Shipwright/soh/soh/Enhancements/randomizer/randomizer_check_tracker.cpp

1640 lines
75 KiB
C++
Raw Normal View History

Randomizer Auto Location tracker (#1942) * Initial Auto-Location Tracking * Updates styling for checked items in Check Tracker * Fixes crashing issues with Check Tracker rendering * Auto scroll Check Tracker windows to current area * Checks Tracker only shows checked locations once in game * Fixes issue where Check Tracker would auto-scroll to wrong location when entering a grotto * Fixes gerudo fortress checks showing in tracker when settings have them removed * InfTable Check Location Fixes: Lost Dog Richard, Rolling Gorons, HBA 1000, Thawed Zora * Fixes most Event Chk Inf Checks on Check Tracker, and Frogs * Check Tracker - Song from Malon now works * Check Tracker - Fixes Claim Check check not tracking - Fixes spoiler for Claim Check check when getting Biggoron's Sword - Fixes LACS being spoiled and not tracking * Check Tracker - Fixes #2 for Skull Mask and Mask of Truth checks * Check Tracker - Adds support for merchants - Fixes #7 for Bomchu Salesman - Fixes #12 for Medigoron * Check Tracker - Fixes #8 for Song from Saria * Check Tracker - Fixes #9 for Adult Shooting Gallery * Check Tracker - Fixes #10 for Composer Grave * Check Tracker - Fixes #14 for Song from Ocarina of Time * Check Tracker - Fixes #16 for Shooting the Sun * Check Tracker - Fixes #19 for Darunia's Joy * Save Editor - Adds missing label for Treasure Chest Game * Check Tracker - Fixes Great Faries checks * Check Tracker - Fixes Sheik at Temple * Check Tracker - Fixes Great Fairy auto-scroll to wrong location * Check Tracker - Updates blue warp checks - Fixes Bongo Bongo and Twinrova checks * Check Tracker - Fixes Dampe's Gravedigging Tour * Check Tracker - Fixes Prescription to King Zora * Check Tracker - Fixes Bazaar showing under wrong area on tracker between adult/child * Check Tracker - Fixes scroll for Hyrule Market and Bazaar * Check Tracker - Fixes giving Adult Trade Items shown on tracker: Broken Sword, Saw, Cojiro, Eyeball Froge, and Eyedrops * Cleans up item_location * Check Tracker - Item List - Fixes item list not updating when changing seeds/options - Separates item exclusion list from item check list - Clean up comments * Check Tracker - Adds Skip functionality to buttons * Check Tracker - Refactors adult trade items to RandomizerInf * Check Tracker - Fixes an issue where any time an item is removed the tracker would cause an application crash * Check Tracker - Item names are now dependent on file language * Check Tracker - Fixes Gerudo Card check not showing in Fast setting * Reorders headers to (hopefully) avoid CI build conflicts on linux/consoles * Explicitly defines vector header in randomizer.h to fix compile errors * Complete Refactor of Check Tracker ImGui * Adds missing check tracker files to CMakeLists * Reverts the Item_location whitespace cleanup from ad10807c * Check Tracker - Loading Fixes - Fixes a bug where loading a save file a second time would add all the checks again - Fixes a bug where the check tracker would not render at all until in a save file * Check Tracker - Fixes a bug where checks would sometimes fail to load * Check Tracker - Fixes duplicated checks when using Only on Pause or Only on Combo * Check Tracker - Works around issue where single characters don't show in EnhancementCombobox, and fixes a label for combo buttons held option * Check Tracker - Applies all Check Tracker changes to Item Location * Check Tracker - Updated Check List - Adds Link's pocket, either in KF or HM depending on starting age - Supports Scrubs and Merchants - Uses enums instead of magic numbers - Updates DC Scrub Short Names for MQ * Check Tracker - Adds a performance mode option * Check Tracker - List Fixes (requires new rando generation) - Fixes Frogs Rupees always visible - Fixes Kokiri Sword Chest not showing - Fixes Weird Egg not showing * Check Tracker - MQ List basic support * Check Tracker - MQ/Vanilla anti-spoilers * Check Tracker - Collecting a compass now spoils the area * Check Tracker - Basic Vanilla Support and fixes - Vanilla items show in check tracker, even if many won't auto check - Fixes an issue with Gerudo Fortress Keys - Refactors IsVisibleInCheckTracker to randomizer_check_tracjer * Check Tracker - Fixes merge conflict from 08a487f35e1d760ab9e69b932edbe4da6bcd9edb * Check Tracker - Fixes tracker loading as Floating when default value is set to Windowed * Randomizer Location Exclusion List - Adds Scrubs, Merchants, Shops. Adult Trade items, MQ Dungeons, and Bean Salesman - Fixes Kokiri Sword Chest, Weird Egg, and Frog Song Rupees from misbehaving - Updates Gerudo Fortress logic to be dependent on Open/Fast/Normal Fortress - Removes Invalid Check - Adds RO Enum for MQ settings - Updates magic values to RO enum * Location Exclusion List - Scrubs that are always randomized now always show on the list * For now, removes some extra code only needed for a Check Tracker. * Randomizer Location Exclusion List - Fixes Eyeball Frog from showing up when Adult Trade Items was off * Location Tracker - Updates Eyedrops to use RandomizerInf instead of Chest * Check Tracker - Fixes a bug where Link's Pocket item wasn't acting as checked for area item count * Check Tracker - Fixes a bug where Locations would incorrectly say Vanilla due to the first check in the area being a non-MQ check * Check Tracker - Fixes a crash when Check Tracker is docked but not visible * Check Tracker - Fixes areas being spoiled when loading different save files * Check Tracker - Only reset variables if they are initialized * Check Tracker - Cleans up old comments, unused variables, methods, and macros, adds language TODOs, * Check Tracker - Readds rainbow UI elements after Cosmetics Editor refactor * Check Tracker - Removal of flag lookup that was refactored, no longer needed header, and some trivial whitespace fixes. * Check Tracker - Refactors Index to Bitmask code to a macro * Check Tracker - Changes ordering from alphabetical to RandomizerCheck ordering * Check Tracker - Wraps everything in a namespace to avoid global variable usage * Check Tracker - Explicitly defines for-loop scope * Check Tracker - refactors dungeon lookup from static array to function * Fixes a bug when using EnhancementColor with alpha * Check Tracker - Refactors all colour to use direct conversions * Check Tracker - refactors settings loading and check visibility for readability * Check Tracker - Fixes a bug where the wrong label showed on the Check Tracker BG Color * UIWidgets - Adds Alpha bar to EnhancementColor when using alpha parameter
2022-12-10 22:39:23 -05:00
#include "randomizer_check_tracker.h"
Check Tracker Update (#2668) * Initial commit. What works so far: Data file loads, saves, deletes, and is created properly. - Need to run `HasItemBeenCollected` when creating in case of mid-seed regen. Organized checks into maps set by area. Areas show in tracker. - Checks pulled from checkObjectsByArea are not currently listed. - Areas are being assumed completed and hidden at the start. * Checks now populate. Still not counting area totals properly. * Don't track RC_LINKS_POCKET in the data file, and instead manually add it in every time a save is load. rcObjects doesn't contain Link's Pocket location (duh). * Moved ItemReceive hook to randomizer_check_tracker.cpp. Skipped items are properly sorted and formatted. Saved items contribute to an area's gotten/skipped checks on load. Changed skipped items default main color to gray. General code cleanup. * Skipped checks now contribute to area totals for area completion logic. * Mid-menu rework transfer. * Started check lookup on item receive. Tried to enable scum checking on save. * Fixed scum check on save. * More code cleanup, which revealed some issues with loading and saving. Loading now works 100%, but entries in checkTrackerData are disappearing in code somewhere, causing issues with later checks. Scummed color now displays properly. Collected but unsaved displays properly. Unchecked, Skipped, Seen and Scummed checks all have arrows for skipping/unskipping. Counts a little messed up, probably double adding skips. * Fixed item counts being off across resets. Restarts were fine. * Beginning of rework for individual check updates. Adds `Actor lastCheck` to PlayState to allow assigning of last actor to give an item. This allows precise tracking of GS, freestanding PoH, etc. Works for chests too. Currently does not work for shops, unknown for normal NPC gives. Doesn't track last gives for non-checks, like drops from grass, pots, crates, etc. * Actor-based checks fully fleshed out, but can't help with sale-based checks. Implemented `pendingSaleCheck` to back out of an RC check cycle if `gSaveContext->pendingSale` is not NONE when `OnItemReceive` is called, processed through `OnSaleEnd`. This should be the final change necessary to streamline the checks. * Temporary hook to message box close to tie in trackers for non-gs/chest actors that aren't added to `GetCheckFromActor`. This triggers a 2-frame countdown to check with `HasItemBeenCollected` since half of the methods in there aren't updated until after a text box closes. Added scene tracking to get last scene so that checks in scenes that span several overworld areas could be tied to their areas properly. Modified tracker data creation to apply Link's Pocket and Song from Impa conditionally based on randomizer settings instead of just being assumed to be done. May need modification for checking click and drag spoiler loading. Removed the scene equivalence check from CheckChecks so that an entire area is checked each time to avoid issues with, e.g., leaving a shop before a pending sale finishes. * Changed check data creation to use RSKs from gRandomizer to account for settings loaded from drag and drop spoilers. * Beginning of tracker code organization. Changed check color defaults. * Reverted moving tracker colors to header. Some individual check fixes. * Missed something from previous merge? * Removed last remnant of removed performance mode. * Better handle checking when skullsanity is off. * Song checks sceneIDs don't match the scenes they're actually in for some reason. Removed that check. * SaleEnd checks don't need the GetItemEntry parameter. Also set a flag that should prevent the check tracker from running during vanilla saves should that not be resolved by the time it's merged. * Attempting to have only the relevant checks added to the tracker data, as well as showing vanilla checks for non-rando saves. Not working yet (everything is displayed in vanilla). * Added vanilla check tracker population via `vanillaCheck` bool in `RandomizerCheckObject`. This is also added to `IsVisibleInImGui` to handle file loading and saving to eliminate checks that aren't part of vanilla or the rando seed. Implemented deleted tracker data file recreation. Added some extra item name text checks. Songs are still... tricky, so they stay blank. Utilize local copies of the randomizer check objects that are applicable for performance purposes. Fixed vanilla item-giving cutscene crashes when triggered mid-transition. * Apparently not all toolchains can handle macro instantiation without all parameters, like VS can. * Fixed scummed detail color not showing properly on tracker. * Fixed dungeon area totals and GS checks not functioning properly. * Major revamp of checking code. Doesn't rely on `GetCheckFromActor` at all anymore, but instead simply sets a flag to evaluate a number of checks in an area every frame until the check that was gotten is identified. With the new setup, it's much less hardware intensive, and at 60fps 6 checks per frame shows no noticeable effect on framerate. I can envision needing to add a collectedCount in order to account for times when two checks are gotten one right after the other. Changed area scroll to happen from `OnTransitionEnd`, and allow for scrolling in bazaar (was disabled previously because it would jump back and forth between Kak and Market while you were in one). Also setup area check order updating by area instead of all at the same time. * Fixed shooting gallery not reporting proper area. Prevent checks from actually happening if area is RCAREA_INVALID, now that all areas are reporting something if they have checks. Fixed `GetCheckArea()` not updating checks for standard scenes. Lots of vanilla tracking updates, mainly manual checks for gems, medallions and songs, since the often don't have proper scenes in the data. Prevent vanilla from triggering check loops if junk items are collected. Fixed sorting based on saved vs collected. Prevent item name display for vanilla runs. Change coloring of checks so the check name reflects status in vanilla runs. * Fixed "Recheck Area" button erroneously adding to an area's check totals? * Fix DMC vanilla checks. * Fix check tracker data recreation on data file loss. Removed redundant file exists check from SaveTrackerDataHook, as it doesn't matter if it exists or not at that point. Limited check loops to 3 to avoid infinite check loops on non-check/junk item pickup. Added more checks to disable tracker operations if a save is not running. Changed check ordering to put boss reward and heart container checks at the end of whatever RCSHOW group they belong to. * Fixed IsRunning calculation. Further improving vanilla checking. Starting framework for checking medallions, stones, and songs on data file recreation. Fixed medallion check collection. Added GIFT_FROM_SAGES to check list for vanilla file for tracking light medallion. Added check loop limitation to prevent infinite checking after picking up junk item from the ground. * Finished vanilla file recreation and recheck (songs and dungeon rewards all check properly now). This includes deku shield with KF shop item 3. Finished Gift from Raoru light medallion tracking for vanilla. Commented all CheckByScene functionality for now. * Fixed new save data file creation. Disabled entrance area calculation for now, as it only tracks the previous entrance for some reason. Fixed area detection for ToT checks. * GetCheckArea() now utilizes EntranceData almost exclusively, via either `gSaveContext.entranceIndex` or the entrance tracker's `currentGrottoId` in the case of grottos. This also means that EVERYTHING CAN AUTOSCROLL NOW. Entrance shuffles are now much easier to track. Autoscroll is now also triggered on save, just in case someone isn't autosaving and has a lot of checks that get converted to saved. * Fixed missing GS check in LW. * Added area scroll on toggling Show Hidden Items. May configure differently later. Fixed area detection for entrances in Gerudo Fortress/Valley and Collossus. Haunted wasteland doesn't autoscroll due to a bug in `OnTransitionEnd` hook, but checks still evaluate properly there. Rely on scene-based area detection if scene is a main overworld or dungeon scene. * Fixed grotto detection when shuffle is off. * Small code cleanup. Fixed Colossus hand chest checks. * Missing lus bump from merge conflict resolution * Fixed Colossus Grotto making `GetCheckArea` return Wasteland. * Improved OnItemReceive processing for non-token GS checks, since they can sometimes take long enough for the checking process to time out before the item is registered as received. * First attempt at thread safety for tracker data file writing. Seems to work, but might need more testing. * Fixed Recheck Area not unskipping items that register as saved. Improved delayed saving with autosaving, as the autosave triggered quite often before the tracker data save, making things not properly register as saved. * merge cleanup * Converted check tracker data to the sectional saves, adding `CheckTrackerData` to `SaveContext`. Implemented section ID returning and fullSave boolean passing to section functions from my PR temporarily for it to work properly. Moved `RandomizerCheckTrackerData` enum to `randomizerTypes.h` to accommodate that. Changed `Randomizer_SaveInit` to a `SaveManager::InitFunc` to allow for other randomizer-dependent sections to be initialized after that. Required a little refactoring to maintain intro cutscene skip when starting a randomizer file. * Revert section index return and randomizer init changes. Will need to wait on yet more changes to main. * Fixed check tracker initialization (shouldn't be tied to window initialization), restored saving/loading functionality. * Removed `CheckTracker::Init` and put SaveManager calls in `CheckTrackerWindow::InitElement`. Also a bit of cleanup from transition back to save file use. * Fixed tracker displaying check categories while file not loaded. * Fix Darunia's Joy check not marking in vanilla. * Fix autosave not triggering change from collected to saved in tracker data. * Changed default colors for scummed and collected display. * Merge upgrade code cleanup. * Add `OnTransitionEnd` calls to sandstorm transitions both to and from Wasteland. Also improved `gSaveContext.lastScene` assignment for both transition types. Allowed a bit of cleanup in `GetCheckArea`. * Added `StateButton`, a button like `ArrowButton` but that allows text instead of arrow icons. Apparently the changes from ArrowButton to StateButton happened in a previous commit... * Changed section name to `trackerDataCheck` to force SoH to load it after the randomizer section, as it required some randoSettings to be loaded first, and nothing else I tried to make the randomizer section load before it worked. This hacks a solution to checks not displaying on fast file load to a specific slot. F*** you, SaveManager, and f*** you too, JSON. * Forgot to change the section string for loading with the name change. * Fix check ordering for checks that trigger the autosave. * Adds option to remove right-side shop items (slots 1-4) from the tracker list. Enabled by default. * Fix default state of Hide Shop Right Checks checkbox. * Fixes grotto and great fairy scrolling and checks. Fixes array overflow from `checkTrackerData` which was creating the issue trying to load the base and randomizer sections first, among other things. That also fixed the massive file loads that were being exhibited in debug mode. * Fix shooting galleries being set as collected again when being played a second time after getting the checks. * Fix Bazaar autoscroll. * Add Saria's Song to `GetCheckFromActor` and removed some limitations from the messageCloseCheck function to make that check track properly. * Fix Song from Impa check. Implemented prevention for multiple "collections" of great fairies, just in case getting the health refill would trigger it with the previous setup. * Fix ice traps on GS tokens not triggering OnItemReceive. * Complete fix for ice trap collection from GS. Add autoscroll when clicking "Expand All". * Add `OnShopSlotChange` with cursorSlot and basePrice parameters. * Fixed include in en_ossan for shop slot hook. Added registration for `OnShopSlotChange` in the tracker, storing the price in a new `price` field in `CheckTrackerData`. Added "seen" functionality to shop checks. Displays the model item name upon first entering a shop, adding the price and switching to trickName (if it's an ice trap) upon navigating to the slot in buy mode, triggered by an invisible "identified" status that mirrors "seen" in every other way. Added tooltips to most options for check tracker color picking to describe what each status actually means. * `std::format` pls * So apparently std::format just decided to break with the latest merge from develop, but fmt::format exists and works? * Removed the last vestiges of `locationsSkipped`. Other general code and formatting cleanups. Moved `IsGameRunning` to `OTRGlobals` so the item tracker could also access it. Used preceding to "fix" item and bottle display in the item tracker on startup. * Some more code cleanup. Removed "Recheck Area" button and relevant code. Backported changes to Anchor branch applicable for single-player, including making a checkAreas vector and structuring the frame by frame checks around that. Also includes fix for Silver Gauntlets and Mirror Shield check collection crash associated with those changes. Fixed Kakariko Bazaar "seen" updates. Fixed tracker window not showing on initial load like it should. * Forgot 1 formatting fix. * Removed conditions for showing Song from Impa (isn't junk under certain conditions, so should show all the time). * Fix vanilla checks, add Zelda's Letter and Malon's Egg to manual check collection. Fix autoscroll while in child stealth section. * Fix crash in Happy Mask Shop in OnSlotChange (referenced non-existent shop id in a tracker-specific enum). * General code cleanup. * Missed one reversion. * One more. * Fix column alignment in `randomizer_check_objects`. * Fix file encoding on `randomizer_check_tracker`. Again. * Fix indentation for `actualItemtrackerItemMap`. Also removed unnecessary parts of the map. * Rename `HasEqItem` to `HasEquipment`. * Slightly better indentation for `actualItemTrackerItemMap`. * Add magic bean salesman to vanilla check tracking, and genericized deku shield to trigger KF shop item 3 wherever you get the shield. Renamed `vanillaCheck` to `vanillaHundoCheck` to (supposedly) clarify the meaning of the usage. * One more rename to `vanillaCompletion` to avoid possible confusion with 100% speedrun conditions. * give me a break XD Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * Changes suggested by briaguya (rename `RandomizerCheckShow` to `Status`, unused code, newline formatting) * Remove unused `itemNames` table. * Remove `IsGameRunning` in favor of `GameInteractor::IsSaveLoaded`. * Restore anti-spoiler functionality for dungeons with dungeon maps. * Review cleanup. * Fix prices not showing for Kak bazaar items. --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com>
2023-10-04 11:03:36 -04:00
#include "randomizer_entrance_tracker.h"
#include "randomizer_item_tracker.h"
#include "randomizerTypes.h"
Randomizer Auto Location tracker (#1942) * Initial Auto-Location Tracking * Updates styling for checked items in Check Tracker * Fixes crashing issues with Check Tracker rendering * Auto scroll Check Tracker windows to current area * Checks Tracker only shows checked locations once in game * Fixes issue where Check Tracker would auto-scroll to wrong location when entering a grotto * Fixes gerudo fortress checks showing in tracker when settings have them removed * InfTable Check Location Fixes: Lost Dog Richard, Rolling Gorons, HBA 1000, Thawed Zora * Fixes most Event Chk Inf Checks on Check Tracker, and Frogs * Check Tracker - Song from Malon now works * Check Tracker - Fixes Claim Check check not tracking - Fixes spoiler for Claim Check check when getting Biggoron's Sword - Fixes LACS being spoiled and not tracking * Check Tracker - Fixes #2 for Skull Mask and Mask of Truth checks * Check Tracker - Adds support for merchants - Fixes #7 for Bomchu Salesman - Fixes #12 for Medigoron * Check Tracker - Fixes #8 for Song from Saria * Check Tracker - Fixes #9 for Adult Shooting Gallery * Check Tracker - Fixes #10 for Composer Grave * Check Tracker - Fixes #14 for Song from Ocarina of Time * Check Tracker - Fixes #16 for Shooting the Sun * Check Tracker - Fixes #19 for Darunia's Joy * Save Editor - Adds missing label for Treasure Chest Game * Check Tracker - Fixes Great Faries checks * Check Tracker - Fixes Sheik at Temple * Check Tracker - Fixes Great Fairy auto-scroll to wrong location * Check Tracker - Updates blue warp checks - Fixes Bongo Bongo and Twinrova checks * Check Tracker - Fixes Dampe's Gravedigging Tour * Check Tracker - Fixes Prescription to King Zora * Check Tracker - Fixes Bazaar showing under wrong area on tracker between adult/child * Check Tracker - Fixes scroll for Hyrule Market and Bazaar * Check Tracker - Fixes giving Adult Trade Items shown on tracker: Broken Sword, Saw, Cojiro, Eyeball Froge, and Eyedrops * Cleans up item_location * Check Tracker - Item List - Fixes item list not updating when changing seeds/options - Separates item exclusion list from item check list - Clean up comments * Check Tracker - Adds Skip functionality to buttons * Check Tracker - Refactors adult trade items to RandomizerInf * Check Tracker - Fixes an issue where any time an item is removed the tracker would cause an application crash * Check Tracker - Item names are now dependent on file language * Check Tracker - Fixes Gerudo Card check not showing in Fast setting * Reorders headers to (hopefully) avoid CI build conflicts on linux/consoles * Explicitly defines vector header in randomizer.h to fix compile errors * Complete Refactor of Check Tracker ImGui * Adds missing check tracker files to CMakeLists * Reverts the Item_location whitespace cleanup from ad10807c * Check Tracker - Loading Fixes - Fixes a bug where loading a save file a second time would add all the checks again - Fixes a bug where the check tracker would not render at all until in a save file * Check Tracker - Fixes a bug where checks would sometimes fail to load * Check Tracker - Fixes duplicated checks when using Only on Pause or Only on Combo * Check Tracker - Works around issue where single characters don't show in EnhancementCombobox, and fixes a label for combo buttons held option * Check Tracker - Applies all Check Tracker changes to Item Location * Check Tracker - Updated Check List - Adds Link's pocket, either in KF or HM depending on starting age - Supports Scrubs and Merchants - Uses enums instead of magic numbers - Updates DC Scrub Short Names for MQ * Check Tracker - Adds a performance mode option * Check Tracker - List Fixes (requires new rando generation) - Fixes Frogs Rupees always visible - Fixes Kokiri Sword Chest not showing - Fixes Weird Egg not showing * Check Tracker - MQ List basic support * Check Tracker - MQ/Vanilla anti-spoilers * Check Tracker - Collecting a compass now spoils the area * Check Tracker - Basic Vanilla Support and fixes - Vanilla items show in check tracker, even if many won't auto check - Fixes an issue with Gerudo Fortress Keys - Refactors IsVisibleInCheckTracker to randomizer_check_tracjer * Check Tracker - Fixes merge conflict from 08a487f35e1d760ab9e69b932edbe4da6bcd9edb * Check Tracker - Fixes tracker loading as Floating when default value is set to Windowed * Randomizer Location Exclusion List - Adds Scrubs, Merchants, Shops. Adult Trade items, MQ Dungeons, and Bean Salesman - Fixes Kokiri Sword Chest, Weird Egg, and Frog Song Rupees from misbehaving - Updates Gerudo Fortress logic to be dependent on Open/Fast/Normal Fortress - Removes Invalid Check - Adds RO Enum for MQ settings - Updates magic values to RO enum * Location Exclusion List - Scrubs that are always randomized now always show on the list * For now, removes some extra code only needed for a Check Tracker. * Randomizer Location Exclusion List - Fixes Eyeball Frog from showing up when Adult Trade Items was off * Location Tracker - Updates Eyedrops to use RandomizerInf instead of Chest * Check Tracker - Fixes a bug where Link's Pocket item wasn't acting as checked for area item count * Check Tracker - Fixes a bug where Locations would incorrectly say Vanilla due to the first check in the area being a non-MQ check * Check Tracker - Fixes a crash when Check Tracker is docked but not visible * Check Tracker - Fixes areas being spoiled when loading different save files * Check Tracker - Only reset variables if they are initialized * Check Tracker - Cleans up old comments, unused variables, methods, and macros, adds language TODOs, * Check Tracker - Readds rainbow UI elements after Cosmetics Editor refactor * Check Tracker - Removal of flag lookup that was refactored, no longer needed header, and some trivial whitespace fixes. * Check Tracker - Refactors Index to Bitmask code to a macro * Check Tracker - Changes ordering from alphabetical to RandomizerCheck ordering * Check Tracker - Wraps everything in a namespace to avoid global variable usage * Check Tracker - Explicitly defines for-loop scope * Check Tracker - refactors dungeon lookup from static array to function * Fixes a bug when using EnhancementColor with alpha * Check Tracker - Refactors all colour to use direct conversions * Check Tracker - refactors settings loading and check visibility for readability * Check Tracker - Fixes a bug where the wrong label showed on the Check Tracker BG Color * UIWidgets - Adds Alpha bar to EnhancementColor when using alpha parameter
2022-12-10 22:39:23 -05:00
#include "../../OTRGlobals.h"
#include "../../UIWidgets.hpp"
#include <string>
#include <vector>
#include <set>
build soh with LUS 1.0.0 (#2881) * Bump LUS * Ship -> LUS namespace change * z_scene_otr Ship -> LUS namespace * Starting to get SoH to build with LUS imgui changes. * start stuff * gamecontroleditor build issues resolved maybe * cosmetics editor and what not * console * actor viewer * more stuff * more stuff * on to errors that make sense * putting this down for a bit * no idea what these errors mean now * some kind of progress maybe * latest lus main * more * back to linker errors and being lost * Fixes command function signature. * More fixes * Even more fixes * Bump LUS * More Fixes. * Fixes even more errors. * lus bump * input editor as var * audio editor working * it builds with this * bump lus * it opens * bump lus to latest main again * make sure to do all the command registering in debugconsole * lus and what not * switch type stuff plz * undo * do the thing that fixes the thing * fix mac? * correctly show/hide menubar on boot * bump lus * input blocking updates * bump lus * Bump LUS * Press F1 to open enhancement menus moved to SoH * lus and rendering backend stuff * audio backend and lus * Bump LUS * Fixes WindowBackend dropdown * Bump LUS * misc -> utils and moves binarytools to utils. * Window refactor * bump lus * make it work * Fixes for moved files again * Bump LUS * Mercury -> Config * Bump LUS * Reacts to removed LUS hooks and bump LUS * Remove Hook: GfxInit * Removes debug audio_setgamevolume to 1 * use non-crashing branch of lus * fix: make audio init work without hooks * game icon stuff * multifix bmp * use input viewer class branch for now * just "Ship" it's cleaner * Bump LUS * Removed ExitGame hook. * Bump LUS * Hook system removed from LUS. * More LUS updates * Changes to make window position saving. * Bump LUS * Bump LUS (for real) * LUS resources now return a specialized pointer. * Bump LUS * Fixes issue in SetPathways::GetPointerSize * Bump LUS to 1.0.0 * builds but crashes * fix crash * better macro names in debug console * remove commeted out line * remove redundant check tracker settings window logic * remove commented out line * move the * * remove extra seqplayers enum def * this sneaky little guy was hiding behind a wii u ifdef * remove extra check tracker header --------- Co-authored-by: Kenix <kenixwhisperwind@gmail.com> Co-authored-by: briaguya <briaguya@alice>
2023-06-03 15:27:45 -04:00
#include <libultraship/libultraship.h>
Randomizer Auto Location tracker (#1942) * Initial Auto-Location Tracking * Updates styling for checked items in Check Tracker * Fixes crashing issues with Check Tracker rendering * Auto scroll Check Tracker windows to current area * Checks Tracker only shows checked locations once in game * Fixes issue where Check Tracker would auto-scroll to wrong location when entering a grotto * Fixes gerudo fortress checks showing in tracker when settings have them removed * InfTable Check Location Fixes: Lost Dog Richard, Rolling Gorons, HBA 1000, Thawed Zora * Fixes most Event Chk Inf Checks on Check Tracker, and Frogs * Check Tracker - Song from Malon now works * Check Tracker - Fixes Claim Check check not tracking - Fixes spoiler for Claim Check check when getting Biggoron's Sword - Fixes LACS being spoiled and not tracking * Check Tracker - Fixes #2 for Skull Mask and Mask of Truth checks * Check Tracker - Adds support for merchants - Fixes #7 for Bomchu Salesman - Fixes #12 for Medigoron * Check Tracker - Fixes #8 for Song from Saria * Check Tracker - Fixes #9 for Adult Shooting Gallery * Check Tracker - Fixes #10 for Composer Grave * Check Tracker - Fixes #14 for Song from Ocarina of Time * Check Tracker - Fixes #16 for Shooting the Sun * Check Tracker - Fixes #19 for Darunia's Joy * Save Editor - Adds missing label for Treasure Chest Game * Check Tracker - Fixes Great Faries checks * Check Tracker - Fixes Sheik at Temple * Check Tracker - Fixes Great Fairy auto-scroll to wrong location * Check Tracker - Updates blue warp checks - Fixes Bongo Bongo and Twinrova checks * Check Tracker - Fixes Dampe's Gravedigging Tour * Check Tracker - Fixes Prescription to King Zora * Check Tracker - Fixes Bazaar showing under wrong area on tracker between adult/child * Check Tracker - Fixes scroll for Hyrule Market and Bazaar * Check Tracker - Fixes giving Adult Trade Items shown on tracker: Broken Sword, Saw, Cojiro, Eyeball Froge, and Eyedrops * Cleans up item_location * Check Tracker - Item List - Fixes item list not updating when changing seeds/options - Separates item exclusion list from item check list - Clean up comments * Check Tracker - Adds Skip functionality to buttons * Check Tracker - Refactors adult trade items to RandomizerInf * Check Tracker - Fixes an issue where any time an item is removed the tracker would cause an application crash * Check Tracker - Item names are now dependent on file language * Check Tracker - Fixes Gerudo Card check not showing in Fast setting * Reorders headers to (hopefully) avoid CI build conflicts on linux/consoles * Explicitly defines vector header in randomizer.h to fix compile errors * Complete Refactor of Check Tracker ImGui * Adds missing check tracker files to CMakeLists * Reverts the Item_location whitespace cleanup from ad10807c * Check Tracker - Loading Fixes - Fixes a bug where loading a save file a second time would add all the checks again - Fixes a bug where the check tracker would not render at all until in a save file * Check Tracker - Fixes a bug where checks would sometimes fail to load * Check Tracker - Fixes duplicated checks when using Only on Pause or Only on Combo * Check Tracker - Works around issue where single characters don't show in EnhancementCombobox, and fixes a label for combo buttons held option * Check Tracker - Applies all Check Tracker changes to Item Location * Check Tracker - Updated Check List - Adds Link's pocket, either in KF or HM depending on starting age - Supports Scrubs and Merchants - Uses enums instead of magic numbers - Updates DC Scrub Short Names for MQ * Check Tracker - Adds a performance mode option * Check Tracker - List Fixes (requires new rando generation) - Fixes Frogs Rupees always visible - Fixes Kokiri Sword Chest not showing - Fixes Weird Egg not showing * Check Tracker - MQ List basic support * Check Tracker - MQ/Vanilla anti-spoilers * Check Tracker - Collecting a compass now spoils the area * Check Tracker - Basic Vanilla Support and fixes - Vanilla items show in check tracker, even if many won't auto check - Fixes an issue with Gerudo Fortress Keys - Refactors IsVisibleInCheckTracker to randomizer_check_tracjer * Check Tracker - Fixes merge conflict from 08a487f35e1d760ab9e69b932edbe4da6bcd9edb * Check Tracker - Fixes tracker loading as Floating when default value is set to Windowed * Randomizer Location Exclusion List - Adds Scrubs, Merchants, Shops. Adult Trade items, MQ Dungeons, and Bean Salesman - Fixes Kokiri Sword Chest, Weird Egg, and Frog Song Rupees from misbehaving - Updates Gerudo Fortress logic to be dependent on Open/Fast/Normal Fortress - Removes Invalid Check - Adds RO Enum for MQ settings - Updates magic values to RO enum * Location Exclusion List - Scrubs that are always randomized now always show on the list * For now, removes some extra code only needed for a Check Tracker. * Randomizer Location Exclusion List - Fixes Eyeball Frog from showing up when Adult Trade Items was off * Location Tracker - Updates Eyedrops to use RandomizerInf instead of Chest * Check Tracker - Fixes a bug where Link's Pocket item wasn't acting as checked for area item count * Check Tracker - Fixes a bug where Locations would incorrectly say Vanilla due to the first check in the area being a non-MQ check * Check Tracker - Fixes a crash when Check Tracker is docked but not visible * Check Tracker - Fixes areas being spoiled when loading different save files * Check Tracker - Only reset variables if they are initialized * Check Tracker - Cleans up old comments, unused variables, methods, and macros, adds language TODOs, * Check Tracker - Readds rainbow UI elements after Cosmetics Editor refactor * Check Tracker - Removal of flag lookup that was refactored, no longer needed header, and some trivial whitespace fixes. * Check Tracker - Refactors Index to Bitmask code to a macro * Check Tracker - Changes ordering from alphabetical to RandomizerCheck ordering * Check Tracker - Wraps everything in a namespace to avoid global variable usage * Check Tracker - Explicitly defines for-loop scope * Check Tracker - refactors dungeon lookup from static array to function * Fixes a bug when using EnhancementColor with alpha * Check Tracker - Refactors all colour to use direct conversions * Check Tracker - refactors settings loading and check visibility for readability * Check Tracker - Fixes a bug where the wrong label showed on the Check Tracker BG Color * UIWidgets - Adds Alpha bar to EnhancementColor when using alpha parameter
2022-12-10 22:39:23 -05:00
#include "3drando/item_location.hpp"
build soh with LUS 1.0.0 (#2881) * Bump LUS * Ship -> LUS namespace change * z_scene_otr Ship -> LUS namespace * Starting to get SoH to build with LUS imgui changes. * start stuff * gamecontroleditor build issues resolved maybe * cosmetics editor and what not * console * actor viewer * more stuff * more stuff * on to errors that make sense * putting this down for a bit * no idea what these errors mean now * some kind of progress maybe * latest lus main * more * back to linker errors and being lost * Fixes command function signature. * More fixes * Even more fixes * Bump LUS * More Fixes. * Fixes even more errors. * lus bump * input editor as var * audio editor working * it builds with this * bump lus * it opens * bump lus to latest main again * make sure to do all the command registering in debugconsole * lus and what not * switch type stuff plz * undo * do the thing that fixes the thing * fix mac? * correctly show/hide menubar on boot * bump lus * input blocking updates * bump lus * Bump LUS * Press F1 to open enhancement menus moved to SoH * lus and rendering backend stuff * audio backend and lus * Bump LUS * Fixes WindowBackend dropdown * Bump LUS * misc -> utils and moves binarytools to utils. * Window refactor * bump lus * make it work * Fixes for moved files again * Bump LUS * Mercury -> Config * Bump LUS * Reacts to removed LUS hooks and bump LUS * Remove Hook: GfxInit * Removes debug audio_setgamevolume to 1 * use non-crashing branch of lus * fix: make audio init work without hooks * game icon stuff * multifix bmp * use input viewer class branch for now * just "Ship" it's cleaner * Bump LUS * Removed ExitGame hook. * Bump LUS * Hook system removed from LUS. * More LUS updates * Changes to make window position saving. * Bump LUS * Bump LUS (for real) * LUS resources now return a specialized pointer. * Bump LUS * Fixes issue in SetPathways::GetPointerSize * Bump LUS to 1.0.0 * builds but crashes * fix crash * better macro names in debug console * remove commeted out line * remove redundant check tracker settings window logic * remove commented out line * move the * * remove extra seqplayers enum def * this sneaky little guy was hiding behind a wii u ifdef * remove extra check tracker header --------- Co-authored-by: Kenix <kenixwhisperwind@gmail.com> Co-authored-by: briaguya <briaguya@alice>
2023-06-03 15:27:45 -04:00
#include "soh/Enhancements/game-interactor/GameInteractor.h"
Check Tracker Update (#2668) * Initial commit. What works so far: Data file loads, saves, deletes, and is created properly. - Need to run `HasItemBeenCollected` when creating in case of mid-seed regen. Organized checks into maps set by area. Areas show in tracker. - Checks pulled from checkObjectsByArea are not currently listed. - Areas are being assumed completed and hidden at the start. * Checks now populate. Still not counting area totals properly. * Don't track RC_LINKS_POCKET in the data file, and instead manually add it in every time a save is load. rcObjects doesn't contain Link's Pocket location (duh). * Moved ItemReceive hook to randomizer_check_tracker.cpp. Skipped items are properly sorted and formatted. Saved items contribute to an area's gotten/skipped checks on load. Changed skipped items default main color to gray. General code cleanup. * Skipped checks now contribute to area totals for area completion logic. * Mid-menu rework transfer. * Started check lookup on item receive. Tried to enable scum checking on save. * Fixed scum check on save. * More code cleanup, which revealed some issues with loading and saving. Loading now works 100%, but entries in checkTrackerData are disappearing in code somewhere, causing issues with later checks. Scummed color now displays properly. Collected but unsaved displays properly. Unchecked, Skipped, Seen and Scummed checks all have arrows for skipping/unskipping. Counts a little messed up, probably double adding skips. * Fixed item counts being off across resets. Restarts were fine. * Beginning of rework for individual check updates. Adds `Actor lastCheck` to PlayState to allow assigning of last actor to give an item. This allows precise tracking of GS, freestanding PoH, etc. Works for chests too. Currently does not work for shops, unknown for normal NPC gives. Doesn't track last gives for non-checks, like drops from grass, pots, crates, etc. * Actor-based checks fully fleshed out, but can't help with sale-based checks. Implemented `pendingSaleCheck` to back out of an RC check cycle if `gSaveContext->pendingSale` is not NONE when `OnItemReceive` is called, processed through `OnSaleEnd`. This should be the final change necessary to streamline the checks. * Temporary hook to message box close to tie in trackers for non-gs/chest actors that aren't added to `GetCheckFromActor`. This triggers a 2-frame countdown to check with `HasItemBeenCollected` since half of the methods in there aren't updated until after a text box closes. Added scene tracking to get last scene so that checks in scenes that span several overworld areas could be tied to their areas properly. Modified tracker data creation to apply Link's Pocket and Song from Impa conditionally based on randomizer settings instead of just being assumed to be done. May need modification for checking click and drag spoiler loading. Removed the scene equivalence check from CheckChecks so that an entire area is checked each time to avoid issues with, e.g., leaving a shop before a pending sale finishes. * Changed check data creation to use RSKs from gRandomizer to account for settings loaded from drag and drop spoilers. * Beginning of tracker code organization. Changed check color defaults. * Reverted moving tracker colors to header. Some individual check fixes. * Missed something from previous merge? * Removed last remnant of removed performance mode. * Better handle checking when skullsanity is off. * Song checks sceneIDs don't match the scenes they're actually in for some reason. Removed that check. * SaleEnd checks don't need the GetItemEntry parameter. Also set a flag that should prevent the check tracker from running during vanilla saves should that not be resolved by the time it's merged. * Attempting to have only the relevant checks added to the tracker data, as well as showing vanilla checks for non-rando saves. Not working yet (everything is displayed in vanilla). * Added vanilla check tracker population via `vanillaCheck` bool in `RandomizerCheckObject`. This is also added to `IsVisibleInImGui` to handle file loading and saving to eliminate checks that aren't part of vanilla or the rando seed. Implemented deleted tracker data file recreation. Added some extra item name text checks. Songs are still... tricky, so they stay blank. Utilize local copies of the randomizer check objects that are applicable for performance purposes. Fixed vanilla item-giving cutscene crashes when triggered mid-transition. * Apparently not all toolchains can handle macro instantiation without all parameters, like VS can. * Fixed scummed detail color not showing properly on tracker. * Fixed dungeon area totals and GS checks not functioning properly. * Major revamp of checking code. Doesn't rely on `GetCheckFromActor` at all anymore, but instead simply sets a flag to evaluate a number of checks in an area every frame until the check that was gotten is identified. With the new setup, it's much less hardware intensive, and at 60fps 6 checks per frame shows no noticeable effect on framerate. I can envision needing to add a collectedCount in order to account for times when two checks are gotten one right after the other. Changed area scroll to happen from `OnTransitionEnd`, and allow for scrolling in bazaar (was disabled previously because it would jump back and forth between Kak and Market while you were in one). Also setup area check order updating by area instead of all at the same time. * Fixed shooting gallery not reporting proper area. Prevent checks from actually happening if area is RCAREA_INVALID, now that all areas are reporting something if they have checks. Fixed `GetCheckArea()` not updating checks for standard scenes. Lots of vanilla tracking updates, mainly manual checks for gems, medallions and songs, since the often don't have proper scenes in the data. Prevent vanilla from triggering check loops if junk items are collected. Fixed sorting based on saved vs collected. Prevent item name display for vanilla runs. Change coloring of checks so the check name reflects status in vanilla runs. * Fixed "Recheck Area" button erroneously adding to an area's check totals? * Fix DMC vanilla checks. * Fix check tracker data recreation on data file loss. Removed redundant file exists check from SaveTrackerDataHook, as it doesn't matter if it exists or not at that point. Limited check loops to 3 to avoid infinite check loops on non-check/junk item pickup. Added more checks to disable tracker operations if a save is not running. Changed check ordering to put boss reward and heart container checks at the end of whatever RCSHOW group they belong to. * Fixed IsRunning calculation. Further improving vanilla checking. Starting framework for checking medallions, stones, and songs on data file recreation. Fixed medallion check collection. Added GIFT_FROM_SAGES to check list for vanilla file for tracking light medallion. Added check loop limitation to prevent infinite checking after picking up junk item from the ground. * Finished vanilla file recreation and recheck (songs and dungeon rewards all check properly now). This includes deku shield with KF shop item 3. Finished Gift from Raoru light medallion tracking for vanilla. Commented all CheckByScene functionality for now. * Fixed new save data file creation. Disabled entrance area calculation for now, as it only tracks the previous entrance for some reason. Fixed area detection for ToT checks. * GetCheckArea() now utilizes EntranceData almost exclusively, via either `gSaveContext.entranceIndex` or the entrance tracker's `currentGrottoId` in the case of grottos. This also means that EVERYTHING CAN AUTOSCROLL NOW. Entrance shuffles are now much easier to track. Autoscroll is now also triggered on save, just in case someone isn't autosaving and has a lot of checks that get converted to saved. * Fixed missing GS check in LW. * Added area scroll on toggling Show Hidden Items. May configure differently later. Fixed area detection for entrances in Gerudo Fortress/Valley and Collossus. Haunted wasteland doesn't autoscroll due to a bug in `OnTransitionEnd` hook, but checks still evaluate properly there. Rely on scene-based area detection if scene is a main overworld or dungeon scene. * Fixed grotto detection when shuffle is off. * Small code cleanup. Fixed Colossus hand chest checks. * Missing lus bump from merge conflict resolution * Fixed Colossus Grotto making `GetCheckArea` return Wasteland. * Improved OnItemReceive processing for non-token GS checks, since they can sometimes take long enough for the checking process to time out before the item is registered as received. * First attempt at thread safety for tracker data file writing. Seems to work, but might need more testing. * Fixed Recheck Area not unskipping items that register as saved. Improved delayed saving with autosaving, as the autosave triggered quite often before the tracker data save, making things not properly register as saved. * merge cleanup * Converted check tracker data to the sectional saves, adding `CheckTrackerData` to `SaveContext`. Implemented section ID returning and fullSave boolean passing to section functions from my PR temporarily for it to work properly. Moved `RandomizerCheckTrackerData` enum to `randomizerTypes.h` to accommodate that. Changed `Randomizer_SaveInit` to a `SaveManager::InitFunc` to allow for other randomizer-dependent sections to be initialized after that. Required a little refactoring to maintain intro cutscene skip when starting a randomizer file. * Revert section index return and randomizer init changes. Will need to wait on yet more changes to main. * Fixed check tracker initialization (shouldn't be tied to window initialization), restored saving/loading functionality. * Removed `CheckTracker::Init` and put SaveManager calls in `CheckTrackerWindow::InitElement`. Also a bit of cleanup from transition back to save file use. * Fixed tracker displaying check categories while file not loaded. * Fix Darunia's Joy check not marking in vanilla. * Fix autosave not triggering change from collected to saved in tracker data. * Changed default colors for scummed and collected display. * Merge upgrade code cleanup. * Add `OnTransitionEnd` calls to sandstorm transitions both to and from Wasteland. Also improved `gSaveContext.lastScene` assignment for both transition types. Allowed a bit of cleanup in `GetCheckArea`. * Added `StateButton`, a button like `ArrowButton` but that allows text instead of arrow icons. Apparently the changes from ArrowButton to StateButton happened in a previous commit... * Changed section name to `trackerDataCheck` to force SoH to load it after the randomizer section, as it required some randoSettings to be loaded first, and nothing else I tried to make the randomizer section load before it worked. This hacks a solution to checks not displaying on fast file load to a specific slot. F*** you, SaveManager, and f*** you too, JSON. * Forgot to change the section string for loading with the name change. * Fix check ordering for checks that trigger the autosave. * Adds option to remove right-side shop items (slots 1-4) from the tracker list. Enabled by default. * Fix default state of Hide Shop Right Checks checkbox. * Fixes grotto and great fairy scrolling and checks. Fixes array overflow from `checkTrackerData` which was creating the issue trying to load the base and randomizer sections first, among other things. That also fixed the massive file loads that were being exhibited in debug mode. * Fix shooting galleries being set as collected again when being played a second time after getting the checks. * Fix Bazaar autoscroll. * Add Saria's Song to `GetCheckFromActor` and removed some limitations from the messageCloseCheck function to make that check track properly. * Fix Song from Impa check. Implemented prevention for multiple "collections" of great fairies, just in case getting the health refill would trigger it with the previous setup. * Fix ice traps on GS tokens not triggering OnItemReceive. * Complete fix for ice trap collection from GS. Add autoscroll when clicking "Expand All". * Add `OnShopSlotChange` with cursorSlot and basePrice parameters. * Fixed include in en_ossan for shop slot hook. Added registration for `OnShopSlotChange` in the tracker, storing the price in a new `price` field in `CheckTrackerData`. Added "seen" functionality to shop checks. Displays the model item name upon first entering a shop, adding the price and switching to trickName (if it's an ice trap) upon navigating to the slot in buy mode, triggered by an invisible "identified" status that mirrors "seen" in every other way. Added tooltips to most options for check tracker color picking to describe what each status actually means. * `std::format` pls * So apparently std::format just decided to break with the latest merge from develop, but fmt::format exists and works? * Removed the last vestiges of `locationsSkipped`. Other general code and formatting cleanups. Moved `IsGameRunning` to `OTRGlobals` so the item tracker could also access it. Used preceding to "fix" item and bottle display in the item tracker on startup. * Some more code cleanup. Removed "Recheck Area" button and relevant code. Backported changes to Anchor branch applicable for single-player, including making a checkAreas vector and structuring the frame by frame checks around that. Also includes fix for Silver Gauntlets and Mirror Shield check collection crash associated with those changes. Fixed Kakariko Bazaar "seen" updates. Fixed tracker window not showing on initial load like it should. * Forgot 1 formatting fix. * Removed conditions for showing Song from Impa (isn't junk under certain conditions, so should show all the time). * Fix vanilla checks, add Zelda's Letter and Malon's Egg to manual check collection. Fix autoscroll while in child stealth section. * Fix crash in Happy Mask Shop in OnSlotChange (referenced non-existent shop id in a tracker-specific enum). * General code cleanup. * Missed one reversion. * One more. * Fix column alignment in `randomizer_check_objects`. * Fix file encoding on `randomizer_check_tracker`. Again. * Fix indentation for `actualItemtrackerItemMap`. Also removed unnecessary parts of the map. * Rename `HasEqItem` to `HasEquipment`. * Slightly better indentation for `actualItemTrackerItemMap`. * Add magic bean salesman to vanilla check tracking, and genericized deku shield to trigger KF shop item 3 wherever you get the shield. Renamed `vanillaCheck` to `vanillaHundoCheck` to (supposedly) clarify the meaning of the usage. * One more rename to `vanillaCompletion` to avoid possible confusion with 100% speedrun conditions. * give me a break XD Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * Changes suggested by briaguya (rename `RandomizerCheckShow` to `Status`, unused code, newline formatting) * Remove unused `itemNames` table. * Remove `IsGameRunning` in favor of `GameInteractor::IsSaveLoaded`. * Restore anti-spoiler functionality for dungeons with dungeon maps. * Review cleanup. * Fix prices not showing for Kak bazaar items. --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com>
2023-10-04 11:03:36 -04:00
#include "z64item.h"
Randomizer Auto Location tracker (#1942) * Initial Auto-Location Tracking * Updates styling for checked items in Check Tracker * Fixes crashing issues with Check Tracker rendering * Auto scroll Check Tracker windows to current area * Checks Tracker only shows checked locations once in game * Fixes issue where Check Tracker would auto-scroll to wrong location when entering a grotto * Fixes gerudo fortress checks showing in tracker when settings have them removed * InfTable Check Location Fixes: Lost Dog Richard, Rolling Gorons, HBA 1000, Thawed Zora * Fixes most Event Chk Inf Checks on Check Tracker, and Frogs * Check Tracker - Song from Malon now works * Check Tracker - Fixes Claim Check check not tracking - Fixes spoiler for Claim Check check when getting Biggoron's Sword - Fixes LACS being spoiled and not tracking * Check Tracker - Fixes #2 for Skull Mask and Mask of Truth checks * Check Tracker - Adds support for merchants - Fixes #7 for Bomchu Salesman - Fixes #12 for Medigoron * Check Tracker - Fixes #8 for Song from Saria * Check Tracker - Fixes #9 for Adult Shooting Gallery * Check Tracker - Fixes #10 for Composer Grave * Check Tracker - Fixes #14 for Song from Ocarina of Time * Check Tracker - Fixes #16 for Shooting the Sun * Check Tracker - Fixes #19 for Darunia's Joy * Save Editor - Adds missing label for Treasure Chest Game * Check Tracker - Fixes Great Faries checks * Check Tracker - Fixes Sheik at Temple * Check Tracker - Fixes Great Fairy auto-scroll to wrong location * Check Tracker - Updates blue warp checks - Fixes Bongo Bongo and Twinrova checks * Check Tracker - Fixes Dampe's Gravedigging Tour * Check Tracker - Fixes Prescription to King Zora * Check Tracker - Fixes Bazaar showing under wrong area on tracker between adult/child * Check Tracker - Fixes scroll for Hyrule Market and Bazaar * Check Tracker - Fixes giving Adult Trade Items shown on tracker: Broken Sword, Saw, Cojiro, Eyeball Froge, and Eyedrops * Cleans up item_location * Check Tracker - Item List - Fixes item list not updating when changing seeds/options - Separates item exclusion list from item check list - Clean up comments * Check Tracker - Adds Skip functionality to buttons * Check Tracker - Refactors adult trade items to RandomizerInf * Check Tracker - Fixes an issue where any time an item is removed the tracker would cause an application crash * Check Tracker - Item names are now dependent on file language * Check Tracker - Fixes Gerudo Card check not showing in Fast setting * Reorders headers to (hopefully) avoid CI build conflicts on linux/consoles * Explicitly defines vector header in randomizer.h to fix compile errors * Complete Refactor of Check Tracker ImGui * Adds missing check tracker files to CMakeLists * Reverts the Item_location whitespace cleanup from ad10807c * Check Tracker - Loading Fixes - Fixes a bug where loading a save file a second time would add all the checks again - Fixes a bug where the check tracker would not render at all until in a save file * Check Tracker - Fixes a bug where checks would sometimes fail to load * Check Tracker - Fixes duplicated checks when using Only on Pause or Only on Combo * Check Tracker - Works around issue where single characters don't show in EnhancementCombobox, and fixes a label for combo buttons held option * Check Tracker - Applies all Check Tracker changes to Item Location * Check Tracker - Updated Check List - Adds Link's pocket, either in KF or HM depending on starting age - Supports Scrubs and Merchants - Uses enums instead of magic numbers - Updates DC Scrub Short Names for MQ * Check Tracker - Adds a performance mode option * Check Tracker - List Fixes (requires new rando generation) - Fixes Frogs Rupees always visible - Fixes Kokiri Sword Chest not showing - Fixes Weird Egg not showing * Check Tracker - MQ List basic support * Check Tracker - MQ/Vanilla anti-spoilers * Check Tracker - Collecting a compass now spoils the area * Check Tracker - Basic Vanilla Support and fixes - Vanilla items show in check tracker, even if many won't auto check - Fixes an issue with Gerudo Fortress Keys - Refactors IsVisibleInCheckTracker to randomizer_check_tracjer * Check Tracker - Fixes merge conflict from 08a487f35e1d760ab9e69b932edbe4da6bcd9edb * Check Tracker - Fixes tracker loading as Floating when default value is set to Windowed * Randomizer Location Exclusion List - Adds Scrubs, Merchants, Shops. Adult Trade items, MQ Dungeons, and Bean Salesman - Fixes Kokiri Sword Chest, Weird Egg, and Frog Song Rupees from misbehaving - Updates Gerudo Fortress logic to be dependent on Open/Fast/Normal Fortress - Removes Invalid Check - Adds RO Enum for MQ settings - Updates magic values to RO enum * Location Exclusion List - Scrubs that are always randomized now always show on the list * For now, removes some extra code only needed for a Check Tracker. * Randomizer Location Exclusion List - Fixes Eyeball Frog from showing up when Adult Trade Items was off * Location Tracker - Updates Eyedrops to use RandomizerInf instead of Chest * Check Tracker - Fixes a bug where Link's Pocket item wasn't acting as checked for area item count * Check Tracker - Fixes a bug where Locations would incorrectly say Vanilla due to the first check in the area being a non-MQ check * Check Tracker - Fixes a crash when Check Tracker is docked but not visible * Check Tracker - Fixes areas being spoiled when loading different save files * Check Tracker - Only reset variables if they are initialized * Check Tracker - Cleans up old comments, unused variables, methods, and macros, adds language TODOs, * Check Tracker - Readds rainbow UI elements after Cosmetics Editor refactor * Check Tracker - Removal of flag lookup that was refactored, no longer needed header, and some trivial whitespace fixes. * Check Tracker - Refactors Index to Bitmask code to a macro * Check Tracker - Changes ordering from alphabetical to RandomizerCheck ordering * Check Tracker - Wraps everything in a namespace to avoid global variable usage * Check Tracker - Explicitly defines for-loop scope * Check Tracker - refactors dungeon lookup from static array to function * Fixes a bug when using EnhancementColor with alpha * Check Tracker - Refactors all colour to use direct conversions * Check Tracker - refactors settings loading and check visibility for readability * Check Tracker - Fixes a bug where the wrong label showed on the Check Tracker BG Color * UIWidgets - Adds Alpha bar to EnhancementColor when using alpha parameter
2022-12-10 22:39:23 -05:00
extern "C" {
#include "variables.h"
#include "functions.h"
#include "macros.h"
extern PlayState* gPlayState;
}
extern "C" uint32_t ResourceMgr_IsSceneMasterQuest(s16 sceneNum);
Check Tracker Update (#2668) * Initial commit. What works so far: Data file loads, saves, deletes, and is created properly. - Need to run `HasItemBeenCollected` when creating in case of mid-seed regen. Organized checks into maps set by area. Areas show in tracker. - Checks pulled from checkObjectsByArea are not currently listed. - Areas are being assumed completed and hidden at the start. * Checks now populate. Still not counting area totals properly. * Don't track RC_LINKS_POCKET in the data file, and instead manually add it in every time a save is load. rcObjects doesn't contain Link's Pocket location (duh). * Moved ItemReceive hook to randomizer_check_tracker.cpp. Skipped items are properly sorted and formatted. Saved items contribute to an area's gotten/skipped checks on load. Changed skipped items default main color to gray. General code cleanup. * Skipped checks now contribute to area totals for area completion logic. * Mid-menu rework transfer. * Started check lookup on item receive. Tried to enable scum checking on save. * Fixed scum check on save. * More code cleanup, which revealed some issues with loading and saving. Loading now works 100%, but entries in checkTrackerData are disappearing in code somewhere, causing issues with later checks. Scummed color now displays properly. Collected but unsaved displays properly. Unchecked, Skipped, Seen and Scummed checks all have arrows for skipping/unskipping. Counts a little messed up, probably double adding skips. * Fixed item counts being off across resets. Restarts were fine. * Beginning of rework for individual check updates. Adds `Actor lastCheck` to PlayState to allow assigning of last actor to give an item. This allows precise tracking of GS, freestanding PoH, etc. Works for chests too. Currently does not work for shops, unknown for normal NPC gives. Doesn't track last gives for non-checks, like drops from grass, pots, crates, etc. * Actor-based checks fully fleshed out, but can't help with sale-based checks. Implemented `pendingSaleCheck` to back out of an RC check cycle if `gSaveContext->pendingSale` is not NONE when `OnItemReceive` is called, processed through `OnSaleEnd`. This should be the final change necessary to streamline the checks. * Temporary hook to message box close to tie in trackers for non-gs/chest actors that aren't added to `GetCheckFromActor`. This triggers a 2-frame countdown to check with `HasItemBeenCollected` since half of the methods in there aren't updated until after a text box closes. Added scene tracking to get last scene so that checks in scenes that span several overworld areas could be tied to their areas properly. Modified tracker data creation to apply Link's Pocket and Song from Impa conditionally based on randomizer settings instead of just being assumed to be done. May need modification for checking click and drag spoiler loading. Removed the scene equivalence check from CheckChecks so that an entire area is checked each time to avoid issues with, e.g., leaving a shop before a pending sale finishes. * Changed check data creation to use RSKs from gRandomizer to account for settings loaded from drag and drop spoilers. * Beginning of tracker code organization. Changed check color defaults. * Reverted moving tracker colors to header. Some individual check fixes. * Missed something from previous merge? * Removed last remnant of removed performance mode. * Better handle checking when skullsanity is off. * Song checks sceneIDs don't match the scenes they're actually in for some reason. Removed that check. * SaleEnd checks don't need the GetItemEntry parameter. Also set a flag that should prevent the check tracker from running during vanilla saves should that not be resolved by the time it's merged. * Attempting to have only the relevant checks added to the tracker data, as well as showing vanilla checks for non-rando saves. Not working yet (everything is displayed in vanilla). * Added vanilla check tracker population via `vanillaCheck` bool in `RandomizerCheckObject`. This is also added to `IsVisibleInImGui` to handle file loading and saving to eliminate checks that aren't part of vanilla or the rando seed. Implemented deleted tracker data file recreation. Added some extra item name text checks. Songs are still... tricky, so they stay blank. Utilize local copies of the randomizer check objects that are applicable for performance purposes. Fixed vanilla item-giving cutscene crashes when triggered mid-transition. * Apparently not all toolchains can handle macro instantiation without all parameters, like VS can. * Fixed scummed detail color not showing properly on tracker. * Fixed dungeon area totals and GS checks not functioning properly. * Major revamp of checking code. Doesn't rely on `GetCheckFromActor` at all anymore, but instead simply sets a flag to evaluate a number of checks in an area every frame until the check that was gotten is identified. With the new setup, it's much less hardware intensive, and at 60fps 6 checks per frame shows no noticeable effect on framerate. I can envision needing to add a collectedCount in order to account for times when two checks are gotten one right after the other. Changed area scroll to happen from `OnTransitionEnd`, and allow for scrolling in bazaar (was disabled previously because it would jump back and forth between Kak and Market while you were in one). Also setup area check order updating by area instead of all at the same time. * Fixed shooting gallery not reporting proper area. Prevent checks from actually happening if area is RCAREA_INVALID, now that all areas are reporting something if they have checks. Fixed `GetCheckArea()` not updating checks for standard scenes. Lots of vanilla tracking updates, mainly manual checks for gems, medallions and songs, since the often don't have proper scenes in the data. Prevent vanilla from triggering check loops if junk items are collected. Fixed sorting based on saved vs collected. Prevent item name display for vanilla runs. Change coloring of checks so the check name reflects status in vanilla runs. * Fixed "Recheck Area" button erroneously adding to an area's check totals? * Fix DMC vanilla checks. * Fix check tracker data recreation on data file loss. Removed redundant file exists check from SaveTrackerDataHook, as it doesn't matter if it exists or not at that point. Limited check loops to 3 to avoid infinite check loops on non-check/junk item pickup. Added more checks to disable tracker operations if a save is not running. Changed check ordering to put boss reward and heart container checks at the end of whatever RCSHOW group they belong to. * Fixed IsRunning calculation. Further improving vanilla checking. Starting framework for checking medallions, stones, and songs on data file recreation. Fixed medallion check collection. Added GIFT_FROM_SAGES to check list for vanilla file for tracking light medallion. Added check loop limitation to prevent infinite checking after picking up junk item from the ground. * Finished vanilla file recreation and recheck (songs and dungeon rewards all check properly now). This includes deku shield with KF shop item 3. Finished Gift from Raoru light medallion tracking for vanilla. Commented all CheckByScene functionality for now. * Fixed new save data file creation. Disabled entrance area calculation for now, as it only tracks the previous entrance for some reason. Fixed area detection for ToT checks. * GetCheckArea() now utilizes EntranceData almost exclusively, via either `gSaveContext.entranceIndex` or the entrance tracker's `currentGrottoId` in the case of grottos. This also means that EVERYTHING CAN AUTOSCROLL NOW. Entrance shuffles are now much easier to track. Autoscroll is now also triggered on save, just in case someone isn't autosaving and has a lot of checks that get converted to saved. * Fixed missing GS check in LW. * Added area scroll on toggling Show Hidden Items. May configure differently later. Fixed area detection for entrances in Gerudo Fortress/Valley and Collossus. Haunted wasteland doesn't autoscroll due to a bug in `OnTransitionEnd` hook, but checks still evaluate properly there. Rely on scene-based area detection if scene is a main overworld or dungeon scene. * Fixed grotto detection when shuffle is off. * Small code cleanup. Fixed Colossus hand chest checks. * Missing lus bump from merge conflict resolution * Fixed Colossus Grotto making `GetCheckArea` return Wasteland. * Improved OnItemReceive processing for non-token GS checks, since they can sometimes take long enough for the checking process to time out before the item is registered as received. * First attempt at thread safety for tracker data file writing. Seems to work, but might need more testing. * Fixed Recheck Area not unskipping items that register as saved. Improved delayed saving with autosaving, as the autosave triggered quite often before the tracker data save, making things not properly register as saved. * merge cleanup * Converted check tracker data to the sectional saves, adding `CheckTrackerData` to `SaveContext`. Implemented section ID returning and fullSave boolean passing to section functions from my PR temporarily for it to work properly. Moved `RandomizerCheckTrackerData` enum to `randomizerTypes.h` to accommodate that. Changed `Randomizer_SaveInit` to a `SaveManager::InitFunc` to allow for other randomizer-dependent sections to be initialized after that. Required a little refactoring to maintain intro cutscene skip when starting a randomizer file. * Revert section index return and randomizer init changes. Will need to wait on yet more changes to main. * Fixed check tracker initialization (shouldn't be tied to window initialization), restored saving/loading functionality. * Removed `CheckTracker::Init` and put SaveManager calls in `CheckTrackerWindow::InitElement`. Also a bit of cleanup from transition back to save file use. * Fixed tracker displaying check categories while file not loaded. * Fix Darunia's Joy check not marking in vanilla. * Fix autosave not triggering change from collected to saved in tracker data. * Changed default colors for scummed and collected display. * Merge upgrade code cleanup. * Add `OnTransitionEnd` calls to sandstorm transitions both to and from Wasteland. Also improved `gSaveContext.lastScene` assignment for both transition types. Allowed a bit of cleanup in `GetCheckArea`. * Added `StateButton`, a button like `ArrowButton` but that allows text instead of arrow icons. Apparently the changes from ArrowButton to StateButton happened in a previous commit... * Changed section name to `trackerDataCheck` to force SoH to load it after the randomizer section, as it required some randoSettings to be loaded first, and nothing else I tried to make the randomizer section load before it worked. This hacks a solution to checks not displaying on fast file load to a specific slot. F*** you, SaveManager, and f*** you too, JSON. * Forgot to change the section string for loading with the name change. * Fix check ordering for checks that trigger the autosave. * Adds option to remove right-side shop items (slots 1-4) from the tracker list. Enabled by default. * Fix default state of Hide Shop Right Checks checkbox. * Fixes grotto and great fairy scrolling and checks. Fixes array overflow from `checkTrackerData` which was creating the issue trying to load the base and randomizer sections first, among other things. That also fixed the massive file loads that were being exhibited in debug mode. * Fix shooting galleries being set as collected again when being played a second time after getting the checks. * Fix Bazaar autoscroll. * Add Saria's Song to `GetCheckFromActor` and removed some limitations from the messageCloseCheck function to make that check track properly. * Fix Song from Impa check. Implemented prevention for multiple "collections" of great fairies, just in case getting the health refill would trigger it with the previous setup. * Fix ice traps on GS tokens not triggering OnItemReceive. * Complete fix for ice trap collection from GS. Add autoscroll when clicking "Expand All". * Add `OnShopSlotChange` with cursorSlot and basePrice parameters. * Fixed include in en_ossan for shop slot hook. Added registration for `OnShopSlotChange` in the tracker, storing the price in a new `price` field in `CheckTrackerData`. Added "seen" functionality to shop checks. Displays the model item name upon first entering a shop, adding the price and switching to trickName (if it's an ice trap) upon navigating to the slot in buy mode, triggered by an invisible "identified" status that mirrors "seen" in every other way. Added tooltips to most options for check tracker color picking to describe what each status actually means. * `std::format` pls * So apparently std::format just decided to break with the latest merge from develop, but fmt::format exists and works? * Removed the last vestiges of `locationsSkipped`. Other general code and formatting cleanups. Moved `IsGameRunning` to `OTRGlobals` so the item tracker could also access it. Used preceding to "fix" item and bottle display in the item tracker on startup. * Some more code cleanup. Removed "Recheck Area" button and relevant code. Backported changes to Anchor branch applicable for single-player, including making a checkAreas vector and structuring the frame by frame checks around that. Also includes fix for Silver Gauntlets and Mirror Shield check collection crash associated with those changes. Fixed Kakariko Bazaar "seen" updates. Fixed tracker window not showing on initial load like it should. * Forgot 1 formatting fix. * Removed conditions for showing Song from Impa (isn't junk under certain conditions, so should show all the time). * Fix vanilla checks, add Zelda's Letter and Malon's Egg to manual check collection. Fix autoscroll while in child stealth section. * Fix crash in Happy Mask Shop in OnSlotChange (referenced non-existent shop id in a tracker-specific enum). * General code cleanup. * Missed one reversion. * One more. * Fix column alignment in `randomizer_check_objects`. * Fix file encoding on `randomizer_check_tracker`. Again. * Fix indentation for `actualItemtrackerItemMap`. Also removed unnecessary parts of the map. * Rename `HasEqItem` to `HasEquipment`. * Slightly better indentation for `actualItemTrackerItemMap`. * Add magic bean salesman to vanilla check tracking, and genericized deku shield to trigger KF shop item 3 wherever you get the shield. Renamed `vanillaCheck` to `vanillaHundoCheck` to (supposedly) clarify the meaning of the usage. * One more rename to `vanillaCompletion` to avoid possible confusion with 100% speedrun conditions. * give me a break XD Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * Changes suggested by briaguya (rename `RandomizerCheckShow` to `Status`, unused code, newline formatting) * Remove unused `itemNames` table. * Remove `IsGameRunning` in favor of `GameInteractor::IsSaveLoaded`. * Restore anti-spoiler functionality for dungeons with dungeon maps. * Review cleanup. * Fix prices not showing for Kak bazaar items. --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com>
2023-10-04 11:03:36 -04:00
extern "C" GetItemEntry ItemTable_RetrieveEntry(s16 modIndex, s16 getItemID);
extern std::vector<ItemTrackerItem> dungeonRewardStones;
extern std::vector<ItemTrackerItem> dungeonRewardMedallions;
extern std::vector<ItemTrackerItem> songItems;
extern std::vector<ItemTrackerItem> equipmentItems;
#define RCO_RAORU { RC_GIFT_FROM_SAGES, RCVORMQ_BOTH, RCTYPE_DUNGEON_REWARD, RCAREA_MARKET, ACTOR_ID_MAX, SCENE_ID_MAX, 0x00, GI_NONE, false, "Gift from Raoru", "Gift from Raoru", true };
using json = nlohmann::json;
void to_json(json& j, const RandomizerCheckTrackerData& rctd) {
j = json {
{ "status", rctd.status == RCSHOW_COLLECTED ? RCSHOW_SAVED : rctd.status },
{ "skipped", rctd.skipped },
{ "price", rctd.price },
{ "hintItem", rctd.hintItem }};
}
void from_json(const json& j, RandomizerCheckTrackerData& rctd) {
j.at("status").get_to(rctd.status);
j.at("skipped").get_to(rctd.skipped);
j.at("hintItem").get_to(rctd.hintItem);
j.at("price").get_to(rctd.price);
}
Randomizer Auto Location tracker (#1942) * Initial Auto-Location Tracking * Updates styling for checked items in Check Tracker * Fixes crashing issues with Check Tracker rendering * Auto scroll Check Tracker windows to current area * Checks Tracker only shows checked locations once in game * Fixes issue where Check Tracker would auto-scroll to wrong location when entering a grotto * Fixes gerudo fortress checks showing in tracker when settings have them removed * InfTable Check Location Fixes: Lost Dog Richard, Rolling Gorons, HBA 1000, Thawed Zora * Fixes most Event Chk Inf Checks on Check Tracker, and Frogs * Check Tracker - Song from Malon now works * Check Tracker - Fixes Claim Check check not tracking - Fixes spoiler for Claim Check check when getting Biggoron's Sword - Fixes LACS being spoiled and not tracking * Check Tracker - Fixes #2 for Skull Mask and Mask of Truth checks * Check Tracker - Adds support for merchants - Fixes #7 for Bomchu Salesman - Fixes #12 for Medigoron * Check Tracker - Fixes #8 for Song from Saria * Check Tracker - Fixes #9 for Adult Shooting Gallery * Check Tracker - Fixes #10 for Composer Grave * Check Tracker - Fixes #14 for Song from Ocarina of Time * Check Tracker - Fixes #16 for Shooting the Sun * Check Tracker - Fixes #19 for Darunia's Joy * Save Editor - Adds missing label for Treasure Chest Game * Check Tracker - Fixes Great Faries checks * Check Tracker - Fixes Sheik at Temple * Check Tracker - Fixes Great Fairy auto-scroll to wrong location * Check Tracker - Updates blue warp checks - Fixes Bongo Bongo and Twinrova checks * Check Tracker - Fixes Dampe's Gravedigging Tour * Check Tracker - Fixes Prescription to King Zora * Check Tracker - Fixes Bazaar showing under wrong area on tracker between adult/child * Check Tracker - Fixes scroll for Hyrule Market and Bazaar * Check Tracker - Fixes giving Adult Trade Items shown on tracker: Broken Sword, Saw, Cojiro, Eyeball Froge, and Eyedrops * Cleans up item_location * Check Tracker - Item List - Fixes item list not updating when changing seeds/options - Separates item exclusion list from item check list - Clean up comments * Check Tracker - Adds Skip functionality to buttons * Check Tracker - Refactors adult trade items to RandomizerInf * Check Tracker - Fixes an issue where any time an item is removed the tracker would cause an application crash * Check Tracker - Item names are now dependent on file language * Check Tracker - Fixes Gerudo Card check not showing in Fast setting * Reorders headers to (hopefully) avoid CI build conflicts on linux/consoles * Explicitly defines vector header in randomizer.h to fix compile errors * Complete Refactor of Check Tracker ImGui * Adds missing check tracker files to CMakeLists * Reverts the Item_location whitespace cleanup from ad10807c * Check Tracker - Loading Fixes - Fixes a bug where loading a save file a second time would add all the checks again - Fixes a bug where the check tracker would not render at all until in a save file * Check Tracker - Fixes a bug where checks would sometimes fail to load * Check Tracker - Fixes duplicated checks when using Only on Pause or Only on Combo * Check Tracker - Works around issue where single characters don't show in EnhancementCombobox, and fixes a label for combo buttons held option * Check Tracker - Applies all Check Tracker changes to Item Location * Check Tracker - Updated Check List - Adds Link's pocket, either in KF or HM depending on starting age - Supports Scrubs and Merchants - Uses enums instead of magic numbers - Updates DC Scrub Short Names for MQ * Check Tracker - Adds a performance mode option * Check Tracker - List Fixes (requires new rando generation) - Fixes Frogs Rupees always visible - Fixes Kokiri Sword Chest not showing - Fixes Weird Egg not showing * Check Tracker - MQ List basic support * Check Tracker - MQ/Vanilla anti-spoilers * Check Tracker - Collecting a compass now spoils the area * Check Tracker - Basic Vanilla Support and fixes - Vanilla items show in check tracker, even if many won't auto check - Fixes an issue with Gerudo Fortress Keys - Refactors IsVisibleInCheckTracker to randomizer_check_tracjer * Check Tracker - Fixes merge conflict from 08a487f35e1d760ab9e69b932edbe4da6bcd9edb * Check Tracker - Fixes tracker loading as Floating when default value is set to Windowed * Randomizer Location Exclusion List - Adds Scrubs, Merchants, Shops. Adult Trade items, MQ Dungeons, and Bean Salesman - Fixes Kokiri Sword Chest, Weird Egg, and Frog Song Rupees from misbehaving - Updates Gerudo Fortress logic to be dependent on Open/Fast/Normal Fortress - Removes Invalid Check - Adds RO Enum for MQ settings - Updates magic values to RO enum * Location Exclusion List - Scrubs that are always randomized now always show on the list * For now, removes some extra code only needed for a Check Tracker. * Randomizer Location Exclusion List - Fixes Eyeball Frog from showing up when Adult Trade Items was off * Location Tracker - Updates Eyedrops to use RandomizerInf instead of Chest * Check Tracker - Fixes a bug where Link's Pocket item wasn't acting as checked for area item count * Check Tracker - Fixes a bug where Locations would incorrectly say Vanilla due to the first check in the area being a non-MQ check * Check Tracker - Fixes a crash when Check Tracker is docked but not visible * Check Tracker - Fixes areas being spoiled when loading different save files * Check Tracker - Only reset variables if they are initialized * Check Tracker - Cleans up old comments, unused variables, methods, and macros, adds language TODOs, * Check Tracker - Readds rainbow UI elements after Cosmetics Editor refactor * Check Tracker - Removal of flag lookup that was refactored, no longer needed header, and some trivial whitespace fixes. * Check Tracker - Refactors Index to Bitmask code to a macro * Check Tracker - Changes ordering from alphabetical to RandomizerCheck ordering * Check Tracker - Wraps everything in a namespace to avoid global variable usage * Check Tracker - Explicitly defines for-loop scope * Check Tracker - refactors dungeon lookup from static array to function * Fixes a bug when using EnhancementColor with alpha * Check Tracker - Refactors all colour to use direct conversions * Check Tracker - refactors settings loading and check visibility for readability * Check Tracker - Fixes a bug where the wrong label showed on the Check Tracker BG Color * UIWidgets - Adds Alpha bar to EnhancementColor when using alpha parameter
2022-12-10 22:39:23 -05:00
namespace CheckTracker {
Check Tracker Update (#2668) * Initial commit. What works so far: Data file loads, saves, deletes, and is created properly. - Need to run `HasItemBeenCollected` when creating in case of mid-seed regen. Organized checks into maps set by area. Areas show in tracker. - Checks pulled from checkObjectsByArea are not currently listed. - Areas are being assumed completed and hidden at the start. * Checks now populate. Still not counting area totals properly. * Don't track RC_LINKS_POCKET in the data file, and instead manually add it in every time a save is load. rcObjects doesn't contain Link's Pocket location (duh). * Moved ItemReceive hook to randomizer_check_tracker.cpp. Skipped items are properly sorted and formatted. Saved items contribute to an area's gotten/skipped checks on load. Changed skipped items default main color to gray. General code cleanup. * Skipped checks now contribute to area totals for area completion logic. * Mid-menu rework transfer. * Started check lookup on item receive. Tried to enable scum checking on save. * Fixed scum check on save. * More code cleanup, which revealed some issues with loading and saving. Loading now works 100%, but entries in checkTrackerData are disappearing in code somewhere, causing issues with later checks. Scummed color now displays properly. Collected but unsaved displays properly. Unchecked, Skipped, Seen and Scummed checks all have arrows for skipping/unskipping. Counts a little messed up, probably double adding skips. * Fixed item counts being off across resets. Restarts were fine. * Beginning of rework for individual check updates. Adds `Actor lastCheck` to PlayState to allow assigning of last actor to give an item. This allows precise tracking of GS, freestanding PoH, etc. Works for chests too. Currently does not work for shops, unknown for normal NPC gives. Doesn't track last gives for non-checks, like drops from grass, pots, crates, etc. * Actor-based checks fully fleshed out, but can't help with sale-based checks. Implemented `pendingSaleCheck` to back out of an RC check cycle if `gSaveContext->pendingSale` is not NONE when `OnItemReceive` is called, processed through `OnSaleEnd`. This should be the final change necessary to streamline the checks. * Temporary hook to message box close to tie in trackers for non-gs/chest actors that aren't added to `GetCheckFromActor`. This triggers a 2-frame countdown to check with `HasItemBeenCollected` since half of the methods in there aren't updated until after a text box closes. Added scene tracking to get last scene so that checks in scenes that span several overworld areas could be tied to their areas properly. Modified tracker data creation to apply Link's Pocket and Song from Impa conditionally based on randomizer settings instead of just being assumed to be done. May need modification for checking click and drag spoiler loading. Removed the scene equivalence check from CheckChecks so that an entire area is checked each time to avoid issues with, e.g., leaving a shop before a pending sale finishes. * Changed check data creation to use RSKs from gRandomizer to account for settings loaded from drag and drop spoilers. * Beginning of tracker code organization. Changed check color defaults. * Reverted moving tracker colors to header. Some individual check fixes. * Missed something from previous merge? * Removed last remnant of removed performance mode. * Better handle checking when skullsanity is off. * Song checks sceneIDs don't match the scenes they're actually in for some reason. Removed that check. * SaleEnd checks don't need the GetItemEntry parameter. Also set a flag that should prevent the check tracker from running during vanilla saves should that not be resolved by the time it's merged. * Attempting to have only the relevant checks added to the tracker data, as well as showing vanilla checks for non-rando saves. Not working yet (everything is displayed in vanilla). * Added vanilla check tracker population via `vanillaCheck` bool in `RandomizerCheckObject`. This is also added to `IsVisibleInImGui` to handle file loading and saving to eliminate checks that aren't part of vanilla or the rando seed. Implemented deleted tracker data file recreation. Added some extra item name text checks. Songs are still... tricky, so they stay blank. Utilize local copies of the randomizer check objects that are applicable for performance purposes. Fixed vanilla item-giving cutscene crashes when triggered mid-transition. * Apparently not all toolchains can handle macro instantiation without all parameters, like VS can. * Fixed scummed detail color not showing properly on tracker. * Fixed dungeon area totals and GS checks not functioning properly. * Major revamp of checking code. Doesn't rely on `GetCheckFromActor` at all anymore, but instead simply sets a flag to evaluate a number of checks in an area every frame until the check that was gotten is identified. With the new setup, it's much less hardware intensive, and at 60fps 6 checks per frame shows no noticeable effect on framerate. I can envision needing to add a collectedCount in order to account for times when two checks are gotten one right after the other. Changed area scroll to happen from `OnTransitionEnd`, and allow for scrolling in bazaar (was disabled previously because it would jump back and forth between Kak and Market while you were in one). Also setup area check order updating by area instead of all at the same time. * Fixed shooting gallery not reporting proper area. Prevent checks from actually happening if area is RCAREA_INVALID, now that all areas are reporting something if they have checks. Fixed `GetCheckArea()` not updating checks for standard scenes. Lots of vanilla tracking updates, mainly manual checks for gems, medallions and songs, since the often don't have proper scenes in the data. Prevent vanilla from triggering check loops if junk items are collected. Fixed sorting based on saved vs collected. Prevent item name display for vanilla runs. Change coloring of checks so the check name reflects status in vanilla runs. * Fixed "Recheck Area" button erroneously adding to an area's check totals? * Fix DMC vanilla checks. * Fix check tracker data recreation on data file loss. Removed redundant file exists check from SaveTrackerDataHook, as it doesn't matter if it exists or not at that point. Limited check loops to 3 to avoid infinite check loops on non-check/junk item pickup. Added more checks to disable tracker operations if a save is not running. Changed check ordering to put boss reward and heart container checks at the end of whatever RCSHOW group they belong to. * Fixed IsRunning calculation. Further improving vanilla checking. Starting framework for checking medallions, stones, and songs on data file recreation. Fixed medallion check collection. Added GIFT_FROM_SAGES to check list for vanilla file for tracking light medallion. Added check loop limitation to prevent infinite checking after picking up junk item from the ground. * Finished vanilla file recreation and recheck (songs and dungeon rewards all check properly now). This includes deku shield with KF shop item 3. Finished Gift from Raoru light medallion tracking for vanilla. Commented all CheckByScene functionality for now. * Fixed new save data file creation. Disabled entrance area calculation for now, as it only tracks the previous entrance for some reason. Fixed area detection for ToT checks. * GetCheckArea() now utilizes EntranceData almost exclusively, via either `gSaveContext.entranceIndex` or the entrance tracker's `currentGrottoId` in the case of grottos. This also means that EVERYTHING CAN AUTOSCROLL NOW. Entrance shuffles are now much easier to track. Autoscroll is now also triggered on save, just in case someone isn't autosaving and has a lot of checks that get converted to saved. * Fixed missing GS check in LW. * Added area scroll on toggling Show Hidden Items. May configure differently later. Fixed area detection for entrances in Gerudo Fortress/Valley and Collossus. Haunted wasteland doesn't autoscroll due to a bug in `OnTransitionEnd` hook, but checks still evaluate properly there. Rely on scene-based area detection if scene is a main overworld or dungeon scene. * Fixed grotto detection when shuffle is off. * Small code cleanup. Fixed Colossus hand chest checks. * Missing lus bump from merge conflict resolution * Fixed Colossus Grotto making `GetCheckArea` return Wasteland. * Improved OnItemReceive processing for non-token GS checks, since they can sometimes take long enough for the checking process to time out before the item is registered as received. * First attempt at thread safety for tracker data file writing. Seems to work, but might need more testing. * Fixed Recheck Area not unskipping items that register as saved. Improved delayed saving with autosaving, as the autosave triggered quite often before the tracker data save, making things not properly register as saved. * merge cleanup * Converted check tracker data to the sectional saves, adding `CheckTrackerData` to `SaveContext`. Implemented section ID returning and fullSave boolean passing to section functions from my PR temporarily for it to work properly. Moved `RandomizerCheckTrackerData` enum to `randomizerTypes.h` to accommodate that. Changed `Randomizer_SaveInit` to a `SaveManager::InitFunc` to allow for other randomizer-dependent sections to be initialized after that. Required a little refactoring to maintain intro cutscene skip when starting a randomizer file. * Revert section index return and randomizer init changes. Will need to wait on yet more changes to main. * Fixed check tracker initialization (shouldn't be tied to window initialization), restored saving/loading functionality. * Removed `CheckTracker::Init` and put SaveManager calls in `CheckTrackerWindow::InitElement`. Also a bit of cleanup from transition back to save file use. * Fixed tracker displaying check categories while file not loaded. * Fix Darunia's Joy check not marking in vanilla. * Fix autosave not triggering change from collected to saved in tracker data. * Changed default colors for scummed and collected display. * Merge upgrade code cleanup. * Add `OnTransitionEnd` calls to sandstorm transitions both to and from Wasteland. Also improved `gSaveContext.lastScene` assignment for both transition types. Allowed a bit of cleanup in `GetCheckArea`. * Added `StateButton`, a button like `ArrowButton` but that allows text instead of arrow icons. Apparently the changes from ArrowButton to StateButton happened in a previous commit... * Changed section name to `trackerDataCheck` to force SoH to load it after the randomizer section, as it required some randoSettings to be loaded first, and nothing else I tried to make the randomizer section load before it worked. This hacks a solution to checks not displaying on fast file load to a specific slot. F*** you, SaveManager, and f*** you too, JSON. * Forgot to change the section string for loading with the name change. * Fix check ordering for checks that trigger the autosave. * Adds option to remove right-side shop items (slots 1-4) from the tracker list. Enabled by default. * Fix default state of Hide Shop Right Checks checkbox. * Fixes grotto and great fairy scrolling and checks. Fixes array overflow from `checkTrackerData` which was creating the issue trying to load the base and randomizer sections first, among other things. That also fixed the massive file loads that were being exhibited in debug mode. * Fix shooting galleries being set as collected again when being played a second time after getting the checks. * Fix Bazaar autoscroll. * Add Saria's Song to `GetCheckFromActor` and removed some limitations from the messageCloseCheck function to make that check track properly. * Fix Song from Impa check. Implemented prevention for multiple "collections" of great fairies, just in case getting the health refill would trigger it with the previous setup. * Fix ice traps on GS tokens not triggering OnItemReceive. * Complete fix for ice trap collection from GS. Add autoscroll when clicking "Expand All". * Add `OnShopSlotChange` with cursorSlot and basePrice parameters. * Fixed include in en_ossan for shop slot hook. Added registration for `OnShopSlotChange` in the tracker, storing the price in a new `price` field in `CheckTrackerData`. Added "seen" functionality to shop checks. Displays the model item name upon first entering a shop, adding the price and switching to trickName (if it's an ice trap) upon navigating to the slot in buy mode, triggered by an invisible "identified" status that mirrors "seen" in every other way. Added tooltips to most options for check tracker color picking to describe what each status actually means. * `std::format` pls * So apparently std::format just decided to break with the latest merge from develop, but fmt::format exists and works? * Removed the last vestiges of `locationsSkipped`. Other general code and formatting cleanups. Moved `IsGameRunning` to `OTRGlobals` so the item tracker could also access it. Used preceding to "fix" item and bottle display in the item tracker on startup. * Some more code cleanup. Removed "Recheck Area" button and relevant code. Backported changes to Anchor branch applicable for single-player, including making a checkAreas vector and structuring the frame by frame checks around that. Also includes fix for Silver Gauntlets and Mirror Shield check collection crash associated with those changes. Fixed Kakariko Bazaar "seen" updates. Fixed tracker window not showing on initial load like it should. * Forgot 1 formatting fix. * Removed conditions for showing Song from Impa (isn't junk under certain conditions, so should show all the time). * Fix vanilla checks, add Zelda's Letter and Malon's Egg to manual check collection. Fix autoscroll while in child stealth section. * Fix crash in Happy Mask Shop in OnSlotChange (referenced non-existent shop id in a tracker-specific enum). * General code cleanup. * Missed one reversion. * One more. * Fix column alignment in `randomizer_check_objects`. * Fix file encoding on `randomizer_check_tracker`. Again. * Fix indentation for `actualItemtrackerItemMap`. Also removed unnecessary parts of the map. * Rename `HasEqItem` to `HasEquipment`. * Slightly better indentation for `actualItemTrackerItemMap`. * Add magic bean salesman to vanilla check tracking, and genericized deku shield to trigger KF shop item 3 wherever you get the shield. Renamed `vanillaCheck` to `vanillaHundoCheck` to (supposedly) clarify the meaning of the usage. * One more rename to `vanillaCompletion` to avoid possible confusion with 100% speedrun conditions. * give me a break XD Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * Changes suggested by briaguya (rename `RandomizerCheckShow` to `Status`, unused code, newline formatting) * Remove unused `itemNames` table. * Remove `IsGameRunning` in favor of `GameInteractor::IsSaveLoaded`. * Restore anti-spoiler functionality for dungeons with dungeon maps. * Review cleanup. * Fix prices not showing for Kak bazaar items. --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com>
2023-10-04 11:03:36 -04:00
// settings
bool showShops;
bool showOverworldTokens;
bool showDungeonTokens;
bool showBeans;
bool showScrubs;
bool showMerchants;
bool showCows;
bool showAdultTrade;
bool showKokiriSword;
Rando: Master Sword Shuffle (#2981) * The mother of all commits * Removed `GI_SWORD_MASTER`; "Master Sword" Items now actually give MS * Removed dupe MS entries in item pool; updated GIMESSAGE (should stop crashing on non-Windows); re-added MS in item list * Give Adult Link a freebie with shuffle MS on; cihld -> adult no longer gives MS; ToT Master Sword now gives correct item * add master sword GI draw func based on ToT MS object * Force `MasterSword` logic var to only update upon getting MS * Dorf funny line now activates with LA and MS in inv * Apply suggestions * Updated RAND_INF; Check Tracker changes; Gave RAND_INF and ice trap logic to ToT MS check; Fixed swordless behavior for HBA/fishing * ToT MS Check now works in check tracker; Visual bug where box hovers over non-existent MS gone; Fixed RAND_INF check with ToT MS pedestal; Ganon no longer gives free MS * adult equips no longer reset in MS shuffle * Apply (most) locacc review suggestions Co-authored-by: inspectredc <78732756+inspectredc@users.noreply.github.com> * Reorganized swordless check for interface to fit edge cases; getting master sword no longer highlights box * Edge case for BGS but no bow * Fix implicit declaration error for GI hooks (#9) * Adjusted `CanAdultAttack/Damage`; applied logic suggestions * Fixed build errors (hopefully) * Cleanup merge * get shit working again * Tidied up remaining uses of DD flag as rando indicator * make master sword invisible and fix ms flag (#10) * Add text to sheik if go mode is obtained but barrier is still up * overhaul swordless behavior in `func_80083108` * reworked ToT MS Check to have an actual GI * suggestions * Apply suggestions * Better swordless handling with temp B (#11) * better swordless handling with temp B * prevent auto save in fishing pond * prevent auto save during bombchu bowling * enum fix --------- Co-authored-by: Adam Bird <archez39@me.com> Co-authored-by: inspectredc <78732756+inspectredc@users.noreply.github.com> Co-authored-by: RaelCappra <rael.cappra@gmail.com> Co-authored-by: Adam Bird <Archez@users.noreply.github.com>
2023-10-21 21:51:37 -04:00
bool showMasterSword;
Check Tracker Update (#2668) * Initial commit. What works so far: Data file loads, saves, deletes, and is created properly. - Need to run `HasItemBeenCollected` when creating in case of mid-seed regen. Organized checks into maps set by area. Areas show in tracker. - Checks pulled from checkObjectsByArea are not currently listed. - Areas are being assumed completed and hidden at the start. * Checks now populate. Still not counting area totals properly. * Don't track RC_LINKS_POCKET in the data file, and instead manually add it in every time a save is load. rcObjects doesn't contain Link's Pocket location (duh). * Moved ItemReceive hook to randomizer_check_tracker.cpp. Skipped items are properly sorted and formatted. Saved items contribute to an area's gotten/skipped checks on load. Changed skipped items default main color to gray. General code cleanup. * Skipped checks now contribute to area totals for area completion logic. * Mid-menu rework transfer. * Started check lookup on item receive. Tried to enable scum checking on save. * Fixed scum check on save. * More code cleanup, which revealed some issues with loading and saving. Loading now works 100%, but entries in checkTrackerData are disappearing in code somewhere, causing issues with later checks. Scummed color now displays properly. Collected but unsaved displays properly. Unchecked, Skipped, Seen and Scummed checks all have arrows for skipping/unskipping. Counts a little messed up, probably double adding skips. * Fixed item counts being off across resets. Restarts were fine. * Beginning of rework for individual check updates. Adds `Actor lastCheck` to PlayState to allow assigning of last actor to give an item. This allows precise tracking of GS, freestanding PoH, etc. Works for chests too. Currently does not work for shops, unknown for normal NPC gives. Doesn't track last gives for non-checks, like drops from grass, pots, crates, etc. * Actor-based checks fully fleshed out, but can't help with sale-based checks. Implemented `pendingSaleCheck` to back out of an RC check cycle if `gSaveContext->pendingSale` is not NONE when `OnItemReceive` is called, processed through `OnSaleEnd`. This should be the final change necessary to streamline the checks. * Temporary hook to message box close to tie in trackers for non-gs/chest actors that aren't added to `GetCheckFromActor`. This triggers a 2-frame countdown to check with `HasItemBeenCollected` since half of the methods in there aren't updated until after a text box closes. Added scene tracking to get last scene so that checks in scenes that span several overworld areas could be tied to their areas properly. Modified tracker data creation to apply Link's Pocket and Song from Impa conditionally based on randomizer settings instead of just being assumed to be done. May need modification for checking click and drag spoiler loading. Removed the scene equivalence check from CheckChecks so that an entire area is checked each time to avoid issues with, e.g., leaving a shop before a pending sale finishes. * Changed check data creation to use RSKs from gRandomizer to account for settings loaded from drag and drop spoilers. * Beginning of tracker code organization. Changed check color defaults. * Reverted moving tracker colors to header. Some individual check fixes. * Missed something from previous merge? * Removed last remnant of removed performance mode. * Better handle checking when skullsanity is off. * Song checks sceneIDs don't match the scenes they're actually in for some reason. Removed that check. * SaleEnd checks don't need the GetItemEntry parameter. Also set a flag that should prevent the check tracker from running during vanilla saves should that not be resolved by the time it's merged. * Attempting to have only the relevant checks added to the tracker data, as well as showing vanilla checks for non-rando saves. Not working yet (everything is displayed in vanilla). * Added vanilla check tracker population via `vanillaCheck` bool in `RandomizerCheckObject`. This is also added to `IsVisibleInImGui` to handle file loading and saving to eliminate checks that aren't part of vanilla or the rando seed. Implemented deleted tracker data file recreation. Added some extra item name text checks. Songs are still... tricky, so they stay blank. Utilize local copies of the randomizer check objects that are applicable for performance purposes. Fixed vanilla item-giving cutscene crashes when triggered mid-transition. * Apparently not all toolchains can handle macro instantiation without all parameters, like VS can. * Fixed scummed detail color not showing properly on tracker. * Fixed dungeon area totals and GS checks not functioning properly. * Major revamp of checking code. Doesn't rely on `GetCheckFromActor` at all anymore, but instead simply sets a flag to evaluate a number of checks in an area every frame until the check that was gotten is identified. With the new setup, it's much less hardware intensive, and at 60fps 6 checks per frame shows no noticeable effect on framerate. I can envision needing to add a collectedCount in order to account for times when two checks are gotten one right after the other. Changed area scroll to happen from `OnTransitionEnd`, and allow for scrolling in bazaar (was disabled previously because it would jump back and forth between Kak and Market while you were in one). Also setup area check order updating by area instead of all at the same time. * Fixed shooting gallery not reporting proper area. Prevent checks from actually happening if area is RCAREA_INVALID, now that all areas are reporting something if they have checks. Fixed `GetCheckArea()` not updating checks for standard scenes. Lots of vanilla tracking updates, mainly manual checks for gems, medallions and songs, since the often don't have proper scenes in the data. Prevent vanilla from triggering check loops if junk items are collected. Fixed sorting based on saved vs collected. Prevent item name display for vanilla runs. Change coloring of checks so the check name reflects status in vanilla runs. * Fixed "Recheck Area" button erroneously adding to an area's check totals? * Fix DMC vanilla checks. * Fix check tracker data recreation on data file loss. Removed redundant file exists check from SaveTrackerDataHook, as it doesn't matter if it exists or not at that point. Limited check loops to 3 to avoid infinite check loops on non-check/junk item pickup. Added more checks to disable tracker operations if a save is not running. Changed check ordering to put boss reward and heart container checks at the end of whatever RCSHOW group they belong to. * Fixed IsRunning calculation. Further improving vanilla checking. Starting framework for checking medallions, stones, and songs on data file recreation. Fixed medallion check collection. Added GIFT_FROM_SAGES to check list for vanilla file for tracking light medallion. Added check loop limitation to prevent infinite checking after picking up junk item from the ground. * Finished vanilla file recreation and recheck (songs and dungeon rewards all check properly now). This includes deku shield with KF shop item 3. Finished Gift from Raoru light medallion tracking for vanilla. Commented all CheckByScene functionality for now. * Fixed new save data file creation. Disabled entrance area calculation for now, as it only tracks the previous entrance for some reason. Fixed area detection for ToT checks. * GetCheckArea() now utilizes EntranceData almost exclusively, via either `gSaveContext.entranceIndex` or the entrance tracker's `currentGrottoId` in the case of grottos. This also means that EVERYTHING CAN AUTOSCROLL NOW. Entrance shuffles are now much easier to track. Autoscroll is now also triggered on save, just in case someone isn't autosaving and has a lot of checks that get converted to saved. * Fixed missing GS check in LW. * Added area scroll on toggling Show Hidden Items. May configure differently later. Fixed area detection for entrances in Gerudo Fortress/Valley and Collossus. Haunted wasteland doesn't autoscroll due to a bug in `OnTransitionEnd` hook, but checks still evaluate properly there. Rely on scene-based area detection if scene is a main overworld or dungeon scene. * Fixed grotto detection when shuffle is off. * Small code cleanup. Fixed Colossus hand chest checks. * Missing lus bump from merge conflict resolution * Fixed Colossus Grotto making `GetCheckArea` return Wasteland. * Improved OnItemReceive processing for non-token GS checks, since they can sometimes take long enough for the checking process to time out before the item is registered as received. * First attempt at thread safety for tracker data file writing. Seems to work, but might need more testing. * Fixed Recheck Area not unskipping items that register as saved. Improved delayed saving with autosaving, as the autosave triggered quite often before the tracker data save, making things not properly register as saved. * merge cleanup * Converted check tracker data to the sectional saves, adding `CheckTrackerData` to `SaveContext`. Implemented section ID returning and fullSave boolean passing to section functions from my PR temporarily for it to work properly. Moved `RandomizerCheckTrackerData` enum to `randomizerTypes.h` to accommodate that. Changed `Randomizer_SaveInit` to a `SaveManager::InitFunc` to allow for other randomizer-dependent sections to be initialized after that. Required a little refactoring to maintain intro cutscene skip when starting a randomizer file. * Revert section index return and randomizer init changes. Will need to wait on yet more changes to main. * Fixed check tracker initialization (shouldn't be tied to window initialization), restored saving/loading functionality. * Removed `CheckTracker::Init` and put SaveManager calls in `CheckTrackerWindow::InitElement`. Also a bit of cleanup from transition back to save file use. * Fixed tracker displaying check categories while file not loaded. * Fix Darunia's Joy check not marking in vanilla. * Fix autosave not triggering change from collected to saved in tracker data. * Changed default colors for scummed and collected display. * Merge upgrade code cleanup. * Add `OnTransitionEnd` calls to sandstorm transitions both to and from Wasteland. Also improved `gSaveContext.lastScene` assignment for both transition types. Allowed a bit of cleanup in `GetCheckArea`. * Added `StateButton`, a button like `ArrowButton` but that allows text instead of arrow icons. Apparently the changes from ArrowButton to StateButton happened in a previous commit... * Changed section name to `trackerDataCheck` to force SoH to load it after the randomizer section, as it required some randoSettings to be loaded first, and nothing else I tried to make the randomizer section load before it worked. This hacks a solution to checks not displaying on fast file load to a specific slot. F*** you, SaveManager, and f*** you too, JSON. * Forgot to change the section string for loading with the name change. * Fix check ordering for checks that trigger the autosave. * Adds option to remove right-side shop items (slots 1-4) from the tracker list. Enabled by default. * Fix default state of Hide Shop Right Checks checkbox. * Fixes grotto and great fairy scrolling and checks. Fixes array overflow from `checkTrackerData` which was creating the issue trying to load the base and randomizer sections first, among other things. That also fixed the massive file loads that were being exhibited in debug mode. * Fix shooting galleries being set as collected again when being played a second time after getting the checks. * Fix Bazaar autoscroll. * Add Saria's Song to `GetCheckFromActor` and removed some limitations from the messageCloseCheck function to make that check track properly. * Fix Song from Impa check. Implemented prevention for multiple "collections" of great fairies, just in case getting the health refill would trigger it with the previous setup. * Fix ice traps on GS tokens not triggering OnItemReceive. * Complete fix for ice trap collection from GS. Add autoscroll when clicking "Expand All". * Add `OnShopSlotChange` with cursorSlot and basePrice parameters. * Fixed include in en_ossan for shop slot hook. Added registration for `OnShopSlotChange` in the tracker, storing the price in a new `price` field in `CheckTrackerData`. Added "seen" functionality to shop checks. Displays the model item name upon first entering a shop, adding the price and switching to trickName (if it's an ice trap) upon navigating to the slot in buy mode, triggered by an invisible "identified" status that mirrors "seen" in every other way. Added tooltips to most options for check tracker color picking to describe what each status actually means. * `std::format` pls * So apparently std::format just decided to break with the latest merge from develop, but fmt::format exists and works? * Removed the last vestiges of `locationsSkipped`. Other general code and formatting cleanups. Moved `IsGameRunning` to `OTRGlobals` so the item tracker could also access it. Used preceding to "fix" item and bottle display in the item tracker on startup. * Some more code cleanup. Removed "Recheck Area" button and relevant code. Backported changes to Anchor branch applicable for single-player, including making a checkAreas vector and structuring the frame by frame checks around that. Also includes fix for Silver Gauntlets and Mirror Shield check collection crash associated with those changes. Fixed Kakariko Bazaar "seen" updates. Fixed tracker window not showing on initial load like it should. * Forgot 1 formatting fix. * Removed conditions for showing Song from Impa (isn't junk under certain conditions, so should show all the time). * Fix vanilla checks, add Zelda's Letter and Malon's Egg to manual check collection. Fix autoscroll while in child stealth section. * Fix crash in Happy Mask Shop in OnSlotChange (referenced non-existent shop id in a tracker-specific enum). * General code cleanup. * Missed one reversion. * One more. * Fix column alignment in `randomizer_check_objects`. * Fix file encoding on `randomizer_check_tracker`. Again. * Fix indentation for `actualItemtrackerItemMap`. Also removed unnecessary parts of the map. * Rename `HasEqItem` to `HasEquipment`. * Slightly better indentation for `actualItemTrackerItemMap`. * Add magic bean salesman to vanilla check tracking, and genericized deku shield to trigger KF shop item 3 wherever you get the shield. Renamed `vanillaCheck` to `vanillaHundoCheck` to (supposedly) clarify the meaning of the usage. * One more rename to `vanillaCompletion` to avoid possible confusion with 100% speedrun conditions. * give me a break XD Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * Changes suggested by briaguya (rename `RandomizerCheckShow` to `Status`, unused code, newline formatting) * Remove unused `itemNames` table. * Remove `IsGameRunning` in favor of `GameInteractor::IsSaveLoaded`. * Restore anti-spoiler functionality for dungeons with dungeon maps. * Review cleanup. * Fix prices not showing for Kak bazaar items. --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com>
2023-10-04 11:03:36 -04:00
bool showWeirdEgg;
bool showGerudoCard;
bool showFrogSongRupees;
bool showStartingMapsCompasses;
bool showKeysanity;
bool showGerudoFortressKeys;
bool showBossKeysanity;
bool showGanonBossKey;
bool showOcarinas;
bool show100SkullReward;
bool showLinksPocket;
bool fortressFast;
bool fortressNormal;
// persistent during gameplay
bool initialized;
bool doAreaScroll;
bool previousShowHidden = false;
bool hideShopRightChecks = true;
bool alwaysShowGS = false;
Check Tracker Update (#2668) * Initial commit. What works so far: Data file loads, saves, deletes, and is created properly. - Need to run `HasItemBeenCollected` when creating in case of mid-seed regen. Organized checks into maps set by area. Areas show in tracker. - Checks pulled from checkObjectsByArea are not currently listed. - Areas are being assumed completed and hidden at the start. * Checks now populate. Still not counting area totals properly. * Don't track RC_LINKS_POCKET in the data file, and instead manually add it in every time a save is load. rcObjects doesn't contain Link's Pocket location (duh). * Moved ItemReceive hook to randomizer_check_tracker.cpp. Skipped items are properly sorted and formatted. Saved items contribute to an area's gotten/skipped checks on load. Changed skipped items default main color to gray. General code cleanup. * Skipped checks now contribute to area totals for area completion logic. * Mid-menu rework transfer. * Started check lookup on item receive. Tried to enable scum checking on save. * Fixed scum check on save. * More code cleanup, which revealed some issues with loading and saving. Loading now works 100%, but entries in checkTrackerData are disappearing in code somewhere, causing issues with later checks. Scummed color now displays properly. Collected but unsaved displays properly. Unchecked, Skipped, Seen and Scummed checks all have arrows for skipping/unskipping. Counts a little messed up, probably double adding skips. * Fixed item counts being off across resets. Restarts were fine. * Beginning of rework for individual check updates. Adds `Actor lastCheck` to PlayState to allow assigning of last actor to give an item. This allows precise tracking of GS, freestanding PoH, etc. Works for chests too. Currently does not work for shops, unknown for normal NPC gives. Doesn't track last gives for non-checks, like drops from grass, pots, crates, etc. * Actor-based checks fully fleshed out, but can't help with sale-based checks. Implemented `pendingSaleCheck` to back out of an RC check cycle if `gSaveContext->pendingSale` is not NONE when `OnItemReceive` is called, processed through `OnSaleEnd`. This should be the final change necessary to streamline the checks. * Temporary hook to message box close to tie in trackers for non-gs/chest actors that aren't added to `GetCheckFromActor`. This triggers a 2-frame countdown to check with `HasItemBeenCollected` since half of the methods in there aren't updated until after a text box closes. Added scene tracking to get last scene so that checks in scenes that span several overworld areas could be tied to their areas properly. Modified tracker data creation to apply Link's Pocket and Song from Impa conditionally based on randomizer settings instead of just being assumed to be done. May need modification for checking click and drag spoiler loading. Removed the scene equivalence check from CheckChecks so that an entire area is checked each time to avoid issues with, e.g., leaving a shop before a pending sale finishes. * Changed check data creation to use RSKs from gRandomizer to account for settings loaded from drag and drop spoilers. * Beginning of tracker code organization. Changed check color defaults. * Reverted moving tracker colors to header. Some individual check fixes. * Missed something from previous merge? * Removed last remnant of removed performance mode. * Better handle checking when skullsanity is off. * Song checks sceneIDs don't match the scenes they're actually in for some reason. Removed that check. * SaleEnd checks don't need the GetItemEntry parameter. Also set a flag that should prevent the check tracker from running during vanilla saves should that not be resolved by the time it's merged. * Attempting to have only the relevant checks added to the tracker data, as well as showing vanilla checks for non-rando saves. Not working yet (everything is displayed in vanilla). * Added vanilla check tracker population via `vanillaCheck` bool in `RandomizerCheckObject`. This is also added to `IsVisibleInImGui` to handle file loading and saving to eliminate checks that aren't part of vanilla or the rando seed. Implemented deleted tracker data file recreation. Added some extra item name text checks. Songs are still... tricky, so they stay blank. Utilize local copies of the randomizer check objects that are applicable for performance purposes. Fixed vanilla item-giving cutscene crashes when triggered mid-transition. * Apparently not all toolchains can handle macro instantiation without all parameters, like VS can. * Fixed scummed detail color not showing properly on tracker. * Fixed dungeon area totals and GS checks not functioning properly. * Major revamp of checking code. Doesn't rely on `GetCheckFromActor` at all anymore, but instead simply sets a flag to evaluate a number of checks in an area every frame until the check that was gotten is identified. With the new setup, it's much less hardware intensive, and at 60fps 6 checks per frame shows no noticeable effect on framerate. I can envision needing to add a collectedCount in order to account for times when two checks are gotten one right after the other. Changed area scroll to happen from `OnTransitionEnd`, and allow for scrolling in bazaar (was disabled previously because it would jump back and forth between Kak and Market while you were in one). Also setup area check order updating by area instead of all at the same time. * Fixed shooting gallery not reporting proper area. Prevent checks from actually happening if area is RCAREA_INVALID, now that all areas are reporting something if they have checks. Fixed `GetCheckArea()` not updating checks for standard scenes. Lots of vanilla tracking updates, mainly manual checks for gems, medallions and songs, since the often don't have proper scenes in the data. Prevent vanilla from triggering check loops if junk items are collected. Fixed sorting based on saved vs collected. Prevent item name display for vanilla runs. Change coloring of checks so the check name reflects status in vanilla runs. * Fixed "Recheck Area" button erroneously adding to an area's check totals? * Fix DMC vanilla checks. * Fix check tracker data recreation on data file loss. Removed redundant file exists check from SaveTrackerDataHook, as it doesn't matter if it exists or not at that point. Limited check loops to 3 to avoid infinite check loops on non-check/junk item pickup. Added more checks to disable tracker operations if a save is not running. Changed check ordering to put boss reward and heart container checks at the end of whatever RCSHOW group they belong to. * Fixed IsRunning calculation. Further improving vanilla checking. Starting framework for checking medallions, stones, and songs on data file recreation. Fixed medallion check collection. Added GIFT_FROM_SAGES to check list for vanilla file for tracking light medallion. Added check loop limitation to prevent infinite checking after picking up junk item from the ground. * Finished vanilla file recreation and recheck (songs and dungeon rewards all check properly now). This includes deku shield with KF shop item 3. Finished Gift from Raoru light medallion tracking for vanilla. Commented all CheckByScene functionality for now. * Fixed new save data file creation. Disabled entrance area calculation for now, as it only tracks the previous entrance for some reason. Fixed area detection for ToT checks. * GetCheckArea() now utilizes EntranceData almost exclusively, via either `gSaveContext.entranceIndex` or the entrance tracker's `currentGrottoId` in the case of grottos. This also means that EVERYTHING CAN AUTOSCROLL NOW. Entrance shuffles are now much easier to track. Autoscroll is now also triggered on save, just in case someone isn't autosaving and has a lot of checks that get converted to saved. * Fixed missing GS check in LW. * Added area scroll on toggling Show Hidden Items. May configure differently later. Fixed area detection for entrances in Gerudo Fortress/Valley and Collossus. Haunted wasteland doesn't autoscroll due to a bug in `OnTransitionEnd` hook, but checks still evaluate properly there. Rely on scene-based area detection if scene is a main overworld or dungeon scene. * Fixed grotto detection when shuffle is off. * Small code cleanup. Fixed Colossus hand chest checks. * Missing lus bump from merge conflict resolution * Fixed Colossus Grotto making `GetCheckArea` return Wasteland. * Improved OnItemReceive processing for non-token GS checks, since they can sometimes take long enough for the checking process to time out before the item is registered as received. * First attempt at thread safety for tracker data file writing. Seems to work, but might need more testing. * Fixed Recheck Area not unskipping items that register as saved. Improved delayed saving with autosaving, as the autosave triggered quite often before the tracker data save, making things not properly register as saved. * merge cleanup * Converted check tracker data to the sectional saves, adding `CheckTrackerData` to `SaveContext`. Implemented section ID returning and fullSave boolean passing to section functions from my PR temporarily for it to work properly. Moved `RandomizerCheckTrackerData` enum to `randomizerTypes.h` to accommodate that. Changed `Randomizer_SaveInit` to a `SaveManager::InitFunc` to allow for other randomizer-dependent sections to be initialized after that. Required a little refactoring to maintain intro cutscene skip when starting a randomizer file. * Revert section index return and randomizer init changes. Will need to wait on yet more changes to main. * Fixed check tracker initialization (shouldn't be tied to window initialization), restored saving/loading functionality. * Removed `CheckTracker::Init` and put SaveManager calls in `CheckTrackerWindow::InitElement`. Also a bit of cleanup from transition back to save file use. * Fixed tracker displaying check categories while file not loaded. * Fix Darunia's Joy check not marking in vanilla. * Fix autosave not triggering change from collected to saved in tracker data. * Changed default colors for scummed and collected display. * Merge upgrade code cleanup. * Add `OnTransitionEnd` calls to sandstorm transitions both to and from Wasteland. Also improved `gSaveContext.lastScene` assignment for both transition types. Allowed a bit of cleanup in `GetCheckArea`. * Added `StateButton`, a button like `ArrowButton` but that allows text instead of arrow icons. Apparently the changes from ArrowButton to StateButton happened in a previous commit... * Changed section name to `trackerDataCheck` to force SoH to load it after the randomizer section, as it required some randoSettings to be loaded first, and nothing else I tried to make the randomizer section load before it worked. This hacks a solution to checks not displaying on fast file load to a specific slot. F*** you, SaveManager, and f*** you too, JSON. * Forgot to change the section string for loading with the name change. * Fix check ordering for checks that trigger the autosave. * Adds option to remove right-side shop items (slots 1-4) from the tracker list. Enabled by default. * Fix default state of Hide Shop Right Checks checkbox. * Fixes grotto and great fairy scrolling and checks. Fixes array overflow from `checkTrackerData` which was creating the issue trying to load the base and randomizer sections first, among other things. That also fixed the massive file loads that were being exhibited in debug mode. * Fix shooting galleries being set as collected again when being played a second time after getting the checks. * Fix Bazaar autoscroll. * Add Saria's Song to `GetCheckFromActor` and removed some limitations from the messageCloseCheck function to make that check track properly. * Fix Song from Impa check. Implemented prevention for multiple "collections" of great fairies, just in case getting the health refill would trigger it with the previous setup. * Fix ice traps on GS tokens not triggering OnItemReceive. * Complete fix for ice trap collection from GS. Add autoscroll when clicking "Expand All". * Add `OnShopSlotChange` with cursorSlot and basePrice parameters. * Fixed include in en_ossan for shop slot hook. Added registration for `OnShopSlotChange` in the tracker, storing the price in a new `price` field in `CheckTrackerData`. Added "seen" functionality to shop checks. Displays the model item name upon first entering a shop, adding the price and switching to trickName (if it's an ice trap) upon navigating to the slot in buy mode, triggered by an invisible "identified" status that mirrors "seen" in every other way. Added tooltips to most options for check tracker color picking to describe what each status actually means. * `std::format` pls * So apparently std::format just decided to break with the latest merge from develop, but fmt::format exists and works? * Removed the last vestiges of `locationsSkipped`. Other general code and formatting cleanups. Moved `IsGameRunning` to `OTRGlobals` so the item tracker could also access it. Used preceding to "fix" item and bottle display in the item tracker on startup. * Some more code cleanup. Removed "Recheck Area" button and relevant code. Backported changes to Anchor branch applicable for single-player, including making a checkAreas vector and structuring the frame by frame checks around that. Also includes fix for Silver Gauntlets and Mirror Shield check collection crash associated with those changes. Fixed Kakariko Bazaar "seen" updates. Fixed tracker window not showing on initial load like it should. * Forgot 1 formatting fix. * Removed conditions for showing Song from Impa (isn't junk under certain conditions, so should show all the time). * Fix vanilla checks, add Zelda's Letter and Malon's Egg to manual check collection. Fix autoscroll while in child stealth section. * Fix crash in Happy Mask Shop in OnSlotChange (referenced non-existent shop id in a tracker-specific enum). * General code cleanup. * Missed one reversion. * One more. * Fix column alignment in `randomizer_check_objects`. * Fix file encoding on `randomizer_check_tracker`. Again. * Fix indentation for `actualItemtrackerItemMap`. Also removed unnecessary parts of the map. * Rename `HasEqItem` to `HasEquipment`. * Slightly better indentation for `actualItemTrackerItemMap`. * Add magic bean salesman to vanilla check tracking, and genericized deku shield to trigger KF shop item 3 wherever you get the shield. Renamed `vanillaCheck` to `vanillaHundoCheck` to (supposedly) clarify the meaning of the usage. * One more rename to `vanillaCompletion` to avoid possible confusion with 100% speedrun conditions. * give me a break XD Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * Changes suggested by briaguya (rename `RandomizerCheckShow` to `Status`, unused code, newline formatting) * Remove unused `itemNames` table. * Remove `IsGameRunning` in favor of `GameInteractor::IsSaveLoaded`. * Restore anti-spoiler functionality for dungeons with dungeon maps. * Review cleanup. * Fix prices not showing for Kak bazaar items. --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com>
2023-10-04 11:03:36 -04:00
std::map<uint32_t, RandomizerCheck> startingShopItem = { { SCENE_KOKIRI_SHOP, RC_KF_SHOP_ITEM_1 },
{ SCENE_BAZAAR, RC_MARKET_BAZAAR_ITEM_1 },
{ SCENE_POTION_SHOP_MARKET, RC_MARKET_POTION_SHOP_ITEM_1 },
{ SCENE_BOMBCHU_SHOP, RC_MARKET_BOMBCHU_SHOP_ITEM_1 },
{ SCENE_POTION_SHOP_KAKARIKO, RC_KAK_POTION_SHOP_ITEM_1 },
{ SCENE_ZORA_SHOP, RC_ZD_SHOP_ITEM_1 },
{ SCENE_GORON_SHOP, RC_GC_SHOP_ITEM_1 } };
std::map<SceneID, RandomizerCheckArea> DungeonRCAreasBySceneID = {
Check Tracker Update (#2668) * Initial commit. What works so far: Data file loads, saves, deletes, and is created properly. - Need to run `HasItemBeenCollected` when creating in case of mid-seed regen. Organized checks into maps set by area. Areas show in tracker. - Checks pulled from checkObjectsByArea are not currently listed. - Areas are being assumed completed and hidden at the start. * Checks now populate. Still not counting area totals properly. * Don't track RC_LINKS_POCKET in the data file, and instead manually add it in every time a save is load. rcObjects doesn't contain Link's Pocket location (duh). * Moved ItemReceive hook to randomizer_check_tracker.cpp. Skipped items are properly sorted and formatted. Saved items contribute to an area's gotten/skipped checks on load. Changed skipped items default main color to gray. General code cleanup. * Skipped checks now contribute to area totals for area completion logic. * Mid-menu rework transfer. * Started check lookup on item receive. Tried to enable scum checking on save. * Fixed scum check on save. * More code cleanup, which revealed some issues with loading and saving. Loading now works 100%, but entries in checkTrackerData are disappearing in code somewhere, causing issues with later checks. Scummed color now displays properly. Collected but unsaved displays properly. Unchecked, Skipped, Seen and Scummed checks all have arrows for skipping/unskipping. Counts a little messed up, probably double adding skips. * Fixed item counts being off across resets. Restarts were fine. * Beginning of rework for individual check updates. Adds `Actor lastCheck` to PlayState to allow assigning of last actor to give an item. This allows precise tracking of GS, freestanding PoH, etc. Works for chests too. Currently does not work for shops, unknown for normal NPC gives. Doesn't track last gives for non-checks, like drops from grass, pots, crates, etc. * Actor-based checks fully fleshed out, but can't help with sale-based checks. Implemented `pendingSaleCheck` to back out of an RC check cycle if `gSaveContext->pendingSale` is not NONE when `OnItemReceive` is called, processed through `OnSaleEnd`. This should be the final change necessary to streamline the checks. * Temporary hook to message box close to tie in trackers for non-gs/chest actors that aren't added to `GetCheckFromActor`. This triggers a 2-frame countdown to check with `HasItemBeenCollected` since half of the methods in there aren't updated until after a text box closes. Added scene tracking to get last scene so that checks in scenes that span several overworld areas could be tied to their areas properly. Modified tracker data creation to apply Link's Pocket and Song from Impa conditionally based on randomizer settings instead of just being assumed to be done. May need modification for checking click and drag spoiler loading. Removed the scene equivalence check from CheckChecks so that an entire area is checked each time to avoid issues with, e.g., leaving a shop before a pending sale finishes. * Changed check data creation to use RSKs from gRandomizer to account for settings loaded from drag and drop spoilers. * Beginning of tracker code organization. Changed check color defaults. * Reverted moving tracker colors to header. Some individual check fixes. * Missed something from previous merge? * Removed last remnant of removed performance mode. * Better handle checking when skullsanity is off. * Song checks sceneIDs don't match the scenes they're actually in for some reason. Removed that check. * SaleEnd checks don't need the GetItemEntry parameter. Also set a flag that should prevent the check tracker from running during vanilla saves should that not be resolved by the time it's merged. * Attempting to have only the relevant checks added to the tracker data, as well as showing vanilla checks for non-rando saves. Not working yet (everything is displayed in vanilla). * Added vanilla check tracker population via `vanillaCheck` bool in `RandomizerCheckObject`. This is also added to `IsVisibleInImGui` to handle file loading and saving to eliminate checks that aren't part of vanilla or the rando seed. Implemented deleted tracker data file recreation. Added some extra item name text checks. Songs are still... tricky, so they stay blank. Utilize local copies of the randomizer check objects that are applicable for performance purposes. Fixed vanilla item-giving cutscene crashes when triggered mid-transition. * Apparently not all toolchains can handle macro instantiation without all parameters, like VS can. * Fixed scummed detail color not showing properly on tracker. * Fixed dungeon area totals and GS checks not functioning properly. * Major revamp of checking code. Doesn't rely on `GetCheckFromActor` at all anymore, but instead simply sets a flag to evaluate a number of checks in an area every frame until the check that was gotten is identified. With the new setup, it's much less hardware intensive, and at 60fps 6 checks per frame shows no noticeable effect on framerate. I can envision needing to add a collectedCount in order to account for times when two checks are gotten one right after the other. Changed area scroll to happen from `OnTransitionEnd`, and allow for scrolling in bazaar (was disabled previously because it would jump back and forth between Kak and Market while you were in one). Also setup area check order updating by area instead of all at the same time. * Fixed shooting gallery not reporting proper area. Prevent checks from actually happening if area is RCAREA_INVALID, now that all areas are reporting something if they have checks. Fixed `GetCheckArea()` not updating checks for standard scenes. Lots of vanilla tracking updates, mainly manual checks for gems, medallions and songs, since the often don't have proper scenes in the data. Prevent vanilla from triggering check loops if junk items are collected. Fixed sorting based on saved vs collected. Prevent item name display for vanilla runs. Change coloring of checks so the check name reflects status in vanilla runs. * Fixed "Recheck Area" button erroneously adding to an area's check totals? * Fix DMC vanilla checks. * Fix check tracker data recreation on data file loss. Removed redundant file exists check from SaveTrackerDataHook, as it doesn't matter if it exists or not at that point. Limited check loops to 3 to avoid infinite check loops on non-check/junk item pickup. Added more checks to disable tracker operations if a save is not running. Changed check ordering to put boss reward and heart container checks at the end of whatever RCSHOW group they belong to. * Fixed IsRunning calculation. Further improving vanilla checking. Starting framework for checking medallions, stones, and songs on data file recreation. Fixed medallion check collection. Added GIFT_FROM_SAGES to check list for vanilla file for tracking light medallion. Added check loop limitation to prevent infinite checking after picking up junk item from the ground. * Finished vanilla file recreation and recheck (songs and dungeon rewards all check properly now). This includes deku shield with KF shop item 3. Finished Gift from Raoru light medallion tracking for vanilla. Commented all CheckByScene functionality for now. * Fixed new save data file creation. Disabled entrance area calculation for now, as it only tracks the previous entrance for some reason. Fixed area detection for ToT checks. * GetCheckArea() now utilizes EntranceData almost exclusively, via either `gSaveContext.entranceIndex` or the entrance tracker's `currentGrottoId` in the case of grottos. This also means that EVERYTHING CAN AUTOSCROLL NOW. Entrance shuffles are now much easier to track. Autoscroll is now also triggered on save, just in case someone isn't autosaving and has a lot of checks that get converted to saved. * Fixed missing GS check in LW. * Added area scroll on toggling Show Hidden Items. May configure differently later. Fixed area detection for entrances in Gerudo Fortress/Valley and Collossus. Haunted wasteland doesn't autoscroll due to a bug in `OnTransitionEnd` hook, but checks still evaluate properly there. Rely on scene-based area detection if scene is a main overworld or dungeon scene. * Fixed grotto detection when shuffle is off. * Small code cleanup. Fixed Colossus hand chest checks. * Missing lus bump from merge conflict resolution * Fixed Colossus Grotto making `GetCheckArea` return Wasteland. * Improved OnItemReceive processing for non-token GS checks, since they can sometimes take long enough for the checking process to time out before the item is registered as received. * First attempt at thread safety for tracker data file writing. Seems to work, but might need more testing. * Fixed Recheck Area not unskipping items that register as saved. Improved delayed saving with autosaving, as the autosave triggered quite often before the tracker data save, making things not properly register as saved. * merge cleanup * Converted check tracker data to the sectional saves, adding `CheckTrackerData` to `SaveContext`. Implemented section ID returning and fullSave boolean passing to section functions from my PR temporarily for it to work properly. Moved `RandomizerCheckTrackerData` enum to `randomizerTypes.h` to accommodate that. Changed `Randomizer_SaveInit` to a `SaveManager::InitFunc` to allow for other randomizer-dependent sections to be initialized after that. Required a little refactoring to maintain intro cutscene skip when starting a randomizer file. * Revert section index return and randomizer init changes. Will need to wait on yet more changes to main. * Fixed check tracker initialization (shouldn't be tied to window initialization), restored saving/loading functionality. * Removed `CheckTracker::Init` and put SaveManager calls in `CheckTrackerWindow::InitElement`. Also a bit of cleanup from transition back to save file use. * Fixed tracker displaying check categories while file not loaded. * Fix Darunia's Joy check not marking in vanilla. * Fix autosave not triggering change from collected to saved in tracker data. * Changed default colors for scummed and collected display. * Merge upgrade code cleanup. * Add `OnTransitionEnd` calls to sandstorm transitions both to and from Wasteland. Also improved `gSaveContext.lastScene` assignment for both transition types. Allowed a bit of cleanup in `GetCheckArea`. * Added `StateButton`, a button like `ArrowButton` but that allows text instead of arrow icons. Apparently the changes from ArrowButton to StateButton happened in a previous commit... * Changed section name to `trackerDataCheck` to force SoH to load it after the randomizer section, as it required some randoSettings to be loaded first, and nothing else I tried to make the randomizer section load before it worked. This hacks a solution to checks not displaying on fast file load to a specific slot. F*** you, SaveManager, and f*** you too, JSON. * Forgot to change the section string for loading with the name change. * Fix check ordering for checks that trigger the autosave. * Adds option to remove right-side shop items (slots 1-4) from the tracker list. Enabled by default. * Fix default state of Hide Shop Right Checks checkbox. * Fixes grotto and great fairy scrolling and checks. Fixes array overflow from `checkTrackerData` which was creating the issue trying to load the base and randomizer sections first, among other things. That also fixed the massive file loads that were being exhibited in debug mode. * Fix shooting galleries being set as collected again when being played a second time after getting the checks. * Fix Bazaar autoscroll. * Add Saria's Song to `GetCheckFromActor` and removed some limitations from the messageCloseCheck function to make that check track properly. * Fix Song from Impa check. Implemented prevention for multiple "collections" of great fairies, just in case getting the health refill would trigger it with the previous setup. * Fix ice traps on GS tokens not triggering OnItemReceive. * Complete fix for ice trap collection from GS. Add autoscroll when clicking "Expand All". * Add `OnShopSlotChange` with cursorSlot and basePrice parameters. * Fixed include in en_ossan for shop slot hook. Added registration for `OnShopSlotChange` in the tracker, storing the price in a new `price` field in `CheckTrackerData`. Added "seen" functionality to shop checks. Displays the model item name upon first entering a shop, adding the price and switching to trickName (if it's an ice trap) upon navigating to the slot in buy mode, triggered by an invisible "identified" status that mirrors "seen" in every other way. Added tooltips to most options for check tracker color picking to describe what each status actually means. * `std::format` pls * So apparently std::format just decided to break with the latest merge from develop, but fmt::format exists and works? * Removed the last vestiges of `locationsSkipped`. Other general code and formatting cleanups. Moved `IsGameRunning` to `OTRGlobals` so the item tracker could also access it. Used preceding to "fix" item and bottle display in the item tracker on startup. * Some more code cleanup. Removed "Recheck Area" button and relevant code. Backported changes to Anchor branch applicable for single-player, including making a checkAreas vector and structuring the frame by frame checks around that. Also includes fix for Silver Gauntlets and Mirror Shield check collection crash associated with those changes. Fixed Kakariko Bazaar "seen" updates. Fixed tracker window not showing on initial load like it should. * Forgot 1 formatting fix. * Removed conditions for showing Song from Impa (isn't junk under certain conditions, so should show all the time). * Fix vanilla checks, add Zelda's Letter and Malon's Egg to manual check collection. Fix autoscroll while in child stealth section. * Fix crash in Happy Mask Shop in OnSlotChange (referenced non-existent shop id in a tracker-specific enum). * General code cleanup. * Missed one reversion. * One more. * Fix column alignment in `randomizer_check_objects`. * Fix file encoding on `randomizer_check_tracker`. Again. * Fix indentation for `actualItemtrackerItemMap`. Also removed unnecessary parts of the map. * Rename `HasEqItem` to `HasEquipment`. * Slightly better indentation for `actualItemTrackerItemMap`. * Add magic bean salesman to vanilla check tracking, and genericized deku shield to trigger KF shop item 3 wherever you get the shield. Renamed `vanillaCheck` to `vanillaHundoCheck` to (supposedly) clarify the meaning of the usage. * One more rename to `vanillaCompletion` to avoid possible confusion with 100% speedrun conditions. * give me a break XD Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * Changes suggested by briaguya (rename `RandomizerCheckShow` to `Status`, unused code, newline formatting) * Remove unused `itemNames` table. * Remove `IsGameRunning` in favor of `GameInteractor::IsSaveLoaded`. * Restore anti-spoiler functionality for dungeons with dungeon maps. * Review cleanup. * Fix prices not showing for Kak bazaar items. --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com>
2023-10-04 11:03:36 -04:00
{SCENE_DEKU_TREE, RCAREA_DEKU_TREE},
{SCENE_DODONGOS_CAVERN, RCAREA_DODONGOS_CAVERN},
{SCENE_JABU_JABU, RCAREA_JABU_JABUS_BELLY},
{SCENE_FOREST_TEMPLE, RCAREA_FOREST_TEMPLE},
{SCENE_FIRE_TEMPLE, RCAREA_FIRE_TEMPLE},
{SCENE_WATER_TEMPLE, RCAREA_WATER_TEMPLE},
{SCENE_SHADOW_TEMPLE, RCAREA_SHADOW_TEMPLE},
{SCENE_SPIRIT_TEMPLE, RCAREA_SPIRIT_TEMPLE},
{SCENE_BOTTOM_OF_THE_WELL, RCAREA_BOTTOM_OF_THE_WELL},
{SCENE_ICE_CAVERN, RCAREA_ICE_CAVERN},
{SCENE_GERUDO_TRAINING_GROUND, RCAREA_GERUDO_TRAINING_GROUND},
{SCENE_INSIDE_GANONS_CASTLE, RCAREA_GANONS_CASTLE},
};
std::map<RandomizerCheckArea, std::vector<RandomizerCheckObject>> checksByArea;
bool areasFullyChecked[RCAREA_INVALID];
u32 areasSpoiled = 0;
bool showVOrMQ;
s8 areaChecksGotten[RCAREA_INVALID]; //| "Kokiri Forest (4/9)"
s8 areaCheckTotals[RCAREA_INVALID];
bool optCollapseAll; // A bool that will collapse all checks once
Check Tracker Update (#2668) * Initial commit. What works so far: Data file loads, saves, deletes, and is created properly. - Need to run `HasItemBeenCollected` when creating in case of mid-seed regen. Organized checks into maps set by area. Areas show in tracker. - Checks pulled from checkObjectsByArea are not currently listed. - Areas are being assumed completed and hidden at the start. * Checks now populate. Still not counting area totals properly. * Don't track RC_LINKS_POCKET in the data file, and instead manually add it in every time a save is load. rcObjects doesn't contain Link's Pocket location (duh). * Moved ItemReceive hook to randomizer_check_tracker.cpp. Skipped items are properly sorted and formatted. Saved items contribute to an area's gotten/skipped checks on load. Changed skipped items default main color to gray. General code cleanup. * Skipped checks now contribute to area totals for area completion logic. * Mid-menu rework transfer. * Started check lookup on item receive. Tried to enable scum checking on save. * Fixed scum check on save. * More code cleanup, which revealed some issues with loading and saving. Loading now works 100%, but entries in checkTrackerData are disappearing in code somewhere, causing issues with later checks. Scummed color now displays properly. Collected but unsaved displays properly. Unchecked, Skipped, Seen and Scummed checks all have arrows for skipping/unskipping. Counts a little messed up, probably double adding skips. * Fixed item counts being off across resets. Restarts were fine. * Beginning of rework for individual check updates. Adds `Actor lastCheck` to PlayState to allow assigning of last actor to give an item. This allows precise tracking of GS, freestanding PoH, etc. Works for chests too. Currently does not work for shops, unknown for normal NPC gives. Doesn't track last gives for non-checks, like drops from grass, pots, crates, etc. * Actor-based checks fully fleshed out, but can't help with sale-based checks. Implemented `pendingSaleCheck` to back out of an RC check cycle if `gSaveContext->pendingSale` is not NONE when `OnItemReceive` is called, processed through `OnSaleEnd`. This should be the final change necessary to streamline the checks. * Temporary hook to message box close to tie in trackers for non-gs/chest actors that aren't added to `GetCheckFromActor`. This triggers a 2-frame countdown to check with `HasItemBeenCollected` since half of the methods in there aren't updated until after a text box closes. Added scene tracking to get last scene so that checks in scenes that span several overworld areas could be tied to their areas properly. Modified tracker data creation to apply Link's Pocket and Song from Impa conditionally based on randomizer settings instead of just being assumed to be done. May need modification for checking click and drag spoiler loading. Removed the scene equivalence check from CheckChecks so that an entire area is checked each time to avoid issues with, e.g., leaving a shop before a pending sale finishes. * Changed check data creation to use RSKs from gRandomizer to account for settings loaded from drag and drop spoilers. * Beginning of tracker code organization. Changed check color defaults. * Reverted moving tracker colors to header. Some individual check fixes. * Missed something from previous merge? * Removed last remnant of removed performance mode. * Better handle checking when skullsanity is off. * Song checks sceneIDs don't match the scenes they're actually in for some reason. Removed that check. * SaleEnd checks don't need the GetItemEntry parameter. Also set a flag that should prevent the check tracker from running during vanilla saves should that not be resolved by the time it's merged. * Attempting to have only the relevant checks added to the tracker data, as well as showing vanilla checks for non-rando saves. Not working yet (everything is displayed in vanilla). * Added vanilla check tracker population via `vanillaCheck` bool in `RandomizerCheckObject`. This is also added to `IsVisibleInImGui` to handle file loading and saving to eliminate checks that aren't part of vanilla or the rando seed. Implemented deleted tracker data file recreation. Added some extra item name text checks. Songs are still... tricky, so they stay blank. Utilize local copies of the randomizer check objects that are applicable for performance purposes. Fixed vanilla item-giving cutscene crashes when triggered mid-transition. * Apparently not all toolchains can handle macro instantiation without all parameters, like VS can. * Fixed scummed detail color not showing properly on tracker. * Fixed dungeon area totals and GS checks not functioning properly. * Major revamp of checking code. Doesn't rely on `GetCheckFromActor` at all anymore, but instead simply sets a flag to evaluate a number of checks in an area every frame until the check that was gotten is identified. With the new setup, it's much less hardware intensive, and at 60fps 6 checks per frame shows no noticeable effect on framerate. I can envision needing to add a collectedCount in order to account for times when two checks are gotten one right after the other. Changed area scroll to happen from `OnTransitionEnd`, and allow for scrolling in bazaar (was disabled previously because it would jump back and forth between Kak and Market while you were in one). Also setup area check order updating by area instead of all at the same time. * Fixed shooting gallery not reporting proper area. Prevent checks from actually happening if area is RCAREA_INVALID, now that all areas are reporting something if they have checks. Fixed `GetCheckArea()` not updating checks for standard scenes. Lots of vanilla tracking updates, mainly manual checks for gems, medallions and songs, since the often don't have proper scenes in the data. Prevent vanilla from triggering check loops if junk items are collected. Fixed sorting based on saved vs collected. Prevent item name display for vanilla runs. Change coloring of checks so the check name reflects status in vanilla runs. * Fixed "Recheck Area" button erroneously adding to an area's check totals? * Fix DMC vanilla checks. * Fix check tracker data recreation on data file loss. Removed redundant file exists check from SaveTrackerDataHook, as it doesn't matter if it exists or not at that point. Limited check loops to 3 to avoid infinite check loops on non-check/junk item pickup. Added more checks to disable tracker operations if a save is not running. Changed check ordering to put boss reward and heart container checks at the end of whatever RCSHOW group they belong to. * Fixed IsRunning calculation. Further improving vanilla checking. Starting framework for checking medallions, stones, and songs on data file recreation. Fixed medallion check collection. Added GIFT_FROM_SAGES to check list for vanilla file for tracking light medallion. Added check loop limitation to prevent infinite checking after picking up junk item from the ground. * Finished vanilla file recreation and recheck (songs and dungeon rewards all check properly now). This includes deku shield with KF shop item 3. Finished Gift from Raoru light medallion tracking for vanilla. Commented all CheckByScene functionality for now. * Fixed new save data file creation. Disabled entrance area calculation for now, as it only tracks the previous entrance for some reason. Fixed area detection for ToT checks. * GetCheckArea() now utilizes EntranceData almost exclusively, via either `gSaveContext.entranceIndex` or the entrance tracker's `currentGrottoId` in the case of grottos. This also means that EVERYTHING CAN AUTOSCROLL NOW. Entrance shuffles are now much easier to track. Autoscroll is now also triggered on save, just in case someone isn't autosaving and has a lot of checks that get converted to saved. * Fixed missing GS check in LW. * Added area scroll on toggling Show Hidden Items. May configure differently later. Fixed area detection for entrances in Gerudo Fortress/Valley and Collossus. Haunted wasteland doesn't autoscroll due to a bug in `OnTransitionEnd` hook, but checks still evaluate properly there. Rely on scene-based area detection if scene is a main overworld or dungeon scene. * Fixed grotto detection when shuffle is off. * Small code cleanup. Fixed Colossus hand chest checks. * Missing lus bump from merge conflict resolution * Fixed Colossus Grotto making `GetCheckArea` return Wasteland. * Improved OnItemReceive processing for non-token GS checks, since they can sometimes take long enough for the checking process to time out before the item is registered as received. * First attempt at thread safety for tracker data file writing. Seems to work, but might need more testing. * Fixed Recheck Area not unskipping items that register as saved. Improved delayed saving with autosaving, as the autosave triggered quite often before the tracker data save, making things not properly register as saved. * merge cleanup * Converted check tracker data to the sectional saves, adding `CheckTrackerData` to `SaveContext`. Implemented section ID returning and fullSave boolean passing to section functions from my PR temporarily for it to work properly. Moved `RandomizerCheckTrackerData` enum to `randomizerTypes.h` to accommodate that. Changed `Randomizer_SaveInit` to a `SaveManager::InitFunc` to allow for other randomizer-dependent sections to be initialized after that. Required a little refactoring to maintain intro cutscene skip when starting a randomizer file. * Revert section index return and randomizer init changes. Will need to wait on yet more changes to main. * Fixed check tracker initialization (shouldn't be tied to window initialization), restored saving/loading functionality. * Removed `CheckTracker::Init` and put SaveManager calls in `CheckTrackerWindow::InitElement`. Also a bit of cleanup from transition back to save file use. * Fixed tracker displaying check categories while file not loaded. * Fix Darunia's Joy check not marking in vanilla. * Fix autosave not triggering change from collected to saved in tracker data. * Changed default colors for scummed and collected display. * Merge upgrade code cleanup. * Add `OnTransitionEnd` calls to sandstorm transitions both to and from Wasteland. Also improved `gSaveContext.lastScene` assignment for both transition types. Allowed a bit of cleanup in `GetCheckArea`. * Added `StateButton`, a button like `ArrowButton` but that allows text instead of arrow icons. Apparently the changes from ArrowButton to StateButton happened in a previous commit... * Changed section name to `trackerDataCheck` to force SoH to load it after the randomizer section, as it required some randoSettings to be loaded first, and nothing else I tried to make the randomizer section load before it worked. This hacks a solution to checks not displaying on fast file load to a specific slot. F*** you, SaveManager, and f*** you too, JSON. * Forgot to change the section string for loading with the name change. * Fix check ordering for checks that trigger the autosave. * Adds option to remove right-side shop items (slots 1-4) from the tracker list. Enabled by default. * Fix default state of Hide Shop Right Checks checkbox. * Fixes grotto and great fairy scrolling and checks. Fixes array overflow from `checkTrackerData` which was creating the issue trying to load the base and randomizer sections first, among other things. That also fixed the massive file loads that were being exhibited in debug mode. * Fix shooting galleries being set as collected again when being played a second time after getting the checks. * Fix Bazaar autoscroll. * Add Saria's Song to `GetCheckFromActor` and removed some limitations from the messageCloseCheck function to make that check track properly. * Fix Song from Impa check. Implemented prevention for multiple "collections" of great fairies, just in case getting the health refill would trigger it with the previous setup. * Fix ice traps on GS tokens not triggering OnItemReceive. * Complete fix for ice trap collection from GS. Add autoscroll when clicking "Expand All". * Add `OnShopSlotChange` with cursorSlot and basePrice parameters. * Fixed include in en_ossan for shop slot hook. Added registration for `OnShopSlotChange` in the tracker, storing the price in a new `price` field in `CheckTrackerData`. Added "seen" functionality to shop checks. Displays the model item name upon first entering a shop, adding the price and switching to trickName (if it's an ice trap) upon navigating to the slot in buy mode, triggered by an invisible "identified" status that mirrors "seen" in every other way. Added tooltips to most options for check tracker color picking to describe what each status actually means. * `std::format` pls * So apparently std::format just decided to break with the latest merge from develop, but fmt::format exists and works? * Removed the last vestiges of `locationsSkipped`. Other general code and formatting cleanups. Moved `IsGameRunning` to `OTRGlobals` so the item tracker could also access it. Used preceding to "fix" item and bottle display in the item tracker on startup. * Some more code cleanup. Removed "Recheck Area" button and relevant code. Backported changes to Anchor branch applicable for single-player, including making a checkAreas vector and structuring the frame by frame checks around that. Also includes fix for Silver Gauntlets and Mirror Shield check collection crash associated with those changes. Fixed Kakariko Bazaar "seen" updates. Fixed tracker window not showing on initial load like it should. * Forgot 1 formatting fix. * Removed conditions for showing Song from Impa (isn't junk under certain conditions, so should show all the time). * Fix vanilla checks, add Zelda's Letter and Malon's Egg to manual check collection. Fix autoscroll while in child stealth section. * Fix crash in Happy Mask Shop in OnSlotChange (referenced non-existent shop id in a tracker-specific enum). * General code cleanup. * Missed one reversion. * One more. * Fix column alignment in `randomizer_check_objects`. * Fix file encoding on `randomizer_check_tracker`. Again. * Fix indentation for `actualItemtrackerItemMap`. Also removed unnecessary parts of the map. * Rename `HasEqItem` to `HasEquipment`. * Slightly better indentation for `actualItemTrackerItemMap`. * Add magic bean salesman to vanilla check tracking, and genericized deku shield to trigger KF shop item 3 wherever you get the shield. Renamed `vanillaCheck` to `vanillaHundoCheck` to (supposedly) clarify the meaning of the usage. * One more rename to `vanillaCompletion` to avoid possible confusion with 100% speedrun conditions. * give me a break XD Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * Changes suggested by briaguya (rename `RandomizerCheckShow` to `Status`, unused code, newline formatting) * Remove unused `itemNames` table. * Remove `IsGameRunning` in favor of `GameInteractor::IsSaveLoaded`. * Restore anti-spoiler functionality for dungeons with dungeon maps. * Review cleanup. * Fix prices not showing for Kak bazaar items. --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com>
2023-10-04 11:03:36 -04:00
bool optExpandAll; // A bool that will expand all checks once
RandomizerCheck lastLocationChecked = RC_UNKNOWN_CHECK;
RandomizerCheckArea previousArea = RCAREA_INVALID;
RandomizerCheckArea currentArea = RCAREA_INVALID;
OSContPad* trackerButtonsPressed;
2023-01-27 19:16:31 -05:00
void BeginFloatWindows(std::string UniqueName, bool& open, ImGuiWindowFlags flags = 0);
Check Tracker Update (#2668) * Initial commit. What works so far: Data file loads, saves, deletes, and is created properly. - Need to run `HasItemBeenCollected` when creating in case of mid-seed regen. Organized checks into maps set by area. Areas show in tracker. - Checks pulled from checkObjectsByArea are not currently listed. - Areas are being assumed completed and hidden at the start. * Checks now populate. Still not counting area totals properly. * Don't track RC_LINKS_POCKET in the data file, and instead manually add it in every time a save is load. rcObjects doesn't contain Link's Pocket location (duh). * Moved ItemReceive hook to randomizer_check_tracker.cpp. Skipped items are properly sorted and formatted. Saved items contribute to an area's gotten/skipped checks on load. Changed skipped items default main color to gray. General code cleanup. * Skipped checks now contribute to area totals for area completion logic. * Mid-menu rework transfer. * Started check lookup on item receive. Tried to enable scum checking on save. * Fixed scum check on save. * More code cleanup, which revealed some issues with loading and saving. Loading now works 100%, but entries in checkTrackerData are disappearing in code somewhere, causing issues with later checks. Scummed color now displays properly. Collected but unsaved displays properly. Unchecked, Skipped, Seen and Scummed checks all have arrows for skipping/unskipping. Counts a little messed up, probably double adding skips. * Fixed item counts being off across resets. Restarts were fine. * Beginning of rework for individual check updates. Adds `Actor lastCheck` to PlayState to allow assigning of last actor to give an item. This allows precise tracking of GS, freestanding PoH, etc. Works for chests too. Currently does not work for shops, unknown for normal NPC gives. Doesn't track last gives for non-checks, like drops from grass, pots, crates, etc. * Actor-based checks fully fleshed out, but can't help with sale-based checks. Implemented `pendingSaleCheck` to back out of an RC check cycle if `gSaveContext->pendingSale` is not NONE when `OnItemReceive` is called, processed through `OnSaleEnd`. This should be the final change necessary to streamline the checks. * Temporary hook to message box close to tie in trackers for non-gs/chest actors that aren't added to `GetCheckFromActor`. This triggers a 2-frame countdown to check with `HasItemBeenCollected` since half of the methods in there aren't updated until after a text box closes. Added scene tracking to get last scene so that checks in scenes that span several overworld areas could be tied to their areas properly. Modified tracker data creation to apply Link's Pocket and Song from Impa conditionally based on randomizer settings instead of just being assumed to be done. May need modification for checking click and drag spoiler loading. Removed the scene equivalence check from CheckChecks so that an entire area is checked each time to avoid issues with, e.g., leaving a shop before a pending sale finishes. * Changed check data creation to use RSKs from gRandomizer to account for settings loaded from drag and drop spoilers. * Beginning of tracker code organization. Changed check color defaults. * Reverted moving tracker colors to header. Some individual check fixes. * Missed something from previous merge? * Removed last remnant of removed performance mode. * Better handle checking when skullsanity is off. * Song checks sceneIDs don't match the scenes they're actually in for some reason. Removed that check. * SaleEnd checks don't need the GetItemEntry parameter. Also set a flag that should prevent the check tracker from running during vanilla saves should that not be resolved by the time it's merged. * Attempting to have only the relevant checks added to the tracker data, as well as showing vanilla checks for non-rando saves. Not working yet (everything is displayed in vanilla). * Added vanilla check tracker population via `vanillaCheck` bool in `RandomizerCheckObject`. This is also added to `IsVisibleInImGui` to handle file loading and saving to eliminate checks that aren't part of vanilla or the rando seed. Implemented deleted tracker data file recreation. Added some extra item name text checks. Songs are still... tricky, so they stay blank. Utilize local copies of the randomizer check objects that are applicable for performance purposes. Fixed vanilla item-giving cutscene crashes when triggered mid-transition. * Apparently not all toolchains can handle macro instantiation without all parameters, like VS can. * Fixed scummed detail color not showing properly on tracker. * Fixed dungeon area totals and GS checks not functioning properly. * Major revamp of checking code. Doesn't rely on `GetCheckFromActor` at all anymore, but instead simply sets a flag to evaluate a number of checks in an area every frame until the check that was gotten is identified. With the new setup, it's much less hardware intensive, and at 60fps 6 checks per frame shows no noticeable effect on framerate. I can envision needing to add a collectedCount in order to account for times when two checks are gotten one right after the other. Changed area scroll to happen from `OnTransitionEnd`, and allow for scrolling in bazaar (was disabled previously because it would jump back and forth between Kak and Market while you were in one). Also setup area check order updating by area instead of all at the same time. * Fixed shooting gallery not reporting proper area. Prevent checks from actually happening if area is RCAREA_INVALID, now that all areas are reporting something if they have checks. Fixed `GetCheckArea()` not updating checks for standard scenes. Lots of vanilla tracking updates, mainly manual checks for gems, medallions and songs, since the often don't have proper scenes in the data. Prevent vanilla from triggering check loops if junk items are collected. Fixed sorting based on saved vs collected. Prevent item name display for vanilla runs. Change coloring of checks so the check name reflects status in vanilla runs. * Fixed "Recheck Area" button erroneously adding to an area's check totals? * Fix DMC vanilla checks. * Fix check tracker data recreation on data file loss. Removed redundant file exists check from SaveTrackerDataHook, as it doesn't matter if it exists or not at that point. Limited check loops to 3 to avoid infinite check loops on non-check/junk item pickup. Added more checks to disable tracker operations if a save is not running. Changed check ordering to put boss reward and heart container checks at the end of whatever RCSHOW group they belong to. * Fixed IsRunning calculation. Further improving vanilla checking. Starting framework for checking medallions, stones, and songs on data file recreation. Fixed medallion check collection. Added GIFT_FROM_SAGES to check list for vanilla file for tracking light medallion. Added check loop limitation to prevent infinite checking after picking up junk item from the ground. * Finished vanilla file recreation and recheck (songs and dungeon rewards all check properly now). This includes deku shield with KF shop item 3. Finished Gift from Raoru light medallion tracking for vanilla. Commented all CheckByScene functionality for now. * Fixed new save data file creation. Disabled entrance area calculation for now, as it only tracks the previous entrance for some reason. Fixed area detection for ToT checks. * GetCheckArea() now utilizes EntranceData almost exclusively, via either `gSaveContext.entranceIndex` or the entrance tracker's `currentGrottoId` in the case of grottos. This also means that EVERYTHING CAN AUTOSCROLL NOW. Entrance shuffles are now much easier to track. Autoscroll is now also triggered on save, just in case someone isn't autosaving and has a lot of checks that get converted to saved. * Fixed missing GS check in LW. * Added area scroll on toggling Show Hidden Items. May configure differently later. Fixed area detection for entrances in Gerudo Fortress/Valley and Collossus. Haunted wasteland doesn't autoscroll due to a bug in `OnTransitionEnd` hook, but checks still evaluate properly there. Rely on scene-based area detection if scene is a main overworld or dungeon scene. * Fixed grotto detection when shuffle is off. * Small code cleanup. Fixed Colossus hand chest checks. * Missing lus bump from merge conflict resolution * Fixed Colossus Grotto making `GetCheckArea` return Wasteland. * Improved OnItemReceive processing for non-token GS checks, since they can sometimes take long enough for the checking process to time out before the item is registered as received. * First attempt at thread safety for tracker data file writing. Seems to work, but might need more testing. * Fixed Recheck Area not unskipping items that register as saved. Improved delayed saving with autosaving, as the autosave triggered quite often before the tracker data save, making things not properly register as saved. * merge cleanup * Converted check tracker data to the sectional saves, adding `CheckTrackerData` to `SaveContext`. Implemented section ID returning and fullSave boolean passing to section functions from my PR temporarily for it to work properly. Moved `RandomizerCheckTrackerData` enum to `randomizerTypes.h` to accommodate that. Changed `Randomizer_SaveInit` to a `SaveManager::InitFunc` to allow for other randomizer-dependent sections to be initialized after that. Required a little refactoring to maintain intro cutscene skip when starting a randomizer file. * Revert section index return and randomizer init changes. Will need to wait on yet more changes to main. * Fixed check tracker initialization (shouldn't be tied to window initialization), restored saving/loading functionality. * Removed `CheckTracker::Init` and put SaveManager calls in `CheckTrackerWindow::InitElement`. Also a bit of cleanup from transition back to save file use. * Fixed tracker displaying check categories while file not loaded. * Fix Darunia's Joy check not marking in vanilla. * Fix autosave not triggering change from collected to saved in tracker data. * Changed default colors for scummed and collected display. * Merge upgrade code cleanup. * Add `OnTransitionEnd` calls to sandstorm transitions both to and from Wasteland. Also improved `gSaveContext.lastScene` assignment for both transition types. Allowed a bit of cleanup in `GetCheckArea`. * Added `StateButton`, a button like `ArrowButton` but that allows text instead of arrow icons. Apparently the changes from ArrowButton to StateButton happened in a previous commit... * Changed section name to `trackerDataCheck` to force SoH to load it after the randomizer section, as it required some randoSettings to be loaded first, and nothing else I tried to make the randomizer section load before it worked. This hacks a solution to checks not displaying on fast file load to a specific slot. F*** you, SaveManager, and f*** you too, JSON. * Forgot to change the section string for loading with the name change. * Fix check ordering for checks that trigger the autosave. * Adds option to remove right-side shop items (slots 1-4) from the tracker list. Enabled by default. * Fix default state of Hide Shop Right Checks checkbox. * Fixes grotto and great fairy scrolling and checks. Fixes array overflow from `checkTrackerData` which was creating the issue trying to load the base and randomizer sections first, among other things. That also fixed the massive file loads that were being exhibited in debug mode. * Fix shooting galleries being set as collected again when being played a second time after getting the checks. * Fix Bazaar autoscroll. * Add Saria's Song to `GetCheckFromActor` and removed some limitations from the messageCloseCheck function to make that check track properly. * Fix Song from Impa check. Implemented prevention for multiple "collections" of great fairies, just in case getting the health refill would trigger it with the previous setup. * Fix ice traps on GS tokens not triggering OnItemReceive. * Complete fix for ice trap collection from GS. Add autoscroll when clicking "Expand All". * Add `OnShopSlotChange` with cursorSlot and basePrice parameters. * Fixed include in en_ossan for shop slot hook. Added registration for `OnShopSlotChange` in the tracker, storing the price in a new `price` field in `CheckTrackerData`. Added "seen" functionality to shop checks. Displays the model item name upon first entering a shop, adding the price and switching to trickName (if it's an ice trap) upon navigating to the slot in buy mode, triggered by an invisible "identified" status that mirrors "seen" in every other way. Added tooltips to most options for check tracker color picking to describe what each status actually means. * `std::format` pls * So apparently std::format just decided to break with the latest merge from develop, but fmt::format exists and works? * Removed the last vestiges of `locationsSkipped`. Other general code and formatting cleanups. Moved `IsGameRunning` to `OTRGlobals` so the item tracker could also access it. Used preceding to "fix" item and bottle display in the item tracker on startup. * Some more code cleanup. Removed "Recheck Area" button and relevant code. Backported changes to Anchor branch applicable for single-player, including making a checkAreas vector and structuring the frame by frame checks around that. Also includes fix for Silver Gauntlets and Mirror Shield check collection crash associated with those changes. Fixed Kakariko Bazaar "seen" updates. Fixed tracker window not showing on initial load like it should. * Forgot 1 formatting fix. * Removed conditions for showing Song from Impa (isn't junk under certain conditions, so should show all the time). * Fix vanilla checks, add Zelda's Letter and Malon's Egg to manual check collection. Fix autoscroll while in child stealth section. * Fix crash in Happy Mask Shop in OnSlotChange (referenced non-existent shop id in a tracker-specific enum). * General code cleanup. * Missed one reversion. * One more. * Fix column alignment in `randomizer_check_objects`. * Fix file encoding on `randomizer_check_tracker`. Again. * Fix indentation for `actualItemtrackerItemMap`. Also removed unnecessary parts of the map. * Rename `HasEqItem` to `HasEquipment`. * Slightly better indentation for `actualItemTrackerItemMap`. * Add magic bean salesman to vanilla check tracking, and genericized deku shield to trigger KF shop item 3 wherever you get the shield. Renamed `vanillaCheck` to `vanillaHundoCheck` to (supposedly) clarify the meaning of the usage. * One more rename to `vanillaCompletion` to avoid possible confusion with 100% speedrun conditions. * give me a break XD Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * Changes suggested by briaguya (rename `RandomizerCheckShow` to `Status`, unused code, newline formatting) * Remove unused `itemNames` table. * Remove `IsGameRunning` in favor of `GameInteractor::IsSaveLoaded`. * Restore anti-spoiler functionality for dungeons with dungeon maps. * Review cleanup. * Fix prices not showing for Kak bazaar items. --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com>
2023-10-04 11:03:36 -04:00
bool CompareChecks(RandomizerCheckObject, RandomizerCheckObject);
bool CheckByArea(RandomizerCheckArea);
void DrawLocation(RandomizerCheckObject);
Randomizer Auto Location tracker (#1942) * Initial Auto-Location Tracking * Updates styling for checked items in Check Tracker * Fixes crashing issues with Check Tracker rendering * Auto scroll Check Tracker windows to current area * Checks Tracker only shows checked locations once in game * Fixes issue where Check Tracker would auto-scroll to wrong location when entering a grotto * Fixes gerudo fortress checks showing in tracker when settings have them removed * InfTable Check Location Fixes: Lost Dog Richard, Rolling Gorons, HBA 1000, Thawed Zora * Fixes most Event Chk Inf Checks on Check Tracker, and Frogs * Check Tracker - Song from Malon now works * Check Tracker - Fixes Claim Check check not tracking - Fixes spoiler for Claim Check check when getting Biggoron's Sword - Fixes LACS being spoiled and not tracking * Check Tracker - Fixes #2 for Skull Mask and Mask of Truth checks * Check Tracker - Adds support for merchants - Fixes #7 for Bomchu Salesman - Fixes #12 for Medigoron * Check Tracker - Fixes #8 for Song from Saria * Check Tracker - Fixes #9 for Adult Shooting Gallery * Check Tracker - Fixes #10 for Composer Grave * Check Tracker - Fixes #14 for Song from Ocarina of Time * Check Tracker - Fixes #16 for Shooting the Sun * Check Tracker - Fixes #19 for Darunia's Joy * Save Editor - Adds missing label for Treasure Chest Game * Check Tracker - Fixes Great Faries checks * Check Tracker - Fixes Sheik at Temple * Check Tracker - Fixes Great Fairy auto-scroll to wrong location * Check Tracker - Updates blue warp checks - Fixes Bongo Bongo and Twinrova checks * Check Tracker - Fixes Dampe's Gravedigging Tour * Check Tracker - Fixes Prescription to King Zora * Check Tracker - Fixes Bazaar showing under wrong area on tracker between adult/child * Check Tracker - Fixes scroll for Hyrule Market and Bazaar * Check Tracker - Fixes giving Adult Trade Items shown on tracker: Broken Sword, Saw, Cojiro, Eyeball Froge, and Eyedrops * Cleans up item_location * Check Tracker - Item List - Fixes item list not updating when changing seeds/options - Separates item exclusion list from item check list - Clean up comments * Check Tracker - Adds Skip functionality to buttons * Check Tracker - Refactors adult trade items to RandomizerInf * Check Tracker - Fixes an issue where any time an item is removed the tracker would cause an application crash * Check Tracker - Item names are now dependent on file language * Check Tracker - Fixes Gerudo Card check not showing in Fast setting * Reorders headers to (hopefully) avoid CI build conflicts on linux/consoles * Explicitly defines vector header in randomizer.h to fix compile errors * Complete Refactor of Check Tracker ImGui * Adds missing check tracker files to CMakeLists * Reverts the Item_location whitespace cleanup from ad10807c * Check Tracker - Loading Fixes - Fixes a bug where loading a save file a second time would add all the checks again - Fixes a bug where the check tracker would not render at all until in a save file * Check Tracker - Fixes a bug where checks would sometimes fail to load * Check Tracker - Fixes duplicated checks when using Only on Pause or Only on Combo * Check Tracker - Works around issue where single characters don't show in EnhancementCombobox, and fixes a label for combo buttons held option * Check Tracker - Applies all Check Tracker changes to Item Location * Check Tracker - Updated Check List - Adds Link's pocket, either in KF or HM depending on starting age - Supports Scrubs and Merchants - Uses enums instead of magic numbers - Updates DC Scrub Short Names for MQ * Check Tracker - Adds a performance mode option * Check Tracker - List Fixes (requires new rando generation) - Fixes Frogs Rupees always visible - Fixes Kokiri Sword Chest not showing - Fixes Weird Egg not showing * Check Tracker - MQ List basic support * Check Tracker - MQ/Vanilla anti-spoilers * Check Tracker - Collecting a compass now spoils the area * Check Tracker - Basic Vanilla Support and fixes - Vanilla items show in check tracker, even if many won't auto check - Fixes an issue with Gerudo Fortress Keys - Refactors IsVisibleInCheckTracker to randomizer_check_tracjer * Check Tracker - Fixes merge conflict from 08a487f35e1d760ab9e69b932edbe4da6bcd9edb * Check Tracker - Fixes tracker loading as Floating when default value is set to Windowed * Randomizer Location Exclusion List - Adds Scrubs, Merchants, Shops. Adult Trade items, MQ Dungeons, and Bean Salesman - Fixes Kokiri Sword Chest, Weird Egg, and Frog Song Rupees from misbehaving - Updates Gerudo Fortress logic to be dependent on Open/Fast/Normal Fortress - Removes Invalid Check - Adds RO Enum for MQ settings - Updates magic values to RO enum * Location Exclusion List - Scrubs that are always randomized now always show on the list * For now, removes some extra code only needed for a Check Tracker. * Randomizer Location Exclusion List - Fixes Eyeball Frog from showing up when Adult Trade Items was off * Location Tracker - Updates Eyedrops to use RandomizerInf instead of Chest * Check Tracker - Fixes a bug where Link's Pocket item wasn't acting as checked for area item count * Check Tracker - Fixes a bug where Locations would incorrectly say Vanilla due to the first check in the area being a non-MQ check * Check Tracker - Fixes a crash when Check Tracker is docked but not visible * Check Tracker - Fixes areas being spoiled when loading different save files * Check Tracker - Only reset variables if they are initialized * Check Tracker - Cleans up old comments, unused variables, methods, and macros, adds language TODOs, * Check Tracker - Readds rainbow UI elements after Cosmetics Editor refactor * Check Tracker - Removal of flag lookup that was refactored, no longer needed header, and some trivial whitespace fixes. * Check Tracker - Refactors Index to Bitmask code to a macro * Check Tracker - Changes ordering from alphabetical to RandomizerCheck ordering * Check Tracker - Wraps everything in a namespace to avoid global variable usage * Check Tracker - Explicitly defines for-loop scope * Check Tracker - refactors dungeon lookup from static array to function * Fixes a bug when using EnhancementColor with alpha * Check Tracker - Refactors all colour to use direct conversions * Check Tracker - refactors settings loading and check visibility for readability * Check Tracker - Fixes a bug where the wrong label showed on the Check Tracker BG Color * UIWidgets - Adds Alpha bar to EnhancementColor when using alpha parameter
2022-12-10 22:39:23 -05:00
void EndFloatWindows();
Check Tracker Update (#2668) * Initial commit. What works so far: Data file loads, saves, deletes, and is created properly. - Need to run `HasItemBeenCollected` when creating in case of mid-seed regen. Organized checks into maps set by area. Areas show in tracker. - Checks pulled from checkObjectsByArea are not currently listed. - Areas are being assumed completed and hidden at the start. * Checks now populate. Still not counting area totals properly. * Don't track RC_LINKS_POCKET in the data file, and instead manually add it in every time a save is load. rcObjects doesn't contain Link's Pocket location (duh). * Moved ItemReceive hook to randomizer_check_tracker.cpp. Skipped items are properly sorted and formatted. Saved items contribute to an area's gotten/skipped checks on load. Changed skipped items default main color to gray. General code cleanup. * Skipped checks now contribute to area totals for area completion logic. * Mid-menu rework transfer. * Started check lookup on item receive. Tried to enable scum checking on save. * Fixed scum check on save. * More code cleanup, which revealed some issues with loading and saving. Loading now works 100%, but entries in checkTrackerData are disappearing in code somewhere, causing issues with later checks. Scummed color now displays properly. Collected but unsaved displays properly. Unchecked, Skipped, Seen and Scummed checks all have arrows for skipping/unskipping. Counts a little messed up, probably double adding skips. * Fixed item counts being off across resets. Restarts were fine. * Beginning of rework for individual check updates. Adds `Actor lastCheck` to PlayState to allow assigning of last actor to give an item. This allows precise tracking of GS, freestanding PoH, etc. Works for chests too. Currently does not work for shops, unknown for normal NPC gives. Doesn't track last gives for non-checks, like drops from grass, pots, crates, etc. * Actor-based checks fully fleshed out, but can't help with sale-based checks. Implemented `pendingSaleCheck` to back out of an RC check cycle if `gSaveContext->pendingSale` is not NONE when `OnItemReceive` is called, processed through `OnSaleEnd`. This should be the final change necessary to streamline the checks. * Temporary hook to message box close to tie in trackers for non-gs/chest actors that aren't added to `GetCheckFromActor`. This triggers a 2-frame countdown to check with `HasItemBeenCollected` since half of the methods in there aren't updated until after a text box closes. Added scene tracking to get last scene so that checks in scenes that span several overworld areas could be tied to their areas properly. Modified tracker data creation to apply Link's Pocket and Song from Impa conditionally based on randomizer settings instead of just being assumed to be done. May need modification for checking click and drag spoiler loading. Removed the scene equivalence check from CheckChecks so that an entire area is checked each time to avoid issues with, e.g., leaving a shop before a pending sale finishes. * Changed check data creation to use RSKs from gRandomizer to account for settings loaded from drag and drop spoilers. * Beginning of tracker code organization. Changed check color defaults. * Reverted moving tracker colors to header. Some individual check fixes. * Missed something from previous merge? * Removed last remnant of removed performance mode. * Better handle checking when skullsanity is off. * Song checks sceneIDs don't match the scenes they're actually in for some reason. Removed that check. * SaleEnd checks don't need the GetItemEntry parameter. Also set a flag that should prevent the check tracker from running during vanilla saves should that not be resolved by the time it's merged. * Attempting to have only the relevant checks added to the tracker data, as well as showing vanilla checks for non-rando saves. Not working yet (everything is displayed in vanilla). * Added vanilla check tracker population via `vanillaCheck` bool in `RandomizerCheckObject`. This is also added to `IsVisibleInImGui` to handle file loading and saving to eliminate checks that aren't part of vanilla or the rando seed. Implemented deleted tracker data file recreation. Added some extra item name text checks. Songs are still... tricky, so they stay blank. Utilize local copies of the randomizer check objects that are applicable for performance purposes. Fixed vanilla item-giving cutscene crashes when triggered mid-transition. * Apparently not all toolchains can handle macro instantiation without all parameters, like VS can. * Fixed scummed detail color not showing properly on tracker. * Fixed dungeon area totals and GS checks not functioning properly. * Major revamp of checking code. Doesn't rely on `GetCheckFromActor` at all anymore, but instead simply sets a flag to evaluate a number of checks in an area every frame until the check that was gotten is identified. With the new setup, it's much less hardware intensive, and at 60fps 6 checks per frame shows no noticeable effect on framerate. I can envision needing to add a collectedCount in order to account for times when two checks are gotten one right after the other. Changed area scroll to happen from `OnTransitionEnd`, and allow for scrolling in bazaar (was disabled previously because it would jump back and forth between Kak and Market while you were in one). Also setup area check order updating by area instead of all at the same time. * Fixed shooting gallery not reporting proper area. Prevent checks from actually happening if area is RCAREA_INVALID, now that all areas are reporting something if they have checks. Fixed `GetCheckArea()` not updating checks for standard scenes. Lots of vanilla tracking updates, mainly manual checks for gems, medallions and songs, since the often don't have proper scenes in the data. Prevent vanilla from triggering check loops if junk items are collected. Fixed sorting based on saved vs collected. Prevent item name display for vanilla runs. Change coloring of checks so the check name reflects status in vanilla runs. * Fixed "Recheck Area" button erroneously adding to an area's check totals? * Fix DMC vanilla checks. * Fix check tracker data recreation on data file loss. Removed redundant file exists check from SaveTrackerDataHook, as it doesn't matter if it exists or not at that point. Limited check loops to 3 to avoid infinite check loops on non-check/junk item pickup. Added more checks to disable tracker operations if a save is not running. Changed check ordering to put boss reward and heart container checks at the end of whatever RCSHOW group they belong to. * Fixed IsRunning calculation. Further improving vanilla checking. Starting framework for checking medallions, stones, and songs on data file recreation. Fixed medallion check collection. Added GIFT_FROM_SAGES to check list for vanilla file for tracking light medallion. Added check loop limitation to prevent infinite checking after picking up junk item from the ground. * Finished vanilla file recreation and recheck (songs and dungeon rewards all check properly now). This includes deku shield with KF shop item 3. Finished Gift from Raoru light medallion tracking for vanilla. Commented all CheckByScene functionality for now. * Fixed new save data file creation. Disabled entrance area calculation for now, as it only tracks the previous entrance for some reason. Fixed area detection for ToT checks. * GetCheckArea() now utilizes EntranceData almost exclusively, via either `gSaveContext.entranceIndex` or the entrance tracker's `currentGrottoId` in the case of grottos. This also means that EVERYTHING CAN AUTOSCROLL NOW. Entrance shuffles are now much easier to track. Autoscroll is now also triggered on save, just in case someone isn't autosaving and has a lot of checks that get converted to saved. * Fixed missing GS check in LW. * Added area scroll on toggling Show Hidden Items. May configure differently later. Fixed area detection for entrances in Gerudo Fortress/Valley and Collossus. Haunted wasteland doesn't autoscroll due to a bug in `OnTransitionEnd` hook, but checks still evaluate properly there. Rely on scene-based area detection if scene is a main overworld or dungeon scene. * Fixed grotto detection when shuffle is off. * Small code cleanup. Fixed Colossus hand chest checks. * Missing lus bump from merge conflict resolution * Fixed Colossus Grotto making `GetCheckArea` return Wasteland. * Improved OnItemReceive processing for non-token GS checks, since they can sometimes take long enough for the checking process to time out before the item is registered as received. * First attempt at thread safety for tracker data file writing. Seems to work, but might need more testing. * Fixed Recheck Area not unskipping items that register as saved. Improved delayed saving with autosaving, as the autosave triggered quite often before the tracker data save, making things not properly register as saved. * merge cleanup * Converted check tracker data to the sectional saves, adding `CheckTrackerData` to `SaveContext`. Implemented section ID returning and fullSave boolean passing to section functions from my PR temporarily for it to work properly. Moved `RandomizerCheckTrackerData` enum to `randomizerTypes.h` to accommodate that. Changed `Randomizer_SaveInit` to a `SaveManager::InitFunc` to allow for other randomizer-dependent sections to be initialized after that. Required a little refactoring to maintain intro cutscene skip when starting a randomizer file. * Revert section index return and randomizer init changes. Will need to wait on yet more changes to main. * Fixed check tracker initialization (shouldn't be tied to window initialization), restored saving/loading functionality. * Removed `CheckTracker::Init` and put SaveManager calls in `CheckTrackerWindow::InitElement`. Also a bit of cleanup from transition back to save file use. * Fixed tracker displaying check categories while file not loaded. * Fix Darunia's Joy check not marking in vanilla. * Fix autosave not triggering change from collected to saved in tracker data. * Changed default colors for scummed and collected display. * Merge upgrade code cleanup. * Add `OnTransitionEnd` calls to sandstorm transitions both to and from Wasteland. Also improved `gSaveContext.lastScene` assignment for both transition types. Allowed a bit of cleanup in `GetCheckArea`. * Added `StateButton`, a button like `ArrowButton` but that allows text instead of arrow icons. Apparently the changes from ArrowButton to StateButton happened in a previous commit... * Changed section name to `trackerDataCheck` to force SoH to load it after the randomizer section, as it required some randoSettings to be loaded first, and nothing else I tried to make the randomizer section load before it worked. This hacks a solution to checks not displaying on fast file load to a specific slot. F*** you, SaveManager, and f*** you too, JSON. * Forgot to change the section string for loading with the name change. * Fix check ordering for checks that trigger the autosave. * Adds option to remove right-side shop items (slots 1-4) from the tracker list. Enabled by default. * Fix default state of Hide Shop Right Checks checkbox. * Fixes grotto and great fairy scrolling and checks. Fixes array overflow from `checkTrackerData` which was creating the issue trying to load the base and randomizer sections first, among other things. That also fixed the massive file loads that were being exhibited in debug mode. * Fix shooting galleries being set as collected again when being played a second time after getting the checks. * Fix Bazaar autoscroll. * Add Saria's Song to `GetCheckFromActor` and removed some limitations from the messageCloseCheck function to make that check track properly. * Fix Song from Impa check. Implemented prevention for multiple "collections" of great fairies, just in case getting the health refill would trigger it with the previous setup. * Fix ice traps on GS tokens not triggering OnItemReceive. * Complete fix for ice trap collection from GS. Add autoscroll when clicking "Expand All". * Add `OnShopSlotChange` with cursorSlot and basePrice parameters. * Fixed include in en_ossan for shop slot hook. Added registration for `OnShopSlotChange` in the tracker, storing the price in a new `price` field in `CheckTrackerData`. Added "seen" functionality to shop checks. Displays the model item name upon first entering a shop, adding the price and switching to trickName (if it's an ice trap) upon navigating to the slot in buy mode, triggered by an invisible "identified" status that mirrors "seen" in every other way. Added tooltips to most options for check tracker color picking to describe what each status actually means. * `std::format` pls * So apparently std::format just decided to break with the latest merge from develop, but fmt::format exists and works? * Removed the last vestiges of `locationsSkipped`. Other general code and formatting cleanups. Moved `IsGameRunning` to `OTRGlobals` so the item tracker could also access it. Used preceding to "fix" item and bottle display in the item tracker on startup. * Some more code cleanup. Removed "Recheck Area" button and relevant code. Backported changes to Anchor branch applicable for single-player, including making a checkAreas vector and structuring the frame by frame checks around that. Also includes fix for Silver Gauntlets and Mirror Shield check collection crash associated with those changes. Fixed Kakariko Bazaar "seen" updates. Fixed tracker window not showing on initial load like it should. * Forgot 1 formatting fix. * Removed conditions for showing Song from Impa (isn't junk under certain conditions, so should show all the time). * Fix vanilla checks, add Zelda's Letter and Malon's Egg to manual check collection. Fix autoscroll while in child stealth section. * Fix crash in Happy Mask Shop in OnSlotChange (referenced non-existent shop id in a tracker-specific enum). * General code cleanup. * Missed one reversion. * One more. * Fix column alignment in `randomizer_check_objects`. * Fix file encoding on `randomizer_check_tracker`. Again. * Fix indentation for `actualItemtrackerItemMap`. Also removed unnecessary parts of the map. * Rename `HasEqItem` to `HasEquipment`. * Slightly better indentation for `actualItemTrackerItemMap`. * Add magic bean salesman to vanilla check tracking, and genericized deku shield to trigger KF shop item 3 wherever you get the shield. Renamed `vanillaCheck` to `vanillaHundoCheck` to (supposedly) clarify the meaning of the usage. * One more rename to `vanillaCompletion` to avoid possible confusion with 100% speedrun conditions. * give me a break XD Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * Changes suggested by briaguya (rename `RandomizerCheckShow` to `Status`, unused code, newline formatting) * Remove unused `itemNames` table. * Remove `IsGameRunning` in favor of `GameInteractor::IsSaveLoaded`. * Restore anti-spoiler functionality for dungeons with dungeon maps. * Review cleanup. * Fix prices not showing for Kak bazaar items. --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com>
2023-10-04 11:03:36 -04:00
bool HasItemBeenCollected(RandomizerCheck);
void LoadSettings();
Randomizer Auto Location tracker (#1942) * Initial Auto-Location Tracking * Updates styling for checked items in Check Tracker * Fixes crashing issues with Check Tracker rendering * Auto scroll Check Tracker windows to current area * Checks Tracker only shows checked locations once in game * Fixes issue where Check Tracker would auto-scroll to wrong location when entering a grotto * Fixes gerudo fortress checks showing in tracker when settings have them removed * InfTable Check Location Fixes: Lost Dog Richard, Rolling Gorons, HBA 1000, Thawed Zora * Fixes most Event Chk Inf Checks on Check Tracker, and Frogs * Check Tracker - Song from Malon now works * Check Tracker - Fixes Claim Check check not tracking - Fixes spoiler for Claim Check check when getting Biggoron's Sword - Fixes LACS being spoiled and not tracking * Check Tracker - Fixes #2 for Skull Mask and Mask of Truth checks * Check Tracker - Adds support for merchants - Fixes #7 for Bomchu Salesman - Fixes #12 for Medigoron * Check Tracker - Fixes #8 for Song from Saria * Check Tracker - Fixes #9 for Adult Shooting Gallery * Check Tracker - Fixes #10 for Composer Grave * Check Tracker - Fixes #14 for Song from Ocarina of Time * Check Tracker - Fixes #16 for Shooting the Sun * Check Tracker - Fixes #19 for Darunia's Joy * Save Editor - Adds missing label for Treasure Chest Game * Check Tracker - Fixes Great Faries checks * Check Tracker - Fixes Sheik at Temple * Check Tracker - Fixes Great Fairy auto-scroll to wrong location * Check Tracker - Updates blue warp checks - Fixes Bongo Bongo and Twinrova checks * Check Tracker - Fixes Dampe's Gravedigging Tour * Check Tracker - Fixes Prescription to King Zora * Check Tracker - Fixes Bazaar showing under wrong area on tracker between adult/child * Check Tracker - Fixes scroll for Hyrule Market and Bazaar * Check Tracker - Fixes giving Adult Trade Items shown on tracker: Broken Sword, Saw, Cojiro, Eyeball Froge, and Eyedrops * Cleans up item_location * Check Tracker - Item List - Fixes item list not updating when changing seeds/options - Separates item exclusion list from item check list - Clean up comments * Check Tracker - Adds Skip functionality to buttons * Check Tracker - Refactors adult trade items to RandomizerInf * Check Tracker - Fixes an issue where any time an item is removed the tracker would cause an application crash * Check Tracker - Item names are now dependent on file language * Check Tracker - Fixes Gerudo Card check not showing in Fast setting * Reorders headers to (hopefully) avoid CI build conflicts on linux/consoles * Explicitly defines vector header in randomizer.h to fix compile errors * Complete Refactor of Check Tracker ImGui * Adds missing check tracker files to CMakeLists * Reverts the Item_location whitespace cleanup from ad10807c * Check Tracker - Loading Fixes - Fixes a bug where loading a save file a second time would add all the checks again - Fixes a bug where the check tracker would not render at all until in a save file * Check Tracker - Fixes a bug where checks would sometimes fail to load * Check Tracker - Fixes duplicated checks when using Only on Pause or Only on Combo * Check Tracker - Works around issue where single characters don't show in EnhancementCombobox, and fixes a label for combo buttons held option * Check Tracker - Applies all Check Tracker changes to Item Location * Check Tracker - Updated Check List - Adds Link's pocket, either in KF or HM depending on starting age - Supports Scrubs and Merchants - Uses enums instead of magic numbers - Updates DC Scrub Short Names for MQ * Check Tracker - Adds a performance mode option * Check Tracker - List Fixes (requires new rando generation) - Fixes Frogs Rupees always visible - Fixes Kokiri Sword Chest not showing - Fixes Weird Egg not showing * Check Tracker - MQ List basic support * Check Tracker - MQ/Vanilla anti-spoilers * Check Tracker - Collecting a compass now spoils the area * Check Tracker - Basic Vanilla Support and fixes - Vanilla items show in check tracker, even if many won't auto check - Fixes an issue with Gerudo Fortress Keys - Refactors IsVisibleInCheckTracker to randomizer_check_tracjer * Check Tracker - Fixes merge conflict from 08a487f35e1d760ab9e69b932edbe4da6bcd9edb * Check Tracker - Fixes tracker loading as Floating when default value is set to Windowed * Randomizer Location Exclusion List - Adds Scrubs, Merchants, Shops. Adult Trade items, MQ Dungeons, and Bean Salesman - Fixes Kokiri Sword Chest, Weird Egg, and Frog Song Rupees from misbehaving - Updates Gerudo Fortress logic to be dependent on Open/Fast/Normal Fortress - Removes Invalid Check - Adds RO Enum for MQ settings - Updates magic values to RO enum * Location Exclusion List - Scrubs that are always randomized now always show on the list * For now, removes some extra code only needed for a Check Tracker. * Randomizer Location Exclusion List - Fixes Eyeball Frog from showing up when Adult Trade Items was off * Location Tracker - Updates Eyedrops to use RandomizerInf instead of Chest * Check Tracker - Fixes a bug where Link's Pocket item wasn't acting as checked for area item count * Check Tracker - Fixes a bug where Locations would incorrectly say Vanilla due to the first check in the area being a non-MQ check * Check Tracker - Fixes a crash when Check Tracker is docked but not visible * Check Tracker - Fixes areas being spoiled when loading different save files * Check Tracker - Only reset variables if they are initialized * Check Tracker - Cleans up old comments, unused variables, methods, and macros, adds language TODOs, * Check Tracker - Readds rainbow UI elements after Cosmetics Editor refactor * Check Tracker - Removal of flag lookup that was refactored, no longer needed header, and some trivial whitespace fixes. * Check Tracker - Refactors Index to Bitmask code to a macro * Check Tracker - Changes ordering from alphabetical to RandomizerCheck ordering * Check Tracker - Wraps everything in a namespace to avoid global variable usage * Check Tracker - Explicitly defines for-loop scope * Check Tracker - refactors dungeon lookup from static array to function * Fixes a bug when using EnhancementColor with alpha * Check Tracker - Refactors all colour to use direct conversions * Check Tracker - refactors settings loading and check visibility for readability * Check Tracker - Fixes a bug where the wrong label showed on the Check Tracker BG Color * UIWidgets - Adds Alpha bar to EnhancementColor when using alpha parameter
2022-12-10 22:39:23 -05:00
void RainbowTick();
Check Tracker Update (#2668) * Initial commit. What works so far: Data file loads, saves, deletes, and is created properly. - Need to run `HasItemBeenCollected` when creating in case of mid-seed regen. Organized checks into maps set by area. Areas show in tracker. - Checks pulled from checkObjectsByArea are not currently listed. - Areas are being assumed completed and hidden at the start. * Checks now populate. Still not counting area totals properly. * Don't track RC_LINKS_POCKET in the data file, and instead manually add it in every time a save is load. rcObjects doesn't contain Link's Pocket location (duh). * Moved ItemReceive hook to randomizer_check_tracker.cpp. Skipped items are properly sorted and formatted. Saved items contribute to an area's gotten/skipped checks on load. Changed skipped items default main color to gray. General code cleanup. * Skipped checks now contribute to area totals for area completion logic. * Mid-menu rework transfer. * Started check lookup on item receive. Tried to enable scum checking on save. * Fixed scum check on save. * More code cleanup, which revealed some issues with loading and saving. Loading now works 100%, but entries in checkTrackerData are disappearing in code somewhere, causing issues with later checks. Scummed color now displays properly. Collected but unsaved displays properly. Unchecked, Skipped, Seen and Scummed checks all have arrows for skipping/unskipping. Counts a little messed up, probably double adding skips. * Fixed item counts being off across resets. Restarts were fine. * Beginning of rework for individual check updates. Adds `Actor lastCheck` to PlayState to allow assigning of last actor to give an item. This allows precise tracking of GS, freestanding PoH, etc. Works for chests too. Currently does not work for shops, unknown for normal NPC gives. Doesn't track last gives for non-checks, like drops from grass, pots, crates, etc. * Actor-based checks fully fleshed out, but can't help with sale-based checks. Implemented `pendingSaleCheck` to back out of an RC check cycle if `gSaveContext->pendingSale` is not NONE when `OnItemReceive` is called, processed through `OnSaleEnd`. This should be the final change necessary to streamline the checks. * Temporary hook to message box close to tie in trackers for non-gs/chest actors that aren't added to `GetCheckFromActor`. This triggers a 2-frame countdown to check with `HasItemBeenCollected` since half of the methods in there aren't updated until after a text box closes. Added scene tracking to get last scene so that checks in scenes that span several overworld areas could be tied to their areas properly. Modified tracker data creation to apply Link's Pocket and Song from Impa conditionally based on randomizer settings instead of just being assumed to be done. May need modification for checking click and drag spoiler loading. Removed the scene equivalence check from CheckChecks so that an entire area is checked each time to avoid issues with, e.g., leaving a shop before a pending sale finishes. * Changed check data creation to use RSKs from gRandomizer to account for settings loaded from drag and drop spoilers. * Beginning of tracker code organization. Changed check color defaults. * Reverted moving tracker colors to header. Some individual check fixes. * Missed something from previous merge? * Removed last remnant of removed performance mode. * Better handle checking when skullsanity is off. * Song checks sceneIDs don't match the scenes they're actually in for some reason. Removed that check. * SaleEnd checks don't need the GetItemEntry parameter. Also set a flag that should prevent the check tracker from running during vanilla saves should that not be resolved by the time it's merged. * Attempting to have only the relevant checks added to the tracker data, as well as showing vanilla checks for non-rando saves. Not working yet (everything is displayed in vanilla). * Added vanilla check tracker population via `vanillaCheck` bool in `RandomizerCheckObject`. This is also added to `IsVisibleInImGui` to handle file loading and saving to eliminate checks that aren't part of vanilla or the rando seed. Implemented deleted tracker data file recreation. Added some extra item name text checks. Songs are still... tricky, so they stay blank. Utilize local copies of the randomizer check objects that are applicable for performance purposes. Fixed vanilla item-giving cutscene crashes when triggered mid-transition. * Apparently not all toolchains can handle macro instantiation without all parameters, like VS can. * Fixed scummed detail color not showing properly on tracker. * Fixed dungeon area totals and GS checks not functioning properly. * Major revamp of checking code. Doesn't rely on `GetCheckFromActor` at all anymore, but instead simply sets a flag to evaluate a number of checks in an area every frame until the check that was gotten is identified. With the new setup, it's much less hardware intensive, and at 60fps 6 checks per frame shows no noticeable effect on framerate. I can envision needing to add a collectedCount in order to account for times when two checks are gotten one right after the other. Changed area scroll to happen from `OnTransitionEnd`, and allow for scrolling in bazaar (was disabled previously because it would jump back and forth between Kak and Market while you were in one). Also setup area check order updating by area instead of all at the same time. * Fixed shooting gallery not reporting proper area. Prevent checks from actually happening if area is RCAREA_INVALID, now that all areas are reporting something if they have checks. Fixed `GetCheckArea()` not updating checks for standard scenes. Lots of vanilla tracking updates, mainly manual checks for gems, medallions and songs, since the often don't have proper scenes in the data. Prevent vanilla from triggering check loops if junk items are collected. Fixed sorting based on saved vs collected. Prevent item name display for vanilla runs. Change coloring of checks so the check name reflects status in vanilla runs. * Fixed "Recheck Area" button erroneously adding to an area's check totals? * Fix DMC vanilla checks. * Fix check tracker data recreation on data file loss. Removed redundant file exists check from SaveTrackerDataHook, as it doesn't matter if it exists or not at that point. Limited check loops to 3 to avoid infinite check loops on non-check/junk item pickup. Added more checks to disable tracker operations if a save is not running. Changed check ordering to put boss reward and heart container checks at the end of whatever RCSHOW group they belong to. * Fixed IsRunning calculation. Further improving vanilla checking. Starting framework for checking medallions, stones, and songs on data file recreation. Fixed medallion check collection. Added GIFT_FROM_SAGES to check list for vanilla file for tracking light medallion. Added check loop limitation to prevent infinite checking after picking up junk item from the ground. * Finished vanilla file recreation and recheck (songs and dungeon rewards all check properly now). This includes deku shield with KF shop item 3. Finished Gift from Raoru light medallion tracking for vanilla. Commented all CheckByScene functionality for now. * Fixed new save data file creation. Disabled entrance area calculation for now, as it only tracks the previous entrance for some reason. Fixed area detection for ToT checks. * GetCheckArea() now utilizes EntranceData almost exclusively, via either `gSaveContext.entranceIndex` or the entrance tracker's `currentGrottoId` in the case of grottos. This also means that EVERYTHING CAN AUTOSCROLL NOW. Entrance shuffles are now much easier to track. Autoscroll is now also triggered on save, just in case someone isn't autosaving and has a lot of checks that get converted to saved. * Fixed missing GS check in LW. * Added area scroll on toggling Show Hidden Items. May configure differently later. Fixed area detection for entrances in Gerudo Fortress/Valley and Collossus. Haunted wasteland doesn't autoscroll due to a bug in `OnTransitionEnd` hook, but checks still evaluate properly there. Rely on scene-based area detection if scene is a main overworld or dungeon scene. * Fixed grotto detection when shuffle is off. * Small code cleanup. Fixed Colossus hand chest checks. * Missing lus bump from merge conflict resolution * Fixed Colossus Grotto making `GetCheckArea` return Wasteland. * Improved OnItemReceive processing for non-token GS checks, since they can sometimes take long enough for the checking process to time out before the item is registered as received. * First attempt at thread safety for tracker data file writing. Seems to work, but might need more testing. * Fixed Recheck Area not unskipping items that register as saved. Improved delayed saving with autosaving, as the autosave triggered quite often before the tracker data save, making things not properly register as saved. * merge cleanup * Converted check tracker data to the sectional saves, adding `CheckTrackerData` to `SaveContext`. Implemented section ID returning and fullSave boolean passing to section functions from my PR temporarily for it to work properly. Moved `RandomizerCheckTrackerData` enum to `randomizerTypes.h` to accommodate that. Changed `Randomizer_SaveInit` to a `SaveManager::InitFunc` to allow for other randomizer-dependent sections to be initialized after that. Required a little refactoring to maintain intro cutscene skip when starting a randomizer file. * Revert section index return and randomizer init changes. Will need to wait on yet more changes to main. * Fixed check tracker initialization (shouldn't be tied to window initialization), restored saving/loading functionality. * Removed `CheckTracker::Init` and put SaveManager calls in `CheckTrackerWindow::InitElement`. Also a bit of cleanup from transition back to save file use. * Fixed tracker displaying check categories while file not loaded. * Fix Darunia's Joy check not marking in vanilla. * Fix autosave not triggering change from collected to saved in tracker data. * Changed default colors for scummed and collected display. * Merge upgrade code cleanup. * Add `OnTransitionEnd` calls to sandstorm transitions both to and from Wasteland. Also improved `gSaveContext.lastScene` assignment for both transition types. Allowed a bit of cleanup in `GetCheckArea`. * Added `StateButton`, a button like `ArrowButton` but that allows text instead of arrow icons. Apparently the changes from ArrowButton to StateButton happened in a previous commit... * Changed section name to `trackerDataCheck` to force SoH to load it after the randomizer section, as it required some randoSettings to be loaded first, and nothing else I tried to make the randomizer section load before it worked. This hacks a solution to checks not displaying on fast file load to a specific slot. F*** you, SaveManager, and f*** you too, JSON. * Forgot to change the section string for loading with the name change. * Fix check ordering for checks that trigger the autosave. * Adds option to remove right-side shop items (slots 1-4) from the tracker list. Enabled by default. * Fix default state of Hide Shop Right Checks checkbox. * Fixes grotto and great fairy scrolling and checks. Fixes array overflow from `checkTrackerData` which was creating the issue trying to load the base and randomizer sections first, among other things. That also fixed the massive file loads that were being exhibited in debug mode. * Fix shooting galleries being set as collected again when being played a second time after getting the checks. * Fix Bazaar autoscroll. * Add Saria's Song to `GetCheckFromActor` and removed some limitations from the messageCloseCheck function to make that check track properly. * Fix Song from Impa check. Implemented prevention for multiple "collections" of great fairies, just in case getting the health refill would trigger it with the previous setup. * Fix ice traps on GS tokens not triggering OnItemReceive. * Complete fix for ice trap collection from GS. Add autoscroll when clicking "Expand All". * Add `OnShopSlotChange` with cursorSlot and basePrice parameters. * Fixed include in en_ossan for shop slot hook. Added registration for `OnShopSlotChange` in the tracker, storing the price in a new `price` field in `CheckTrackerData`. Added "seen" functionality to shop checks. Displays the model item name upon first entering a shop, adding the price and switching to trickName (if it's an ice trap) upon navigating to the slot in buy mode, triggered by an invisible "identified" status that mirrors "seen" in every other way. Added tooltips to most options for check tracker color picking to describe what each status actually means. * `std::format` pls * So apparently std::format just decided to break with the latest merge from develop, but fmt::format exists and works? * Removed the last vestiges of `locationsSkipped`. Other general code and formatting cleanups. Moved `IsGameRunning` to `OTRGlobals` so the item tracker could also access it. Used preceding to "fix" item and bottle display in the item tracker on startup. * Some more code cleanup. Removed "Recheck Area" button and relevant code. Backported changes to Anchor branch applicable for single-player, including making a checkAreas vector and structuring the frame by frame checks around that. Also includes fix for Silver Gauntlets and Mirror Shield check collection crash associated with those changes. Fixed Kakariko Bazaar "seen" updates. Fixed tracker window not showing on initial load like it should. * Forgot 1 formatting fix. * Removed conditions for showing Song from Impa (isn't junk under certain conditions, so should show all the time). * Fix vanilla checks, add Zelda's Letter and Malon's Egg to manual check collection. Fix autoscroll while in child stealth section. * Fix crash in Happy Mask Shop in OnSlotChange (referenced non-existent shop id in a tracker-specific enum). * General code cleanup. * Missed one reversion. * One more. * Fix column alignment in `randomizer_check_objects`. * Fix file encoding on `randomizer_check_tracker`. Again. * Fix indentation for `actualItemtrackerItemMap`. Also removed unnecessary parts of the map. * Rename `HasEqItem` to `HasEquipment`. * Slightly better indentation for `actualItemTrackerItemMap`. * Add magic bean salesman to vanilla check tracking, and genericized deku shield to trigger KF shop item 3 wherever you get the shield. Renamed `vanillaCheck` to `vanillaHundoCheck` to (supposedly) clarify the meaning of the usage. * One more rename to `vanillaCompletion` to avoid possible confusion with 100% speedrun conditions. * give me a break XD Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * Changes suggested by briaguya (rename `RandomizerCheckShow` to `Status`, unused code, newline formatting) * Remove unused `itemNames` table. * Remove `IsGameRunning` in favor of `GameInteractor::IsSaveLoaded`. * Restore anti-spoiler functionality for dungeons with dungeon maps. * Review cleanup. * Fix prices not showing for Kak bazaar items. --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com>
2023-10-04 11:03:36 -04:00
void UpdateAreas(RandomizerCheckArea area);
void UpdateInventoryChecks();
void UpdateOrdering(RandomizerCheckArea);
int sectionId;
Randomizer Auto Location tracker (#1942) * Initial Auto-Location Tracking * Updates styling for checked items in Check Tracker * Fixes crashing issues with Check Tracker rendering * Auto scroll Check Tracker windows to current area * Checks Tracker only shows checked locations once in game * Fixes issue where Check Tracker would auto-scroll to wrong location when entering a grotto * Fixes gerudo fortress checks showing in tracker when settings have them removed * InfTable Check Location Fixes: Lost Dog Richard, Rolling Gorons, HBA 1000, Thawed Zora * Fixes most Event Chk Inf Checks on Check Tracker, and Frogs * Check Tracker - Song from Malon now works * Check Tracker - Fixes Claim Check check not tracking - Fixes spoiler for Claim Check check when getting Biggoron's Sword - Fixes LACS being spoiled and not tracking * Check Tracker - Fixes #2 for Skull Mask and Mask of Truth checks * Check Tracker - Adds support for merchants - Fixes #7 for Bomchu Salesman - Fixes #12 for Medigoron * Check Tracker - Fixes #8 for Song from Saria * Check Tracker - Fixes #9 for Adult Shooting Gallery * Check Tracker - Fixes #10 for Composer Grave * Check Tracker - Fixes #14 for Song from Ocarina of Time * Check Tracker - Fixes #16 for Shooting the Sun * Check Tracker - Fixes #19 for Darunia's Joy * Save Editor - Adds missing label for Treasure Chest Game * Check Tracker - Fixes Great Faries checks * Check Tracker - Fixes Sheik at Temple * Check Tracker - Fixes Great Fairy auto-scroll to wrong location * Check Tracker - Updates blue warp checks - Fixes Bongo Bongo and Twinrova checks * Check Tracker - Fixes Dampe's Gravedigging Tour * Check Tracker - Fixes Prescription to King Zora * Check Tracker - Fixes Bazaar showing under wrong area on tracker between adult/child * Check Tracker - Fixes scroll for Hyrule Market and Bazaar * Check Tracker - Fixes giving Adult Trade Items shown on tracker: Broken Sword, Saw, Cojiro, Eyeball Froge, and Eyedrops * Cleans up item_location * Check Tracker - Item List - Fixes item list not updating when changing seeds/options - Separates item exclusion list from item check list - Clean up comments * Check Tracker - Adds Skip functionality to buttons * Check Tracker - Refactors adult trade items to RandomizerInf * Check Tracker - Fixes an issue where any time an item is removed the tracker would cause an application crash * Check Tracker - Item names are now dependent on file language * Check Tracker - Fixes Gerudo Card check not showing in Fast setting * Reorders headers to (hopefully) avoid CI build conflicts on linux/consoles * Explicitly defines vector header in randomizer.h to fix compile errors * Complete Refactor of Check Tracker ImGui * Adds missing check tracker files to CMakeLists * Reverts the Item_location whitespace cleanup from ad10807c * Check Tracker - Loading Fixes - Fixes a bug where loading a save file a second time would add all the checks again - Fixes a bug where the check tracker would not render at all until in a save file * Check Tracker - Fixes a bug where checks would sometimes fail to load * Check Tracker - Fixes duplicated checks when using Only on Pause or Only on Combo * Check Tracker - Works around issue where single characters don't show in EnhancementCombobox, and fixes a label for combo buttons held option * Check Tracker - Applies all Check Tracker changes to Item Location * Check Tracker - Updated Check List - Adds Link's pocket, either in KF or HM depending on starting age - Supports Scrubs and Merchants - Uses enums instead of magic numbers - Updates DC Scrub Short Names for MQ * Check Tracker - Adds a performance mode option * Check Tracker - List Fixes (requires new rando generation) - Fixes Frogs Rupees always visible - Fixes Kokiri Sword Chest not showing - Fixes Weird Egg not showing * Check Tracker - MQ List basic support * Check Tracker - MQ/Vanilla anti-spoilers * Check Tracker - Collecting a compass now spoils the area * Check Tracker - Basic Vanilla Support and fixes - Vanilla items show in check tracker, even if many won't auto check - Fixes an issue with Gerudo Fortress Keys - Refactors IsVisibleInCheckTracker to randomizer_check_tracjer * Check Tracker - Fixes merge conflict from 08a487f35e1d760ab9e69b932edbe4da6bcd9edb * Check Tracker - Fixes tracker loading as Floating when default value is set to Windowed * Randomizer Location Exclusion List - Adds Scrubs, Merchants, Shops. Adult Trade items, MQ Dungeons, and Bean Salesman - Fixes Kokiri Sword Chest, Weird Egg, and Frog Song Rupees from misbehaving - Updates Gerudo Fortress logic to be dependent on Open/Fast/Normal Fortress - Removes Invalid Check - Adds RO Enum for MQ settings - Updates magic values to RO enum * Location Exclusion List - Scrubs that are always randomized now always show on the list * For now, removes some extra code only needed for a Check Tracker. * Randomizer Location Exclusion List - Fixes Eyeball Frog from showing up when Adult Trade Items was off * Location Tracker - Updates Eyedrops to use RandomizerInf instead of Chest * Check Tracker - Fixes a bug where Link's Pocket item wasn't acting as checked for area item count * Check Tracker - Fixes a bug where Locations would incorrectly say Vanilla due to the first check in the area being a non-MQ check * Check Tracker - Fixes a crash when Check Tracker is docked but not visible * Check Tracker - Fixes areas being spoiled when loading different save files * Check Tracker - Only reset variables if they are initialized * Check Tracker - Cleans up old comments, unused variables, methods, and macros, adds language TODOs, * Check Tracker - Readds rainbow UI elements after Cosmetics Editor refactor * Check Tracker - Removal of flag lookup that was refactored, no longer needed header, and some trivial whitespace fixes. * Check Tracker - Refactors Index to Bitmask code to a macro * Check Tracker - Changes ordering from alphabetical to RandomizerCheck ordering * Check Tracker - Wraps everything in a namespace to avoid global variable usage * Check Tracker - Explicitly defines for-loop scope * Check Tracker - refactors dungeon lookup from static array to function * Fixes a bug when using EnhancementColor with alpha * Check Tracker - Refactors all colour to use direct conversions * Check Tracker - refactors settings loading and check visibility for readability * Check Tracker - Fixes a bug where the wrong label showed on the Check Tracker BG Color * UIWidgets - Adds Alpha bar to EnhancementColor when using alpha parameter
2022-12-10 22:39:23 -05:00
Check Tracker Update (#2668) * Initial commit. What works so far: Data file loads, saves, deletes, and is created properly. - Need to run `HasItemBeenCollected` when creating in case of mid-seed regen. Organized checks into maps set by area. Areas show in tracker. - Checks pulled from checkObjectsByArea are not currently listed. - Areas are being assumed completed and hidden at the start. * Checks now populate. Still not counting area totals properly. * Don't track RC_LINKS_POCKET in the data file, and instead manually add it in every time a save is load. rcObjects doesn't contain Link's Pocket location (duh). * Moved ItemReceive hook to randomizer_check_tracker.cpp. Skipped items are properly sorted and formatted. Saved items contribute to an area's gotten/skipped checks on load. Changed skipped items default main color to gray. General code cleanup. * Skipped checks now contribute to area totals for area completion logic. * Mid-menu rework transfer. * Started check lookup on item receive. Tried to enable scum checking on save. * Fixed scum check on save. * More code cleanup, which revealed some issues with loading and saving. Loading now works 100%, but entries in checkTrackerData are disappearing in code somewhere, causing issues with later checks. Scummed color now displays properly. Collected but unsaved displays properly. Unchecked, Skipped, Seen and Scummed checks all have arrows for skipping/unskipping. Counts a little messed up, probably double adding skips. * Fixed item counts being off across resets. Restarts were fine. * Beginning of rework for individual check updates. Adds `Actor lastCheck` to PlayState to allow assigning of last actor to give an item. This allows precise tracking of GS, freestanding PoH, etc. Works for chests too. Currently does not work for shops, unknown for normal NPC gives. Doesn't track last gives for non-checks, like drops from grass, pots, crates, etc. * Actor-based checks fully fleshed out, but can't help with sale-based checks. Implemented `pendingSaleCheck` to back out of an RC check cycle if `gSaveContext->pendingSale` is not NONE when `OnItemReceive` is called, processed through `OnSaleEnd`. This should be the final change necessary to streamline the checks. * Temporary hook to message box close to tie in trackers for non-gs/chest actors that aren't added to `GetCheckFromActor`. This triggers a 2-frame countdown to check with `HasItemBeenCollected` since half of the methods in there aren't updated until after a text box closes. Added scene tracking to get last scene so that checks in scenes that span several overworld areas could be tied to their areas properly. Modified tracker data creation to apply Link's Pocket and Song from Impa conditionally based on randomizer settings instead of just being assumed to be done. May need modification for checking click and drag spoiler loading. Removed the scene equivalence check from CheckChecks so that an entire area is checked each time to avoid issues with, e.g., leaving a shop before a pending sale finishes. * Changed check data creation to use RSKs from gRandomizer to account for settings loaded from drag and drop spoilers. * Beginning of tracker code organization. Changed check color defaults. * Reverted moving tracker colors to header. Some individual check fixes. * Missed something from previous merge? * Removed last remnant of removed performance mode. * Better handle checking when skullsanity is off. * Song checks sceneIDs don't match the scenes they're actually in for some reason. Removed that check. * SaleEnd checks don't need the GetItemEntry parameter. Also set a flag that should prevent the check tracker from running during vanilla saves should that not be resolved by the time it's merged. * Attempting to have only the relevant checks added to the tracker data, as well as showing vanilla checks for non-rando saves. Not working yet (everything is displayed in vanilla). * Added vanilla check tracker population via `vanillaCheck` bool in `RandomizerCheckObject`. This is also added to `IsVisibleInImGui` to handle file loading and saving to eliminate checks that aren't part of vanilla or the rando seed. Implemented deleted tracker data file recreation. Added some extra item name text checks. Songs are still... tricky, so they stay blank. Utilize local copies of the randomizer check objects that are applicable for performance purposes. Fixed vanilla item-giving cutscene crashes when triggered mid-transition. * Apparently not all toolchains can handle macro instantiation without all parameters, like VS can. * Fixed scummed detail color not showing properly on tracker. * Fixed dungeon area totals and GS checks not functioning properly. * Major revamp of checking code. Doesn't rely on `GetCheckFromActor` at all anymore, but instead simply sets a flag to evaluate a number of checks in an area every frame until the check that was gotten is identified. With the new setup, it's much less hardware intensive, and at 60fps 6 checks per frame shows no noticeable effect on framerate. I can envision needing to add a collectedCount in order to account for times when two checks are gotten one right after the other. Changed area scroll to happen from `OnTransitionEnd`, and allow for scrolling in bazaar (was disabled previously because it would jump back and forth between Kak and Market while you were in one). Also setup area check order updating by area instead of all at the same time. * Fixed shooting gallery not reporting proper area. Prevent checks from actually happening if area is RCAREA_INVALID, now that all areas are reporting something if they have checks. Fixed `GetCheckArea()` not updating checks for standard scenes. Lots of vanilla tracking updates, mainly manual checks for gems, medallions and songs, since the often don't have proper scenes in the data. Prevent vanilla from triggering check loops if junk items are collected. Fixed sorting based on saved vs collected. Prevent item name display for vanilla runs. Change coloring of checks so the check name reflects status in vanilla runs. * Fixed "Recheck Area" button erroneously adding to an area's check totals? * Fix DMC vanilla checks. * Fix check tracker data recreation on data file loss. Removed redundant file exists check from SaveTrackerDataHook, as it doesn't matter if it exists or not at that point. Limited check loops to 3 to avoid infinite check loops on non-check/junk item pickup. Added more checks to disable tracker operations if a save is not running. Changed check ordering to put boss reward and heart container checks at the end of whatever RCSHOW group they belong to. * Fixed IsRunning calculation. Further improving vanilla checking. Starting framework for checking medallions, stones, and songs on data file recreation. Fixed medallion check collection. Added GIFT_FROM_SAGES to check list for vanilla file for tracking light medallion. Added check loop limitation to prevent infinite checking after picking up junk item from the ground. * Finished vanilla file recreation and recheck (songs and dungeon rewards all check properly now). This includes deku shield with KF shop item 3. Finished Gift from Raoru light medallion tracking for vanilla. Commented all CheckByScene functionality for now. * Fixed new save data file creation. Disabled entrance area calculation for now, as it only tracks the previous entrance for some reason. Fixed area detection for ToT checks. * GetCheckArea() now utilizes EntranceData almost exclusively, via either `gSaveContext.entranceIndex` or the entrance tracker's `currentGrottoId` in the case of grottos. This also means that EVERYTHING CAN AUTOSCROLL NOW. Entrance shuffles are now much easier to track. Autoscroll is now also triggered on save, just in case someone isn't autosaving and has a lot of checks that get converted to saved. * Fixed missing GS check in LW. * Added area scroll on toggling Show Hidden Items. May configure differently later. Fixed area detection for entrances in Gerudo Fortress/Valley and Collossus. Haunted wasteland doesn't autoscroll due to a bug in `OnTransitionEnd` hook, but checks still evaluate properly there. Rely on scene-based area detection if scene is a main overworld or dungeon scene. * Fixed grotto detection when shuffle is off. * Small code cleanup. Fixed Colossus hand chest checks. * Missing lus bump from merge conflict resolution * Fixed Colossus Grotto making `GetCheckArea` return Wasteland. * Improved OnItemReceive processing for non-token GS checks, since they can sometimes take long enough for the checking process to time out before the item is registered as received. * First attempt at thread safety for tracker data file writing. Seems to work, but might need more testing. * Fixed Recheck Area not unskipping items that register as saved. Improved delayed saving with autosaving, as the autosave triggered quite often before the tracker data save, making things not properly register as saved. * merge cleanup * Converted check tracker data to the sectional saves, adding `CheckTrackerData` to `SaveContext`. Implemented section ID returning and fullSave boolean passing to section functions from my PR temporarily for it to work properly. Moved `RandomizerCheckTrackerData` enum to `randomizerTypes.h` to accommodate that. Changed `Randomizer_SaveInit` to a `SaveManager::InitFunc` to allow for other randomizer-dependent sections to be initialized after that. Required a little refactoring to maintain intro cutscene skip when starting a randomizer file. * Revert section index return and randomizer init changes. Will need to wait on yet more changes to main. * Fixed check tracker initialization (shouldn't be tied to window initialization), restored saving/loading functionality. * Removed `CheckTracker::Init` and put SaveManager calls in `CheckTrackerWindow::InitElement`. Also a bit of cleanup from transition back to save file use. * Fixed tracker displaying check categories while file not loaded. * Fix Darunia's Joy check not marking in vanilla. * Fix autosave not triggering change from collected to saved in tracker data. * Changed default colors for scummed and collected display. * Merge upgrade code cleanup. * Add `OnTransitionEnd` calls to sandstorm transitions both to and from Wasteland. Also improved `gSaveContext.lastScene` assignment for both transition types. Allowed a bit of cleanup in `GetCheckArea`. * Added `StateButton`, a button like `ArrowButton` but that allows text instead of arrow icons. Apparently the changes from ArrowButton to StateButton happened in a previous commit... * Changed section name to `trackerDataCheck` to force SoH to load it after the randomizer section, as it required some randoSettings to be loaded first, and nothing else I tried to make the randomizer section load before it worked. This hacks a solution to checks not displaying on fast file load to a specific slot. F*** you, SaveManager, and f*** you too, JSON. * Forgot to change the section string for loading with the name change. * Fix check ordering for checks that trigger the autosave. * Adds option to remove right-side shop items (slots 1-4) from the tracker list. Enabled by default. * Fix default state of Hide Shop Right Checks checkbox. * Fixes grotto and great fairy scrolling and checks. Fixes array overflow from `checkTrackerData` which was creating the issue trying to load the base and randomizer sections first, among other things. That also fixed the massive file loads that were being exhibited in debug mode. * Fix shooting galleries being set as collected again when being played a second time after getting the checks. * Fix Bazaar autoscroll. * Add Saria's Song to `GetCheckFromActor` and removed some limitations from the messageCloseCheck function to make that check track properly. * Fix Song from Impa check. Implemented prevention for multiple "collections" of great fairies, just in case getting the health refill would trigger it with the previous setup. * Fix ice traps on GS tokens not triggering OnItemReceive. * Complete fix for ice trap collection from GS. Add autoscroll when clicking "Expand All". * Add `OnShopSlotChange` with cursorSlot and basePrice parameters. * Fixed include in en_ossan for shop slot hook. Added registration for `OnShopSlotChange` in the tracker, storing the price in a new `price` field in `CheckTrackerData`. Added "seen" functionality to shop checks. Displays the model item name upon first entering a shop, adding the price and switching to trickName (if it's an ice trap) upon navigating to the slot in buy mode, triggered by an invisible "identified" status that mirrors "seen" in every other way. Added tooltips to most options for check tracker color picking to describe what each status actually means. * `std::format` pls * So apparently std::format just decided to break with the latest merge from develop, but fmt::format exists and works? * Removed the last vestiges of `locationsSkipped`. Other general code and formatting cleanups. Moved `IsGameRunning` to `OTRGlobals` so the item tracker could also access it. Used preceding to "fix" item and bottle display in the item tracker on startup. * Some more code cleanup. Removed "Recheck Area" button and relevant code. Backported changes to Anchor branch applicable for single-player, including making a checkAreas vector and structuring the frame by frame checks around that. Also includes fix for Silver Gauntlets and Mirror Shield check collection crash associated with those changes. Fixed Kakariko Bazaar "seen" updates. Fixed tracker window not showing on initial load like it should. * Forgot 1 formatting fix. * Removed conditions for showing Song from Impa (isn't junk under certain conditions, so should show all the time). * Fix vanilla checks, add Zelda's Letter and Malon's Egg to manual check collection. Fix autoscroll while in child stealth section. * Fix crash in Happy Mask Shop in OnSlotChange (referenced non-existent shop id in a tracker-specific enum). * General code cleanup. * Missed one reversion. * One more. * Fix column alignment in `randomizer_check_objects`. * Fix file encoding on `randomizer_check_tracker`. Again. * Fix indentation for `actualItemtrackerItemMap`. Also removed unnecessary parts of the map. * Rename `HasEqItem` to `HasEquipment`. * Slightly better indentation for `actualItemTrackerItemMap`. * Add magic bean salesman to vanilla check tracking, and genericized deku shield to trigger KF shop item 3 wherever you get the shield. Renamed `vanillaCheck` to `vanillaHundoCheck` to (supposedly) clarify the meaning of the usage. * One more rename to `vanillaCompletion` to avoid possible confusion with 100% speedrun conditions. * give me a break XD Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * Changes suggested by briaguya (rename `RandomizerCheckShow` to `Status`, unused code, newline formatting) * Remove unused `itemNames` table. * Remove `IsGameRunning` in favor of `GameInteractor::IsSaveLoaded`. * Restore anti-spoiler functionality for dungeons with dungeon maps. * Review cleanup. * Fix prices not showing for Kak bazaar items. --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com>
2023-10-04 11:03:36 -04:00
SceneID DungeonSceneLookupByArea(RandomizerCheckArea area) {
switch (area) {
case RCAREA_DEKU_TREE: return SCENE_DEKU_TREE;
case RCAREA_DODONGOS_CAVERN: return SCENE_DODONGOS_CAVERN;
case RCAREA_JABU_JABUS_BELLY: return SCENE_JABU_JABU;
case RCAREA_FOREST_TEMPLE: return SCENE_FOREST_TEMPLE;
case RCAREA_FIRE_TEMPLE: return SCENE_FIRE_TEMPLE;
case RCAREA_WATER_TEMPLE: return SCENE_WATER_TEMPLE;
case RCAREA_SPIRIT_TEMPLE: return SCENE_SPIRIT_TEMPLE;
case RCAREA_SHADOW_TEMPLE: return SCENE_SHADOW_TEMPLE;
case RCAREA_BOTTOM_OF_THE_WELL: return SCENE_BOTTOM_OF_THE_WELL;
case RCAREA_ICE_CAVERN: return SCENE_ICE_CAVERN;
case RCAREA_GERUDO_TRAINING_GROUND: return SCENE_GERUDO_TRAINING_GROUND;
case RCAREA_GANONS_CASTLE: return SCENE_INSIDE_GANONS_CASTLE;
default: return SCENE_ID_MAX;
}
}
Randomizer Auto Location tracker (#1942) * Initial Auto-Location Tracking * Updates styling for checked items in Check Tracker * Fixes crashing issues with Check Tracker rendering * Auto scroll Check Tracker windows to current area * Checks Tracker only shows checked locations once in game * Fixes issue where Check Tracker would auto-scroll to wrong location when entering a grotto * Fixes gerudo fortress checks showing in tracker when settings have them removed * InfTable Check Location Fixes: Lost Dog Richard, Rolling Gorons, HBA 1000, Thawed Zora * Fixes most Event Chk Inf Checks on Check Tracker, and Frogs * Check Tracker - Song from Malon now works * Check Tracker - Fixes Claim Check check not tracking - Fixes spoiler for Claim Check check when getting Biggoron's Sword - Fixes LACS being spoiled and not tracking * Check Tracker - Fixes #2 for Skull Mask and Mask of Truth checks * Check Tracker - Adds support for merchants - Fixes #7 for Bomchu Salesman - Fixes #12 for Medigoron * Check Tracker - Fixes #8 for Song from Saria * Check Tracker - Fixes #9 for Adult Shooting Gallery * Check Tracker - Fixes #10 for Composer Grave * Check Tracker - Fixes #14 for Song from Ocarina of Time * Check Tracker - Fixes #16 for Shooting the Sun * Check Tracker - Fixes #19 for Darunia's Joy * Save Editor - Adds missing label for Treasure Chest Game * Check Tracker - Fixes Great Faries checks * Check Tracker - Fixes Sheik at Temple * Check Tracker - Fixes Great Fairy auto-scroll to wrong location * Check Tracker - Updates blue warp checks - Fixes Bongo Bongo and Twinrova checks * Check Tracker - Fixes Dampe's Gravedigging Tour * Check Tracker - Fixes Prescription to King Zora * Check Tracker - Fixes Bazaar showing under wrong area on tracker between adult/child * Check Tracker - Fixes scroll for Hyrule Market and Bazaar * Check Tracker - Fixes giving Adult Trade Items shown on tracker: Broken Sword, Saw, Cojiro, Eyeball Froge, and Eyedrops * Cleans up item_location * Check Tracker - Item List - Fixes item list not updating when changing seeds/options - Separates item exclusion list from item check list - Clean up comments * Check Tracker - Adds Skip functionality to buttons * Check Tracker - Refactors adult trade items to RandomizerInf * Check Tracker - Fixes an issue where any time an item is removed the tracker would cause an application crash * Check Tracker - Item names are now dependent on file language * Check Tracker - Fixes Gerudo Card check not showing in Fast setting * Reorders headers to (hopefully) avoid CI build conflicts on linux/consoles * Explicitly defines vector header in randomizer.h to fix compile errors * Complete Refactor of Check Tracker ImGui * Adds missing check tracker files to CMakeLists * Reverts the Item_location whitespace cleanup from ad10807c * Check Tracker - Loading Fixes - Fixes a bug where loading a save file a second time would add all the checks again - Fixes a bug where the check tracker would not render at all until in a save file * Check Tracker - Fixes a bug where checks would sometimes fail to load * Check Tracker - Fixes duplicated checks when using Only on Pause or Only on Combo * Check Tracker - Works around issue where single characters don't show in EnhancementCombobox, and fixes a label for combo buttons held option * Check Tracker - Applies all Check Tracker changes to Item Location * Check Tracker - Updated Check List - Adds Link's pocket, either in KF or HM depending on starting age - Supports Scrubs and Merchants - Uses enums instead of magic numbers - Updates DC Scrub Short Names for MQ * Check Tracker - Adds a performance mode option * Check Tracker - List Fixes (requires new rando generation) - Fixes Frogs Rupees always visible - Fixes Kokiri Sword Chest not showing - Fixes Weird Egg not showing * Check Tracker - MQ List basic support * Check Tracker - MQ/Vanilla anti-spoilers * Check Tracker - Collecting a compass now spoils the area * Check Tracker - Basic Vanilla Support and fixes - Vanilla items show in check tracker, even if many won't auto check - Fixes an issue with Gerudo Fortress Keys - Refactors IsVisibleInCheckTracker to randomizer_check_tracjer * Check Tracker - Fixes merge conflict from 08a487f35e1d760ab9e69b932edbe4da6bcd9edb * Check Tracker - Fixes tracker loading as Floating when default value is set to Windowed * Randomizer Location Exclusion List - Adds Scrubs, Merchants, Shops. Adult Trade items, MQ Dungeons, and Bean Salesman - Fixes Kokiri Sword Chest, Weird Egg, and Frog Song Rupees from misbehaving - Updates Gerudo Fortress logic to be dependent on Open/Fast/Normal Fortress - Removes Invalid Check - Adds RO Enum for MQ settings - Updates magic values to RO enum * Location Exclusion List - Scrubs that are always randomized now always show on the list * For now, removes some extra code only needed for a Check Tracker. * Randomizer Location Exclusion List - Fixes Eyeball Frog from showing up when Adult Trade Items was off * Location Tracker - Updates Eyedrops to use RandomizerInf instead of Chest * Check Tracker - Fixes a bug where Link's Pocket item wasn't acting as checked for area item count * Check Tracker - Fixes a bug where Locations would incorrectly say Vanilla due to the first check in the area being a non-MQ check * Check Tracker - Fixes a crash when Check Tracker is docked but not visible * Check Tracker - Fixes areas being spoiled when loading different save files * Check Tracker - Only reset variables if they are initialized * Check Tracker - Cleans up old comments, unused variables, methods, and macros, adds language TODOs, * Check Tracker - Readds rainbow UI elements after Cosmetics Editor refactor * Check Tracker - Removal of flag lookup that was refactored, no longer needed header, and some trivial whitespace fixes. * Check Tracker - Refactors Index to Bitmask code to a macro * Check Tracker - Changes ordering from alphabetical to RandomizerCheck ordering * Check Tracker - Wraps everything in a namespace to avoid global variable usage * Check Tracker - Explicitly defines for-loop scope * Check Tracker - refactors dungeon lookup from static array to function * Fixes a bug when using EnhancementColor with alpha * Check Tracker - Refactors all colour to use direct conversions * Check Tracker - refactors settings loading and check visibility for readability * Check Tracker - Fixes a bug where the wrong label showed on the Check Tracker BG Color * UIWidgets - Adds Alpha bar to EnhancementColor when using alpha parameter
2022-12-10 22:39:23 -05:00
Color_RGBA8 Color_Bg_Default = { 0, 0, 0, 255 }; // Black
Color_RGBA8 Color_Main_Default = { 255, 255, 255, 255 }; // White
Color_RGBA8 Color_Area_Incomplete_Extra_Default = { 255, 255, 255, 255 }; // White
Color_RGBA8 Color_Area_Complete_Extra_Default = { 255, 255, 255, 255 }; // White
Color_RGBA8 Color_Unchecked_Extra_Default = { 255, 255, 255, 255 }; // White
Color_RGBA8 Color_Skipped_Main_Default = { 160, 160, 160, 255 }; // Grey
Color_RGBA8 Color_Skipped_Extra_Default = { 160, 160, 160, 255 }; // Grey
Color_RGBA8 Color_Seen_Extra_Default = { 255, 255, 255, 255 }; // TODO
Color_RGBA8 Color_Hinted_Extra_Default = { 255, 255, 255, 255 }; // TODO
Check Tracker Update (#2668) * Initial commit. What works so far: Data file loads, saves, deletes, and is created properly. - Need to run `HasItemBeenCollected` when creating in case of mid-seed regen. Organized checks into maps set by area. Areas show in tracker. - Checks pulled from checkObjectsByArea are not currently listed. - Areas are being assumed completed and hidden at the start. * Checks now populate. Still not counting area totals properly. * Don't track RC_LINKS_POCKET in the data file, and instead manually add it in every time a save is load. rcObjects doesn't contain Link's Pocket location (duh). * Moved ItemReceive hook to randomizer_check_tracker.cpp. Skipped items are properly sorted and formatted. Saved items contribute to an area's gotten/skipped checks on load. Changed skipped items default main color to gray. General code cleanup. * Skipped checks now contribute to area totals for area completion logic. * Mid-menu rework transfer. * Started check lookup on item receive. Tried to enable scum checking on save. * Fixed scum check on save. * More code cleanup, which revealed some issues with loading and saving. Loading now works 100%, but entries in checkTrackerData are disappearing in code somewhere, causing issues with later checks. Scummed color now displays properly. Collected but unsaved displays properly. Unchecked, Skipped, Seen and Scummed checks all have arrows for skipping/unskipping. Counts a little messed up, probably double adding skips. * Fixed item counts being off across resets. Restarts were fine. * Beginning of rework for individual check updates. Adds `Actor lastCheck` to PlayState to allow assigning of last actor to give an item. This allows precise tracking of GS, freestanding PoH, etc. Works for chests too. Currently does not work for shops, unknown for normal NPC gives. Doesn't track last gives for non-checks, like drops from grass, pots, crates, etc. * Actor-based checks fully fleshed out, but can't help with sale-based checks. Implemented `pendingSaleCheck` to back out of an RC check cycle if `gSaveContext->pendingSale` is not NONE when `OnItemReceive` is called, processed through `OnSaleEnd`. This should be the final change necessary to streamline the checks. * Temporary hook to message box close to tie in trackers for non-gs/chest actors that aren't added to `GetCheckFromActor`. This triggers a 2-frame countdown to check with `HasItemBeenCollected` since half of the methods in there aren't updated until after a text box closes. Added scene tracking to get last scene so that checks in scenes that span several overworld areas could be tied to their areas properly. Modified tracker data creation to apply Link's Pocket and Song from Impa conditionally based on randomizer settings instead of just being assumed to be done. May need modification for checking click and drag spoiler loading. Removed the scene equivalence check from CheckChecks so that an entire area is checked each time to avoid issues with, e.g., leaving a shop before a pending sale finishes. * Changed check data creation to use RSKs from gRandomizer to account for settings loaded from drag and drop spoilers. * Beginning of tracker code organization. Changed check color defaults. * Reverted moving tracker colors to header. Some individual check fixes. * Missed something from previous merge? * Removed last remnant of removed performance mode. * Better handle checking when skullsanity is off. * Song checks sceneIDs don't match the scenes they're actually in for some reason. Removed that check. * SaleEnd checks don't need the GetItemEntry parameter. Also set a flag that should prevent the check tracker from running during vanilla saves should that not be resolved by the time it's merged. * Attempting to have only the relevant checks added to the tracker data, as well as showing vanilla checks for non-rando saves. Not working yet (everything is displayed in vanilla). * Added vanilla check tracker population via `vanillaCheck` bool in `RandomizerCheckObject`. This is also added to `IsVisibleInImGui` to handle file loading and saving to eliminate checks that aren't part of vanilla or the rando seed. Implemented deleted tracker data file recreation. Added some extra item name text checks. Songs are still... tricky, so they stay blank. Utilize local copies of the randomizer check objects that are applicable for performance purposes. Fixed vanilla item-giving cutscene crashes when triggered mid-transition. * Apparently not all toolchains can handle macro instantiation without all parameters, like VS can. * Fixed scummed detail color not showing properly on tracker. * Fixed dungeon area totals and GS checks not functioning properly. * Major revamp of checking code. Doesn't rely on `GetCheckFromActor` at all anymore, but instead simply sets a flag to evaluate a number of checks in an area every frame until the check that was gotten is identified. With the new setup, it's much less hardware intensive, and at 60fps 6 checks per frame shows no noticeable effect on framerate. I can envision needing to add a collectedCount in order to account for times when two checks are gotten one right after the other. Changed area scroll to happen from `OnTransitionEnd`, and allow for scrolling in bazaar (was disabled previously because it would jump back and forth between Kak and Market while you were in one). Also setup area check order updating by area instead of all at the same time. * Fixed shooting gallery not reporting proper area. Prevent checks from actually happening if area is RCAREA_INVALID, now that all areas are reporting something if they have checks. Fixed `GetCheckArea()` not updating checks for standard scenes. Lots of vanilla tracking updates, mainly manual checks for gems, medallions and songs, since the often don't have proper scenes in the data. Prevent vanilla from triggering check loops if junk items are collected. Fixed sorting based on saved vs collected. Prevent item name display for vanilla runs. Change coloring of checks so the check name reflects status in vanilla runs. * Fixed "Recheck Area" button erroneously adding to an area's check totals? * Fix DMC vanilla checks. * Fix check tracker data recreation on data file loss. Removed redundant file exists check from SaveTrackerDataHook, as it doesn't matter if it exists or not at that point. Limited check loops to 3 to avoid infinite check loops on non-check/junk item pickup. Added more checks to disable tracker operations if a save is not running. Changed check ordering to put boss reward and heart container checks at the end of whatever RCSHOW group they belong to. * Fixed IsRunning calculation. Further improving vanilla checking. Starting framework for checking medallions, stones, and songs on data file recreation. Fixed medallion check collection. Added GIFT_FROM_SAGES to check list for vanilla file for tracking light medallion. Added check loop limitation to prevent infinite checking after picking up junk item from the ground. * Finished vanilla file recreation and recheck (songs and dungeon rewards all check properly now). This includes deku shield with KF shop item 3. Finished Gift from Raoru light medallion tracking for vanilla. Commented all CheckByScene functionality for now. * Fixed new save data file creation. Disabled entrance area calculation for now, as it only tracks the previous entrance for some reason. Fixed area detection for ToT checks. * GetCheckArea() now utilizes EntranceData almost exclusively, via either `gSaveContext.entranceIndex` or the entrance tracker's `currentGrottoId` in the case of grottos. This also means that EVERYTHING CAN AUTOSCROLL NOW. Entrance shuffles are now much easier to track. Autoscroll is now also triggered on save, just in case someone isn't autosaving and has a lot of checks that get converted to saved. * Fixed missing GS check in LW. * Added area scroll on toggling Show Hidden Items. May configure differently later. Fixed area detection for entrances in Gerudo Fortress/Valley and Collossus. Haunted wasteland doesn't autoscroll due to a bug in `OnTransitionEnd` hook, but checks still evaluate properly there. Rely on scene-based area detection if scene is a main overworld or dungeon scene. * Fixed grotto detection when shuffle is off. * Small code cleanup. Fixed Colossus hand chest checks. * Missing lus bump from merge conflict resolution * Fixed Colossus Grotto making `GetCheckArea` return Wasteland. * Improved OnItemReceive processing for non-token GS checks, since they can sometimes take long enough for the checking process to time out before the item is registered as received. * First attempt at thread safety for tracker data file writing. Seems to work, but might need more testing. * Fixed Recheck Area not unskipping items that register as saved. Improved delayed saving with autosaving, as the autosave triggered quite often before the tracker data save, making things not properly register as saved. * merge cleanup * Converted check tracker data to the sectional saves, adding `CheckTrackerData` to `SaveContext`. Implemented section ID returning and fullSave boolean passing to section functions from my PR temporarily for it to work properly. Moved `RandomizerCheckTrackerData` enum to `randomizerTypes.h` to accommodate that. Changed `Randomizer_SaveInit` to a `SaveManager::InitFunc` to allow for other randomizer-dependent sections to be initialized after that. Required a little refactoring to maintain intro cutscene skip when starting a randomizer file. * Revert section index return and randomizer init changes. Will need to wait on yet more changes to main. * Fixed check tracker initialization (shouldn't be tied to window initialization), restored saving/loading functionality. * Removed `CheckTracker::Init` and put SaveManager calls in `CheckTrackerWindow::InitElement`. Also a bit of cleanup from transition back to save file use. * Fixed tracker displaying check categories while file not loaded. * Fix Darunia's Joy check not marking in vanilla. * Fix autosave not triggering change from collected to saved in tracker data. * Changed default colors for scummed and collected display. * Merge upgrade code cleanup. * Add `OnTransitionEnd` calls to sandstorm transitions both to and from Wasteland. Also improved `gSaveContext.lastScene` assignment for both transition types. Allowed a bit of cleanup in `GetCheckArea`. * Added `StateButton`, a button like `ArrowButton` but that allows text instead of arrow icons. Apparently the changes from ArrowButton to StateButton happened in a previous commit... * Changed section name to `trackerDataCheck` to force SoH to load it after the randomizer section, as it required some randoSettings to be loaded first, and nothing else I tried to make the randomizer section load before it worked. This hacks a solution to checks not displaying on fast file load to a specific slot. F*** you, SaveManager, and f*** you too, JSON. * Forgot to change the section string for loading with the name change. * Fix check ordering for checks that trigger the autosave. * Adds option to remove right-side shop items (slots 1-4) from the tracker list. Enabled by default. * Fix default state of Hide Shop Right Checks checkbox. * Fixes grotto and great fairy scrolling and checks. Fixes array overflow from `checkTrackerData` which was creating the issue trying to load the base and randomizer sections first, among other things. That also fixed the massive file loads that were being exhibited in debug mode. * Fix shooting galleries being set as collected again when being played a second time after getting the checks. * Fix Bazaar autoscroll. * Add Saria's Song to `GetCheckFromActor` and removed some limitations from the messageCloseCheck function to make that check track properly. * Fix Song from Impa check. Implemented prevention for multiple "collections" of great fairies, just in case getting the health refill would trigger it with the previous setup. * Fix ice traps on GS tokens not triggering OnItemReceive. * Complete fix for ice trap collection from GS. Add autoscroll when clicking "Expand All". * Add `OnShopSlotChange` with cursorSlot and basePrice parameters. * Fixed include in en_ossan for shop slot hook. Added registration for `OnShopSlotChange` in the tracker, storing the price in a new `price` field in `CheckTrackerData`. Added "seen" functionality to shop checks. Displays the model item name upon first entering a shop, adding the price and switching to trickName (if it's an ice trap) upon navigating to the slot in buy mode, triggered by an invisible "identified" status that mirrors "seen" in every other way. Added tooltips to most options for check tracker color picking to describe what each status actually means. * `std::format` pls * So apparently std::format just decided to break with the latest merge from develop, but fmt::format exists and works? * Removed the last vestiges of `locationsSkipped`. Other general code and formatting cleanups. Moved `IsGameRunning` to `OTRGlobals` so the item tracker could also access it. Used preceding to "fix" item and bottle display in the item tracker on startup. * Some more code cleanup. Removed "Recheck Area" button and relevant code. Backported changes to Anchor branch applicable for single-player, including making a checkAreas vector and structuring the frame by frame checks around that. Also includes fix for Silver Gauntlets and Mirror Shield check collection crash associated with those changes. Fixed Kakariko Bazaar "seen" updates. Fixed tracker window not showing on initial load like it should. * Forgot 1 formatting fix. * Removed conditions for showing Song from Impa (isn't junk under certain conditions, so should show all the time). * Fix vanilla checks, add Zelda's Letter and Malon's Egg to manual check collection. Fix autoscroll while in child stealth section. * Fix crash in Happy Mask Shop in OnSlotChange (referenced non-existent shop id in a tracker-specific enum). * General code cleanup. * Missed one reversion. * One more. * Fix column alignment in `randomizer_check_objects`. * Fix file encoding on `randomizer_check_tracker`. Again. * Fix indentation for `actualItemtrackerItemMap`. Also removed unnecessary parts of the map. * Rename `HasEqItem` to `HasEquipment`. * Slightly better indentation for `actualItemTrackerItemMap`. * Add magic bean salesman to vanilla check tracking, and genericized deku shield to trigger KF shop item 3 wherever you get the shield. Renamed `vanillaCheck` to `vanillaHundoCheck` to (supposedly) clarify the meaning of the usage. * One more rename to `vanillaCompletion` to avoid possible confusion with 100% speedrun conditions. * give me a break XD Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * Changes suggested by briaguya (rename `RandomizerCheckShow` to `Status`, unused code, newline formatting) * Remove unused `itemNames` table. * Remove `IsGameRunning` in favor of `GameInteractor::IsSaveLoaded`. * Restore anti-spoiler functionality for dungeons with dungeon maps. * Review cleanup. * Fix prices not showing for Kak bazaar items. --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com>
2023-10-04 11:03:36 -04:00
Color_RGBA8 Color_Collected_Extra_Default = { 242, 101, 34, 255 }; // Orange
Color_RGBA8 Color_Scummed_Extra_Default = { 0, 174, 239, 255 }; // Blue
Randomizer Auto Location tracker (#1942) * Initial Auto-Location Tracking * Updates styling for checked items in Check Tracker * Fixes crashing issues with Check Tracker rendering * Auto scroll Check Tracker windows to current area * Checks Tracker only shows checked locations once in game * Fixes issue where Check Tracker would auto-scroll to wrong location when entering a grotto * Fixes gerudo fortress checks showing in tracker when settings have them removed * InfTable Check Location Fixes: Lost Dog Richard, Rolling Gorons, HBA 1000, Thawed Zora * Fixes most Event Chk Inf Checks on Check Tracker, and Frogs * Check Tracker - Song from Malon now works * Check Tracker - Fixes Claim Check check not tracking - Fixes spoiler for Claim Check check when getting Biggoron's Sword - Fixes LACS being spoiled and not tracking * Check Tracker - Fixes #2 for Skull Mask and Mask of Truth checks * Check Tracker - Adds support for merchants - Fixes #7 for Bomchu Salesman - Fixes #12 for Medigoron * Check Tracker - Fixes #8 for Song from Saria * Check Tracker - Fixes #9 for Adult Shooting Gallery * Check Tracker - Fixes #10 for Composer Grave * Check Tracker - Fixes #14 for Song from Ocarina of Time * Check Tracker - Fixes #16 for Shooting the Sun * Check Tracker - Fixes #19 for Darunia's Joy * Save Editor - Adds missing label for Treasure Chest Game * Check Tracker - Fixes Great Faries checks * Check Tracker - Fixes Sheik at Temple * Check Tracker - Fixes Great Fairy auto-scroll to wrong location * Check Tracker - Updates blue warp checks - Fixes Bongo Bongo and Twinrova checks * Check Tracker - Fixes Dampe's Gravedigging Tour * Check Tracker - Fixes Prescription to King Zora * Check Tracker - Fixes Bazaar showing under wrong area on tracker between adult/child * Check Tracker - Fixes scroll for Hyrule Market and Bazaar * Check Tracker - Fixes giving Adult Trade Items shown on tracker: Broken Sword, Saw, Cojiro, Eyeball Froge, and Eyedrops * Cleans up item_location * Check Tracker - Item List - Fixes item list not updating when changing seeds/options - Separates item exclusion list from item check list - Clean up comments * Check Tracker - Adds Skip functionality to buttons * Check Tracker - Refactors adult trade items to RandomizerInf * Check Tracker - Fixes an issue where any time an item is removed the tracker would cause an application crash * Check Tracker - Item names are now dependent on file language * Check Tracker - Fixes Gerudo Card check not showing in Fast setting * Reorders headers to (hopefully) avoid CI build conflicts on linux/consoles * Explicitly defines vector header in randomizer.h to fix compile errors * Complete Refactor of Check Tracker ImGui * Adds missing check tracker files to CMakeLists * Reverts the Item_location whitespace cleanup from ad10807c * Check Tracker - Loading Fixes - Fixes a bug where loading a save file a second time would add all the checks again - Fixes a bug where the check tracker would not render at all until in a save file * Check Tracker - Fixes a bug where checks would sometimes fail to load * Check Tracker - Fixes duplicated checks when using Only on Pause or Only on Combo * Check Tracker - Works around issue where single characters don't show in EnhancementCombobox, and fixes a label for combo buttons held option * Check Tracker - Applies all Check Tracker changes to Item Location * Check Tracker - Updated Check List - Adds Link's pocket, either in KF or HM depending on starting age - Supports Scrubs and Merchants - Uses enums instead of magic numbers - Updates DC Scrub Short Names for MQ * Check Tracker - Adds a performance mode option * Check Tracker - List Fixes (requires new rando generation) - Fixes Frogs Rupees always visible - Fixes Kokiri Sword Chest not showing - Fixes Weird Egg not showing * Check Tracker - MQ List basic support * Check Tracker - MQ/Vanilla anti-spoilers * Check Tracker - Collecting a compass now spoils the area * Check Tracker - Basic Vanilla Support and fixes - Vanilla items show in check tracker, even if many won't auto check - Fixes an issue with Gerudo Fortress Keys - Refactors IsVisibleInCheckTracker to randomizer_check_tracjer * Check Tracker - Fixes merge conflict from 08a487f35e1d760ab9e69b932edbe4da6bcd9edb * Check Tracker - Fixes tracker loading as Floating when default value is set to Windowed * Randomizer Location Exclusion List - Adds Scrubs, Merchants, Shops. Adult Trade items, MQ Dungeons, and Bean Salesman - Fixes Kokiri Sword Chest, Weird Egg, and Frog Song Rupees from misbehaving - Updates Gerudo Fortress logic to be dependent on Open/Fast/Normal Fortress - Removes Invalid Check - Adds RO Enum for MQ settings - Updates magic values to RO enum * Location Exclusion List - Scrubs that are always randomized now always show on the list * For now, removes some extra code only needed for a Check Tracker. * Randomizer Location Exclusion List - Fixes Eyeball Frog from showing up when Adult Trade Items was off * Location Tracker - Updates Eyedrops to use RandomizerInf instead of Chest * Check Tracker - Fixes a bug where Link's Pocket item wasn't acting as checked for area item count * Check Tracker - Fixes a bug where Locations would incorrectly say Vanilla due to the first check in the area being a non-MQ check * Check Tracker - Fixes a crash when Check Tracker is docked but not visible * Check Tracker - Fixes areas being spoiled when loading different save files * Check Tracker - Only reset variables if they are initialized * Check Tracker - Cleans up old comments, unused variables, methods, and macros, adds language TODOs, * Check Tracker - Readds rainbow UI elements after Cosmetics Editor refactor * Check Tracker - Removal of flag lookup that was refactored, no longer needed header, and some trivial whitespace fixes. * Check Tracker - Refactors Index to Bitmask code to a macro * Check Tracker - Changes ordering from alphabetical to RandomizerCheck ordering * Check Tracker - Wraps everything in a namespace to avoid global variable usage * Check Tracker - Explicitly defines for-loop scope * Check Tracker - refactors dungeon lookup from static array to function * Fixes a bug when using EnhancementColor with alpha * Check Tracker - Refactors all colour to use direct conversions * Check Tracker - refactors settings loading and check visibility for readability * Check Tracker - Fixes a bug where the wrong label showed on the Check Tracker BG Color * UIWidgets - Adds Alpha bar to EnhancementColor when using alpha parameter
2022-12-10 22:39:23 -05:00
Color_RGBA8 Color_Saved_Extra_Default = { 0, 185, 0, 255 }; // Green
Color_RGBA8 Color_Background = { 0, 0, 0, 255 };
Check Tracker Update (#2668) * Initial commit. What works so far: Data file loads, saves, deletes, and is created properly. - Need to run `HasItemBeenCollected` when creating in case of mid-seed regen. Organized checks into maps set by area. Areas show in tracker. - Checks pulled from checkObjectsByArea are not currently listed. - Areas are being assumed completed and hidden at the start. * Checks now populate. Still not counting area totals properly. * Don't track RC_LINKS_POCKET in the data file, and instead manually add it in every time a save is load. rcObjects doesn't contain Link's Pocket location (duh). * Moved ItemReceive hook to randomizer_check_tracker.cpp. Skipped items are properly sorted and formatted. Saved items contribute to an area's gotten/skipped checks on load. Changed skipped items default main color to gray. General code cleanup. * Skipped checks now contribute to area totals for area completion logic. * Mid-menu rework transfer. * Started check lookup on item receive. Tried to enable scum checking on save. * Fixed scum check on save. * More code cleanup, which revealed some issues with loading and saving. Loading now works 100%, but entries in checkTrackerData are disappearing in code somewhere, causing issues with later checks. Scummed color now displays properly. Collected but unsaved displays properly. Unchecked, Skipped, Seen and Scummed checks all have arrows for skipping/unskipping. Counts a little messed up, probably double adding skips. * Fixed item counts being off across resets. Restarts were fine. * Beginning of rework for individual check updates. Adds `Actor lastCheck` to PlayState to allow assigning of last actor to give an item. This allows precise tracking of GS, freestanding PoH, etc. Works for chests too. Currently does not work for shops, unknown for normal NPC gives. Doesn't track last gives for non-checks, like drops from grass, pots, crates, etc. * Actor-based checks fully fleshed out, but can't help with sale-based checks. Implemented `pendingSaleCheck` to back out of an RC check cycle if `gSaveContext->pendingSale` is not NONE when `OnItemReceive` is called, processed through `OnSaleEnd`. This should be the final change necessary to streamline the checks. * Temporary hook to message box close to tie in trackers for non-gs/chest actors that aren't added to `GetCheckFromActor`. This triggers a 2-frame countdown to check with `HasItemBeenCollected` since half of the methods in there aren't updated until after a text box closes. Added scene tracking to get last scene so that checks in scenes that span several overworld areas could be tied to their areas properly. Modified tracker data creation to apply Link's Pocket and Song from Impa conditionally based on randomizer settings instead of just being assumed to be done. May need modification for checking click and drag spoiler loading. Removed the scene equivalence check from CheckChecks so that an entire area is checked each time to avoid issues with, e.g., leaving a shop before a pending sale finishes. * Changed check data creation to use RSKs from gRandomizer to account for settings loaded from drag and drop spoilers. * Beginning of tracker code organization. Changed check color defaults. * Reverted moving tracker colors to header. Some individual check fixes. * Missed something from previous merge? * Removed last remnant of removed performance mode. * Better handle checking when skullsanity is off. * Song checks sceneIDs don't match the scenes they're actually in for some reason. Removed that check. * SaleEnd checks don't need the GetItemEntry parameter. Also set a flag that should prevent the check tracker from running during vanilla saves should that not be resolved by the time it's merged. * Attempting to have only the relevant checks added to the tracker data, as well as showing vanilla checks for non-rando saves. Not working yet (everything is displayed in vanilla). * Added vanilla check tracker population via `vanillaCheck` bool in `RandomizerCheckObject`. This is also added to `IsVisibleInImGui` to handle file loading and saving to eliminate checks that aren't part of vanilla or the rando seed. Implemented deleted tracker data file recreation. Added some extra item name text checks. Songs are still... tricky, so they stay blank. Utilize local copies of the randomizer check objects that are applicable for performance purposes. Fixed vanilla item-giving cutscene crashes when triggered mid-transition. * Apparently not all toolchains can handle macro instantiation without all parameters, like VS can. * Fixed scummed detail color not showing properly on tracker. * Fixed dungeon area totals and GS checks not functioning properly. * Major revamp of checking code. Doesn't rely on `GetCheckFromActor` at all anymore, but instead simply sets a flag to evaluate a number of checks in an area every frame until the check that was gotten is identified. With the new setup, it's much less hardware intensive, and at 60fps 6 checks per frame shows no noticeable effect on framerate. I can envision needing to add a collectedCount in order to account for times when two checks are gotten one right after the other. Changed area scroll to happen from `OnTransitionEnd`, and allow for scrolling in bazaar (was disabled previously because it would jump back and forth between Kak and Market while you were in one). Also setup area check order updating by area instead of all at the same time. * Fixed shooting gallery not reporting proper area. Prevent checks from actually happening if area is RCAREA_INVALID, now that all areas are reporting something if they have checks. Fixed `GetCheckArea()` not updating checks for standard scenes. Lots of vanilla tracking updates, mainly manual checks for gems, medallions and songs, since the often don't have proper scenes in the data. Prevent vanilla from triggering check loops if junk items are collected. Fixed sorting based on saved vs collected. Prevent item name display for vanilla runs. Change coloring of checks so the check name reflects status in vanilla runs. * Fixed "Recheck Area" button erroneously adding to an area's check totals? * Fix DMC vanilla checks. * Fix check tracker data recreation on data file loss. Removed redundant file exists check from SaveTrackerDataHook, as it doesn't matter if it exists or not at that point. Limited check loops to 3 to avoid infinite check loops on non-check/junk item pickup. Added more checks to disable tracker operations if a save is not running. Changed check ordering to put boss reward and heart container checks at the end of whatever RCSHOW group they belong to. * Fixed IsRunning calculation. Further improving vanilla checking. Starting framework for checking medallions, stones, and songs on data file recreation. Fixed medallion check collection. Added GIFT_FROM_SAGES to check list for vanilla file for tracking light medallion. Added check loop limitation to prevent infinite checking after picking up junk item from the ground. * Finished vanilla file recreation and recheck (songs and dungeon rewards all check properly now). This includes deku shield with KF shop item 3. Finished Gift from Raoru light medallion tracking for vanilla. Commented all CheckByScene functionality for now. * Fixed new save data file creation. Disabled entrance area calculation for now, as it only tracks the previous entrance for some reason. Fixed area detection for ToT checks. * GetCheckArea() now utilizes EntranceData almost exclusively, via either `gSaveContext.entranceIndex` or the entrance tracker's `currentGrottoId` in the case of grottos. This also means that EVERYTHING CAN AUTOSCROLL NOW. Entrance shuffles are now much easier to track. Autoscroll is now also triggered on save, just in case someone isn't autosaving and has a lot of checks that get converted to saved. * Fixed missing GS check in LW. * Added area scroll on toggling Show Hidden Items. May configure differently later. Fixed area detection for entrances in Gerudo Fortress/Valley and Collossus. Haunted wasteland doesn't autoscroll due to a bug in `OnTransitionEnd` hook, but checks still evaluate properly there. Rely on scene-based area detection if scene is a main overworld or dungeon scene. * Fixed grotto detection when shuffle is off. * Small code cleanup. Fixed Colossus hand chest checks. * Missing lus bump from merge conflict resolution * Fixed Colossus Grotto making `GetCheckArea` return Wasteland. * Improved OnItemReceive processing for non-token GS checks, since they can sometimes take long enough for the checking process to time out before the item is registered as received. * First attempt at thread safety for tracker data file writing. Seems to work, but might need more testing. * Fixed Recheck Area not unskipping items that register as saved. Improved delayed saving with autosaving, as the autosave triggered quite often before the tracker data save, making things not properly register as saved. * merge cleanup * Converted check tracker data to the sectional saves, adding `CheckTrackerData` to `SaveContext`. Implemented section ID returning and fullSave boolean passing to section functions from my PR temporarily for it to work properly. Moved `RandomizerCheckTrackerData` enum to `randomizerTypes.h` to accommodate that. Changed `Randomizer_SaveInit` to a `SaveManager::InitFunc` to allow for other randomizer-dependent sections to be initialized after that. Required a little refactoring to maintain intro cutscene skip when starting a randomizer file. * Revert section index return and randomizer init changes. Will need to wait on yet more changes to main. * Fixed check tracker initialization (shouldn't be tied to window initialization), restored saving/loading functionality. * Removed `CheckTracker::Init` and put SaveManager calls in `CheckTrackerWindow::InitElement`. Also a bit of cleanup from transition back to save file use. * Fixed tracker displaying check categories while file not loaded. * Fix Darunia's Joy check not marking in vanilla. * Fix autosave not triggering change from collected to saved in tracker data. * Changed default colors for scummed and collected display. * Merge upgrade code cleanup. * Add `OnTransitionEnd` calls to sandstorm transitions both to and from Wasteland. Also improved `gSaveContext.lastScene` assignment for both transition types. Allowed a bit of cleanup in `GetCheckArea`. * Added `StateButton`, a button like `ArrowButton` but that allows text instead of arrow icons. Apparently the changes from ArrowButton to StateButton happened in a previous commit... * Changed section name to `trackerDataCheck` to force SoH to load it after the randomizer section, as it required some randoSettings to be loaded first, and nothing else I tried to make the randomizer section load before it worked. This hacks a solution to checks not displaying on fast file load to a specific slot. F*** you, SaveManager, and f*** you too, JSON. * Forgot to change the section string for loading with the name change. * Fix check ordering for checks that trigger the autosave. * Adds option to remove right-side shop items (slots 1-4) from the tracker list. Enabled by default. * Fix default state of Hide Shop Right Checks checkbox. * Fixes grotto and great fairy scrolling and checks. Fixes array overflow from `checkTrackerData` which was creating the issue trying to load the base and randomizer sections first, among other things. That also fixed the massive file loads that were being exhibited in debug mode. * Fix shooting galleries being set as collected again when being played a second time after getting the checks. * Fix Bazaar autoscroll. * Add Saria's Song to `GetCheckFromActor` and removed some limitations from the messageCloseCheck function to make that check track properly. * Fix Song from Impa check. Implemented prevention for multiple "collections" of great fairies, just in case getting the health refill would trigger it with the previous setup. * Fix ice traps on GS tokens not triggering OnItemReceive. * Complete fix for ice trap collection from GS. Add autoscroll when clicking "Expand All". * Add `OnShopSlotChange` with cursorSlot and basePrice parameters. * Fixed include in en_ossan for shop slot hook. Added registration for `OnShopSlotChange` in the tracker, storing the price in a new `price` field in `CheckTrackerData`. Added "seen" functionality to shop checks. Displays the model item name upon first entering a shop, adding the price and switching to trickName (if it's an ice trap) upon navigating to the slot in buy mode, triggered by an invisible "identified" status that mirrors "seen" in every other way. Added tooltips to most options for check tracker color picking to describe what each status actually means. * `std::format` pls * So apparently std::format just decided to break with the latest merge from develop, but fmt::format exists and works? * Removed the last vestiges of `locationsSkipped`. Other general code and formatting cleanups. Moved `IsGameRunning` to `OTRGlobals` so the item tracker could also access it. Used preceding to "fix" item and bottle display in the item tracker on startup. * Some more code cleanup. Removed "Recheck Area" button and relevant code. Backported changes to Anchor branch applicable for single-player, including making a checkAreas vector and structuring the frame by frame checks around that. Also includes fix for Silver Gauntlets and Mirror Shield check collection crash associated with those changes. Fixed Kakariko Bazaar "seen" updates. Fixed tracker window not showing on initial load like it should. * Forgot 1 formatting fix. * Removed conditions for showing Song from Impa (isn't junk under certain conditions, so should show all the time). * Fix vanilla checks, add Zelda's Letter and Malon's Egg to manual check collection. Fix autoscroll while in child stealth section. * Fix crash in Happy Mask Shop in OnSlotChange (referenced non-existent shop id in a tracker-specific enum). * General code cleanup. * Missed one reversion. * One more. * Fix column alignment in `randomizer_check_objects`. * Fix file encoding on `randomizer_check_tracker`. Again. * Fix indentation for `actualItemtrackerItemMap`. Also removed unnecessary parts of the map. * Rename `HasEqItem` to `HasEquipment`. * Slightly better indentation for `actualItemTrackerItemMap`. * Add magic bean salesman to vanilla check tracking, and genericized deku shield to trigger KF shop item 3 wherever you get the shield. Renamed `vanillaCheck` to `vanillaHundoCheck` to (supposedly) clarify the meaning of the usage. * One more rename to `vanillaCompletion` to avoid possible confusion with 100% speedrun conditions. * give me a break XD Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * Changes suggested by briaguya (rename `RandomizerCheckShow` to `Status`, unused code, newline formatting) * Remove unused `itemNames` table. * Remove `IsGameRunning` in favor of `GameInteractor::IsSaveLoaded`. * Restore anti-spoiler functionality for dungeons with dungeon maps. * Review cleanup. * Fix prices not showing for Kak bazaar items. --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com>
2023-10-04 11:03:36 -04:00
Color_RGBA8 Color_Area_Incomplete_Main = { 255, 255, 255, 255 }; // White
Color_RGBA8 Color_Area_Incomplete_Extra = { 255, 255, 255, 255 }; // White
Randomizer Auto Location tracker (#1942) * Initial Auto-Location Tracking * Updates styling for checked items in Check Tracker * Fixes crashing issues with Check Tracker rendering * Auto scroll Check Tracker windows to current area * Checks Tracker only shows checked locations once in game * Fixes issue where Check Tracker would auto-scroll to wrong location when entering a grotto * Fixes gerudo fortress checks showing in tracker when settings have them removed * InfTable Check Location Fixes: Lost Dog Richard, Rolling Gorons, HBA 1000, Thawed Zora * Fixes most Event Chk Inf Checks on Check Tracker, and Frogs * Check Tracker - Song from Malon now works * Check Tracker - Fixes Claim Check check not tracking - Fixes spoiler for Claim Check check when getting Biggoron's Sword - Fixes LACS being spoiled and not tracking * Check Tracker - Fixes #2 for Skull Mask and Mask of Truth checks * Check Tracker - Adds support for merchants - Fixes #7 for Bomchu Salesman - Fixes #12 for Medigoron * Check Tracker - Fixes #8 for Song from Saria * Check Tracker - Fixes #9 for Adult Shooting Gallery * Check Tracker - Fixes #10 for Composer Grave * Check Tracker - Fixes #14 for Song from Ocarina of Time * Check Tracker - Fixes #16 for Shooting the Sun * Check Tracker - Fixes #19 for Darunia's Joy * Save Editor - Adds missing label for Treasure Chest Game * Check Tracker - Fixes Great Faries checks * Check Tracker - Fixes Sheik at Temple * Check Tracker - Fixes Great Fairy auto-scroll to wrong location * Check Tracker - Updates blue warp checks - Fixes Bongo Bongo and Twinrova checks * Check Tracker - Fixes Dampe's Gravedigging Tour * Check Tracker - Fixes Prescription to King Zora * Check Tracker - Fixes Bazaar showing under wrong area on tracker between adult/child * Check Tracker - Fixes scroll for Hyrule Market and Bazaar * Check Tracker - Fixes giving Adult Trade Items shown on tracker: Broken Sword, Saw, Cojiro, Eyeball Froge, and Eyedrops * Cleans up item_location * Check Tracker - Item List - Fixes item list not updating when changing seeds/options - Separates item exclusion list from item check list - Clean up comments * Check Tracker - Adds Skip functionality to buttons * Check Tracker - Refactors adult trade items to RandomizerInf * Check Tracker - Fixes an issue where any time an item is removed the tracker would cause an application crash * Check Tracker - Item names are now dependent on file language * Check Tracker - Fixes Gerudo Card check not showing in Fast setting * Reorders headers to (hopefully) avoid CI build conflicts on linux/consoles * Explicitly defines vector header in randomizer.h to fix compile errors * Complete Refactor of Check Tracker ImGui * Adds missing check tracker files to CMakeLists * Reverts the Item_location whitespace cleanup from ad10807c * Check Tracker - Loading Fixes - Fixes a bug where loading a save file a second time would add all the checks again - Fixes a bug where the check tracker would not render at all until in a save file * Check Tracker - Fixes a bug where checks would sometimes fail to load * Check Tracker - Fixes duplicated checks when using Only on Pause or Only on Combo * Check Tracker - Works around issue where single characters don't show in EnhancementCombobox, and fixes a label for combo buttons held option * Check Tracker - Applies all Check Tracker changes to Item Location * Check Tracker - Updated Check List - Adds Link's pocket, either in KF or HM depending on starting age - Supports Scrubs and Merchants - Uses enums instead of magic numbers - Updates DC Scrub Short Names for MQ * Check Tracker - Adds a performance mode option * Check Tracker - List Fixes (requires new rando generation) - Fixes Frogs Rupees always visible - Fixes Kokiri Sword Chest not showing - Fixes Weird Egg not showing * Check Tracker - MQ List basic support * Check Tracker - MQ/Vanilla anti-spoilers * Check Tracker - Collecting a compass now spoils the area * Check Tracker - Basic Vanilla Support and fixes - Vanilla items show in check tracker, even if many won't auto check - Fixes an issue with Gerudo Fortress Keys - Refactors IsVisibleInCheckTracker to randomizer_check_tracjer * Check Tracker - Fixes merge conflict from 08a487f35e1d760ab9e69b932edbe4da6bcd9edb * Check Tracker - Fixes tracker loading as Floating when default value is set to Windowed * Randomizer Location Exclusion List - Adds Scrubs, Merchants, Shops. Adult Trade items, MQ Dungeons, and Bean Salesman - Fixes Kokiri Sword Chest, Weird Egg, and Frog Song Rupees from misbehaving - Updates Gerudo Fortress logic to be dependent on Open/Fast/Normal Fortress - Removes Invalid Check - Adds RO Enum for MQ settings - Updates magic values to RO enum * Location Exclusion List - Scrubs that are always randomized now always show on the list * For now, removes some extra code only needed for a Check Tracker. * Randomizer Location Exclusion List - Fixes Eyeball Frog from showing up when Adult Trade Items was off * Location Tracker - Updates Eyedrops to use RandomizerInf instead of Chest * Check Tracker - Fixes a bug where Link's Pocket item wasn't acting as checked for area item count * Check Tracker - Fixes a bug where Locations would incorrectly say Vanilla due to the first check in the area being a non-MQ check * Check Tracker - Fixes a crash when Check Tracker is docked but not visible * Check Tracker - Fixes areas being spoiled when loading different save files * Check Tracker - Only reset variables if they are initialized * Check Tracker - Cleans up old comments, unused variables, methods, and macros, adds language TODOs, * Check Tracker - Readds rainbow UI elements after Cosmetics Editor refactor * Check Tracker - Removal of flag lookup that was refactored, no longer needed header, and some trivial whitespace fixes. * Check Tracker - Refactors Index to Bitmask code to a macro * Check Tracker - Changes ordering from alphabetical to RandomizerCheck ordering * Check Tracker - Wraps everything in a namespace to avoid global variable usage * Check Tracker - Explicitly defines for-loop scope * Check Tracker - refactors dungeon lookup from static array to function * Fixes a bug when using EnhancementColor with alpha * Check Tracker - Refactors all colour to use direct conversions * Check Tracker - refactors settings loading and check visibility for readability * Check Tracker - Fixes a bug where the wrong label showed on the Check Tracker BG Color * UIWidgets - Adds Alpha bar to EnhancementColor when using alpha parameter
2022-12-10 22:39:23 -05:00
Color_RGBA8 Color_Area_Complete_Main = { 255, 255, 255, 255 }; // White
Color_RGBA8 Color_Area_Complete_Extra = { 255, 255, 255, 255 }; // White
Check Tracker Update (#2668) * Initial commit. What works so far: Data file loads, saves, deletes, and is created properly. - Need to run `HasItemBeenCollected` when creating in case of mid-seed regen. Organized checks into maps set by area. Areas show in tracker. - Checks pulled from checkObjectsByArea are not currently listed. - Areas are being assumed completed and hidden at the start. * Checks now populate. Still not counting area totals properly. * Don't track RC_LINKS_POCKET in the data file, and instead manually add it in every time a save is load. rcObjects doesn't contain Link's Pocket location (duh). * Moved ItemReceive hook to randomizer_check_tracker.cpp. Skipped items are properly sorted and formatted. Saved items contribute to an area's gotten/skipped checks on load. Changed skipped items default main color to gray. General code cleanup. * Skipped checks now contribute to area totals for area completion logic. * Mid-menu rework transfer. * Started check lookup on item receive. Tried to enable scum checking on save. * Fixed scum check on save. * More code cleanup, which revealed some issues with loading and saving. Loading now works 100%, but entries in checkTrackerData are disappearing in code somewhere, causing issues with later checks. Scummed color now displays properly. Collected but unsaved displays properly. Unchecked, Skipped, Seen and Scummed checks all have arrows for skipping/unskipping. Counts a little messed up, probably double adding skips. * Fixed item counts being off across resets. Restarts were fine. * Beginning of rework for individual check updates. Adds `Actor lastCheck` to PlayState to allow assigning of last actor to give an item. This allows precise tracking of GS, freestanding PoH, etc. Works for chests too. Currently does not work for shops, unknown for normal NPC gives. Doesn't track last gives for non-checks, like drops from grass, pots, crates, etc. * Actor-based checks fully fleshed out, but can't help with sale-based checks. Implemented `pendingSaleCheck` to back out of an RC check cycle if `gSaveContext->pendingSale` is not NONE when `OnItemReceive` is called, processed through `OnSaleEnd`. This should be the final change necessary to streamline the checks. * Temporary hook to message box close to tie in trackers for non-gs/chest actors that aren't added to `GetCheckFromActor`. This triggers a 2-frame countdown to check with `HasItemBeenCollected` since half of the methods in there aren't updated until after a text box closes. Added scene tracking to get last scene so that checks in scenes that span several overworld areas could be tied to their areas properly. Modified tracker data creation to apply Link's Pocket and Song from Impa conditionally based on randomizer settings instead of just being assumed to be done. May need modification for checking click and drag spoiler loading. Removed the scene equivalence check from CheckChecks so that an entire area is checked each time to avoid issues with, e.g., leaving a shop before a pending sale finishes. * Changed check data creation to use RSKs from gRandomizer to account for settings loaded from drag and drop spoilers. * Beginning of tracker code organization. Changed check color defaults. * Reverted moving tracker colors to header. Some individual check fixes. * Missed something from previous merge? * Removed last remnant of removed performance mode. * Better handle checking when skullsanity is off. * Song checks sceneIDs don't match the scenes they're actually in for some reason. Removed that check. * SaleEnd checks don't need the GetItemEntry parameter. Also set a flag that should prevent the check tracker from running during vanilla saves should that not be resolved by the time it's merged. * Attempting to have only the relevant checks added to the tracker data, as well as showing vanilla checks for non-rando saves. Not working yet (everything is displayed in vanilla). * Added vanilla check tracker population via `vanillaCheck` bool in `RandomizerCheckObject`. This is also added to `IsVisibleInImGui` to handle file loading and saving to eliminate checks that aren't part of vanilla or the rando seed. Implemented deleted tracker data file recreation. Added some extra item name text checks. Songs are still... tricky, so they stay blank. Utilize local copies of the randomizer check objects that are applicable for performance purposes. Fixed vanilla item-giving cutscene crashes when triggered mid-transition. * Apparently not all toolchains can handle macro instantiation without all parameters, like VS can. * Fixed scummed detail color not showing properly on tracker. * Fixed dungeon area totals and GS checks not functioning properly. * Major revamp of checking code. Doesn't rely on `GetCheckFromActor` at all anymore, but instead simply sets a flag to evaluate a number of checks in an area every frame until the check that was gotten is identified. With the new setup, it's much less hardware intensive, and at 60fps 6 checks per frame shows no noticeable effect on framerate. I can envision needing to add a collectedCount in order to account for times when two checks are gotten one right after the other. Changed area scroll to happen from `OnTransitionEnd`, and allow for scrolling in bazaar (was disabled previously because it would jump back and forth between Kak and Market while you were in one). Also setup area check order updating by area instead of all at the same time. * Fixed shooting gallery not reporting proper area. Prevent checks from actually happening if area is RCAREA_INVALID, now that all areas are reporting something if they have checks. Fixed `GetCheckArea()` not updating checks for standard scenes. Lots of vanilla tracking updates, mainly manual checks for gems, medallions and songs, since the often don't have proper scenes in the data. Prevent vanilla from triggering check loops if junk items are collected. Fixed sorting based on saved vs collected. Prevent item name display for vanilla runs. Change coloring of checks so the check name reflects status in vanilla runs. * Fixed "Recheck Area" button erroneously adding to an area's check totals? * Fix DMC vanilla checks. * Fix check tracker data recreation on data file loss. Removed redundant file exists check from SaveTrackerDataHook, as it doesn't matter if it exists or not at that point. Limited check loops to 3 to avoid infinite check loops on non-check/junk item pickup. Added more checks to disable tracker operations if a save is not running. Changed check ordering to put boss reward and heart container checks at the end of whatever RCSHOW group they belong to. * Fixed IsRunning calculation. Further improving vanilla checking. Starting framework for checking medallions, stones, and songs on data file recreation. Fixed medallion check collection. Added GIFT_FROM_SAGES to check list for vanilla file for tracking light medallion. Added check loop limitation to prevent infinite checking after picking up junk item from the ground. * Finished vanilla file recreation and recheck (songs and dungeon rewards all check properly now). This includes deku shield with KF shop item 3. Finished Gift from Raoru light medallion tracking for vanilla. Commented all CheckByScene functionality for now. * Fixed new save data file creation. Disabled entrance area calculation for now, as it only tracks the previous entrance for some reason. Fixed area detection for ToT checks. * GetCheckArea() now utilizes EntranceData almost exclusively, via either `gSaveContext.entranceIndex` or the entrance tracker's `currentGrottoId` in the case of grottos. This also means that EVERYTHING CAN AUTOSCROLL NOW. Entrance shuffles are now much easier to track. Autoscroll is now also triggered on save, just in case someone isn't autosaving and has a lot of checks that get converted to saved. * Fixed missing GS check in LW. * Added area scroll on toggling Show Hidden Items. May configure differently later. Fixed area detection for entrances in Gerudo Fortress/Valley and Collossus. Haunted wasteland doesn't autoscroll due to a bug in `OnTransitionEnd` hook, but checks still evaluate properly there. Rely on scene-based area detection if scene is a main overworld or dungeon scene. * Fixed grotto detection when shuffle is off. * Small code cleanup. Fixed Colossus hand chest checks. * Missing lus bump from merge conflict resolution * Fixed Colossus Grotto making `GetCheckArea` return Wasteland. * Improved OnItemReceive processing for non-token GS checks, since they can sometimes take long enough for the checking process to time out before the item is registered as received. * First attempt at thread safety for tracker data file writing. Seems to work, but might need more testing. * Fixed Recheck Area not unskipping items that register as saved. Improved delayed saving with autosaving, as the autosave triggered quite often before the tracker data save, making things not properly register as saved. * merge cleanup * Converted check tracker data to the sectional saves, adding `CheckTrackerData` to `SaveContext`. Implemented section ID returning and fullSave boolean passing to section functions from my PR temporarily for it to work properly. Moved `RandomizerCheckTrackerData` enum to `randomizerTypes.h` to accommodate that. Changed `Randomizer_SaveInit` to a `SaveManager::InitFunc` to allow for other randomizer-dependent sections to be initialized after that. Required a little refactoring to maintain intro cutscene skip when starting a randomizer file. * Revert section index return and randomizer init changes. Will need to wait on yet more changes to main. * Fixed check tracker initialization (shouldn't be tied to window initialization), restored saving/loading functionality. * Removed `CheckTracker::Init` and put SaveManager calls in `CheckTrackerWindow::InitElement`. Also a bit of cleanup from transition back to save file use. * Fixed tracker displaying check categories while file not loaded. * Fix Darunia's Joy check not marking in vanilla. * Fix autosave not triggering change from collected to saved in tracker data. * Changed default colors for scummed and collected display. * Merge upgrade code cleanup. * Add `OnTransitionEnd` calls to sandstorm transitions both to and from Wasteland. Also improved `gSaveContext.lastScene` assignment for both transition types. Allowed a bit of cleanup in `GetCheckArea`. * Added `StateButton`, a button like `ArrowButton` but that allows text instead of arrow icons. Apparently the changes from ArrowButton to StateButton happened in a previous commit... * Changed section name to `trackerDataCheck` to force SoH to load it after the randomizer section, as it required some randoSettings to be loaded first, and nothing else I tried to make the randomizer section load before it worked. This hacks a solution to checks not displaying on fast file load to a specific slot. F*** you, SaveManager, and f*** you too, JSON. * Forgot to change the section string for loading with the name change. * Fix check ordering for checks that trigger the autosave. * Adds option to remove right-side shop items (slots 1-4) from the tracker list. Enabled by default. * Fix default state of Hide Shop Right Checks checkbox. * Fixes grotto and great fairy scrolling and checks. Fixes array overflow from `checkTrackerData` which was creating the issue trying to load the base and randomizer sections first, among other things. That also fixed the massive file loads that were being exhibited in debug mode. * Fix shooting galleries being set as collected again when being played a second time after getting the checks. * Fix Bazaar autoscroll. * Add Saria's Song to `GetCheckFromActor` and removed some limitations from the messageCloseCheck function to make that check track properly. * Fix Song from Impa check. Implemented prevention for multiple "collections" of great fairies, just in case getting the health refill would trigger it with the previous setup. * Fix ice traps on GS tokens not triggering OnItemReceive. * Complete fix for ice trap collection from GS. Add autoscroll when clicking "Expand All". * Add `OnShopSlotChange` with cursorSlot and basePrice parameters. * Fixed include in en_ossan for shop slot hook. Added registration for `OnShopSlotChange` in the tracker, storing the price in a new `price` field in `CheckTrackerData`. Added "seen" functionality to shop checks. Displays the model item name upon first entering a shop, adding the price and switching to trickName (if it's an ice trap) upon navigating to the slot in buy mode, triggered by an invisible "identified" status that mirrors "seen" in every other way. Added tooltips to most options for check tracker color picking to describe what each status actually means. * `std::format` pls * So apparently std::format just decided to break with the latest merge from develop, but fmt::format exists and works? * Removed the last vestiges of `locationsSkipped`. Other general code and formatting cleanups. Moved `IsGameRunning` to `OTRGlobals` so the item tracker could also access it. Used preceding to "fix" item and bottle display in the item tracker on startup. * Some more code cleanup. Removed "Recheck Area" button and relevant code. Backported changes to Anchor branch applicable for single-player, including making a checkAreas vector and structuring the frame by frame checks around that. Also includes fix for Silver Gauntlets and Mirror Shield check collection crash associated with those changes. Fixed Kakariko Bazaar "seen" updates. Fixed tracker window not showing on initial load like it should. * Forgot 1 formatting fix. * Removed conditions for showing Song from Impa (isn't junk under certain conditions, so should show all the time). * Fix vanilla checks, add Zelda's Letter and Malon's Egg to manual check collection. Fix autoscroll while in child stealth section. * Fix crash in Happy Mask Shop in OnSlotChange (referenced non-existent shop id in a tracker-specific enum). * General code cleanup. * Missed one reversion. * One more. * Fix column alignment in `randomizer_check_objects`. * Fix file encoding on `randomizer_check_tracker`. Again. * Fix indentation for `actualItemtrackerItemMap`. Also removed unnecessary parts of the map. * Rename `HasEqItem` to `HasEquipment`. * Slightly better indentation for `actualItemTrackerItemMap`. * Add magic bean salesman to vanilla check tracking, and genericized deku shield to trigger KF shop item 3 wherever you get the shield. Renamed `vanillaCheck` to `vanillaHundoCheck` to (supposedly) clarify the meaning of the usage. * One more rename to `vanillaCompletion` to avoid possible confusion with 100% speedrun conditions. * give me a break XD Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * Changes suggested by briaguya (rename `RandomizerCheckShow` to `Status`, unused code, newline formatting) * Remove unused `itemNames` table. * Remove `IsGameRunning` in favor of `GameInteractor::IsSaveLoaded`. * Restore anti-spoiler functionality for dungeons with dungeon maps. * Review cleanup. * Fix prices not showing for Kak bazaar items. --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com>
2023-10-04 11:03:36 -04:00
Color_RGBA8 Color_Unchecked_Main = { 255, 255, 255, 255 }; // White
Color_RGBA8 Color_Unchecked_Extra = { 255, 255, 255, 255 }; // Useless
Color_RGBA8 Color_Skipped_Main = { 160, 160, 160, 255 }; // Grey
Color_RGBA8 Color_Skipped_Extra = { 160, 160, 160, 255 }; // Grey
Color_RGBA8 Color_Seen_Main = { 255, 255, 255, 255 }; // TODO
Color_RGBA8 Color_Seen_Extra = { 160, 160, 160, 255 }; // TODO
Color_RGBA8 Color_Hinted_Main = { 255, 255, 255, 255 }; // TODO
Color_RGBA8 Color_Hinted_Extra = { 255, 255, 255, 255 }; // TODO
Color_RGBA8 Color_Collected_Main = { 255, 255, 255, 255 }; // White
Color_RGBA8 Color_Collected_Extra = { 242, 101, 34, 255 }; // Orange
Color_RGBA8 Color_Scummed_Main = { 255, 255, 255, 255 }; // White
Color_RGBA8 Color_Scummed_Extra = { 0, 174, 239, 255 }; // Blue
Color_RGBA8 Color_Saved_Main = { 255, 255, 255, 255 }; // White
Color_RGBA8 Color_Saved_Extra = { 0, 185, 0, 255 }; // Green
Randomizer Auto Location tracker (#1942) * Initial Auto-Location Tracking * Updates styling for checked items in Check Tracker * Fixes crashing issues with Check Tracker rendering * Auto scroll Check Tracker windows to current area * Checks Tracker only shows checked locations once in game * Fixes issue where Check Tracker would auto-scroll to wrong location when entering a grotto * Fixes gerudo fortress checks showing in tracker when settings have them removed * InfTable Check Location Fixes: Lost Dog Richard, Rolling Gorons, HBA 1000, Thawed Zora * Fixes most Event Chk Inf Checks on Check Tracker, and Frogs * Check Tracker - Song from Malon now works * Check Tracker - Fixes Claim Check check not tracking - Fixes spoiler for Claim Check check when getting Biggoron's Sword - Fixes LACS being spoiled and not tracking * Check Tracker - Fixes #2 for Skull Mask and Mask of Truth checks * Check Tracker - Adds support for merchants - Fixes #7 for Bomchu Salesman - Fixes #12 for Medigoron * Check Tracker - Fixes #8 for Song from Saria * Check Tracker - Fixes #9 for Adult Shooting Gallery * Check Tracker - Fixes #10 for Composer Grave * Check Tracker - Fixes #14 for Song from Ocarina of Time * Check Tracker - Fixes #16 for Shooting the Sun * Check Tracker - Fixes #19 for Darunia's Joy * Save Editor - Adds missing label for Treasure Chest Game * Check Tracker - Fixes Great Faries checks * Check Tracker - Fixes Sheik at Temple * Check Tracker - Fixes Great Fairy auto-scroll to wrong location * Check Tracker - Updates blue warp checks - Fixes Bongo Bongo and Twinrova checks * Check Tracker - Fixes Dampe's Gravedigging Tour * Check Tracker - Fixes Prescription to King Zora * Check Tracker - Fixes Bazaar showing under wrong area on tracker between adult/child * Check Tracker - Fixes scroll for Hyrule Market and Bazaar * Check Tracker - Fixes giving Adult Trade Items shown on tracker: Broken Sword, Saw, Cojiro, Eyeball Froge, and Eyedrops * Cleans up item_location * Check Tracker - Item List - Fixes item list not updating when changing seeds/options - Separates item exclusion list from item check list - Clean up comments * Check Tracker - Adds Skip functionality to buttons * Check Tracker - Refactors adult trade items to RandomizerInf * Check Tracker - Fixes an issue where any time an item is removed the tracker would cause an application crash * Check Tracker - Item names are now dependent on file language * Check Tracker - Fixes Gerudo Card check not showing in Fast setting * Reorders headers to (hopefully) avoid CI build conflicts on linux/consoles * Explicitly defines vector header in randomizer.h to fix compile errors * Complete Refactor of Check Tracker ImGui * Adds missing check tracker files to CMakeLists * Reverts the Item_location whitespace cleanup from ad10807c * Check Tracker - Loading Fixes - Fixes a bug where loading a save file a second time would add all the checks again - Fixes a bug where the check tracker would not render at all until in a save file * Check Tracker - Fixes a bug where checks would sometimes fail to load * Check Tracker - Fixes duplicated checks when using Only on Pause or Only on Combo * Check Tracker - Works around issue where single characters don't show in EnhancementCombobox, and fixes a label for combo buttons held option * Check Tracker - Applies all Check Tracker changes to Item Location * Check Tracker - Updated Check List - Adds Link's pocket, either in KF or HM depending on starting age - Supports Scrubs and Merchants - Uses enums instead of magic numbers - Updates DC Scrub Short Names for MQ * Check Tracker - Adds a performance mode option * Check Tracker - List Fixes (requires new rando generation) - Fixes Frogs Rupees always visible - Fixes Kokiri Sword Chest not showing - Fixes Weird Egg not showing * Check Tracker - MQ List basic support * Check Tracker - MQ/Vanilla anti-spoilers * Check Tracker - Collecting a compass now spoils the area * Check Tracker - Basic Vanilla Support and fixes - Vanilla items show in check tracker, even if many won't auto check - Fixes an issue with Gerudo Fortress Keys - Refactors IsVisibleInCheckTracker to randomizer_check_tracjer * Check Tracker - Fixes merge conflict from 08a487f35e1d760ab9e69b932edbe4da6bcd9edb * Check Tracker - Fixes tracker loading as Floating when default value is set to Windowed * Randomizer Location Exclusion List - Adds Scrubs, Merchants, Shops. Adult Trade items, MQ Dungeons, and Bean Salesman - Fixes Kokiri Sword Chest, Weird Egg, and Frog Song Rupees from misbehaving - Updates Gerudo Fortress logic to be dependent on Open/Fast/Normal Fortress - Removes Invalid Check - Adds RO Enum for MQ settings - Updates magic values to RO enum * Location Exclusion List - Scrubs that are always randomized now always show on the list * For now, removes some extra code only needed for a Check Tracker. * Randomizer Location Exclusion List - Fixes Eyeball Frog from showing up when Adult Trade Items was off * Location Tracker - Updates Eyedrops to use RandomizerInf instead of Chest * Check Tracker - Fixes a bug where Link's Pocket item wasn't acting as checked for area item count * Check Tracker - Fixes a bug where Locations would incorrectly say Vanilla due to the first check in the area being a non-MQ check * Check Tracker - Fixes a crash when Check Tracker is docked but not visible * Check Tracker - Fixes areas being spoiled when loading different save files * Check Tracker - Only reset variables if they are initialized * Check Tracker - Cleans up old comments, unused variables, methods, and macros, adds language TODOs, * Check Tracker - Readds rainbow UI elements after Cosmetics Editor refactor * Check Tracker - Removal of flag lookup that was refactored, no longer needed header, and some trivial whitespace fixes. * Check Tracker - Refactors Index to Bitmask code to a macro * Check Tracker - Changes ordering from alphabetical to RandomizerCheck ordering * Check Tracker - Wraps everything in a namespace to avoid global variable usage * Check Tracker - Explicitly defines for-loop scope * Check Tracker - refactors dungeon lookup from static array to function * Fixes a bug when using EnhancementColor with alpha * Check Tracker - Refactors all colour to use direct conversions * Check Tracker - refactors settings loading and check visibility for readability * Check Tracker - Fixes a bug where the wrong label showed on the Check Tracker BG Color * UIWidgets - Adds Alpha bar to EnhancementColor when using alpha parameter
2022-12-10 22:39:23 -05:00
Check Tracker Update (#2668) * Initial commit. What works so far: Data file loads, saves, deletes, and is created properly. - Need to run `HasItemBeenCollected` when creating in case of mid-seed regen. Organized checks into maps set by area. Areas show in tracker. - Checks pulled from checkObjectsByArea are not currently listed. - Areas are being assumed completed and hidden at the start. * Checks now populate. Still not counting area totals properly. * Don't track RC_LINKS_POCKET in the data file, and instead manually add it in every time a save is load. rcObjects doesn't contain Link's Pocket location (duh). * Moved ItemReceive hook to randomizer_check_tracker.cpp. Skipped items are properly sorted and formatted. Saved items contribute to an area's gotten/skipped checks on load. Changed skipped items default main color to gray. General code cleanup. * Skipped checks now contribute to area totals for area completion logic. * Mid-menu rework transfer. * Started check lookup on item receive. Tried to enable scum checking on save. * Fixed scum check on save. * More code cleanup, which revealed some issues with loading and saving. Loading now works 100%, but entries in checkTrackerData are disappearing in code somewhere, causing issues with later checks. Scummed color now displays properly. Collected but unsaved displays properly. Unchecked, Skipped, Seen and Scummed checks all have arrows for skipping/unskipping. Counts a little messed up, probably double adding skips. * Fixed item counts being off across resets. Restarts were fine. * Beginning of rework for individual check updates. Adds `Actor lastCheck` to PlayState to allow assigning of last actor to give an item. This allows precise tracking of GS, freestanding PoH, etc. Works for chests too. Currently does not work for shops, unknown for normal NPC gives. Doesn't track last gives for non-checks, like drops from grass, pots, crates, etc. * Actor-based checks fully fleshed out, but can't help with sale-based checks. Implemented `pendingSaleCheck` to back out of an RC check cycle if `gSaveContext->pendingSale` is not NONE when `OnItemReceive` is called, processed through `OnSaleEnd`. This should be the final change necessary to streamline the checks. * Temporary hook to message box close to tie in trackers for non-gs/chest actors that aren't added to `GetCheckFromActor`. This triggers a 2-frame countdown to check with `HasItemBeenCollected` since half of the methods in there aren't updated until after a text box closes. Added scene tracking to get last scene so that checks in scenes that span several overworld areas could be tied to their areas properly. Modified tracker data creation to apply Link's Pocket and Song from Impa conditionally based on randomizer settings instead of just being assumed to be done. May need modification for checking click and drag spoiler loading. Removed the scene equivalence check from CheckChecks so that an entire area is checked each time to avoid issues with, e.g., leaving a shop before a pending sale finishes. * Changed check data creation to use RSKs from gRandomizer to account for settings loaded from drag and drop spoilers. * Beginning of tracker code organization. Changed check color defaults. * Reverted moving tracker colors to header. Some individual check fixes. * Missed something from previous merge? * Removed last remnant of removed performance mode. * Better handle checking when skullsanity is off. * Song checks sceneIDs don't match the scenes they're actually in for some reason. Removed that check. * SaleEnd checks don't need the GetItemEntry parameter. Also set a flag that should prevent the check tracker from running during vanilla saves should that not be resolved by the time it's merged. * Attempting to have only the relevant checks added to the tracker data, as well as showing vanilla checks for non-rando saves. Not working yet (everything is displayed in vanilla). * Added vanilla check tracker population via `vanillaCheck` bool in `RandomizerCheckObject`. This is also added to `IsVisibleInImGui` to handle file loading and saving to eliminate checks that aren't part of vanilla or the rando seed. Implemented deleted tracker data file recreation. Added some extra item name text checks. Songs are still... tricky, so they stay blank. Utilize local copies of the randomizer check objects that are applicable for performance purposes. Fixed vanilla item-giving cutscene crashes when triggered mid-transition. * Apparently not all toolchains can handle macro instantiation without all parameters, like VS can. * Fixed scummed detail color not showing properly on tracker. * Fixed dungeon area totals and GS checks not functioning properly. * Major revamp of checking code. Doesn't rely on `GetCheckFromActor` at all anymore, but instead simply sets a flag to evaluate a number of checks in an area every frame until the check that was gotten is identified. With the new setup, it's much less hardware intensive, and at 60fps 6 checks per frame shows no noticeable effect on framerate. I can envision needing to add a collectedCount in order to account for times when two checks are gotten one right after the other. Changed area scroll to happen from `OnTransitionEnd`, and allow for scrolling in bazaar (was disabled previously because it would jump back and forth between Kak and Market while you were in one). Also setup area check order updating by area instead of all at the same time. * Fixed shooting gallery not reporting proper area. Prevent checks from actually happening if area is RCAREA_INVALID, now that all areas are reporting something if they have checks. Fixed `GetCheckArea()` not updating checks for standard scenes. Lots of vanilla tracking updates, mainly manual checks for gems, medallions and songs, since the often don't have proper scenes in the data. Prevent vanilla from triggering check loops if junk items are collected. Fixed sorting based on saved vs collected. Prevent item name display for vanilla runs. Change coloring of checks so the check name reflects status in vanilla runs. * Fixed "Recheck Area" button erroneously adding to an area's check totals? * Fix DMC vanilla checks. * Fix check tracker data recreation on data file loss. Removed redundant file exists check from SaveTrackerDataHook, as it doesn't matter if it exists or not at that point. Limited check loops to 3 to avoid infinite check loops on non-check/junk item pickup. Added more checks to disable tracker operations if a save is not running. Changed check ordering to put boss reward and heart container checks at the end of whatever RCSHOW group they belong to. * Fixed IsRunning calculation. Further improving vanilla checking. Starting framework for checking medallions, stones, and songs on data file recreation. Fixed medallion check collection. Added GIFT_FROM_SAGES to check list for vanilla file for tracking light medallion. Added check loop limitation to prevent infinite checking after picking up junk item from the ground. * Finished vanilla file recreation and recheck (songs and dungeon rewards all check properly now). This includes deku shield with KF shop item 3. Finished Gift from Raoru light medallion tracking for vanilla. Commented all CheckByScene functionality for now. * Fixed new save data file creation. Disabled entrance area calculation for now, as it only tracks the previous entrance for some reason. Fixed area detection for ToT checks. * GetCheckArea() now utilizes EntranceData almost exclusively, via either `gSaveContext.entranceIndex` or the entrance tracker's `currentGrottoId` in the case of grottos. This also means that EVERYTHING CAN AUTOSCROLL NOW. Entrance shuffles are now much easier to track. Autoscroll is now also triggered on save, just in case someone isn't autosaving and has a lot of checks that get converted to saved. * Fixed missing GS check in LW. * Added area scroll on toggling Show Hidden Items. May configure differently later. Fixed area detection for entrances in Gerudo Fortress/Valley and Collossus. Haunted wasteland doesn't autoscroll due to a bug in `OnTransitionEnd` hook, but checks still evaluate properly there. Rely on scene-based area detection if scene is a main overworld or dungeon scene. * Fixed grotto detection when shuffle is off. * Small code cleanup. Fixed Colossus hand chest checks. * Missing lus bump from merge conflict resolution * Fixed Colossus Grotto making `GetCheckArea` return Wasteland. * Improved OnItemReceive processing for non-token GS checks, since they can sometimes take long enough for the checking process to time out before the item is registered as received. * First attempt at thread safety for tracker data file writing. Seems to work, but might need more testing. * Fixed Recheck Area not unskipping items that register as saved. Improved delayed saving with autosaving, as the autosave triggered quite often before the tracker data save, making things not properly register as saved. * merge cleanup * Converted check tracker data to the sectional saves, adding `CheckTrackerData` to `SaveContext`. Implemented section ID returning and fullSave boolean passing to section functions from my PR temporarily for it to work properly. Moved `RandomizerCheckTrackerData` enum to `randomizerTypes.h` to accommodate that. Changed `Randomizer_SaveInit` to a `SaveManager::InitFunc` to allow for other randomizer-dependent sections to be initialized after that. Required a little refactoring to maintain intro cutscene skip when starting a randomizer file. * Revert section index return and randomizer init changes. Will need to wait on yet more changes to main. * Fixed check tracker initialization (shouldn't be tied to window initialization), restored saving/loading functionality. * Removed `CheckTracker::Init` and put SaveManager calls in `CheckTrackerWindow::InitElement`. Also a bit of cleanup from transition back to save file use. * Fixed tracker displaying check categories while file not loaded. * Fix Darunia's Joy check not marking in vanilla. * Fix autosave not triggering change from collected to saved in tracker data. * Changed default colors for scummed and collected display. * Merge upgrade code cleanup. * Add `OnTransitionEnd` calls to sandstorm transitions both to and from Wasteland. Also improved `gSaveContext.lastScene` assignment for both transition types. Allowed a bit of cleanup in `GetCheckArea`. * Added `StateButton`, a button like `ArrowButton` but that allows text instead of arrow icons. Apparently the changes from ArrowButton to StateButton happened in a previous commit... * Changed section name to `trackerDataCheck` to force SoH to load it after the randomizer section, as it required some randoSettings to be loaded first, and nothing else I tried to make the randomizer section load before it worked. This hacks a solution to checks not displaying on fast file load to a specific slot. F*** you, SaveManager, and f*** you too, JSON. * Forgot to change the section string for loading with the name change. * Fix check ordering for checks that trigger the autosave. * Adds option to remove right-side shop items (slots 1-4) from the tracker list. Enabled by default. * Fix default state of Hide Shop Right Checks checkbox. * Fixes grotto and great fairy scrolling and checks. Fixes array overflow from `checkTrackerData` which was creating the issue trying to load the base and randomizer sections first, among other things. That also fixed the massive file loads that were being exhibited in debug mode. * Fix shooting galleries being set as collected again when being played a second time after getting the checks. * Fix Bazaar autoscroll. * Add Saria's Song to `GetCheckFromActor` and removed some limitations from the messageCloseCheck function to make that check track properly. * Fix Song from Impa check. Implemented prevention for multiple "collections" of great fairies, just in case getting the health refill would trigger it with the previous setup. * Fix ice traps on GS tokens not triggering OnItemReceive. * Complete fix for ice trap collection from GS. Add autoscroll when clicking "Expand All". * Add `OnShopSlotChange` with cursorSlot and basePrice parameters. * Fixed include in en_ossan for shop slot hook. Added registration for `OnShopSlotChange` in the tracker, storing the price in a new `price` field in `CheckTrackerData`. Added "seen" functionality to shop checks. Displays the model item name upon first entering a shop, adding the price and switching to trickName (if it's an ice trap) upon navigating to the slot in buy mode, triggered by an invisible "identified" status that mirrors "seen" in every other way. Added tooltips to most options for check tracker color picking to describe what each status actually means. * `std::format` pls * So apparently std::format just decided to break with the latest merge from develop, but fmt::format exists and works? * Removed the last vestiges of `locationsSkipped`. Other general code and formatting cleanups. Moved `IsGameRunning` to `OTRGlobals` so the item tracker could also access it. Used preceding to "fix" item and bottle display in the item tracker on startup. * Some more code cleanup. Removed "Recheck Area" button and relevant code. Backported changes to Anchor branch applicable for single-player, including making a checkAreas vector and structuring the frame by frame checks around that. Also includes fix for Silver Gauntlets and Mirror Shield check collection crash associated with those changes. Fixed Kakariko Bazaar "seen" updates. Fixed tracker window not showing on initial load like it should. * Forgot 1 formatting fix. * Removed conditions for showing Song from Impa (isn't junk under certain conditions, so should show all the time). * Fix vanilla checks, add Zelda's Letter and Malon's Egg to manual check collection. Fix autoscroll while in child stealth section. * Fix crash in Happy Mask Shop in OnSlotChange (referenced non-existent shop id in a tracker-specific enum). * General code cleanup. * Missed one reversion. * One more. * Fix column alignment in `randomizer_check_objects`. * Fix file encoding on `randomizer_check_tracker`. Again. * Fix indentation for `actualItemtrackerItemMap`. Also removed unnecessary parts of the map. * Rename `HasEqItem` to `HasEquipment`. * Slightly better indentation for `actualItemTrackerItemMap`. * Add magic bean salesman to vanilla check tracking, and genericized deku shield to trigger KF shop item 3 wherever you get the shield. Renamed `vanillaCheck` to `vanillaHundoCheck` to (supposedly) clarify the meaning of the usage. * One more rename to `vanillaCompletion` to avoid possible confusion with 100% speedrun conditions. * give me a break XD Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * Changes suggested by briaguya (rename `RandomizerCheckShow` to `Status`, unused code, newline formatting) * Remove unused `itemNames` table. * Remove `IsGameRunning` in favor of `GameInteractor::IsSaveLoaded`. * Restore anti-spoiler functionality for dungeons with dungeon maps. * Review cleanup. * Fix prices not showing for Kak bazaar items. --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com>
2023-10-04 11:03:36 -04:00
std::vector<uint32_t> buttons = { BTN_A, BTN_B, BTN_CUP, BTN_CDOWN, BTN_CLEFT, BTN_CRIGHT, BTN_L,
BTN_Z, BTN_R, BTN_START, BTN_DUP, BTN_DDOWN, BTN_DLEFT, BTN_DRIGHT };
void DefaultCheckData(RandomizerCheck rc) {
gSaveContext.checkTrackerData[rc].status = RCSHOW_UNCHECKED;
gSaveContext.checkTrackerData[rc].skipped = 0;
gSaveContext.checkTrackerData[rc].hintItem = RC_UNKNOWN_CHECK;
}
void SongFromImpa() {
if (IS_RANDO) {
if (OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_SKIP_CHILD_ZELDA) == RO_GENERIC_ON && IS_RANDO) {
if (gSaveContext.checkTrackerData[RC_SONG_FROM_IMPA].status != RCSHOW_SAVED) {
gSaveContext.checkTrackerData[RC_SONG_FROM_IMPA].status = RCSHOW_SAVED;
}
}
}
}
void GiftFromSages() {
if (!IS_RANDO) {
DefaultCheckData(RC_GIFT_FROM_SAGES);
Randomizer Auto Location tracker (#1942) * Initial Auto-Location Tracking * Updates styling for checked items in Check Tracker * Fixes crashing issues with Check Tracker rendering * Auto scroll Check Tracker windows to current area * Checks Tracker only shows checked locations once in game * Fixes issue where Check Tracker would auto-scroll to wrong location when entering a grotto * Fixes gerudo fortress checks showing in tracker when settings have them removed * InfTable Check Location Fixes: Lost Dog Richard, Rolling Gorons, HBA 1000, Thawed Zora * Fixes most Event Chk Inf Checks on Check Tracker, and Frogs * Check Tracker - Song from Malon now works * Check Tracker - Fixes Claim Check check not tracking - Fixes spoiler for Claim Check check when getting Biggoron's Sword - Fixes LACS being spoiled and not tracking * Check Tracker - Fixes #2 for Skull Mask and Mask of Truth checks * Check Tracker - Adds support for merchants - Fixes #7 for Bomchu Salesman - Fixes #12 for Medigoron * Check Tracker - Fixes #8 for Song from Saria * Check Tracker - Fixes #9 for Adult Shooting Gallery * Check Tracker - Fixes #10 for Composer Grave * Check Tracker - Fixes #14 for Song from Ocarina of Time * Check Tracker - Fixes #16 for Shooting the Sun * Check Tracker - Fixes #19 for Darunia's Joy * Save Editor - Adds missing label for Treasure Chest Game * Check Tracker - Fixes Great Faries checks * Check Tracker - Fixes Sheik at Temple * Check Tracker - Fixes Great Fairy auto-scroll to wrong location * Check Tracker - Updates blue warp checks - Fixes Bongo Bongo and Twinrova checks * Check Tracker - Fixes Dampe's Gravedigging Tour * Check Tracker - Fixes Prescription to King Zora * Check Tracker - Fixes Bazaar showing under wrong area on tracker between adult/child * Check Tracker - Fixes scroll for Hyrule Market and Bazaar * Check Tracker - Fixes giving Adult Trade Items shown on tracker: Broken Sword, Saw, Cojiro, Eyeball Froge, and Eyedrops * Cleans up item_location * Check Tracker - Item List - Fixes item list not updating when changing seeds/options - Separates item exclusion list from item check list - Clean up comments * Check Tracker - Adds Skip functionality to buttons * Check Tracker - Refactors adult trade items to RandomizerInf * Check Tracker - Fixes an issue where any time an item is removed the tracker would cause an application crash * Check Tracker - Item names are now dependent on file language * Check Tracker - Fixes Gerudo Card check not showing in Fast setting * Reorders headers to (hopefully) avoid CI build conflicts on linux/consoles * Explicitly defines vector header in randomizer.h to fix compile errors * Complete Refactor of Check Tracker ImGui * Adds missing check tracker files to CMakeLists * Reverts the Item_location whitespace cleanup from ad10807c * Check Tracker - Loading Fixes - Fixes a bug where loading a save file a second time would add all the checks again - Fixes a bug where the check tracker would not render at all until in a save file * Check Tracker - Fixes a bug where checks would sometimes fail to load * Check Tracker - Fixes duplicated checks when using Only on Pause or Only on Combo * Check Tracker - Works around issue where single characters don't show in EnhancementCombobox, and fixes a label for combo buttons held option * Check Tracker - Applies all Check Tracker changes to Item Location * Check Tracker - Updated Check List - Adds Link's pocket, either in KF or HM depending on starting age - Supports Scrubs and Merchants - Uses enums instead of magic numbers - Updates DC Scrub Short Names for MQ * Check Tracker - Adds a performance mode option * Check Tracker - List Fixes (requires new rando generation) - Fixes Frogs Rupees always visible - Fixes Kokiri Sword Chest not showing - Fixes Weird Egg not showing * Check Tracker - MQ List basic support * Check Tracker - MQ/Vanilla anti-spoilers * Check Tracker - Collecting a compass now spoils the area * Check Tracker - Basic Vanilla Support and fixes - Vanilla items show in check tracker, even if many won't auto check - Fixes an issue with Gerudo Fortress Keys - Refactors IsVisibleInCheckTracker to randomizer_check_tracjer * Check Tracker - Fixes merge conflict from 08a487f35e1d760ab9e69b932edbe4da6bcd9edb * Check Tracker - Fixes tracker loading as Floating when default value is set to Windowed * Randomizer Location Exclusion List - Adds Scrubs, Merchants, Shops. Adult Trade items, MQ Dungeons, and Bean Salesman - Fixes Kokiri Sword Chest, Weird Egg, and Frog Song Rupees from misbehaving - Updates Gerudo Fortress logic to be dependent on Open/Fast/Normal Fortress - Removes Invalid Check - Adds RO Enum for MQ settings - Updates magic values to RO enum * Location Exclusion List - Scrubs that are always randomized now always show on the list * For now, removes some extra code only needed for a Check Tracker. * Randomizer Location Exclusion List - Fixes Eyeball Frog from showing up when Adult Trade Items was off * Location Tracker - Updates Eyedrops to use RandomizerInf instead of Chest * Check Tracker - Fixes a bug where Link's Pocket item wasn't acting as checked for area item count * Check Tracker - Fixes a bug where Locations would incorrectly say Vanilla due to the first check in the area being a non-MQ check * Check Tracker - Fixes a crash when Check Tracker is docked but not visible * Check Tracker - Fixes areas being spoiled when loading different save files * Check Tracker - Only reset variables if they are initialized * Check Tracker - Cleans up old comments, unused variables, methods, and macros, adds language TODOs, * Check Tracker - Readds rainbow UI elements after Cosmetics Editor refactor * Check Tracker - Removal of flag lookup that was refactored, no longer needed header, and some trivial whitespace fixes. * Check Tracker - Refactors Index to Bitmask code to a macro * Check Tracker - Changes ordering from alphabetical to RandomizerCheck ordering * Check Tracker - Wraps everything in a namespace to avoid global variable usage * Check Tracker - Explicitly defines for-loop scope * Check Tracker - refactors dungeon lookup from static array to function * Fixes a bug when using EnhancementColor with alpha * Check Tracker - Refactors all colour to use direct conversions * Check Tracker - refactors settings loading and check visibility for readability * Check Tracker - Fixes a bug where the wrong label showed on the Check Tracker BG Color * UIWidgets - Adds Alpha bar to EnhancementColor when using alpha parameter
2022-12-10 22:39:23 -05:00
}
}
std::vector<RandomizerCheckObject> checks;
Check Tracker Update (#2668) * Initial commit. What works so far: Data file loads, saves, deletes, and is created properly. - Need to run `HasItemBeenCollected` when creating in case of mid-seed regen. Organized checks into maps set by area. Areas show in tracker. - Checks pulled from checkObjectsByArea are not currently listed. - Areas are being assumed completed and hidden at the start. * Checks now populate. Still not counting area totals properly. * Don't track RC_LINKS_POCKET in the data file, and instead manually add it in every time a save is load. rcObjects doesn't contain Link's Pocket location (duh). * Moved ItemReceive hook to randomizer_check_tracker.cpp. Skipped items are properly sorted and formatted. Saved items contribute to an area's gotten/skipped checks on load. Changed skipped items default main color to gray. General code cleanup. * Skipped checks now contribute to area totals for area completion logic. * Mid-menu rework transfer. * Started check lookup on item receive. Tried to enable scum checking on save. * Fixed scum check on save. * More code cleanup, which revealed some issues with loading and saving. Loading now works 100%, but entries in checkTrackerData are disappearing in code somewhere, causing issues with later checks. Scummed color now displays properly. Collected but unsaved displays properly. Unchecked, Skipped, Seen and Scummed checks all have arrows for skipping/unskipping. Counts a little messed up, probably double adding skips. * Fixed item counts being off across resets. Restarts were fine. * Beginning of rework for individual check updates. Adds `Actor lastCheck` to PlayState to allow assigning of last actor to give an item. This allows precise tracking of GS, freestanding PoH, etc. Works for chests too. Currently does not work for shops, unknown for normal NPC gives. Doesn't track last gives for non-checks, like drops from grass, pots, crates, etc. * Actor-based checks fully fleshed out, but can't help with sale-based checks. Implemented `pendingSaleCheck` to back out of an RC check cycle if `gSaveContext->pendingSale` is not NONE when `OnItemReceive` is called, processed through `OnSaleEnd`. This should be the final change necessary to streamline the checks. * Temporary hook to message box close to tie in trackers for non-gs/chest actors that aren't added to `GetCheckFromActor`. This triggers a 2-frame countdown to check with `HasItemBeenCollected` since half of the methods in there aren't updated until after a text box closes. Added scene tracking to get last scene so that checks in scenes that span several overworld areas could be tied to their areas properly. Modified tracker data creation to apply Link's Pocket and Song from Impa conditionally based on randomizer settings instead of just being assumed to be done. May need modification for checking click and drag spoiler loading. Removed the scene equivalence check from CheckChecks so that an entire area is checked each time to avoid issues with, e.g., leaving a shop before a pending sale finishes. * Changed check data creation to use RSKs from gRandomizer to account for settings loaded from drag and drop spoilers. * Beginning of tracker code organization. Changed check color defaults. * Reverted moving tracker colors to header. Some individual check fixes. * Missed something from previous merge? * Removed last remnant of removed performance mode. * Better handle checking when skullsanity is off. * Song checks sceneIDs don't match the scenes they're actually in for some reason. Removed that check. * SaleEnd checks don't need the GetItemEntry parameter. Also set a flag that should prevent the check tracker from running during vanilla saves should that not be resolved by the time it's merged. * Attempting to have only the relevant checks added to the tracker data, as well as showing vanilla checks for non-rando saves. Not working yet (everything is displayed in vanilla). * Added vanilla check tracker population via `vanillaCheck` bool in `RandomizerCheckObject`. This is also added to `IsVisibleInImGui` to handle file loading and saving to eliminate checks that aren't part of vanilla or the rando seed. Implemented deleted tracker data file recreation. Added some extra item name text checks. Songs are still... tricky, so they stay blank. Utilize local copies of the randomizer check objects that are applicable for performance purposes. Fixed vanilla item-giving cutscene crashes when triggered mid-transition. * Apparently not all toolchains can handle macro instantiation without all parameters, like VS can. * Fixed scummed detail color not showing properly on tracker. * Fixed dungeon area totals and GS checks not functioning properly. * Major revamp of checking code. Doesn't rely on `GetCheckFromActor` at all anymore, but instead simply sets a flag to evaluate a number of checks in an area every frame until the check that was gotten is identified. With the new setup, it's much less hardware intensive, and at 60fps 6 checks per frame shows no noticeable effect on framerate. I can envision needing to add a collectedCount in order to account for times when two checks are gotten one right after the other. Changed area scroll to happen from `OnTransitionEnd`, and allow for scrolling in bazaar (was disabled previously because it would jump back and forth between Kak and Market while you were in one). Also setup area check order updating by area instead of all at the same time. * Fixed shooting gallery not reporting proper area. Prevent checks from actually happening if area is RCAREA_INVALID, now that all areas are reporting something if they have checks. Fixed `GetCheckArea()` not updating checks for standard scenes. Lots of vanilla tracking updates, mainly manual checks for gems, medallions and songs, since the often don't have proper scenes in the data. Prevent vanilla from triggering check loops if junk items are collected. Fixed sorting based on saved vs collected. Prevent item name display for vanilla runs. Change coloring of checks so the check name reflects status in vanilla runs. * Fixed "Recheck Area" button erroneously adding to an area's check totals? * Fix DMC vanilla checks. * Fix check tracker data recreation on data file loss. Removed redundant file exists check from SaveTrackerDataHook, as it doesn't matter if it exists or not at that point. Limited check loops to 3 to avoid infinite check loops on non-check/junk item pickup. Added more checks to disable tracker operations if a save is not running. Changed check ordering to put boss reward and heart container checks at the end of whatever RCSHOW group they belong to. * Fixed IsRunning calculation. Further improving vanilla checking. Starting framework for checking medallions, stones, and songs on data file recreation. Fixed medallion check collection. Added GIFT_FROM_SAGES to check list for vanilla file for tracking light medallion. Added check loop limitation to prevent infinite checking after picking up junk item from the ground. * Finished vanilla file recreation and recheck (songs and dungeon rewards all check properly now). This includes deku shield with KF shop item 3. Finished Gift from Raoru light medallion tracking for vanilla. Commented all CheckByScene functionality for now. * Fixed new save data file creation. Disabled entrance area calculation for now, as it only tracks the previous entrance for some reason. Fixed area detection for ToT checks. * GetCheckArea() now utilizes EntranceData almost exclusively, via either `gSaveContext.entranceIndex` or the entrance tracker's `currentGrottoId` in the case of grottos. This also means that EVERYTHING CAN AUTOSCROLL NOW. Entrance shuffles are now much easier to track. Autoscroll is now also triggered on save, just in case someone isn't autosaving and has a lot of checks that get converted to saved. * Fixed missing GS check in LW. * Added area scroll on toggling Show Hidden Items. May configure differently later. Fixed area detection for entrances in Gerudo Fortress/Valley and Collossus. Haunted wasteland doesn't autoscroll due to a bug in `OnTransitionEnd` hook, but checks still evaluate properly there. Rely on scene-based area detection if scene is a main overworld or dungeon scene. * Fixed grotto detection when shuffle is off. * Small code cleanup. Fixed Colossus hand chest checks. * Missing lus bump from merge conflict resolution * Fixed Colossus Grotto making `GetCheckArea` return Wasteland. * Improved OnItemReceive processing for non-token GS checks, since they can sometimes take long enough for the checking process to time out before the item is registered as received. * First attempt at thread safety for tracker data file writing. Seems to work, but might need more testing. * Fixed Recheck Area not unskipping items that register as saved. Improved delayed saving with autosaving, as the autosave triggered quite often before the tracker data save, making things not properly register as saved. * merge cleanup * Converted check tracker data to the sectional saves, adding `CheckTrackerData` to `SaveContext`. Implemented section ID returning and fullSave boolean passing to section functions from my PR temporarily for it to work properly. Moved `RandomizerCheckTrackerData` enum to `randomizerTypes.h` to accommodate that. Changed `Randomizer_SaveInit` to a `SaveManager::InitFunc` to allow for other randomizer-dependent sections to be initialized after that. Required a little refactoring to maintain intro cutscene skip when starting a randomizer file. * Revert section index return and randomizer init changes. Will need to wait on yet more changes to main. * Fixed check tracker initialization (shouldn't be tied to window initialization), restored saving/loading functionality. * Removed `CheckTracker::Init` and put SaveManager calls in `CheckTrackerWindow::InitElement`. Also a bit of cleanup from transition back to save file use. * Fixed tracker displaying check categories while file not loaded. * Fix Darunia's Joy check not marking in vanilla. * Fix autosave not triggering change from collected to saved in tracker data. * Changed default colors for scummed and collected display. * Merge upgrade code cleanup. * Add `OnTransitionEnd` calls to sandstorm transitions both to and from Wasteland. Also improved `gSaveContext.lastScene` assignment for both transition types. Allowed a bit of cleanup in `GetCheckArea`. * Added `StateButton`, a button like `ArrowButton` but that allows text instead of arrow icons. Apparently the changes from ArrowButton to StateButton happened in a previous commit... * Changed section name to `trackerDataCheck` to force SoH to load it after the randomizer section, as it required some randoSettings to be loaded first, and nothing else I tried to make the randomizer section load before it worked. This hacks a solution to checks not displaying on fast file load to a specific slot. F*** you, SaveManager, and f*** you too, JSON. * Forgot to change the section string for loading with the name change. * Fix check ordering for checks that trigger the autosave. * Adds option to remove right-side shop items (slots 1-4) from the tracker list. Enabled by default. * Fix default state of Hide Shop Right Checks checkbox. * Fixes grotto and great fairy scrolling and checks. Fixes array overflow from `checkTrackerData` which was creating the issue trying to load the base and randomizer sections first, among other things. That also fixed the massive file loads that were being exhibited in debug mode. * Fix shooting galleries being set as collected again when being played a second time after getting the checks. * Fix Bazaar autoscroll. * Add Saria's Song to `GetCheckFromActor` and removed some limitations from the messageCloseCheck function to make that check track properly. * Fix Song from Impa check. Implemented prevention for multiple "collections" of great fairies, just in case getting the health refill would trigger it with the previous setup. * Fix ice traps on GS tokens not triggering OnItemReceive. * Complete fix for ice trap collection from GS. Add autoscroll when clicking "Expand All". * Add `OnShopSlotChange` with cursorSlot and basePrice parameters. * Fixed include in en_ossan for shop slot hook. Added registration for `OnShopSlotChange` in the tracker, storing the price in a new `price` field in `CheckTrackerData`. Added "seen" functionality to shop checks. Displays the model item name upon first entering a shop, adding the price and switching to trickName (if it's an ice trap) upon navigating to the slot in buy mode, triggered by an invisible "identified" status that mirrors "seen" in every other way. Added tooltips to most options for check tracker color picking to describe what each status actually means. * `std::format` pls * So apparently std::format just decided to break with the latest merge from develop, but fmt::format exists and works? * Removed the last vestiges of `locationsSkipped`. Other general code and formatting cleanups. Moved `IsGameRunning` to `OTRGlobals` so the item tracker could also access it. Used preceding to "fix" item and bottle display in the item tracker on startup. * Some more code cleanup. Removed "Recheck Area" button and relevant code. Backported changes to Anchor branch applicable for single-player, including making a checkAreas vector and structuring the frame by frame checks around that. Also includes fix for Silver Gauntlets and Mirror Shield check collection crash associated with those changes. Fixed Kakariko Bazaar "seen" updates. Fixed tracker window not showing on initial load like it should. * Forgot 1 formatting fix. * Removed conditions for showing Song from Impa (isn't junk under certain conditions, so should show all the time). * Fix vanilla checks, add Zelda's Letter and Malon's Egg to manual check collection. Fix autoscroll while in child stealth section. * Fix crash in Happy Mask Shop in OnSlotChange (referenced non-existent shop id in a tracker-specific enum). * General code cleanup. * Missed one reversion. * One more. * Fix column alignment in `randomizer_check_objects`. * Fix file encoding on `randomizer_check_tracker`. Again. * Fix indentation for `actualItemtrackerItemMap`. Also removed unnecessary parts of the map. * Rename `HasEqItem` to `HasEquipment`. * Slightly better indentation for `actualItemTrackerItemMap`. * Add magic bean salesman to vanilla check tracking, and genericized deku shield to trigger KF shop item 3 wherever you get the shield. Renamed `vanillaCheck` to `vanillaHundoCheck` to (supposedly) clarify the meaning of the usage. * One more rename to `vanillaCompletion` to avoid possible confusion with 100% speedrun conditions. * give me a break XD Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * Changes suggested by briaguya (rename `RandomizerCheckShow` to `Status`, unused code, newline formatting) * Remove unused `itemNames` table. * Remove `IsGameRunning` in favor of `GameInteractor::IsSaveLoaded`. * Restore anti-spoiler functionality for dungeons with dungeon maps. * Review cleanup. * Fix prices not showing for Kak bazaar items. --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com>
2023-10-04 11:03:36 -04:00
// Function for adding Link's Pocket check
void LinksPocket() {
if (IS_RANDO) {
if (OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_LINKS_POCKET) != RO_LINKS_POCKET_NOTHING ||
OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_SHUFFLE_DUNGEON_REWARDS) == RO_DUNGEON_REWARDS_END_OF_DUNGEON) {
DefaultCheckData(RC_LINKS_POCKET);
gSaveContext.checkTrackerData[RC_LINKS_POCKET].status = RCSHOW_SAVED;
}
}
}
Randomizer Auto Location tracker (#1942) * Initial Auto-Location Tracking * Updates styling for checked items in Check Tracker * Fixes crashing issues with Check Tracker rendering * Auto scroll Check Tracker windows to current area * Checks Tracker only shows checked locations once in game * Fixes issue where Check Tracker would auto-scroll to wrong location when entering a grotto * Fixes gerudo fortress checks showing in tracker when settings have them removed * InfTable Check Location Fixes: Lost Dog Richard, Rolling Gorons, HBA 1000, Thawed Zora * Fixes most Event Chk Inf Checks on Check Tracker, and Frogs * Check Tracker - Song from Malon now works * Check Tracker - Fixes Claim Check check not tracking - Fixes spoiler for Claim Check check when getting Biggoron's Sword - Fixes LACS being spoiled and not tracking * Check Tracker - Fixes #2 for Skull Mask and Mask of Truth checks * Check Tracker - Adds support for merchants - Fixes #7 for Bomchu Salesman - Fixes #12 for Medigoron * Check Tracker - Fixes #8 for Song from Saria * Check Tracker - Fixes #9 for Adult Shooting Gallery * Check Tracker - Fixes #10 for Composer Grave * Check Tracker - Fixes #14 for Song from Ocarina of Time * Check Tracker - Fixes #16 for Shooting the Sun * Check Tracker - Fixes #19 for Darunia's Joy * Save Editor - Adds missing label for Treasure Chest Game * Check Tracker - Fixes Great Faries checks * Check Tracker - Fixes Sheik at Temple * Check Tracker - Fixes Great Fairy auto-scroll to wrong location * Check Tracker - Updates blue warp checks - Fixes Bongo Bongo and Twinrova checks * Check Tracker - Fixes Dampe's Gravedigging Tour * Check Tracker - Fixes Prescription to King Zora * Check Tracker - Fixes Bazaar showing under wrong area on tracker between adult/child * Check Tracker - Fixes scroll for Hyrule Market and Bazaar * Check Tracker - Fixes giving Adult Trade Items shown on tracker: Broken Sword, Saw, Cojiro, Eyeball Froge, and Eyedrops * Cleans up item_location * Check Tracker - Item List - Fixes item list not updating when changing seeds/options - Separates item exclusion list from item check list - Clean up comments * Check Tracker - Adds Skip functionality to buttons * Check Tracker - Refactors adult trade items to RandomizerInf * Check Tracker - Fixes an issue where any time an item is removed the tracker would cause an application crash * Check Tracker - Item names are now dependent on file language * Check Tracker - Fixes Gerudo Card check not showing in Fast setting * Reorders headers to (hopefully) avoid CI build conflicts on linux/consoles * Explicitly defines vector header in randomizer.h to fix compile errors * Complete Refactor of Check Tracker ImGui * Adds missing check tracker files to CMakeLists * Reverts the Item_location whitespace cleanup from ad10807c * Check Tracker - Loading Fixes - Fixes a bug where loading a save file a second time would add all the checks again - Fixes a bug where the check tracker would not render at all until in a save file * Check Tracker - Fixes a bug where checks would sometimes fail to load * Check Tracker - Fixes duplicated checks when using Only on Pause or Only on Combo * Check Tracker - Works around issue where single characters don't show in EnhancementCombobox, and fixes a label for combo buttons held option * Check Tracker - Applies all Check Tracker changes to Item Location * Check Tracker - Updated Check List - Adds Link's pocket, either in KF or HM depending on starting age - Supports Scrubs and Merchants - Uses enums instead of magic numbers - Updates DC Scrub Short Names for MQ * Check Tracker - Adds a performance mode option * Check Tracker - List Fixes (requires new rando generation) - Fixes Frogs Rupees always visible - Fixes Kokiri Sword Chest not showing - Fixes Weird Egg not showing * Check Tracker - MQ List basic support * Check Tracker - MQ/Vanilla anti-spoilers * Check Tracker - Collecting a compass now spoils the area * Check Tracker - Basic Vanilla Support and fixes - Vanilla items show in check tracker, even if many won't auto check - Fixes an issue with Gerudo Fortress Keys - Refactors IsVisibleInCheckTracker to randomizer_check_tracjer * Check Tracker - Fixes merge conflict from 08a487f35e1d760ab9e69b932edbe4da6bcd9edb * Check Tracker - Fixes tracker loading as Floating when default value is set to Windowed * Randomizer Location Exclusion List - Adds Scrubs, Merchants, Shops. Adult Trade items, MQ Dungeons, and Bean Salesman - Fixes Kokiri Sword Chest, Weird Egg, and Frog Song Rupees from misbehaving - Updates Gerudo Fortress logic to be dependent on Open/Fast/Normal Fortress - Removes Invalid Check - Adds RO Enum for MQ settings - Updates magic values to RO enum * Location Exclusion List - Scrubs that are always randomized now always show on the list * For now, removes some extra code only needed for a Check Tracker. * Randomizer Location Exclusion List - Fixes Eyeball Frog from showing up when Adult Trade Items was off * Location Tracker - Updates Eyedrops to use RandomizerInf instead of Chest * Check Tracker - Fixes a bug where Link's Pocket item wasn't acting as checked for area item count * Check Tracker - Fixes a bug where Locations would incorrectly say Vanilla due to the first check in the area being a non-MQ check * Check Tracker - Fixes a crash when Check Tracker is docked but not visible * Check Tracker - Fixes areas being spoiled when loading different save files * Check Tracker - Only reset variables if they are initialized * Check Tracker - Cleans up old comments, unused variables, methods, and macros, adds language TODOs, * Check Tracker - Readds rainbow UI elements after Cosmetics Editor refactor * Check Tracker - Removal of flag lookup that was refactored, no longer needed header, and some trivial whitespace fixes. * Check Tracker - Refactors Index to Bitmask code to a macro * Check Tracker - Changes ordering from alphabetical to RandomizerCheck ordering * Check Tracker - Wraps everything in a namespace to avoid global variable usage * Check Tracker - Explicitly defines for-loop scope * Check Tracker - refactors dungeon lookup from static array to function * Fixes a bug when using EnhancementColor with alpha * Check Tracker - Refactors all colour to use direct conversions * Check Tracker - refactors settings loading and check visibility for readability * Check Tracker - Fixes a bug where the wrong label showed on the Check Tracker BG Color * UIWidgets - Adds Alpha bar to EnhancementColor when using alpha parameter
2022-12-10 22:39:23 -05:00
Check Tracker Update (#2668) * Initial commit. What works so far: Data file loads, saves, deletes, and is created properly. - Need to run `HasItemBeenCollected` when creating in case of mid-seed regen. Organized checks into maps set by area. Areas show in tracker. - Checks pulled from checkObjectsByArea are not currently listed. - Areas are being assumed completed and hidden at the start. * Checks now populate. Still not counting area totals properly. * Don't track RC_LINKS_POCKET in the data file, and instead manually add it in every time a save is load. rcObjects doesn't contain Link's Pocket location (duh). * Moved ItemReceive hook to randomizer_check_tracker.cpp. Skipped items are properly sorted and formatted. Saved items contribute to an area's gotten/skipped checks on load. Changed skipped items default main color to gray. General code cleanup. * Skipped checks now contribute to area totals for area completion logic. * Mid-menu rework transfer. * Started check lookup on item receive. Tried to enable scum checking on save. * Fixed scum check on save. * More code cleanup, which revealed some issues with loading and saving. Loading now works 100%, but entries in checkTrackerData are disappearing in code somewhere, causing issues with later checks. Scummed color now displays properly. Collected but unsaved displays properly. Unchecked, Skipped, Seen and Scummed checks all have arrows for skipping/unskipping. Counts a little messed up, probably double adding skips. * Fixed item counts being off across resets. Restarts were fine. * Beginning of rework for individual check updates. Adds `Actor lastCheck` to PlayState to allow assigning of last actor to give an item. This allows precise tracking of GS, freestanding PoH, etc. Works for chests too. Currently does not work for shops, unknown for normal NPC gives. Doesn't track last gives for non-checks, like drops from grass, pots, crates, etc. * Actor-based checks fully fleshed out, but can't help with sale-based checks. Implemented `pendingSaleCheck` to back out of an RC check cycle if `gSaveContext->pendingSale` is not NONE when `OnItemReceive` is called, processed through `OnSaleEnd`. This should be the final change necessary to streamline the checks. * Temporary hook to message box close to tie in trackers for non-gs/chest actors that aren't added to `GetCheckFromActor`. This triggers a 2-frame countdown to check with `HasItemBeenCollected` since half of the methods in there aren't updated until after a text box closes. Added scene tracking to get last scene so that checks in scenes that span several overworld areas could be tied to their areas properly. Modified tracker data creation to apply Link's Pocket and Song from Impa conditionally based on randomizer settings instead of just being assumed to be done. May need modification for checking click and drag spoiler loading. Removed the scene equivalence check from CheckChecks so that an entire area is checked each time to avoid issues with, e.g., leaving a shop before a pending sale finishes. * Changed check data creation to use RSKs from gRandomizer to account for settings loaded from drag and drop spoilers. * Beginning of tracker code organization. Changed check color defaults. * Reverted moving tracker colors to header. Some individual check fixes. * Missed something from previous merge? * Removed last remnant of removed performance mode. * Better handle checking when skullsanity is off. * Song checks sceneIDs don't match the scenes they're actually in for some reason. Removed that check. * SaleEnd checks don't need the GetItemEntry parameter. Also set a flag that should prevent the check tracker from running during vanilla saves should that not be resolved by the time it's merged. * Attempting to have only the relevant checks added to the tracker data, as well as showing vanilla checks for non-rando saves. Not working yet (everything is displayed in vanilla). * Added vanilla check tracker population via `vanillaCheck` bool in `RandomizerCheckObject`. This is also added to `IsVisibleInImGui` to handle file loading and saving to eliminate checks that aren't part of vanilla or the rando seed. Implemented deleted tracker data file recreation. Added some extra item name text checks. Songs are still... tricky, so they stay blank. Utilize local copies of the randomizer check objects that are applicable for performance purposes. Fixed vanilla item-giving cutscene crashes when triggered mid-transition. * Apparently not all toolchains can handle macro instantiation without all parameters, like VS can. * Fixed scummed detail color not showing properly on tracker. * Fixed dungeon area totals and GS checks not functioning properly. * Major revamp of checking code. Doesn't rely on `GetCheckFromActor` at all anymore, but instead simply sets a flag to evaluate a number of checks in an area every frame until the check that was gotten is identified. With the new setup, it's much less hardware intensive, and at 60fps 6 checks per frame shows no noticeable effect on framerate. I can envision needing to add a collectedCount in order to account for times when two checks are gotten one right after the other. Changed area scroll to happen from `OnTransitionEnd`, and allow for scrolling in bazaar (was disabled previously because it would jump back and forth between Kak and Market while you were in one). Also setup area check order updating by area instead of all at the same time. * Fixed shooting gallery not reporting proper area. Prevent checks from actually happening if area is RCAREA_INVALID, now that all areas are reporting something if they have checks. Fixed `GetCheckArea()` not updating checks for standard scenes. Lots of vanilla tracking updates, mainly manual checks for gems, medallions and songs, since the often don't have proper scenes in the data. Prevent vanilla from triggering check loops if junk items are collected. Fixed sorting based on saved vs collected. Prevent item name display for vanilla runs. Change coloring of checks so the check name reflects status in vanilla runs. * Fixed "Recheck Area" button erroneously adding to an area's check totals? * Fix DMC vanilla checks. * Fix check tracker data recreation on data file loss. Removed redundant file exists check from SaveTrackerDataHook, as it doesn't matter if it exists or not at that point. Limited check loops to 3 to avoid infinite check loops on non-check/junk item pickup. Added more checks to disable tracker operations if a save is not running. Changed check ordering to put boss reward and heart container checks at the end of whatever RCSHOW group they belong to. * Fixed IsRunning calculation. Further improving vanilla checking. Starting framework for checking medallions, stones, and songs on data file recreation. Fixed medallion check collection. Added GIFT_FROM_SAGES to check list for vanilla file for tracking light medallion. Added check loop limitation to prevent infinite checking after picking up junk item from the ground. * Finished vanilla file recreation and recheck (songs and dungeon rewards all check properly now). This includes deku shield with KF shop item 3. Finished Gift from Raoru light medallion tracking for vanilla. Commented all CheckByScene functionality for now. * Fixed new save data file creation. Disabled entrance area calculation for now, as it only tracks the previous entrance for some reason. Fixed area detection for ToT checks. * GetCheckArea() now utilizes EntranceData almost exclusively, via either `gSaveContext.entranceIndex` or the entrance tracker's `currentGrottoId` in the case of grottos. This also means that EVERYTHING CAN AUTOSCROLL NOW. Entrance shuffles are now much easier to track. Autoscroll is now also triggered on save, just in case someone isn't autosaving and has a lot of checks that get converted to saved. * Fixed missing GS check in LW. * Added area scroll on toggling Show Hidden Items. May configure differently later. Fixed area detection for entrances in Gerudo Fortress/Valley and Collossus. Haunted wasteland doesn't autoscroll due to a bug in `OnTransitionEnd` hook, but checks still evaluate properly there. Rely on scene-based area detection if scene is a main overworld or dungeon scene. * Fixed grotto detection when shuffle is off. * Small code cleanup. Fixed Colossus hand chest checks. * Missing lus bump from merge conflict resolution * Fixed Colossus Grotto making `GetCheckArea` return Wasteland. * Improved OnItemReceive processing for non-token GS checks, since they can sometimes take long enough for the checking process to time out before the item is registered as received. * First attempt at thread safety for tracker data file writing. Seems to work, but might need more testing. * Fixed Recheck Area not unskipping items that register as saved. Improved delayed saving with autosaving, as the autosave triggered quite often before the tracker data save, making things not properly register as saved. * merge cleanup * Converted check tracker data to the sectional saves, adding `CheckTrackerData` to `SaveContext`. Implemented section ID returning and fullSave boolean passing to section functions from my PR temporarily for it to work properly. Moved `RandomizerCheckTrackerData` enum to `randomizerTypes.h` to accommodate that. Changed `Randomizer_SaveInit` to a `SaveManager::InitFunc` to allow for other randomizer-dependent sections to be initialized after that. Required a little refactoring to maintain intro cutscene skip when starting a randomizer file. * Revert section index return and randomizer init changes. Will need to wait on yet more changes to main. * Fixed check tracker initialization (shouldn't be tied to window initialization), restored saving/loading functionality. * Removed `CheckTracker::Init` and put SaveManager calls in `CheckTrackerWindow::InitElement`. Also a bit of cleanup from transition back to save file use. * Fixed tracker displaying check categories while file not loaded. * Fix Darunia's Joy check not marking in vanilla. * Fix autosave not triggering change from collected to saved in tracker data. * Changed default colors for scummed and collected display. * Merge upgrade code cleanup. * Add `OnTransitionEnd` calls to sandstorm transitions both to and from Wasteland. Also improved `gSaveContext.lastScene` assignment for both transition types. Allowed a bit of cleanup in `GetCheckArea`. * Added `StateButton`, a button like `ArrowButton` but that allows text instead of arrow icons. Apparently the changes from ArrowButton to StateButton happened in a previous commit... * Changed section name to `trackerDataCheck` to force SoH to load it after the randomizer section, as it required some randoSettings to be loaded first, and nothing else I tried to make the randomizer section load before it worked. This hacks a solution to checks not displaying on fast file load to a specific slot. F*** you, SaveManager, and f*** you too, JSON. * Forgot to change the section string for loading with the name change. * Fix check ordering for checks that trigger the autosave. * Adds option to remove right-side shop items (slots 1-4) from the tracker list. Enabled by default. * Fix default state of Hide Shop Right Checks checkbox. * Fixes grotto and great fairy scrolling and checks. Fixes array overflow from `checkTrackerData` which was creating the issue trying to load the base and randomizer sections first, among other things. That also fixed the massive file loads that were being exhibited in debug mode. * Fix shooting galleries being set as collected again when being played a second time after getting the checks. * Fix Bazaar autoscroll. * Add Saria's Song to `GetCheckFromActor` and removed some limitations from the messageCloseCheck function to make that check track properly. * Fix Song from Impa check. Implemented prevention for multiple "collections" of great fairies, just in case getting the health refill would trigger it with the previous setup. * Fix ice traps on GS tokens not triggering OnItemReceive. * Complete fix for ice trap collection from GS. Add autoscroll when clicking "Expand All". * Add `OnShopSlotChange` with cursorSlot and basePrice parameters. * Fixed include in en_ossan for shop slot hook. Added registration for `OnShopSlotChange` in the tracker, storing the price in a new `price` field in `CheckTrackerData`. Added "seen" functionality to shop checks. Displays the model item name upon first entering a shop, adding the price and switching to trickName (if it's an ice trap) upon navigating to the slot in buy mode, triggered by an invisible "identified" status that mirrors "seen" in every other way. Added tooltips to most options for check tracker color picking to describe what each status actually means. * `std::format` pls * So apparently std::format just decided to break with the latest merge from develop, but fmt::format exists and works? * Removed the last vestiges of `locationsSkipped`. Other general code and formatting cleanups. Moved `IsGameRunning` to `OTRGlobals` so the item tracker could also access it. Used preceding to "fix" item and bottle display in the item tracker on startup. * Some more code cleanup. Removed "Recheck Area" button and relevant code. Backported changes to Anchor branch applicable for single-player, including making a checkAreas vector and structuring the frame by frame checks around that. Also includes fix for Silver Gauntlets and Mirror Shield check collection crash associated with those changes. Fixed Kakariko Bazaar "seen" updates. Fixed tracker window not showing on initial load like it should. * Forgot 1 formatting fix. * Removed conditions for showing Song from Impa (isn't junk under certain conditions, so should show all the time). * Fix vanilla checks, add Zelda's Letter and Malon's Egg to manual check collection. Fix autoscroll while in child stealth section. * Fix crash in Happy Mask Shop in OnSlotChange (referenced non-existent shop id in a tracker-specific enum). * General code cleanup. * Missed one reversion. * One more. * Fix column alignment in `randomizer_check_objects`. * Fix file encoding on `randomizer_check_tracker`. Again. * Fix indentation for `actualItemtrackerItemMap`. Also removed unnecessary parts of the map. * Rename `HasEqItem` to `HasEquipment`. * Slightly better indentation for `actualItemTrackerItemMap`. * Add magic bean salesman to vanilla check tracking, and genericized deku shield to trigger KF shop item 3 wherever you get the shield. Renamed `vanillaCheck` to `vanillaHundoCheck` to (supposedly) clarify the meaning of the usage. * One more rename to `vanillaCompletion` to avoid possible confusion with 100% speedrun conditions. * give me a break XD Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * Changes suggested by briaguya (rename `RandomizerCheckShow` to `Status`, unused code, newline formatting) * Remove unused `itemNames` table. * Remove `IsGameRunning` in favor of `GameInteractor::IsSaveLoaded`. * Restore anti-spoiler functionality for dungeons with dungeon maps. * Review cleanup. * Fix prices not showing for Kak bazaar items. --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com>
2023-10-04 11:03:36 -04:00
void TrySetAreas() {
if (checksByArea.empty()) {
for (int i = RCAREA_KOKIRI_FOREST; i < RCAREA_INVALID; i++) {
checksByArea.emplace(static_cast<RandomizerCheckArea>(i), std::vector<RandomizerCheckObject>());
}
}
}
void RecalculateAreaTotals() {
for (auto [rcArea, rcObjects] : checksByArea) {
if (rcArea == RCAREA_INVALID) {
return;
}
areaChecksGotten[rcArea] = 0;
areaCheckTotals[rcArea] = 0;
for (auto rcObj : rcObjects) {
if (!IsVisibleInCheckTracker(rcObj)) {
continue;
}
areaCheckTotals[rcArea]++;
if (gSaveContext.checkTrackerData[rcObj.rc].skipped || gSaveContext.checkTrackerData[rcObj.rc].status == RCSHOW_COLLECTED
|| gSaveContext.checkTrackerData[rcObj.rc].status == RCSHOW_SAVED) {
areaChecksGotten[rcArea]++;
}
}
}
}
Check Tracker Update (#2668) * Initial commit. What works so far: Data file loads, saves, deletes, and is created properly. - Need to run `HasItemBeenCollected` when creating in case of mid-seed regen. Organized checks into maps set by area. Areas show in tracker. - Checks pulled from checkObjectsByArea are not currently listed. - Areas are being assumed completed and hidden at the start. * Checks now populate. Still not counting area totals properly. * Don't track RC_LINKS_POCKET in the data file, and instead manually add it in every time a save is load. rcObjects doesn't contain Link's Pocket location (duh). * Moved ItemReceive hook to randomizer_check_tracker.cpp. Skipped items are properly sorted and formatted. Saved items contribute to an area's gotten/skipped checks on load. Changed skipped items default main color to gray. General code cleanup. * Skipped checks now contribute to area totals for area completion logic. * Mid-menu rework transfer. * Started check lookup on item receive. Tried to enable scum checking on save. * Fixed scum check on save. * More code cleanup, which revealed some issues with loading and saving. Loading now works 100%, but entries in checkTrackerData are disappearing in code somewhere, causing issues with later checks. Scummed color now displays properly. Collected but unsaved displays properly. Unchecked, Skipped, Seen and Scummed checks all have arrows for skipping/unskipping. Counts a little messed up, probably double adding skips. * Fixed item counts being off across resets. Restarts were fine. * Beginning of rework for individual check updates. Adds `Actor lastCheck` to PlayState to allow assigning of last actor to give an item. This allows precise tracking of GS, freestanding PoH, etc. Works for chests too. Currently does not work for shops, unknown for normal NPC gives. Doesn't track last gives for non-checks, like drops from grass, pots, crates, etc. * Actor-based checks fully fleshed out, but can't help with sale-based checks. Implemented `pendingSaleCheck` to back out of an RC check cycle if `gSaveContext->pendingSale` is not NONE when `OnItemReceive` is called, processed through `OnSaleEnd`. This should be the final change necessary to streamline the checks. * Temporary hook to message box close to tie in trackers for non-gs/chest actors that aren't added to `GetCheckFromActor`. This triggers a 2-frame countdown to check with `HasItemBeenCollected` since half of the methods in there aren't updated until after a text box closes. Added scene tracking to get last scene so that checks in scenes that span several overworld areas could be tied to their areas properly. Modified tracker data creation to apply Link's Pocket and Song from Impa conditionally based on randomizer settings instead of just being assumed to be done. May need modification for checking click and drag spoiler loading. Removed the scene equivalence check from CheckChecks so that an entire area is checked each time to avoid issues with, e.g., leaving a shop before a pending sale finishes. * Changed check data creation to use RSKs from gRandomizer to account for settings loaded from drag and drop spoilers. * Beginning of tracker code organization. Changed check color defaults. * Reverted moving tracker colors to header. Some individual check fixes. * Missed something from previous merge? * Removed last remnant of removed performance mode. * Better handle checking when skullsanity is off. * Song checks sceneIDs don't match the scenes they're actually in for some reason. Removed that check. * SaleEnd checks don't need the GetItemEntry parameter. Also set a flag that should prevent the check tracker from running during vanilla saves should that not be resolved by the time it's merged. * Attempting to have only the relevant checks added to the tracker data, as well as showing vanilla checks for non-rando saves. Not working yet (everything is displayed in vanilla). * Added vanilla check tracker population via `vanillaCheck` bool in `RandomizerCheckObject`. This is also added to `IsVisibleInImGui` to handle file loading and saving to eliminate checks that aren't part of vanilla or the rando seed. Implemented deleted tracker data file recreation. Added some extra item name text checks. Songs are still... tricky, so they stay blank. Utilize local copies of the randomizer check objects that are applicable for performance purposes. Fixed vanilla item-giving cutscene crashes when triggered mid-transition. * Apparently not all toolchains can handle macro instantiation without all parameters, like VS can. * Fixed scummed detail color not showing properly on tracker. * Fixed dungeon area totals and GS checks not functioning properly. * Major revamp of checking code. Doesn't rely on `GetCheckFromActor` at all anymore, but instead simply sets a flag to evaluate a number of checks in an area every frame until the check that was gotten is identified. With the new setup, it's much less hardware intensive, and at 60fps 6 checks per frame shows no noticeable effect on framerate. I can envision needing to add a collectedCount in order to account for times when two checks are gotten one right after the other. Changed area scroll to happen from `OnTransitionEnd`, and allow for scrolling in bazaar (was disabled previously because it would jump back and forth between Kak and Market while you were in one). Also setup area check order updating by area instead of all at the same time. * Fixed shooting gallery not reporting proper area. Prevent checks from actually happening if area is RCAREA_INVALID, now that all areas are reporting something if they have checks. Fixed `GetCheckArea()` not updating checks for standard scenes. Lots of vanilla tracking updates, mainly manual checks for gems, medallions and songs, since the often don't have proper scenes in the data. Prevent vanilla from triggering check loops if junk items are collected. Fixed sorting based on saved vs collected. Prevent item name display for vanilla runs. Change coloring of checks so the check name reflects status in vanilla runs. * Fixed "Recheck Area" button erroneously adding to an area's check totals? * Fix DMC vanilla checks. * Fix check tracker data recreation on data file loss. Removed redundant file exists check from SaveTrackerDataHook, as it doesn't matter if it exists or not at that point. Limited check loops to 3 to avoid infinite check loops on non-check/junk item pickup. Added more checks to disable tracker operations if a save is not running. Changed check ordering to put boss reward and heart container checks at the end of whatever RCSHOW group they belong to. * Fixed IsRunning calculation. Further improving vanilla checking. Starting framework for checking medallions, stones, and songs on data file recreation. Fixed medallion check collection. Added GIFT_FROM_SAGES to check list for vanilla file for tracking light medallion. Added check loop limitation to prevent infinite checking after picking up junk item from the ground. * Finished vanilla file recreation and recheck (songs and dungeon rewards all check properly now). This includes deku shield with KF shop item 3. Finished Gift from Raoru light medallion tracking for vanilla. Commented all CheckByScene functionality for now. * Fixed new save data file creation. Disabled entrance area calculation for now, as it only tracks the previous entrance for some reason. Fixed area detection for ToT checks. * GetCheckArea() now utilizes EntranceData almost exclusively, via either `gSaveContext.entranceIndex` or the entrance tracker's `currentGrottoId` in the case of grottos. This also means that EVERYTHING CAN AUTOSCROLL NOW. Entrance shuffles are now much easier to track. Autoscroll is now also triggered on save, just in case someone isn't autosaving and has a lot of checks that get converted to saved. * Fixed missing GS check in LW. * Added area scroll on toggling Show Hidden Items. May configure differently later. Fixed area detection for entrances in Gerudo Fortress/Valley and Collossus. Haunted wasteland doesn't autoscroll due to a bug in `OnTransitionEnd` hook, but checks still evaluate properly there. Rely on scene-based area detection if scene is a main overworld or dungeon scene. * Fixed grotto detection when shuffle is off. * Small code cleanup. Fixed Colossus hand chest checks. * Missing lus bump from merge conflict resolution * Fixed Colossus Grotto making `GetCheckArea` return Wasteland. * Improved OnItemReceive processing for non-token GS checks, since they can sometimes take long enough for the checking process to time out before the item is registered as received. * First attempt at thread safety for tracker data file writing. Seems to work, but might need more testing. * Fixed Recheck Area not unskipping items that register as saved. Improved delayed saving with autosaving, as the autosave triggered quite often before the tracker data save, making things not properly register as saved. * merge cleanup * Converted check tracker data to the sectional saves, adding `CheckTrackerData` to `SaveContext`. Implemented section ID returning and fullSave boolean passing to section functions from my PR temporarily for it to work properly. Moved `RandomizerCheckTrackerData` enum to `randomizerTypes.h` to accommodate that. Changed `Randomizer_SaveInit` to a `SaveManager::InitFunc` to allow for other randomizer-dependent sections to be initialized after that. Required a little refactoring to maintain intro cutscene skip when starting a randomizer file. * Revert section index return and randomizer init changes. Will need to wait on yet more changes to main. * Fixed check tracker initialization (shouldn't be tied to window initialization), restored saving/loading functionality. * Removed `CheckTracker::Init` and put SaveManager calls in `CheckTrackerWindow::InitElement`. Also a bit of cleanup from transition back to save file use. * Fixed tracker displaying check categories while file not loaded. * Fix Darunia's Joy check not marking in vanilla. * Fix autosave not triggering change from collected to saved in tracker data. * Changed default colors for scummed and collected display. * Merge upgrade code cleanup. * Add `OnTransitionEnd` calls to sandstorm transitions both to and from Wasteland. Also improved `gSaveContext.lastScene` assignment for both transition types. Allowed a bit of cleanup in `GetCheckArea`. * Added `StateButton`, a button like `ArrowButton` but that allows text instead of arrow icons. Apparently the changes from ArrowButton to StateButton happened in a previous commit... * Changed section name to `trackerDataCheck` to force SoH to load it after the randomizer section, as it required some randoSettings to be loaded first, and nothing else I tried to make the randomizer section load before it worked. This hacks a solution to checks not displaying on fast file load to a specific slot. F*** you, SaveManager, and f*** you too, JSON. * Forgot to change the section string for loading with the name change. * Fix check ordering for checks that trigger the autosave. * Adds option to remove right-side shop items (slots 1-4) from the tracker list. Enabled by default. * Fix default state of Hide Shop Right Checks checkbox. * Fixes grotto and great fairy scrolling and checks. Fixes array overflow from `checkTrackerData` which was creating the issue trying to load the base and randomizer sections first, among other things. That also fixed the massive file loads that were being exhibited in debug mode. * Fix shooting galleries being set as collected again when being played a second time after getting the checks. * Fix Bazaar autoscroll. * Add Saria's Song to `GetCheckFromActor` and removed some limitations from the messageCloseCheck function to make that check track properly. * Fix Song from Impa check. Implemented prevention for multiple "collections" of great fairies, just in case getting the health refill would trigger it with the previous setup. * Fix ice traps on GS tokens not triggering OnItemReceive. * Complete fix for ice trap collection from GS. Add autoscroll when clicking "Expand All". * Add `OnShopSlotChange` with cursorSlot and basePrice parameters. * Fixed include in en_ossan for shop slot hook. Added registration for `OnShopSlotChange` in the tracker, storing the price in a new `price` field in `CheckTrackerData`. Added "seen" functionality to shop checks. Displays the model item name upon first entering a shop, adding the price and switching to trickName (if it's an ice trap) upon navigating to the slot in buy mode, triggered by an invisible "identified" status that mirrors "seen" in every other way. Added tooltips to most options for check tracker color picking to describe what each status actually means. * `std::format` pls * So apparently std::format just decided to break with the latest merge from develop, but fmt::format exists and works? * Removed the last vestiges of `locationsSkipped`. Other general code and formatting cleanups. Moved `IsGameRunning` to `OTRGlobals` so the item tracker could also access it. Used preceding to "fix" item and bottle display in the item tracker on startup. * Some more code cleanup. Removed "Recheck Area" button and relevant code. Backported changes to Anchor branch applicable for single-player, including making a checkAreas vector and structuring the frame by frame checks around that. Also includes fix for Silver Gauntlets and Mirror Shield check collection crash associated with those changes. Fixed Kakariko Bazaar "seen" updates. Fixed tracker window not showing on initial load like it should. * Forgot 1 formatting fix. * Removed conditions for showing Song from Impa (isn't junk under certain conditions, so should show all the time). * Fix vanilla checks, add Zelda's Letter and Malon's Egg to manual check collection. Fix autoscroll while in child stealth section. * Fix crash in Happy Mask Shop in OnSlotChange (referenced non-existent shop id in a tracker-specific enum). * General code cleanup. * Missed one reversion. * One more. * Fix column alignment in `randomizer_check_objects`. * Fix file encoding on `randomizer_check_tracker`. Again. * Fix indentation for `actualItemtrackerItemMap`. Also removed unnecessary parts of the map. * Rename `HasEqItem` to `HasEquipment`. * Slightly better indentation for `actualItemTrackerItemMap`. * Add magic bean salesman to vanilla check tracking, and genericized deku shield to trigger KF shop item 3 wherever you get the shield. Renamed `vanillaCheck` to `vanillaHundoCheck` to (supposedly) clarify the meaning of the usage. * One more rename to `vanillaCompletion` to avoid possible confusion with 100% speedrun conditions. * give me a break XD Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * Changes suggested by briaguya (rename `RandomizerCheckShow` to `Status`, unused code, newline formatting) * Remove unused `itemNames` table. * Remove `IsGameRunning` in favor of `GameInteractor::IsSaveLoaded`. * Restore anti-spoiler functionality for dungeons with dungeon maps. * Review cleanup. * Fix prices not showing for Kak bazaar items. --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com>
2023-10-04 11:03:36 -04:00
void SetCheckCollected(RandomizerCheck rc) {
gSaveContext.checkTrackerData[rc].status = RCSHOW_COLLECTED;
RandomizerCheckObject rcObj;
if (rc == RC_GIFT_FROM_SAGES && !IS_RANDO) {
rcObj = RCO_RAORU;
} else {
rcObj = RandomizerCheckObjects::GetAllRCObjects().find(rc)->second;
}
if (IsVisibleInCheckTracker(rcObj)) {
if (!gSaveContext.checkTrackerData[rc].skipped) {
areaChecksGotten[rcObj.rcArea]++;
} else {
gSaveContext.checkTrackerData[rc].skipped = false;
}
Check Tracker Update (#2668) * Initial commit. What works so far: Data file loads, saves, deletes, and is created properly. - Need to run `HasItemBeenCollected` when creating in case of mid-seed regen. Organized checks into maps set by area. Areas show in tracker. - Checks pulled from checkObjectsByArea are not currently listed. - Areas are being assumed completed and hidden at the start. * Checks now populate. Still not counting area totals properly. * Don't track RC_LINKS_POCKET in the data file, and instead manually add it in every time a save is load. rcObjects doesn't contain Link's Pocket location (duh). * Moved ItemReceive hook to randomizer_check_tracker.cpp. Skipped items are properly sorted and formatted. Saved items contribute to an area's gotten/skipped checks on load. Changed skipped items default main color to gray. General code cleanup. * Skipped checks now contribute to area totals for area completion logic. * Mid-menu rework transfer. * Started check lookup on item receive. Tried to enable scum checking on save. * Fixed scum check on save. * More code cleanup, which revealed some issues with loading and saving. Loading now works 100%, but entries in checkTrackerData are disappearing in code somewhere, causing issues with later checks. Scummed color now displays properly. Collected but unsaved displays properly. Unchecked, Skipped, Seen and Scummed checks all have arrows for skipping/unskipping. Counts a little messed up, probably double adding skips. * Fixed item counts being off across resets. Restarts were fine. * Beginning of rework for individual check updates. Adds `Actor lastCheck` to PlayState to allow assigning of last actor to give an item. This allows precise tracking of GS, freestanding PoH, etc. Works for chests too. Currently does not work for shops, unknown for normal NPC gives. Doesn't track last gives for non-checks, like drops from grass, pots, crates, etc. * Actor-based checks fully fleshed out, but can't help with sale-based checks. Implemented `pendingSaleCheck` to back out of an RC check cycle if `gSaveContext->pendingSale` is not NONE when `OnItemReceive` is called, processed through `OnSaleEnd`. This should be the final change necessary to streamline the checks. * Temporary hook to message box close to tie in trackers for non-gs/chest actors that aren't added to `GetCheckFromActor`. This triggers a 2-frame countdown to check with `HasItemBeenCollected` since half of the methods in there aren't updated until after a text box closes. Added scene tracking to get last scene so that checks in scenes that span several overworld areas could be tied to their areas properly. Modified tracker data creation to apply Link's Pocket and Song from Impa conditionally based on randomizer settings instead of just being assumed to be done. May need modification for checking click and drag spoiler loading. Removed the scene equivalence check from CheckChecks so that an entire area is checked each time to avoid issues with, e.g., leaving a shop before a pending sale finishes. * Changed check data creation to use RSKs from gRandomizer to account for settings loaded from drag and drop spoilers. * Beginning of tracker code organization. Changed check color defaults. * Reverted moving tracker colors to header. Some individual check fixes. * Missed something from previous merge? * Removed last remnant of removed performance mode. * Better handle checking when skullsanity is off. * Song checks sceneIDs don't match the scenes they're actually in for some reason. Removed that check. * SaleEnd checks don't need the GetItemEntry parameter. Also set a flag that should prevent the check tracker from running during vanilla saves should that not be resolved by the time it's merged. * Attempting to have only the relevant checks added to the tracker data, as well as showing vanilla checks for non-rando saves. Not working yet (everything is displayed in vanilla). * Added vanilla check tracker population via `vanillaCheck` bool in `RandomizerCheckObject`. This is also added to `IsVisibleInImGui` to handle file loading and saving to eliminate checks that aren't part of vanilla or the rando seed. Implemented deleted tracker data file recreation. Added some extra item name text checks. Songs are still... tricky, so they stay blank. Utilize local copies of the randomizer check objects that are applicable for performance purposes. Fixed vanilla item-giving cutscene crashes when triggered mid-transition. * Apparently not all toolchains can handle macro instantiation without all parameters, like VS can. * Fixed scummed detail color not showing properly on tracker. * Fixed dungeon area totals and GS checks not functioning properly. * Major revamp of checking code. Doesn't rely on `GetCheckFromActor` at all anymore, but instead simply sets a flag to evaluate a number of checks in an area every frame until the check that was gotten is identified. With the new setup, it's much less hardware intensive, and at 60fps 6 checks per frame shows no noticeable effect on framerate. I can envision needing to add a collectedCount in order to account for times when two checks are gotten one right after the other. Changed area scroll to happen from `OnTransitionEnd`, and allow for scrolling in bazaar (was disabled previously because it would jump back and forth between Kak and Market while you were in one). Also setup area check order updating by area instead of all at the same time. * Fixed shooting gallery not reporting proper area. Prevent checks from actually happening if area is RCAREA_INVALID, now that all areas are reporting something if they have checks. Fixed `GetCheckArea()` not updating checks for standard scenes. Lots of vanilla tracking updates, mainly manual checks for gems, medallions and songs, since the often don't have proper scenes in the data. Prevent vanilla from triggering check loops if junk items are collected. Fixed sorting based on saved vs collected. Prevent item name display for vanilla runs. Change coloring of checks so the check name reflects status in vanilla runs. * Fixed "Recheck Area" button erroneously adding to an area's check totals? * Fix DMC vanilla checks. * Fix check tracker data recreation on data file loss. Removed redundant file exists check from SaveTrackerDataHook, as it doesn't matter if it exists or not at that point. Limited check loops to 3 to avoid infinite check loops on non-check/junk item pickup. Added more checks to disable tracker operations if a save is not running. Changed check ordering to put boss reward and heart container checks at the end of whatever RCSHOW group they belong to. * Fixed IsRunning calculation. Further improving vanilla checking. Starting framework for checking medallions, stones, and songs on data file recreation. Fixed medallion check collection. Added GIFT_FROM_SAGES to check list for vanilla file for tracking light medallion. Added check loop limitation to prevent infinite checking after picking up junk item from the ground. * Finished vanilla file recreation and recheck (songs and dungeon rewards all check properly now). This includes deku shield with KF shop item 3. Finished Gift from Raoru light medallion tracking for vanilla. Commented all CheckByScene functionality for now. * Fixed new save data file creation. Disabled entrance area calculation for now, as it only tracks the previous entrance for some reason. Fixed area detection for ToT checks. * GetCheckArea() now utilizes EntranceData almost exclusively, via either `gSaveContext.entranceIndex` or the entrance tracker's `currentGrottoId` in the case of grottos. This also means that EVERYTHING CAN AUTOSCROLL NOW. Entrance shuffles are now much easier to track. Autoscroll is now also triggered on save, just in case someone isn't autosaving and has a lot of checks that get converted to saved. * Fixed missing GS check in LW. * Added area scroll on toggling Show Hidden Items. May configure differently later. Fixed area detection for entrances in Gerudo Fortress/Valley and Collossus. Haunted wasteland doesn't autoscroll due to a bug in `OnTransitionEnd` hook, but checks still evaluate properly there. Rely on scene-based area detection if scene is a main overworld or dungeon scene. * Fixed grotto detection when shuffle is off. * Small code cleanup. Fixed Colossus hand chest checks. * Missing lus bump from merge conflict resolution * Fixed Colossus Grotto making `GetCheckArea` return Wasteland. * Improved OnItemReceive processing for non-token GS checks, since they can sometimes take long enough for the checking process to time out before the item is registered as received. * First attempt at thread safety for tracker data file writing. Seems to work, but might need more testing. * Fixed Recheck Area not unskipping items that register as saved. Improved delayed saving with autosaving, as the autosave triggered quite often before the tracker data save, making things not properly register as saved. * merge cleanup * Converted check tracker data to the sectional saves, adding `CheckTrackerData` to `SaveContext`. Implemented section ID returning and fullSave boolean passing to section functions from my PR temporarily for it to work properly. Moved `RandomizerCheckTrackerData` enum to `randomizerTypes.h` to accommodate that. Changed `Randomizer_SaveInit` to a `SaveManager::InitFunc` to allow for other randomizer-dependent sections to be initialized after that. Required a little refactoring to maintain intro cutscene skip when starting a randomizer file. * Revert section index return and randomizer init changes. Will need to wait on yet more changes to main. * Fixed check tracker initialization (shouldn't be tied to window initialization), restored saving/loading functionality. * Removed `CheckTracker::Init` and put SaveManager calls in `CheckTrackerWindow::InitElement`. Also a bit of cleanup from transition back to save file use. * Fixed tracker displaying check categories while file not loaded. * Fix Darunia's Joy check not marking in vanilla. * Fix autosave not triggering change from collected to saved in tracker data. * Changed default colors for scummed and collected display. * Merge upgrade code cleanup. * Add `OnTransitionEnd` calls to sandstorm transitions both to and from Wasteland. Also improved `gSaveContext.lastScene` assignment for both transition types. Allowed a bit of cleanup in `GetCheckArea`. * Added `StateButton`, a button like `ArrowButton` but that allows text instead of arrow icons. Apparently the changes from ArrowButton to StateButton happened in a previous commit... * Changed section name to `trackerDataCheck` to force SoH to load it after the randomizer section, as it required some randoSettings to be loaded first, and nothing else I tried to make the randomizer section load before it worked. This hacks a solution to checks not displaying on fast file load to a specific slot. F*** you, SaveManager, and f*** you too, JSON. * Forgot to change the section string for loading with the name change. * Fix check ordering for checks that trigger the autosave. * Adds option to remove right-side shop items (slots 1-4) from the tracker list. Enabled by default. * Fix default state of Hide Shop Right Checks checkbox. * Fixes grotto and great fairy scrolling and checks. Fixes array overflow from `checkTrackerData` which was creating the issue trying to load the base and randomizer sections first, among other things. That also fixed the massive file loads that were being exhibited in debug mode. * Fix shooting galleries being set as collected again when being played a second time after getting the checks. * Fix Bazaar autoscroll. * Add Saria's Song to `GetCheckFromActor` and removed some limitations from the messageCloseCheck function to make that check track properly. * Fix Song from Impa check. Implemented prevention for multiple "collections" of great fairies, just in case getting the health refill would trigger it with the previous setup. * Fix ice traps on GS tokens not triggering OnItemReceive. * Complete fix for ice trap collection from GS. Add autoscroll when clicking "Expand All". * Add `OnShopSlotChange` with cursorSlot and basePrice parameters. * Fixed include in en_ossan for shop slot hook. Added registration for `OnShopSlotChange` in the tracker, storing the price in a new `price` field in `CheckTrackerData`. Added "seen" functionality to shop checks. Displays the model item name upon first entering a shop, adding the price and switching to trickName (if it's an ice trap) upon navigating to the slot in buy mode, triggered by an invisible "identified" status that mirrors "seen" in every other way. Added tooltips to most options for check tracker color picking to describe what each status actually means. * `std::format` pls * So apparently std::format just decided to break with the latest merge from develop, but fmt::format exists and works? * Removed the last vestiges of `locationsSkipped`. Other general code and formatting cleanups. Moved `IsGameRunning` to `OTRGlobals` so the item tracker could also access it. Used preceding to "fix" item and bottle display in the item tracker on startup. * Some more code cleanup. Removed "Recheck Area" button and relevant code. Backported changes to Anchor branch applicable for single-player, including making a checkAreas vector and structuring the frame by frame checks around that. Also includes fix for Silver Gauntlets and Mirror Shield check collection crash associated with those changes. Fixed Kakariko Bazaar "seen" updates. Fixed tracker window not showing on initial load like it should. * Forgot 1 formatting fix. * Removed conditions for showing Song from Impa (isn't junk under certain conditions, so should show all the time). * Fix vanilla checks, add Zelda's Letter and Malon's Egg to manual check collection. Fix autoscroll while in child stealth section. * Fix crash in Happy Mask Shop in OnSlotChange (referenced non-existent shop id in a tracker-specific enum). * General code cleanup. * Missed one reversion. * One more. * Fix column alignment in `randomizer_check_objects`. * Fix file encoding on `randomizer_check_tracker`. Again. * Fix indentation for `actualItemtrackerItemMap`. Also removed unnecessary parts of the map. * Rename `HasEqItem` to `HasEquipment`. * Slightly better indentation for `actualItemTrackerItemMap`. * Add magic bean salesman to vanilla check tracking, and genericized deku shield to trigger KF shop item 3 wherever you get the shield. Renamed `vanillaCheck` to `vanillaHundoCheck` to (supposedly) clarify the meaning of the usage. * One more rename to `vanillaCompletion` to avoid possible confusion with 100% speedrun conditions. * give me a break XD Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * Changes suggested by briaguya (rename `RandomizerCheckShow` to `Status`, unused code, newline formatting) * Remove unused `itemNames` table. * Remove `IsGameRunning` in favor of `GameInteractor::IsSaveLoaded`. * Restore anti-spoiler functionality for dungeons with dungeon maps. * Review cleanup. * Fix prices not showing for Kak bazaar items. --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com>
2023-10-04 11:03:36 -04:00
}
SaveManager::Instance->SaveSection(gSaveContext.fileNum, sectionId, true);
doAreaScroll = true;
UpdateOrdering(rcObj.rcArea);
UpdateInventoryChecks();
}
bool IsAreaScene(SceneID sceneNum) {
switch (sceneNum) {
case SCENE_HYRULE_FIELD:
case SCENE_KAKARIKO_VILLAGE:
case SCENE_GRAVEYARD:
case SCENE_ZORAS_RIVER:
case SCENE_KOKIRI_FOREST:
case SCENE_SACRED_FOREST_MEADOW:
case SCENE_LAKE_HYLIA:
case SCENE_ZORAS_DOMAIN:
case SCENE_ZORAS_FOUNTAIN:
case SCENE_GERUDO_VALLEY:
case SCENE_LOST_WOODS:
case SCENE_DESERT_COLOSSUS:
case SCENE_GERUDOS_FORTRESS:
case SCENE_HAUNTED_WASTELAND:
case SCENE_HYRULE_CASTLE:
case SCENE_DEATH_MOUNTAIN_TRAIL:
case SCENE_DEATH_MOUNTAIN_CRATER:
case SCENE_GORON_CITY:
case SCENE_LON_LON_RANCH:
case SCENE_DEKU_TREE:
case SCENE_DODONGOS_CAVERN:
case SCENE_JABU_JABU:
case SCENE_FOREST_TEMPLE:
case SCENE_FIRE_TEMPLE:
case SCENE_WATER_TEMPLE:
case SCENE_SPIRIT_TEMPLE:
case SCENE_SHADOW_TEMPLE:
case SCENE_BOTTOM_OF_THE_WELL:
case SCENE_ICE_CAVERN:
case SCENE_GERUDO_TRAINING_GROUND:
case SCENE_GANONS_TOWER:
case SCENE_INSIDE_GANONS_CASTLE:
case SCENE_BACK_ALLEY_DAY:
case SCENE_BACK_ALLEY_NIGHT:
case SCENE_MARKET_DAY:
case SCENE_MARKET_NIGHT:
case SCENE_MARKET_RUINS:
return true;
default:
return false;
}
}
RandomizerCheckArea AreaFromEntranceGroup[] = {
RCAREA_INVALID,
RCAREA_KOKIRI_FOREST,
RCAREA_LOST_WOODS,
RCAREA_SACRED_FOREST_MEADOW,
RCAREA_KAKARIKO_VILLAGE,
RCAREA_GRAVEYARD,
RCAREA_DEATH_MOUNTAIN_TRAIL,
RCAREA_DEATH_MOUNTAIN_CRATER,
RCAREA_GORON_CITY,
RCAREA_ZORAS_RIVER,
RCAREA_ZORAS_DOMAIN,
RCAREA_ZORAS_FOUNTAIN,
RCAREA_HYRULE_FIELD,
RCAREA_LON_LON_RANCH,
RCAREA_LAKE_HYLIA,
RCAREA_GERUDO_VALLEY,
RCAREA_WASTELAND,
RCAREA_MARKET,
RCAREA_HYRULE_CASTLE,
};
RandomizerCheckArea GetCheckArea() {
auto scene = static_cast<SceneID>(gPlayState->sceneNum);
bool grottoScene = (scene == SCENE_GROTTOS || scene == SCENE_FAIRYS_FOUNTAIN);
const EntranceData* ent = GetEntranceData(grottoScene ? ENTRANCE_RANDO_GROTTO_EXIT_START + GetCurrentGrottoId() : gSaveContext.entranceIndex);
RandomizerCheckArea area = RCAREA_INVALID;
if (ent != nullptr && !IsAreaScene(scene) && ent->type != ENTRANCE_TYPE_DUNGEON) {
if (ent->source == "Desert Colossus" || ent->destination == "Desert Colossus") {
area = RCAREA_DESERT_COLOSSUS;
} else if (ent->source == "Gerudo Fortress" || ent->destination == "Gerudo Fortress") {
area = RCAREA_GERUDO_FORTRESS;
} else {
area = AreaFromEntranceGroup[ent->dstGroup];
}
}
if (area == RCAREA_INVALID) {
if (grottoScene && (GetCurrentGrottoId() == -1) && (OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_SHUFFLE_GROTTO_ENTRANCES) == RO_GENERIC_OFF)) {
area = previousArea;
} else {
area = RandomizerCheckObjects::GetRCAreaBySceneID(scene);
}
}
return area;
}
bool vector_contains_scene(std::vector<SceneID> vec, const int16_t scene) {
return std::any_of(vec.begin(), vec.end(), [&](const auto& x) { return x == scene; });
}
std::vector<SceneID> skipScenes = {SCENE_GANON_BOSS, SCENE_GANONS_TOWER_COLLAPSE_EXTERIOR, SCENE_GANON_BOSS, SCENE_INSIDE_GANONS_CASTLE_COLLAPSE, SCENE_GANONS_TOWER_COLLAPSE_INTERIOR};
Flag tracker (#3447) * Hook into flagset hooks for processing check tracking. Has some manual workarounds (some breaks still need to be found). Remove areaChecks and looping functionality as redundant. * Additional vanilla handling. * Fix tracker not showing MQ checks in MQ non-rando. Fix tracker marking non-MQ variants of dungeon checks (e.g. map chest, etc) when collecting in MQ. * Set all areas to spoiled if not rando. * Revert attempt to spoil in randomizer based on MQ dungeon count as I don't know how that works at the moment. * Restore and update spoiling based on MQ dungeon settings (none, selection, or count of 12). Fix Anju As Adult check. * Remove Anchor-specific code :baguette: * Use `ClearAreaTotals()` in `Teardown()` instead of the duplicate code there. * Update to `ClearAreaChecksAndTotals()` with `vec.clear()` added. * Fix type spoiling again. Now spoils on 0 MQ dungeons, not rando, if the option is enabled in check tracker settings, selection, or set number of 12. Fix vanilla checks being marked collected in MQ dungeons. * Fix 100 GS check. * ACTUALLY fix 100 GS: change flag type to `RandomizerInf()` in `item_location.cpp`, add RC to RandoInf for it to the table. Also don't send GI for flag if father, falsely triggers ZR frogs minigame. * Fix gravedigging tour tracking. * Fix membership card check tracking. Change scene and flag values to any existing enums. Clarifying formatting for the checking loop vOrMQ conditions. * Fix Gravedigging Tour tracking. Simplify Always Win Gravedigging Tour and Fix Gravedigging Tour Glitch applications. Modified all necessary paths to use vanilla GDT PoH collection flag instead of randomizer variant. * Fix Kak Potion Shop being "seen" when entering as child.
2023-11-28 21:25:48 -05:00
void ClearAreaChecksAndTotals() {
for (auto& [rcArea, vec] : checksByArea) {
vec.clear();
areaChecksGotten[rcArea] = 0;
areaCheckTotals[rcArea] = 0;
Check Tracker Update (#2668) * Initial commit. What works so far: Data file loads, saves, deletes, and is created properly. - Need to run `HasItemBeenCollected` when creating in case of mid-seed regen. Organized checks into maps set by area. Areas show in tracker. - Checks pulled from checkObjectsByArea are not currently listed. - Areas are being assumed completed and hidden at the start. * Checks now populate. Still not counting area totals properly. * Don't track RC_LINKS_POCKET in the data file, and instead manually add it in every time a save is load. rcObjects doesn't contain Link's Pocket location (duh). * Moved ItemReceive hook to randomizer_check_tracker.cpp. Skipped items are properly sorted and formatted. Saved items contribute to an area's gotten/skipped checks on load. Changed skipped items default main color to gray. General code cleanup. * Skipped checks now contribute to area totals for area completion logic. * Mid-menu rework transfer. * Started check lookup on item receive. Tried to enable scum checking on save. * Fixed scum check on save. * More code cleanup, which revealed some issues with loading and saving. Loading now works 100%, but entries in checkTrackerData are disappearing in code somewhere, causing issues with later checks. Scummed color now displays properly. Collected but unsaved displays properly. Unchecked, Skipped, Seen and Scummed checks all have arrows for skipping/unskipping. Counts a little messed up, probably double adding skips. * Fixed item counts being off across resets. Restarts were fine. * Beginning of rework for individual check updates. Adds `Actor lastCheck` to PlayState to allow assigning of last actor to give an item. This allows precise tracking of GS, freestanding PoH, etc. Works for chests too. Currently does not work for shops, unknown for normal NPC gives. Doesn't track last gives for non-checks, like drops from grass, pots, crates, etc. * Actor-based checks fully fleshed out, but can't help with sale-based checks. Implemented `pendingSaleCheck` to back out of an RC check cycle if `gSaveContext->pendingSale` is not NONE when `OnItemReceive` is called, processed through `OnSaleEnd`. This should be the final change necessary to streamline the checks. * Temporary hook to message box close to tie in trackers for non-gs/chest actors that aren't added to `GetCheckFromActor`. This triggers a 2-frame countdown to check with `HasItemBeenCollected` since half of the methods in there aren't updated until after a text box closes. Added scene tracking to get last scene so that checks in scenes that span several overworld areas could be tied to their areas properly. Modified tracker data creation to apply Link's Pocket and Song from Impa conditionally based on randomizer settings instead of just being assumed to be done. May need modification for checking click and drag spoiler loading. Removed the scene equivalence check from CheckChecks so that an entire area is checked each time to avoid issues with, e.g., leaving a shop before a pending sale finishes. * Changed check data creation to use RSKs from gRandomizer to account for settings loaded from drag and drop spoilers. * Beginning of tracker code organization. Changed check color defaults. * Reverted moving tracker colors to header. Some individual check fixes. * Missed something from previous merge? * Removed last remnant of removed performance mode. * Better handle checking when skullsanity is off. * Song checks sceneIDs don't match the scenes they're actually in for some reason. Removed that check. * SaleEnd checks don't need the GetItemEntry parameter. Also set a flag that should prevent the check tracker from running during vanilla saves should that not be resolved by the time it's merged. * Attempting to have only the relevant checks added to the tracker data, as well as showing vanilla checks for non-rando saves. Not working yet (everything is displayed in vanilla). * Added vanilla check tracker population via `vanillaCheck` bool in `RandomizerCheckObject`. This is also added to `IsVisibleInImGui` to handle file loading and saving to eliminate checks that aren't part of vanilla or the rando seed. Implemented deleted tracker data file recreation. Added some extra item name text checks. Songs are still... tricky, so they stay blank. Utilize local copies of the randomizer check objects that are applicable for performance purposes. Fixed vanilla item-giving cutscene crashes when triggered mid-transition. * Apparently not all toolchains can handle macro instantiation without all parameters, like VS can. * Fixed scummed detail color not showing properly on tracker. * Fixed dungeon area totals and GS checks not functioning properly. * Major revamp of checking code. Doesn't rely on `GetCheckFromActor` at all anymore, but instead simply sets a flag to evaluate a number of checks in an area every frame until the check that was gotten is identified. With the new setup, it's much less hardware intensive, and at 60fps 6 checks per frame shows no noticeable effect on framerate. I can envision needing to add a collectedCount in order to account for times when two checks are gotten one right after the other. Changed area scroll to happen from `OnTransitionEnd`, and allow for scrolling in bazaar (was disabled previously because it would jump back and forth between Kak and Market while you were in one). Also setup area check order updating by area instead of all at the same time. * Fixed shooting gallery not reporting proper area. Prevent checks from actually happening if area is RCAREA_INVALID, now that all areas are reporting something if they have checks. Fixed `GetCheckArea()` not updating checks for standard scenes. Lots of vanilla tracking updates, mainly manual checks for gems, medallions and songs, since the often don't have proper scenes in the data. Prevent vanilla from triggering check loops if junk items are collected. Fixed sorting based on saved vs collected. Prevent item name display for vanilla runs. Change coloring of checks so the check name reflects status in vanilla runs. * Fixed "Recheck Area" button erroneously adding to an area's check totals? * Fix DMC vanilla checks. * Fix check tracker data recreation on data file loss. Removed redundant file exists check from SaveTrackerDataHook, as it doesn't matter if it exists or not at that point. Limited check loops to 3 to avoid infinite check loops on non-check/junk item pickup. Added more checks to disable tracker operations if a save is not running. Changed check ordering to put boss reward and heart container checks at the end of whatever RCSHOW group they belong to. * Fixed IsRunning calculation. Further improving vanilla checking. Starting framework for checking medallions, stones, and songs on data file recreation. Fixed medallion check collection. Added GIFT_FROM_SAGES to check list for vanilla file for tracking light medallion. Added check loop limitation to prevent infinite checking after picking up junk item from the ground. * Finished vanilla file recreation and recheck (songs and dungeon rewards all check properly now). This includes deku shield with KF shop item 3. Finished Gift from Raoru light medallion tracking for vanilla. Commented all CheckByScene functionality for now. * Fixed new save data file creation. Disabled entrance area calculation for now, as it only tracks the previous entrance for some reason. Fixed area detection for ToT checks. * GetCheckArea() now utilizes EntranceData almost exclusively, via either `gSaveContext.entranceIndex` or the entrance tracker's `currentGrottoId` in the case of grottos. This also means that EVERYTHING CAN AUTOSCROLL NOW. Entrance shuffles are now much easier to track. Autoscroll is now also triggered on save, just in case someone isn't autosaving and has a lot of checks that get converted to saved. * Fixed missing GS check in LW. * Added area scroll on toggling Show Hidden Items. May configure differently later. Fixed area detection for entrances in Gerudo Fortress/Valley and Collossus. Haunted wasteland doesn't autoscroll due to a bug in `OnTransitionEnd` hook, but checks still evaluate properly there. Rely on scene-based area detection if scene is a main overworld or dungeon scene. * Fixed grotto detection when shuffle is off. * Small code cleanup. Fixed Colossus hand chest checks. * Missing lus bump from merge conflict resolution * Fixed Colossus Grotto making `GetCheckArea` return Wasteland. * Improved OnItemReceive processing for non-token GS checks, since they can sometimes take long enough for the checking process to time out before the item is registered as received. * First attempt at thread safety for tracker data file writing. Seems to work, but might need more testing. * Fixed Recheck Area not unskipping items that register as saved. Improved delayed saving with autosaving, as the autosave triggered quite often before the tracker data save, making things not properly register as saved. * merge cleanup * Converted check tracker data to the sectional saves, adding `CheckTrackerData` to `SaveContext`. Implemented section ID returning and fullSave boolean passing to section functions from my PR temporarily for it to work properly. Moved `RandomizerCheckTrackerData` enum to `randomizerTypes.h` to accommodate that. Changed `Randomizer_SaveInit` to a `SaveManager::InitFunc` to allow for other randomizer-dependent sections to be initialized after that. Required a little refactoring to maintain intro cutscene skip when starting a randomizer file. * Revert section index return and randomizer init changes. Will need to wait on yet more changes to main. * Fixed check tracker initialization (shouldn't be tied to window initialization), restored saving/loading functionality. * Removed `CheckTracker::Init` and put SaveManager calls in `CheckTrackerWindow::InitElement`. Also a bit of cleanup from transition back to save file use. * Fixed tracker displaying check categories while file not loaded. * Fix Darunia's Joy check not marking in vanilla. * Fix autosave not triggering change from collected to saved in tracker data. * Changed default colors for scummed and collected display. * Merge upgrade code cleanup. * Add `OnTransitionEnd` calls to sandstorm transitions both to and from Wasteland. Also improved `gSaveContext.lastScene` assignment for both transition types. Allowed a bit of cleanup in `GetCheckArea`. * Added `StateButton`, a button like `ArrowButton` but that allows text instead of arrow icons. Apparently the changes from ArrowButton to StateButton happened in a previous commit... * Changed section name to `trackerDataCheck` to force SoH to load it after the randomizer section, as it required some randoSettings to be loaded first, and nothing else I tried to make the randomizer section load before it worked. This hacks a solution to checks not displaying on fast file load to a specific slot. F*** you, SaveManager, and f*** you too, JSON. * Forgot to change the section string for loading with the name change. * Fix check ordering for checks that trigger the autosave. * Adds option to remove right-side shop items (slots 1-4) from the tracker list. Enabled by default. * Fix default state of Hide Shop Right Checks checkbox. * Fixes grotto and great fairy scrolling and checks. Fixes array overflow from `checkTrackerData` which was creating the issue trying to load the base and randomizer sections first, among other things. That also fixed the massive file loads that were being exhibited in debug mode. * Fix shooting galleries being set as collected again when being played a second time after getting the checks. * Fix Bazaar autoscroll. * Add Saria's Song to `GetCheckFromActor` and removed some limitations from the messageCloseCheck function to make that check track properly. * Fix Song from Impa check. Implemented prevention for multiple "collections" of great fairies, just in case getting the health refill would trigger it with the previous setup. * Fix ice traps on GS tokens not triggering OnItemReceive. * Complete fix for ice trap collection from GS. Add autoscroll when clicking "Expand All". * Add `OnShopSlotChange` with cursorSlot and basePrice parameters. * Fixed include in en_ossan for shop slot hook. Added registration for `OnShopSlotChange` in the tracker, storing the price in a new `price` field in `CheckTrackerData`. Added "seen" functionality to shop checks. Displays the model item name upon first entering a shop, adding the price and switching to trickName (if it's an ice trap) upon navigating to the slot in buy mode, triggered by an invisible "identified" status that mirrors "seen" in every other way. Added tooltips to most options for check tracker color picking to describe what each status actually means. * `std::format` pls * So apparently std::format just decided to break with the latest merge from develop, but fmt::format exists and works? * Removed the last vestiges of `locationsSkipped`. Other general code and formatting cleanups. Moved `IsGameRunning` to `OTRGlobals` so the item tracker could also access it. Used preceding to "fix" item and bottle display in the item tracker on startup. * Some more code cleanup. Removed "Recheck Area" button and relevant code. Backported changes to Anchor branch applicable for single-player, including making a checkAreas vector and structuring the frame by frame checks around that. Also includes fix for Silver Gauntlets and Mirror Shield check collection crash associated with those changes. Fixed Kakariko Bazaar "seen" updates. Fixed tracker window not showing on initial load like it should. * Forgot 1 formatting fix. * Removed conditions for showing Song from Impa (isn't junk under certain conditions, so should show all the time). * Fix vanilla checks, add Zelda's Letter and Malon's Egg to manual check collection. Fix autoscroll while in child stealth section. * Fix crash in Happy Mask Shop in OnSlotChange (referenced non-existent shop id in a tracker-specific enum). * General code cleanup. * Missed one reversion. * One more. * Fix column alignment in `randomizer_check_objects`. * Fix file encoding on `randomizer_check_tracker`. Again. * Fix indentation for `actualItemtrackerItemMap`. Also removed unnecessary parts of the map. * Rename `HasEqItem` to `HasEquipment`. * Slightly better indentation for `actualItemTrackerItemMap`. * Add magic bean salesman to vanilla check tracking, and genericized deku shield to trigger KF shop item 3 wherever you get the shield. Renamed `vanillaCheck` to `vanillaHundoCheck` to (supposedly) clarify the meaning of the usage. * One more rename to `vanillaCompletion` to avoid possible confusion with 100% speedrun conditions. * give me a break XD Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * Changes suggested by briaguya (rename `RandomizerCheckShow` to `Status`, unused code, newline formatting) * Remove unused `itemNames` table. * Remove `IsGameRunning` in favor of `GameInteractor::IsSaveLoaded`. * Restore anti-spoiler functionality for dungeons with dungeon maps. * Review cleanup. * Fix prices not showing for Kak bazaar items. --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com>
2023-10-04 11:03:36 -04:00
}
}
void SetShopSeen(uint32_t sceneNum, bool prices) {
RandomizerCheck start = startingShopItem.find(sceneNum)->second;
Flag tracker (#3447) * Hook into flagset hooks for processing check tracking. Has some manual workarounds (some breaks still need to be found). Remove areaChecks and looping functionality as redundant. * Additional vanilla handling. * Fix tracker not showing MQ checks in MQ non-rando. Fix tracker marking non-MQ variants of dungeon checks (e.g. map chest, etc) when collecting in MQ. * Set all areas to spoiled if not rando. * Revert attempt to spoil in randomizer based on MQ dungeon count as I don't know how that works at the moment. * Restore and update spoiling based on MQ dungeon settings (none, selection, or count of 12). Fix Anju As Adult check. * Remove Anchor-specific code :baguette: * Use `ClearAreaTotals()` in `Teardown()` instead of the duplicate code there. * Update to `ClearAreaChecksAndTotals()` with `vec.clear()` added. * Fix type spoiling again. Now spoils on 0 MQ dungeons, not rando, if the option is enabled in check tracker settings, selection, or set number of 12. Fix vanilla checks being marked collected in MQ dungeons. * Fix 100 GS check. * ACTUALLY fix 100 GS: change flag type to `RandomizerInf()` in `item_location.cpp`, add RC to RandoInf for it to the table. Also don't send GI for flag if father, falsely triggers ZR frogs minigame. * Fix gravedigging tour tracking. * Fix membership card check tracking. Change scene and flag values to any existing enums. Clarifying formatting for the checking loop vOrMQ conditions. * Fix Gravedigging Tour tracking. Simplify Always Win Gravedigging Tour and Fix Gravedigging Tour Glitch applications. Modified all necessary paths to use vanilla GDT PoH collection flag instead of randomizer variant. * Fix Kak Potion Shop being "seen" when entering as child.
2023-11-28 21:25:48 -05:00
if (sceneNum == SCENE_POTION_SHOP_KAKARIKO && !LINK_IS_ADULT) {
return;
}
Check Tracker Update (#2668) * Initial commit. What works so far: Data file loads, saves, deletes, and is created properly. - Need to run `HasItemBeenCollected` when creating in case of mid-seed regen. Organized checks into maps set by area. Areas show in tracker. - Checks pulled from checkObjectsByArea are not currently listed. - Areas are being assumed completed and hidden at the start. * Checks now populate. Still not counting area totals properly. * Don't track RC_LINKS_POCKET in the data file, and instead manually add it in every time a save is load. rcObjects doesn't contain Link's Pocket location (duh). * Moved ItemReceive hook to randomizer_check_tracker.cpp. Skipped items are properly sorted and formatted. Saved items contribute to an area's gotten/skipped checks on load. Changed skipped items default main color to gray. General code cleanup. * Skipped checks now contribute to area totals for area completion logic. * Mid-menu rework transfer. * Started check lookup on item receive. Tried to enable scum checking on save. * Fixed scum check on save. * More code cleanup, which revealed some issues with loading and saving. Loading now works 100%, but entries in checkTrackerData are disappearing in code somewhere, causing issues with later checks. Scummed color now displays properly. Collected but unsaved displays properly. Unchecked, Skipped, Seen and Scummed checks all have arrows for skipping/unskipping. Counts a little messed up, probably double adding skips. * Fixed item counts being off across resets. Restarts were fine. * Beginning of rework for individual check updates. Adds `Actor lastCheck` to PlayState to allow assigning of last actor to give an item. This allows precise tracking of GS, freestanding PoH, etc. Works for chests too. Currently does not work for shops, unknown for normal NPC gives. Doesn't track last gives for non-checks, like drops from grass, pots, crates, etc. * Actor-based checks fully fleshed out, but can't help with sale-based checks. Implemented `pendingSaleCheck` to back out of an RC check cycle if `gSaveContext->pendingSale` is not NONE when `OnItemReceive` is called, processed through `OnSaleEnd`. This should be the final change necessary to streamline the checks. * Temporary hook to message box close to tie in trackers for non-gs/chest actors that aren't added to `GetCheckFromActor`. This triggers a 2-frame countdown to check with `HasItemBeenCollected` since half of the methods in there aren't updated until after a text box closes. Added scene tracking to get last scene so that checks in scenes that span several overworld areas could be tied to their areas properly. Modified tracker data creation to apply Link's Pocket and Song from Impa conditionally based on randomizer settings instead of just being assumed to be done. May need modification for checking click and drag spoiler loading. Removed the scene equivalence check from CheckChecks so that an entire area is checked each time to avoid issues with, e.g., leaving a shop before a pending sale finishes. * Changed check data creation to use RSKs from gRandomizer to account for settings loaded from drag and drop spoilers. * Beginning of tracker code organization. Changed check color defaults. * Reverted moving tracker colors to header. Some individual check fixes. * Missed something from previous merge? * Removed last remnant of removed performance mode. * Better handle checking when skullsanity is off. * Song checks sceneIDs don't match the scenes they're actually in for some reason. Removed that check. * SaleEnd checks don't need the GetItemEntry parameter. Also set a flag that should prevent the check tracker from running during vanilla saves should that not be resolved by the time it's merged. * Attempting to have only the relevant checks added to the tracker data, as well as showing vanilla checks for non-rando saves. Not working yet (everything is displayed in vanilla). * Added vanilla check tracker population via `vanillaCheck` bool in `RandomizerCheckObject`. This is also added to `IsVisibleInImGui` to handle file loading and saving to eliminate checks that aren't part of vanilla or the rando seed. Implemented deleted tracker data file recreation. Added some extra item name text checks. Songs are still... tricky, so they stay blank. Utilize local copies of the randomizer check objects that are applicable for performance purposes. Fixed vanilla item-giving cutscene crashes when triggered mid-transition. * Apparently not all toolchains can handle macro instantiation without all parameters, like VS can. * Fixed scummed detail color not showing properly on tracker. * Fixed dungeon area totals and GS checks not functioning properly. * Major revamp of checking code. Doesn't rely on `GetCheckFromActor` at all anymore, but instead simply sets a flag to evaluate a number of checks in an area every frame until the check that was gotten is identified. With the new setup, it's much less hardware intensive, and at 60fps 6 checks per frame shows no noticeable effect on framerate. I can envision needing to add a collectedCount in order to account for times when two checks are gotten one right after the other. Changed area scroll to happen from `OnTransitionEnd`, and allow for scrolling in bazaar (was disabled previously because it would jump back and forth between Kak and Market while you were in one). Also setup area check order updating by area instead of all at the same time. * Fixed shooting gallery not reporting proper area. Prevent checks from actually happening if area is RCAREA_INVALID, now that all areas are reporting something if they have checks. Fixed `GetCheckArea()` not updating checks for standard scenes. Lots of vanilla tracking updates, mainly manual checks for gems, medallions and songs, since the often don't have proper scenes in the data. Prevent vanilla from triggering check loops if junk items are collected. Fixed sorting based on saved vs collected. Prevent item name display for vanilla runs. Change coloring of checks so the check name reflects status in vanilla runs. * Fixed "Recheck Area" button erroneously adding to an area's check totals? * Fix DMC vanilla checks. * Fix check tracker data recreation on data file loss. Removed redundant file exists check from SaveTrackerDataHook, as it doesn't matter if it exists or not at that point. Limited check loops to 3 to avoid infinite check loops on non-check/junk item pickup. Added more checks to disable tracker operations if a save is not running. Changed check ordering to put boss reward and heart container checks at the end of whatever RCSHOW group they belong to. * Fixed IsRunning calculation. Further improving vanilla checking. Starting framework for checking medallions, stones, and songs on data file recreation. Fixed medallion check collection. Added GIFT_FROM_SAGES to check list for vanilla file for tracking light medallion. Added check loop limitation to prevent infinite checking after picking up junk item from the ground. * Finished vanilla file recreation and recheck (songs and dungeon rewards all check properly now). This includes deku shield with KF shop item 3. Finished Gift from Raoru light medallion tracking for vanilla. Commented all CheckByScene functionality for now. * Fixed new save data file creation. Disabled entrance area calculation for now, as it only tracks the previous entrance for some reason. Fixed area detection for ToT checks. * GetCheckArea() now utilizes EntranceData almost exclusively, via either `gSaveContext.entranceIndex` or the entrance tracker's `currentGrottoId` in the case of grottos. This also means that EVERYTHING CAN AUTOSCROLL NOW. Entrance shuffles are now much easier to track. Autoscroll is now also triggered on save, just in case someone isn't autosaving and has a lot of checks that get converted to saved. * Fixed missing GS check in LW. * Added area scroll on toggling Show Hidden Items. May configure differently later. Fixed area detection for entrances in Gerudo Fortress/Valley and Collossus. Haunted wasteland doesn't autoscroll due to a bug in `OnTransitionEnd` hook, but checks still evaluate properly there. Rely on scene-based area detection if scene is a main overworld or dungeon scene. * Fixed grotto detection when shuffle is off. * Small code cleanup. Fixed Colossus hand chest checks. * Missing lus bump from merge conflict resolution * Fixed Colossus Grotto making `GetCheckArea` return Wasteland. * Improved OnItemReceive processing for non-token GS checks, since they can sometimes take long enough for the checking process to time out before the item is registered as received. * First attempt at thread safety for tracker data file writing. Seems to work, but might need more testing. * Fixed Recheck Area not unskipping items that register as saved. Improved delayed saving with autosaving, as the autosave triggered quite often before the tracker data save, making things not properly register as saved. * merge cleanup * Converted check tracker data to the sectional saves, adding `CheckTrackerData` to `SaveContext`. Implemented section ID returning and fullSave boolean passing to section functions from my PR temporarily for it to work properly. Moved `RandomizerCheckTrackerData` enum to `randomizerTypes.h` to accommodate that. Changed `Randomizer_SaveInit` to a `SaveManager::InitFunc` to allow for other randomizer-dependent sections to be initialized after that. Required a little refactoring to maintain intro cutscene skip when starting a randomizer file. * Revert section index return and randomizer init changes. Will need to wait on yet more changes to main. * Fixed check tracker initialization (shouldn't be tied to window initialization), restored saving/loading functionality. * Removed `CheckTracker::Init` and put SaveManager calls in `CheckTrackerWindow::InitElement`. Also a bit of cleanup from transition back to save file use. * Fixed tracker displaying check categories while file not loaded. * Fix Darunia's Joy check not marking in vanilla. * Fix autosave not triggering change from collected to saved in tracker data. * Changed default colors for scummed and collected display. * Merge upgrade code cleanup. * Add `OnTransitionEnd` calls to sandstorm transitions both to and from Wasteland. Also improved `gSaveContext.lastScene` assignment for both transition types. Allowed a bit of cleanup in `GetCheckArea`. * Added `StateButton`, a button like `ArrowButton` but that allows text instead of arrow icons. Apparently the changes from ArrowButton to StateButton happened in a previous commit... * Changed section name to `trackerDataCheck` to force SoH to load it after the randomizer section, as it required some randoSettings to be loaded first, and nothing else I tried to make the randomizer section load before it worked. This hacks a solution to checks not displaying on fast file load to a specific slot. F*** you, SaveManager, and f*** you too, JSON. * Forgot to change the section string for loading with the name change. * Fix check ordering for checks that trigger the autosave. * Adds option to remove right-side shop items (slots 1-4) from the tracker list. Enabled by default. * Fix default state of Hide Shop Right Checks checkbox. * Fixes grotto and great fairy scrolling and checks. Fixes array overflow from `checkTrackerData` which was creating the issue trying to load the base and randomizer sections first, among other things. That also fixed the massive file loads that were being exhibited in debug mode. * Fix shooting galleries being set as collected again when being played a second time after getting the checks. * Fix Bazaar autoscroll. * Add Saria's Song to `GetCheckFromActor` and removed some limitations from the messageCloseCheck function to make that check track properly. * Fix Song from Impa check. Implemented prevention for multiple "collections" of great fairies, just in case getting the health refill would trigger it with the previous setup. * Fix ice traps on GS tokens not triggering OnItemReceive. * Complete fix for ice trap collection from GS. Add autoscroll when clicking "Expand All". * Add `OnShopSlotChange` with cursorSlot and basePrice parameters. * Fixed include in en_ossan for shop slot hook. Added registration for `OnShopSlotChange` in the tracker, storing the price in a new `price` field in `CheckTrackerData`. Added "seen" functionality to shop checks. Displays the model item name upon first entering a shop, adding the price and switching to trickName (if it's an ice trap) upon navigating to the slot in buy mode, triggered by an invisible "identified" status that mirrors "seen" in every other way. Added tooltips to most options for check tracker color picking to describe what each status actually means. * `std::format` pls * So apparently std::format just decided to break with the latest merge from develop, but fmt::format exists and works? * Removed the last vestiges of `locationsSkipped`. Other general code and formatting cleanups. Moved `IsGameRunning` to `OTRGlobals` so the item tracker could also access it. Used preceding to "fix" item and bottle display in the item tracker on startup. * Some more code cleanup. Removed "Recheck Area" button and relevant code. Backported changes to Anchor branch applicable for single-player, including making a checkAreas vector and structuring the frame by frame checks around that. Also includes fix for Silver Gauntlets and Mirror Shield check collection crash associated with those changes. Fixed Kakariko Bazaar "seen" updates. Fixed tracker window not showing on initial load like it should. * Forgot 1 formatting fix. * Removed conditions for showing Song from Impa (isn't junk under certain conditions, so should show all the time). * Fix vanilla checks, add Zelda's Letter and Malon's Egg to manual check collection. Fix autoscroll while in child stealth section. * Fix crash in Happy Mask Shop in OnSlotChange (referenced non-existent shop id in a tracker-specific enum). * General code cleanup. * Missed one reversion. * One more. * Fix column alignment in `randomizer_check_objects`. * Fix file encoding on `randomizer_check_tracker`. Again. * Fix indentation for `actualItemtrackerItemMap`. Also removed unnecessary parts of the map. * Rename `HasEqItem` to `HasEquipment`. * Slightly better indentation for `actualItemTrackerItemMap`. * Add magic bean salesman to vanilla check tracking, and genericized deku shield to trigger KF shop item 3 wherever you get the shield. Renamed `vanillaCheck` to `vanillaHundoCheck` to (supposedly) clarify the meaning of the usage. * One more rename to `vanillaCompletion` to avoid possible confusion with 100% speedrun conditions. * give me a break XD Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * Changes suggested by briaguya (rename `RandomizerCheckShow` to `Status`, unused code, newline formatting) * Remove unused `itemNames` table. * Remove `IsGameRunning` in favor of `GameInteractor::IsSaveLoaded`. * Restore anti-spoiler functionality for dungeons with dungeon maps. * Review cleanup. * Fix prices not showing for Kak bazaar items. --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com>
2023-10-04 11:03:36 -04:00
if (GetCheckArea() == RCAREA_KAKARIKO_VILLAGE && sceneNum == SCENE_BAZAAR) {
start = RC_KAK_BAZAAR_ITEM_1;
}
bool statusChanged = false;
for (int i = start; i < start + 8; i++) {
if (gSaveContext.checkTrackerData[i].status == RCSHOW_UNCHECKED) {
gSaveContext.checkTrackerData[i].status = RCSHOW_SEEN;
statusChanged = true;
}
}
if (statusChanged) {
SaveManager::Instance->SaveSection(gSaveContext.fileNum, sectionId, true);
}
}
bool HasItemBeenCollected(RandomizerCheck rc) {
if (gPlayState == nullptr) {
return false;
}
ItemLocation* x = Location(rc);
SpoilerCollectionCheck check = x->GetCollectionCheck();
auto flag = check.flag;
auto scene = check.scene;
auto type = check.type;
switch (type) {
case SpoilerCollectionCheckType::SPOILER_CHK_ALWAYS_COLLECTED:
return true;
case SpoilerCollectionCheckType::SPOILER_CHK_CHEST:
return (gPlayState->sceneNum == scene && gPlayState->actorCtx.flags.chest & (1 << flag)) ||
gSaveContext.sceneFlags[scene].chest & (1 << flag);
case SpoilerCollectionCheckType::SPOILER_CHK_COLLECTABLE:
return (gPlayState->sceneNum == scene && gPlayState->actorCtx.flags.collect & (1 << flag)) ||
gSaveContext.sceneFlags[scene].collect & (1 << flag);
case SpoilerCollectionCheckType::SPOILER_CHK_MERCHANT:
case SpoilerCollectionCheckType::SPOILER_CHK_SHOP_ITEM:
case SpoilerCollectionCheckType::SPOILER_CHK_COW:
case SpoilerCollectionCheckType::SPOILER_CHK_SCRUB:
case SpoilerCollectionCheckType::SPOILER_CHK_RANDOMIZER_INF:
Rando: Master Sword Shuffle (#2981) * The mother of all commits * Removed `GI_SWORD_MASTER`; "Master Sword" Items now actually give MS * Removed dupe MS entries in item pool; updated GIMESSAGE (should stop crashing on non-Windows); re-added MS in item list * Give Adult Link a freebie with shuffle MS on; cihld -> adult no longer gives MS; ToT Master Sword now gives correct item * add master sword GI draw func based on ToT MS object * Force `MasterSword` logic var to only update upon getting MS * Dorf funny line now activates with LA and MS in inv * Apply suggestions * Updated RAND_INF; Check Tracker changes; Gave RAND_INF and ice trap logic to ToT MS check; Fixed swordless behavior for HBA/fishing * ToT MS Check now works in check tracker; Visual bug where box hovers over non-existent MS gone; Fixed RAND_INF check with ToT MS pedestal; Ganon no longer gives free MS * adult equips no longer reset in MS shuffle * Apply (most) locacc review suggestions Co-authored-by: inspectredc <78732756+inspectredc@users.noreply.github.com> * Reorganized swordless check for interface to fit edge cases; getting master sword no longer highlights box * Edge case for BGS but no bow * Fix implicit declaration error for GI hooks (#9) * Adjusted `CanAdultAttack/Damage`; applied logic suggestions * Fixed build errors (hopefully) * Cleanup merge * get shit working again * Tidied up remaining uses of DD flag as rando indicator * make master sword invisible and fix ms flag (#10) * Add text to sheik if go mode is obtained but barrier is still up * overhaul swordless behavior in `func_80083108` * reworked ToT MS Check to have an actual GI * suggestions * Apply suggestions * Better swordless handling with temp B (#11) * better swordless handling with temp B * prevent auto save in fishing pond * prevent auto save during bombchu bowling * enum fix --------- Co-authored-by: Adam Bird <archez39@me.com> Co-authored-by: inspectredc <78732756+inspectredc@users.noreply.github.com> Co-authored-by: RaelCappra <rael.cappra@gmail.com> Co-authored-by: Adam Bird <Archez@users.noreply.github.com>
2023-10-21 21:51:37 -04:00
case SpoilerCollectionCheckType::SPOILER_CHK_MASTER_SWORD:
Check Tracker Update (#2668) * Initial commit. What works so far: Data file loads, saves, deletes, and is created properly. - Need to run `HasItemBeenCollected` when creating in case of mid-seed regen. Organized checks into maps set by area. Areas show in tracker. - Checks pulled from checkObjectsByArea are not currently listed. - Areas are being assumed completed and hidden at the start. * Checks now populate. Still not counting area totals properly. * Don't track RC_LINKS_POCKET in the data file, and instead manually add it in every time a save is load. rcObjects doesn't contain Link's Pocket location (duh). * Moved ItemReceive hook to randomizer_check_tracker.cpp. Skipped items are properly sorted and formatted. Saved items contribute to an area's gotten/skipped checks on load. Changed skipped items default main color to gray. General code cleanup. * Skipped checks now contribute to area totals for area completion logic. * Mid-menu rework transfer. * Started check lookup on item receive. Tried to enable scum checking on save. * Fixed scum check on save. * More code cleanup, which revealed some issues with loading and saving. Loading now works 100%, but entries in checkTrackerData are disappearing in code somewhere, causing issues with later checks. Scummed color now displays properly. Collected but unsaved displays properly. Unchecked, Skipped, Seen and Scummed checks all have arrows for skipping/unskipping. Counts a little messed up, probably double adding skips. * Fixed item counts being off across resets. Restarts were fine. * Beginning of rework for individual check updates. Adds `Actor lastCheck` to PlayState to allow assigning of last actor to give an item. This allows precise tracking of GS, freestanding PoH, etc. Works for chests too. Currently does not work for shops, unknown for normal NPC gives. Doesn't track last gives for non-checks, like drops from grass, pots, crates, etc. * Actor-based checks fully fleshed out, but can't help with sale-based checks. Implemented `pendingSaleCheck` to back out of an RC check cycle if `gSaveContext->pendingSale` is not NONE when `OnItemReceive` is called, processed through `OnSaleEnd`. This should be the final change necessary to streamline the checks. * Temporary hook to message box close to tie in trackers for non-gs/chest actors that aren't added to `GetCheckFromActor`. This triggers a 2-frame countdown to check with `HasItemBeenCollected` since half of the methods in there aren't updated until after a text box closes. Added scene tracking to get last scene so that checks in scenes that span several overworld areas could be tied to their areas properly. Modified tracker data creation to apply Link's Pocket and Song from Impa conditionally based on randomizer settings instead of just being assumed to be done. May need modification for checking click and drag spoiler loading. Removed the scene equivalence check from CheckChecks so that an entire area is checked each time to avoid issues with, e.g., leaving a shop before a pending sale finishes. * Changed check data creation to use RSKs from gRandomizer to account for settings loaded from drag and drop spoilers. * Beginning of tracker code organization. Changed check color defaults. * Reverted moving tracker colors to header. Some individual check fixes. * Missed something from previous merge? * Removed last remnant of removed performance mode. * Better handle checking when skullsanity is off. * Song checks sceneIDs don't match the scenes they're actually in for some reason. Removed that check. * SaleEnd checks don't need the GetItemEntry parameter. Also set a flag that should prevent the check tracker from running during vanilla saves should that not be resolved by the time it's merged. * Attempting to have only the relevant checks added to the tracker data, as well as showing vanilla checks for non-rando saves. Not working yet (everything is displayed in vanilla). * Added vanilla check tracker population via `vanillaCheck` bool in `RandomizerCheckObject`. This is also added to `IsVisibleInImGui` to handle file loading and saving to eliminate checks that aren't part of vanilla or the rando seed. Implemented deleted tracker data file recreation. Added some extra item name text checks. Songs are still... tricky, so they stay blank. Utilize local copies of the randomizer check objects that are applicable for performance purposes. Fixed vanilla item-giving cutscene crashes when triggered mid-transition. * Apparently not all toolchains can handle macro instantiation without all parameters, like VS can. * Fixed scummed detail color not showing properly on tracker. * Fixed dungeon area totals and GS checks not functioning properly. * Major revamp of checking code. Doesn't rely on `GetCheckFromActor` at all anymore, but instead simply sets a flag to evaluate a number of checks in an area every frame until the check that was gotten is identified. With the new setup, it's much less hardware intensive, and at 60fps 6 checks per frame shows no noticeable effect on framerate. I can envision needing to add a collectedCount in order to account for times when two checks are gotten one right after the other. Changed area scroll to happen from `OnTransitionEnd`, and allow for scrolling in bazaar (was disabled previously because it would jump back and forth between Kak and Market while you were in one). Also setup area check order updating by area instead of all at the same time. * Fixed shooting gallery not reporting proper area. Prevent checks from actually happening if area is RCAREA_INVALID, now that all areas are reporting something if they have checks. Fixed `GetCheckArea()` not updating checks for standard scenes. Lots of vanilla tracking updates, mainly manual checks for gems, medallions and songs, since the often don't have proper scenes in the data. Prevent vanilla from triggering check loops if junk items are collected. Fixed sorting based on saved vs collected. Prevent item name display for vanilla runs. Change coloring of checks so the check name reflects status in vanilla runs. * Fixed "Recheck Area" button erroneously adding to an area's check totals? * Fix DMC vanilla checks. * Fix check tracker data recreation on data file loss. Removed redundant file exists check from SaveTrackerDataHook, as it doesn't matter if it exists or not at that point. Limited check loops to 3 to avoid infinite check loops on non-check/junk item pickup. Added more checks to disable tracker operations if a save is not running. Changed check ordering to put boss reward and heart container checks at the end of whatever RCSHOW group they belong to. * Fixed IsRunning calculation. Further improving vanilla checking. Starting framework for checking medallions, stones, and songs on data file recreation. Fixed medallion check collection. Added GIFT_FROM_SAGES to check list for vanilla file for tracking light medallion. Added check loop limitation to prevent infinite checking after picking up junk item from the ground. * Finished vanilla file recreation and recheck (songs and dungeon rewards all check properly now). This includes deku shield with KF shop item 3. Finished Gift from Raoru light medallion tracking for vanilla. Commented all CheckByScene functionality for now. * Fixed new save data file creation. Disabled entrance area calculation for now, as it only tracks the previous entrance for some reason. Fixed area detection for ToT checks. * GetCheckArea() now utilizes EntranceData almost exclusively, via either `gSaveContext.entranceIndex` or the entrance tracker's `currentGrottoId` in the case of grottos. This also means that EVERYTHING CAN AUTOSCROLL NOW. Entrance shuffles are now much easier to track. Autoscroll is now also triggered on save, just in case someone isn't autosaving and has a lot of checks that get converted to saved. * Fixed missing GS check in LW. * Added area scroll on toggling Show Hidden Items. May configure differently later. Fixed area detection for entrances in Gerudo Fortress/Valley and Collossus. Haunted wasteland doesn't autoscroll due to a bug in `OnTransitionEnd` hook, but checks still evaluate properly there. Rely on scene-based area detection if scene is a main overworld or dungeon scene. * Fixed grotto detection when shuffle is off. * Small code cleanup. Fixed Colossus hand chest checks. * Missing lus bump from merge conflict resolution * Fixed Colossus Grotto making `GetCheckArea` return Wasteland. * Improved OnItemReceive processing for non-token GS checks, since they can sometimes take long enough for the checking process to time out before the item is registered as received. * First attempt at thread safety for tracker data file writing. Seems to work, but might need more testing. * Fixed Recheck Area not unskipping items that register as saved. Improved delayed saving with autosaving, as the autosave triggered quite often before the tracker data save, making things not properly register as saved. * merge cleanup * Converted check tracker data to the sectional saves, adding `CheckTrackerData` to `SaveContext`. Implemented section ID returning and fullSave boolean passing to section functions from my PR temporarily for it to work properly. Moved `RandomizerCheckTrackerData` enum to `randomizerTypes.h` to accommodate that. Changed `Randomizer_SaveInit` to a `SaveManager::InitFunc` to allow for other randomizer-dependent sections to be initialized after that. Required a little refactoring to maintain intro cutscene skip when starting a randomizer file. * Revert section index return and randomizer init changes. Will need to wait on yet more changes to main. * Fixed check tracker initialization (shouldn't be tied to window initialization), restored saving/loading functionality. * Removed `CheckTracker::Init` and put SaveManager calls in `CheckTrackerWindow::InitElement`. Also a bit of cleanup from transition back to save file use. * Fixed tracker displaying check categories while file not loaded. * Fix Darunia's Joy check not marking in vanilla. * Fix autosave not triggering change from collected to saved in tracker data. * Changed default colors for scummed and collected display. * Merge upgrade code cleanup. * Add `OnTransitionEnd` calls to sandstorm transitions both to and from Wasteland. Also improved `gSaveContext.lastScene` assignment for both transition types. Allowed a bit of cleanup in `GetCheckArea`. * Added `StateButton`, a button like `ArrowButton` but that allows text instead of arrow icons. Apparently the changes from ArrowButton to StateButton happened in a previous commit... * Changed section name to `trackerDataCheck` to force SoH to load it after the randomizer section, as it required some randoSettings to be loaded first, and nothing else I tried to make the randomizer section load before it worked. This hacks a solution to checks not displaying on fast file load to a specific slot. F*** you, SaveManager, and f*** you too, JSON. * Forgot to change the section string for loading with the name change. * Fix check ordering for checks that trigger the autosave. * Adds option to remove right-side shop items (slots 1-4) from the tracker list. Enabled by default. * Fix default state of Hide Shop Right Checks checkbox. * Fixes grotto and great fairy scrolling and checks. Fixes array overflow from `checkTrackerData` which was creating the issue trying to load the base and randomizer sections first, among other things. That also fixed the massive file loads that were being exhibited in debug mode. * Fix shooting galleries being set as collected again when being played a second time after getting the checks. * Fix Bazaar autoscroll. * Add Saria's Song to `GetCheckFromActor` and removed some limitations from the messageCloseCheck function to make that check track properly. * Fix Song from Impa check. Implemented prevention for multiple "collections" of great fairies, just in case getting the health refill would trigger it with the previous setup. * Fix ice traps on GS tokens not triggering OnItemReceive. * Complete fix for ice trap collection from GS. Add autoscroll when clicking "Expand All". * Add `OnShopSlotChange` with cursorSlot and basePrice parameters. * Fixed include in en_ossan for shop slot hook. Added registration for `OnShopSlotChange` in the tracker, storing the price in a new `price` field in `CheckTrackerData`. Added "seen" functionality to shop checks. Displays the model item name upon first entering a shop, adding the price and switching to trickName (if it's an ice trap) upon navigating to the slot in buy mode, triggered by an invisible "identified" status that mirrors "seen" in every other way. Added tooltips to most options for check tracker color picking to describe what each status actually means. * `std::format` pls * So apparently std::format just decided to break with the latest merge from develop, but fmt::format exists and works? * Removed the last vestiges of `locationsSkipped`. Other general code and formatting cleanups. Moved `IsGameRunning` to `OTRGlobals` so the item tracker could also access it. Used preceding to "fix" item and bottle display in the item tracker on startup. * Some more code cleanup. Removed "Recheck Area" button and relevant code. Backported changes to Anchor branch applicable for single-player, including making a checkAreas vector and structuring the frame by frame checks around that. Also includes fix for Silver Gauntlets and Mirror Shield check collection crash associated with those changes. Fixed Kakariko Bazaar "seen" updates. Fixed tracker window not showing on initial load like it should. * Forgot 1 formatting fix. * Removed conditions for showing Song from Impa (isn't junk under certain conditions, so should show all the time). * Fix vanilla checks, add Zelda's Letter and Malon's Egg to manual check collection. Fix autoscroll while in child stealth section. * Fix crash in Happy Mask Shop in OnSlotChange (referenced non-existent shop id in a tracker-specific enum). * General code cleanup. * Missed one reversion. * One more. * Fix column alignment in `randomizer_check_objects`. * Fix file encoding on `randomizer_check_tracker`. Again. * Fix indentation for `actualItemtrackerItemMap`. Also removed unnecessary parts of the map. * Rename `HasEqItem` to `HasEquipment`. * Slightly better indentation for `actualItemTrackerItemMap`. * Add magic bean salesman to vanilla check tracking, and genericized deku shield to trigger KF shop item 3 wherever you get the shield. Renamed `vanillaCheck` to `vanillaHundoCheck` to (supposedly) clarify the meaning of the usage. * One more rename to `vanillaCompletion` to avoid possible confusion with 100% speedrun conditions. * give me a break XD Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * Changes suggested by briaguya (rename `RandomizerCheckShow` to `Status`, unused code, newline formatting) * Remove unused `itemNames` table. * Remove `IsGameRunning` in favor of `GameInteractor::IsSaveLoaded`. * Restore anti-spoiler functionality for dungeons with dungeon maps. * Review cleanup. * Fix prices not showing for Kak bazaar items. --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com>
2023-10-04 11:03:36 -04:00
return Flags_GetRandomizerInf(OTRGlobals::Instance->gRandomizer->GetRandomizerInfFromCheck(rc));
case SpoilerCollectionCheckType::SPOILER_CHK_EVENT_CHK_INF:
return gSaveContext.eventChkInf[flag / 16] & (0x01 << flag % 16);
case SpoilerCollectionCheckType::SPOILER_CHK_GERUDO_MEMBERSHIP_CARD:
return CHECK_FLAG_ALL(gSaveContext.eventChkInf[0x09], 0x0F);
case SpoilerCollectionCheckType::SPOILER_CHK_GOLD_SKULLTULA:
return GET_GS_FLAGS(scene) & flag;
case SpoilerCollectionCheckType::SPOILER_CHK_INF_TABLE:
return gSaveContext.infTable[scene] & INDEX_TO_16BIT_LITTLE_ENDIAN_BITMASK(flag);
case SpoilerCollectionCheckType::SPOILER_CHK_ITEM_GET_INF:
return gSaveContext.itemGetInf[flag / 16] & INDEX_TO_16BIT_LITTLE_ENDIAN_BITMASK(flag);
case SpoilerCollectionCheckType::SPOILER_CHK_MAGIC_BEANS:
return BEANS_BOUGHT >= 10;
case SpoilerCollectionCheckType::SPOILER_CHK_NONE:
return false;
case SpoilerCollectionCheckType::SPOILER_CHK_GRAVEDIGGER:
// Gravedigger has a fix in place that means one of two save locations. Check both.
return (gSaveContext.itemGetInf[1] & 0x1000) || // vanilla flag
((IS_RANDO || CVarGetInteger("gGravediggingTourFix", 0)) &&
gSaveContext.sceneFlags[scene].collect & (1 << flag) || (gPlayState->actorCtx.flags.collect & (1 << flag))); // rando/fix flag
default:
return false;
}
return false;
}
void CheckTrackerLoadGame(int32_t fileNum) {
LoadSettings();
TrySetAreas();
for (auto [rc, rcObj] : RandomizerCheckObjects::GetAllRCObjects()) {
RandomizerCheckTrackerData rcTrackerData = gSaveContext.checkTrackerData[rc];
if (rc == RC_UNKNOWN_CHECK || rc == RC_MAX || rc == RC_LINKS_POCKET || !RandomizerCheckObjects::GetAllRCObjects().contains(rc)) {
continue;
}
RandomizerCheckObject realRcObj;
if (rc == RC_GIFT_FROM_SAGES && !IS_RANDO) {
realRcObj = RCO_RAORU;
} else {
realRcObj = rcObj;
}
checksByArea.find(realRcObj.rcArea)->second.push_back(realRcObj);
if (IsVisibleInCheckTracker(realRcObj)) {
areaCheckTotals[realRcObj.rcArea]++;
if (rcTrackerData.status == RCSHOW_COLLECTED || rcTrackerData.status == RCSHOW_SAVED || rcTrackerData.skipped) {
areaChecksGotten[realRcObj.rcArea]++;
}
}
if (areaChecksGotten[realRcObj.rcArea] != 0 || RandomizerCheckObjects::AreaIsOverworld(realRcObj.rcArea)) {
areasSpoiled |= (1 << realRcObj.rcArea);
}
}
if (OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_LINKS_POCKET) != RO_LINKS_POCKET_NOTHING && IS_RANDO) {
s8 startingAge = OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_STARTING_AGE);
RandomizerCheckArea startingArea;
switch (startingAge) {
case RO_AGE_CHILD:
startingArea = RCAREA_KOKIRI_FOREST;
break;
case RO_AGE_ADULT:
startingArea = RCAREA_MARKET;
break;
default:
startingArea = RCAREA_KOKIRI_FOREST;
break;
}
RandomizerCheckObject linksPocket = { RC_LINKS_POCKET, RCVORMQ_BOTH, RCTYPE_LINKS_POCKET, startingArea, ACTOR_ID_MAX, SCENE_ID_MAX, 0x00, GI_NONE, false, "Link's Pocket", "Link's Pocket" };
checksByArea.find(startingArea)->second.push_back(linksPocket);
areaChecksGotten[startingArea]++;
areaCheckTotals[startingArea]++;
}
showVOrMQ = (OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_RANDOM_MQ_DUNGEONS) == RO_MQ_DUNGEONS_RANDOM_NUMBER ||
(OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_RANDOM_MQ_DUNGEONS) == RO_MQ_DUNGEONS_SET_NUMBER &&
OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_MQ_DUNGEON_COUNT) < 12));
LinksPocket();
SongFromImpa();
GiftFromSages();
initialized = true;
UpdateAllOrdering();
UpdateInventoryChecks();
}
Check Tracker Update (#2668) * Initial commit. What works so far: Data file loads, saves, deletes, and is created properly. - Need to run `HasItemBeenCollected` when creating in case of mid-seed regen. Organized checks into maps set by area. Areas show in tracker. - Checks pulled from checkObjectsByArea are not currently listed. - Areas are being assumed completed and hidden at the start. * Checks now populate. Still not counting area totals properly. * Don't track RC_LINKS_POCKET in the data file, and instead manually add it in every time a save is load. rcObjects doesn't contain Link's Pocket location (duh). * Moved ItemReceive hook to randomizer_check_tracker.cpp. Skipped items are properly sorted and formatted. Saved items contribute to an area's gotten/skipped checks on load. Changed skipped items default main color to gray. General code cleanup. * Skipped checks now contribute to area totals for area completion logic. * Mid-menu rework transfer. * Started check lookup on item receive. Tried to enable scum checking on save. * Fixed scum check on save. * More code cleanup, which revealed some issues with loading and saving. Loading now works 100%, but entries in checkTrackerData are disappearing in code somewhere, causing issues with later checks. Scummed color now displays properly. Collected but unsaved displays properly. Unchecked, Skipped, Seen and Scummed checks all have arrows for skipping/unskipping. Counts a little messed up, probably double adding skips. * Fixed item counts being off across resets. Restarts were fine. * Beginning of rework for individual check updates. Adds `Actor lastCheck` to PlayState to allow assigning of last actor to give an item. This allows precise tracking of GS, freestanding PoH, etc. Works for chests too. Currently does not work for shops, unknown for normal NPC gives. Doesn't track last gives for non-checks, like drops from grass, pots, crates, etc. * Actor-based checks fully fleshed out, but can't help with sale-based checks. Implemented `pendingSaleCheck` to back out of an RC check cycle if `gSaveContext->pendingSale` is not NONE when `OnItemReceive` is called, processed through `OnSaleEnd`. This should be the final change necessary to streamline the checks. * Temporary hook to message box close to tie in trackers for non-gs/chest actors that aren't added to `GetCheckFromActor`. This triggers a 2-frame countdown to check with `HasItemBeenCollected` since half of the methods in there aren't updated until after a text box closes. Added scene tracking to get last scene so that checks in scenes that span several overworld areas could be tied to their areas properly. Modified tracker data creation to apply Link's Pocket and Song from Impa conditionally based on randomizer settings instead of just being assumed to be done. May need modification for checking click and drag spoiler loading. Removed the scene equivalence check from CheckChecks so that an entire area is checked each time to avoid issues with, e.g., leaving a shop before a pending sale finishes. * Changed check data creation to use RSKs from gRandomizer to account for settings loaded from drag and drop spoilers. * Beginning of tracker code organization. Changed check color defaults. * Reverted moving tracker colors to header. Some individual check fixes. * Missed something from previous merge? * Removed last remnant of removed performance mode. * Better handle checking when skullsanity is off. * Song checks sceneIDs don't match the scenes they're actually in for some reason. Removed that check. * SaleEnd checks don't need the GetItemEntry parameter. Also set a flag that should prevent the check tracker from running during vanilla saves should that not be resolved by the time it's merged. * Attempting to have only the relevant checks added to the tracker data, as well as showing vanilla checks for non-rando saves. Not working yet (everything is displayed in vanilla). * Added vanilla check tracker population via `vanillaCheck` bool in `RandomizerCheckObject`. This is also added to `IsVisibleInImGui` to handle file loading and saving to eliminate checks that aren't part of vanilla or the rando seed. Implemented deleted tracker data file recreation. Added some extra item name text checks. Songs are still... tricky, so they stay blank. Utilize local copies of the randomizer check objects that are applicable for performance purposes. Fixed vanilla item-giving cutscene crashes when triggered mid-transition. * Apparently not all toolchains can handle macro instantiation without all parameters, like VS can. * Fixed scummed detail color not showing properly on tracker. * Fixed dungeon area totals and GS checks not functioning properly. * Major revamp of checking code. Doesn't rely on `GetCheckFromActor` at all anymore, but instead simply sets a flag to evaluate a number of checks in an area every frame until the check that was gotten is identified. With the new setup, it's much less hardware intensive, and at 60fps 6 checks per frame shows no noticeable effect on framerate. I can envision needing to add a collectedCount in order to account for times when two checks are gotten one right after the other. Changed area scroll to happen from `OnTransitionEnd`, and allow for scrolling in bazaar (was disabled previously because it would jump back and forth between Kak and Market while you were in one). Also setup area check order updating by area instead of all at the same time. * Fixed shooting gallery not reporting proper area. Prevent checks from actually happening if area is RCAREA_INVALID, now that all areas are reporting something if they have checks. Fixed `GetCheckArea()` not updating checks for standard scenes. Lots of vanilla tracking updates, mainly manual checks for gems, medallions and songs, since the often don't have proper scenes in the data. Prevent vanilla from triggering check loops if junk items are collected. Fixed sorting based on saved vs collected. Prevent item name display for vanilla runs. Change coloring of checks so the check name reflects status in vanilla runs. * Fixed "Recheck Area" button erroneously adding to an area's check totals? * Fix DMC vanilla checks. * Fix check tracker data recreation on data file loss. Removed redundant file exists check from SaveTrackerDataHook, as it doesn't matter if it exists or not at that point. Limited check loops to 3 to avoid infinite check loops on non-check/junk item pickup. Added more checks to disable tracker operations if a save is not running. Changed check ordering to put boss reward and heart container checks at the end of whatever RCSHOW group they belong to. * Fixed IsRunning calculation. Further improving vanilla checking. Starting framework for checking medallions, stones, and songs on data file recreation. Fixed medallion check collection. Added GIFT_FROM_SAGES to check list for vanilla file for tracking light medallion. Added check loop limitation to prevent infinite checking after picking up junk item from the ground. * Finished vanilla file recreation and recheck (songs and dungeon rewards all check properly now). This includes deku shield with KF shop item 3. Finished Gift from Raoru light medallion tracking for vanilla. Commented all CheckByScene functionality for now. * Fixed new save data file creation. Disabled entrance area calculation for now, as it only tracks the previous entrance for some reason. Fixed area detection for ToT checks. * GetCheckArea() now utilizes EntranceData almost exclusively, via either `gSaveContext.entranceIndex` or the entrance tracker's `currentGrottoId` in the case of grottos. This also means that EVERYTHING CAN AUTOSCROLL NOW. Entrance shuffles are now much easier to track. Autoscroll is now also triggered on save, just in case someone isn't autosaving and has a lot of checks that get converted to saved. * Fixed missing GS check in LW. * Added area scroll on toggling Show Hidden Items. May configure differently later. Fixed area detection for entrances in Gerudo Fortress/Valley and Collossus. Haunted wasteland doesn't autoscroll due to a bug in `OnTransitionEnd` hook, but checks still evaluate properly there. Rely on scene-based area detection if scene is a main overworld or dungeon scene. * Fixed grotto detection when shuffle is off. * Small code cleanup. Fixed Colossus hand chest checks. * Missing lus bump from merge conflict resolution * Fixed Colossus Grotto making `GetCheckArea` return Wasteland. * Improved OnItemReceive processing for non-token GS checks, since they can sometimes take long enough for the checking process to time out before the item is registered as received. * First attempt at thread safety for tracker data file writing. Seems to work, but might need more testing. * Fixed Recheck Area not unskipping items that register as saved. Improved delayed saving with autosaving, as the autosave triggered quite often before the tracker data save, making things not properly register as saved. * merge cleanup * Converted check tracker data to the sectional saves, adding `CheckTrackerData` to `SaveContext`. Implemented section ID returning and fullSave boolean passing to section functions from my PR temporarily for it to work properly. Moved `RandomizerCheckTrackerData` enum to `randomizerTypes.h` to accommodate that. Changed `Randomizer_SaveInit` to a `SaveManager::InitFunc` to allow for other randomizer-dependent sections to be initialized after that. Required a little refactoring to maintain intro cutscene skip when starting a randomizer file. * Revert section index return and randomizer init changes. Will need to wait on yet more changes to main. * Fixed check tracker initialization (shouldn't be tied to window initialization), restored saving/loading functionality. * Removed `CheckTracker::Init` and put SaveManager calls in `CheckTrackerWindow::InitElement`. Also a bit of cleanup from transition back to save file use. * Fixed tracker displaying check categories while file not loaded. * Fix Darunia's Joy check not marking in vanilla. * Fix autosave not triggering change from collected to saved in tracker data. * Changed default colors for scummed and collected display. * Merge upgrade code cleanup. * Add `OnTransitionEnd` calls to sandstorm transitions both to and from Wasteland. Also improved `gSaveContext.lastScene` assignment for both transition types. Allowed a bit of cleanup in `GetCheckArea`. * Added `StateButton`, a button like `ArrowButton` but that allows text instead of arrow icons. Apparently the changes from ArrowButton to StateButton happened in a previous commit... * Changed section name to `trackerDataCheck` to force SoH to load it after the randomizer section, as it required some randoSettings to be loaded first, and nothing else I tried to make the randomizer section load before it worked. This hacks a solution to checks not displaying on fast file load to a specific slot. F*** you, SaveManager, and f*** you too, JSON. * Forgot to change the section string for loading with the name change. * Fix check ordering for checks that trigger the autosave. * Adds option to remove right-side shop items (slots 1-4) from the tracker list. Enabled by default. * Fix default state of Hide Shop Right Checks checkbox. * Fixes grotto and great fairy scrolling and checks. Fixes array overflow from `checkTrackerData` which was creating the issue trying to load the base and randomizer sections first, among other things. That also fixed the massive file loads that were being exhibited in debug mode. * Fix shooting galleries being set as collected again when being played a second time after getting the checks. * Fix Bazaar autoscroll. * Add Saria's Song to `GetCheckFromActor` and removed some limitations from the messageCloseCheck function to make that check track properly. * Fix Song from Impa check. Implemented prevention for multiple "collections" of great fairies, just in case getting the health refill would trigger it with the previous setup. * Fix ice traps on GS tokens not triggering OnItemReceive. * Complete fix for ice trap collection from GS. Add autoscroll when clicking "Expand All". * Add `OnShopSlotChange` with cursorSlot and basePrice parameters. * Fixed include in en_ossan for shop slot hook. Added registration for `OnShopSlotChange` in the tracker, storing the price in a new `price` field in `CheckTrackerData`. Added "seen" functionality to shop checks. Displays the model item name upon first entering a shop, adding the price and switching to trickName (if it's an ice trap) upon navigating to the slot in buy mode, triggered by an invisible "identified" status that mirrors "seen" in every other way. Added tooltips to most options for check tracker color picking to describe what each status actually means. * `std::format` pls * So apparently std::format just decided to break with the latest merge from develop, but fmt::format exists and works? * Removed the last vestiges of `locationsSkipped`. Other general code and formatting cleanups. Moved `IsGameRunning` to `OTRGlobals` so the item tracker could also access it. Used preceding to "fix" item and bottle display in the item tracker on startup. * Some more code cleanup. Removed "Recheck Area" button and relevant code. Backported changes to Anchor branch applicable for single-player, including making a checkAreas vector and structuring the frame by frame checks around that. Also includes fix for Silver Gauntlets and Mirror Shield check collection crash associated with those changes. Fixed Kakariko Bazaar "seen" updates. Fixed tracker window not showing on initial load like it should. * Forgot 1 formatting fix. * Removed conditions for showing Song from Impa (isn't junk under certain conditions, so should show all the time). * Fix vanilla checks, add Zelda's Letter and Malon's Egg to manual check collection. Fix autoscroll while in child stealth section. * Fix crash in Happy Mask Shop in OnSlotChange (referenced non-existent shop id in a tracker-specific enum). * General code cleanup. * Missed one reversion. * One more. * Fix column alignment in `randomizer_check_objects`. * Fix file encoding on `randomizer_check_tracker`. Again. * Fix indentation for `actualItemtrackerItemMap`. Also removed unnecessary parts of the map. * Rename `HasEqItem` to `HasEquipment`. * Slightly better indentation for `actualItemTrackerItemMap`. * Add magic bean salesman to vanilla check tracking, and genericized deku shield to trigger KF shop item 3 wherever you get the shield. Renamed `vanillaCheck` to `vanillaHundoCheck` to (supposedly) clarify the meaning of the usage. * One more rename to `vanillaCompletion` to avoid possible confusion with 100% speedrun conditions. * give me a break XD Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * Changes suggested by briaguya (rename `RandomizerCheckShow` to `Status`, unused code, newline formatting) * Remove unused `itemNames` table. * Remove `IsGameRunning` in favor of `GameInteractor::IsSaveLoaded`. * Restore anti-spoiler functionality for dungeons with dungeon maps. * Review cleanup. * Fix prices not showing for Kak bazaar items. --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com>
2023-10-04 11:03:36 -04:00
void CheckTrackerShopSlotChange(uint8_t cursorSlot, int16_t basePrice) {
if (gPlayState->sceneNum == SCENE_HAPPY_MASK_SHOP) { // Happy Mask Shop is not used in rando, so is not tracked
return;
}
auto slot = startingShopItem.find(gPlayState->sceneNum)->second + cursorSlot;
if (GetCheckArea() == RCAREA_KAKARIKO_VILLAGE && gPlayState->sceneNum == SCENE_BAZAAR) {
slot = RC_KAK_BAZAAR_ITEM_1 + cursorSlot;
}
auto status = gSaveContext.checkTrackerData[slot].status;
if (status == RCSHOW_SEEN) {
gSaveContext.checkTrackerData[slot].status = RCSHOW_IDENTIFIED;
gSaveContext.checkTrackerData[slot].price = basePrice;
SaveManager::Instance->SaveSection(gSaveContext.fileNum, sectionId, true);
}
}
void CheckTrackerTransition(uint32_t sceneNum) {
if (!GameInteractor::IsSaveLoaded()) {
return;
}
doAreaScroll = true;
previousArea = currentArea;
currentArea = GetCheckArea();
switch (sceneNum) {
case SCENE_KOKIRI_SHOP:
case SCENE_BAZAAR:
case SCENE_POTION_SHOP_MARKET:
case SCENE_BOMBCHU_SHOP:
case SCENE_POTION_SHOP_KAKARIKO:
case SCENE_GORON_SHOP:
case SCENE_ZORA_SHOP:
SetShopSeen(sceneNum, false);
break;
}
}
void CheckTrackerFrame() {
if (!GameInteractor::IsSaveLoaded()) {
return;
}
Flag tracker (#3447) * Hook into flagset hooks for processing check tracking. Has some manual workarounds (some breaks still need to be found). Remove areaChecks and looping functionality as redundant. * Additional vanilla handling. * Fix tracker not showing MQ checks in MQ non-rando. Fix tracker marking non-MQ variants of dungeon checks (e.g. map chest, etc) when collecting in MQ. * Set all areas to spoiled if not rando. * Revert attempt to spoil in randomizer based on MQ dungeon count as I don't know how that works at the moment. * Restore and update spoiling based on MQ dungeon settings (none, selection, or count of 12). Fix Anju As Adult check. * Remove Anchor-specific code :baguette: * Use `ClearAreaTotals()` in `Teardown()` instead of the duplicate code there. * Update to `ClearAreaChecksAndTotals()` with `vec.clear()` added. * Fix type spoiling again. Now spoils on 0 MQ dungeons, not rando, if the option is enabled in check tracker settings, selection, or set number of 12. Fix vanilla checks being marked collected in MQ dungeons. * Fix 100 GS check. * ACTUALLY fix 100 GS: change flag type to `RandomizerInf()` in `item_location.cpp`, add RC to RandoInf for it to the table. Also don't send GI for flag if father, falsely triggers ZR frogs minigame. * Fix gravedigging tour tracking. * Fix membership card check tracking. Change scene and flag values to any existing enums. Clarifying formatting for the checking loop vOrMQ conditions. * Fix Gravedigging Tour tracking. Simplify Always Win Gravedigging Tour and Fix Gravedigging Tour Glitch applications. Modified all necessary paths to use vanilla GDT PoH collection flag instead of randomizer variant. * Fix Kak Potion Shop being "seen" when entering as child.
2023-11-28 21:25:48 -05:00
// TODO: Move to OnAmmoChange hook once it gets added.
if (gSaveContext.checkTrackerData[RC_ZR_MAGIC_BEAN_SALESMAN].status != RCSHOW_COLLECTED &&
gSaveContext.checkTrackerData[RC_ZR_MAGIC_BEAN_SALESMAN].status != RCSHOW_SAVED) {
if (BEANS_BOUGHT >= 10) {
SetCheckCollected(RC_ZR_MAGIC_BEAN_SALESMAN);
Check Tracker Update (#2668) * Initial commit. What works so far: Data file loads, saves, deletes, and is created properly. - Need to run `HasItemBeenCollected` when creating in case of mid-seed regen. Organized checks into maps set by area. Areas show in tracker. - Checks pulled from checkObjectsByArea are not currently listed. - Areas are being assumed completed and hidden at the start. * Checks now populate. Still not counting area totals properly. * Don't track RC_LINKS_POCKET in the data file, and instead manually add it in every time a save is load. rcObjects doesn't contain Link's Pocket location (duh). * Moved ItemReceive hook to randomizer_check_tracker.cpp. Skipped items are properly sorted and formatted. Saved items contribute to an area's gotten/skipped checks on load. Changed skipped items default main color to gray. General code cleanup. * Skipped checks now contribute to area totals for area completion logic. * Mid-menu rework transfer. * Started check lookup on item receive. Tried to enable scum checking on save. * Fixed scum check on save. * More code cleanup, which revealed some issues with loading and saving. Loading now works 100%, but entries in checkTrackerData are disappearing in code somewhere, causing issues with later checks. Scummed color now displays properly. Collected but unsaved displays properly. Unchecked, Skipped, Seen and Scummed checks all have arrows for skipping/unskipping. Counts a little messed up, probably double adding skips. * Fixed item counts being off across resets. Restarts were fine. * Beginning of rework for individual check updates. Adds `Actor lastCheck` to PlayState to allow assigning of last actor to give an item. This allows precise tracking of GS, freestanding PoH, etc. Works for chests too. Currently does not work for shops, unknown for normal NPC gives. Doesn't track last gives for non-checks, like drops from grass, pots, crates, etc. * Actor-based checks fully fleshed out, but can't help with sale-based checks. Implemented `pendingSaleCheck` to back out of an RC check cycle if `gSaveContext->pendingSale` is not NONE when `OnItemReceive` is called, processed through `OnSaleEnd`. This should be the final change necessary to streamline the checks. * Temporary hook to message box close to tie in trackers for non-gs/chest actors that aren't added to `GetCheckFromActor`. This triggers a 2-frame countdown to check with `HasItemBeenCollected` since half of the methods in there aren't updated until after a text box closes. Added scene tracking to get last scene so that checks in scenes that span several overworld areas could be tied to their areas properly. Modified tracker data creation to apply Link's Pocket and Song from Impa conditionally based on randomizer settings instead of just being assumed to be done. May need modification for checking click and drag spoiler loading. Removed the scene equivalence check from CheckChecks so that an entire area is checked each time to avoid issues with, e.g., leaving a shop before a pending sale finishes. * Changed check data creation to use RSKs from gRandomizer to account for settings loaded from drag and drop spoilers. * Beginning of tracker code organization. Changed check color defaults. * Reverted moving tracker colors to header. Some individual check fixes. * Missed something from previous merge? * Removed last remnant of removed performance mode. * Better handle checking when skullsanity is off. * Song checks sceneIDs don't match the scenes they're actually in for some reason. Removed that check. * SaleEnd checks don't need the GetItemEntry parameter. Also set a flag that should prevent the check tracker from running during vanilla saves should that not be resolved by the time it's merged. * Attempting to have only the relevant checks added to the tracker data, as well as showing vanilla checks for non-rando saves. Not working yet (everything is displayed in vanilla). * Added vanilla check tracker population via `vanillaCheck` bool in `RandomizerCheckObject`. This is also added to `IsVisibleInImGui` to handle file loading and saving to eliminate checks that aren't part of vanilla or the rando seed. Implemented deleted tracker data file recreation. Added some extra item name text checks. Songs are still... tricky, so they stay blank. Utilize local copies of the randomizer check objects that are applicable for performance purposes. Fixed vanilla item-giving cutscene crashes when triggered mid-transition. * Apparently not all toolchains can handle macro instantiation without all parameters, like VS can. * Fixed scummed detail color not showing properly on tracker. * Fixed dungeon area totals and GS checks not functioning properly. * Major revamp of checking code. Doesn't rely on `GetCheckFromActor` at all anymore, but instead simply sets a flag to evaluate a number of checks in an area every frame until the check that was gotten is identified. With the new setup, it's much less hardware intensive, and at 60fps 6 checks per frame shows no noticeable effect on framerate. I can envision needing to add a collectedCount in order to account for times when two checks are gotten one right after the other. Changed area scroll to happen from `OnTransitionEnd`, and allow for scrolling in bazaar (was disabled previously because it would jump back and forth between Kak and Market while you were in one). Also setup area check order updating by area instead of all at the same time. * Fixed shooting gallery not reporting proper area. Prevent checks from actually happening if area is RCAREA_INVALID, now that all areas are reporting something if they have checks. Fixed `GetCheckArea()` not updating checks for standard scenes. Lots of vanilla tracking updates, mainly manual checks for gems, medallions and songs, since the often don't have proper scenes in the data. Prevent vanilla from triggering check loops if junk items are collected. Fixed sorting based on saved vs collected. Prevent item name display for vanilla runs. Change coloring of checks so the check name reflects status in vanilla runs. * Fixed "Recheck Area" button erroneously adding to an area's check totals? * Fix DMC vanilla checks. * Fix check tracker data recreation on data file loss. Removed redundant file exists check from SaveTrackerDataHook, as it doesn't matter if it exists or not at that point. Limited check loops to 3 to avoid infinite check loops on non-check/junk item pickup. Added more checks to disable tracker operations if a save is not running. Changed check ordering to put boss reward and heart container checks at the end of whatever RCSHOW group they belong to. * Fixed IsRunning calculation. Further improving vanilla checking. Starting framework for checking medallions, stones, and songs on data file recreation. Fixed medallion check collection. Added GIFT_FROM_SAGES to check list for vanilla file for tracking light medallion. Added check loop limitation to prevent infinite checking after picking up junk item from the ground. * Finished vanilla file recreation and recheck (songs and dungeon rewards all check properly now). This includes deku shield with KF shop item 3. Finished Gift from Raoru light medallion tracking for vanilla. Commented all CheckByScene functionality for now. * Fixed new save data file creation. Disabled entrance area calculation for now, as it only tracks the previous entrance for some reason. Fixed area detection for ToT checks. * GetCheckArea() now utilizes EntranceData almost exclusively, via either `gSaveContext.entranceIndex` or the entrance tracker's `currentGrottoId` in the case of grottos. This also means that EVERYTHING CAN AUTOSCROLL NOW. Entrance shuffles are now much easier to track. Autoscroll is now also triggered on save, just in case someone isn't autosaving and has a lot of checks that get converted to saved. * Fixed missing GS check in LW. * Added area scroll on toggling Show Hidden Items. May configure differently later. Fixed area detection for entrances in Gerudo Fortress/Valley and Collossus. Haunted wasteland doesn't autoscroll due to a bug in `OnTransitionEnd` hook, but checks still evaluate properly there. Rely on scene-based area detection if scene is a main overworld or dungeon scene. * Fixed grotto detection when shuffle is off. * Small code cleanup. Fixed Colossus hand chest checks. * Missing lus bump from merge conflict resolution * Fixed Colossus Grotto making `GetCheckArea` return Wasteland. * Improved OnItemReceive processing for non-token GS checks, since they can sometimes take long enough for the checking process to time out before the item is registered as received. * First attempt at thread safety for tracker data file writing. Seems to work, but might need more testing. * Fixed Recheck Area not unskipping items that register as saved. Improved delayed saving with autosaving, as the autosave triggered quite often before the tracker data save, making things not properly register as saved. * merge cleanup * Converted check tracker data to the sectional saves, adding `CheckTrackerData` to `SaveContext`. Implemented section ID returning and fullSave boolean passing to section functions from my PR temporarily for it to work properly. Moved `RandomizerCheckTrackerData` enum to `randomizerTypes.h` to accommodate that. Changed `Randomizer_SaveInit` to a `SaveManager::InitFunc` to allow for other randomizer-dependent sections to be initialized after that. Required a little refactoring to maintain intro cutscene skip when starting a randomizer file. * Revert section index return and randomizer init changes. Will need to wait on yet more changes to main. * Fixed check tracker initialization (shouldn't be tied to window initialization), restored saving/loading functionality. * Removed `CheckTracker::Init` and put SaveManager calls in `CheckTrackerWindow::InitElement`. Also a bit of cleanup from transition back to save file use. * Fixed tracker displaying check categories while file not loaded. * Fix Darunia's Joy check not marking in vanilla. * Fix autosave not triggering change from collected to saved in tracker data. * Changed default colors for scummed and collected display. * Merge upgrade code cleanup. * Add `OnTransitionEnd` calls to sandstorm transitions both to and from Wasteland. Also improved `gSaveContext.lastScene` assignment for both transition types. Allowed a bit of cleanup in `GetCheckArea`. * Added `StateButton`, a button like `ArrowButton` but that allows text instead of arrow icons. Apparently the changes from ArrowButton to StateButton happened in a previous commit... * Changed section name to `trackerDataCheck` to force SoH to load it after the randomizer section, as it required some randoSettings to be loaded first, and nothing else I tried to make the randomizer section load before it worked. This hacks a solution to checks not displaying on fast file load to a specific slot. F*** you, SaveManager, and f*** you too, JSON. * Forgot to change the section string for loading with the name change. * Fix check ordering for checks that trigger the autosave. * Adds option to remove right-side shop items (slots 1-4) from the tracker list. Enabled by default. * Fix default state of Hide Shop Right Checks checkbox. * Fixes grotto and great fairy scrolling and checks. Fixes array overflow from `checkTrackerData` which was creating the issue trying to load the base and randomizer sections first, among other things. That also fixed the massive file loads that were being exhibited in debug mode. * Fix shooting galleries being set as collected again when being played a second time after getting the checks. * Fix Bazaar autoscroll. * Add Saria's Song to `GetCheckFromActor` and removed some limitations from the messageCloseCheck function to make that check track properly. * Fix Song from Impa check. Implemented prevention for multiple "collections" of great fairies, just in case getting the health refill would trigger it with the previous setup. * Fix ice traps on GS tokens not triggering OnItemReceive. * Complete fix for ice trap collection from GS. Add autoscroll when clicking "Expand All". * Add `OnShopSlotChange` with cursorSlot and basePrice parameters. * Fixed include in en_ossan for shop slot hook. Added registration for `OnShopSlotChange` in the tracker, storing the price in a new `price` field in `CheckTrackerData`. Added "seen" functionality to shop checks. Displays the model item name upon first entering a shop, adding the price and switching to trickName (if it's an ice trap) upon navigating to the slot in buy mode, triggered by an invisible "identified" status that mirrors "seen" in every other way. Added tooltips to most options for check tracker color picking to describe what each status actually means. * `std::format` pls * So apparently std::format just decided to break with the latest merge from develop, but fmt::format exists and works? * Removed the last vestiges of `locationsSkipped`. Other general code and formatting cleanups. Moved `IsGameRunning` to `OTRGlobals` so the item tracker could also access it. Used preceding to "fix" item and bottle display in the item tracker on startup. * Some more code cleanup. Removed "Recheck Area" button and relevant code. Backported changes to Anchor branch applicable for single-player, including making a checkAreas vector and structuring the frame by frame checks around that. Also includes fix for Silver Gauntlets and Mirror Shield check collection crash associated with those changes. Fixed Kakariko Bazaar "seen" updates. Fixed tracker window not showing on initial load like it should. * Forgot 1 formatting fix. * Removed conditions for showing Song from Impa (isn't junk under certain conditions, so should show all the time). * Fix vanilla checks, add Zelda's Letter and Malon's Egg to manual check collection. Fix autoscroll while in child stealth section. * Fix crash in Happy Mask Shop in OnSlotChange (referenced non-existent shop id in a tracker-specific enum). * General code cleanup. * Missed one reversion. * One more. * Fix column alignment in `randomizer_check_objects`. * Fix file encoding on `randomizer_check_tracker`. Again. * Fix indentation for `actualItemtrackerItemMap`. Also removed unnecessary parts of the map. * Rename `HasEqItem` to `HasEquipment`. * Slightly better indentation for `actualItemTrackerItemMap`. * Add magic bean salesman to vanilla check tracking, and genericized deku shield to trigger KF shop item 3 wherever you get the shield. Renamed `vanillaCheck` to `vanillaHundoCheck` to (supposedly) clarify the meaning of the usage. * One more rename to `vanillaCompletion` to avoid possible confusion with 100% speedrun conditions. * give me a break XD Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * Changes suggested by briaguya (rename `RandomizerCheckShow` to `Status`, unused code, newline formatting) * Remove unused `itemNames` table. * Remove `IsGameRunning` in favor of `GameInteractor::IsSaveLoaded`. * Restore anti-spoiler functionality for dungeons with dungeon maps. * Review cleanup. * Fix prices not showing for Kak bazaar items. --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com>
2023-10-04 11:03:36 -04:00
}
}
}
void CheckTrackerItemReceive(GetItemEntry giEntry) {
if (!GameInteractor::IsSaveLoaded() || vector_contains_scene(skipScenes, gPlayState->sceneNum)) {
return;
}
auto scene = static_cast<SceneID>(gPlayState->sceneNum);
// Vanilla special item checks
if (!IS_RANDO) {
if (giEntry.itemId == ITEM_SHIELD_DEKU) {
Flag tracker (#3447) * Hook into flagset hooks for processing check tracking. Has some manual workarounds (some breaks still need to be found). Remove areaChecks and looping functionality as redundant. * Additional vanilla handling. * Fix tracker not showing MQ checks in MQ non-rando. Fix tracker marking non-MQ variants of dungeon checks (e.g. map chest, etc) when collecting in MQ. * Set all areas to spoiled if not rando. * Revert attempt to spoil in randomizer based on MQ dungeon count as I don't know how that works at the moment. * Restore and update spoiling based on MQ dungeon settings (none, selection, or count of 12). Fix Anju As Adult check. * Remove Anchor-specific code :baguette: * Use `ClearAreaTotals()` in `Teardown()` instead of the duplicate code there. * Update to `ClearAreaChecksAndTotals()` with `vec.clear()` added. * Fix type spoiling again. Now spoils on 0 MQ dungeons, not rando, if the option is enabled in check tracker settings, selection, or set number of 12. Fix vanilla checks being marked collected in MQ dungeons. * Fix 100 GS check. * ACTUALLY fix 100 GS: change flag type to `RandomizerInf()` in `item_location.cpp`, add RC to RandoInf for it to the table. Also don't send GI for flag if father, falsely triggers ZR frogs minigame. * Fix gravedigging tour tracking. * Fix membership card check tracking. Change scene and flag values to any existing enums. Clarifying formatting for the checking loop vOrMQ conditions. * Fix Gravedigging Tour tracking. Simplify Always Win Gravedigging Tour and Fix Gravedigging Tour Glitch applications. Modified all necessary paths to use vanilla GDT PoH collection flag instead of randomizer variant. * Fix Kak Potion Shop being "seen" when entering as child.
2023-11-28 21:25:48 -05:00
SetCheckCollected(RC_KF_SHOP_ITEM_1);
Check Tracker Update (#2668) * Initial commit. What works so far: Data file loads, saves, deletes, and is created properly. - Need to run `HasItemBeenCollected` when creating in case of mid-seed regen. Organized checks into maps set by area. Areas show in tracker. - Checks pulled from checkObjectsByArea are not currently listed. - Areas are being assumed completed and hidden at the start. * Checks now populate. Still not counting area totals properly. * Don't track RC_LINKS_POCKET in the data file, and instead manually add it in every time a save is load. rcObjects doesn't contain Link's Pocket location (duh). * Moved ItemReceive hook to randomizer_check_tracker.cpp. Skipped items are properly sorted and formatted. Saved items contribute to an area's gotten/skipped checks on load. Changed skipped items default main color to gray. General code cleanup. * Skipped checks now contribute to area totals for area completion logic. * Mid-menu rework transfer. * Started check lookup on item receive. Tried to enable scum checking on save. * Fixed scum check on save. * More code cleanup, which revealed some issues with loading and saving. Loading now works 100%, but entries in checkTrackerData are disappearing in code somewhere, causing issues with later checks. Scummed color now displays properly. Collected but unsaved displays properly. Unchecked, Skipped, Seen and Scummed checks all have arrows for skipping/unskipping. Counts a little messed up, probably double adding skips. * Fixed item counts being off across resets. Restarts were fine. * Beginning of rework for individual check updates. Adds `Actor lastCheck` to PlayState to allow assigning of last actor to give an item. This allows precise tracking of GS, freestanding PoH, etc. Works for chests too. Currently does not work for shops, unknown for normal NPC gives. Doesn't track last gives for non-checks, like drops from grass, pots, crates, etc. * Actor-based checks fully fleshed out, but can't help with sale-based checks. Implemented `pendingSaleCheck` to back out of an RC check cycle if `gSaveContext->pendingSale` is not NONE when `OnItemReceive` is called, processed through `OnSaleEnd`. This should be the final change necessary to streamline the checks. * Temporary hook to message box close to tie in trackers for non-gs/chest actors that aren't added to `GetCheckFromActor`. This triggers a 2-frame countdown to check with `HasItemBeenCollected` since half of the methods in there aren't updated until after a text box closes. Added scene tracking to get last scene so that checks in scenes that span several overworld areas could be tied to their areas properly. Modified tracker data creation to apply Link's Pocket and Song from Impa conditionally based on randomizer settings instead of just being assumed to be done. May need modification for checking click and drag spoiler loading. Removed the scene equivalence check from CheckChecks so that an entire area is checked each time to avoid issues with, e.g., leaving a shop before a pending sale finishes. * Changed check data creation to use RSKs from gRandomizer to account for settings loaded from drag and drop spoilers. * Beginning of tracker code organization. Changed check color defaults. * Reverted moving tracker colors to header. Some individual check fixes. * Missed something from previous merge? * Removed last remnant of removed performance mode. * Better handle checking when skullsanity is off. * Song checks sceneIDs don't match the scenes they're actually in for some reason. Removed that check. * SaleEnd checks don't need the GetItemEntry parameter. Also set a flag that should prevent the check tracker from running during vanilla saves should that not be resolved by the time it's merged. * Attempting to have only the relevant checks added to the tracker data, as well as showing vanilla checks for non-rando saves. Not working yet (everything is displayed in vanilla). * Added vanilla check tracker population via `vanillaCheck` bool in `RandomizerCheckObject`. This is also added to `IsVisibleInImGui` to handle file loading and saving to eliminate checks that aren't part of vanilla or the rando seed. Implemented deleted tracker data file recreation. Added some extra item name text checks. Songs are still... tricky, so they stay blank. Utilize local copies of the randomizer check objects that are applicable for performance purposes. Fixed vanilla item-giving cutscene crashes when triggered mid-transition. * Apparently not all toolchains can handle macro instantiation without all parameters, like VS can. * Fixed scummed detail color not showing properly on tracker. * Fixed dungeon area totals and GS checks not functioning properly. * Major revamp of checking code. Doesn't rely on `GetCheckFromActor` at all anymore, but instead simply sets a flag to evaluate a number of checks in an area every frame until the check that was gotten is identified. With the new setup, it's much less hardware intensive, and at 60fps 6 checks per frame shows no noticeable effect on framerate. I can envision needing to add a collectedCount in order to account for times when two checks are gotten one right after the other. Changed area scroll to happen from `OnTransitionEnd`, and allow for scrolling in bazaar (was disabled previously because it would jump back and forth between Kak and Market while you were in one). Also setup area check order updating by area instead of all at the same time. * Fixed shooting gallery not reporting proper area. Prevent checks from actually happening if area is RCAREA_INVALID, now that all areas are reporting something if they have checks. Fixed `GetCheckArea()` not updating checks for standard scenes. Lots of vanilla tracking updates, mainly manual checks for gems, medallions and songs, since the often don't have proper scenes in the data. Prevent vanilla from triggering check loops if junk items are collected. Fixed sorting based on saved vs collected. Prevent item name display for vanilla runs. Change coloring of checks so the check name reflects status in vanilla runs. * Fixed "Recheck Area" button erroneously adding to an area's check totals? * Fix DMC vanilla checks. * Fix check tracker data recreation on data file loss. Removed redundant file exists check from SaveTrackerDataHook, as it doesn't matter if it exists or not at that point. Limited check loops to 3 to avoid infinite check loops on non-check/junk item pickup. Added more checks to disable tracker operations if a save is not running. Changed check ordering to put boss reward and heart container checks at the end of whatever RCSHOW group they belong to. * Fixed IsRunning calculation. Further improving vanilla checking. Starting framework for checking medallions, stones, and songs on data file recreation. Fixed medallion check collection. Added GIFT_FROM_SAGES to check list for vanilla file for tracking light medallion. Added check loop limitation to prevent infinite checking after picking up junk item from the ground. * Finished vanilla file recreation and recheck (songs and dungeon rewards all check properly now). This includes deku shield with KF shop item 3. Finished Gift from Raoru light medallion tracking for vanilla. Commented all CheckByScene functionality for now. * Fixed new save data file creation. Disabled entrance area calculation for now, as it only tracks the previous entrance for some reason. Fixed area detection for ToT checks. * GetCheckArea() now utilizes EntranceData almost exclusively, via either `gSaveContext.entranceIndex` or the entrance tracker's `currentGrottoId` in the case of grottos. This also means that EVERYTHING CAN AUTOSCROLL NOW. Entrance shuffles are now much easier to track. Autoscroll is now also triggered on save, just in case someone isn't autosaving and has a lot of checks that get converted to saved. * Fixed missing GS check in LW. * Added area scroll on toggling Show Hidden Items. May configure differently later. Fixed area detection for entrances in Gerudo Fortress/Valley and Collossus. Haunted wasteland doesn't autoscroll due to a bug in `OnTransitionEnd` hook, but checks still evaluate properly there. Rely on scene-based area detection if scene is a main overworld or dungeon scene. * Fixed grotto detection when shuffle is off. * Small code cleanup. Fixed Colossus hand chest checks. * Missing lus bump from merge conflict resolution * Fixed Colossus Grotto making `GetCheckArea` return Wasteland. * Improved OnItemReceive processing for non-token GS checks, since they can sometimes take long enough for the checking process to time out before the item is registered as received. * First attempt at thread safety for tracker data file writing. Seems to work, but might need more testing. * Fixed Recheck Area not unskipping items that register as saved. Improved delayed saving with autosaving, as the autosave triggered quite often before the tracker data save, making things not properly register as saved. * merge cleanup * Converted check tracker data to the sectional saves, adding `CheckTrackerData` to `SaveContext`. Implemented section ID returning and fullSave boolean passing to section functions from my PR temporarily for it to work properly. Moved `RandomizerCheckTrackerData` enum to `randomizerTypes.h` to accommodate that. Changed `Randomizer_SaveInit` to a `SaveManager::InitFunc` to allow for other randomizer-dependent sections to be initialized after that. Required a little refactoring to maintain intro cutscene skip when starting a randomizer file. * Revert section index return and randomizer init changes. Will need to wait on yet more changes to main. * Fixed check tracker initialization (shouldn't be tied to window initialization), restored saving/loading functionality. * Removed `CheckTracker::Init` and put SaveManager calls in `CheckTrackerWindow::InitElement`. Also a bit of cleanup from transition back to save file use. * Fixed tracker displaying check categories while file not loaded. * Fix Darunia's Joy check not marking in vanilla. * Fix autosave not triggering change from collected to saved in tracker data. * Changed default colors for scummed and collected display. * Merge upgrade code cleanup. * Add `OnTransitionEnd` calls to sandstorm transitions both to and from Wasteland. Also improved `gSaveContext.lastScene` assignment for both transition types. Allowed a bit of cleanup in `GetCheckArea`. * Added `StateButton`, a button like `ArrowButton` but that allows text instead of arrow icons. Apparently the changes from ArrowButton to StateButton happened in a previous commit... * Changed section name to `trackerDataCheck` to force SoH to load it after the randomizer section, as it required some randoSettings to be loaded first, and nothing else I tried to make the randomizer section load before it worked. This hacks a solution to checks not displaying on fast file load to a specific slot. F*** you, SaveManager, and f*** you too, JSON. * Forgot to change the section string for loading with the name change. * Fix check ordering for checks that trigger the autosave. * Adds option to remove right-side shop items (slots 1-4) from the tracker list. Enabled by default. * Fix default state of Hide Shop Right Checks checkbox. * Fixes grotto and great fairy scrolling and checks. Fixes array overflow from `checkTrackerData` which was creating the issue trying to load the base and randomizer sections first, among other things. That also fixed the massive file loads that were being exhibited in debug mode. * Fix shooting galleries being set as collected again when being played a second time after getting the checks. * Fix Bazaar autoscroll. * Add Saria's Song to `GetCheckFromActor` and removed some limitations from the messageCloseCheck function to make that check track properly. * Fix Song from Impa check. Implemented prevention for multiple "collections" of great fairies, just in case getting the health refill would trigger it with the previous setup. * Fix ice traps on GS tokens not triggering OnItemReceive. * Complete fix for ice trap collection from GS. Add autoscroll when clicking "Expand All". * Add `OnShopSlotChange` with cursorSlot and basePrice parameters. * Fixed include in en_ossan for shop slot hook. Added registration for `OnShopSlotChange` in the tracker, storing the price in a new `price` field in `CheckTrackerData`. Added "seen" functionality to shop checks. Displays the model item name upon first entering a shop, adding the price and switching to trickName (if it's an ice trap) upon navigating to the slot in buy mode, triggered by an invisible "identified" status that mirrors "seen" in every other way. Added tooltips to most options for check tracker color picking to describe what each status actually means. * `std::format` pls * So apparently std::format just decided to break with the latest merge from develop, but fmt::format exists and works? * Removed the last vestiges of `locationsSkipped`. Other general code and formatting cleanups. Moved `IsGameRunning` to `OTRGlobals` so the item tracker could also access it. Used preceding to "fix" item and bottle display in the item tracker on startup. * Some more code cleanup. Removed "Recheck Area" button and relevant code. Backported changes to Anchor branch applicable for single-player, including making a checkAreas vector and structuring the frame by frame checks around that. Also includes fix for Silver Gauntlets and Mirror Shield check collection crash associated with those changes. Fixed Kakariko Bazaar "seen" updates. Fixed tracker window not showing on initial load like it should. * Forgot 1 formatting fix. * Removed conditions for showing Song from Impa (isn't junk under certain conditions, so should show all the time). * Fix vanilla checks, add Zelda's Letter and Malon's Egg to manual check collection. Fix autoscroll while in child stealth section. * Fix crash in Happy Mask Shop in OnSlotChange (referenced non-existent shop id in a tracker-specific enum). * General code cleanup. * Missed one reversion. * One more. * Fix column alignment in `randomizer_check_objects`. * Fix file encoding on `randomizer_check_tracker`. Again. * Fix indentation for `actualItemtrackerItemMap`. Also removed unnecessary parts of the map. * Rename `HasEqItem` to `HasEquipment`. * Slightly better indentation for `actualItemTrackerItemMap`. * Add magic bean salesman to vanilla check tracking, and genericized deku shield to trigger KF shop item 3 wherever you get the shield. Renamed `vanillaCheck` to `vanillaHundoCheck` to (supposedly) clarify the meaning of the usage. * One more rename to `vanillaCompletion` to avoid possible confusion with 100% speedrun conditions. * give me a break XD Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * Changes suggested by briaguya (rename `RandomizerCheckShow` to `Status`, unused code, newline formatting) * Remove unused `itemNames` table. * Remove `IsGameRunning` in favor of `GameInteractor::IsSaveLoaded`. * Restore anti-spoiler functionality for dungeons with dungeon maps. * Review cleanup. * Fix prices not showing for Kak bazaar items. --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com>
2023-10-04 11:03:36 -04:00
return;
}else if (giEntry.itemId == ITEM_KOKIRI_EMERALD) {
SetCheckCollected(RC_QUEEN_GOHMA);
return;
} else if (giEntry.itemId == ITEM_GORON_RUBY) {
SetCheckCollected(RC_KING_DODONGO);
return;
} else if (giEntry.itemId == ITEM_ZORA_SAPPHIRE) {
SetCheckCollected(RC_BARINADE);
return;
} else if (giEntry.itemId == ITEM_MEDALLION_FOREST) {
SetCheckCollected(RC_PHANTOM_GANON);
return;
} else if (giEntry.itemId == ITEM_MEDALLION_FIRE) {
SetCheckCollected(RC_VOLVAGIA);
return;
} else if (giEntry.itemId == ITEM_MEDALLION_WATER) {
SetCheckCollected(RC_MORPHA);
return;
} else if (giEntry.itemId == ITEM_MEDALLION_SHADOW) {
SetCheckCollected(RC_BONGO_BONGO);
return;
} else if (giEntry.itemId == ITEM_MEDALLION_SPIRIT) {
SetCheckCollected(RC_TWINROVA);
return;
} else if (giEntry.itemId == ITEM_MEDALLION_LIGHT) {
SetCheckCollected(RC_GIFT_FROM_SAGES);
return;
} else if (giEntry.itemId == ITEM_SONG_EPONA) {
SetCheckCollected(RC_SONG_FROM_MALON);
return;
} else if (giEntry.itemId == ITEM_SONG_SARIA) {
SetCheckCollected(RC_SONG_FROM_SARIA);
return;
Flag tracker (#3447) * Hook into flagset hooks for processing check tracking. Has some manual workarounds (some breaks still need to be found). Remove areaChecks and looping functionality as redundant. * Additional vanilla handling. * Fix tracker not showing MQ checks in MQ non-rando. Fix tracker marking non-MQ variants of dungeon checks (e.g. map chest, etc) when collecting in MQ. * Set all areas to spoiled if not rando. * Revert attempt to spoil in randomizer based on MQ dungeon count as I don't know how that works at the moment. * Restore and update spoiling based on MQ dungeon settings (none, selection, or count of 12). Fix Anju As Adult check. * Remove Anchor-specific code :baguette: * Use `ClearAreaTotals()` in `Teardown()` instead of the duplicate code there. * Update to `ClearAreaChecksAndTotals()` with `vec.clear()` added. * Fix type spoiling again. Now spoils on 0 MQ dungeons, not rando, if the option is enabled in check tracker settings, selection, or set number of 12. Fix vanilla checks being marked collected in MQ dungeons. * Fix 100 GS check. * ACTUALLY fix 100 GS: change flag type to `RandomizerInf()` in `item_location.cpp`, add RC to RandoInf for it to the table. Also don't send GI for flag if father, falsely triggers ZR frogs minigame. * Fix gravedigging tour tracking. * Fix membership card check tracking. Change scene and flag values to any existing enums. Clarifying formatting for the checking loop vOrMQ conditions. * Fix Gravedigging Tour tracking. Simplify Always Win Gravedigging Tour and Fix Gravedigging Tour Glitch applications. Modified all necessary paths to use vanilla GDT PoH collection flag instead of randomizer variant. * Fix Kak Potion Shop being "seen" when entering as child.
2023-11-28 21:25:48 -05:00
} else if (giEntry.itemId == ITEM_BEAN) {
SetCheckCollected(RC_ZR_MAGIC_BEAN_SALESMAN);
return;
} else if (giEntry.itemId == ITEM_BRACELET) {
SetCheckCollected(RC_GC_DARUNIAS_JOY);
return;
}/* else if (giEntry.itemId == ITEM_SONG_SUN) {
Check Tracker Update (#2668) * Initial commit. What works so far: Data file loads, saves, deletes, and is created properly. - Need to run `HasItemBeenCollected` when creating in case of mid-seed regen. Organized checks into maps set by area. Areas show in tracker. - Checks pulled from checkObjectsByArea are not currently listed. - Areas are being assumed completed and hidden at the start. * Checks now populate. Still not counting area totals properly. * Don't track RC_LINKS_POCKET in the data file, and instead manually add it in every time a save is load. rcObjects doesn't contain Link's Pocket location (duh). * Moved ItemReceive hook to randomizer_check_tracker.cpp. Skipped items are properly sorted and formatted. Saved items contribute to an area's gotten/skipped checks on load. Changed skipped items default main color to gray. General code cleanup. * Skipped checks now contribute to area totals for area completion logic. * Mid-menu rework transfer. * Started check lookup on item receive. Tried to enable scum checking on save. * Fixed scum check on save. * More code cleanup, which revealed some issues with loading and saving. Loading now works 100%, but entries in checkTrackerData are disappearing in code somewhere, causing issues with later checks. Scummed color now displays properly. Collected but unsaved displays properly. Unchecked, Skipped, Seen and Scummed checks all have arrows for skipping/unskipping. Counts a little messed up, probably double adding skips. * Fixed item counts being off across resets. Restarts were fine. * Beginning of rework for individual check updates. Adds `Actor lastCheck` to PlayState to allow assigning of last actor to give an item. This allows precise tracking of GS, freestanding PoH, etc. Works for chests too. Currently does not work for shops, unknown for normal NPC gives. Doesn't track last gives for non-checks, like drops from grass, pots, crates, etc. * Actor-based checks fully fleshed out, but can't help with sale-based checks. Implemented `pendingSaleCheck` to back out of an RC check cycle if `gSaveContext->pendingSale` is not NONE when `OnItemReceive` is called, processed through `OnSaleEnd`. This should be the final change necessary to streamline the checks. * Temporary hook to message box close to tie in trackers for non-gs/chest actors that aren't added to `GetCheckFromActor`. This triggers a 2-frame countdown to check with `HasItemBeenCollected` since half of the methods in there aren't updated until after a text box closes. Added scene tracking to get last scene so that checks in scenes that span several overworld areas could be tied to their areas properly. Modified tracker data creation to apply Link's Pocket and Song from Impa conditionally based on randomizer settings instead of just being assumed to be done. May need modification for checking click and drag spoiler loading. Removed the scene equivalence check from CheckChecks so that an entire area is checked each time to avoid issues with, e.g., leaving a shop before a pending sale finishes. * Changed check data creation to use RSKs from gRandomizer to account for settings loaded from drag and drop spoilers. * Beginning of tracker code organization. Changed check color defaults. * Reverted moving tracker colors to header. Some individual check fixes. * Missed something from previous merge? * Removed last remnant of removed performance mode. * Better handle checking when skullsanity is off. * Song checks sceneIDs don't match the scenes they're actually in for some reason. Removed that check. * SaleEnd checks don't need the GetItemEntry parameter. Also set a flag that should prevent the check tracker from running during vanilla saves should that not be resolved by the time it's merged. * Attempting to have only the relevant checks added to the tracker data, as well as showing vanilla checks for non-rando saves. Not working yet (everything is displayed in vanilla). * Added vanilla check tracker population via `vanillaCheck` bool in `RandomizerCheckObject`. This is also added to `IsVisibleInImGui` to handle file loading and saving to eliminate checks that aren't part of vanilla or the rando seed. Implemented deleted tracker data file recreation. Added some extra item name text checks. Songs are still... tricky, so they stay blank. Utilize local copies of the randomizer check objects that are applicable for performance purposes. Fixed vanilla item-giving cutscene crashes when triggered mid-transition. * Apparently not all toolchains can handle macro instantiation without all parameters, like VS can. * Fixed scummed detail color not showing properly on tracker. * Fixed dungeon area totals and GS checks not functioning properly. * Major revamp of checking code. Doesn't rely on `GetCheckFromActor` at all anymore, but instead simply sets a flag to evaluate a number of checks in an area every frame until the check that was gotten is identified. With the new setup, it's much less hardware intensive, and at 60fps 6 checks per frame shows no noticeable effect on framerate. I can envision needing to add a collectedCount in order to account for times when two checks are gotten one right after the other. Changed area scroll to happen from `OnTransitionEnd`, and allow for scrolling in bazaar (was disabled previously because it would jump back and forth between Kak and Market while you were in one). Also setup area check order updating by area instead of all at the same time. * Fixed shooting gallery not reporting proper area. Prevent checks from actually happening if area is RCAREA_INVALID, now that all areas are reporting something if they have checks. Fixed `GetCheckArea()` not updating checks for standard scenes. Lots of vanilla tracking updates, mainly manual checks for gems, medallions and songs, since the often don't have proper scenes in the data. Prevent vanilla from triggering check loops if junk items are collected. Fixed sorting based on saved vs collected. Prevent item name display for vanilla runs. Change coloring of checks so the check name reflects status in vanilla runs. * Fixed "Recheck Area" button erroneously adding to an area's check totals? * Fix DMC vanilla checks. * Fix check tracker data recreation on data file loss. Removed redundant file exists check from SaveTrackerDataHook, as it doesn't matter if it exists or not at that point. Limited check loops to 3 to avoid infinite check loops on non-check/junk item pickup. Added more checks to disable tracker operations if a save is not running. Changed check ordering to put boss reward and heart container checks at the end of whatever RCSHOW group they belong to. * Fixed IsRunning calculation. Further improving vanilla checking. Starting framework for checking medallions, stones, and songs on data file recreation. Fixed medallion check collection. Added GIFT_FROM_SAGES to check list for vanilla file for tracking light medallion. Added check loop limitation to prevent infinite checking after picking up junk item from the ground. * Finished vanilla file recreation and recheck (songs and dungeon rewards all check properly now). This includes deku shield with KF shop item 3. Finished Gift from Raoru light medallion tracking for vanilla. Commented all CheckByScene functionality for now. * Fixed new save data file creation. Disabled entrance area calculation for now, as it only tracks the previous entrance for some reason. Fixed area detection for ToT checks. * GetCheckArea() now utilizes EntranceData almost exclusively, via either `gSaveContext.entranceIndex` or the entrance tracker's `currentGrottoId` in the case of grottos. This also means that EVERYTHING CAN AUTOSCROLL NOW. Entrance shuffles are now much easier to track. Autoscroll is now also triggered on save, just in case someone isn't autosaving and has a lot of checks that get converted to saved. * Fixed missing GS check in LW. * Added area scroll on toggling Show Hidden Items. May configure differently later. Fixed area detection for entrances in Gerudo Fortress/Valley and Collossus. Haunted wasteland doesn't autoscroll due to a bug in `OnTransitionEnd` hook, but checks still evaluate properly there. Rely on scene-based area detection if scene is a main overworld or dungeon scene. * Fixed grotto detection when shuffle is off. * Small code cleanup. Fixed Colossus hand chest checks. * Missing lus bump from merge conflict resolution * Fixed Colossus Grotto making `GetCheckArea` return Wasteland. * Improved OnItemReceive processing for non-token GS checks, since they can sometimes take long enough for the checking process to time out before the item is registered as received. * First attempt at thread safety for tracker data file writing. Seems to work, but might need more testing. * Fixed Recheck Area not unskipping items that register as saved. Improved delayed saving with autosaving, as the autosave triggered quite often before the tracker data save, making things not properly register as saved. * merge cleanup * Converted check tracker data to the sectional saves, adding `CheckTrackerData` to `SaveContext`. Implemented section ID returning and fullSave boolean passing to section functions from my PR temporarily for it to work properly. Moved `RandomizerCheckTrackerData` enum to `randomizerTypes.h` to accommodate that. Changed `Randomizer_SaveInit` to a `SaveManager::InitFunc` to allow for other randomizer-dependent sections to be initialized after that. Required a little refactoring to maintain intro cutscene skip when starting a randomizer file. * Revert section index return and randomizer init changes. Will need to wait on yet more changes to main. * Fixed check tracker initialization (shouldn't be tied to window initialization), restored saving/loading functionality. * Removed `CheckTracker::Init` and put SaveManager calls in `CheckTrackerWindow::InitElement`. Also a bit of cleanup from transition back to save file use. * Fixed tracker displaying check categories while file not loaded. * Fix Darunia's Joy check not marking in vanilla. * Fix autosave not triggering change from collected to saved in tracker data. * Changed default colors for scummed and collected display. * Merge upgrade code cleanup. * Add `OnTransitionEnd` calls to sandstorm transitions both to and from Wasteland. Also improved `gSaveContext.lastScene` assignment for both transition types. Allowed a bit of cleanup in `GetCheckArea`. * Added `StateButton`, a button like `ArrowButton` but that allows text instead of arrow icons. Apparently the changes from ArrowButton to StateButton happened in a previous commit... * Changed section name to `trackerDataCheck` to force SoH to load it after the randomizer section, as it required some randoSettings to be loaded first, and nothing else I tried to make the randomizer section load before it worked. This hacks a solution to checks not displaying on fast file load to a specific slot. F*** you, SaveManager, and f*** you too, JSON. * Forgot to change the section string for loading with the name change. * Fix check ordering for checks that trigger the autosave. * Adds option to remove right-side shop items (slots 1-4) from the tracker list. Enabled by default. * Fix default state of Hide Shop Right Checks checkbox. * Fixes grotto and great fairy scrolling and checks. Fixes array overflow from `checkTrackerData` which was creating the issue trying to load the base and randomizer sections first, among other things. That also fixed the massive file loads that were being exhibited in debug mode. * Fix shooting galleries being set as collected again when being played a second time after getting the checks. * Fix Bazaar autoscroll. * Add Saria's Song to `GetCheckFromActor` and removed some limitations from the messageCloseCheck function to make that check track properly. * Fix Song from Impa check. Implemented prevention for multiple "collections" of great fairies, just in case getting the health refill would trigger it with the previous setup. * Fix ice traps on GS tokens not triggering OnItemReceive. * Complete fix for ice trap collection from GS. Add autoscroll when clicking "Expand All". * Add `OnShopSlotChange` with cursorSlot and basePrice parameters. * Fixed include in en_ossan for shop slot hook. Added registration for `OnShopSlotChange` in the tracker, storing the price in a new `price` field in `CheckTrackerData`. Added "seen" functionality to shop checks. Displays the model item name upon first entering a shop, adding the price and switching to trickName (if it's an ice trap) upon navigating to the slot in buy mode, triggered by an invisible "identified" status that mirrors "seen" in every other way. Added tooltips to most options for check tracker color picking to describe what each status actually means. * `std::format` pls * So apparently std::format just decided to break with the latest merge from develop, but fmt::format exists and works? * Removed the last vestiges of `locationsSkipped`. Other general code and formatting cleanups. Moved `IsGameRunning` to `OTRGlobals` so the item tracker could also access it. Used preceding to "fix" item and bottle display in the item tracker on startup. * Some more code cleanup. Removed "Recheck Area" button and relevant code. Backported changes to Anchor branch applicable for single-player, including making a checkAreas vector and structuring the frame by frame checks around that. Also includes fix for Silver Gauntlets and Mirror Shield check collection crash associated with those changes. Fixed Kakariko Bazaar "seen" updates. Fixed tracker window not showing on initial load like it should. * Forgot 1 formatting fix. * Removed conditions for showing Song from Impa (isn't junk under certain conditions, so should show all the time). * Fix vanilla checks, add Zelda's Letter and Malon's Egg to manual check collection. Fix autoscroll while in child stealth section. * Fix crash in Happy Mask Shop in OnSlotChange (referenced non-existent shop id in a tracker-specific enum). * General code cleanup. * Missed one reversion. * One more. * Fix column alignment in `randomizer_check_objects`. * Fix file encoding on `randomizer_check_tracker`. Again. * Fix indentation for `actualItemtrackerItemMap`. Also removed unnecessary parts of the map. * Rename `HasEqItem` to `HasEquipment`. * Slightly better indentation for `actualItemTrackerItemMap`. * Add magic bean salesman to vanilla check tracking, and genericized deku shield to trigger KF shop item 3 wherever you get the shield. Renamed `vanillaCheck` to `vanillaHundoCheck` to (supposedly) clarify the meaning of the usage. * One more rename to `vanillaCompletion` to avoid possible confusion with 100% speedrun conditions. * give me a break XD Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * Changes suggested by briaguya (rename `RandomizerCheckShow` to `Status`, unused code, newline formatting) * Remove unused `itemNames` table. * Remove `IsGameRunning` in favor of `GameInteractor::IsSaveLoaded`. * Restore anti-spoiler functionality for dungeons with dungeon maps. * Review cleanup. * Fix prices not showing for Kak bazaar items. --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com>
2023-10-04 11:03:36 -04:00
SetCheckCollected(RC_SONG_FROM_ROYAL_FAMILYS_TOMB);
return;
} else if (giEntry.itemId == ITEM_SONG_TIME) {
SetCheckCollected(RC_SONG_FROM_OCARINA_OF_TIME);
return;
} else if (giEntry.itemId == ITEM_SONG_STORMS) {
SetCheckCollected(RC_SONG_FROM_WINDMILL);
return;
} else if (giEntry.itemId == ITEM_SONG_MINUET) {
SetCheckCollected(RC_SHEIK_IN_FOREST);
return;
} else if (giEntry.itemId == ITEM_SONG_BOLERO) {
SetCheckCollected(RC_SHEIK_IN_CRATER);
return;
} else if (giEntry.itemId == ITEM_SONG_SERENADE) {
SetCheckCollected(RC_SHEIK_IN_ICE_CAVERN);
return;
} else if (giEntry.itemId == ITEM_SONG_NOCTURNE) {
SetCheckCollected(RC_SHEIK_IN_KAKARIKO);
return;
} else if (giEntry.itemId == ITEM_SONG_REQUIEM) {
SetCheckCollected(RC_SHEIK_AT_COLOSSUS);
return;
} else if (giEntry.itemId == ITEM_SONG_PRELUDE) {
SetCheckCollected(RC_SHEIK_AT_TEMPLE);
return;
Flag tracker (#3447) * Hook into flagset hooks for processing check tracking. Has some manual workarounds (some breaks still need to be found). Remove areaChecks and looping functionality as redundant. * Additional vanilla handling. * Fix tracker not showing MQ checks in MQ non-rando. Fix tracker marking non-MQ variants of dungeon checks (e.g. map chest, etc) when collecting in MQ. * Set all areas to spoiled if not rando. * Revert attempt to spoil in randomizer based on MQ dungeon count as I don't know how that works at the moment. * Restore and update spoiling based on MQ dungeon settings (none, selection, or count of 12). Fix Anju As Adult check. * Remove Anchor-specific code :baguette: * Use `ClearAreaTotals()` in `Teardown()` instead of the duplicate code there. * Update to `ClearAreaChecksAndTotals()` with `vec.clear()` added. * Fix type spoiling again. Now spoils on 0 MQ dungeons, not rando, if the option is enabled in check tracker settings, selection, or set number of 12. Fix vanilla checks being marked collected in MQ dungeons. * Fix 100 GS check. * ACTUALLY fix 100 GS: change flag type to `RandomizerInf()` in `item_location.cpp`, add RC to RandoInf for it to the table. Also don't send GI for flag if father, falsely triggers ZR frogs minigame. * Fix gravedigging tour tracking. * Fix membership card check tracking. Change scene and flag values to any existing enums. Clarifying formatting for the checking loop vOrMQ conditions. * Fix Gravedigging Tour tracking. Simplify Always Win Gravedigging Tour and Fix Gravedigging Tour Glitch applications. Modified all necessary paths to use vanilla GDT PoH collection flag instead of randomizer variant. * Fix Kak Potion Shop being "seen" when entering as child.
2023-11-28 21:25:48 -05:00
}*/
Check Tracker Update (#2668) * Initial commit. What works so far: Data file loads, saves, deletes, and is created properly. - Need to run `HasItemBeenCollected` when creating in case of mid-seed regen. Organized checks into maps set by area. Areas show in tracker. - Checks pulled from checkObjectsByArea are not currently listed. - Areas are being assumed completed and hidden at the start. * Checks now populate. Still not counting area totals properly. * Don't track RC_LINKS_POCKET in the data file, and instead manually add it in every time a save is load. rcObjects doesn't contain Link's Pocket location (duh). * Moved ItemReceive hook to randomizer_check_tracker.cpp. Skipped items are properly sorted and formatted. Saved items contribute to an area's gotten/skipped checks on load. Changed skipped items default main color to gray. General code cleanup. * Skipped checks now contribute to area totals for area completion logic. * Mid-menu rework transfer. * Started check lookup on item receive. Tried to enable scum checking on save. * Fixed scum check on save. * More code cleanup, which revealed some issues with loading and saving. Loading now works 100%, but entries in checkTrackerData are disappearing in code somewhere, causing issues with later checks. Scummed color now displays properly. Collected but unsaved displays properly. Unchecked, Skipped, Seen and Scummed checks all have arrows for skipping/unskipping. Counts a little messed up, probably double adding skips. * Fixed item counts being off across resets. Restarts were fine. * Beginning of rework for individual check updates. Adds `Actor lastCheck` to PlayState to allow assigning of last actor to give an item. This allows precise tracking of GS, freestanding PoH, etc. Works for chests too. Currently does not work for shops, unknown for normal NPC gives. Doesn't track last gives for non-checks, like drops from grass, pots, crates, etc. * Actor-based checks fully fleshed out, but can't help with sale-based checks. Implemented `pendingSaleCheck` to back out of an RC check cycle if `gSaveContext->pendingSale` is not NONE when `OnItemReceive` is called, processed through `OnSaleEnd`. This should be the final change necessary to streamline the checks. * Temporary hook to message box close to tie in trackers for non-gs/chest actors that aren't added to `GetCheckFromActor`. This triggers a 2-frame countdown to check with `HasItemBeenCollected` since half of the methods in there aren't updated until after a text box closes. Added scene tracking to get last scene so that checks in scenes that span several overworld areas could be tied to their areas properly. Modified tracker data creation to apply Link's Pocket and Song from Impa conditionally based on randomizer settings instead of just being assumed to be done. May need modification for checking click and drag spoiler loading. Removed the scene equivalence check from CheckChecks so that an entire area is checked each time to avoid issues with, e.g., leaving a shop before a pending sale finishes. * Changed check data creation to use RSKs from gRandomizer to account for settings loaded from drag and drop spoilers. * Beginning of tracker code organization. Changed check color defaults. * Reverted moving tracker colors to header. Some individual check fixes. * Missed something from previous merge? * Removed last remnant of removed performance mode. * Better handle checking when skullsanity is off. * Song checks sceneIDs don't match the scenes they're actually in for some reason. Removed that check. * SaleEnd checks don't need the GetItemEntry parameter. Also set a flag that should prevent the check tracker from running during vanilla saves should that not be resolved by the time it's merged. * Attempting to have only the relevant checks added to the tracker data, as well as showing vanilla checks for non-rando saves. Not working yet (everything is displayed in vanilla). * Added vanilla check tracker population via `vanillaCheck` bool in `RandomizerCheckObject`. This is also added to `IsVisibleInImGui` to handle file loading and saving to eliminate checks that aren't part of vanilla or the rando seed. Implemented deleted tracker data file recreation. Added some extra item name text checks. Songs are still... tricky, so they stay blank. Utilize local copies of the randomizer check objects that are applicable for performance purposes. Fixed vanilla item-giving cutscene crashes when triggered mid-transition. * Apparently not all toolchains can handle macro instantiation without all parameters, like VS can. * Fixed scummed detail color not showing properly on tracker. * Fixed dungeon area totals and GS checks not functioning properly. * Major revamp of checking code. Doesn't rely on `GetCheckFromActor` at all anymore, but instead simply sets a flag to evaluate a number of checks in an area every frame until the check that was gotten is identified. With the new setup, it's much less hardware intensive, and at 60fps 6 checks per frame shows no noticeable effect on framerate. I can envision needing to add a collectedCount in order to account for times when two checks are gotten one right after the other. Changed area scroll to happen from `OnTransitionEnd`, and allow for scrolling in bazaar (was disabled previously because it would jump back and forth between Kak and Market while you were in one). Also setup area check order updating by area instead of all at the same time. * Fixed shooting gallery not reporting proper area. Prevent checks from actually happening if area is RCAREA_INVALID, now that all areas are reporting something if they have checks. Fixed `GetCheckArea()` not updating checks for standard scenes. Lots of vanilla tracking updates, mainly manual checks for gems, medallions and songs, since the often don't have proper scenes in the data. Prevent vanilla from triggering check loops if junk items are collected. Fixed sorting based on saved vs collected. Prevent item name display for vanilla runs. Change coloring of checks so the check name reflects status in vanilla runs. * Fixed "Recheck Area" button erroneously adding to an area's check totals? * Fix DMC vanilla checks. * Fix check tracker data recreation on data file loss. Removed redundant file exists check from SaveTrackerDataHook, as it doesn't matter if it exists or not at that point. Limited check loops to 3 to avoid infinite check loops on non-check/junk item pickup. Added more checks to disable tracker operations if a save is not running. Changed check ordering to put boss reward and heart container checks at the end of whatever RCSHOW group they belong to. * Fixed IsRunning calculation. Further improving vanilla checking. Starting framework for checking medallions, stones, and songs on data file recreation. Fixed medallion check collection. Added GIFT_FROM_SAGES to check list for vanilla file for tracking light medallion. Added check loop limitation to prevent infinite checking after picking up junk item from the ground. * Finished vanilla file recreation and recheck (songs and dungeon rewards all check properly now). This includes deku shield with KF shop item 3. Finished Gift from Raoru light medallion tracking for vanilla. Commented all CheckByScene functionality for now. * Fixed new save data file creation. Disabled entrance area calculation for now, as it only tracks the previous entrance for some reason. Fixed area detection for ToT checks. * GetCheckArea() now utilizes EntranceData almost exclusively, via either `gSaveContext.entranceIndex` or the entrance tracker's `currentGrottoId` in the case of grottos. This also means that EVERYTHING CAN AUTOSCROLL NOW. Entrance shuffles are now much easier to track. Autoscroll is now also triggered on save, just in case someone isn't autosaving and has a lot of checks that get converted to saved. * Fixed missing GS check in LW. * Added area scroll on toggling Show Hidden Items. May configure differently later. Fixed area detection for entrances in Gerudo Fortress/Valley and Collossus. Haunted wasteland doesn't autoscroll due to a bug in `OnTransitionEnd` hook, but checks still evaluate properly there. Rely on scene-based area detection if scene is a main overworld or dungeon scene. * Fixed grotto detection when shuffle is off. * Small code cleanup. Fixed Colossus hand chest checks. * Missing lus bump from merge conflict resolution * Fixed Colossus Grotto making `GetCheckArea` return Wasteland. * Improved OnItemReceive processing for non-token GS checks, since they can sometimes take long enough for the checking process to time out before the item is registered as received. * First attempt at thread safety for tracker data file writing. Seems to work, but might need more testing. * Fixed Recheck Area not unskipping items that register as saved. Improved delayed saving with autosaving, as the autosave triggered quite often before the tracker data save, making things not properly register as saved. * merge cleanup * Converted check tracker data to the sectional saves, adding `CheckTrackerData` to `SaveContext`. Implemented section ID returning and fullSave boolean passing to section functions from my PR temporarily for it to work properly. Moved `RandomizerCheckTrackerData` enum to `randomizerTypes.h` to accommodate that. Changed `Randomizer_SaveInit` to a `SaveManager::InitFunc` to allow for other randomizer-dependent sections to be initialized after that. Required a little refactoring to maintain intro cutscene skip when starting a randomizer file. * Revert section index return and randomizer init changes. Will need to wait on yet more changes to main. * Fixed check tracker initialization (shouldn't be tied to window initialization), restored saving/loading functionality. * Removed `CheckTracker::Init` and put SaveManager calls in `CheckTrackerWindow::InitElement`. Also a bit of cleanup from transition back to save file use. * Fixed tracker displaying check categories while file not loaded. * Fix Darunia's Joy check not marking in vanilla. * Fix autosave not triggering change from collected to saved in tracker data. * Changed default colors for scummed and collected display. * Merge upgrade code cleanup. * Add `OnTransitionEnd` calls to sandstorm transitions both to and from Wasteland. Also improved `gSaveContext.lastScene` assignment for both transition types. Allowed a bit of cleanup in `GetCheckArea`. * Added `StateButton`, a button like `ArrowButton` but that allows text instead of arrow icons. Apparently the changes from ArrowButton to StateButton happened in a previous commit... * Changed section name to `trackerDataCheck` to force SoH to load it after the randomizer section, as it required some randoSettings to be loaded first, and nothing else I tried to make the randomizer section load before it worked. This hacks a solution to checks not displaying on fast file load to a specific slot. F*** you, SaveManager, and f*** you too, JSON. * Forgot to change the section string for loading with the name change. * Fix check ordering for checks that trigger the autosave. * Adds option to remove right-side shop items (slots 1-4) from the tracker list. Enabled by default. * Fix default state of Hide Shop Right Checks checkbox. * Fixes grotto and great fairy scrolling and checks. Fixes array overflow from `checkTrackerData` which was creating the issue trying to load the base and randomizer sections first, among other things. That also fixed the massive file loads that were being exhibited in debug mode. * Fix shooting galleries being set as collected again when being played a second time after getting the checks. * Fix Bazaar autoscroll. * Add Saria's Song to `GetCheckFromActor` and removed some limitations from the messageCloseCheck function to make that check track properly. * Fix Song from Impa check. Implemented prevention for multiple "collections" of great fairies, just in case getting the health refill would trigger it with the previous setup. * Fix ice traps on GS tokens not triggering OnItemReceive. * Complete fix for ice trap collection from GS. Add autoscroll when clicking "Expand All". * Add `OnShopSlotChange` with cursorSlot and basePrice parameters. * Fixed include in en_ossan for shop slot hook. Added registration for `OnShopSlotChange` in the tracker, storing the price in a new `price` field in `CheckTrackerData`. Added "seen" functionality to shop checks. Displays the model item name upon first entering a shop, adding the price and switching to trickName (if it's an ice trap) upon navigating to the slot in buy mode, triggered by an invisible "identified" status that mirrors "seen" in every other way. Added tooltips to most options for check tracker color picking to describe what each status actually means. * `std::format` pls * So apparently std::format just decided to break with the latest merge from develop, but fmt::format exists and works? * Removed the last vestiges of `locationsSkipped`. Other general code and formatting cleanups. Moved `IsGameRunning` to `OTRGlobals` so the item tracker could also access it. Used preceding to "fix" item and bottle display in the item tracker on startup. * Some more code cleanup. Removed "Recheck Area" button and relevant code. Backported changes to Anchor branch applicable for single-player, including making a checkAreas vector and structuring the frame by frame checks around that. Also includes fix for Silver Gauntlets and Mirror Shield check collection crash associated with those changes. Fixed Kakariko Bazaar "seen" updates. Fixed tracker window not showing on initial load like it should. * Forgot 1 formatting fix. * Removed conditions for showing Song from Impa (isn't junk under certain conditions, so should show all the time). * Fix vanilla checks, add Zelda's Letter and Malon's Egg to manual check collection. Fix autoscroll while in child stealth section. * Fix crash in Happy Mask Shop in OnSlotChange (referenced non-existent shop id in a tracker-specific enum). * General code cleanup. * Missed one reversion. * One more. * Fix column alignment in `randomizer_check_objects`. * Fix file encoding on `randomizer_check_tracker`. Again. * Fix indentation for `actualItemtrackerItemMap`. Also removed unnecessary parts of the map. * Rename `HasEqItem` to `HasEquipment`. * Slightly better indentation for `actualItemTrackerItemMap`. * Add magic bean salesman to vanilla check tracking, and genericized deku shield to trigger KF shop item 3 wherever you get the shield. Renamed `vanillaCheck` to `vanillaHundoCheck` to (supposedly) clarify the meaning of the usage. * One more rename to `vanillaCompletion` to avoid possible confusion with 100% speedrun conditions. * give me a break XD Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * Changes suggested by briaguya (rename `RandomizerCheckShow` to `Status`, unused code, newline formatting) * Remove unused `itemNames` table. * Remove `IsGameRunning` in favor of `GameInteractor::IsSaveLoaded`. * Restore anti-spoiler functionality for dungeons with dungeon maps. * Review cleanup. * Fix prices not showing for Kak bazaar items. --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com>
2023-10-04 11:03:36 -04:00
}
Flag tracker (#3447) * Hook into flagset hooks for processing check tracking. Has some manual workarounds (some breaks still need to be found). Remove areaChecks and looping functionality as redundant. * Additional vanilla handling. * Fix tracker not showing MQ checks in MQ non-rando. Fix tracker marking non-MQ variants of dungeon checks (e.g. map chest, etc) when collecting in MQ. * Set all areas to spoiled if not rando. * Revert attempt to spoil in randomizer based on MQ dungeon count as I don't know how that works at the moment. * Restore and update spoiling based on MQ dungeon settings (none, selection, or count of 12). Fix Anju As Adult check. * Remove Anchor-specific code :baguette: * Use `ClearAreaTotals()` in `Teardown()` instead of the duplicate code there. * Update to `ClearAreaChecksAndTotals()` with `vec.clear()` added. * Fix type spoiling again. Now spoils on 0 MQ dungeons, not rando, if the option is enabled in check tracker settings, selection, or set number of 12. Fix vanilla checks being marked collected in MQ dungeons. * Fix 100 GS check. * ACTUALLY fix 100 GS: change flag type to `RandomizerInf()` in `item_location.cpp`, add RC to RandoInf for it to the table. Also don't send GI for flag if father, falsely triggers ZR frogs minigame. * Fix gravedigging tour tracking. * Fix membership card check tracking. Change scene and flag values to any existing enums. Clarifying formatting for the checking loop vOrMQ conditions. * Fix Gravedigging Tour tracking. Simplify Always Win Gravedigging Tour and Fix Gravedigging Tour Glitch applications. Modified all necessary paths to use vanilla GDT PoH collection flag instead of randomizer variant. * Fix Kak Potion Shop being "seen" when entering as child.
2023-11-28 21:25:48 -05:00
}
void CheckTrackerSceneFlagSet(int16_t sceneNum, int16_t flagType, int32_t flag) {
if (flagType != FLAG_SCENE_TREASURE && flagType != FLAG_SCENE_COLLECTIBLE) {
Check Tracker Update (#2668) * Initial commit. What works so far: Data file loads, saves, deletes, and is created properly. - Need to run `HasItemBeenCollected` when creating in case of mid-seed regen. Organized checks into maps set by area. Areas show in tracker. - Checks pulled from checkObjectsByArea are not currently listed. - Areas are being assumed completed and hidden at the start. * Checks now populate. Still not counting area totals properly. * Don't track RC_LINKS_POCKET in the data file, and instead manually add it in every time a save is load. rcObjects doesn't contain Link's Pocket location (duh). * Moved ItemReceive hook to randomizer_check_tracker.cpp. Skipped items are properly sorted and formatted. Saved items contribute to an area's gotten/skipped checks on load. Changed skipped items default main color to gray. General code cleanup. * Skipped checks now contribute to area totals for area completion logic. * Mid-menu rework transfer. * Started check lookup on item receive. Tried to enable scum checking on save. * Fixed scum check on save. * More code cleanup, which revealed some issues with loading and saving. Loading now works 100%, but entries in checkTrackerData are disappearing in code somewhere, causing issues with later checks. Scummed color now displays properly. Collected but unsaved displays properly. Unchecked, Skipped, Seen and Scummed checks all have arrows for skipping/unskipping. Counts a little messed up, probably double adding skips. * Fixed item counts being off across resets. Restarts were fine. * Beginning of rework for individual check updates. Adds `Actor lastCheck` to PlayState to allow assigning of last actor to give an item. This allows precise tracking of GS, freestanding PoH, etc. Works for chests too. Currently does not work for shops, unknown for normal NPC gives. Doesn't track last gives for non-checks, like drops from grass, pots, crates, etc. * Actor-based checks fully fleshed out, but can't help with sale-based checks. Implemented `pendingSaleCheck` to back out of an RC check cycle if `gSaveContext->pendingSale` is not NONE when `OnItemReceive` is called, processed through `OnSaleEnd`. This should be the final change necessary to streamline the checks. * Temporary hook to message box close to tie in trackers for non-gs/chest actors that aren't added to `GetCheckFromActor`. This triggers a 2-frame countdown to check with `HasItemBeenCollected` since half of the methods in there aren't updated until after a text box closes. Added scene tracking to get last scene so that checks in scenes that span several overworld areas could be tied to their areas properly. Modified tracker data creation to apply Link's Pocket and Song from Impa conditionally based on randomizer settings instead of just being assumed to be done. May need modification for checking click and drag spoiler loading. Removed the scene equivalence check from CheckChecks so that an entire area is checked each time to avoid issues with, e.g., leaving a shop before a pending sale finishes. * Changed check data creation to use RSKs from gRandomizer to account for settings loaded from drag and drop spoilers. * Beginning of tracker code organization. Changed check color defaults. * Reverted moving tracker colors to header. Some individual check fixes. * Missed something from previous merge? * Removed last remnant of removed performance mode. * Better handle checking when skullsanity is off. * Song checks sceneIDs don't match the scenes they're actually in for some reason. Removed that check. * SaleEnd checks don't need the GetItemEntry parameter. Also set a flag that should prevent the check tracker from running during vanilla saves should that not be resolved by the time it's merged. * Attempting to have only the relevant checks added to the tracker data, as well as showing vanilla checks for non-rando saves. Not working yet (everything is displayed in vanilla). * Added vanilla check tracker population via `vanillaCheck` bool in `RandomizerCheckObject`. This is also added to `IsVisibleInImGui` to handle file loading and saving to eliminate checks that aren't part of vanilla or the rando seed. Implemented deleted tracker data file recreation. Added some extra item name text checks. Songs are still... tricky, so they stay blank. Utilize local copies of the randomizer check objects that are applicable for performance purposes. Fixed vanilla item-giving cutscene crashes when triggered mid-transition. * Apparently not all toolchains can handle macro instantiation without all parameters, like VS can. * Fixed scummed detail color not showing properly on tracker. * Fixed dungeon area totals and GS checks not functioning properly. * Major revamp of checking code. Doesn't rely on `GetCheckFromActor` at all anymore, but instead simply sets a flag to evaluate a number of checks in an area every frame until the check that was gotten is identified. With the new setup, it's much less hardware intensive, and at 60fps 6 checks per frame shows no noticeable effect on framerate. I can envision needing to add a collectedCount in order to account for times when two checks are gotten one right after the other. Changed area scroll to happen from `OnTransitionEnd`, and allow for scrolling in bazaar (was disabled previously because it would jump back and forth between Kak and Market while you were in one). Also setup area check order updating by area instead of all at the same time. * Fixed shooting gallery not reporting proper area. Prevent checks from actually happening if area is RCAREA_INVALID, now that all areas are reporting something if they have checks. Fixed `GetCheckArea()` not updating checks for standard scenes. Lots of vanilla tracking updates, mainly manual checks for gems, medallions and songs, since the often don't have proper scenes in the data. Prevent vanilla from triggering check loops if junk items are collected. Fixed sorting based on saved vs collected. Prevent item name display for vanilla runs. Change coloring of checks so the check name reflects status in vanilla runs. * Fixed "Recheck Area" button erroneously adding to an area's check totals? * Fix DMC vanilla checks. * Fix check tracker data recreation on data file loss. Removed redundant file exists check from SaveTrackerDataHook, as it doesn't matter if it exists or not at that point. Limited check loops to 3 to avoid infinite check loops on non-check/junk item pickup. Added more checks to disable tracker operations if a save is not running. Changed check ordering to put boss reward and heart container checks at the end of whatever RCSHOW group they belong to. * Fixed IsRunning calculation. Further improving vanilla checking. Starting framework for checking medallions, stones, and songs on data file recreation. Fixed medallion check collection. Added GIFT_FROM_SAGES to check list for vanilla file for tracking light medallion. Added check loop limitation to prevent infinite checking after picking up junk item from the ground. * Finished vanilla file recreation and recheck (songs and dungeon rewards all check properly now). This includes deku shield with KF shop item 3. Finished Gift from Raoru light medallion tracking for vanilla. Commented all CheckByScene functionality for now. * Fixed new save data file creation. Disabled entrance area calculation for now, as it only tracks the previous entrance for some reason. Fixed area detection for ToT checks. * GetCheckArea() now utilizes EntranceData almost exclusively, via either `gSaveContext.entranceIndex` or the entrance tracker's `currentGrottoId` in the case of grottos. This also means that EVERYTHING CAN AUTOSCROLL NOW. Entrance shuffles are now much easier to track. Autoscroll is now also triggered on save, just in case someone isn't autosaving and has a lot of checks that get converted to saved. * Fixed missing GS check in LW. * Added area scroll on toggling Show Hidden Items. May configure differently later. Fixed area detection for entrances in Gerudo Fortress/Valley and Collossus. Haunted wasteland doesn't autoscroll due to a bug in `OnTransitionEnd` hook, but checks still evaluate properly there. Rely on scene-based area detection if scene is a main overworld or dungeon scene. * Fixed grotto detection when shuffle is off. * Small code cleanup. Fixed Colossus hand chest checks. * Missing lus bump from merge conflict resolution * Fixed Colossus Grotto making `GetCheckArea` return Wasteland. * Improved OnItemReceive processing for non-token GS checks, since they can sometimes take long enough for the checking process to time out before the item is registered as received. * First attempt at thread safety for tracker data file writing. Seems to work, but might need more testing. * Fixed Recheck Area not unskipping items that register as saved. Improved delayed saving with autosaving, as the autosave triggered quite often before the tracker data save, making things not properly register as saved. * merge cleanup * Converted check tracker data to the sectional saves, adding `CheckTrackerData` to `SaveContext`. Implemented section ID returning and fullSave boolean passing to section functions from my PR temporarily for it to work properly. Moved `RandomizerCheckTrackerData` enum to `randomizerTypes.h` to accommodate that. Changed `Randomizer_SaveInit` to a `SaveManager::InitFunc` to allow for other randomizer-dependent sections to be initialized after that. Required a little refactoring to maintain intro cutscene skip when starting a randomizer file. * Revert section index return and randomizer init changes. Will need to wait on yet more changes to main. * Fixed check tracker initialization (shouldn't be tied to window initialization), restored saving/loading functionality. * Removed `CheckTracker::Init` and put SaveManager calls in `CheckTrackerWindow::InitElement`. Also a bit of cleanup from transition back to save file use. * Fixed tracker displaying check categories while file not loaded. * Fix Darunia's Joy check not marking in vanilla. * Fix autosave not triggering change from collected to saved in tracker data. * Changed default colors for scummed and collected display. * Merge upgrade code cleanup. * Add `OnTransitionEnd` calls to sandstorm transitions both to and from Wasteland. Also improved `gSaveContext.lastScene` assignment for both transition types. Allowed a bit of cleanup in `GetCheckArea`. * Added `StateButton`, a button like `ArrowButton` but that allows text instead of arrow icons. Apparently the changes from ArrowButton to StateButton happened in a previous commit... * Changed section name to `trackerDataCheck` to force SoH to load it after the randomizer section, as it required some randoSettings to be loaded first, and nothing else I tried to make the randomizer section load before it worked. This hacks a solution to checks not displaying on fast file load to a specific slot. F*** you, SaveManager, and f*** you too, JSON. * Forgot to change the section string for loading with the name change. * Fix check ordering for checks that trigger the autosave. * Adds option to remove right-side shop items (slots 1-4) from the tracker list. Enabled by default. * Fix default state of Hide Shop Right Checks checkbox. * Fixes grotto and great fairy scrolling and checks. Fixes array overflow from `checkTrackerData` which was creating the issue trying to load the base and randomizer sections first, among other things. That also fixed the massive file loads that were being exhibited in debug mode. * Fix shooting galleries being set as collected again when being played a second time after getting the checks. * Fix Bazaar autoscroll. * Add Saria's Song to `GetCheckFromActor` and removed some limitations from the messageCloseCheck function to make that check track properly. * Fix Song from Impa check. Implemented prevention for multiple "collections" of great fairies, just in case getting the health refill would trigger it with the previous setup. * Fix ice traps on GS tokens not triggering OnItemReceive. * Complete fix for ice trap collection from GS. Add autoscroll when clicking "Expand All". * Add `OnShopSlotChange` with cursorSlot and basePrice parameters. * Fixed include in en_ossan for shop slot hook. Added registration for `OnShopSlotChange` in the tracker, storing the price in a new `price` field in `CheckTrackerData`. Added "seen" functionality to shop checks. Displays the model item name upon first entering a shop, adding the price and switching to trickName (if it's an ice trap) upon navigating to the slot in buy mode, triggered by an invisible "identified" status that mirrors "seen" in every other way. Added tooltips to most options for check tracker color picking to describe what each status actually means. * `std::format` pls * So apparently std::format just decided to break with the latest merge from develop, but fmt::format exists and works? * Removed the last vestiges of `locationsSkipped`. Other general code and formatting cleanups. Moved `IsGameRunning` to `OTRGlobals` so the item tracker could also access it. Used preceding to "fix" item and bottle display in the item tracker on startup. * Some more code cleanup. Removed "Recheck Area" button and relevant code. Backported changes to Anchor branch applicable for single-player, including making a checkAreas vector and structuring the frame by frame checks around that. Also includes fix for Silver Gauntlets and Mirror Shield check collection crash associated with those changes. Fixed Kakariko Bazaar "seen" updates. Fixed tracker window not showing on initial load like it should. * Forgot 1 formatting fix. * Removed conditions for showing Song from Impa (isn't junk under certain conditions, so should show all the time). * Fix vanilla checks, add Zelda's Letter and Malon's Egg to manual check collection. Fix autoscroll while in child stealth section. * Fix crash in Happy Mask Shop in OnSlotChange (referenced non-existent shop id in a tracker-specific enum). * General code cleanup. * Missed one reversion. * One more. * Fix column alignment in `randomizer_check_objects`. * Fix file encoding on `randomizer_check_tracker`. Again. * Fix indentation for `actualItemtrackerItemMap`. Also removed unnecessary parts of the map. * Rename `HasEqItem` to `HasEquipment`. * Slightly better indentation for `actualItemTrackerItemMap`. * Add magic bean salesman to vanilla check tracking, and genericized deku shield to trigger KF shop item 3 wherever you get the shield. Renamed `vanillaCheck` to `vanillaHundoCheck` to (supposedly) clarify the meaning of the usage. * One more rename to `vanillaCompletion` to avoid possible confusion with 100% speedrun conditions. * give me a break XD Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * Changes suggested by briaguya (rename `RandomizerCheckShow` to `Status`, unused code, newline formatting) * Remove unused `itemNames` table. * Remove `IsGameRunning` in favor of `GameInteractor::IsSaveLoaded`. * Restore anti-spoiler functionality for dungeons with dungeon maps. * Review cleanup. * Fix prices not showing for Kak bazaar items. --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com>
2023-10-04 11:03:36 -04:00
return;
}
Flag tracker (#3447) * Hook into flagset hooks for processing check tracking. Has some manual workarounds (some breaks still need to be found). Remove areaChecks and looping functionality as redundant. * Additional vanilla handling. * Fix tracker not showing MQ checks in MQ non-rando. Fix tracker marking non-MQ variants of dungeon checks (e.g. map chest, etc) when collecting in MQ. * Set all areas to spoiled if not rando. * Revert attempt to spoil in randomizer based on MQ dungeon count as I don't know how that works at the moment. * Restore and update spoiling based on MQ dungeon settings (none, selection, or count of 12). Fix Anju As Adult check. * Remove Anchor-specific code :baguette: * Use `ClearAreaTotals()` in `Teardown()` instead of the duplicate code there. * Update to `ClearAreaChecksAndTotals()` with `vec.clear()` added. * Fix type spoiling again. Now spoils on 0 MQ dungeons, not rando, if the option is enabled in check tracker settings, selection, or set number of 12. Fix vanilla checks being marked collected in MQ dungeons. * Fix 100 GS check. * ACTUALLY fix 100 GS: change flag type to `RandomizerInf()` in `item_location.cpp`, add RC to RandoInf for it to the table. Also don't send GI for flag if father, falsely triggers ZR frogs minigame. * Fix gravedigging tour tracking. * Fix membership card check tracking. Change scene and flag values to any existing enums. Clarifying formatting for the checking loop vOrMQ conditions. * Fix Gravedigging Tour tracking. Simplify Always Win Gravedigging Tour and Fix Gravedigging Tour Glitch applications. Modified all necessary paths to use vanilla GDT PoH collection flag instead of randomizer variant. * Fix Kak Potion Shop being "seen" when entering as child.
2023-11-28 21:25:48 -05:00
if (sceneNum == SCENE_GRAVEYARD && flag == 0x19 && flagType == FLAG_SCENE_COLLECTIBLE) { // Gravedigging tour special case
SetCheckCollected(RC_GRAVEYARD_DAMPE_GRAVEDIGGING_TOUR);
Check Tracker Update (#2668) * Initial commit. What works so far: Data file loads, saves, deletes, and is created properly. - Need to run `HasItemBeenCollected` when creating in case of mid-seed regen. Organized checks into maps set by area. Areas show in tracker. - Checks pulled from checkObjectsByArea are not currently listed. - Areas are being assumed completed and hidden at the start. * Checks now populate. Still not counting area totals properly. * Don't track RC_LINKS_POCKET in the data file, and instead manually add it in every time a save is load. rcObjects doesn't contain Link's Pocket location (duh). * Moved ItemReceive hook to randomizer_check_tracker.cpp. Skipped items are properly sorted and formatted. Saved items contribute to an area's gotten/skipped checks on load. Changed skipped items default main color to gray. General code cleanup. * Skipped checks now contribute to area totals for area completion logic. * Mid-menu rework transfer. * Started check lookup on item receive. Tried to enable scum checking on save. * Fixed scum check on save. * More code cleanup, which revealed some issues with loading and saving. Loading now works 100%, but entries in checkTrackerData are disappearing in code somewhere, causing issues with later checks. Scummed color now displays properly. Collected but unsaved displays properly. Unchecked, Skipped, Seen and Scummed checks all have arrows for skipping/unskipping. Counts a little messed up, probably double adding skips. * Fixed item counts being off across resets. Restarts were fine. * Beginning of rework for individual check updates. Adds `Actor lastCheck` to PlayState to allow assigning of last actor to give an item. This allows precise tracking of GS, freestanding PoH, etc. Works for chests too. Currently does not work for shops, unknown for normal NPC gives. Doesn't track last gives for non-checks, like drops from grass, pots, crates, etc. * Actor-based checks fully fleshed out, but can't help with sale-based checks. Implemented `pendingSaleCheck` to back out of an RC check cycle if `gSaveContext->pendingSale` is not NONE when `OnItemReceive` is called, processed through `OnSaleEnd`. This should be the final change necessary to streamline the checks. * Temporary hook to message box close to tie in trackers for non-gs/chest actors that aren't added to `GetCheckFromActor`. This triggers a 2-frame countdown to check with `HasItemBeenCollected` since half of the methods in there aren't updated until after a text box closes. Added scene tracking to get last scene so that checks in scenes that span several overworld areas could be tied to their areas properly. Modified tracker data creation to apply Link's Pocket and Song from Impa conditionally based on randomizer settings instead of just being assumed to be done. May need modification for checking click and drag spoiler loading. Removed the scene equivalence check from CheckChecks so that an entire area is checked each time to avoid issues with, e.g., leaving a shop before a pending sale finishes. * Changed check data creation to use RSKs from gRandomizer to account for settings loaded from drag and drop spoilers. * Beginning of tracker code organization. Changed check color defaults. * Reverted moving tracker colors to header. Some individual check fixes. * Missed something from previous merge? * Removed last remnant of removed performance mode. * Better handle checking when skullsanity is off. * Song checks sceneIDs don't match the scenes they're actually in for some reason. Removed that check. * SaleEnd checks don't need the GetItemEntry parameter. Also set a flag that should prevent the check tracker from running during vanilla saves should that not be resolved by the time it's merged. * Attempting to have only the relevant checks added to the tracker data, as well as showing vanilla checks for non-rando saves. Not working yet (everything is displayed in vanilla). * Added vanilla check tracker population via `vanillaCheck` bool in `RandomizerCheckObject`. This is also added to `IsVisibleInImGui` to handle file loading and saving to eliminate checks that aren't part of vanilla or the rando seed. Implemented deleted tracker data file recreation. Added some extra item name text checks. Songs are still... tricky, so they stay blank. Utilize local copies of the randomizer check objects that are applicable for performance purposes. Fixed vanilla item-giving cutscene crashes when triggered mid-transition. * Apparently not all toolchains can handle macro instantiation without all parameters, like VS can. * Fixed scummed detail color not showing properly on tracker. * Fixed dungeon area totals and GS checks not functioning properly. * Major revamp of checking code. Doesn't rely on `GetCheckFromActor` at all anymore, but instead simply sets a flag to evaluate a number of checks in an area every frame until the check that was gotten is identified. With the new setup, it's much less hardware intensive, and at 60fps 6 checks per frame shows no noticeable effect on framerate. I can envision needing to add a collectedCount in order to account for times when two checks are gotten one right after the other. Changed area scroll to happen from `OnTransitionEnd`, and allow for scrolling in bazaar (was disabled previously because it would jump back and forth between Kak and Market while you were in one). Also setup area check order updating by area instead of all at the same time. * Fixed shooting gallery not reporting proper area. Prevent checks from actually happening if area is RCAREA_INVALID, now that all areas are reporting something if they have checks. Fixed `GetCheckArea()` not updating checks for standard scenes. Lots of vanilla tracking updates, mainly manual checks for gems, medallions and songs, since the often don't have proper scenes in the data. Prevent vanilla from triggering check loops if junk items are collected. Fixed sorting based on saved vs collected. Prevent item name display for vanilla runs. Change coloring of checks so the check name reflects status in vanilla runs. * Fixed "Recheck Area" button erroneously adding to an area's check totals? * Fix DMC vanilla checks. * Fix check tracker data recreation on data file loss. Removed redundant file exists check from SaveTrackerDataHook, as it doesn't matter if it exists or not at that point. Limited check loops to 3 to avoid infinite check loops on non-check/junk item pickup. Added more checks to disable tracker operations if a save is not running. Changed check ordering to put boss reward and heart container checks at the end of whatever RCSHOW group they belong to. * Fixed IsRunning calculation. Further improving vanilla checking. Starting framework for checking medallions, stones, and songs on data file recreation. Fixed medallion check collection. Added GIFT_FROM_SAGES to check list for vanilla file for tracking light medallion. Added check loop limitation to prevent infinite checking after picking up junk item from the ground. * Finished vanilla file recreation and recheck (songs and dungeon rewards all check properly now). This includes deku shield with KF shop item 3. Finished Gift from Raoru light medallion tracking for vanilla. Commented all CheckByScene functionality for now. * Fixed new save data file creation. Disabled entrance area calculation for now, as it only tracks the previous entrance for some reason. Fixed area detection for ToT checks. * GetCheckArea() now utilizes EntranceData almost exclusively, via either `gSaveContext.entranceIndex` or the entrance tracker's `currentGrottoId` in the case of grottos. This also means that EVERYTHING CAN AUTOSCROLL NOW. Entrance shuffles are now much easier to track. Autoscroll is now also triggered on save, just in case someone isn't autosaving and has a lot of checks that get converted to saved. * Fixed missing GS check in LW. * Added area scroll on toggling Show Hidden Items. May configure differently later. Fixed area detection for entrances in Gerudo Fortress/Valley and Collossus. Haunted wasteland doesn't autoscroll due to a bug in `OnTransitionEnd` hook, but checks still evaluate properly there. Rely on scene-based area detection if scene is a main overworld or dungeon scene. * Fixed grotto detection when shuffle is off. * Small code cleanup. Fixed Colossus hand chest checks. * Missing lus bump from merge conflict resolution * Fixed Colossus Grotto making `GetCheckArea` return Wasteland. * Improved OnItemReceive processing for non-token GS checks, since they can sometimes take long enough for the checking process to time out before the item is registered as received. * First attempt at thread safety for tracker data file writing. Seems to work, but might need more testing. * Fixed Recheck Area not unskipping items that register as saved. Improved delayed saving with autosaving, as the autosave triggered quite often before the tracker data save, making things not properly register as saved. * merge cleanup * Converted check tracker data to the sectional saves, adding `CheckTrackerData` to `SaveContext`. Implemented section ID returning and fullSave boolean passing to section functions from my PR temporarily for it to work properly. Moved `RandomizerCheckTrackerData` enum to `randomizerTypes.h` to accommodate that. Changed `Randomizer_SaveInit` to a `SaveManager::InitFunc` to allow for other randomizer-dependent sections to be initialized after that. Required a little refactoring to maintain intro cutscene skip when starting a randomizer file. * Revert section index return and randomizer init changes. Will need to wait on yet more changes to main. * Fixed check tracker initialization (shouldn't be tied to window initialization), restored saving/loading functionality. * Removed `CheckTracker::Init` and put SaveManager calls in `CheckTrackerWindow::InitElement`. Also a bit of cleanup from transition back to save file use. * Fixed tracker displaying check categories while file not loaded. * Fix Darunia's Joy check not marking in vanilla. * Fix autosave not triggering change from collected to saved in tracker data. * Changed default colors for scummed and collected display. * Merge upgrade code cleanup. * Add `OnTransitionEnd` calls to sandstorm transitions both to and from Wasteland. Also improved `gSaveContext.lastScene` assignment for both transition types. Allowed a bit of cleanup in `GetCheckArea`. * Added `StateButton`, a button like `ArrowButton` but that allows text instead of arrow icons. Apparently the changes from ArrowButton to StateButton happened in a previous commit... * Changed section name to `trackerDataCheck` to force SoH to load it after the randomizer section, as it required some randoSettings to be loaded first, and nothing else I tried to make the randomizer section load before it worked. This hacks a solution to checks not displaying on fast file load to a specific slot. F*** you, SaveManager, and f*** you too, JSON. * Forgot to change the section string for loading with the name change. * Fix check ordering for checks that trigger the autosave. * Adds option to remove right-side shop items (slots 1-4) from the tracker list. Enabled by default. * Fix default state of Hide Shop Right Checks checkbox. * Fixes grotto and great fairy scrolling and checks. Fixes array overflow from `checkTrackerData` which was creating the issue trying to load the base and randomizer sections first, among other things. That also fixed the massive file loads that were being exhibited in debug mode. * Fix shooting galleries being set as collected again when being played a second time after getting the checks. * Fix Bazaar autoscroll. * Add Saria's Song to `GetCheckFromActor` and removed some limitations from the messageCloseCheck function to make that check track properly. * Fix Song from Impa check. Implemented prevention for multiple "collections" of great fairies, just in case getting the health refill would trigger it with the previous setup. * Fix ice traps on GS tokens not triggering OnItemReceive. * Complete fix for ice trap collection from GS. Add autoscroll when clicking "Expand All". * Add `OnShopSlotChange` with cursorSlot and basePrice parameters. * Fixed include in en_ossan for shop slot hook. Added registration for `OnShopSlotChange` in the tracker, storing the price in a new `price` field in `CheckTrackerData`. Added "seen" functionality to shop checks. Displays the model item name upon first entering a shop, adding the price and switching to trickName (if it's an ice trap) upon navigating to the slot in buy mode, triggered by an invisible "identified" status that mirrors "seen" in every other way. Added tooltips to most options for check tracker color picking to describe what each status actually means. * `std::format` pls * So apparently std::format just decided to break with the latest merge from develop, but fmt::format exists and works? * Removed the last vestiges of `locationsSkipped`. Other general code and formatting cleanups. Moved `IsGameRunning` to `OTRGlobals` so the item tracker could also access it. Used preceding to "fix" item and bottle display in the item tracker on startup. * Some more code cleanup. Removed "Recheck Area" button and relevant code. Backported changes to Anchor branch applicable for single-player, including making a checkAreas vector and structuring the frame by frame checks around that. Also includes fix for Silver Gauntlets and Mirror Shield check collection crash associated with those changes. Fixed Kakariko Bazaar "seen" updates. Fixed tracker window not showing on initial load like it should. * Forgot 1 formatting fix. * Removed conditions for showing Song from Impa (isn't junk under certain conditions, so should show all the time). * Fix vanilla checks, add Zelda's Letter and Malon's Egg to manual check collection. Fix autoscroll while in child stealth section. * Fix crash in Happy Mask Shop in OnSlotChange (referenced non-existent shop id in a tracker-specific enum). * General code cleanup. * Missed one reversion. * One more. * Fix column alignment in `randomizer_check_objects`. * Fix file encoding on `randomizer_check_tracker`. Again. * Fix indentation for `actualItemtrackerItemMap`. Also removed unnecessary parts of the map. * Rename `HasEqItem` to `HasEquipment`. * Slightly better indentation for `actualItemTrackerItemMap`. * Add magic bean salesman to vanilla check tracking, and genericized deku shield to trigger KF shop item 3 wherever you get the shield. Renamed `vanillaCheck` to `vanillaHundoCheck` to (supposedly) clarify the meaning of the usage. * One more rename to `vanillaCompletion` to avoid possible confusion with 100% speedrun conditions. * give me a break XD Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * Changes suggested by briaguya (rename `RandomizerCheckShow` to `Status`, unused code, newline formatting) * Remove unused `itemNames` table. * Remove `IsGameRunning` in favor of `GameInteractor::IsSaveLoaded`. * Restore anti-spoiler functionality for dungeons with dungeon maps. * Review cleanup. * Fix prices not showing for Kak bazaar items. --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com>
2023-10-04 11:03:36 -04:00
return;
}
Flag tracker (#3447) * Hook into flagset hooks for processing check tracking. Has some manual workarounds (some breaks still need to be found). Remove areaChecks and looping functionality as redundant. * Additional vanilla handling. * Fix tracker not showing MQ checks in MQ non-rando. Fix tracker marking non-MQ variants of dungeon checks (e.g. map chest, etc) when collecting in MQ. * Set all areas to spoiled if not rando. * Revert attempt to spoil in randomizer based on MQ dungeon count as I don't know how that works at the moment. * Restore and update spoiling based on MQ dungeon settings (none, selection, or count of 12). Fix Anju As Adult check. * Remove Anchor-specific code :baguette: * Use `ClearAreaTotals()` in `Teardown()` instead of the duplicate code there. * Update to `ClearAreaChecksAndTotals()` with `vec.clear()` added. * Fix type spoiling again. Now spoils on 0 MQ dungeons, not rando, if the option is enabled in check tracker settings, selection, or set number of 12. Fix vanilla checks being marked collected in MQ dungeons. * Fix 100 GS check. * ACTUALLY fix 100 GS: change flag type to `RandomizerInf()` in `item_location.cpp`, add RC to RandoInf for it to the table. Also don't send GI for flag if father, falsely triggers ZR frogs minigame. * Fix gravedigging tour tracking. * Fix membership card check tracking. Change scene and flag values to any existing enums. Clarifying formatting for the checking loop vOrMQ conditions. * Fix Gravedigging Tour tracking. Simplify Always Win Gravedigging Tour and Fix Gravedigging Tour Glitch applications. Modified all necessary paths to use vanilla GDT PoH collection flag instead of randomizer variant. * Fix Kak Potion Shop being "seen" when entering as child.
2023-11-28 21:25:48 -05:00
for (auto [rc, rcObj] : RandomizerCheckObjects::GetAllRCObjects()) {
if (!IsVisibleInCheckTracker(rcObj)) {
continue;
}
SpoilerCollectionCheckType checkMatchType = flagType == FLAG_SCENE_TREASURE ? SpoilerCollectionCheckType::SPOILER_CHK_CHEST : SpoilerCollectionCheckType::SPOILER_CHK_COLLECTABLE;
SpoilerCollectionCheck scCheck = Location(rc)->GetCollectionCheck();
if (scCheck.scene == sceneNum && scCheck.flag == flag && scCheck.type == checkMatchType) {
SetCheckCollected(rc);
return;
}
}
}
void CheckTrackerFlagSet(int16_t flagType, int32_t flag) {
SpoilerCollectionCheckType checkMatchType = SpoilerCollectionCheckType::SPOILER_CHK_NONE;
switch (flagType) {
case FLAG_GS_TOKEN:
checkMatchType = SpoilerCollectionCheckType::SPOILER_CHK_GOLD_SKULLTULA;
break;
case FLAG_EVENT_CHECK_INF:
if ((flag == EVENTCHKINF_CARPENTERS_FREE(0) || flag == EVENTCHKINF_CARPENTERS_FREE(1) ||
flag == EVENTCHKINF_CARPENTERS_FREE(2) || flag == EVENTCHKINF_CARPENTERS_FREE(3))
&& GET_EVENTCHKINF_CARPENTERS_FREE_ALL()) {
SetCheckCollected(RC_GF_GERUDO_MEMBERSHIP_CARD);
return;
}
checkMatchType = SpoilerCollectionCheckType::SPOILER_CHK_EVENT_CHK_INF;
break;
case FLAG_INF_TABLE:
if (flag == INFTABLE_190) {
SetCheckCollected(RC_GF_HBA_1000_POINTS);
return;
} else if (flag == INFTABLE_11E) {
SetCheckCollected(RC_GC_ROLLING_GORON_AS_CHILD);
return;
} else if (flag == INFTABLE_GORON_CITY_DOORS_UNLOCKED) {
SetCheckCollected(RC_GC_ROLLING_GORON_AS_ADULT);
return;
} else if (flag == INFTABLE_139) {
SetCheckCollected(RC_ZD_KING_ZORA_THAWED);
return;
} else if (flag == INFTABLE_191) {
SetCheckCollected(RC_MARKET_LOST_DOG);
return;
}
if (!IS_RANDO) {
if (flag == INFTABLE_192) {
SetCheckCollected(RC_LW_DEKU_SCRUB_NEAR_BRIDGE);
return;
} else if (flag == INFTABLE_193) {
SetCheckCollected(RC_LW_DEKU_SCRUB_GROTTO_FRONT);
return;
}
}
break;
case FLAG_ITEM_GET_INF:
if (!IS_RANDO) {
if (flag == ITEMGETINF_OBTAINED_STICK_UPGRADE_FROM_STAGE) {
SetCheckCollected(RC_DEKU_THEATER_SKULL_MASK);
return;
} else if (flag == ITEMGETINF_OBTAINED_NUT_UPGRADE_FROM_STAGE) {
SetCheckCollected(RC_DEKU_THEATER_MASK_OF_TRUTH);
return;
} else if (flag == ITEMGETINF_0B) {
SetCheckCollected(RC_HF_DEKU_SCRUB_GROTTO);
return;
}
}
checkMatchType = SpoilerCollectionCheckType::SPOILER_CHK_ITEM_GET_INF;
break;
case FLAG_RANDOMIZER_INF:
checkMatchType = SpoilerCollectionCheckType::SPOILER_CHK_RANDOMIZER_INF;
break;
Check Tracker Update (#2668) * Initial commit. What works so far: Data file loads, saves, deletes, and is created properly. - Need to run `HasItemBeenCollected` when creating in case of mid-seed regen. Organized checks into maps set by area. Areas show in tracker. - Checks pulled from checkObjectsByArea are not currently listed. - Areas are being assumed completed and hidden at the start. * Checks now populate. Still not counting area totals properly. * Don't track RC_LINKS_POCKET in the data file, and instead manually add it in every time a save is load. rcObjects doesn't contain Link's Pocket location (duh). * Moved ItemReceive hook to randomizer_check_tracker.cpp. Skipped items are properly sorted and formatted. Saved items contribute to an area's gotten/skipped checks on load. Changed skipped items default main color to gray. General code cleanup. * Skipped checks now contribute to area totals for area completion logic. * Mid-menu rework transfer. * Started check lookup on item receive. Tried to enable scum checking on save. * Fixed scum check on save. * More code cleanup, which revealed some issues with loading and saving. Loading now works 100%, but entries in checkTrackerData are disappearing in code somewhere, causing issues with later checks. Scummed color now displays properly. Collected but unsaved displays properly. Unchecked, Skipped, Seen and Scummed checks all have arrows for skipping/unskipping. Counts a little messed up, probably double adding skips. * Fixed item counts being off across resets. Restarts were fine. * Beginning of rework for individual check updates. Adds `Actor lastCheck` to PlayState to allow assigning of last actor to give an item. This allows precise tracking of GS, freestanding PoH, etc. Works for chests too. Currently does not work for shops, unknown for normal NPC gives. Doesn't track last gives for non-checks, like drops from grass, pots, crates, etc. * Actor-based checks fully fleshed out, but can't help with sale-based checks. Implemented `pendingSaleCheck` to back out of an RC check cycle if `gSaveContext->pendingSale` is not NONE when `OnItemReceive` is called, processed through `OnSaleEnd`. This should be the final change necessary to streamline the checks. * Temporary hook to message box close to tie in trackers for non-gs/chest actors that aren't added to `GetCheckFromActor`. This triggers a 2-frame countdown to check with `HasItemBeenCollected` since half of the methods in there aren't updated until after a text box closes. Added scene tracking to get last scene so that checks in scenes that span several overworld areas could be tied to their areas properly. Modified tracker data creation to apply Link's Pocket and Song from Impa conditionally based on randomizer settings instead of just being assumed to be done. May need modification for checking click and drag spoiler loading. Removed the scene equivalence check from CheckChecks so that an entire area is checked each time to avoid issues with, e.g., leaving a shop before a pending sale finishes. * Changed check data creation to use RSKs from gRandomizer to account for settings loaded from drag and drop spoilers. * Beginning of tracker code organization. Changed check color defaults. * Reverted moving tracker colors to header. Some individual check fixes. * Missed something from previous merge? * Removed last remnant of removed performance mode. * Better handle checking when skullsanity is off. * Song checks sceneIDs don't match the scenes they're actually in for some reason. Removed that check. * SaleEnd checks don't need the GetItemEntry parameter. Also set a flag that should prevent the check tracker from running during vanilla saves should that not be resolved by the time it's merged. * Attempting to have only the relevant checks added to the tracker data, as well as showing vanilla checks for non-rando saves. Not working yet (everything is displayed in vanilla). * Added vanilla check tracker population via `vanillaCheck` bool in `RandomizerCheckObject`. This is also added to `IsVisibleInImGui` to handle file loading and saving to eliminate checks that aren't part of vanilla or the rando seed. Implemented deleted tracker data file recreation. Added some extra item name text checks. Songs are still... tricky, so they stay blank. Utilize local copies of the randomizer check objects that are applicable for performance purposes. Fixed vanilla item-giving cutscene crashes when triggered mid-transition. * Apparently not all toolchains can handle macro instantiation without all parameters, like VS can. * Fixed scummed detail color not showing properly on tracker. * Fixed dungeon area totals and GS checks not functioning properly. * Major revamp of checking code. Doesn't rely on `GetCheckFromActor` at all anymore, but instead simply sets a flag to evaluate a number of checks in an area every frame until the check that was gotten is identified. With the new setup, it's much less hardware intensive, and at 60fps 6 checks per frame shows no noticeable effect on framerate. I can envision needing to add a collectedCount in order to account for times when two checks are gotten one right after the other. Changed area scroll to happen from `OnTransitionEnd`, and allow for scrolling in bazaar (was disabled previously because it would jump back and forth between Kak and Market while you were in one). Also setup area check order updating by area instead of all at the same time. * Fixed shooting gallery not reporting proper area. Prevent checks from actually happening if area is RCAREA_INVALID, now that all areas are reporting something if they have checks. Fixed `GetCheckArea()` not updating checks for standard scenes. Lots of vanilla tracking updates, mainly manual checks for gems, medallions and songs, since the often don't have proper scenes in the data. Prevent vanilla from triggering check loops if junk items are collected. Fixed sorting based on saved vs collected. Prevent item name display for vanilla runs. Change coloring of checks so the check name reflects status in vanilla runs. * Fixed "Recheck Area" button erroneously adding to an area's check totals? * Fix DMC vanilla checks. * Fix check tracker data recreation on data file loss. Removed redundant file exists check from SaveTrackerDataHook, as it doesn't matter if it exists or not at that point. Limited check loops to 3 to avoid infinite check loops on non-check/junk item pickup. Added more checks to disable tracker operations if a save is not running. Changed check ordering to put boss reward and heart container checks at the end of whatever RCSHOW group they belong to. * Fixed IsRunning calculation. Further improving vanilla checking. Starting framework for checking medallions, stones, and songs on data file recreation. Fixed medallion check collection. Added GIFT_FROM_SAGES to check list for vanilla file for tracking light medallion. Added check loop limitation to prevent infinite checking after picking up junk item from the ground. * Finished vanilla file recreation and recheck (songs and dungeon rewards all check properly now). This includes deku shield with KF shop item 3. Finished Gift from Raoru light medallion tracking for vanilla. Commented all CheckByScene functionality for now. * Fixed new save data file creation. Disabled entrance area calculation for now, as it only tracks the previous entrance for some reason. Fixed area detection for ToT checks. * GetCheckArea() now utilizes EntranceData almost exclusively, via either `gSaveContext.entranceIndex` or the entrance tracker's `currentGrottoId` in the case of grottos. This also means that EVERYTHING CAN AUTOSCROLL NOW. Entrance shuffles are now much easier to track. Autoscroll is now also triggered on save, just in case someone isn't autosaving and has a lot of checks that get converted to saved. * Fixed missing GS check in LW. * Added area scroll on toggling Show Hidden Items. May configure differently later. Fixed area detection for entrances in Gerudo Fortress/Valley and Collossus. Haunted wasteland doesn't autoscroll due to a bug in `OnTransitionEnd` hook, but checks still evaluate properly there. Rely on scene-based area detection if scene is a main overworld or dungeon scene. * Fixed grotto detection when shuffle is off. * Small code cleanup. Fixed Colossus hand chest checks. * Missing lus bump from merge conflict resolution * Fixed Colossus Grotto making `GetCheckArea` return Wasteland. * Improved OnItemReceive processing for non-token GS checks, since they can sometimes take long enough for the checking process to time out before the item is registered as received. * First attempt at thread safety for tracker data file writing. Seems to work, but might need more testing. * Fixed Recheck Area not unskipping items that register as saved. Improved delayed saving with autosaving, as the autosave triggered quite often before the tracker data save, making things not properly register as saved. * merge cleanup * Converted check tracker data to the sectional saves, adding `CheckTrackerData` to `SaveContext`. Implemented section ID returning and fullSave boolean passing to section functions from my PR temporarily for it to work properly. Moved `RandomizerCheckTrackerData` enum to `randomizerTypes.h` to accommodate that. Changed `Randomizer_SaveInit` to a `SaveManager::InitFunc` to allow for other randomizer-dependent sections to be initialized after that. Required a little refactoring to maintain intro cutscene skip when starting a randomizer file. * Revert section index return and randomizer init changes. Will need to wait on yet more changes to main. * Fixed check tracker initialization (shouldn't be tied to window initialization), restored saving/loading functionality. * Removed `CheckTracker::Init` and put SaveManager calls in `CheckTrackerWindow::InitElement`. Also a bit of cleanup from transition back to save file use. * Fixed tracker displaying check categories while file not loaded. * Fix Darunia's Joy check not marking in vanilla. * Fix autosave not triggering change from collected to saved in tracker data. * Changed default colors for scummed and collected display. * Merge upgrade code cleanup. * Add `OnTransitionEnd` calls to sandstorm transitions both to and from Wasteland. Also improved `gSaveContext.lastScene` assignment for both transition types. Allowed a bit of cleanup in `GetCheckArea`. * Added `StateButton`, a button like `ArrowButton` but that allows text instead of arrow icons. Apparently the changes from ArrowButton to StateButton happened in a previous commit... * Changed section name to `trackerDataCheck` to force SoH to load it after the randomizer section, as it required some randoSettings to be loaded first, and nothing else I tried to make the randomizer section load before it worked. This hacks a solution to checks not displaying on fast file load to a specific slot. F*** you, SaveManager, and f*** you too, JSON. * Forgot to change the section string for loading with the name change. * Fix check ordering for checks that trigger the autosave. * Adds option to remove right-side shop items (slots 1-4) from the tracker list. Enabled by default. * Fix default state of Hide Shop Right Checks checkbox. * Fixes grotto and great fairy scrolling and checks. Fixes array overflow from `checkTrackerData` which was creating the issue trying to load the base and randomizer sections first, among other things. That also fixed the massive file loads that were being exhibited in debug mode. * Fix shooting galleries being set as collected again when being played a second time after getting the checks. * Fix Bazaar autoscroll. * Add Saria's Song to `GetCheckFromActor` and removed some limitations from the messageCloseCheck function to make that check track properly. * Fix Song from Impa check. Implemented prevention for multiple "collections" of great fairies, just in case getting the health refill would trigger it with the previous setup. * Fix ice traps on GS tokens not triggering OnItemReceive. * Complete fix for ice trap collection from GS. Add autoscroll when clicking "Expand All". * Add `OnShopSlotChange` with cursorSlot and basePrice parameters. * Fixed include in en_ossan for shop slot hook. Added registration for `OnShopSlotChange` in the tracker, storing the price in a new `price` field in `CheckTrackerData`. Added "seen" functionality to shop checks. Displays the model item name upon first entering a shop, adding the price and switching to trickName (if it's an ice trap) upon navigating to the slot in buy mode, triggered by an invisible "identified" status that mirrors "seen" in every other way. Added tooltips to most options for check tracker color picking to describe what each status actually means. * `std::format` pls * So apparently std::format just decided to break with the latest merge from develop, but fmt::format exists and works? * Removed the last vestiges of `locationsSkipped`. Other general code and formatting cleanups. Moved `IsGameRunning` to `OTRGlobals` so the item tracker could also access it. Used preceding to "fix" item and bottle display in the item tracker on startup. * Some more code cleanup. Removed "Recheck Area" button and relevant code. Backported changes to Anchor branch applicable for single-player, including making a checkAreas vector and structuring the frame by frame checks around that. Also includes fix for Silver Gauntlets and Mirror Shield check collection crash associated with those changes. Fixed Kakariko Bazaar "seen" updates. Fixed tracker window not showing on initial load like it should. * Forgot 1 formatting fix. * Removed conditions for showing Song from Impa (isn't junk under certain conditions, so should show all the time). * Fix vanilla checks, add Zelda's Letter and Malon's Egg to manual check collection. Fix autoscroll while in child stealth section. * Fix crash in Happy Mask Shop in OnSlotChange (referenced non-existent shop id in a tracker-specific enum). * General code cleanup. * Missed one reversion. * One more. * Fix column alignment in `randomizer_check_objects`. * Fix file encoding on `randomizer_check_tracker`. Again. * Fix indentation for `actualItemtrackerItemMap`. Also removed unnecessary parts of the map. * Rename `HasEqItem` to `HasEquipment`. * Slightly better indentation for `actualItemTrackerItemMap`. * Add magic bean salesman to vanilla check tracking, and genericized deku shield to trigger KF shop item 3 wherever you get the shield. Renamed `vanillaCheck` to `vanillaHundoCheck` to (supposedly) clarify the meaning of the usage. * One more rename to `vanillaCompletion` to avoid possible confusion with 100% speedrun conditions. * give me a break XD Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * Changes suggested by briaguya (rename `RandomizerCheckShow` to `Status`, unused code, newline formatting) * Remove unused `itemNames` table. * Remove `IsGameRunning` in favor of `GameInteractor::IsSaveLoaded`. * Restore anti-spoiler functionality for dungeons with dungeon maps. * Review cleanup. * Fix prices not showing for Kak bazaar items. --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com>
2023-10-04 11:03:36 -04:00
}
Flag tracker (#3447) * Hook into flagset hooks for processing check tracking. Has some manual workarounds (some breaks still need to be found). Remove areaChecks and looping functionality as redundant. * Additional vanilla handling. * Fix tracker not showing MQ checks in MQ non-rando. Fix tracker marking non-MQ variants of dungeon checks (e.g. map chest, etc) when collecting in MQ. * Set all areas to spoiled if not rando. * Revert attempt to spoil in randomizer based on MQ dungeon count as I don't know how that works at the moment. * Restore and update spoiling based on MQ dungeon settings (none, selection, or count of 12). Fix Anju As Adult check. * Remove Anchor-specific code :baguette: * Use `ClearAreaTotals()` in `Teardown()` instead of the duplicate code there. * Update to `ClearAreaChecksAndTotals()` with `vec.clear()` added. * Fix type spoiling again. Now spoils on 0 MQ dungeons, not rando, if the option is enabled in check tracker settings, selection, or set number of 12. Fix vanilla checks being marked collected in MQ dungeons. * Fix 100 GS check. * ACTUALLY fix 100 GS: change flag type to `RandomizerInf()` in `item_location.cpp`, add RC to RandoInf for it to the table. Also don't send GI for flag if father, falsely triggers ZR frogs minigame. * Fix gravedigging tour tracking. * Fix membership card check tracking. Change scene and flag values to any existing enums. Clarifying formatting for the checking loop vOrMQ conditions. * Fix Gravedigging Tour tracking. Simplify Always Win Gravedigging Tour and Fix Gravedigging Tour Glitch applications. Modified all necessary paths to use vanilla GDT PoH collection flag instead of randomizer variant. * Fix Kak Potion Shop being "seen" when entering as child.
2023-11-28 21:25:48 -05:00
if (checkMatchType == SpoilerCollectionCheckType::SPOILER_CHK_NONE) {
Check Tracker Update (#2668) * Initial commit. What works so far: Data file loads, saves, deletes, and is created properly. - Need to run `HasItemBeenCollected` when creating in case of mid-seed regen. Organized checks into maps set by area. Areas show in tracker. - Checks pulled from checkObjectsByArea are not currently listed. - Areas are being assumed completed and hidden at the start. * Checks now populate. Still not counting area totals properly. * Don't track RC_LINKS_POCKET in the data file, and instead manually add it in every time a save is load. rcObjects doesn't contain Link's Pocket location (duh). * Moved ItemReceive hook to randomizer_check_tracker.cpp. Skipped items are properly sorted and formatted. Saved items contribute to an area's gotten/skipped checks on load. Changed skipped items default main color to gray. General code cleanup. * Skipped checks now contribute to area totals for area completion logic. * Mid-menu rework transfer. * Started check lookup on item receive. Tried to enable scum checking on save. * Fixed scum check on save. * More code cleanup, which revealed some issues with loading and saving. Loading now works 100%, but entries in checkTrackerData are disappearing in code somewhere, causing issues with later checks. Scummed color now displays properly. Collected but unsaved displays properly. Unchecked, Skipped, Seen and Scummed checks all have arrows for skipping/unskipping. Counts a little messed up, probably double adding skips. * Fixed item counts being off across resets. Restarts were fine. * Beginning of rework for individual check updates. Adds `Actor lastCheck` to PlayState to allow assigning of last actor to give an item. This allows precise tracking of GS, freestanding PoH, etc. Works for chests too. Currently does not work for shops, unknown for normal NPC gives. Doesn't track last gives for non-checks, like drops from grass, pots, crates, etc. * Actor-based checks fully fleshed out, but can't help with sale-based checks. Implemented `pendingSaleCheck` to back out of an RC check cycle if `gSaveContext->pendingSale` is not NONE when `OnItemReceive` is called, processed through `OnSaleEnd`. This should be the final change necessary to streamline the checks. * Temporary hook to message box close to tie in trackers for non-gs/chest actors that aren't added to `GetCheckFromActor`. This triggers a 2-frame countdown to check with `HasItemBeenCollected` since half of the methods in there aren't updated until after a text box closes. Added scene tracking to get last scene so that checks in scenes that span several overworld areas could be tied to their areas properly. Modified tracker data creation to apply Link's Pocket and Song from Impa conditionally based on randomizer settings instead of just being assumed to be done. May need modification for checking click and drag spoiler loading. Removed the scene equivalence check from CheckChecks so that an entire area is checked each time to avoid issues with, e.g., leaving a shop before a pending sale finishes. * Changed check data creation to use RSKs from gRandomizer to account for settings loaded from drag and drop spoilers. * Beginning of tracker code organization. Changed check color defaults. * Reverted moving tracker colors to header. Some individual check fixes. * Missed something from previous merge? * Removed last remnant of removed performance mode. * Better handle checking when skullsanity is off. * Song checks sceneIDs don't match the scenes they're actually in for some reason. Removed that check. * SaleEnd checks don't need the GetItemEntry parameter. Also set a flag that should prevent the check tracker from running during vanilla saves should that not be resolved by the time it's merged. * Attempting to have only the relevant checks added to the tracker data, as well as showing vanilla checks for non-rando saves. Not working yet (everything is displayed in vanilla). * Added vanilla check tracker population via `vanillaCheck` bool in `RandomizerCheckObject`. This is also added to `IsVisibleInImGui` to handle file loading and saving to eliminate checks that aren't part of vanilla or the rando seed. Implemented deleted tracker data file recreation. Added some extra item name text checks. Songs are still... tricky, so they stay blank. Utilize local copies of the randomizer check objects that are applicable for performance purposes. Fixed vanilla item-giving cutscene crashes when triggered mid-transition. * Apparently not all toolchains can handle macro instantiation without all parameters, like VS can. * Fixed scummed detail color not showing properly on tracker. * Fixed dungeon area totals and GS checks not functioning properly. * Major revamp of checking code. Doesn't rely on `GetCheckFromActor` at all anymore, but instead simply sets a flag to evaluate a number of checks in an area every frame until the check that was gotten is identified. With the new setup, it's much less hardware intensive, and at 60fps 6 checks per frame shows no noticeable effect on framerate. I can envision needing to add a collectedCount in order to account for times when two checks are gotten one right after the other. Changed area scroll to happen from `OnTransitionEnd`, and allow for scrolling in bazaar (was disabled previously because it would jump back and forth between Kak and Market while you were in one). Also setup area check order updating by area instead of all at the same time. * Fixed shooting gallery not reporting proper area. Prevent checks from actually happening if area is RCAREA_INVALID, now that all areas are reporting something if they have checks. Fixed `GetCheckArea()` not updating checks for standard scenes. Lots of vanilla tracking updates, mainly manual checks for gems, medallions and songs, since the often don't have proper scenes in the data. Prevent vanilla from triggering check loops if junk items are collected. Fixed sorting based on saved vs collected. Prevent item name display for vanilla runs. Change coloring of checks so the check name reflects status in vanilla runs. * Fixed "Recheck Area" button erroneously adding to an area's check totals? * Fix DMC vanilla checks. * Fix check tracker data recreation on data file loss. Removed redundant file exists check from SaveTrackerDataHook, as it doesn't matter if it exists or not at that point. Limited check loops to 3 to avoid infinite check loops on non-check/junk item pickup. Added more checks to disable tracker operations if a save is not running. Changed check ordering to put boss reward and heart container checks at the end of whatever RCSHOW group they belong to. * Fixed IsRunning calculation. Further improving vanilla checking. Starting framework for checking medallions, stones, and songs on data file recreation. Fixed medallion check collection. Added GIFT_FROM_SAGES to check list for vanilla file for tracking light medallion. Added check loop limitation to prevent infinite checking after picking up junk item from the ground. * Finished vanilla file recreation and recheck (songs and dungeon rewards all check properly now). This includes deku shield with KF shop item 3. Finished Gift from Raoru light medallion tracking for vanilla. Commented all CheckByScene functionality for now. * Fixed new save data file creation. Disabled entrance area calculation for now, as it only tracks the previous entrance for some reason. Fixed area detection for ToT checks. * GetCheckArea() now utilizes EntranceData almost exclusively, via either `gSaveContext.entranceIndex` or the entrance tracker's `currentGrottoId` in the case of grottos. This also means that EVERYTHING CAN AUTOSCROLL NOW. Entrance shuffles are now much easier to track. Autoscroll is now also triggered on save, just in case someone isn't autosaving and has a lot of checks that get converted to saved. * Fixed missing GS check in LW. * Added area scroll on toggling Show Hidden Items. May configure differently later. Fixed area detection for entrances in Gerudo Fortress/Valley and Collossus. Haunted wasteland doesn't autoscroll due to a bug in `OnTransitionEnd` hook, but checks still evaluate properly there. Rely on scene-based area detection if scene is a main overworld or dungeon scene. * Fixed grotto detection when shuffle is off. * Small code cleanup. Fixed Colossus hand chest checks. * Missing lus bump from merge conflict resolution * Fixed Colossus Grotto making `GetCheckArea` return Wasteland. * Improved OnItemReceive processing for non-token GS checks, since they can sometimes take long enough for the checking process to time out before the item is registered as received. * First attempt at thread safety for tracker data file writing. Seems to work, but might need more testing. * Fixed Recheck Area not unskipping items that register as saved. Improved delayed saving with autosaving, as the autosave triggered quite often before the tracker data save, making things not properly register as saved. * merge cleanup * Converted check tracker data to the sectional saves, adding `CheckTrackerData` to `SaveContext`. Implemented section ID returning and fullSave boolean passing to section functions from my PR temporarily for it to work properly. Moved `RandomizerCheckTrackerData` enum to `randomizerTypes.h` to accommodate that. Changed `Randomizer_SaveInit` to a `SaveManager::InitFunc` to allow for other randomizer-dependent sections to be initialized after that. Required a little refactoring to maintain intro cutscene skip when starting a randomizer file. * Revert section index return and randomizer init changes. Will need to wait on yet more changes to main. * Fixed check tracker initialization (shouldn't be tied to window initialization), restored saving/loading functionality. * Removed `CheckTracker::Init` and put SaveManager calls in `CheckTrackerWindow::InitElement`. Also a bit of cleanup from transition back to save file use. * Fixed tracker displaying check categories while file not loaded. * Fix Darunia's Joy check not marking in vanilla. * Fix autosave not triggering change from collected to saved in tracker data. * Changed default colors for scummed and collected display. * Merge upgrade code cleanup. * Add `OnTransitionEnd` calls to sandstorm transitions both to and from Wasteland. Also improved `gSaveContext.lastScene` assignment for both transition types. Allowed a bit of cleanup in `GetCheckArea`. * Added `StateButton`, a button like `ArrowButton` but that allows text instead of arrow icons. Apparently the changes from ArrowButton to StateButton happened in a previous commit... * Changed section name to `trackerDataCheck` to force SoH to load it after the randomizer section, as it required some randoSettings to be loaded first, and nothing else I tried to make the randomizer section load before it worked. This hacks a solution to checks not displaying on fast file load to a specific slot. F*** you, SaveManager, and f*** you too, JSON. * Forgot to change the section string for loading with the name change. * Fix check ordering for checks that trigger the autosave. * Adds option to remove right-side shop items (slots 1-4) from the tracker list. Enabled by default. * Fix default state of Hide Shop Right Checks checkbox. * Fixes grotto and great fairy scrolling and checks. Fixes array overflow from `checkTrackerData` which was creating the issue trying to load the base and randomizer sections first, among other things. That also fixed the massive file loads that were being exhibited in debug mode. * Fix shooting galleries being set as collected again when being played a second time after getting the checks. * Fix Bazaar autoscroll. * Add Saria's Song to `GetCheckFromActor` and removed some limitations from the messageCloseCheck function to make that check track properly. * Fix Song from Impa check. Implemented prevention for multiple "collections" of great fairies, just in case getting the health refill would trigger it with the previous setup. * Fix ice traps on GS tokens not triggering OnItemReceive. * Complete fix for ice trap collection from GS. Add autoscroll when clicking "Expand All". * Add `OnShopSlotChange` with cursorSlot and basePrice parameters. * Fixed include in en_ossan for shop slot hook. Added registration for `OnShopSlotChange` in the tracker, storing the price in a new `price` field in `CheckTrackerData`. Added "seen" functionality to shop checks. Displays the model item name upon first entering a shop, adding the price and switching to trickName (if it's an ice trap) upon navigating to the slot in buy mode, triggered by an invisible "identified" status that mirrors "seen" in every other way. Added tooltips to most options for check tracker color picking to describe what each status actually means. * `std::format` pls * So apparently std::format just decided to break with the latest merge from develop, but fmt::format exists and works? * Removed the last vestiges of `locationsSkipped`. Other general code and formatting cleanups. Moved `IsGameRunning` to `OTRGlobals` so the item tracker could also access it. Used preceding to "fix" item and bottle display in the item tracker on startup. * Some more code cleanup. Removed "Recheck Area" button and relevant code. Backported changes to Anchor branch applicable for single-player, including making a checkAreas vector and structuring the frame by frame checks around that. Also includes fix for Silver Gauntlets and Mirror Shield check collection crash associated with those changes. Fixed Kakariko Bazaar "seen" updates. Fixed tracker window not showing on initial load like it should. * Forgot 1 formatting fix. * Removed conditions for showing Song from Impa (isn't junk under certain conditions, so should show all the time). * Fix vanilla checks, add Zelda's Letter and Malon's Egg to manual check collection. Fix autoscroll while in child stealth section. * Fix crash in Happy Mask Shop in OnSlotChange (referenced non-existent shop id in a tracker-specific enum). * General code cleanup. * Missed one reversion. * One more. * Fix column alignment in `randomizer_check_objects`. * Fix file encoding on `randomizer_check_tracker`. Again. * Fix indentation for `actualItemtrackerItemMap`. Also removed unnecessary parts of the map. * Rename `HasEqItem` to `HasEquipment`. * Slightly better indentation for `actualItemTrackerItemMap`. * Add magic bean salesman to vanilla check tracking, and genericized deku shield to trigger KF shop item 3 wherever you get the shield. Renamed `vanillaCheck` to `vanillaHundoCheck` to (supposedly) clarify the meaning of the usage. * One more rename to `vanillaCompletion` to avoid possible confusion with 100% speedrun conditions. * give me a break XD Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * Changes suggested by briaguya (rename `RandomizerCheckShow` to `Status`, unused code, newline formatting) * Remove unused `itemNames` table. * Remove `IsGameRunning` in favor of `GameInteractor::IsSaveLoaded`. * Restore anti-spoiler functionality for dungeons with dungeon maps. * Review cleanup. * Fix prices not showing for Kak bazaar items. --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com>
2023-10-04 11:03:36 -04:00
return;
}
Flag tracker (#3447) * Hook into flagset hooks for processing check tracking. Has some manual workarounds (some breaks still need to be found). Remove areaChecks and looping functionality as redundant. * Additional vanilla handling. * Fix tracker not showing MQ checks in MQ non-rando. Fix tracker marking non-MQ variants of dungeon checks (e.g. map chest, etc) when collecting in MQ. * Set all areas to spoiled if not rando. * Revert attempt to spoil in randomizer based on MQ dungeon count as I don't know how that works at the moment. * Restore and update spoiling based on MQ dungeon settings (none, selection, or count of 12). Fix Anju As Adult check. * Remove Anchor-specific code :baguette: * Use `ClearAreaTotals()` in `Teardown()` instead of the duplicate code there. * Update to `ClearAreaChecksAndTotals()` with `vec.clear()` added. * Fix type spoiling again. Now spoils on 0 MQ dungeons, not rando, if the option is enabled in check tracker settings, selection, or set number of 12. Fix vanilla checks being marked collected in MQ dungeons. * Fix 100 GS check. * ACTUALLY fix 100 GS: change flag type to `RandomizerInf()` in `item_location.cpp`, add RC to RandoInf for it to the table. Also don't send GI for flag if father, falsely triggers ZR frogs minigame. * Fix gravedigging tour tracking. * Fix membership card check tracking. Change scene and flag values to any existing enums. Clarifying formatting for the checking loop vOrMQ conditions. * Fix Gravedigging Tour tracking. Simplify Always Win Gravedigging Tour and Fix Gravedigging Tour Glitch applications. Modified all necessary paths to use vanilla GDT PoH collection flag instead of randomizer variant. * Fix Kak Potion Shop being "seen" when entering as child.
2023-11-28 21:25:48 -05:00
for (auto [rc, rcObj] : RandomizerCheckObjects::GetAllRCObjects()) {
if ((!IS_RANDO && ((rcObj.vOrMQ == RCVORMQ_MQ && !IS_MASTER_QUEST) ||
(rcObj.vOrMQ == RCVORMQ_VANILLA && IS_MASTER_QUEST))) ||
(IS_RANDO && ((OTRGlobals::Instance->gRandomizer->masterQuestDungeons.contains(rcObj.sceneId) &&
rcObj.vOrMQ == RCVORMQ_VANILLA) ||
!OTRGlobals::Instance->gRandomizer->masterQuestDungeons.contains(rcObj.sceneId) &&
rcObj.vOrMQ == RCVORMQ_MQ))) {
continue;
}
SpoilerCollectionCheck scCheck = Location(rc)->GetCollectionCheck();
SpoilerCollectionCheckType scCheckType = scCheck.type;
if (checkMatchType == SpoilerCollectionCheckType::SPOILER_CHK_RANDOMIZER_INF &&
(scCheckType == SpoilerCollectionCheckType::SPOILER_CHK_MERCHANT ||
scCheckType == SpoilerCollectionCheckType::SPOILER_CHK_SHOP_ITEM ||
scCheckType == SpoilerCollectionCheckType::SPOILER_CHK_COW ||
scCheckType == SpoilerCollectionCheckType::SPOILER_CHK_SCRUB ||
scCheckType == SpoilerCollectionCheckType::SPOILER_CHK_MASTER_SWORD ||
scCheckType == SpoilerCollectionCheckType::SPOILER_CHK_RANDOMIZER_INF)) {
if (flag == OTRGlobals::Instance->gRandomizer->GetRandomizerInfFromCheck(rc)) {
SetCheckCollected(rc);
return;
}
continue;
}
int16_t checkFlag = scCheck.flag;
if (checkMatchType == SpoilerCollectionCheckType::SPOILER_CHK_GOLD_SKULLTULA) {
checkFlag = rcObj.actorParams;
}
if (checkFlag == flag && scCheck.type == checkMatchType) {
SetCheckCollected(rc);
return;
}
Check Tracker Update (#2668) * Initial commit. What works so far: Data file loads, saves, deletes, and is created properly. - Need to run `HasItemBeenCollected` when creating in case of mid-seed regen. Organized checks into maps set by area. Areas show in tracker. - Checks pulled from checkObjectsByArea are not currently listed. - Areas are being assumed completed and hidden at the start. * Checks now populate. Still not counting area totals properly. * Don't track RC_LINKS_POCKET in the data file, and instead manually add it in every time a save is load. rcObjects doesn't contain Link's Pocket location (duh). * Moved ItemReceive hook to randomizer_check_tracker.cpp. Skipped items are properly sorted and formatted. Saved items contribute to an area's gotten/skipped checks on load. Changed skipped items default main color to gray. General code cleanup. * Skipped checks now contribute to area totals for area completion logic. * Mid-menu rework transfer. * Started check lookup on item receive. Tried to enable scum checking on save. * Fixed scum check on save. * More code cleanup, which revealed some issues with loading and saving. Loading now works 100%, but entries in checkTrackerData are disappearing in code somewhere, causing issues with later checks. Scummed color now displays properly. Collected but unsaved displays properly. Unchecked, Skipped, Seen and Scummed checks all have arrows for skipping/unskipping. Counts a little messed up, probably double adding skips. * Fixed item counts being off across resets. Restarts were fine. * Beginning of rework for individual check updates. Adds `Actor lastCheck` to PlayState to allow assigning of last actor to give an item. This allows precise tracking of GS, freestanding PoH, etc. Works for chests too. Currently does not work for shops, unknown for normal NPC gives. Doesn't track last gives for non-checks, like drops from grass, pots, crates, etc. * Actor-based checks fully fleshed out, but can't help with sale-based checks. Implemented `pendingSaleCheck` to back out of an RC check cycle if `gSaveContext->pendingSale` is not NONE when `OnItemReceive` is called, processed through `OnSaleEnd`. This should be the final change necessary to streamline the checks. * Temporary hook to message box close to tie in trackers for non-gs/chest actors that aren't added to `GetCheckFromActor`. This triggers a 2-frame countdown to check with `HasItemBeenCollected` since half of the methods in there aren't updated until after a text box closes. Added scene tracking to get last scene so that checks in scenes that span several overworld areas could be tied to their areas properly. Modified tracker data creation to apply Link's Pocket and Song from Impa conditionally based on randomizer settings instead of just being assumed to be done. May need modification for checking click and drag spoiler loading. Removed the scene equivalence check from CheckChecks so that an entire area is checked each time to avoid issues with, e.g., leaving a shop before a pending sale finishes. * Changed check data creation to use RSKs from gRandomizer to account for settings loaded from drag and drop spoilers. * Beginning of tracker code organization. Changed check color defaults. * Reverted moving tracker colors to header. Some individual check fixes. * Missed something from previous merge? * Removed last remnant of removed performance mode. * Better handle checking when skullsanity is off. * Song checks sceneIDs don't match the scenes they're actually in for some reason. Removed that check. * SaleEnd checks don't need the GetItemEntry parameter. Also set a flag that should prevent the check tracker from running during vanilla saves should that not be resolved by the time it's merged. * Attempting to have only the relevant checks added to the tracker data, as well as showing vanilla checks for non-rando saves. Not working yet (everything is displayed in vanilla). * Added vanilla check tracker population via `vanillaCheck` bool in `RandomizerCheckObject`. This is also added to `IsVisibleInImGui` to handle file loading and saving to eliminate checks that aren't part of vanilla or the rando seed. Implemented deleted tracker data file recreation. Added some extra item name text checks. Songs are still... tricky, so they stay blank. Utilize local copies of the randomizer check objects that are applicable for performance purposes. Fixed vanilla item-giving cutscene crashes when triggered mid-transition. * Apparently not all toolchains can handle macro instantiation without all parameters, like VS can. * Fixed scummed detail color not showing properly on tracker. * Fixed dungeon area totals and GS checks not functioning properly. * Major revamp of checking code. Doesn't rely on `GetCheckFromActor` at all anymore, but instead simply sets a flag to evaluate a number of checks in an area every frame until the check that was gotten is identified. With the new setup, it's much less hardware intensive, and at 60fps 6 checks per frame shows no noticeable effect on framerate. I can envision needing to add a collectedCount in order to account for times when two checks are gotten one right after the other. Changed area scroll to happen from `OnTransitionEnd`, and allow for scrolling in bazaar (was disabled previously because it would jump back and forth between Kak and Market while you were in one). Also setup area check order updating by area instead of all at the same time. * Fixed shooting gallery not reporting proper area. Prevent checks from actually happening if area is RCAREA_INVALID, now that all areas are reporting something if they have checks. Fixed `GetCheckArea()` not updating checks for standard scenes. Lots of vanilla tracking updates, mainly manual checks for gems, medallions and songs, since the often don't have proper scenes in the data. Prevent vanilla from triggering check loops if junk items are collected. Fixed sorting based on saved vs collected. Prevent item name display for vanilla runs. Change coloring of checks so the check name reflects status in vanilla runs. * Fixed "Recheck Area" button erroneously adding to an area's check totals? * Fix DMC vanilla checks. * Fix check tracker data recreation on data file loss. Removed redundant file exists check from SaveTrackerDataHook, as it doesn't matter if it exists or not at that point. Limited check loops to 3 to avoid infinite check loops on non-check/junk item pickup. Added more checks to disable tracker operations if a save is not running. Changed check ordering to put boss reward and heart container checks at the end of whatever RCSHOW group they belong to. * Fixed IsRunning calculation. Further improving vanilla checking. Starting framework for checking medallions, stones, and songs on data file recreation. Fixed medallion check collection. Added GIFT_FROM_SAGES to check list for vanilla file for tracking light medallion. Added check loop limitation to prevent infinite checking after picking up junk item from the ground. * Finished vanilla file recreation and recheck (songs and dungeon rewards all check properly now). This includes deku shield with KF shop item 3. Finished Gift from Raoru light medallion tracking for vanilla. Commented all CheckByScene functionality for now. * Fixed new save data file creation. Disabled entrance area calculation for now, as it only tracks the previous entrance for some reason. Fixed area detection for ToT checks. * GetCheckArea() now utilizes EntranceData almost exclusively, via either `gSaveContext.entranceIndex` or the entrance tracker's `currentGrottoId` in the case of grottos. This also means that EVERYTHING CAN AUTOSCROLL NOW. Entrance shuffles are now much easier to track. Autoscroll is now also triggered on save, just in case someone isn't autosaving and has a lot of checks that get converted to saved. * Fixed missing GS check in LW. * Added area scroll on toggling Show Hidden Items. May configure differently later. Fixed area detection for entrances in Gerudo Fortress/Valley and Collossus. Haunted wasteland doesn't autoscroll due to a bug in `OnTransitionEnd` hook, but checks still evaluate properly there. Rely on scene-based area detection if scene is a main overworld or dungeon scene. * Fixed grotto detection when shuffle is off. * Small code cleanup. Fixed Colossus hand chest checks. * Missing lus bump from merge conflict resolution * Fixed Colossus Grotto making `GetCheckArea` return Wasteland. * Improved OnItemReceive processing for non-token GS checks, since they can sometimes take long enough for the checking process to time out before the item is registered as received. * First attempt at thread safety for tracker data file writing. Seems to work, but might need more testing. * Fixed Recheck Area not unskipping items that register as saved. Improved delayed saving with autosaving, as the autosave triggered quite often before the tracker data save, making things not properly register as saved. * merge cleanup * Converted check tracker data to the sectional saves, adding `CheckTrackerData` to `SaveContext`. Implemented section ID returning and fullSave boolean passing to section functions from my PR temporarily for it to work properly. Moved `RandomizerCheckTrackerData` enum to `randomizerTypes.h` to accommodate that. Changed `Randomizer_SaveInit` to a `SaveManager::InitFunc` to allow for other randomizer-dependent sections to be initialized after that. Required a little refactoring to maintain intro cutscene skip when starting a randomizer file. * Revert section index return and randomizer init changes. Will need to wait on yet more changes to main. * Fixed check tracker initialization (shouldn't be tied to window initialization), restored saving/loading functionality. * Removed `CheckTracker::Init` and put SaveManager calls in `CheckTrackerWindow::InitElement`. Also a bit of cleanup from transition back to save file use. * Fixed tracker displaying check categories while file not loaded. * Fix Darunia's Joy check not marking in vanilla. * Fix autosave not triggering change from collected to saved in tracker data. * Changed default colors for scummed and collected display. * Merge upgrade code cleanup. * Add `OnTransitionEnd` calls to sandstorm transitions both to and from Wasteland. Also improved `gSaveContext.lastScene` assignment for both transition types. Allowed a bit of cleanup in `GetCheckArea`. * Added `StateButton`, a button like `ArrowButton` but that allows text instead of arrow icons. Apparently the changes from ArrowButton to StateButton happened in a previous commit... * Changed section name to `trackerDataCheck` to force SoH to load it after the randomizer section, as it required some randoSettings to be loaded first, and nothing else I tried to make the randomizer section load before it worked. This hacks a solution to checks not displaying on fast file load to a specific slot. F*** you, SaveManager, and f*** you too, JSON. * Forgot to change the section string for loading with the name change. * Fix check ordering for checks that trigger the autosave. * Adds option to remove right-side shop items (slots 1-4) from the tracker list. Enabled by default. * Fix default state of Hide Shop Right Checks checkbox. * Fixes grotto and great fairy scrolling and checks. Fixes array overflow from `checkTrackerData` which was creating the issue trying to load the base and randomizer sections first, among other things. That also fixed the massive file loads that were being exhibited in debug mode. * Fix shooting galleries being set as collected again when being played a second time after getting the checks. * Fix Bazaar autoscroll. * Add Saria's Song to `GetCheckFromActor` and removed some limitations from the messageCloseCheck function to make that check track properly. * Fix Song from Impa check. Implemented prevention for multiple "collections" of great fairies, just in case getting the health refill would trigger it with the previous setup. * Fix ice traps on GS tokens not triggering OnItemReceive. * Complete fix for ice trap collection from GS. Add autoscroll when clicking "Expand All". * Add `OnShopSlotChange` with cursorSlot and basePrice parameters. * Fixed include in en_ossan for shop slot hook. Added registration for `OnShopSlotChange` in the tracker, storing the price in a new `price` field in `CheckTrackerData`. Added "seen" functionality to shop checks. Displays the model item name upon first entering a shop, adding the price and switching to trickName (if it's an ice trap) upon navigating to the slot in buy mode, triggered by an invisible "identified" status that mirrors "seen" in every other way. Added tooltips to most options for check tracker color picking to describe what each status actually means. * `std::format` pls * So apparently std::format just decided to break with the latest merge from develop, but fmt::format exists and works? * Removed the last vestiges of `locationsSkipped`. Other general code and formatting cleanups. Moved `IsGameRunning` to `OTRGlobals` so the item tracker could also access it. Used preceding to "fix" item and bottle display in the item tracker on startup. * Some more code cleanup. Removed "Recheck Area" button and relevant code. Backported changes to Anchor branch applicable for single-player, including making a checkAreas vector and structuring the frame by frame checks around that. Also includes fix for Silver Gauntlets and Mirror Shield check collection crash associated with those changes. Fixed Kakariko Bazaar "seen" updates. Fixed tracker window not showing on initial load like it should. * Forgot 1 formatting fix. * Removed conditions for showing Song from Impa (isn't junk under certain conditions, so should show all the time). * Fix vanilla checks, add Zelda's Letter and Malon's Egg to manual check collection. Fix autoscroll while in child stealth section. * Fix crash in Happy Mask Shop in OnSlotChange (referenced non-existent shop id in a tracker-specific enum). * General code cleanup. * Missed one reversion. * One more. * Fix column alignment in `randomizer_check_objects`. * Fix file encoding on `randomizer_check_tracker`. Again. * Fix indentation for `actualItemtrackerItemMap`. Also removed unnecessary parts of the map. * Rename `HasEqItem` to `HasEquipment`. * Slightly better indentation for `actualItemTrackerItemMap`. * Add magic bean salesman to vanilla check tracking, and genericized deku shield to trigger KF shop item 3 wherever you get the shield. Renamed `vanillaCheck` to `vanillaHundoCheck` to (supposedly) clarify the meaning of the usage. * One more rename to `vanillaCompletion` to avoid possible confusion with 100% speedrun conditions. * give me a break XD Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * Changes suggested by briaguya (rename `RandomizerCheckShow` to `Status`, unused code, newline formatting) * Remove unused `itemNames` table. * Remove `IsGameRunning` in favor of `GameInteractor::IsSaveLoaded`. * Restore anti-spoiler functionality for dungeons with dungeon maps. * Review cleanup. * Fix prices not showing for Kak bazaar items. --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com>
2023-10-04 11:03:36 -04:00
}
}
void InitTrackerData(bool isDebug) {
TrySetAreas();
for (auto& [rc, rco] : RandomizerCheckObjects::GetAllRCObjects()) {
if (rc != RC_UNKNOWN_CHECK && rc != RC_MAX) {
DefaultCheckData(rc);
}
}
UpdateAllOrdering();
}
void SaveTrackerData(SaveContext* saveContext, int sectionID, bool gameSave) {
SaveManager::Instance->SaveArray("checks", ARRAY_COUNT(saveContext->checkTrackerData), [&](size_t i) {
if (saveContext->checkTrackerData[i].status == RCSHOW_COLLECTED) {
Flag tracker (#3447) * Hook into flagset hooks for processing check tracking. Has some manual workarounds (some breaks still need to be found). Remove areaChecks and looping functionality as redundant. * Additional vanilla handling. * Fix tracker not showing MQ checks in MQ non-rando. Fix tracker marking non-MQ variants of dungeon checks (e.g. map chest, etc) when collecting in MQ. * Set all areas to spoiled if not rando. * Revert attempt to spoil in randomizer based on MQ dungeon count as I don't know how that works at the moment. * Restore and update spoiling based on MQ dungeon settings (none, selection, or count of 12). Fix Anju As Adult check. * Remove Anchor-specific code :baguette: * Use `ClearAreaTotals()` in `Teardown()` instead of the duplicate code there. * Update to `ClearAreaChecksAndTotals()` with `vec.clear()` added. * Fix type spoiling again. Now spoils on 0 MQ dungeons, not rando, if the option is enabled in check tracker settings, selection, or set number of 12. Fix vanilla checks being marked collected in MQ dungeons. * Fix 100 GS check. * ACTUALLY fix 100 GS: change flag type to `RandomizerInf()` in `item_location.cpp`, add RC to RandoInf for it to the table. Also don't send GI for flag if father, falsely triggers ZR frogs minigame. * Fix gravedigging tour tracking. * Fix membership card check tracking. Change scene and flag values to any existing enums. Clarifying formatting for the checking loop vOrMQ conditions. * Fix Gravedigging Tour tracking. Simplify Always Win Gravedigging Tour and Fix Gravedigging Tour Glitch applications. Modified all necessary paths to use vanilla GDT PoH collection flag instead of randomizer variant. * Fix Kak Potion Shop being "seen" when entering as child.
2023-11-28 21:25:48 -05:00
if (gameSave) {
Check Tracker Update (#2668) * Initial commit. What works so far: Data file loads, saves, deletes, and is created properly. - Need to run `HasItemBeenCollected` when creating in case of mid-seed regen. Organized checks into maps set by area. Areas show in tracker. - Checks pulled from checkObjectsByArea are not currently listed. - Areas are being assumed completed and hidden at the start. * Checks now populate. Still not counting area totals properly. * Don't track RC_LINKS_POCKET in the data file, and instead manually add it in every time a save is load. rcObjects doesn't contain Link's Pocket location (duh). * Moved ItemReceive hook to randomizer_check_tracker.cpp. Skipped items are properly sorted and formatted. Saved items contribute to an area's gotten/skipped checks on load. Changed skipped items default main color to gray. General code cleanup. * Skipped checks now contribute to area totals for area completion logic. * Mid-menu rework transfer. * Started check lookup on item receive. Tried to enable scum checking on save. * Fixed scum check on save. * More code cleanup, which revealed some issues with loading and saving. Loading now works 100%, but entries in checkTrackerData are disappearing in code somewhere, causing issues with later checks. Scummed color now displays properly. Collected but unsaved displays properly. Unchecked, Skipped, Seen and Scummed checks all have arrows for skipping/unskipping. Counts a little messed up, probably double adding skips. * Fixed item counts being off across resets. Restarts were fine. * Beginning of rework for individual check updates. Adds `Actor lastCheck` to PlayState to allow assigning of last actor to give an item. This allows precise tracking of GS, freestanding PoH, etc. Works for chests too. Currently does not work for shops, unknown for normal NPC gives. Doesn't track last gives for non-checks, like drops from grass, pots, crates, etc. * Actor-based checks fully fleshed out, but can't help with sale-based checks. Implemented `pendingSaleCheck` to back out of an RC check cycle if `gSaveContext->pendingSale` is not NONE when `OnItemReceive` is called, processed through `OnSaleEnd`. This should be the final change necessary to streamline the checks. * Temporary hook to message box close to tie in trackers for non-gs/chest actors that aren't added to `GetCheckFromActor`. This triggers a 2-frame countdown to check with `HasItemBeenCollected` since half of the methods in there aren't updated until after a text box closes. Added scene tracking to get last scene so that checks in scenes that span several overworld areas could be tied to their areas properly. Modified tracker data creation to apply Link's Pocket and Song from Impa conditionally based on randomizer settings instead of just being assumed to be done. May need modification for checking click and drag spoiler loading. Removed the scene equivalence check from CheckChecks so that an entire area is checked each time to avoid issues with, e.g., leaving a shop before a pending sale finishes. * Changed check data creation to use RSKs from gRandomizer to account for settings loaded from drag and drop spoilers. * Beginning of tracker code organization. Changed check color defaults. * Reverted moving tracker colors to header. Some individual check fixes. * Missed something from previous merge? * Removed last remnant of removed performance mode. * Better handle checking when skullsanity is off. * Song checks sceneIDs don't match the scenes they're actually in for some reason. Removed that check. * SaleEnd checks don't need the GetItemEntry parameter. Also set a flag that should prevent the check tracker from running during vanilla saves should that not be resolved by the time it's merged. * Attempting to have only the relevant checks added to the tracker data, as well as showing vanilla checks for non-rando saves. Not working yet (everything is displayed in vanilla). * Added vanilla check tracker population via `vanillaCheck` bool in `RandomizerCheckObject`. This is also added to `IsVisibleInImGui` to handle file loading and saving to eliminate checks that aren't part of vanilla or the rando seed. Implemented deleted tracker data file recreation. Added some extra item name text checks. Songs are still... tricky, so they stay blank. Utilize local copies of the randomizer check objects that are applicable for performance purposes. Fixed vanilla item-giving cutscene crashes when triggered mid-transition. * Apparently not all toolchains can handle macro instantiation without all parameters, like VS can. * Fixed scummed detail color not showing properly on tracker. * Fixed dungeon area totals and GS checks not functioning properly. * Major revamp of checking code. Doesn't rely on `GetCheckFromActor` at all anymore, but instead simply sets a flag to evaluate a number of checks in an area every frame until the check that was gotten is identified. With the new setup, it's much less hardware intensive, and at 60fps 6 checks per frame shows no noticeable effect on framerate. I can envision needing to add a collectedCount in order to account for times when two checks are gotten one right after the other. Changed area scroll to happen from `OnTransitionEnd`, and allow for scrolling in bazaar (was disabled previously because it would jump back and forth between Kak and Market while you were in one). Also setup area check order updating by area instead of all at the same time. * Fixed shooting gallery not reporting proper area. Prevent checks from actually happening if area is RCAREA_INVALID, now that all areas are reporting something if they have checks. Fixed `GetCheckArea()` not updating checks for standard scenes. Lots of vanilla tracking updates, mainly manual checks for gems, medallions and songs, since the often don't have proper scenes in the data. Prevent vanilla from triggering check loops if junk items are collected. Fixed sorting based on saved vs collected. Prevent item name display for vanilla runs. Change coloring of checks so the check name reflects status in vanilla runs. * Fixed "Recheck Area" button erroneously adding to an area's check totals? * Fix DMC vanilla checks. * Fix check tracker data recreation on data file loss. Removed redundant file exists check from SaveTrackerDataHook, as it doesn't matter if it exists or not at that point. Limited check loops to 3 to avoid infinite check loops on non-check/junk item pickup. Added more checks to disable tracker operations if a save is not running. Changed check ordering to put boss reward and heart container checks at the end of whatever RCSHOW group they belong to. * Fixed IsRunning calculation. Further improving vanilla checking. Starting framework for checking medallions, stones, and songs on data file recreation. Fixed medallion check collection. Added GIFT_FROM_SAGES to check list for vanilla file for tracking light medallion. Added check loop limitation to prevent infinite checking after picking up junk item from the ground. * Finished vanilla file recreation and recheck (songs and dungeon rewards all check properly now). This includes deku shield with KF shop item 3. Finished Gift from Raoru light medallion tracking for vanilla. Commented all CheckByScene functionality for now. * Fixed new save data file creation. Disabled entrance area calculation for now, as it only tracks the previous entrance for some reason. Fixed area detection for ToT checks. * GetCheckArea() now utilizes EntranceData almost exclusively, via either `gSaveContext.entranceIndex` or the entrance tracker's `currentGrottoId` in the case of grottos. This also means that EVERYTHING CAN AUTOSCROLL NOW. Entrance shuffles are now much easier to track. Autoscroll is now also triggered on save, just in case someone isn't autosaving and has a lot of checks that get converted to saved. * Fixed missing GS check in LW. * Added area scroll on toggling Show Hidden Items. May configure differently later. Fixed area detection for entrances in Gerudo Fortress/Valley and Collossus. Haunted wasteland doesn't autoscroll due to a bug in `OnTransitionEnd` hook, but checks still evaluate properly there. Rely on scene-based area detection if scene is a main overworld or dungeon scene. * Fixed grotto detection when shuffle is off. * Small code cleanup. Fixed Colossus hand chest checks. * Missing lus bump from merge conflict resolution * Fixed Colossus Grotto making `GetCheckArea` return Wasteland. * Improved OnItemReceive processing for non-token GS checks, since they can sometimes take long enough for the checking process to time out before the item is registered as received. * First attempt at thread safety for tracker data file writing. Seems to work, but might need more testing. * Fixed Recheck Area not unskipping items that register as saved. Improved delayed saving with autosaving, as the autosave triggered quite often before the tracker data save, making things not properly register as saved. * merge cleanup * Converted check tracker data to the sectional saves, adding `CheckTrackerData` to `SaveContext`. Implemented section ID returning and fullSave boolean passing to section functions from my PR temporarily for it to work properly. Moved `RandomizerCheckTrackerData` enum to `randomizerTypes.h` to accommodate that. Changed `Randomizer_SaveInit` to a `SaveManager::InitFunc` to allow for other randomizer-dependent sections to be initialized after that. Required a little refactoring to maintain intro cutscene skip when starting a randomizer file. * Revert section index return and randomizer init changes. Will need to wait on yet more changes to main. * Fixed check tracker initialization (shouldn't be tied to window initialization), restored saving/loading functionality. * Removed `CheckTracker::Init` and put SaveManager calls in `CheckTrackerWindow::InitElement`. Also a bit of cleanup from transition back to save file use. * Fixed tracker displaying check categories while file not loaded. * Fix Darunia's Joy check not marking in vanilla. * Fix autosave not triggering change from collected to saved in tracker data. * Changed default colors for scummed and collected display. * Merge upgrade code cleanup. * Add `OnTransitionEnd` calls to sandstorm transitions both to and from Wasteland. Also improved `gSaveContext.lastScene` assignment for both transition types. Allowed a bit of cleanup in `GetCheckArea`. * Added `StateButton`, a button like `ArrowButton` but that allows text instead of arrow icons. Apparently the changes from ArrowButton to StateButton happened in a previous commit... * Changed section name to `trackerDataCheck` to force SoH to load it after the randomizer section, as it required some randoSettings to be loaded first, and nothing else I tried to make the randomizer section load before it worked. This hacks a solution to checks not displaying on fast file load to a specific slot. F*** you, SaveManager, and f*** you too, JSON. * Forgot to change the section string for loading with the name change. * Fix check ordering for checks that trigger the autosave. * Adds option to remove right-side shop items (slots 1-4) from the tracker list. Enabled by default. * Fix default state of Hide Shop Right Checks checkbox. * Fixes grotto and great fairy scrolling and checks. Fixes array overflow from `checkTrackerData` which was creating the issue trying to load the base and randomizer sections first, among other things. That also fixed the massive file loads that were being exhibited in debug mode. * Fix shooting galleries being set as collected again when being played a second time after getting the checks. * Fix Bazaar autoscroll. * Add Saria's Song to `GetCheckFromActor` and removed some limitations from the messageCloseCheck function to make that check track properly. * Fix Song from Impa check. Implemented prevention for multiple "collections" of great fairies, just in case getting the health refill would trigger it with the previous setup. * Fix ice traps on GS tokens not triggering OnItemReceive. * Complete fix for ice trap collection from GS. Add autoscroll when clicking "Expand All". * Add `OnShopSlotChange` with cursorSlot and basePrice parameters. * Fixed include in en_ossan for shop slot hook. Added registration for `OnShopSlotChange` in the tracker, storing the price in a new `price` field in `CheckTrackerData`. Added "seen" functionality to shop checks. Displays the model item name upon first entering a shop, adding the price and switching to trickName (if it's an ice trap) upon navigating to the slot in buy mode, triggered by an invisible "identified" status that mirrors "seen" in every other way. Added tooltips to most options for check tracker color picking to describe what each status actually means. * `std::format` pls * So apparently std::format just decided to break with the latest merge from develop, but fmt::format exists and works? * Removed the last vestiges of `locationsSkipped`. Other general code and formatting cleanups. Moved `IsGameRunning` to `OTRGlobals` so the item tracker could also access it. Used preceding to "fix" item and bottle display in the item tracker on startup. * Some more code cleanup. Removed "Recheck Area" button and relevant code. Backported changes to Anchor branch applicable for single-player, including making a checkAreas vector and structuring the frame by frame checks around that. Also includes fix for Silver Gauntlets and Mirror Shield check collection crash associated with those changes. Fixed Kakariko Bazaar "seen" updates. Fixed tracker window not showing on initial load like it should. * Forgot 1 formatting fix. * Removed conditions for showing Song from Impa (isn't junk under certain conditions, so should show all the time). * Fix vanilla checks, add Zelda's Letter and Malon's Egg to manual check collection. Fix autoscroll while in child stealth section. * Fix crash in Happy Mask Shop in OnSlotChange (referenced non-existent shop id in a tracker-specific enum). * General code cleanup. * Missed one reversion. * One more. * Fix column alignment in `randomizer_check_objects`. * Fix file encoding on `randomizer_check_tracker`. Again. * Fix indentation for `actualItemtrackerItemMap`. Also removed unnecessary parts of the map. * Rename `HasEqItem` to `HasEquipment`. * Slightly better indentation for `actualItemTrackerItemMap`. * Add magic bean salesman to vanilla check tracking, and genericized deku shield to trigger KF shop item 3 wherever you get the shield. Renamed `vanillaCheck` to `vanillaHundoCheck` to (supposedly) clarify the meaning of the usage. * One more rename to `vanillaCompletion` to avoid possible confusion with 100% speedrun conditions. * give me a break XD Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * Changes suggested by briaguya (rename `RandomizerCheckShow` to `Status`, unused code, newline formatting) * Remove unused `itemNames` table. * Remove `IsGameRunning` in favor of `GameInteractor::IsSaveLoaded`. * Restore anti-spoiler functionality for dungeons with dungeon maps. * Review cleanup. * Fix prices not showing for Kak bazaar items. --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com>
2023-10-04 11:03:36 -04:00
gSaveContext.checkTrackerData[i].status = saveContext->checkTrackerData[i].status = RCSHOW_SAVED;
UpdateAllOrdering();
UpdateInventoryChecks();
} else {
saveContext->checkTrackerData[i].status = RCSHOW_SCUMMED;
}
}
SaveManager::Instance->SaveStruct("", [&]() {
SaveManager::Instance->SaveData("status", saveContext->checkTrackerData[i].status);
SaveManager::Instance->SaveData("skipped", saveContext->checkTrackerData[i].skipped);
SaveManager::Instance->SaveData("price", saveContext->checkTrackerData[i].price);
SaveManager::Instance->SaveData("hintItem", saveContext->checkTrackerData[i].hintItem);
});
});
}
void SaveFile(SaveContext* saveContext, int sectionID, bool fullSave) {
SaveTrackerData(saveContext, sectionID, fullSave);
}
void LoadFile() {
SaveManager::Instance->LoadArray("checks", RC_MAX, [](size_t i) {
SaveManager::Instance->LoadStruct("", [&]() {
SaveManager::Instance->LoadData("status", gSaveContext.checkTrackerData[i].status);
SaveManager::Instance->LoadData("skipped", gSaveContext.checkTrackerData[i].skipped);
SaveManager::Instance->LoadData("price", gSaveContext.checkTrackerData[i].price);
SaveManager::Instance->LoadData("hintItem", gSaveContext.checkTrackerData[i].hintItem);
});
});
}
void Teardown() {
initialized = false;
Flag tracker (#3447) * Hook into flagset hooks for processing check tracking. Has some manual workarounds (some breaks still need to be found). Remove areaChecks and looping functionality as redundant. * Additional vanilla handling. * Fix tracker not showing MQ checks in MQ non-rando. Fix tracker marking non-MQ variants of dungeon checks (e.g. map chest, etc) when collecting in MQ. * Set all areas to spoiled if not rando. * Revert attempt to spoil in randomizer based on MQ dungeon count as I don't know how that works at the moment. * Restore and update spoiling based on MQ dungeon settings (none, selection, or count of 12). Fix Anju As Adult check. * Remove Anchor-specific code :baguette: * Use `ClearAreaTotals()` in `Teardown()` instead of the duplicate code there. * Update to `ClearAreaChecksAndTotals()` with `vec.clear()` added. * Fix type spoiling again. Now spoils on 0 MQ dungeons, not rando, if the option is enabled in check tracker settings, selection, or set number of 12. Fix vanilla checks being marked collected in MQ dungeons. * Fix 100 GS check. * ACTUALLY fix 100 GS: change flag type to `RandomizerInf()` in `item_location.cpp`, add RC to RandoInf for it to the table. Also don't send GI for flag if father, falsely triggers ZR frogs minigame. * Fix gravedigging tour tracking. * Fix membership card check tracking. Change scene and flag values to any existing enums. Clarifying formatting for the checking loop vOrMQ conditions. * Fix Gravedigging Tour tracking. Simplify Always Win Gravedigging Tour and Fix Gravedigging Tour Glitch applications. Modified all necessary paths to use vanilla GDT PoH collection flag instead of randomizer variant. * Fix Kak Potion Shop being "seen" when entering as child.
2023-11-28 21:25:48 -05:00
ClearAreaChecksAndTotals();
Check Tracker Update (#2668) * Initial commit. What works so far: Data file loads, saves, deletes, and is created properly. - Need to run `HasItemBeenCollected` when creating in case of mid-seed regen. Organized checks into maps set by area. Areas show in tracker. - Checks pulled from checkObjectsByArea are not currently listed. - Areas are being assumed completed and hidden at the start. * Checks now populate. Still not counting area totals properly. * Don't track RC_LINKS_POCKET in the data file, and instead manually add it in every time a save is load. rcObjects doesn't contain Link's Pocket location (duh). * Moved ItemReceive hook to randomizer_check_tracker.cpp. Skipped items are properly sorted and formatted. Saved items contribute to an area's gotten/skipped checks on load. Changed skipped items default main color to gray. General code cleanup. * Skipped checks now contribute to area totals for area completion logic. * Mid-menu rework transfer. * Started check lookup on item receive. Tried to enable scum checking on save. * Fixed scum check on save. * More code cleanup, which revealed some issues with loading and saving. Loading now works 100%, but entries in checkTrackerData are disappearing in code somewhere, causing issues with later checks. Scummed color now displays properly. Collected but unsaved displays properly. Unchecked, Skipped, Seen and Scummed checks all have arrows for skipping/unskipping. Counts a little messed up, probably double adding skips. * Fixed item counts being off across resets. Restarts were fine. * Beginning of rework for individual check updates. Adds `Actor lastCheck` to PlayState to allow assigning of last actor to give an item. This allows precise tracking of GS, freestanding PoH, etc. Works for chests too. Currently does not work for shops, unknown for normal NPC gives. Doesn't track last gives for non-checks, like drops from grass, pots, crates, etc. * Actor-based checks fully fleshed out, but can't help with sale-based checks. Implemented `pendingSaleCheck` to back out of an RC check cycle if `gSaveContext->pendingSale` is not NONE when `OnItemReceive` is called, processed through `OnSaleEnd`. This should be the final change necessary to streamline the checks. * Temporary hook to message box close to tie in trackers for non-gs/chest actors that aren't added to `GetCheckFromActor`. This triggers a 2-frame countdown to check with `HasItemBeenCollected` since half of the methods in there aren't updated until after a text box closes. Added scene tracking to get last scene so that checks in scenes that span several overworld areas could be tied to their areas properly. Modified tracker data creation to apply Link's Pocket and Song from Impa conditionally based on randomizer settings instead of just being assumed to be done. May need modification for checking click and drag spoiler loading. Removed the scene equivalence check from CheckChecks so that an entire area is checked each time to avoid issues with, e.g., leaving a shop before a pending sale finishes. * Changed check data creation to use RSKs from gRandomizer to account for settings loaded from drag and drop spoilers. * Beginning of tracker code organization. Changed check color defaults. * Reverted moving tracker colors to header. Some individual check fixes. * Missed something from previous merge? * Removed last remnant of removed performance mode. * Better handle checking when skullsanity is off. * Song checks sceneIDs don't match the scenes they're actually in for some reason. Removed that check. * SaleEnd checks don't need the GetItemEntry parameter. Also set a flag that should prevent the check tracker from running during vanilla saves should that not be resolved by the time it's merged. * Attempting to have only the relevant checks added to the tracker data, as well as showing vanilla checks for non-rando saves. Not working yet (everything is displayed in vanilla). * Added vanilla check tracker population via `vanillaCheck` bool in `RandomizerCheckObject`. This is also added to `IsVisibleInImGui` to handle file loading and saving to eliminate checks that aren't part of vanilla or the rando seed. Implemented deleted tracker data file recreation. Added some extra item name text checks. Songs are still... tricky, so they stay blank. Utilize local copies of the randomizer check objects that are applicable for performance purposes. Fixed vanilla item-giving cutscene crashes when triggered mid-transition. * Apparently not all toolchains can handle macro instantiation without all parameters, like VS can. * Fixed scummed detail color not showing properly on tracker. * Fixed dungeon area totals and GS checks not functioning properly. * Major revamp of checking code. Doesn't rely on `GetCheckFromActor` at all anymore, but instead simply sets a flag to evaluate a number of checks in an area every frame until the check that was gotten is identified. With the new setup, it's much less hardware intensive, and at 60fps 6 checks per frame shows no noticeable effect on framerate. I can envision needing to add a collectedCount in order to account for times when two checks are gotten one right after the other. Changed area scroll to happen from `OnTransitionEnd`, and allow for scrolling in bazaar (was disabled previously because it would jump back and forth between Kak and Market while you were in one). Also setup area check order updating by area instead of all at the same time. * Fixed shooting gallery not reporting proper area. Prevent checks from actually happening if area is RCAREA_INVALID, now that all areas are reporting something if they have checks. Fixed `GetCheckArea()` not updating checks for standard scenes. Lots of vanilla tracking updates, mainly manual checks for gems, medallions and songs, since the often don't have proper scenes in the data. Prevent vanilla from triggering check loops if junk items are collected. Fixed sorting based on saved vs collected. Prevent item name display for vanilla runs. Change coloring of checks so the check name reflects status in vanilla runs. * Fixed "Recheck Area" button erroneously adding to an area's check totals? * Fix DMC vanilla checks. * Fix check tracker data recreation on data file loss. Removed redundant file exists check from SaveTrackerDataHook, as it doesn't matter if it exists or not at that point. Limited check loops to 3 to avoid infinite check loops on non-check/junk item pickup. Added more checks to disable tracker operations if a save is not running. Changed check ordering to put boss reward and heart container checks at the end of whatever RCSHOW group they belong to. * Fixed IsRunning calculation. Further improving vanilla checking. Starting framework for checking medallions, stones, and songs on data file recreation. Fixed medallion check collection. Added GIFT_FROM_SAGES to check list for vanilla file for tracking light medallion. Added check loop limitation to prevent infinite checking after picking up junk item from the ground. * Finished vanilla file recreation and recheck (songs and dungeon rewards all check properly now). This includes deku shield with KF shop item 3. Finished Gift from Raoru light medallion tracking for vanilla. Commented all CheckByScene functionality for now. * Fixed new save data file creation. Disabled entrance area calculation for now, as it only tracks the previous entrance for some reason. Fixed area detection for ToT checks. * GetCheckArea() now utilizes EntranceData almost exclusively, via either `gSaveContext.entranceIndex` or the entrance tracker's `currentGrottoId` in the case of grottos. This also means that EVERYTHING CAN AUTOSCROLL NOW. Entrance shuffles are now much easier to track. Autoscroll is now also triggered on save, just in case someone isn't autosaving and has a lot of checks that get converted to saved. * Fixed missing GS check in LW. * Added area scroll on toggling Show Hidden Items. May configure differently later. Fixed area detection for entrances in Gerudo Fortress/Valley and Collossus. Haunted wasteland doesn't autoscroll due to a bug in `OnTransitionEnd` hook, but checks still evaluate properly there. Rely on scene-based area detection if scene is a main overworld or dungeon scene. * Fixed grotto detection when shuffle is off. * Small code cleanup. Fixed Colossus hand chest checks. * Missing lus bump from merge conflict resolution * Fixed Colossus Grotto making `GetCheckArea` return Wasteland. * Improved OnItemReceive processing for non-token GS checks, since they can sometimes take long enough for the checking process to time out before the item is registered as received. * First attempt at thread safety for tracker data file writing. Seems to work, but might need more testing. * Fixed Recheck Area not unskipping items that register as saved. Improved delayed saving with autosaving, as the autosave triggered quite often before the tracker data save, making things not properly register as saved. * merge cleanup * Converted check tracker data to the sectional saves, adding `CheckTrackerData` to `SaveContext`. Implemented section ID returning and fullSave boolean passing to section functions from my PR temporarily for it to work properly. Moved `RandomizerCheckTrackerData` enum to `randomizerTypes.h` to accommodate that. Changed `Randomizer_SaveInit` to a `SaveManager::InitFunc` to allow for other randomizer-dependent sections to be initialized after that. Required a little refactoring to maintain intro cutscene skip when starting a randomizer file. * Revert section index return and randomizer init changes. Will need to wait on yet more changes to main. * Fixed check tracker initialization (shouldn't be tied to window initialization), restored saving/loading functionality. * Removed `CheckTracker::Init` and put SaveManager calls in `CheckTrackerWindow::InitElement`. Also a bit of cleanup from transition back to save file use. * Fixed tracker displaying check categories while file not loaded. * Fix Darunia's Joy check not marking in vanilla. * Fix autosave not triggering change from collected to saved in tracker data. * Changed default colors for scummed and collected display. * Merge upgrade code cleanup. * Add `OnTransitionEnd` calls to sandstorm transitions both to and from Wasteland. Also improved `gSaveContext.lastScene` assignment for both transition types. Allowed a bit of cleanup in `GetCheckArea`. * Added `StateButton`, a button like `ArrowButton` but that allows text instead of arrow icons. Apparently the changes from ArrowButton to StateButton happened in a previous commit... * Changed section name to `trackerDataCheck` to force SoH to load it after the randomizer section, as it required some randoSettings to be loaded first, and nothing else I tried to make the randomizer section load before it worked. This hacks a solution to checks not displaying on fast file load to a specific slot. F*** you, SaveManager, and f*** you too, JSON. * Forgot to change the section string for loading with the name change. * Fix check ordering for checks that trigger the autosave. * Adds option to remove right-side shop items (slots 1-4) from the tracker list. Enabled by default. * Fix default state of Hide Shop Right Checks checkbox. * Fixes grotto and great fairy scrolling and checks. Fixes array overflow from `checkTrackerData` which was creating the issue trying to load the base and randomizer sections first, among other things. That also fixed the massive file loads that were being exhibited in debug mode. * Fix shooting galleries being set as collected again when being played a second time after getting the checks. * Fix Bazaar autoscroll. * Add Saria's Song to `GetCheckFromActor` and removed some limitations from the messageCloseCheck function to make that check track properly. * Fix Song from Impa check. Implemented prevention for multiple "collections" of great fairies, just in case getting the health refill would trigger it with the previous setup. * Fix ice traps on GS tokens not triggering OnItemReceive. * Complete fix for ice trap collection from GS. Add autoscroll when clicking "Expand All". * Add `OnShopSlotChange` with cursorSlot and basePrice parameters. * Fixed include in en_ossan for shop slot hook. Added registration for `OnShopSlotChange` in the tracker, storing the price in a new `price` field in `CheckTrackerData`. Added "seen" functionality to shop checks. Displays the model item name upon first entering a shop, adding the price and switching to trickName (if it's an ice trap) upon navigating to the slot in buy mode, triggered by an invisible "identified" status that mirrors "seen" in every other way. Added tooltips to most options for check tracker color picking to describe what each status actually means. * `std::format` pls * So apparently std::format just decided to break with the latest merge from develop, but fmt::format exists and works? * Removed the last vestiges of `locationsSkipped`. Other general code and formatting cleanups. Moved `IsGameRunning` to `OTRGlobals` so the item tracker could also access it. Used preceding to "fix" item and bottle display in the item tracker on startup. * Some more code cleanup. Removed "Recheck Area" button and relevant code. Backported changes to Anchor branch applicable for single-player, including making a checkAreas vector and structuring the frame by frame checks around that. Also includes fix for Silver Gauntlets and Mirror Shield check collection crash associated with those changes. Fixed Kakariko Bazaar "seen" updates. Fixed tracker window not showing on initial load like it should. * Forgot 1 formatting fix. * Removed conditions for showing Song from Impa (isn't junk under certain conditions, so should show all the time). * Fix vanilla checks, add Zelda's Letter and Malon's Egg to manual check collection. Fix autoscroll while in child stealth section. * Fix crash in Happy Mask Shop in OnSlotChange (referenced non-existent shop id in a tracker-specific enum). * General code cleanup. * Missed one reversion. * One more. * Fix column alignment in `randomizer_check_objects`. * Fix file encoding on `randomizer_check_tracker`. Again. * Fix indentation for `actualItemtrackerItemMap`. Also removed unnecessary parts of the map. * Rename `HasEqItem` to `HasEquipment`. * Slightly better indentation for `actualItemTrackerItemMap`. * Add magic bean salesman to vanilla check tracking, and genericized deku shield to trigger KF shop item 3 wherever you get the shield. Renamed `vanillaCheck` to `vanillaHundoCheck` to (supposedly) clarify the meaning of the usage. * One more rename to `vanillaCompletion` to avoid possible confusion with 100% speedrun conditions. * give me a break XD Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * Changes suggested by briaguya (rename `RandomizerCheckShow` to `Status`, unused code, newline formatting) * Remove unused `itemNames` table. * Remove `IsGameRunning` in favor of `GameInteractor::IsSaveLoaded`. * Restore anti-spoiler functionality for dungeons with dungeon maps. * Review cleanup. * Fix prices not showing for Kak bazaar items. --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com>
2023-10-04 11:03:36 -04:00
checksByArea.clear();
areasSpoiled = 0;
lastLocationChecked = RC_UNKNOWN_CHECK;
}
void UpdateCheck(uint32_t check, RandomizerCheckTrackerData data) {
auto area = RandomizerCheckObjects::GetAllRCObjects().find(static_cast<RandomizerCheck>(check))->second.rcArea;
if ((!gSaveContext.checkTrackerData[check].skipped && data.skipped) ||
((gSaveContext.checkTrackerData[check].status != RCSHOW_COLLECTED && gSaveContext.checkTrackerData[check].status != RCSHOW_SAVED) &&
(data.status == RCSHOW_COLLECTED || data.status == RCSHOW_SAVED))) {
Check Tracker Update (#2668) * Initial commit. What works so far: Data file loads, saves, deletes, and is created properly. - Need to run `HasItemBeenCollected` when creating in case of mid-seed regen. Organized checks into maps set by area. Areas show in tracker. - Checks pulled from checkObjectsByArea are not currently listed. - Areas are being assumed completed and hidden at the start. * Checks now populate. Still not counting area totals properly. * Don't track RC_LINKS_POCKET in the data file, and instead manually add it in every time a save is load. rcObjects doesn't contain Link's Pocket location (duh). * Moved ItemReceive hook to randomizer_check_tracker.cpp. Skipped items are properly sorted and formatted. Saved items contribute to an area's gotten/skipped checks on load. Changed skipped items default main color to gray. General code cleanup. * Skipped checks now contribute to area totals for area completion logic. * Mid-menu rework transfer. * Started check lookup on item receive. Tried to enable scum checking on save. * Fixed scum check on save. * More code cleanup, which revealed some issues with loading and saving. Loading now works 100%, but entries in checkTrackerData are disappearing in code somewhere, causing issues with later checks. Scummed color now displays properly. Collected but unsaved displays properly. Unchecked, Skipped, Seen and Scummed checks all have arrows for skipping/unskipping. Counts a little messed up, probably double adding skips. * Fixed item counts being off across resets. Restarts were fine. * Beginning of rework for individual check updates. Adds `Actor lastCheck` to PlayState to allow assigning of last actor to give an item. This allows precise tracking of GS, freestanding PoH, etc. Works for chests too. Currently does not work for shops, unknown for normal NPC gives. Doesn't track last gives for non-checks, like drops from grass, pots, crates, etc. * Actor-based checks fully fleshed out, but can't help with sale-based checks. Implemented `pendingSaleCheck` to back out of an RC check cycle if `gSaveContext->pendingSale` is not NONE when `OnItemReceive` is called, processed through `OnSaleEnd`. This should be the final change necessary to streamline the checks. * Temporary hook to message box close to tie in trackers for non-gs/chest actors that aren't added to `GetCheckFromActor`. This triggers a 2-frame countdown to check with `HasItemBeenCollected` since half of the methods in there aren't updated until after a text box closes. Added scene tracking to get last scene so that checks in scenes that span several overworld areas could be tied to their areas properly. Modified tracker data creation to apply Link's Pocket and Song from Impa conditionally based on randomizer settings instead of just being assumed to be done. May need modification for checking click and drag spoiler loading. Removed the scene equivalence check from CheckChecks so that an entire area is checked each time to avoid issues with, e.g., leaving a shop before a pending sale finishes. * Changed check data creation to use RSKs from gRandomizer to account for settings loaded from drag and drop spoilers. * Beginning of tracker code organization. Changed check color defaults. * Reverted moving tracker colors to header. Some individual check fixes. * Missed something from previous merge? * Removed last remnant of removed performance mode. * Better handle checking when skullsanity is off. * Song checks sceneIDs don't match the scenes they're actually in for some reason. Removed that check. * SaleEnd checks don't need the GetItemEntry parameter. Also set a flag that should prevent the check tracker from running during vanilla saves should that not be resolved by the time it's merged. * Attempting to have only the relevant checks added to the tracker data, as well as showing vanilla checks for non-rando saves. Not working yet (everything is displayed in vanilla). * Added vanilla check tracker population via `vanillaCheck` bool in `RandomizerCheckObject`. This is also added to `IsVisibleInImGui` to handle file loading and saving to eliminate checks that aren't part of vanilla or the rando seed. Implemented deleted tracker data file recreation. Added some extra item name text checks. Songs are still... tricky, so they stay blank. Utilize local copies of the randomizer check objects that are applicable for performance purposes. Fixed vanilla item-giving cutscene crashes when triggered mid-transition. * Apparently not all toolchains can handle macro instantiation without all parameters, like VS can. * Fixed scummed detail color not showing properly on tracker. * Fixed dungeon area totals and GS checks not functioning properly. * Major revamp of checking code. Doesn't rely on `GetCheckFromActor` at all anymore, but instead simply sets a flag to evaluate a number of checks in an area every frame until the check that was gotten is identified. With the new setup, it's much less hardware intensive, and at 60fps 6 checks per frame shows no noticeable effect on framerate. I can envision needing to add a collectedCount in order to account for times when two checks are gotten one right after the other. Changed area scroll to happen from `OnTransitionEnd`, and allow for scrolling in bazaar (was disabled previously because it would jump back and forth between Kak and Market while you were in one). Also setup area check order updating by area instead of all at the same time. * Fixed shooting gallery not reporting proper area. Prevent checks from actually happening if area is RCAREA_INVALID, now that all areas are reporting something if they have checks. Fixed `GetCheckArea()` not updating checks for standard scenes. Lots of vanilla tracking updates, mainly manual checks for gems, medallions and songs, since the often don't have proper scenes in the data. Prevent vanilla from triggering check loops if junk items are collected. Fixed sorting based on saved vs collected. Prevent item name display for vanilla runs. Change coloring of checks so the check name reflects status in vanilla runs. * Fixed "Recheck Area" button erroneously adding to an area's check totals? * Fix DMC vanilla checks. * Fix check tracker data recreation on data file loss. Removed redundant file exists check from SaveTrackerDataHook, as it doesn't matter if it exists or not at that point. Limited check loops to 3 to avoid infinite check loops on non-check/junk item pickup. Added more checks to disable tracker operations if a save is not running. Changed check ordering to put boss reward and heart container checks at the end of whatever RCSHOW group they belong to. * Fixed IsRunning calculation. Further improving vanilla checking. Starting framework for checking medallions, stones, and songs on data file recreation. Fixed medallion check collection. Added GIFT_FROM_SAGES to check list for vanilla file for tracking light medallion. Added check loop limitation to prevent infinite checking after picking up junk item from the ground. * Finished vanilla file recreation and recheck (songs and dungeon rewards all check properly now). This includes deku shield with KF shop item 3. Finished Gift from Raoru light medallion tracking for vanilla. Commented all CheckByScene functionality for now. * Fixed new save data file creation. Disabled entrance area calculation for now, as it only tracks the previous entrance for some reason. Fixed area detection for ToT checks. * GetCheckArea() now utilizes EntranceData almost exclusively, via either `gSaveContext.entranceIndex` or the entrance tracker's `currentGrottoId` in the case of grottos. This also means that EVERYTHING CAN AUTOSCROLL NOW. Entrance shuffles are now much easier to track. Autoscroll is now also triggered on save, just in case someone isn't autosaving and has a lot of checks that get converted to saved. * Fixed missing GS check in LW. * Added area scroll on toggling Show Hidden Items. May configure differently later. Fixed area detection for entrances in Gerudo Fortress/Valley and Collossus. Haunted wasteland doesn't autoscroll due to a bug in `OnTransitionEnd` hook, but checks still evaluate properly there. Rely on scene-based area detection if scene is a main overworld or dungeon scene. * Fixed grotto detection when shuffle is off. * Small code cleanup. Fixed Colossus hand chest checks. * Missing lus bump from merge conflict resolution * Fixed Colossus Grotto making `GetCheckArea` return Wasteland. * Improved OnItemReceive processing for non-token GS checks, since they can sometimes take long enough for the checking process to time out before the item is registered as received. * First attempt at thread safety for tracker data file writing. Seems to work, but might need more testing. * Fixed Recheck Area not unskipping items that register as saved. Improved delayed saving with autosaving, as the autosave triggered quite often before the tracker data save, making things not properly register as saved. * merge cleanup * Converted check tracker data to the sectional saves, adding `CheckTrackerData` to `SaveContext`. Implemented section ID returning and fullSave boolean passing to section functions from my PR temporarily for it to work properly. Moved `RandomizerCheckTrackerData` enum to `randomizerTypes.h` to accommodate that. Changed `Randomizer_SaveInit` to a `SaveManager::InitFunc` to allow for other randomizer-dependent sections to be initialized after that. Required a little refactoring to maintain intro cutscene skip when starting a randomizer file. * Revert section index return and randomizer init changes. Will need to wait on yet more changes to main. * Fixed check tracker initialization (shouldn't be tied to window initialization), restored saving/loading functionality. * Removed `CheckTracker::Init` and put SaveManager calls in `CheckTrackerWindow::InitElement`. Also a bit of cleanup from transition back to save file use. * Fixed tracker displaying check categories while file not loaded. * Fix Darunia's Joy check not marking in vanilla. * Fix autosave not triggering change from collected to saved in tracker data. * Changed default colors for scummed and collected display. * Merge upgrade code cleanup. * Add `OnTransitionEnd` calls to sandstorm transitions both to and from Wasteland. Also improved `gSaveContext.lastScene` assignment for both transition types. Allowed a bit of cleanup in `GetCheckArea`. * Added `StateButton`, a button like `ArrowButton` but that allows text instead of arrow icons. Apparently the changes from ArrowButton to StateButton happened in a previous commit... * Changed section name to `trackerDataCheck` to force SoH to load it after the randomizer section, as it required some randoSettings to be loaded first, and nothing else I tried to make the randomizer section load before it worked. This hacks a solution to checks not displaying on fast file load to a specific slot. F*** you, SaveManager, and f*** you too, JSON. * Forgot to change the section string for loading with the name change. * Fix check ordering for checks that trigger the autosave. * Adds option to remove right-side shop items (slots 1-4) from the tracker list. Enabled by default. * Fix default state of Hide Shop Right Checks checkbox. * Fixes grotto and great fairy scrolling and checks. Fixes array overflow from `checkTrackerData` which was creating the issue trying to load the base and randomizer sections first, among other things. That also fixed the massive file loads that were being exhibited in debug mode. * Fix shooting galleries being set as collected again when being played a second time after getting the checks. * Fix Bazaar autoscroll. * Add Saria's Song to `GetCheckFromActor` and removed some limitations from the messageCloseCheck function to make that check track properly. * Fix Song from Impa check. Implemented prevention for multiple "collections" of great fairies, just in case getting the health refill would trigger it with the previous setup. * Fix ice traps on GS tokens not triggering OnItemReceive. * Complete fix for ice trap collection from GS. Add autoscroll when clicking "Expand All". * Add `OnShopSlotChange` with cursorSlot and basePrice parameters. * Fixed include in en_ossan for shop slot hook. Added registration for `OnShopSlotChange` in the tracker, storing the price in a new `price` field in `CheckTrackerData`. Added "seen" functionality to shop checks. Displays the model item name upon first entering a shop, adding the price and switching to trickName (if it's an ice trap) upon navigating to the slot in buy mode, triggered by an invisible "identified" status that mirrors "seen" in every other way. Added tooltips to most options for check tracker color picking to describe what each status actually means. * `std::format` pls * So apparently std::format just decided to break with the latest merge from develop, but fmt::format exists and works? * Removed the last vestiges of `locationsSkipped`. Other general code and formatting cleanups. Moved `IsGameRunning` to `OTRGlobals` so the item tracker could also access it. Used preceding to "fix" item and bottle display in the item tracker on startup. * Some more code cleanup. Removed "Recheck Area" button and relevant code. Backported changes to Anchor branch applicable for single-player, including making a checkAreas vector and structuring the frame by frame checks around that. Also includes fix for Silver Gauntlets and Mirror Shield check collection crash associated with those changes. Fixed Kakariko Bazaar "seen" updates. Fixed tracker window not showing on initial load like it should. * Forgot 1 formatting fix. * Removed conditions for showing Song from Impa (isn't junk under certain conditions, so should show all the time). * Fix vanilla checks, add Zelda's Letter and Malon's Egg to manual check collection. Fix autoscroll while in child stealth section. * Fix crash in Happy Mask Shop in OnSlotChange (referenced non-existent shop id in a tracker-specific enum). * General code cleanup. * Missed one reversion. * One more. * Fix column alignment in `randomizer_check_objects`. * Fix file encoding on `randomizer_check_tracker`. Again. * Fix indentation for `actualItemtrackerItemMap`. Also removed unnecessary parts of the map. * Rename `HasEqItem` to `HasEquipment`. * Slightly better indentation for `actualItemTrackerItemMap`. * Add magic bean salesman to vanilla check tracking, and genericized deku shield to trigger KF shop item 3 wherever you get the shield. Renamed `vanillaCheck` to `vanillaHundoCheck` to (supposedly) clarify the meaning of the usage. * One more rename to `vanillaCompletion` to avoid possible confusion with 100% speedrun conditions. * give me a break XD Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * Changes suggested by briaguya (rename `RandomizerCheckShow` to `Status`, unused code, newline formatting) * Remove unused `itemNames` table. * Remove `IsGameRunning` in favor of `GameInteractor::IsSaveLoaded`. * Restore anti-spoiler functionality for dungeons with dungeon maps. * Review cleanup. * Fix prices not showing for Kak bazaar items. --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com>
2023-10-04 11:03:36 -04:00
areaChecksGotten[area]++;
} else if ((gSaveContext.checkTrackerData[check].skipped && !data.skipped) ||
((gSaveContext.checkTrackerData[check].status == RCSHOW_COLLECTED || gSaveContext.checkTrackerData[check].status == RCSHOW_SAVED) &&
(data.status != RCSHOW_COLLECTED && data.status != RCSHOW_SAVED))) {
Check Tracker Update (#2668) * Initial commit. What works so far: Data file loads, saves, deletes, and is created properly. - Need to run `HasItemBeenCollected` when creating in case of mid-seed regen. Organized checks into maps set by area. Areas show in tracker. - Checks pulled from checkObjectsByArea are not currently listed. - Areas are being assumed completed and hidden at the start. * Checks now populate. Still not counting area totals properly. * Don't track RC_LINKS_POCKET in the data file, and instead manually add it in every time a save is load. rcObjects doesn't contain Link's Pocket location (duh). * Moved ItemReceive hook to randomizer_check_tracker.cpp. Skipped items are properly sorted and formatted. Saved items contribute to an area's gotten/skipped checks on load. Changed skipped items default main color to gray. General code cleanup. * Skipped checks now contribute to area totals for area completion logic. * Mid-menu rework transfer. * Started check lookup on item receive. Tried to enable scum checking on save. * Fixed scum check on save. * More code cleanup, which revealed some issues with loading and saving. Loading now works 100%, but entries in checkTrackerData are disappearing in code somewhere, causing issues with later checks. Scummed color now displays properly. Collected but unsaved displays properly. Unchecked, Skipped, Seen and Scummed checks all have arrows for skipping/unskipping. Counts a little messed up, probably double adding skips. * Fixed item counts being off across resets. Restarts were fine. * Beginning of rework for individual check updates. Adds `Actor lastCheck` to PlayState to allow assigning of last actor to give an item. This allows precise tracking of GS, freestanding PoH, etc. Works for chests too. Currently does not work for shops, unknown for normal NPC gives. Doesn't track last gives for non-checks, like drops from grass, pots, crates, etc. * Actor-based checks fully fleshed out, but can't help with sale-based checks. Implemented `pendingSaleCheck` to back out of an RC check cycle if `gSaveContext->pendingSale` is not NONE when `OnItemReceive` is called, processed through `OnSaleEnd`. This should be the final change necessary to streamline the checks. * Temporary hook to message box close to tie in trackers for non-gs/chest actors that aren't added to `GetCheckFromActor`. This triggers a 2-frame countdown to check with `HasItemBeenCollected` since half of the methods in there aren't updated until after a text box closes. Added scene tracking to get last scene so that checks in scenes that span several overworld areas could be tied to their areas properly. Modified tracker data creation to apply Link's Pocket and Song from Impa conditionally based on randomizer settings instead of just being assumed to be done. May need modification for checking click and drag spoiler loading. Removed the scene equivalence check from CheckChecks so that an entire area is checked each time to avoid issues with, e.g., leaving a shop before a pending sale finishes. * Changed check data creation to use RSKs from gRandomizer to account for settings loaded from drag and drop spoilers. * Beginning of tracker code organization. Changed check color defaults. * Reverted moving tracker colors to header. Some individual check fixes. * Missed something from previous merge? * Removed last remnant of removed performance mode. * Better handle checking when skullsanity is off. * Song checks sceneIDs don't match the scenes they're actually in for some reason. Removed that check. * SaleEnd checks don't need the GetItemEntry parameter. Also set a flag that should prevent the check tracker from running during vanilla saves should that not be resolved by the time it's merged. * Attempting to have only the relevant checks added to the tracker data, as well as showing vanilla checks for non-rando saves. Not working yet (everything is displayed in vanilla). * Added vanilla check tracker population via `vanillaCheck` bool in `RandomizerCheckObject`. This is also added to `IsVisibleInImGui` to handle file loading and saving to eliminate checks that aren't part of vanilla or the rando seed. Implemented deleted tracker data file recreation. Added some extra item name text checks. Songs are still... tricky, so they stay blank. Utilize local copies of the randomizer check objects that are applicable for performance purposes. Fixed vanilla item-giving cutscene crashes when triggered mid-transition. * Apparently not all toolchains can handle macro instantiation without all parameters, like VS can. * Fixed scummed detail color not showing properly on tracker. * Fixed dungeon area totals and GS checks not functioning properly. * Major revamp of checking code. Doesn't rely on `GetCheckFromActor` at all anymore, but instead simply sets a flag to evaluate a number of checks in an area every frame until the check that was gotten is identified. With the new setup, it's much less hardware intensive, and at 60fps 6 checks per frame shows no noticeable effect on framerate. I can envision needing to add a collectedCount in order to account for times when two checks are gotten one right after the other. Changed area scroll to happen from `OnTransitionEnd`, and allow for scrolling in bazaar (was disabled previously because it would jump back and forth between Kak and Market while you were in one). Also setup area check order updating by area instead of all at the same time. * Fixed shooting gallery not reporting proper area. Prevent checks from actually happening if area is RCAREA_INVALID, now that all areas are reporting something if they have checks. Fixed `GetCheckArea()` not updating checks for standard scenes. Lots of vanilla tracking updates, mainly manual checks for gems, medallions and songs, since the often don't have proper scenes in the data. Prevent vanilla from triggering check loops if junk items are collected. Fixed sorting based on saved vs collected. Prevent item name display for vanilla runs. Change coloring of checks so the check name reflects status in vanilla runs. * Fixed "Recheck Area" button erroneously adding to an area's check totals? * Fix DMC vanilla checks. * Fix check tracker data recreation on data file loss. Removed redundant file exists check from SaveTrackerDataHook, as it doesn't matter if it exists or not at that point. Limited check loops to 3 to avoid infinite check loops on non-check/junk item pickup. Added more checks to disable tracker operations if a save is not running. Changed check ordering to put boss reward and heart container checks at the end of whatever RCSHOW group they belong to. * Fixed IsRunning calculation. Further improving vanilla checking. Starting framework for checking medallions, stones, and songs on data file recreation. Fixed medallion check collection. Added GIFT_FROM_SAGES to check list for vanilla file for tracking light medallion. Added check loop limitation to prevent infinite checking after picking up junk item from the ground. * Finished vanilla file recreation and recheck (songs and dungeon rewards all check properly now). This includes deku shield with KF shop item 3. Finished Gift from Raoru light medallion tracking for vanilla. Commented all CheckByScene functionality for now. * Fixed new save data file creation. Disabled entrance area calculation for now, as it only tracks the previous entrance for some reason. Fixed area detection for ToT checks. * GetCheckArea() now utilizes EntranceData almost exclusively, via either `gSaveContext.entranceIndex` or the entrance tracker's `currentGrottoId` in the case of grottos. This also means that EVERYTHING CAN AUTOSCROLL NOW. Entrance shuffles are now much easier to track. Autoscroll is now also triggered on save, just in case someone isn't autosaving and has a lot of checks that get converted to saved. * Fixed missing GS check in LW. * Added area scroll on toggling Show Hidden Items. May configure differently later. Fixed area detection for entrances in Gerudo Fortress/Valley and Collossus. Haunted wasteland doesn't autoscroll due to a bug in `OnTransitionEnd` hook, but checks still evaluate properly there. Rely on scene-based area detection if scene is a main overworld or dungeon scene. * Fixed grotto detection when shuffle is off. * Small code cleanup. Fixed Colossus hand chest checks. * Missing lus bump from merge conflict resolution * Fixed Colossus Grotto making `GetCheckArea` return Wasteland. * Improved OnItemReceive processing for non-token GS checks, since they can sometimes take long enough for the checking process to time out before the item is registered as received. * First attempt at thread safety for tracker data file writing. Seems to work, but might need more testing. * Fixed Recheck Area not unskipping items that register as saved. Improved delayed saving with autosaving, as the autosave triggered quite often before the tracker data save, making things not properly register as saved. * merge cleanup * Converted check tracker data to the sectional saves, adding `CheckTrackerData` to `SaveContext`. Implemented section ID returning and fullSave boolean passing to section functions from my PR temporarily for it to work properly. Moved `RandomizerCheckTrackerData` enum to `randomizerTypes.h` to accommodate that. Changed `Randomizer_SaveInit` to a `SaveManager::InitFunc` to allow for other randomizer-dependent sections to be initialized after that. Required a little refactoring to maintain intro cutscene skip when starting a randomizer file. * Revert section index return and randomizer init changes. Will need to wait on yet more changes to main. * Fixed check tracker initialization (shouldn't be tied to window initialization), restored saving/loading functionality. * Removed `CheckTracker::Init` and put SaveManager calls in `CheckTrackerWindow::InitElement`. Also a bit of cleanup from transition back to save file use. * Fixed tracker displaying check categories while file not loaded. * Fix Darunia's Joy check not marking in vanilla. * Fix autosave not triggering change from collected to saved in tracker data. * Changed default colors for scummed and collected display. * Merge upgrade code cleanup. * Add `OnTransitionEnd` calls to sandstorm transitions both to and from Wasteland. Also improved `gSaveContext.lastScene` assignment for both transition types. Allowed a bit of cleanup in `GetCheckArea`. * Added `StateButton`, a button like `ArrowButton` but that allows text instead of arrow icons. Apparently the changes from ArrowButton to StateButton happened in a previous commit... * Changed section name to `trackerDataCheck` to force SoH to load it after the randomizer section, as it required some randoSettings to be loaded first, and nothing else I tried to make the randomizer section load before it worked. This hacks a solution to checks not displaying on fast file load to a specific slot. F*** you, SaveManager, and f*** you too, JSON. * Forgot to change the section string for loading with the name change. * Fix check ordering for checks that trigger the autosave. * Adds option to remove right-side shop items (slots 1-4) from the tracker list. Enabled by default. * Fix default state of Hide Shop Right Checks checkbox. * Fixes grotto and great fairy scrolling and checks. Fixes array overflow from `checkTrackerData` which was creating the issue trying to load the base and randomizer sections first, among other things. That also fixed the massive file loads that were being exhibited in debug mode. * Fix shooting galleries being set as collected again when being played a second time after getting the checks. * Fix Bazaar autoscroll. * Add Saria's Song to `GetCheckFromActor` and removed some limitations from the messageCloseCheck function to make that check track properly. * Fix Song from Impa check. Implemented prevention for multiple "collections" of great fairies, just in case getting the health refill would trigger it with the previous setup. * Fix ice traps on GS tokens not triggering OnItemReceive. * Complete fix for ice trap collection from GS. Add autoscroll when clicking "Expand All". * Add `OnShopSlotChange` with cursorSlot and basePrice parameters. * Fixed include in en_ossan for shop slot hook. Added registration for `OnShopSlotChange` in the tracker, storing the price in a new `price` field in `CheckTrackerData`. Added "seen" functionality to shop checks. Displays the model item name upon first entering a shop, adding the price and switching to trickName (if it's an ice trap) upon navigating to the slot in buy mode, triggered by an invisible "identified" status that mirrors "seen" in every other way. Added tooltips to most options for check tracker color picking to describe what each status actually means. * `std::format` pls * So apparently std::format just decided to break with the latest merge from develop, but fmt::format exists and works? * Removed the last vestiges of `locationsSkipped`. Other general code and formatting cleanups. Moved `IsGameRunning` to `OTRGlobals` so the item tracker could also access it. Used preceding to "fix" item and bottle display in the item tracker on startup. * Some more code cleanup. Removed "Recheck Area" button and relevant code. Backported changes to Anchor branch applicable for single-player, including making a checkAreas vector and structuring the frame by frame checks around that. Also includes fix for Silver Gauntlets and Mirror Shield check collection crash associated with those changes. Fixed Kakariko Bazaar "seen" updates. Fixed tracker window not showing on initial load like it should. * Forgot 1 formatting fix. * Removed conditions for showing Song from Impa (isn't junk under certain conditions, so should show all the time). * Fix vanilla checks, add Zelda's Letter and Malon's Egg to manual check collection. Fix autoscroll while in child stealth section. * Fix crash in Happy Mask Shop in OnSlotChange (referenced non-existent shop id in a tracker-specific enum). * General code cleanup. * Missed one reversion. * One more. * Fix column alignment in `randomizer_check_objects`. * Fix file encoding on `randomizer_check_tracker`. Again. * Fix indentation for `actualItemtrackerItemMap`. Also removed unnecessary parts of the map. * Rename `HasEqItem` to `HasEquipment`. * Slightly better indentation for `actualItemTrackerItemMap`. * Add magic bean salesman to vanilla check tracking, and genericized deku shield to trigger KF shop item 3 wherever you get the shield. Renamed `vanillaCheck` to `vanillaHundoCheck` to (supposedly) clarify the meaning of the usage. * One more rename to `vanillaCompletion` to avoid possible confusion with 100% speedrun conditions. * give me a break XD Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * Changes suggested by briaguya (rename `RandomizerCheckShow` to `Status`, unused code, newline formatting) * Remove unused `itemNames` table. * Remove `IsGameRunning` in favor of `GameInteractor::IsSaveLoaded`. * Restore anti-spoiler functionality for dungeons with dungeon maps. * Review cleanup. * Fix prices not showing for Kak bazaar items. --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com>
2023-10-04 11:03:36 -04:00
areaChecksGotten[area]--;
}
gSaveContext.checkTrackerData[check] = data;
UpdateOrdering(area);
}
Randomizer Auto Location tracker (#1942) * Initial Auto-Location Tracking * Updates styling for checked items in Check Tracker * Fixes crashing issues with Check Tracker rendering * Auto scroll Check Tracker windows to current area * Checks Tracker only shows checked locations once in game * Fixes issue where Check Tracker would auto-scroll to wrong location when entering a grotto * Fixes gerudo fortress checks showing in tracker when settings have them removed * InfTable Check Location Fixes: Lost Dog Richard, Rolling Gorons, HBA 1000, Thawed Zora * Fixes most Event Chk Inf Checks on Check Tracker, and Frogs * Check Tracker - Song from Malon now works * Check Tracker - Fixes Claim Check check not tracking - Fixes spoiler for Claim Check check when getting Biggoron's Sword - Fixes LACS being spoiled and not tracking * Check Tracker - Fixes #2 for Skull Mask and Mask of Truth checks * Check Tracker - Adds support for merchants - Fixes #7 for Bomchu Salesman - Fixes #12 for Medigoron * Check Tracker - Fixes #8 for Song from Saria * Check Tracker - Fixes #9 for Adult Shooting Gallery * Check Tracker - Fixes #10 for Composer Grave * Check Tracker - Fixes #14 for Song from Ocarina of Time * Check Tracker - Fixes #16 for Shooting the Sun * Check Tracker - Fixes #19 for Darunia's Joy * Save Editor - Adds missing label for Treasure Chest Game * Check Tracker - Fixes Great Faries checks * Check Tracker - Fixes Sheik at Temple * Check Tracker - Fixes Great Fairy auto-scroll to wrong location * Check Tracker - Updates blue warp checks - Fixes Bongo Bongo and Twinrova checks * Check Tracker - Fixes Dampe's Gravedigging Tour * Check Tracker - Fixes Prescription to King Zora * Check Tracker - Fixes Bazaar showing under wrong area on tracker between adult/child * Check Tracker - Fixes scroll for Hyrule Market and Bazaar * Check Tracker - Fixes giving Adult Trade Items shown on tracker: Broken Sword, Saw, Cojiro, Eyeball Froge, and Eyedrops * Cleans up item_location * Check Tracker - Item List - Fixes item list not updating when changing seeds/options - Separates item exclusion list from item check list - Clean up comments * Check Tracker - Adds Skip functionality to buttons * Check Tracker - Refactors adult trade items to RandomizerInf * Check Tracker - Fixes an issue where any time an item is removed the tracker would cause an application crash * Check Tracker - Item names are now dependent on file language * Check Tracker - Fixes Gerudo Card check not showing in Fast setting * Reorders headers to (hopefully) avoid CI build conflicts on linux/consoles * Explicitly defines vector header in randomizer.h to fix compile errors * Complete Refactor of Check Tracker ImGui * Adds missing check tracker files to CMakeLists * Reverts the Item_location whitespace cleanup from ad10807c * Check Tracker - Loading Fixes - Fixes a bug where loading a save file a second time would add all the checks again - Fixes a bug where the check tracker would not render at all until in a save file * Check Tracker - Fixes a bug where checks would sometimes fail to load * Check Tracker - Fixes duplicated checks when using Only on Pause or Only on Combo * Check Tracker - Works around issue where single characters don't show in EnhancementCombobox, and fixes a label for combo buttons held option * Check Tracker - Applies all Check Tracker changes to Item Location * Check Tracker - Updated Check List - Adds Link's pocket, either in KF or HM depending on starting age - Supports Scrubs and Merchants - Uses enums instead of magic numbers - Updates DC Scrub Short Names for MQ * Check Tracker - Adds a performance mode option * Check Tracker - List Fixes (requires new rando generation) - Fixes Frogs Rupees always visible - Fixes Kokiri Sword Chest not showing - Fixes Weird Egg not showing * Check Tracker - MQ List basic support * Check Tracker - MQ/Vanilla anti-spoilers * Check Tracker - Collecting a compass now spoils the area * Check Tracker - Basic Vanilla Support and fixes - Vanilla items show in check tracker, even if many won't auto check - Fixes an issue with Gerudo Fortress Keys - Refactors IsVisibleInCheckTracker to randomizer_check_tracjer * Check Tracker - Fixes merge conflict from 08a487f35e1d760ab9e69b932edbe4da6bcd9edb * Check Tracker - Fixes tracker loading as Floating when default value is set to Windowed * Randomizer Location Exclusion List - Adds Scrubs, Merchants, Shops. Adult Trade items, MQ Dungeons, and Bean Salesman - Fixes Kokiri Sword Chest, Weird Egg, and Frog Song Rupees from misbehaving - Updates Gerudo Fortress logic to be dependent on Open/Fast/Normal Fortress - Removes Invalid Check - Adds RO Enum for MQ settings - Updates magic values to RO enum * Location Exclusion List - Scrubs that are always randomized now always show on the list * For now, removes some extra code only needed for a Check Tracker. * Randomizer Location Exclusion List - Fixes Eyeball Frog from showing up when Adult Trade Items was off * Location Tracker - Updates Eyedrops to use RandomizerInf instead of Chest * Check Tracker - Fixes a bug where Link's Pocket item wasn't acting as checked for area item count * Check Tracker - Fixes a bug where Locations would incorrectly say Vanilla due to the first check in the area being a non-MQ check * Check Tracker - Fixes a crash when Check Tracker is docked but not visible * Check Tracker - Fixes areas being spoiled when loading different save files * Check Tracker - Only reset variables if they are initialized * Check Tracker - Cleans up old comments, unused variables, methods, and macros, adds language TODOs, * Check Tracker - Readds rainbow UI elements after Cosmetics Editor refactor * Check Tracker - Removal of flag lookup that was refactored, no longer needed header, and some trivial whitespace fixes. * Check Tracker - Refactors Index to Bitmask code to a macro * Check Tracker - Changes ordering from alphabetical to RandomizerCheck ordering * Check Tracker - Wraps everything in a namespace to avoid global variable usage * Check Tracker - Explicitly defines for-loop scope * Check Tracker - refactors dungeon lookup from static array to function * Fixes a bug when using EnhancementColor with alpha * Check Tracker - Refactors all colour to use direct conversions * Check Tracker - refactors settings loading and check visibility for readability * Check Tracker - Fixes a bug where the wrong label showed on the Check Tracker BG Color * UIWidgets - Adds Alpha bar to EnhancementColor when using alpha parameter
2022-12-10 22:39:23 -05:00
build soh with LUS 1.0.0 (#2881) * Bump LUS * Ship -> LUS namespace change * z_scene_otr Ship -> LUS namespace * Starting to get SoH to build with LUS imgui changes. * start stuff * gamecontroleditor build issues resolved maybe * cosmetics editor and what not * console * actor viewer * more stuff * more stuff * on to errors that make sense * putting this down for a bit * no idea what these errors mean now * some kind of progress maybe * latest lus main * more * back to linker errors and being lost * Fixes command function signature. * More fixes * Even more fixes * Bump LUS * More Fixes. * Fixes even more errors. * lus bump * input editor as var * audio editor working * it builds with this * bump lus * it opens * bump lus to latest main again * make sure to do all the command registering in debugconsole * lus and what not * switch type stuff plz * undo * do the thing that fixes the thing * fix mac? * correctly show/hide menubar on boot * bump lus * input blocking updates * bump lus * Bump LUS * Press F1 to open enhancement menus moved to SoH * lus and rendering backend stuff * audio backend and lus * Bump LUS * Fixes WindowBackend dropdown * Bump LUS * misc -> utils and moves binarytools to utils. * Window refactor * bump lus * make it work * Fixes for moved files again * Bump LUS * Mercury -> Config * Bump LUS * Reacts to removed LUS hooks and bump LUS * Remove Hook: GfxInit * Removes debug audio_setgamevolume to 1 * use non-crashing branch of lus * fix: make audio init work without hooks * game icon stuff * multifix bmp * use input viewer class branch for now * just "Ship" it's cleaner * Bump LUS * Removed ExitGame hook. * Bump LUS * Hook system removed from LUS. * More LUS updates * Changes to make window position saving. * Bump LUS * Bump LUS (for real) * LUS resources now return a specialized pointer. * Bump LUS * Fixes issue in SetPathways::GetPointerSize * Bump LUS to 1.0.0 * builds but crashes * fix crash * better macro names in debug console * remove commeted out line * remove redundant check tracker settings window logic * remove commented out line * move the * * remove extra seqplayers enum def * this sneaky little guy was hiding behind a wii u ifdef * remove extra check tracker header --------- Co-authored-by: Kenix <kenixwhisperwind@gmail.com> Co-authored-by: briaguya <briaguya@alice>
2023-06-03 15:27:45 -04:00
void CheckTrackerWindow::DrawElement() {
2023-01-27 19:16:31 -05:00
ImGui::SetNextWindowSize(ImVec2(400, 540), ImGuiCond_FirstUseEver);
Check Tracker Update (#2668) * Initial commit. What works so far: Data file loads, saves, deletes, and is created properly. - Need to run `HasItemBeenCollected` when creating in case of mid-seed regen. Organized checks into maps set by area. Areas show in tracker. - Checks pulled from checkObjectsByArea are not currently listed. - Areas are being assumed completed and hidden at the start. * Checks now populate. Still not counting area totals properly. * Don't track RC_LINKS_POCKET in the data file, and instead manually add it in every time a save is load. rcObjects doesn't contain Link's Pocket location (duh). * Moved ItemReceive hook to randomizer_check_tracker.cpp. Skipped items are properly sorted and formatted. Saved items contribute to an area's gotten/skipped checks on load. Changed skipped items default main color to gray. General code cleanup. * Skipped checks now contribute to area totals for area completion logic. * Mid-menu rework transfer. * Started check lookup on item receive. Tried to enable scum checking on save. * Fixed scum check on save. * More code cleanup, which revealed some issues with loading and saving. Loading now works 100%, but entries in checkTrackerData are disappearing in code somewhere, causing issues with later checks. Scummed color now displays properly. Collected but unsaved displays properly. Unchecked, Skipped, Seen and Scummed checks all have arrows for skipping/unskipping. Counts a little messed up, probably double adding skips. * Fixed item counts being off across resets. Restarts were fine. * Beginning of rework for individual check updates. Adds `Actor lastCheck` to PlayState to allow assigning of last actor to give an item. This allows precise tracking of GS, freestanding PoH, etc. Works for chests too. Currently does not work for shops, unknown for normal NPC gives. Doesn't track last gives for non-checks, like drops from grass, pots, crates, etc. * Actor-based checks fully fleshed out, but can't help with sale-based checks. Implemented `pendingSaleCheck` to back out of an RC check cycle if `gSaveContext->pendingSale` is not NONE when `OnItemReceive` is called, processed through `OnSaleEnd`. This should be the final change necessary to streamline the checks. * Temporary hook to message box close to tie in trackers for non-gs/chest actors that aren't added to `GetCheckFromActor`. This triggers a 2-frame countdown to check with `HasItemBeenCollected` since half of the methods in there aren't updated until after a text box closes. Added scene tracking to get last scene so that checks in scenes that span several overworld areas could be tied to their areas properly. Modified tracker data creation to apply Link's Pocket and Song from Impa conditionally based on randomizer settings instead of just being assumed to be done. May need modification for checking click and drag spoiler loading. Removed the scene equivalence check from CheckChecks so that an entire area is checked each time to avoid issues with, e.g., leaving a shop before a pending sale finishes. * Changed check data creation to use RSKs from gRandomizer to account for settings loaded from drag and drop spoilers. * Beginning of tracker code organization. Changed check color defaults. * Reverted moving tracker colors to header. Some individual check fixes. * Missed something from previous merge? * Removed last remnant of removed performance mode. * Better handle checking when skullsanity is off. * Song checks sceneIDs don't match the scenes they're actually in for some reason. Removed that check. * SaleEnd checks don't need the GetItemEntry parameter. Also set a flag that should prevent the check tracker from running during vanilla saves should that not be resolved by the time it's merged. * Attempting to have only the relevant checks added to the tracker data, as well as showing vanilla checks for non-rando saves. Not working yet (everything is displayed in vanilla). * Added vanilla check tracker population via `vanillaCheck` bool in `RandomizerCheckObject`. This is also added to `IsVisibleInImGui` to handle file loading and saving to eliminate checks that aren't part of vanilla or the rando seed. Implemented deleted tracker data file recreation. Added some extra item name text checks. Songs are still... tricky, so they stay blank. Utilize local copies of the randomizer check objects that are applicable for performance purposes. Fixed vanilla item-giving cutscene crashes when triggered mid-transition. * Apparently not all toolchains can handle macro instantiation without all parameters, like VS can. * Fixed scummed detail color not showing properly on tracker. * Fixed dungeon area totals and GS checks not functioning properly. * Major revamp of checking code. Doesn't rely on `GetCheckFromActor` at all anymore, but instead simply sets a flag to evaluate a number of checks in an area every frame until the check that was gotten is identified. With the new setup, it's much less hardware intensive, and at 60fps 6 checks per frame shows no noticeable effect on framerate. I can envision needing to add a collectedCount in order to account for times when two checks are gotten one right after the other. Changed area scroll to happen from `OnTransitionEnd`, and allow for scrolling in bazaar (was disabled previously because it would jump back and forth between Kak and Market while you were in one). Also setup area check order updating by area instead of all at the same time. * Fixed shooting gallery not reporting proper area. Prevent checks from actually happening if area is RCAREA_INVALID, now that all areas are reporting something if they have checks. Fixed `GetCheckArea()` not updating checks for standard scenes. Lots of vanilla tracking updates, mainly manual checks for gems, medallions and songs, since the often don't have proper scenes in the data. Prevent vanilla from triggering check loops if junk items are collected. Fixed sorting based on saved vs collected. Prevent item name display for vanilla runs. Change coloring of checks so the check name reflects status in vanilla runs. * Fixed "Recheck Area" button erroneously adding to an area's check totals? * Fix DMC vanilla checks. * Fix check tracker data recreation on data file loss. Removed redundant file exists check from SaveTrackerDataHook, as it doesn't matter if it exists or not at that point. Limited check loops to 3 to avoid infinite check loops on non-check/junk item pickup. Added more checks to disable tracker operations if a save is not running. Changed check ordering to put boss reward and heart container checks at the end of whatever RCSHOW group they belong to. * Fixed IsRunning calculation. Further improving vanilla checking. Starting framework for checking medallions, stones, and songs on data file recreation. Fixed medallion check collection. Added GIFT_FROM_SAGES to check list for vanilla file for tracking light medallion. Added check loop limitation to prevent infinite checking after picking up junk item from the ground. * Finished vanilla file recreation and recheck (songs and dungeon rewards all check properly now). This includes deku shield with KF shop item 3. Finished Gift from Raoru light medallion tracking for vanilla. Commented all CheckByScene functionality for now. * Fixed new save data file creation. Disabled entrance area calculation for now, as it only tracks the previous entrance for some reason. Fixed area detection for ToT checks. * GetCheckArea() now utilizes EntranceData almost exclusively, via either `gSaveContext.entranceIndex` or the entrance tracker's `currentGrottoId` in the case of grottos. This also means that EVERYTHING CAN AUTOSCROLL NOW. Entrance shuffles are now much easier to track. Autoscroll is now also triggered on save, just in case someone isn't autosaving and has a lot of checks that get converted to saved. * Fixed missing GS check in LW. * Added area scroll on toggling Show Hidden Items. May configure differently later. Fixed area detection for entrances in Gerudo Fortress/Valley and Collossus. Haunted wasteland doesn't autoscroll due to a bug in `OnTransitionEnd` hook, but checks still evaluate properly there. Rely on scene-based area detection if scene is a main overworld or dungeon scene. * Fixed grotto detection when shuffle is off. * Small code cleanup. Fixed Colossus hand chest checks. * Missing lus bump from merge conflict resolution * Fixed Colossus Grotto making `GetCheckArea` return Wasteland. * Improved OnItemReceive processing for non-token GS checks, since they can sometimes take long enough for the checking process to time out before the item is registered as received. * First attempt at thread safety for tracker data file writing. Seems to work, but might need more testing. * Fixed Recheck Area not unskipping items that register as saved. Improved delayed saving with autosaving, as the autosave triggered quite often before the tracker data save, making things not properly register as saved. * merge cleanup * Converted check tracker data to the sectional saves, adding `CheckTrackerData` to `SaveContext`. Implemented section ID returning and fullSave boolean passing to section functions from my PR temporarily for it to work properly. Moved `RandomizerCheckTrackerData` enum to `randomizerTypes.h` to accommodate that. Changed `Randomizer_SaveInit` to a `SaveManager::InitFunc` to allow for other randomizer-dependent sections to be initialized after that. Required a little refactoring to maintain intro cutscene skip when starting a randomizer file. * Revert section index return and randomizer init changes. Will need to wait on yet more changes to main. * Fixed check tracker initialization (shouldn't be tied to window initialization), restored saving/loading functionality. * Removed `CheckTracker::Init` and put SaveManager calls in `CheckTrackerWindow::InitElement`. Also a bit of cleanup from transition back to save file use. * Fixed tracker displaying check categories while file not loaded. * Fix Darunia's Joy check not marking in vanilla. * Fix autosave not triggering change from collected to saved in tracker data. * Changed default colors for scummed and collected display. * Merge upgrade code cleanup. * Add `OnTransitionEnd` calls to sandstorm transitions both to and from Wasteland. Also improved `gSaveContext.lastScene` assignment for both transition types. Allowed a bit of cleanup in `GetCheckArea`. * Added `StateButton`, a button like `ArrowButton` but that allows text instead of arrow icons. Apparently the changes from ArrowButton to StateButton happened in a previous commit... * Changed section name to `trackerDataCheck` to force SoH to load it after the randomizer section, as it required some randoSettings to be loaded first, and nothing else I tried to make the randomizer section load before it worked. This hacks a solution to checks not displaying on fast file load to a specific slot. F*** you, SaveManager, and f*** you too, JSON. * Forgot to change the section string for loading with the name change. * Fix check ordering for checks that trigger the autosave. * Adds option to remove right-side shop items (slots 1-4) from the tracker list. Enabled by default. * Fix default state of Hide Shop Right Checks checkbox. * Fixes grotto and great fairy scrolling and checks. Fixes array overflow from `checkTrackerData` which was creating the issue trying to load the base and randomizer sections first, among other things. That also fixed the massive file loads that were being exhibited in debug mode. * Fix shooting galleries being set as collected again when being played a second time after getting the checks. * Fix Bazaar autoscroll. * Add Saria's Song to `GetCheckFromActor` and removed some limitations from the messageCloseCheck function to make that check track properly. * Fix Song from Impa check. Implemented prevention for multiple "collections" of great fairies, just in case getting the health refill would trigger it with the previous setup. * Fix ice traps on GS tokens not triggering OnItemReceive. * Complete fix for ice trap collection from GS. Add autoscroll when clicking "Expand All". * Add `OnShopSlotChange` with cursorSlot and basePrice parameters. * Fixed include in en_ossan for shop slot hook. Added registration for `OnShopSlotChange` in the tracker, storing the price in a new `price` field in `CheckTrackerData`. Added "seen" functionality to shop checks. Displays the model item name upon first entering a shop, adding the price and switching to trickName (if it's an ice trap) upon navigating to the slot in buy mode, triggered by an invisible "identified" status that mirrors "seen" in every other way. Added tooltips to most options for check tracker color picking to describe what each status actually means. * `std::format` pls * So apparently std::format just decided to break with the latest merge from develop, but fmt::format exists and works? * Removed the last vestiges of `locationsSkipped`. Other general code and formatting cleanups. Moved `IsGameRunning` to `OTRGlobals` so the item tracker could also access it. Used preceding to "fix" item and bottle display in the item tracker on startup. * Some more code cleanup. Removed "Recheck Area" button and relevant code. Backported changes to Anchor branch applicable for single-player, including making a checkAreas vector and structuring the frame by frame checks around that. Also includes fix for Silver Gauntlets and Mirror Shield check collection crash associated with those changes. Fixed Kakariko Bazaar "seen" updates. Fixed tracker window not showing on initial load like it should. * Forgot 1 formatting fix. * Removed conditions for showing Song from Impa (isn't junk under certain conditions, so should show all the time). * Fix vanilla checks, add Zelda's Letter and Malon's Egg to manual check collection. Fix autoscroll while in child stealth section. * Fix crash in Happy Mask Shop in OnSlotChange (referenced non-existent shop id in a tracker-specific enum). * General code cleanup. * Missed one reversion. * One more. * Fix column alignment in `randomizer_check_objects`. * Fix file encoding on `randomizer_check_tracker`. Again. * Fix indentation for `actualItemtrackerItemMap`. Also removed unnecessary parts of the map. * Rename `HasEqItem` to `HasEquipment`. * Slightly better indentation for `actualItemTrackerItemMap`. * Add magic bean salesman to vanilla check tracking, and genericized deku shield to trigger KF shop item 3 wherever you get the shield. Renamed `vanillaCheck` to `vanillaHundoCheck` to (supposedly) clarify the meaning of the usage. * One more rename to `vanillaCompletion` to avoid possible confusion with 100% speedrun conditions. * give me a break XD Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * Changes suggested by briaguya (rename `RandomizerCheckShow` to `Status`, unused code, newline formatting) * Remove unused `itemNames` table. * Remove `IsGameRunning` in favor of `GameInteractor::IsSaveLoaded`. * Restore anti-spoiler functionality for dungeons with dungeon maps. * Review cleanup. * Fix prices not showing for Kak bazaar items. --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com>
2023-10-04 11:03:36 -04:00
if (!initialized && (gPlayState == nullptr || gSaveContext.fileNum < 0 || gSaveContext.fileNum > 2)) {
Randomizer Auto Location tracker (#1942) * Initial Auto-Location Tracking * Updates styling for checked items in Check Tracker * Fixes crashing issues with Check Tracker rendering * Auto scroll Check Tracker windows to current area * Checks Tracker only shows checked locations once in game * Fixes issue where Check Tracker would auto-scroll to wrong location when entering a grotto * Fixes gerudo fortress checks showing in tracker when settings have them removed * InfTable Check Location Fixes: Lost Dog Richard, Rolling Gorons, HBA 1000, Thawed Zora * Fixes most Event Chk Inf Checks on Check Tracker, and Frogs * Check Tracker - Song from Malon now works * Check Tracker - Fixes Claim Check check not tracking - Fixes spoiler for Claim Check check when getting Biggoron's Sword - Fixes LACS being spoiled and not tracking * Check Tracker - Fixes #2 for Skull Mask and Mask of Truth checks * Check Tracker - Adds support for merchants - Fixes #7 for Bomchu Salesman - Fixes #12 for Medigoron * Check Tracker - Fixes #8 for Song from Saria * Check Tracker - Fixes #9 for Adult Shooting Gallery * Check Tracker - Fixes #10 for Composer Grave * Check Tracker - Fixes #14 for Song from Ocarina of Time * Check Tracker - Fixes #16 for Shooting the Sun * Check Tracker - Fixes #19 for Darunia's Joy * Save Editor - Adds missing label for Treasure Chest Game * Check Tracker - Fixes Great Faries checks * Check Tracker - Fixes Sheik at Temple * Check Tracker - Fixes Great Fairy auto-scroll to wrong location * Check Tracker - Updates blue warp checks - Fixes Bongo Bongo and Twinrova checks * Check Tracker - Fixes Dampe's Gravedigging Tour * Check Tracker - Fixes Prescription to King Zora * Check Tracker - Fixes Bazaar showing under wrong area on tracker between adult/child * Check Tracker - Fixes scroll for Hyrule Market and Bazaar * Check Tracker - Fixes giving Adult Trade Items shown on tracker: Broken Sword, Saw, Cojiro, Eyeball Froge, and Eyedrops * Cleans up item_location * Check Tracker - Item List - Fixes item list not updating when changing seeds/options - Separates item exclusion list from item check list - Clean up comments * Check Tracker - Adds Skip functionality to buttons * Check Tracker - Refactors adult trade items to RandomizerInf * Check Tracker - Fixes an issue where any time an item is removed the tracker would cause an application crash * Check Tracker - Item names are now dependent on file language * Check Tracker - Fixes Gerudo Card check not showing in Fast setting * Reorders headers to (hopefully) avoid CI build conflicts on linux/consoles * Explicitly defines vector header in randomizer.h to fix compile errors * Complete Refactor of Check Tracker ImGui * Adds missing check tracker files to CMakeLists * Reverts the Item_location whitespace cleanup from ad10807c * Check Tracker - Loading Fixes - Fixes a bug where loading a save file a second time would add all the checks again - Fixes a bug where the check tracker would not render at all until in a save file * Check Tracker - Fixes a bug where checks would sometimes fail to load * Check Tracker - Fixes duplicated checks when using Only on Pause or Only on Combo * Check Tracker - Works around issue where single characters don't show in EnhancementCombobox, and fixes a label for combo buttons held option * Check Tracker - Applies all Check Tracker changes to Item Location * Check Tracker - Updated Check List - Adds Link's pocket, either in KF or HM depending on starting age - Supports Scrubs and Merchants - Uses enums instead of magic numbers - Updates DC Scrub Short Names for MQ * Check Tracker - Adds a performance mode option * Check Tracker - List Fixes (requires new rando generation) - Fixes Frogs Rupees always visible - Fixes Kokiri Sword Chest not showing - Fixes Weird Egg not showing * Check Tracker - MQ List basic support * Check Tracker - MQ/Vanilla anti-spoilers * Check Tracker - Collecting a compass now spoils the area * Check Tracker - Basic Vanilla Support and fixes - Vanilla items show in check tracker, even if many won't auto check - Fixes an issue with Gerudo Fortress Keys - Refactors IsVisibleInCheckTracker to randomizer_check_tracjer * Check Tracker - Fixes merge conflict from 08a487f35e1d760ab9e69b932edbe4da6bcd9edb * Check Tracker - Fixes tracker loading as Floating when default value is set to Windowed * Randomizer Location Exclusion List - Adds Scrubs, Merchants, Shops. Adult Trade items, MQ Dungeons, and Bean Salesman - Fixes Kokiri Sword Chest, Weird Egg, and Frog Song Rupees from misbehaving - Updates Gerudo Fortress logic to be dependent on Open/Fast/Normal Fortress - Removes Invalid Check - Adds RO Enum for MQ settings - Updates magic values to RO enum * Location Exclusion List - Scrubs that are always randomized now always show on the list * For now, removes some extra code only needed for a Check Tracker. * Randomizer Location Exclusion List - Fixes Eyeball Frog from showing up when Adult Trade Items was off * Location Tracker - Updates Eyedrops to use RandomizerInf instead of Chest * Check Tracker - Fixes a bug where Link's Pocket item wasn't acting as checked for area item count * Check Tracker - Fixes a bug where Locations would incorrectly say Vanilla due to the first check in the area being a non-MQ check * Check Tracker - Fixes a crash when Check Tracker is docked but not visible * Check Tracker - Fixes areas being spoiled when loading different save files * Check Tracker - Only reset variables if they are initialized * Check Tracker - Cleans up old comments, unused variables, methods, and macros, adds language TODOs, * Check Tracker - Readds rainbow UI elements after Cosmetics Editor refactor * Check Tracker - Removal of flag lookup that was refactored, no longer needed header, and some trivial whitespace fixes. * Check Tracker - Refactors Index to Bitmask code to a macro * Check Tracker - Changes ordering from alphabetical to RandomizerCheck ordering * Check Tracker - Wraps everything in a namespace to avoid global variable usage * Check Tracker - Explicitly defines for-loop scope * Check Tracker - refactors dungeon lookup from static array to function * Fixes a bug when using EnhancementColor with alpha * Check Tracker - Refactors all colour to use direct conversions * Check Tracker - refactors settings loading and check visibility for readability * Check Tracker - Fixes a bug where the wrong label showed on the Check Tracker BG Color * UIWidgets - Adds Alpha bar to EnhancementColor when using alpha parameter
2022-12-10 22:39:23 -05:00
return;
}
if (CVarGetInteger("gCheckTrackerWindowType", TRACKER_WINDOW_WINDOW) == TRACKER_WINDOW_FLOATING) {
if (CVarGetInteger("gCheckTrackerShowOnlyPaused", 0) && (gPlayState == nullptr || gPlayState->pauseCtx.state == 0)) {
return;
}
Randomizer Auto Location tracker (#1942) * Initial Auto-Location Tracking * Updates styling for checked items in Check Tracker * Fixes crashing issues with Check Tracker rendering * Auto scroll Check Tracker windows to current area * Checks Tracker only shows checked locations once in game * Fixes issue where Check Tracker would auto-scroll to wrong location when entering a grotto * Fixes gerudo fortress checks showing in tracker when settings have them removed * InfTable Check Location Fixes: Lost Dog Richard, Rolling Gorons, HBA 1000, Thawed Zora * Fixes most Event Chk Inf Checks on Check Tracker, and Frogs * Check Tracker - Song from Malon now works * Check Tracker - Fixes Claim Check check not tracking - Fixes spoiler for Claim Check check when getting Biggoron's Sword - Fixes LACS being spoiled and not tracking * Check Tracker - Fixes #2 for Skull Mask and Mask of Truth checks * Check Tracker - Adds support for merchants - Fixes #7 for Bomchu Salesman - Fixes #12 for Medigoron * Check Tracker - Fixes #8 for Song from Saria * Check Tracker - Fixes #9 for Adult Shooting Gallery * Check Tracker - Fixes #10 for Composer Grave * Check Tracker - Fixes #14 for Song from Ocarina of Time * Check Tracker - Fixes #16 for Shooting the Sun * Check Tracker - Fixes #19 for Darunia's Joy * Save Editor - Adds missing label for Treasure Chest Game * Check Tracker - Fixes Great Faries checks * Check Tracker - Fixes Sheik at Temple * Check Tracker - Fixes Great Fairy auto-scroll to wrong location * Check Tracker - Updates blue warp checks - Fixes Bongo Bongo and Twinrova checks * Check Tracker - Fixes Dampe's Gravedigging Tour * Check Tracker - Fixes Prescription to King Zora * Check Tracker - Fixes Bazaar showing under wrong area on tracker between adult/child * Check Tracker - Fixes scroll for Hyrule Market and Bazaar * Check Tracker - Fixes giving Adult Trade Items shown on tracker: Broken Sword, Saw, Cojiro, Eyeball Froge, and Eyedrops * Cleans up item_location * Check Tracker - Item List - Fixes item list not updating when changing seeds/options - Separates item exclusion list from item check list - Clean up comments * Check Tracker - Adds Skip functionality to buttons * Check Tracker - Refactors adult trade items to RandomizerInf * Check Tracker - Fixes an issue where any time an item is removed the tracker would cause an application crash * Check Tracker - Item names are now dependent on file language * Check Tracker - Fixes Gerudo Card check not showing in Fast setting * Reorders headers to (hopefully) avoid CI build conflicts on linux/consoles * Explicitly defines vector header in randomizer.h to fix compile errors * Complete Refactor of Check Tracker ImGui * Adds missing check tracker files to CMakeLists * Reverts the Item_location whitespace cleanup from ad10807c * Check Tracker - Loading Fixes - Fixes a bug where loading a save file a second time would add all the checks again - Fixes a bug where the check tracker would not render at all until in a save file * Check Tracker - Fixes a bug where checks would sometimes fail to load * Check Tracker - Fixes duplicated checks when using Only on Pause or Only on Combo * Check Tracker - Works around issue where single characters don't show in EnhancementCombobox, and fixes a label for combo buttons held option * Check Tracker - Applies all Check Tracker changes to Item Location * Check Tracker - Updated Check List - Adds Link's pocket, either in KF or HM depending on starting age - Supports Scrubs and Merchants - Uses enums instead of magic numbers - Updates DC Scrub Short Names for MQ * Check Tracker - Adds a performance mode option * Check Tracker - List Fixes (requires new rando generation) - Fixes Frogs Rupees always visible - Fixes Kokiri Sword Chest not showing - Fixes Weird Egg not showing * Check Tracker - MQ List basic support * Check Tracker - MQ/Vanilla anti-spoilers * Check Tracker - Collecting a compass now spoils the area * Check Tracker - Basic Vanilla Support and fixes - Vanilla items show in check tracker, even if many won't auto check - Fixes an issue with Gerudo Fortress Keys - Refactors IsVisibleInCheckTracker to randomizer_check_tracjer * Check Tracker - Fixes merge conflict from 08a487f35e1d760ab9e69b932edbe4da6bcd9edb * Check Tracker - Fixes tracker loading as Floating when default value is set to Windowed * Randomizer Location Exclusion List - Adds Scrubs, Merchants, Shops. Adult Trade items, MQ Dungeons, and Bean Salesman - Fixes Kokiri Sword Chest, Weird Egg, and Frog Song Rupees from misbehaving - Updates Gerudo Fortress logic to be dependent on Open/Fast/Normal Fortress - Removes Invalid Check - Adds RO Enum for MQ settings - Updates magic values to RO enum * Location Exclusion List - Scrubs that are always randomized now always show on the list * For now, removes some extra code only needed for a Check Tracker. * Randomizer Location Exclusion List - Fixes Eyeball Frog from showing up when Adult Trade Items was off * Location Tracker - Updates Eyedrops to use RandomizerInf instead of Chest * Check Tracker - Fixes a bug where Link's Pocket item wasn't acting as checked for area item count * Check Tracker - Fixes a bug where Locations would incorrectly say Vanilla due to the first check in the area being a non-MQ check * Check Tracker - Fixes a crash when Check Tracker is docked but not visible * Check Tracker - Fixes areas being spoiled when loading different save files * Check Tracker - Only reset variables if they are initialized * Check Tracker - Cleans up old comments, unused variables, methods, and macros, adds language TODOs, * Check Tracker - Readds rainbow UI elements after Cosmetics Editor refactor * Check Tracker - Removal of flag lookup that was refactored, no longer needed header, and some trivial whitespace fixes. * Check Tracker - Refactors Index to Bitmask code to a macro * Check Tracker - Changes ordering from alphabetical to RandomizerCheck ordering * Check Tracker - Wraps everything in a namespace to avoid global variable usage * Check Tracker - Explicitly defines for-loop scope * Check Tracker - refactors dungeon lookup from static array to function * Fixes a bug when using EnhancementColor with alpha * Check Tracker - Refactors all colour to use direct conversions * Check Tracker - refactors settings loading and check visibility for readability * Check Tracker - Fixes a bug where the wrong label showed on the Check Tracker BG Color * UIWidgets - Adds Alpha bar to EnhancementColor when using alpha parameter
2022-12-10 22:39:23 -05:00
if (CVarGetInteger("gCheckTrackerDisplayType", TRACKER_DISPLAY_ALWAYS) == TRACKER_DISPLAY_COMBO_BUTTON) {
int comboButton1Mask = buttons[CVarGetInteger("gCheckTrackerComboButton1", TRACKER_COMBO_BUTTON_L)];
int comboButton2Mask = buttons[CVarGetInteger("gCheckTrackerComboButton2", TRACKER_COMBO_BUTTON_R)];
build soh with LUS 1.0.0 (#2881) * Bump LUS * Ship -> LUS namespace change * z_scene_otr Ship -> LUS namespace * Starting to get SoH to build with LUS imgui changes. * start stuff * gamecontroleditor build issues resolved maybe * cosmetics editor and what not * console * actor viewer * more stuff * more stuff * on to errors that make sense * putting this down for a bit * no idea what these errors mean now * some kind of progress maybe * latest lus main * more * back to linker errors and being lost * Fixes command function signature. * More fixes * Even more fixes * Bump LUS * More Fixes. * Fixes even more errors. * lus bump * input editor as var * audio editor working * it builds with this * bump lus * it opens * bump lus to latest main again * make sure to do all the command registering in debugconsole * lus and what not * switch type stuff plz * undo * do the thing that fixes the thing * fix mac? * correctly show/hide menubar on boot * bump lus * input blocking updates * bump lus * Bump LUS * Press F1 to open enhancement menus moved to SoH * lus and rendering backend stuff * audio backend and lus * Bump LUS * Fixes WindowBackend dropdown * Bump LUS * misc -> utils and moves binarytools to utils. * Window refactor * bump lus * make it work * Fixes for moved files again * Bump LUS * Mercury -> Config * Bump LUS * Reacts to removed LUS hooks and bump LUS * Remove Hook: GfxInit * Removes debug audio_setgamevolume to 1 * use non-crashing branch of lus * fix: make audio init work without hooks * game icon stuff * multifix bmp * use input viewer class branch for now * just "Ship" it's cleaner * Bump LUS * Removed ExitGame hook. * Bump LUS * Hook system removed from LUS. * More LUS updates * Changes to make window position saving. * Bump LUS * Bump LUS (for real) * LUS resources now return a specialized pointer. * Bump LUS * Fixes issue in SetPathways::GetPointerSize * Bump LUS to 1.0.0 * builds but crashes * fix crash * better macro names in debug console * remove commeted out line * remove redundant check tracker settings window logic * remove commented out line * move the * * remove extra seqplayers enum def * this sneaky little guy was hiding behind a wii u ifdef * remove extra check tracker header --------- Co-authored-by: Kenix <kenixwhisperwind@gmail.com> Co-authored-by: briaguya <briaguya@alice>
2023-06-03 15:27:45 -04:00
OSContPad* trackerButtonsPressed = LUS::Context::GetInstance()->GetControlDeck()->GetPads();
Randomizer Auto Location tracker (#1942) * Initial Auto-Location Tracking * Updates styling for checked items in Check Tracker * Fixes crashing issues with Check Tracker rendering * Auto scroll Check Tracker windows to current area * Checks Tracker only shows checked locations once in game * Fixes issue where Check Tracker would auto-scroll to wrong location when entering a grotto * Fixes gerudo fortress checks showing in tracker when settings have them removed * InfTable Check Location Fixes: Lost Dog Richard, Rolling Gorons, HBA 1000, Thawed Zora * Fixes most Event Chk Inf Checks on Check Tracker, and Frogs * Check Tracker - Song from Malon now works * Check Tracker - Fixes Claim Check check not tracking - Fixes spoiler for Claim Check check when getting Biggoron's Sword - Fixes LACS being spoiled and not tracking * Check Tracker - Fixes #2 for Skull Mask and Mask of Truth checks * Check Tracker - Adds support for merchants - Fixes #7 for Bomchu Salesman - Fixes #12 for Medigoron * Check Tracker - Fixes #8 for Song from Saria * Check Tracker - Fixes #9 for Adult Shooting Gallery * Check Tracker - Fixes #10 for Composer Grave * Check Tracker - Fixes #14 for Song from Ocarina of Time * Check Tracker - Fixes #16 for Shooting the Sun * Check Tracker - Fixes #19 for Darunia's Joy * Save Editor - Adds missing label for Treasure Chest Game * Check Tracker - Fixes Great Faries checks * Check Tracker - Fixes Sheik at Temple * Check Tracker - Fixes Great Fairy auto-scroll to wrong location * Check Tracker - Updates blue warp checks - Fixes Bongo Bongo and Twinrova checks * Check Tracker - Fixes Dampe's Gravedigging Tour * Check Tracker - Fixes Prescription to King Zora * Check Tracker - Fixes Bazaar showing under wrong area on tracker between adult/child * Check Tracker - Fixes scroll for Hyrule Market and Bazaar * Check Tracker - Fixes giving Adult Trade Items shown on tracker: Broken Sword, Saw, Cojiro, Eyeball Froge, and Eyedrops * Cleans up item_location * Check Tracker - Item List - Fixes item list not updating when changing seeds/options - Separates item exclusion list from item check list - Clean up comments * Check Tracker - Adds Skip functionality to buttons * Check Tracker - Refactors adult trade items to RandomizerInf * Check Tracker - Fixes an issue where any time an item is removed the tracker would cause an application crash * Check Tracker - Item names are now dependent on file language * Check Tracker - Fixes Gerudo Card check not showing in Fast setting * Reorders headers to (hopefully) avoid CI build conflicts on linux/consoles * Explicitly defines vector header in randomizer.h to fix compile errors * Complete Refactor of Check Tracker ImGui * Adds missing check tracker files to CMakeLists * Reverts the Item_location whitespace cleanup from ad10807c * Check Tracker - Loading Fixes - Fixes a bug where loading a save file a second time would add all the checks again - Fixes a bug where the check tracker would not render at all until in a save file * Check Tracker - Fixes a bug where checks would sometimes fail to load * Check Tracker - Fixes duplicated checks when using Only on Pause or Only on Combo * Check Tracker - Works around issue where single characters don't show in EnhancementCombobox, and fixes a label for combo buttons held option * Check Tracker - Applies all Check Tracker changes to Item Location * Check Tracker - Updated Check List - Adds Link's pocket, either in KF or HM depending on starting age - Supports Scrubs and Merchants - Uses enums instead of magic numbers - Updates DC Scrub Short Names for MQ * Check Tracker - Adds a performance mode option * Check Tracker - List Fixes (requires new rando generation) - Fixes Frogs Rupees always visible - Fixes Kokiri Sword Chest not showing - Fixes Weird Egg not showing * Check Tracker - MQ List basic support * Check Tracker - MQ/Vanilla anti-spoilers * Check Tracker - Collecting a compass now spoils the area * Check Tracker - Basic Vanilla Support and fixes - Vanilla items show in check tracker, even if many won't auto check - Fixes an issue with Gerudo Fortress Keys - Refactors IsVisibleInCheckTracker to randomizer_check_tracjer * Check Tracker - Fixes merge conflict from 08a487f35e1d760ab9e69b932edbe4da6bcd9edb * Check Tracker - Fixes tracker loading as Floating when default value is set to Windowed * Randomizer Location Exclusion List - Adds Scrubs, Merchants, Shops. Adult Trade items, MQ Dungeons, and Bean Salesman - Fixes Kokiri Sword Chest, Weird Egg, and Frog Song Rupees from misbehaving - Updates Gerudo Fortress logic to be dependent on Open/Fast/Normal Fortress - Removes Invalid Check - Adds RO Enum for MQ settings - Updates magic values to RO enum * Location Exclusion List - Scrubs that are always randomized now always show on the list * For now, removes some extra code only needed for a Check Tracker. * Randomizer Location Exclusion List - Fixes Eyeball Frog from showing up when Adult Trade Items was off * Location Tracker - Updates Eyedrops to use RandomizerInf instead of Chest * Check Tracker - Fixes a bug where Link's Pocket item wasn't acting as checked for area item count * Check Tracker - Fixes a bug where Locations would incorrectly say Vanilla due to the first check in the area being a non-MQ check * Check Tracker - Fixes a crash when Check Tracker is docked but not visible * Check Tracker - Fixes areas being spoiled when loading different save files * Check Tracker - Only reset variables if they are initialized * Check Tracker - Cleans up old comments, unused variables, methods, and macros, adds language TODOs, * Check Tracker - Readds rainbow UI elements after Cosmetics Editor refactor * Check Tracker - Removal of flag lookup that was refactored, no longer needed header, and some trivial whitespace fixes. * Check Tracker - Refactors Index to Bitmask code to a macro * Check Tracker - Changes ordering from alphabetical to RandomizerCheck ordering * Check Tracker - Wraps everything in a namespace to avoid global variable usage * Check Tracker - Explicitly defines for-loop scope * Check Tracker - refactors dungeon lookup from static array to function * Fixes a bug when using EnhancementColor with alpha * Check Tracker - Refactors all colour to use direct conversions * Check Tracker - refactors settings loading and check visibility for readability * Check Tracker - Fixes a bug where the wrong label showed on the Check Tracker BG Color * UIWidgets - Adds Alpha bar to EnhancementColor when using alpha parameter
2022-12-10 22:39:23 -05:00
bool comboButtonsHeld = trackerButtonsPressed != nullptr &&
trackerButtonsPressed[0].button & comboButton1Mask &&
trackerButtonsPressed[0].button & comboButton2Mask;
if (!comboButtonsHeld) {
Randomizer Auto Location tracker (#1942) * Initial Auto-Location Tracking * Updates styling for checked items in Check Tracker * Fixes crashing issues with Check Tracker rendering * Auto scroll Check Tracker windows to current area * Checks Tracker only shows checked locations once in game * Fixes issue where Check Tracker would auto-scroll to wrong location when entering a grotto * Fixes gerudo fortress checks showing in tracker when settings have them removed * InfTable Check Location Fixes: Lost Dog Richard, Rolling Gorons, HBA 1000, Thawed Zora * Fixes most Event Chk Inf Checks on Check Tracker, and Frogs * Check Tracker - Song from Malon now works * Check Tracker - Fixes Claim Check check not tracking - Fixes spoiler for Claim Check check when getting Biggoron's Sword - Fixes LACS being spoiled and not tracking * Check Tracker - Fixes #2 for Skull Mask and Mask of Truth checks * Check Tracker - Adds support for merchants - Fixes #7 for Bomchu Salesman - Fixes #12 for Medigoron * Check Tracker - Fixes #8 for Song from Saria * Check Tracker - Fixes #9 for Adult Shooting Gallery * Check Tracker - Fixes #10 for Composer Grave * Check Tracker - Fixes #14 for Song from Ocarina of Time * Check Tracker - Fixes #16 for Shooting the Sun * Check Tracker - Fixes #19 for Darunia's Joy * Save Editor - Adds missing label for Treasure Chest Game * Check Tracker - Fixes Great Faries checks * Check Tracker - Fixes Sheik at Temple * Check Tracker - Fixes Great Fairy auto-scroll to wrong location * Check Tracker - Updates blue warp checks - Fixes Bongo Bongo and Twinrova checks * Check Tracker - Fixes Dampe's Gravedigging Tour * Check Tracker - Fixes Prescription to King Zora * Check Tracker - Fixes Bazaar showing under wrong area on tracker between adult/child * Check Tracker - Fixes scroll for Hyrule Market and Bazaar * Check Tracker - Fixes giving Adult Trade Items shown on tracker: Broken Sword, Saw, Cojiro, Eyeball Froge, and Eyedrops * Cleans up item_location * Check Tracker - Item List - Fixes item list not updating when changing seeds/options - Separates item exclusion list from item check list - Clean up comments * Check Tracker - Adds Skip functionality to buttons * Check Tracker - Refactors adult trade items to RandomizerInf * Check Tracker - Fixes an issue where any time an item is removed the tracker would cause an application crash * Check Tracker - Item names are now dependent on file language * Check Tracker - Fixes Gerudo Card check not showing in Fast setting * Reorders headers to (hopefully) avoid CI build conflicts on linux/consoles * Explicitly defines vector header in randomizer.h to fix compile errors * Complete Refactor of Check Tracker ImGui * Adds missing check tracker files to CMakeLists * Reverts the Item_location whitespace cleanup from ad10807c * Check Tracker - Loading Fixes - Fixes a bug where loading a save file a second time would add all the checks again - Fixes a bug where the check tracker would not render at all until in a save file * Check Tracker - Fixes a bug where checks would sometimes fail to load * Check Tracker - Fixes duplicated checks when using Only on Pause or Only on Combo * Check Tracker - Works around issue where single characters don't show in EnhancementCombobox, and fixes a label for combo buttons held option * Check Tracker - Applies all Check Tracker changes to Item Location * Check Tracker - Updated Check List - Adds Link's pocket, either in KF or HM depending on starting age - Supports Scrubs and Merchants - Uses enums instead of magic numbers - Updates DC Scrub Short Names for MQ * Check Tracker - Adds a performance mode option * Check Tracker - List Fixes (requires new rando generation) - Fixes Frogs Rupees always visible - Fixes Kokiri Sword Chest not showing - Fixes Weird Egg not showing * Check Tracker - MQ List basic support * Check Tracker - MQ/Vanilla anti-spoilers * Check Tracker - Collecting a compass now spoils the area * Check Tracker - Basic Vanilla Support and fixes - Vanilla items show in check tracker, even if many won't auto check - Fixes an issue with Gerudo Fortress Keys - Refactors IsVisibleInCheckTracker to randomizer_check_tracjer * Check Tracker - Fixes merge conflict from 08a487f35e1d760ab9e69b932edbe4da6bcd9edb * Check Tracker - Fixes tracker loading as Floating when default value is set to Windowed * Randomizer Location Exclusion List - Adds Scrubs, Merchants, Shops. Adult Trade items, MQ Dungeons, and Bean Salesman - Fixes Kokiri Sword Chest, Weird Egg, and Frog Song Rupees from misbehaving - Updates Gerudo Fortress logic to be dependent on Open/Fast/Normal Fortress - Removes Invalid Check - Adds RO Enum for MQ settings - Updates magic values to RO enum * Location Exclusion List - Scrubs that are always randomized now always show on the list * For now, removes some extra code only needed for a Check Tracker. * Randomizer Location Exclusion List - Fixes Eyeball Frog from showing up when Adult Trade Items was off * Location Tracker - Updates Eyedrops to use RandomizerInf instead of Chest * Check Tracker - Fixes a bug where Link's Pocket item wasn't acting as checked for area item count * Check Tracker - Fixes a bug where Locations would incorrectly say Vanilla due to the first check in the area being a non-MQ check * Check Tracker - Fixes a crash when Check Tracker is docked but not visible * Check Tracker - Fixes areas being spoiled when loading different save files * Check Tracker - Only reset variables if they are initialized * Check Tracker - Cleans up old comments, unused variables, methods, and macros, adds language TODOs, * Check Tracker - Readds rainbow UI elements after Cosmetics Editor refactor * Check Tracker - Removal of flag lookup that was refactored, no longer needed header, and some trivial whitespace fixes. * Check Tracker - Refactors Index to Bitmask code to a macro * Check Tracker - Changes ordering from alphabetical to RandomizerCheck ordering * Check Tracker - Wraps everything in a namespace to avoid global variable usage * Check Tracker - Explicitly defines for-loop scope * Check Tracker - refactors dungeon lookup from static array to function * Fixes a bug when using EnhancementColor with alpha * Check Tracker - Refactors all colour to use direct conversions * Check Tracker - refactors settings loading and check visibility for readability * Check Tracker - Fixes a bug where the wrong label showed on the Check Tracker BG Color * UIWidgets - Adds Alpha bar to EnhancementColor when using alpha parameter
2022-12-10 22:39:23 -05:00
return;
}
Randomizer Auto Location tracker (#1942) * Initial Auto-Location Tracking * Updates styling for checked items in Check Tracker * Fixes crashing issues with Check Tracker rendering * Auto scroll Check Tracker windows to current area * Checks Tracker only shows checked locations once in game * Fixes issue where Check Tracker would auto-scroll to wrong location when entering a grotto * Fixes gerudo fortress checks showing in tracker when settings have them removed * InfTable Check Location Fixes: Lost Dog Richard, Rolling Gorons, HBA 1000, Thawed Zora * Fixes most Event Chk Inf Checks on Check Tracker, and Frogs * Check Tracker - Song from Malon now works * Check Tracker - Fixes Claim Check check not tracking - Fixes spoiler for Claim Check check when getting Biggoron's Sword - Fixes LACS being spoiled and not tracking * Check Tracker - Fixes #2 for Skull Mask and Mask of Truth checks * Check Tracker - Adds support for merchants - Fixes #7 for Bomchu Salesman - Fixes #12 for Medigoron * Check Tracker - Fixes #8 for Song from Saria * Check Tracker - Fixes #9 for Adult Shooting Gallery * Check Tracker - Fixes #10 for Composer Grave * Check Tracker - Fixes #14 for Song from Ocarina of Time * Check Tracker - Fixes #16 for Shooting the Sun * Check Tracker - Fixes #19 for Darunia's Joy * Save Editor - Adds missing label for Treasure Chest Game * Check Tracker - Fixes Great Faries checks * Check Tracker - Fixes Sheik at Temple * Check Tracker - Fixes Great Fairy auto-scroll to wrong location * Check Tracker - Updates blue warp checks - Fixes Bongo Bongo and Twinrova checks * Check Tracker - Fixes Dampe's Gravedigging Tour * Check Tracker - Fixes Prescription to King Zora * Check Tracker - Fixes Bazaar showing under wrong area on tracker between adult/child * Check Tracker - Fixes scroll for Hyrule Market and Bazaar * Check Tracker - Fixes giving Adult Trade Items shown on tracker: Broken Sword, Saw, Cojiro, Eyeball Froge, and Eyedrops * Cleans up item_location * Check Tracker - Item List - Fixes item list not updating when changing seeds/options - Separates item exclusion list from item check list - Clean up comments * Check Tracker - Adds Skip functionality to buttons * Check Tracker - Refactors adult trade items to RandomizerInf * Check Tracker - Fixes an issue where any time an item is removed the tracker would cause an application crash * Check Tracker - Item names are now dependent on file language * Check Tracker - Fixes Gerudo Card check not showing in Fast setting * Reorders headers to (hopefully) avoid CI build conflicts on linux/consoles * Explicitly defines vector header in randomizer.h to fix compile errors * Complete Refactor of Check Tracker ImGui * Adds missing check tracker files to CMakeLists * Reverts the Item_location whitespace cleanup from ad10807c * Check Tracker - Loading Fixes - Fixes a bug where loading a save file a second time would add all the checks again - Fixes a bug where the check tracker would not render at all until in a save file * Check Tracker - Fixes a bug where checks would sometimes fail to load * Check Tracker - Fixes duplicated checks when using Only on Pause or Only on Combo * Check Tracker - Works around issue where single characters don't show in EnhancementCombobox, and fixes a label for combo buttons held option * Check Tracker - Applies all Check Tracker changes to Item Location * Check Tracker - Updated Check List - Adds Link's pocket, either in KF or HM depending on starting age - Supports Scrubs and Merchants - Uses enums instead of magic numbers - Updates DC Scrub Short Names for MQ * Check Tracker - Adds a performance mode option * Check Tracker - List Fixes (requires new rando generation) - Fixes Frogs Rupees always visible - Fixes Kokiri Sword Chest not showing - Fixes Weird Egg not showing * Check Tracker - MQ List basic support * Check Tracker - MQ/Vanilla anti-spoilers * Check Tracker - Collecting a compass now spoils the area * Check Tracker - Basic Vanilla Support and fixes - Vanilla items show in check tracker, even if many won't auto check - Fixes an issue with Gerudo Fortress Keys - Refactors IsVisibleInCheckTracker to randomizer_check_tracjer * Check Tracker - Fixes merge conflict from 08a487f35e1d760ab9e69b932edbe4da6bcd9edb * Check Tracker - Fixes tracker loading as Floating when default value is set to Windowed * Randomizer Location Exclusion List - Adds Scrubs, Merchants, Shops. Adult Trade items, MQ Dungeons, and Bean Salesman - Fixes Kokiri Sword Chest, Weird Egg, and Frog Song Rupees from misbehaving - Updates Gerudo Fortress logic to be dependent on Open/Fast/Normal Fortress - Removes Invalid Check - Adds RO Enum for MQ settings - Updates magic values to RO enum * Location Exclusion List - Scrubs that are always randomized now always show on the list * For now, removes some extra code only needed for a Check Tracker. * Randomizer Location Exclusion List - Fixes Eyeball Frog from showing up when Adult Trade Items was off * Location Tracker - Updates Eyedrops to use RandomizerInf instead of Chest * Check Tracker - Fixes a bug where Link's Pocket item wasn't acting as checked for area item count * Check Tracker - Fixes a bug where Locations would incorrectly say Vanilla due to the first check in the area being a non-MQ check * Check Tracker - Fixes a crash when Check Tracker is docked but not visible * Check Tracker - Fixes areas being spoiled when loading different save files * Check Tracker - Only reset variables if they are initialized * Check Tracker - Cleans up old comments, unused variables, methods, and macros, adds language TODOs, * Check Tracker - Readds rainbow UI elements after Cosmetics Editor refactor * Check Tracker - Removal of flag lookup that was refactored, no longer needed header, and some trivial whitespace fixes. * Check Tracker - Refactors Index to Bitmask code to a macro * Check Tracker - Changes ordering from alphabetical to RandomizerCheck ordering * Check Tracker - Wraps everything in a namespace to avoid global variable usage * Check Tracker - Explicitly defines for-loop scope * Check Tracker - refactors dungeon lookup from static array to function * Fixes a bug when using EnhancementColor with alpha * Check Tracker - Refactors all colour to use direct conversions * Check Tracker - refactors settings loading and check visibility for readability * Check Tracker - Fixes a bug where the wrong label showed on the Check Tracker BG Color * UIWidgets - Adds Alpha bar to EnhancementColor when using alpha parameter
2022-12-10 22:39:23 -05:00
}
}
build soh with LUS 1.0.0 (#2881) * Bump LUS * Ship -> LUS namespace change * z_scene_otr Ship -> LUS namespace * Starting to get SoH to build with LUS imgui changes. * start stuff * gamecontroleditor build issues resolved maybe * cosmetics editor and what not * console * actor viewer * more stuff * more stuff * on to errors that make sense * putting this down for a bit * no idea what these errors mean now * some kind of progress maybe * latest lus main * more * back to linker errors and being lost * Fixes command function signature. * More fixes * Even more fixes * Bump LUS * More Fixes. * Fixes even more errors. * lus bump * input editor as var * audio editor working * it builds with this * bump lus * it opens * bump lus to latest main again * make sure to do all the command registering in debugconsole * lus and what not * switch type stuff plz * undo * do the thing that fixes the thing * fix mac? * correctly show/hide menubar on boot * bump lus * input blocking updates * bump lus * Bump LUS * Press F1 to open enhancement menus moved to SoH * lus and rendering backend stuff * audio backend and lus * Bump LUS * Fixes WindowBackend dropdown * Bump LUS * misc -> utils and moves binarytools to utils. * Window refactor * bump lus * make it work * Fixes for moved files again * Bump LUS * Mercury -> Config * Bump LUS * Reacts to removed LUS hooks and bump LUS * Remove Hook: GfxInit * Removes debug audio_setgamevolume to 1 * use non-crashing branch of lus * fix: make audio init work without hooks * game icon stuff * multifix bmp * use input viewer class branch for now * just "Ship" it's cleaner * Bump LUS * Removed ExitGame hook. * Bump LUS * Hook system removed from LUS. * More LUS updates * Changes to make window position saving. * Bump LUS * Bump LUS (for real) * LUS resources now return a specialized pointer. * Bump LUS * Fixes issue in SetPathways::GetPointerSize * Bump LUS to 1.0.0 * builds but crashes * fix crash * better macro names in debug console * remove commeted out line * remove redundant check tracker settings window logic * remove commented out line * move the * * remove extra seqplayers enum def * this sneaky little guy was hiding behind a wii u ifdef * remove extra check tracker header --------- Co-authored-by: Kenix <kenixwhisperwind@gmail.com> Co-authored-by: briaguya <briaguya@alice>
2023-06-03 15:27:45 -04:00
BeginFloatWindows("Check Tracker", mIsVisible, ImGuiWindowFlags_NoScrollbar);
Randomizer Auto Location tracker (#1942) * Initial Auto-Location Tracking * Updates styling for checked items in Check Tracker * Fixes crashing issues with Check Tracker rendering * Auto scroll Check Tracker windows to current area * Checks Tracker only shows checked locations once in game * Fixes issue where Check Tracker would auto-scroll to wrong location when entering a grotto * Fixes gerudo fortress checks showing in tracker when settings have them removed * InfTable Check Location Fixes: Lost Dog Richard, Rolling Gorons, HBA 1000, Thawed Zora * Fixes most Event Chk Inf Checks on Check Tracker, and Frogs * Check Tracker - Song from Malon now works * Check Tracker - Fixes Claim Check check not tracking - Fixes spoiler for Claim Check check when getting Biggoron's Sword - Fixes LACS being spoiled and not tracking * Check Tracker - Fixes #2 for Skull Mask and Mask of Truth checks * Check Tracker - Adds support for merchants - Fixes #7 for Bomchu Salesman - Fixes #12 for Medigoron * Check Tracker - Fixes #8 for Song from Saria * Check Tracker - Fixes #9 for Adult Shooting Gallery * Check Tracker - Fixes #10 for Composer Grave * Check Tracker - Fixes #14 for Song from Ocarina of Time * Check Tracker - Fixes #16 for Shooting the Sun * Check Tracker - Fixes #19 for Darunia's Joy * Save Editor - Adds missing label for Treasure Chest Game * Check Tracker - Fixes Great Faries checks * Check Tracker - Fixes Sheik at Temple * Check Tracker - Fixes Great Fairy auto-scroll to wrong location * Check Tracker - Updates blue warp checks - Fixes Bongo Bongo and Twinrova checks * Check Tracker - Fixes Dampe's Gravedigging Tour * Check Tracker - Fixes Prescription to King Zora * Check Tracker - Fixes Bazaar showing under wrong area on tracker between adult/child * Check Tracker - Fixes scroll for Hyrule Market and Bazaar * Check Tracker - Fixes giving Adult Trade Items shown on tracker: Broken Sword, Saw, Cojiro, Eyeball Froge, and Eyedrops * Cleans up item_location * Check Tracker - Item List - Fixes item list not updating when changing seeds/options - Separates item exclusion list from item check list - Clean up comments * Check Tracker - Adds Skip functionality to buttons * Check Tracker - Refactors adult trade items to RandomizerInf * Check Tracker - Fixes an issue where any time an item is removed the tracker would cause an application crash * Check Tracker - Item names are now dependent on file language * Check Tracker - Fixes Gerudo Card check not showing in Fast setting * Reorders headers to (hopefully) avoid CI build conflicts on linux/consoles * Explicitly defines vector header in randomizer.h to fix compile errors * Complete Refactor of Check Tracker ImGui * Adds missing check tracker files to CMakeLists * Reverts the Item_location whitespace cleanup from ad10807c * Check Tracker - Loading Fixes - Fixes a bug where loading a save file a second time would add all the checks again - Fixes a bug where the check tracker would not render at all until in a save file * Check Tracker - Fixes a bug where checks would sometimes fail to load * Check Tracker - Fixes duplicated checks when using Only on Pause or Only on Combo * Check Tracker - Works around issue where single characters don't show in EnhancementCombobox, and fixes a label for combo buttons held option * Check Tracker - Applies all Check Tracker changes to Item Location * Check Tracker - Updated Check List - Adds Link's pocket, either in KF or HM depending on starting age - Supports Scrubs and Merchants - Uses enums instead of magic numbers - Updates DC Scrub Short Names for MQ * Check Tracker - Adds a performance mode option * Check Tracker - List Fixes (requires new rando generation) - Fixes Frogs Rupees always visible - Fixes Kokiri Sword Chest not showing - Fixes Weird Egg not showing * Check Tracker - MQ List basic support * Check Tracker - MQ/Vanilla anti-spoilers * Check Tracker - Collecting a compass now spoils the area * Check Tracker - Basic Vanilla Support and fixes - Vanilla items show in check tracker, even if many won't auto check - Fixes an issue with Gerudo Fortress Keys - Refactors IsVisibleInCheckTracker to randomizer_check_tracjer * Check Tracker - Fixes merge conflict from 08a487f35e1d760ab9e69b932edbe4da6bcd9edb * Check Tracker - Fixes tracker loading as Floating when default value is set to Windowed * Randomizer Location Exclusion List - Adds Scrubs, Merchants, Shops. Adult Trade items, MQ Dungeons, and Bean Salesman - Fixes Kokiri Sword Chest, Weird Egg, and Frog Song Rupees from misbehaving - Updates Gerudo Fortress logic to be dependent on Open/Fast/Normal Fortress - Removes Invalid Check - Adds RO Enum for MQ settings - Updates magic values to RO enum * Location Exclusion List - Scrubs that are always randomized now always show on the list * For now, removes some extra code only needed for a Check Tracker. * Randomizer Location Exclusion List - Fixes Eyeball Frog from showing up when Adult Trade Items was off * Location Tracker - Updates Eyedrops to use RandomizerInf instead of Chest * Check Tracker - Fixes a bug where Link's Pocket item wasn't acting as checked for area item count * Check Tracker - Fixes a bug where Locations would incorrectly say Vanilla due to the first check in the area being a non-MQ check * Check Tracker - Fixes a crash when Check Tracker is docked but not visible * Check Tracker - Fixes areas being spoiled when loading different save files * Check Tracker - Only reset variables if they are initialized * Check Tracker - Cleans up old comments, unused variables, methods, and macros, adds language TODOs, * Check Tracker - Readds rainbow UI elements after Cosmetics Editor refactor * Check Tracker - Removal of flag lookup that was refactored, no longer needed header, and some trivial whitespace fixes. * Check Tracker - Refactors Index to Bitmask code to a macro * Check Tracker - Changes ordering from alphabetical to RandomizerCheck ordering * Check Tracker - Wraps everything in a namespace to avoid global variable usage * Check Tracker - Explicitly defines for-loop scope * Check Tracker - refactors dungeon lookup from static array to function * Fixes a bug when using EnhancementColor with alpha * Check Tracker - Refactors all colour to use direct conversions * Check Tracker - refactors settings loading and check visibility for readability * Check Tracker - Fixes a bug where the wrong label showed on the Check Tracker BG Color * UIWidgets - Adds Alpha bar to EnhancementColor when using alpha parameter
2022-12-10 22:39:23 -05:00
Check Tracker Update (#2668) * Initial commit. What works so far: Data file loads, saves, deletes, and is created properly. - Need to run `HasItemBeenCollected` when creating in case of mid-seed regen. Organized checks into maps set by area. Areas show in tracker. - Checks pulled from checkObjectsByArea are not currently listed. - Areas are being assumed completed and hidden at the start. * Checks now populate. Still not counting area totals properly. * Don't track RC_LINKS_POCKET in the data file, and instead manually add it in every time a save is load. rcObjects doesn't contain Link's Pocket location (duh). * Moved ItemReceive hook to randomizer_check_tracker.cpp. Skipped items are properly sorted and formatted. Saved items contribute to an area's gotten/skipped checks on load. Changed skipped items default main color to gray. General code cleanup. * Skipped checks now contribute to area totals for area completion logic. * Mid-menu rework transfer. * Started check lookup on item receive. Tried to enable scum checking on save. * Fixed scum check on save. * More code cleanup, which revealed some issues with loading and saving. Loading now works 100%, but entries in checkTrackerData are disappearing in code somewhere, causing issues with later checks. Scummed color now displays properly. Collected but unsaved displays properly. Unchecked, Skipped, Seen and Scummed checks all have arrows for skipping/unskipping. Counts a little messed up, probably double adding skips. * Fixed item counts being off across resets. Restarts were fine. * Beginning of rework for individual check updates. Adds `Actor lastCheck` to PlayState to allow assigning of last actor to give an item. This allows precise tracking of GS, freestanding PoH, etc. Works for chests too. Currently does not work for shops, unknown for normal NPC gives. Doesn't track last gives for non-checks, like drops from grass, pots, crates, etc. * Actor-based checks fully fleshed out, but can't help with sale-based checks. Implemented `pendingSaleCheck` to back out of an RC check cycle if `gSaveContext->pendingSale` is not NONE when `OnItemReceive` is called, processed through `OnSaleEnd`. This should be the final change necessary to streamline the checks. * Temporary hook to message box close to tie in trackers for non-gs/chest actors that aren't added to `GetCheckFromActor`. This triggers a 2-frame countdown to check with `HasItemBeenCollected` since half of the methods in there aren't updated until after a text box closes. Added scene tracking to get last scene so that checks in scenes that span several overworld areas could be tied to their areas properly. Modified tracker data creation to apply Link's Pocket and Song from Impa conditionally based on randomizer settings instead of just being assumed to be done. May need modification for checking click and drag spoiler loading. Removed the scene equivalence check from CheckChecks so that an entire area is checked each time to avoid issues with, e.g., leaving a shop before a pending sale finishes. * Changed check data creation to use RSKs from gRandomizer to account for settings loaded from drag and drop spoilers. * Beginning of tracker code organization. Changed check color defaults. * Reverted moving tracker colors to header. Some individual check fixes. * Missed something from previous merge? * Removed last remnant of removed performance mode. * Better handle checking when skullsanity is off. * Song checks sceneIDs don't match the scenes they're actually in for some reason. Removed that check. * SaleEnd checks don't need the GetItemEntry parameter. Also set a flag that should prevent the check tracker from running during vanilla saves should that not be resolved by the time it's merged. * Attempting to have only the relevant checks added to the tracker data, as well as showing vanilla checks for non-rando saves. Not working yet (everything is displayed in vanilla). * Added vanilla check tracker population via `vanillaCheck` bool in `RandomizerCheckObject`. This is also added to `IsVisibleInImGui` to handle file loading and saving to eliminate checks that aren't part of vanilla or the rando seed. Implemented deleted tracker data file recreation. Added some extra item name text checks. Songs are still... tricky, so they stay blank. Utilize local copies of the randomizer check objects that are applicable for performance purposes. Fixed vanilla item-giving cutscene crashes when triggered mid-transition. * Apparently not all toolchains can handle macro instantiation without all parameters, like VS can. * Fixed scummed detail color not showing properly on tracker. * Fixed dungeon area totals and GS checks not functioning properly. * Major revamp of checking code. Doesn't rely on `GetCheckFromActor` at all anymore, but instead simply sets a flag to evaluate a number of checks in an area every frame until the check that was gotten is identified. With the new setup, it's much less hardware intensive, and at 60fps 6 checks per frame shows no noticeable effect on framerate. I can envision needing to add a collectedCount in order to account for times when two checks are gotten one right after the other. Changed area scroll to happen from `OnTransitionEnd`, and allow for scrolling in bazaar (was disabled previously because it would jump back and forth between Kak and Market while you were in one). Also setup area check order updating by area instead of all at the same time. * Fixed shooting gallery not reporting proper area. Prevent checks from actually happening if area is RCAREA_INVALID, now that all areas are reporting something if they have checks. Fixed `GetCheckArea()` not updating checks for standard scenes. Lots of vanilla tracking updates, mainly manual checks for gems, medallions and songs, since the often don't have proper scenes in the data. Prevent vanilla from triggering check loops if junk items are collected. Fixed sorting based on saved vs collected. Prevent item name display for vanilla runs. Change coloring of checks so the check name reflects status in vanilla runs. * Fixed "Recheck Area" button erroneously adding to an area's check totals? * Fix DMC vanilla checks. * Fix check tracker data recreation on data file loss. Removed redundant file exists check from SaveTrackerDataHook, as it doesn't matter if it exists or not at that point. Limited check loops to 3 to avoid infinite check loops on non-check/junk item pickup. Added more checks to disable tracker operations if a save is not running. Changed check ordering to put boss reward and heart container checks at the end of whatever RCSHOW group they belong to. * Fixed IsRunning calculation. Further improving vanilla checking. Starting framework for checking medallions, stones, and songs on data file recreation. Fixed medallion check collection. Added GIFT_FROM_SAGES to check list for vanilla file for tracking light medallion. Added check loop limitation to prevent infinite checking after picking up junk item from the ground. * Finished vanilla file recreation and recheck (songs and dungeon rewards all check properly now). This includes deku shield with KF shop item 3. Finished Gift from Raoru light medallion tracking for vanilla. Commented all CheckByScene functionality for now. * Fixed new save data file creation. Disabled entrance area calculation for now, as it only tracks the previous entrance for some reason. Fixed area detection for ToT checks. * GetCheckArea() now utilizes EntranceData almost exclusively, via either `gSaveContext.entranceIndex` or the entrance tracker's `currentGrottoId` in the case of grottos. This also means that EVERYTHING CAN AUTOSCROLL NOW. Entrance shuffles are now much easier to track. Autoscroll is now also triggered on save, just in case someone isn't autosaving and has a lot of checks that get converted to saved. * Fixed missing GS check in LW. * Added area scroll on toggling Show Hidden Items. May configure differently later. Fixed area detection for entrances in Gerudo Fortress/Valley and Collossus. Haunted wasteland doesn't autoscroll due to a bug in `OnTransitionEnd` hook, but checks still evaluate properly there. Rely on scene-based area detection if scene is a main overworld or dungeon scene. * Fixed grotto detection when shuffle is off. * Small code cleanup. Fixed Colossus hand chest checks. * Missing lus bump from merge conflict resolution * Fixed Colossus Grotto making `GetCheckArea` return Wasteland. * Improved OnItemReceive processing for non-token GS checks, since they can sometimes take long enough for the checking process to time out before the item is registered as received. * First attempt at thread safety for tracker data file writing. Seems to work, but might need more testing. * Fixed Recheck Area not unskipping items that register as saved. Improved delayed saving with autosaving, as the autosave triggered quite often before the tracker data save, making things not properly register as saved. * merge cleanup * Converted check tracker data to the sectional saves, adding `CheckTrackerData` to `SaveContext`. Implemented section ID returning and fullSave boolean passing to section functions from my PR temporarily for it to work properly. Moved `RandomizerCheckTrackerData` enum to `randomizerTypes.h` to accommodate that. Changed `Randomizer_SaveInit` to a `SaveManager::InitFunc` to allow for other randomizer-dependent sections to be initialized after that. Required a little refactoring to maintain intro cutscene skip when starting a randomizer file. * Revert section index return and randomizer init changes. Will need to wait on yet more changes to main. * Fixed check tracker initialization (shouldn't be tied to window initialization), restored saving/loading functionality. * Removed `CheckTracker::Init` and put SaveManager calls in `CheckTrackerWindow::InitElement`. Also a bit of cleanup from transition back to save file use. * Fixed tracker displaying check categories while file not loaded. * Fix Darunia's Joy check not marking in vanilla. * Fix autosave not triggering change from collected to saved in tracker data. * Changed default colors for scummed and collected display. * Merge upgrade code cleanup. * Add `OnTransitionEnd` calls to sandstorm transitions both to and from Wasteland. Also improved `gSaveContext.lastScene` assignment for both transition types. Allowed a bit of cleanup in `GetCheckArea`. * Added `StateButton`, a button like `ArrowButton` but that allows text instead of arrow icons. Apparently the changes from ArrowButton to StateButton happened in a previous commit... * Changed section name to `trackerDataCheck` to force SoH to load it after the randomizer section, as it required some randoSettings to be loaded first, and nothing else I tried to make the randomizer section load before it worked. This hacks a solution to checks not displaying on fast file load to a specific slot. F*** you, SaveManager, and f*** you too, JSON. * Forgot to change the section string for loading with the name change. * Fix check ordering for checks that trigger the autosave. * Adds option to remove right-side shop items (slots 1-4) from the tracker list. Enabled by default. * Fix default state of Hide Shop Right Checks checkbox. * Fixes grotto and great fairy scrolling and checks. Fixes array overflow from `checkTrackerData` which was creating the issue trying to load the base and randomizer sections first, among other things. That also fixed the massive file loads that were being exhibited in debug mode. * Fix shooting galleries being set as collected again when being played a second time after getting the checks. * Fix Bazaar autoscroll. * Add Saria's Song to `GetCheckFromActor` and removed some limitations from the messageCloseCheck function to make that check track properly. * Fix Song from Impa check. Implemented prevention for multiple "collections" of great fairies, just in case getting the health refill would trigger it with the previous setup. * Fix ice traps on GS tokens not triggering OnItemReceive. * Complete fix for ice trap collection from GS. Add autoscroll when clicking "Expand All". * Add `OnShopSlotChange` with cursorSlot and basePrice parameters. * Fixed include in en_ossan for shop slot hook. Added registration for `OnShopSlotChange` in the tracker, storing the price in a new `price` field in `CheckTrackerData`. Added "seen" functionality to shop checks. Displays the model item name upon first entering a shop, adding the price and switching to trickName (if it's an ice trap) upon navigating to the slot in buy mode, triggered by an invisible "identified" status that mirrors "seen" in every other way. Added tooltips to most options for check tracker color picking to describe what each status actually means. * `std::format` pls * So apparently std::format just decided to break with the latest merge from develop, but fmt::format exists and works? * Removed the last vestiges of `locationsSkipped`. Other general code and formatting cleanups. Moved `IsGameRunning` to `OTRGlobals` so the item tracker could also access it. Used preceding to "fix" item and bottle display in the item tracker on startup. * Some more code cleanup. Removed "Recheck Area" button and relevant code. Backported changes to Anchor branch applicable for single-player, including making a checkAreas vector and structuring the frame by frame checks around that. Also includes fix for Silver Gauntlets and Mirror Shield check collection crash associated with those changes. Fixed Kakariko Bazaar "seen" updates. Fixed tracker window not showing on initial load like it should. * Forgot 1 formatting fix. * Removed conditions for showing Song from Impa (isn't junk under certain conditions, so should show all the time). * Fix vanilla checks, add Zelda's Letter and Malon's Egg to manual check collection. Fix autoscroll while in child stealth section. * Fix crash in Happy Mask Shop in OnSlotChange (referenced non-existent shop id in a tracker-specific enum). * General code cleanup. * Missed one reversion. * One more. * Fix column alignment in `randomizer_check_objects`. * Fix file encoding on `randomizer_check_tracker`. Again. * Fix indentation for `actualItemtrackerItemMap`. Also removed unnecessary parts of the map. * Rename `HasEqItem` to `HasEquipment`. * Slightly better indentation for `actualItemTrackerItemMap`. * Add magic bean salesman to vanilla check tracking, and genericized deku shield to trigger KF shop item 3 wherever you get the shield. Renamed `vanillaCheck` to `vanillaHundoCheck` to (supposedly) clarify the meaning of the usage. * One more rename to `vanillaCompletion` to avoid possible confusion with 100% speedrun conditions. * give me a break XD Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * Changes suggested by briaguya (rename `RandomizerCheckShow` to `Status`, unused code, newline formatting) * Remove unused `itemNames` table. * Remove `IsGameRunning` in favor of `GameInteractor::IsSaveLoaded`. * Restore anti-spoiler functionality for dungeons with dungeon maps. * Review cleanup. * Fix prices not showing for Kak bazaar items. --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com>
2023-10-04 11:03:36 -04:00
if (!GameInteractor::IsSaveLoaded()) {
Randomizer Auto Location tracker (#1942) * Initial Auto-Location Tracking * Updates styling for checked items in Check Tracker * Fixes crashing issues with Check Tracker rendering * Auto scroll Check Tracker windows to current area * Checks Tracker only shows checked locations once in game * Fixes issue where Check Tracker would auto-scroll to wrong location when entering a grotto * Fixes gerudo fortress checks showing in tracker when settings have them removed * InfTable Check Location Fixes: Lost Dog Richard, Rolling Gorons, HBA 1000, Thawed Zora * Fixes most Event Chk Inf Checks on Check Tracker, and Frogs * Check Tracker - Song from Malon now works * Check Tracker - Fixes Claim Check check not tracking - Fixes spoiler for Claim Check check when getting Biggoron's Sword - Fixes LACS being spoiled and not tracking * Check Tracker - Fixes #2 for Skull Mask and Mask of Truth checks * Check Tracker - Adds support for merchants - Fixes #7 for Bomchu Salesman - Fixes #12 for Medigoron * Check Tracker - Fixes #8 for Song from Saria * Check Tracker - Fixes #9 for Adult Shooting Gallery * Check Tracker - Fixes #10 for Composer Grave * Check Tracker - Fixes #14 for Song from Ocarina of Time * Check Tracker - Fixes #16 for Shooting the Sun * Check Tracker - Fixes #19 for Darunia's Joy * Save Editor - Adds missing label for Treasure Chest Game * Check Tracker - Fixes Great Faries checks * Check Tracker - Fixes Sheik at Temple * Check Tracker - Fixes Great Fairy auto-scroll to wrong location * Check Tracker - Updates blue warp checks - Fixes Bongo Bongo and Twinrova checks * Check Tracker - Fixes Dampe's Gravedigging Tour * Check Tracker - Fixes Prescription to King Zora * Check Tracker - Fixes Bazaar showing under wrong area on tracker between adult/child * Check Tracker - Fixes scroll for Hyrule Market and Bazaar * Check Tracker - Fixes giving Adult Trade Items shown on tracker: Broken Sword, Saw, Cojiro, Eyeball Froge, and Eyedrops * Cleans up item_location * Check Tracker - Item List - Fixes item list not updating when changing seeds/options - Separates item exclusion list from item check list - Clean up comments * Check Tracker - Adds Skip functionality to buttons * Check Tracker - Refactors adult trade items to RandomizerInf * Check Tracker - Fixes an issue where any time an item is removed the tracker would cause an application crash * Check Tracker - Item names are now dependent on file language * Check Tracker - Fixes Gerudo Card check not showing in Fast setting * Reorders headers to (hopefully) avoid CI build conflicts on linux/consoles * Explicitly defines vector header in randomizer.h to fix compile errors * Complete Refactor of Check Tracker ImGui * Adds missing check tracker files to CMakeLists * Reverts the Item_location whitespace cleanup from ad10807c * Check Tracker - Loading Fixes - Fixes a bug where loading a save file a second time would add all the checks again - Fixes a bug where the check tracker would not render at all until in a save file * Check Tracker - Fixes a bug where checks would sometimes fail to load * Check Tracker - Fixes duplicated checks when using Only on Pause or Only on Combo * Check Tracker - Works around issue where single characters don't show in EnhancementCombobox, and fixes a label for combo buttons held option * Check Tracker - Applies all Check Tracker changes to Item Location * Check Tracker - Updated Check List - Adds Link's pocket, either in KF or HM depending on starting age - Supports Scrubs and Merchants - Uses enums instead of magic numbers - Updates DC Scrub Short Names for MQ * Check Tracker - Adds a performance mode option * Check Tracker - List Fixes (requires new rando generation) - Fixes Frogs Rupees always visible - Fixes Kokiri Sword Chest not showing - Fixes Weird Egg not showing * Check Tracker - MQ List basic support * Check Tracker - MQ/Vanilla anti-spoilers * Check Tracker - Collecting a compass now spoils the area * Check Tracker - Basic Vanilla Support and fixes - Vanilla items show in check tracker, even if many won't auto check - Fixes an issue with Gerudo Fortress Keys - Refactors IsVisibleInCheckTracker to randomizer_check_tracjer * Check Tracker - Fixes merge conflict from 08a487f35e1d760ab9e69b932edbe4da6bcd9edb * Check Tracker - Fixes tracker loading as Floating when default value is set to Windowed * Randomizer Location Exclusion List - Adds Scrubs, Merchants, Shops. Adult Trade items, MQ Dungeons, and Bean Salesman - Fixes Kokiri Sword Chest, Weird Egg, and Frog Song Rupees from misbehaving - Updates Gerudo Fortress logic to be dependent on Open/Fast/Normal Fortress - Removes Invalid Check - Adds RO Enum for MQ settings - Updates magic values to RO enum * Location Exclusion List - Scrubs that are always randomized now always show on the list * For now, removes some extra code only needed for a Check Tracker. * Randomizer Location Exclusion List - Fixes Eyeball Frog from showing up when Adult Trade Items was off * Location Tracker - Updates Eyedrops to use RandomizerInf instead of Chest * Check Tracker - Fixes a bug where Link's Pocket item wasn't acting as checked for area item count * Check Tracker - Fixes a bug where Locations would incorrectly say Vanilla due to the first check in the area being a non-MQ check * Check Tracker - Fixes a crash when Check Tracker is docked but not visible * Check Tracker - Fixes areas being spoiled when loading different save files * Check Tracker - Only reset variables if they are initialized * Check Tracker - Cleans up old comments, unused variables, methods, and macros, adds language TODOs, * Check Tracker - Readds rainbow UI elements after Cosmetics Editor refactor * Check Tracker - Removal of flag lookup that was refactored, no longer needed header, and some trivial whitespace fixes. * Check Tracker - Refactors Index to Bitmask code to a macro * Check Tracker - Changes ordering from alphabetical to RandomizerCheck ordering * Check Tracker - Wraps everything in a namespace to avoid global variable usage * Check Tracker - Explicitly defines for-loop scope * Check Tracker - refactors dungeon lookup from static array to function * Fixes a bug when using EnhancementColor with alpha * Check Tracker - Refactors all colour to use direct conversions * Check Tracker - refactors settings loading and check visibility for readability * Check Tracker - Fixes a bug where the wrong label showed on the Check Tracker BG Color * UIWidgets - Adds Alpha bar to EnhancementColor when using alpha parameter
2022-12-10 22:39:23 -05:00
ImGui::Text("Waiting for file load..."); //TODO Language
EndFloatWindows();
return;
}
SceneID sceneId = SCENE_ID_MAX;
if (gPlayState != nullptr) {
sceneId = (SceneID)gPlayState->sceneNum;
}
areasSpoiled |= (1 << currentArea);
//Quick Options
#ifdef __WIIU__
float headerHeight = 40.0f;
#else
float headerHeight = 20.0f;
#endif
ImVec2 size = ImGui::GetContentRegionMax();
size.y -= headerHeight;
if (!ImGui::BeginTable("Check Tracker", 1, 0, size)) {
EndFloatWindows();
return;
}
ImGui::TableNextRow(0, headerHeight);
ImGui::TableNextColumn();
UIWidgets::EnhancementCheckbox(
"Show Hidden Items", "gCheckTrackerOptionShowHidden", false,
"When active, items will show hidden checks by default when updated to this state.");
Check Tracker Update (#2668) * Initial commit. What works so far: Data file loads, saves, deletes, and is created properly. - Need to run `HasItemBeenCollected` when creating in case of mid-seed regen. Organized checks into maps set by area. Areas show in tracker. - Checks pulled from checkObjectsByArea are not currently listed. - Areas are being assumed completed and hidden at the start. * Checks now populate. Still not counting area totals properly. * Don't track RC_LINKS_POCKET in the data file, and instead manually add it in every time a save is load. rcObjects doesn't contain Link's Pocket location (duh). * Moved ItemReceive hook to randomizer_check_tracker.cpp. Skipped items are properly sorted and formatted. Saved items contribute to an area's gotten/skipped checks on load. Changed skipped items default main color to gray. General code cleanup. * Skipped checks now contribute to area totals for area completion logic. * Mid-menu rework transfer. * Started check lookup on item receive. Tried to enable scum checking on save. * Fixed scum check on save. * More code cleanup, which revealed some issues with loading and saving. Loading now works 100%, but entries in checkTrackerData are disappearing in code somewhere, causing issues with later checks. Scummed color now displays properly. Collected but unsaved displays properly. Unchecked, Skipped, Seen and Scummed checks all have arrows for skipping/unskipping. Counts a little messed up, probably double adding skips. * Fixed item counts being off across resets. Restarts were fine. * Beginning of rework for individual check updates. Adds `Actor lastCheck` to PlayState to allow assigning of last actor to give an item. This allows precise tracking of GS, freestanding PoH, etc. Works for chests too. Currently does not work for shops, unknown for normal NPC gives. Doesn't track last gives for non-checks, like drops from grass, pots, crates, etc. * Actor-based checks fully fleshed out, but can't help with sale-based checks. Implemented `pendingSaleCheck` to back out of an RC check cycle if `gSaveContext->pendingSale` is not NONE when `OnItemReceive` is called, processed through `OnSaleEnd`. This should be the final change necessary to streamline the checks. * Temporary hook to message box close to tie in trackers for non-gs/chest actors that aren't added to `GetCheckFromActor`. This triggers a 2-frame countdown to check with `HasItemBeenCollected` since half of the methods in there aren't updated until after a text box closes. Added scene tracking to get last scene so that checks in scenes that span several overworld areas could be tied to their areas properly. Modified tracker data creation to apply Link's Pocket and Song from Impa conditionally based on randomizer settings instead of just being assumed to be done. May need modification for checking click and drag spoiler loading. Removed the scene equivalence check from CheckChecks so that an entire area is checked each time to avoid issues with, e.g., leaving a shop before a pending sale finishes. * Changed check data creation to use RSKs from gRandomizer to account for settings loaded from drag and drop spoilers. * Beginning of tracker code organization. Changed check color defaults. * Reverted moving tracker colors to header. Some individual check fixes. * Missed something from previous merge? * Removed last remnant of removed performance mode. * Better handle checking when skullsanity is off. * Song checks sceneIDs don't match the scenes they're actually in for some reason. Removed that check. * SaleEnd checks don't need the GetItemEntry parameter. Also set a flag that should prevent the check tracker from running during vanilla saves should that not be resolved by the time it's merged. * Attempting to have only the relevant checks added to the tracker data, as well as showing vanilla checks for non-rando saves. Not working yet (everything is displayed in vanilla). * Added vanilla check tracker population via `vanillaCheck` bool in `RandomizerCheckObject`. This is also added to `IsVisibleInImGui` to handle file loading and saving to eliminate checks that aren't part of vanilla or the rando seed. Implemented deleted tracker data file recreation. Added some extra item name text checks. Songs are still... tricky, so they stay blank. Utilize local copies of the randomizer check objects that are applicable for performance purposes. Fixed vanilla item-giving cutscene crashes when triggered mid-transition. * Apparently not all toolchains can handle macro instantiation without all parameters, like VS can. * Fixed scummed detail color not showing properly on tracker. * Fixed dungeon area totals and GS checks not functioning properly. * Major revamp of checking code. Doesn't rely on `GetCheckFromActor` at all anymore, but instead simply sets a flag to evaluate a number of checks in an area every frame until the check that was gotten is identified. With the new setup, it's much less hardware intensive, and at 60fps 6 checks per frame shows no noticeable effect on framerate. I can envision needing to add a collectedCount in order to account for times when two checks are gotten one right after the other. Changed area scroll to happen from `OnTransitionEnd`, and allow for scrolling in bazaar (was disabled previously because it would jump back and forth between Kak and Market while you were in one). Also setup area check order updating by area instead of all at the same time. * Fixed shooting gallery not reporting proper area. Prevent checks from actually happening if area is RCAREA_INVALID, now that all areas are reporting something if they have checks. Fixed `GetCheckArea()` not updating checks for standard scenes. Lots of vanilla tracking updates, mainly manual checks for gems, medallions and songs, since the often don't have proper scenes in the data. Prevent vanilla from triggering check loops if junk items are collected. Fixed sorting based on saved vs collected. Prevent item name display for vanilla runs. Change coloring of checks so the check name reflects status in vanilla runs. * Fixed "Recheck Area" button erroneously adding to an area's check totals? * Fix DMC vanilla checks. * Fix check tracker data recreation on data file loss. Removed redundant file exists check from SaveTrackerDataHook, as it doesn't matter if it exists or not at that point. Limited check loops to 3 to avoid infinite check loops on non-check/junk item pickup. Added more checks to disable tracker operations if a save is not running. Changed check ordering to put boss reward and heart container checks at the end of whatever RCSHOW group they belong to. * Fixed IsRunning calculation. Further improving vanilla checking. Starting framework for checking medallions, stones, and songs on data file recreation. Fixed medallion check collection. Added GIFT_FROM_SAGES to check list for vanilla file for tracking light medallion. Added check loop limitation to prevent infinite checking after picking up junk item from the ground. * Finished vanilla file recreation and recheck (songs and dungeon rewards all check properly now). This includes deku shield with KF shop item 3. Finished Gift from Raoru light medallion tracking for vanilla. Commented all CheckByScene functionality for now. * Fixed new save data file creation. Disabled entrance area calculation for now, as it only tracks the previous entrance for some reason. Fixed area detection for ToT checks. * GetCheckArea() now utilizes EntranceData almost exclusively, via either `gSaveContext.entranceIndex` or the entrance tracker's `currentGrottoId` in the case of grottos. This also means that EVERYTHING CAN AUTOSCROLL NOW. Entrance shuffles are now much easier to track. Autoscroll is now also triggered on save, just in case someone isn't autosaving and has a lot of checks that get converted to saved. * Fixed missing GS check in LW. * Added area scroll on toggling Show Hidden Items. May configure differently later. Fixed area detection for entrances in Gerudo Fortress/Valley and Collossus. Haunted wasteland doesn't autoscroll due to a bug in `OnTransitionEnd` hook, but checks still evaluate properly there. Rely on scene-based area detection if scene is a main overworld or dungeon scene. * Fixed grotto detection when shuffle is off. * Small code cleanup. Fixed Colossus hand chest checks. * Missing lus bump from merge conflict resolution * Fixed Colossus Grotto making `GetCheckArea` return Wasteland. * Improved OnItemReceive processing for non-token GS checks, since they can sometimes take long enough for the checking process to time out before the item is registered as received. * First attempt at thread safety for tracker data file writing. Seems to work, but might need more testing. * Fixed Recheck Area not unskipping items that register as saved. Improved delayed saving with autosaving, as the autosave triggered quite often before the tracker data save, making things not properly register as saved. * merge cleanup * Converted check tracker data to the sectional saves, adding `CheckTrackerData` to `SaveContext`. Implemented section ID returning and fullSave boolean passing to section functions from my PR temporarily for it to work properly. Moved `RandomizerCheckTrackerData` enum to `randomizerTypes.h` to accommodate that. Changed `Randomizer_SaveInit` to a `SaveManager::InitFunc` to allow for other randomizer-dependent sections to be initialized after that. Required a little refactoring to maintain intro cutscene skip when starting a randomizer file. * Revert section index return and randomizer init changes. Will need to wait on yet more changes to main. * Fixed check tracker initialization (shouldn't be tied to window initialization), restored saving/loading functionality. * Removed `CheckTracker::Init` and put SaveManager calls in `CheckTrackerWindow::InitElement`. Also a bit of cleanup from transition back to save file use. * Fixed tracker displaying check categories while file not loaded. * Fix Darunia's Joy check not marking in vanilla. * Fix autosave not triggering change from collected to saved in tracker data. * Changed default colors for scummed and collected display. * Merge upgrade code cleanup. * Add `OnTransitionEnd` calls to sandstorm transitions both to and from Wasteland. Also improved `gSaveContext.lastScene` assignment for both transition types. Allowed a bit of cleanup in `GetCheckArea`. * Added `StateButton`, a button like `ArrowButton` but that allows text instead of arrow icons. Apparently the changes from ArrowButton to StateButton happened in a previous commit... * Changed section name to `trackerDataCheck` to force SoH to load it after the randomizer section, as it required some randoSettings to be loaded first, and nothing else I tried to make the randomizer section load before it worked. This hacks a solution to checks not displaying on fast file load to a specific slot. F*** you, SaveManager, and f*** you too, JSON. * Forgot to change the section string for loading with the name change. * Fix check ordering for checks that trigger the autosave. * Adds option to remove right-side shop items (slots 1-4) from the tracker list. Enabled by default. * Fix default state of Hide Shop Right Checks checkbox. * Fixes grotto and great fairy scrolling and checks. Fixes array overflow from `checkTrackerData` which was creating the issue trying to load the base and randomizer sections first, among other things. That also fixed the massive file loads that were being exhibited in debug mode. * Fix shooting galleries being set as collected again when being played a second time after getting the checks. * Fix Bazaar autoscroll. * Add Saria's Song to `GetCheckFromActor` and removed some limitations from the messageCloseCheck function to make that check track properly. * Fix Song from Impa check. Implemented prevention for multiple "collections" of great fairies, just in case getting the health refill would trigger it with the previous setup. * Fix ice traps on GS tokens not triggering OnItemReceive. * Complete fix for ice trap collection from GS. Add autoscroll when clicking "Expand All". * Add `OnShopSlotChange` with cursorSlot and basePrice parameters. * Fixed include in en_ossan for shop slot hook. Added registration for `OnShopSlotChange` in the tracker, storing the price in a new `price` field in `CheckTrackerData`. Added "seen" functionality to shop checks. Displays the model item name upon first entering a shop, adding the price and switching to trickName (if it's an ice trap) upon navigating to the slot in buy mode, triggered by an invisible "identified" status that mirrors "seen" in every other way. Added tooltips to most options for check tracker color picking to describe what each status actually means. * `std::format` pls * So apparently std::format just decided to break with the latest merge from develop, but fmt::format exists and works? * Removed the last vestiges of `locationsSkipped`. Other general code and formatting cleanups. Moved `IsGameRunning` to `OTRGlobals` so the item tracker could also access it. Used preceding to "fix" item and bottle display in the item tracker on startup. * Some more code cleanup. Removed "Recheck Area" button and relevant code. Backported changes to Anchor branch applicable for single-player, including making a checkAreas vector and structuring the frame by frame checks around that. Also includes fix for Silver Gauntlets and Mirror Shield check collection crash associated with those changes. Fixed Kakariko Bazaar "seen" updates. Fixed tracker window not showing on initial load like it should. * Forgot 1 formatting fix. * Removed conditions for showing Song from Impa (isn't junk under certain conditions, so should show all the time). * Fix vanilla checks, add Zelda's Letter and Malon's Egg to manual check collection. Fix autoscroll while in child stealth section. * Fix crash in Happy Mask Shop in OnSlotChange (referenced non-existent shop id in a tracker-specific enum). * General code cleanup. * Missed one reversion. * One more. * Fix column alignment in `randomizer_check_objects`. * Fix file encoding on `randomizer_check_tracker`. Again. * Fix indentation for `actualItemtrackerItemMap`. Also removed unnecessary parts of the map. * Rename `HasEqItem` to `HasEquipment`. * Slightly better indentation for `actualItemTrackerItemMap`. * Add magic bean salesman to vanilla check tracking, and genericized deku shield to trigger KF shop item 3 wherever you get the shield. Renamed `vanillaCheck` to `vanillaHundoCheck` to (supposedly) clarify the meaning of the usage. * One more rename to `vanillaCompletion` to avoid possible confusion with 100% speedrun conditions. * give me a break XD Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * Changes suggested by briaguya (rename `RandomizerCheckShow` to `Status`, unused code, newline formatting) * Remove unused `itemNames` table. * Remove `IsGameRunning` in favor of `GameInteractor::IsSaveLoaded`. * Restore anti-spoiler functionality for dungeons with dungeon maps. * Review cleanup. * Fix prices not showing for Kak bazaar items. --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com>
2023-10-04 11:03:36 -04:00
UIWidgets::PaddedSeparator();
Randomizer Auto Location tracker (#1942) * Initial Auto-Location Tracking * Updates styling for checked items in Check Tracker * Fixes crashing issues with Check Tracker rendering * Auto scroll Check Tracker windows to current area * Checks Tracker only shows checked locations once in game * Fixes issue where Check Tracker would auto-scroll to wrong location when entering a grotto * Fixes gerudo fortress checks showing in tracker when settings have them removed * InfTable Check Location Fixes: Lost Dog Richard, Rolling Gorons, HBA 1000, Thawed Zora * Fixes most Event Chk Inf Checks on Check Tracker, and Frogs * Check Tracker - Song from Malon now works * Check Tracker - Fixes Claim Check check not tracking - Fixes spoiler for Claim Check check when getting Biggoron's Sword - Fixes LACS being spoiled and not tracking * Check Tracker - Fixes #2 for Skull Mask and Mask of Truth checks * Check Tracker - Adds support for merchants - Fixes #7 for Bomchu Salesman - Fixes #12 for Medigoron * Check Tracker - Fixes #8 for Song from Saria * Check Tracker - Fixes #9 for Adult Shooting Gallery * Check Tracker - Fixes #10 for Composer Grave * Check Tracker - Fixes #14 for Song from Ocarina of Time * Check Tracker - Fixes #16 for Shooting the Sun * Check Tracker - Fixes #19 for Darunia's Joy * Save Editor - Adds missing label for Treasure Chest Game * Check Tracker - Fixes Great Faries checks * Check Tracker - Fixes Sheik at Temple * Check Tracker - Fixes Great Fairy auto-scroll to wrong location * Check Tracker - Updates blue warp checks - Fixes Bongo Bongo and Twinrova checks * Check Tracker - Fixes Dampe's Gravedigging Tour * Check Tracker - Fixes Prescription to King Zora * Check Tracker - Fixes Bazaar showing under wrong area on tracker between adult/child * Check Tracker - Fixes scroll for Hyrule Market and Bazaar * Check Tracker - Fixes giving Adult Trade Items shown on tracker: Broken Sword, Saw, Cojiro, Eyeball Froge, and Eyedrops * Cleans up item_location * Check Tracker - Item List - Fixes item list not updating when changing seeds/options - Separates item exclusion list from item check list - Clean up comments * Check Tracker - Adds Skip functionality to buttons * Check Tracker - Refactors adult trade items to RandomizerInf * Check Tracker - Fixes an issue where any time an item is removed the tracker would cause an application crash * Check Tracker - Item names are now dependent on file language * Check Tracker - Fixes Gerudo Card check not showing in Fast setting * Reorders headers to (hopefully) avoid CI build conflicts on linux/consoles * Explicitly defines vector header in randomizer.h to fix compile errors * Complete Refactor of Check Tracker ImGui * Adds missing check tracker files to CMakeLists * Reverts the Item_location whitespace cleanup from ad10807c * Check Tracker - Loading Fixes - Fixes a bug where loading a save file a second time would add all the checks again - Fixes a bug where the check tracker would not render at all until in a save file * Check Tracker - Fixes a bug where checks would sometimes fail to load * Check Tracker - Fixes duplicated checks when using Only on Pause or Only on Combo * Check Tracker - Works around issue where single characters don't show in EnhancementCombobox, and fixes a label for combo buttons held option * Check Tracker - Applies all Check Tracker changes to Item Location * Check Tracker - Updated Check List - Adds Link's pocket, either in KF or HM depending on starting age - Supports Scrubs and Merchants - Uses enums instead of magic numbers - Updates DC Scrub Short Names for MQ * Check Tracker - Adds a performance mode option * Check Tracker - List Fixes (requires new rando generation) - Fixes Frogs Rupees always visible - Fixes Kokiri Sword Chest not showing - Fixes Weird Egg not showing * Check Tracker - MQ List basic support * Check Tracker - MQ/Vanilla anti-spoilers * Check Tracker - Collecting a compass now spoils the area * Check Tracker - Basic Vanilla Support and fixes - Vanilla items show in check tracker, even if many won't auto check - Fixes an issue with Gerudo Fortress Keys - Refactors IsVisibleInCheckTracker to randomizer_check_tracjer * Check Tracker - Fixes merge conflict from 08a487f35e1d760ab9e69b932edbe4da6bcd9edb * Check Tracker - Fixes tracker loading as Floating when default value is set to Windowed * Randomizer Location Exclusion List - Adds Scrubs, Merchants, Shops. Adult Trade items, MQ Dungeons, and Bean Salesman - Fixes Kokiri Sword Chest, Weird Egg, and Frog Song Rupees from misbehaving - Updates Gerudo Fortress logic to be dependent on Open/Fast/Normal Fortress - Removes Invalid Check - Adds RO Enum for MQ settings - Updates magic values to RO enum * Location Exclusion List - Scrubs that are always randomized now always show on the list * For now, removes some extra code only needed for a Check Tracker. * Randomizer Location Exclusion List - Fixes Eyeball Frog from showing up when Adult Trade Items was off * Location Tracker - Updates Eyedrops to use RandomizerInf instead of Chest * Check Tracker - Fixes a bug where Link's Pocket item wasn't acting as checked for area item count * Check Tracker - Fixes a bug where Locations would incorrectly say Vanilla due to the first check in the area being a non-MQ check * Check Tracker - Fixes a crash when Check Tracker is docked but not visible * Check Tracker - Fixes areas being spoiled when loading different save files * Check Tracker - Only reset variables if they are initialized * Check Tracker - Cleans up old comments, unused variables, methods, and macros, adds language TODOs, * Check Tracker - Readds rainbow UI elements after Cosmetics Editor refactor * Check Tracker - Removal of flag lookup that was refactored, no longer needed header, and some trivial whitespace fixes. * Check Tracker - Refactors Index to Bitmask code to a macro * Check Tracker - Changes ordering from alphabetical to RandomizerCheck ordering * Check Tracker - Wraps everything in a namespace to avoid global variable usage * Check Tracker - Explicitly defines for-loop scope * Check Tracker - refactors dungeon lookup from static array to function * Fixes a bug when using EnhancementColor with alpha * Check Tracker - Refactors all colour to use direct conversions * Check Tracker - refactors settings loading and check visibility for readability * Check Tracker - Fixes a bug where the wrong label showed on the Check Tracker BG Color * UIWidgets - Adds Alpha bar to EnhancementColor when using alpha parameter
2022-12-10 22:39:23 -05:00
if (ImGui::Button("Expand All")) {
optCollapseAll = false;
optExpandAll = true;
Check Tracker Update (#2668) * Initial commit. What works so far: Data file loads, saves, deletes, and is created properly. - Need to run `HasItemBeenCollected` when creating in case of mid-seed regen. Organized checks into maps set by area. Areas show in tracker. - Checks pulled from checkObjectsByArea are not currently listed. - Areas are being assumed completed and hidden at the start. * Checks now populate. Still not counting area totals properly. * Don't track RC_LINKS_POCKET in the data file, and instead manually add it in every time a save is load. rcObjects doesn't contain Link's Pocket location (duh). * Moved ItemReceive hook to randomizer_check_tracker.cpp. Skipped items are properly sorted and formatted. Saved items contribute to an area's gotten/skipped checks on load. Changed skipped items default main color to gray. General code cleanup. * Skipped checks now contribute to area totals for area completion logic. * Mid-menu rework transfer. * Started check lookup on item receive. Tried to enable scum checking on save. * Fixed scum check on save. * More code cleanup, which revealed some issues with loading and saving. Loading now works 100%, but entries in checkTrackerData are disappearing in code somewhere, causing issues with later checks. Scummed color now displays properly. Collected but unsaved displays properly. Unchecked, Skipped, Seen and Scummed checks all have arrows for skipping/unskipping. Counts a little messed up, probably double adding skips. * Fixed item counts being off across resets. Restarts were fine. * Beginning of rework for individual check updates. Adds `Actor lastCheck` to PlayState to allow assigning of last actor to give an item. This allows precise tracking of GS, freestanding PoH, etc. Works for chests too. Currently does not work for shops, unknown for normal NPC gives. Doesn't track last gives for non-checks, like drops from grass, pots, crates, etc. * Actor-based checks fully fleshed out, but can't help with sale-based checks. Implemented `pendingSaleCheck` to back out of an RC check cycle if `gSaveContext->pendingSale` is not NONE when `OnItemReceive` is called, processed through `OnSaleEnd`. This should be the final change necessary to streamline the checks. * Temporary hook to message box close to tie in trackers for non-gs/chest actors that aren't added to `GetCheckFromActor`. This triggers a 2-frame countdown to check with `HasItemBeenCollected` since half of the methods in there aren't updated until after a text box closes. Added scene tracking to get last scene so that checks in scenes that span several overworld areas could be tied to their areas properly. Modified tracker data creation to apply Link's Pocket and Song from Impa conditionally based on randomizer settings instead of just being assumed to be done. May need modification for checking click and drag spoiler loading. Removed the scene equivalence check from CheckChecks so that an entire area is checked each time to avoid issues with, e.g., leaving a shop before a pending sale finishes. * Changed check data creation to use RSKs from gRandomizer to account for settings loaded from drag and drop spoilers. * Beginning of tracker code organization. Changed check color defaults. * Reverted moving tracker colors to header. Some individual check fixes. * Missed something from previous merge? * Removed last remnant of removed performance mode. * Better handle checking when skullsanity is off. * Song checks sceneIDs don't match the scenes they're actually in for some reason. Removed that check. * SaleEnd checks don't need the GetItemEntry parameter. Also set a flag that should prevent the check tracker from running during vanilla saves should that not be resolved by the time it's merged. * Attempting to have only the relevant checks added to the tracker data, as well as showing vanilla checks for non-rando saves. Not working yet (everything is displayed in vanilla). * Added vanilla check tracker population via `vanillaCheck` bool in `RandomizerCheckObject`. This is also added to `IsVisibleInImGui` to handle file loading and saving to eliminate checks that aren't part of vanilla or the rando seed. Implemented deleted tracker data file recreation. Added some extra item name text checks. Songs are still... tricky, so they stay blank. Utilize local copies of the randomizer check objects that are applicable for performance purposes. Fixed vanilla item-giving cutscene crashes when triggered mid-transition. * Apparently not all toolchains can handle macro instantiation without all parameters, like VS can. * Fixed scummed detail color not showing properly on tracker. * Fixed dungeon area totals and GS checks not functioning properly. * Major revamp of checking code. Doesn't rely on `GetCheckFromActor` at all anymore, but instead simply sets a flag to evaluate a number of checks in an area every frame until the check that was gotten is identified. With the new setup, it's much less hardware intensive, and at 60fps 6 checks per frame shows no noticeable effect on framerate. I can envision needing to add a collectedCount in order to account for times when two checks are gotten one right after the other. Changed area scroll to happen from `OnTransitionEnd`, and allow for scrolling in bazaar (was disabled previously because it would jump back and forth between Kak and Market while you were in one). Also setup area check order updating by area instead of all at the same time. * Fixed shooting gallery not reporting proper area. Prevent checks from actually happening if area is RCAREA_INVALID, now that all areas are reporting something if they have checks. Fixed `GetCheckArea()` not updating checks for standard scenes. Lots of vanilla tracking updates, mainly manual checks for gems, medallions and songs, since the often don't have proper scenes in the data. Prevent vanilla from triggering check loops if junk items are collected. Fixed sorting based on saved vs collected. Prevent item name display for vanilla runs. Change coloring of checks so the check name reflects status in vanilla runs. * Fixed "Recheck Area" button erroneously adding to an area's check totals? * Fix DMC vanilla checks. * Fix check tracker data recreation on data file loss. Removed redundant file exists check from SaveTrackerDataHook, as it doesn't matter if it exists or not at that point. Limited check loops to 3 to avoid infinite check loops on non-check/junk item pickup. Added more checks to disable tracker operations if a save is not running. Changed check ordering to put boss reward and heart container checks at the end of whatever RCSHOW group they belong to. * Fixed IsRunning calculation. Further improving vanilla checking. Starting framework for checking medallions, stones, and songs on data file recreation. Fixed medallion check collection. Added GIFT_FROM_SAGES to check list for vanilla file for tracking light medallion. Added check loop limitation to prevent infinite checking after picking up junk item from the ground. * Finished vanilla file recreation and recheck (songs and dungeon rewards all check properly now). This includes deku shield with KF shop item 3. Finished Gift from Raoru light medallion tracking for vanilla. Commented all CheckByScene functionality for now. * Fixed new save data file creation. Disabled entrance area calculation for now, as it only tracks the previous entrance for some reason. Fixed area detection for ToT checks. * GetCheckArea() now utilizes EntranceData almost exclusively, via either `gSaveContext.entranceIndex` or the entrance tracker's `currentGrottoId` in the case of grottos. This also means that EVERYTHING CAN AUTOSCROLL NOW. Entrance shuffles are now much easier to track. Autoscroll is now also triggered on save, just in case someone isn't autosaving and has a lot of checks that get converted to saved. * Fixed missing GS check in LW. * Added area scroll on toggling Show Hidden Items. May configure differently later. Fixed area detection for entrances in Gerudo Fortress/Valley and Collossus. Haunted wasteland doesn't autoscroll due to a bug in `OnTransitionEnd` hook, but checks still evaluate properly there. Rely on scene-based area detection if scene is a main overworld or dungeon scene. * Fixed grotto detection when shuffle is off. * Small code cleanup. Fixed Colossus hand chest checks. * Missing lus bump from merge conflict resolution * Fixed Colossus Grotto making `GetCheckArea` return Wasteland. * Improved OnItemReceive processing for non-token GS checks, since they can sometimes take long enough for the checking process to time out before the item is registered as received. * First attempt at thread safety for tracker data file writing. Seems to work, but might need more testing. * Fixed Recheck Area not unskipping items that register as saved. Improved delayed saving with autosaving, as the autosave triggered quite often before the tracker data save, making things not properly register as saved. * merge cleanup * Converted check tracker data to the sectional saves, adding `CheckTrackerData` to `SaveContext`. Implemented section ID returning and fullSave boolean passing to section functions from my PR temporarily for it to work properly. Moved `RandomizerCheckTrackerData` enum to `randomizerTypes.h` to accommodate that. Changed `Randomizer_SaveInit` to a `SaveManager::InitFunc` to allow for other randomizer-dependent sections to be initialized after that. Required a little refactoring to maintain intro cutscene skip when starting a randomizer file. * Revert section index return and randomizer init changes. Will need to wait on yet more changes to main. * Fixed check tracker initialization (shouldn't be tied to window initialization), restored saving/loading functionality. * Removed `CheckTracker::Init` and put SaveManager calls in `CheckTrackerWindow::InitElement`. Also a bit of cleanup from transition back to save file use. * Fixed tracker displaying check categories while file not loaded. * Fix Darunia's Joy check not marking in vanilla. * Fix autosave not triggering change from collected to saved in tracker data. * Changed default colors for scummed and collected display. * Merge upgrade code cleanup. * Add `OnTransitionEnd` calls to sandstorm transitions both to and from Wasteland. Also improved `gSaveContext.lastScene` assignment for both transition types. Allowed a bit of cleanup in `GetCheckArea`. * Added `StateButton`, a button like `ArrowButton` but that allows text instead of arrow icons. Apparently the changes from ArrowButton to StateButton happened in a previous commit... * Changed section name to `trackerDataCheck` to force SoH to load it after the randomizer section, as it required some randoSettings to be loaded first, and nothing else I tried to make the randomizer section load before it worked. This hacks a solution to checks not displaying on fast file load to a specific slot. F*** you, SaveManager, and f*** you too, JSON. * Forgot to change the section string for loading with the name change. * Fix check ordering for checks that trigger the autosave. * Adds option to remove right-side shop items (slots 1-4) from the tracker list. Enabled by default. * Fix default state of Hide Shop Right Checks checkbox. * Fixes grotto and great fairy scrolling and checks. Fixes array overflow from `checkTrackerData` which was creating the issue trying to load the base and randomizer sections first, among other things. That also fixed the massive file loads that were being exhibited in debug mode. * Fix shooting galleries being set as collected again when being played a second time after getting the checks. * Fix Bazaar autoscroll. * Add Saria's Song to `GetCheckFromActor` and removed some limitations from the messageCloseCheck function to make that check track properly. * Fix Song from Impa check. Implemented prevention for multiple "collections" of great fairies, just in case getting the health refill would trigger it with the previous setup. * Fix ice traps on GS tokens not triggering OnItemReceive. * Complete fix for ice trap collection from GS. Add autoscroll when clicking "Expand All". * Add `OnShopSlotChange` with cursorSlot and basePrice parameters. * Fixed include in en_ossan for shop slot hook. Added registration for `OnShopSlotChange` in the tracker, storing the price in a new `price` field in `CheckTrackerData`. Added "seen" functionality to shop checks. Displays the model item name upon first entering a shop, adding the price and switching to trickName (if it's an ice trap) upon navigating to the slot in buy mode, triggered by an invisible "identified" status that mirrors "seen" in every other way. Added tooltips to most options for check tracker color picking to describe what each status actually means. * `std::format` pls * So apparently std::format just decided to break with the latest merge from develop, but fmt::format exists and works? * Removed the last vestiges of `locationsSkipped`. Other general code and formatting cleanups. Moved `IsGameRunning` to `OTRGlobals` so the item tracker could also access it. Used preceding to "fix" item and bottle display in the item tracker on startup. * Some more code cleanup. Removed "Recheck Area" button and relevant code. Backported changes to Anchor branch applicable for single-player, including making a checkAreas vector and structuring the frame by frame checks around that. Also includes fix for Silver Gauntlets and Mirror Shield check collection crash associated with those changes. Fixed Kakariko Bazaar "seen" updates. Fixed tracker window not showing on initial load like it should. * Forgot 1 formatting fix. * Removed conditions for showing Song from Impa (isn't junk under certain conditions, so should show all the time). * Fix vanilla checks, add Zelda's Letter and Malon's Egg to manual check collection. Fix autoscroll while in child stealth section. * Fix crash in Happy Mask Shop in OnSlotChange (referenced non-existent shop id in a tracker-specific enum). * General code cleanup. * Missed one reversion. * One more. * Fix column alignment in `randomizer_check_objects`. * Fix file encoding on `randomizer_check_tracker`. Again. * Fix indentation for `actualItemtrackerItemMap`. Also removed unnecessary parts of the map. * Rename `HasEqItem` to `HasEquipment`. * Slightly better indentation for `actualItemTrackerItemMap`. * Add magic bean salesman to vanilla check tracking, and genericized deku shield to trigger KF shop item 3 wherever you get the shield. Renamed `vanillaCheck` to `vanillaHundoCheck` to (supposedly) clarify the meaning of the usage. * One more rename to `vanillaCompletion` to avoid possible confusion with 100% speedrun conditions. * give me a break XD Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * Changes suggested by briaguya (rename `RandomizerCheckShow` to `Status`, unused code, newline formatting) * Remove unused `itemNames` table. * Remove `IsGameRunning` in favor of `GameInteractor::IsSaveLoaded`. * Restore anti-spoiler functionality for dungeons with dungeon maps. * Review cleanup. * Fix prices not showing for Kak bazaar items. --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com>
2023-10-04 11:03:36 -04:00
doAreaScroll = true;
Randomizer Auto Location tracker (#1942) * Initial Auto-Location Tracking * Updates styling for checked items in Check Tracker * Fixes crashing issues with Check Tracker rendering * Auto scroll Check Tracker windows to current area * Checks Tracker only shows checked locations once in game * Fixes issue where Check Tracker would auto-scroll to wrong location when entering a grotto * Fixes gerudo fortress checks showing in tracker when settings have them removed * InfTable Check Location Fixes: Lost Dog Richard, Rolling Gorons, HBA 1000, Thawed Zora * Fixes most Event Chk Inf Checks on Check Tracker, and Frogs * Check Tracker - Song from Malon now works * Check Tracker - Fixes Claim Check check not tracking - Fixes spoiler for Claim Check check when getting Biggoron's Sword - Fixes LACS being spoiled and not tracking * Check Tracker - Fixes #2 for Skull Mask and Mask of Truth checks * Check Tracker - Adds support for merchants - Fixes #7 for Bomchu Salesman - Fixes #12 for Medigoron * Check Tracker - Fixes #8 for Song from Saria * Check Tracker - Fixes #9 for Adult Shooting Gallery * Check Tracker - Fixes #10 for Composer Grave * Check Tracker - Fixes #14 for Song from Ocarina of Time * Check Tracker - Fixes #16 for Shooting the Sun * Check Tracker - Fixes #19 for Darunia's Joy * Save Editor - Adds missing label for Treasure Chest Game * Check Tracker - Fixes Great Faries checks * Check Tracker - Fixes Sheik at Temple * Check Tracker - Fixes Great Fairy auto-scroll to wrong location * Check Tracker - Updates blue warp checks - Fixes Bongo Bongo and Twinrova checks * Check Tracker - Fixes Dampe's Gravedigging Tour * Check Tracker - Fixes Prescription to King Zora * Check Tracker - Fixes Bazaar showing under wrong area on tracker between adult/child * Check Tracker - Fixes scroll for Hyrule Market and Bazaar * Check Tracker - Fixes giving Adult Trade Items shown on tracker: Broken Sword, Saw, Cojiro, Eyeball Froge, and Eyedrops * Cleans up item_location * Check Tracker - Item List - Fixes item list not updating when changing seeds/options - Separates item exclusion list from item check list - Clean up comments * Check Tracker - Adds Skip functionality to buttons * Check Tracker - Refactors adult trade items to RandomizerInf * Check Tracker - Fixes an issue where any time an item is removed the tracker would cause an application crash * Check Tracker - Item names are now dependent on file language * Check Tracker - Fixes Gerudo Card check not showing in Fast setting * Reorders headers to (hopefully) avoid CI build conflicts on linux/consoles * Explicitly defines vector header in randomizer.h to fix compile errors * Complete Refactor of Check Tracker ImGui * Adds missing check tracker files to CMakeLists * Reverts the Item_location whitespace cleanup from ad10807c * Check Tracker - Loading Fixes - Fixes a bug where loading a save file a second time would add all the checks again - Fixes a bug where the check tracker would not render at all until in a save file * Check Tracker - Fixes a bug where checks would sometimes fail to load * Check Tracker - Fixes duplicated checks when using Only on Pause or Only on Combo * Check Tracker - Works around issue where single characters don't show in EnhancementCombobox, and fixes a label for combo buttons held option * Check Tracker - Applies all Check Tracker changes to Item Location * Check Tracker - Updated Check List - Adds Link's pocket, either in KF or HM depending on starting age - Supports Scrubs and Merchants - Uses enums instead of magic numbers - Updates DC Scrub Short Names for MQ * Check Tracker - Adds a performance mode option * Check Tracker - List Fixes (requires new rando generation) - Fixes Frogs Rupees always visible - Fixes Kokiri Sword Chest not showing - Fixes Weird Egg not showing * Check Tracker - MQ List basic support * Check Tracker - MQ/Vanilla anti-spoilers * Check Tracker - Collecting a compass now spoils the area * Check Tracker - Basic Vanilla Support and fixes - Vanilla items show in check tracker, even if many won't auto check - Fixes an issue with Gerudo Fortress Keys - Refactors IsVisibleInCheckTracker to randomizer_check_tracjer * Check Tracker - Fixes merge conflict from 08a487f35e1d760ab9e69b932edbe4da6bcd9edb * Check Tracker - Fixes tracker loading as Floating when default value is set to Windowed * Randomizer Location Exclusion List - Adds Scrubs, Merchants, Shops. Adult Trade items, MQ Dungeons, and Bean Salesman - Fixes Kokiri Sword Chest, Weird Egg, and Frog Song Rupees from misbehaving - Updates Gerudo Fortress logic to be dependent on Open/Fast/Normal Fortress - Removes Invalid Check - Adds RO Enum for MQ settings - Updates magic values to RO enum * Location Exclusion List - Scrubs that are always randomized now always show on the list * For now, removes some extra code only needed for a Check Tracker. * Randomizer Location Exclusion List - Fixes Eyeball Frog from showing up when Adult Trade Items was off * Location Tracker - Updates Eyedrops to use RandomizerInf instead of Chest * Check Tracker - Fixes a bug where Link's Pocket item wasn't acting as checked for area item count * Check Tracker - Fixes a bug where Locations would incorrectly say Vanilla due to the first check in the area being a non-MQ check * Check Tracker - Fixes a crash when Check Tracker is docked but not visible * Check Tracker - Fixes areas being spoiled when loading different save files * Check Tracker - Only reset variables if they are initialized * Check Tracker - Cleans up old comments, unused variables, methods, and macros, adds language TODOs, * Check Tracker - Readds rainbow UI elements after Cosmetics Editor refactor * Check Tracker - Removal of flag lookup that was refactored, no longer needed header, and some trivial whitespace fixes. * Check Tracker - Refactors Index to Bitmask code to a macro * Check Tracker - Changes ordering from alphabetical to RandomizerCheck ordering * Check Tracker - Wraps everything in a namespace to avoid global variable usage * Check Tracker - Explicitly defines for-loop scope * Check Tracker - refactors dungeon lookup from static array to function * Fixes a bug when using EnhancementColor with alpha * Check Tracker - Refactors all colour to use direct conversions * Check Tracker - refactors settings loading and check visibility for readability * Check Tracker - Fixes a bug where the wrong label showed on the Check Tracker BG Color * UIWidgets - Adds Alpha bar to EnhancementColor when using alpha parameter
2022-12-10 22:39:23 -05:00
}
ImGui::SameLine();
if (ImGui::Button("Collapse All")) {
optExpandAll = false;
optCollapseAll = true;
}
UIWidgets::PaddedSeparator();
//Checks Section Lead-in
ImGui::TableNextRow();
ImGui::TableNextColumn();
size = ImGui::GetContentRegionAvail();
if (!ImGui::BeginTable("CheckTracker##Checks", 1, ImGuiTableFlags_ScrollY, size)) {
ImGui::EndTable();
EndFloatWindows();
return;
}
ImGui::TableNextRow();
ImGui::TableNextColumn();
//Prep for loop
RainbowTick();
bool doDraw = false;
bool thisAreaFullyChecked = false;
bool showHidden = CVarGetInteger("gCheckTrackerOptionShowHidden", 0);
bool hideIncomplete = CVarGetInteger("gCheckTrackerAreaIncompleteHide", 0);
bool hideComplete = CVarGetInteger("gCheckTrackerAreaCompleteHide", 0);
Randomizer Auto Location tracker (#1942) * Initial Auto-Location Tracking * Updates styling for checked items in Check Tracker * Fixes crashing issues with Check Tracker rendering * Auto scroll Check Tracker windows to current area * Checks Tracker only shows checked locations once in game * Fixes issue where Check Tracker would auto-scroll to wrong location when entering a grotto * Fixes gerudo fortress checks showing in tracker when settings have them removed * InfTable Check Location Fixes: Lost Dog Richard, Rolling Gorons, HBA 1000, Thawed Zora * Fixes most Event Chk Inf Checks on Check Tracker, and Frogs * Check Tracker - Song from Malon now works * Check Tracker - Fixes Claim Check check not tracking - Fixes spoiler for Claim Check check when getting Biggoron's Sword - Fixes LACS being spoiled and not tracking * Check Tracker - Fixes #2 for Skull Mask and Mask of Truth checks * Check Tracker - Adds support for merchants - Fixes #7 for Bomchu Salesman - Fixes #12 for Medigoron * Check Tracker - Fixes #8 for Song from Saria * Check Tracker - Fixes #9 for Adult Shooting Gallery * Check Tracker - Fixes #10 for Composer Grave * Check Tracker - Fixes #14 for Song from Ocarina of Time * Check Tracker - Fixes #16 for Shooting the Sun * Check Tracker - Fixes #19 for Darunia's Joy * Save Editor - Adds missing label for Treasure Chest Game * Check Tracker - Fixes Great Faries checks * Check Tracker - Fixes Sheik at Temple * Check Tracker - Fixes Great Fairy auto-scroll to wrong location * Check Tracker - Updates blue warp checks - Fixes Bongo Bongo and Twinrova checks * Check Tracker - Fixes Dampe's Gravedigging Tour * Check Tracker - Fixes Prescription to King Zora * Check Tracker - Fixes Bazaar showing under wrong area on tracker between adult/child * Check Tracker - Fixes scroll for Hyrule Market and Bazaar * Check Tracker - Fixes giving Adult Trade Items shown on tracker: Broken Sword, Saw, Cojiro, Eyeball Froge, and Eyedrops * Cleans up item_location * Check Tracker - Item List - Fixes item list not updating when changing seeds/options - Separates item exclusion list from item check list - Clean up comments * Check Tracker - Adds Skip functionality to buttons * Check Tracker - Refactors adult trade items to RandomizerInf * Check Tracker - Fixes an issue where any time an item is removed the tracker would cause an application crash * Check Tracker - Item names are now dependent on file language * Check Tracker - Fixes Gerudo Card check not showing in Fast setting * Reorders headers to (hopefully) avoid CI build conflicts on linux/consoles * Explicitly defines vector header in randomizer.h to fix compile errors * Complete Refactor of Check Tracker ImGui * Adds missing check tracker files to CMakeLists * Reverts the Item_location whitespace cleanup from ad10807c * Check Tracker - Loading Fixes - Fixes a bug where loading a save file a second time would add all the checks again - Fixes a bug where the check tracker would not render at all until in a save file * Check Tracker - Fixes a bug where checks would sometimes fail to load * Check Tracker - Fixes duplicated checks when using Only on Pause or Only on Combo * Check Tracker - Works around issue where single characters don't show in EnhancementCombobox, and fixes a label for combo buttons held option * Check Tracker - Applies all Check Tracker changes to Item Location * Check Tracker - Updated Check List - Adds Link's pocket, either in KF or HM depending on starting age - Supports Scrubs and Merchants - Uses enums instead of magic numbers - Updates DC Scrub Short Names for MQ * Check Tracker - Adds a performance mode option * Check Tracker - List Fixes (requires new rando generation) - Fixes Frogs Rupees always visible - Fixes Kokiri Sword Chest not showing - Fixes Weird Egg not showing * Check Tracker - MQ List basic support * Check Tracker - MQ/Vanilla anti-spoilers * Check Tracker - Collecting a compass now spoils the area * Check Tracker - Basic Vanilla Support and fixes - Vanilla items show in check tracker, even if many won't auto check - Fixes an issue with Gerudo Fortress Keys - Refactors IsVisibleInCheckTracker to randomizer_check_tracjer * Check Tracker - Fixes merge conflict from 08a487f35e1d760ab9e69b932edbe4da6bcd9edb * Check Tracker - Fixes tracker loading as Floating when default value is set to Windowed * Randomizer Location Exclusion List - Adds Scrubs, Merchants, Shops. Adult Trade items, MQ Dungeons, and Bean Salesman - Fixes Kokiri Sword Chest, Weird Egg, and Frog Song Rupees from misbehaving - Updates Gerudo Fortress logic to be dependent on Open/Fast/Normal Fortress - Removes Invalid Check - Adds RO Enum for MQ settings - Updates magic values to RO enum * Location Exclusion List - Scrubs that are always randomized now always show on the list * For now, removes some extra code only needed for a Check Tracker. * Randomizer Location Exclusion List - Fixes Eyeball Frog from showing up when Adult Trade Items was off * Location Tracker - Updates Eyedrops to use RandomizerInf instead of Chest * Check Tracker - Fixes a bug where Link's Pocket item wasn't acting as checked for area item count * Check Tracker - Fixes a bug where Locations would incorrectly say Vanilla due to the first check in the area being a non-MQ check * Check Tracker - Fixes a crash when Check Tracker is docked but not visible * Check Tracker - Fixes areas being spoiled when loading different save files * Check Tracker - Only reset variables if they are initialized * Check Tracker - Cleans up old comments, unused variables, methods, and macros, adds language TODOs, * Check Tracker - Readds rainbow UI elements after Cosmetics Editor refactor * Check Tracker - Removal of flag lookup that was refactored, no longer needed header, and some trivial whitespace fixes. * Check Tracker - Refactors Index to Bitmask code to a macro * Check Tracker - Changes ordering from alphabetical to RandomizerCheck ordering * Check Tracker - Wraps everything in a namespace to avoid global variable usage * Check Tracker - Explicitly defines for-loop scope * Check Tracker - refactors dungeon lookup from static array to function * Fixes a bug when using EnhancementColor with alpha * Check Tracker - Refactors all colour to use direct conversions * Check Tracker - refactors settings loading and check visibility for readability * Check Tracker - Fixes a bug where the wrong label showed on the Check Tracker BG Color * UIWidgets - Adds Alpha bar to EnhancementColor when using alpha parameter
2022-12-10 22:39:23 -05:00
bool collapseLogic;
bool doingCollapseOrExpand = optExpandAll || optCollapseAll;
bool isThisAreaSpoiled;
RandomizerCheckArea lastArea = RCAREA_INVALID;
Color_RGBA8 areaCompleteColor = CVarGetColor("gCheckTrackerAreaMainCompleteColor", Color_Main_Default);
Color_RGBA8 areaIncompleteColor = CVarGetColor("gCheckTrackerAreaMainIncompleteColor", Color_Main_Default);
Color_RGBA8 extraCompleteColor = CVarGetColor("gCheckTrackerAreaExtraCompleteColor", Color_Area_Complete_Extra_Default);
Color_RGBA8 extraIncompleteColor = CVarGetColor("gCheckTrackerAreaExtraIncompleteColor", Color_Area_Incomplete_Extra_Default);
Randomizer Auto Location tracker (#1942) * Initial Auto-Location Tracking * Updates styling for checked items in Check Tracker * Fixes crashing issues with Check Tracker rendering * Auto scroll Check Tracker windows to current area * Checks Tracker only shows checked locations once in game * Fixes issue where Check Tracker would auto-scroll to wrong location when entering a grotto * Fixes gerudo fortress checks showing in tracker when settings have them removed * InfTable Check Location Fixes: Lost Dog Richard, Rolling Gorons, HBA 1000, Thawed Zora * Fixes most Event Chk Inf Checks on Check Tracker, and Frogs * Check Tracker - Song from Malon now works * Check Tracker - Fixes Claim Check check not tracking - Fixes spoiler for Claim Check check when getting Biggoron's Sword - Fixes LACS being spoiled and not tracking * Check Tracker - Fixes #2 for Skull Mask and Mask of Truth checks * Check Tracker - Adds support for merchants - Fixes #7 for Bomchu Salesman - Fixes #12 for Medigoron * Check Tracker - Fixes #8 for Song from Saria * Check Tracker - Fixes #9 for Adult Shooting Gallery * Check Tracker - Fixes #10 for Composer Grave * Check Tracker - Fixes #14 for Song from Ocarina of Time * Check Tracker - Fixes #16 for Shooting the Sun * Check Tracker - Fixes #19 for Darunia's Joy * Save Editor - Adds missing label for Treasure Chest Game * Check Tracker - Fixes Great Faries checks * Check Tracker - Fixes Sheik at Temple * Check Tracker - Fixes Great Fairy auto-scroll to wrong location * Check Tracker - Updates blue warp checks - Fixes Bongo Bongo and Twinrova checks * Check Tracker - Fixes Dampe's Gravedigging Tour * Check Tracker - Fixes Prescription to King Zora * Check Tracker - Fixes Bazaar showing under wrong area on tracker between adult/child * Check Tracker - Fixes scroll for Hyrule Market and Bazaar * Check Tracker - Fixes giving Adult Trade Items shown on tracker: Broken Sword, Saw, Cojiro, Eyeball Froge, and Eyedrops * Cleans up item_location * Check Tracker - Item List - Fixes item list not updating when changing seeds/options - Separates item exclusion list from item check list - Clean up comments * Check Tracker - Adds Skip functionality to buttons * Check Tracker - Refactors adult trade items to RandomizerInf * Check Tracker - Fixes an issue where any time an item is removed the tracker would cause an application crash * Check Tracker - Item names are now dependent on file language * Check Tracker - Fixes Gerudo Card check not showing in Fast setting * Reorders headers to (hopefully) avoid CI build conflicts on linux/consoles * Explicitly defines vector header in randomizer.h to fix compile errors * Complete Refactor of Check Tracker ImGui * Adds missing check tracker files to CMakeLists * Reverts the Item_location whitespace cleanup from ad10807c * Check Tracker - Loading Fixes - Fixes a bug where loading a save file a second time would add all the checks again - Fixes a bug where the check tracker would not render at all until in a save file * Check Tracker - Fixes a bug where checks would sometimes fail to load * Check Tracker - Fixes duplicated checks when using Only on Pause or Only on Combo * Check Tracker - Works around issue where single characters don't show in EnhancementCombobox, and fixes a label for combo buttons held option * Check Tracker - Applies all Check Tracker changes to Item Location * Check Tracker - Updated Check List - Adds Link's pocket, either in KF or HM depending on starting age - Supports Scrubs and Merchants - Uses enums instead of magic numbers - Updates DC Scrub Short Names for MQ * Check Tracker - Adds a performance mode option * Check Tracker - List Fixes (requires new rando generation) - Fixes Frogs Rupees always visible - Fixes Kokiri Sword Chest not showing - Fixes Weird Egg not showing * Check Tracker - MQ List basic support * Check Tracker - MQ/Vanilla anti-spoilers * Check Tracker - Collecting a compass now spoils the area * Check Tracker - Basic Vanilla Support and fixes - Vanilla items show in check tracker, even if many won't auto check - Fixes an issue with Gerudo Fortress Keys - Refactors IsVisibleInCheckTracker to randomizer_check_tracjer * Check Tracker - Fixes merge conflict from 08a487f35e1d760ab9e69b932edbe4da6bcd9edb * Check Tracker - Fixes tracker loading as Floating when default value is set to Windowed * Randomizer Location Exclusion List - Adds Scrubs, Merchants, Shops. Adult Trade items, MQ Dungeons, and Bean Salesman - Fixes Kokiri Sword Chest, Weird Egg, and Frog Song Rupees from misbehaving - Updates Gerudo Fortress logic to be dependent on Open/Fast/Normal Fortress - Removes Invalid Check - Adds RO Enum for MQ settings - Updates magic values to RO enum * Location Exclusion List - Scrubs that are always randomized now always show on the list * For now, removes some extra code only needed for a Check Tracker. * Randomizer Location Exclusion List - Fixes Eyeball Frog from showing up when Adult Trade Items was off * Location Tracker - Updates Eyedrops to use RandomizerInf instead of Chest * Check Tracker - Fixes a bug where Link's Pocket item wasn't acting as checked for area item count * Check Tracker - Fixes a bug where Locations would incorrectly say Vanilla due to the first check in the area being a non-MQ check * Check Tracker - Fixes a crash when Check Tracker is docked but not visible * Check Tracker - Fixes areas being spoiled when loading different save files * Check Tracker - Only reset variables if they are initialized * Check Tracker - Cleans up old comments, unused variables, methods, and macros, adds language TODOs, * Check Tracker - Readds rainbow UI elements after Cosmetics Editor refactor * Check Tracker - Removal of flag lookup that was refactored, no longer needed header, and some trivial whitespace fixes. * Check Tracker - Refactors Index to Bitmask code to a macro * Check Tracker - Changes ordering from alphabetical to RandomizerCheck ordering * Check Tracker - Wraps everything in a namespace to avoid global variable usage * Check Tracker - Explicitly defines for-loop scope * Check Tracker - refactors dungeon lookup from static array to function * Fixes a bug when using EnhancementColor with alpha * Check Tracker - Refactors all colour to use direct conversions * Check Tracker - refactors settings loading and check visibility for readability * Check Tracker - Fixes a bug where the wrong label showed on the Check Tracker BG Color * UIWidgets - Adds Alpha bar to EnhancementColor when using alpha parameter
2022-12-10 22:39:23 -05:00
Color_RGBA8 mainColor;
Color_RGBA8 extraColor;
std::string stemp;
s32 areaMask = 1;
Check Tracker Update (#2668) * Initial commit. What works so far: Data file loads, saves, deletes, and is created properly. - Need to run `HasItemBeenCollected` when creating in case of mid-seed regen. Organized checks into maps set by area. Areas show in tracker. - Checks pulled from checkObjectsByArea are not currently listed. - Areas are being assumed completed and hidden at the start. * Checks now populate. Still not counting area totals properly. * Don't track RC_LINKS_POCKET in the data file, and instead manually add it in every time a save is load. rcObjects doesn't contain Link's Pocket location (duh). * Moved ItemReceive hook to randomizer_check_tracker.cpp. Skipped items are properly sorted and formatted. Saved items contribute to an area's gotten/skipped checks on load. Changed skipped items default main color to gray. General code cleanup. * Skipped checks now contribute to area totals for area completion logic. * Mid-menu rework transfer. * Started check lookup on item receive. Tried to enable scum checking on save. * Fixed scum check on save. * More code cleanup, which revealed some issues with loading and saving. Loading now works 100%, but entries in checkTrackerData are disappearing in code somewhere, causing issues with later checks. Scummed color now displays properly. Collected but unsaved displays properly. Unchecked, Skipped, Seen and Scummed checks all have arrows for skipping/unskipping. Counts a little messed up, probably double adding skips. * Fixed item counts being off across resets. Restarts were fine. * Beginning of rework for individual check updates. Adds `Actor lastCheck` to PlayState to allow assigning of last actor to give an item. This allows precise tracking of GS, freestanding PoH, etc. Works for chests too. Currently does not work for shops, unknown for normal NPC gives. Doesn't track last gives for non-checks, like drops from grass, pots, crates, etc. * Actor-based checks fully fleshed out, but can't help with sale-based checks. Implemented `pendingSaleCheck` to back out of an RC check cycle if `gSaveContext->pendingSale` is not NONE when `OnItemReceive` is called, processed through `OnSaleEnd`. This should be the final change necessary to streamline the checks. * Temporary hook to message box close to tie in trackers for non-gs/chest actors that aren't added to `GetCheckFromActor`. This triggers a 2-frame countdown to check with `HasItemBeenCollected` since half of the methods in there aren't updated until after a text box closes. Added scene tracking to get last scene so that checks in scenes that span several overworld areas could be tied to their areas properly. Modified tracker data creation to apply Link's Pocket and Song from Impa conditionally based on randomizer settings instead of just being assumed to be done. May need modification for checking click and drag spoiler loading. Removed the scene equivalence check from CheckChecks so that an entire area is checked each time to avoid issues with, e.g., leaving a shop before a pending sale finishes. * Changed check data creation to use RSKs from gRandomizer to account for settings loaded from drag and drop spoilers. * Beginning of tracker code organization. Changed check color defaults. * Reverted moving tracker colors to header. Some individual check fixes. * Missed something from previous merge? * Removed last remnant of removed performance mode. * Better handle checking when skullsanity is off. * Song checks sceneIDs don't match the scenes they're actually in for some reason. Removed that check. * SaleEnd checks don't need the GetItemEntry parameter. Also set a flag that should prevent the check tracker from running during vanilla saves should that not be resolved by the time it's merged. * Attempting to have only the relevant checks added to the tracker data, as well as showing vanilla checks for non-rando saves. Not working yet (everything is displayed in vanilla). * Added vanilla check tracker population via `vanillaCheck` bool in `RandomizerCheckObject`. This is also added to `IsVisibleInImGui` to handle file loading and saving to eliminate checks that aren't part of vanilla or the rando seed. Implemented deleted tracker data file recreation. Added some extra item name text checks. Songs are still... tricky, so they stay blank. Utilize local copies of the randomizer check objects that are applicable for performance purposes. Fixed vanilla item-giving cutscene crashes when triggered mid-transition. * Apparently not all toolchains can handle macro instantiation without all parameters, like VS can. * Fixed scummed detail color not showing properly on tracker. * Fixed dungeon area totals and GS checks not functioning properly. * Major revamp of checking code. Doesn't rely on `GetCheckFromActor` at all anymore, but instead simply sets a flag to evaluate a number of checks in an area every frame until the check that was gotten is identified. With the new setup, it's much less hardware intensive, and at 60fps 6 checks per frame shows no noticeable effect on framerate. I can envision needing to add a collectedCount in order to account for times when two checks are gotten one right after the other. Changed area scroll to happen from `OnTransitionEnd`, and allow for scrolling in bazaar (was disabled previously because it would jump back and forth between Kak and Market while you were in one). Also setup area check order updating by area instead of all at the same time. * Fixed shooting gallery not reporting proper area. Prevent checks from actually happening if area is RCAREA_INVALID, now that all areas are reporting something if they have checks. Fixed `GetCheckArea()` not updating checks for standard scenes. Lots of vanilla tracking updates, mainly manual checks for gems, medallions and songs, since the often don't have proper scenes in the data. Prevent vanilla from triggering check loops if junk items are collected. Fixed sorting based on saved vs collected. Prevent item name display for vanilla runs. Change coloring of checks so the check name reflects status in vanilla runs. * Fixed "Recheck Area" button erroneously adding to an area's check totals? * Fix DMC vanilla checks. * Fix check tracker data recreation on data file loss. Removed redundant file exists check from SaveTrackerDataHook, as it doesn't matter if it exists or not at that point. Limited check loops to 3 to avoid infinite check loops on non-check/junk item pickup. Added more checks to disable tracker operations if a save is not running. Changed check ordering to put boss reward and heart container checks at the end of whatever RCSHOW group they belong to. * Fixed IsRunning calculation. Further improving vanilla checking. Starting framework for checking medallions, stones, and songs on data file recreation. Fixed medallion check collection. Added GIFT_FROM_SAGES to check list for vanilla file for tracking light medallion. Added check loop limitation to prevent infinite checking after picking up junk item from the ground. * Finished vanilla file recreation and recheck (songs and dungeon rewards all check properly now). This includes deku shield with KF shop item 3. Finished Gift from Raoru light medallion tracking for vanilla. Commented all CheckByScene functionality for now. * Fixed new save data file creation. Disabled entrance area calculation for now, as it only tracks the previous entrance for some reason. Fixed area detection for ToT checks. * GetCheckArea() now utilizes EntranceData almost exclusively, via either `gSaveContext.entranceIndex` or the entrance tracker's `currentGrottoId` in the case of grottos. This also means that EVERYTHING CAN AUTOSCROLL NOW. Entrance shuffles are now much easier to track. Autoscroll is now also triggered on save, just in case someone isn't autosaving and has a lot of checks that get converted to saved. * Fixed missing GS check in LW. * Added area scroll on toggling Show Hidden Items. May configure differently later. Fixed area detection for entrances in Gerudo Fortress/Valley and Collossus. Haunted wasteland doesn't autoscroll due to a bug in `OnTransitionEnd` hook, but checks still evaluate properly there. Rely on scene-based area detection if scene is a main overworld or dungeon scene. * Fixed grotto detection when shuffle is off. * Small code cleanup. Fixed Colossus hand chest checks. * Missing lus bump from merge conflict resolution * Fixed Colossus Grotto making `GetCheckArea` return Wasteland. * Improved OnItemReceive processing for non-token GS checks, since they can sometimes take long enough for the checking process to time out before the item is registered as received. * First attempt at thread safety for tracker data file writing. Seems to work, but might need more testing. * Fixed Recheck Area not unskipping items that register as saved. Improved delayed saving with autosaving, as the autosave triggered quite often before the tracker data save, making things not properly register as saved. * merge cleanup * Converted check tracker data to the sectional saves, adding `CheckTrackerData` to `SaveContext`. Implemented section ID returning and fullSave boolean passing to section functions from my PR temporarily for it to work properly. Moved `RandomizerCheckTrackerData` enum to `randomizerTypes.h` to accommodate that. Changed `Randomizer_SaveInit` to a `SaveManager::InitFunc` to allow for other randomizer-dependent sections to be initialized after that. Required a little refactoring to maintain intro cutscene skip when starting a randomizer file. * Revert section index return and randomizer init changes. Will need to wait on yet more changes to main. * Fixed check tracker initialization (shouldn't be tied to window initialization), restored saving/loading functionality. * Removed `CheckTracker::Init` and put SaveManager calls in `CheckTrackerWindow::InitElement`. Also a bit of cleanup from transition back to save file use. * Fixed tracker displaying check categories while file not loaded. * Fix Darunia's Joy check not marking in vanilla. * Fix autosave not triggering change from collected to saved in tracker data. * Changed default colors for scummed and collected display. * Merge upgrade code cleanup. * Add `OnTransitionEnd` calls to sandstorm transitions both to and from Wasteland. Also improved `gSaveContext.lastScene` assignment for both transition types. Allowed a bit of cleanup in `GetCheckArea`. * Added `StateButton`, a button like `ArrowButton` but that allows text instead of arrow icons. Apparently the changes from ArrowButton to StateButton happened in a previous commit... * Changed section name to `trackerDataCheck` to force SoH to load it after the randomizer section, as it required some randoSettings to be loaded first, and nothing else I tried to make the randomizer section load before it worked. This hacks a solution to checks not displaying on fast file load to a specific slot. F*** you, SaveManager, and f*** you too, JSON. * Forgot to change the section string for loading with the name change. * Fix check ordering for checks that trigger the autosave. * Adds option to remove right-side shop items (slots 1-4) from the tracker list. Enabled by default. * Fix default state of Hide Shop Right Checks checkbox. * Fixes grotto and great fairy scrolling and checks. Fixes array overflow from `checkTrackerData` which was creating the issue trying to load the base and randomizer sections first, among other things. That also fixed the massive file loads that were being exhibited in debug mode. * Fix shooting galleries being set as collected again when being played a second time after getting the checks. * Fix Bazaar autoscroll. * Add Saria's Song to `GetCheckFromActor` and removed some limitations from the messageCloseCheck function to make that check track properly. * Fix Song from Impa check. Implemented prevention for multiple "collections" of great fairies, just in case getting the health refill would trigger it with the previous setup. * Fix ice traps on GS tokens not triggering OnItemReceive. * Complete fix for ice trap collection from GS. Add autoscroll when clicking "Expand All". * Add `OnShopSlotChange` with cursorSlot and basePrice parameters. * Fixed include in en_ossan for shop slot hook. Added registration for `OnShopSlotChange` in the tracker, storing the price in a new `price` field in `CheckTrackerData`. Added "seen" functionality to shop checks. Displays the model item name upon first entering a shop, adding the price and switching to trickName (if it's an ice trap) upon navigating to the slot in buy mode, triggered by an invisible "identified" status that mirrors "seen" in every other way. Added tooltips to most options for check tracker color picking to describe what each status actually means. * `std::format` pls * So apparently std::format just decided to break with the latest merge from develop, but fmt::format exists and works? * Removed the last vestiges of `locationsSkipped`. Other general code and formatting cleanups. Moved `IsGameRunning` to `OTRGlobals` so the item tracker could also access it. Used preceding to "fix" item and bottle display in the item tracker on startup. * Some more code cleanup. Removed "Recheck Area" button and relevant code. Backported changes to Anchor branch applicable for single-player, including making a checkAreas vector and structuring the frame by frame checks around that. Also includes fix for Silver Gauntlets and Mirror Shield check collection crash associated with those changes. Fixed Kakariko Bazaar "seen" updates. Fixed tracker window not showing on initial load like it should. * Forgot 1 formatting fix. * Removed conditions for showing Song from Impa (isn't junk under certain conditions, so should show all the time). * Fix vanilla checks, add Zelda's Letter and Malon's Egg to manual check collection. Fix autoscroll while in child stealth section. * Fix crash in Happy Mask Shop in OnSlotChange (referenced non-existent shop id in a tracker-specific enum). * General code cleanup. * Missed one reversion. * One more. * Fix column alignment in `randomizer_check_objects`. * Fix file encoding on `randomizer_check_tracker`. Again. * Fix indentation for `actualItemtrackerItemMap`. Also removed unnecessary parts of the map. * Rename `HasEqItem` to `HasEquipment`. * Slightly better indentation for `actualItemTrackerItemMap`. * Add magic bean salesman to vanilla check tracking, and genericized deku shield to trigger KF shop item 3 wherever you get the shield. Renamed `vanillaCheck` to `vanillaHundoCheck` to (supposedly) clarify the meaning of the usage. * One more rename to `vanillaCompletion` to avoid possible confusion with 100% speedrun conditions. * give me a break XD Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * Changes suggested by briaguya (rename `RandomizerCheckShow` to `Status`, unused code, newline formatting) * Remove unused `itemNames` table. * Remove `IsGameRunning` in favor of `GameInteractor::IsSaveLoaded`. * Restore anti-spoiler functionality for dungeons with dungeon maps. * Review cleanup. * Fix prices not showing for Kak bazaar items. --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com>
2023-10-04 11:03:36 -04:00
for (auto& [rcArea, objs] : checksByArea) {
RandomizerCheckArea thisArea = currentArea;
Randomizer Auto Location tracker (#1942) * Initial Auto-Location Tracking * Updates styling for checked items in Check Tracker * Fixes crashing issues with Check Tracker rendering * Auto scroll Check Tracker windows to current area * Checks Tracker only shows checked locations once in game * Fixes issue where Check Tracker would auto-scroll to wrong location when entering a grotto * Fixes gerudo fortress checks showing in tracker when settings have them removed * InfTable Check Location Fixes: Lost Dog Richard, Rolling Gorons, HBA 1000, Thawed Zora * Fixes most Event Chk Inf Checks on Check Tracker, and Frogs * Check Tracker - Song from Malon now works * Check Tracker - Fixes Claim Check check not tracking - Fixes spoiler for Claim Check check when getting Biggoron's Sword - Fixes LACS being spoiled and not tracking * Check Tracker - Fixes #2 for Skull Mask and Mask of Truth checks * Check Tracker - Adds support for merchants - Fixes #7 for Bomchu Salesman - Fixes #12 for Medigoron * Check Tracker - Fixes #8 for Song from Saria * Check Tracker - Fixes #9 for Adult Shooting Gallery * Check Tracker - Fixes #10 for Composer Grave * Check Tracker - Fixes #14 for Song from Ocarina of Time * Check Tracker - Fixes #16 for Shooting the Sun * Check Tracker - Fixes #19 for Darunia's Joy * Save Editor - Adds missing label for Treasure Chest Game * Check Tracker - Fixes Great Faries checks * Check Tracker - Fixes Sheik at Temple * Check Tracker - Fixes Great Fairy auto-scroll to wrong location * Check Tracker - Updates blue warp checks - Fixes Bongo Bongo and Twinrova checks * Check Tracker - Fixes Dampe's Gravedigging Tour * Check Tracker - Fixes Prescription to King Zora * Check Tracker - Fixes Bazaar showing under wrong area on tracker between adult/child * Check Tracker - Fixes scroll for Hyrule Market and Bazaar * Check Tracker - Fixes giving Adult Trade Items shown on tracker: Broken Sword, Saw, Cojiro, Eyeball Froge, and Eyedrops * Cleans up item_location * Check Tracker - Item List - Fixes item list not updating when changing seeds/options - Separates item exclusion list from item check list - Clean up comments * Check Tracker - Adds Skip functionality to buttons * Check Tracker - Refactors adult trade items to RandomizerInf * Check Tracker - Fixes an issue where any time an item is removed the tracker would cause an application crash * Check Tracker - Item names are now dependent on file language * Check Tracker - Fixes Gerudo Card check not showing in Fast setting * Reorders headers to (hopefully) avoid CI build conflicts on linux/consoles * Explicitly defines vector header in randomizer.h to fix compile errors * Complete Refactor of Check Tracker ImGui * Adds missing check tracker files to CMakeLists * Reverts the Item_location whitespace cleanup from ad10807c * Check Tracker - Loading Fixes - Fixes a bug where loading a save file a second time would add all the checks again - Fixes a bug where the check tracker would not render at all until in a save file * Check Tracker - Fixes a bug where checks would sometimes fail to load * Check Tracker - Fixes duplicated checks when using Only on Pause or Only on Combo * Check Tracker - Works around issue where single characters don't show in EnhancementCombobox, and fixes a label for combo buttons held option * Check Tracker - Applies all Check Tracker changes to Item Location * Check Tracker - Updated Check List - Adds Link's pocket, either in KF or HM depending on starting age - Supports Scrubs and Merchants - Uses enums instead of magic numbers - Updates DC Scrub Short Names for MQ * Check Tracker - Adds a performance mode option * Check Tracker - List Fixes (requires new rando generation) - Fixes Frogs Rupees always visible - Fixes Kokiri Sword Chest not showing - Fixes Weird Egg not showing * Check Tracker - MQ List basic support * Check Tracker - MQ/Vanilla anti-spoilers * Check Tracker - Collecting a compass now spoils the area * Check Tracker - Basic Vanilla Support and fixes - Vanilla items show in check tracker, even if many won't auto check - Fixes an issue with Gerudo Fortress Keys - Refactors IsVisibleInCheckTracker to randomizer_check_tracjer * Check Tracker - Fixes merge conflict from 08a487f35e1d760ab9e69b932edbe4da6bcd9edb * Check Tracker - Fixes tracker loading as Floating when default value is set to Windowed * Randomizer Location Exclusion List - Adds Scrubs, Merchants, Shops. Adult Trade items, MQ Dungeons, and Bean Salesman - Fixes Kokiri Sword Chest, Weird Egg, and Frog Song Rupees from misbehaving - Updates Gerudo Fortress logic to be dependent on Open/Fast/Normal Fortress - Removes Invalid Check - Adds RO Enum for MQ settings - Updates magic values to RO enum * Location Exclusion List - Scrubs that are always randomized now always show on the list * For now, removes some extra code only needed for a Check Tracker. * Randomizer Location Exclusion List - Fixes Eyeball Frog from showing up when Adult Trade Items was off * Location Tracker - Updates Eyedrops to use RandomizerInf instead of Chest * Check Tracker - Fixes a bug where Link's Pocket item wasn't acting as checked for area item count * Check Tracker - Fixes a bug where Locations would incorrectly say Vanilla due to the first check in the area being a non-MQ check * Check Tracker - Fixes a crash when Check Tracker is docked but not visible * Check Tracker - Fixes areas being spoiled when loading different save files * Check Tracker - Only reset variables if they are initialized * Check Tracker - Cleans up old comments, unused variables, methods, and macros, adds language TODOs, * Check Tracker - Readds rainbow UI elements after Cosmetics Editor refactor * Check Tracker - Removal of flag lookup that was refactored, no longer needed header, and some trivial whitespace fixes. * Check Tracker - Refactors Index to Bitmask code to a macro * Check Tracker - Changes ordering from alphabetical to RandomizerCheck ordering * Check Tracker - Wraps everything in a namespace to avoid global variable usage * Check Tracker - Explicitly defines for-loop scope * Check Tracker - refactors dungeon lookup from static array to function * Fixes a bug when using EnhancementColor with alpha * Check Tracker - Refactors all colour to use direct conversions * Check Tracker - refactors settings loading and check visibility for readability * Check Tracker - Fixes a bug where the wrong label showed on the Check Tracker BG Color * UIWidgets - Adds Alpha bar to EnhancementColor when using alpha parameter
2022-12-10 22:39:23 -05:00
thisAreaFullyChecked = (areaChecksGotten[rcArea] == areaCheckTotals[rcArea]);
Check Tracker Update (#2668) * Initial commit. What works so far: Data file loads, saves, deletes, and is created properly. - Need to run `HasItemBeenCollected` when creating in case of mid-seed regen. Organized checks into maps set by area. Areas show in tracker. - Checks pulled from checkObjectsByArea are not currently listed. - Areas are being assumed completed and hidden at the start. * Checks now populate. Still not counting area totals properly. * Don't track RC_LINKS_POCKET in the data file, and instead manually add it in every time a save is load. rcObjects doesn't contain Link's Pocket location (duh). * Moved ItemReceive hook to randomizer_check_tracker.cpp. Skipped items are properly sorted and formatted. Saved items contribute to an area's gotten/skipped checks on load. Changed skipped items default main color to gray. General code cleanup. * Skipped checks now contribute to area totals for area completion logic. * Mid-menu rework transfer. * Started check lookup on item receive. Tried to enable scum checking on save. * Fixed scum check on save. * More code cleanup, which revealed some issues with loading and saving. Loading now works 100%, but entries in checkTrackerData are disappearing in code somewhere, causing issues with later checks. Scummed color now displays properly. Collected but unsaved displays properly. Unchecked, Skipped, Seen and Scummed checks all have arrows for skipping/unskipping. Counts a little messed up, probably double adding skips. * Fixed item counts being off across resets. Restarts were fine. * Beginning of rework for individual check updates. Adds `Actor lastCheck` to PlayState to allow assigning of last actor to give an item. This allows precise tracking of GS, freestanding PoH, etc. Works for chests too. Currently does not work for shops, unknown for normal NPC gives. Doesn't track last gives for non-checks, like drops from grass, pots, crates, etc. * Actor-based checks fully fleshed out, but can't help with sale-based checks. Implemented `pendingSaleCheck` to back out of an RC check cycle if `gSaveContext->pendingSale` is not NONE when `OnItemReceive` is called, processed through `OnSaleEnd`. This should be the final change necessary to streamline the checks. * Temporary hook to message box close to tie in trackers for non-gs/chest actors that aren't added to `GetCheckFromActor`. This triggers a 2-frame countdown to check with `HasItemBeenCollected` since half of the methods in there aren't updated until after a text box closes. Added scene tracking to get last scene so that checks in scenes that span several overworld areas could be tied to their areas properly. Modified tracker data creation to apply Link's Pocket and Song from Impa conditionally based on randomizer settings instead of just being assumed to be done. May need modification for checking click and drag spoiler loading. Removed the scene equivalence check from CheckChecks so that an entire area is checked each time to avoid issues with, e.g., leaving a shop before a pending sale finishes. * Changed check data creation to use RSKs from gRandomizer to account for settings loaded from drag and drop spoilers. * Beginning of tracker code organization. Changed check color defaults. * Reverted moving tracker colors to header. Some individual check fixes. * Missed something from previous merge? * Removed last remnant of removed performance mode. * Better handle checking when skullsanity is off. * Song checks sceneIDs don't match the scenes they're actually in for some reason. Removed that check. * SaleEnd checks don't need the GetItemEntry parameter. Also set a flag that should prevent the check tracker from running during vanilla saves should that not be resolved by the time it's merged. * Attempting to have only the relevant checks added to the tracker data, as well as showing vanilla checks for non-rando saves. Not working yet (everything is displayed in vanilla). * Added vanilla check tracker population via `vanillaCheck` bool in `RandomizerCheckObject`. This is also added to `IsVisibleInImGui` to handle file loading and saving to eliminate checks that aren't part of vanilla or the rando seed. Implemented deleted tracker data file recreation. Added some extra item name text checks. Songs are still... tricky, so they stay blank. Utilize local copies of the randomizer check objects that are applicable for performance purposes. Fixed vanilla item-giving cutscene crashes when triggered mid-transition. * Apparently not all toolchains can handle macro instantiation without all parameters, like VS can. * Fixed scummed detail color not showing properly on tracker. * Fixed dungeon area totals and GS checks not functioning properly. * Major revamp of checking code. Doesn't rely on `GetCheckFromActor` at all anymore, but instead simply sets a flag to evaluate a number of checks in an area every frame until the check that was gotten is identified. With the new setup, it's much less hardware intensive, and at 60fps 6 checks per frame shows no noticeable effect on framerate. I can envision needing to add a collectedCount in order to account for times when two checks are gotten one right after the other. Changed area scroll to happen from `OnTransitionEnd`, and allow for scrolling in bazaar (was disabled previously because it would jump back and forth between Kak and Market while you were in one). Also setup area check order updating by area instead of all at the same time. * Fixed shooting gallery not reporting proper area. Prevent checks from actually happening if area is RCAREA_INVALID, now that all areas are reporting something if they have checks. Fixed `GetCheckArea()` not updating checks for standard scenes. Lots of vanilla tracking updates, mainly manual checks for gems, medallions and songs, since the often don't have proper scenes in the data. Prevent vanilla from triggering check loops if junk items are collected. Fixed sorting based on saved vs collected. Prevent item name display for vanilla runs. Change coloring of checks so the check name reflects status in vanilla runs. * Fixed "Recheck Area" button erroneously adding to an area's check totals? * Fix DMC vanilla checks. * Fix check tracker data recreation on data file loss. Removed redundant file exists check from SaveTrackerDataHook, as it doesn't matter if it exists or not at that point. Limited check loops to 3 to avoid infinite check loops on non-check/junk item pickup. Added more checks to disable tracker operations if a save is not running. Changed check ordering to put boss reward and heart container checks at the end of whatever RCSHOW group they belong to. * Fixed IsRunning calculation. Further improving vanilla checking. Starting framework for checking medallions, stones, and songs on data file recreation. Fixed medallion check collection. Added GIFT_FROM_SAGES to check list for vanilla file for tracking light medallion. Added check loop limitation to prevent infinite checking after picking up junk item from the ground. * Finished vanilla file recreation and recheck (songs and dungeon rewards all check properly now). This includes deku shield with KF shop item 3. Finished Gift from Raoru light medallion tracking for vanilla. Commented all CheckByScene functionality for now. * Fixed new save data file creation. Disabled entrance area calculation for now, as it only tracks the previous entrance for some reason. Fixed area detection for ToT checks. * GetCheckArea() now utilizes EntranceData almost exclusively, via either `gSaveContext.entranceIndex` or the entrance tracker's `currentGrottoId` in the case of grottos. This also means that EVERYTHING CAN AUTOSCROLL NOW. Entrance shuffles are now much easier to track. Autoscroll is now also triggered on save, just in case someone isn't autosaving and has a lot of checks that get converted to saved. * Fixed missing GS check in LW. * Added area scroll on toggling Show Hidden Items. May configure differently later. Fixed area detection for entrances in Gerudo Fortress/Valley and Collossus. Haunted wasteland doesn't autoscroll due to a bug in `OnTransitionEnd` hook, but checks still evaluate properly there. Rely on scene-based area detection if scene is a main overworld or dungeon scene. * Fixed grotto detection when shuffle is off. * Small code cleanup. Fixed Colossus hand chest checks. * Missing lus bump from merge conflict resolution * Fixed Colossus Grotto making `GetCheckArea` return Wasteland. * Improved OnItemReceive processing for non-token GS checks, since they can sometimes take long enough for the checking process to time out before the item is registered as received. * First attempt at thread safety for tracker data file writing. Seems to work, but might need more testing. * Fixed Recheck Area not unskipping items that register as saved. Improved delayed saving with autosaving, as the autosave triggered quite often before the tracker data save, making things not properly register as saved. * merge cleanup * Converted check tracker data to the sectional saves, adding `CheckTrackerData` to `SaveContext`. Implemented section ID returning and fullSave boolean passing to section functions from my PR temporarily for it to work properly. Moved `RandomizerCheckTrackerData` enum to `randomizerTypes.h` to accommodate that. Changed `Randomizer_SaveInit` to a `SaveManager::InitFunc` to allow for other randomizer-dependent sections to be initialized after that. Required a little refactoring to maintain intro cutscene skip when starting a randomizer file. * Revert section index return and randomizer init changes. Will need to wait on yet more changes to main. * Fixed check tracker initialization (shouldn't be tied to window initialization), restored saving/loading functionality. * Removed `CheckTracker::Init` and put SaveManager calls in `CheckTrackerWindow::InitElement`. Also a bit of cleanup from transition back to save file use. * Fixed tracker displaying check categories while file not loaded. * Fix Darunia's Joy check not marking in vanilla. * Fix autosave not triggering change from collected to saved in tracker data. * Changed default colors for scummed and collected display. * Merge upgrade code cleanup. * Add `OnTransitionEnd` calls to sandstorm transitions both to and from Wasteland. Also improved `gSaveContext.lastScene` assignment for both transition types. Allowed a bit of cleanup in `GetCheckArea`. * Added `StateButton`, a button like `ArrowButton` but that allows text instead of arrow icons. Apparently the changes from ArrowButton to StateButton happened in a previous commit... * Changed section name to `trackerDataCheck` to force SoH to load it after the randomizer section, as it required some randoSettings to be loaded first, and nothing else I tried to make the randomizer section load before it worked. This hacks a solution to checks not displaying on fast file load to a specific slot. F*** you, SaveManager, and f*** you too, JSON. * Forgot to change the section string for loading with the name change. * Fix check ordering for checks that trigger the autosave. * Adds option to remove right-side shop items (slots 1-4) from the tracker list. Enabled by default. * Fix default state of Hide Shop Right Checks checkbox. * Fixes grotto and great fairy scrolling and checks. Fixes array overflow from `checkTrackerData` which was creating the issue trying to load the base and randomizer sections first, among other things. That also fixed the massive file loads that were being exhibited in debug mode. * Fix shooting galleries being set as collected again when being played a second time after getting the checks. * Fix Bazaar autoscroll. * Add Saria's Song to `GetCheckFromActor` and removed some limitations from the messageCloseCheck function to make that check track properly. * Fix Song from Impa check. Implemented prevention for multiple "collections" of great fairies, just in case getting the health refill would trigger it with the previous setup. * Fix ice traps on GS tokens not triggering OnItemReceive. * Complete fix for ice trap collection from GS. Add autoscroll when clicking "Expand All". * Add `OnShopSlotChange` with cursorSlot and basePrice parameters. * Fixed include in en_ossan for shop slot hook. Added registration for `OnShopSlotChange` in the tracker, storing the price in a new `price` field in `CheckTrackerData`. Added "seen" functionality to shop checks. Displays the model item name upon first entering a shop, adding the price and switching to trickName (if it's an ice trap) upon navigating to the slot in buy mode, triggered by an invisible "identified" status that mirrors "seen" in every other way. Added tooltips to most options for check tracker color picking to describe what each status actually means. * `std::format` pls * So apparently std::format just decided to break with the latest merge from develop, but fmt::format exists and works? * Removed the last vestiges of `locationsSkipped`. Other general code and formatting cleanups. Moved `IsGameRunning` to `OTRGlobals` so the item tracker could also access it. Used preceding to "fix" item and bottle display in the item tracker on startup. * Some more code cleanup. Removed "Recheck Area" button and relevant code. Backported changes to Anchor branch applicable for single-player, including making a checkAreas vector and structuring the frame by frame checks around that. Also includes fix for Silver Gauntlets and Mirror Shield check collection crash associated with those changes. Fixed Kakariko Bazaar "seen" updates. Fixed tracker window not showing on initial load like it should. * Forgot 1 formatting fix. * Removed conditions for showing Song from Impa (isn't junk under certain conditions, so should show all the time). * Fix vanilla checks, add Zelda's Letter and Malon's Egg to manual check collection. Fix autoscroll while in child stealth section. * Fix crash in Happy Mask Shop in OnSlotChange (referenced non-existent shop id in a tracker-specific enum). * General code cleanup. * Missed one reversion. * One more. * Fix column alignment in `randomizer_check_objects`. * Fix file encoding on `randomizer_check_tracker`. Again. * Fix indentation for `actualItemtrackerItemMap`. Also removed unnecessary parts of the map. * Rename `HasEqItem` to `HasEquipment`. * Slightly better indentation for `actualItemTrackerItemMap`. * Add magic bean salesman to vanilla check tracking, and genericized deku shield to trigger KF shop item 3 wherever you get the shield. Renamed `vanillaCheck` to `vanillaHundoCheck` to (supposedly) clarify the meaning of the usage. * One more rename to `vanillaCompletion` to avoid possible confusion with 100% speedrun conditions. * give me a break XD Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * Changes suggested by briaguya (rename `RandomizerCheckShow` to `Status`, unused code, newline formatting) * Remove unused `itemNames` table. * Remove `IsGameRunning` in favor of `GameInteractor::IsSaveLoaded`. * Restore anti-spoiler functionality for dungeons with dungeon maps. * Review cleanup. * Fix prices not showing for Kak bazaar items. --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com>
2023-10-04 11:03:36 -04:00
//Last Area needs to be cleaned up
if (lastArea != RCAREA_INVALID && doDraw) {
UIWidgets::PaddedSeparator();
}
lastArea = rcArea;
if (previousShowHidden != showHidden) {
previousShowHidden = showHidden;
doAreaScroll = true;
}
if (!showHidden && (
hideComplete && thisAreaFullyChecked ||
hideIncomplete && !thisAreaFullyChecked
)) {
doDraw = false;
} else {
//Get the colour for the area
if (thisAreaFullyChecked) {
mainColor = areaCompleteColor;
extraColor = extraCompleteColor;
} else {
mainColor = areaIncompleteColor;
extraColor = extraIncompleteColor;
Randomizer Auto Location tracker (#1942) * Initial Auto-Location Tracking * Updates styling for checked items in Check Tracker * Fixes crashing issues with Check Tracker rendering * Auto scroll Check Tracker windows to current area * Checks Tracker only shows checked locations once in game * Fixes issue where Check Tracker would auto-scroll to wrong location when entering a grotto * Fixes gerudo fortress checks showing in tracker when settings have them removed * InfTable Check Location Fixes: Lost Dog Richard, Rolling Gorons, HBA 1000, Thawed Zora * Fixes most Event Chk Inf Checks on Check Tracker, and Frogs * Check Tracker - Song from Malon now works * Check Tracker - Fixes Claim Check check not tracking - Fixes spoiler for Claim Check check when getting Biggoron's Sword - Fixes LACS being spoiled and not tracking * Check Tracker - Fixes #2 for Skull Mask and Mask of Truth checks * Check Tracker - Adds support for merchants - Fixes #7 for Bomchu Salesman - Fixes #12 for Medigoron * Check Tracker - Fixes #8 for Song from Saria * Check Tracker - Fixes #9 for Adult Shooting Gallery * Check Tracker - Fixes #10 for Composer Grave * Check Tracker - Fixes #14 for Song from Ocarina of Time * Check Tracker - Fixes #16 for Shooting the Sun * Check Tracker - Fixes #19 for Darunia's Joy * Save Editor - Adds missing label for Treasure Chest Game * Check Tracker - Fixes Great Faries checks * Check Tracker - Fixes Sheik at Temple * Check Tracker - Fixes Great Fairy auto-scroll to wrong location * Check Tracker - Updates blue warp checks - Fixes Bongo Bongo and Twinrova checks * Check Tracker - Fixes Dampe's Gravedigging Tour * Check Tracker - Fixes Prescription to King Zora * Check Tracker - Fixes Bazaar showing under wrong area on tracker between adult/child * Check Tracker - Fixes scroll for Hyrule Market and Bazaar * Check Tracker - Fixes giving Adult Trade Items shown on tracker: Broken Sword, Saw, Cojiro, Eyeball Froge, and Eyedrops * Cleans up item_location * Check Tracker - Item List - Fixes item list not updating when changing seeds/options - Separates item exclusion list from item check list - Clean up comments * Check Tracker - Adds Skip functionality to buttons * Check Tracker - Refactors adult trade items to RandomizerInf * Check Tracker - Fixes an issue where any time an item is removed the tracker would cause an application crash * Check Tracker - Item names are now dependent on file language * Check Tracker - Fixes Gerudo Card check not showing in Fast setting * Reorders headers to (hopefully) avoid CI build conflicts on linux/consoles * Explicitly defines vector header in randomizer.h to fix compile errors * Complete Refactor of Check Tracker ImGui * Adds missing check tracker files to CMakeLists * Reverts the Item_location whitespace cleanup from ad10807c * Check Tracker - Loading Fixes - Fixes a bug where loading a save file a second time would add all the checks again - Fixes a bug where the check tracker would not render at all until in a save file * Check Tracker - Fixes a bug where checks would sometimes fail to load * Check Tracker - Fixes duplicated checks when using Only on Pause or Only on Combo * Check Tracker - Works around issue where single characters don't show in EnhancementCombobox, and fixes a label for combo buttons held option * Check Tracker - Applies all Check Tracker changes to Item Location * Check Tracker - Updated Check List - Adds Link's pocket, either in KF or HM depending on starting age - Supports Scrubs and Merchants - Uses enums instead of magic numbers - Updates DC Scrub Short Names for MQ * Check Tracker - Adds a performance mode option * Check Tracker - List Fixes (requires new rando generation) - Fixes Frogs Rupees always visible - Fixes Kokiri Sword Chest not showing - Fixes Weird Egg not showing * Check Tracker - MQ List basic support * Check Tracker - MQ/Vanilla anti-spoilers * Check Tracker - Collecting a compass now spoils the area * Check Tracker - Basic Vanilla Support and fixes - Vanilla items show in check tracker, even if many won't auto check - Fixes an issue with Gerudo Fortress Keys - Refactors IsVisibleInCheckTracker to randomizer_check_tracjer * Check Tracker - Fixes merge conflict from 08a487f35e1d760ab9e69b932edbe4da6bcd9edb * Check Tracker - Fixes tracker loading as Floating when default value is set to Windowed * Randomizer Location Exclusion List - Adds Scrubs, Merchants, Shops. Adult Trade items, MQ Dungeons, and Bean Salesman - Fixes Kokiri Sword Chest, Weird Egg, and Frog Song Rupees from misbehaving - Updates Gerudo Fortress logic to be dependent on Open/Fast/Normal Fortress - Removes Invalid Check - Adds RO Enum for MQ settings - Updates magic values to RO enum * Location Exclusion List - Scrubs that are always randomized now always show on the list * For now, removes some extra code only needed for a Check Tracker. * Randomizer Location Exclusion List - Fixes Eyeball Frog from showing up when Adult Trade Items was off * Location Tracker - Updates Eyedrops to use RandomizerInf instead of Chest * Check Tracker - Fixes a bug where Link's Pocket item wasn't acting as checked for area item count * Check Tracker - Fixes a bug where Locations would incorrectly say Vanilla due to the first check in the area being a non-MQ check * Check Tracker - Fixes a crash when Check Tracker is docked but not visible * Check Tracker - Fixes areas being spoiled when loading different save files * Check Tracker - Only reset variables if they are initialized * Check Tracker - Cleans up old comments, unused variables, methods, and macros, adds language TODOs, * Check Tracker - Readds rainbow UI elements after Cosmetics Editor refactor * Check Tracker - Removal of flag lookup that was refactored, no longer needed header, and some trivial whitespace fixes. * Check Tracker - Refactors Index to Bitmask code to a macro * Check Tracker - Changes ordering from alphabetical to RandomizerCheck ordering * Check Tracker - Wraps everything in a namespace to avoid global variable usage * Check Tracker - Explicitly defines for-loop scope * Check Tracker - refactors dungeon lookup from static array to function * Fixes a bug when using EnhancementColor with alpha * Check Tracker - Refactors all colour to use direct conversions * Check Tracker - refactors settings loading and check visibility for readability * Check Tracker - Fixes a bug where the wrong label showed on the Check Tracker BG Color * UIWidgets - Adds Alpha bar to EnhancementColor when using alpha parameter
2022-12-10 22:39:23 -05:00
}
Check Tracker Update (#2668) * Initial commit. What works so far: Data file loads, saves, deletes, and is created properly. - Need to run `HasItemBeenCollected` when creating in case of mid-seed regen. Organized checks into maps set by area. Areas show in tracker. - Checks pulled from checkObjectsByArea are not currently listed. - Areas are being assumed completed and hidden at the start. * Checks now populate. Still not counting area totals properly. * Don't track RC_LINKS_POCKET in the data file, and instead manually add it in every time a save is load. rcObjects doesn't contain Link's Pocket location (duh). * Moved ItemReceive hook to randomizer_check_tracker.cpp. Skipped items are properly sorted and formatted. Saved items contribute to an area's gotten/skipped checks on load. Changed skipped items default main color to gray. General code cleanup. * Skipped checks now contribute to area totals for area completion logic. * Mid-menu rework transfer. * Started check lookup on item receive. Tried to enable scum checking on save. * Fixed scum check on save. * More code cleanup, which revealed some issues with loading and saving. Loading now works 100%, but entries in checkTrackerData are disappearing in code somewhere, causing issues with later checks. Scummed color now displays properly. Collected but unsaved displays properly. Unchecked, Skipped, Seen and Scummed checks all have arrows for skipping/unskipping. Counts a little messed up, probably double adding skips. * Fixed item counts being off across resets. Restarts were fine. * Beginning of rework for individual check updates. Adds `Actor lastCheck` to PlayState to allow assigning of last actor to give an item. This allows precise tracking of GS, freestanding PoH, etc. Works for chests too. Currently does not work for shops, unknown for normal NPC gives. Doesn't track last gives for non-checks, like drops from grass, pots, crates, etc. * Actor-based checks fully fleshed out, but can't help with sale-based checks. Implemented `pendingSaleCheck` to back out of an RC check cycle if `gSaveContext->pendingSale` is not NONE when `OnItemReceive` is called, processed through `OnSaleEnd`. This should be the final change necessary to streamline the checks. * Temporary hook to message box close to tie in trackers for non-gs/chest actors that aren't added to `GetCheckFromActor`. This triggers a 2-frame countdown to check with `HasItemBeenCollected` since half of the methods in there aren't updated until after a text box closes. Added scene tracking to get last scene so that checks in scenes that span several overworld areas could be tied to their areas properly. Modified tracker data creation to apply Link's Pocket and Song from Impa conditionally based on randomizer settings instead of just being assumed to be done. May need modification for checking click and drag spoiler loading. Removed the scene equivalence check from CheckChecks so that an entire area is checked each time to avoid issues with, e.g., leaving a shop before a pending sale finishes. * Changed check data creation to use RSKs from gRandomizer to account for settings loaded from drag and drop spoilers. * Beginning of tracker code organization. Changed check color defaults. * Reverted moving tracker colors to header. Some individual check fixes. * Missed something from previous merge? * Removed last remnant of removed performance mode. * Better handle checking when skullsanity is off. * Song checks sceneIDs don't match the scenes they're actually in for some reason. Removed that check. * SaleEnd checks don't need the GetItemEntry parameter. Also set a flag that should prevent the check tracker from running during vanilla saves should that not be resolved by the time it's merged. * Attempting to have only the relevant checks added to the tracker data, as well as showing vanilla checks for non-rando saves. Not working yet (everything is displayed in vanilla). * Added vanilla check tracker population via `vanillaCheck` bool in `RandomizerCheckObject`. This is also added to `IsVisibleInImGui` to handle file loading and saving to eliminate checks that aren't part of vanilla or the rando seed. Implemented deleted tracker data file recreation. Added some extra item name text checks. Songs are still... tricky, so they stay blank. Utilize local copies of the randomizer check objects that are applicable for performance purposes. Fixed vanilla item-giving cutscene crashes when triggered mid-transition. * Apparently not all toolchains can handle macro instantiation without all parameters, like VS can. * Fixed scummed detail color not showing properly on tracker. * Fixed dungeon area totals and GS checks not functioning properly. * Major revamp of checking code. Doesn't rely on `GetCheckFromActor` at all anymore, but instead simply sets a flag to evaluate a number of checks in an area every frame until the check that was gotten is identified. With the new setup, it's much less hardware intensive, and at 60fps 6 checks per frame shows no noticeable effect on framerate. I can envision needing to add a collectedCount in order to account for times when two checks are gotten one right after the other. Changed area scroll to happen from `OnTransitionEnd`, and allow for scrolling in bazaar (was disabled previously because it would jump back and forth between Kak and Market while you were in one). Also setup area check order updating by area instead of all at the same time. * Fixed shooting gallery not reporting proper area. Prevent checks from actually happening if area is RCAREA_INVALID, now that all areas are reporting something if they have checks. Fixed `GetCheckArea()` not updating checks for standard scenes. Lots of vanilla tracking updates, mainly manual checks for gems, medallions and songs, since the often don't have proper scenes in the data. Prevent vanilla from triggering check loops if junk items are collected. Fixed sorting based on saved vs collected. Prevent item name display for vanilla runs. Change coloring of checks so the check name reflects status in vanilla runs. * Fixed "Recheck Area" button erroneously adding to an area's check totals? * Fix DMC vanilla checks. * Fix check tracker data recreation on data file loss. Removed redundant file exists check from SaveTrackerDataHook, as it doesn't matter if it exists or not at that point. Limited check loops to 3 to avoid infinite check loops on non-check/junk item pickup. Added more checks to disable tracker operations if a save is not running. Changed check ordering to put boss reward and heart container checks at the end of whatever RCSHOW group they belong to. * Fixed IsRunning calculation. Further improving vanilla checking. Starting framework for checking medallions, stones, and songs on data file recreation. Fixed medallion check collection. Added GIFT_FROM_SAGES to check list for vanilla file for tracking light medallion. Added check loop limitation to prevent infinite checking after picking up junk item from the ground. * Finished vanilla file recreation and recheck (songs and dungeon rewards all check properly now). This includes deku shield with KF shop item 3. Finished Gift from Raoru light medallion tracking for vanilla. Commented all CheckByScene functionality for now. * Fixed new save data file creation. Disabled entrance area calculation for now, as it only tracks the previous entrance for some reason. Fixed area detection for ToT checks. * GetCheckArea() now utilizes EntranceData almost exclusively, via either `gSaveContext.entranceIndex` or the entrance tracker's `currentGrottoId` in the case of grottos. This also means that EVERYTHING CAN AUTOSCROLL NOW. Entrance shuffles are now much easier to track. Autoscroll is now also triggered on save, just in case someone isn't autosaving and has a lot of checks that get converted to saved. * Fixed missing GS check in LW. * Added area scroll on toggling Show Hidden Items. May configure differently later. Fixed area detection for entrances in Gerudo Fortress/Valley and Collossus. Haunted wasteland doesn't autoscroll due to a bug in `OnTransitionEnd` hook, but checks still evaluate properly there. Rely on scene-based area detection if scene is a main overworld or dungeon scene. * Fixed grotto detection when shuffle is off. * Small code cleanup. Fixed Colossus hand chest checks. * Missing lus bump from merge conflict resolution * Fixed Colossus Grotto making `GetCheckArea` return Wasteland. * Improved OnItemReceive processing for non-token GS checks, since they can sometimes take long enough for the checking process to time out before the item is registered as received. * First attempt at thread safety for tracker data file writing. Seems to work, but might need more testing. * Fixed Recheck Area not unskipping items that register as saved. Improved delayed saving with autosaving, as the autosave triggered quite often before the tracker data save, making things not properly register as saved. * merge cleanup * Converted check tracker data to the sectional saves, adding `CheckTrackerData` to `SaveContext`. Implemented section ID returning and fullSave boolean passing to section functions from my PR temporarily for it to work properly. Moved `RandomizerCheckTrackerData` enum to `randomizerTypes.h` to accommodate that. Changed `Randomizer_SaveInit` to a `SaveManager::InitFunc` to allow for other randomizer-dependent sections to be initialized after that. Required a little refactoring to maintain intro cutscene skip when starting a randomizer file. * Revert section index return and randomizer init changes. Will need to wait on yet more changes to main. * Fixed check tracker initialization (shouldn't be tied to window initialization), restored saving/loading functionality. * Removed `CheckTracker::Init` and put SaveManager calls in `CheckTrackerWindow::InitElement`. Also a bit of cleanup from transition back to save file use. * Fixed tracker displaying check categories while file not loaded. * Fix Darunia's Joy check not marking in vanilla. * Fix autosave not triggering change from collected to saved in tracker data. * Changed default colors for scummed and collected display. * Merge upgrade code cleanup. * Add `OnTransitionEnd` calls to sandstorm transitions both to and from Wasteland. Also improved `gSaveContext.lastScene` assignment for both transition types. Allowed a bit of cleanup in `GetCheckArea`. * Added `StateButton`, a button like `ArrowButton` but that allows text instead of arrow icons. Apparently the changes from ArrowButton to StateButton happened in a previous commit... * Changed section name to `trackerDataCheck` to force SoH to load it after the randomizer section, as it required some randoSettings to be loaded first, and nothing else I tried to make the randomizer section load before it worked. This hacks a solution to checks not displaying on fast file load to a specific slot. F*** you, SaveManager, and f*** you too, JSON. * Forgot to change the section string for loading with the name change. * Fix check ordering for checks that trigger the autosave. * Adds option to remove right-side shop items (slots 1-4) from the tracker list. Enabled by default. * Fix default state of Hide Shop Right Checks checkbox. * Fixes grotto and great fairy scrolling and checks. Fixes array overflow from `checkTrackerData` which was creating the issue trying to load the base and randomizer sections first, among other things. That also fixed the massive file loads that were being exhibited in debug mode. * Fix shooting galleries being set as collected again when being played a second time after getting the checks. * Fix Bazaar autoscroll. * Add Saria's Song to `GetCheckFromActor` and removed some limitations from the messageCloseCheck function to make that check track properly. * Fix Song from Impa check. Implemented prevention for multiple "collections" of great fairies, just in case getting the health refill would trigger it with the previous setup. * Fix ice traps on GS tokens not triggering OnItemReceive. * Complete fix for ice trap collection from GS. Add autoscroll when clicking "Expand All". * Add `OnShopSlotChange` with cursorSlot and basePrice parameters. * Fixed include in en_ossan for shop slot hook. Added registration for `OnShopSlotChange` in the tracker, storing the price in a new `price` field in `CheckTrackerData`. Added "seen" functionality to shop checks. Displays the model item name upon first entering a shop, adding the price and switching to trickName (if it's an ice trap) upon navigating to the slot in buy mode, triggered by an invisible "identified" status that mirrors "seen" in every other way. Added tooltips to most options for check tracker color picking to describe what each status actually means. * `std::format` pls * So apparently std::format just decided to break with the latest merge from develop, but fmt::format exists and works? * Removed the last vestiges of `locationsSkipped`. Other general code and formatting cleanups. Moved `IsGameRunning` to `OTRGlobals` so the item tracker could also access it. Used preceding to "fix" item and bottle display in the item tracker on startup. * Some more code cleanup. Removed "Recheck Area" button and relevant code. Backported changes to Anchor branch applicable for single-player, including making a checkAreas vector and structuring the frame by frame checks around that. Also includes fix for Silver Gauntlets and Mirror Shield check collection crash associated with those changes. Fixed Kakariko Bazaar "seen" updates. Fixed tracker window not showing on initial load like it should. * Forgot 1 formatting fix. * Removed conditions for showing Song from Impa (isn't junk under certain conditions, so should show all the time). * Fix vanilla checks, add Zelda's Letter and Malon's Egg to manual check collection. Fix autoscroll while in child stealth section. * Fix crash in Happy Mask Shop in OnSlotChange (referenced non-existent shop id in a tracker-specific enum). * General code cleanup. * Missed one reversion. * One more. * Fix column alignment in `randomizer_check_objects`. * Fix file encoding on `randomizer_check_tracker`. Again. * Fix indentation for `actualItemtrackerItemMap`. Also removed unnecessary parts of the map. * Rename `HasEqItem` to `HasEquipment`. * Slightly better indentation for `actualItemTrackerItemMap`. * Add magic bean salesman to vanilla check tracking, and genericized deku shield to trigger KF shop item 3 wherever you get the shield. Renamed `vanillaCheck` to `vanillaHundoCheck` to (supposedly) clarify the meaning of the usage. * One more rename to `vanillaCompletion` to avoid possible confusion with 100% speedrun conditions. * give me a break XD Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * Changes suggested by briaguya (rename `RandomizerCheckShow` to `Status`, unused code, newline formatting) * Remove unused `itemNames` table. * Remove `IsGameRunning` in favor of `GameInteractor::IsSaveLoaded`. * Restore anti-spoiler functionality for dungeons with dungeon maps. * Review cleanup. * Fix prices not showing for Kak bazaar items. --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com>
2023-10-04 11:03:36 -04:00
//Draw the area
collapseLogic = !thisAreaFullyChecked;
if (doingCollapseOrExpand) {
if (optExpandAll) {
collapseLogic = true;
} else if (optCollapseAll) {
collapseLogic = false;
Randomizer Auto Location tracker (#1942) * Initial Auto-Location Tracking * Updates styling for checked items in Check Tracker * Fixes crashing issues with Check Tracker rendering * Auto scroll Check Tracker windows to current area * Checks Tracker only shows checked locations once in game * Fixes issue where Check Tracker would auto-scroll to wrong location when entering a grotto * Fixes gerudo fortress checks showing in tracker when settings have them removed * InfTable Check Location Fixes: Lost Dog Richard, Rolling Gorons, HBA 1000, Thawed Zora * Fixes most Event Chk Inf Checks on Check Tracker, and Frogs * Check Tracker - Song from Malon now works * Check Tracker - Fixes Claim Check check not tracking - Fixes spoiler for Claim Check check when getting Biggoron's Sword - Fixes LACS being spoiled and not tracking * Check Tracker - Fixes #2 for Skull Mask and Mask of Truth checks * Check Tracker - Adds support for merchants - Fixes #7 for Bomchu Salesman - Fixes #12 for Medigoron * Check Tracker - Fixes #8 for Song from Saria * Check Tracker - Fixes #9 for Adult Shooting Gallery * Check Tracker - Fixes #10 for Composer Grave * Check Tracker - Fixes #14 for Song from Ocarina of Time * Check Tracker - Fixes #16 for Shooting the Sun * Check Tracker - Fixes #19 for Darunia's Joy * Save Editor - Adds missing label for Treasure Chest Game * Check Tracker - Fixes Great Faries checks * Check Tracker - Fixes Sheik at Temple * Check Tracker - Fixes Great Fairy auto-scroll to wrong location * Check Tracker - Updates blue warp checks - Fixes Bongo Bongo and Twinrova checks * Check Tracker - Fixes Dampe's Gravedigging Tour * Check Tracker - Fixes Prescription to King Zora * Check Tracker - Fixes Bazaar showing under wrong area on tracker between adult/child * Check Tracker - Fixes scroll for Hyrule Market and Bazaar * Check Tracker - Fixes giving Adult Trade Items shown on tracker: Broken Sword, Saw, Cojiro, Eyeball Froge, and Eyedrops * Cleans up item_location * Check Tracker - Item List - Fixes item list not updating when changing seeds/options - Separates item exclusion list from item check list - Clean up comments * Check Tracker - Adds Skip functionality to buttons * Check Tracker - Refactors adult trade items to RandomizerInf * Check Tracker - Fixes an issue where any time an item is removed the tracker would cause an application crash * Check Tracker - Item names are now dependent on file language * Check Tracker - Fixes Gerudo Card check not showing in Fast setting * Reorders headers to (hopefully) avoid CI build conflicts on linux/consoles * Explicitly defines vector header in randomizer.h to fix compile errors * Complete Refactor of Check Tracker ImGui * Adds missing check tracker files to CMakeLists * Reverts the Item_location whitespace cleanup from ad10807c * Check Tracker - Loading Fixes - Fixes a bug where loading a save file a second time would add all the checks again - Fixes a bug where the check tracker would not render at all until in a save file * Check Tracker - Fixes a bug where checks would sometimes fail to load * Check Tracker - Fixes duplicated checks when using Only on Pause or Only on Combo * Check Tracker - Works around issue where single characters don't show in EnhancementCombobox, and fixes a label for combo buttons held option * Check Tracker - Applies all Check Tracker changes to Item Location * Check Tracker - Updated Check List - Adds Link's pocket, either in KF or HM depending on starting age - Supports Scrubs and Merchants - Uses enums instead of magic numbers - Updates DC Scrub Short Names for MQ * Check Tracker - Adds a performance mode option * Check Tracker - List Fixes (requires new rando generation) - Fixes Frogs Rupees always visible - Fixes Kokiri Sword Chest not showing - Fixes Weird Egg not showing * Check Tracker - MQ List basic support * Check Tracker - MQ/Vanilla anti-spoilers * Check Tracker - Collecting a compass now spoils the area * Check Tracker - Basic Vanilla Support and fixes - Vanilla items show in check tracker, even if many won't auto check - Fixes an issue with Gerudo Fortress Keys - Refactors IsVisibleInCheckTracker to randomizer_check_tracjer * Check Tracker - Fixes merge conflict from 08a487f35e1d760ab9e69b932edbe4da6bcd9edb * Check Tracker - Fixes tracker loading as Floating when default value is set to Windowed * Randomizer Location Exclusion List - Adds Scrubs, Merchants, Shops. Adult Trade items, MQ Dungeons, and Bean Salesman - Fixes Kokiri Sword Chest, Weird Egg, and Frog Song Rupees from misbehaving - Updates Gerudo Fortress logic to be dependent on Open/Fast/Normal Fortress - Removes Invalid Check - Adds RO Enum for MQ settings - Updates magic values to RO enum * Location Exclusion List - Scrubs that are always randomized now always show on the list * For now, removes some extra code only needed for a Check Tracker. * Randomizer Location Exclusion List - Fixes Eyeball Frog from showing up when Adult Trade Items was off * Location Tracker - Updates Eyedrops to use RandomizerInf instead of Chest * Check Tracker - Fixes a bug where Link's Pocket item wasn't acting as checked for area item count * Check Tracker - Fixes a bug where Locations would incorrectly say Vanilla due to the first check in the area being a non-MQ check * Check Tracker - Fixes a crash when Check Tracker is docked but not visible * Check Tracker - Fixes areas being spoiled when loading different save files * Check Tracker - Only reset variables if they are initialized * Check Tracker - Cleans up old comments, unused variables, methods, and macros, adds language TODOs, * Check Tracker - Readds rainbow UI elements after Cosmetics Editor refactor * Check Tracker - Removal of flag lookup that was refactored, no longer needed header, and some trivial whitespace fixes. * Check Tracker - Refactors Index to Bitmask code to a macro * Check Tracker - Changes ordering from alphabetical to RandomizerCheck ordering * Check Tracker - Wraps everything in a namespace to avoid global variable usage * Check Tracker - Explicitly defines for-loop scope * Check Tracker - refactors dungeon lookup from static array to function * Fixes a bug when using EnhancementColor with alpha * Check Tracker - Refactors all colour to use direct conversions * Check Tracker - refactors settings loading and check visibility for readability * Check Tracker - Fixes a bug where the wrong label showed on the Check Tracker BG Color * UIWidgets - Adds Alpha bar to EnhancementColor when using alpha parameter
2022-12-10 22:39:23 -05:00
}
Check Tracker Update (#2668) * Initial commit. What works so far: Data file loads, saves, deletes, and is created properly. - Need to run `HasItemBeenCollected` when creating in case of mid-seed regen. Organized checks into maps set by area. Areas show in tracker. - Checks pulled from checkObjectsByArea are not currently listed. - Areas are being assumed completed and hidden at the start. * Checks now populate. Still not counting area totals properly. * Don't track RC_LINKS_POCKET in the data file, and instead manually add it in every time a save is load. rcObjects doesn't contain Link's Pocket location (duh). * Moved ItemReceive hook to randomizer_check_tracker.cpp. Skipped items are properly sorted and formatted. Saved items contribute to an area's gotten/skipped checks on load. Changed skipped items default main color to gray. General code cleanup. * Skipped checks now contribute to area totals for area completion logic. * Mid-menu rework transfer. * Started check lookup on item receive. Tried to enable scum checking on save. * Fixed scum check on save. * More code cleanup, which revealed some issues with loading and saving. Loading now works 100%, but entries in checkTrackerData are disappearing in code somewhere, causing issues with later checks. Scummed color now displays properly. Collected but unsaved displays properly. Unchecked, Skipped, Seen and Scummed checks all have arrows for skipping/unskipping. Counts a little messed up, probably double adding skips. * Fixed item counts being off across resets. Restarts were fine. * Beginning of rework for individual check updates. Adds `Actor lastCheck` to PlayState to allow assigning of last actor to give an item. This allows precise tracking of GS, freestanding PoH, etc. Works for chests too. Currently does not work for shops, unknown for normal NPC gives. Doesn't track last gives for non-checks, like drops from grass, pots, crates, etc. * Actor-based checks fully fleshed out, but can't help with sale-based checks. Implemented `pendingSaleCheck` to back out of an RC check cycle if `gSaveContext->pendingSale` is not NONE when `OnItemReceive` is called, processed through `OnSaleEnd`. This should be the final change necessary to streamline the checks. * Temporary hook to message box close to tie in trackers for non-gs/chest actors that aren't added to `GetCheckFromActor`. This triggers a 2-frame countdown to check with `HasItemBeenCollected` since half of the methods in there aren't updated until after a text box closes. Added scene tracking to get last scene so that checks in scenes that span several overworld areas could be tied to their areas properly. Modified tracker data creation to apply Link's Pocket and Song from Impa conditionally based on randomizer settings instead of just being assumed to be done. May need modification for checking click and drag spoiler loading. Removed the scene equivalence check from CheckChecks so that an entire area is checked each time to avoid issues with, e.g., leaving a shop before a pending sale finishes. * Changed check data creation to use RSKs from gRandomizer to account for settings loaded from drag and drop spoilers. * Beginning of tracker code organization. Changed check color defaults. * Reverted moving tracker colors to header. Some individual check fixes. * Missed something from previous merge? * Removed last remnant of removed performance mode. * Better handle checking when skullsanity is off. * Song checks sceneIDs don't match the scenes they're actually in for some reason. Removed that check. * SaleEnd checks don't need the GetItemEntry parameter. Also set a flag that should prevent the check tracker from running during vanilla saves should that not be resolved by the time it's merged. * Attempting to have only the relevant checks added to the tracker data, as well as showing vanilla checks for non-rando saves. Not working yet (everything is displayed in vanilla). * Added vanilla check tracker population via `vanillaCheck` bool in `RandomizerCheckObject`. This is also added to `IsVisibleInImGui` to handle file loading and saving to eliminate checks that aren't part of vanilla or the rando seed. Implemented deleted tracker data file recreation. Added some extra item name text checks. Songs are still... tricky, so they stay blank. Utilize local copies of the randomizer check objects that are applicable for performance purposes. Fixed vanilla item-giving cutscene crashes when triggered mid-transition. * Apparently not all toolchains can handle macro instantiation without all parameters, like VS can. * Fixed scummed detail color not showing properly on tracker. * Fixed dungeon area totals and GS checks not functioning properly. * Major revamp of checking code. Doesn't rely on `GetCheckFromActor` at all anymore, but instead simply sets a flag to evaluate a number of checks in an area every frame until the check that was gotten is identified. With the new setup, it's much less hardware intensive, and at 60fps 6 checks per frame shows no noticeable effect on framerate. I can envision needing to add a collectedCount in order to account for times when two checks are gotten one right after the other. Changed area scroll to happen from `OnTransitionEnd`, and allow for scrolling in bazaar (was disabled previously because it would jump back and forth between Kak and Market while you were in one). Also setup area check order updating by area instead of all at the same time. * Fixed shooting gallery not reporting proper area. Prevent checks from actually happening if area is RCAREA_INVALID, now that all areas are reporting something if they have checks. Fixed `GetCheckArea()` not updating checks for standard scenes. Lots of vanilla tracking updates, mainly manual checks for gems, medallions and songs, since the often don't have proper scenes in the data. Prevent vanilla from triggering check loops if junk items are collected. Fixed sorting based on saved vs collected. Prevent item name display for vanilla runs. Change coloring of checks so the check name reflects status in vanilla runs. * Fixed "Recheck Area" button erroneously adding to an area's check totals? * Fix DMC vanilla checks. * Fix check tracker data recreation on data file loss. Removed redundant file exists check from SaveTrackerDataHook, as it doesn't matter if it exists or not at that point. Limited check loops to 3 to avoid infinite check loops on non-check/junk item pickup. Added more checks to disable tracker operations if a save is not running. Changed check ordering to put boss reward and heart container checks at the end of whatever RCSHOW group they belong to. * Fixed IsRunning calculation. Further improving vanilla checking. Starting framework for checking medallions, stones, and songs on data file recreation. Fixed medallion check collection. Added GIFT_FROM_SAGES to check list for vanilla file for tracking light medallion. Added check loop limitation to prevent infinite checking after picking up junk item from the ground. * Finished vanilla file recreation and recheck (songs and dungeon rewards all check properly now). This includes deku shield with KF shop item 3. Finished Gift from Raoru light medallion tracking for vanilla. Commented all CheckByScene functionality for now. * Fixed new save data file creation. Disabled entrance area calculation for now, as it only tracks the previous entrance for some reason. Fixed area detection for ToT checks. * GetCheckArea() now utilizes EntranceData almost exclusively, via either `gSaveContext.entranceIndex` or the entrance tracker's `currentGrottoId` in the case of grottos. This also means that EVERYTHING CAN AUTOSCROLL NOW. Entrance shuffles are now much easier to track. Autoscroll is now also triggered on save, just in case someone isn't autosaving and has a lot of checks that get converted to saved. * Fixed missing GS check in LW. * Added area scroll on toggling Show Hidden Items. May configure differently later. Fixed area detection for entrances in Gerudo Fortress/Valley and Collossus. Haunted wasteland doesn't autoscroll due to a bug in `OnTransitionEnd` hook, but checks still evaluate properly there. Rely on scene-based area detection if scene is a main overworld or dungeon scene. * Fixed grotto detection when shuffle is off. * Small code cleanup. Fixed Colossus hand chest checks. * Missing lus bump from merge conflict resolution * Fixed Colossus Grotto making `GetCheckArea` return Wasteland. * Improved OnItemReceive processing for non-token GS checks, since they can sometimes take long enough for the checking process to time out before the item is registered as received. * First attempt at thread safety for tracker data file writing. Seems to work, but might need more testing. * Fixed Recheck Area not unskipping items that register as saved. Improved delayed saving with autosaving, as the autosave triggered quite often before the tracker data save, making things not properly register as saved. * merge cleanup * Converted check tracker data to the sectional saves, adding `CheckTrackerData` to `SaveContext`. Implemented section ID returning and fullSave boolean passing to section functions from my PR temporarily for it to work properly. Moved `RandomizerCheckTrackerData` enum to `randomizerTypes.h` to accommodate that. Changed `Randomizer_SaveInit` to a `SaveManager::InitFunc` to allow for other randomizer-dependent sections to be initialized after that. Required a little refactoring to maintain intro cutscene skip when starting a randomizer file. * Revert section index return and randomizer init changes. Will need to wait on yet more changes to main. * Fixed check tracker initialization (shouldn't be tied to window initialization), restored saving/loading functionality. * Removed `CheckTracker::Init` and put SaveManager calls in `CheckTrackerWindow::InitElement`. Also a bit of cleanup from transition back to save file use. * Fixed tracker displaying check categories while file not loaded. * Fix Darunia's Joy check not marking in vanilla. * Fix autosave not triggering change from collected to saved in tracker data. * Changed default colors for scummed and collected display. * Merge upgrade code cleanup. * Add `OnTransitionEnd` calls to sandstorm transitions both to and from Wasteland. Also improved `gSaveContext.lastScene` assignment for both transition types. Allowed a bit of cleanup in `GetCheckArea`. * Added `StateButton`, a button like `ArrowButton` but that allows text instead of arrow icons. Apparently the changes from ArrowButton to StateButton happened in a previous commit... * Changed section name to `trackerDataCheck` to force SoH to load it after the randomizer section, as it required some randoSettings to be loaded first, and nothing else I tried to make the randomizer section load before it worked. This hacks a solution to checks not displaying on fast file load to a specific slot. F*** you, SaveManager, and f*** you too, JSON. * Forgot to change the section string for loading with the name change. * Fix check ordering for checks that trigger the autosave. * Adds option to remove right-side shop items (slots 1-4) from the tracker list. Enabled by default. * Fix default state of Hide Shop Right Checks checkbox. * Fixes grotto and great fairy scrolling and checks. Fixes array overflow from `checkTrackerData` which was creating the issue trying to load the base and randomizer sections first, among other things. That also fixed the massive file loads that were being exhibited in debug mode. * Fix shooting galleries being set as collected again when being played a second time after getting the checks. * Fix Bazaar autoscroll. * Add Saria's Song to `GetCheckFromActor` and removed some limitations from the messageCloseCheck function to make that check track properly. * Fix Song from Impa check. Implemented prevention for multiple "collections" of great fairies, just in case getting the health refill would trigger it with the previous setup. * Fix ice traps on GS tokens not triggering OnItemReceive. * Complete fix for ice trap collection from GS. Add autoscroll when clicking "Expand All". * Add `OnShopSlotChange` with cursorSlot and basePrice parameters. * Fixed include in en_ossan for shop slot hook. Added registration for `OnShopSlotChange` in the tracker, storing the price in a new `price` field in `CheckTrackerData`. Added "seen" functionality to shop checks. Displays the model item name upon first entering a shop, adding the price and switching to trickName (if it's an ice trap) upon navigating to the slot in buy mode, triggered by an invisible "identified" status that mirrors "seen" in every other way. Added tooltips to most options for check tracker color picking to describe what each status actually means. * `std::format` pls * So apparently std::format just decided to break with the latest merge from develop, but fmt::format exists and works? * Removed the last vestiges of `locationsSkipped`. Other general code and formatting cleanups. Moved `IsGameRunning` to `OTRGlobals` so the item tracker could also access it. Used preceding to "fix" item and bottle display in the item tracker on startup. * Some more code cleanup. Removed "Recheck Area" button and relevant code. Backported changes to Anchor branch applicable for single-player, including making a checkAreas vector and structuring the frame by frame checks around that. Also includes fix for Silver Gauntlets and Mirror Shield check collection crash associated with those changes. Fixed Kakariko Bazaar "seen" updates. Fixed tracker window not showing on initial load like it should. * Forgot 1 formatting fix. * Removed conditions for showing Song from Impa (isn't junk under certain conditions, so should show all the time). * Fix vanilla checks, add Zelda's Letter and Malon's Egg to manual check collection. Fix autoscroll while in child stealth section. * Fix crash in Happy Mask Shop in OnSlotChange (referenced non-existent shop id in a tracker-specific enum). * General code cleanup. * Missed one reversion. * One more. * Fix column alignment in `randomizer_check_objects`. * Fix file encoding on `randomizer_check_tracker`. Again. * Fix indentation for `actualItemtrackerItemMap`. Also removed unnecessary parts of the map. * Rename `HasEqItem` to `HasEquipment`. * Slightly better indentation for `actualItemTrackerItemMap`. * Add magic bean salesman to vanilla check tracking, and genericized deku shield to trigger KF shop item 3 wherever you get the shield. Renamed `vanillaCheck` to `vanillaHundoCheck` to (supposedly) clarify the meaning of the usage. * One more rename to `vanillaCompletion` to avoid possible confusion with 100% speedrun conditions. * give me a break XD Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * Changes suggested by briaguya (rename `RandomizerCheckShow` to `Status`, unused code, newline formatting) * Remove unused `itemNames` table. * Remove `IsGameRunning` in favor of `GameInteractor::IsSaveLoaded`. * Restore anti-spoiler functionality for dungeons with dungeon maps. * Review cleanup. * Fix prices not showing for Kak bazaar items. --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com>
2023-10-04 11:03:36 -04:00
}
stemp = RandomizerCheckObjects::GetRCAreaName(rcArea) + "##TreeNode";
ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(mainColor.r / 255.0f, mainColor.g / 255.0f,
mainColor.b / 255.0f, mainColor.a / 255.0f));
if (doingCollapseOrExpand) {
Check Tracker Update (#2668) * Initial commit. What works so far: Data file loads, saves, deletes, and is created properly. - Need to run `HasItemBeenCollected` when creating in case of mid-seed regen. Organized checks into maps set by area. Areas show in tracker. - Checks pulled from checkObjectsByArea are not currently listed. - Areas are being assumed completed and hidden at the start. * Checks now populate. Still not counting area totals properly. * Don't track RC_LINKS_POCKET in the data file, and instead manually add it in every time a save is load. rcObjects doesn't contain Link's Pocket location (duh). * Moved ItemReceive hook to randomizer_check_tracker.cpp. Skipped items are properly sorted and formatted. Saved items contribute to an area's gotten/skipped checks on load. Changed skipped items default main color to gray. General code cleanup. * Skipped checks now contribute to area totals for area completion logic. * Mid-menu rework transfer. * Started check lookup on item receive. Tried to enable scum checking on save. * Fixed scum check on save. * More code cleanup, which revealed some issues with loading and saving. Loading now works 100%, but entries in checkTrackerData are disappearing in code somewhere, causing issues with later checks. Scummed color now displays properly. Collected but unsaved displays properly. Unchecked, Skipped, Seen and Scummed checks all have arrows for skipping/unskipping. Counts a little messed up, probably double adding skips. * Fixed item counts being off across resets. Restarts were fine. * Beginning of rework for individual check updates. Adds `Actor lastCheck` to PlayState to allow assigning of last actor to give an item. This allows precise tracking of GS, freestanding PoH, etc. Works for chests too. Currently does not work for shops, unknown for normal NPC gives. Doesn't track last gives for non-checks, like drops from grass, pots, crates, etc. * Actor-based checks fully fleshed out, but can't help with sale-based checks. Implemented `pendingSaleCheck` to back out of an RC check cycle if `gSaveContext->pendingSale` is not NONE when `OnItemReceive` is called, processed through `OnSaleEnd`. This should be the final change necessary to streamline the checks. * Temporary hook to message box close to tie in trackers for non-gs/chest actors that aren't added to `GetCheckFromActor`. This triggers a 2-frame countdown to check with `HasItemBeenCollected` since half of the methods in there aren't updated until after a text box closes. Added scene tracking to get last scene so that checks in scenes that span several overworld areas could be tied to their areas properly. Modified tracker data creation to apply Link's Pocket and Song from Impa conditionally based on randomizer settings instead of just being assumed to be done. May need modification for checking click and drag spoiler loading. Removed the scene equivalence check from CheckChecks so that an entire area is checked each time to avoid issues with, e.g., leaving a shop before a pending sale finishes. * Changed check data creation to use RSKs from gRandomizer to account for settings loaded from drag and drop spoilers. * Beginning of tracker code organization. Changed check color defaults. * Reverted moving tracker colors to header. Some individual check fixes. * Missed something from previous merge? * Removed last remnant of removed performance mode. * Better handle checking when skullsanity is off. * Song checks sceneIDs don't match the scenes they're actually in for some reason. Removed that check. * SaleEnd checks don't need the GetItemEntry parameter. Also set a flag that should prevent the check tracker from running during vanilla saves should that not be resolved by the time it's merged. * Attempting to have only the relevant checks added to the tracker data, as well as showing vanilla checks for non-rando saves. Not working yet (everything is displayed in vanilla). * Added vanilla check tracker population via `vanillaCheck` bool in `RandomizerCheckObject`. This is also added to `IsVisibleInImGui` to handle file loading and saving to eliminate checks that aren't part of vanilla or the rando seed. Implemented deleted tracker data file recreation. Added some extra item name text checks. Songs are still... tricky, so they stay blank. Utilize local copies of the randomizer check objects that are applicable for performance purposes. Fixed vanilla item-giving cutscene crashes when triggered mid-transition. * Apparently not all toolchains can handle macro instantiation without all parameters, like VS can. * Fixed scummed detail color not showing properly on tracker. * Fixed dungeon area totals and GS checks not functioning properly. * Major revamp of checking code. Doesn't rely on `GetCheckFromActor` at all anymore, but instead simply sets a flag to evaluate a number of checks in an area every frame until the check that was gotten is identified. With the new setup, it's much less hardware intensive, and at 60fps 6 checks per frame shows no noticeable effect on framerate. I can envision needing to add a collectedCount in order to account for times when two checks are gotten one right after the other. Changed area scroll to happen from `OnTransitionEnd`, and allow for scrolling in bazaar (was disabled previously because it would jump back and forth between Kak and Market while you were in one). Also setup area check order updating by area instead of all at the same time. * Fixed shooting gallery not reporting proper area. Prevent checks from actually happening if area is RCAREA_INVALID, now that all areas are reporting something if they have checks. Fixed `GetCheckArea()` not updating checks for standard scenes. Lots of vanilla tracking updates, mainly manual checks for gems, medallions and songs, since the often don't have proper scenes in the data. Prevent vanilla from triggering check loops if junk items are collected. Fixed sorting based on saved vs collected. Prevent item name display for vanilla runs. Change coloring of checks so the check name reflects status in vanilla runs. * Fixed "Recheck Area" button erroneously adding to an area's check totals? * Fix DMC vanilla checks. * Fix check tracker data recreation on data file loss. Removed redundant file exists check from SaveTrackerDataHook, as it doesn't matter if it exists or not at that point. Limited check loops to 3 to avoid infinite check loops on non-check/junk item pickup. Added more checks to disable tracker operations if a save is not running. Changed check ordering to put boss reward and heart container checks at the end of whatever RCSHOW group they belong to. * Fixed IsRunning calculation. Further improving vanilla checking. Starting framework for checking medallions, stones, and songs on data file recreation. Fixed medallion check collection. Added GIFT_FROM_SAGES to check list for vanilla file for tracking light medallion. Added check loop limitation to prevent infinite checking after picking up junk item from the ground. * Finished vanilla file recreation and recheck (songs and dungeon rewards all check properly now). This includes deku shield with KF shop item 3. Finished Gift from Raoru light medallion tracking for vanilla. Commented all CheckByScene functionality for now. * Fixed new save data file creation. Disabled entrance area calculation for now, as it only tracks the previous entrance for some reason. Fixed area detection for ToT checks. * GetCheckArea() now utilizes EntranceData almost exclusively, via either `gSaveContext.entranceIndex` or the entrance tracker's `currentGrottoId` in the case of grottos. This also means that EVERYTHING CAN AUTOSCROLL NOW. Entrance shuffles are now much easier to track. Autoscroll is now also triggered on save, just in case someone isn't autosaving and has a lot of checks that get converted to saved. * Fixed missing GS check in LW. * Added area scroll on toggling Show Hidden Items. May configure differently later. Fixed area detection for entrances in Gerudo Fortress/Valley and Collossus. Haunted wasteland doesn't autoscroll due to a bug in `OnTransitionEnd` hook, but checks still evaluate properly there. Rely on scene-based area detection if scene is a main overworld or dungeon scene. * Fixed grotto detection when shuffle is off. * Small code cleanup. Fixed Colossus hand chest checks. * Missing lus bump from merge conflict resolution * Fixed Colossus Grotto making `GetCheckArea` return Wasteland. * Improved OnItemReceive processing for non-token GS checks, since they can sometimes take long enough for the checking process to time out before the item is registered as received. * First attempt at thread safety for tracker data file writing. Seems to work, but might need more testing. * Fixed Recheck Area not unskipping items that register as saved. Improved delayed saving with autosaving, as the autosave triggered quite often before the tracker data save, making things not properly register as saved. * merge cleanup * Converted check tracker data to the sectional saves, adding `CheckTrackerData` to `SaveContext`. Implemented section ID returning and fullSave boolean passing to section functions from my PR temporarily for it to work properly. Moved `RandomizerCheckTrackerData` enum to `randomizerTypes.h` to accommodate that. Changed `Randomizer_SaveInit` to a `SaveManager::InitFunc` to allow for other randomizer-dependent sections to be initialized after that. Required a little refactoring to maintain intro cutscene skip when starting a randomizer file. * Revert section index return and randomizer init changes. Will need to wait on yet more changes to main. * Fixed check tracker initialization (shouldn't be tied to window initialization), restored saving/loading functionality. * Removed `CheckTracker::Init` and put SaveManager calls in `CheckTrackerWindow::InitElement`. Also a bit of cleanup from transition back to save file use. * Fixed tracker displaying check categories while file not loaded. * Fix Darunia's Joy check not marking in vanilla. * Fix autosave not triggering change from collected to saved in tracker data. * Changed default colors for scummed and collected display. * Merge upgrade code cleanup. * Add `OnTransitionEnd` calls to sandstorm transitions both to and from Wasteland. Also improved `gSaveContext.lastScene` assignment for both transition types. Allowed a bit of cleanup in `GetCheckArea`. * Added `StateButton`, a button like `ArrowButton` but that allows text instead of arrow icons. Apparently the changes from ArrowButton to StateButton happened in a previous commit... * Changed section name to `trackerDataCheck` to force SoH to load it after the randomizer section, as it required some randoSettings to be loaded first, and nothing else I tried to make the randomizer section load before it worked. This hacks a solution to checks not displaying on fast file load to a specific slot. F*** you, SaveManager, and f*** you too, JSON. * Forgot to change the section string for loading with the name change. * Fix check ordering for checks that trigger the autosave. * Adds option to remove right-side shop items (slots 1-4) from the tracker list. Enabled by default. * Fix default state of Hide Shop Right Checks checkbox. * Fixes grotto and great fairy scrolling and checks. Fixes array overflow from `checkTrackerData` which was creating the issue trying to load the base and randomizer sections first, among other things. That also fixed the massive file loads that were being exhibited in debug mode. * Fix shooting galleries being set as collected again when being played a second time after getting the checks. * Fix Bazaar autoscroll. * Add Saria's Song to `GetCheckFromActor` and removed some limitations from the messageCloseCheck function to make that check track properly. * Fix Song from Impa check. Implemented prevention for multiple "collections" of great fairies, just in case getting the health refill would trigger it with the previous setup. * Fix ice traps on GS tokens not triggering OnItemReceive. * Complete fix for ice trap collection from GS. Add autoscroll when clicking "Expand All". * Add `OnShopSlotChange` with cursorSlot and basePrice parameters. * Fixed include in en_ossan for shop slot hook. Added registration for `OnShopSlotChange` in the tracker, storing the price in a new `price` field in `CheckTrackerData`. Added "seen" functionality to shop checks. Displays the model item name upon first entering a shop, adding the price and switching to trickName (if it's an ice trap) upon navigating to the slot in buy mode, triggered by an invisible "identified" status that mirrors "seen" in every other way. Added tooltips to most options for check tracker color picking to describe what each status actually means. * `std::format` pls * So apparently std::format just decided to break with the latest merge from develop, but fmt::format exists and works? * Removed the last vestiges of `locationsSkipped`. Other general code and formatting cleanups. Moved `IsGameRunning` to `OTRGlobals` so the item tracker could also access it. Used preceding to "fix" item and bottle display in the item tracker on startup. * Some more code cleanup. Removed "Recheck Area" button and relevant code. Backported changes to Anchor branch applicable for single-player, including making a checkAreas vector and structuring the frame by frame checks around that. Also includes fix for Silver Gauntlets and Mirror Shield check collection crash associated with those changes. Fixed Kakariko Bazaar "seen" updates. Fixed tracker window not showing on initial load like it should. * Forgot 1 formatting fix. * Removed conditions for showing Song from Impa (isn't junk under certain conditions, so should show all the time). * Fix vanilla checks, add Zelda's Letter and Malon's Egg to manual check collection. Fix autoscroll while in child stealth section. * Fix crash in Happy Mask Shop in OnSlotChange (referenced non-existent shop id in a tracker-specific enum). * General code cleanup. * Missed one reversion. * One more. * Fix column alignment in `randomizer_check_objects`. * Fix file encoding on `randomizer_check_tracker`. Again. * Fix indentation for `actualItemtrackerItemMap`. Also removed unnecessary parts of the map. * Rename `HasEqItem` to `HasEquipment`. * Slightly better indentation for `actualItemTrackerItemMap`. * Add magic bean salesman to vanilla check tracking, and genericized deku shield to trigger KF shop item 3 wherever you get the shield. Renamed `vanillaCheck` to `vanillaHundoCheck` to (supposedly) clarify the meaning of the usage. * One more rename to `vanillaCompletion` to avoid possible confusion with 100% speedrun conditions. * give me a break XD Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * Changes suggested by briaguya (rename `RandomizerCheckShow` to `Status`, unused code, newline formatting) * Remove unused `itemNames` table. * Remove `IsGameRunning` in favor of `GameInteractor::IsSaveLoaded`. * Restore anti-spoiler functionality for dungeons with dungeon maps. * Review cleanup. * Fix prices not showing for Kak bazaar items. --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com>
2023-10-04 11:03:36 -04:00
ImGui::SetNextItemOpen(collapseLogic, ImGuiCond_Always);
} else {
Check Tracker Update (#2668) * Initial commit. What works so far: Data file loads, saves, deletes, and is created properly. - Need to run `HasItemBeenCollected` when creating in case of mid-seed regen. Organized checks into maps set by area. Areas show in tracker. - Checks pulled from checkObjectsByArea are not currently listed. - Areas are being assumed completed and hidden at the start. * Checks now populate. Still not counting area totals properly. * Don't track RC_LINKS_POCKET in the data file, and instead manually add it in every time a save is load. rcObjects doesn't contain Link's Pocket location (duh). * Moved ItemReceive hook to randomizer_check_tracker.cpp. Skipped items are properly sorted and formatted. Saved items contribute to an area's gotten/skipped checks on load. Changed skipped items default main color to gray. General code cleanup. * Skipped checks now contribute to area totals for area completion logic. * Mid-menu rework transfer. * Started check lookup on item receive. Tried to enable scum checking on save. * Fixed scum check on save. * More code cleanup, which revealed some issues with loading and saving. Loading now works 100%, but entries in checkTrackerData are disappearing in code somewhere, causing issues with later checks. Scummed color now displays properly. Collected but unsaved displays properly. Unchecked, Skipped, Seen and Scummed checks all have arrows for skipping/unskipping. Counts a little messed up, probably double adding skips. * Fixed item counts being off across resets. Restarts were fine. * Beginning of rework for individual check updates. Adds `Actor lastCheck` to PlayState to allow assigning of last actor to give an item. This allows precise tracking of GS, freestanding PoH, etc. Works for chests too. Currently does not work for shops, unknown for normal NPC gives. Doesn't track last gives for non-checks, like drops from grass, pots, crates, etc. * Actor-based checks fully fleshed out, but can't help with sale-based checks. Implemented `pendingSaleCheck` to back out of an RC check cycle if `gSaveContext->pendingSale` is not NONE when `OnItemReceive` is called, processed through `OnSaleEnd`. This should be the final change necessary to streamline the checks. * Temporary hook to message box close to tie in trackers for non-gs/chest actors that aren't added to `GetCheckFromActor`. This triggers a 2-frame countdown to check with `HasItemBeenCollected` since half of the methods in there aren't updated until after a text box closes. Added scene tracking to get last scene so that checks in scenes that span several overworld areas could be tied to their areas properly. Modified tracker data creation to apply Link's Pocket and Song from Impa conditionally based on randomizer settings instead of just being assumed to be done. May need modification for checking click and drag spoiler loading. Removed the scene equivalence check from CheckChecks so that an entire area is checked each time to avoid issues with, e.g., leaving a shop before a pending sale finishes. * Changed check data creation to use RSKs from gRandomizer to account for settings loaded from drag and drop spoilers. * Beginning of tracker code organization. Changed check color defaults. * Reverted moving tracker colors to header. Some individual check fixes. * Missed something from previous merge? * Removed last remnant of removed performance mode. * Better handle checking when skullsanity is off. * Song checks sceneIDs don't match the scenes they're actually in for some reason. Removed that check. * SaleEnd checks don't need the GetItemEntry parameter. Also set a flag that should prevent the check tracker from running during vanilla saves should that not be resolved by the time it's merged. * Attempting to have only the relevant checks added to the tracker data, as well as showing vanilla checks for non-rando saves. Not working yet (everything is displayed in vanilla). * Added vanilla check tracker population via `vanillaCheck` bool in `RandomizerCheckObject`. This is also added to `IsVisibleInImGui` to handle file loading and saving to eliminate checks that aren't part of vanilla or the rando seed. Implemented deleted tracker data file recreation. Added some extra item name text checks. Songs are still... tricky, so they stay blank. Utilize local copies of the randomizer check objects that are applicable for performance purposes. Fixed vanilla item-giving cutscene crashes when triggered mid-transition. * Apparently not all toolchains can handle macro instantiation without all parameters, like VS can. * Fixed scummed detail color not showing properly on tracker. * Fixed dungeon area totals and GS checks not functioning properly. * Major revamp of checking code. Doesn't rely on `GetCheckFromActor` at all anymore, but instead simply sets a flag to evaluate a number of checks in an area every frame until the check that was gotten is identified. With the new setup, it's much less hardware intensive, and at 60fps 6 checks per frame shows no noticeable effect on framerate. I can envision needing to add a collectedCount in order to account for times when two checks are gotten one right after the other. Changed area scroll to happen from `OnTransitionEnd`, and allow for scrolling in bazaar (was disabled previously because it would jump back and forth between Kak and Market while you were in one). Also setup area check order updating by area instead of all at the same time. * Fixed shooting gallery not reporting proper area. Prevent checks from actually happening if area is RCAREA_INVALID, now that all areas are reporting something if they have checks. Fixed `GetCheckArea()` not updating checks for standard scenes. Lots of vanilla tracking updates, mainly manual checks for gems, medallions and songs, since the often don't have proper scenes in the data. Prevent vanilla from triggering check loops if junk items are collected. Fixed sorting based on saved vs collected. Prevent item name display for vanilla runs. Change coloring of checks so the check name reflects status in vanilla runs. * Fixed "Recheck Area" button erroneously adding to an area's check totals? * Fix DMC vanilla checks. * Fix check tracker data recreation on data file loss. Removed redundant file exists check from SaveTrackerDataHook, as it doesn't matter if it exists or not at that point. Limited check loops to 3 to avoid infinite check loops on non-check/junk item pickup. Added more checks to disable tracker operations if a save is not running. Changed check ordering to put boss reward and heart container checks at the end of whatever RCSHOW group they belong to. * Fixed IsRunning calculation. Further improving vanilla checking. Starting framework for checking medallions, stones, and songs on data file recreation. Fixed medallion check collection. Added GIFT_FROM_SAGES to check list for vanilla file for tracking light medallion. Added check loop limitation to prevent infinite checking after picking up junk item from the ground. * Finished vanilla file recreation and recheck (songs and dungeon rewards all check properly now). This includes deku shield with KF shop item 3. Finished Gift from Raoru light medallion tracking for vanilla. Commented all CheckByScene functionality for now. * Fixed new save data file creation. Disabled entrance area calculation for now, as it only tracks the previous entrance for some reason. Fixed area detection for ToT checks. * GetCheckArea() now utilizes EntranceData almost exclusively, via either `gSaveContext.entranceIndex` or the entrance tracker's `currentGrottoId` in the case of grottos. This also means that EVERYTHING CAN AUTOSCROLL NOW. Entrance shuffles are now much easier to track. Autoscroll is now also triggered on save, just in case someone isn't autosaving and has a lot of checks that get converted to saved. * Fixed missing GS check in LW. * Added area scroll on toggling Show Hidden Items. May configure differently later. Fixed area detection for entrances in Gerudo Fortress/Valley and Collossus. Haunted wasteland doesn't autoscroll due to a bug in `OnTransitionEnd` hook, but checks still evaluate properly there. Rely on scene-based area detection if scene is a main overworld or dungeon scene. * Fixed grotto detection when shuffle is off. * Small code cleanup. Fixed Colossus hand chest checks. * Missing lus bump from merge conflict resolution * Fixed Colossus Grotto making `GetCheckArea` return Wasteland. * Improved OnItemReceive processing for non-token GS checks, since they can sometimes take long enough for the checking process to time out before the item is registered as received. * First attempt at thread safety for tracker data file writing. Seems to work, but might need more testing. * Fixed Recheck Area not unskipping items that register as saved. Improved delayed saving with autosaving, as the autosave triggered quite often before the tracker data save, making things not properly register as saved. * merge cleanup * Converted check tracker data to the sectional saves, adding `CheckTrackerData` to `SaveContext`. Implemented section ID returning and fullSave boolean passing to section functions from my PR temporarily for it to work properly. Moved `RandomizerCheckTrackerData` enum to `randomizerTypes.h` to accommodate that. Changed `Randomizer_SaveInit` to a `SaveManager::InitFunc` to allow for other randomizer-dependent sections to be initialized after that. Required a little refactoring to maintain intro cutscene skip when starting a randomizer file. * Revert section index return and randomizer init changes. Will need to wait on yet more changes to main. * Fixed check tracker initialization (shouldn't be tied to window initialization), restored saving/loading functionality. * Removed `CheckTracker::Init` and put SaveManager calls in `CheckTrackerWindow::InitElement`. Also a bit of cleanup from transition back to save file use. * Fixed tracker displaying check categories while file not loaded. * Fix Darunia's Joy check not marking in vanilla. * Fix autosave not triggering change from collected to saved in tracker data. * Changed default colors for scummed and collected display. * Merge upgrade code cleanup. * Add `OnTransitionEnd` calls to sandstorm transitions both to and from Wasteland. Also improved `gSaveContext.lastScene` assignment for both transition types. Allowed a bit of cleanup in `GetCheckArea`. * Added `StateButton`, a button like `ArrowButton` but that allows text instead of arrow icons. Apparently the changes from ArrowButton to StateButton happened in a previous commit... * Changed section name to `trackerDataCheck` to force SoH to load it after the randomizer section, as it required some randoSettings to be loaded first, and nothing else I tried to make the randomizer section load before it worked. This hacks a solution to checks not displaying on fast file load to a specific slot. F*** you, SaveManager, and f*** you too, JSON. * Forgot to change the section string for loading with the name change. * Fix check ordering for checks that trigger the autosave. * Adds option to remove right-side shop items (slots 1-4) from the tracker list. Enabled by default. * Fix default state of Hide Shop Right Checks checkbox. * Fixes grotto and great fairy scrolling and checks. Fixes array overflow from `checkTrackerData` which was creating the issue trying to load the base and randomizer sections first, among other things. That also fixed the massive file loads that were being exhibited in debug mode. * Fix shooting galleries being set as collected again when being played a second time after getting the checks. * Fix Bazaar autoscroll. * Add Saria's Song to `GetCheckFromActor` and removed some limitations from the messageCloseCheck function to make that check track properly. * Fix Song from Impa check. Implemented prevention for multiple "collections" of great fairies, just in case getting the health refill would trigger it with the previous setup. * Fix ice traps on GS tokens not triggering OnItemReceive. * Complete fix for ice trap collection from GS. Add autoscroll when clicking "Expand All". * Add `OnShopSlotChange` with cursorSlot and basePrice parameters. * Fixed include in en_ossan for shop slot hook. Added registration for `OnShopSlotChange` in the tracker, storing the price in a new `price` field in `CheckTrackerData`. Added "seen" functionality to shop checks. Displays the model item name upon first entering a shop, adding the price and switching to trickName (if it's an ice trap) upon navigating to the slot in buy mode, triggered by an invisible "identified" status that mirrors "seen" in every other way. Added tooltips to most options for check tracker color picking to describe what each status actually means. * `std::format` pls * So apparently std::format just decided to break with the latest merge from develop, but fmt::format exists and works? * Removed the last vestiges of `locationsSkipped`. Other general code and formatting cleanups. Moved `IsGameRunning` to `OTRGlobals` so the item tracker could also access it. Used preceding to "fix" item and bottle display in the item tracker on startup. * Some more code cleanup. Removed "Recheck Area" button and relevant code. Backported changes to Anchor branch applicable for single-player, including making a checkAreas vector and structuring the frame by frame checks around that. Also includes fix for Silver Gauntlets and Mirror Shield check collection crash associated with those changes. Fixed Kakariko Bazaar "seen" updates. Fixed tracker window not showing on initial load like it should. * Forgot 1 formatting fix. * Removed conditions for showing Song from Impa (isn't junk under certain conditions, so should show all the time). * Fix vanilla checks, add Zelda's Letter and Malon's Egg to manual check collection. Fix autoscroll while in child stealth section. * Fix crash in Happy Mask Shop in OnSlotChange (referenced non-existent shop id in a tracker-specific enum). * General code cleanup. * Missed one reversion. * One more. * Fix column alignment in `randomizer_check_objects`. * Fix file encoding on `randomizer_check_tracker`. Again. * Fix indentation for `actualItemtrackerItemMap`. Also removed unnecessary parts of the map. * Rename `HasEqItem` to `HasEquipment`. * Slightly better indentation for `actualItemTrackerItemMap`. * Add magic bean salesman to vanilla check tracking, and genericized deku shield to trigger KF shop item 3 wherever you get the shield. Renamed `vanillaCheck` to `vanillaHundoCheck` to (supposedly) clarify the meaning of the usage. * One more rename to `vanillaCompletion` to avoid possible confusion with 100% speedrun conditions. * give me a break XD Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * Changes suggested by briaguya (rename `RandomizerCheckShow` to `Status`, unused code, newline formatting) * Remove unused `itemNames` table. * Remove `IsGameRunning` in favor of `GameInteractor::IsSaveLoaded`. * Restore anti-spoiler functionality for dungeons with dungeon maps. * Review cleanup. * Fix prices not showing for Kak bazaar items. --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com>
2023-10-04 11:03:36 -04:00
ImGui::SetNextItemOpen(!thisAreaFullyChecked, ImGuiCond_Once);
}
Check Tracker Update (#2668) * Initial commit. What works so far: Data file loads, saves, deletes, and is created properly. - Need to run `HasItemBeenCollected` when creating in case of mid-seed regen. Organized checks into maps set by area. Areas show in tracker. - Checks pulled from checkObjectsByArea are not currently listed. - Areas are being assumed completed and hidden at the start. * Checks now populate. Still not counting area totals properly. * Don't track RC_LINKS_POCKET in the data file, and instead manually add it in every time a save is load. rcObjects doesn't contain Link's Pocket location (duh). * Moved ItemReceive hook to randomizer_check_tracker.cpp. Skipped items are properly sorted and formatted. Saved items contribute to an area's gotten/skipped checks on load. Changed skipped items default main color to gray. General code cleanup. * Skipped checks now contribute to area totals for area completion logic. * Mid-menu rework transfer. * Started check lookup on item receive. Tried to enable scum checking on save. * Fixed scum check on save. * More code cleanup, which revealed some issues with loading and saving. Loading now works 100%, but entries in checkTrackerData are disappearing in code somewhere, causing issues with later checks. Scummed color now displays properly. Collected but unsaved displays properly. Unchecked, Skipped, Seen and Scummed checks all have arrows for skipping/unskipping. Counts a little messed up, probably double adding skips. * Fixed item counts being off across resets. Restarts were fine. * Beginning of rework for individual check updates. Adds `Actor lastCheck` to PlayState to allow assigning of last actor to give an item. This allows precise tracking of GS, freestanding PoH, etc. Works for chests too. Currently does not work for shops, unknown for normal NPC gives. Doesn't track last gives for non-checks, like drops from grass, pots, crates, etc. * Actor-based checks fully fleshed out, but can't help with sale-based checks. Implemented `pendingSaleCheck` to back out of an RC check cycle if `gSaveContext->pendingSale` is not NONE when `OnItemReceive` is called, processed through `OnSaleEnd`. This should be the final change necessary to streamline the checks. * Temporary hook to message box close to tie in trackers for non-gs/chest actors that aren't added to `GetCheckFromActor`. This triggers a 2-frame countdown to check with `HasItemBeenCollected` since half of the methods in there aren't updated until after a text box closes. Added scene tracking to get last scene so that checks in scenes that span several overworld areas could be tied to their areas properly. Modified tracker data creation to apply Link's Pocket and Song from Impa conditionally based on randomizer settings instead of just being assumed to be done. May need modification for checking click and drag spoiler loading. Removed the scene equivalence check from CheckChecks so that an entire area is checked each time to avoid issues with, e.g., leaving a shop before a pending sale finishes. * Changed check data creation to use RSKs from gRandomizer to account for settings loaded from drag and drop spoilers. * Beginning of tracker code organization. Changed check color defaults. * Reverted moving tracker colors to header. Some individual check fixes. * Missed something from previous merge? * Removed last remnant of removed performance mode. * Better handle checking when skullsanity is off. * Song checks sceneIDs don't match the scenes they're actually in for some reason. Removed that check. * SaleEnd checks don't need the GetItemEntry parameter. Also set a flag that should prevent the check tracker from running during vanilla saves should that not be resolved by the time it's merged. * Attempting to have only the relevant checks added to the tracker data, as well as showing vanilla checks for non-rando saves. Not working yet (everything is displayed in vanilla). * Added vanilla check tracker population via `vanillaCheck` bool in `RandomizerCheckObject`. This is also added to `IsVisibleInImGui` to handle file loading and saving to eliminate checks that aren't part of vanilla or the rando seed. Implemented deleted tracker data file recreation. Added some extra item name text checks. Songs are still... tricky, so they stay blank. Utilize local copies of the randomizer check objects that are applicable for performance purposes. Fixed vanilla item-giving cutscene crashes when triggered mid-transition. * Apparently not all toolchains can handle macro instantiation without all parameters, like VS can. * Fixed scummed detail color not showing properly on tracker. * Fixed dungeon area totals and GS checks not functioning properly. * Major revamp of checking code. Doesn't rely on `GetCheckFromActor` at all anymore, but instead simply sets a flag to evaluate a number of checks in an area every frame until the check that was gotten is identified. With the new setup, it's much less hardware intensive, and at 60fps 6 checks per frame shows no noticeable effect on framerate. I can envision needing to add a collectedCount in order to account for times when two checks are gotten one right after the other. Changed area scroll to happen from `OnTransitionEnd`, and allow for scrolling in bazaar (was disabled previously because it would jump back and forth between Kak and Market while you were in one). Also setup area check order updating by area instead of all at the same time. * Fixed shooting gallery not reporting proper area. Prevent checks from actually happening if area is RCAREA_INVALID, now that all areas are reporting something if they have checks. Fixed `GetCheckArea()` not updating checks for standard scenes. Lots of vanilla tracking updates, mainly manual checks for gems, medallions and songs, since the often don't have proper scenes in the data. Prevent vanilla from triggering check loops if junk items are collected. Fixed sorting based on saved vs collected. Prevent item name display for vanilla runs. Change coloring of checks so the check name reflects status in vanilla runs. * Fixed "Recheck Area" button erroneously adding to an area's check totals? * Fix DMC vanilla checks. * Fix check tracker data recreation on data file loss. Removed redundant file exists check from SaveTrackerDataHook, as it doesn't matter if it exists or not at that point. Limited check loops to 3 to avoid infinite check loops on non-check/junk item pickup. Added more checks to disable tracker operations if a save is not running. Changed check ordering to put boss reward and heart container checks at the end of whatever RCSHOW group they belong to. * Fixed IsRunning calculation. Further improving vanilla checking. Starting framework for checking medallions, stones, and songs on data file recreation. Fixed medallion check collection. Added GIFT_FROM_SAGES to check list for vanilla file for tracking light medallion. Added check loop limitation to prevent infinite checking after picking up junk item from the ground. * Finished vanilla file recreation and recheck (songs and dungeon rewards all check properly now). This includes deku shield with KF shop item 3. Finished Gift from Raoru light medallion tracking for vanilla. Commented all CheckByScene functionality for now. * Fixed new save data file creation. Disabled entrance area calculation for now, as it only tracks the previous entrance for some reason. Fixed area detection for ToT checks. * GetCheckArea() now utilizes EntranceData almost exclusively, via either `gSaveContext.entranceIndex` or the entrance tracker's `currentGrottoId` in the case of grottos. This also means that EVERYTHING CAN AUTOSCROLL NOW. Entrance shuffles are now much easier to track. Autoscroll is now also triggered on save, just in case someone isn't autosaving and has a lot of checks that get converted to saved. * Fixed missing GS check in LW. * Added area scroll on toggling Show Hidden Items. May configure differently later. Fixed area detection for entrances in Gerudo Fortress/Valley and Collossus. Haunted wasteland doesn't autoscroll due to a bug in `OnTransitionEnd` hook, but checks still evaluate properly there. Rely on scene-based area detection if scene is a main overworld or dungeon scene. * Fixed grotto detection when shuffle is off. * Small code cleanup. Fixed Colossus hand chest checks. * Missing lus bump from merge conflict resolution * Fixed Colossus Grotto making `GetCheckArea` return Wasteland. * Improved OnItemReceive processing for non-token GS checks, since they can sometimes take long enough for the checking process to time out before the item is registered as received. * First attempt at thread safety for tracker data file writing. Seems to work, but might need more testing. * Fixed Recheck Area not unskipping items that register as saved. Improved delayed saving with autosaving, as the autosave triggered quite often before the tracker data save, making things not properly register as saved. * merge cleanup * Converted check tracker data to the sectional saves, adding `CheckTrackerData` to `SaveContext`. Implemented section ID returning and fullSave boolean passing to section functions from my PR temporarily for it to work properly. Moved `RandomizerCheckTrackerData` enum to `randomizerTypes.h` to accommodate that. Changed `Randomizer_SaveInit` to a `SaveManager::InitFunc` to allow for other randomizer-dependent sections to be initialized after that. Required a little refactoring to maintain intro cutscene skip when starting a randomizer file. * Revert section index return and randomizer init changes. Will need to wait on yet more changes to main. * Fixed check tracker initialization (shouldn't be tied to window initialization), restored saving/loading functionality. * Removed `CheckTracker::Init` and put SaveManager calls in `CheckTrackerWindow::InitElement`. Also a bit of cleanup from transition back to save file use. * Fixed tracker displaying check categories while file not loaded. * Fix Darunia's Joy check not marking in vanilla. * Fix autosave not triggering change from collected to saved in tracker data. * Changed default colors for scummed and collected display. * Merge upgrade code cleanup. * Add `OnTransitionEnd` calls to sandstorm transitions both to and from Wasteland. Also improved `gSaveContext.lastScene` assignment for both transition types. Allowed a bit of cleanup in `GetCheckArea`. * Added `StateButton`, a button like `ArrowButton` but that allows text instead of arrow icons. Apparently the changes from ArrowButton to StateButton happened in a previous commit... * Changed section name to `trackerDataCheck` to force SoH to load it after the randomizer section, as it required some randoSettings to be loaded first, and nothing else I tried to make the randomizer section load before it worked. This hacks a solution to checks not displaying on fast file load to a specific slot. F*** you, SaveManager, and f*** you too, JSON. * Forgot to change the section string for loading with the name change. * Fix check ordering for checks that trigger the autosave. * Adds option to remove right-side shop items (slots 1-4) from the tracker list. Enabled by default. * Fix default state of Hide Shop Right Checks checkbox. * Fixes grotto and great fairy scrolling and checks. Fixes array overflow from `checkTrackerData` which was creating the issue trying to load the base and randomizer sections first, among other things. That also fixed the massive file loads that were being exhibited in debug mode. * Fix shooting galleries being set as collected again when being played a second time after getting the checks. * Fix Bazaar autoscroll. * Add Saria's Song to `GetCheckFromActor` and removed some limitations from the messageCloseCheck function to make that check track properly. * Fix Song from Impa check. Implemented prevention for multiple "collections" of great fairies, just in case getting the health refill would trigger it with the previous setup. * Fix ice traps on GS tokens not triggering OnItemReceive. * Complete fix for ice trap collection from GS. Add autoscroll when clicking "Expand All". * Add `OnShopSlotChange` with cursorSlot and basePrice parameters. * Fixed include in en_ossan for shop slot hook. Added registration for `OnShopSlotChange` in the tracker, storing the price in a new `price` field in `CheckTrackerData`. Added "seen" functionality to shop checks. Displays the model item name upon first entering a shop, adding the price and switching to trickName (if it's an ice trap) upon navigating to the slot in buy mode, triggered by an invisible "identified" status that mirrors "seen" in every other way. Added tooltips to most options for check tracker color picking to describe what each status actually means. * `std::format` pls * So apparently std::format just decided to break with the latest merge from develop, but fmt::format exists and works? * Removed the last vestiges of `locationsSkipped`. Other general code and formatting cleanups. Moved `IsGameRunning` to `OTRGlobals` so the item tracker could also access it. Used preceding to "fix" item and bottle display in the item tracker on startup. * Some more code cleanup. Removed "Recheck Area" button and relevant code. Backported changes to Anchor branch applicable for single-player, including making a checkAreas vector and structuring the frame by frame checks around that. Also includes fix for Silver Gauntlets and Mirror Shield check collection crash associated with those changes. Fixed Kakariko Bazaar "seen" updates. Fixed tracker window not showing on initial load like it should. * Forgot 1 formatting fix. * Removed conditions for showing Song from Impa (isn't junk under certain conditions, so should show all the time). * Fix vanilla checks, add Zelda's Letter and Malon's Egg to manual check collection. Fix autoscroll while in child stealth section. * Fix crash in Happy Mask Shop in OnSlotChange (referenced non-existent shop id in a tracker-specific enum). * General code cleanup. * Missed one reversion. * One more. * Fix column alignment in `randomizer_check_objects`. * Fix file encoding on `randomizer_check_tracker`. Again. * Fix indentation for `actualItemtrackerItemMap`. Also removed unnecessary parts of the map. * Rename `HasEqItem` to `HasEquipment`. * Slightly better indentation for `actualItemTrackerItemMap`. * Add magic bean salesman to vanilla check tracking, and genericized deku shield to trigger KF shop item 3 wherever you get the shield. Renamed `vanillaCheck` to `vanillaHundoCheck` to (supposedly) clarify the meaning of the usage. * One more rename to `vanillaCompletion` to avoid possible confusion with 100% speedrun conditions. * give me a break XD Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * Changes suggested by briaguya (rename `RandomizerCheckShow` to `Status`, unused code, newline formatting) * Remove unused `itemNames` table. * Remove `IsGameRunning` in favor of `GameInteractor::IsSaveLoaded`. * Restore anti-spoiler functionality for dungeons with dungeon maps. * Review cleanup. * Fix prices not showing for Kak bazaar items. --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com>
2023-10-04 11:03:36 -04:00
doDraw = ImGui::TreeNode(stemp.c_str());
ImGui::PopStyleColor();
ImGui::SameLine();
ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(extraColor.r / 255.0f, extraColor.g / 255.0f,
extraColor.b / 255.0f, extraColor.a / 255.0f));
Flag tracker (#3447) * Hook into flagset hooks for processing check tracking. Has some manual workarounds (some breaks still need to be found). Remove areaChecks and looping functionality as redundant. * Additional vanilla handling. * Fix tracker not showing MQ checks in MQ non-rando. Fix tracker marking non-MQ variants of dungeon checks (e.g. map chest, etc) when collecting in MQ. * Set all areas to spoiled if not rando. * Revert attempt to spoil in randomizer based on MQ dungeon count as I don't know how that works at the moment. * Restore and update spoiling based on MQ dungeon settings (none, selection, or count of 12). Fix Anju As Adult check. * Remove Anchor-specific code :baguette: * Use `ClearAreaTotals()` in `Teardown()` instead of the duplicate code there. * Update to `ClearAreaChecksAndTotals()` with `vec.clear()` added. * Fix type spoiling again. Now spoils on 0 MQ dungeons, not rando, if the option is enabled in check tracker settings, selection, or set number of 12. Fix vanilla checks being marked collected in MQ dungeons. * Fix 100 GS check. * ACTUALLY fix 100 GS: change flag type to `RandomizerInf()` in `item_location.cpp`, add RC to RandoInf for it to the table. Also don't send GI for flag if father, falsely triggers ZR frogs minigame. * Fix gravedigging tour tracking. * Fix membership card check tracking. Change scene and flag values to any existing enums. Clarifying formatting for the checking loop vOrMQ conditions. * Fix Gravedigging Tour tracking. Simplify Always Win Gravedigging Tour and Fix Gravedigging Tour Glitch applications. Modified all necessary paths to use vanilla GDT PoH collection flag instead of randomizer variant. * Fix Kak Potion Shop being "seen" when entering as child.
2023-11-28 21:25:48 -05:00
isThisAreaSpoiled = areasSpoiled & areaMask || CVarGetInteger("gCheckTrackerOptionMQSpoilers", 0) || !IS_RANDO ||
OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_RANDOM_MQ_DUNGEONS) == RO_MQ_DUNGEONS_NONE ||
OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_RANDOM_MQ_DUNGEONS) == RO_MQ_DUNGEONS_SELECTION ||
(OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_RANDOM_MQ_DUNGEONS) == RO_MQ_DUNGEONS_SET_NUMBER &&
OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_MQ_DUNGEON_COUNT) == 12);
Check Tracker Update (#2668) * Initial commit. What works so far: Data file loads, saves, deletes, and is created properly. - Need to run `HasItemBeenCollected` when creating in case of mid-seed regen. Organized checks into maps set by area. Areas show in tracker. - Checks pulled from checkObjectsByArea are not currently listed. - Areas are being assumed completed and hidden at the start. * Checks now populate. Still not counting area totals properly. * Don't track RC_LINKS_POCKET in the data file, and instead manually add it in every time a save is load. rcObjects doesn't contain Link's Pocket location (duh). * Moved ItemReceive hook to randomizer_check_tracker.cpp. Skipped items are properly sorted and formatted. Saved items contribute to an area's gotten/skipped checks on load. Changed skipped items default main color to gray. General code cleanup. * Skipped checks now contribute to area totals for area completion logic. * Mid-menu rework transfer. * Started check lookup on item receive. Tried to enable scum checking on save. * Fixed scum check on save. * More code cleanup, which revealed some issues with loading and saving. Loading now works 100%, but entries in checkTrackerData are disappearing in code somewhere, causing issues with later checks. Scummed color now displays properly. Collected but unsaved displays properly. Unchecked, Skipped, Seen and Scummed checks all have arrows for skipping/unskipping. Counts a little messed up, probably double adding skips. * Fixed item counts being off across resets. Restarts were fine. * Beginning of rework for individual check updates. Adds `Actor lastCheck` to PlayState to allow assigning of last actor to give an item. This allows precise tracking of GS, freestanding PoH, etc. Works for chests too. Currently does not work for shops, unknown for normal NPC gives. Doesn't track last gives for non-checks, like drops from grass, pots, crates, etc. * Actor-based checks fully fleshed out, but can't help with sale-based checks. Implemented `pendingSaleCheck` to back out of an RC check cycle if `gSaveContext->pendingSale` is not NONE when `OnItemReceive` is called, processed through `OnSaleEnd`. This should be the final change necessary to streamline the checks. * Temporary hook to message box close to tie in trackers for non-gs/chest actors that aren't added to `GetCheckFromActor`. This triggers a 2-frame countdown to check with `HasItemBeenCollected` since half of the methods in there aren't updated until after a text box closes. Added scene tracking to get last scene so that checks in scenes that span several overworld areas could be tied to their areas properly. Modified tracker data creation to apply Link's Pocket and Song from Impa conditionally based on randomizer settings instead of just being assumed to be done. May need modification for checking click and drag spoiler loading. Removed the scene equivalence check from CheckChecks so that an entire area is checked each time to avoid issues with, e.g., leaving a shop before a pending sale finishes. * Changed check data creation to use RSKs from gRandomizer to account for settings loaded from drag and drop spoilers. * Beginning of tracker code organization. Changed check color defaults. * Reverted moving tracker colors to header. Some individual check fixes. * Missed something from previous merge? * Removed last remnant of removed performance mode. * Better handle checking when skullsanity is off. * Song checks sceneIDs don't match the scenes they're actually in for some reason. Removed that check. * SaleEnd checks don't need the GetItemEntry parameter. Also set a flag that should prevent the check tracker from running during vanilla saves should that not be resolved by the time it's merged. * Attempting to have only the relevant checks added to the tracker data, as well as showing vanilla checks for non-rando saves. Not working yet (everything is displayed in vanilla). * Added vanilla check tracker population via `vanillaCheck` bool in `RandomizerCheckObject`. This is also added to `IsVisibleInImGui` to handle file loading and saving to eliminate checks that aren't part of vanilla or the rando seed. Implemented deleted tracker data file recreation. Added some extra item name text checks. Songs are still... tricky, so they stay blank. Utilize local copies of the randomizer check objects that are applicable for performance purposes. Fixed vanilla item-giving cutscene crashes when triggered mid-transition. * Apparently not all toolchains can handle macro instantiation without all parameters, like VS can. * Fixed scummed detail color not showing properly on tracker. * Fixed dungeon area totals and GS checks not functioning properly. * Major revamp of checking code. Doesn't rely on `GetCheckFromActor` at all anymore, but instead simply sets a flag to evaluate a number of checks in an area every frame until the check that was gotten is identified. With the new setup, it's much less hardware intensive, and at 60fps 6 checks per frame shows no noticeable effect on framerate. I can envision needing to add a collectedCount in order to account for times when two checks are gotten one right after the other. Changed area scroll to happen from `OnTransitionEnd`, and allow for scrolling in bazaar (was disabled previously because it would jump back and forth between Kak and Market while you were in one). Also setup area check order updating by area instead of all at the same time. * Fixed shooting gallery not reporting proper area. Prevent checks from actually happening if area is RCAREA_INVALID, now that all areas are reporting something if they have checks. Fixed `GetCheckArea()` not updating checks for standard scenes. Lots of vanilla tracking updates, mainly manual checks for gems, medallions and songs, since the often don't have proper scenes in the data. Prevent vanilla from triggering check loops if junk items are collected. Fixed sorting based on saved vs collected. Prevent item name display for vanilla runs. Change coloring of checks so the check name reflects status in vanilla runs. * Fixed "Recheck Area" button erroneously adding to an area's check totals? * Fix DMC vanilla checks. * Fix check tracker data recreation on data file loss. Removed redundant file exists check from SaveTrackerDataHook, as it doesn't matter if it exists or not at that point. Limited check loops to 3 to avoid infinite check loops on non-check/junk item pickup. Added more checks to disable tracker operations if a save is not running. Changed check ordering to put boss reward and heart container checks at the end of whatever RCSHOW group they belong to. * Fixed IsRunning calculation. Further improving vanilla checking. Starting framework for checking medallions, stones, and songs on data file recreation. Fixed medallion check collection. Added GIFT_FROM_SAGES to check list for vanilla file for tracking light medallion. Added check loop limitation to prevent infinite checking after picking up junk item from the ground. * Finished vanilla file recreation and recheck (songs and dungeon rewards all check properly now). This includes deku shield with KF shop item 3. Finished Gift from Raoru light medallion tracking for vanilla. Commented all CheckByScene functionality for now. * Fixed new save data file creation. Disabled entrance area calculation for now, as it only tracks the previous entrance for some reason. Fixed area detection for ToT checks. * GetCheckArea() now utilizes EntranceData almost exclusively, via either `gSaveContext.entranceIndex` or the entrance tracker's `currentGrottoId` in the case of grottos. This also means that EVERYTHING CAN AUTOSCROLL NOW. Entrance shuffles are now much easier to track. Autoscroll is now also triggered on save, just in case someone isn't autosaving and has a lot of checks that get converted to saved. * Fixed missing GS check in LW. * Added area scroll on toggling Show Hidden Items. May configure differently later. Fixed area detection for entrances in Gerudo Fortress/Valley and Collossus. Haunted wasteland doesn't autoscroll due to a bug in `OnTransitionEnd` hook, but checks still evaluate properly there. Rely on scene-based area detection if scene is a main overworld or dungeon scene. * Fixed grotto detection when shuffle is off. * Small code cleanup. Fixed Colossus hand chest checks. * Missing lus bump from merge conflict resolution * Fixed Colossus Grotto making `GetCheckArea` return Wasteland. * Improved OnItemReceive processing for non-token GS checks, since they can sometimes take long enough for the checking process to time out before the item is registered as received. * First attempt at thread safety for tracker data file writing. Seems to work, but might need more testing. * Fixed Recheck Area not unskipping items that register as saved. Improved delayed saving with autosaving, as the autosave triggered quite often before the tracker data save, making things not properly register as saved. * merge cleanup * Converted check tracker data to the sectional saves, adding `CheckTrackerData` to `SaveContext`. Implemented section ID returning and fullSave boolean passing to section functions from my PR temporarily for it to work properly. Moved `RandomizerCheckTrackerData` enum to `randomizerTypes.h` to accommodate that. Changed `Randomizer_SaveInit` to a `SaveManager::InitFunc` to allow for other randomizer-dependent sections to be initialized after that. Required a little refactoring to maintain intro cutscene skip when starting a randomizer file. * Revert section index return and randomizer init changes. Will need to wait on yet more changes to main. * Fixed check tracker initialization (shouldn't be tied to window initialization), restored saving/loading functionality. * Removed `CheckTracker::Init` and put SaveManager calls in `CheckTrackerWindow::InitElement`. Also a bit of cleanup from transition back to save file use. * Fixed tracker displaying check categories while file not loaded. * Fix Darunia's Joy check not marking in vanilla. * Fix autosave not triggering change from collected to saved in tracker data. * Changed default colors for scummed and collected display. * Merge upgrade code cleanup. * Add `OnTransitionEnd` calls to sandstorm transitions both to and from Wasteland. Also improved `gSaveContext.lastScene` assignment for both transition types. Allowed a bit of cleanup in `GetCheckArea`. * Added `StateButton`, a button like `ArrowButton` but that allows text instead of arrow icons. Apparently the changes from ArrowButton to StateButton happened in a previous commit... * Changed section name to `trackerDataCheck` to force SoH to load it after the randomizer section, as it required some randoSettings to be loaded first, and nothing else I tried to make the randomizer section load before it worked. This hacks a solution to checks not displaying on fast file load to a specific slot. F*** you, SaveManager, and f*** you too, JSON. * Forgot to change the section string for loading with the name change. * Fix check ordering for checks that trigger the autosave. * Adds option to remove right-side shop items (slots 1-4) from the tracker list. Enabled by default. * Fix default state of Hide Shop Right Checks checkbox. * Fixes grotto and great fairy scrolling and checks. Fixes array overflow from `checkTrackerData` which was creating the issue trying to load the base and randomizer sections first, among other things. That also fixed the massive file loads that were being exhibited in debug mode. * Fix shooting galleries being set as collected again when being played a second time after getting the checks. * Fix Bazaar autoscroll. * Add Saria's Song to `GetCheckFromActor` and removed some limitations from the messageCloseCheck function to make that check track properly. * Fix Song from Impa check. Implemented prevention for multiple "collections" of great fairies, just in case getting the health refill would trigger it with the previous setup. * Fix ice traps on GS tokens not triggering OnItemReceive. * Complete fix for ice trap collection from GS. Add autoscroll when clicking "Expand All". * Add `OnShopSlotChange` with cursorSlot and basePrice parameters. * Fixed include in en_ossan for shop slot hook. Added registration for `OnShopSlotChange` in the tracker, storing the price in a new `price` field in `CheckTrackerData`. Added "seen" functionality to shop checks. Displays the model item name upon first entering a shop, adding the price and switching to trickName (if it's an ice trap) upon navigating to the slot in buy mode, triggered by an invisible "identified" status that mirrors "seen" in every other way. Added tooltips to most options for check tracker color picking to describe what each status actually means. * `std::format` pls * So apparently std::format just decided to break with the latest merge from develop, but fmt::format exists and works? * Removed the last vestiges of `locationsSkipped`. Other general code and formatting cleanups. Moved `IsGameRunning` to `OTRGlobals` so the item tracker could also access it. Used preceding to "fix" item and bottle display in the item tracker on startup. * Some more code cleanup. Removed "Recheck Area" button and relevant code. Backported changes to Anchor branch applicable for single-player, including making a checkAreas vector and structuring the frame by frame checks around that. Also includes fix for Silver Gauntlets and Mirror Shield check collection crash associated with those changes. Fixed Kakariko Bazaar "seen" updates. Fixed tracker window not showing on initial load like it should. * Forgot 1 formatting fix. * Removed conditions for showing Song from Impa (isn't junk under certain conditions, so should show all the time). * Fix vanilla checks, add Zelda's Letter and Malon's Egg to manual check collection. Fix autoscroll while in child stealth section. * Fix crash in Happy Mask Shop in OnSlotChange (referenced non-existent shop id in a tracker-specific enum). * General code cleanup. * Missed one reversion. * One more. * Fix column alignment in `randomizer_check_objects`. * Fix file encoding on `randomizer_check_tracker`. Again. * Fix indentation for `actualItemtrackerItemMap`. Also removed unnecessary parts of the map. * Rename `HasEqItem` to `HasEquipment`. * Slightly better indentation for `actualItemTrackerItemMap`. * Add magic bean salesman to vanilla check tracking, and genericized deku shield to trigger KF shop item 3 wherever you get the shield. Renamed `vanillaCheck` to `vanillaHundoCheck` to (supposedly) clarify the meaning of the usage. * One more rename to `vanillaCompletion` to avoid possible confusion with 100% speedrun conditions. * give me a break XD Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * Changes suggested by briaguya (rename `RandomizerCheckShow` to `Status`, unused code, newline formatting) * Remove unused `itemNames` table. * Remove `IsGameRunning` in favor of `GameInteractor::IsSaveLoaded`. * Restore anti-spoiler functionality for dungeons with dungeon maps. * Review cleanup. * Fix prices not showing for Kak bazaar items. --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com>
2023-10-04 11:03:36 -04:00
if (isThisAreaSpoiled) {
if (showVOrMQ && RandomizerCheckObjects::AreaIsDungeon(rcArea)) {
if (OTRGlobals::Instance->gRandomizer->masterQuestDungeons.contains(
DungeonSceneLookupByArea(rcArea))) {
ImGui::Text("(%d/%d) - MQ", areaChecksGotten[rcArea], areaCheckTotals[rcArea]);
} else {
ImGui::Text("(%d/%d) - Vanilla", areaChecksGotten[rcArea], areaCheckTotals[rcArea]);
}
Randomizer Auto Location tracker (#1942) * Initial Auto-Location Tracking * Updates styling for checked items in Check Tracker * Fixes crashing issues with Check Tracker rendering * Auto scroll Check Tracker windows to current area * Checks Tracker only shows checked locations once in game * Fixes issue where Check Tracker would auto-scroll to wrong location when entering a grotto * Fixes gerudo fortress checks showing in tracker when settings have them removed * InfTable Check Location Fixes: Lost Dog Richard, Rolling Gorons, HBA 1000, Thawed Zora * Fixes most Event Chk Inf Checks on Check Tracker, and Frogs * Check Tracker - Song from Malon now works * Check Tracker - Fixes Claim Check check not tracking - Fixes spoiler for Claim Check check when getting Biggoron's Sword - Fixes LACS being spoiled and not tracking * Check Tracker - Fixes #2 for Skull Mask and Mask of Truth checks * Check Tracker - Adds support for merchants - Fixes #7 for Bomchu Salesman - Fixes #12 for Medigoron * Check Tracker - Fixes #8 for Song from Saria * Check Tracker - Fixes #9 for Adult Shooting Gallery * Check Tracker - Fixes #10 for Composer Grave * Check Tracker - Fixes #14 for Song from Ocarina of Time * Check Tracker - Fixes #16 for Shooting the Sun * Check Tracker - Fixes #19 for Darunia's Joy * Save Editor - Adds missing label for Treasure Chest Game * Check Tracker - Fixes Great Faries checks * Check Tracker - Fixes Sheik at Temple * Check Tracker - Fixes Great Fairy auto-scroll to wrong location * Check Tracker - Updates blue warp checks - Fixes Bongo Bongo and Twinrova checks * Check Tracker - Fixes Dampe's Gravedigging Tour * Check Tracker - Fixes Prescription to King Zora * Check Tracker - Fixes Bazaar showing under wrong area on tracker between adult/child * Check Tracker - Fixes scroll for Hyrule Market and Bazaar * Check Tracker - Fixes giving Adult Trade Items shown on tracker: Broken Sword, Saw, Cojiro, Eyeball Froge, and Eyedrops * Cleans up item_location * Check Tracker - Item List - Fixes item list not updating when changing seeds/options - Separates item exclusion list from item check list - Clean up comments * Check Tracker - Adds Skip functionality to buttons * Check Tracker - Refactors adult trade items to RandomizerInf * Check Tracker - Fixes an issue where any time an item is removed the tracker would cause an application crash * Check Tracker - Item names are now dependent on file language * Check Tracker - Fixes Gerudo Card check not showing in Fast setting * Reorders headers to (hopefully) avoid CI build conflicts on linux/consoles * Explicitly defines vector header in randomizer.h to fix compile errors * Complete Refactor of Check Tracker ImGui * Adds missing check tracker files to CMakeLists * Reverts the Item_location whitespace cleanup from ad10807c * Check Tracker - Loading Fixes - Fixes a bug where loading a save file a second time would add all the checks again - Fixes a bug where the check tracker would not render at all until in a save file * Check Tracker - Fixes a bug where checks would sometimes fail to load * Check Tracker - Fixes duplicated checks when using Only on Pause or Only on Combo * Check Tracker - Works around issue where single characters don't show in EnhancementCombobox, and fixes a label for combo buttons held option * Check Tracker - Applies all Check Tracker changes to Item Location * Check Tracker - Updated Check List - Adds Link's pocket, either in KF or HM depending on starting age - Supports Scrubs and Merchants - Uses enums instead of magic numbers - Updates DC Scrub Short Names for MQ * Check Tracker - Adds a performance mode option * Check Tracker - List Fixes (requires new rando generation) - Fixes Frogs Rupees always visible - Fixes Kokiri Sword Chest not showing - Fixes Weird Egg not showing * Check Tracker - MQ List basic support * Check Tracker - MQ/Vanilla anti-spoilers * Check Tracker - Collecting a compass now spoils the area * Check Tracker - Basic Vanilla Support and fixes - Vanilla items show in check tracker, even if many won't auto check - Fixes an issue with Gerudo Fortress Keys - Refactors IsVisibleInCheckTracker to randomizer_check_tracjer * Check Tracker - Fixes merge conflict from 08a487f35e1d760ab9e69b932edbe4da6bcd9edb * Check Tracker - Fixes tracker loading as Floating when default value is set to Windowed * Randomizer Location Exclusion List - Adds Scrubs, Merchants, Shops. Adult Trade items, MQ Dungeons, and Bean Salesman - Fixes Kokiri Sword Chest, Weird Egg, and Frog Song Rupees from misbehaving - Updates Gerudo Fortress logic to be dependent on Open/Fast/Normal Fortress - Removes Invalid Check - Adds RO Enum for MQ settings - Updates magic values to RO enum * Location Exclusion List - Scrubs that are always randomized now always show on the list * For now, removes some extra code only needed for a Check Tracker. * Randomizer Location Exclusion List - Fixes Eyeball Frog from showing up when Adult Trade Items was off * Location Tracker - Updates Eyedrops to use RandomizerInf instead of Chest * Check Tracker - Fixes a bug where Link's Pocket item wasn't acting as checked for area item count * Check Tracker - Fixes a bug where Locations would incorrectly say Vanilla due to the first check in the area being a non-MQ check * Check Tracker - Fixes a crash when Check Tracker is docked but not visible * Check Tracker - Fixes areas being spoiled when loading different save files * Check Tracker - Only reset variables if they are initialized * Check Tracker - Cleans up old comments, unused variables, methods, and macros, adds language TODOs, * Check Tracker - Readds rainbow UI elements after Cosmetics Editor refactor * Check Tracker - Removal of flag lookup that was refactored, no longer needed header, and some trivial whitespace fixes. * Check Tracker - Refactors Index to Bitmask code to a macro * Check Tracker - Changes ordering from alphabetical to RandomizerCheck ordering * Check Tracker - Wraps everything in a namespace to avoid global variable usage * Check Tracker - Explicitly defines for-loop scope * Check Tracker - refactors dungeon lookup from static array to function * Fixes a bug when using EnhancementColor with alpha * Check Tracker - Refactors all colour to use direct conversions * Check Tracker - refactors settings loading and check visibility for readability * Check Tracker - Fixes a bug where the wrong label showed on the Check Tracker BG Color * UIWidgets - Adds Alpha bar to EnhancementColor when using alpha parameter
2022-12-10 22:39:23 -05:00
} else {
ImGui::Text("(%d/%d)", areaChecksGotten[rcArea], areaCheckTotals[rcArea]);
Randomizer Auto Location tracker (#1942) * Initial Auto-Location Tracking * Updates styling for checked items in Check Tracker * Fixes crashing issues with Check Tracker rendering * Auto scroll Check Tracker windows to current area * Checks Tracker only shows checked locations once in game * Fixes issue where Check Tracker would auto-scroll to wrong location when entering a grotto * Fixes gerudo fortress checks showing in tracker when settings have them removed * InfTable Check Location Fixes: Lost Dog Richard, Rolling Gorons, HBA 1000, Thawed Zora * Fixes most Event Chk Inf Checks on Check Tracker, and Frogs * Check Tracker - Song from Malon now works * Check Tracker - Fixes Claim Check check not tracking - Fixes spoiler for Claim Check check when getting Biggoron's Sword - Fixes LACS being spoiled and not tracking * Check Tracker - Fixes #2 for Skull Mask and Mask of Truth checks * Check Tracker - Adds support for merchants - Fixes #7 for Bomchu Salesman - Fixes #12 for Medigoron * Check Tracker - Fixes #8 for Song from Saria * Check Tracker - Fixes #9 for Adult Shooting Gallery * Check Tracker - Fixes #10 for Composer Grave * Check Tracker - Fixes #14 for Song from Ocarina of Time * Check Tracker - Fixes #16 for Shooting the Sun * Check Tracker - Fixes #19 for Darunia's Joy * Save Editor - Adds missing label for Treasure Chest Game * Check Tracker - Fixes Great Faries checks * Check Tracker - Fixes Sheik at Temple * Check Tracker - Fixes Great Fairy auto-scroll to wrong location * Check Tracker - Updates blue warp checks - Fixes Bongo Bongo and Twinrova checks * Check Tracker - Fixes Dampe's Gravedigging Tour * Check Tracker - Fixes Prescription to King Zora * Check Tracker - Fixes Bazaar showing under wrong area on tracker between adult/child * Check Tracker - Fixes scroll for Hyrule Market and Bazaar * Check Tracker - Fixes giving Adult Trade Items shown on tracker: Broken Sword, Saw, Cojiro, Eyeball Froge, and Eyedrops * Cleans up item_location * Check Tracker - Item List - Fixes item list not updating when changing seeds/options - Separates item exclusion list from item check list - Clean up comments * Check Tracker - Adds Skip functionality to buttons * Check Tracker - Refactors adult trade items to RandomizerInf * Check Tracker - Fixes an issue where any time an item is removed the tracker would cause an application crash * Check Tracker - Item names are now dependent on file language * Check Tracker - Fixes Gerudo Card check not showing in Fast setting * Reorders headers to (hopefully) avoid CI build conflicts on linux/consoles * Explicitly defines vector header in randomizer.h to fix compile errors * Complete Refactor of Check Tracker ImGui * Adds missing check tracker files to CMakeLists * Reverts the Item_location whitespace cleanup from ad10807c * Check Tracker - Loading Fixes - Fixes a bug where loading a save file a second time would add all the checks again - Fixes a bug where the check tracker would not render at all until in a save file * Check Tracker - Fixes a bug where checks would sometimes fail to load * Check Tracker - Fixes duplicated checks when using Only on Pause or Only on Combo * Check Tracker - Works around issue where single characters don't show in EnhancementCombobox, and fixes a label for combo buttons held option * Check Tracker - Applies all Check Tracker changes to Item Location * Check Tracker - Updated Check List - Adds Link's pocket, either in KF or HM depending on starting age - Supports Scrubs and Merchants - Uses enums instead of magic numbers - Updates DC Scrub Short Names for MQ * Check Tracker - Adds a performance mode option * Check Tracker - List Fixes (requires new rando generation) - Fixes Frogs Rupees always visible - Fixes Kokiri Sword Chest not showing - Fixes Weird Egg not showing * Check Tracker - MQ List basic support * Check Tracker - MQ/Vanilla anti-spoilers * Check Tracker - Collecting a compass now spoils the area * Check Tracker - Basic Vanilla Support and fixes - Vanilla items show in check tracker, even if many won't auto check - Fixes an issue with Gerudo Fortress Keys - Refactors IsVisibleInCheckTracker to randomizer_check_tracjer * Check Tracker - Fixes merge conflict from 08a487f35e1d760ab9e69b932edbe4da6bcd9edb * Check Tracker - Fixes tracker loading as Floating when default value is set to Windowed * Randomizer Location Exclusion List - Adds Scrubs, Merchants, Shops. Adult Trade items, MQ Dungeons, and Bean Salesman - Fixes Kokiri Sword Chest, Weird Egg, and Frog Song Rupees from misbehaving - Updates Gerudo Fortress logic to be dependent on Open/Fast/Normal Fortress - Removes Invalid Check - Adds RO Enum for MQ settings - Updates magic values to RO enum * Location Exclusion List - Scrubs that are always randomized now always show on the list * For now, removes some extra code only needed for a Check Tracker. * Randomizer Location Exclusion List - Fixes Eyeball Frog from showing up when Adult Trade Items was off * Location Tracker - Updates Eyedrops to use RandomizerInf instead of Chest * Check Tracker - Fixes a bug where Link's Pocket item wasn't acting as checked for area item count * Check Tracker - Fixes a bug where Locations would incorrectly say Vanilla due to the first check in the area being a non-MQ check * Check Tracker - Fixes a crash when Check Tracker is docked but not visible * Check Tracker - Fixes areas being spoiled when loading different save files * Check Tracker - Only reset variables if they are initialized * Check Tracker - Cleans up old comments, unused variables, methods, and macros, adds language TODOs, * Check Tracker - Readds rainbow UI elements after Cosmetics Editor refactor * Check Tracker - Removal of flag lookup that was refactored, no longer needed header, and some trivial whitespace fixes. * Check Tracker - Refactors Index to Bitmask code to a macro * Check Tracker - Changes ordering from alphabetical to RandomizerCheck ordering * Check Tracker - Wraps everything in a namespace to avoid global variable usage * Check Tracker - Explicitly defines for-loop scope * Check Tracker - refactors dungeon lookup from static array to function * Fixes a bug when using EnhancementColor with alpha * Check Tracker - Refactors all colour to use direct conversions * Check Tracker - refactors settings loading and check visibility for readability * Check Tracker - Fixes a bug where the wrong label showed on the Check Tracker BG Color * UIWidgets - Adds Alpha bar to EnhancementColor when using alpha parameter
2022-12-10 22:39:23 -05:00
}
Check Tracker Update (#2668) * Initial commit. What works so far: Data file loads, saves, deletes, and is created properly. - Need to run `HasItemBeenCollected` when creating in case of mid-seed regen. Organized checks into maps set by area. Areas show in tracker. - Checks pulled from checkObjectsByArea are not currently listed. - Areas are being assumed completed and hidden at the start. * Checks now populate. Still not counting area totals properly. * Don't track RC_LINKS_POCKET in the data file, and instead manually add it in every time a save is load. rcObjects doesn't contain Link's Pocket location (duh). * Moved ItemReceive hook to randomizer_check_tracker.cpp. Skipped items are properly sorted and formatted. Saved items contribute to an area's gotten/skipped checks on load. Changed skipped items default main color to gray. General code cleanup. * Skipped checks now contribute to area totals for area completion logic. * Mid-menu rework transfer. * Started check lookup on item receive. Tried to enable scum checking on save. * Fixed scum check on save. * More code cleanup, which revealed some issues with loading and saving. Loading now works 100%, but entries in checkTrackerData are disappearing in code somewhere, causing issues with later checks. Scummed color now displays properly. Collected but unsaved displays properly. Unchecked, Skipped, Seen and Scummed checks all have arrows for skipping/unskipping. Counts a little messed up, probably double adding skips. * Fixed item counts being off across resets. Restarts were fine. * Beginning of rework for individual check updates. Adds `Actor lastCheck` to PlayState to allow assigning of last actor to give an item. This allows precise tracking of GS, freestanding PoH, etc. Works for chests too. Currently does not work for shops, unknown for normal NPC gives. Doesn't track last gives for non-checks, like drops from grass, pots, crates, etc. * Actor-based checks fully fleshed out, but can't help with sale-based checks. Implemented `pendingSaleCheck` to back out of an RC check cycle if `gSaveContext->pendingSale` is not NONE when `OnItemReceive` is called, processed through `OnSaleEnd`. This should be the final change necessary to streamline the checks. * Temporary hook to message box close to tie in trackers for non-gs/chest actors that aren't added to `GetCheckFromActor`. This triggers a 2-frame countdown to check with `HasItemBeenCollected` since half of the methods in there aren't updated until after a text box closes. Added scene tracking to get last scene so that checks in scenes that span several overworld areas could be tied to their areas properly. Modified tracker data creation to apply Link's Pocket and Song from Impa conditionally based on randomizer settings instead of just being assumed to be done. May need modification for checking click and drag spoiler loading. Removed the scene equivalence check from CheckChecks so that an entire area is checked each time to avoid issues with, e.g., leaving a shop before a pending sale finishes. * Changed check data creation to use RSKs from gRandomizer to account for settings loaded from drag and drop spoilers. * Beginning of tracker code organization. Changed check color defaults. * Reverted moving tracker colors to header. Some individual check fixes. * Missed something from previous merge? * Removed last remnant of removed performance mode. * Better handle checking when skullsanity is off. * Song checks sceneIDs don't match the scenes they're actually in for some reason. Removed that check. * SaleEnd checks don't need the GetItemEntry parameter. Also set a flag that should prevent the check tracker from running during vanilla saves should that not be resolved by the time it's merged. * Attempting to have only the relevant checks added to the tracker data, as well as showing vanilla checks for non-rando saves. Not working yet (everything is displayed in vanilla). * Added vanilla check tracker population via `vanillaCheck` bool in `RandomizerCheckObject`. This is also added to `IsVisibleInImGui` to handle file loading and saving to eliminate checks that aren't part of vanilla or the rando seed. Implemented deleted tracker data file recreation. Added some extra item name text checks. Songs are still... tricky, so they stay blank. Utilize local copies of the randomizer check objects that are applicable for performance purposes. Fixed vanilla item-giving cutscene crashes when triggered mid-transition. * Apparently not all toolchains can handle macro instantiation without all parameters, like VS can. * Fixed scummed detail color not showing properly on tracker. * Fixed dungeon area totals and GS checks not functioning properly. * Major revamp of checking code. Doesn't rely on `GetCheckFromActor` at all anymore, but instead simply sets a flag to evaluate a number of checks in an area every frame until the check that was gotten is identified. With the new setup, it's much less hardware intensive, and at 60fps 6 checks per frame shows no noticeable effect on framerate. I can envision needing to add a collectedCount in order to account for times when two checks are gotten one right after the other. Changed area scroll to happen from `OnTransitionEnd`, and allow for scrolling in bazaar (was disabled previously because it would jump back and forth between Kak and Market while you were in one). Also setup area check order updating by area instead of all at the same time. * Fixed shooting gallery not reporting proper area. Prevent checks from actually happening if area is RCAREA_INVALID, now that all areas are reporting something if they have checks. Fixed `GetCheckArea()` not updating checks for standard scenes. Lots of vanilla tracking updates, mainly manual checks for gems, medallions and songs, since the often don't have proper scenes in the data. Prevent vanilla from triggering check loops if junk items are collected. Fixed sorting based on saved vs collected. Prevent item name display for vanilla runs. Change coloring of checks so the check name reflects status in vanilla runs. * Fixed "Recheck Area" button erroneously adding to an area's check totals? * Fix DMC vanilla checks. * Fix check tracker data recreation on data file loss. Removed redundant file exists check from SaveTrackerDataHook, as it doesn't matter if it exists or not at that point. Limited check loops to 3 to avoid infinite check loops on non-check/junk item pickup. Added more checks to disable tracker operations if a save is not running. Changed check ordering to put boss reward and heart container checks at the end of whatever RCSHOW group they belong to. * Fixed IsRunning calculation. Further improving vanilla checking. Starting framework for checking medallions, stones, and songs on data file recreation. Fixed medallion check collection. Added GIFT_FROM_SAGES to check list for vanilla file for tracking light medallion. Added check loop limitation to prevent infinite checking after picking up junk item from the ground. * Finished vanilla file recreation and recheck (songs and dungeon rewards all check properly now). This includes deku shield with KF shop item 3. Finished Gift from Raoru light medallion tracking for vanilla. Commented all CheckByScene functionality for now. * Fixed new save data file creation. Disabled entrance area calculation for now, as it only tracks the previous entrance for some reason. Fixed area detection for ToT checks. * GetCheckArea() now utilizes EntranceData almost exclusively, via either `gSaveContext.entranceIndex` or the entrance tracker's `currentGrottoId` in the case of grottos. This also means that EVERYTHING CAN AUTOSCROLL NOW. Entrance shuffles are now much easier to track. Autoscroll is now also triggered on save, just in case someone isn't autosaving and has a lot of checks that get converted to saved. * Fixed missing GS check in LW. * Added area scroll on toggling Show Hidden Items. May configure differently later. Fixed area detection for entrances in Gerudo Fortress/Valley and Collossus. Haunted wasteland doesn't autoscroll due to a bug in `OnTransitionEnd` hook, but checks still evaluate properly there. Rely on scene-based area detection if scene is a main overworld or dungeon scene. * Fixed grotto detection when shuffle is off. * Small code cleanup. Fixed Colossus hand chest checks. * Missing lus bump from merge conflict resolution * Fixed Colossus Grotto making `GetCheckArea` return Wasteland. * Improved OnItemReceive processing for non-token GS checks, since they can sometimes take long enough for the checking process to time out before the item is registered as received. * First attempt at thread safety for tracker data file writing. Seems to work, but might need more testing. * Fixed Recheck Area not unskipping items that register as saved. Improved delayed saving with autosaving, as the autosave triggered quite often before the tracker data save, making things not properly register as saved. * merge cleanup * Converted check tracker data to the sectional saves, adding `CheckTrackerData` to `SaveContext`. Implemented section ID returning and fullSave boolean passing to section functions from my PR temporarily for it to work properly. Moved `RandomizerCheckTrackerData` enum to `randomizerTypes.h` to accommodate that. Changed `Randomizer_SaveInit` to a `SaveManager::InitFunc` to allow for other randomizer-dependent sections to be initialized after that. Required a little refactoring to maintain intro cutscene skip when starting a randomizer file. * Revert section index return and randomizer init changes. Will need to wait on yet more changes to main. * Fixed check tracker initialization (shouldn't be tied to window initialization), restored saving/loading functionality. * Removed `CheckTracker::Init` and put SaveManager calls in `CheckTrackerWindow::InitElement`. Also a bit of cleanup from transition back to save file use. * Fixed tracker displaying check categories while file not loaded. * Fix Darunia's Joy check not marking in vanilla. * Fix autosave not triggering change from collected to saved in tracker data. * Changed default colors for scummed and collected display. * Merge upgrade code cleanup. * Add `OnTransitionEnd` calls to sandstorm transitions both to and from Wasteland. Also improved `gSaveContext.lastScene` assignment for both transition types. Allowed a bit of cleanup in `GetCheckArea`. * Added `StateButton`, a button like `ArrowButton` but that allows text instead of arrow icons. Apparently the changes from ArrowButton to StateButton happened in a previous commit... * Changed section name to `trackerDataCheck` to force SoH to load it after the randomizer section, as it required some randoSettings to be loaded first, and nothing else I tried to make the randomizer section load before it worked. This hacks a solution to checks not displaying on fast file load to a specific slot. F*** you, SaveManager, and f*** you too, JSON. * Forgot to change the section string for loading with the name change. * Fix check ordering for checks that trigger the autosave. * Adds option to remove right-side shop items (slots 1-4) from the tracker list. Enabled by default. * Fix default state of Hide Shop Right Checks checkbox. * Fixes grotto and great fairy scrolling and checks. Fixes array overflow from `checkTrackerData` which was creating the issue trying to load the base and randomizer sections first, among other things. That also fixed the massive file loads that were being exhibited in debug mode. * Fix shooting galleries being set as collected again when being played a second time after getting the checks. * Fix Bazaar autoscroll. * Add Saria's Song to `GetCheckFromActor` and removed some limitations from the messageCloseCheck function to make that check track properly. * Fix Song from Impa check. Implemented prevention for multiple "collections" of great fairies, just in case getting the health refill would trigger it with the previous setup. * Fix ice traps on GS tokens not triggering OnItemReceive. * Complete fix for ice trap collection from GS. Add autoscroll when clicking "Expand All". * Add `OnShopSlotChange` with cursorSlot and basePrice parameters. * Fixed include in en_ossan for shop slot hook. Added registration for `OnShopSlotChange` in the tracker, storing the price in a new `price` field in `CheckTrackerData`. Added "seen" functionality to shop checks. Displays the model item name upon first entering a shop, adding the price and switching to trickName (if it's an ice trap) upon navigating to the slot in buy mode, triggered by an invisible "identified" status that mirrors "seen" in every other way. Added tooltips to most options for check tracker color picking to describe what each status actually means. * `std::format` pls * So apparently std::format just decided to break with the latest merge from develop, but fmt::format exists and works? * Removed the last vestiges of `locationsSkipped`. Other general code and formatting cleanups. Moved `IsGameRunning` to `OTRGlobals` so the item tracker could also access it. Used preceding to "fix" item and bottle display in the item tracker on startup. * Some more code cleanup. Removed "Recheck Area" button and relevant code. Backported changes to Anchor branch applicable for single-player, including making a checkAreas vector and structuring the frame by frame checks around that. Also includes fix for Silver Gauntlets and Mirror Shield check collection crash associated with those changes. Fixed Kakariko Bazaar "seen" updates. Fixed tracker window not showing on initial load like it should. * Forgot 1 formatting fix. * Removed conditions for showing Song from Impa (isn't junk under certain conditions, so should show all the time). * Fix vanilla checks, add Zelda's Letter and Malon's Egg to manual check collection. Fix autoscroll while in child stealth section. * Fix crash in Happy Mask Shop in OnSlotChange (referenced non-existent shop id in a tracker-specific enum). * General code cleanup. * Missed one reversion. * One more. * Fix column alignment in `randomizer_check_objects`. * Fix file encoding on `randomizer_check_tracker`. Again. * Fix indentation for `actualItemtrackerItemMap`. Also removed unnecessary parts of the map. * Rename `HasEqItem` to `HasEquipment`. * Slightly better indentation for `actualItemTrackerItemMap`. * Add magic bean salesman to vanilla check tracking, and genericized deku shield to trigger KF shop item 3 wherever you get the shield. Renamed `vanillaCheck` to `vanillaHundoCheck` to (supposedly) clarify the meaning of the usage. * One more rename to `vanillaCompletion` to avoid possible confusion with 100% speedrun conditions. * give me a break XD Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * Changes suggested by briaguya (rename `RandomizerCheckShow` to `Status`, unused code, newline formatting) * Remove unused `itemNames` table. * Remove `IsGameRunning` in favor of `GameInteractor::IsSaveLoaded`. * Restore anti-spoiler functionality for dungeons with dungeon maps. * Review cleanup. * Fix prices not showing for Kak bazaar items. --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com>
2023-10-04 11:03:36 -04:00
} else {
ImGui::Text("???");
}
Randomizer Auto Location tracker (#1942) * Initial Auto-Location Tracking * Updates styling for checked items in Check Tracker * Fixes crashing issues with Check Tracker rendering * Auto scroll Check Tracker windows to current area * Checks Tracker only shows checked locations once in game * Fixes issue where Check Tracker would auto-scroll to wrong location when entering a grotto * Fixes gerudo fortress checks showing in tracker when settings have them removed * InfTable Check Location Fixes: Lost Dog Richard, Rolling Gorons, HBA 1000, Thawed Zora * Fixes most Event Chk Inf Checks on Check Tracker, and Frogs * Check Tracker - Song from Malon now works * Check Tracker - Fixes Claim Check check not tracking - Fixes spoiler for Claim Check check when getting Biggoron's Sword - Fixes LACS being spoiled and not tracking * Check Tracker - Fixes #2 for Skull Mask and Mask of Truth checks * Check Tracker - Adds support for merchants - Fixes #7 for Bomchu Salesman - Fixes #12 for Medigoron * Check Tracker - Fixes #8 for Song from Saria * Check Tracker - Fixes #9 for Adult Shooting Gallery * Check Tracker - Fixes #10 for Composer Grave * Check Tracker - Fixes #14 for Song from Ocarina of Time * Check Tracker - Fixes #16 for Shooting the Sun * Check Tracker - Fixes #19 for Darunia's Joy * Save Editor - Adds missing label for Treasure Chest Game * Check Tracker - Fixes Great Faries checks * Check Tracker - Fixes Sheik at Temple * Check Tracker - Fixes Great Fairy auto-scroll to wrong location * Check Tracker - Updates blue warp checks - Fixes Bongo Bongo and Twinrova checks * Check Tracker - Fixes Dampe's Gravedigging Tour * Check Tracker - Fixes Prescription to King Zora * Check Tracker - Fixes Bazaar showing under wrong area on tracker between adult/child * Check Tracker - Fixes scroll for Hyrule Market and Bazaar * Check Tracker - Fixes giving Adult Trade Items shown on tracker: Broken Sword, Saw, Cojiro, Eyeball Froge, and Eyedrops * Cleans up item_location * Check Tracker - Item List - Fixes item list not updating when changing seeds/options - Separates item exclusion list from item check list - Clean up comments * Check Tracker - Adds Skip functionality to buttons * Check Tracker - Refactors adult trade items to RandomizerInf * Check Tracker - Fixes an issue where any time an item is removed the tracker would cause an application crash * Check Tracker - Item names are now dependent on file language * Check Tracker - Fixes Gerudo Card check not showing in Fast setting * Reorders headers to (hopefully) avoid CI build conflicts on linux/consoles * Explicitly defines vector header in randomizer.h to fix compile errors * Complete Refactor of Check Tracker ImGui * Adds missing check tracker files to CMakeLists * Reverts the Item_location whitespace cleanup from ad10807c * Check Tracker - Loading Fixes - Fixes a bug where loading a save file a second time would add all the checks again - Fixes a bug where the check tracker would not render at all until in a save file * Check Tracker - Fixes a bug where checks would sometimes fail to load * Check Tracker - Fixes duplicated checks when using Only on Pause or Only on Combo * Check Tracker - Works around issue where single characters don't show in EnhancementCombobox, and fixes a label for combo buttons held option * Check Tracker - Applies all Check Tracker changes to Item Location * Check Tracker - Updated Check List - Adds Link's pocket, either in KF or HM depending on starting age - Supports Scrubs and Merchants - Uses enums instead of magic numbers - Updates DC Scrub Short Names for MQ * Check Tracker - Adds a performance mode option * Check Tracker - List Fixes (requires new rando generation) - Fixes Frogs Rupees always visible - Fixes Kokiri Sword Chest not showing - Fixes Weird Egg not showing * Check Tracker - MQ List basic support * Check Tracker - MQ/Vanilla anti-spoilers * Check Tracker - Collecting a compass now spoils the area * Check Tracker - Basic Vanilla Support and fixes - Vanilla items show in check tracker, even if many won't auto check - Fixes an issue with Gerudo Fortress Keys - Refactors IsVisibleInCheckTracker to randomizer_check_tracjer * Check Tracker - Fixes merge conflict from 08a487f35e1d760ab9e69b932edbe4da6bcd9edb * Check Tracker - Fixes tracker loading as Floating when default value is set to Windowed * Randomizer Location Exclusion List - Adds Scrubs, Merchants, Shops. Adult Trade items, MQ Dungeons, and Bean Salesman - Fixes Kokiri Sword Chest, Weird Egg, and Frog Song Rupees from misbehaving - Updates Gerudo Fortress logic to be dependent on Open/Fast/Normal Fortress - Removes Invalid Check - Adds RO Enum for MQ settings - Updates magic values to RO enum * Location Exclusion List - Scrubs that are always randomized now always show on the list * For now, removes some extra code only needed for a Check Tracker. * Randomizer Location Exclusion List - Fixes Eyeball Frog from showing up when Adult Trade Items was off * Location Tracker - Updates Eyedrops to use RandomizerInf instead of Chest * Check Tracker - Fixes a bug where Link's Pocket item wasn't acting as checked for area item count * Check Tracker - Fixes a bug where Locations would incorrectly say Vanilla due to the first check in the area being a non-MQ check * Check Tracker - Fixes a crash when Check Tracker is docked but not visible * Check Tracker - Fixes areas being spoiled when loading different save files * Check Tracker - Only reset variables if they are initialized * Check Tracker - Cleans up old comments, unused variables, methods, and macros, adds language TODOs, * Check Tracker - Readds rainbow UI elements after Cosmetics Editor refactor * Check Tracker - Removal of flag lookup that was refactored, no longer needed header, and some trivial whitespace fixes. * Check Tracker - Refactors Index to Bitmask code to a macro * Check Tracker - Changes ordering from alphabetical to RandomizerCheck ordering * Check Tracker - Wraps everything in a namespace to avoid global variable usage * Check Tracker - Explicitly defines for-loop scope * Check Tracker - refactors dungeon lookup from static array to function * Fixes a bug when using EnhancementColor with alpha * Check Tracker - Refactors all colour to use direct conversions * Check Tracker - refactors settings loading and check visibility for readability * Check Tracker - Fixes a bug where the wrong label showed on the Check Tracker BG Color * UIWidgets - Adds Alpha bar to EnhancementColor when using alpha parameter
2022-12-10 22:39:23 -05:00
Check Tracker Update (#2668) * Initial commit. What works so far: Data file loads, saves, deletes, and is created properly. - Need to run `HasItemBeenCollected` when creating in case of mid-seed regen. Organized checks into maps set by area. Areas show in tracker. - Checks pulled from checkObjectsByArea are not currently listed. - Areas are being assumed completed and hidden at the start. * Checks now populate. Still not counting area totals properly. * Don't track RC_LINKS_POCKET in the data file, and instead manually add it in every time a save is load. rcObjects doesn't contain Link's Pocket location (duh). * Moved ItemReceive hook to randomizer_check_tracker.cpp. Skipped items are properly sorted and formatted. Saved items contribute to an area's gotten/skipped checks on load. Changed skipped items default main color to gray. General code cleanup. * Skipped checks now contribute to area totals for area completion logic. * Mid-menu rework transfer. * Started check lookup on item receive. Tried to enable scum checking on save. * Fixed scum check on save. * More code cleanup, which revealed some issues with loading and saving. Loading now works 100%, but entries in checkTrackerData are disappearing in code somewhere, causing issues with later checks. Scummed color now displays properly. Collected but unsaved displays properly. Unchecked, Skipped, Seen and Scummed checks all have arrows for skipping/unskipping. Counts a little messed up, probably double adding skips. * Fixed item counts being off across resets. Restarts were fine. * Beginning of rework for individual check updates. Adds `Actor lastCheck` to PlayState to allow assigning of last actor to give an item. This allows precise tracking of GS, freestanding PoH, etc. Works for chests too. Currently does not work for shops, unknown for normal NPC gives. Doesn't track last gives for non-checks, like drops from grass, pots, crates, etc. * Actor-based checks fully fleshed out, but can't help with sale-based checks. Implemented `pendingSaleCheck` to back out of an RC check cycle if `gSaveContext->pendingSale` is not NONE when `OnItemReceive` is called, processed through `OnSaleEnd`. This should be the final change necessary to streamline the checks. * Temporary hook to message box close to tie in trackers for non-gs/chest actors that aren't added to `GetCheckFromActor`. This triggers a 2-frame countdown to check with `HasItemBeenCollected` since half of the methods in there aren't updated until after a text box closes. Added scene tracking to get last scene so that checks in scenes that span several overworld areas could be tied to their areas properly. Modified tracker data creation to apply Link's Pocket and Song from Impa conditionally based on randomizer settings instead of just being assumed to be done. May need modification for checking click and drag spoiler loading. Removed the scene equivalence check from CheckChecks so that an entire area is checked each time to avoid issues with, e.g., leaving a shop before a pending sale finishes. * Changed check data creation to use RSKs from gRandomizer to account for settings loaded from drag and drop spoilers. * Beginning of tracker code organization. Changed check color defaults. * Reverted moving tracker colors to header. Some individual check fixes. * Missed something from previous merge? * Removed last remnant of removed performance mode. * Better handle checking when skullsanity is off. * Song checks sceneIDs don't match the scenes they're actually in for some reason. Removed that check. * SaleEnd checks don't need the GetItemEntry parameter. Also set a flag that should prevent the check tracker from running during vanilla saves should that not be resolved by the time it's merged. * Attempting to have only the relevant checks added to the tracker data, as well as showing vanilla checks for non-rando saves. Not working yet (everything is displayed in vanilla). * Added vanilla check tracker population via `vanillaCheck` bool in `RandomizerCheckObject`. This is also added to `IsVisibleInImGui` to handle file loading and saving to eliminate checks that aren't part of vanilla or the rando seed. Implemented deleted tracker data file recreation. Added some extra item name text checks. Songs are still... tricky, so they stay blank. Utilize local copies of the randomizer check objects that are applicable for performance purposes. Fixed vanilla item-giving cutscene crashes when triggered mid-transition. * Apparently not all toolchains can handle macro instantiation without all parameters, like VS can. * Fixed scummed detail color not showing properly on tracker. * Fixed dungeon area totals and GS checks not functioning properly. * Major revamp of checking code. Doesn't rely on `GetCheckFromActor` at all anymore, but instead simply sets a flag to evaluate a number of checks in an area every frame until the check that was gotten is identified. With the new setup, it's much less hardware intensive, and at 60fps 6 checks per frame shows no noticeable effect on framerate. I can envision needing to add a collectedCount in order to account for times when two checks are gotten one right after the other. Changed area scroll to happen from `OnTransitionEnd`, and allow for scrolling in bazaar (was disabled previously because it would jump back and forth between Kak and Market while you were in one). Also setup area check order updating by area instead of all at the same time. * Fixed shooting gallery not reporting proper area. Prevent checks from actually happening if area is RCAREA_INVALID, now that all areas are reporting something if they have checks. Fixed `GetCheckArea()` not updating checks for standard scenes. Lots of vanilla tracking updates, mainly manual checks for gems, medallions and songs, since the often don't have proper scenes in the data. Prevent vanilla from triggering check loops if junk items are collected. Fixed sorting based on saved vs collected. Prevent item name display for vanilla runs. Change coloring of checks so the check name reflects status in vanilla runs. * Fixed "Recheck Area" button erroneously adding to an area's check totals? * Fix DMC vanilla checks. * Fix check tracker data recreation on data file loss. Removed redundant file exists check from SaveTrackerDataHook, as it doesn't matter if it exists or not at that point. Limited check loops to 3 to avoid infinite check loops on non-check/junk item pickup. Added more checks to disable tracker operations if a save is not running. Changed check ordering to put boss reward and heart container checks at the end of whatever RCSHOW group they belong to. * Fixed IsRunning calculation. Further improving vanilla checking. Starting framework for checking medallions, stones, and songs on data file recreation. Fixed medallion check collection. Added GIFT_FROM_SAGES to check list for vanilla file for tracking light medallion. Added check loop limitation to prevent infinite checking after picking up junk item from the ground. * Finished vanilla file recreation and recheck (songs and dungeon rewards all check properly now). This includes deku shield with KF shop item 3. Finished Gift from Raoru light medallion tracking for vanilla. Commented all CheckByScene functionality for now. * Fixed new save data file creation. Disabled entrance area calculation for now, as it only tracks the previous entrance for some reason. Fixed area detection for ToT checks. * GetCheckArea() now utilizes EntranceData almost exclusively, via either `gSaveContext.entranceIndex` or the entrance tracker's `currentGrottoId` in the case of grottos. This also means that EVERYTHING CAN AUTOSCROLL NOW. Entrance shuffles are now much easier to track. Autoscroll is now also triggered on save, just in case someone isn't autosaving and has a lot of checks that get converted to saved. * Fixed missing GS check in LW. * Added area scroll on toggling Show Hidden Items. May configure differently later. Fixed area detection for entrances in Gerudo Fortress/Valley and Collossus. Haunted wasteland doesn't autoscroll due to a bug in `OnTransitionEnd` hook, but checks still evaluate properly there. Rely on scene-based area detection if scene is a main overworld or dungeon scene. * Fixed grotto detection when shuffle is off. * Small code cleanup. Fixed Colossus hand chest checks. * Missing lus bump from merge conflict resolution * Fixed Colossus Grotto making `GetCheckArea` return Wasteland. * Improved OnItemReceive processing for non-token GS checks, since they can sometimes take long enough for the checking process to time out before the item is registered as received. * First attempt at thread safety for tracker data file writing. Seems to work, but might need more testing. * Fixed Recheck Area not unskipping items that register as saved. Improved delayed saving with autosaving, as the autosave triggered quite often before the tracker data save, making things not properly register as saved. * merge cleanup * Converted check tracker data to the sectional saves, adding `CheckTrackerData` to `SaveContext`. Implemented section ID returning and fullSave boolean passing to section functions from my PR temporarily for it to work properly. Moved `RandomizerCheckTrackerData` enum to `randomizerTypes.h` to accommodate that. Changed `Randomizer_SaveInit` to a `SaveManager::InitFunc` to allow for other randomizer-dependent sections to be initialized after that. Required a little refactoring to maintain intro cutscene skip when starting a randomizer file. * Revert section index return and randomizer init changes. Will need to wait on yet more changes to main. * Fixed check tracker initialization (shouldn't be tied to window initialization), restored saving/loading functionality. * Removed `CheckTracker::Init` and put SaveManager calls in `CheckTrackerWindow::InitElement`. Also a bit of cleanup from transition back to save file use. * Fixed tracker displaying check categories while file not loaded. * Fix Darunia's Joy check not marking in vanilla. * Fix autosave not triggering change from collected to saved in tracker data. * Changed default colors for scummed and collected display. * Merge upgrade code cleanup. * Add `OnTransitionEnd` calls to sandstorm transitions both to and from Wasteland. Also improved `gSaveContext.lastScene` assignment for both transition types. Allowed a bit of cleanup in `GetCheckArea`. * Added `StateButton`, a button like `ArrowButton` but that allows text instead of arrow icons. Apparently the changes from ArrowButton to StateButton happened in a previous commit... * Changed section name to `trackerDataCheck` to force SoH to load it after the randomizer section, as it required some randoSettings to be loaded first, and nothing else I tried to make the randomizer section load before it worked. This hacks a solution to checks not displaying on fast file load to a specific slot. F*** you, SaveManager, and f*** you too, JSON. * Forgot to change the section string for loading with the name change. * Fix check ordering for checks that trigger the autosave. * Adds option to remove right-side shop items (slots 1-4) from the tracker list. Enabled by default. * Fix default state of Hide Shop Right Checks checkbox. * Fixes grotto and great fairy scrolling and checks. Fixes array overflow from `checkTrackerData` which was creating the issue trying to load the base and randomizer sections first, among other things. That also fixed the massive file loads that were being exhibited in debug mode. * Fix shooting galleries being set as collected again when being played a second time after getting the checks. * Fix Bazaar autoscroll. * Add Saria's Song to `GetCheckFromActor` and removed some limitations from the messageCloseCheck function to make that check track properly. * Fix Song from Impa check. Implemented prevention for multiple "collections" of great fairies, just in case getting the health refill would trigger it with the previous setup. * Fix ice traps on GS tokens not triggering OnItemReceive. * Complete fix for ice trap collection from GS. Add autoscroll when clicking "Expand All". * Add `OnShopSlotChange` with cursorSlot and basePrice parameters. * Fixed include in en_ossan for shop slot hook. Added registration for `OnShopSlotChange` in the tracker, storing the price in a new `price` field in `CheckTrackerData`. Added "seen" functionality to shop checks. Displays the model item name upon first entering a shop, adding the price and switching to trickName (if it's an ice trap) upon navigating to the slot in buy mode, triggered by an invisible "identified" status that mirrors "seen" in every other way. Added tooltips to most options for check tracker color picking to describe what each status actually means. * `std::format` pls * So apparently std::format just decided to break with the latest merge from develop, but fmt::format exists and works? * Removed the last vestiges of `locationsSkipped`. Other general code and formatting cleanups. Moved `IsGameRunning` to `OTRGlobals` so the item tracker could also access it. Used preceding to "fix" item and bottle display in the item tracker on startup. * Some more code cleanup. Removed "Recheck Area" button and relevant code. Backported changes to Anchor branch applicable for single-player, including making a checkAreas vector and structuring the frame by frame checks around that. Also includes fix for Silver Gauntlets and Mirror Shield check collection crash associated with those changes. Fixed Kakariko Bazaar "seen" updates. Fixed tracker window not showing on initial load like it should. * Forgot 1 formatting fix. * Removed conditions for showing Song from Impa (isn't junk under certain conditions, so should show all the time). * Fix vanilla checks, add Zelda's Letter and Malon's Egg to manual check collection. Fix autoscroll while in child stealth section. * Fix crash in Happy Mask Shop in OnSlotChange (referenced non-existent shop id in a tracker-specific enum). * General code cleanup. * Missed one reversion. * One more. * Fix column alignment in `randomizer_check_objects`. * Fix file encoding on `randomizer_check_tracker`. Again. * Fix indentation for `actualItemtrackerItemMap`. Also removed unnecessary parts of the map. * Rename `HasEqItem` to `HasEquipment`. * Slightly better indentation for `actualItemTrackerItemMap`. * Add magic bean salesman to vanilla check tracking, and genericized deku shield to trigger KF shop item 3 wherever you get the shield. Renamed `vanillaCheck` to `vanillaHundoCheck` to (supposedly) clarify the meaning of the usage. * One more rename to `vanillaCompletion` to avoid possible confusion with 100% speedrun conditions. * give me a break XD Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * Changes suggested by briaguya (rename `RandomizerCheckShow` to `Status`, unused code, newline formatting) * Remove unused `itemNames` table. * Remove `IsGameRunning` in favor of `GameInteractor::IsSaveLoaded`. * Restore anti-spoiler functionality for dungeons with dungeon maps. * Review cleanup. * Fix prices not showing for Kak bazaar items. --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com>
2023-10-04 11:03:36 -04:00
ImGui::PopStyleColor();
Randomizer Auto Location tracker (#1942) * Initial Auto-Location Tracking * Updates styling for checked items in Check Tracker * Fixes crashing issues with Check Tracker rendering * Auto scroll Check Tracker windows to current area * Checks Tracker only shows checked locations once in game * Fixes issue where Check Tracker would auto-scroll to wrong location when entering a grotto * Fixes gerudo fortress checks showing in tracker when settings have them removed * InfTable Check Location Fixes: Lost Dog Richard, Rolling Gorons, HBA 1000, Thawed Zora * Fixes most Event Chk Inf Checks on Check Tracker, and Frogs * Check Tracker - Song from Malon now works * Check Tracker - Fixes Claim Check check not tracking - Fixes spoiler for Claim Check check when getting Biggoron's Sword - Fixes LACS being spoiled and not tracking * Check Tracker - Fixes #2 for Skull Mask and Mask of Truth checks * Check Tracker - Adds support for merchants - Fixes #7 for Bomchu Salesman - Fixes #12 for Medigoron * Check Tracker - Fixes #8 for Song from Saria * Check Tracker - Fixes #9 for Adult Shooting Gallery * Check Tracker - Fixes #10 for Composer Grave * Check Tracker - Fixes #14 for Song from Ocarina of Time * Check Tracker - Fixes #16 for Shooting the Sun * Check Tracker - Fixes #19 for Darunia's Joy * Save Editor - Adds missing label for Treasure Chest Game * Check Tracker - Fixes Great Faries checks * Check Tracker - Fixes Sheik at Temple * Check Tracker - Fixes Great Fairy auto-scroll to wrong location * Check Tracker - Updates blue warp checks - Fixes Bongo Bongo and Twinrova checks * Check Tracker - Fixes Dampe's Gravedigging Tour * Check Tracker - Fixes Prescription to King Zora * Check Tracker - Fixes Bazaar showing under wrong area on tracker between adult/child * Check Tracker - Fixes scroll for Hyrule Market and Bazaar * Check Tracker - Fixes giving Adult Trade Items shown on tracker: Broken Sword, Saw, Cojiro, Eyeball Froge, and Eyedrops * Cleans up item_location * Check Tracker - Item List - Fixes item list not updating when changing seeds/options - Separates item exclusion list from item check list - Clean up comments * Check Tracker - Adds Skip functionality to buttons * Check Tracker - Refactors adult trade items to RandomizerInf * Check Tracker - Fixes an issue where any time an item is removed the tracker would cause an application crash * Check Tracker - Item names are now dependent on file language * Check Tracker - Fixes Gerudo Card check not showing in Fast setting * Reorders headers to (hopefully) avoid CI build conflicts on linux/consoles * Explicitly defines vector header in randomizer.h to fix compile errors * Complete Refactor of Check Tracker ImGui * Adds missing check tracker files to CMakeLists * Reverts the Item_location whitespace cleanup from ad10807c * Check Tracker - Loading Fixes - Fixes a bug where loading a save file a second time would add all the checks again - Fixes a bug where the check tracker would not render at all until in a save file * Check Tracker - Fixes a bug where checks would sometimes fail to load * Check Tracker - Fixes duplicated checks when using Only on Pause or Only on Combo * Check Tracker - Works around issue where single characters don't show in EnhancementCombobox, and fixes a label for combo buttons held option * Check Tracker - Applies all Check Tracker changes to Item Location * Check Tracker - Updated Check List - Adds Link's pocket, either in KF or HM depending on starting age - Supports Scrubs and Merchants - Uses enums instead of magic numbers - Updates DC Scrub Short Names for MQ * Check Tracker - Adds a performance mode option * Check Tracker - List Fixes (requires new rando generation) - Fixes Frogs Rupees always visible - Fixes Kokiri Sword Chest not showing - Fixes Weird Egg not showing * Check Tracker - MQ List basic support * Check Tracker - MQ/Vanilla anti-spoilers * Check Tracker - Collecting a compass now spoils the area * Check Tracker - Basic Vanilla Support and fixes - Vanilla items show in check tracker, even if many won't auto check - Fixes an issue with Gerudo Fortress Keys - Refactors IsVisibleInCheckTracker to randomizer_check_tracjer * Check Tracker - Fixes merge conflict from 08a487f35e1d760ab9e69b932edbe4da6bcd9edb * Check Tracker - Fixes tracker loading as Floating when default value is set to Windowed * Randomizer Location Exclusion List - Adds Scrubs, Merchants, Shops. Adult Trade items, MQ Dungeons, and Bean Salesman - Fixes Kokiri Sword Chest, Weird Egg, and Frog Song Rupees from misbehaving - Updates Gerudo Fortress logic to be dependent on Open/Fast/Normal Fortress - Removes Invalid Check - Adds RO Enum for MQ settings - Updates magic values to RO enum * Location Exclusion List - Scrubs that are always randomized now always show on the list * For now, removes some extra code only needed for a Check Tracker. * Randomizer Location Exclusion List - Fixes Eyeball Frog from showing up when Adult Trade Items was off * Location Tracker - Updates Eyedrops to use RandomizerInf instead of Chest * Check Tracker - Fixes a bug where Link's Pocket item wasn't acting as checked for area item count * Check Tracker - Fixes a bug where Locations would incorrectly say Vanilla due to the first check in the area being a non-MQ check * Check Tracker - Fixes a crash when Check Tracker is docked but not visible * Check Tracker - Fixes areas being spoiled when loading different save files * Check Tracker - Only reset variables if they are initialized * Check Tracker - Cleans up old comments, unused variables, methods, and macros, adds language TODOs, * Check Tracker - Readds rainbow UI elements after Cosmetics Editor refactor * Check Tracker - Removal of flag lookup that was refactored, no longer needed header, and some trivial whitespace fixes. * Check Tracker - Refactors Index to Bitmask code to a macro * Check Tracker - Changes ordering from alphabetical to RandomizerCheck ordering * Check Tracker - Wraps everything in a namespace to avoid global variable usage * Check Tracker - Explicitly defines for-loop scope * Check Tracker - refactors dungeon lookup from static array to function * Fixes a bug when using EnhancementColor with alpha * Check Tracker - Refactors all colour to use direct conversions * Check Tracker - refactors settings loading and check visibility for readability * Check Tracker - Fixes a bug where the wrong label showed on the Check Tracker BG Color * UIWidgets - Adds Alpha bar to EnhancementColor when using alpha parameter
2022-12-10 22:39:23 -05:00
Check Tracker Update (#2668) * Initial commit. What works so far: Data file loads, saves, deletes, and is created properly. - Need to run `HasItemBeenCollected` when creating in case of mid-seed regen. Organized checks into maps set by area. Areas show in tracker. - Checks pulled from checkObjectsByArea are not currently listed. - Areas are being assumed completed and hidden at the start. * Checks now populate. Still not counting area totals properly. * Don't track RC_LINKS_POCKET in the data file, and instead manually add it in every time a save is load. rcObjects doesn't contain Link's Pocket location (duh). * Moved ItemReceive hook to randomizer_check_tracker.cpp. Skipped items are properly sorted and formatted. Saved items contribute to an area's gotten/skipped checks on load. Changed skipped items default main color to gray. General code cleanup. * Skipped checks now contribute to area totals for area completion logic. * Mid-menu rework transfer. * Started check lookup on item receive. Tried to enable scum checking on save. * Fixed scum check on save. * More code cleanup, which revealed some issues with loading and saving. Loading now works 100%, but entries in checkTrackerData are disappearing in code somewhere, causing issues with later checks. Scummed color now displays properly. Collected but unsaved displays properly. Unchecked, Skipped, Seen and Scummed checks all have arrows for skipping/unskipping. Counts a little messed up, probably double adding skips. * Fixed item counts being off across resets. Restarts were fine. * Beginning of rework for individual check updates. Adds `Actor lastCheck` to PlayState to allow assigning of last actor to give an item. This allows precise tracking of GS, freestanding PoH, etc. Works for chests too. Currently does not work for shops, unknown for normal NPC gives. Doesn't track last gives for non-checks, like drops from grass, pots, crates, etc. * Actor-based checks fully fleshed out, but can't help with sale-based checks. Implemented `pendingSaleCheck` to back out of an RC check cycle if `gSaveContext->pendingSale` is not NONE when `OnItemReceive` is called, processed through `OnSaleEnd`. This should be the final change necessary to streamline the checks. * Temporary hook to message box close to tie in trackers for non-gs/chest actors that aren't added to `GetCheckFromActor`. This triggers a 2-frame countdown to check with `HasItemBeenCollected` since half of the methods in there aren't updated until after a text box closes. Added scene tracking to get last scene so that checks in scenes that span several overworld areas could be tied to their areas properly. Modified tracker data creation to apply Link's Pocket and Song from Impa conditionally based on randomizer settings instead of just being assumed to be done. May need modification for checking click and drag spoiler loading. Removed the scene equivalence check from CheckChecks so that an entire area is checked each time to avoid issues with, e.g., leaving a shop before a pending sale finishes. * Changed check data creation to use RSKs from gRandomizer to account for settings loaded from drag and drop spoilers. * Beginning of tracker code organization. Changed check color defaults. * Reverted moving tracker colors to header. Some individual check fixes. * Missed something from previous merge? * Removed last remnant of removed performance mode. * Better handle checking when skullsanity is off. * Song checks sceneIDs don't match the scenes they're actually in for some reason. Removed that check. * SaleEnd checks don't need the GetItemEntry parameter. Also set a flag that should prevent the check tracker from running during vanilla saves should that not be resolved by the time it's merged. * Attempting to have only the relevant checks added to the tracker data, as well as showing vanilla checks for non-rando saves. Not working yet (everything is displayed in vanilla). * Added vanilla check tracker population via `vanillaCheck` bool in `RandomizerCheckObject`. This is also added to `IsVisibleInImGui` to handle file loading and saving to eliminate checks that aren't part of vanilla or the rando seed. Implemented deleted tracker data file recreation. Added some extra item name text checks. Songs are still... tricky, so they stay blank. Utilize local copies of the randomizer check objects that are applicable for performance purposes. Fixed vanilla item-giving cutscene crashes when triggered mid-transition. * Apparently not all toolchains can handle macro instantiation without all parameters, like VS can. * Fixed scummed detail color not showing properly on tracker. * Fixed dungeon area totals and GS checks not functioning properly. * Major revamp of checking code. Doesn't rely on `GetCheckFromActor` at all anymore, but instead simply sets a flag to evaluate a number of checks in an area every frame until the check that was gotten is identified. With the new setup, it's much less hardware intensive, and at 60fps 6 checks per frame shows no noticeable effect on framerate. I can envision needing to add a collectedCount in order to account for times when two checks are gotten one right after the other. Changed area scroll to happen from `OnTransitionEnd`, and allow for scrolling in bazaar (was disabled previously because it would jump back and forth between Kak and Market while you were in one). Also setup area check order updating by area instead of all at the same time. * Fixed shooting gallery not reporting proper area. Prevent checks from actually happening if area is RCAREA_INVALID, now that all areas are reporting something if they have checks. Fixed `GetCheckArea()` not updating checks for standard scenes. Lots of vanilla tracking updates, mainly manual checks for gems, medallions and songs, since the often don't have proper scenes in the data. Prevent vanilla from triggering check loops if junk items are collected. Fixed sorting based on saved vs collected. Prevent item name display for vanilla runs. Change coloring of checks so the check name reflects status in vanilla runs. * Fixed "Recheck Area" button erroneously adding to an area's check totals? * Fix DMC vanilla checks. * Fix check tracker data recreation on data file loss. Removed redundant file exists check from SaveTrackerDataHook, as it doesn't matter if it exists or not at that point. Limited check loops to 3 to avoid infinite check loops on non-check/junk item pickup. Added more checks to disable tracker operations if a save is not running. Changed check ordering to put boss reward and heart container checks at the end of whatever RCSHOW group they belong to. * Fixed IsRunning calculation. Further improving vanilla checking. Starting framework for checking medallions, stones, and songs on data file recreation. Fixed medallion check collection. Added GIFT_FROM_SAGES to check list for vanilla file for tracking light medallion. Added check loop limitation to prevent infinite checking after picking up junk item from the ground. * Finished vanilla file recreation and recheck (songs and dungeon rewards all check properly now). This includes deku shield with KF shop item 3. Finished Gift from Raoru light medallion tracking for vanilla. Commented all CheckByScene functionality for now. * Fixed new save data file creation. Disabled entrance area calculation for now, as it only tracks the previous entrance for some reason. Fixed area detection for ToT checks. * GetCheckArea() now utilizes EntranceData almost exclusively, via either `gSaveContext.entranceIndex` or the entrance tracker's `currentGrottoId` in the case of grottos. This also means that EVERYTHING CAN AUTOSCROLL NOW. Entrance shuffles are now much easier to track. Autoscroll is now also triggered on save, just in case someone isn't autosaving and has a lot of checks that get converted to saved. * Fixed missing GS check in LW. * Added area scroll on toggling Show Hidden Items. May configure differently later. Fixed area detection for entrances in Gerudo Fortress/Valley and Collossus. Haunted wasteland doesn't autoscroll due to a bug in `OnTransitionEnd` hook, but checks still evaluate properly there. Rely on scene-based area detection if scene is a main overworld or dungeon scene. * Fixed grotto detection when shuffle is off. * Small code cleanup. Fixed Colossus hand chest checks. * Missing lus bump from merge conflict resolution * Fixed Colossus Grotto making `GetCheckArea` return Wasteland. * Improved OnItemReceive processing for non-token GS checks, since they can sometimes take long enough for the checking process to time out before the item is registered as received. * First attempt at thread safety for tracker data file writing. Seems to work, but might need more testing. * Fixed Recheck Area not unskipping items that register as saved. Improved delayed saving with autosaving, as the autosave triggered quite often before the tracker data save, making things not properly register as saved. * merge cleanup * Converted check tracker data to the sectional saves, adding `CheckTrackerData` to `SaveContext`. Implemented section ID returning and fullSave boolean passing to section functions from my PR temporarily for it to work properly. Moved `RandomizerCheckTrackerData` enum to `randomizerTypes.h` to accommodate that. Changed `Randomizer_SaveInit` to a `SaveManager::InitFunc` to allow for other randomizer-dependent sections to be initialized after that. Required a little refactoring to maintain intro cutscene skip when starting a randomizer file. * Revert section index return and randomizer init changes. Will need to wait on yet more changes to main. * Fixed check tracker initialization (shouldn't be tied to window initialization), restored saving/loading functionality. * Removed `CheckTracker::Init` and put SaveManager calls in `CheckTrackerWindow::InitElement`. Also a bit of cleanup from transition back to save file use. * Fixed tracker displaying check categories while file not loaded. * Fix Darunia's Joy check not marking in vanilla. * Fix autosave not triggering change from collected to saved in tracker data. * Changed default colors for scummed and collected display. * Merge upgrade code cleanup. * Add `OnTransitionEnd` calls to sandstorm transitions both to and from Wasteland. Also improved `gSaveContext.lastScene` assignment for both transition types. Allowed a bit of cleanup in `GetCheckArea`. * Added `StateButton`, a button like `ArrowButton` but that allows text instead of arrow icons. Apparently the changes from ArrowButton to StateButton happened in a previous commit... * Changed section name to `trackerDataCheck` to force SoH to load it after the randomizer section, as it required some randoSettings to be loaded first, and nothing else I tried to make the randomizer section load before it worked. This hacks a solution to checks not displaying on fast file load to a specific slot. F*** you, SaveManager, and f*** you too, JSON. * Forgot to change the section string for loading with the name change. * Fix check ordering for checks that trigger the autosave. * Adds option to remove right-side shop items (slots 1-4) from the tracker list. Enabled by default. * Fix default state of Hide Shop Right Checks checkbox. * Fixes grotto and great fairy scrolling and checks. Fixes array overflow from `checkTrackerData` which was creating the issue trying to load the base and randomizer sections first, among other things. That also fixed the massive file loads that were being exhibited in debug mode. * Fix shooting galleries being set as collected again when being played a second time after getting the checks. * Fix Bazaar autoscroll. * Add Saria's Song to `GetCheckFromActor` and removed some limitations from the messageCloseCheck function to make that check track properly. * Fix Song from Impa check. Implemented prevention for multiple "collections" of great fairies, just in case getting the health refill would trigger it with the previous setup. * Fix ice traps on GS tokens not triggering OnItemReceive. * Complete fix for ice trap collection from GS. Add autoscroll when clicking "Expand All". * Add `OnShopSlotChange` with cursorSlot and basePrice parameters. * Fixed include in en_ossan for shop slot hook. Added registration for `OnShopSlotChange` in the tracker, storing the price in a new `price` field in `CheckTrackerData`. Added "seen" functionality to shop checks. Displays the model item name upon first entering a shop, adding the price and switching to trickName (if it's an ice trap) upon navigating to the slot in buy mode, triggered by an invisible "identified" status that mirrors "seen" in every other way. Added tooltips to most options for check tracker color picking to describe what each status actually means. * `std::format` pls * So apparently std::format just decided to break with the latest merge from develop, but fmt::format exists and works? * Removed the last vestiges of `locationsSkipped`. Other general code and formatting cleanups. Moved `IsGameRunning` to `OTRGlobals` so the item tracker could also access it. Used preceding to "fix" item and bottle display in the item tracker on startup. * Some more code cleanup. Removed "Recheck Area" button and relevant code. Backported changes to Anchor branch applicable for single-player, including making a checkAreas vector and structuring the frame by frame checks around that. Also includes fix for Silver Gauntlets and Mirror Shield check collection crash associated with those changes. Fixed Kakariko Bazaar "seen" updates. Fixed tracker window not showing on initial load like it should. * Forgot 1 formatting fix. * Removed conditions for showing Song from Impa (isn't junk under certain conditions, so should show all the time). * Fix vanilla checks, add Zelda's Letter and Malon's Egg to manual check collection. Fix autoscroll while in child stealth section. * Fix crash in Happy Mask Shop in OnSlotChange (referenced non-existent shop id in a tracker-specific enum). * General code cleanup. * Missed one reversion. * One more. * Fix column alignment in `randomizer_check_objects`. * Fix file encoding on `randomizer_check_tracker`. Again. * Fix indentation for `actualItemtrackerItemMap`. Also removed unnecessary parts of the map. * Rename `HasEqItem` to `HasEquipment`. * Slightly better indentation for `actualItemTrackerItemMap`. * Add magic bean salesman to vanilla check tracking, and genericized deku shield to trigger KF shop item 3 wherever you get the shield. Renamed `vanillaCheck` to `vanillaHundoCheck` to (supposedly) clarify the meaning of the usage. * One more rename to `vanillaCompletion` to avoid possible confusion with 100% speedrun conditions. * give me a break XD Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * Changes suggested by briaguya (rename `RandomizerCheckShow` to `Status`, unused code, newline formatting) * Remove unused `itemNames` table. * Remove `IsGameRunning` in favor of `GameInteractor::IsSaveLoaded`. * Restore anti-spoiler functionality for dungeons with dungeon maps. * Review cleanup. * Fix prices not showing for Kak bazaar items. --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com>
2023-10-04 11:03:36 -04:00
//Keep areas loaded between transitions
if (thisArea == rcArea && doAreaScroll) {
ImGui::SetScrollHereY(0.0f);
doAreaScroll = false;
Randomizer Auto Location tracker (#1942) * Initial Auto-Location Tracking * Updates styling for checked items in Check Tracker * Fixes crashing issues with Check Tracker rendering * Auto scroll Check Tracker windows to current area * Checks Tracker only shows checked locations once in game * Fixes issue where Check Tracker would auto-scroll to wrong location when entering a grotto * Fixes gerudo fortress checks showing in tracker when settings have them removed * InfTable Check Location Fixes: Lost Dog Richard, Rolling Gorons, HBA 1000, Thawed Zora * Fixes most Event Chk Inf Checks on Check Tracker, and Frogs * Check Tracker - Song from Malon now works * Check Tracker - Fixes Claim Check check not tracking - Fixes spoiler for Claim Check check when getting Biggoron's Sword - Fixes LACS being spoiled and not tracking * Check Tracker - Fixes #2 for Skull Mask and Mask of Truth checks * Check Tracker - Adds support for merchants - Fixes #7 for Bomchu Salesman - Fixes #12 for Medigoron * Check Tracker - Fixes #8 for Song from Saria * Check Tracker - Fixes #9 for Adult Shooting Gallery * Check Tracker - Fixes #10 for Composer Grave * Check Tracker - Fixes #14 for Song from Ocarina of Time * Check Tracker - Fixes #16 for Shooting the Sun * Check Tracker - Fixes #19 for Darunia's Joy * Save Editor - Adds missing label for Treasure Chest Game * Check Tracker - Fixes Great Faries checks * Check Tracker - Fixes Sheik at Temple * Check Tracker - Fixes Great Fairy auto-scroll to wrong location * Check Tracker - Updates blue warp checks - Fixes Bongo Bongo and Twinrova checks * Check Tracker - Fixes Dampe's Gravedigging Tour * Check Tracker - Fixes Prescription to King Zora * Check Tracker - Fixes Bazaar showing under wrong area on tracker between adult/child * Check Tracker - Fixes scroll for Hyrule Market and Bazaar * Check Tracker - Fixes giving Adult Trade Items shown on tracker: Broken Sword, Saw, Cojiro, Eyeball Froge, and Eyedrops * Cleans up item_location * Check Tracker - Item List - Fixes item list not updating when changing seeds/options - Separates item exclusion list from item check list - Clean up comments * Check Tracker - Adds Skip functionality to buttons * Check Tracker - Refactors adult trade items to RandomizerInf * Check Tracker - Fixes an issue where any time an item is removed the tracker would cause an application crash * Check Tracker - Item names are now dependent on file language * Check Tracker - Fixes Gerudo Card check not showing in Fast setting * Reorders headers to (hopefully) avoid CI build conflicts on linux/consoles * Explicitly defines vector header in randomizer.h to fix compile errors * Complete Refactor of Check Tracker ImGui * Adds missing check tracker files to CMakeLists * Reverts the Item_location whitespace cleanup from ad10807c * Check Tracker - Loading Fixes - Fixes a bug where loading a save file a second time would add all the checks again - Fixes a bug where the check tracker would not render at all until in a save file * Check Tracker - Fixes a bug where checks would sometimes fail to load * Check Tracker - Fixes duplicated checks when using Only on Pause or Only on Combo * Check Tracker - Works around issue where single characters don't show in EnhancementCombobox, and fixes a label for combo buttons held option * Check Tracker - Applies all Check Tracker changes to Item Location * Check Tracker - Updated Check List - Adds Link's pocket, either in KF or HM depending on starting age - Supports Scrubs and Merchants - Uses enums instead of magic numbers - Updates DC Scrub Short Names for MQ * Check Tracker - Adds a performance mode option * Check Tracker - List Fixes (requires new rando generation) - Fixes Frogs Rupees always visible - Fixes Kokiri Sword Chest not showing - Fixes Weird Egg not showing * Check Tracker - MQ List basic support * Check Tracker - MQ/Vanilla anti-spoilers * Check Tracker - Collecting a compass now spoils the area * Check Tracker - Basic Vanilla Support and fixes - Vanilla items show in check tracker, even if many won't auto check - Fixes an issue with Gerudo Fortress Keys - Refactors IsVisibleInCheckTracker to randomizer_check_tracjer * Check Tracker - Fixes merge conflict from 08a487f35e1d760ab9e69b932edbe4da6bcd9edb * Check Tracker - Fixes tracker loading as Floating when default value is set to Windowed * Randomizer Location Exclusion List - Adds Scrubs, Merchants, Shops. Adult Trade items, MQ Dungeons, and Bean Salesman - Fixes Kokiri Sword Chest, Weird Egg, and Frog Song Rupees from misbehaving - Updates Gerudo Fortress logic to be dependent on Open/Fast/Normal Fortress - Removes Invalid Check - Adds RO Enum for MQ settings - Updates magic values to RO enum * Location Exclusion List - Scrubs that are always randomized now always show on the list * For now, removes some extra code only needed for a Check Tracker. * Randomizer Location Exclusion List - Fixes Eyeball Frog from showing up when Adult Trade Items was off * Location Tracker - Updates Eyedrops to use RandomizerInf instead of Chest * Check Tracker - Fixes a bug where Link's Pocket item wasn't acting as checked for area item count * Check Tracker - Fixes a bug where Locations would incorrectly say Vanilla due to the first check in the area being a non-MQ check * Check Tracker - Fixes a crash when Check Tracker is docked but not visible * Check Tracker - Fixes areas being spoiled when loading different save files * Check Tracker - Only reset variables if they are initialized * Check Tracker - Cleans up old comments, unused variables, methods, and macros, adds language TODOs, * Check Tracker - Readds rainbow UI elements after Cosmetics Editor refactor * Check Tracker - Removal of flag lookup that was refactored, no longer needed header, and some trivial whitespace fixes. * Check Tracker - Refactors Index to Bitmask code to a macro * Check Tracker - Changes ordering from alphabetical to RandomizerCheck ordering * Check Tracker - Wraps everything in a namespace to avoid global variable usage * Check Tracker - Explicitly defines for-loop scope * Check Tracker - refactors dungeon lookup from static array to function * Fixes a bug when using EnhancementColor with alpha * Check Tracker - Refactors all colour to use direct conversions * Check Tracker - refactors settings loading and check visibility for readability * Check Tracker - Fixes a bug where the wrong label showed on the Check Tracker BG Color * UIWidgets - Adds Alpha bar to EnhancementColor when using alpha parameter
2022-12-10 22:39:23 -05:00
}
Check Tracker Update (#2668) * Initial commit. What works so far: Data file loads, saves, deletes, and is created properly. - Need to run `HasItemBeenCollected` when creating in case of mid-seed regen. Organized checks into maps set by area. Areas show in tracker. - Checks pulled from checkObjectsByArea are not currently listed. - Areas are being assumed completed and hidden at the start. * Checks now populate. Still not counting area totals properly. * Don't track RC_LINKS_POCKET in the data file, and instead manually add it in every time a save is load. rcObjects doesn't contain Link's Pocket location (duh). * Moved ItemReceive hook to randomizer_check_tracker.cpp. Skipped items are properly sorted and formatted. Saved items contribute to an area's gotten/skipped checks on load. Changed skipped items default main color to gray. General code cleanup. * Skipped checks now contribute to area totals for area completion logic. * Mid-menu rework transfer. * Started check lookup on item receive. Tried to enable scum checking on save. * Fixed scum check on save. * More code cleanup, which revealed some issues with loading and saving. Loading now works 100%, but entries in checkTrackerData are disappearing in code somewhere, causing issues with later checks. Scummed color now displays properly. Collected but unsaved displays properly. Unchecked, Skipped, Seen and Scummed checks all have arrows for skipping/unskipping. Counts a little messed up, probably double adding skips. * Fixed item counts being off across resets. Restarts were fine. * Beginning of rework for individual check updates. Adds `Actor lastCheck` to PlayState to allow assigning of last actor to give an item. This allows precise tracking of GS, freestanding PoH, etc. Works for chests too. Currently does not work for shops, unknown for normal NPC gives. Doesn't track last gives for non-checks, like drops from grass, pots, crates, etc. * Actor-based checks fully fleshed out, but can't help with sale-based checks. Implemented `pendingSaleCheck` to back out of an RC check cycle if `gSaveContext->pendingSale` is not NONE when `OnItemReceive` is called, processed through `OnSaleEnd`. This should be the final change necessary to streamline the checks. * Temporary hook to message box close to tie in trackers for non-gs/chest actors that aren't added to `GetCheckFromActor`. This triggers a 2-frame countdown to check with `HasItemBeenCollected` since half of the methods in there aren't updated until after a text box closes. Added scene tracking to get last scene so that checks in scenes that span several overworld areas could be tied to their areas properly. Modified tracker data creation to apply Link's Pocket and Song from Impa conditionally based on randomizer settings instead of just being assumed to be done. May need modification for checking click and drag spoiler loading. Removed the scene equivalence check from CheckChecks so that an entire area is checked each time to avoid issues with, e.g., leaving a shop before a pending sale finishes. * Changed check data creation to use RSKs from gRandomizer to account for settings loaded from drag and drop spoilers. * Beginning of tracker code organization. Changed check color defaults. * Reverted moving tracker colors to header. Some individual check fixes. * Missed something from previous merge? * Removed last remnant of removed performance mode. * Better handle checking when skullsanity is off. * Song checks sceneIDs don't match the scenes they're actually in for some reason. Removed that check. * SaleEnd checks don't need the GetItemEntry parameter. Also set a flag that should prevent the check tracker from running during vanilla saves should that not be resolved by the time it's merged. * Attempting to have only the relevant checks added to the tracker data, as well as showing vanilla checks for non-rando saves. Not working yet (everything is displayed in vanilla). * Added vanilla check tracker population via `vanillaCheck` bool in `RandomizerCheckObject`. This is also added to `IsVisibleInImGui` to handle file loading and saving to eliminate checks that aren't part of vanilla or the rando seed. Implemented deleted tracker data file recreation. Added some extra item name text checks. Songs are still... tricky, so they stay blank. Utilize local copies of the randomizer check objects that are applicable for performance purposes. Fixed vanilla item-giving cutscene crashes when triggered mid-transition. * Apparently not all toolchains can handle macro instantiation without all parameters, like VS can. * Fixed scummed detail color not showing properly on tracker. * Fixed dungeon area totals and GS checks not functioning properly. * Major revamp of checking code. Doesn't rely on `GetCheckFromActor` at all anymore, but instead simply sets a flag to evaluate a number of checks in an area every frame until the check that was gotten is identified. With the new setup, it's much less hardware intensive, and at 60fps 6 checks per frame shows no noticeable effect on framerate. I can envision needing to add a collectedCount in order to account for times when two checks are gotten one right after the other. Changed area scroll to happen from `OnTransitionEnd`, and allow for scrolling in bazaar (was disabled previously because it would jump back and forth between Kak and Market while you were in one). Also setup area check order updating by area instead of all at the same time. * Fixed shooting gallery not reporting proper area. Prevent checks from actually happening if area is RCAREA_INVALID, now that all areas are reporting something if they have checks. Fixed `GetCheckArea()` not updating checks for standard scenes. Lots of vanilla tracking updates, mainly manual checks for gems, medallions and songs, since the often don't have proper scenes in the data. Prevent vanilla from triggering check loops if junk items are collected. Fixed sorting based on saved vs collected. Prevent item name display for vanilla runs. Change coloring of checks so the check name reflects status in vanilla runs. * Fixed "Recheck Area" button erroneously adding to an area's check totals? * Fix DMC vanilla checks. * Fix check tracker data recreation on data file loss. Removed redundant file exists check from SaveTrackerDataHook, as it doesn't matter if it exists or not at that point. Limited check loops to 3 to avoid infinite check loops on non-check/junk item pickup. Added more checks to disable tracker operations if a save is not running. Changed check ordering to put boss reward and heart container checks at the end of whatever RCSHOW group they belong to. * Fixed IsRunning calculation. Further improving vanilla checking. Starting framework for checking medallions, stones, and songs on data file recreation. Fixed medallion check collection. Added GIFT_FROM_SAGES to check list for vanilla file for tracking light medallion. Added check loop limitation to prevent infinite checking after picking up junk item from the ground. * Finished vanilla file recreation and recheck (songs and dungeon rewards all check properly now). This includes deku shield with KF shop item 3. Finished Gift from Raoru light medallion tracking for vanilla. Commented all CheckByScene functionality for now. * Fixed new save data file creation. Disabled entrance area calculation for now, as it only tracks the previous entrance for some reason. Fixed area detection for ToT checks. * GetCheckArea() now utilizes EntranceData almost exclusively, via either `gSaveContext.entranceIndex` or the entrance tracker's `currentGrottoId` in the case of grottos. This also means that EVERYTHING CAN AUTOSCROLL NOW. Entrance shuffles are now much easier to track. Autoscroll is now also triggered on save, just in case someone isn't autosaving and has a lot of checks that get converted to saved. * Fixed missing GS check in LW. * Added area scroll on toggling Show Hidden Items. May configure differently later. Fixed area detection for entrances in Gerudo Fortress/Valley and Collossus. Haunted wasteland doesn't autoscroll due to a bug in `OnTransitionEnd` hook, but checks still evaluate properly there. Rely on scene-based area detection if scene is a main overworld or dungeon scene. * Fixed grotto detection when shuffle is off. * Small code cleanup. Fixed Colossus hand chest checks. * Missing lus bump from merge conflict resolution * Fixed Colossus Grotto making `GetCheckArea` return Wasteland. * Improved OnItemReceive processing for non-token GS checks, since they can sometimes take long enough for the checking process to time out before the item is registered as received. * First attempt at thread safety for tracker data file writing. Seems to work, but might need more testing. * Fixed Recheck Area not unskipping items that register as saved. Improved delayed saving with autosaving, as the autosave triggered quite often before the tracker data save, making things not properly register as saved. * merge cleanup * Converted check tracker data to the sectional saves, adding `CheckTrackerData` to `SaveContext`. Implemented section ID returning and fullSave boolean passing to section functions from my PR temporarily for it to work properly. Moved `RandomizerCheckTrackerData` enum to `randomizerTypes.h` to accommodate that. Changed `Randomizer_SaveInit` to a `SaveManager::InitFunc` to allow for other randomizer-dependent sections to be initialized after that. Required a little refactoring to maintain intro cutscene skip when starting a randomizer file. * Revert section index return and randomizer init changes. Will need to wait on yet more changes to main. * Fixed check tracker initialization (shouldn't be tied to window initialization), restored saving/loading functionality. * Removed `CheckTracker::Init` and put SaveManager calls in `CheckTrackerWindow::InitElement`. Also a bit of cleanup from transition back to save file use. * Fixed tracker displaying check categories while file not loaded. * Fix Darunia's Joy check not marking in vanilla. * Fix autosave not triggering change from collected to saved in tracker data. * Changed default colors for scummed and collected display. * Merge upgrade code cleanup. * Add `OnTransitionEnd` calls to sandstorm transitions both to and from Wasteland. Also improved `gSaveContext.lastScene` assignment for both transition types. Allowed a bit of cleanup in `GetCheckArea`. * Added `StateButton`, a button like `ArrowButton` but that allows text instead of arrow icons. Apparently the changes from ArrowButton to StateButton happened in a previous commit... * Changed section name to `trackerDataCheck` to force SoH to load it after the randomizer section, as it required some randoSettings to be loaded first, and nothing else I tried to make the randomizer section load before it worked. This hacks a solution to checks not displaying on fast file load to a specific slot. F*** you, SaveManager, and f*** you too, JSON. * Forgot to change the section string for loading with the name change. * Fix check ordering for checks that trigger the autosave. * Adds option to remove right-side shop items (slots 1-4) from the tracker list. Enabled by default. * Fix default state of Hide Shop Right Checks checkbox. * Fixes grotto and great fairy scrolling and checks. Fixes array overflow from `checkTrackerData` which was creating the issue trying to load the base and randomizer sections first, among other things. That also fixed the massive file loads that were being exhibited in debug mode. * Fix shooting galleries being set as collected again when being played a second time after getting the checks. * Fix Bazaar autoscroll. * Add Saria's Song to `GetCheckFromActor` and removed some limitations from the messageCloseCheck function to make that check track properly. * Fix Song from Impa check. Implemented prevention for multiple "collections" of great fairies, just in case getting the health refill would trigger it with the previous setup. * Fix ice traps on GS tokens not triggering OnItemReceive. * Complete fix for ice trap collection from GS. Add autoscroll when clicking "Expand All". * Add `OnShopSlotChange` with cursorSlot and basePrice parameters. * Fixed include in en_ossan for shop slot hook. Added registration for `OnShopSlotChange` in the tracker, storing the price in a new `price` field in `CheckTrackerData`. Added "seen" functionality to shop checks. Displays the model item name upon first entering a shop, adding the price and switching to trickName (if it's an ice trap) upon navigating to the slot in buy mode, triggered by an invisible "identified" status that mirrors "seen" in every other way. Added tooltips to most options for check tracker color picking to describe what each status actually means. * `std::format` pls * So apparently std::format just decided to break with the latest merge from develop, but fmt::format exists and works? * Removed the last vestiges of `locationsSkipped`. Other general code and formatting cleanups. Moved `IsGameRunning` to `OTRGlobals` so the item tracker could also access it. Used preceding to "fix" item and bottle display in the item tracker on startup. * Some more code cleanup. Removed "Recheck Area" button and relevant code. Backported changes to Anchor branch applicable for single-player, including making a checkAreas vector and structuring the frame by frame checks around that. Also includes fix for Silver Gauntlets and Mirror Shield check collection crash associated with those changes. Fixed Kakariko Bazaar "seen" updates. Fixed tracker window not showing on initial load like it should. * Forgot 1 formatting fix. * Removed conditions for showing Song from Impa (isn't junk under certain conditions, so should show all the time). * Fix vanilla checks, add Zelda's Letter and Malon's Egg to manual check collection. Fix autoscroll while in child stealth section. * Fix crash in Happy Mask Shop in OnSlotChange (referenced non-existent shop id in a tracker-specific enum). * General code cleanup. * Missed one reversion. * One more. * Fix column alignment in `randomizer_check_objects`. * Fix file encoding on `randomizer_check_tracker`. Again. * Fix indentation for `actualItemtrackerItemMap`. Also removed unnecessary parts of the map. * Rename `HasEqItem` to `HasEquipment`. * Slightly better indentation for `actualItemTrackerItemMap`. * Add magic bean salesman to vanilla check tracking, and genericized deku shield to trigger KF shop item 3 wherever you get the shield. Renamed `vanillaCheck` to `vanillaHundoCheck` to (supposedly) clarify the meaning of the usage. * One more rename to `vanillaCompletion` to avoid possible confusion with 100% speedrun conditions. * give me a break XD Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * Changes suggested by briaguya (rename `RandomizerCheckShow` to `Status`, unused code, newline formatting) * Remove unused `itemNames` table. * Remove `IsGameRunning` in favor of `GameInteractor::IsSaveLoaded`. * Restore anti-spoiler functionality for dungeons with dungeon maps. * Review cleanup. * Fix prices not showing for Kak bazaar items. --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com>
2023-10-04 11:03:36 -04:00
for (auto rco : objs) {
if (IsVisibleInCheckTracker(rco) && doDraw && isThisAreaSpoiled) {
Check Tracker Update (#2668) * Initial commit. What works so far: Data file loads, saves, deletes, and is created properly. - Need to run `HasItemBeenCollected` when creating in case of mid-seed regen. Organized checks into maps set by area. Areas show in tracker. - Checks pulled from checkObjectsByArea are not currently listed. - Areas are being assumed completed and hidden at the start. * Checks now populate. Still not counting area totals properly. * Don't track RC_LINKS_POCKET in the data file, and instead manually add it in every time a save is load. rcObjects doesn't contain Link's Pocket location (duh). * Moved ItemReceive hook to randomizer_check_tracker.cpp. Skipped items are properly sorted and formatted. Saved items contribute to an area's gotten/skipped checks on load. Changed skipped items default main color to gray. General code cleanup. * Skipped checks now contribute to area totals for area completion logic. * Mid-menu rework transfer. * Started check lookup on item receive. Tried to enable scum checking on save. * Fixed scum check on save. * More code cleanup, which revealed some issues with loading and saving. Loading now works 100%, but entries in checkTrackerData are disappearing in code somewhere, causing issues with later checks. Scummed color now displays properly. Collected but unsaved displays properly. Unchecked, Skipped, Seen and Scummed checks all have arrows for skipping/unskipping. Counts a little messed up, probably double adding skips. * Fixed item counts being off across resets. Restarts were fine. * Beginning of rework for individual check updates. Adds `Actor lastCheck` to PlayState to allow assigning of last actor to give an item. This allows precise tracking of GS, freestanding PoH, etc. Works for chests too. Currently does not work for shops, unknown for normal NPC gives. Doesn't track last gives for non-checks, like drops from grass, pots, crates, etc. * Actor-based checks fully fleshed out, but can't help with sale-based checks. Implemented `pendingSaleCheck` to back out of an RC check cycle if `gSaveContext->pendingSale` is not NONE when `OnItemReceive` is called, processed through `OnSaleEnd`. This should be the final change necessary to streamline the checks. * Temporary hook to message box close to tie in trackers for non-gs/chest actors that aren't added to `GetCheckFromActor`. This triggers a 2-frame countdown to check with `HasItemBeenCollected` since half of the methods in there aren't updated until after a text box closes. Added scene tracking to get last scene so that checks in scenes that span several overworld areas could be tied to their areas properly. Modified tracker data creation to apply Link's Pocket and Song from Impa conditionally based on randomizer settings instead of just being assumed to be done. May need modification for checking click and drag spoiler loading. Removed the scene equivalence check from CheckChecks so that an entire area is checked each time to avoid issues with, e.g., leaving a shop before a pending sale finishes. * Changed check data creation to use RSKs from gRandomizer to account for settings loaded from drag and drop spoilers. * Beginning of tracker code organization. Changed check color defaults. * Reverted moving tracker colors to header. Some individual check fixes. * Missed something from previous merge? * Removed last remnant of removed performance mode. * Better handle checking when skullsanity is off. * Song checks sceneIDs don't match the scenes they're actually in for some reason. Removed that check. * SaleEnd checks don't need the GetItemEntry parameter. Also set a flag that should prevent the check tracker from running during vanilla saves should that not be resolved by the time it's merged. * Attempting to have only the relevant checks added to the tracker data, as well as showing vanilla checks for non-rando saves. Not working yet (everything is displayed in vanilla). * Added vanilla check tracker population via `vanillaCheck` bool in `RandomizerCheckObject`. This is also added to `IsVisibleInImGui` to handle file loading and saving to eliminate checks that aren't part of vanilla or the rando seed. Implemented deleted tracker data file recreation. Added some extra item name text checks. Songs are still... tricky, so they stay blank. Utilize local copies of the randomizer check objects that are applicable for performance purposes. Fixed vanilla item-giving cutscene crashes when triggered mid-transition. * Apparently not all toolchains can handle macro instantiation without all parameters, like VS can. * Fixed scummed detail color not showing properly on tracker. * Fixed dungeon area totals and GS checks not functioning properly. * Major revamp of checking code. Doesn't rely on `GetCheckFromActor` at all anymore, but instead simply sets a flag to evaluate a number of checks in an area every frame until the check that was gotten is identified. With the new setup, it's much less hardware intensive, and at 60fps 6 checks per frame shows no noticeable effect on framerate. I can envision needing to add a collectedCount in order to account for times when two checks are gotten one right after the other. Changed area scroll to happen from `OnTransitionEnd`, and allow for scrolling in bazaar (was disabled previously because it would jump back and forth between Kak and Market while you were in one). Also setup area check order updating by area instead of all at the same time. * Fixed shooting gallery not reporting proper area. Prevent checks from actually happening if area is RCAREA_INVALID, now that all areas are reporting something if they have checks. Fixed `GetCheckArea()` not updating checks for standard scenes. Lots of vanilla tracking updates, mainly manual checks for gems, medallions and songs, since the often don't have proper scenes in the data. Prevent vanilla from triggering check loops if junk items are collected. Fixed sorting based on saved vs collected. Prevent item name display for vanilla runs. Change coloring of checks so the check name reflects status in vanilla runs. * Fixed "Recheck Area" button erroneously adding to an area's check totals? * Fix DMC vanilla checks. * Fix check tracker data recreation on data file loss. Removed redundant file exists check from SaveTrackerDataHook, as it doesn't matter if it exists or not at that point. Limited check loops to 3 to avoid infinite check loops on non-check/junk item pickup. Added more checks to disable tracker operations if a save is not running. Changed check ordering to put boss reward and heart container checks at the end of whatever RCSHOW group they belong to. * Fixed IsRunning calculation. Further improving vanilla checking. Starting framework for checking medallions, stones, and songs on data file recreation. Fixed medallion check collection. Added GIFT_FROM_SAGES to check list for vanilla file for tracking light medallion. Added check loop limitation to prevent infinite checking after picking up junk item from the ground. * Finished vanilla file recreation and recheck (songs and dungeon rewards all check properly now). This includes deku shield with KF shop item 3. Finished Gift from Raoru light medallion tracking for vanilla. Commented all CheckByScene functionality for now. * Fixed new save data file creation. Disabled entrance area calculation for now, as it only tracks the previous entrance for some reason. Fixed area detection for ToT checks. * GetCheckArea() now utilizes EntranceData almost exclusively, via either `gSaveContext.entranceIndex` or the entrance tracker's `currentGrottoId` in the case of grottos. This also means that EVERYTHING CAN AUTOSCROLL NOW. Entrance shuffles are now much easier to track. Autoscroll is now also triggered on save, just in case someone isn't autosaving and has a lot of checks that get converted to saved. * Fixed missing GS check in LW. * Added area scroll on toggling Show Hidden Items. May configure differently later. Fixed area detection for entrances in Gerudo Fortress/Valley and Collossus. Haunted wasteland doesn't autoscroll due to a bug in `OnTransitionEnd` hook, but checks still evaluate properly there. Rely on scene-based area detection if scene is a main overworld or dungeon scene. * Fixed grotto detection when shuffle is off. * Small code cleanup. Fixed Colossus hand chest checks. * Missing lus bump from merge conflict resolution * Fixed Colossus Grotto making `GetCheckArea` return Wasteland. * Improved OnItemReceive processing for non-token GS checks, since they can sometimes take long enough for the checking process to time out before the item is registered as received. * First attempt at thread safety for tracker data file writing. Seems to work, but might need more testing. * Fixed Recheck Area not unskipping items that register as saved. Improved delayed saving with autosaving, as the autosave triggered quite often before the tracker data save, making things not properly register as saved. * merge cleanup * Converted check tracker data to the sectional saves, adding `CheckTrackerData` to `SaveContext`. Implemented section ID returning and fullSave boolean passing to section functions from my PR temporarily for it to work properly. Moved `RandomizerCheckTrackerData` enum to `randomizerTypes.h` to accommodate that. Changed `Randomizer_SaveInit` to a `SaveManager::InitFunc` to allow for other randomizer-dependent sections to be initialized after that. Required a little refactoring to maintain intro cutscene skip when starting a randomizer file. * Revert section index return and randomizer init changes. Will need to wait on yet more changes to main. * Fixed check tracker initialization (shouldn't be tied to window initialization), restored saving/loading functionality. * Removed `CheckTracker::Init` and put SaveManager calls in `CheckTrackerWindow::InitElement`. Also a bit of cleanup from transition back to save file use. * Fixed tracker displaying check categories while file not loaded. * Fix Darunia's Joy check not marking in vanilla. * Fix autosave not triggering change from collected to saved in tracker data. * Changed default colors for scummed and collected display. * Merge upgrade code cleanup. * Add `OnTransitionEnd` calls to sandstorm transitions both to and from Wasteland. Also improved `gSaveContext.lastScene` assignment for both transition types. Allowed a bit of cleanup in `GetCheckArea`. * Added `StateButton`, a button like `ArrowButton` but that allows text instead of arrow icons. Apparently the changes from ArrowButton to StateButton happened in a previous commit... * Changed section name to `trackerDataCheck` to force SoH to load it after the randomizer section, as it required some randoSettings to be loaded first, and nothing else I tried to make the randomizer section load before it worked. This hacks a solution to checks not displaying on fast file load to a specific slot. F*** you, SaveManager, and f*** you too, JSON. * Forgot to change the section string for loading with the name change. * Fix check ordering for checks that trigger the autosave. * Adds option to remove right-side shop items (slots 1-4) from the tracker list. Enabled by default. * Fix default state of Hide Shop Right Checks checkbox. * Fixes grotto and great fairy scrolling and checks. Fixes array overflow from `checkTrackerData` which was creating the issue trying to load the base and randomizer sections first, among other things. That also fixed the massive file loads that were being exhibited in debug mode. * Fix shooting galleries being set as collected again when being played a second time after getting the checks. * Fix Bazaar autoscroll. * Add Saria's Song to `GetCheckFromActor` and removed some limitations from the messageCloseCheck function to make that check track properly. * Fix Song from Impa check. Implemented prevention for multiple "collections" of great fairies, just in case getting the health refill would trigger it with the previous setup. * Fix ice traps on GS tokens not triggering OnItemReceive. * Complete fix for ice trap collection from GS. Add autoscroll when clicking "Expand All". * Add `OnShopSlotChange` with cursorSlot and basePrice parameters. * Fixed include in en_ossan for shop slot hook. Added registration for `OnShopSlotChange` in the tracker, storing the price in a new `price` field in `CheckTrackerData`. Added "seen" functionality to shop checks. Displays the model item name upon first entering a shop, adding the price and switching to trickName (if it's an ice trap) upon navigating to the slot in buy mode, triggered by an invisible "identified" status that mirrors "seen" in every other way. Added tooltips to most options for check tracker color picking to describe what each status actually means. * `std::format` pls * So apparently std::format just decided to break with the latest merge from develop, but fmt::format exists and works? * Removed the last vestiges of `locationsSkipped`. Other general code and formatting cleanups. Moved `IsGameRunning` to `OTRGlobals` so the item tracker could also access it. Used preceding to "fix" item and bottle display in the item tracker on startup. * Some more code cleanup. Removed "Recheck Area" button and relevant code. Backported changes to Anchor branch applicable for single-player, including making a checkAreas vector and structuring the frame by frame checks around that. Also includes fix for Silver Gauntlets and Mirror Shield check collection crash associated with those changes. Fixed Kakariko Bazaar "seen" updates. Fixed tracker window not showing on initial load like it should. * Forgot 1 formatting fix. * Removed conditions for showing Song from Impa (isn't junk under certain conditions, so should show all the time). * Fix vanilla checks, add Zelda's Letter and Malon's Egg to manual check collection. Fix autoscroll while in child stealth section. * Fix crash in Happy Mask Shop in OnSlotChange (referenced non-existent shop id in a tracker-specific enum). * General code cleanup. * Missed one reversion. * One more. * Fix column alignment in `randomizer_check_objects`. * Fix file encoding on `randomizer_check_tracker`. Again. * Fix indentation for `actualItemtrackerItemMap`. Also removed unnecessary parts of the map. * Rename `HasEqItem` to `HasEquipment`. * Slightly better indentation for `actualItemTrackerItemMap`. * Add magic bean salesman to vanilla check tracking, and genericized deku shield to trigger KF shop item 3 wherever you get the shield. Renamed `vanillaCheck` to `vanillaHundoCheck` to (supposedly) clarify the meaning of the usage. * One more rename to `vanillaCompletion` to avoid possible confusion with 100% speedrun conditions. * give me a break XD Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * Changes suggested by briaguya (rename `RandomizerCheckShow` to `Status`, unused code, newline formatting) * Remove unused `itemNames` table. * Remove `IsGameRunning` in favor of `GameInteractor::IsSaveLoaded`. * Restore anti-spoiler functionality for dungeons with dungeon maps. * Review cleanup. * Fix prices not showing for Kak bazaar items. --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com>
2023-10-04 11:03:36 -04:00
DrawLocation(rco);
}
Check Tracker Update (#2668) * Initial commit. What works so far: Data file loads, saves, deletes, and is created properly. - Need to run `HasItemBeenCollected` when creating in case of mid-seed regen. Organized checks into maps set by area. Areas show in tracker. - Checks pulled from checkObjectsByArea are not currently listed. - Areas are being assumed completed and hidden at the start. * Checks now populate. Still not counting area totals properly. * Don't track RC_LINKS_POCKET in the data file, and instead manually add it in every time a save is load. rcObjects doesn't contain Link's Pocket location (duh). * Moved ItemReceive hook to randomizer_check_tracker.cpp. Skipped items are properly sorted and formatted. Saved items contribute to an area's gotten/skipped checks on load. Changed skipped items default main color to gray. General code cleanup. * Skipped checks now contribute to area totals for area completion logic. * Mid-menu rework transfer. * Started check lookup on item receive. Tried to enable scum checking on save. * Fixed scum check on save. * More code cleanup, which revealed some issues with loading and saving. Loading now works 100%, but entries in checkTrackerData are disappearing in code somewhere, causing issues with later checks. Scummed color now displays properly. Collected but unsaved displays properly. Unchecked, Skipped, Seen and Scummed checks all have arrows for skipping/unskipping. Counts a little messed up, probably double adding skips. * Fixed item counts being off across resets. Restarts were fine. * Beginning of rework for individual check updates. Adds `Actor lastCheck` to PlayState to allow assigning of last actor to give an item. This allows precise tracking of GS, freestanding PoH, etc. Works for chests too. Currently does not work for shops, unknown for normal NPC gives. Doesn't track last gives for non-checks, like drops from grass, pots, crates, etc. * Actor-based checks fully fleshed out, but can't help with sale-based checks. Implemented `pendingSaleCheck` to back out of an RC check cycle if `gSaveContext->pendingSale` is not NONE when `OnItemReceive` is called, processed through `OnSaleEnd`. This should be the final change necessary to streamline the checks. * Temporary hook to message box close to tie in trackers for non-gs/chest actors that aren't added to `GetCheckFromActor`. This triggers a 2-frame countdown to check with `HasItemBeenCollected` since half of the methods in there aren't updated until after a text box closes. Added scene tracking to get last scene so that checks in scenes that span several overworld areas could be tied to their areas properly. Modified tracker data creation to apply Link's Pocket and Song from Impa conditionally based on randomizer settings instead of just being assumed to be done. May need modification for checking click and drag spoiler loading. Removed the scene equivalence check from CheckChecks so that an entire area is checked each time to avoid issues with, e.g., leaving a shop before a pending sale finishes. * Changed check data creation to use RSKs from gRandomizer to account for settings loaded from drag and drop spoilers. * Beginning of tracker code organization. Changed check color defaults. * Reverted moving tracker colors to header. Some individual check fixes. * Missed something from previous merge? * Removed last remnant of removed performance mode. * Better handle checking when skullsanity is off. * Song checks sceneIDs don't match the scenes they're actually in for some reason. Removed that check. * SaleEnd checks don't need the GetItemEntry parameter. Also set a flag that should prevent the check tracker from running during vanilla saves should that not be resolved by the time it's merged. * Attempting to have only the relevant checks added to the tracker data, as well as showing vanilla checks for non-rando saves. Not working yet (everything is displayed in vanilla). * Added vanilla check tracker population via `vanillaCheck` bool in `RandomizerCheckObject`. This is also added to `IsVisibleInImGui` to handle file loading and saving to eliminate checks that aren't part of vanilla or the rando seed. Implemented deleted tracker data file recreation. Added some extra item name text checks. Songs are still... tricky, so they stay blank. Utilize local copies of the randomizer check objects that are applicable for performance purposes. Fixed vanilla item-giving cutscene crashes when triggered mid-transition. * Apparently not all toolchains can handle macro instantiation without all parameters, like VS can. * Fixed scummed detail color not showing properly on tracker. * Fixed dungeon area totals and GS checks not functioning properly. * Major revamp of checking code. Doesn't rely on `GetCheckFromActor` at all anymore, but instead simply sets a flag to evaluate a number of checks in an area every frame until the check that was gotten is identified. With the new setup, it's much less hardware intensive, and at 60fps 6 checks per frame shows no noticeable effect on framerate. I can envision needing to add a collectedCount in order to account for times when two checks are gotten one right after the other. Changed area scroll to happen from `OnTransitionEnd`, and allow for scrolling in bazaar (was disabled previously because it would jump back and forth between Kak and Market while you were in one). Also setup area check order updating by area instead of all at the same time. * Fixed shooting gallery not reporting proper area. Prevent checks from actually happening if area is RCAREA_INVALID, now that all areas are reporting something if they have checks. Fixed `GetCheckArea()` not updating checks for standard scenes. Lots of vanilla tracking updates, mainly manual checks for gems, medallions and songs, since the often don't have proper scenes in the data. Prevent vanilla from triggering check loops if junk items are collected. Fixed sorting based on saved vs collected. Prevent item name display for vanilla runs. Change coloring of checks so the check name reflects status in vanilla runs. * Fixed "Recheck Area" button erroneously adding to an area's check totals? * Fix DMC vanilla checks. * Fix check tracker data recreation on data file loss. Removed redundant file exists check from SaveTrackerDataHook, as it doesn't matter if it exists or not at that point. Limited check loops to 3 to avoid infinite check loops on non-check/junk item pickup. Added more checks to disable tracker operations if a save is not running. Changed check ordering to put boss reward and heart container checks at the end of whatever RCSHOW group they belong to. * Fixed IsRunning calculation. Further improving vanilla checking. Starting framework for checking medallions, stones, and songs on data file recreation. Fixed medallion check collection. Added GIFT_FROM_SAGES to check list for vanilla file for tracking light medallion. Added check loop limitation to prevent infinite checking after picking up junk item from the ground. * Finished vanilla file recreation and recheck (songs and dungeon rewards all check properly now). This includes deku shield with KF shop item 3. Finished Gift from Raoru light medallion tracking for vanilla. Commented all CheckByScene functionality for now. * Fixed new save data file creation. Disabled entrance area calculation for now, as it only tracks the previous entrance for some reason. Fixed area detection for ToT checks. * GetCheckArea() now utilizes EntranceData almost exclusively, via either `gSaveContext.entranceIndex` or the entrance tracker's `currentGrottoId` in the case of grottos. This also means that EVERYTHING CAN AUTOSCROLL NOW. Entrance shuffles are now much easier to track. Autoscroll is now also triggered on save, just in case someone isn't autosaving and has a lot of checks that get converted to saved. * Fixed missing GS check in LW. * Added area scroll on toggling Show Hidden Items. May configure differently later. Fixed area detection for entrances in Gerudo Fortress/Valley and Collossus. Haunted wasteland doesn't autoscroll due to a bug in `OnTransitionEnd` hook, but checks still evaluate properly there. Rely on scene-based area detection if scene is a main overworld or dungeon scene. * Fixed grotto detection when shuffle is off. * Small code cleanup. Fixed Colossus hand chest checks. * Missing lus bump from merge conflict resolution * Fixed Colossus Grotto making `GetCheckArea` return Wasteland. * Improved OnItemReceive processing for non-token GS checks, since they can sometimes take long enough for the checking process to time out before the item is registered as received. * First attempt at thread safety for tracker data file writing. Seems to work, but might need more testing. * Fixed Recheck Area not unskipping items that register as saved. Improved delayed saving with autosaving, as the autosave triggered quite often before the tracker data save, making things not properly register as saved. * merge cleanup * Converted check tracker data to the sectional saves, adding `CheckTrackerData` to `SaveContext`. Implemented section ID returning and fullSave boolean passing to section functions from my PR temporarily for it to work properly. Moved `RandomizerCheckTrackerData` enum to `randomizerTypes.h` to accommodate that. Changed `Randomizer_SaveInit` to a `SaveManager::InitFunc` to allow for other randomizer-dependent sections to be initialized after that. Required a little refactoring to maintain intro cutscene skip when starting a randomizer file. * Revert section index return and randomizer init changes. Will need to wait on yet more changes to main. * Fixed check tracker initialization (shouldn't be tied to window initialization), restored saving/loading functionality. * Removed `CheckTracker::Init` and put SaveManager calls in `CheckTrackerWindow::InitElement`. Also a bit of cleanup from transition back to save file use. * Fixed tracker displaying check categories while file not loaded. * Fix Darunia's Joy check not marking in vanilla. * Fix autosave not triggering change from collected to saved in tracker data. * Changed default colors for scummed and collected display. * Merge upgrade code cleanup. * Add `OnTransitionEnd` calls to sandstorm transitions both to and from Wasteland. Also improved `gSaveContext.lastScene` assignment for both transition types. Allowed a bit of cleanup in `GetCheckArea`. * Added `StateButton`, a button like `ArrowButton` but that allows text instead of arrow icons. Apparently the changes from ArrowButton to StateButton happened in a previous commit... * Changed section name to `trackerDataCheck` to force SoH to load it after the randomizer section, as it required some randoSettings to be loaded first, and nothing else I tried to make the randomizer section load before it worked. This hacks a solution to checks not displaying on fast file load to a specific slot. F*** you, SaveManager, and f*** you too, JSON. * Forgot to change the section string for loading with the name change. * Fix check ordering for checks that trigger the autosave. * Adds option to remove right-side shop items (slots 1-4) from the tracker list. Enabled by default. * Fix default state of Hide Shop Right Checks checkbox. * Fixes grotto and great fairy scrolling and checks. Fixes array overflow from `checkTrackerData` which was creating the issue trying to load the base and randomizer sections first, among other things. That also fixed the massive file loads that were being exhibited in debug mode. * Fix shooting galleries being set as collected again when being played a second time after getting the checks. * Fix Bazaar autoscroll. * Add Saria's Song to `GetCheckFromActor` and removed some limitations from the messageCloseCheck function to make that check track properly. * Fix Song from Impa check. Implemented prevention for multiple "collections" of great fairies, just in case getting the health refill would trigger it with the previous setup. * Fix ice traps on GS tokens not triggering OnItemReceive. * Complete fix for ice trap collection from GS. Add autoscroll when clicking "Expand All". * Add `OnShopSlotChange` with cursorSlot and basePrice parameters. * Fixed include in en_ossan for shop slot hook. Added registration for `OnShopSlotChange` in the tracker, storing the price in a new `price` field in `CheckTrackerData`. Added "seen" functionality to shop checks. Displays the model item name upon first entering a shop, adding the price and switching to trickName (if it's an ice trap) upon navigating to the slot in buy mode, triggered by an invisible "identified" status that mirrors "seen" in every other way. Added tooltips to most options for check tracker color picking to describe what each status actually means. * `std::format` pls * So apparently std::format just decided to break with the latest merge from develop, but fmt::format exists and works? * Removed the last vestiges of `locationsSkipped`. Other general code and formatting cleanups. Moved `IsGameRunning` to `OTRGlobals` so the item tracker could also access it. Used preceding to "fix" item and bottle display in the item tracker on startup. * Some more code cleanup. Removed "Recheck Area" button and relevant code. Backported changes to Anchor branch applicable for single-player, including making a checkAreas vector and structuring the frame by frame checks around that. Also includes fix for Silver Gauntlets and Mirror Shield check collection crash associated with those changes. Fixed Kakariko Bazaar "seen" updates. Fixed tracker window not showing on initial load like it should. * Forgot 1 formatting fix. * Removed conditions for showing Song from Impa (isn't junk under certain conditions, so should show all the time). * Fix vanilla checks, add Zelda's Letter and Malon's Egg to manual check collection. Fix autoscroll while in child stealth section. * Fix crash in Happy Mask Shop in OnSlotChange (referenced non-existent shop id in a tracker-specific enum). * General code cleanup. * Missed one reversion. * One more. * Fix column alignment in `randomizer_check_objects`. * Fix file encoding on `randomizer_check_tracker`. Again. * Fix indentation for `actualItemtrackerItemMap`. Also removed unnecessary parts of the map. * Rename `HasEqItem` to `HasEquipment`. * Slightly better indentation for `actualItemTrackerItemMap`. * Add magic bean salesman to vanilla check tracking, and genericized deku shield to trigger KF shop item 3 wherever you get the shield. Renamed `vanillaCheck` to `vanillaHundoCheck` to (supposedly) clarify the meaning of the usage. * One more rename to `vanillaCompletion` to avoid possible confusion with 100% speedrun conditions. * give me a break XD Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * Changes suggested by briaguya (rename `RandomizerCheckShow` to `Status`, unused code, newline formatting) * Remove unused `itemNames` table. * Remove `IsGameRunning` in favor of `GameInteractor::IsSaveLoaded`. * Restore anti-spoiler functionality for dungeons with dungeon maps. * Review cleanup. * Fix prices not showing for Kak bazaar items. --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com>
2023-10-04 11:03:36 -04:00
}
if (doDraw) {
Check Tracker Update (#2668) * Initial commit. What works so far: Data file loads, saves, deletes, and is created properly. - Need to run `HasItemBeenCollected` when creating in case of mid-seed regen. Organized checks into maps set by area. Areas show in tracker. - Checks pulled from checkObjectsByArea are not currently listed. - Areas are being assumed completed and hidden at the start. * Checks now populate. Still not counting area totals properly. * Don't track RC_LINKS_POCKET in the data file, and instead manually add it in every time a save is load. rcObjects doesn't contain Link's Pocket location (duh). * Moved ItemReceive hook to randomizer_check_tracker.cpp. Skipped items are properly sorted and formatted. Saved items contribute to an area's gotten/skipped checks on load. Changed skipped items default main color to gray. General code cleanup. * Skipped checks now contribute to area totals for area completion logic. * Mid-menu rework transfer. * Started check lookup on item receive. Tried to enable scum checking on save. * Fixed scum check on save. * More code cleanup, which revealed some issues with loading and saving. Loading now works 100%, but entries in checkTrackerData are disappearing in code somewhere, causing issues with later checks. Scummed color now displays properly. Collected but unsaved displays properly. Unchecked, Skipped, Seen and Scummed checks all have arrows for skipping/unskipping. Counts a little messed up, probably double adding skips. * Fixed item counts being off across resets. Restarts were fine. * Beginning of rework for individual check updates. Adds `Actor lastCheck` to PlayState to allow assigning of last actor to give an item. This allows precise tracking of GS, freestanding PoH, etc. Works for chests too. Currently does not work for shops, unknown for normal NPC gives. Doesn't track last gives for non-checks, like drops from grass, pots, crates, etc. * Actor-based checks fully fleshed out, but can't help with sale-based checks. Implemented `pendingSaleCheck` to back out of an RC check cycle if `gSaveContext->pendingSale` is not NONE when `OnItemReceive` is called, processed through `OnSaleEnd`. This should be the final change necessary to streamline the checks. * Temporary hook to message box close to tie in trackers for non-gs/chest actors that aren't added to `GetCheckFromActor`. This triggers a 2-frame countdown to check with `HasItemBeenCollected` since half of the methods in there aren't updated until after a text box closes. Added scene tracking to get last scene so that checks in scenes that span several overworld areas could be tied to their areas properly. Modified tracker data creation to apply Link's Pocket and Song from Impa conditionally based on randomizer settings instead of just being assumed to be done. May need modification for checking click and drag spoiler loading. Removed the scene equivalence check from CheckChecks so that an entire area is checked each time to avoid issues with, e.g., leaving a shop before a pending sale finishes. * Changed check data creation to use RSKs from gRandomizer to account for settings loaded from drag and drop spoilers. * Beginning of tracker code organization. Changed check color defaults. * Reverted moving tracker colors to header. Some individual check fixes. * Missed something from previous merge? * Removed last remnant of removed performance mode. * Better handle checking when skullsanity is off. * Song checks sceneIDs don't match the scenes they're actually in for some reason. Removed that check. * SaleEnd checks don't need the GetItemEntry parameter. Also set a flag that should prevent the check tracker from running during vanilla saves should that not be resolved by the time it's merged. * Attempting to have only the relevant checks added to the tracker data, as well as showing vanilla checks for non-rando saves. Not working yet (everything is displayed in vanilla). * Added vanilla check tracker population via `vanillaCheck` bool in `RandomizerCheckObject`. This is also added to `IsVisibleInImGui` to handle file loading and saving to eliminate checks that aren't part of vanilla or the rando seed. Implemented deleted tracker data file recreation. Added some extra item name text checks. Songs are still... tricky, so they stay blank. Utilize local copies of the randomizer check objects that are applicable for performance purposes. Fixed vanilla item-giving cutscene crashes when triggered mid-transition. * Apparently not all toolchains can handle macro instantiation without all parameters, like VS can. * Fixed scummed detail color not showing properly on tracker. * Fixed dungeon area totals and GS checks not functioning properly. * Major revamp of checking code. Doesn't rely on `GetCheckFromActor` at all anymore, but instead simply sets a flag to evaluate a number of checks in an area every frame until the check that was gotten is identified. With the new setup, it's much less hardware intensive, and at 60fps 6 checks per frame shows no noticeable effect on framerate. I can envision needing to add a collectedCount in order to account for times when two checks are gotten one right after the other. Changed area scroll to happen from `OnTransitionEnd`, and allow for scrolling in bazaar (was disabled previously because it would jump back and forth between Kak and Market while you were in one). Also setup area check order updating by area instead of all at the same time. * Fixed shooting gallery not reporting proper area. Prevent checks from actually happening if area is RCAREA_INVALID, now that all areas are reporting something if they have checks. Fixed `GetCheckArea()` not updating checks for standard scenes. Lots of vanilla tracking updates, mainly manual checks for gems, medallions and songs, since the often don't have proper scenes in the data. Prevent vanilla from triggering check loops if junk items are collected. Fixed sorting based on saved vs collected. Prevent item name display for vanilla runs. Change coloring of checks so the check name reflects status in vanilla runs. * Fixed "Recheck Area" button erroneously adding to an area's check totals? * Fix DMC vanilla checks. * Fix check tracker data recreation on data file loss. Removed redundant file exists check from SaveTrackerDataHook, as it doesn't matter if it exists or not at that point. Limited check loops to 3 to avoid infinite check loops on non-check/junk item pickup. Added more checks to disable tracker operations if a save is not running. Changed check ordering to put boss reward and heart container checks at the end of whatever RCSHOW group they belong to. * Fixed IsRunning calculation. Further improving vanilla checking. Starting framework for checking medallions, stones, and songs on data file recreation. Fixed medallion check collection. Added GIFT_FROM_SAGES to check list for vanilla file for tracking light medallion. Added check loop limitation to prevent infinite checking after picking up junk item from the ground. * Finished vanilla file recreation and recheck (songs and dungeon rewards all check properly now). This includes deku shield with KF shop item 3. Finished Gift from Raoru light medallion tracking for vanilla. Commented all CheckByScene functionality for now. * Fixed new save data file creation. Disabled entrance area calculation for now, as it only tracks the previous entrance for some reason. Fixed area detection for ToT checks. * GetCheckArea() now utilizes EntranceData almost exclusively, via either `gSaveContext.entranceIndex` or the entrance tracker's `currentGrottoId` in the case of grottos. This also means that EVERYTHING CAN AUTOSCROLL NOW. Entrance shuffles are now much easier to track. Autoscroll is now also triggered on save, just in case someone isn't autosaving and has a lot of checks that get converted to saved. * Fixed missing GS check in LW. * Added area scroll on toggling Show Hidden Items. May configure differently later. Fixed area detection for entrances in Gerudo Fortress/Valley and Collossus. Haunted wasteland doesn't autoscroll due to a bug in `OnTransitionEnd` hook, but checks still evaluate properly there. Rely on scene-based area detection if scene is a main overworld or dungeon scene. * Fixed grotto detection when shuffle is off. * Small code cleanup. Fixed Colossus hand chest checks. * Missing lus bump from merge conflict resolution * Fixed Colossus Grotto making `GetCheckArea` return Wasteland. * Improved OnItemReceive processing for non-token GS checks, since they can sometimes take long enough for the checking process to time out before the item is registered as received. * First attempt at thread safety for tracker data file writing. Seems to work, but might need more testing. * Fixed Recheck Area not unskipping items that register as saved. Improved delayed saving with autosaving, as the autosave triggered quite often before the tracker data save, making things not properly register as saved. * merge cleanup * Converted check tracker data to the sectional saves, adding `CheckTrackerData` to `SaveContext`. Implemented section ID returning and fullSave boolean passing to section functions from my PR temporarily for it to work properly. Moved `RandomizerCheckTrackerData` enum to `randomizerTypes.h` to accommodate that. Changed `Randomizer_SaveInit` to a `SaveManager::InitFunc` to allow for other randomizer-dependent sections to be initialized after that. Required a little refactoring to maintain intro cutscene skip when starting a randomizer file. * Revert section index return and randomizer init changes. Will need to wait on yet more changes to main. * Fixed check tracker initialization (shouldn't be tied to window initialization), restored saving/loading functionality. * Removed `CheckTracker::Init` and put SaveManager calls in `CheckTrackerWindow::InitElement`. Also a bit of cleanup from transition back to save file use. * Fixed tracker displaying check categories while file not loaded. * Fix Darunia's Joy check not marking in vanilla. * Fix autosave not triggering change from collected to saved in tracker data. * Changed default colors for scummed and collected display. * Merge upgrade code cleanup. * Add `OnTransitionEnd` calls to sandstorm transitions both to and from Wasteland. Also improved `gSaveContext.lastScene` assignment for both transition types. Allowed a bit of cleanup in `GetCheckArea`. * Added `StateButton`, a button like `ArrowButton` but that allows text instead of arrow icons. Apparently the changes from ArrowButton to StateButton happened in a previous commit... * Changed section name to `trackerDataCheck` to force SoH to load it after the randomizer section, as it required some randoSettings to be loaded first, and nothing else I tried to make the randomizer section load before it worked. This hacks a solution to checks not displaying on fast file load to a specific slot. F*** you, SaveManager, and f*** you too, JSON. * Forgot to change the section string for loading with the name change. * Fix check ordering for checks that trigger the autosave. * Adds option to remove right-side shop items (slots 1-4) from the tracker list. Enabled by default. * Fix default state of Hide Shop Right Checks checkbox. * Fixes grotto and great fairy scrolling and checks. Fixes array overflow from `checkTrackerData` which was creating the issue trying to load the base and randomizer sections first, among other things. That also fixed the massive file loads that were being exhibited in debug mode. * Fix shooting galleries being set as collected again when being played a second time after getting the checks. * Fix Bazaar autoscroll. * Add Saria's Song to `GetCheckFromActor` and removed some limitations from the messageCloseCheck function to make that check track properly. * Fix Song from Impa check. Implemented prevention for multiple "collections" of great fairies, just in case getting the health refill would trigger it with the previous setup. * Fix ice traps on GS tokens not triggering OnItemReceive. * Complete fix for ice trap collection from GS. Add autoscroll when clicking "Expand All". * Add `OnShopSlotChange` with cursorSlot and basePrice parameters. * Fixed include in en_ossan for shop slot hook. Added registration for `OnShopSlotChange` in the tracker, storing the price in a new `price` field in `CheckTrackerData`. Added "seen" functionality to shop checks. Displays the model item name upon first entering a shop, adding the price and switching to trickName (if it's an ice trap) upon navigating to the slot in buy mode, triggered by an invisible "identified" status that mirrors "seen" in every other way. Added tooltips to most options for check tracker color picking to describe what each status actually means. * `std::format` pls * So apparently std::format just decided to break with the latest merge from develop, but fmt::format exists and works? * Removed the last vestiges of `locationsSkipped`. Other general code and formatting cleanups. Moved `IsGameRunning` to `OTRGlobals` so the item tracker could also access it. Used preceding to "fix" item and bottle display in the item tracker on startup. * Some more code cleanup. Removed "Recheck Area" button and relevant code. Backported changes to Anchor branch applicable for single-player, including making a checkAreas vector and structuring the frame by frame checks around that. Also includes fix for Silver Gauntlets and Mirror Shield check collection crash associated with those changes. Fixed Kakariko Bazaar "seen" updates. Fixed tracker window not showing on initial load like it should. * Forgot 1 formatting fix. * Removed conditions for showing Song from Impa (isn't junk under certain conditions, so should show all the time). * Fix vanilla checks, add Zelda's Letter and Malon's Egg to manual check collection. Fix autoscroll while in child stealth section. * Fix crash in Happy Mask Shop in OnSlotChange (referenced non-existent shop id in a tracker-specific enum). * General code cleanup. * Missed one reversion. * One more. * Fix column alignment in `randomizer_check_objects`. * Fix file encoding on `randomizer_check_tracker`. Again. * Fix indentation for `actualItemtrackerItemMap`. Also removed unnecessary parts of the map. * Rename `HasEqItem` to `HasEquipment`. * Slightly better indentation for `actualItemTrackerItemMap`. * Add magic bean salesman to vanilla check tracking, and genericized deku shield to trigger KF shop item 3 wherever you get the shield. Renamed `vanillaCheck` to `vanillaHundoCheck` to (supposedly) clarify the meaning of the usage. * One more rename to `vanillaCompletion` to avoid possible confusion with 100% speedrun conditions. * give me a break XD Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * Changes suggested by briaguya (rename `RandomizerCheckShow` to `Status`, unused code, newline formatting) * Remove unused `itemNames` table. * Remove `IsGameRunning` in favor of `GameInteractor::IsSaveLoaded`. * Restore anti-spoiler functionality for dungeons with dungeon maps. * Review cleanup. * Fix prices not showing for Kak bazaar items. --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com>
2023-10-04 11:03:36 -04:00
ImGui::TreePop();
}
Randomizer Auto Location tracker (#1942) * Initial Auto-Location Tracking * Updates styling for checked items in Check Tracker * Fixes crashing issues with Check Tracker rendering * Auto scroll Check Tracker windows to current area * Checks Tracker only shows checked locations once in game * Fixes issue where Check Tracker would auto-scroll to wrong location when entering a grotto * Fixes gerudo fortress checks showing in tracker when settings have them removed * InfTable Check Location Fixes: Lost Dog Richard, Rolling Gorons, HBA 1000, Thawed Zora * Fixes most Event Chk Inf Checks on Check Tracker, and Frogs * Check Tracker - Song from Malon now works * Check Tracker - Fixes Claim Check check not tracking - Fixes spoiler for Claim Check check when getting Biggoron's Sword - Fixes LACS being spoiled and not tracking * Check Tracker - Fixes #2 for Skull Mask and Mask of Truth checks * Check Tracker - Adds support for merchants - Fixes #7 for Bomchu Salesman - Fixes #12 for Medigoron * Check Tracker - Fixes #8 for Song from Saria * Check Tracker - Fixes #9 for Adult Shooting Gallery * Check Tracker - Fixes #10 for Composer Grave * Check Tracker - Fixes #14 for Song from Ocarina of Time * Check Tracker - Fixes #16 for Shooting the Sun * Check Tracker - Fixes #19 for Darunia's Joy * Save Editor - Adds missing label for Treasure Chest Game * Check Tracker - Fixes Great Faries checks * Check Tracker - Fixes Sheik at Temple * Check Tracker - Fixes Great Fairy auto-scroll to wrong location * Check Tracker - Updates blue warp checks - Fixes Bongo Bongo and Twinrova checks * Check Tracker - Fixes Dampe's Gravedigging Tour * Check Tracker - Fixes Prescription to King Zora * Check Tracker - Fixes Bazaar showing under wrong area on tracker between adult/child * Check Tracker - Fixes scroll for Hyrule Market and Bazaar * Check Tracker - Fixes giving Adult Trade Items shown on tracker: Broken Sword, Saw, Cojiro, Eyeball Froge, and Eyedrops * Cleans up item_location * Check Tracker - Item List - Fixes item list not updating when changing seeds/options - Separates item exclusion list from item check list - Clean up comments * Check Tracker - Adds Skip functionality to buttons * Check Tracker - Refactors adult trade items to RandomizerInf * Check Tracker - Fixes an issue where any time an item is removed the tracker would cause an application crash * Check Tracker - Item names are now dependent on file language * Check Tracker - Fixes Gerudo Card check not showing in Fast setting * Reorders headers to (hopefully) avoid CI build conflicts on linux/consoles * Explicitly defines vector header in randomizer.h to fix compile errors * Complete Refactor of Check Tracker ImGui * Adds missing check tracker files to CMakeLists * Reverts the Item_location whitespace cleanup from ad10807c * Check Tracker - Loading Fixes - Fixes a bug where loading a save file a second time would add all the checks again - Fixes a bug where the check tracker would not render at all until in a save file * Check Tracker - Fixes a bug where checks would sometimes fail to load * Check Tracker - Fixes duplicated checks when using Only on Pause or Only on Combo * Check Tracker - Works around issue where single characters don't show in EnhancementCombobox, and fixes a label for combo buttons held option * Check Tracker - Applies all Check Tracker changes to Item Location * Check Tracker - Updated Check List - Adds Link's pocket, either in KF or HM depending on starting age - Supports Scrubs and Merchants - Uses enums instead of magic numbers - Updates DC Scrub Short Names for MQ * Check Tracker - Adds a performance mode option * Check Tracker - List Fixes (requires new rando generation) - Fixes Frogs Rupees always visible - Fixes Kokiri Sword Chest not showing - Fixes Weird Egg not showing * Check Tracker - MQ List basic support * Check Tracker - MQ/Vanilla anti-spoilers * Check Tracker - Collecting a compass now spoils the area * Check Tracker - Basic Vanilla Support and fixes - Vanilla items show in check tracker, even if many won't auto check - Fixes an issue with Gerudo Fortress Keys - Refactors IsVisibleInCheckTracker to randomizer_check_tracjer * Check Tracker - Fixes merge conflict from 08a487f35e1d760ab9e69b932edbe4da6bcd9edb * Check Tracker - Fixes tracker loading as Floating when default value is set to Windowed * Randomizer Location Exclusion List - Adds Scrubs, Merchants, Shops. Adult Trade items, MQ Dungeons, and Bean Salesman - Fixes Kokiri Sword Chest, Weird Egg, and Frog Song Rupees from misbehaving - Updates Gerudo Fortress logic to be dependent on Open/Fast/Normal Fortress - Removes Invalid Check - Adds RO Enum for MQ settings - Updates magic values to RO enum * Location Exclusion List - Scrubs that are always randomized now always show on the list * For now, removes some extra code only needed for a Check Tracker. * Randomizer Location Exclusion List - Fixes Eyeball Frog from showing up when Adult Trade Items was off * Location Tracker - Updates Eyedrops to use RandomizerInf instead of Chest * Check Tracker - Fixes a bug where Link's Pocket item wasn't acting as checked for area item count * Check Tracker - Fixes a bug where Locations would incorrectly say Vanilla due to the first check in the area being a non-MQ check * Check Tracker - Fixes a crash when Check Tracker is docked but not visible * Check Tracker - Fixes areas being spoiled when loading different save files * Check Tracker - Only reset variables if they are initialized * Check Tracker - Cleans up old comments, unused variables, methods, and macros, adds language TODOs, * Check Tracker - Readds rainbow UI elements after Cosmetics Editor refactor * Check Tracker - Removal of flag lookup that was refactored, no longer needed header, and some trivial whitespace fixes. * Check Tracker - Refactors Index to Bitmask code to a macro * Check Tracker - Changes ordering from alphabetical to RandomizerCheck ordering * Check Tracker - Wraps everything in a namespace to avoid global variable usage * Check Tracker - Explicitly defines for-loop scope * Check Tracker - refactors dungeon lookup from static array to function * Fixes a bug when using EnhancementColor with alpha * Check Tracker - Refactors all colour to use direct conversions * Check Tracker - refactors settings loading and check visibility for readability * Check Tracker - Fixes a bug where the wrong label showed on the Check Tracker BG Color * UIWidgets - Adds Alpha bar to EnhancementColor when using alpha parameter
2022-12-10 22:39:23 -05:00
}
Check Tracker Update (#2668) * Initial commit. What works so far: Data file loads, saves, deletes, and is created properly. - Need to run `HasItemBeenCollected` when creating in case of mid-seed regen. Organized checks into maps set by area. Areas show in tracker. - Checks pulled from checkObjectsByArea are not currently listed. - Areas are being assumed completed and hidden at the start. * Checks now populate. Still not counting area totals properly. * Don't track RC_LINKS_POCKET in the data file, and instead manually add it in every time a save is load. rcObjects doesn't contain Link's Pocket location (duh). * Moved ItemReceive hook to randomizer_check_tracker.cpp. Skipped items are properly sorted and formatted. Saved items contribute to an area's gotten/skipped checks on load. Changed skipped items default main color to gray. General code cleanup. * Skipped checks now contribute to area totals for area completion logic. * Mid-menu rework transfer. * Started check lookup on item receive. Tried to enable scum checking on save. * Fixed scum check on save. * More code cleanup, which revealed some issues with loading and saving. Loading now works 100%, but entries in checkTrackerData are disappearing in code somewhere, causing issues with later checks. Scummed color now displays properly. Collected but unsaved displays properly. Unchecked, Skipped, Seen and Scummed checks all have arrows for skipping/unskipping. Counts a little messed up, probably double adding skips. * Fixed item counts being off across resets. Restarts were fine. * Beginning of rework for individual check updates. Adds `Actor lastCheck` to PlayState to allow assigning of last actor to give an item. This allows precise tracking of GS, freestanding PoH, etc. Works for chests too. Currently does not work for shops, unknown for normal NPC gives. Doesn't track last gives for non-checks, like drops from grass, pots, crates, etc. * Actor-based checks fully fleshed out, but can't help with sale-based checks. Implemented `pendingSaleCheck` to back out of an RC check cycle if `gSaveContext->pendingSale` is not NONE when `OnItemReceive` is called, processed through `OnSaleEnd`. This should be the final change necessary to streamline the checks. * Temporary hook to message box close to tie in trackers for non-gs/chest actors that aren't added to `GetCheckFromActor`. This triggers a 2-frame countdown to check with `HasItemBeenCollected` since half of the methods in there aren't updated until after a text box closes. Added scene tracking to get last scene so that checks in scenes that span several overworld areas could be tied to their areas properly. Modified tracker data creation to apply Link's Pocket and Song from Impa conditionally based on randomizer settings instead of just being assumed to be done. May need modification for checking click and drag spoiler loading. Removed the scene equivalence check from CheckChecks so that an entire area is checked each time to avoid issues with, e.g., leaving a shop before a pending sale finishes. * Changed check data creation to use RSKs from gRandomizer to account for settings loaded from drag and drop spoilers. * Beginning of tracker code organization. Changed check color defaults. * Reverted moving tracker colors to header. Some individual check fixes. * Missed something from previous merge? * Removed last remnant of removed performance mode. * Better handle checking when skullsanity is off. * Song checks sceneIDs don't match the scenes they're actually in for some reason. Removed that check. * SaleEnd checks don't need the GetItemEntry parameter. Also set a flag that should prevent the check tracker from running during vanilla saves should that not be resolved by the time it's merged. * Attempting to have only the relevant checks added to the tracker data, as well as showing vanilla checks for non-rando saves. Not working yet (everything is displayed in vanilla). * Added vanilla check tracker population via `vanillaCheck` bool in `RandomizerCheckObject`. This is also added to `IsVisibleInImGui` to handle file loading and saving to eliminate checks that aren't part of vanilla or the rando seed. Implemented deleted tracker data file recreation. Added some extra item name text checks. Songs are still... tricky, so they stay blank. Utilize local copies of the randomizer check objects that are applicable for performance purposes. Fixed vanilla item-giving cutscene crashes when triggered mid-transition. * Apparently not all toolchains can handle macro instantiation without all parameters, like VS can. * Fixed scummed detail color not showing properly on tracker. * Fixed dungeon area totals and GS checks not functioning properly. * Major revamp of checking code. Doesn't rely on `GetCheckFromActor` at all anymore, but instead simply sets a flag to evaluate a number of checks in an area every frame until the check that was gotten is identified. With the new setup, it's much less hardware intensive, and at 60fps 6 checks per frame shows no noticeable effect on framerate. I can envision needing to add a collectedCount in order to account for times when two checks are gotten one right after the other. Changed area scroll to happen from `OnTransitionEnd`, and allow for scrolling in bazaar (was disabled previously because it would jump back and forth between Kak and Market while you were in one). Also setup area check order updating by area instead of all at the same time. * Fixed shooting gallery not reporting proper area. Prevent checks from actually happening if area is RCAREA_INVALID, now that all areas are reporting something if they have checks. Fixed `GetCheckArea()` not updating checks for standard scenes. Lots of vanilla tracking updates, mainly manual checks for gems, medallions and songs, since the often don't have proper scenes in the data. Prevent vanilla from triggering check loops if junk items are collected. Fixed sorting based on saved vs collected. Prevent item name display for vanilla runs. Change coloring of checks so the check name reflects status in vanilla runs. * Fixed "Recheck Area" button erroneously adding to an area's check totals? * Fix DMC vanilla checks. * Fix check tracker data recreation on data file loss. Removed redundant file exists check from SaveTrackerDataHook, as it doesn't matter if it exists or not at that point. Limited check loops to 3 to avoid infinite check loops on non-check/junk item pickup. Added more checks to disable tracker operations if a save is not running. Changed check ordering to put boss reward and heart container checks at the end of whatever RCSHOW group they belong to. * Fixed IsRunning calculation. Further improving vanilla checking. Starting framework for checking medallions, stones, and songs on data file recreation. Fixed medallion check collection. Added GIFT_FROM_SAGES to check list for vanilla file for tracking light medallion. Added check loop limitation to prevent infinite checking after picking up junk item from the ground. * Finished vanilla file recreation and recheck (songs and dungeon rewards all check properly now). This includes deku shield with KF shop item 3. Finished Gift from Raoru light medallion tracking for vanilla. Commented all CheckByScene functionality for now. * Fixed new save data file creation. Disabled entrance area calculation for now, as it only tracks the previous entrance for some reason. Fixed area detection for ToT checks. * GetCheckArea() now utilizes EntranceData almost exclusively, via either `gSaveContext.entranceIndex` or the entrance tracker's `currentGrottoId` in the case of grottos. This also means that EVERYTHING CAN AUTOSCROLL NOW. Entrance shuffles are now much easier to track. Autoscroll is now also triggered on save, just in case someone isn't autosaving and has a lot of checks that get converted to saved. * Fixed missing GS check in LW. * Added area scroll on toggling Show Hidden Items. May configure differently later. Fixed area detection for entrances in Gerudo Fortress/Valley and Collossus. Haunted wasteland doesn't autoscroll due to a bug in `OnTransitionEnd` hook, but checks still evaluate properly there. Rely on scene-based area detection if scene is a main overworld or dungeon scene. * Fixed grotto detection when shuffle is off. * Small code cleanup. Fixed Colossus hand chest checks. * Missing lus bump from merge conflict resolution * Fixed Colossus Grotto making `GetCheckArea` return Wasteland. * Improved OnItemReceive processing for non-token GS checks, since they can sometimes take long enough for the checking process to time out before the item is registered as received. * First attempt at thread safety for tracker data file writing. Seems to work, but might need more testing. * Fixed Recheck Area not unskipping items that register as saved. Improved delayed saving with autosaving, as the autosave triggered quite often before the tracker data save, making things not properly register as saved. * merge cleanup * Converted check tracker data to the sectional saves, adding `CheckTrackerData` to `SaveContext`. Implemented section ID returning and fullSave boolean passing to section functions from my PR temporarily for it to work properly. Moved `RandomizerCheckTrackerData` enum to `randomizerTypes.h` to accommodate that. Changed `Randomizer_SaveInit` to a `SaveManager::InitFunc` to allow for other randomizer-dependent sections to be initialized after that. Required a little refactoring to maintain intro cutscene skip when starting a randomizer file. * Revert section index return and randomizer init changes. Will need to wait on yet more changes to main. * Fixed check tracker initialization (shouldn't be tied to window initialization), restored saving/loading functionality. * Removed `CheckTracker::Init` and put SaveManager calls in `CheckTrackerWindow::InitElement`. Also a bit of cleanup from transition back to save file use. * Fixed tracker displaying check categories while file not loaded. * Fix Darunia's Joy check not marking in vanilla. * Fix autosave not triggering change from collected to saved in tracker data. * Changed default colors for scummed and collected display. * Merge upgrade code cleanup. * Add `OnTransitionEnd` calls to sandstorm transitions both to and from Wasteland. Also improved `gSaveContext.lastScene` assignment for both transition types. Allowed a bit of cleanup in `GetCheckArea`. * Added `StateButton`, a button like `ArrowButton` but that allows text instead of arrow icons. Apparently the changes from ArrowButton to StateButton happened in a previous commit... * Changed section name to `trackerDataCheck` to force SoH to load it after the randomizer section, as it required some randoSettings to be loaded first, and nothing else I tried to make the randomizer section load before it worked. This hacks a solution to checks not displaying on fast file load to a specific slot. F*** you, SaveManager, and f*** you too, JSON. * Forgot to change the section string for loading with the name change. * Fix check ordering for checks that trigger the autosave. * Adds option to remove right-side shop items (slots 1-4) from the tracker list. Enabled by default. * Fix default state of Hide Shop Right Checks checkbox. * Fixes grotto and great fairy scrolling and checks. Fixes array overflow from `checkTrackerData` which was creating the issue trying to load the base and randomizer sections first, among other things. That also fixed the massive file loads that were being exhibited in debug mode. * Fix shooting galleries being set as collected again when being played a second time after getting the checks. * Fix Bazaar autoscroll. * Add Saria's Song to `GetCheckFromActor` and removed some limitations from the messageCloseCheck function to make that check track properly. * Fix Song from Impa check. Implemented prevention for multiple "collections" of great fairies, just in case getting the health refill would trigger it with the previous setup. * Fix ice traps on GS tokens not triggering OnItemReceive. * Complete fix for ice trap collection from GS. Add autoscroll when clicking "Expand All". * Add `OnShopSlotChange` with cursorSlot and basePrice parameters. * Fixed include in en_ossan for shop slot hook. Added registration for `OnShopSlotChange` in the tracker, storing the price in a new `price` field in `CheckTrackerData`. Added "seen" functionality to shop checks. Displays the model item name upon first entering a shop, adding the price and switching to trickName (if it's an ice trap) upon navigating to the slot in buy mode, triggered by an invisible "identified" status that mirrors "seen" in every other way. Added tooltips to most options for check tracker color picking to describe what each status actually means. * `std::format` pls * So apparently std::format just decided to break with the latest merge from develop, but fmt::format exists and works? * Removed the last vestiges of `locationsSkipped`. Other general code and formatting cleanups. Moved `IsGameRunning` to `OTRGlobals` so the item tracker could also access it. Used preceding to "fix" item and bottle display in the item tracker on startup. * Some more code cleanup. Removed "Recheck Area" button and relevant code. Backported changes to Anchor branch applicable for single-player, including making a checkAreas vector and structuring the frame by frame checks around that. Also includes fix for Silver Gauntlets and Mirror Shield check collection crash associated with those changes. Fixed Kakariko Bazaar "seen" updates. Fixed tracker window not showing on initial load like it should. * Forgot 1 formatting fix. * Removed conditions for showing Song from Impa (isn't junk under certain conditions, so should show all the time). * Fix vanilla checks, add Zelda's Letter and Malon's Egg to manual check collection. Fix autoscroll while in child stealth section. * Fix crash in Happy Mask Shop in OnSlotChange (referenced non-existent shop id in a tracker-specific enum). * General code cleanup. * Missed one reversion. * One more. * Fix column alignment in `randomizer_check_objects`. * Fix file encoding on `randomizer_check_tracker`. Again. * Fix indentation for `actualItemtrackerItemMap`. Also removed unnecessary parts of the map. * Rename `HasEqItem` to `HasEquipment`. * Slightly better indentation for `actualItemTrackerItemMap`. * Add magic bean salesman to vanilla check tracking, and genericized deku shield to trigger KF shop item 3 wherever you get the shield. Renamed `vanillaCheck` to `vanillaHundoCheck` to (supposedly) clarify the meaning of the usage. * One more rename to `vanillaCompletion` to avoid possible confusion with 100% speedrun conditions. * give me a break XD Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * Changes suggested by briaguya (rename `RandomizerCheckShow` to `Status`, unused code, newline formatting) * Remove unused `itemNames` table. * Remove `IsGameRunning` in favor of `GameInteractor::IsSaveLoaded`. * Restore anti-spoiler functionality for dungeons with dungeon maps. * Review cleanup. * Fix prices not showing for Kak bazaar items. --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com>
2023-10-04 11:03:36 -04:00
areaMask <<= 1;
Randomizer Auto Location tracker (#1942) * Initial Auto-Location Tracking * Updates styling for checked items in Check Tracker * Fixes crashing issues with Check Tracker rendering * Auto scroll Check Tracker windows to current area * Checks Tracker only shows checked locations once in game * Fixes issue where Check Tracker would auto-scroll to wrong location when entering a grotto * Fixes gerudo fortress checks showing in tracker when settings have them removed * InfTable Check Location Fixes: Lost Dog Richard, Rolling Gorons, HBA 1000, Thawed Zora * Fixes most Event Chk Inf Checks on Check Tracker, and Frogs * Check Tracker - Song from Malon now works * Check Tracker - Fixes Claim Check check not tracking - Fixes spoiler for Claim Check check when getting Biggoron's Sword - Fixes LACS being spoiled and not tracking * Check Tracker - Fixes #2 for Skull Mask and Mask of Truth checks * Check Tracker - Adds support for merchants - Fixes #7 for Bomchu Salesman - Fixes #12 for Medigoron * Check Tracker - Fixes #8 for Song from Saria * Check Tracker - Fixes #9 for Adult Shooting Gallery * Check Tracker - Fixes #10 for Composer Grave * Check Tracker - Fixes #14 for Song from Ocarina of Time * Check Tracker - Fixes #16 for Shooting the Sun * Check Tracker - Fixes #19 for Darunia's Joy * Save Editor - Adds missing label for Treasure Chest Game * Check Tracker - Fixes Great Faries checks * Check Tracker - Fixes Sheik at Temple * Check Tracker - Fixes Great Fairy auto-scroll to wrong location * Check Tracker - Updates blue warp checks - Fixes Bongo Bongo and Twinrova checks * Check Tracker - Fixes Dampe's Gravedigging Tour * Check Tracker - Fixes Prescription to King Zora * Check Tracker - Fixes Bazaar showing under wrong area on tracker between adult/child * Check Tracker - Fixes scroll for Hyrule Market and Bazaar * Check Tracker - Fixes giving Adult Trade Items shown on tracker: Broken Sword, Saw, Cojiro, Eyeball Froge, and Eyedrops * Cleans up item_location * Check Tracker - Item List - Fixes item list not updating when changing seeds/options - Separates item exclusion list from item check list - Clean up comments * Check Tracker - Adds Skip functionality to buttons * Check Tracker - Refactors adult trade items to RandomizerInf * Check Tracker - Fixes an issue where any time an item is removed the tracker would cause an application crash * Check Tracker - Item names are now dependent on file language * Check Tracker - Fixes Gerudo Card check not showing in Fast setting * Reorders headers to (hopefully) avoid CI build conflicts on linux/consoles * Explicitly defines vector header in randomizer.h to fix compile errors * Complete Refactor of Check Tracker ImGui * Adds missing check tracker files to CMakeLists * Reverts the Item_location whitespace cleanup from ad10807c * Check Tracker - Loading Fixes - Fixes a bug where loading a save file a second time would add all the checks again - Fixes a bug where the check tracker would not render at all until in a save file * Check Tracker - Fixes a bug where checks would sometimes fail to load * Check Tracker - Fixes duplicated checks when using Only on Pause or Only on Combo * Check Tracker - Works around issue where single characters don't show in EnhancementCombobox, and fixes a label for combo buttons held option * Check Tracker - Applies all Check Tracker changes to Item Location * Check Tracker - Updated Check List - Adds Link's pocket, either in KF or HM depending on starting age - Supports Scrubs and Merchants - Uses enums instead of magic numbers - Updates DC Scrub Short Names for MQ * Check Tracker - Adds a performance mode option * Check Tracker - List Fixes (requires new rando generation) - Fixes Frogs Rupees always visible - Fixes Kokiri Sword Chest not showing - Fixes Weird Egg not showing * Check Tracker - MQ List basic support * Check Tracker - MQ/Vanilla anti-spoilers * Check Tracker - Collecting a compass now spoils the area * Check Tracker - Basic Vanilla Support and fixes - Vanilla items show in check tracker, even if many won't auto check - Fixes an issue with Gerudo Fortress Keys - Refactors IsVisibleInCheckTracker to randomizer_check_tracjer * Check Tracker - Fixes merge conflict from 08a487f35e1d760ab9e69b932edbe4da6bcd9edb * Check Tracker - Fixes tracker loading as Floating when default value is set to Windowed * Randomizer Location Exclusion List - Adds Scrubs, Merchants, Shops. Adult Trade items, MQ Dungeons, and Bean Salesman - Fixes Kokiri Sword Chest, Weird Egg, and Frog Song Rupees from misbehaving - Updates Gerudo Fortress logic to be dependent on Open/Fast/Normal Fortress - Removes Invalid Check - Adds RO Enum for MQ settings - Updates magic values to RO enum * Location Exclusion List - Scrubs that are always randomized now always show on the list * For now, removes some extra code only needed for a Check Tracker. * Randomizer Location Exclusion List - Fixes Eyeball Frog from showing up when Adult Trade Items was off * Location Tracker - Updates Eyedrops to use RandomizerInf instead of Chest * Check Tracker - Fixes a bug where Link's Pocket item wasn't acting as checked for area item count * Check Tracker - Fixes a bug where Locations would incorrectly say Vanilla due to the first check in the area being a non-MQ check * Check Tracker - Fixes a crash when Check Tracker is docked but not visible * Check Tracker - Fixes areas being spoiled when loading different save files * Check Tracker - Only reset variables if they are initialized * Check Tracker - Cleans up old comments, unused variables, methods, and macros, adds language TODOs, * Check Tracker - Readds rainbow UI elements after Cosmetics Editor refactor * Check Tracker - Removal of flag lookup that was refactored, no longer needed header, and some trivial whitespace fixes. * Check Tracker - Refactors Index to Bitmask code to a macro * Check Tracker - Changes ordering from alphabetical to RandomizerCheck ordering * Check Tracker - Wraps everything in a namespace to avoid global variable usage * Check Tracker - Explicitly defines for-loop scope * Check Tracker - refactors dungeon lookup from static array to function * Fixes a bug when using EnhancementColor with alpha * Check Tracker - Refactors all colour to use direct conversions * Check Tracker - refactors settings loading and check visibility for readability * Check Tracker - Fixes a bug where the wrong label showed on the Check Tracker BG Color * UIWidgets - Adds Alpha bar to EnhancementColor when using alpha parameter
2022-12-10 22:39:23 -05:00
}
ImGui::EndTable(); //Checks Lead-out
ImGui::EndTable(); //Quick Options Lead-out
EndFloatWindows();
if (doingCollapseOrExpand) {
optCollapseAll = false;
optExpandAll = false;
}
}
// Windowing stuff
2023-01-27 19:16:31 -05:00
void BeginFloatWindows(std::string UniqueName, bool& open, ImGuiWindowFlags flags) {
Randomizer Auto Location tracker (#1942) * Initial Auto-Location Tracking * Updates styling for checked items in Check Tracker * Fixes crashing issues with Check Tracker rendering * Auto scroll Check Tracker windows to current area * Checks Tracker only shows checked locations once in game * Fixes issue where Check Tracker would auto-scroll to wrong location when entering a grotto * Fixes gerudo fortress checks showing in tracker when settings have them removed * InfTable Check Location Fixes: Lost Dog Richard, Rolling Gorons, HBA 1000, Thawed Zora * Fixes most Event Chk Inf Checks on Check Tracker, and Frogs * Check Tracker - Song from Malon now works * Check Tracker - Fixes Claim Check check not tracking - Fixes spoiler for Claim Check check when getting Biggoron's Sword - Fixes LACS being spoiled and not tracking * Check Tracker - Fixes #2 for Skull Mask and Mask of Truth checks * Check Tracker - Adds support for merchants - Fixes #7 for Bomchu Salesman - Fixes #12 for Medigoron * Check Tracker - Fixes #8 for Song from Saria * Check Tracker - Fixes #9 for Adult Shooting Gallery * Check Tracker - Fixes #10 for Composer Grave * Check Tracker - Fixes #14 for Song from Ocarina of Time * Check Tracker - Fixes #16 for Shooting the Sun * Check Tracker - Fixes #19 for Darunia's Joy * Save Editor - Adds missing label for Treasure Chest Game * Check Tracker - Fixes Great Faries checks * Check Tracker - Fixes Sheik at Temple * Check Tracker - Fixes Great Fairy auto-scroll to wrong location * Check Tracker - Updates blue warp checks - Fixes Bongo Bongo and Twinrova checks * Check Tracker - Fixes Dampe's Gravedigging Tour * Check Tracker - Fixes Prescription to King Zora * Check Tracker - Fixes Bazaar showing under wrong area on tracker between adult/child * Check Tracker - Fixes scroll for Hyrule Market and Bazaar * Check Tracker - Fixes giving Adult Trade Items shown on tracker: Broken Sword, Saw, Cojiro, Eyeball Froge, and Eyedrops * Cleans up item_location * Check Tracker - Item List - Fixes item list not updating when changing seeds/options - Separates item exclusion list from item check list - Clean up comments * Check Tracker - Adds Skip functionality to buttons * Check Tracker - Refactors adult trade items to RandomizerInf * Check Tracker - Fixes an issue where any time an item is removed the tracker would cause an application crash * Check Tracker - Item names are now dependent on file language * Check Tracker - Fixes Gerudo Card check not showing in Fast setting * Reorders headers to (hopefully) avoid CI build conflicts on linux/consoles * Explicitly defines vector header in randomizer.h to fix compile errors * Complete Refactor of Check Tracker ImGui * Adds missing check tracker files to CMakeLists * Reverts the Item_location whitespace cleanup from ad10807c * Check Tracker - Loading Fixes - Fixes a bug where loading a save file a second time would add all the checks again - Fixes a bug where the check tracker would not render at all until in a save file * Check Tracker - Fixes a bug where checks would sometimes fail to load * Check Tracker - Fixes duplicated checks when using Only on Pause or Only on Combo * Check Tracker - Works around issue where single characters don't show in EnhancementCombobox, and fixes a label for combo buttons held option * Check Tracker - Applies all Check Tracker changes to Item Location * Check Tracker - Updated Check List - Adds Link's pocket, either in KF or HM depending on starting age - Supports Scrubs and Merchants - Uses enums instead of magic numbers - Updates DC Scrub Short Names for MQ * Check Tracker - Adds a performance mode option * Check Tracker - List Fixes (requires new rando generation) - Fixes Frogs Rupees always visible - Fixes Kokiri Sword Chest not showing - Fixes Weird Egg not showing * Check Tracker - MQ List basic support * Check Tracker - MQ/Vanilla anti-spoilers * Check Tracker - Collecting a compass now spoils the area * Check Tracker - Basic Vanilla Support and fixes - Vanilla items show in check tracker, even if many won't auto check - Fixes an issue with Gerudo Fortress Keys - Refactors IsVisibleInCheckTracker to randomizer_check_tracjer * Check Tracker - Fixes merge conflict from 08a487f35e1d760ab9e69b932edbe4da6bcd9edb * Check Tracker - Fixes tracker loading as Floating when default value is set to Windowed * Randomizer Location Exclusion List - Adds Scrubs, Merchants, Shops. Adult Trade items, MQ Dungeons, and Bean Salesman - Fixes Kokiri Sword Chest, Weird Egg, and Frog Song Rupees from misbehaving - Updates Gerudo Fortress logic to be dependent on Open/Fast/Normal Fortress - Removes Invalid Check - Adds RO Enum for MQ settings - Updates magic values to RO enum * Location Exclusion List - Scrubs that are always randomized now always show on the list * For now, removes some extra code only needed for a Check Tracker. * Randomizer Location Exclusion List - Fixes Eyeball Frog from showing up when Adult Trade Items was off * Location Tracker - Updates Eyedrops to use RandomizerInf instead of Chest * Check Tracker - Fixes a bug where Link's Pocket item wasn't acting as checked for area item count * Check Tracker - Fixes a bug where Locations would incorrectly say Vanilla due to the first check in the area being a non-MQ check * Check Tracker - Fixes a crash when Check Tracker is docked but not visible * Check Tracker - Fixes areas being spoiled when loading different save files * Check Tracker - Only reset variables if they are initialized * Check Tracker - Cleans up old comments, unused variables, methods, and macros, adds language TODOs, * Check Tracker - Readds rainbow UI elements after Cosmetics Editor refactor * Check Tracker - Removal of flag lookup that was refactored, no longer needed header, and some trivial whitespace fixes. * Check Tracker - Refactors Index to Bitmask code to a macro * Check Tracker - Changes ordering from alphabetical to RandomizerCheck ordering * Check Tracker - Wraps everything in a namespace to avoid global variable usage * Check Tracker - Explicitly defines for-loop scope * Check Tracker - refactors dungeon lookup from static array to function * Fixes a bug when using EnhancementColor with alpha * Check Tracker - Refactors all colour to use direct conversions * Check Tracker - refactors settings loading and check visibility for readability * Check Tracker - Fixes a bug where the wrong label showed on the Check Tracker BG Color * UIWidgets - Adds Alpha bar to EnhancementColor when using alpha parameter
2022-12-10 22:39:23 -05:00
ImGuiWindowFlags windowFlags = flags;
if (windowFlags == 0) {
windowFlags |=
ImGuiWindowFlags_AlwaysVerticalScrollbar | ImGuiWindowFlags_NoFocusOnAppearing;
}
if (CVarGetInteger("gCheckTrackerWindowType", TRACKER_WINDOW_WINDOW) == TRACKER_WINDOW_FLOATING) {
Randomizer Auto Location tracker (#1942) * Initial Auto-Location Tracking * Updates styling for checked items in Check Tracker * Fixes crashing issues with Check Tracker rendering * Auto scroll Check Tracker windows to current area * Checks Tracker only shows checked locations once in game * Fixes issue where Check Tracker would auto-scroll to wrong location when entering a grotto * Fixes gerudo fortress checks showing in tracker when settings have them removed * InfTable Check Location Fixes: Lost Dog Richard, Rolling Gorons, HBA 1000, Thawed Zora * Fixes most Event Chk Inf Checks on Check Tracker, and Frogs * Check Tracker - Song from Malon now works * Check Tracker - Fixes Claim Check check not tracking - Fixes spoiler for Claim Check check when getting Biggoron's Sword - Fixes LACS being spoiled and not tracking * Check Tracker - Fixes #2 for Skull Mask and Mask of Truth checks * Check Tracker - Adds support for merchants - Fixes #7 for Bomchu Salesman - Fixes #12 for Medigoron * Check Tracker - Fixes #8 for Song from Saria * Check Tracker - Fixes #9 for Adult Shooting Gallery * Check Tracker - Fixes #10 for Composer Grave * Check Tracker - Fixes #14 for Song from Ocarina of Time * Check Tracker - Fixes #16 for Shooting the Sun * Check Tracker - Fixes #19 for Darunia's Joy * Save Editor - Adds missing label for Treasure Chest Game * Check Tracker - Fixes Great Faries checks * Check Tracker - Fixes Sheik at Temple * Check Tracker - Fixes Great Fairy auto-scroll to wrong location * Check Tracker - Updates blue warp checks - Fixes Bongo Bongo and Twinrova checks * Check Tracker - Fixes Dampe's Gravedigging Tour * Check Tracker - Fixes Prescription to King Zora * Check Tracker - Fixes Bazaar showing under wrong area on tracker between adult/child * Check Tracker - Fixes scroll for Hyrule Market and Bazaar * Check Tracker - Fixes giving Adult Trade Items shown on tracker: Broken Sword, Saw, Cojiro, Eyeball Froge, and Eyedrops * Cleans up item_location * Check Tracker - Item List - Fixes item list not updating when changing seeds/options - Separates item exclusion list from item check list - Clean up comments * Check Tracker - Adds Skip functionality to buttons * Check Tracker - Refactors adult trade items to RandomizerInf * Check Tracker - Fixes an issue where any time an item is removed the tracker would cause an application crash * Check Tracker - Item names are now dependent on file language * Check Tracker - Fixes Gerudo Card check not showing in Fast setting * Reorders headers to (hopefully) avoid CI build conflicts on linux/consoles * Explicitly defines vector header in randomizer.h to fix compile errors * Complete Refactor of Check Tracker ImGui * Adds missing check tracker files to CMakeLists * Reverts the Item_location whitespace cleanup from ad10807c * Check Tracker - Loading Fixes - Fixes a bug where loading a save file a second time would add all the checks again - Fixes a bug where the check tracker would not render at all until in a save file * Check Tracker - Fixes a bug where checks would sometimes fail to load * Check Tracker - Fixes duplicated checks when using Only on Pause or Only on Combo * Check Tracker - Works around issue where single characters don't show in EnhancementCombobox, and fixes a label for combo buttons held option * Check Tracker - Applies all Check Tracker changes to Item Location * Check Tracker - Updated Check List - Adds Link's pocket, either in KF or HM depending on starting age - Supports Scrubs and Merchants - Uses enums instead of magic numbers - Updates DC Scrub Short Names for MQ * Check Tracker - Adds a performance mode option * Check Tracker - List Fixes (requires new rando generation) - Fixes Frogs Rupees always visible - Fixes Kokiri Sword Chest not showing - Fixes Weird Egg not showing * Check Tracker - MQ List basic support * Check Tracker - MQ/Vanilla anti-spoilers * Check Tracker - Collecting a compass now spoils the area * Check Tracker - Basic Vanilla Support and fixes - Vanilla items show in check tracker, even if many won't auto check - Fixes an issue with Gerudo Fortress Keys - Refactors IsVisibleInCheckTracker to randomizer_check_tracjer * Check Tracker - Fixes merge conflict from 08a487f35e1d760ab9e69b932edbe4da6bcd9edb * Check Tracker - Fixes tracker loading as Floating when default value is set to Windowed * Randomizer Location Exclusion List - Adds Scrubs, Merchants, Shops. Adult Trade items, MQ Dungeons, and Bean Salesman - Fixes Kokiri Sword Chest, Weird Egg, and Frog Song Rupees from misbehaving - Updates Gerudo Fortress logic to be dependent on Open/Fast/Normal Fortress - Removes Invalid Check - Adds RO Enum for MQ settings - Updates magic values to RO enum * Location Exclusion List - Scrubs that are always randomized now always show on the list * For now, removes some extra code only needed for a Check Tracker. * Randomizer Location Exclusion List - Fixes Eyeball Frog from showing up when Adult Trade Items was off * Location Tracker - Updates Eyedrops to use RandomizerInf instead of Chest * Check Tracker - Fixes a bug where Link's Pocket item wasn't acting as checked for area item count * Check Tracker - Fixes a bug where Locations would incorrectly say Vanilla due to the first check in the area being a non-MQ check * Check Tracker - Fixes a crash when Check Tracker is docked but not visible * Check Tracker - Fixes areas being spoiled when loading different save files * Check Tracker - Only reset variables if they are initialized * Check Tracker - Cleans up old comments, unused variables, methods, and macros, adds language TODOs, * Check Tracker - Readds rainbow UI elements after Cosmetics Editor refactor * Check Tracker - Removal of flag lookup that was refactored, no longer needed header, and some trivial whitespace fixes. * Check Tracker - Refactors Index to Bitmask code to a macro * Check Tracker - Changes ordering from alphabetical to RandomizerCheck ordering * Check Tracker - Wraps everything in a namespace to avoid global variable usage * Check Tracker - Explicitly defines for-loop scope * Check Tracker - refactors dungeon lookup from static array to function * Fixes a bug when using EnhancementColor with alpha * Check Tracker - Refactors all colour to use direct conversions * Check Tracker - refactors settings loading and check visibility for readability * Check Tracker - Fixes a bug where the wrong label showed on the Check Tracker BG Color * UIWidgets - Adds Alpha bar to EnhancementColor when using alpha parameter
2022-12-10 22:39:23 -05:00
ImGui::SetNextWindowViewport(ImGui::GetMainViewport()->ID);
windowFlags |= ImGuiWindowFlags_NoDocking | ImGuiWindowFlags_NoNav | ImGuiWindowFlags_NoTitleBar |
ImGuiWindowFlags_NoScrollWithMouse | ImGuiWindowFlags_NoScrollbar;
if (!CVarGetInteger("gCheckTrackerHudEditMode", 0)) {
Randomizer Auto Location tracker (#1942) * Initial Auto-Location Tracking * Updates styling for checked items in Check Tracker * Fixes crashing issues with Check Tracker rendering * Auto scroll Check Tracker windows to current area * Checks Tracker only shows checked locations once in game * Fixes issue where Check Tracker would auto-scroll to wrong location when entering a grotto * Fixes gerudo fortress checks showing in tracker when settings have them removed * InfTable Check Location Fixes: Lost Dog Richard, Rolling Gorons, HBA 1000, Thawed Zora * Fixes most Event Chk Inf Checks on Check Tracker, and Frogs * Check Tracker - Song from Malon now works * Check Tracker - Fixes Claim Check check not tracking - Fixes spoiler for Claim Check check when getting Biggoron's Sword - Fixes LACS being spoiled and not tracking * Check Tracker - Fixes #2 for Skull Mask and Mask of Truth checks * Check Tracker - Adds support for merchants - Fixes #7 for Bomchu Salesman - Fixes #12 for Medigoron * Check Tracker - Fixes #8 for Song from Saria * Check Tracker - Fixes #9 for Adult Shooting Gallery * Check Tracker - Fixes #10 for Composer Grave * Check Tracker - Fixes #14 for Song from Ocarina of Time * Check Tracker - Fixes #16 for Shooting the Sun * Check Tracker - Fixes #19 for Darunia's Joy * Save Editor - Adds missing label for Treasure Chest Game * Check Tracker - Fixes Great Faries checks * Check Tracker - Fixes Sheik at Temple * Check Tracker - Fixes Great Fairy auto-scroll to wrong location * Check Tracker - Updates blue warp checks - Fixes Bongo Bongo and Twinrova checks * Check Tracker - Fixes Dampe's Gravedigging Tour * Check Tracker - Fixes Prescription to King Zora * Check Tracker - Fixes Bazaar showing under wrong area on tracker between adult/child * Check Tracker - Fixes scroll for Hyrule Market and Bazaar * Check Tracker - Fixes giving Adult Trade Items shown on tracker: Broken Sword, Saw, Cojiro, Eyeball Froge, and Eyedrops * Cleans up item_location * Check Tracker - Item List - Fixes item list not updating when changing seeds/options - Separates item exclusion list from item check list - Clean up comments * Check Tracker - Adds Skip functionality to buttons * Check Tracker - Refactors adult trade items to RandomizerInf * Check Tracker - Fixes an issue where any time an item is removed the tracker would cause an application crash * Check Tracker - Item names are now dependent on file language * Check Tracker - Fixes Gerudo Card check not showing in Fast setting * Reorders headers to (hopefully) avoid CI build conflicts on linux/consoles * Explicitly defines vector header in randomizer.h to fix compile errors * Complete Refactor of Check Tracker ImGui * Adds missing check tracker files to CMakeLists * Reverts the Item_location whitespace cleanup from ad10807c * Check Tracker - Loading Fixes - Fixes a bug where loading a save file a second time would add all the checks again - Fixes a bug where the check tracker would not render at all until in a save file * Check Tracker - Fixes a bug where checks would sometimes fail to load * Check Tracker - Fixes duplicated checks when using Only on Pause or Only on Combo * Check Tracker - Works around issue where single characters don't show in EnhancementCombobox, and fixes a label for combo buttons held option * Check Tracker - Applies all Check Tracker changes to Item Location * Check Tracker - Updated Check List - Adds Link's pocket, either in KF or HM depending on starting age - Supports Scrubs and Merchants - Uses enums instead of magic numbers - Updates DC Scrub Short Names for MQ * Check Tracker - Adds a performance mode option * Check Tracker - List Fixes (requires new rando generation) - Fixes Frogs Rupees always visible - Fixes Kokiri Sword Chest not showing - Fixes Weird Egg not showing * Check Tracker - MQ List basic support * Check Tracker - MQ/Vanilla anti-spoilers * Check Tracker - Collecting a compass now spoils the area * Check Tracker - Basic Vanilla Support and fixes - Vanilla items show in check tracker, even if many won't auto check - Fixes an issue with Gerudo Fortress Keys - Refactors IsVisibleInCheckTracker to randomizer_check_tracjer * Check Tracker - Fixes merge conflict from 08a487f35e1d760ab9e69b932edbe4da6bcd9edb * Check Tracker - Fixes tracker loading as Floating when default value is set to Windowed * Randomizer Location Exclusion List - Adds Scrubs, Merchants, Shops. Adult Trade items, MQ Dungeons, and Bean Salesman - Fixes Kokiri Sword Chest, Weird Egg, and Frog Song Rupees from misbehaving - Updates Gerudo Fortress logic to be dependent on Open/Fast/Normal Fortress - Removes Invalid Check - Adds RO Enum for MQ settings - Updates magic values to RO enum * Location Exclusion List - Scrubs that are always randomized now always show on the list * For now, removes some extra code only needed for a Check Tracker. * Randomizer Location Exclusion List - Fixes Eyeball Frog from showing up when Adult Trade Items was off * Location Tracker - Updates Eyedrops to use RandomizerInf instead of Chest * Check Tracker - Fixes a bug where Link's Pocket item wasn't acting as checked for area item count * Check Tracker - Fixes a bug where Locations would incorrectly say Vanilla due to the first check in the area being a non-MQ check * Check Tracker - Fixes a crash when Check Tracker is docked but not visible * Check Tracker - Fixes areas being spoiled when loading different save files * Check Tracker - Only reset variables if they are initialized * Check Tracker - Cleans up old comments, unused variables, methods, and macros, adds language TODOs, * Check Tracker - Readds rainbow UI elements after Cosmetics Editor refactor * Check Tracker - Removal of flag lookup that was refactored, no longer needed header, and some trivial whitespace fixes. * Check Tracker - Refactors Index to Bitmask code to a macro * Check Tracker - Changes ordering from alphabetical to RandomizerCheck ordering * Check Tracker - Wraps everything in a namespace to avoid global variable usage * Check Tracker - Explicitly defines for-loop scope * Check Tracker - refactors dungeon lookup from static array to function * Fixes a bug when using EnhancementColor with alpha * Check Tracker - Refactors all colour to use direct conversions * Check Tracker - refactors settings loading and check visibility for readability * Check Tracker - Fixes a bug where the wrong label showed on the Check Tracker BG Color * UIWidgets - Adds Alpha bar to EnhancementColor when using alpha parameter
2022-12-10 22:39:23 -05:00
windowFlags |= ImGuiWindowFlags_NoInputs | ImGuiWindowFlags_NoMove;
}
}
ImGui::PushStyleColor(ImGuiCol_WindowBg, ImVec4(Color_Background.r / 255.0f, Color_Background.g / 255.0f,
Color_Background.b / 255.0f, Color_Background.a / 255.0f));
ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(0, 0, 0, 0));
ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 4.0f);
2023-01-27 19:16:31 -05:00
ImGui::Begin(UniqueName.c_str(), &open, windowFlags);
Randomizer Auto Location tracker (#1942) * Initial Auto-Location Tracking * Updates styling for checked items in Check Tracker * Fixes crashing issues with Check Tracker rendering * Auto scroll Check Tracker windows to current area * Checks Tracker only shows checked locations once in game * Fixes issue where Check Tracker would auto-scroll to wrong location when entering a grotto * Fixes gerudo fortress checks showing in tracker when settings have them removed * InfTable Check Location Fixes: Lost Dog Richard, Rolling Gorons, HBA 1000, Thawed Zora * Fixes most Event Chk Inf Checks on Check Tracker, and Frogs * Check Tracker - Song from Malon now works * Check Tracker - Fixes Claim Check check not tracking - Fixes spoiler for Claim Check check when getting Biggoron's Sword - Fixes LACS being spoiled and not tracking * Check Tracker - Fixes #2 for Skull Mask and Mask of Truth checks * Check Tracker - Adds support for merchants - Fixes #7 for Bomchu Salesman - Fixes #12 for Medigoron * Check Tracker - Fixes #8 for Song from Saria * Check Tracker - Fixes #9 for Adult Shooting Gallery * Check Tracker - Fixes #10 for Composer Grave * Check Tracker - Fixes #14 for Song from Ocarina of Time * Check Tracker - Fixes #16 for Shooting the Sun * Check Tracker - Fixes #19 for Darunia's Joy * Save Editor - Adds missing label for Treasure Chest Game * Check Tracker - Fixes Great Faries checks * Check Tracker - Fixes Sheik at Temple * Check Tracker - Fixes Great Fairy auto-scroll to wrong location * Check Tracker - Updates blue warp checks - Fixes Bongo Bongo and Twinrova checks * Check Tracker - Fixes Dampe's Gravedigging Tour * Check Tracker - Fixes Prescription to King Zora * Check Tracker - Fixes Bazaar showing under wrong area on tracker between adult/child * Check Tracker - Fixes scroll for Hyrule Market and Bazaar * Check Tracker - Fixes giving Adult Trade Items shown on tracker: Broken Sword, Saw, Cojiro, Eyeball Froge, and Eyedrops * Cleans up item_location * Check Tracker - Item List - Fixes item list not updating when changing seeds/options - Separates item exclusion list from item check list - Clean up comments * Check Tracker - Adds Skip functionality to buttons * Check Tracker - Refactors adult trade items to RandomizerInf * Check Tracker - Fixes an issue where any time an item is removed the tracker would cause an application crash * Check Tracker - Item names are now dependent on file language * Check Tracker - Fixes Gerudo Card check not showing in Fast setting * Reorders headers to (hopefully) avoid CI build conflicts on linux/consoles * Explicitly defines vector header in randomizer.h to fix compile errors * Complete Refactor of Check Tracker ImGui * Adds missing check tracker files to CMakeLists * Reverts the Item_location whitespace cleanup from ad10807c * Check Tracker - Loading Fixes - Fixes a bug where loading a save file a second time would add all the checks again - Fixes a bug where the check tracker would not render at all until in a save file * Check Tracker - Fixes a bug where checks would sometimes fail to load * Check Tracker - Fixes duplicated checks when using Only on Pause or Only on Combo * Check Tracker - Works around issue where single characters don't show in EnhancementCombobox, and fixes a label for combo buttons held option * Check Tracker - Applies all Check Tracker changes to Item Location * Check Tracker - Updated Check List - Adds Link's pocket, either in KF or HM depending on starting age - Supports Scrubs and Merchants - Uses enums instead of magic numbers - Updates DC Scrub Short Names for MQ * Check Tracker - Adds a performance mode option * Check Tracker - List Fixes (requires new rando generation) - Fixes Frogs Rupees always visible - Fixes Kokiri Sword Chest not showing - Fixes Weird Egg not showing * Check Tracker - MQ List basic support * Check Tracker - MQ/Vanilla anti-spoilers * Check Tracker - Collecting a compass now spoils the area * Check Tracker - Basic Vanilla Support and fixes - Vanilla items show in check tracker, even if many won't auto check - Fixes an issue with Gerudo Fortress Keys - Refactors IsVisibleInCheckTracker to randomizer_check_tracjer * Check Tracker - Fixes merge conflict from 08a487f35e1d760ab9e69b932edbe4da6bcd9edb * Check Tracker - Fixes tracker loading as Floating when default value is set to Windowed * Randomizer Location Exclusion List - Adds Scrubs, Merchants, Shops. Adult Trade items, MQ Dungeons, and Bean Salesman - Fixes Kokiri Sword Chest, Weird Egg, and Frog Song Rupees from misbehaving - Updates Gerudo Fortress logic to be dependent on Open/Fast/Normal Fortress - Removes Invalid Check - Adds RO Enum for MQ settings - Updates magic values to RO enum * Location Exclusion List - Scrubs that are always randomized now always show on the list * For now, removes some extra code only needed for a Check Tracker. * Randomizer Location Exclusion List - Fixes Eyeball Frog from showing up when Adult Trade Items was off * Location Tracker - Updates Eyedrops to use RandomizerInf instead of Chest * Check Tracker - Fixes a bug where Link's Pocket item wasn't acting as checked for area item count * Check Tracker - Fixes a bug where Locations would incorrectly say Vanilla due to the first check in the area being a non-MQ check * Check Tracker - Fixes a crash when Check Tracker is docked but not visible * Check Tracker - Fixes areas being spoiled when loading different save files * Check Tracker - Only reset variables if they are initialized * Check Tracker - Cleans up old comments, unused variables, methods, and macros, adds language TODOs, * Check Tracker - Readds rainbow UI elements after Cosmetics Editor refactor * Check Tracker - Removal of flag lookup that was refactored, no longer needed header, and some trivial whitespace fixes. * Check Tracker - Refactors Index to Bitmask code to a macro * Check Tracker - Changes ordering from alphabetical to RandomizerCheck ordering * Check Tracker - Wraps everything in a namespace to avoid global variable usage * Check Tracker - Explicitly defines for-loop scope * Check Tracker - refactors dungeon lookup from static array to function * Fixes a bug when using EnhancementColor with alpha * Check Tracker - Refactors all colour to use direct conversions * Check Tracker - refactors settings loading and check visibility for readability * Check Tracker - Fixes a bug where the wrong label showed on the Check Tracker BG Color * UIWidgets - Adds Alpha bar to EnhancementColor when using alpha parameter
2022-12-10 22:39:23 -05:00
}
void EndFloatWindows() {
ImGui::PopStyleVar();
ImGui::PopStyleColor();
ImGui::PopStyleColor();
ImGui::End();
}
void LoadSettings() {
Check Tracker Update (#2668) * Initial commit. What works so far: Data file loads, saves, deletes, and is created properly. - Need to run `HasItemBeenCollected` when creating in case of mid-seed regen. Organized checks into maps set by area. Areas show in tracker. - Checks pulled from checkObjectsByArea are not currently listed. - Areas are being assumed completed and hidden at the start. * Checks now populate. Still not counting area totals properly. * Don't track RC_LINKS_POCKET in the data file, and instead manually add it in every time a save is load. rcObjects doesn't contain Link's Pocket location (duh). * Moved ItemReceive hook to randomizer_check_tracker.cpp. Skipped items are properly sorted and formatted. Saved items contribute to an area's gotten/skipped checks on load. Changed skipped items default main color to gray. General code cleanup. * Skipped checks now contribute to area totals for area completion logic. * Mid-menu rework transfer. * Started check lookup on item receive. Tried to enable scum checking on save. * Fixed scum check on save. * More code cleanup, which revealed some issues with loading and saving. Loading now works 100%, but entries in checkTrackerData are disappearing in code somewhere, causing issues with later checks. Scummed color now displays properly. Collected but unsaved displays properly. Unchecked, Skipped, Seen and Scummed checks all have arrows for skipping/unskipping. Counts a little messed up, probably double adding skips. * Fixed item counts being off across resets. Restarts were fine. * Beginning of rework for individual check updates. Adds `Actor lastCheck` to PlayState to allow assigning of last actor to give an item. This allows precise tracking of GS, freestanding PoH, etc. Works for chests too. Currently does not work for shops, unknown for normal NPC gives. Doesn't track last gives for non-checks, like drops from grass, pots, crates, etc. * Actor-based checks fully fleshed out, but can't help with sale-based checks. Implemented `pendingSaleCheck` to back out of an RC check cycle if `gSaveContext->pendingSale` is not NONE when `OnItemReceive` is called, processed through `OnSaleEnd`. This should be the final change necessary to streamline the checks. * Temporary hook to message box close to tie in trackers for non-gs/chest actors that aren't added to `GetCheckFromActor`. This triggers a 2-frame countdown to check with `HasItemBeenCollected` since half of the methods in there aren't updated until after a text box closes. Added scene tracking to get last scene so that checks in scenes that span several overworld areas could be tied to their areas properly. Modified tracker data creation to apply Link's Pocket and Song from Impa conditionally based on randomizer settings instead of just being assumed to be done. May need modification for checking click and drag spoiler loading. Removed the scene equivalence check from CheckChecks so that an entire area is checked each time to avoid issues with, e.g., leaving a shop before a pending sale finishes. * Changed check data creation to use RSKs from gRandomizer to account for settings loaded from drag and drop spoilers. * Beginning of tracker code organization. Changed check color defaults. * Reverted moving tracker colors to header. Some individual check fixes. * Missed something from previous merge? * Removed last remnant of removed performance mode. * Better handle checking when skullsanity is off. * Song checks sceneIDs don't match the scenes they're actually in for some reason. Removed that check. * SaleEnd checks don't need the GetItemEntry parameter. Also set a flag that should prevent the check tracker from running during vanilla saves should that not be resolved by the time it's merged. * Attempting to have only the relevant checks added to the tracker data, as well as showing vanilla checks for non-rando saves. Not working yet (everything is displayed in vanilla). * Added vanilla check tracker population via `vanillaCheck` bool in `RandomizerCheckObject`. This is also added to `IsVisibleInImGui` to handle file loading and saving to eliminate checks that aren't part of vanilla or the rando seed. Implemented deleted tracker data file recreation. Added some extra item name text checks. Songs are still... tricky, so they stay blank. Utilize local copies of the randomizer check objects that are applicable for performance purposes. Fixed vanilla item-giving cutscene crashes when triggered mid-transition. * Apparently not all toolchains can handle macro instantiation without all parameters, like VS can. * Fixed scummed detail color not showing properly on tracker. * Fixed dungeon area totals and GS checks not functioning properly. * Major revamp of checking code. Doesn't rely on `GetCheckFromActor` at all anymore, but instead simply sets a flag to evaluate a number of checks in an area every frame until the check that was gotten is identified. With the new setup, it's much less hardware intensive, and at 60fps 6 checks per frame shows no noticeable effect on framerate. I can envision needing to add a collectedCount in order to account for times when two checks are gotten one right after the other. Changed area scroll to happen from `OnTransitionEnd`, and allow for scrolling in bazaar (was disabled previously because it would jump back and forth between Kak and Market while you were in one). Also setup area check order updating by area instead of all at the same time. * Fixed shooting gallery not reporting proper area. Prevent checks from actually happening if area is RCAREA_INVALID, now that all areas are reporting something if they have checks. Fixed `GetCheckArea()` not updating checks for standard scenes. Lots of vanilla tracking updates, mainly manual checks for gems, medallions and songs, since the often don't have proper scenes in the data. Prevent vanilla from triggering check loops if junk items are collected. Fixed sorting based on saved vs collected. Prevent item name display for vanilla runs. Change coloring of checks so the check name reflects status in vanilla runs. * Fixed "Recheck Area" button erroneously adding to an area's check totals? * Fix DMC vanilla checks. * Fix check tracker data recreation on data file loss. Removed redundant file exists check from SaveTrackerDataHook, as it doesn't matter if it exists or not at that point. Limited check loops to 3 to avoid infinite check loops on non-check/junk item pickup. Added more checks to disable tracker operations if a save is not running. Changed check ordering to put boss reward and heart container checks at the end of whatever RCSHOW group they belong to. * Fixed IsRunning calculation. Further improving vanilla checking. Starting framework for checking medallions, stones, and songs on data file recreation. Fixed medallion check collection. Added GIFT_FROM_SAGES to check list for vanilla file for tracking light medallion. Added check loop limitation to prevent infinite checking after picking up junk item from the ground. * Finished vanilla file recreation and recheck (songs and dungeon rewards all check properly now). This includes deku shield with KF shop item 3. Finished Gift from Raoru light medallion tracking for vanilla. Commented all CheckByScene functionality for now. * Fixed new save data file creation. Disabled entrance area calculation for now, as it only tracks the previous entrance for some reason. Fixed area detection for ToT checks. * GetCheckArea() now utilizes EntranceData almost exclusively, via either `gSaveContext.entranceIndex` or the entrance tracker's `currentGrottoId` in the case of grottos. This also means that EVERYTHING CAN AUTOSCROLL NOW. Entrance shuffles are now much easier to track. Autoscroll is now also triggered on save, just in case someone isn't autosaving and has a lot of checks that get converted to saved. * Fixed missing GS check in LW. * Added area scroll on toggling Show Hidden Items. May configure differently later. Fixed area detection for entrances in Gerudo Fortress/Valley and Collossus. Haunted wasteland doesn't autoscroll due to a bug in `OnTransitionEnd` hook, but checks still evaluate properly there. Rely on scene-based area detection if scene is a main overworld or dungeon scene. * Fixed grotto detection when shuffle is off. * Small code cleanup. Fixed Colossus hand chest checks. * Missing lus bump from merge conflict resolution * Fixed Colossus Grotto making `GetCheckArea` return Wasteland. * Improved OnItemReceive processing for non-token GS checks, since they can sometimes take long enough for the checking process to time out before the item is registered as received. * First attempt at thread safety for tracker data file writing. Seems to work, but might need more testing. * Fixed Recheck Area not unskipping items that register as saved. Improved delayed saving with autosaving, as the autosave triggered quite often before the tracker data save, making things not properly register as saved. * merge cleanup * Converted check tracker data to the sectional saves, adding `CheckTrackerData` to `SaveContext`. Implemented section ID returning and fullSave boolean passing to section functions from my PR temporarily for it to work properly. Moved `RandomizerCheckTrackerData` enum to `randomizerTypes.h` to accommodate that. Changed `Randomizer_SaveInit` to a `SaveManager::InitFunc` to allow for other randomizer-dependent sections to be initialized after that. Required a little refactoring to maintain intro cutscene skip when starting a randomizer file. * Revert section index return and randomizer init changes. Will need to wait on yet more changes to main. * Fixed check tracker initialization (shouldn't be tied to window initialization), restored saving/loading functionality. * Removed `CheckTracker::Init` and put SaveManager calls in `CheckTrackerWindow::InitElement`. Also a bit of cleanup from transition back to save file use. * Fixed tracker displaying check categories while file not loaded. * Fix Darunia's Joy check not marking in vanilla. * Fix autosave not triggering change from collected to saved in tracker data. * Changed default colors for scummed and collected display. * Merge upgrade code cleanup. * Add `OnTransitionEnd` calls to sandstorm transitions both to and from Wasteland. Also improved `gSaveContext.lastScene` assignment for both transition types. Allowed a bit of cleanup in `GetCheckArea`. * Added `StateButton`, a button like `ArrowButton` but that allows text instead of arrow icons. Apparently the changes from ArrowButton to StateButton happened in a previous commit... * Changed section name to `trackerDataCheck` to force SoH to load it after the randomizer section, as it required some randoSettings to be loaded first, and nothing else I tried to make the randomizer section load before it worked. This hacks a solution to checks not displaying on fast file load to a specific slot. F*** you, SaveManager, and f*** you too, JSON. * Forgot to change the section string for loading with the name change. * Fix check ordering for checks that trigger the autosave. * Adds option to remove right-side shop items (slots 1-4) from the tracker list. Enabled by default. * Fix default state of Hide Shop Right Checks checkbox. * Fixes grotto and great fairy scrolling and checks. Fixes array overflow from `checkTrackerData` which was creating the issue trying to load the base and randomizer sections first, among other things. That also fixed the massive file loads that were being exhibited in debug mode. * Fix shooting galleries being set as collected again when being played a second time after getting the checks. * Fix Bazaar autoscroll. * Add Saria's Song to `GetCheckFromActor` and removed some limitations from the messageCloseCheck function to make that check track properly. * Fix Song from Impa check. Implemented prevention for multiple "collections" of great fairies, just in case getting the health refill would trigger it with the previous setup. * Fix ice traps on GS tokens not triggering OnItemReceive. * Complete fix for ice trap collection from GS. Add autoscroll when clicking "Expand All". * Add `OnShopSlotChange` with cursorSlot and basePrice parameters. * Fixed include in en_ossan for shop slot hook. Added registration for `OnShopSlotChange` in the tracker, storing the price in a new `price` field in `CheckTrackerData`. Added "seen" functionality to shop checks. Displays the model item name upon first entering a shop, adding the price and switching to trickName (if it's an ice trap) upon navigating to the slot in buy mode, triggered by an invisible "identified" status that mirrors "seen" in every other way. Added tooltips to most options for check tracker color picking to describe what each status actually means. * `std::format` pls * So apparently std::format just decided to break with the latest merge from develop, but fmt::format exists and works? * Removed the last vestiges of `locationsSkipped`. Other general code and formatting cleanups. Moved `IsGameRunning` to `OTRGlobals` so the item tracker could also access it. Used preceding to "fix" item and bottle display in the item tracker on startup. * Some more code cleanup. Removed "Recheck Area" button and relevant code. Backported changes to Anchor branch applicable for single-player, including making a checkAreas vector and structuring the frame by frame checks around that. Also includes fix for Silver Gauntlets and Mirror Shield check collection crash associated with those changes. Fixed Kakariko Bazaar "seen" updates. Fixed tracker window not showing on initial load like it should. * Forgot 1 formatting fix. * Removed conditions for showing Song from Impa (isn't junk under certain conditions, so should show all the time). * Fix vanilla checks, add Zelda's Letter and Malon's Egg to manual check collection. Fix autoscroll while in child stealth section. * Fix crash in Happy Mask Shop in OnSlotChange (referenced non-existent shop id in a tracker-specific enum). * General code cleanup. * Missed one reversion. * One more. * Fix column alignment in `randomizer_check_objects`. * Fix file encoding on `randomizer_check_tracker`. Again. * Fix indentation for `actualItemtrackerItemMap`. Also removed unnecessary parts of the map. * Rename `HasEqItem` to `HasEquipment`. * Slightly better indentation for `actualItemTrackerItemMap`. * Add magic bean salesman to vanilla check tracking, and genericized deku shield to trigger KF shop item 3 wherever you get the shield. Renamed `vanillaCheck` to `vanillaHundoCheck` to (supposedly) clarify the meaning of the usage. * One more rename to `vanillaCompletion` to avoid possible confusion with 100% speedrun conditions. * give me a break XD Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * Changes suggested by briaguya (rename `RandomizerCheckShow` to `Status`, unused code, newline formatting) * Remove unused `itemNames` table. * Remove `IsGameRunning` in favor of `GameInteractor::IsSaveLoaded`. * Restore anti-spoiler functionality for dungeons with dungeon maps. * Review cleanup. * Fix prices not showing for Kak bazaar items. --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com>
2023-10-04 11:03:36 -04:00
//If in randomzer (n64ddFlag), then get the setting and check if in general we should be showing the settings
Randomizer Auto Location tracker (#1942) * Initial Auto-Location Tracking * Updates styling for checked items in Check Tracker * Fixes crashing issues with Check Tracker rendering * Auto scroll Check Tracker windows to current area * Checks Tracker only shows checked locations once in game * Fixes issue where Check Tracker would auto-scroll to wrong location when entering a grotto * Fixes gerudo fortress checks showing in tracker when settings have them removed * InfTable Check Location Fixes: Lost Dog Richard, Rolling Gorons, HBA 1000, Thawed Zora * Fixes most Event Chk Inf Checks on Check Tracker, and Frogs * Check Tracker - Song from Malon now works * Check Tracker - Fixes Claim Check check not tracking - Fixes spoiler for Claim Check check when getting Biggoron's Sword - Fixes LACS being spoiled and not tracking * Check Tracker - Fixes #2 for Skull Mask and Mask of Truth checks * Check Tracker - Adds support for merchants - Fixes #7 for Bomchu Salesman - Fixes #12 for Medigoron * Check Tracker - Fixes #8 for Song from Saria * Check Tracker - Fixes #9 for Adult Shooting Gallery * Check Tracker - Fixes #10 for Composer Grave * Check Tracker - Fixes #14 for Song from Ocarina of Time * Check Tracker - Fixes #16 for Shooting the Sun * Check Tracker - Fixes #19 for Darunia's Joy * Save Editor - Adds missing label for Treasure Chest Game * Check Tracker - Fixes Great Faries checks * Check Tracker - Fixes Sheik at Temple * Check Tracker - Fixes Great Fairy auto-scroll to wrong location * Check Tracker - Updates blue warp checks - Fixes Bongo Bongo and Twinrova checks * Check Tracker - Fixes Dampe's Gravedigging Tour * Check Tracker - Fixes Prescription to King Zora * Check Tracker - Fixes Bazaar showing under wrong area on tracker between adult/child * Check Tracker - Fixes scroll for Hyrule Market and Bazaar * Check Tracker - Fixes giving Adult Trade Items shown on tracker: Broken Sword, Saw, Cojiro, Eyeball Froge, and Eyedrops * Cleans up item_location * Check Tracker - Item List - Fixes item list not updating when changing seeds/options - Separates item exclusion list from item check list - Clean up comments * Check Tracker - Adds Skip functionality to buttons * Check Tracker - Refactors adult trade items to RandomizerInf * Check Tracker - Fixes an issue where any time an item is removed the tracker would cause an application crash * Check Tracker - Item names are now dependent on file language * Check Tracker - Fixes Gerudo Card check not showing in Fast setting * Reorders headers to (hopefully) avoid CI build conflicts on linux/consoles * Explicitly defines vector header in randomizer.h to fix compile errors * Complete Refactor of Check Tracker ImGui * Adds missing check tracker files to CMakeLists * Reverts the Item_location whitespace cleanup from ad10807c * Check Tracker - Loading Fixes - Fixes a bug where loading a save file a second time would add all the checks again - Fixes a bug where the check tracker would not render at all until in a save file * Check Tracker - Fixes a bug where checks would sometimes fail to load * Check Tracker - Fixes duplicated checks when using Only on Pause or Only on Combo * Check Tracker - Works around issue where single characters don't show in EnhancementCombobox, and fixes a label for combo buttons held option * Check Tracker - Applies all Check Tracker changes to Item Location * Check Tracker - Updated Check List - Adds Link's pocket, either in KF or HM depending on starting age - Supports Scrubs and Merchants - Uses enums instead of magic numbers - Updates DC Scrub Short Names for MQ * Check Tracker - Adds a performance mode option * Check Tracker - List Fixes (requires new rando generation) - Fixes Frogs Rupees always visible - Fixes Kokiri Sword Chest not showing - Fixes Weird Egg not showing * Check Tracker - MQ List basic support * Check Tracker - MQ/Vanilla anti-spoilers * Check Tracker - Collecting a compass now spoils the area * Check Tracker - Basic Vanilla Support and fixes - Vanilla items show in check tracker, even if many won't auto check - Fixes an issue with Gerudo Fortress Keys - Refactors IsVisibleInCheckTracker to randomizer_check_tracjer * Check Tracker - Fixes merge conflict from 08a487f35e1d760ab9e69b932edbe4da6bcd9edb * Check Tracker - Fixes tracker loading as Floating when default value is set to Windowed * Randomizer Location Exclusion List - Adds Scrubs, Merchants, Shops. Adult Trade items, MQ Dungeons, and Bean Salesman - Fixes Kokiri Sword Chest, Weird Egg, and Frog Song Rupees from misbehaving - Updates Gerudo Fortress logic to be dependent on Open/Fast/Normal Fortress - Removes Invalid Check - Adds RO Enum for MQ settings - Updates magic values to RO enum * Location Exclusion List - Scrubs that are always randomized now always show on the list * For now, removes some extra code only needed for a Check Tracker. * Randomizer Location Exclusion List - Fixes Eyeball Frog from showing up when Adult Trade Items was off * Location Tracker - Updates Eyedrops to use RandomizerInf instead of Chest * Check Tracker - Fixes a bug where Link's Pocket item wasn't acting as checked for area item count * Check Tracker - Fixes a bug where Locations would incorrectly say Vanilla due to the first check in the area being a non-MQ check * Check Tracker - Fixes a crash when Check Tracker is docked but not visible * Check Tracker - Fixes areas being spoiled when loading different save files * Check Tracker - Only reset variables if they are initialized * Check Tracker - Cleans up old comments, unused variables, methods, and macros, adds language TODOs, * Check Tracker - Readds rainbow UI elements after Cosmetics Editor refactor * Check Tracker - Removal of flag lookup that was refactored, no longer needed header, and some trivial whitespace fixes. * Check Tracker - Refactors Index to Bitmask code to a macro * Check Tracker - Changes ordering from alphabetical to RandomizerCheck ordering * Check Tracker - Wraps everything in a namespace to avoid global variable usage * Check Tracker - Explicitly defines for-loop scope * Check Tracker - refactors dungeon lookup from static array to function * Fixes a bug when using EnhancementColor with alpha * Check Tracker - Refactors all colour to use direct conversions * Check Tracker - refactors settings loading and check visibility for readability * Check Tracker - Fixes a bug where the wrong label showed on the Check Tracker BG Color * UIWidgets - Adds Alpha bar to EnhancementColor when using alpha parameter
2022-12-10 22:39:23 -05:00
//If in vanilla, _try_ to show items that at least are needed for 100%
showShops = IS_RANDO ? (
Randomizer Auto Location tracker (#1942) * Initial Auto-Location Tracking * Updates styling for checked items in Check Tracker * Fixes crashing issues with Check Tracker rendering * Auto scroll Check Tracker windows to current area * Checks Tracker only shows checked locations once in game * Fixes issue where Check Tracker would auto-scroll to wrong location when entering a grotto * Fixes gerudo fortress checks showing in tracker when settings have them removed * InfTable Check Location Fixes: Lost Dog Richard, Rolling Gorons, HBA 1000, Thawed Zora * Fixes most Event Chk Inf Checks on Check Tracker, and Frogs * Check Tracker - Song from Malon now works * Check Tracker - Fixes Claim Check check not tracking - Fixes spoiler for Claim Check check when getting Biggoron's Sword - Fixes LACS being spoiled and not tracking * Check Tracker - Fixes #2 for Skull Mask and Mask of Truth checks * Check Tracker - Adds support for merchants - Fixes #7 for Bomchu Salesman - Fixes #12 for Medigoron * Check Tracker - Fixes #8 for Song from Saria * Check Tracker - Fixes #9 for Adult Shooting Gallery * Check Tracker - Fixes #10 for Composer Grave * Check Tracker - Fixes #14 for Song from Ocarina of Time * Check Tracker - Fixes #16 for Shooting the Sun * Check Tracker - Fixes #19 for Darunia's Joy * Save Editor - Adds missing label for Treasure Chest Game * Check Tracker - Fixes Great Faries checks * Check Tracker - Fixes Sheik at Temple * Check Tracker - Fixes Great Fairy auto-scroll to wrong location * Check Tracker - Updates blue warp checks - Fixes Bongo Bongo and Twinrova checks * Check Tracker - Fixes Dampe's Gravedigging Tour * Check Tracker - Fixes Prescription to King Zora * Check Tracker - Fixes Bazaar showing under wrong area on tracker between adult/child * Check Tracker - Fixes scroll for Hyrule Market and Bazaar * Check Tracker - Fixes giving Adult Trade Items shown on tracker: Broken Sword, Saw, Cojiro, Eyeball Froge, and Eyedrops * Cleans up item_location * Check Tracker - Item List - Fixes item list not updating when changing seeds/options - Separates item exclusion list from item check list - Clean up comments * Check Tracker - Adds Skip functionality to buttons * Check Tracker - Refactors adult trade items to RandomizerInf * Check Tracker - Fixes an issue where any time an item is removed the tracker would cause an application crash * Check Tracker - Item names are now dependent on file language * Check Tracker - Fixes Gerudo Card check not showing in Fast setting * Reorders headers to (hopefully) avoid CI build conflicts on linux/consoles * Explicitly defines vector header in randomizer.h to fix compile errors * Complete Refactor of Check Tracker ImGui * Adds missing check tracker files to CMakeLists * Reverts the Item_location whitespace cleanup from ad10807c * Check Tracker - Loading Fixes - Fixes a bug where loading a save file a second time would add all the checks again - Fixes a bug where the check tracker would not render at all until in a save file * Check Tracker - Fixes a bug where checks would sometimes fail to load * Check Tracker - Fixes duplicated checks when using Only on Pause or Only on Combo * Check Tracker - Works around issue where single characters don't show in EnhancementCombobox, and fixes a label for combo buttons held option * Check Tracker - Applies all Check Tracker changes to Item Location * Check Tracker - Updated Check List - Adds Link's pocket, either in KF or HM depending on starting age - Supports Scrubs and Merchants - Uses enums instead of magic numbers - Updates DC Scrub Short Names for MQ * Check Tracker - Adds a performance mode option * Check Tracker - List Fixes (requires new rando generation) - Fixes Frogs Rupees always visible - Fixes Kokiri Sword Chest not showing - Fixes Weird Egg not showing * Check Tracker - MQ List basic support * Check Tracker - MQ/Vanilla anti-spoilers * Check Tracker - Collecting a compass now spoils the area * Check Tracker - Basic Vanilla Support and fixes - Vanilla items show in check tracker, even if many won't auto check - Fixes an issue with Gerudo Fortress Keys - Refactors IsVisibleInCheckTracker to randomizer_check_tracjer * Check Tracker - Fixes merge conflict from 08a487f35e1d760ab9e69b932edbe4da6bcd9edb * Check Tracker - Fixes tracker loading as Floating when default value is set to Windowed * Randomizer Location Exclusion List - Adds Scrubs, Merchants, Shops. Adult Trade items, MQ Dungeons, and Bean Salesman - Fixes Kokiri Sword Chest, Weird Egg, and Frog Song Rupees from misbehaving - Updates Gerudo Fortress logic to be dependent on Open/Fast/Normal Fortress - Removes Invalid Check - Adds RO Enum for MQ settings - Updates magic values to RO enum * Location Exclusion List - Scrubs that are always randomized now always show on the list * For now, removes some extra code only needed for a Check Tracker. * Randomizer Location Exclusion List - Fixes Eyeball Frog from showing up when Adult Trade Items was off * Location Tracker - Updates Eyedrops to use RandomizerInf instead of Chest * Check Tracker - Fixes a bug where Link's Pocket item wasn't acting as checked for area item count * Check Tracker - Fixes a bug where Locations would incorrectly say Vanilla due to the first check in the area being a non-MQ check * Check Tracker - Fixes a crash when Check Tracker is docked but not visible * Check Tracker - Fixes areas being spoiled when loading different save files * Check Tracker - Only reset variables if they are initialized * Check Tracker - Cleans up old comments, unused variables, methods, and macros, adds language TODOs, * Check Tracker - Readds rainbow UI elements after Cosmetics Editor refactor * Check Tracker - Removal of flag lookup that was refactored, no longer needed header, and some trivial whitespace fixes. * Check Tracker - Refactors Index to Bitmask code to a macro * Check Tracker - Changes ordering from alphabetical to RandomizerCheck ordering * Check Tracker - Wraps everything in a namespace to avoid global variable usage * Check Tracker - Explicitly defines for-loop scope * Check Tracker - refactors dungeon lookup from static array to function * Fixes a bug when using EnhancementColor with alpha * Check Tracker - Refactors all colour to use direct conversions * Check Tracker - refactors settings loading and check visibility for readability * Check Tracker - Fixes a bug where the wrong label showed on the Check Tracker BG Color * UIWidgets - Adds Alpha bar to EnhancementColor when using alpha parameter
2022-12-10 22:39:23 -05:00
OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_SHOPSANITY) != RO_SHOPSANITY_OFF &&
OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_SHOPSANITY) != RO_SHOPSANITY_ZERO_ITEMS)
: false;
showBeans = IS_RANDO ?
Randomizer Auto Location tracker (#1942) * Initial Auto-Location Tracking * Updates styling for checked items in Check Tracker * Fixes crashing issues with Check Tracker rendering * Auto scroll Check Tracker windows to current area * Checks Tracker only shows checked locations once in game * Fixes issue where Check Tracker would auto-scroll to wrong location when entering a grotto * Fixes gerudo fortress checks showing in tracker when settings have them removed * InfTable Check Location Fixes: Lost Dog Richard, Rolling Gorons, HBA 1000, Thawed Zora * Fixes most Event Chk Inf Checks on Check Tracker, and Frogs * Check Tracker - Song from Malon now works * Check Tracker - Fixes Claim Check check not tracking - Fixes spoiler for Claim Check check when getting Biggoron's Sword - Fixes LACS being spoiled and not tracking * Check Tracker - Fixes #2 for Skull Mask and Mask of Truth checks * Check Tracker - Adds support for merchants - Fixes #7 for Bomchu Salesman - Fixes #12 for Medigoron * Check Tracker - Fixes #8 for Song from Saria * Check Tracker - Fixes #9 for Adult Shooting Gallery * Check Tracker - Fixes #10 for Composer Grave * Check Tracker - Fixes #14 for Song from Ocarina of Time * Check Tracker - Fixes #16 for Shooting the Sun * Check Tracker - Fixes #19 for Darunia's Joy * Save Editor - Adds missing label for Treasure Chest Game * Check Tracker - Fixes Great Faries checks * Check Tracker - Fixes Sheik at Temple * Check Tracker - Fixes Great Fairy auto-scroll to wrong location * Check Tracker - Updates blue warp checks - Fixes Bongo Bongo and Twinrova checks * Check Tracker - Fixes Dampe's Gravedigging Tour * Check Tracker - Fixes Prescription to King Zora * Check Tracker - Fixes Bazaar showing under wrong area on tracker between adult/child * Check Tracker - Fixes scroll for Hyrule Market and Bazaar * Check Tracker - Fixes giving Adult Trade Items shown on tracker: Broken Sword, Saw, Cojiro, Eyeball Froge, and Eyedrops * Cleans up item_location * Check Tracker - Item List - Fixes item list not updating when changing seeds/options - Separates item exclusion list from item check list - Clean up comments * Check Tracker - Adds Skip functionality to buttons * Check Tracker - Refactors adult trade items to RandomizerInf * Check Tracker - Fixes an issue where any time an item is removed the tracker would cause an application crash * Check Tracker - Item names are now dependent on file language * Check Tracker - Fixes Gerudo Card check not showing in Fast setting * Reorders headers to (hopefully) avoid CI build conflicts on linux/consoles * Explicitly defines vector header in randomizer.h to fix compile errors * Complete Refactor of Check Tracker ImGui * Adds missing check tracker files to CMakeLists * Reverts the Item_location whitespace cleanup from ad10807c * Check Tracker - Loading Fixes - Fixes a bug where loading a save file a second time would add all the checks again - Fixes a bug where the check tracker would not render at all until in a save file * Check Tracker - Fixes a bug where checks would sometimes fail to load * Check Tracker - Fixes duplicated checks when using Only on Pause or Only on Combo * Check Tracker - Works around issue where single characters don't show in EnhancementCombobox, and fixes a label for combo buttons held option * Check Tracker - Applies all Check Tracker changes to Item Location * Check Tracker - Updated Check List - Adds Link's pocket, either in KF or HM depending on starting age - Supports Scrubs and Merchants - Uses enums instead of magic numbers - Updates DC Scrub Short Names for MQ * Check Tracker - Adds a performance mode option * Check Tracker - List Fixes (requires new rando generation) - Fixes Frogs Rupees always visible - Fixes Kokiri Sword Chest not showing - Fixes Weird Egg not showing * Check Tracker - MQ List basic support * Check Tracker - MQ/Vanilla anti-spoilers * Check Tracker - Collecting a compass now spoils the area * Check Tracker - Basic Vanilla Support and fixes - Vanilla items show in check tracker, even if many won't auto check - Fixes an issue with Gerudo Fortress Keys - Refactors IsVisibleInCheckTracker to randomizer_check_tracjer * Check Tracker - Fixes merge conflict from 08a487f35e1d760ab9e69b932edbe4da6bcd9edb * Check Tracker - Fixes tracker loading as Floating when default value is set to Windowed * Randomizer Location Exclusion List - Adds Scrubs, Merchants, Shops. Adult Trade items, MQ Dungeons, and Bean Salesman - Fixes Kokiri Sword Chest, Weird Egg, and Frog Song Rupees from misbehaving - Updates Gerudo Fortress logic to be dependent on Open/Fast/Normal Fortress - Removes Invalid Check - Adds RO Enum for MQ settings - Updates magic values to RO enum * Location Exclusion List - Scrubs that are always randomized now always show on the list * For now, removes some extra code only needed for a Check Tracker. * Randomizer Location Exclusion List - Fixes Eyeball Frog from showing up when Adult Trade Items was off * Location Tracker - Updates Eyedrops to use RandomizerInf instead of Chest * Check Tracker - Fixes a bug where Link's Pocket item wasn't acting as checked for area item count * Check Tracker - Fixes a bug where Locations would incorrectly say Vanilla due to the first check in the area being a non-MQ check * Check Tracker - Fixes a crash when Check Tracker is docked but not visible * Check Tracker - Fixes areas being spoiled when loading different save files * Check Tracker - Only reset variables if they are initialized * Check Tracker - Cleans up old comments, unused variables, methods, and macros, adds language TODOs, * Check Tracker - Readds rainbow UI elements after Cosmetics Editor refactor * Check Tracker - Removal of flag lookup that was refactored, no longer needed header, and some trivial whitespace fixes. * Check Tracker - Refactors Index to Bitmask code to a macro * Check Tracker - Changes ordering from alphabetical to RandomizerCheck ordering * Check Tracker - Wraps everything in a namespace to avoid global variable usage * Check Tracker - Explicitly defines for-loop scope * Check Tracker - refactors dungeon lookup from static array to function * Fixes a bug when using EnhancementColor with alpha * Check Tracker - Refactors all colour to use direct conversions * Check Tracker - refactors settings loading and check visibility for readability * Check Tracker - Fixes a bug where the wrong label showed on the Check Tracker BG Color * UIWidgets - Adds Alpha bar to EnhancementColor when using alpha parameter
2022-12-10 22:39:23 -05:00
OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_SHUFFLE_MAGIC_BEANS) == RO_GENERIC_YES
: true;
showScrubs = IS_RANDO ?
Randomizer Auto Location tracker (#1942) * Initial Auto-Location Tracking * Updates styling for checked items in Check Tracker * Fixes crashing issues with Check Tracker rendering * Auto scroll Check Tracker windows to current area * Checks Tracker only shows checked locations once in game * Fixes issue where Check Tracker would auto-scroll to wrong location when entering a grotto * Fixes gerudo fortress checks showing in tracker when settings have them removed * InfTable Check Location Fixes: Lost Dog Richard, Rolling Gorons, HBA 1000, Thawed Zora * Fixes most Event Chk Inf Checks on Check Tracker, and Frogs * Check Tracker - Song from Malon now works * Check Tracker - Fixes Claim Check check not tracking - Fixes spoiler for Claim Check check when getting Biggoron's Sword - Fixes LACS being spoiled and not tracking * Check Tracker - Fixes #2 for Skull Mask and Mask of Truth checks * Check Tracker - Adds support for merchants - Fixes #7 for Bomchu Salesman - Fixes #12 for Medigoron * Check Tracker - Fixes #8 for Song from Saria * Check Tracker - Fixes #9 for Adult Shooting Gallery * Check Tracker - Fixes #10 for Composer Grave * Check Tracker - Fixes #14 for Song from Ocarina of Time * Check Tracker - Fixes #16 for Shooting the Sun * Check Tracker - Fixes #19 for Darunia's Joy * Save Editor - Adds missing label for Treasure Chest Game * Check Tracker - Fixes Great Faries checks * Check Tracker - Fixes Sheik at Temple * Check Tracker - Fixes Great Fairy auto-scroll to wrong location * Check Tracker - Updates blue warp checks - Fixes Bongo Bongo and Twinrova checks * Check Tracker - Fixes Dampe's Gravedigging Tour * Check Tracker - Fixes Prescription to King Zora * Check Tracker - Fixes Bazaar showing under wrong area on tracker between adult/child * Check Tracker - Fixes scroll for Hyrule Market and Bazaar * Check Tracker - Fixes giving Adult Trade Items shown on tracker: Broken Sword, Saw, Cojiro, Eyeball Froge, and Eyedrops * Cleans up item_location * Check Tracker - Item List - Fixes item list not updating when changing seeds/options - Separates item exclusion list from item check list - Clean up comments * Check Tracker - Adds Skip functionality to buttons * Check Tracker - Refactors adult trade items to RandomizerInf * Check Tracker - Fixes an issue where any time an item is removed the tracker would cause an application crash * Check Tracker - Item names are now dependent on file language * Check Tracker - Fixes Gerudo Card check not showing in Fast setting * Reorders headers to (hopefully) avoid CI build conflicts on linux/consoles * Explicitly defines vector header in randomizer.h to fix compile errors * Complete Refactor of Check Tracker ImGui * Adds missing check tracker files to CMakeLists * Reverts the Item_location whitespace cleanup from ad10807c * Check Tracker - Loading Fixes - Fixes a bug where loading a save file a second time would add all the checks again - Fixes a bug where the check tracker would not render at all until in a save file * Check Tracker - Fixes a bug where checks would sometimes fail to load * Check Tracker - Fixes duplicated checks when using Only on Pause or Only on Combo * Check Tracker - Works around issue where single characters don't show in EnhancementCombobox, and fixes a label for combo buttons held option * Check Tracker - Applies all Check Tracker changes to Item Location * Check Tracker - Updated Check List - Adds Link's pocket, either in KF or HM depending on starting age - Supports Scrubs and Merchants - Uses enums instead of magic numbers - Updates DC Scrub Short Names for MQ * Check Tracker - Adds a performance mode option * Check Tracker - List Fixes (requires new rando generation) - Fixes Frogs Rupees always visible - Fixes Kokiri Sword Chest not showing - Fixes Weird Egg not showing * Check Tracker - MQ List basic support * Check Tracker - MQ/Vanilla anti-spoilers * Check Tracker - Collecting a compass now spoils the area * Check Tracker - Basic Vanilla Support and fixes - Vanilla items show in check tracker, even if many won't auto check - Fixes an issue with Gerudo Fortress Keys - Refactors IsVisibleInCheckTracker to randomizer_check_tracjer * Check Tracker - Fixes merge conflict from 08a487f35e1d760ab9e69b932edbe4da6bcd9edb * Check Tracker - Fixes tracker loading as Floating when default value is set to Windowed * Randomizer Location Exclusion List - Adds Scrubs, Merchants, Shops. Adult Trade items, MQ Dungeons, and Bean Salesman - Fixes Kokiri Sword Chest, Weird Egg, and Frog Song Rupees from misbehaving - Updates Gerudo Fortress logic to be dependent on Open/Fast/Normal Fortress - Removes Invalid Check - Adds RO Enum for MQ settings - Updates magic values to RO enum * Location Exclusion List - Scrubs that are always randomized now always show on the list * For now, removes some extra code only needed for a Check Tracker. * Randomizer Location Exclusion List - Fixes Eyeball Frog from showing up when Adult Trade Items was off * Location Tracker - Updates Eyedrops to use RandomizerInf instead of Chest * Check Tracker - Fixes a bug where Link's Pocket item wasn't acting as checked for area item count * Check Tracker - Fixes a bug where Locations would incorrectly say Vanilla due to the first check in the area being a non-MQ check * Check Tracker - Fixes a crash when Check Tracker is docked but not visible * Check Tracker - Fixes areas being spoiled when loading different save files * Check Tracker - Only reset variables if they are initialized * Check Tracker - Cleans up old comments, unused variables, methods, and macros, adds language TODOs, * Check Tracker - Readds rainbow UI elements after Cosmetics Editor refactor * Check Tracker - Removal of flag lookup that was refactored, no longer needed header, and some trivial whitespace fixes. * Check Tracker - Refactors Index to Bitmask code to a macro * Check Tracker - Changes ordering from alphabetical to RandomizerCheck ordering * Check Tracker - Wraps everything in a namespace to avoid global variable usage * Check Tracker - Explicitly defines for-loop scope * Check Tracker - refactors dungeon lookup from static array to function * Fixes a bug when using EnhancementColor with alpha * Check Tracker - Refactors all colour to use direct conversions * Check Tracker - refactors settings loading and check visibility for readability * Check Tracker - Fixes a bug where the wrong label showed on the Check Tracker BG Color * UIWidgets - Adds Alpha bar to EnhancementColor when using alpha parameter
2022-12-10 22:39:23 -05:00
OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_SHUFFLE_SCRUBS) != RO_SCRUBS_OFF
: false;
showMerchants = IS_RANDO ?
Randomizer Auto Location tracker (#1942) * Initial Auto-Location Tracking * Updates styling for checked items in Check Tracker * Fixes crashing issues with Check Tracker rendering * Auto scroll Check Tracker windows to current area * Checks Tracker only shows checked locations once in game * Fixes issue where Check Tracker would auto-scroll to wrong location when entering a grotto * Fixes gerudo fortress checks showing in tracker when settings have them removed * InfTable Check Location Fixes: Lost Dog Richard, Rolling Gorons, HBA 1000, Thawed Zora * Fixes most Event Chk Inf Checks on Check Tracker, and Frogs * Check Tracker - Song from Malon now works * Check Tracker - Fixes Claim Check check not tracking - Fixes spoiler for Claim Check check when getting Biggoron's Sword - Fixes LACS being spoiled and not tracking * Check Tracker - Fixes #2 for Skull Mask and Mask of Truth checks * Check Tracker - Adds support for merchants - Fixes #7 for Bomchu Salesman - Fixes #12 for Medigoron * Check Tracker - Fixes #8 for Song from Saria * Check Tracker - Fixes #9 for Adult Shooting Gallery * Check Tracker - Fixes #10 for Composer Grave * Check Tracker - Fixes #14 for Song from Ocarina of Time * Check Tracker - Fixes #16 for Shooting the Sun * Check Tracker - Fixes #19 for Darunia's Joy * Save Editor - Adds missing label for Treasure Chest Game * Check Tracker - Fixes Great Faries checks * Check Tracker - Fixes Sheik at Temple * Check Tracker - Fixes Great Fairy auto-scroll to wrong location * Check Tracker - Updates blue warp checks - Fixes Bongo Bongo and Twinrova checks * Check Tracker - Fixes Dampe's Gravedigging Tour * Check Tracker - Fixes Prescription to King Zora * Check Tracker - Fixes Bazaar showing under wrong area on tracker between adult/child * Check Tracker - Fixes scroll for Hyrule Market and Bazaar * Check Tracker - Fixes giving Adult Trade Items shown on tracker: Broken Sword, Saw, Cojiro, Eyeball Froge, and Eyedrops * Cleans up item_location * Check Tracker - Item List - Fixes item list not updating when changing seeds/options - Separates item exclusion list from item check list - Clean up comments * Check Tracker - Adds Skip functionality to buttons * Check Tracker - Refactors adult trade items to RandomizerInf * Check Tracker - Fixes an issue where any time an item is removed the tracker would cause an application crash * Check Tracker - Item names are now dependent on file language * Check Tracker - Fixes Gerudo Card check not showing in Fast setting * Reorders headers to (hopefully) avoid CI build conflicts on linux/consoles * Explicitly defines vector header in randomizer.h to fix compile errors * Complete Refactor of Check Tracker ImGui * Adds missing check tracker files to CMakeLists * Reverts the Item_location whitespace cleanup from ad10807c * Check Tracker - Loading Fixes - Fixes a bug where loading a save file a second time would add all the checks again - Fixes a bug where the check tracker would not render at all until in a save file * Check Tracker - Fixes a bug where checks would sometimes fail to load * Check Tracker - Fixes duplicated checks when using Only on Pause or Only on Combo * Check Tracker - Works around issue where single characters don't show in EnhancementCombobox, and fixes a label for combo buttons held option * Check Tracker - Applies all Check Tracker changes to Item Location * Check Tracker - Updated Check List - Adds Link's pocket, either in KF or HM depending on starting age - Supports Scrubs and Merchants - Uses enums instead of magic numbers - Updates DC Scrub Short Names for MQ * Check Tracker - Adds a performance mode option * Check Tracker - List Fixes (requires new rando generation) - Fixes Frogs Rupees always visible - Fixes Kokiri Sword Chest not showing - Fixes Weird Egg not showing * Check Tracker - MQ List basic support * Check Tracker - MQ/Vanilla anti-spoilers * Check Tracker - Collecting a compass now spoils the area * Check Tracker - Basic Vanilla Support and fixes - Vanilla items show in check tracker, even if many won't auto check - Fixes an issue with Gerudo Fortress Keys - Refactors IsVisibleInCheckTracker to randomizer_check_tracjer * Check Tracker - Fixes merge conflict from 08a487f35e1d760ab9e69b932edbe4da6bcd9edb * Check Tracker - Fixes tracker loading as Floating when default value is set to Windowed * Randomizer Location Exclusion List - Adds Scrubs, Merchants, Shops. Adult Trade items, MQ Dungeons, and Bean Salesman - Fixes Kokiri Sword Chest, Weird Egg, and Frog Song Rupees from misbehaving - Updates Gerudo Fortress logic to be dependent on Open/Fast/Normal Fortress - Removes Invalid Check - Adds RO Enum for MQ settings - Updates magic values to RO enum * Location Exclusion List - Scrubs that are always randomized now always show on the list * For now, removes some extra code only needed for a Check Tracker. * Randomizer Location Exclusion List - Fixes Eyeball Frog from showing up when Adult Trade Items was off * Location Tracker - Updates Eyedrops to use RandomizerInf instead of Chest * Check Tracker - Fixes a bug where Link's Pocket item wasn't acting as checked for area item count * Check Tracker - Fixes a bug where Locations would incorrectly say Vanilla due to the first check in the area being a non-MQ check * Check Tracker - Fixes a crash when Check Tracker is docked but not visible * Check Tracker - Fixes areas being spoiled when loading different save files * Check Tracker - Only reset variables if they are initialized * Check Tracker - Cleans up old comments, unused variables, methods, and macros, adds language TODOs, * Check Tracker - Readds rainbow UI elements after Cosmetics Editor refactor * Check Tracker - Removal of flag lookup that was refactored, no longer needed header, and some trivial whitespace fixes. * Check Tracker - Refactors Index to Bitmask code to a macro * Check Tracker - Changes ordering from alphabetical to RandomizerCheck ordering * Check Tracker - Wraps everything in a namespace to avoid global variable usage * Check Tracker - Explicitly defines for-loop scope * Check Tracker - refactors dungeon lookup from static array to function * Fixes a bug when using EnhancementColor with alpha * Check Tracker - Refactors all colour to use direct conversions * Check Tracker - refactors settings loading and check visibility for readability * Check Tracker - Fixes a bug where the wrong label showed on the Check Tracker BG Color * UIWidgets - Adds Alpha bar to EnhancementColor when using alpha parameter
2022-12-10 22:39:23 -05:00
OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_SHUFFLE_MERCHANTS) != RO_SHUFFLE_MERCHANTS_OFF
: true;
showCows = IS_RANDO ?
Randomizer Auto Location tracker (#1942) * Initial Auto-Location Tracking * Updates styling for checked items in Check Tracker * Fixes crashing issues with Check Tracker rendering * Auto scroll Check Tracker windows to current area * Checks Tracker only shows checked locations once in game * Fixes issue where Check Tracker would auto-scroll to wrong location when entering a grotto * Fixes gerudo fortress checks showing in tracker when settings have them removed * InfTable Check Location Fixes: Lost Dog Richard, Rolling Gorons, HBA 1000, Thawed Zora * Fixes most Event Chk Inf Checks on Check Tracker, and Frogs * Check Tracker - Song from Malon now works * Check Tracker - Fixes Claim Check check not tracking - Fixes spoiler for Claim Check check when getting Biggoron's Sword - Fixes LACS being spoiled and not tracking * Check Tracker - Fixes #2 for Skull Mask and Mask of Truth checks * Check Tracker - Adds support for merchants - Fixes #7 for Bomchu Salesman - Fixes #12 for Medigoron * Check Tracker - Fixes #8 for Song from Saria * Check Tracker - Fixes #9 for Adult Shooting Gallery * Check Tracker - Fixes #10 for Composer Grave * Check Tracker - Fixes #14 for Song from Ocarina of Time * Check Tracker - Fixes #16 for Shooting the Sun * Check Tracker - Fixes #19 for Darunia's Joy * Save Editor - Adds missing label for Treasure Chest Game * Check Tracker - Fixes Great Faries checks * Check Tracker - Fixes Sheik at Temple * Check Tracker - Fixes Great Fairy auto-scroll to wrong location * Check Tracker - Updates blue warp checks - Fixes Bongo Bongo and Twinrova checks * Check Tracker - Fixes Dampe's Gravedigging Tour * Check Tracker - Fixes Prescription to King Zora * Check Tracker - Fixes Bazaar showing under wrong area on tracker between adult/child * Check Tracker - Fixes scroll for Hyrule Market and Bazaar * Check Tracker - Fixes giving Adult Trade Items shown on tracker: Broken Sword, Saw, Cojiro, Eyeball Froge, and Eyedrops * Cleans up item_location * Check Tracker - Item List - Fixes item list not updating when changing seeds/options - Separates item exclusion list from item check list - Clean up comments * Check Tracker - Adds Skip functionality to buttons * Check Tracker - Refactors adult trade items to RandomizerInf * Check Tracker - Fixes an issue where any time an item is removed the tracker would cause an application crash * Check Tracker - Item names are now dependent on file language * Check Tracker - Fixes Gerudo Card check not showing in Fast setting * Reorders headers to (hopefully) avoid CI build conflicts on linux/consoles * Explicitly defines vector header in randomizer.h to fix compile errors * Complete Refactor of Check Tracker ImGui * Adds missing check tracker files to CMakeLists * Reverts the Item_location whitespace cleanup from ad10807c * Check Tracker - Loading Fixes - Fixes a bug where loading a save file a second time would add all the checks again - Fixes a bug where the check tracker would not render at all until in a save file * Check Tracker - Fixes a bug where checks would sometimes fail to load * Check Tracker - Fixes duplicated checks when using Only on Pause or Only on Combo * Check Tracker - Works around issue where single characters don't show in EnhancementCombobox, and fixes a label for combo buttons held option * Check Tracker - Applies all Check Tracker changes to Item Location * Check Tracker - Updated Check List - Adds Link's pocket, either in KF or HM depending on starting age - Supports Scrubs and Merchants - Uses enums instead of magic numbers - Updates DC Scrub Short Names for MQ * Check Tracker - Adds a performance mode option * Check Tracker - List Fixes (requires new rando generation) - Fixes Frogs Rupees always visible - Fixes Kokiri Sword Chest not showing - Fixes Weird Egg not showing * Check Tracker - MQ List basic support * Check Tracker - MQ/Vanilla anti-spoilers * Check Tracker - Collecting a compass now spoils the area * Check Tracker - Basic Vanilla Support and fixes - Vanilla items show in check tracker, even if many won't auto check - Fixes an issue with Gerudo Fortress Keys - Refactors IsVisibleInCheckTracker to randomizer_check_tracjer * Check Tracker - Fixes merge conflict from 08a487f35e1d760ab9e69b932edbe4da6bcd9edb * Check Tracker - Fixes tracker loading as Floating when default value is set to Windowed * Randomizer Location Exclusion List - Adds Scrubs, Merchants, Shops. Adult Trade items, MQ Dungeons, and Bean Salesman - Fixes Kokiri Sword Chest, Weird Egg, and Frog Song Rupees from misbehaving - Updates Gerudo Fortress logic to be dependent on Open/Fast/Normal Fortress - Removes Invalid Check - Adds RO Enum for MQ settings - Updates magic values to RO enum * Location Exclusion List - Scrubs that are always randomized now always show on the list * For now, removes some extra code only needed for a Check Tracker. * Randomizer Location Exclusion List - Fixes Eyeball Frog from showing up when Adult Trade Items was off * Location Tracker - Updates Eyedrops to use RandomizerInf instead of Chest * Check Tracker - Fixes a bug where Link's Pocket item wasn't acting as checked for area item count * Check Tracker - Fixes a bug where Locations would incorrectly say Vanilla due to the first check in the area being a non-MQ check * Check Tracker - Fixes a crash when Check Tracker is docked but not visible * Check Tracker - Fixes areas being spoiled when loading different save files * Check Tracker - Only reset variables if they are initialized * Check Tracker - Cleans up old comments, unused variables, methods, and macros, adds language TODOs, * Check Tracker - Readds rainbow UI elements after Cosmetics Editor refactor * Check Tracker - Removal of flag lookup that was refactored, no longer needed header, and some trivial whitespace fixes. * Check Tracker - Refactors Index to Bitmask code to a macro * Check Tracker - Changes ordering from alphabetical to RandomizerCheck ordering * Check Tracker - Wraps everything in a namespace to avoid global variable usage * Check Tracker - Explicitly defines for-loop scope * Check Tracker - refactors dungeon lookup from static array to function * Fixes a bug when using EnhancementColor with alpha * Check Tracker - Refactors all colour to use direct conversions * Check Tracker - refactors settings loading and check visibility for readability * Check Tracker - Fixes a bug where the wrong label showed on the Check Tracker BG Color * UIWidgets - Adds Alpha bar to EnhancementColor when using alpha parameter
2022-12-10 22:39:23 -05:00
OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_SHUFFLE_COWS) == RO_GENERIC_YES
: false;
showAdultTrade = IS_RANDO ?
Randomizer Auto Location tracker (#1942) * Initial Auto-Location Tracking * Updates styling for checked items in Check Tracker * Fixes crashing issues with Check Tracker rendering * Auto scroll Check Tracker windows to current area * Checks Tracker only shows checked locations once in game * Fixes issue where Check Tracker would auto-scroll to wrong location when entering a grotto * Fixes gerudo fortress checks showing in tracker when settings have them removed * InfTable Check Location Fixes: Lost Dog Richard, Rolling Gorons, HBA 1000, Thawed Zora * Fixes most Event Chk Inf Checks on Check Tracker, and Frogs * Check Tracker - Song from Malon now works * Check Tracker - Fixes Claim Check check not tracking - Fixes spoiler for Claim Check check when getting Biggoron's Sword - Fixes LACS being spoiled and not tracking * Check Tracker - Fixes #2 for Skull Mask and Mask of Truth checks * Check Tracker - Adds support for merchants - Fixes #7 for Bomchu Salesman - Fixes #12 for Medigoron * Check Tracker - Fixes #8 for Song from Saria * Check Tracker - Fixes #9 for Adult Shooting Gallery * Check Tracker - Fixes #10 for Composer Grave * Check Tracker - Fixes #14 for Song from Ocarina of Time * Check Tracker - Fixes #16 for Shooting the Sun * Check Tracker - Fixes #19 for Darunia's Joy * Save Editor - Adds missing label for Treasure Chest Game * Check Tracker - Fixes Great Faries checks * Check Tracker - Fixes Sheik at Temple * Check Tracker - Fixes Great Fairy auto-scroll to wrong location * Check Tracker - Updates blue warp checks - Fixes Bongo Bongo and Twinrova checks * Check Tracker - Fixes Dampe's Gravedigging Tour * Check Tracker - Fixes Prescription to King Zora * Check Tracker - Fixes Bazaar showing under wrong area on tracker between adult/child * Check Tracker - Fixes scroll for Hyrule Market and Bazaar * Check Tracker - Fixes giving Adult Trade Items shown on tracker: Broken Sword, Saw, Cojiro, Eyeball Froge, and Eyedrops * Cleans up item_location * Check Tracker - Item List - Fixes item list not updating when changing seeds/options - Separates item exclusion list from item check list - Clean up comments * Check Tracker - Adds Skip functionality to buttons * Check Tracker - Refactors adult trade items to RandomizerInf * Check Tracker - Fixes an issue where any time an item is removed the tracker would cause an application crash * Check Tracker - Item names are now dependent on file language * Check Tracker - Fixes Gerudo Card check not showing in Fast setting * Reorders headers to (hopefully) avoid CI build conflicts on linux/consoles * Explicitly defines vector header in randomizer.h to fix compile errors * Complete Refactor of Check Tracker ImGui * Adds missing check tracker files to CMakeLists * Reverts the Item_location whitespace cleanup from ad10807c * Check Tracker - Loading Fixes - Fixes a bug where loading a save file a second time would add all the checks again - Fixes a bug where the check tracker would not render at all until in a save file * Check Tracker - Fixes a bug where checks would sometimes fail to load * Check Tracker - Fixes duplicated checks when using Only on Pause or Only on Combo * Check Tracker - Works around issue where single characters don't show in EnhancementCombobox, and fixes a label for combo buttons held option * Check Tracker - Applies all Check Tracker changes to Item Location * Check Tracker - Updated Check List - Adds Link's pocket, either in KF or HM depending on starting age - Supports Scrubs and Merchants - Uses enums instead of magic numbers - Updates DC Scrub Short Names for MQ * Check Tracker - Adds a performance mode option * Check Tracker - List Fixes (requires new rando generation) - Fixes Frogs Rupees always visible - Fixes Kokiri Sword Chest not showing - Fixes Weird Egg not showing * Check Tracker - MQ List basic support * Check Tracker - MQ/Vanilla anti-spoilers * Check Tracker - Collecting a compass now spoils the area * Check Tracker - Basic Vanilla Support and fixes - Vanilla items show in check tracker, even if many won't auto check - Fixes an issue with Gerudo Fortress Keys - Refactors IsVisibleInCheckTracker to randomizer_check_tracjer * Check Tracker - Fixes merge conflict from 08a487f35e1d760ab9e69b932edbe4da6bcd9edb * Check Tracker - Fixes tracker loading as Floating when default value is set to Windowed * Randomizer Location Exclusion List - Adds Scrubs, Merchants, Shops. Adult Trade items, MQ Dungeons, and Bean Salesman - Fixes Kokiri Sword Chest, Weird Egg, and Frog Song Rupees from misbehaving - Updates Gerudo Fortress logic to be dependent on Open/Fast/Normal Fortress - Removes Invalid Check - Adds RO Enum for MQ settings - Updates magic values to RO enum * Location Exclusion List - Scrubs that are always randomized now always show on the list * For now, removes some extra code only needed for a Check Tracker. * Randomizer Location Exclusion List - Fixes Eyeball Frog from showing up when Adult Trade Items was off * Location Tracker - Updates Eyedrops to use RandomizerInf instead of Chest * Check Tracker - Fixes a bug where Link's Pocket item wasn't acting as checked for area item count * Check Tracker - Fixes a bug where Locations would incorrectly say Vanilla due to the first check in the area being a non-MQ check * Check Tracker - Fixes a crash when Check Tracker is docked but not visible * Check Tracker - Fixes areas being spoiled when loading different save files * Check Tracker - Only reset variables if they are initialized * Check Tracker - Cleans up old comments, unused variables, methods, and macros, adds language TODOs, * Check Tracker - Readds rainbow UI elements after Cosmetics Editor refactor * Check Tracker - Removal of flag lookup that was refactored, no longer needed header, and some trivial whitespace fixes. * Check Tracker - Refactors Index to Bitmask code to a macro * Check Tracker - Changes ordering from alphabetical to RandomizerCheck ordering * Check Tracker - Wraps everything in a namespace to avoid global variable usage * Check Tracker - Explicitly defines for-loop scope * Check Tracker - refactors dungeon lookup from static array to function * Fixes a bug when using EnhancementColor with alpha * Check Tracker - Refactors all colour to use direct conversions * Check Tracker - refactors settings loading and check visibility for readability * Check Tracker - Fixes a bug where the wrong label showed on the Check Tracker BG Color * UIWidgets - Adds Alpha bar to EnhancementColor when using alpha parameter
2022-12-10 22:39:23 -05:00
OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_SHUFFLE_ADULT_TRADE) == RO_GENERIC_YES
: true;
showKokiriSword = IS_RANDO ?
Randomizer Auto Location tracker (#1942) * Initial Auto-Location Tracking * Updates styling for checked items in Check Tracker * Fixes crashing issues with Check Tracker rendering * Auto scroll Check Tracker windows to current area * Checks Tracker only shows checked locations once in game * Fixes issue where Check Tracker would auto-scroll to wrong location when entering a grotto * Fixes gerudo fortress checks showing in tracker when settings have them removed * InfTable Check Location Fixes: Lost Dog Richard, Rolling Gorons, HBA 1000, Thawed Zora * Fixes most Event Chk Inf Checks on Check Tracker, and Frogs * Check Tracker - Song from Malon now works * Check Tracker - Fixes Claim Check check not tracking - Fixes spoiler for Claim Check check when getting Biggoron's Sword - Fixes LACS being spoiled and not tracking * Check Tracker - Fixes #2 for Skull Mask and Mask of Truth checks * Check Tracker - Adds support for merchants - Fixes #7 for Bomchu Salesman - Fixes #12 for Medigoron * Check Tracker - Fixes #8 for Song from Saria * Check Tracker - Fixes #9 for Adult Shooting Gallery * Check Tracker - Fixes #10 for Composer Grave * Check Tracker - Fixes #14 for Song from Ocarina of Time * Check Tracker - Fixes #16 for Shooting the Sun * Check Tracker - Fixes #19 for Darunia's Joy * Save Editor - Adds missing label for Treasure Chest Game * Check Tracker - Fixes Great Faries checks * Check Tracker - Fixes Sheik at Temple * Check Tracker - Fixes Great Fairy auto-scroll to wrong location * Check Tracker - Updates blue warp checks - Fixes Bongo Bongo and Twinrova checks * Check Tracker - Fixes Dampe's Gravedigging Tour * Check Tracker - Fixes Prescription to King Zora * Check Tracker - Fixes Bazaar showing under wrong area on tracker between adult/child * Check Tracker - Fixes scroll for Hyrule Market and Bazaar * Check Tracker - Fixes giving Adult Trade Items shown on tracker: Broken Sword, Saw, Cojiro, Eyeball Froge, and Eyedrops * Cleans up item_location * Check Tracker - Item List - Fixes item list not updating when changing seeds/options - Separates item exclusion list from item check list - Clean up comments * Check Tracker - Adds Skip functionality to buttons * Check Tracker - Refactors adult trade items to RandomizerInf * Check Tracker - Fixes an issue where any time an item is removed the tracker would cause an application crash * Check Tracker - Item names are now dependent on file language * Check Tracker - Fixes Gerudo Card check not showing in Fast setting * Reorders headers to (hopefully) avoid CI build conflicts on linux/consoles * Explicitly defines vector header in randomizer.h to fix compile errors * Complete Refactor of Check Tracker ImGui * Adds missing check tracker files to CMakeLists * Reverts the Item_location whitespace cleanup from ad10807c * Check Tracker - Loading Fixes - Fixes a bug where loading a save file a second time would add all the checks again - Fixes a bug where the check tracker would not render at all until in a save file * Check Tracker - Fixes a bug where checks would sometimes fail to load * Check Tracker - Fixes duplicated checks when using Only on Pause or Only on Combo * Check Tracker - Works around issue where single characters don't show in EnhancementCombobox, and fixes a label for combo buttons held option * Check Tracker - Applies all Check Tracker changes to Item Location * Check Tracker - Updated Check List - Adds Link's pocket, either in KF or HM depending on starting age - Supports Scrubs and Merchants - Uses enums instead of magic numbers - Updates DC Scrub Short Names for MQ * Check Tracker - Adds a performance mode option * Check Tracker - List Fixes (requires new rando generation) - Fixes Frogs Rupees always visible - Fixes Kokiri Sword Chest not showing - Fixes Weird Egg not showing * Check Tracker - MQ List basic support * Check Tracker - MQ/Vanilla anti-spoilers * Check Tracker - Collecting a compass now spoils the area * Check Tracker - Basic Vanilla Support and fixes - Vanilla items show in check tracker, even if many won't auto check - Fixes an issue with Gerudo Fortress Keys - Refactors IsVisibleInCheckTracker to randomizer_check_tracjer * Check Tracker - Fixes merge conflict from 08a487f35e1d760ab9e69b932edbe4da6bcd9edb * Check Tracker - Fixes tracker loading as Floating when default value is set to Windowed * Randomizer Location Exclusion List - Adds Scrubs, Merchants, Shops. Adult Trade items, MQ Dungeons, and Bean Salesman - Fixes Kokiri Sword Chest, Weird Egg, and Frog Song Rupees from misbehaving - Updates Gerudo Fortress logic to be dependent on Open/Fast/Normal Fortress - Removes Invalid Check - Adds RO Enum for MQ settings - Updates magic values to RO enum * Location Exclusion List - Scrubs that are always randomized now always show on the list * For now, removes some extra code only needed for a Check Tracker. * Randomizer Location Exclusion List - Fixes Eyeball Frog from showing up when Adult Trade Items was off * Location Tracker - Updates Eyedrops to use RandomizerInf instead of Chest * Check Tracker - Fixes a bug where Link's Pocket item wasn't acting as checked for area item count * Check Tracker - Fixes a bug where Locations would incorrectly say Vanilla due to the first check in the area being a non-MQ check * Check Tracker - Fixes a crash when Check Tracker is docked but not visible * Check Tracker - Fixes areas being spoiled when loading different save files * Check Tracker - Only reset variables if they are initialized * Check Tracker - Cleans up old comments, unused variables, methods, and macros, adds language TODOs, * Check Tracker - Readds rainbow UI elements after Cosmetics Editor refactor * Check Tracker - Removal of flag lookup that was refactored, no longer needed header, and some trivial whitespace fixes. * Check Tracker - Refactors Index to Bitmask code to a macro * Check Tracker - Changes ordering from alphabetical to RandomizerCheck ordering * Check Tracker - Wraps everything in a namespace to avoid global variable usage * Check Tracker - Explicitly defines for-loop scope * Check Tracker - refactors dungeon lookup from static array to function * Fixes a bug when using EnhancementColor with alpha * Check Tracker - Refactors all colour to use direct conversions * Check Tracker - refactors settings loading and check visibility for readability * Check Tracker - Fixes a bug where the wrong label showed on the Check Tracker BG Color * UIWidgets - Adds Alpha bar to EnhancementColor when using alpha parameter
2022-12-10 22:39:23 -05:00
OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_SHUFFLE_KOKIRI_SWORD) == RO_GENERIC_YES
: true;
Rando: Master Sword Shuffle (#2981) * The mother of all commits * Removed `GI_SWORD_MASTER`; "Master Sword" Items now actually give MS * Removed dupe MS entries in item pool; updated GIMESSAGE (should stop crashing on non-Windows); re-added MS in item list * Give Adult Link a freebie with shuffle MS on; cihld -> adult no longer gives MS; ToT Master Sword now gives correct item * add master sword GI draw func based on ToT MS object * Force `MasterSword` logic var to only update upon getting MS * Dorf funny line now activates with LA and MS in inv * Apply suggestions * Updated RAND_INF; Check Tracker changes; Gave RAND_INF and ice trap logic to ToT MS check; Fixed swordless behavior for HBA/fishing * ToT MS Check now works in check tracker; Visual bug where box hovers over non-existent MS gone; Fixed RAND_INF check with ToT MS pedestal; Ganon no longer gives free MS * adult equips no longer reset in MS shuffle * Apply (most) locacc review suggestions Co-authored-by: inspectredc <78732756+inspectredc@users.noreply.github.com> * Reorganized swordless check for interface to fit edge cases; getting master sword no longer highlights box * Edge case for BGS but no bow * Fix implicit declaration error for GI hooks (#9) * Adjusted `CanAdultAttack/Damage`; applied logic suggestions * Fixed build errors (hopefully) * Cleanup merge * get shit working again * Tidied up remaining uses of DD flag as rando indicator * make master sword invisible and fix ms flag (#10) * Add text to sheik if go mode is obtained but barrier is still up * overhaul swordless behavior in `func_80083108` * reworked ToT MS Check to have an actual GI * suggestions * Apply suggestions * Better swordless handling with temp B (#11) * better swordless handling with temp B * prevent auto save in fishing pond * prevent auto save during bombchu bowling * enum fix --------- Co-authored-by: Adam Bird <archez39@me.com> Co-authored-by: inspectredc <78732756+inspectredc@users.noreply.github.com> Co-authored-by: RaelCappra <rael.cappra@gmail.com> Co-authored-by: Adam Bird <Archez@users.noreply.github.com>
2023-10-21 21:51:37 -04:00
showMasterSword = IS_RANDO ?
OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_SHUFFLE_MASTER_SWORD) == RO_GENERIC_YES
: true;
showWeirdEgg = IS_RANDO ?
Randomizer Auto Location tracker (#1942) * Initial Auto-Location Tracking * Updates styling for checked items in Check Tracker * Fixes crashing issues with Check Tracker rendering * Auto scroll Check Tracker windows to current area * Checks Tracker only shows checked locations once in game * Fixes issue where Check Tracker would auto-scroll to wrong location when entering a grotto * Fixes gerudo fortress checks showing in tracker when settings have them removed * InfTable Check Location Fixes: Lost Dog Richard, Rolling Gorons, HBA 1000, Thawed Zora * Fixes most Event Chk Inf Checks on Check Tracker, and Frogs * Check Tracker - Song from Malon now works * Check Tracker - Fixes Claim Check check not tracking - Fixes spoiler for Claim Check check when getting Biggoron's Sword - Fixes LACS being spoiled and not tracking * Check Tracker - Fixes #2 for Skull Mask and Mask of Truth checks * Check Tracker - Adds support for merchants - Fixes #7 for Bomchu Salesman - Fixes #12 for Medigoron * Check Tracker - Fixes #8 for Song from Saria * Check Tracker - Fixes #9 for Adult Shooting Gallery * Check Tracker - Fixes #10 for Composer Grave * Check Tracker - Fixes #14 for Song from Ocarina of Time * Check Tracker - Fixes #16 for Shooting the Sun * Check Tracker - Fixes #19 for Darunia's Joy * Save Editor - Adds missing label for Treasure Chest Game * Check Tracker - Fixes Great Faries checks * Check Tracker - Fixes Sheik at Temple * Check Tracker - Fixes Great Fairy auto-scroll to wrong location * Check Tracker - Updates blue warp checks - Fixes Bongo Bongo and Twinrova checks * Check Tracker - Fixes Dampe's Gravedigging Tour * Check Tracker - Fixes Prescription to King Zora * Check Tracker - Fixes Bazaar showing under wrong area on tracker between adult/child * Check Tracker - Fixes scroll for Hyrule Market and Bazaar * Check Tracker - Fixes giving Adult Trade Items shown on tracker: Broken Sword, Saw, Cojiro, Eyeball Froge, and Eyedrops * Cleans up item_location * Check Tracker - Item List - Fixes item list not updating when changing seeds/options - Separates item exclusion list from item check list - Clean up comments * Check Tracker - Adds Skip functionality to buttons * Check Tracker - Refactors adult trade items to RandomizerInf * Check Tracker - Fixes an issue where any time an item is removed the tracker would cause an application crash * Check Tracker - Item names are now dependent on file language * Check Tracker - Fixes Gerudo Card check not showing in Fast setting * Reorders headers to (hopefully) avoid CI build conflicts on linux/consoles * Explicitly defines vector header in randomizer.h to fix compile errors * Complete Refactor of Check Tracker ImGui * Adds missing check tracker files to CMakeLists * Reverts the Item_location whitespace cleanup from ad10807c * Check Tracker - Loading Fixes - Fixes a bug where loading a save file a second time would add all the checks again - Fixes a bug where the check tracker would not render at all until in a save file * Check Tracker - Fixes a bug where checks would sometimes fail to load * Check Tracker - Fixes duplicated checks when using Only on Pause or Only on Combo * Check Tracker - Works around issue where single characters don't show in EnhancementCombobox, and fixes a label for combo buttons held option * Check Tracker - Applies all Check Tracker changes to Item Location * Check Tracker - Updated Check List - Adds Link's pocket, either in KF or HM depending on starting age - Supports Scrubs and Merchants - Uses enums instead of magic numbers - Updates DC Scrub Short Names for MQ * Check Tracker - Adds a performance mode option * Check Tracker - List Fixes (requires new rando generation) - Fixes Frogs Rupees always visible - Fixes Kokiri Sword Chest not showing - Fixes Weird Egg not showing * Check Tracker - MQ List basic support * Check Tracker - MQ/Vanilla anti-spoilers * Check Tracker - Collecting a compass now spoils the area * Check Tracker - Basic Vanilla Support and fixes - Vanilla items show in check tracker, even if many won't auto check - Fixes an issue with Gerudo Fortress Keys - Refactors IsVisibleInCheckTracker to randomizer_check_tracjer * Check Tracker - Fixes merge conflict from 08a487f35e1d760ab9e69b932edbe4da6bcd9edb * Check Tracker - Fixes tracker loading as Floating when default value is set to Windowed * Randomizer Location Exclusion List - Adds Scrubs, Merchants, Shops. Adult Trade items, MQ Dungeons, and Bean Salesman - Fixes Kokiri Sword Chest, Weird Egg, and Frog Song Rupees from misbehaving - Updates Gerudo Fortress logic to be dependent on Open/Fast/Normal Fortress - Removes Invalid Check - Adds RO Enum for MQ settings - Updates magic values to RO enum * Location Exclusion List - Scrubs that are always randomized now always show on the list * For now, removes some extra code only needed for a Check Tracker. * Randomizer Location Exclusion List - Fixes Eyeball Frog from showing up when Adult Trade Items was off * Location Tracker - Updates Eyedrops to use RandomizerInf instead of Chest * Check Tracker - Fixes a bug where Link's Pocket item wasn't acting as checked for area item count * Check Tracker - Fixes a bug where Locations would incorrectly say Vanilla due to the first check in the area being a non-MQ check * Check Tracker - Fixes a crash when Check Tracker is docked but not visible * Check Tracker - Fixes areas being spoiled when loading different save files * Check Tracker - Only reset variables if they are initialized * Check Tracker - Cleans up old comments, unused variables, methods, and macros, adds language TODOs, * Check Tracker - Readds rainbow UI elements after Cosmetics Editor refactor * Check Tracker - Removal of flag lookup that was refactored, no longer needed header, and some trivial whitespace fixes. * Check Tracker - Refactors Index to Bitmask code to a macro * Check Tracker - Changes ordering from alphabetical to RandomizerCheck ordering * Check Tracker - Wraps everything in a namespace to avoid global variable usage * Check Tracker - Explicitly defines for-loop scope * Check Tracker - refactors dungeon lookup from static array to function * Fixes a bug when using EnhancementColor with alpha * Check Tracker - Refactors all colour to use direct conversions * Check Tracker - refactors settings loading and check visibility for readability * Check Tracker - Fixes a bug where the wrong label showed on the Check Tracker BG Color * UIWidgets - Adds Alpha bar to EnhancementColor when using alpha parameter
2022-12-10 22:39:23 -05:00
OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_SHUFFLE_WEIRD_EGG) == RO_GENERIC_YES
: true;
showGerudoCard = IS_RANDO ?
Randomizer Auto Location tracker (#1942) * Initial Auto-Location Tracking * Updates styling for checked items in Check Tracker * Fixes crashing issues with Check Tracker rendering * Auto scroll Check Tracker windows to current area * Checks Tracker only shows checked locations once in game * Fixes issue where Check Tracker would auto-scroll to wrong location when entering a grotto * Fixes gerudo fortress checks showing in tracker when settings have them removed * InfTable Check Location Fixes: Lost Dog Richard, Rolling Gorons, HBA 1000, Thawed Zora * Fixes most Event Chk Inf Checks on Check Tracker, and Frogs * Check Tracker - Song from Malon now works * Check Tracker - Fixes Claim Check check not tracking - Fixes spoiler for Claim Check check when getting Biggoron's Sword - Fixes LACS being spoiled and not tracking * Check Tracker - Fixes #2 for Skull Mask and Mask of Truth checks * Check Tracker - Adds support for merchants - Fixes #7 for Bomchu Salesman - Fixes #12 for Medigoron * Check Tracker - Fixes #8 for Song from Saria * Check Tracker - Fixes #9 for Adult Shooting Gallery * Check Tracker - Fixes #10 for Composer Grave * Check Tracker - Fixes #14 for Song from Ocarina of Time * Check Tracker - Fixes #16 for Shooting the Sun * Check Tracker - Fixes #19 for Darunia's Joy * Save Editor - Adds missing label for Treasure Chest Game * Check Tracker - Fixes Great Faries checks * Check Tracker - Fixes Sheik at Temple * Check Tracker - Fixes Great Fairy auto-scroll to wrong location * Check Tracker - Updates blue warp checks - Fixes Bongo Bongo and Twinrova checks * Check Tracker - Fixes Dampe's Gravedigging Tour * Check Tracker - Fixes Prescription to King Zora * Check Tracker - Fixes Bazaar showing under wrong area on tracker between adult/child * Check Tracker - Fixes scroll for Hyrule Market and Bazaar * Check Tracker - Fixes giving Adult Trade Items shown on tracker: Broken Sword, Saw, Cojiro, Eyeball Froge, and Eyedrops * Cleans up item_location * Check Tracker - Item List - Fixes item list not updating when changing seeds/options - Separates item exclusion list from item check list - Clean up comments * Check Tracker - Adds Skip functionality to buttons * Check Tracker - Refactors adult trade items to RandomizerInf * Check Tracker - Fixes an issue where any time an item is removed the tracker would cause an application crash * Check Tracker - Item names are now dependent on file language * Check Tracker - Fixes Gerudo Card check not showing in Fast setting * Reorders headers to (hopefully) avoid CI build conflicts on linux/consoles * Explicitly defines vector header in randomizer.h to fix compile errors * Complete Refactor of Check Tracker ImGui * Adds missing check tracker files to CMakeLists * Reverts the Item_location whitespace cleanup from ad10807c * Check Tracker - Loading Fixes - Fixes a bug where loading a save file a second time would add all the checks again - Fixes a bug where the check tracker would not render at all until in a save file * Check Tracker - Fixes a bug where checks would sometimes fail to load * Check Tracker - Fixes duplicated checks when using Only on Pause or Only on Combo * Check Tracker - Works around issue where single characters don't show in EnhancementCombobox, and fixes a label for combo buttons held option * Check Tracker - Applies all Check Tracker changes to Item Location * Check Tracker - Updated Check List - Adds Link's pocket, either in KF or HM depending on starting age - Supports Scrubs and Merchants - Uses enums instead of magic numbers - Updates DC Scrub Short Names for MQ * Check Tracker - Adds a performance mode option * Check Tracker - List Fixes (requires new rando generation) - Fixes Frogs Rupees always visible - Fixes Kokiri Sword Chest not showing - Fixes Weird Egg not showing * Check Tracker - MQ List basic support * Check Tracker - MQ/Vanilla anti-spoilers * Check Tracker - Collecting a compass now spoils the area * Check Tracker - Basic Vanilla Support and fixes - Vanilla items show in check tracker, even if many won't auto check - Fixes an issue with Gerudo Fortress Keys - Refactors IsVisibleInCheckTracker to randomizer_check_tracjer * Check Tracker - Fixes merge conflict from 08a487f35e1d760ab9e69b932edbe4da6bcd9edb * Check Tracker - Fixes tracker loading as Floating when default value is set to Windowed * Randomizer Location Exclusion List - Adds Scrubs, Merchants, Shops. Adult Trade items, MQ Dungeons, and Bean Salesman - Fixes Kokiri Sword Chest, Weird Egg, and Frog Song Rupees from misbehaving - Updates Gerudo Fortress logic to be dependent on Open/Fast/Normal Fortress - Removes Invalid Check - Adds RO Enum for MQ settings - Updates magic values to RO enum * Location Exclusion List - Scrubs that are always randomized now always show on the list * For now, removes some extra code only needed for a Check Tracker. * Randomizer Location Exclusion List - Fixes Eyeball Frog from showing up when Adult Trade Items was off * Location Tracker - Updates Eyedrops to use RandomizerInf instead of Chest * Check Tracker - Fixes a bug where Link's Pocket item wasn't acting as checked for area item count * Check Tracker - Fixes a bug where Locations would incorrectly say Vanilla due to the first check in the area being a non-MQ check * Check Tracker - Fixes a crash when Check Tracker is docked but not visible * Check Tracker - Fixes areas being spoiled when loading different save files * Check Tracker - Only reset variables if they are initialized * Check Tracker - Cleans up old comments, unused variables, methods, and macros, adds language TODOs, * Check Tracker - Readds rainbow UI elements after Cosmetics Editor refactor * Check Tracker - Removal of flag lookup that was refactored, no longer needed header, and some trivial whitespace fixes. * Check Tracker - Refactors Index to Bitmask code to a macro * Check Tracker - Changes ordering from alphabetical to RandomizerCheck ordering * Check Tracker - Wraps everything in a namespace to avoid global variable usage * Check Tracker - Explicitly defines for-loop scope * Check Tracker - refactors dungeon lookup from static array to function * Fixes a bug when using EnhancementColor with alpha * Check Tracker - Refactors all colour to use direct conversions * Check Tracker - refactors settings loading and check visibility for readability * Check Tracker - Fixes a bug where the wrong label showed on the Check Tracker BG Color * UIWidgets - Adds Alpha bar to EnhancementColor when using alpha parameter
2022-12-10 22:39:23 -05:00
OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_SHUFFLE_GERUDO_MEMBERSHIP_CARD) == RO_GENERIC_YES
: true;
showFrogSongRupees = IS_RANDO ?
Randomizer Auto Location tracker (#1942) * Initial Auto-Location Tracking * Updates styling for checked items in Check Tracker * Fixes crashing issues with Check Tracker rendering * Auto scroll Check Tracker windows to current area * Checks Tracker only shows checked locations once in game * Fixes issue where Check Tracker would auto-scroll to wrong location when entering a grotto * Fixes gerudo fortress checks showing in tracker when settings have them removed * InfTable Check Location Fixes: Lost Dog Richard, Rolling Gorons, HBA 1000, Thawed Zora * Fixes most Event Chk Inf Checks on Check Tracker, and Frogs * Check Tracker - Song from Malon now works * Check Tracker - Fixes Claim Check check not tracking - Fixes spoiler for Claim Check check when getting Biggoron's Sword - Fixes LACS being spoiled and not tracking * Check Tracker - Fixes #2 for Skull Mask and Mask of Truth checks * Check Tracker - Adds support for merchants - Fixes #7 for Bomchu Salesman - Fixes #12 for Medigoron * Check Tracker - Fixes #8 for Song from Saria * Check Tracker - Fixes #9 for Adult Shooting Gallery * Check Tracker - Fixes #10 for Composer Grave * Check Tracker - Fixes #14 for Song from Ocarina of Time * Check Tracker - Fixes #16 for Shooting the Sun * Check Tracker - Fixes #19 for Darunia's Joy * Save Editor - Adds missing label for Treasure Chest Game * Check Tracker - Fixes Great Faries checks * Check Tracker - Fixes Sheik at Temple * Check Tracker - Fixes Great Fairy auto-scroll to wrong location * Check Tracker - Updates blue warp checks - Fixes Bongo Bongo and Twinrova checks * Check Tracker - Fixes Dampe's Gravedigging Tour * Check Tracker - Fixes Prescription to King Zora * Check Tracker - Fixes Bazaar showing under wrong area on tracker between adult/child * Check Tracker - Fixes scroll for Hyrule Market and Bazaar * Check Tracker - Fixes giving Adult Trade Items shown on tracker: Broken Sword, Saw, Cojiro, Eyeball Froge, and Eyedrops * Cleans up item_location * Check Tracker - Item List - Fixes item list not updating when changing seeds/options - Separates item exclusion list from item check list - Clean up comments * Check Tracker - Adds Skip functionality to buttons * Check Tracker - Refactors adult trade items to RandomizerInf * Check Tracker - Fixes an issue where any time an item is removed the tracker would cause an application crash * Check Tracker - Item names are now dependent on file language * Check Tracker - Fixes Gerudo Card check not showing in Fast setting * Reorders headers to (hopefully) avoid CI build conflicts on linux/consoles * Explicitly defines vector header in randomizer.h to fix compile errors * Complete Refactor of Check Tracker ImGui * Adds missing check tracker files to CMakeLists * Reverts the Item_location whitespace cleanup from ad10807c * Check Tracker - Loading Fixes - Fixes a bug where loading a save file a second time would add all the checks again - Fixes a bug where the check tracker would not render at all until in a save file * Check Tracker - Fixes a bug where checks would sometimes fail to load * Check Tracker - Fixes duplicated checks when using Only on Pause or Only on Combo * Check Tracker - Works around issue where single characters don't show in EnhancementCombobox, and fixes a label for combo buttons held option * Check Tracker - Applies all Check Tracker changes to Item Location * Check Tracker - Updated Check List - Adds Link's pocket, either in KF or HM depending on starting age - Supports Scrubs and Merchants - Uses enums instead of magic numbers - Updates DC Scrub Short Names for MQ * Check Tracker - Adds a performance mode option * Check Tracker - List Fixes (requires new rando generation) - Fixes Frogs Rupees always visible - Fixes Kokiri Sword Chest not showing - Fixes Weird Egg not showing * Check Tracker - MQ List basic support * Check Tracker - MQ/Vanilla anti-spoilers * Check Tracker - Collecting a compass now spoils the area * Check Tracker - Basic Vanilla Support and fixes - Vanilla items show in check tracker, even if many won't auto check - Fixes an issue with Gerudo Fortress Keys - Refactors IsVisibleInCheckTracker to randomizer_check_tracjer * Check Tracker - Fixes merge conflict from 08a487f35e1d760ab9e69b932edbe4da6bcd9edb * Check Tracker - Fixes tracker loading as Floating when default value is set to Windowed * Randomizer Location Exclusion List - Adds Scrubs, Merchants, Shops. Adult Trade items, MQ Dungeons, and Bean Salesman - Fixes Kokiri Sword Chest, Weird Egg, and Frog Song Rupees from misbehaving - Updates Gerudo Fortress logic to be dependent on Open/Fast/Normal Fortress - Removes Invalid Check - Adds RO Enum for MQ settings - Updates magic values to RO enum * Location Exclusion List - Scrubs that are always randomized now always show on the list * For now, removes some extra code only needed for a Check Tracker. * Randomizer Location Exclusion List - Fixes Eyeball Frog from showing up when Adult Trade Items was off * Location Tracker - Updates Eyedrops to use RandomizerInf instead of Chest * Check Tracker - Fixes a bug where Link's Pocket item wasn't acting as checked for area item count * Check Tracker - Fixes a bug where Locations would incorrectly say Vanilla due to the first check in the area being a non-MQ check * Check Tracker - Fixes a crash when Check Tracker is docked but not visible * Check Tracker - Fixes areas being spoiled when loading different save files * Check Tracker - Only reset variables if they are initialized * Check Tracker - Cleans up old comments, unused variables, methods, and macros, adds language TODOs, * Check Tracker - Readds rainbow UI elements after Cosmetics Editor refactor * Check Tracker - Removal of flag lookup that was refactored, no longer needed header, and some trivial whitespace fixes. * Check Tracker - Refactors Index to Bitmask code to a macro * Check Tracker - Changes ordering from alphabetical to RandomizerCheck ordering * Check Tracker - Wraps everything in a namespace to avoid global variable usage * Check Tracker - Explicitly defines for-loop scope * Check Tracker - refactors dungeon lookup from static array to function * Fixes a bug when using EnhancementColor with alpha * Check Tracker - Refactors all colour to use direct conversions * Check Tracker - refactors settings loading and check visibility for readability * Check Tracker - Fixes a bug where the wrong label showed on the Check Tracker BG Color * UIWidgets - Adds Alpha bar to EnhancementColor when using alpha parameter
2022-12-10 22:39:23 -05:00
OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_SHUFFLE_FROG_SONG_RUPEES) == RO_GENERIC_YES
: false;
showStartingMapsCompasses = IS_RANDO ?
Randomizer Auto Location tracker (#1942) * Initial Auto-Location Tracking * Updates styling for checked items in Check Tracker * Fixes crashing issues with Check Tracker rendering * Auto scroll Check Tracker windows to current area * Checks Tracker only shows checked locations once in game * Fixes issue where Check Tracker would auto-scroll to wrong location when entering a grotto * Fixes gerudo fortress checks showing in tracker when settings have them removed * InfTable Check Location Fixes: Lost Dog Richard, Rolling Gorons, HBA 1000, Thawed Zora * Fixes most Event Chk Inf Checks on Check Tracker, and Frogs * Check Tracker - Song from Malon now works * Check Tracker - Fixes Claim Check check not tracking - Fixes spoiler for Claim Check check when getting Biggoron's Sword - Fixes LACS being spoiled and not tracking * Check Tracker - Fixes #2 for Skull Mask and Mask of Truth checks * Check Tracker - Adds support for merchants - Fixes #7 for Bomchu Salesman - Fixes #12 for Medigoron * Check Tracker - Fixes #8 for Song from Saria * Check Tracker - Fixes #9 for Adult Shooting Gallery * Check Tracker - Fixes #10 for Composer Grave * Check Tracker - Fixes #14 for Song from Ocarina of Time * Check Tracker - Fixes #16 for Shooting the Sun * Check Tracker - Fixes #19 for Darunia's Joy * Save Editor - Adds missing label for Treasure Chest Game * Check Tracker - Fixes Great Faries checks * Check Tracker - Fixes Sheik at Temple * Check Tracker - Fixes Great Fairy auto-scroll to wrong location * Check Tracker - Updates blue warp checks - Fixes Bongo Bongo and Twinrova checks * Check Tracker - Fixes Dampe's Gravedigging Tour * Check Tracker - Fixes Prescription to King Zora * Check Tracker - Fixes Bazaar showing under wrong area on tracker between adult/child * Check Tracker - Fixes scroll for Hyrule Market and Bazaar * Check Tracker - Fixes giving Adult Trade Items shown on tracker: Broken Sword, Saw, Cojiro, Eyeball Froge, and Eyedrops * Cleans up item_location * Check Tracker - Item List - Fixes item list not updating when changing seeds/options - Separates item exclusion list from item check list - Clean up comments * Check Tracker - Adds Skip functionality to buttons * Check Tracker - Refactors adult trade items to RandomizerInf * Check Tracker - Fixes an issue where any time an item is removed the tracker would cause an application crash * Check Tracker - Item names are now dependent on file language * Check Tracker - Fixes Gerudo Card check not showing in Fast setting * Reorders headers to (hopefully) avoid CI build conflicts on linux/consoles * Explicitly defines vector header in randomizer.h to fix compile errors * Complete Refactor of Check Tracker ImGui * Adds missing check tracker files to CMakeLists * Reverts the Item_location whitespace cleanup from ad10807c * Check Tracker - Loading Fixes - Fixes a bug where loading a save file a second time would add all the checks again - Fixes a bug where the check tracker would not render at all until in a save file * Check Tracker - Fixes a bug where checks would sometimes fail to load * Check Tracker - Fixes duplicated checks when using Only on Pause or Only on Combo * Check Tracker - Works around issue where single characters don't show in EnhancementCombobox, and fixes a label for combo buttons held option * Check Tracker - Applies all Check Tracker changes to Item Location * Check Tracker - Updated Check List - Adds Link's pocket, either in KF or HM depending on starting age - Supports Scrubs and Merchants - Uses enums instead of magic numbers - Updates DC Scrub Short Names for MQ * Check Tracker - Adds a performance mode option * Check Tracker - List Fixes (requires new rando generation) - Fixes Frogs Rupees always visible - Fixes Kokiri Sword Chest not showing - Fixes Weird Egg not showing * Check Tracker - MQ List basic support * Check Tracker - MQ/Vanilla anti-spoilers * Check Tracker - Collecting a compass now spoils the area * Check Tracker - Basic Vanilla Support and fixes - Vanilla items show in check tracker, even if many won't auto check - Fixes an issue with Gerudo Fortress Keys - Refactors IsVisibleInCheckTracker to randomizer_check_tracjer * Check Tracker - Fixes merge conflict from 08a487f35e1d760ab9e69b932edbe4da6bcd9edb * Check Tracker - Fixes tracker loading as Floating when default value is set to Windowed * Randomizer Location Exclusion List - Adds Scrubs, Merchants, Shops. Adult Trade items, MQ Dungeons, and Bean Salesman - Fixes Kokiri Sword Chest, Weird Egg, and Frog Song Rupees from misbehaving - Updates Gerudo Fortress logic to be dependent on Open/Fast/Normal Fortress - Removes Invalid Check - Adds RO Enum for MQ settings - Updates magic values to RO enum * Location Exclusion List - Scrubs that are always randomized now always show on the list * For now, removes some extra code only needed for a Check Tracker. * Randomizer Location Exclusion List - Fixes Eyeball Frog from showing up when Adult Trade Items was off * Location Tracker - Updates Eyedrops to use RandomizerInf instead of Chest * Check Tracker - Fixes a bug where Link's Pocket item wasn't acting as checked for area item count * Check Tracker - Fixes a bug where Locations would incorrectly say Vanilla due to the first check in the area being a non-MQ check * Check Tracker - Fixes a crash when Check Tracker is docked but not visible * Check Tracker - Fixes areas being spoiled when loading different save files * Check Tracker - Only reset variables if they are initialized * Check Tracker - Cleans up old comments, unused variables, methods, and macros, adds language TODOs, * Check Tracker - Readds rainbow UI elements after Cosmetics Editor refactor * Check Tracker - Removal of flag lookup that was refactored, no longer needed header, and some trivial whitespace fixes. * Check Tracker - Refactors Index to Bitmask code to a macro * Check Tracker - Changes ordering from alphabetical to RandomizerCheck ordering * Check Tracker - Wraps everything in a namespace to avoid global variable usage * Check Tracker - Explicitly defines for-loop scope * Check Tracker - refactors dungeon lookup from static array to function * Fixes a bug when using EnhancementColor with alpha * Check Tracker - Refactors all colour to use direct conversions * Check Tracker - refactors settings loading and check visibility for readability * Check Tracker - Fixes a bug where the wrong label showed on the Check Tracker BG Color * UIWidgets - Adds Alpha bar to EnhancementColor when using alpha parameter
2022-12-10 22:39:23 -05:00
OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_STARTING_MAPS_COMPASSES) != RO_DUNGEON_ITEM_LOC_VANILLA
: false;
showKeysanity = IS_RANDO ?
Randomizer Auto Location tracker (#1942) * Initial Auto-Location Tracking * Updates styling for checked items in Check Tracker * Fixes crashing issues with Check Tracker rendering * Auto scroll Check Tracker windows to current area * Checks Tracker only shows checked locations once in game * Fixes issue where Check Tracker would auto-scroll to wrong location when entering a grotto * Fixes gerudo fortress checks showing in tracker when settings have them removed * InfTable Check Location Fixes: Lost Dog Richard, Rolling Gorons, HBA 1000, Thawed Zora * Fixes most Event Chk Inf Checks on Check Tracker, and Frogs * Check Tracker - Song from Malon now works * Check Tracker - Fixes Claim Check check not tracking - Fixes spoiler for Claim Check check when getting Biggoron's Sword - Fixes LACS being spoiled and not tracking * Check Tracker - Fixes #2 for Skull Mask and Mask of Truth checks * Check Tracker - Adds support for merchants - Fixes #7 for Bomchu Salesman - Fixes #12 for Medigoron * Check Tracker - Fixes #8 for Song from Saria * Check Tracker - Fixes #9 for Adult Shooting Gallery * Check Tracker - Fixes #10 for Composer Grave * Check Tracker - Fixes #14 for Song from Ocarina of Time * Check Tracker - Fixes #16 for Shooting the Sun * Check Tracker - Fixes #19 for Darunia's Joy * Save Editor - Adds missing label for Treasure Chest Game * Check Tracker - Fixes Great Faries checks * Check Tracker - Fixes Sheik at Temple * Check Tracker - Fixes Great Fairy auto-scroll to wrong location * Check Tracker - Updates blue warp checks - Fixes Bongo Bongo and Twinrova checks * Check Tracker - Fixes Dampe's Gravedigging Tour * Check Tracker - Fixes Prescription to King Zora * Check Tracker - Fixes Bazaar showing under wrong area on tracker between adult/child * Check Tracker - Fixes scroll for Hyrule Market and Bazaar * Check Tracker - Fixes giving Adult Trade Items shown on tracker: Broken Sword, Saw, Cojiro, Eyeball Froge, and Eyedrops * Cleans up item_location * Check Tracker - Item List - Fixes item list not updating when changing seeds/options - Separates item exclusion list from item check list - Clean up comments * Check Tracker - Adds Skip functionality to buttons * Check Tracker - Refactors adult trade items to RandomizerInf * Check Tracker - Fixes an issue where any time an item is removed the tracker would cause an application crash * Check Tracker - Item names are now dependent on file language * Check Tracker - Fixes Gerudo Card check not showing in Fast setting * Reorders headers to (hopefully) avoid CI build conflicts on linux/consoles * Explicitly defines vector header in randomizer.h to fix compile errors * Complete Refactor of Check Tracker ImGui * Adds missing check tracker files to CMakeLists * Reverts the Item_location whitespace cleanup from ad10807c * Check Tracker - Loading Fixes - Fixes a bug where loading a save file a second time would add all the checks again - Fixes a bug where the check tracker would not render at all until in a save file * Check Tracker - Fixes a bug where checks would sometimes fail to load * Check Tracker - Fixes duplicated checks when using Only on Pause or Only on Combo * Check Tracker - Works around issue where single characters don't show in EnhancementCombobox, and fixes a label for combo buttons held option * Check Tracker - Applies all Check Tracker changes to Item Location * Check Tracker - Updated Check List - Adds Link's pocket, either in KF or HM depending on starting age - Supports Scrubs and Merchants - Uses enums instead of magic numbers - Updates DC Scrub Short Names for MQ * Check Tracker - Adds a performance mode option * Check Tracker - List Fixes (requires new rando generation) - Fixes Frogs Rupees always visible - Fixes Kokiri Sword Chest not showing - Fixes Weird Egg not showing * Check Tracker - MQ List basic support * Check Tracker - MQ/Vanilla anti-spoilers * Check Tracker - Collecting a compass now spoils the area * Check Tracker - Basic Vanilla Support and fixes - Vanilla items show in check tracker, even if many won't auto check - Fixes an issue with Gerudo Fortress Keys - Refactors IsVisibleInCheckTracker to randomizer_check_tracjer * Check Tracker - Fixes merge conflict from 08a487f35e1d760ab9e69b932edbe4da6bcd9edb * Check Tracker - Fixes tracker loading as Floating when default value is set to Windowed * Randomizer Location Exclusion List - Adds Scrubs, Merchants, Shops. Adult Trade items, MQ Dungeons, and Bean Salesman - Fixes Kokiri Sword Chest, Weird Egg, and Frog Song Rupees from misbehaving - Updates Gerudo Fortress logic to be dependent on Open/Fast/Normal Fortress - Removes Invalid Check - Adds RO Enum for MQ settings - Updates magic values to RO enum * Location Exclusion List - Scrubs that are always randomized now always show on the list * For now, removes some extra code only needed for a Check Tracker. * Randomizer Location Exclusion List - Fixes Eyeball Frog from showing up when Adult Trade Items was off * Location Tracker - Updates Eyedrops to use RandomizerInf instead of Chest * Check Tracker - Fixes a bug where Link's Pocket item wasn't acting as checked for area item count * Check Tracker - Fixes a bug where Locations would incorrectly say Vanilla due to the first check in the area being a non-MQ check * Check Tracker - Fixes a crash when Check Tracker is docked but not visible * Check Tracker - Fixes areas being spoiled when loading different save files * Check Tracker - Only reset variables if they are initialized * Check Tracker - Cleans up old comments, unused variables, methods, and macros, adds language TODOs, * Check Tracker - Readds rainbow UI elements after Cosmetics Editor refactor * Check Tracker - Removal of flag lookup that was refactored, no longer needed header, and some trivial whitespace fixes. * Check Tracker - Refactors Index to Bitmask code to a macro * Check Tracker - Changes ordering from alphabetical to RandomizerCheck ordering * Check Tracker - Wraps everything in a namespace to avoid global variable usage * Check Tracker - Explicitly defines for-loop scope * Check Tracker - refactors dungeon lookup from static array to function * Fixes a bug when using EnhancementColor with alpha * Check Tracker - Refactors all colour to use direct conversions * Check Tracker - refactors settings loading and check visibility for readability * Check Tracker - Fixes a bug where the wrong label showed on the Check Tracker BG Color * UIWidgets - Adds Alpha bar to EnhancementColor when using alpha parameter
2022-12-10 22:39:23 -05:00
OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_KEYSANITY) != RO_DUNGEON_ITEM_LOC_VANILLA
: false;
showBossKeysanity = IS_RANDO ?
Randomizer Auto Location tracker (#1942) * Initial Auto-Location Tracking * Updates styling for checked items in Check Tracker * Fixes crashing issues with Check Tracker rendering * Auto scroll Check Tracker windows to current area * Checks Tracker only shows checked locations once in game * Fixes issue where Check Tracker would auto-scroll to wrong location when entering a grotto * Fixes gerudo fortress checks showing in tracker when settings have them removed * InfTable Check Location Fixes: Lost Dog Richard, Rolling Gorons, HBA 1000, Thawed Zora * Fixes most Event Chk Inf Checks on Check Tracker, and Frogs * Check Tracker - Song from Malon now works * Check Tracker - Fixes Claim Check check not tracking - Fixes spoiler for Claim Check check when getting Biggoron's Sword - Fixes LACS being spoiled and not tracking * Check Tracker - Fixes #2 for Skull Mask and Mask of Truth checks * Check Tracker - Adds support for merchants - Fixes #7 for Bomchu Salesman - Fixes #12 for Medigoron * Check Tracker - Fixes #8 for Song from Saria * Check Tracker - Fixes #9 for Adult Shooting Gallery * Check Tracker - Fixes #10 for Composer Grave * Check Tracker - Fixes #14 for Song from Ocarina of Time * Check Tracker - Fixes #16 for Shooting the Sun * Check Tracker - Fixes #19 for Darunia's Joy * Save Editor - Adds missing label for Treasure Chest Game * Check Tracker - Fixes Great Faries checks * Check Tracker - Fixes Sheik at Temple * Check Tracker - Fixes Great Fairy auto-scroll to wrong location * Check Tracker - Updates blue warp checks - Fixes Bongo Bongo and Twinrova checks * Check Tracker - Fixes Dampe's Gravedigging Tour * Check Tracker - Fixes Prescription to King Zora * Check Tracker - Fixes Bazaar showing under wrong area on tracker between adult/child * Check Tracker - Fixes scroll for Hyrule Market and Bazaar * Check Tracker - Fixes giving Adult Trade Items shown on tracker: Broken Sword, Saw, Cojiro, Eyeball Froge, and Eyedrops * Cleans up item_location * Check Tracker - Item List - Fixes item list not updating when changing seeds/options - Separates item exclusion list from item check list - Clean up comments * Check Tracker - Adds Skip functionality to buttons * Check Tracker - Refactors adult trade items to RandomizerInf * Check Tracker - Fixes an issue where any time an item is removed the tracker would cause an application crash * Check Tracker - Item names are now dependent on file language * Check Tracker - Fixes Gerudo Card check not showing in Fast setting * Reorders headers to (hopefully) avoid CI build conflicts on linux/consoles * Explicitly defines vector header in randomizer.h to fix compile errors * Complete Refactor of Check Tracker ImGui * Adds missing check tracker files to CMakeLists * Reverts the Item_location whitespace cleanup from ad10807c * Check Tracker - Loading Fixes - Fixes a bug where loading a save file a second time would add all the checks again - Fixes a bug where the check tracker would not render at all until in a save file * Check Tracker - Fixes a bug where checks would sometimes fail to load * Check Tracker - Fixes duplicated checks when using Only on Pause or Only on Combo * Check Tracker - Works around issue where single characters don't show in EnhancementCombobox, and fixes a label for combo buttons held option * Check Tracker - Applies all Check Tracker changes to Item Location * Check Tracker - Updated Check List - Adds Link's pocket, either in KF or HM depending on starting age - Supports Scrubs and Merchants - Uses enums instead of magic numbers - Updates DC Scrub Short Names for MQ * Check Tracker - Adds a performance mode option * Check Tracker - List Fixes (requires new rando generation) - Fixes Frogs Rupees always visible - Fixes Kokiri Sword Chest not showing - Fixes Weird Egg not showing * Check Tracker - MQ List basic support * Check Tracker - MQ/Vanilla anti-spoilers * Check Tracker - Collecting a compass now spoils the area * Check Tracker - Basic Vanilla Support and fixes - Vanilla items show in check tracker, even if many won't auto check - Fixes an issue with Gerudo Fortress Keys - Refactors IsVisibleInCheckTracker to randomizer_check_tracjer * Check Tracker - Fixes merge conflict from 08a487f35e1d760ab9e69b932edbe4da6bcd9edb * Check Tracker - Fixes tracker loading as Floating when default value is set to Windowed * Randomizer Location Exclusion List - Adds Scrubs, Merchants, Shops. Adult Trade items, MQ Dungeons, and Bean Salesman - Fixes Kokiri Sword Chest, Weird Egg, and Frog Song Rupees from misbehaving - Updates Gerudo Fortress logic to be dependent on Open/Fast/Normal Fortress - Removes Invalid Check - Adds RO Enum for MQ settings - Updates magic values to RO enum * Location Exclusion List - Scrubs that are always randomized now always show on the list * For now, removes some extra code only needed for a Check Tracker. * Randomizer Location Exclusion List - Fixes Eyeball Frog from showing up when Adult Trade Items was off * Location Tracker - Updates Eyedrops to use RandomizerInf instead of Chest * Check Tracker - Fixes a bug where Link's Pocket item wasn't acting as checked for area item count * Check Tracker - Fixes a bug where Locations would incorrectly say Vanilla due to the first check in the area being a non-MQ check * Check Tracker - Fixes a crash when Check Tracker is docked but not visible * Check Tracker - Fixes areas being spoiled when loading different save files * Check Tracker - Only reset variables if they are initialized * Check Tracker - Cleans up old comments, unused variables, methods, and macros, adds language TODOs, * Check Tracker - Readds rainbow UI elements after Cosmetics Editor refactor * Check Tracker - Removal of flag lookup that was refactored, no longer needed header, and some trivial whitespace fixes. * Check Tracker - Refactors Index to Bitmask code to a macro * Check Tracker - Changes ordering from alphabetical to RandomizerCheck ordering * Check Tracker - Wraps everything in a namespace to avoid global variable usage * Check Tracker - Explicitly defines for-loop scope * Check Tracker - refactors dungeon lookup from static array to function * Fixes a bug when using EnhancementColor with alpha * Check Tracker - Refactors all colour to use direct conversions * Check Tracker - refactors settings loading and check visibility for readability * Check Tracker - Fixes a bug where the wrong label showed on the Check Tracker BG Color * UIWidgets - Adds Alpha bar to EnhancementColor when using alpha parameter
2022-12-10 22:39:23 -05:00
OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_BOSS_KEYSANITY) != RO_DUNGEON_ITEM_LOC_VANILLA
: false;
showGerudoFortressKeys = IS_RANDO ?
Randomizer Auto Location tracker (#1942) * Initial Auto-Location Tracking * Updates styling for checked items in Check Tracker * Fixes crashing issues with Check Tracker rendering * Auto scroll Check Tracker windows to current area * Checks Tracker only shows checked locations once in game * Fixes issue where Check Tracker would auto-scroll to wrong location when entering a grotto * Fixes gerudo fortress checks showing in tracker when settings have them removed * InfTable Check Location Fixes: Lost Dog Richard, Rolling Gorons, HBA 1000, Thawed Zora * Fixes most Event Chk Inf Checks on Check Tracker, and Frogs * Check Tracker - Song from Malon now works * Check Tracker - Fixes Claim Check check not tracking - Fixes spoiler for Claim Check check when getting Biggoron's Sword - Fixes LACS being spoiled and not tracking * Check Tracker - Fixes #2 for Skull Mask and Mask of Truth checks * Check Tracker - Adds support for merchants - Fixes #7 for Bomchu Salesman - Fixes #12 for Medigoron * Check Tracker - Fixes #8 for Song from Saria * Check Tracker - Fixes #9 for Adult Shooting Gallery * Check Tracker - Fixes #10 for Composer Grave * Check Tracker - Fixes #14 for Song from Ocarina of Time * Check Tracker - Fixes #16 for Shooting the Sun * Check Tracker - Fixes #19 for Darunia's Joy * Save Editor - Adds missing label for Treasure Chest Game * Check Tracker - Fixes Great Faries checks * Check Tracker - Fixes Sheik at Temple * Check Tracker - Fixes Great Fairy auto-scroll to wrong location * Check Tracker - Updates blue warp checks - Fixes Bongo Bongo and Twinrova checks * Check Tracker - Fixes Dampe's Gravedigging Tour * Check Tracker - Fixes Prescription to King Zora * Check Tracker - Fixes Bazaar showing under wrong area on tracker between adult/child * Check Tracker - Fixes scroll for Hyrule Market and Bazaar * Check Tracker - Fixes giving Adult Trade Items shown on tracker: Broken Sword, Saw, Cojiro, Eyeball Froge, and Eyedrops * Cleans up item_location * Check Tracker - Item List - Fixes item list not updating when changing seeds/options - Separates item exclusion list from item check list - Clean up comments * Check Tracker - Adds Skip functionality to buttons * Check Tracker - Refactors adult trade items to RandomizerInf * Check Tracker - Fixes an issue where any time an item is removed the tracker would cause an application crash * Check Tracker - Item names are now dependent on file language * Check Tracker - Fixes Gerudo Card check not showing in Fast setting * Reorders headers to (hopefully) avoid CI build conflicts on linux/consoles * Explicitly defines vector header in randomizer.h to fix compile errors * Complete Refactor of Check Tracker ImGui * Adds missing check tracker files to CMakeLists * Reverts the Item_location whitespace cleanup from ad10807c * Check Tracker - Loading Fixes - Fixes a bug where loading a save file a second time would add all the checks again - Fixes a bug where the check tracker would not render at all until in a save file * Check Tracker - Fixes a bug where checks would sometimes fail to load * Check Tracker - Fixes duplicated checks when using Only on Pause or Only on Combo * Check Tracker - Works around issue where single characters don't show in EnhancementCombobox, and fixes a label for combo buttons held option * Check Tracker - Applies all Check Tracker changes to Item Location * Check Tracker - Updated Check List - Adds Link's pocket, either in KF or HM depending on starting age - Supports Scrubs and Merchants - Uses enums instead of magic numbers - Updates DC Scrub Short Names for MQ * Check Tracker - Adds a performance mode option * Check Tracker - List Fixes (requires new rando generation) - Fixes Frogs Rupees always visible - Fixes Kokiri Sword Chest not showing - Fixes Weird Egg not showing * Check Tracker - MQ List basic support * Check Tracker - MQ/Vanilla anti-spoilers * Check Tracker - Collecting a compass now spoils the area * Check Tracker - Basic Vanilla Support and fixes - Vanilla items show in check tracker, even if many won't auto check - Fixes an issue with Gerudo Fortress Keys - Refactors IsVisibleInCheckTracker to randomizer_check_tracjer * Check Tracker - Fixes merge conflict from 08a487f35e1d760ab9e69b932edbe4da6bcd9edb * Check Tracker - Fixes tracker loading as Floating when default value is set to Windowed * Randomizer Location Exclusion List - Adds Scrubs, Merchants, Shops. Adult Trade items, MQ Dungeons, and Bean Salesman - Fixes Kokiri Sword Chest, Weird Egg, and Frog Song Rupees from misbehaving - Updates Gerudo Fortress logic to be dependent on Open/Fast/Normal Fortress - Removes Invalid Check - Adds RO Enum for MQ settings - Updates magic values to RO enum * Location Exclusion List - Scrubs that are always randomized now always show on the list * For now, removes some extra code only needed for a Check Tracker. * Randomizer Location Exclusion List - Fixes Eyeball Frog from showing up when Adult Trade Items was off * Location Tracker - Updates Eyedrops to use RandomizerInf instead of Chest * Check Tracker - Fixes a bug where Link's Pocket item wasn't acting as checked for area item count * Check Tracker - Fixes a bug where Locations would incorrectly say Vanilla due to the first check in the area being a non-MQ check * Check Tracker - Fixes a crash when Check Tracker is docked but not visible * Check Tracker - Fixes areas being spoiled when loading different save files * Check Tracker - Only reset variables if they are initialized * Check Tracker - Cleans up old comments, unused variables, methods, and macros, adds language TODOs, * Check Tracker - Readds rainbow UI elements after Cosmetics Editor refactor * Check Tracker - Removal of flag lookup that was refactored, no longer needed header, and some trivial whitespace fixes. * Check Tracker - Refactors Index to Bitmask code to a macro * Check Tracker - Changes ordering from alphabetical to RandomizerCheck ordering * Check Tracker - Wraps everything in a namespace to avoid global variable usage * Check Tracker - Explicitly defines for-loop scope * Check Tracker - refactors dungeon lookup from static array to function * Fixes a bug when using EnhancementColor with alpha * Check Tracker - Refactors all colour to use direct conversions * Check Tracker - refactors settings loading and check visibility for readability * Check Tracker - Fixes a bug where the wrong label showed on the Check Tracker BG Color * UIWidgets - Adds Alpha bar to EnhancementColor when using alpha parameter
2022-12-10 22:39:23 -05:00
OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_GERUDO_KEYS) != RO_GERUDO_KEYS_VANILLA
: false;
showGanonBossKey = IS_RANDO ?
Randomizer Auto Location tracker (#1942) * Initial Auto-Location Tracking * Updates styling for checked items in Check Tracker * Fixes crashing issues with Check Tracker rendering * Auto scroll Check Tracker windows to current area * Checks Tracker only shows checked locations once in game * Fixes issue where Check Tracker would auto-scroll to wrong location when entering a grotto * Fixes gerudo fortress checks showing in tracker when settings have them removed * InfTable Check Location Fixes: Lost Dog Richard, Rolling Gorons, HBA 1000, Thawed Zora * Fixes most Event Chk Inf Checks on Check Tracker, and Frogs * Check Tracker - Song from Malon now works * Check Tracker - Fixes Claim Check check not tracking - Fixes spoiler for Claim Check check when getting Biggoron's Sword - Fixes LACS being spoiled and not tracking * Check Tracker - Fixes #2 for Skull Mask and Mask of Truth checks * Check Tracker - Adds support for merchants - Fixes #7 for Bomchu Salesman - Fixes #12 for Medigoron * Check Tracker - Fixes #8 for Song from Saria * Check Tracker - Fixes #9 for Adult Shooting Gallery * Check Tracker - Fixes #10 for Composer Grave * Check Tracker - Fixes #14 for Song from Ocarina of Time * Check Tracker - Fixes #16 for Shooting the Sun * Check Tracker - Fixes #19 for Darunia's Joy * Save Editor - Adds missing label for Treasure Chest Game * Check Tracker - Fixes Great Faries checks * Check Tracker - Fixes Sheik at Temple * Check Tracker - Fixes Great Fairy auto-scroll to wrong location * Check Tracker - Updates blue warp checks - Fixes Bongo Bongo and Twinrova checks * Check Tracker - Fixes Dampe's Gravedigging Tour * Check Tracker - Fixes Prescription to King Zora * Check Tracker - Fixes Bazaar showing under wrong area on tracker between adult/child * Check Tracker - Fixes scroll for Hyrule Market and Bazaar * Check Tracker - Fixes giving Adult Trade Items shown on tracker: Broken Sword, Saw, Cojiro, Eyeball Froge, and Eyedrops * Cleans up item_location * Check Tracker - Item List - Fixes item list not updating when changing seeds/options - Separates item exclusion list from item check list - Clean up comments * Check Tracker - Adds Skip functionality to buttons * Check Tracker - Refactors adult trade items to RandomizerInf * Check Tracker - Fixes an issue where any time an item is removed the tracker would cause an application crash * Check Tracker - Item names are now dependent on file language * Check Tracker - Fixes Gerudo Card check not showing in Fast setting * Reorders headers to (hopefully) avoid CI build conflicts on linux/consoles * Explicitly defines vector header in randomizer.h to fix compile errors * Complete Refactor of Check Tracker ImGui * Adds missing check tracker files to CMakeLists * Reverts the Item_location whitespace cleanup from ad10807c * Check Tracker - Loading Fixes - Fixes a bug where loading a save file a second time would add all the checks again - Fixes a bug where the check tracker would not render at all until in a save file * Check Tracker - Fixes a bug where checks would sometimes fail to load * Check Tracker - Fixes duplicated checks when using Only on Pause or Only on Combo * Check Tracker - Works around issue where single characters don't show in EnhancementCombobox, and fixes a label for combo buttons held option * Check Tracker - Applies all Check Tracker changes to Item Location * Check Tracker - Updated Check List - Adds Link's pocket, either in KF or HM depending on starting age - Supports Scrubs and Merchants - Uses enums instead of magic numbers - Updates DC Scrub Short Names for MQ * Check Tracker - Adds a performance mode option * Check Tracker - List Fixes (requires new rando generation) - Fixes Frogs Rupees always visible - Fixes Kokiri Sword Chest not showing - Fixes Weird Egg not showing * Check Tracker - MQ List basic support * Check Tracker - MQ/Vanilla anti-spoilers * Check Tracker - Collecting a compass now spoils the area * Check Tracker - Basic Vanilla Support and fixes - Vanilla items show in check tracker, even if many won't auto check - Fixes an issue with Gerudo Fortress Keys - Refactors IsVisibleInCheckTracker to randomizer_check_tracjer * Check Tracker - Fixes merge conflict from 08a487f35e1d760ab9e69b932edbe4da6bcd9edb * Check Tracker - Fixes tracker loading as Floating when default value is set to Windowed * Randomizer Location Exclusion List - Adds Scrubs, Merchants, Shops. Adult Trade items, MQ Dungeons, and Bean Salesman - Fixes Kokiri Sword Chest, Weird Egg, and Frog Song Rupees from misbehaving - Updates Gerudo Fortress logic to be dependent on Open/Fast/Normal Fortress - Removes Invalid Check - Adds RO Enum for MQ settings - Updates magic values to RO enum * Location Exclusion List - Scrubs that are always randomized now always show on the list * For now, removes some extra code only needed for a Check Tracker. * Randomizer Location Exclusion List - Fixes Eyeball Frog from showing up when Adult Trade Items was off * Location Tracker - Updates Eyedrops to use RandomizerInf instead of Chest * Check Tracker - Fixes a bug where Link's Pocket item wasn't acting as checked for area item count * Check Tracker - Fixes a bug where Locations would incorrectly say Vanilla due to the first check in the area being a non-MQ check * Check Tracker - Fixes a crash when Check Tracker is docked but not visible * Check Tracker - Fixes areas being spoiled when loading different save files * Check Tracker - Only reset variables if they are initialized * Check Tracker - Cleans up old comments, unused variables, methods, and macros, adds language TODOs, * Check Tracker - Readds rainbow UI elements after Cosmetics Editor refactor * Check Tracker - Removal of flag lookup that was refactored, no longer needed header, and some trivial whitespace fixes. * Check Tracker - Refactors Index to Bitmask code to a macro * Check Tracker - Changes ordering from alphabetical to RandomizerCheck ordering * Check Tracker - Wraps everything in a namespace to avoid global variable usage * Check Tracker - Explicitly defines for-loop scope * Check Tracker - refactors dungeon lookup from static array to function * Fixes a bug when using EnhancementColor with alpha * Check Tracker - Refactors all colour to use direct conversions * Check Tracker - refactors settings loading and check visibility for readability * Check Tracker - Fixes a bug where the wrong label showed on the Check Tracker BG Color * UIWidgets - Adds Alpha bar to EnhancementColor when using alpha parameter
2022-12-10 22:39:23 -05:00
OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_GANONS_BOSS_KEY) != RO_GANON_BOSS_KEY_VANILLA
: false;
showOcarinas = IS_RANDO ?
OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_SHUFFLE_OCARINA) == RO_GENERIC_YES
: false;
show100SkullReward = IS_RANDO ?
OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_SHUFFLE_100_GS_REWARD) == RO_GENERIC_YES
: false;
Check Tracker Update (#2668) * Initial commit. What works so far: Data file loads, saves, deletes, and is created properly. - Need to run `HasItemBeenCollected` when creating in case of mid-seed regen. Organized checks into maps set by area. Areas show in tracker. - Checks pulled from checkObjectsByArea are not currently listed. - Areas are being assumed completed and hidden at the start. * Checks now populate. Still not counting area totals properly. * Don't track RC_LINKS_POCKET in the data file, and instead manually add it in every time a save is load. rcObjects doesn't contain Link's Pocket location (duh). * Moved ItemReceive hook to randomizer_check_tracker.cpp. Skipped items are properly sorted and formatted. Saved items contribute to an area's gotten/skipped checks on load. Changed skipped items default main color to gray. General code cleanup. * Skipped checks now contribute to area totals for area completion logic. * Mid-menu rework transfer. * Started check lookup on item receive. Tried to enable scum checking on save. * Fixed scum check on save. * More code cleanup, which revealed some issues with loading and saving. Loading now works 100%, but entries in checkTrackerData are disappearing in code somewhere, causing issues with later checks. Scummed color now displays properly. Collected but unsaved displays properly. Unchecked, Skipped, Seen and Scummed checks all have arrows for skipping/unskipping. Counts a little messed up, probably double adding skips. * Fixed item counts being off across resets. Restarts were fine. * Beginning of rework for individual check updates. Adds `Actor lastCheck` to PlayState to allow assigning of last actor to give an item. This allows precise tracking of GS, freestanding PoH, etc. Works for chests too. Currently does not work for shops, unknown for normal NPC gives. Doesn't track last gives for non-checks, like drops from grass, pots, crates, etc. * Actor-based checks fully fleshed out, but can't help with sale-based checks. Implemented `pendingSaleCheck` to back out of an RC check cycle if `gSaveContext->pendingSale` is not NONE when `OnItemReceive` is called, processed through `OnSaleEnd`. This should be the final change necessary to streamline the checks. * Temporary hook to message box close to tie in trackers for non-gs/chest actors that aren't added to `GetCheckFromActor`. This triggers a 2-frame countdown to check with `HasItemBeenCollected` since half of the methods in there aren't updated until after a text box closes. Added scene tracking to get last scene so that checks in scenes that span several overworld areas could be tied to their areas properly. Modified tracker data creation to apply Link's Pocket and Song from Impa conditionally based on randomizer settings instead of just being assumed to be done. May need modification for checking click and drag spoiler loading. Removed the scene equivalence check from CheckChecks so that an entire area is checked each time to avoid issues with, e.g., leaving a shop before a pending sale finishes. * Changed check data creation to use RSKs from gRandomizer to account for settings loaded from drag and drop spoilers. * Beginning of tracker code organization. Changed check color defaults. * Reverted moving tracker colors to header. Some individual check fixes. * Missed something from previous merge? * Removed last remnant of removed performance mode. * Better handle checking when skullsanity is off. * Song checks sceneIDs don't match the scenes they're actually in for some reason. Removed that check. * SaleEnd checks don't need the GetItemEntry parameter. Also set a flag that should prevent the check tracker from running during vanilla saves should that not be resolved by the time it's merged. * Attempting to have only the relevant checks added to the tracker data, as well as showing vanilla checks for non-rando saves. Not working yet (everything is displayed in vanilla). * Added vanilla check tracker population via `vanillaCheck` bool in `RandomizerCheckObject`. This is also added to `IsVisibleInImGui` to handle file loading and saving to eliminate checks that aren't part of vanilla or the rando seed. Implemented deleted tracker data file recreation. Added some extra item name text checks. Songs are still... tricky, so they stay blank. Utilize local copies of the randomizer check objects that are applicable for performance purposes. Fixed vanilla item-giving cutscene crashes when triggered mid-transition. * Apparently not all toolchains can handle macro instantiation without all parameters, like VS can. * Fixed scummed detail color not showing properly on tracker. * Fixed dungeon area totals and GS checks not functioning properly. * Major revamp of checking code. Doesn't rely on `GetCheckFromActor` at all anymore, but instead simply sets a flag to evaluate a number of checks in an area every frame until the check that was gotten is identified. With the new setup, it's much less hardware intensive, and at 60fps 6 checks per frame shows no noticeable effect on framerate. I can envision needing to add a collectedCount in order to account for times when two checks are gotten one right after the other. Changed area scroll to happen from `OnTransitionEnd`, and allow for scrolling in bazaar (was disabled previously because it would jump back and forth between Kak and Market while you were in one). Also setup area check order updating by area instead of all at the same time. * Fixed shooting gallery not reporting proper area. Prevent checks from actually happening if area is RCAREA_INVALID, now that all areas are reporting something if they have checks. Fixed `GetCheckArea()` not updating checks for standard scenes. Lots of vanilla tracking updates, mainly manual checks for gems, medallions and songs, since the often don't have proper scenes in the data. Prevent vanilla from triggering check loops if junk items are collected. Fixed sorting based on saved vs collected. Prevent item name display for vanilla runs. Change coloring of checks so the check name reflects status in vanilla runs. * Fixed "Recheck Area" button erroneously adding to an area's check totals? * Fix DMC vanilla checks. * Fix check tracker data recreation on data file loss. Removed redundant file exists check from SaveTrackerDataHook, as it doesn't matter if it exists or not at that point. Limited check loops to 3 to avoid infinite check loops on non-check/junk item pickup. Added more checks to disable tracker operations if a save is not running. Changed check ordering to put boss reward and heart container checks at the end of whatever RCSHOW group they belong to. * Fixed IsRunning calculation. Further improving vanilla checking. Starting framework for checking medallions, stones, and songs on data file recreation. Fixed medallion check collection. Added GIFT_FROM_SAGES to check list for vanilla file for tracking light medallion. Added check loop limitation to prevent infinite checking after picking up junk item from the ground. * Finished vanilla file recreation and recheck (songs and dungeon rewards all check properly now). This includes deku shield with KF shop item 3. Finished Gift from Raoru light medallion tracking for vanilla. Commented all CheckByScene functionality for now. * Fixed new save data file creation. Disabled entrance area calculation for now, as it only tracks the previous entrance for some reason. Fixed area detection for ToT checks. * GetCheckArea() now utilizes EntranceData almost exclusively, via either `gSaveContext.entranceIndex` or the entrance tracker's `currentGrottoId` in the case of grottos. This also means that EVERYTHING CAN AUTOSCROLL NOW. Entrance shuffles are now much easier to track. Autoscroll is now also triggered on save, just in case someone isn't autosaving and has a lot of checks that get converted to saved. * Fixed missing GS check in LW. * Added area scroll on toggling Show Hidden Items. May configure differently later. Fixed area detection for entrances in Gerudo Fortress/Valley and Collossus. Haunted wasteland doesn't autoscroll due to a bug in `OnTransitionEnd` hook, but checks still evaluate properly there. Rely on scene-based area detection if scene is a main overworld or dungeon scene. * Fixed grotto detection when shuffle is off. * Small code cleanup. Fixed Colossus hand chest checks. * Missing lus bump from merge conflict resolution * Fixed Colossus Grotto making `GetCheckArea` return Wasteland. * Improved OnItemReceive processing for non-token GS checks, since they can sometimes take long enough for the checking process to time out before the item is registered as received. * First attempt at thread safety for tracker data file writing. Seems to work, but might need more testing. * Fixed Recheck Area not unskipping items that register as saved. Improved delayed saving with autosaving, as the autosave triggered quite often before the tracker data save, making things not properly register as saved. * merge cleanup * Converted check tracker data to the sectional saves, adding `CheckTrackerData` to `SaveContext`. Implemented section ID returning and fullSave boolean passing to section functions from my PR temporarily for it to work properly. Moved `RandomizerCheckTrackerData` enum to `randomizerTypes.h` to accommodate that. Changed `Randomizer_SaveInit` to a `SaveManager::InitFunc` to allow for other randomizer-dependent sections to be initialized after that. Required a little refactoring to maintain intro cutscene skip when starting a randomizer file. * Revert section index return and randomizer init changes. Will need to wait on yet more changes to main. * Fixed check tracker initialization (shouldn't be tied to window initialization), restored saving/loading functionality. * Removed `CheckTracker::Init` and put SaveManager calls in `CheckTrackerWindow::InitElement`. Also a bit of cleanup from transition back to save file use. * Fixed tracker displaying check categories while file not loaded. * Fix Darunia's Joy check not marking in vanilla. * Fix autosave not triggering change from collected to saved in tracker data. * Changed default colors for scummed and collected display. * Merge upgrade code cleanup. * Add `OnTransitionEnd` calls to sandstorm transitions both to and from Wasteland. Also improved `gSaveContext.lastScene` assignment for both transition types. Allowed a bit of cleanup in `GetCheckArea`. * Added `StateButton`, a button like `ArrowButton` but that allows text instead of arrow icons. Apparently the changes from ArrowButton to StateButton happened in a previous commit... * Changed section name to `trackerDataCheck` to force SoH to load it after the randomizer section, as it required some randoSettings to be loaded first, and nothing else I tried to make the randomizer section load before it worked. This hacks a solution to checks not displaying on fast file load to a specific slot. F*** you, SaveManager, and f*** you too, JSON. * Forgot to change the section string for loading with the name change. * Fix check ordering for checks that trigger the autosave. * Adds option to remove right-side shop items (slots 1-4) from the tracker list. Enabled by default. * Fix default state of Hide Shop Right Checks checkbox. * Fixes grotto and great fairy scrolling and checks. Fixes array overflow from `checkTrackerData` which was creating the issue trying to load the base and randomizer sections first, among other things. That also fixed the massive file loads that were being exhibited in debug mode. * Fix shooting galleries being set as collected again when being played a second time after getting the checks. * Fix Bazaar autoscroll. * Add Saria's Song to `GetCheckFromActor` and removed some limitations from the messageCloseCheck function to make that check track properly. * Fix Song from Impa check. Implemented prevention for multiple "collections" of great fairies, just in case getting the health refill would trigger it with the previous setup. * Fix ice traps on GS tokens not triggering OnItemReceive. * Complete fix for ice trap collection from GS. Add autoscroll when clicking "Expand All". * Add `OnShopSlotChange` with cursorSlot and basePrice parameters. * Fixed include in en_ossan for shop slot hook. Added registration for `OnShopSlotChange` in the tracker, storing the price in a new `price` field in `CheckTrackerData`. Added "seen" functionality to shop checks. Displays the model item name upon first entering a shop, adding the price and switching to trickName (if it's an ice trap) upon navigating to the slot in buy mode, triggered by an invisible "identified" status that mirrors "seen" in every other way. Added tooltips to most options for check tracker color picking to describe what each status actually means. * `std::format` pls * So apparently std::format just decided to break with the latest merge from develop, but fmt::format exists and works? * Removed the last vestiges of `locationsSkipped`. Other general code and formatting cleanups. Moved `IsGameRunning` to `OTRGlobals` so the item tracker could also access it. Used preceding to "fix" item and bottle display in the item tracker on startup. * Some more code cleanup. Removed "Recheck Area" button and relevant code. Backported changes to Anchor branch applicable for single-player, including making a checkAreas vector and structuring the frame by frame checks around that. Also includes fix for Silver Gauntlets and Mirror Shield check collection crash associated with those changes. Fixed Kakariko Bazaar "seen" updates. Fixed tracker window not showing on initial load like it should. * Forgot 1 formatting fix. * Removed conditions for showing Song from Impa (isn't junk under certain conditions, so should show all the time). * Fix vanilla checks, add Zelda's Letter and Malon's Egg to manual check collection. Fix autoscroll while in child stealth section. * Fix crash in Happy Mask Shop in OnSlotChange (referenced non-existent shop id in a tracker-specific enum). * General code cleanup. * Missed one reversion. * One more. * Fix column alignment in `randomizer_check_objects`. * Fix file encoding on `randomizer_check_tracker`. Again. * Fix indentation for `actualItemtrackerItemMap`. Also removed unnecessary parts of the map. * Rename `HasEqItem` to `HasEquipment`. * Slightly better indentation for `actualItemTrackerItemMap`. * Add magic bean salesman to vanilla check tracking, and genericized deku shield to trigger KF shop item 3 wherever you get the shield. Renamed `vanillaCheck` to `vanillaHundoCheck` to (supposedly) clarify the meaning of the usage. * One more rename to `vanillaCompletion` to avoid possible confusion with 100% speedrun conditions. * give me a break XD Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * Changes suggested by briaguya (rename `RandomizerCheckShow` to `Status`, unused code, newline formatting) * Remove unused `itemNames` table. * Remove `IsGameRunning` in favor of `GameInteractor::IsSaveLoaded`. * Restore anti-spoiler functionality for dungeons with dungeon maps. * Review cleanup. * Fix prices not showing for Kak bazaar items. --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com>
2023-10-04 11:03:36 -04:00
showLinksPocket = IS_RANDO ? // don't show Link's Pocket if not randomizer, or if rando and pocket is disabled
OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_LINKS_POCKET) != RO_LINKS_POCKET_NOTHING
:false;
Randomizer Auto Location tracker (#1942) * Initial Auto-Location Tracking * Updates styling for checked items in Check Tracker * Fixes crashing issues with Check Tracker rendering * Auto scroll Check Tracker windows to current area * Checks Tracker only shows checked locations once in game * Fixes issue where Check Tracker would auto-scroll to wrong location when entering a grotto * Fixes gerudo fortress checks showing in tracker when settings have them removed * InfTable Check Location Fixes: Lost Dog Richard, Rolling Gorons, HBA 1000, Thawed Zora * Fixes most Event Chk Inf Checks on Check Tracker, and Frogs * Check Tracker - Song from Malon now works * Check Tracker - Fixes Claim Check check not tracking - Fixes spoiler for Claim Check check when getting Biggoron's Sword - Fixes LACS being spoiled and not tracking * Check Tracker - Fixes #2 for Skull Mask and Mask of Truth checks * Check Tracker - Adds support for merchants - Fixes #7 for Bomchu Salesman - Fixes #12 for Medigoron * Check Tracker - Fixes #8 for Song from Saria * Check Tracker - Fixes #9 for Adult Shooting Gallery * Check Tracker - Fixes #10 for Composer Grave * Check Tracker - Fixes #14 for Song from Ocarina of Time * Check Tracker - Fixes #16 for Shooting the Sun * Check Tracker - Fixes #19 for Darunia's Joy * Save Editor - Adds missing label for Treasure Chest Game * Check Tracker - Fixes Great Faries checks * Check Tracker - Fixes Sheik at Temple * Check Tracker - Fixes Great Fairy auto-scroll to wrong location * Check Tracker - Updates blue warp checks - Fixes Bongo Bongo and Twinrova checks * Check Tracker - Fixes Dampe's Gravedigging Tour * Check Tracker - Fixes Prescription to King Zora * Check Tracker - Fixes Bazaar showing under wrong area on tracker between adult/child * Check Tracker - Fixes scroll for Hyrule Market and Bazaar * Check Tracker - Fixes giving Adult Trade Items shown on tracker: Broken Sword, Saw, Cojiro, Eyeball Froge, and Eyedrops * Cleans up item_location * Check Tracker - Item List - Fixes item list not updating when changing seeds/options - Separates item exclusion list from item check list - Clean up comments * Check Tracker - Adds Skip functionality to buttons * Check Tracker - Refactors adult trade items to RandomizerInf * Check Tracker - Fixes an issue where any time an item is removed the tracker would cause an application crash * Check Tracker - Item names are now dependent on file language * Check Tracker - Fixes Gerudo Card check not showing in Fast setting * Reorders headers to (hopefully) avoid CI build conflicts on linux/consoles * Explicitly defines vector header in randomizer.h to fix compile errors * Complete Refactor of Check Tracker ImGui * Adds missing check tracker files to CMakeLists * Reverts the Item_location whitespace cleanup from ad10807c * Check Tracker - Loading Fixes - Fixes a bug where loading a save file a second time would add all the checks again - Fixes a bug where the check tracker would not render at all until in a save file * Check Tracker - Fixes a bug where checks would sometimes fail to load * Check Tracker - Fixes duplicated checks when using Only on Pause or Only on Combo * Check Tracker - Works around issue where single characters don't show in EnhancementCombobox, and fixes a label for combo buttons held option * Check Tracker - Applies all Check Tracker changes to Item Location * Check Tracker - Updated Check List - Adds Link's pocket, either in KF or HM depending on starting age - Supports Scrubs and Merchants - Uses enums instead of magic numbers - Updates DC Scrub Short Names for MQ * Check Tracker - Adds a performance mode option * Check Tracker - List Fixes (requires new rando generation) - Fixes Frogs Rupees always visible - Fixes Kokiri Sword Chest not showing - Fixes Weird Egg not showing * Check Tracker - MQ List basic support * Check Tracker - MQ/Vanilla anti-spoilers * Check Tracker - Collecting a compass now spoils the area * Check Tracker - Basic Vanilla Support and fixes - Vanilla items show in check tracker, even if many won't auto check - Fixes an issue with Gerudo Fortress Keys - Refactors IsVisibleInCheckTracker to randomizer_check_tracjer * Check Tracker - Fixes merge conflict from 08a487f35e1d760ab9e69b932edbe4da6bcd9edb * Check Tracker - Fixes tracker loading as Floating when default value is set to Windowed * Randomizer Location Exclusion List - Adds Scrubs, Merchants, Shops. Adult Trade items, MQ Dungeons, and Bean Salesman - Fixes Kokiri Sword Chest, Weird Egg, and Frog Song Rupees from misbehaving - Updates Gerudo Fortress logic to be dependent on Open/Fast/Normal Fortress - Removes Invalid Check - Adds RO Enum for MQ settings - Updates magic values to RO enum * Location Exclusion List - Scrubs that are always randomized now always show on the list * For now, removes some extra code only needed for a Check Tracker. * Randomizer Location Exclusion List - Fixes Eyeball Frog from showing up when Adult Trade Items was off * Location Tracker - Updates Eyedrops to use RandomizerInf instead of Chest * Check Tracker - Fixes a bug where Link's Pocket item wasn't acting as checked for area item count * Check Tracker - Fixes a bug where Locations would incorrectly say Vanilla due to the first check in the area being a non-MQ check * Check Tracker - Fixes a crash when Check Tracker is docked but not visible * Check Tracker - Fixes areas being spoiled when loading different save files * Check Tracker - Only reset variables if they are initialized * Check Tracker - Cleans up old comments, unused variables, methods, and macros, adds language TODOs, * Check Tracker - Readds rainbow UI elements after Cosmetics Editor refactor * Check Tracker - Removal of flag lookup that was refactored, no longer needed header, and some trivial whitespace fixes. * Check Tracker - Refactors Index to Bitmask code to a macro * Check Tracker - Changes ordering from alphabetical to RandomizerCheck ordering * Check Tracker - Wraps everything in a namespace to avoid global variable usage * Check Tracker - Explicitly defines for-loop scope * Check Tracker - refactors dungeon lookup from static array to function * Fixes a bug when using EnhancementColor with alpha * Check Tracker - Refactors all colour to use direct conversions * Check Tracker - refactors settings loading and check visibility for readability * Check Tracker - Fixes a bug where the wrong label showed on the Check Tracker BG Color * UIWidgets - Adds Alpha bar to EnhancementColor when using alpha parameter
2022-12-10 22:39:23 -05:00
if (IS_RANDO) {
Randomizer Auto Location tracker (#1942) * Initial Auto-Location Tracking * Updates styling for checked items in Check Tracker * Fixes crashing issues with Check Tracker rendering * Auto scroll Check Tracker windows to current area * Checks Tracker only shows checked locations once in game * Fixes issue where Check Tracker would auto-scroll to wrong location when entering a grotto * Fixes gerudo fortress checks showing in tracker when settings have them removed * InfTable Check Location Fixes: Lost Dog Richard, Rolling Gorons, HBA 1000, Thawed Zora * Fixes most Event Chk Inf Checks on Check Tracker, and Frogs * Check Tracker - Song from Malon now works * Check Tracker - Fixes Claim Check check not tracking - Fixes spoiler for Claim Check check when getting Biggoron's Sword - Fixes LACS being spoiled and not tracking * Check Tracker - Fixes #2 for Skull Mask and Mask of Truth checks * Check Tracker - Adds support for merchants - Fixes #7 for Bomchu Salesman - Fixes #12 for Medigoron * Check Tracker - Fixes #8 for Song from Saria * Check Tracker - Fixes #9 for Adult Shooting Gallery * Check Tracker - Fixes #10 for Composer Grave * Check Tracker - Fixes #14 for Song from Ocarina of Time * Check Tracker - Fixes #16 for Shooting the Sun * Check Tracker - Fixes #19 for Darunia's Joy * Save Editor - Adds missing label for Treasure Chest Game * Check Tracker - Fixes Great Faries checks * Check Tracker - Fixes Sheik at Temple * Check Tracker - Fixes Great Fairy auto-scroll to wrong location * Check Tracker - Updates blue warp checks - Fixes Bongo Bongo and Twinrova checks * Check Tracker - Fixes Dampe's Gravedigging Tour * Check Tracker - Fixes Prescription to King Zora * Check Tracker - Fixes Bazaar showing under wrong area on tracker between adult/child * Check Tracker - Fixes scroll for Hyrule Market and Bazaar * Check Tracker - Fixes giving Adult Trade Items shown on tracker: Broken Sword, Saw, Cojiro, Eyeball Froge, and Eyedrops * Cleans up item_location * Check Tracker - Item List - Fixes item list not updating when changing seeds/options - Separates item exclusion list from item check list - Clean up comments * Check Tracker - Adds Skip functionality to buttons * Check Tracker - Refactors adult trade items to RandomizerInf * Check Tracker - Fixes an issue where any time an item is removed the tracker would cause an application crash * Check Tracker - Item names are now dependent on file language * Check Tracker - Fixes Gerudo Card check not showing in Fast setting * Reorders headers to (hopefully) avoid CI build conflicts on linux/consoles * Explicitly defines vector header in randomizer.h to fix compile errors * Complete Refactor of Check Tracker ImGui * Adds missing check tracker files to CMakeLists * Reverts the Item_location whitespace cleanup from ad10807c * Check Tracker - Loading Fixes - Fixes a bug where loading a save file a second time would add all the checks again - Fixes a bug where the check tracker would not render at all until in a save file * Check Tracker - Fixes a bug where checks would sometimes fail to load * Check Tracker - Fixes duplicated checks when using Only on Pause or Only on Combo * Check Tracker - Works around issue where single characters don't show in EnhancementCombobox, and fixes a label for combo buttons held option * Check Tracker - Applies all Check Tracker changes to Item Location * Check Tracker - Updated Check List - Adds Link's pocket, either in KF or HM depending on starting age - Supports Scrubs and Merchants - Uses enums instead of magic numbers - Updates DC Scrub Short Names for MQ * Check Tracker - Adds a performance mode option * Check Tracker - List Fixes (requires new rando generation) - Fixes Frogs Rupees always visible - Fixes Kokiri Sword Chest not showing - Fixes Weird Egg not showing * Check Tracker - MQ List basic support * Check Tracker - MQ/Vanilla anti-spoilers * Check Tracker - Collecting a compass now spoils the area * Check Tracker - Basic Vanilla Support and fixes - Vanilla items show in check tracker, even if many won't auto check - Fixes an issue with Gerudo Fortress Keys - Refactors IsVisibleInCheckTracker to randomizer_check_tracjer * Check Tracker - Fixes merge conflict from 08a487f35e1d760ab9e69b932edbe4da6bcd9edb * Check Tracker - Fixes tracker loading as Floating when default value is set to Windowed * Randomizer Location Exclusion List - Adds Scrubs, Merchants, Shops. Adult Trade items, MQ Dungeons, and Bean Salesman - Fixes Kokiri Sword Chest, Weird Egg, and Frog Song Rupees from misbehaving - Updates Gerudo Fortress logic to be dependent on Open/Fast/Normal Fortress - Removes Invalid Check - Adds RO Enum for MQ settings - Updates magic values to RO enum * Location Exclusion List - Scrubs that are always randomized now always show on the list * For now, removes some extra code only needed for a Check Tracker. * Randomizer Location Exclusion List - Fixes Eyeball Frog from showing up when Adult Trade Items was off * Location Tracker - Updates Eyedrops to use RandomizerInf instead of Chest * Check Tracker - Fixes a bug where Link's Pocket item wasn't acting as checked for area item count * Check Tracker - Fixes a bug where Locations would incorrectly say Vanilla due to the first check in the area being a non-MQ check * Check Tracker - Fixes a crash when Check Tracker is docked but not visible * Check Tracker - Fixes areas being spoiled when loading different save files * Check Tracker - Only reset variables if they are initialized * Check Tracker - Cleans up old comments, unused variables, methods, and macros, adds language TODOs, * Check Tracker - Readds rainbow UI elements after Cosmetics Editor refactor * Check Tracker - Removal of flag lookup that was refactored, no longer needed header, and some trivial whitespace fixes. * Check Tracker - Refactors Index to Bitmask code to a macro * Check Tracker - Changes ordering from alphabetical to RandomizerCheck ordering * Check Tracker - Wraps everything in a namespace to avoid global variable usage * Check Tracker - Explicitly defines for-loop scope * Check Tracker - refactors dungeon lookup from static array to function * Fixes a bug when using EnhancementColor with alpha * Check Tracker - Refactors all colour to use direct conversions * Check Tracker - refactors settings loading and check visibility for readability * Check Tracker - Fixes a bug where the wrong label showed on the Check Tracker BG Color * UIWidgets - Adds Alpha bar to EnhancementColor when using alpha parameter
2022-12-10 22:39:23 -05:00
switch (OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_SHUFFLE_TOKENS)) {
case RO_TOKENSANITY_ALL:
showOverworldTokens = true;
showDungeonTokens = true;
break;
case RO_TOKENSANITY_OVERWORLD:
showOverworldTokens = true;
showDungeonTokens = false;
break;
case RO_TOKENSANITY_DUNGEONS:
showOverworldTokens = false;
showDungeonTokens = true;
break;
default:
showOverworldTokens = false;
showDungeonTokens = false;
break;
}
} else { // Vanilla
showOverworldTokens = true;
showDungeonTokens = true;
}
fortressFast = false;
fortressNormal = false;
switch (OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_GERUDO_FORTRESS)) {
case RO_GF_OPEN:
showGerudoFortressKeys = false;
showGerudoCard = false;
break;
case RO_GF_FAST:
fortressFast = true;
break;
case RO_GF_NORMAL:
fortressNormal = true;
break;
}
}
bool IsVisibleInCheckTracker(RandomizerCheckObject rcObj) {
2023-12-04 12:29:48 -05:00
if (IS_RANDO && OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_LOGIC_RULES) != RO_LOGIC_VANILLA) {
Check Tracker Update (#2668) * Initial commit. What works so far: Data file loads, saves, deletes, and is created properly. - Need to run `HasItemBeenCollected` when creating in case of mid-seed regen. Organized checks into maps set by area. Areas show in tracker. - Checks pulled from checkObjectsByArea are not currently listed. - Areas are being assumed completed and hidden at the start. * Checks now populate. Still not counting area totals properly. * Don't track RC_LINKS_POCKET in the data file, and instead manually add it in every time a save is load. rcObjects doesn't contain Link's Pocket location (duh). * Moved ItemReceive hook to randomizer_check_tracker.cpp. Skipped items are properly sorted and formatted. Saved items contribute to an area's gotten/skipped checks on load. Changed skipped items default main color to gray. General code cleanup. * Skipped checks now contribute to area totals for area completion logic. * Mid-menu rework transfer. * Started check lookup on item receive. Tried to enable scum checking on save. * Fixed scum check on save. * More code cleanup, which revealed some issues with loading and saving. Loading now works 100%, but entries in checkTrackerData are disappearing in code somewhere, causing issues with later checks. Scummed color now displays properly. Collected but unsaved displays properly. Unchecked, Skipped, Seen and Scummed checks all have arrows for skipping/unskipping. Counts a little messed up, probably double adding skips. * Fixed item counts being off across resets. Restarts were fine. * Beginning of rework for individual check updates. Adds `Actor lastCheck` to PlayState to allow assigning of last actor to give an item. This allows precise tracking of GS, freestanding PoH, etc. Works for chests too. Currently does not work for shops, unknown for normal NPC gives. Doesn't track last gives for non-checks, like drops from grass, pots, crates, etc. * Actor-based checks fully fleshed out, but can't help with sale-based checks. Implemented `pendingSaleCheck` to back out of an RC check cycle if `gSaveContext->pendingSale` is not NONE when `OnItemReceive` is called, processed through `OnSaleEnd`. This should be the final change necessary to streamline the checks. * Temporary hook to message box close to tie in trackers for non-gs/chest actors that aren't added to `GetCheckFromActor`. This triggers a 2-frame countdown to check with `HasItemBeenCollected` since half of the methods in there aren't updated until after a text box closes. Added scene tracking to get last scene so that checks in scenes that span several overworld areas could be tied to their areas properly. Modified tracker data creation to apply Link's Pocket and Song from Impa conditionally based on randomizer settings instead of just being assumed to be done. May need modification for checking click and drag spoiler loading. Removed the scene equivalence check from CheckChecks so that an entire area is checked each time to avoid issues with, e.g., leaving a shop before a pending sale finishes. * Changed check data creation to use RSKs from gRandomizer to account for settings loaded from drag and drop spoilers. * Beginning of tracker code organization. Changed check color defaults. * Reverted moving tracker colors to header. Some individual check fixes. * Missed something from previous merge? * Removed last remnant of removed performance mode. * Better handle checking when skullsanity is off. * Song checks sceneIDs don't match the scenes they're actually in for some reason. Removed that check. * SaleEnd checks don't need the GetItemEntry parameter. Also set a flag that should prevent the check tracker from running during vanilla saves should that not be resolved by the time it's merged. * Attempting to have only the relevant checks added to the tracker data, as well as showing vanilla checks for non-rando saves. Not working yet (everything is displayed in vanilla). * Added vanilla check tracker population via `vanillaCheck` bool in `RandomizerCheckObject`. This is also added to `IsVisibleInImGui` to handle file loading and saving to eliminate checks that aren't part of vanilla or the rando seed. Implemented deleted tracker data file recreation. Added some extra item name text checks. Songs are still... tricky, so they stay blank. Utilize local copies of the randomizer check objects that are applicable for performance purposes. Fixed vanilla item-giving cutscene crashes when triggered mid-transition. * Apparently not all toolchains can handle macro instantiation without all parameters, like VS can. * Fixed scummed detail color not showing properly on tracker. * Fixed dungeon area totals and GS checks not functioning properly. * Major revamp of checking code. Doesn't rely on `GetCheckFromActor` at all anymore, but instead simply sets a flag to evaluate a number of checks in an area every frame until the check that was gotten is identified. With the new setup, it's much less hardware intensive, and at 60fps 6 checks per frame shows no noticeable effect on framerate. I can envision needing to add a collectedCount in order to account for times when two checks are gotten one right after the other. Changed area scroll to happen from `OnTransitionEnd`, and allow for scrolling in bazaar (was disabled previously because it would jump back and forth between Kak and Market while you were in one). Also setup area check order updating by area instead of all at the same time. * Fixed shooting gallery not reporting proper area. Prevent checks from actually happening if area is RCAREA_INVALID, now that all areas are reporting something if they have checks. Fixed `GetCheckArea()` not updating checks for standard scenes. Lots of vanilla tracking updates, mainly manual checks for gems, medallions and songs, since the often don't have proper scenes in the data. Prevent vanilla from triggering check loops if junk items are collected. Fixed sorting based on saved vs collected. Prevent item name display for vanilla runs. Change coloring of checks so the check name reflects status in vanilla runs. * Fixed "Recheck Area" button erroneously adding to an area's check totals? * Fix DMC vanilla checks. * Fix check tracker data recreation on data file loss. Removed redundant file exists check from SaveTrackerDataHook, as it doesn't matter if it exists or not at that point. Limited check loops to 3 to avoid infinite check loops on non-check/junk item pickup. Added more checks to disable tracker operations if a save is not running. Changed check ordering to put boss reward and heart container checks at the end of whatever RCSHOW group they belong to. * Fixed IsRunning calculation. Further improving vanilla checking. Starting framework for checking medallions, stones, and songs on data file recreation. Fixed medallion check collection. Added GIFT_FROM_SAGES to check list for vanilla file for tracking light medallion. Added check loop limitation to prevent infinite checking after picking up junk item from the ground. * Finished vanilla file recreation and recheck (songs and dungeon rewards all check properly now). This includes deku shield with KF shop item 3. Finished Gift from Raoru light medallion tracking for vanilla. Commented all CheckByScene functionality for now. * Fixed new save data file creation. Disabled entrance area calculation for now, as it only tracks the previous entrance for some reason. Fixed area detection for ToT checks. * GetCheckArea() now utilizes EntranceData almost exclusively, via either `gSaveContext.entranceIndex` or the entrance tracker's `currentGrottoId` in the case of grottos. This also means that EVERYTHING CAN AUTOSCROLL NOW. Entrance shuffles are now much easier to track. Autoscroll is now also triggered on save, just in case someone isn't autosaving and has a lot of checks that get converted to saved. * Fixed missing GS check in LW. * Added area scroll on toggling Show Hidden Items. May configure differently later. Fixed area detection for entrances in Gerudo Fortress/Valley and Collossus. Haunted wasteland doesn't autoscroll due to a bug in `OnTransitionEnd` hook, but checks still evaluate properly there. Rely on scene-based area detection if scene is a main overworld or dungeon scene. * Fixed grotto detection when shuffle is off. * Small code cleanup. Fixed Colossus hand chest checks. * Missing lus bump from merge conflict resolution * Fixed Colossus Grotto making `GetCheckArea` return Wasteland. * Improved OnItemReceive processing for non-token GS checks, since they can sometimes take long enough for the checking process to time out before the item is registered as received. * First attempt at thread safety for tracker data file writing. Seems to work, but might need more testing. * Fixed Recheck Area not unskipping items that register as saved. Improved delayed saving with autosaving, as the autosave triggered quite often before the tracker data save, making things not properly register as saved. * merge cleanup * Converted check tracker data to the sectional saves, adding `CheckTrackerData` to `SaveContext`. Implemented section ID returning and fullSave boolean passing to section functions from my PR temporarily for it to work properly. Moved `RandomizerCheckTrackerData` enum to `randomizerTypes.h` to accommodate that. Changed `Randomizer_SaveInit` to a `SaveManager::InitFunc` to allow for other randomizer-dependent sections to be initialized after that. Required a little refactoring to maintain intro cutscene skip when starting a randomizer file. * Revert section index return and randomizer init changes. Will need to wait on yet more changes to main. * Fixed check tracker initialization (shouldn't be tied to window initialization), restored saving/loading functionality. * Removed `CheckTracker::Init` and put SaveManager calls in `CheckTrackerWindow::InitElement`. Also a bit of cleanup from transition back to save file use. * Fixed tracker displaying check categories while file not loaded. * Fix Darunia's Joy check not marking in vanilla. * Fix autosave not triggering change from collected to saved in tracker data. * Changed default colors for scummed and collected display. * Merge upgrade code cleanup. * Add `OnTransitionEnd` calls to sandstorm transitions both to and from Wasteland. Also improved `gSaveContext.lastScene` assignment for both transition types. Allowed a bit of cleanup in `GetCheckArea`. * Added `StateButton`, a button like `ArrowButton` but that allows text instead of arrow icons. Apparently the changes from ArrowButton to StateButton happened in a previous commit... * Changed section name to `trackerDataCheck` to force SoH to load it after the randomizer section, as it required some randoSettings to be loaded first, and nothing else I tried to make the randomizer section load before it worked. This hacks a solution to checks not displaying on fast file load to a specific slot. F*** you, SaveManager, and f*** you too, JSON. * Forgot to change the section string for loading with the name change. * Fix check ordering for checks that trigger the autosave. * Adds option to remove right-side shop items (slots 1-4) from the tracker list. Enabled by default. * Fix default state of Hide Shop Right Checks checkbox. * Fixes grotto and great fairy scrolling and checks. Fixes array overflow from `checkTrackerData` which was creating the issue trying to load the base and randomizer sections first, among other things. That also fixed the massive file loads that were being exhibited in debug mode. * Fix shooting galleries being set as collected again when being played a second time after getting the checks. * Fix Bazaar autoscroll. * Add Saria's Song to `GetCheckFromActor` and removed some limitations from the messageCloseCheck function to make that check track properly. * Fix Song from Impa check. Implemented prevention for multiple "collections" of great fairies, just in case getting the health refill would trigger it with the previous setup. * Fix ice traps on GS tokens not triggering OnItemReceive. * Complete fix for ice trap collection from GS. Add autoscroll when clicking "Expand All". * Add `OnShopSlotChange` with cursorSlot and basePrice parameters. * Fixed include in en_ossan for shop slot hook. Added registration for `OnShopSlotChange` in the tracker, storing the price in a new `price` field in `CheckTrackerData`. Added "seen" functionality to shop checks. Displays the model item name upon first entering a shop, adding the price and switching to trickName (if it's an ice trap) upon navigating to the slot in buy mode, triggered by an invisible "identified" status that mirrors "seen" in every other way. Added tooltips to most options for check tracker color picking to describe what each status actually means. * `std::format` pls * So apparently std::format just decided to break with the latest merge from develop, but fmt::format exists and works? * Removed the last vestiges of `locationsSkipped`. Other general code and formatting cleanups. Moved `IsGameRunning` to `OTRGlobals` so the item tracker could also access it. Used preceding to "fix" item and bottle display in the item tracker on startup. * Some more code cleanup. Removed "Recheck Area" button and relevant code. Backported changes to Anchor branch applicable for single-player, including making a checkAreas vector and structuring the frame by frame checks around that. Also includes fix for Silver Gauntlets and Mirror Shield check collection crash associated with those changes. Fixed Kakariko Bazaar "seen" updates. Fixed tracker window not showing on initial load like it should. * Forgot 1 formatting fix. * Removed conditions for showing Song from Impa (isn't junk under certain conditions, so should show all the time). * Fix vanilla checks, add Zelda's Letter and Malon's Egg to manual check collection. Fix autoscroll while in child stealth section. * Fix crash in Happy Mask Shop in OnSlotChange (referenced non-existent shop id in a tracker-specific enum). * General code cleanup. * Missed one reversion. * One more. * Fix column alignment in `randomizer_check_objects`. * Fix file encoding on `randomizer_check_tracker`. Again. * Fix indentation for `actualItemtrackerItemMap`. Also removed unnecessary parts of the map. * Rename `HasEqItem` to `HasEquipment`. * Slightly better indentation for `actualItemTrackerItemMap`. * Add magic bean salesman to vanilla check tracking, and genericized deku shield to trigger KF shop item 3 wherever you get the shield. Renamed `vanillaCheck` to `vanillaHundoCheck` to (supposedly) clarify the meaning of the usage. * One more rename to `vanillaCompletion` to avoid possible confusion with 100% speedrun conditions. * give me a break XD Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * Changes suggested by briaguya (rename `RandomizerCheckShow` to `Status`, unused code, newline formatting) * Remove unused `itemNames` table. * Remove `IsGameRunning` in favor of `GameInteractor::IsSaveLoaded`. * Restore anti-spoiler functionality for dungeons with dungeon maps. * Review cleanup. * Fix prices not showing for Kak bazaar items. --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com>
2023-10-04 11:03:36 -04:00
return
(rcObj.rcArea != RCAREA_INVALID) && // don't show Invalid locations
(rcObj.rcType != RCTYPE_GOSSIP_STONE) && //TODO: Don't show hints until tracker supports them
(rcObj.rcType != RCTYPE_CHEST_GAME) && // don't show non final reward chest game checks until we support shuffling them
(rcObj.rc != RC_HC_ZELDAS_LETTER) && // don't show zeldas letter until we support shuffling it
(rcObj.rc != RC_LINKS_POCKET || showLinksPocket) &&
(!RandomizerCheckObjects::AreaIsDungeon(rcObj.rcArea) ||
rcObj.vOrMQ == RCVORMQ_BOTH ||
rcObj.vOrMQ == RCVORMQ_MQ && OTRGlobals::Instance->gRandomizer->masterQuestDungeons.contains(rcObj.sceneId) ||
rcObj.vOrMQ == RCVORMQ_VANILLA && !OTRGlobals::Instance->gRandomizer->masterQuestDungeons.contains(rcObj.sceneId)
) &&
(rcObj.rcType != RCTYPE_SHOP || (showShops && (!hideShopRightChecks || hideShopRightChecks && rcObj.actorParams > 0x03))) &&
(rcObj.rcType != RCTYPE_SCRUB ||
showScrubs ||
rcObj.rc == RC_LW_DEKU_SCRUB_NEAR_BRIDGE || // The 3 scrubs that are always randomized
rcObj.rc == RC_HF_DEKU_SCRUB_GROTTO ||
rcObj.rc == RC_LW_DEKU_SCRUB_GROTTO_FRONT
) &&
(rcObj.rcType != RCTYPE_MERCHANT || showMerchants) &&
(rcObj.rcType != RCTYPE_OCARINA || showOcarinas) &&
(rcObj.rcType != RCTYPE_SKULL_TOKEN || alwaysShowGS ||
Check Tracker Update (#2668) * Initial commit. What works so far: Data file loads, saves, deletes, and is created properly. - Need to run `HasItemBeenCollected` when creating in case of mid-seed regen. Organized checks into maps set by area. Areas show in tracker. - Checks pulled from checkObjectsByArea are not currently listed. - Areas are being assumed completed and hidden at the start. * Checks now populate. Still not counting area totals properly. * Don't track RC_LINKS_POCKET in the data file, and instead manually add it in every time a save is load. rcObjects doesn't contain Link's Pocket location (duh). * Moved ItemReceive hook to randomizer_check_tracker.cpp. Skipped items are properly sorted and formatted. Saved items contribute to an area's gotten/skipped checks on load. Changed skipped items default main color to gray. General code cleanup. * Skipped checks now contribute to area totals for area completion logic. * Mid-menu rework transfer. * Started check lookup on item receive. Tried to enable scum checking on save. * Fixed scum check on save. * More code cleanup, which revealed some issues with loading and saving. Loading now works 100%, but entries in checkTrackerData are disappearing in code somewhere, causing issues with later checks. Scummed color now displays properly. Collected but unsaved displays properly. Unchecked, Skipped, Seen and Scummed checks all have arrows for skipping/unskipping. Counts a little messed up, probably double adding skips. * Fixed item counts being off across resets. Restarts were fine. * Beginning of rework for individual check updates. Adds `Actor lastCheck` to PlayState to allow assigning of last actor to give an item. This allows precise tracking of GS, freestanding PoH, etc. Works for chests too. Currently does not work for shops, unknown for normal NPC gives. Doesn't track last gives for non-checks, like drops from grass, pots, crates, etc. * Actor-based checks fully fleshed out, but can't help with sale-based checks. Implemented `pendingSaleCheck` to back out of an RC check cycle if `gSaveContext->pendingSale` is not NONE when `OnItemReceive` is called, processed through `OnSaleEnd`. This should be the final change necessary to streamline the checks. * Temporary hook to message box close to tie in trackers for non-gs/chest actors that aren't added to `GetCheckFromActor`. This triggers a 2-frame countdown to check with `HasItemBeenCollected` since half of the methods in there aren't updated until after a text box closes. Added scene tracking to get last scene so that checks in scenes that span several overworld areas could be tied to their areas properly. Modified tracker data creation to apply Link's Pocket and Song from Impa conditionally based on randomizer settings instead of just being assumed to be done. May need modification for checking click and drag spoiler loading. Removed the scene equivalence check from CheckChecks so that an entire area is checked each time to avoid issues with, e.g., leaving a shop before a pending sale finishes. * Changed check data creation to use RSKs from gRandomizer to account for settings loaded from drag and drop spoilers. * Beginning of tracker code organization. Changed check color defaults. * Reverted moving tracker colors to header. Some individual check fixes. * Missed something from previous merge? * Removed last remnant of removed performance mode. * Better handle checking when skullsanity is off. * Song checks sceneIDs don't match the scenes they're actually in for some reason. Removed that check. * SaleEnd checks don't need the GetItemEntry parameter. Also set a flag that should prevent the check tracker from running during vanilla saves should that not be resolved by the time it's merged. * Attempting to have only the relevant checks added to the tracker data, as well as showing vanilla checks for non-rando saves. Not working yet (everything is displayed in vanilla). * Added vanilla check tracker population via `vanillaCheck` bool in `RandomizerCheckObject`. This is also added to `IsVisibleInImGui` to handle file loading and saving to eliminate checks that aren't part of vanilla or the rando seed. Implemented deleted tracker data file recreation. Added some extra item name text checks. Songs are still... tricky, so they stay blank. Utilize local copies of the randomizer check objects that are applicable for performance purposes. Fixed vanilla item-giving cutscene crashes when triggered mid-transition. * Apparently not all toolchains can handle macro instantiation without all parameters, like VS can. * Fixed scummed detail color not showing properly on tracker. * Fixed dungeon area totals and GS checks not functioning properly. * Major revamp of checking code. Doesn't rely on `GetCheckFromActor` at all anymore, but instead simply sets a flag to evaluate a number of checks in an area every frame until the check that was gotten is identified. With the new setup, it's much less hardware intensive, and at 60fps 6 checks per frame shows no noticeable effect on framerate. I can envision needing to add a collectedCount in order to account for times when two checks are gotten one right after the other. Changed area scroll to happen from `OnTransitionEnd`, and allow for scrolling in bazaar (was disabled previously because it would jump back and forth between Kak and Market while you were in one). Also setup area check order updating by area instead of all at the same time. * Fixed shooting gallery not reporting proper area. Prevent checks from actually happening if area is RCAREA_INVALID, now that all areas are reporting something if they have checks. Fixed `GetCheckArea()` not updating checks for standard scenes. Lots of vanilla tracking updates, mainly manual checks for gems, medallions and songs, since the often don't have proper scenes in the data. Prevent vanilla from triggering check loops if junk items are collected. Fixed sorting based on saved vs collected. Prevent item name display for vanilla runs. Change coloring of checks so the check name reflects status in vanilla runs. * Fixed "Recheck Area" button erroneously adding to an area's check totals? * Fix DMC vanilla checks. * Fix check tracker data recreation on data file loss. Removed redundant file exists check from SaveTrackerDataHook, as it doesn't matter if it exists or not at that point. Limited check loops to 3 to avoid infinite check loops on non-check/junk item pickup. Added more checks to disable tracker operations if a save is not running. Changed check ordering to put boss reward and heart container checks at the end of whatever RCSHOW group they belong to. * Fixed IsRunning calculation. Further improving vanilla checking. Starting framework for checking medallions, stones, and songs on data file recreation. Fixed medallion check collection. Added GIFT_FROM_SAGES to check list for vanilla file for tracking light medallion. Added check loop limitation to prevent infinite checking after picking up junk item from the ground. * Finished vanilla file recreation and recheck (songs and dungeon rewards all check properly now). This includes deku shield with KF shop item 3. Finished Gift from Raoru light medallion tracking for vanilla. Commented all CheckByScene functionality for now. * Fixed new save data file creation. Disabled entrance area calculation for now, as it only tracks the previous entrance for some reason. Fixed area detection for ToT checks. * GetCheckArea() now utilizes EntranceData almost exclusively, via either `gSaveContext.entranceIndex` or the entrance tracker's `currentGrottoId` in the case of grottos. This also means that EVERYTHING CAN AUTOSCROLL NOW. Entrance shuffles are now much easier to track. Autoscroll is now also triggered on save, just in case someone isn't autosaving and has a lot of checks that get converted to saved. * Fixed missing GS check in LW. * Added area scroll on toggling Show Hidden Items. May configure differently later. Fixed area detection for entrances in Gerudo Fortress/Valley and Collossus. Haunted wasteland doesn't autoscroll due to a bug in `OnTransitionEnd` hook, but checks still evaluate properly there. Rely on scene-based area detection if scene is a main overworld or dungeon scene. * Fixed grotto detection when shuffle is off. * Small code cleanup. Fixed Colossus hand chest checks. * Missing lus bump from merge conflict resolution * Fixed Colossus Grotto making `GetCheckArea` return Wasteland. * Improved OnItemReceive processing for non-token GS checks, since they can sometimes take long enough for the checking process to time out before the item is registered as received. * First attempt at thread safety for tracker data file writing. Seems to work, but might need more testing. * Fixed Recheck Area not unskipping items that register as saved. Improved delayed saving with autosaving, as the autosave triggered quite often before the tracker data save, making things not properly register as saved. * merge cleanup * Converted check tracker data to the sectional saves, adding `CheckTrackerData` to `SaveContext`. Implemented section ID returning and fullSave boolean passing to section functions from my PR temporarily for it to work properly. Moved `RandomizerCheckTrackerData` enum to `randomizerTypes.h` to accommodate that. Changed `Randomizer_SaveInit` to a `SaveManager::InitFunc` to allow for other randomizer-dependent sections to be initialized after that. Required a little refactoring to maintain intro cutscene skip when starting a randomizer file. * Revert section index return and randomizer init changes. Will need to wait on yet more changes to main. * Fixed check tracker initialization (shouldn't be tied to window initialization), restored saving/loading functionality. * Removed `CheckTracker::Init` and put SaveManager calls in `CheckTrackerWindow::InitElement`. Also a bit of cleanup from transition back to save file use. * Fixed tracker displaying check categories while file not loaded. * Fix Darunia's Joy check not marking in vanilla. * Fix autosave not triggering change from collected to saved in tracker data. * Changed default colors for scummed and collected display. * Merge upgrade code cleanup. * Add `OnTransitionEnd` calls to sandstorm transitions both to and from Wasteland. Also improved `gSaveContext.lastScene` assignment for both transition types. Allowed a bit of cleanup in `GetCheckArea`. * Added `StateButton`, a button like `ArrowButton` but that allows text instead of arrow icons. Apparently the changes from ArrowButton to StateButton happened in a previous commit... * Changed section name to `trackerDataCheck` to force SoH to load it after the randomizer section, as it required some randoSettings to be loaded first, and nothing else I tried to make the randomizer section load before it worked. This hacks a solution to checks not displaying on fast file load to a specific slot. F*** you, SaveManager, and f*** you too, JSON. * Forgot to change the section string for loading with the name change. * Fix check ordering for checks that trigger the autosave. * Adds option to remove right-side shop items (slots 1-4) from the tracker list. Enabled by default. * Fix default state of Hide Shop Right Checks checkbox. * Fixes grotto and great fairy scrolling and checks. Fixes array overflow from `checkTrackerData` which was creating the issue trying to load the base and randomizer sections first, among other things. That also fixed the massive file loads that were being exhibited in debug mode. * Fix shooting galleries being set as collected again when being played a second time after getting the checks. * Fix Bazaar autoscroll. * Add Saria's Song to `GetCheckFromActor` and removed some limitations from the messageCloseCheck function to make that check track properly. * Fix Song from Impa check. Implemented prevention for multiple "collections" of great fairies, just in case getting the health refill would trigger it with the previous setup. * Fix ice traps on GS tokens not triggering OnItemReceive. * Complete fix for ice trap collection from GS. Add autoscroll when clicking "Expand All". * Add `OnShopSlotChange` with cursorSlot and basePrice parameters. * Fixed include in en_ossan for shop slot hook. Added registration for `OnShopSlotChange` in the tracker, storing the price in a new `price` field in `CheckTrackerData`. Added "seen" functionality to shop checks. Displays the model item name upon first entering a shop, adding the price and switching to trickName (if it's an ice trap) upon navigating to the slot in buy mode, triggered by an invisible "identified" status that mirrors "seen" in every other way. Added tooltips to most options for check tracker color picking to describe what each status actually means. * `std::format` pls * So apparently std::format just decided to break with the latest merge from develop, but fmt::format exists and works? * Removed the last vestiges of `locationsSkipped`. Other general code and formatting cleanups. Moved `IsGameRunning` to `OTRGlobals` so the item tracker could also access it. Used preceding to "fix" item and bottle display in the item tracker on startup. * Some more code cleanup. Removed "Recheck Area" button and relevant code. Backported changes to Anchor branch applicable for single-player, including making a checkAreas vector and structuring the frame by frame checks around that. Also includes fix for Silver Gauntlets and Mirror Shield check collection crash associated with those changes. Fixed Kakariko Bazaar "seen" updates. Fixed tracker window not showing on initial load like it should. * Forgot 1 formatting fix. * Removed conditions for showing Song from Impa (isn't junk under certain conditions, so should show all the time). * Fix vanilla checks, add Zelda's Letter and Malon's Egg to manual check collection. Fix autoscroll while in child stealth section. * Fix crash in Happy Mask Shop in OnSlotChange (referenced non-existent shop id in a tracker-specific enum). * General code cleanup. * Missed one reversion. * One more. * Fix column alignment in `randomizer_check_objects`. * Fix file encoding on `randomizer_check_tracker`. Again. * Fix indentation for `actualItemtrackerItemMap`. Also removed unnecessary parts of the map. * Rename `HasEqItem` to `HasEquipment`. * Slightly better indentation for `actualItemTrackerItemMap`. * Add magic bean salesman to vanilla check tracking, and genericized deku shield to trigger KF shop item 3 wherever you get the shield. Renamed `vanillaCheck` to `vanillaHundoCheck` to (supposedly) clarify the meaning of the usage. * One more rename to `vanillaCompletion` to avoid possible confusion with 100% speedrun conditions. * give me a break XD Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * Changes suggested by briaguya (rename `RandomizerCheckShow` to `Status`, unused code, newline formatting) * Remove unused `itemNames` table. * Remove `IsGameRunning` in favor of `GameInteractor::IsSaveLoaded`. * Restore anti-spoiler functionality for dungeons with dungeon maps. * Review cleanup. * Fix prices not showing for Kak bazaar items. --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com>
2023-10-04 11:03:36 -04:00
(showOverworldTokens && RandomizerCheckObjects::AreaIsOverworld(rcObj.rcArea)) ||
(showDungeonTokens && RandomizerCheckObjects::AreaIsDungeon(rcObj.rcArea))
) &&
(rcObj.rcType != RCTYPE_COW || showCows) &&
(rcObj.rcType != RCTYPE_ADULT_TRADE ||
showAdultTrade ||
rcObj.rc == RC_KAK_ANJU_AS_ADULT || // adult trade checks that are always shuffled
rcObj.rc == RC_DMT_TRADE_CLAIM_CHECK // even when shuffle adult trade is off
) &&
(rcObj.rc != RC_KF_KOKIRI_SWORD_CHEST || showKokiriSword) &&
Rando: Master Sword Shuffle (#2981) * The mother of all commits * Removed `GI_SWORD_MASTER`; "Master Sword" Items now actually give MS * Removed dupe MS entries in item pool; updated GIMESSAGE (should stop crashing on non-Windows); re-added MS in item list * Give Adult Link a freebie with shuffle MS on; cihld -> adult no longer gives MS; ToT Master Sword now gives correct item * add master sword GI draw func based on ToT MS object * Force `MasterSword` logic var to only update upon getting MS * Dorf funny line now activates with LA and MS in inv * Apply suggestions * Updated RAND_INF; Check Tracker changes; Gave RAND_INF and ice trap logic to ToT MS check; Fixed swordless behavior for HBA/fishing * ToT MS Check now works in check tracker; Visual bug where box hovers over non-existent MS gone; Fixed RAND_INF check with ToT MS pedestal; Ganon no longer gives free MS * adult equips no longer reset in MS shuffle * Apply (most) locacc review suggestions Co-authored-by: inspectredc <78732756+inspectredc@users.noreply.github.com> * Reorganized swordless check for interface to fit edge cases; getting master sword no longer highlights box * Edge case for BGS but no bow * Fix implicit declaration error for GI hooks (#9) * Adjusted `CanAdultAttack/Damage`; applied logic suggestions * Fixed build errors (hopefully) * Cleanup merge * get shit working again * Tidied up remaining uses of DD flag as rando indicator * make master sword invisible and fix ms flag (#10) * Add text to sheik if go mode is obtained but barrier is still up * overhaul swordless behavior in `func_80083108` * reworked ToT MS Check to have an actual GI * suggestions * Apply suggestions * Better swordless handling with temp B (#11) * better swordless handling with temp B * prevent auto save in fishing pond * prevent auto save during bombchu bowling * enum fix --------- Co-authored-by: Adam Bird <archez39@me.com> Co-authored-by: inspectredc <78732756+inspectredc@users.noreply.github.com> Co-authored-by: RaelCappra <rael.cappra@gmail.com> Co-authored-by: Adam Bird <Archez@users.noreply.github.com>
2023-10-21 21:51:37 -04:00
(rcObj.rc != RC_TOT_MASTER_SWORD || showMasterSword) &&
Check Tracker Update (#2668) * Initial commit. What works so far: Data file loads, saves, deletes, and is created properly. - Need to run `HasItemBeenCollected` when creating in case of mid-seed regen. Organized checks into maps set by area. Areas show in tracker. - Checks pulled from checkObjectsByArea are not currently listed. - Areas are being assumed completed and hidden at the start. * Checks now populate. Still not counting area totals properly. * Don't track RC_LINKS_POCKET in the data file, and instead manually add it in every time a save is load. rcObjects doesn't contain Link's Pocket location (duh). * Moved ItemReceive hook to randomizer_check_tracker.cpp. Skipped items are properly sorted and formatted. Saved items contribute to an area's gotten/skipped checks on load. Changed skipped items default main color to gray. General code cleanup. * Skipped checks now contribute to area totals for area completion logic. * Mid-menu rework transfer. * Started check lookup on item receive. Tried to enable scum checking on save. * Fixed scum check on save. * More code cleanup, which revealed some issues with loading and saving. Loading now works 100%, but entries in checkTrackerData are disappearing in code somewhere, causing issues with later checks. Scummed color now displays properly. Collected but unsaved displays properly. Unchecked, Skipped, Seen and Scummed checks all have arrows for skipping/unskipping. Counts a little messed up, probably double adding skips. * Fixed item counts being off across resets. Restarts were fine. * Beginning of rework for individual check updates. Adds `Actor lastCheck` to PlayState to allow assigning of last actor to give an item. This allows precise tracking of GS, freestanding PoH, etc. Works for chests too. Currently does not work for shops, unknown for normal NPC gives. Doesn't track last gives for non-checks, like drops from grass, pots, crates, etc. * Actor-based checks fully fleshed out, but can't help with sale-based checks. Implemented `pendingSaleCheck` to back out of an RC check cycle if `gSaveContext->pendingSale` is not NONE when `OnItemReceive` is called, processed through `OnSaleEnd`. This should be the final change necessary to streamline the checks. * Temporary hook to message box close to tie in trackers for non-gs/chest actors that aren't added to `GetCheckFromActor`. This triggers a 2-frame countdown to check with `HasItemBeenCollected` since half of the methods in there aren't updated until after a text box closes. Added scene tracking to get last scene so that checks in scenes that span several overworld areas could be tied to their areas properly. Modified tracker data creation to apply Link's Pocket and Song from Impa conditionally based on randomizer settings instead of just being assumed to be done. May need modification for checking click and drag spoiler loading. Removed the scene equivalence check from CheckChecks so that an entire area is checked each time to avoid issues with, e.g., leaving a shop before a pending sale finishes. * Changed check data creation to use RSKs from gRandomizer to account for settings loaded from drag and drop spoilers. * Beginning of tracker code organization. Changed check color defaults. * Reverted moving tracker colors to header. Some individual check fixes. * Missed something from previous merge? * Removed last remnant of removed performance mode. * Better handle checking when skullsanity is off. * Song checks sceneIDs don't match the scenes they're actually in for some reason. Removed that check. * SaleEnd checks don't need the GetItemEntry parameter. Also set a flag that should prevent the check tracker from running during vanilla saves should that not be resolved by the time it's merged. * Attempting to have only the relevant checks added to the tracker data, as well as showing vanilla checks for non-rando saves. Not working yet (everything is displayed in vanilla). * Added vanilla check tracker population via `vanillaCheck` bool in `RandomizerCheckObject`. This is also added to `IsVisibleInImGui` to handle file loading and saving to eliminate checks that aren't part of vanilla or the rando seed. Implemented deleted tracker data file recreation. Added some extra item name text checks. Songs are still... tricky, so they stay blank. Utilize local copies of the randomizer check objects that are applicable for performance purposes. Fixed vanilla item-giving cutscene crashes when triggered mid-transition. * Apparently not all toolchains can handle macro instantiation without all parameters, like VS can. * Fixed scummed detail color not showing properly on tracker. * Fixed dungeon area totals and GS checks not functioning properly. * Major revamp of checking code. Doesn't rely on `GetCheckFromActor` at all anymore, but instead simply sets a flag to evaluate a number of checks in an area every frame until the check that was gotten is identified. With the new setup, it's much less hardware intensive, and at 60fps 6 checks per frame shows no noticeable effect on framerate. I can envision needing to add a collectedCount in order to account for times when two checks are gotten one right after the other. Changed area scroll to happen from `OnTransitionEnd`, and allow for scrolling in bazaar (was disabled previously because it would jump back and forth between Kak and Market while you were in one). Also setup area check order updating by area instead of all at the same time. * Fixed shooting gallery not reporting proper area. Prevent checks from actually happening if area is RCAREA_INVALID, now that all areas are reporting something if they have checks. Fixed `GetCheckArea()` not updating checks for standard scenes. Lots of vanilla tracking updates, mainly manual checks for gems, medallions and songs, since the often don't have proper scenes in the data. Prevent vanilla from triggering check loops if junk items are collected. Fixed sorting based on saved vs collected. Prevent item name display for vanilla runs. Change coloring of checks so the check name reflects status in vanilla runs. * Fixed "Recheck Area" button erroneously adding to an area's check totals? * Fix DMC vanilla checks. * Fix check tracker data recreation on data file loss. Removed redundant file exists check from SaveTrackerDataHook, as it doesn't matter if it exists or not at that point. Limited check loops to 3 to avoid infinite check loops on non-check/junk item pickup. Added more checks to disable tracker operations if a save is not running. Changed check ordering to put boss reward and heart container checks at the end of whatever RCSHOW group they belong to. * Fixed IsRunning calculation. Further improving vanilla checking. Starting framework for checking medallions, stones, and songs on data file recreation. Fixed medallion check collection. Added GIFT_FROM_SAGES to check list for vanilla file for tracking light medallion. Added check loop limitation to prevent infinite checking after picking up junk item from the ground. * Finished vanilla file recreation and recheck (songs and dungeon rewards all check properly now). This includes deku shield with KF shop item 3. Finished Gift from Raoru light medallion tracking for vanilla. Commented all CheckByScene functionality for now. * Fixed new save data file creation. Disabled entrance area calculation for now, as it only tracks the previous entrance for some reason. Fixed area detection for ToT checks. * GetCheckArea() now utilizes EntranceData almost exclusively, via either `gSaveContext.entranceIndex` or the entrance tracker's `currentGrottoId` in the case of grottos. This also means that EVERYTHING CAN AUTOSCROLL NOW. Entrance shuffles are now much easier to track. Autoscroll is now also triggered on save, just in case someone isn't autosaving and has a lot of checks that get converted to saved. * Fixed missing GS check in LW. * Added area scroll on toggling Show Hidden Items. May configure differently later. Fixed area detection for entrances in Gerudo Fortress/Valley and Collossus. Haunted wasteland doesn't autoscroll due to a bug in `OnTransitionEnd` hook, but checks still evaluate properly there. Rely on scene-based area detection if scene is a main overworld or dungeon scene. * Fixed grotto detection when shuffle is off. * Small code cleanup. Fixed Colossus hand chest checks. * Missing lus bump from merge conflict resolution * Fixed Colossus Grotto making `GetCheckArea` return Wasteland. * Improved OnItemReceive processing for non-token GS checks, since they can sometimes take long enough for the checking process to time out before the item is registered as received. * First attempt at thread safety for tracker data file writing. Seems to work, but might need more testing. * Fixed Recheck Area not unskipping items that register as saved. Improved delayed saving with autosaving, as the autosave triggered quite often before the tracker data save, making things not properly register as saved. * merge cleanup * Converted check tracker data to the sectional saves, adding `CheckTrackerData` to `SaveContext`. Implemented section ID returning and fullSave boolean passing to section functions from my PR temporarily for it to work properly. Moved `RandomizerCheckTrackerData` enum to `randomizerTypes.h` to accommodate that. Changed `Randomizer_SaveInit` to a `SaveManager::InitFunc` to allow for other randomizer-dependent sections to be initialized after that. Required a little refactoring to maintain intro cutscene skip when starting a randomizer file. * Revert section index return and randomizer init changes. Will need to wait on yet more changes to main. * Fixed check tracker initialization (shouldn't be tied to window initialization), restored saving/loading functionality. * Removed `CheckTracker::Init` and put SaveManager calls in `CheckTrackerWindow::InitElement`. Also a bit of cleanup from transition back to save file use. * Fixed tracker displaying check categories while file not loaded. * Fix Darunia's Joy check not marking in vanilla. * Fix autosave not triggering change from collected to saved in tracker data. * Changed default colors for scummed and collected display. * Merge upgrade code cleanup. * Add `OnTransitionEnd` calls to sandstorm transitions both to and from Wasteland. Also improved `gSaveContext.lastScene` assignment for both transition types. Allowed a bit of cleanup in `GetCheckArea`. * Added `StateButton`, a button like `ArrowButton` but that allows text instead of arrow icons. Apparently the changes from ArrowButton to StateButton happened in a previous commit... * Changed section name to `trackerDataCheck` to force SoH to load it after the randomizer section, as it required some randoSettings to be loaded first, and nothing else I tried to make the randomizer section load before it worked. This hacks a solution to checks not displaying on fast file load to a specific slot. F*** you, SaveManager, and f*** you too, JSON. * Forgot to change the section string for loading with the name change. * Fix check ordering for checks that trigger the autosave. * Adds option to remove right-side shop items (slots 1-4) from the tracker list. Enabled by default. * Fix default state of Hide Shop Right Checks checkbox. * Fixes grotto and great fairy scrolling and checks. Fixes array overflow from `checkTrackerData` which was creating the issue trying to load the base and randomizer sections first, among other things. That also fixed the massive file loads that were being exhibited in debug mode. * Fix shooting galleries being set as collected again when being played a second time after getting the checks. * Fix Bazaar autoscroll. * Add Saria's Song to `GetCheckFromActor` and removed some limitations from the messageCloseCheck function to make that check track properly. * Fix Song from Impa check. Implemented prevention for multiple "collections" of great fairies, just in case getting the health refill would trigger it with the previous setup. * Fix ice traps on GS tokens not triggering OnItemReceive. * Complete fix for ice trap collection from GS. Add autoscroll when clicking "Expand All". * Add `OnShopSlotChange` with cursorSlot and basePrice parameters. * Fixed include in en_ossan for shop slot hook. Added registration for `OnShopSlotChange` in the tracker, storing the price in a new `price` field in `CheckTrackerData`. Added "seen" functionality to shop checks. Displays the model item name upon first entering a shop, adding the price and switching to trickName (if it's an ice trap) upon navigating to the slot in buy mode, triggered by an invisible "identified" status that mirrors "seen" in every other way. Added tooltips to most options for check tracker color picking to describe what each status actually means. * `std::format` pls * So apparently std::format just decided to break with the latest merge from develop, but fmt::format exists and works? * Removed the last vestiges of `locationsSkipped`. Other general code and formatting cleanups. Moved `IsGameRunning` to `OTRGlobals` so the item tracker could also access it. Used preceding to "fix" item and bottle display in the item tracker on startup. * Some more code cleanup. Removed "Recheck Area" button and relevant code. Backported changes to Anchor branch applicable for single-player, including making a checkAreas vector and structuring the frame by frame checks around that. Also includes fix for Silver Gauntlets and Mirror Shield check collection crash associated with those changes. Fixed Kakariko Bazaar "seen" updates. Fixed tracker window not showing on initial load like it should. * Forgot 1 formatting fix. * Removed conditions for showing Song from Impa (isn't junk under certain conditions, so should show all the time). * Fix vanilla checks, add Zelda's Letter and Malon's Egg to manual check collection. Fix autoscroll while in child stealth section. * Fix crash in Happy Mask Shop in OnSlotChange (referenced non-existent shop id in a tracker-specific enum). * General code cleanup. * Missed one reversion. * One more. * Fix column alignment in `randomizer_check_objects`. * Fix file encoding on `randomizer_check_tracker`. Again. * Fix indentation for `actualItemtrackerItemMap`. Also removed unnecessary parts of the map. * Rename `HasEqItem` to `HasEquipment`. * Slightly better indentation for `actualItemTrackerItemMap`. * Add magic bean salesman to vanilla check tracking, and genericized deku shield to trigger KF shop item 3 wherever you get the shield. Renamed `vanillaCheck` to `vanillaHundoCheck` to (supposedly) clarify the meaning of the usage. * One more rename to `vanillaCompletion` to avoid possible confusion with 100% speedrun conditions. * give me a break XD Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * Changes suggested by briaguya (rename `RandomizerCheckShow` to `Status`, unused code, newline formatting) * Remove unused `itemNames` table. * Remove `IsGameRunning` in favor of `GameInteractor::IsSaveLoaded`. * Restore anti-spoiler functionality for dungeons with dungeon maps. * Review cleanup. * Fix prices not showing for Kak bazaar items. --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com>
2023-10-04 11:03:36 -04:00
(rcObj.rc != RC_ZR_MAGIC_BEAN_SALESMAN || showBeans) &&
(rcObj.rc != RC_HC_MALON_EGG || showWeirdEgg) &&
(rcObj.rcType != RCTYPE_FROG_SONG || showFrogSongRupees) &&
(rcObj.rcType != RCTYPE_MAP_COMPASS || showStartingMapsCompasses) &&
(rcObj.rcType != RCTYPE_SMALL_KEY || showKeysanity) &&
(rcObj.rcType != RCTYPE_BOSS_KEY || showBossKeysanity) &&
(rcObj.rcType != RCTYPE_GANON_BOSS_KEY || showGanonBossKey) &&
(rcObj.rc != RC_KAK_100_GOLD_SKULLTULA_REWARD || show100SkullReward) &&
(rcObj.rcType != RCTYPE_GF_KEY && rcObj.rc != RC_GF_GERUDO_MEMBERSHIP_CARD ||
(showGerudoCard && rcObj.rc == RC_GF_GERUDO_MEMBERSHIP_CARD) ||
(fortressNormal && showGerudoFortressKeys && rcObj.rcType == RCTYPE_GF_KEY) ||
(fortressFast && showGerudoFortressKeys && rcObj.rc == RC_GF_NORTH_F1_CARPENTER)
);
Randomizer Auto Location tracker (#1942) * Initial Auto-Location Tracking * Updates styling for checked items in Check Tracker * Fixes crashing issues with Check Tracker rendering * Auto scroll Check Tracker windows to current area * Checks Tracker only shows checked locations once in game * Fixes issue where Check Tracker would auto-scroll to wrong location when entering a grotto * Fixes gerudo fortress checks showing in tracker when settings have them removed * InfTable Check Location Fixes: Lost Dog Richard, Rolling Gorons, HBA 1000, Thawed Zora * Fixes most Event Chk Inf Checks on Check Tracker, and Frogs * Check Tracker - Song from Malon now works * Check Tracker - Fixes Claim Check check not tracking - Fixes spoiler for Claim Check check when getting Biggoron's Sword - Fixes LACS being spoiled and not tracking * Check Tracker - Fixes #2 for Skull Mask and Mask of Truth checks * Check Tracker - Adds support for merchants - Fixes #7 for Bomchu Salesman - Fixes #12 for Medigoron * Check Tracker - Fixes #8 for Song from Saria * Check Tracker - Fixes #9 for Adult Shooting Gallery * Check Tracker - Fixes #10 for Composer Grave * Check Tracker - Fixes #14 for Song from Ocarina of Time * Check Tracker - Fixes #16 for Shooting the Sun * Check Tracker - Fixes #19 for Darunia's Joy * Save Editor - Adds missing label for Treasure Chest Game * Check Tracker - Fixes Great Faries checks * Check Tracker - Fixes Sheik at Temple * Check Tracker - Fixes Great Fairy auto-scroll to wrong location * Check Tracker - Updates blue warp checks - Fixes Bongo Bongo and Twinrova checks * Check Tracker - Fixes Dampe's Gravedigging Tour * Check Tracker - Fixes Prescription to King Zora * Check Tracker - Fixes Bazaar showing under wrong area on tracker between adult/child * Check Tracker - Fixes scroll for Hyrule Market and Bazaar * Check Tracker - Fixes giving Adult Trade Items shown on tracker: Broken Sword, Saw, Cojiro, Eyeball Froge, and Eyedrops * Cleans up item_location * Check Tracker - Item List - Fixes item list not updating when changing seeds/options - Separates item exclusion list from item check list - Clean up comments * Check Tracker - Adds Skip functionality to buttons * Check Tracker - Refactors adult trade items to RandomizerInf * Check Tracker - Fixes an issue where any time an item is removed the tracker would cause an application crash * Check Tracker - Item names are now dependent on file language * Check Tracker - Fixes Gerudo Card check not showing in Fast setting * Reorders headers to (hopefully) avoid CI build conflicts on linux/consoles * Explicitly defines vector header in randomizer.h to fix compile errors * Complete Refactor of Check Tracker ImGui * Adds missing check tracker files to CMakeLists * Reverts the Item_location whitespace cleanup from ad10807c * Check Tracker - Loading Fixes - Fixes a bug where loading a save file a second time would add all the checks again - Fixes a bug where the check tracker would not render at all until in a save file * Check Tracker - Fixes a bug where checks would sometimes fail to load * Check Tracker - Fixes duplicated checks when using Only on Pause or Only on Combo * Check Tracker - Works around issue where single characters don't show in EnhancementCombobox, and fixes a label for combo buttons held option * Check Tracker - Applies all Check Tracker changes to Item Location * Check Tracker - Updated Check List - Adds Link's pocket, either in KF or HM depending on starting age - Supports Scrubs and Merchants - Uses enums instead of magic numbers - Updates DC Scrub Short Names for MQ * Check Tracker - Adds a performance mode option * Check Tracker - List Fixes (requires new rando generation) - Fixes Frogs Rupees always visible - Fixes Kokiri Sword Chest not showing - Fixes Weird Egg not showing * Check Tracker - MQ List basic support * Check Tracker - MQ/Vanilla anti-spoilers * Check Tracker - Collecting a compass now spoils the area * Check Tracker - Basic Vanilla Support and fixes - Vanilla items show in check tracker, even if many won't auto check - Fixes an issue with Gerudo Fortress Keys - Refactors IsVisibleInCheckTracker to randomizer_check_tracjer * Check Tracker - Fixes merge conflict from 08a487f35e1d760ab9e69b932edbe4da6bcd9edb * Check Tracker - Fixes tracker loading as Floating when default value is set to Windowed * Randomizer Location Exclusion List - Adds Scrubs, Merchants, Shops. Adult Trade items, MQ Dungeons, and Bean Salesman - Fixes Kokiri Sword Chest, Weird Egg, and Frog Song Rupees from misbehaving - Updates Gerudo Fortress logic to be dependent on Open/Fast/Normal Fortress - Removes Invalid Check - Adds RO Enum for MQ settings - Updates magic values to RO enum * Location Exclusion List - Scrubs that are always randomized now always show on the list * For now, removes some extra code only needed for a Check Tracker. * Randomizer Location Exclusion List - Fixes Eyeball Frog from showing up when Adult Trade Items was off * Location Tracker - Updates Eyedrops to use RandomizerInf instead of Chest * Check Tracker - Fixes a bug where Link's Pocket item wasn't acting as checked for area item count * Check Tracker - Fixes a bug where Locations would incorrectly say Vanilla due to the first check in the area being a non-MQ check * Check Tracker - Fixes a crash when Check Tracker is docked but not visible * Check Tracker - Fixes areas being spoiled when loading different save files * Check Tracker - Only reset variables if they are initialized * Check Tracker - Cleans up old comments, unused variables, methods, and macros, adds language TODOs, * Check Tracker - Readds rainbow UI elements after Cosmetics Editor refactor * Check Tracker - Removal of flag lookup that was refactored, no longer needed header, and some trivial whitespace fixes. * Check Tracker - Refactors Index to Bitmask code to a macro * Check Tracker - Changes ordering from alphabetical to RandomizerCheck ordering * Check Tracker - Wraps everything in a namespace to avoid global variable usage * Check Tracker - Explicitly defines for-loop scope * Check Tracker - refactors dungeon lookup from static array to function * Fixes a bug when using EnhancementColor with alpha * Check Tracker - Refactors all colour to use direct conversions * Check Tracker - refactors settings loading and check visibility for readability * Check Tracker - Fixes a bug where the wrong label showed on the Check Tracker BG Color * UIWidgets - Adds Alpha bar to EnhancementColor when using alpha parameter
2022-12-10 22:39:23 -05:00
}
Check Tracker Update (#2668) * Initial commit. What works so far: Data file loads, saves, deletes, and is created properly. - Need to run `HasItemBeenCollected` when creating in case of mid-seed regen. Organized checks into maps set by area. Areas show in tracker. - Checks pulled from checkObjectsByArea are not currently listed. - Areas are being assumed completed and hidden at the start. * Checks now populate. Still not counting area totals properly. * Don't track RC_LINKS_POCKET in the data file, and instead manually add it in every time a save is load. rcObjects doesn't contain Link's Pocket location (duh). * Moved ItemReceive hook to randomizer_check_tracker.cpp. Skipped items are properly sorted and formatted. Saved items contribute to an area's gotten/skipped checks on load. Changed skipped items default main color to gray. General code cleanup. * Skipped checks now contribute to area totals for area completion logic. * Mid-menu rework transfer. * Started check lookup on item receive. Tried to enable scum checking on save. * Fixed scum check on save. * More code cleanup, which revealed some issues with loading and saving. Loading now works 100%, but entries in checkTrackerData are disappearing in code somewhere, causing issues with later checks. Scummed color now displays properly. Collected but unsaved displays properly. Unchecked, Skipped, Seen and Scummed checks all have arrows for skipping/unskipping. Counts a little messed up, probably double adding skips. * Fixed item counts being off across resets. Restarts were fine. * Beginning of rework for individual check updates. Adds `Actor lastCheck` to PlayState to allow assigning of last actor to give an item. This allows precise tracking of GS, freestanding PoH, etc. Works for chests too. Currently does not work for shops, unknown for normal NPC gives. Doesn't track last gives for non-checks, like drops from grass, pots, crates, etc. * Actor-based checks fully fleshed out, but can't help with sale-based checks. Implemented `pendingSaleCheck` to back out of an RC check cycle if `gSaveContext->pendingSale` is not NONE when `OnItemReceive` is called, processed through `OnSaleEnd`. This should be the final change necessary to streamline the checks. * Temporary hook to message box close to tie in trackers for non-gs/chest actors that aren't added to `GetCheckFromActor`. This triggers a 2-frame countdown to check with `HasItemBeenCollected` since half of the methods in there aren't updated until after a text box closes. Added scene tracking to get last scene so that checks in scenes that span several overworld areas could be tied to their areas properly. Modified tracker data creation to apply Link's Pocket and Song from Impa conditionally based on randomizer settings instead of just being assumed to be done. May need modification for checking click and drag spoiler loading. Removed the scene equivalence check from CheckChecks so that an entire area is checked each time to avoid issues with, e.g., leaving a shop before a pending sale finishes. * Changed check data creation to use RSKs from gRandomizer to account for settings loaded from drag and drop spoilers. * Beginning of tracker code organization. Changed check color defaults. * Reverted moving tracker colors to header. Some individual check fixes. * Missed something from previous merge? * Removed last remnant of removed performance mode. * Better handle checking when skullsanity is off. * Song checks sceneIDs don't match the scenes they're actually in for some reason. Removed that check. * SaleEnd checks don't need the GetItemEntry parameter. Also set a flag that should prevent the check tracker from running during vanilla saves should that not be resolved by the time it's merged. * Attempting to have only the relevant checks added to the tracker data, as well as showing vanilla checks for non-rando saves. Not working yet (everything is displayed in vanilla). * Added vanilla check tracker population via `vanillaCheck` bool in `RandomizerCheckObject`. This is also added to `IsVisibleInImGui` to handle file loading and saving to eliminate checks that aren't part of vanilla or the rando seed. Implemented deleted tracker data file recreation. Added some extra item name text checks. Songs are still... tricky, so they stay blank. Utilize local copies of the randomizer check objects that are applicable for performance purposes. Fixed vanilla item-giving cutscene crashes when triggered mid-transition. * Apparently not all toolchains can handle macro instantiation without all parameters, like VS can. * Fixed scummed detail color not showing properly on tracker. * Fixed dungeon area totals and GS checks not functioning properly. * Major revamp of checking code. Doesn't rely on `GetCheckFromActor` at all anymore, but instead simply sets a flag to evaluate a number of checks in an area every frame until the check that was gotten is identified. With the new setup, it's much less hardware intensive, and at 60fps 6 checks per frame shows no noticeable effect on framerate. I can envision needing to add a collectedCount in order to account for times when two checks are gotten one right after the other. Changed area scroll to happen from `OnTransitionEnd`, and allow for scrolling in bazaar (was disabled previously because it would jump back and forth between Kak and Market while you were in one). Also setup area check order updating by area instead of all at the same time. * Fixed shooting gallery not reporting proper area. Prevent checks from actually happening if area is RCAREA_INVALID, now that all areas are reporting something if they have checks. Fixed `GetCheckArea()` not updating checks for standard scenes. Lots of vanilla tracking updates, mainly manual checks for gems, medallions and songs, since the often don't have proper scenes in the data. Prevent vanilla from triggering check loops if junk items are collected. Fixed sorting based on saved vs collected. Prevent item name display for vanilla runs. Change coloring of checks so the check name reflects status in vanilla runs. * Fixed "Recheck Area" button erroneously adding to an area's check totals? * Fix DMC vanilla checks. * Fix check tracker data recreation on data file loss. Removed redundant file exists check from SaveTrackerDataHook, as it doesn't matter if it exists or not at that point. Limited check loops to 3 to avoid infinite check loops on non-check/junk item pickup. Added more checks to disable tracker operations if a save is not running. Changed check ordering to put boss reward and heart container checks at the end of whatever RCSHOW group they belong to. * Fixed IsRunning calculation. Further improving vanilla checking. Starting framework for checking medallions, stones, and songs on data file recreation. Fixed medallion check collection. Added GIFT_FROM_SAGES to check list for vanilla file for tracking light medallion. Added check loop limitation to prevent infinite checking after picking up junk item from the ground. * Finished vanilla file recreation and recheck (songs and dungeon rewards all check properly now). This includes deku shield with KF shop item 3. Finished Gift from Raoru light medallion tracking for vanilla. Commented all CheckByScene functionality for now. * Fixed new save data file creation. Disabled entrance area calculation for now, as it only tracks the previous entrance for some reason. Fixed area detection for ToT checks. * GetCheckArea() now utilizes EntranceData almost exclusively, via either `gSaveContext.entranceIndex` or the entrance tracker's `currentGrottoId` in the case of grottos. This also means that EVERYTHING CAN AUTOSCROLL NOW. Entrance shuffles are now much easier to track. Autoscroll is now also triggered on save, just in case someone isn't autosaving and has a lot of checks that get converted to saved. * Fixed missing GS check in LW. * Added area scroll on toggling Show Hidden Items. May configure differently later. Fixed area detection for entrances in Gerudo Fortress/Valley and Collossus. Haunted wasteland doesn't autoscroll due to a bug in `OnTransitionEnd` hook, but checks still evaluate properly there. Rely on scene-based area detection if scene is a main overworld or dungeon scene. * Fixed grotto detection when shuffle is off. * Small code cleanup. Fixed Colossus hand chest checks. * Missing lus bump from merge conflict resolution * Fixed Colossus Grotto making `GetCheckArea` return Wasteland. * Improved OnItemReceive processing for non-token GS checks, since they can sometimes take long enough for the checking process to time out before the item is registered as received. * First attempt at thread safety for tracker data file writing. Seems to work, but might need more testing. * Fixed Recheck Area not unskipping items that register as saved. Improved delayed saving with autosaving, as the autosave triggered quite often before the tracker data save, making things not properly register as saved. * merge cleanup * Converted check tracker data to the sectional saves, adding `CheckTrackerData` to `SaveContext`. Implemented section ID returning and fullSave boolean passing to section functions from my PR temporarily for it to work properly. Moved `RandomizerCheckTrackerData` enum to `randomizerTypes.h` to accommodate that. Changed `Randomizer_SaveInit` to a `SaveManager::InitFunc` to allow for other randomizer-dependent sections to be initialized after that. Required a little refactoring to maintain intro cutscene skip when starting a randomizer file. * Revert section index return and randomizer init changes. Will need to wait on yet more changes to main. * Fixed check tracker initialization (shouldn't be tied to window initialization), restored saving/loading functionality. * Removed `CheckTracker::Init` and put SaveManager calls in `CheckTrackerWindow::InitElement`. Also a bit of cleanup from transition back to save file use. * Fixed tracker displaying check categories while file not loaded. * Fix Darunia's Joy check not marking in vanilla. * Fix autosave not triggering change from collected to saved in tracker data. * Changed default colors for scummed and collected display. * Merge upgrade code cleanup. * Add `OnTransitionEnd` calls to sandstorm transitions both to and from Wasteland. Also improved `gSaveContext.lastScene` assignment for both transition types. Allowed a bit of cleanup in `GetCheckArea`. * Added `StateButton`, a button like `ArrowButton` but that allows text instead of arrow icons. Apparently the changes from ArrowButton to StateButton happened in a previous commit... * Changed section name to `trackerDataCheck` to force SoH to load it after the randomizer section, as it required some randoSettings to be loaded first, and nothing else I tried to make the randomizer section load before it worked. This hacks a solution to checks not displaying on fast file load to a specific slot. F*** you, SaveManager, and f*** you too, JSON. * Forgot to change the section string for loading with the name change. * Fix check ordering for checks that trigger the autosave. * Adds option to remove right-side shop items (slots 1-4) from the tracker list. Enabled by default. * Fix default state of Hide Shop Right Checks checkbox. * Fixes grotto and great fairy scrolling and checks. Fixes array overflow from `checkTrackerData` which was creating the issue trying to load the base and randomizer sections first, among other things. That also fixed the massive file loads that were being exhibited in debug mode. * Fix shooting galleries being set as collected again when being played a second time after getting the checks. * Fix Bazaar autoscroll. * Add Saria's Song to `GetCheckFromActor` and removed some limitations from the messageCloseCheck function to make that check track properly. * Fix Song from Impa check. Implemented prevention for multiple "collections" of great fairies, just in case getting the health refill would trigger it with the previous setup. * Fix ice traps on GS tokens not triggering OnItemReceive. * Complete fix for ice trap collection from GS. Add autoscroll when clicking "Expand All". * Add `OnShopSlotChange` with cursorSlot and basePrice parameters. * Fixed include in en_ossan for shop slot hook. Added registration for `OnShopSlotChange` in the tracker, storing the price in a new `price` field in `CheckTrackerData`. Added "seen" functionality to shop checks. Displays the model item name upon first entering a shop, adding the price and switching to trickName (if it's an ice trap) upon navigating to the slot in buy mode, triggered by an invisible "identified" status that mirrors "seen" in every other way. Added tooltips to most options for check tracker color picking to describe what each status actually means. * `std::format` pls * So apparently std::format just decided to break with the latest merge from develop, but fmt::format exists and works? * Removed the last vestiges of `locationsSkipped`. Other general code and formatting cleanups. Moved `IsGameRunning` to `OTRGlobals` so the item tracker could also access it. Used preceding to "fix" item and bottle display in the item tracker on startup. * Some more code cleanup. Removed "Recheck Area" button and relevant code. Backported changes to Anchor branch applicable for single-player, including making a checkAreas vector and structuring the frame by frame checks around that. Also includes fix for Silver Gauntlets and Mirror Shield check collection crash associated with those changes. Fixed Kakariko Bazaar "seen" updates. Fixed tracker window not showing on initial load like it should. * Forgot 1 formatting fix. * Removed conditions for showing Song from Impa (isn't junk under certain conditions, so should show all the time). * Fix vanilla checks, add Zelda's Letter and Malon's Egg to manual check collection. Fix autoscroll while in child stealth section. * Fix crash in Happy Mask Shop in OnSlotChange (referenced non-existent shop id in a tracker-specific enum). * General code cleanup. * Missed one reversion. * One more. * Fix column alignment in `randomizer_check_objects`. * Fix file encoding on `randomizer_check_tracker`. Again. * Fix indentation for `actualItemtrackerItemMap`. Also removed unnecessary parts of the map. * Rename `HasEqItem` to `HasEquipment`. * Slightly better indentation for `actualItemTrackerItemMap`. * Add magic bean salesman to vanilla check tracking, and genericized deku shield to trigger KF shop item 3 wherever you get the shield. Renamed `vanillaCheck` to `vanillaHundoCheck` to (supposedly) clarify the meaning of the usage. * One more rename to `vanillaCompletion` to avoid possible confusion with 100% speedrun conditions. * give me a break XD Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * Changes suggested by briaguya (rename `RandomizerCheckShow` to `Status`, unused code, newline formatting) * Remove unused `itemNames` table. * Remove `IsGameRunning` in favor of `GameInteractor::IsSaveLoaded`. * Restore anti-spoiler functionality for dungeons with dungeon maps. * Review cleanup. * Fix prices not showing for Kak bazaar items. --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com>
2023-10-04 11:03:36 -04:00
else if (rcObj.vanillaCompletion) {
return (rcObj.vOrMQ == RCVORMQ_BOTH ||
Flag tracker (#3447) * Hook into flagset hooks for processing check tracking. Has some manual workarounds (some breaks still need to be found). Remove areaChecks and looping functionality as redundant. * Additional vanilla handling. * Fix tracker not showing MQ checks in MQ non-rando. Fix tracker marking non-MQ variants of dungeon checks (e.g. map chest, etc) when collecting in MQ. * Set all areas to spoiled if not rando. * Revert attempt to spoil in randomizer based on MQ dungeon count as I don't know how that works at the moment. * Restore and update spoiling based on MQ dungeon settings (none, selection, or count of 12). Fix Anju As Adult check. * Remove Anchor-specific code :baguette: * Use `ClearAreaTotals()` in `Teardown()` instead of the duplicate code there. * Update to `ClearAreaChecksAndTotals()` with `vec.clear()` added. * Fix type spoiling again. Now spoils on 0 MQ dungeons, not rando, if the option is enabled in check tracker settings, selection, or set number of 12. Fix vanilla checks being marked collected in MQ dungeons. * Fix 100 GS check. * ACTUALLY fix 100 GS: change flag type to `RandomizerInf()` in `item_location.cpp`, add RC to RandoInf for it to the table. Also don't send GI for flag if father, falsely triggers ZR frogs minigame. * Fix gravedigging tour tracking. * Fix membership card check tracking. Change scene and flag values to any existing enums. Clarifying formatting for the checking loop vOrMQ conditions. * Fix Gravedigging Tour tracking. Simplify Always Win Gravedigging Tour and Fix Gravedigging Tour Glitch applications. Modified all necessary paths to use vanilla GDT PoH collection flag instead of randomizer variant. * Fix Kak Potion Shop being "seen" when entering as child.
2023-11-28 21:25:48 -05:00
(rcObj.vOrMQ == RCVORMQ_MQ && IS_MASTER_QUEST) ||
(rcObj.vOrMQ == RCVORMQ_VANILLA && !IS_MASTER_QUEST) ||
Check Tracker Update (#2668) * Initial commit. What works so far: Data file loads, saves, deletes, and is created properly. - Need to run `HasItemBeenCollected` when creating in case of mid-seed regen. Organized checks into maps set by area. Areas show in tracker. - Checks pulled from checkObjectsByArea are not currently listed. - Areas are being assumed completed and hidden at the start. * Checks now populate. Still not counting area totals properly. * Don't track RC_LINKS_POCKET in the data file, and instead manually add it in every time a save is load. rcObjects doesn't contain Link's Pocket location (duh). * Moved ItemReceive hook to randomizer_check_tracker.cpp. Skipped items are properly sorted and formatted. Saved items contribute to an area's gotten/skipped checks on load. Changed skipped items default main color to gray. General code cleanup. * Skipped checks now contribute to area totals for area completion logic. * Mid-menu rework transfer. * Started check lookup on item receive. Tried to enable scum checking on save. * Fixed scum check on save. * More code cleanup, which revealed some issues with loading and saving. Loading now works 100%, but entries in checkTrackerData are disappearing in code somewhere, causing issues with later checks. Scummed color now displays properly. Collected but unsaved displays properly. Unchecked, Skipped, Seen and Scummed checks all have arrows for skipping/unskipping. Counts a little messed up, probably double adding skips. * Fixed item counts being off across resets. Restarts were fine. * Beginning of rework for individual check updates. Adds `Actor lastCheck` to PlayState to allow assigning of last actor to give an item. This allows precise tracking of GS, freestanding PoH, etc. Works for chests too. Currently does not work for shops, unknown for normal NPC gives. Doesn't track last gives for non-checks, like drops from grass, pots, crates, etc. * Actor-based checks fully fleshed out, but can't help with sale-based checks. Implemented `pendingSaleCheck` to back out of an RC check cycle if `gSaveContext->pendingSale` is not NONE when `OnItemReceive` is called, processed through `OnSaleEnd`. This should be the final change necessary to streamline the checks. * Temporary hook to message box close to tie in trackers for non-gs/chest actors that aren't added to `GetCheckFromActor`. This triggers a 2-frame countdown to check with `HasItemBeenCollected` since half of the methods in there aren't updated until after a text box closes. Added scene tracking to get last scene so that checks in scenes that span several overworld areas could be tied to their areas properly. Modified tracker data creation to apply Link's Pocket and Song from Impa conditionally based on randomizer settings instead of just being assumed to be done. May need modification for checking click and drag spoiler loading. Removed the scene equivalence check from CheckChecks so that an entire area is checked each time to avoid issues with, e.g., leaving a shop before a pending sale finishes. * Changed check data creation to use RSKs from gRandomizer to account for settings loaded from drag and drop spoilers. * Beginning of tracker code organization. Changed check color defaults. * Reverted moving tracker colors to header. Some individual check fixes. * Missed something from previous merge? * Removed last remnant of removed performance mode. * Better handle checking when skullsanity is off. * Song checks sceneIDs don't match the scenes they're actually in for some reason. Removed that check. * SaleEnd checks don't need the GetItemEntry parameter. Also set a flag that should prevent the check tracker from running during vanilla saves should that not be resolved by the time it's merged. * Attempting to have only the relevant checks added to the tracker data, as well as showing vanilla checks for non-rando saves. Not working yet (everything is displayed in vanilla). * Added vanilla check tracker population via `vanillaCheck` bool in `RandomizerCheckObject`. This is also added to `IsVisibleInImGui` to handle file loading and saving to eliminate checks that aren't part of vanilla or the rando seed. Implemented deleted tracker data file recreation. Added some extra item name text checks. Songs are still... tricky, so they stay blank. Utilize local copies of the randomizer check objects that are applicable for performance purposes. Fixed vanilla item-giving cutscene crashes when triggered mid-transition. * Apparently not all toolchains can handle macro instantiation without all parameters, like VS can. * Fixed scummed detail color not showing properly on tracker. * Fixed dungeon area totals and GS checks not functioning properly. * Major revamp of checking code. Doesn't rely on `GetCheckFromActor` at all anymore, but instead simply sets a flag to evaluate a number of checks in an area every frame until the check that was gotten is identified. With the new setup, it's much less hardware intensive, and at 60fps 6 checks per frame shows no noticeable effect on framerate. I can envision needing to add a collectedCount in order to account for times when two checks are gotten one right after the other. Changed area scroll to happen from `OnTransitionEnd`, and allow for scrolling in bazaar (was disabled previously because it would jump back and forth between Kak and Market while you were in one). Also setup area check order updating by area instead of all at the same time. * Fixed shooting gallery not reporting proper area. Prevent checks from actually happening if area is RCAREA_INVALID, now that all areas are reporting something if they have checks. Fixed `GetCheckArea()` not updating checks for standard scenes. Lots of vanilla tracking updates, mainly manual checks for gems, medallions and songs, since the often don't have proper scenes in the data. Prevent vanilla from triggering check loops if junk items are collected. Fixed sorting based on saved vs collected. Prevent item name display for vanilla runs. Change coloring of checks so the check name reflects status in vanilla runs. * Fixed "Recheck Area" button erroneously adding to an area's check totals? * Fix DMC vanilla checks. * Fix check tracker data recreation on data file loss. Removed redundant file exists check from SaveTrackerDataHook, as it doesn't matter if it exists or not at that point. Limited check loops to 3 to avoid infinite check loops on non-check/junk item pickup. Added more checks to disable tracker operations if a save is not running. Changed check ordering to put boss reward and heart container checks at the end of whatever RCSHOW group they belong to. * Fixed IsRunning calculation. Further improving vanilla checking. Starting framework for checking medallions, stones, and songs on data file recreation. Fixed medallion check collection. Added GIFT_FROM_SAGES to check list for vanilla file for tracking light medallion. Added check loop limitation to prevent infinite checking after picking up junk item from the ground. * Finished vanilla file recreation and recheck (songs and dungeon rewards all check properly now). This includes deku shield with KF shop item 3. Finished Gift from Raoru light medallion tracking for vanilla. Commented all CheckByScene functionality for now. * Fixed new save data file creation. Disabled entrance area calculation for now, as it only tracks the previous entrance for some reason. Fixed area detection for ToT checks. * GetCheckArea() now utilizes EntranceData almost exclusively, via either `gSaveContext.entranceIndex` or the entrance tracker's `currentGrottoId` in the case of grottos. This also means that EVERYTHING CAN AUTOSCROLL NOW. Entrance shuffles are now much easier to track. Autoscroll is now also triggered on save, just in case someone isn't autosaving and has a lot of checks that get converted to saved. * Fixed missing GS check in LW. * Added area scroll on toggling Show Hidden Items. May configure differently later. Fixed area detection for entrances in Gerudo Fortress/Valley and Collossus. Haunted wasteland doesn't autoscroll due to a bug in `OnTransitionEnd` hook, but checks still evaluate properly there. Rely on scene-based area detection if scene is a main overworld or dungeon scene. * Fixed grotto detection when shuffle is off. * Small code cleanup. Fixed Colossus hand chest checks. * Missing lus bump from merge conflict resolution * Fixed Colossus Grotto making `GetCheckArea` return Wasteland. * Improved OnItemReceive processing for non-token GS checks, since they can sometimes take long enough for the checking process to time out before the item is registered as received. * First attempt at thread safety for tracker data file writing. Seems to work, but might need more testing. * Fixed Recheck Area not unskipping items that register as saved. Improved delayed saving with autosaving, as the autosave triggered quite often before the tracker data save, making things not properly register as saved. * merge cleanup * Converted check tracker data to the sectional saves, adding `CheckTrackerData` to `SaveContext`. Implemented section ID returning and fullSave boolean passing to section functions from my PR temporarily for it to work properly. Moved `RandomizerCheckTrackerData` enum to `randomizerTypes.h` to accommodate that. Changed `Randomizer_SaveInit` to a `SaveManager::InitFunc` to allow for other randomizer-dependent sections to be initialized after that. Required a little refactoring to maintain intro cutscene skip when starting a randomizer file. * Revert section index return and randomizer init changes. Will need to wait on yet more changes to main. * Fixed check tracker initialization (shouldn't be tied to window initialization), restored saving/loading functionality. * Removed `CheckTracker::Init` and put SaveManager calls in `CheckTrackerWindow::InitElement`. Also a bit of cleanup from transition back to save file use. * Fixed tracker displaying check categories while file not loaded. * Fix Darunia's Joy check not marking in vanilla. * Fix autosave not triggering change from collected to saved in tracker data. * Changed default colors for scummed and collected display. * Merge upgrade code cleanup. * Add `OnTransitionEnd` calls to sandstorm transitions both to and from Wasteland. Also improved `gSaveContext.lastScene` assignment for both transition types. Allowed a bit of cleanup in `GetCheckArea`. * Added `StateButton`, a button like `ArrowButton` but that allows text instead of arrow icons. Apparently the changes from ArrowButton to StateButton happened in a previous commit... * Changed section name to `trackerDataCheck` to force SoH to load it after the randomizer section, as it required some randoSettings to be loaded first, and nothing else I tried to make the randomizer section load before it worked. This hacks a solution to checks not displaying on fast file load to a specific slot. F*** you, SaveManager, and f*** you too, JSON. * Forgot to change the section string for loading with the name change. * Fix check ordering for checks that trigger the autosave. * Adds option to remove right-side shop items (slots 1-4) from the tracker list. Enabled by default. * Fix default state of Hide Shop Right Checks checkbox. * Fixes grotto and great fairy scrolling and checks. Fixes array overflow from `checkTrackerData` which was creating the issue trying to load the base and randomizer sections first, among other things. That also fixed the massive file loads that were being exhibited in debug mode. * Fix shooting galleries being set as collected again when being played a second time after getting the checks. * Fix Bazaar autoscroll. * Add Saria's Song to `GetCheckFromActor` and removed some limitations from the messageCloseCheck function to make that check track properly. * Fix Song from Impa check. Implemented prevention for multiple "collections" of great fairies, just in case getting the health refill would trigger it with the previous setup. * Fix ice traps on GS tokens not triggering OnItemReceive. * Complete fix for ice trap collection from GS. Add autoscroll when clicking "Expand All". * Add `OnShopSlotChange` with cursorSlot and basePrice parameters. * Fixed include in en_ossan for shop slot hook. Added registration for `OnShopSlotChange` in the tracker, storing the price in a new `price` field in `CheckTrackerData`. Added "seen" functionality to shop checks. Displays the model item name upon first entering a shop, adding the price and switching to trickName (if it's an ice trap) upon navigating to the slot in buy mode, triggered by an invisible "identified" status that mirrors "seen" in every other way. Added tooltips to most options for check tracker color picking to describe what each status actually means. * `std::format` pls * So apparently std::format just decided to break with the latest merge from develop, but fmt::format exists and works? * Removed the last vestiges of `locationsSkipped`. Other general code and formatting cleanups. Moved `IsGameRunning` to `OTRGlobals` so the item tracker could also access it. Used preceding to "fix" item and bottle display in the item tracker on startup. * Some more code cleanup. Removed "Recheck Area" button and relevant code. Backported changes to Anchor branch applicable for single-player, including making a checkAreas vector and structuring the frame by frame checks around that. Also includes fix for Silver Gauntlets and Mirror Shield check collection crash associated with those changes. Fixed Kakariko Bazaar "seen" updates. Fixed tracker window not showing on initial load like it should. * Forgot 1 formatting fix. * Removed conditions for showing Song from Impa (isn't junk under certain conditions, so should show all the time). * Fix vanilla checks, add Zelda's Letter and Malon's Egg to manual check collection. Fix autoscroll while in child stealth section. * Fix crash in Happy Mask Shop in OnSlotChange (referenced non-existent shop id in a tracker-specific enum). * General code cleanup. * Missed one reversion. * One more. * Fix column alignment in `randomizer_check_objects`. * Fix file encoding on `randomizer_check_tracker`. Again. * Fix indentation for `actualItemtrackerItemMap`. Also removed unnecessary parts of the map. * Rename `HasEqItem` to `HasEquipment`. * Slightly better indentation for `actualItemTrackerItemMap`. * Add magic bean salesman to vanilla check tracking, and genericized deku shield to trigger KF shop item 3 wherever you get the shield. Renamed `vanillaCheck` to `vanillaHundoCheck` to (supposedly) clarify the meaning of the usage. * One more rename to `vanillaCompletion` to avoid possible confusion with 100% speedrun conditions. * give me a break XD Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * Changes suggested by briaguya (rename `RandomizerCheckShow` to `Status`, unused code, newline formatting) * Remove unused `itemNames` table. * Remove `IsGameRunning` in favor of `GameInteractor::IsSaveLoaded`. * Restore anti-spoiler functionality for dungeons with dungeon maps. * Review cleanup. * Fix prices not showing for Kak bazaar items. --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com>
2023-10-04 11:03:36 -04:00
rcObj.rc == RC_GIFT_FROM_SAGES) && rcObj.rc != RC_LINKS_POCKET;
Randomizer Auto Location tracker (#1942) * Initial Auto-Location Tracking * Updates styling for checked items in Check Tracker * Fixes crashing issues with Check Tracker rendering * Auto scroll Check Tracker windows to current area * Checks Tracker only shows checked locations once in game * Fixes issue where Check Tracker would auto-scroll to wrong location when entering a grotto * Fixes gerudo fortress checks showing in tracker when settings have them removed * InfTable Check Location Fixes: Lost Dog Richard, Rolling Gorons, HBA 1000, Thawed Zora * Fixes most Event Chk Inf Checks on Check Tracker, and Frogs * Check Tracker - Song from Malon now works * Check Tracker - Fixes Claim Check check not tracking - Fixes spoiler for Claim Check check when getting Biggoron's Sword - Fixes LACS being spoiled and not tracking * Check Tracker - Fixes #2 for Skull Mask and Mask of Truth checks * Check Tracker - Adds support for merchants - Fixes #7 for Bomchu Salesman - Fixes #12 for Medigoron * Check Tracker - Fixes #8 for Song from Saria * Check Tracker - Fixes #9 for Adult Shooting Gallery * Check Tracker - Fixes #10 for Composer Grave * Check Tracker - Fixes #14 for Song from Ocarina of Time * Check Tracker - Fixes #16 for Shooting the Sun * Check Tracker - Fixes #19 for Darunia's Joy * Save Editor - Adds missing label for Treasure Chest Game * Check Tracker - Fixes Great Faries checks * Check Tracker - Fixes Sheik at Temple * Check Tracker - Fixes Great Fairy auto-scroll to wrong location * Check Tracker - Updates blue warp checks - Fixes Bongo Bongo and Twinrova checks * Check Tracker - Fixes Dampe's Gravedigging Tour * Check Tracker - Fixes Prescription to King Zora * Check Tracker - Fixes Bazaar showing under wrong area on tracker between adult/child * Check Tracker - Fixes scroll for Hyrule Market and Bazaar * Check Tracker - Fixes giving Adult Trade Items shown on tracker: Broken Sword, Saw, Cojiro, Eyeball Froge, and Eyedrops * Cleans up item_location * Check Tracker - Item List - Fixes item list not updating when changing seeds/options - Separates item exclusion list from item check list - Clean up comments * Check Tracker - Adds Skip functionality to buttons * Check Tracker - Refactors adult trade items to RandomizerInf * Check Tracker - Fixes an issue where any time an item is removed the tracker would cause an application crash * Check Tracker - Item names are now dependent on file language * Check Tracker - Fixes Gerudo Card check not showing in Fast setting * Reorders headers to (hopefully) avoid CI build conflicts on linux/consoles * Explicitly defines vector header in randomizer.h to fix compile errors * Complete Refactor of Check Tracker ImGui * Adds missing check tracker files to CMakeLists * Reverts the Item_location whitespace cleanup from ad10807c * Check Tracker - Loading Fixes - Fixes a bug where loading a save file a second time would add all the checks again - Fixes a bug where the check tracker would not render at all until in a save file * Check Tracker - Fixes a bug where checks would sometimes fail to load * Check Tracker - Fixes duplicated checks when using Only on Pause or Only on Combo * Check Tracker - Works around issue where single characters don't show in EnhancementCombobox, and fixes a label for combo buttons held option * Check Tracker - Applies all Check Tracker changes to Item Location * Check Tracker - Updated Check List - Adds Link's pocket, either in KF or HM depending on starting age - Supports Scrubs and Merchants - Uses enums instead of magic numbers - Updates DC Scrub Short Names for MQ * Check Tracker - Adds a performance mode option * Check Tracker - List Fixes (requires new rando generation) - Fixes Frogs Rupees always visible - Fixes Kokiri Sword Chest not showing - Fixes Weird Egg not showing * Check Tracker - MQ List basic support * Check Tracker - MQ/Vanilla anti-spoilers * Check Tracker - Collecting a compass now spoils the area * Check Tracker - Basic Vanilla Support and fixes - Vanilla items show in check tracker, even if many won't auto check - Fixes an issue with Gerudo Fortress Keys - Refactors IsVisibleInCheckTracker to randomizer_check_tracjer * Check Tracker - Fixes merge conflict from 08a487f35e1d760ab9e69b932edbe4da6bcd9edb * Check Tracker - Fixes tracker loading as Floating when default value is set to Windowed * Randomizer Location Exclusion List - Adds Scrubs, Merchants, Shops. Adult Trade items, MQ Dungeons, and Bean Salesman - Fixes Kokiri Sword Chest, Weird Egg, and Frog Song Rupees from misbehaving - Updates Gerudo Fortress logic to be dependent on Open/Fast/Normal Fortress - Removes Invalid Check - Adds RO Enum for MQ settings - Updates magic values to RO enum * Location Exclusion List - Scrubs that are always randomized now always show on the list * For now, removes some extra code only needed for a Check Tracker. * Randomizer Location Exclusion List - Fixes Eyeball Frog from showing up when Adult Trade Items was off * Location Tracker - Updates Eyedrops to use RandomizerInf instead of Chest * Check Tracker - Fixes a bug where Link's Pocket item wasn't acting as checked for area item count * Check Tracker - Fixes a bug where Locations would incorrectly say Vanilla due to the first check in the area being a non-MQ check * Check Tracker - Fixes a crash when Check Tracker is docked but not visible * Check Tracker - Fixes areas being spoiled when loading different save files * Check Tracker - Only reset variables if they are initialized * Check Tracker - Cleans up old comments, unused variables, methods, and macros, adds language TODOs, * Check Tracker - Readds rainbow UI elements after Cosmetics Editor refactor * Check Tracker - Removal of flag lookup that was refactored, no longer needed header, and some trivial whitespace fixes. * Check Tracker - Refactors Index to Bitmask code to a macro * Check Tracker - Changes ordering from alphabetical to RandomizerCheck ordering * Check Tracker - Wraps everything in a namespace to avoid global variable usage * Check Tracker - Explicitly defines for-loop scope * Check Tracker - refactors dungeon lookup from static array to function * Fixes a bug when using EnhancementColor with alpha * Check Tracker - Refactors all colour to use direct conversions * Check Tracker - refactors settings loading and check visibility for readability * Check Tracker - Fixes a bug where the wrong label showed on the Check Tracker BG Color * UIWidgets - Adds Alpha bar to EnhancementColor when using alpha parameter
2022-12-10 22:39:23 -05:00
}
Check Tracker Update (#2668) * Initial commit. What works so far: Data file loads, saves, deletes, and is created properly. - Need to run `HasItemBeenCollected` when creating in case of mid-seed regen. Organized checks into maps set by area. Areas show in tracker. - Checks pulled from checkObjectsByArea are not currently listed. - Areas are being assumed completed and hidden at the start. * Checks now populate. Still not counting area totals properly. * Don't track RC_LINKS_POCKET in the data file, and instead manually add it in every time a save is load. rcObjects doesn't contain Link's Pocket location (duh). * Moved ItemReceive hook to randomizer_check_tracker.cpp. Skipped items are properly sorted and formatted. Saved items contribute to an area's gotten/skipped checks on load. Changed skipped items default main color to gray. General code cleanup. * Skipped checks now contribute to area totals for area completion logic. * Mid-menu rework transfer. * Started check lookup on item receive. Tried to enable scum checking on save. * Fixed scum check on save. * More code cleanup, which revealed some issues with loading and saving. Loading now works 100%, but entries in checkTrackerData are disappearing in code somewhere, causing issues with later checks. Scummed color now displays properly. Collected but unsaved displays properly. Unchecked, Skipped, Seen and Scummed checks all have arrows for skipping/unskipping. Counts a little messed up, probably double adding skips. * Fixed item counts being off across resets. Restarts were fine. * Beginning of rework for individual check updates. Adds `Actor lastCheck` to PlayState to allow assigning of last actor to give an item. This allows precise tracking of GS, freestanding PoH, etc. Works for chests too. Currently does not work for shops, unknown for normal NPC gives. Doesn't track last gives for non-checks, like drops from grass, pots, crates, etc. * Actor-based checks fully fleshed out, but can't help with sale-based checks. Implemented `pendingSaleCheck` to back out of an RC check cycle if `gSaveContext->pendingSale` is not NONE when `OnItemReceive` is called, processed through `OnSaleEnd`. This should be the final change necessary to streamline the checks. * Temporary hook to message box close to tie in trackers for non-gs/chest actors that aren't added to `GetCheckFromActor`. This triggers a 2-frame countdown to check with `HasItemBeenCollected` since half of the methods in there aren't updated until after a text box closes. Added scene tracking to get last scene so that checks in scenes that span several overworld areas could be tied to their areas properly. Modified tracker data creation to apply Link's Pocket and Song from Impa conditionally based on randomizer settings instead of just being assumed to be done. May need modification for checking click and drag spoiler loading. Removed the scene equivalence check from CheckChecks so that an entire area is checked each time to avoid issues with, e.g., leaving a shop before a pending sale finishes. * Changed check data creation to use RSKs from gRandomizer to account for settings loaded from drag and drop spoilers. * Beginning of tracker code organization. Changed check color defaults. * Reverted moving tracker colors to header. Some individual check fixes. * Missed something from previous merge? * Removed last remnant of removed performance mode. * Better handle checking when skullsanity is off. * Song checks sceneIDs don't match the scenes they're actually in for some reason. Removed that check. * SaleEnd checks don't need the GetItemEntry parameter. Also set a flag that should prevent the check tracker from running during vanilla saves should that not be resolved by the time it's merged. * Attempting to have only the relevant checks added to the tracker data, as well as showing vanilla checks for non-rando saves. Not working yet (everything is displayed in vanilla). * Added vanilla check tracker population via `vanillaCheck` bool in `RandomizerCheckObject`. This is also added to `IsVisibleInImGui` to handle file loading and saving to eliminate checks that aren't part of vanilla or the rando seed. Implemented deleted tracker data file recreation. Added some extra item name text checks. Songs are still... tricky, so they stay blank. Utilize local copies of the randomizer check objects that are applicable for performance purposes. Fixed vanilla item-giving cutscene crashes when triggered mid-transition. * Apparently not all toolchains can handle macro instantiation without all parameters, like VS can. * Fixed scummed detail color not showing properly on tracker. * Fixed dungeon area totals and GS checks not functioning properly. * Major revamp of checking code. Doesn't rely on `GetCheckFromActor` at all anymore, but instead simply sets a flag to evaluate a number of checks in an area every frame until the check that was gotten is identified. With the new setup, it's much less hardware intensive, and at 60fps 6 checks per frame shows no noticeable effect on framerate. I can envision needing to add a collectedCount in order to account for times when two checks are gotten one right after the other. Changed area scroll to happen from `OnTransitionEnd`, and allow for scrolling in bazaar (was disabled previously because it would jump back and forth between Kak and Market while you were in one). Also setup area check order updating by area instead of all at the same time. * Fixed shooting gallery not reporting proper area. Prevent checks from actually happening if area is RCAREA_INVALID, now that all areas are reporting something if they have checks. Fixed `GetCheckArea()` not updating checks for standard scenes. Lots of vanilla tracking updates, mainly manual checks for gems, medallions and songs, since the often don't have proper scenes in the data. Prevent vanilla from triggering check loops if junk items are collected. Fixed sorting based on saved vs collected. Prevent item name display for vanilla runs. Change coloring of checks so the check name reflects status in vanilla runs. * Fixed "Recheck Area" button erroneously adding to an area's check totals? * Fix DMC vanilla checks. * Fix check tracker data recreation on data file loss. Removed redundant file exists check from SaveTrackerDataHook, as it doesn't matter if it exists or not at that point. Limited check loops to 3 to avoid infinite check loops on non-check/junk item pickup. Added more checks to disable tracker operations if a save is not running. Changed check ordering to put boss reward and heart container checks at the end of whatever RCSHOW group they belong to. * Fixed IsRunning calculation. Further improving vanilla checking. Starting framework for checking medallions, stones, and songs on data file recreation. Fixed medallion check collection. Added GIFT_FROM_SAGES to check list for vanilla file for tracking light medallion. Added check loop limitation to prevent infinite checking after picking up junk item from the ground. * Finished vanilla file recreation and recheck (songs and dungeon rewards all check properly now). This includes deku shield with KF shop item 3. Finished Gift from Raoru light medallion tracking for vanilla. Commented all CheckByScene functionality for now. * Fixed new save data file creation. Disabled entrance area calculation for now, as it only tracks the previous entrance for some reason. Fixed area detection for ToT checks. * GetCheckArea() now utilizes EntranceData almost exclusively, via either `gSaveContext.entranceIndex` or the entrance tracker's `currentGrottoId` in the case of grottos. This also means that EVERYTHING CAN AUTOSCROLL NOW. Entrance shuffles are now much easier to track. Autoscroll is now also triggered on save, just in case someone isn't autosaving and has a lot of checks that get converted to saved. * Fixed missing GS check in LW. * Added area scroll on toggling Show Hidden Items. May configure differently later. Fixed area detection for entrances in Gerudo Fortress/Valley and Collossus. Haunted wasteland doesn't autoscroll due to a bug in `OnTransitionEnd` hook, but checks still evaluate properly there. Rely on scene-based area detection if scene is a main overworld or dungeon scene. * Fixed grotto detection when shuffle is off. * Small code cleanup. Fixed Colossus hand chest checks. * Missing lus bump from merge conflict resolution * Fixed Colossus Grotto making `GetCheckArea` return Wasteland. * Improved OnItemReceive processing for non-token GS checks, since they can sometimes take long enough for the checking process to time out before the item is registered as received. * First attempt at thread safety for tracker data file writing. Seems to work, but might need more testing. * Fixed Recheck Area not unskipping items that register as saved. Improved delayed saving with autosaving, as the autosave triggered quite often before the tracker data save, making things not properly register as saved. * merge cleanup * Converted check tracker data to the sectional saves, adding `CheckTrackerData` to `SaveContext`. Implemented section ID returning and fullSave boolean passing to section functions from my PR temporarily for it to work properly. Moved `RandomizerCheckTrackerData` enum to `randomizerTypes.h` to accommodate that. Changed `Randomizer_SaveInit` to a `SaveManager::InitFunc` to allow for other randomizer-dependent sections to be initialized after that. Required a little refactoring to maintain intro cutscene skip when starting a randomizer file. * Revert section index return and randomizer init changes. Will need to wait on yet more changes to main. * Fixed check tracker initialization (shouldn't be tied to window initialization), restored saving/loading functionality. * Removed `CheckTracker::Init` and put SaveManager calls in `CheckTrackerWindow::InitElement`. Also a bit of cleanup from transition back to save file use. * Fixed tracker displaying check categories while file not loaded. * Fix Darunia's Joy check not marking in vanilla. * Fix autosave not triggering change from collected to saved in tracker data. * Changed default colors for scummed and collected display. * Merge upgrade code cleanup. * Add `OnTransitionEnd` calls to sandstorm transitions both to and from Wasteland. Also improved `gSaveContext.lastScene` assignment for both transition types. Allowed a bit of cleanup in `GetCheckArea`. * Added `StateButton`, a button like `ArrowButton` but that allows text instead of arrow icons. Apparently the changes from ArrowButton to StateButton happened in a previous commit... * Changed section name to `trackerDataCheck` to force SoH to load it after the randomizer section, as it required some randoSettings to be loaded first, and nothing else I tried to make the randomizer section load before it worked. This hacks a solution to checks not displaying on fast file load to a specific slot. F*** you, SaveManager, and f*** you too, JSON. * Forgot to change the section string for loading with the name change. * Fix check ordering for checks that trigger the autosave. * Adds option to remove right-side shop items (slots 1-4) from the tracker list. Enabled by default. * Fix default state of Hide Shop Right Checks checkbox. * Fixes grotto and great fairy scrolling and checks. Fixes array overflow from `checkTrackerData` which was creating the issue trying to load the base and randomizer sections first, among other things. That also fixed the massive file loads that were being exhibited in debug mode. * Fix shooting galleries being set as collected again when being played a second time after getting the checks. * Fix Bazaar autoscroll. * Add Saria's Song to `GetCheckFromActor` and removed some limitations from the messageCloseCheck function to make that check track properly. * Fix Song from Impa check. Implemented prevention for multiple "collections" of great fairies, just in case getting the health refill would trigger it with the previous setup. * Fix ice traps on GS tokens not triggering OnItemReceive. * Complete fix for ice trap collection from GS. Add autoscroll when clicking "Expand All". * Add `OnShopSlotChange` with cursorSlot and basePrice parameters. * Fixed include in en_ossan for shop slot hook. Added registration for `OnShopSlotChange` in the tracker, storing the price in a new `price` field in `CheckTrackerData`. Added "seen" functionality to shop checks. Displays the model item name upon first entering a shop, adding the price and switching to trickName (if it's an ice trap) upon navigating to the slot in buy mode, triggered by an invisible "identified" status that mirrors "seen" in every other way. Added tooltips to most options for check tracker color picking to describe what each status actually means. * `std::format` pls * So apparently std::format just decided to break with the latest merge from develop, but fmt::format exists and works? * Removed the last vestiges of `locationsSkipped`. Other general code and formatting cleanups. Moved `IsGameRunning` to `OTRGlobals` so the item tracker could also access it. Used preceding to "fix" item and bottle display in the item tracker on startup. * Some more code cleanup. Removed "Recheck Area" button and relevant code. Backported changes to Anchor branch applicable for single-player, including making a checkAreas vector and structuring the frame by frame checks around that. Also includes fix for Silver Gauntlets and Mirror Shield check collection crash associated with those changes. Fixed Kakariko Bazaar "seen" updates. Fixed tracker window not showing on initial load like it should. * Forgot 1 formatting fix. * Removed conditions for showing Song from Impa (isn't junk under certain conditions, so should show all the time). * Fix vanilla checks, add Zelda's Letter and Malon's Egg to manual check collection. Fix autoscroll while in child stealth section. * Fix crash in Happy Mask Shop in OnSlotChange (referenced non-existent shop id in a tracker-specific enum). * General code cleanup. * Missed one reversion. * One more. * Fix column alignment in `randomizer_check_objects`. * Fix file encoding on `randomizer_check_tracker`. Again. * Fix indentation for `actualItemtrackerItemMap`. Also removed unnecessary parts of the map. * Rename `HasEqItem` to `HasEquipment`. * Slightly better indentation for `actualItemTrackerItemMap`. * Add magic bean salesman to vanilla check tracking, and genericized deku shield to trigger KF shop item 3 wherever you get the shield. Renamed `vanillaCheck` to `vanillaHundoCheck` to (supposedly) clarify the meaning of the usage. * One more rename to `vanillaCompletion` to avoid possible confusion with 100% speedrun conditions. * give me a break XD Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * Changes suggested by briaguya (rename `RandomizerCheckShow` to `Status`, unused code, newline formatting) * Remove unused `itemNames` table. * Remove `IsGameRunning` in favor of `GameInteractor::IsSaveLoaded`. * Restore anti-spoiler functionality for dungeons with dungeon maps. * Review cleanup. * Fix prices not showing for Kak bazaar items. --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com>
2023-10-04 11:03:36 -04:00
return false;
Randomizer Auto Location tracker (#1942) * Initial Auto-Location Tracking * Updates styling for checked items in Check Tracker * Fixes crashing issues with Check Tracker rendering * Auto scroll Check Tracker windows to current area * Checks Tracker only shows checked locations once in game * Fixes issue where Check Tracker would auto-scroll to wrong location when entering a grotto * Fixes gerudo fortress checks showing in tracker when settings have them removed * InfTable Check Location Fixes: Lost Dog Richard, Rolling Gorons, HBA 1000, Thawed Zora * Fixes most Event Chk Inf Checks on Check Tracker, and Frogs * Check Tracker - Song from Malon now works * Check Tracker - Fixes Claim Check check not tracking - Fixes spoiler for Claim Check check when getting Biggoron's Sword - Fixes LACS being spoiled and not tracking * Check Tracker - Fixes #2 for Skull Mask and Mask of Truth checks * Check Tracker - Adds support for merchants - Fixes #7 for Bomchu Salesman - Fixes #12 for Medigoron * Check Tracker - Fixes #8 for Song from Saria * Check Tracker - Fixes #9 for Adult Shooting Gallery * Check Tracker - Fixes #10 for Composer Grave * Check Tracker - Fixes #14 for Song from Ocarina of Time * Check Tracker - Fixes #16 for Shooting the Sun * Check Tracker - Fixes #19 for Darunia's Joy * Save Editor - Adds missing label for Treasure Chest Game * Check Tracker - Fixes Great Faries checks * Check Tracker - Fixes Sheik at Temple * Check Tracker - Fixes Great Fairy auto-scroll to wrong location * Check Tracker - Updates blue warp checks - Fixes Bongo Bongo and Twinrova checks * Check Tracker - Fixes Dampe's Gravedigging Tour * Check Tracker - Fixes Prescription to King Zora * Check Tracker - Fixes Bazaar showing under wrong area on tracker between adult/child * Check Tracker - Fixes scroll for Hyrule Market and Bazaar * Check Tracker - Fixes giving Adult Trade Items shown on tracker: Broken Sword, Saw, Cojiro, Eyeball Froge, and Eyedrops * Cleans up item_location * Check Tracker - Item List - Fixes item list not updating when changing seeds/options - Separates item exclusion list from item check list - Clean up comments * Check Tracker - Adds Skip functionality to buttons * Check Tracker - Refactors adult trade items to RandomizerInf * Check Tracker - Fixes an issue where any time an item is removed the tracker would cause an application crash * Check Tracker - Item names are now dependent on file language * Check Tracker - Fixes Gerudo Card check not showing in Fast setting * Reorders headers to (hopefully) avoid CI build conflicts on linux/consoles * Explicitly defines vector header in randomizer.h to fix compile errors * Complete Refactor of Check Tracker ImGui * Adds missing check tracker files to CMakeLists * Reverts the Item_location whitespace cleanup from ad10807c * Check Tracker - Loading Fixes - Fixes a bug where loading a save file a second time would add all the checks again - Fixes a bug where the check tracker would not render at all until in a save file * Check Tracker - Fixes a bug where checks would sometimes fail to load * Check Tracker - Fixes duplicated checks when using Only on Pause or Only on Combo * Check Tracker - Works around issue where single characters don't show in EnhancementCombobox, and fixes a label for combo buttons held option * Check Tracker - Applies all Check Tracker changes to Item Location * Check Tracker - Updated Check List - Adds Link's pocket, either in KF or HM depending on starting age - Supports Scrubs and Merchants - Uses enums instead of magic numbers - Updates DC Scrub Short Names for MQ * Check Tracker - Adds a performance mode option * Check Tracker - List Fixes (requires new rando generation) - Fixes Frogs Rupees always visible - Fixes Kokiri Sword Chest not showing - Fixes Weird Egg not showing * Check Tracker - MQ List basic support * Check Tracker - MQ/Vanilla anti-spoilers * Check Tracker - Collecting a compass now spoils the area * Check Tracker - Basic Vanilla Support and fixes - Vanilla items show in check tracker, even if many won't auto check - Fixes an issue with Gerudo Fortress Keys - Refactors IsVisibleInCheckTracker to randomizer_check_tracjer * Check Tracker - Fixes merge conflict from 08a487f35e1d760ab9e69b932edbe4da6bcd9edb * Check Tracker - Fixes tracker loading as Floating when default value is set to Windowed * Randomizer Location Exclusion List - Adds Scrubs, Merchants, Shops. Adult Trade items, MQ Dungeons, and Bean Salesman - Fixes Kokiri Sword Chest, Weird Egg, and Frog Song Rupees from misbehaving - Updates Gerudo Fortress logic to be dependent on Open/Fast/Normal Fortress - Removes Invalid Check - Adds RO Enum for MQ settings - Updates magic values to RO enum * Location Exclusion List - Scrubs that are always randomized now always show on the list * For now, removes some extra code only needed for a Check Tracker. * Randomizer Location Exclusion List - Fixes Eyeball Frog from showing up when Adult Trade Items was off * Location Tracker - Updates Eyedrops to use RandomizerInf instead of Chest * Check Tracker - Fixes a bug where Link's Pocket item wasn't acting as checked for area item count * Check Tracker - Fixes a bug where Locations would incorrectly say Vanilla due to the first check in the area being a non-MQ check * Check Tracker - Fixes a crash when Check Tracker is docked but not visible * Check Tracker - Fixes areas being spoiled when loading different save files * Check Tracker - Only reset variables if they are initialized * Check Tracker - Cleans up old comments, unused variables, methods, and macros, adds language TODOs, * Check Tracker - Readds rainbow UI elements after Cosmetics Editor refactor * Check Tracker - Removal of flag lookup that was refactored, no longer needed header, and some trivial whitespace fixes. * Check Tracker - Refactors Index to Bitmask code to a macro * Check Tracker - Changes ordering from alphabetical to RandomizerCheck ordering * Check Tracker - Wraps everything in a namespace to avoid global variable usage * Check Tracker - Explicitly defines for-loop scope * Check Tracker - refactors dungeon lookup from static array to function * Fixes a bug when using EnhancementColor with alpha * Check Tracker - Refactors all colour to use direct conversions * Check Tracker - refactors settings loading and check visibility for readability * Check Tracker - Fixes a bug where the wrong label showed on the Check Tracker BG Color * UIWidgets - Adds Alpha bar to EnhancementColor when using alpha parameter
2022-12-10 22:39:23 -05:00
}
void UpdateInventoryChecks() {
//For all the areas with compasses, if you have one, spoil the area
for (auto [scene, area] : DungeonRCAreasBySceneID) {
if (CHECK_DUNGEON_ITEM(DUNGEON_MAP, scene)) {
areasSpoiled |= (1 << area);
}
}
Randomizer Auto Location tracker (#1942) * Initial Auto-Location Tracking * Updates styling for checked items in Check Tracker * Fixes crashing issues with Check Tracker rendering * Auto scroll Check Tracker windows to current area * Checks Tracker only shows checked locations once in game * Fixes issue where Check Tracker would auto-scroll to wrong location when entering a grotto * Fixes gerudo fortress checks showing in tracker when settings have them removed * InfTable Check Location Fixes: Lost Dog Richard, Rolling Gorons, HBA 1000, Thawed Zora * Fixes most Event Chk Inf Checks on Check Tracker, and Frogs * Check Tracker - Song from Malon now works * Check Tracker - Fixes Claim Check check not tracking - Fixes spoiler for Claim Check check when getting Biggoron's Sword - Fixes LACS being spoiled and not tracking * Check Tracker - Fixes #2 for Skull Mask and Mask of Truth checks * Check Tracker - Adds support for merchants - Fixes #7 for Bomchu Salesman - Fixes #12 for Medigoron * Check Tracker - Fixes #8 for Song from Saria * Check Tracker - Fixes #9 for Adult Shooting Gallery * Check Tracker - Fixes #10 for Composer Grave * Check Tracker - Fixes #14 for Song from Ocarina of Time * Check Tracker - Fixes #16 for Shooting the Sun * Check Tracker - Fixes #19 for Darunia's Joy * Save Editor - Adds missing label for Treasure Chest Game * Check Tracker - Fixes Great Faries checks * Check Tracker - Fixes Sheik at Temple * Check Tracker - Fixes Great Fairy auto-scroll to wrong location * Check Tracker - Updates blue warp checks - Fixes Bongo Bongo and Twinrova checks * Check Tracker - Fixes Dampe's Gravedigging Tour * Check Tracker - Fixes Prescription to King Zora * Check Tracker - Fixes Bazaar showing under wrong area on tracker between adult/child * Check Tracker - Fixes scroll for Hyrule Market and Bazaar * Check Tracker - Fixes giving Adult Trade Items shown on tracker: Broken Sword, Saw, Cojiro, Eyeball Froge, and Eyedrops * Cleans up item_location * Check Tracker - Item List - Fixes item list not updating when changing seeds/options - Separates item exclusion list from item check list - Clean up comments * Check Tracker - Adds Skip functionality to buttons * Check Tracker - Refactors adult trade items to RandomizerInf * Check Tracker - Fixes an issue where any time an item is removed the tracker would cause an application crash * Check Tracker - Item names are now dependent on file language * Check Tracker - Fixes Gerudo Card check not showing in Fast setting * Reorders headers to (hopefully) avoid CI build conflicts on linux/consoles * Explicitly defines vector header in randomizer.h to fix compile errors * Complete Refactor of Check Tracker ImGui * Adds missing check tracker files to CMakeLists * Reverts the Item_location whitespace cleanup from ad10807c * Check Tracker - Loading Fixes - Fixes a bug where loading a save file a second time would add all the checks again - Fixes a bug where the check tracker would not render at all until in a save file * Check Tracker - Fixes a bug where checks would sometimes fail to load * Check Tracker - Fixes duplicated checks when using Only on Pause or Only on Combo * Check Tracker - Works around issue where single characters don't show in EnhancementCombobox, and fixes a label for combo buttons held option * Check Tracker - Applies all Check Tracker changes to Item Location * Check Tracker - Updated Check List - Adds Link's pocket, either in KF or HM depending on starting age - Supports Scrubs and Merchants - Uses enums instead of magic numbers - Updates DC Scrub Short Names for MQ * Check Tracker - Adds a performance mode option * Check Tracker - List Fixes (requires new rando generation) - Fixes Frogs Rupees always visible - Fixes Kokiri Sword Chest not showing - Fixes Weird Egg not showing * Check Tracker - MQ List basic support * Check Tracker - MQ/Vanilla anti-spoilers * Check Tracker - Collecting a compass now spoils the area * Check Tracker - Basic Vanilla Support and fixes - Vanilla items show in check tracker, even if many won't auto check - Fixes an issue with Gerudo Fortress Keys - Refactors IsVisibleInCheckTracker to randomizer_check_tracjer * Check Tracker - Fixes merge conflict from 08a487f35e1d760ab9e69b932edbe4da6bcd9edb * Check Tracker - Fixes tracker loading as Floating when default value is set to Windowed * Randomizer Location Exclusion List - Adds Scrubs, Merchants, Shops. Adult Trade items, MQ Dungeons, and Bean Salesman - Fixes Kokiri Sword Chest, Weird Egg, and Frog Song Rupees from misbehaving - Updates Gerudo Fortress logic to be dependent on Open/Fast/Normal Fortress - Removes Invalid Check - Adds RO Enum for MQ settings - Updates magic values to RO enum * Location Exclusion List - Scrubs that are always randomized now always show on the list * For now, removes some extra code only needed for a Check Tracker. * Randomizer Location Exclusion List - Fixes Eyeball Frog from showing up when Adult Trade Items was off * Location Tracker - Updates Eyedrops to use RandomizerInf instead of Chest * Check Tracker - Fixes a bug where Link's Pocket item wasn't acting as checked for area item count * Check Tracker - Fixes a bug where Locations would incorrectly say Vanilla due to the first check in the area being a non-MQ check * Check Tracker - Fixes a crash when Check Tracker is docked but not visible * Check Tracker - Fixes areas being spoiled when loading different save files * Check Tracker - Only reset variables if they are initialized * Check Tracker - Cleans up old comments, unused variables, methods, and macros, adds language TODOs, * Check Tracker - Readds rainbow UI elements after Cosmetics Editor refactor * Check Tracker - Removal of flag lookup that was refactored, no longer needed header, and some trivial whitespace fixes. * Check Tracker - Refactors Index to Bitmask code to a macro * Check Tracker - Changes ordering from alphabetical to RandomizerCheck ordering * Check Tracker - Wraps everything in a namespace to avoid global variable usage * Check Tracker - Explicitly defines for-loop scope * Check Tracker - refactors dungeon lookup from static array to function * Fixes a bug when using EnhancementColor with alpha * Check Tracker - Refactors all colour to use direct conversions * Check Tracker - refactors settings loading and check visibility for readability * Check Tracker - Fixes a bug where the wrong label showed on the Check Tracker BG Color * UIWidgets - Adds Alpha bar to EnhancementColor when using alpha parameter
2022-12-10 22:39:23 -05:00
}
Check Tracker Update (#2668) * Initial commit. What works so far: Data file loads, saves, deletes, and is created properly. - Need to run `HasItemBeenCollected` when creating in case of mid-seed regen. Organized checks into maps set by area. Areas show in tracker. - Checks pulled from checkObjectsByArea are not currently listed. - Areas are being assumed completed and hidden at the start. * Checks now populate. Still not counting area totals properly. * Don't track RC_LINKS_POCKET in the data file, and instead manually add it in every time a save is load. rcObjects doesn't contain Link's Pocket location (duh). * Moved ItemReceive hook to randomizer_check_tracker.cpp. Skipped items are properly sorted and formatted. Saved items contribute to an area's gotten/skipped checks on load. Changed skipped items default main color to gray. General code cleanup. * Skipped checks now contribute to area totals for area completion logic. * Mid-menu rework transfer. * Started check lookup on item receive. Tried to enable scum checking on save. * Fixed scum check on save. * More code cleanup, which revealed some issues with loading and saving. Loading now works 100%, but entries in checkTrackerData are disappearing in code somewhere, causing issues with later checks. Scummed color now displays properly. Collected but unsaved displays properly. Unchecked, Skipped, Seen and Scummed checks all have arrows for skipping/unskipping. Counts a little messed up, probably double adding skips. * Fixed item counts being off across resets. Restarts were fine. * Beginning of rework for individual check updates. Adds `Actor lastCheck` to PlayState to allow assigning of last actor to give an item. This allows precise tracking of GS, freestanding PoH, etc. Works for chests too. Currently does not work for shops, unknown for normal NPC gives. Doesn't track last gives for non-checks, like drops from grass, pots, crates, etc. * Actor-based checks fully fleshed out, but can't help with sale-based checks. Implemented `pendingSaleCheck` to back out of an RC check cycle if `gSaveContext->pendingSale` is not NONE when `OnItemReceive` is called, processed through `OnSaleEnd`. This should be the final change necessary to streamline the checks. * Temporary hook to message box close to tie in trackers for non-gs/chest actors that aren't added to `GetCheckFromActor`. This triggers a 2-frame countdown to check with `HasItemBeenCollected` since half of the methods in there aren't updated until after a text box closes. Added scene tracking to get last scene so that checks in scenes that span several overworld areas could be tied to their areas properly. Modified tracker data creation to apply Link's Pocket and Song from Impa conditionally based on randomizer settings instead of just being assumed to be done. May need modification for checking click and drag spoiler loading. Removed the scene equivalence check from CheckChecks so that an entire area is checked each time to avoid issues with, e.g., leaving a shop before a pending sale finishes. * Changed check data creation to use RSKs from gRandomizer to account for settings loaded from drag and drop spoilers. * Beginning of tracker code organization. Changed check color defaults. * Reverted moving tracker colors to header. Some individual check fixes. * Missed something from previous merge? * Removed last remnant of removed performance mode. * Better handle checking when skullsanity is off. * Song checks sceneIDs don't match the scenes they're actually in for some reason. Removed that check. * SaleEnd checks don't need the GetItemEntry parameter. Also set a flag that should prevent the check tracker from running during vanilla saves should that not be resolved by the time it's merged. * Attempting to have only the relevant checks added to the tracker data, as well as showing vanilla checks for non-rando saves. Not working yet (everything is displayed in vanilla). * Added vanilla check tracker population via `vanillaCheck` bool in `RandomizerCheckObject`. This is also added to `IsVisibleInImGui` to handle file loading and saving to eliminate checks that aren't part of vanilla or the rando seed. Implemented deleted tracker data file recreation. Added some extra item name text checks. Songs are still... tricky, so they stay blank. Utilize local copies of the randomizer check objects that are applicable for performance purposes. Fixed vanilla item-giving cutscene crashes when triggered mid-transition. * Apparently not all toolchains can handle macro instantiation without all parameters, like VS can. * Fixed scummed detail color not showing properly on tracker. * Fixed dungeon area totals and GS checks not functioning properly. * Major revamp of checking code. Doesn't rely on `GetCheckFromActor` at all anymore, but instead simply sets a flag to evaluate a number of checks in an area every frame until the check that was gotten is identified. With the new setup, it's much less hardware intensive, and at 60fps 6 checks per frame shows no noticeable effect on framerate. I can envision needing to add a collectedCount in order to account for times when two checks are gotten one right after the other. Changed area scroll to happen from `OnTransitionEnd`, and allow for scrolling in bazaar (was disabled previously because it would jump back and forth between Kak and Market while you were in one). Also setup area check order updating by area instead of all at the same time. * Fixed shooting gallery not reporting proper area. Prevent checks from actually happening if area is RCAREA_INVALID, now that all areas are reporting something if they have checks. Fixed `GetCheckArea()` not updating checks for standard scenes. Lots of vanilla tracking updates, mainly manual checks for gems, medallions and songs, since the often don't have proper scenes in the data. Prevent vanilla from triggering check loops if junk items are collected. Fixed sorting based on saved vs collected. Prevent item name display for vanilla runs. Change coloring of checks so the check name reflects status in vanilla runs. * Fixed "Recheck Area" button erroneously adding to an area's check totals? * Fix DMC vanilla checks. * Fix check tracker data recreation on data file loss. Removed redundant file exists check from SaveTrackerDataHook, as it doesn't matter if it exists or not at that point. Limited check loops to 3 to avoid infinite check loops on non-check/junk item pickup. Added more checks to disable tracker operations if a save is not running. Changed check ordering to put boss reward and heart container checks at the end of whatever RCSHOW group they belong to. * Fixed IsRunning calculation. Further improving vanilla checking. Starting framework for checking medallions, stones, and songs on data file recreation. Fixed medallion check collection. Added GIFT_FROM_SAGES to check list for vanilla file for tracking light medallion. Added check loop limitation to prevent infinite checking after picking up junk item from the ground. * Finished vanilla file recreation and recheck (songs and dungeon rewards all check properly now). This includes deku shield with KF shop item 3. Finished Gift from Raoru light medallion tracking for vanilla. Commented all CheckByScene functionality for now. * Fixed new save data file creation. Disabled entrance area calculation for now, as it only tracks the previous entrance for some reason. Fixed area detection for ToT checks. * GetCheckArea() now utilizes EntranceData almost exclusively, via either `gSaveContext.entranceIndex` or the entrance tracker's `currentGrottoId` in the case of grottos. This also means that EVERYTHING CAN AUTOSCROLL NOW. Entrance shuffles are now much easier to track. Autoscroll is now also triggered on save, just in case someone isn't autosaving and has a lot of checks that get converted to saved. * Fixed missing GS check in LW. * Added area scroll on toggling Show Hidden Items. May configure differently later. Fixed area detection for entrances in Gerudo Fortress/Valley and Collossus. Haunted wasteland doesn't autoscroll due to a bug in `OnTransitionEnd` hook, but checks still evaluate properly there. Rely on scene-based area detection if scene is a main overworld or dungeon scene. * Fixed grotto detection when shuffle is off. * Small code cleanup. Fixed Colossus hand chest checks. * Missing lus bump from merge conflict resolution * Fixed Colossus Grotto making `GetCheckArea` return Wasteland. * Improved OnItemReceive processing for non-token GS checks, since they can sometimes take long enough for the checking process to time out before the item is registered as received. * First attempt at thread safety for tracker data file writing. Seems to work, but might need more testing. * Fixed Recheck Area not unskipping items that register as saved. Improved delayed saving with autosaving, as the autosave triggered quite often before the tracker data save, making things not properly register as saved. * merge cleanup * Converted check tracker data to the sectional saves, adding `CheckTrackerData` to `SaveContext`. Implemented section ID returning and fullSave boolean passing to section functions from my PR temporarily for it to work properly. Moved `RandomizerCheckTrackerData` enum to `randomizerTypes.h` to accommodate that. Changed `Randomizer_SaveInit` to a `SaveManager::InitFunc` to allow for other randomizer-dependent sections to be initialized after that. Required a little refactoring to maintain intro cutscene skip when starting a randomizer file. * Revert section index return and randomizer init changes. Will need to wait on yet more changes to main. * Fixed check tracker initialization (shouldn't be tied to window initialization), restored saving/loading functionality. * Removed `CheckTracker::Init` and put SaveManager calls in `CheckTrackerWindow::InitElement`. Also a bit of cleanup from transition back to save file use. * Fixed tracker displaying check categories while file not loaded. * Fix Darunia's Joy check not marking in vanilla. * Fix autosave not triggering change from collected to saved in tracker data. * Changed default colors for scummed and collected display. * Merge upgrade code cleanup. * Add `OnTransitionEnd` calls to sandstorm transitions both to and from Wasteland. Also improved `gSaveContext.lastScene` assignment for both transition types. Allowed a bit of cleanup in `GetCheckArea`. * Added `StateButton`, a button like `ArrowButton` but that allows text instead of arrow icons. Apparently the changes from ArrowButton to StateButton happened in a previous commit... * Changed section name to `trackerDataCheck` to force SoH to load it after the randomizer section, as it required some randoSettings to be loaded first, and nothing else I tried to make the randomizer section load before it worked. This hacks a solution to checks not displaying on fast file load to a specific slot. F*** you, SaveManager, and f*** you too, JSON. * Forgot to change the section string for loading with the name change. * Fix check ordering for checks that trigger the autosave. * Adds option to remove right-side shop items (slots 1-4) from the tracker list. Enabled by default. * Fix default state of Hide Shop Right Checks checkbox. * Fixes grotto and great fairy scrolling and checks. Fixes array overflow from `checkTrackerData` which was creating the issue trying to load the base and randomizer sections first, among other things. That also fixed the massive file loads that were being exhibited in debug mode. * Fix shooting galleries being set as collected again when being played a second time after getting the checks. * Fix Bazaar autoscroll. * Add Saria's Song to `GetCheckFromActor` and removed some limitations from the messageCloseCheck function to make that check track properly. * Fix Song from Impa check. Implemented prevention for multiple "collections" of great fairies, just in case getting the health refill would trigger it with the previous setup. * Fix ice traps on GS tokens not triggering OnItemReceive. * Complete fix for ice trap collection from GS. Add autoscroll when clicking "Expand All". * Add `OnShopSlotChange` with cursorSlot and basePrice parameters. * Fixed include in en_ossan for shop slot hook. Added registration for `OnShopSlotChange` in the tracker, storing the price in a new `price` field in `CheckTrackerData`. Added "seen" functionality to shop checks. Displays the model item name upon first entering a shop, adding the price and switching to trickName (if it's an ice trap) upon navigating to the slot in buy mode, triggered by an invisible "identified" status that mirrors "seen" in every other way. Added tooltips to most options for check tracker color picking to describe what each status actually means. * `std::format` pls * So apparently std::format just decided to break with the latest merge from develop, but fmt::format exists and works? * Removed the last vestiges of `locationsSkipped`. Other general code and formatting cleanups. Moved `IsGameRunning` to `OTRGlobals` so the item tracker could also access it. Used preceding to "fix" item and bottle display in the item tracker on startup. * Some more code cleanup. Removed "Recheck Area" button and relevant code. Backported changes to Anchor branch applicable for single-player, including making a checkAreas vector and structuring the frame by frame checks around that. Also includes fix for Silver Gauntlets and Mirror Shield check collection crash associated with those changes. Fixed Kakariko Bazaar "seen" updates. Fixed tracker window not showing on initial load like it should. * Forgot 1 formatting fix. * Removed conditions for showing Song from Impa (isn't junk under certain conditions, so should show all the time). * Fix vanilla checks, add Zelda's Letter and Malon's Egg to manual check collection. Fix autoscroll while in child stealth section. * Fix crash in Happy Mask Shop in OnSlotChange (referenced non-existent shop id in a tracker-specific enum). * General code cleanup. * Missed one reversion. * One more. * Fix column alignment in `randomizer_check_objects`. * Fix file encoding on `randomizer_check_tracker`. Again. * Fix indentation for `actualItemtrackerItemMap`. Also removed unnecessary parts of the map. * Rename `HasEqItem` to `HasEquipment`. * Slightly better indentation for `actualItemTrackerItemMap`. * Add magic bean salesman to vanilla check tracking, and genericized deku shield to trigger KF shop item 3 wherever you get the shield. Renamed `vanillaCheck` to `vanillaHundoCheck` to (supposedly) clarify the meaning of the usage. * One more rename to `vanillaCompletion` to avoid possible confusion with 100% speedrun conditions. * give me a break XD Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * Changes suggested by briaguya (rename `RandomizerCheckShow` to `Status`, unused code, newline formatting) * Remove unused `itemNames` table. * Remove `IsGameRunning` in favor of `GameInteractor::IsSaveLoaded`. * Restore anti-spoiler functionality for dungeons with dungeon maps. * Review cleanup. * Fix prices not showing for Kak bazaar items. --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com>
2023-10-04 11:03:36 -04:00
void UpdateAreaFullyChecked(RandomizerCheckArea area) {
}
Randomizer Auto Location tracker (#1942) * Initial Auto-Location Tracking * Updates styling for checked items in Check Tracker * Fixes crashing issues with Check Tracker rendering * Auto scroll Check Tracker windows to current area * Checks Tracker only shows checked locations once in game * Fixes issue where Check Tracker would auto-scroll to wrong location when entering a grotto * Fixes gerudo fortress checks showing in tracker when settings have them removed * InfTable Check Location Fixes: Lost Dog Richard, Rolling Gorons, HBA 1000, Thawed Zora * Fixes most Event Chk Inf Checks on Check Tracker, and Frogs * Check Tracker - Song from Malon now works * Check Tracker - Fixes Claim Check check not tracking - Fixes spoiler for Claim Check check when getting Biggoron's Sword - Fixes LACS being spoiled and not tracking * Check Tracker - Fixes #2 for Skull Mask and Mask of Truth checks * Check Tracker - Adds support for merchants - Fixes #7 for Bomchu Salesman - Fixes #12 for Medigoron * Check Tracker - Fixes #8 for Song from Saria * Check Tracker - Fixes #9 for Adult Shooting Gallery * Check Tracker - Fixes #10 for Composer Grave * Check Tracker - Fixes #14 for Song from Ocarina of Time * Check Tracker - Fixes #16 for Shooting the Sun * Check Tracker - Fixes #19 for Darunia's Joy * Save Editor - Adds missing label for Treasure Chest Game * Check Tracker - Fixes Great Faries checks * Check Tracker - Fixes Sheik at Temple * Check Tracker - Fixes Great Fairy auto-scroll to wrong location * Check Tracker - Updates blue warp checks - Fixes Bongo Bongo and Twinrova checks * Check Tracker - Fixes Dampe's Gravedigging Tour * Check Tracker - Fixes Prescription to King Zora * Check Tracker - Fixes Bazaar showing under wrong area on tracker between adult/child * Check Tracker - Fixes scroll for Hyrule Market and Bazaar * Check Tracker - Fixes giving Adult Trade Items shown on tracker: Broken Sword, Saw, Cojiro, Eyeball Froge, and Eyedrops * Cleans up item_location * Check Tracker - Item List - Fixes item list not updating when changing seeds/options - Separates item exclusion list from item check list - Clean up comments * Check Tracker - Adds Skip functionality to buttons * Check Tracker - Refactors adult trade items to RandomizerInf * Check Tracker - Fixes an issue where any time an item is removed the tracker would cause an application crash * Check Tracker - Item names are now dependent on file language * Check Tracker - Fixes Gerudo Card check not showing in Fast setting * Reorders headers to (hopefully) avoid CI build conflicts on linux/consoles * Explicitly defines vector header in randomizer.h to fix compile errors * Complete Refactor of Check Tracker ImGui * Adds missing check tracker files to CMakeLists * Reverts the Item_location whitespace cleanup from ad10807c * Check Tracker - Loading Fixes - Fixes a bug where loading a save file a second time would add all the checks again - Fixes a bug where the check tracker would not render at all until in a save file * Check Tracker - Fixes a bug where checks would sometimes fail to load * Check Tracker - Fixes duplicated checks when using Only on Pause or Only on Combo * Check Tracker - Works around issue where single characters don't show in EnhancementCombobox, and fixes a label for combo buttons held option * Check Tracker - Applies all Check Tracker changes to Item Location * Check Tracker - Updated Check List - Adds Link's pocket, either in KF or HM depending on starting age - Supports Scrubs and Merchants - Uses enums instead of magic numbers - Updates DC Scrub Short Names for MQ * Check Tracker - Adds a performance mode option * Check Tracker - List Fixes (requires new rando generation) - Fixes Frogs Rupees always visible - Fixes Kokiri Sword Chest not showing - Fixes Weird Egg not showing * Check Tracker - MQ List basic support * Check Tracker - MQ/Vanilla anti-spoilers * Check Tracker - Collecting a compass now spoils the area * Check Tracker - Basic Vanilla Support and fixes - Vanilla items show in check tracker, even if many won't auto check - Fixes an issue with Gerudo Fortress Keys - Refactors IsVisibleInCheckTracker to randomizer_check_tracjer * Check Tracker - Fixes merge conflict from 08a487f35e1d760ab9e69b932edbe4da6bcd9edb * Check Tracker - Fixes tracker loading as Floating when default value is set to Windowed * Randomizer Location Exclusion List - Adds Scrubs, Merchants, Shops. Adult Trade items, MQ Dungeons, and Bean Salesman - Fixes Kokiri Sword Chest, Weird Egg, and Frog Song Rupees from misbehaving - Updates Gerudo Fortress logic to be dependent on Open/Fast/Normal Fortress - Removes Invalid Check - Adds RO Enum for MQ settings - Updates magic values to RO enum * Location Exclusion List - Scrubs that are always randomized now always show on the list * For now, removes some extra code only needed for a Check Tracker. * Randomizer Location Exclusion List - Fixes Eyeball Frog from showing up when Adult Trade Items was off * Location Tracker - Updates Eyedrops to use RandomizerInf instead of Chest * Check Tracker - Fixes a bug where Link's Pocket item wasn't acting as checked for area item count * Check Tracker - Fixes a bug where Locations would incorrectly say Vanilla due to the first check in the area being a non-MQ check * Check Tracker - Fixes a crash when Check Tracker is docked but not visible * Check Tracker - Fixes areas being spoiled when loading different save files * Check Tracker - Only reset variables if they are initialized * Check Tracker - Cleans up old comments, unused variables, methods, and macros, adds language TODOs, * Check Tracker - Readds rainbow UI elements after Cosmetics Editor refactor * Check Tracker - Removal of flag lookup that was refactored, no longer needed header, and some trivial whitespace fixes. * Check Tracker - Refactors Index to Bitmask code to a macro * Check Tracker - Changes ordering from alphabetical to RandomizerCheck ordering * Check Tracker - Wraps everything in a namespace to avoid global variable usage * Check Tracker - Explicitly defines for-loop scope * Check Tracker - refactors dungeon lookup from static array to function * Fixes a bug when using EnhancementColor with alpha * Check Tracker - Refactors all colour to use direct conversions * Check Tracker - refactors settings loading and check visibility for readability * Check Tracker - Fixes a bug where the wrong label showed on the Check Tracker BG Color * UIWidgets - Adds Alpha bar to EnhancementColor when using alpha parameter
2022-12-10 22:39:23 -05:00
Check Tracker Update (#2668) * Initial commit. What works so far: Data file loads, saves, deletes, and is created properly. - Need to run `HasItemBeenCollected` when creating in case of mid-seed regen. Organized checks into maps set by area. Areas show in tracker. - Checks pulled from checkObjectsByArea are not currently listed. - Areas are being assumed completed and hidden at the start. * Checks now populate. Still not counting area totals properly. * Don't track RC_LINKS_POCKET in the data file, and instead manually add it in every time a save is load. rcObjects doesn't contain Link's Pocket location (duh). * Moved ItemReceive hook to randomizer_check_tracker.cpp. Skipped items are properly sorted and formatted. Saved items contribute to an area's gotten/skipped checks on load. Changed skipped items default main color to gray. General code cleanup. * Skipped checks now contribute to area totals for area completion logic. * Mid-menu rework transfer. * Started check lookup on item receive. Tried to enable scum checking on save. * Fixed scum check on save. * More code cleanup, which revealed some issues with loading and saving. Loading now works 100%, but entries in checkTrackerData are disappearing in code somewhere, causing issues with later checks. Scummed color now displays properly. Collected but unsaved displays properly. Unchecked, Skipped, Seen and Scummed checks all have arrows for skipping/unskipping. Counts a little messed up, probably double adding skips. * Fixed item counts being off across resets. Restarts were fine. * Beginning of rework for individual check updates. Adds `Actor lastCheck` to PlayState to allow assigning of last actor to give an item. This allows precise tracking of GS, freestanding PoH, etc. Works for chests too. Currently does not work for shops, unknown for normal NPC gives. Doesn't track last gives for non-checks, like drops from grass, pots, crates, etc. * Actor-based checks fully fleshed out, but can't help with sale-based checks. Implemented `pendingSaleCheck` to back out of an RC check cycle if `gSaveContext->pendingSale` is not NONE when `OnItemReceive` is called, processed through `OnSaleEnd`. This should be the final change necessary to streamline the checks. * Temporary hook to message box close to tie in trackers for non-gs/chest actors that aren't added to `GetCheckFromActor`. This triggers a 2-frame countdown to check with `HasItemBeenCollected` since half of the methods in there aren't updated until after a text box closes. Added scene tracking to get last scene so that checks in scenes that span several overworld areas could be tied to their areas properly. Modified tracker data creation to apply Link's Pocket and Song from Impa conditionally based on randomizer settings instead of just being assumed to be done. May need modification for checking click and drag spoiler loading. Removed the scene equivalence check from CheckChecks so that an entire area is checked each time to avoid issues with, e.g., leaving a shop before a pending sale finishes. * Changed check data creation to use RSKs from gRandomizer to account for settings loaded from drag and drop spoilers. * Beginning of tracker code organization. Changed check color defaults. * Reverted moving tracker colors to header. Some individual check fixes. * Missed something from previous merge? * Removed last remnant of removed performance mode. * Better handle checking when skullsanity is off. * Song checks sceneIDs don't match the scenes they're actually in for some reason. Removed that check. * SaleEnd checks don't need the GetItemEntry parameter. Also set a flag that should prevent the check tracker from running during vanilla saves should that not be resolved by the time it's merged. * Attempting to have only the relevant checks added to the tracker data, as well as showing vanilla checks for non-rando saves. Not working yet (everything is displayed in vanilla). * Added vanilla check tracker population via `vanillaCheck` bool in `RandomizerCheckObject`. This is also added to `IsVisibleInImGui` to handle file loading and saving to eliminate checks that aren't part of vanilla or the rando seed. Implemented deleted tracker data file recreation. Added some extra item name text checks. Songs are still... tricky, so they stay blank. Utilize local copies of the randomizer check objects that are applicable for performance purposes. Fixed vanilla item-giving cutscene crashes when triggered mid-transition. * Apparently not all toolchains can handle macro instantiation without all parameters, like VS can. * Fixed scummed detail color not showing properly on tracker. * Fixed dungeon area totals and GS checks not functioning properly. * Major revamp of checking code. Doesn't rely on `GetCheckFromActor` at all anymore, but instead simply sets a flag to evaluate a number of checks in an area every frame until the check that was gotten is identified. With the new setup, it's much less hardware intensive, and at 60fps 6 checks per frame shows no noticeable effect on framerate. I can envision needing to add a collectedCount in order to account for times when two checks are gotten one right after the other. Changed area scroll to happen from `OnTransitionEnd`, and allow for scrolling in bazaar (was disabled previously because it would jump back and forth between Kak and Market while you were in one). Also setup area check order updating by area instead of all at the same time. * Fixed shooting gallery not reporting proper area. Prevent checks from actually happening if area is RCAREA_INVALID, now that all areas are reporting something if they have checks. Fixed `GetCheckArea()` not updating checks for standard scenes. Lots of vanilla tracking updates, mainly manual checks for gems, medallions and songs, since the often don't have proper scenes in the data. Prevent vanilla from triggering check loops if junk items are collected. Fixed sorting based on saved vs collected. Prevent item name display for vanilla runs. Change coloring of checks so the check name reflects status in vanilla runs. * Fixed "Recheck Area" button erroneously adding to an area's check totals? * Fix DMC vanilla checks. * Fix check tracker data recreation on data file loss. Removed redundant file exists check from SaveTrackerDataHook, as it doesn't matter if it exists or not at that point. Limited check loops to 3 to avoid infinite check loops on non-check/junk item pickup. Added more checks to disable tracker operations if a save is not running. Changed check ordering to put boss reward and heart container checks at the end of whatever RCSHOW group they belong to. * Fixed IsRunning calculation. Further improving vanilla checking. Starting framework for checking medallions, stones, and songs on data file recreation. Fixed medallion check collection. Added GIFT_FROM_SAGES to check list for vanilla file for tracking light medallion. Added check loop limitation to prevent infinite checking after picking up junk item from the ground. * Finished vanilla file recreation and recheck (songs and dungeon rewards all check properly now). This includes deku shield with KF shop item 3. Finished Gift from Raoru light medallion tracking for vanilla. Commented all CheckByScene functionality for now. * Fixed new save data file creation. Disabled entrance area calculation for now, as it only tracks the previous entrance for some reason. Fixed area detection for ToT checks. * GetCheckArea() now utilizes EntranceData almost exclusively, via either `gSaveContext.entranceIndex` or the entrance tracker's `currentGrottoId` in the case of grottos. This also means that EVERYTHING CAN AUTOSCROLL NOW. Entrance shuffles are now much easier to track. Autoscroll is now also triggered on save, just in case someone isn't autosaving and has a lot of checks that get converted to saved. * Fixed missing GS check in LW. * Added area scroll on toggling Show Hidden Items. May configure differently later. Fixed area detection for entrances in Gerudo Fortress/Valley and Collossus. Haunted wasteland doesn't autoscroll due to a bug in `OnTransitionEnd` hook, but checks still evaluate properly there. Rely on scene-based area detection if scene is a main overworld or dungeon scene. * Fixed grotto detection when shuffle is off. * Small code cleanup. Fixed Colossus hand chest checks. * Missing lus bump from merge conflict resolution * Fixed Colossus Grotto making `GetCheckArea` return Wasteland. * Improved OnItemReceive processing for non-token GS checks, since they can sometimes take long enough for the checking process to time out before the item is registered as received. * First attempt at thread safety for tracker data file writing. Seems to work, but might need more testing. * Fixed Recheck Area not unskipping items that register as saved. Improved delayed saving with autosaving, as the autosave triggered quite often before the tracker data save, making things not properly register as saved. * merge cleanup * Converted check tracker data to the sectional saves, adding `CheckTrackerData` to `SaveContext`. Implemented section ID returning and fullSave boolean passing to section functions from my PR temporarily for it to work properly. Moved `RandomizerCheckTrackerData` enum to `randomizerTypes.h` to accommodate that. Changed `Randomizer_SaveInit` to a `SaveManager::InitFunc` to allow for other randomizer-dependent sections to be initialized after that. Required a little refactoring to maintain intro cutscene skip when starting a randomizer file. * Revert section index return and randomizer init changes. Will need to wait on yet more changes to main. * Fixed check tracker initialization (shouldn't be tied to window initialization), restored saving/loading functionality. * Removed `CheckTracker::Init` and put SaveManager calls in `CheckTrackerWindow::InitElement`. Also a bit of cleanup from transition back to save file use. * Fixed tracker displaying check categories while file not loaded. * Fix Darunia's Joy check not marking in vanilla. * Fix autosave not triggering change from collected to saved in tracker data. * Changed default colors for scummed and collected display. * Merge upgrade code cleanup. * Add `OnTransitionEnd` calls to sandstorm transitions both to and from Wasteland. Also improved `gSaveContext.lastScene` assignment for both transition types. Allowed a bit of cleanup in `GetCheckArea`. * Added `StateButton`, a button like `ArrowButton` but that allows text instead of arrow icons. Apparently the changes from ArrowButton to StateButton happened in a previous commit... * Changed section name to `trackerDataCheck` to force SoH to load it after the randomizer section, as it required some randoSettings to be loaded first, and nothing else I tried to make the randomizer section load before it worked. This hacks a solution to checks not displaying on fast file load to a specific slot. F*** you, SaveManager, and f*** you too, JSON. * Forgot to change the section string for loading with the name change. * Fix check ordering for checks that trigger the autosave. * Adds option to remove right-side shop items (slots 1-4) from the tracker list. Enabled by default. * Fix default state of Hide Shop Right Checks checkbox. * Fixes grotto and great fairy scrolling and checks. Fixes array overflow from `checkTrackerData` which was creating the issue trying to load the base and randomizer sections first, among other things. That also fixed the massive file loads that were being exhibited in debug mode. * Fix shooting galleries being set as collected again when being played a second time after getting the checks. * Fix Bazaar autoscroll. * Add Saria's Song to `GetCheckFromActor` and removed some limitations from the messageCloseCheck function to make that check track properly. * Fix Song from Impa check. Implemented prevention for multiple "collections" of great fairies, just in case getting the health refill would trigger it with the previous setup. * Fix ice traps on GS tokens not triggering OnItemReceive. * Complete fix for ice trap collection from GS. Add autoscroll when clicking "Expand All". * Add `OnShopSlotChange` with cursorSlot and basePrice parameters. * Fixed include in en_ossan for shop slot hook. Added registration for `OnShopSlotChange` in the tracker, storing the price in a new `price` field in `CheckTrackerData`. Added "seen" functionality to shop checks. Displays the model item name upon first entering a shop, adding the price and switching to trickName (if it's an ice trap) upon navigating to the slot in buy mode, triggered by an invisible "identified" status that mirrors "seen" in every other way. Added tooltips to most options for check tracker color picking to describe what each status actually means. * `std::format` pls * So apparently std::format just decided to break with the latest merge from develop, but fmt::format exists and works? * Removed the last vestiges of `locationsSkipped`. Other general code and formatting cleanups. Moved `IsGameRunning` to `OTRGlobals` so the item tracker could also access it. Used preceding to "fix" item and bottle display in the item tracker on startup. * Some more code cleanup. Removed "Recheck Area" button and relevant code. Backported changes to Anchor branch applicable for single-player, including making a checkAreas vector and structuring the frame by frame checks around that. Also includes fix for Silver Gauntlets and Mirror Shield check collection crash associated with those changes. Fixed Kakariko Bazaar "seen" updates. Fixed tracker window not showing on initial load like it should. * Forgot 1 formatting fix. * Removed conditions for showing Song from Impa (isn't junk under certain conditions, so should show all the time). * Fix vanilla checks, add Zelda's Letter and Malon's Egg to manual check collection. Fix autoscroll while in child stealth section. * Fix crash in Happy Mask Shop in OnSlotChange (referenced non-existent shop id in a tracker-specific enum). * General code cleanup. * Missed one reversion. * One more. * Fix column alignment in `randomizer_check_objects`. * Fix file encoding on `randomizer_check_tracker`. Again. * Fix indentation for `actualItemtrackerItemMap`. Also removed unnecessary parts of the map. * Rename `HasEqItem` to `HasEquipment`. * Slightly better indentation for `actualItemTrackerItemMap`. * Add magic bean salesman to vanilla check tracking, and genericized deku shield to trigger KF shop item 3 wherever you get the shield. Renamed `vanillaCheck` to `vanillaHundoCheck` to (supposedly) clarify the meaning of the usage. * One more rename to `vanillaCompletion` to avoid possible confusion with 100% speedrun conditions. * give me a break XD Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * Changes suggested by briaguya (rename `RandomizerCheckShow` to `Status`, unused code, newline formatting) * Remove unused `itemNames` table. * Remove `IsGameRunning` in favor of `GameInteractor::IsSaveLoaded`. * Restore anti-spoiler functionality for dungeons with dungeon maps. * Review cleanup. * Fix prices not showing for Kak bazaar items. --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com>
2023-10-04 11:03:36 -04:00
void UpdateAreas(RandomizerCheckArea area) {
areasFullyChecked[area] = areaChecksGotten[area] == checksByArea.find(area)->second.size();
if (areaChecksGotten[area] != 0 || RandomizerCheckObjects::AreaIsOverworld(area)) {
Check Tracker Update (#2668) * Initial commit. What works so far: Data file loads, saves, deletes, and is created properly. - Need to run `HasItemBeenCollected` when creating in case of mid-seed regen. Organized checks into maps set by area. Areas show in tracker. - Checks pulled from checkObjectsByArea are not currently listed. - Areas are being assumed completed and hidden at the start. * Checks now populate. Still not counting area totals properly. * Don't track RC_LINKS_POCKET in the data file, and instead manually add it in every time a save is load. rcObjects doesn't contain Link's Pocket location (duh). * Moved ItemReceive hook to randomizer_check_tracker.cpp. Skipped items are properly sorted and formatted. Saved items contribute to an area's gotten/skipped checks on load. Changed skipped items default main color to gray. General code cleanup. * Skipped checks now contribute to area totals for area completion logic. * Mid-menu rework transfer. * Started check lookup on item receive. Tried to enable scum checking on save. * Fixed scum check on save. * More code cleanup, which revealed some issues with loading and saving. Loading now works 100%, but entries in checkTrackerData are disappearing in code somewhere, causing issues with later checks. Scummed color now displays properly. Collected but unsaved displays properly. Unchecked, Skipped, Seen and Scummed checks all have arrows for skipping/unskipping. Counts a little messed up, probably double adding skips. * Fixed item counts being off across resets. Restarts were fine. * Beginning of rework for individual check updates. Adds `Actor lastCheck` to PlayState to allow assigning of last actor to give an item. This allows precise tracking of GS, freestanding PoH, etc. Works for chests too. Currently does not work for shops, unknown for normal NPC gives. Doesn't track last gives for non-checks, like drops from grass, pots, crates, etc. * Actor-based checks fully fleshed out, but can't help with sale-based checks. Implemented `pendingSaleCheck` to back out of an RC check cycle if `gSaveContext->pendingSale` is not NONE when `OnItemReceive` is called, processed through `OnSaleEnd`. This should be the final change necessary to streamline the checks. * Temporary hook to message box close to tie in trackers for non-gs/chest actors that aren't added to `GetCheckFromActor`. This triggers a 2-frame countdown to check with `HasItemBeenCollected` since half of the methods in there aren't updated until after a text box closes. Added scene tracking to get last scene so that checks in scenes that span several overworld areas could be tied to their areas properly. Modified tracker data creation to apply Link's Pocket and Song from Impa conditionally based on randomizer settings instead of just being assumed to be done. May need modification for checking click and drag spoiler loading. Removed the scene equivalence check from CheckChecks so that an entire area is checked each time to avoid issues with, e.g., leaving a shop before a pending sale finishes. * Changed check data creation to use RSKs from gRandomizer to account for settings loaded from drag and drop spoilers. * Beginning of tracker code organization. Changed check color defaults. * Reverted moving tracker colors to header. Some individual check fixes. * Missed something from previous merge? * Removed last remnant of removed performance mode. * Better handle checking when skullsanity is off. * Song checks sceneIDs don't match the scenes they're actually in for some reason. Removed that check. * SaleEnd checks don't need the GetItemEntry parameter. Also set a flag that should prevent the check tracker from running during vanilla saves should that not be resolved by the time it's merged. * Attempting to have only the relevant checks added to the tracker data, as well as showing vanilla checks for non-rando saves. Not working yet (everything is displayed in vanilla). * Added vanilla check tracker population via `vanillaCheck` bool in `RandomizerCheckObject`. This is also added to `IsVisibleInImGui` to handle file loading and saving to eliminate checks that aren't part of vanilla or the rando seed. Implemented deleted tracker data file recreation. Added some extra item name text checks. Songs are still... tricky, so they stay blank. Utilize local copies of the randomizer check objects that are applicable for performance purposes. Fixed vanilla item-giving cutscene crashes when triggered mid-transition. * Apparently not all toolchains can handle macro instantiation without all parameters, like VS can. * Fixed scummed detail color not showing properly on tracker. * Fixed dungeon area totals and GS checks not functioning properly. * Major revamp of checking code. Doesn't rely on `GetCheckFromActor` at all anymore, but instead simply sets a flag to evaluate a number of checks in an area every frame until the check that was gotten is identified. With the new setup, it's much less hardware intensive, and at 60fps 6 checks per frame shows no noticeable effect on framerate. I can envision needing to add a collectedCount in order to account for times when two checks are gotten one right after the other. Changed area scroll to happen from `OnTransitionEnd`, and allow for scrolling in bazaar (was disabled previously because it would jump back and forth between Kak and Market while you were in one). Also setup area check order updating by area instead of all at the same time. * Fixed shooting gallery not reporting proper area. Prevent checks from actually happening if area is RCAREA_INVALID, now that all areas are reporting something if they have checks. Fixed `GetCheckArea()` not updating checks for standard scenes. Lots of vanilla tracking updates, mainly manual checks for gems, medallions and songs, since the often don't have proper scenes in the data. Prevent vanilla from triggering check loops if junk items are collected. Fixed sorting based on saved vs collected. Prevent item name display for vanilla runs. Change coloring of checks so the check name reflects status in vanilla runs. * Fixed "Recheck Area" button erroneously adding to an area's check totals? * Fix DMC vanilla checks. * Fix check tracker data recreation on data file loss. Removed redundant file exists check from SaveTrackerDataHook, as it doesn't matter if it exists or not at that point. Limited check loops to 3 to avoid infinite check loops on non-check/junk item pickup. Added more checks to disable tracker operations if a save is not running. Changed check ordering to put boss reward and heart container checks at the end of whatever RCSHOW group they belong to. * Fixed IsRunning calculation. Further improving vanilla checking. Starting framework for checking medallions, stones, and songs on data file recreation. Fixed medallion check collection. Added GIFT_FROM_SAGES to check list for vanilla file for tracking light medallion. Added check loop limitation to prevent infinite checking after picking up junk item from the ground. * Finished vanilla file recreation and recheck (songs and dungeon rewards all check properly now). This includes deku shield with KF shop item 3. Finished Gift from Raoru light medallion tracking for vanilla. Commented all CheckByScene functionality for now. * Fixed new save data file creation. Disabled entrance area calculation for now, as it only tracks the previous entrance for some reason. Fixed area detection for ToT checks. * GetCheckArea() now utilizes EntranceData almost exclusively, via either `gSaveContext.entranceIndex` or the entrance tracker's `currentGrottoId` in the case of grottos. This also means that EVERYTHING CAN AUTOSCROLL NOW. Entrance shuffles are now much easier to track. Autoscroll is now also triggered on save, just in case someone isn't autosaving and has a lot of checks that get converted to saved. * Fixed missing GS check in LW. * Added area scroll on toggling Show Hidden Items. May configure differently later. Fixed area detection for entrances in Gerudo Fortress/Valley and Collossus. Haunted wasteland doesn't autoscroll due to a bug in `OnTransitionEnd` hook, but checks still evaluate properly there. Rely on scene-based area detection if scene is a main overworld or dungeon scene. * Fixed grotto detection when shuffle is off. * Small code cleanup. Fixed Colossus hand chest checks. * Missing lus bump from merge conflict resolution * Fixed Colossus Grotto making `GetCheckArea` return Wasteland. * Improved OnItemReceive processing for non-token GS checks, since they can sometimes take long enough for the checking process to time out before the item is registered as received. * First attempt at thread safety for tracker data file writing. Seems to work, but might need more testing. * Fixed Recheck Area not unskipping items that register as saved. Improved delayed saving with autosaving, as the autosave triggered quite often before the tracker data save, making things not properly register as saved. * merge cleanup * Converted check tracker data to the sectional saves, adding `CheckTrackerData` to `SaveContext`. Implemented section ID returning and fullSave boolean passing to section functions from my PR temporarily for it to work properly. Moved `RandomizerCheckTrackerData` enum to `randomizerTypes.h` to accommodate that. Changed `Randomizer_SaveInit` to a `SaveManager::InitFunc` to allow for other randomizer-dependent sections to be initialized after that. Required a little refactoring to maintain intro cutscene skip when starting a randomizer file. * Revert section index return and randomizer init changes. Will need to wait on yet more changes to main. * Fixed check tracker initialization (shouldn't be tied to window initialization), restored saving/loading functionality. * Removed `CheckTracker::Init` and put SaveManager calls in `CheckTrackerWindow::InitElement`. Also a bit of cleanup from transition back to save file use. * Fixed tracker displaying check categories while file not loaded. * Fix Darunia's Joy check not marking in vanilla. * Fix autosave not triggering change from collected to saved in tracker data. * Changed default colors for scummed and collected display. * Merge upgrade code cleanup. * Add `OnTransitionEnd` calls to sandstorm transitions both to and from Wasteland. Also improved `gSaveContext.lastScene` assignment for both transition types. Allowed a bit of cleanup in `GetCheckArea`. * Added `StateButton`, a button like `ArrowButton` but that allows text instead of arrow icons. Apparently the changes from ArrowButton to StateButton happened in a previous commit... * Changed section name to `trackerDataCheck` to force SoH to load it after the randomizer section, as it required some randoSettings to be loaded first, and nothing else I tried to make the randomizer section load before it worked. This hacks a solution to checks not displaying on fast file load to a specific slot. F*** you, SaveManager, and f*** you too, JSON. * Forgot to change the section string for loading with the name change. * Fix check ordering for checks that trigger the autosave. * Adds option to remove right-side shop items (slots 1-4) from the tracker list. Enabled by default. * Fix default state of Hide Shop Right Checks checkbox. * Fixes grotto and great fairy scrolling and checks. Fixes array overflow from `checkTrackerData` which was creating the issue trying to load the base and randomizer sections first, among other things. That also fixed the massive file loads that were being exhibited in debug mode. * Fix shooting galleries being set as collected again when being played a second time after getting the checks. * Fix Bazaar autoscroll. * Add Saria's Song to `GetCheckFromActor` and removed some limitations from the messageCloseCheck function to make that check track properly. * Fix Song from Impa check. Implemented prevention for multiple "collections" of great fairies, just in case getting the health refill would trigger it with the previous setup. * Fix ice traps on GS tokens not triggering OnItemReceive. * Complete fix for ice trap collection from GS. Add autoscroll when clicking "Expand All". * Add `OnShopSlotChange` with cursorSlot and basePrice parameters. * Fixed include in en_ossan for shop slot hook. Added registration for `OnShopSlotChange` in the tracker, storing the price in a new `price` field in `CheckTrackerData`. Added "seen" functionality to shop checks. Displays the model item name upon first entering a shop, adding the price and switching to trickName (if it's an ice trap) upon navigating to the slot in buy mode, triggered by an invisible "identified" status that mirrors "seen" in every other way. Added tooltips to most options for check tracker color picking to describe what each status actually means. * `std::format` pls * So apparently std::format just decided to break with the latest merge from develop, but fmt::format exists and works? * Removed the last vestiges of `locationsSkipped`. Other general code and formatting cleanups. Moved `IsGameRunning` to `OTRGlobals` so the item tracker could also access it. Used preceding to "fix" item and bottle display in the item tracker on startup. * Some more code cleanup. Removed "Recheck Area" button and relevant code. Backported changes to Anchor branch applicable for single-player, including making a checkAreas vector and structuring the frame by frame checks around that. Also includes fix for Silver Gauntlets and Mirror Shield check collection crash associated with those changes. Fixed Kakariko Bazaar "seen" updates. Fixed tracker window not showing on initial load like it should. * Forgot 1 formatting fix. * Removed conditions for showing Song from Impa (isn't junk under certain conditions, so should show all the time). * Fix vanilla checks, add Zelda's Letter and Malon's Egg to manual check collection. Fix autoscroll while in child stealth section. * Fix crash in Happy Mask Shop in OnSlotChange (referenced non-existent shop id in a tracker-specific enum). * General code cleanup. * Missed one reversion. * One more. * Fix column alignment in `randomizer_check_objects`. * Fix file encoding on `randomizer_check_tracker`. Again. * Fix indentation for `actualItemtrackerItemMap`. Also removed unnecessary parts of the map. * Rename `HasEqItem` to `HasEquipment`. * Slightly better indentation for `actualItemTrackerItemMap`. * Add magic bean salesman to vanilla check tracking, and genericized deku shield to trigger KF shop item 3 wherever you get the shield. Renamed `vanillaCheck` to `vanillaHundoCheck` to (supposedly) clarify the meaning of the usage. * One more rename to `vanillaCompletion` to avoid possible confusion with 100% speedrun conditions. * give me a break XD Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * Changes suggested by briaguya (rename `RandomizerCheckShow` to `Status`, unused code, newline formatting) * Remove unused `itemNames` table. * Remove `IsGameRunning` in favor of `GameInteractor::IsSaveLoaded`. * Restore anti-spoiler functionality for dungeons with dungeon maps. * Review cleanup. * Fix prices not showing for Kak bazaar items. --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com>
2023-10-04 11:03:36 -04:00
areasSpoiled |= (1 << area);
}
Randomizer Auto Location tracker (#1942) * Initial Auto-Location Tracking * Updates styling for checked items in Check Tracker * Fixes crashing issues with Check Tracker rendering * Auto scroll Check Tracker windows to current area * Checks Tracker only shows checked locations once in game * Fixes issue where Check Tracker would auto-scroll to wrong location when entering a grotto * Fixes gerudo fortress checks showing in tracker when settings have them removed * InfTable Check Location Fixes: Lost Dog Richard, Rolling Gorons, HBA 1000, Thawed Zora * Fixes most Event Chk Inf Checks on Check Tracker, and Frogs * Check Tracker - Song from Malon now works * Check Tracker - Fixes Claim Check check not tracking - Fixes spoiler for Claim Check check when getting Biggoron's Sword - Fixes LACS being spoiled and not tracking * Check Tracker - Fixes #2 for Skull Mask and Mask of Truth checks * Check Tracker - Adds support for merchants - Fixes #7 for Bomchu Salesman - Fixes #12 for Medigoron * Check Tracker - Fixes #8 for Song from Saria * Check Tracker - Fixes #9 for Adult Shooting Gallery * Check Tracker - Fixes #10 for Composer Grave * Check Tracker - Fixes #14 for Song from Ocarina of Time * Check Tracker - Fixes #16 for Shooting the Sun * Check Tracker - Fixes #19 for Darunia's Joy * Save Editor - Adds missing label for Treasure Chest Game * Check Tracker - Fixes Great Faries checks * Check Tracker - Fixes Sheik at Temple * Check Tracker - Fixes Great Fairy auto-scroll to wrong location * Check Tracker - Updates blue warp checks - Fixes Bongo Bongo and Twinrova checks * Check Tracker - Fixes Dampe's Gravedigging Tour * Check Tracker - Fixes Prescription to King Zora * Check Tracker - Fixes Bazaar showing under wrong area on tracker between adult/child * Check Tracker - Fixes scroll for Hyrule Market and Bazaar * Check Tracker - Fixes giving Adult Trade Items shown on tracker: Broken Sword, Saw, Cojiro, Eyeball Froge, and Eyedrops * Cleans up item_location * Check Tracker - Item List - Fixes item list not updating when changing seeds/options - Separates item exclusion list from item check list - Clean up comments * Check Tracker - Adds Skip functionality to buttons * Check Tracker - Refactors adult trade items to RandomizerInf * Check Tracker - Fixes an issue where any time an item is removed the tracker would cause an application crash * Check Tracker - Item names are now dependent on file language * Check Tracker - Fixes Gerudo Card check not showing in Fast setting * Reorders headers to (hopefully) avoid CI build conflicts on linux/consoles * Explicitly defines vector header in randomizer.h to fix compile errors * Complete Refactor of Check Tracker ImGui * Adds missing check tracker files to CMakeLists * Reverts the Item_location whitespace cleanup from ad10807c * Check Tracker - Loading Fixes - Fixes a bug where loading a save file a second time would add all the checks again - Fixes a bug where the check tracker would not render at all until in a save file * Check Tracker - Fixes a bug where checks would sometimes fail to load * Check Tracker - Fixes duplicated checks when using Only on Pause or Only on Combo * Check Tracker - Works around issue where single characters don't show in EnhancementCombobox, and fixes a label for combo buttons held option * Check Tracker - Applies all Check Tracker changes to Item Location * Check Tracker - Updated Check List - Adds Link's pocket, either in KF or HM depending on starting age - Supports Scrubs and Merchants - Uses enums instead of magic numbers - Updates DC Scrub Short Names for MQ * Check Tracker - Adds a performance mode option * Check Tracker - List Fixes (requires new rando generation) - Fixes Frogs Rupees always visible - Fixes Kokiri Sword Chest not showing - Fixes Weird Egg not showing * Check Tracker - MQ List basic support * Check Tracker - MQ/Vanilla anti-spoilers * Check Tracker - Collecting a compass now spoils the area * Check Tracker - Basic Vanilla Support and fixes - Vanilla items show in check tracker, even if many won't auto check - Fixes an issue with Gerudo Fortress Keys - Refactors IsVisibleInCheckTracker to randomizer_check_tracjer * Check Tracker - Fixes merge conflict from 08a487f35e1d760ab9e69b932edbe4da6bcd9edb * Check Tracker - Fixes tracker loading as Floating when default value is set to Windowed * Randomizer Location Exclusion List - Adds Scrubs, Merchants, Shops. Adult Trade items, MQ Dungeons, and Bean Salesman - Fixes Kokiri Sword Chest, Weird Egg, and Frog Song Rupees from misbehaving - Updates Gerudo Fortress logic to be dependent on Open/Fast/Normal Fortress - Removes Invalid Check - Adds RO Enum for MQ settings - Updates magic values to RO enum * Location Exclusion List - Scrubs that are always randomized now always show on the list * For now, removes some extra code only needed for a Check Tracker. * Randomizer Location Exclusion List - Fixes Eyeball Frog from showing up when Adult Trade Items was off * Location Tracker - Updates Eyedrops to use RandomizerInf instead of Chest * Check Tracker - Fixes a bug where Link's Pocket item wasn't acting as checked for area item count * Check Tracker - Fixes a bug where Locations would incorrectly say Vanilla due to the first check in the area being a non-MQ check * Check Tracker - Fixes a crash when Check Tracker is docked but not visible * Check Tracker - Fixes areas being spoiled when loading different save files * Check Tracker - Only reset variables if they are initialized * Check Tracker - Cleans up old comments, unused variables, methods, and macros, adds language TODOs, * Check Tracker - Readds rainbow UI elements after Cosmetics Editor refactor * Check Tracker - Removal of flag lookup that was refactored, no longer needed header, and some trivial whitespace fixes. * Check Tracker - Refactors Index to Bitmask code to a macro * Check Tracker - Changes ordering from alphabetical to RandomizerCheck ordering * Check Tracker - Wraps everything in a namespace to avoid global variable usage * Check Tracker - Explicitly defines for-loop scope * Check Tracker - refactors dungeon lookup from static array to function * Fixes a bug when using EnhancementColor with alpha * Check Tracker - Refactors all colour to use direct conversions * Check Tracker - refactors settings loading and check visibility for readability * Check Tracker - Fixes a bug where the wrong label showed on the Check Tracker BG Color * UIWidgets - Adds Alpha bar to EnhancementColor when using alpha parameter
2022-12-10 22:39:23 -05:00
}
Check Tracker Update (#2668) * Initial commit. What works so far: Data file loads, saves, deletes, and is created properly. - Need to run `HasItemBeenCollected` when creating in case of mid-seed regen. Organized checks into maps set by area. Areas show in tracker. - Checks pulled from checkObjectsByArea are not currently listed. - Areas are being assumed completed and hidden at the start. * Checks now populate. Still not counting area totals properly. * Don't track RC_LINKS_POCKET in the data file, and instead manually add it in every time a save is load. rcObjects doesn't contain Link's Pocket location (duh). * Moved ItemReceive hook to randomizer_check_tracker.cpp. Skipped items are properly sorted and formatted. Saved items contribute to an area's gotten/skipped checks on load. Changed skipped items default main color to gray. General code cleanup. * Skipped checks now contribute to area totals for area completion logic. * Mid-menu rework transfer. * Started check lookup on item receive. Tried to enable scum checking on save. * Fixed scum check on save. * More code cleanup, which revealed some issues with loading and saving. Loading now works 100%, but entries in checkTrackerData are disappearing in code somewhere, causing issues with later checks. Scummed color now displays properly. Collected but unsaved displays properly. Unchecked, Skipped, Seen and Scummed checks all have arrows for skipping/unskipping. Counts a little messed up, probably double adding skips. * Fixed item counts being off across resets. Restarts were fine. * Beginning of rework for individual check updates. Adds `Actor lastCheck` to PlayState to allow assigning of last actor to give an item. This allows precise tracking of GS, freestanding PoH, etc. Works for chests too. Currently does not work for shops, unknown for normal NPC gives. Doesn't track last gives for non-checks, like drops from grass, pots, crates, etc. * Actor-based checks fully fleshed out, but can't help with sale-based checks. Implemented `pendingSaleCheck` to back out of an RC check cycle if `gSaveContext->pendingSale` is not NONE when `OnItemReceive` is called, processed through `OnSaleEnd`. This should be the final change necessary to streamline the checks. * Temporary hook to message box close to tie in trackers for non-gs/chest actors that aren't added to `GetCheckFromActor`. This triggers a 2-frame countdown to check with `HasItemBeenCollected` since half of the methods in there aren't updated until after a text box closes. Added scene tracking to get last scene so that checks in scenes that span several overworld areas could be tied to their areas properly. Modified tracker data creation to apply Link's Pocket and Song from Impa conditionally based on randomizer settings instead of just being assumed to be done. May need modification for checking click and drag spoiler loading. Removed the scene equivalence check from CheckChecks so that an entire area is checked each time to avoid issues with, e.g., leaving a shop before a pending sale finishes. * Changed check data creation to use RSKs from gRandomizer to account for settings loaded from drag and drop spoilers. * Beginning of tracker code organization. Changed check color defaults. * Reverted moving tracker colors to header. Some individual check fixes. * Missed something from previous merge? * Removed last remnant of removed performance mode. * Better handle checking when skullsanity is off. * Song checks sceneIDs don't match the scenes they're actually in for some reason. Removed that check. * SaleEnd checks don't need the GetItemEntry parameter. Also set a flag that should prevent the check tracker from running during vanilla saves should that not be resolved by the time it's merged. * Attempting to have only the relevant checks added to the tracker data, as well as showing vanilla checks for non-rando saves. Not working yet (everything is displayed in vanilla). * Added vanilla check tracker population via `vanillaCheck` bool in `RandomizerCheckObject`. This is also added to `IsVisibleInImGui` to handle file loading and saving to eliminate checks that aren't part of vanilla or the rando seed. Implemented deleted tracker data file recreation. Added some extra item name text checks. Songs are still... tricky, so they stay blank. Utilize local copies of the randomizer check objects that are applicable for performance purposes. Fixed vanilla item-giving cutscene crashes when triggered mid-transition. * Apparently not all toolchains can handle macro instantiation without all parameters, like VS can. * Fixed scummed detail color not showing properly on tracker. * Fixed dungeon area totals and GS checks not functioning properly. * Major revamp of checking code. Doesn't rely on `GetCheckFromActor` at all anymore, but instead simply sets a flag to evaluate a number of checks in an area every frame until the check that was gotten is identified. With the new setup, it's much less hardware intensive, and at 60fps 6 checks per frame shows no noticeable effect on framerate. I can envision needing to add a collectedCount in order to account for times when two checks are gotten one right after the other. Changed area scroll to happen from `OnTransitionEnd`, and allow for scrolling in bazaar (was disabled previously because it would jump back and forth between Kak and Market while you were in one). Also setup area check order updating by area instead of all at the same time. * Fixed shooting gallery not reporting proper area. Prevent checks from actually happening if area is RCAREA_INVALID, now that all areas are reporting something if they have checks. Fixed `GetCheckArea()` not updating checks for standard scenes. Lots of vanilla tracking updates, mainly manual checks for gems, medallions and songs, since the often don't have proper scenes in the data. Prevent vanilla from triggering check loops if junk items are collected. Fixed sorting based on saved vs collected. Prevent item name display for vanilla runs. Change coloring of checks so the check name reflects status in vanilla runs. * Fixed "Recheck Area" button erroneously adding to an area's check totals? * Fix DMC vanilla checks. * Fix check tracker data recreation on data file loss. Removed redundant file exists check from SaveTrackerDataHook, as it doesn't matter if it exists or not at that point. Limited check loops to 3 to avoid infinite check loops on non-check/junk item pickup. Added more checks to disable tracker operations if a save is not running. Changed check ordering to put boss reward and heart container checks at the end of whatever RCSHOW group they belong to. * Fixed IsRunning calculation. Further improving vanilla checking. Starting framework for checking medallions, stones, and songs on data file recreation. Fixed medallion check collection. Added GIFT_FROM_SAGES to check list for vanilla file for tracking light medallion. Added check loop limitation to prevent infinite checking after picking up junk item from the ground. * Finished vanilla file recreation and recheck (songs and dungeon rewards all check properly now). This includes deku shield with KF shop item 3. Finished Gift from Raoru light medallion tracking for vanilla. Commented all CheckByScene functionality for now. * Fixed new save data file creation. Disabled entrance area calculation for now, as it only tracks the previous entrance for some reason. Fixed area detection for ToT checks. * GetCheckArea() now utilizes EntranceData almost exclusively, via either `gSaveContext.entranceIndex` or the entrance tracker's `currentGrottoId` in the case of grottos. This also means that EVERYTHING CAN AUTOSCROLL NOW. Entrance shuffles are now much easier to track. Autoscroll is now also triggered on save, just in case someone isn't autosaving and has a lot of checks that get converted to saved. * Fixed missing GS check in LW. * Added area scroll on toggling Show Hidden Items. May configure differently later. Fixed area detection for entrances in Gerudo Fortress/Valley and Collossus. Haunted wasteland doesn't autoscroll due to a bug in `OnTransitionEnd` hook, but checks still evaluate properly there. Rely on scene-based area detection if scene is a main overworld or dungeon scene. * Fixed grotto detection when shuffle is off. * Small code cleanup. Fixed Colossus hand chest checks. * Missing lus bump from merge conflict resolution * Fixed Colossus Grotto making `GetCheckArea` return Wasteland. * Improved OnItemReceive processing for non-token GS checks, since they can sometimes take long enough for the checking process to time out before the item is registered as received. * First attempt at thread safety for tracker data file writing. Seems to work, but might need more testing. * Fixed Recheck Area not unskipping items that register as saved. Improved delayed saving with autosaving, as the autosave triggered quite often before the tracker data save, making things not properly register as saved. * merge cleanup * Converted check tracker data to the sectional saves, adding `CheckTrackerData` to `SaveContext`. Implemented section ID returning and fullSave boolean passing to section functions from my PR temporarily for it to work properly. Moved `RandomizerCheckTrackerData` enum to `randomizerTypes.h` to accommodate that. Changed `Randomizer_SaveInit` to a `SaveManager::InitFunc` to allow for other randomizer-dependent sections to be initialized after that. Required a little refactoring to maintain intro cutscene skip when starting a randomizer file. * Revert section index return and randomizer init changes. Will need to wait on yet more changes to main. * Fixed check tracker initialization (shouldn't be tied to window initialization), restored saving/loading functionality. * Removed `CheckTracker::Init` and put SaveManager calls in `CheckTrackerWindow::InitElement`. Also a bit of cleanup from transition back to save file use. * Fixed tracker displaying check categories while file not loaded. * Fix Darunia's Joy check not marking in vanilla. * Fix autosave not triggering change from collected to saved in tracker data. * Changed default colors for scummed and collected display. * Merge upgrade code cleanup. * Add `OnTransitionEnd` calls to sandstorm transitions both to and from Wasteland. Also improved `gSaveContext.lastScene` assignment for both transition types. Allowed a bit of cleanup in `GetCheckArea`. * Added `StateButton`, a button like `ArrowButton` but that allows text instead of arrow icons. Apparently the changes from ArrowButton to StateButton happened in a previous commit... * Changed section name to `trackerDataCheck` to force SoH to load it after the randomizer section, as it required some randoSettings to be loaded first, and nothing else I tried to make the randomizer section load before it worked. This hacks a solution to checks not displaying on fast file load to a specific slot. F*** you, SaveManager, and f*** you too, JSON. * Forgot to change the section string for loading with the name change. * Fix check ordering for checks that trigger the autosave. * Adds option to remove right-side shop items (slots 1-4) from the tracker list. Enabled by default. * Fix default state of Hide Shop Right Checks checkbox. * Fixes grotto and great fairy scrolling and checks. Fixes array overflow from `checkTrackerData` which was creating the issue trying to load the base and randomizer sections first, among other things. That also fixed the massive file loads that were being exhibited in debug mode. * Fix shooting galleries being set as collected again when being played a second time after getting the checks. * Fix Bazaar autoscroll. * Add Saria's Song to `GetCheckFromActor` and removed some limitations from the messageCloseCheck function to make that check track properly. * Fix Song from Impa check. Implemented prevention for multiple "collections" of great fairies, just in case getting the health refill would trigger it with the previous setup. * Fix ice traps on GS tokens not triggering OnItemReceive. * Complete fix for ice trap collection from GS. Add autoscroll when clicking "Expand All". * Add `OnShopSlotChange` with cursorSlot and basePrice parameters. * Fixed include in en_ossan for shop slot hook. Added registration for `OnShopSlotChange` in the tracker, storing the price in a new `price` field in `CheckTrackerData`. Added "seen" functionality to shop checks. Displays the model item name upon first entering a shop, adding the price and switching to trickName (if it's an ice trap) upon navigating to the slot in buy mode, triggered by an invisible "identified" status that mirrors "seen" in every other way. Added tooltips to most options for check tracker color picking to describe what each status actually means. * `std::format` pls * So apparently std::format just decided to break with the latest merge from develop, but fmt::format exists and works? * Removed the last vestiges of `locationsSkipped`. Other general code and formatting cleanups. Moved `IsGameRunning` to `OTRGlobals` so the item tracker could also access it. Used preceding to "fix" item and bottle display in the item tracker on startup. * Some more code cleanup. Removed "Recheck Area" button and relevant code. Backported changes to Anchor branch applicable for single-player, including making a checkAreas vector and structuring the frame by frame checks around that. Also includes fix for Silver Gauntlets and Mirror Shield check collection crash associated with those changes. Fixed Kakariko Bazaar "seen" updates. Fixed tracker window not showing on initial load like it should. * Forgot 1 formatting fix. * Removed conditions for showing Song from Impa (isn't junk under certain conditions, so should show all the time). * Fix vanilla checks, add Zelda's Letter and Malon's Egg to manual check collection. Fix autoscroll while in child stealth section. * Fix crash in Happy Mask Shop in OnSlotChange (referenced non-existent shop id in a tracker-specific enum). * General code cleanup. * Missed one reversion. * One more. * Fix column alignment in `randomizer_check_objects`. * Fix file encoding on `randomizer_check_tracker`. Again. * Fix indentation for `actualItemtrackerItemMap`. Also removed unnecessary parts of the map. * Rename `HasEqItem` to `HasEquipment`. * Slightly better indentation for `actualItemTrackerItemMap`. * Add magic bean salesman to vanilla check tracking, and genericized deku shield to trigger KF shop item 3 wherever you get the shield. Renamed `vanillaCheck` to `vanillaHundoCheck` to (supposedly) clarify the meaning of the usage. * One more rename to `vanillaCompletion` to avoid possible confusion with 100% speedrun conditions. * give me a break XD Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * Changes suggested by briaguya (rename `RandomizerCheckShow` to `Status`, unused code, newline formatting) * Remove unused `itemNames` table. * Remove `IsGameRunning` in favor of `GameInteractor::IsSaveLoaded`. * Restore anti-spoiler functionality for dungeons with dungeon maps. * Review cleanup. * Fix prices not showing for Kak bazaar items. --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com>
2023-10-04 11:03:36 -04:00
void UpdateAllOrdering() {
Randomizer Auto Location tracker (#1942) * Initial Auto-Location Tracking * Updates styling for checked items in Check Tracker * Fixes crashing issues with Check Tracker rendering * Auto scroll Check Tracker windows to current area * Checks Tracker only shows checked locations once in game * Fixes issue where Check Tracker would auto-scroll to wrong location when entering a grotto * Fixes gerudo fortress checks showing in tracker when settings have them removed * InfTable Check Location Fixes: Lost Dog Richard, Rolling Gorons, HBA 1000, Thawed Zora * Fixes most Event Chk Inf Checks on Check Tracker, and Frogs * Check Tracker - Song from Malon now works * Check Tracker - Fixes Claim Check check not tracking - Fixes spoiler for Claim Check check when getting Biggoron's Sword - Fixes LACS being spoiled and not tracking * Check Tracker - Fixes #2 for Skull Mask and Mask of Truth checks * Check Tracker - Adds support for merchants - Fixes #7 for Bomchu Salesman - Fixes #12 for Medigoron * Check Tracker - Fixes #8 for Song from Saria * Check Tracker - Fixes #9 for Adult Shooting Gallery * Check Tracker - Fixes #10 for Composer Grave * Check Tracker - Fixes #14 for Song from Ocarina of Time * Check Tracker - Fixes #16 for Shooting the Sun * Check Tracker - Fixes #19 for Darunia's Joy * Save Editor - Adds missing label for Treasure Chest Game * Check Tracker - Fixes Great Faries checks * Check Tracker - Fixes Sheik at Temple * Check Tracker - Fixes Great Fairy auto-scroll to wrong location * Check Tracker - Updates blue warp checks - Fixes Bongo Bongo and Twinrova checks * Check Tracker - Fixes Dampe's Gravedigging Tour * Check Tracker - Fixes Prescription to King Zora * Check Tracker - Fixes Bazaar showing under wrong area on tracker between adult/child * Check Tracker - Fixes scroll for Hyrule Market and Bazaar * Check Tracker - Fixes giving Adult Trade Items shown on tracker: Broken Sword, Saw, Cojiro, Eyeball Froge, and Eyedrops * Cleans up item_location * Check Tracker - Item List - Fixes item list not updating when changing seeds/options - Separates item exclusion list from item check list - Clean up comments * Check Tracker - Adds Skip functionality to buttons * Check Tracker - Refactors adult trade items to RandomizerInf * Check Tracker - Fixes an issue where any time an item is removed the tracker would cause an application crash * Check Tracker - Item names are now dependent on file language * Check Tracker - Fixes Gerudo Card check not showing in Fast setting * Reorders headers to (hopefully) avoid CI build conflicts on linux/consoles * Explicitly defines vector header in randomizer.h to fix compile errors * Complete Refactor of Check Tracker ImGui * Adds missing check tracker files to CMakeLists * Reverts the Item_location whitespace cleanup from ad10807c * Check Tracker - Loading Fixes - Fixes a bug where loading a save file a second time would add all the checks again - Fixes a bug where the check tracker would not render at all until in a save file * Check Tracker - Fixes a bug where checks would sometimes fail to load * Check Tracker - Fixes duplicated checks when using Only on Pause or Only on Combo * Check Tracker - Works around issue where single characters don't show in EnhancementCombobox, and fixes a label for combo buttons held option * Check Tracker - Applies all Check Tracker changes to Item Location * Check Tracker - Updated Check List - Adds Link's pocket, either in KF or HM depending on starting age - Supports Scrubs and Merchants - Uses enums instead of magic numbers - Updates DC Scrub Short Names for MQ * Check Tracker - Adds a performance mode option * Check Tracker - List Fixes (requires new rando generation) - Fixes Frogs Rupees always visible - Fixes Kokiri Sword Chest not showing - Fixes Weird Egg not showing * Check Tracker - MQ List basic support * Check Tracker - MQ/Vanilla anti-spoilers * Check Tracker - Collecting a compass now spoils the area * Check Tracker - Basic Vanilla Support and fixes - Vanilla items show in check tracker, even if many won't auto check - Fixes an issue with Gerudo Fortress Keys - Refactors IsVisibleInCheckTracker to randomizer_check_tracjer * Check Tracker - Fixes merge conflict from 08a487f35e1d760ab9e69b932edbe4da6bcd9edb * Check Tracker - Fixes tracker loading as Floating when default value is set to Windowed * Randomizer Location Exclusion List - Adds Scrubs, Merchants, Shops. Adult Trade items, MQ Dungeons, and Bean Salesman - Fixes Kokiri Sword Chest, Weird Egg, and Frog Song Rupees from misbehaving - Updates Gerudo Fortress logic to be dependent on Open/Fast/Normal Fortress - Removes Invalid Check - Adds RO Enum for MQ settings - Updates magic values to RO enum * Location Exclusion List - Scrubs that are always randomized now always show on the list * For now, removes some extra code only needed for a Check Tracker. * Randomizer Location Exclusion List - Fixes Eyeball Frog from showing up when Adult Trade Items was off * Location Tracker - Updates Eyedrops to use RandomizerInf instead of Chest * Check Tracker - Fixes a bug where Link's Pocket item wasn't acting as checked for area item count * Check Tracker - Fixes a bug where Locations would incorrectly say Vanilla due to the first check in the area being a non-MQ check * Check Tracker - Fixes a crash when Check Tracker is docked but not visible * Check Tracker - Fixes areas being spoiled when loading different save files * Check Tracker - Only reset variables if they are initialized * Check Tracker - Cleans up old comments, unused variables, methods, and macros, adds language TODOs, * Check Tracker - Readds rainbow UI elements after Cosmetics Editor refactor * Check Tracker - Removal of flag lookup that was refactored, no longer needed header, and some trivial whitespace fixes. * Check Tracker - Refactors Index to Bitmask code to a macro * Check Tracker - Changes ordering from alphabetical to RandomizerCheck ordering * Check Tracker - Wraps everything in a namespace to avoid global variable usage * Check Tracker - Explicitly defines for-loop scope * Check Tracker - refactors dungeon lookup from static array to function * Fixes a bug when using EnhancementColor with alpha * Check Tracker - Refactors all colour to use direct conversions * Check Tracker - refactors settings loading and check visibility for readability * Check Tracker - Fixes a bug where the wrong label showed on the Check Tracker BG Color * UIWidgets - Adds Alpha bar to EnhancementColor when using alpha parameter
2022-12-10 22:39:23 -05:00
// Sort the entire thing
Check Tracker Update (#2668) * Initial commit. What works so far: Data file loads, saves, deletes, and is created properly. - Need to run `HasItemBeenCollected` when creating in case of mid-seed regen. Organized checks into maps set by area. Areas show in tracker. - Checks pulled from checkObjectsByArea are not currently listed. - Areas are being assumed completed and hidden at the start. * Checks now populate. Still not counting area totals properly. * Don't track RC_LINKS_POCKET in the data file, and instead manually add it in every time a save is load. rcObjects doesn't contain Link's Pocket location (duh). * Moved ItemReceive hook to randomizer_check_tracker.cpp. Skipped items are properly sorted and formatted. Saved items contribute to an area's gotten/skipped checks on load. Changed skipped items default main color to gray. General code cleanup. * Skipped checks now contribute to area totals for area completion logic. * Mid-menu rework transfer. * Started check lookup on item receive. Tried to enable scum checking on save. * Fixed scum check on save. * More code cleanup, which revealed some issues with loading and saving. Loading now works 100%, but entries in checkTrackerData are disappearing in code somewhere, causing issues with later checks. Scummed color now displays properly. Collected but unsaved displays properly. Unchecked, Skipped, Seen and Scummed checks all have arrows for skipping/unskipping. Counts a little messed up, probably double adding skips. * Fixed item counts being off across resets. Restarts were fine. * Beginning of rework for individual check updates. Adds `Actor lastCheck` to PlayState to allow assigning of last actor to give an item. This allows precise tracking of GS, freestanding PoH, etc. Works for chests too. Currently does not work for shops, unknown for normal NPC gives. Doesn't track last gives for non-checks, like drops from grass, pots, crates, etc. * Actor-based checks fully fleshed out, but can't help with sale-based checks. Implemented `pendingSaleCheck` to back out of an RC check cycle if `gSaveContext->pendingSale` is not NONE when `OnItemReceive` is called, processed through `OnSaleEnd`. This should be the final change necessary to streamline the checks. * Temporary hook to message box close to tie in trackers for non-gs/chest actors that aren't added to `GetCheckFromActor`. This triggers a 2-frame countdown to check with `HasItemBeenCollected` since half of the methods in there aren't updated until after a text box closes. Added scene tracking to get last scene so that checks in scenes that span several overworld areas could be tied to their areas properly. Modified tracker data creation to apply Link's Pocket and Song from Impa conditionally based on randomizer settings instead of just being assumed to be done. May need modification for checking click and drag spoiler loading. Removed the scene equivalence check from CheckChecks so that an entire area is checked each time to avoid issues with, e.g., leaving a shop before a pending sale finishes. * Changed check data creation to use RSKs from gRandomizer to account for settings loaded from drag and drop spoilers. * Beginning of tracker code organization. Changed check color defaults. * Reverted moving tracker colors to header. Some individual check fixes. * Missed something from previous merge? * Removed last remnant of removed performance mode. * Better handle checking when skullsanity is off. * Song checks sceneIDs don't match the scenes they're actually in for some reason. Removed that check. * SaleEnd checks don't need the GetItemEntry parameter. Also set a flag that should prevent the check tracker from running during vanilla saves should that not be resolved by the time it's merged. * Attempting to have only the relevant checks added to the tracker data, as well as showing vanilla checks for non-rando saves. Not working yet (everything is displayed in vanilla). * Added vanilla check tracker population via `vanillaCheck` bool in `RandomizerCheckObject`. This is also added to `IsVisibleInImGui` to handle file loading and saving to eliminate checks that aren't part of vanilla or the rando seed. Implemented deleted tracker data file recreation. Added some extra item name text checks. Songs are still... tricky, so they stay blank. Utilize local copies of the randomizer check objects that are applicable for performance purposes. Fixed vanilla item-giving cutscene crashes when triggered mid-transition. * Apparently not all toolchains can handle macro instantiation without all parameters, like VS can. * Fixed scummed detail color not showing properly on tracker. * Fixed dungeon area totals and GS checks not functioning properly. * Major revamp of checking code. Doesn't rely on `GetCheckFromActor` at all anymore, but instead simply sets a flag to evaluate a number of checks in an area every frame until the check that was gotten is identified. With the new setup, it's much less hardware intensive, and at 60fps 6 checks per frame shows no noticeable effect on framerate. I can envision needing to add a collectedCount in order to account for times when two checks are gotten one right after the other. Changed area scroll to happen from `OnTransitionEnd`, and allow for scrolling in bazaar (was disabled previously because it would jump back and forth between Kak and Market while you were in one). Also setup area check order updating by area instead of all at the same time. * Fixed shooting gallery not reporting proper area. Prevent checks from actually happening if area is RCAREA_INVALID, now that all areas are reporting something if they have checks. Fixed `GetCheckArea()` not updating checks for standard scenes. Lots of vanilla tracking updates, mainly manual checks for gems, medallions and songs, since the often don't have proper scenes in the data. Prevent vanilla from triggering check loops if junk items are collected. Fixed sorting based on saved vs collected. Prevent item name display for vanilla runs. Change coloring of checks so the check name reflects status in vanilla runs. * Fixed "Recheck Area" button erroneously adding to an area's check totals? * Fix DMC vanilla checks. * Fix check tracker data recreation on data file loss. Removed redundant file exists check from SaveTrackerDataHook, as it doesn't matter if it exists or not at that point. Limited check loops to 3 to avoid infinite check loops on non-check/junk item pickup. Added more checks to disable tracker operations if a save is not running. Changed check ordering to put boss reward and heart container checks at the end of whatever RCSHOW group they belong to. * Fixed IsRunning calculation. Further improving vanilla checking. Starting framework for checking medallions, stones, and songs on data file recreation. Fixed medallion check collection. Added GIFT_FROM_SAGES to check list for vanilla file for tracking light medallion. Added check loop limitation to prevent infinite checking after picking up junk item from the ground. * Finished vanilla file recreation and recheck (songs and dungeon rewards all check properly now). This includes deku shield with KF shop item 3. Finished Gift from Raoru light medallion tracking for vanilla. Commented all CheckByScene functionality for now. * Fixed new save data file creation. Disabled entrance area calculation for now, as it only tracks the previous entrance for some reason. Fixed area detection for ToT checks. * GetCheckArea() now utilizes EntranceData almost exclusively, via either `gSaveContext.entranceIndex` or the entrance tracker's `currentGrottoId` in the case of grottos. This also means that EVERYTHING CAN AUTOSCROLL NOW. Entrance shuffles are now much easier to track. Autoscroll is now also triggered on save, just in case someone isn't autosaving and has a lot of checks that get converted to saved. * Fixed missing GS check in LW. * Added area scroll on toggling Show Hidden Items. May configure differently later. Fixed area detection for entrances in Gerudo Fortress/Valley and Collossus. Haunted wasteland doesn't autoscroll due to a bug in `OnTransitionEnd` hook, but checks still evaluate properly there. Rely on scene-based area detection if scene is a main overworld or dungeon scene. * Fixed grotto detection when shuffle is off. * Small code cleanup. Fixed Colossus hand chest checks. * Missing lus bump from merge conflict resolution * Fixed Colossus Grotto making `GetCheckArea` return Wasteland. * Improved OnItemReceive processing for non-token GS checks, since they can sometimes take long enough for the checking process to time out before the item is registered as received. * First attempt at thread safety for tracker data file writing. Seems to work, but might need more testing. * Fixed Recheck Area not unskipping items that register as saved. Improved delayed saving with autosaving, as the autosave triggered quite often before the tracker data save, making things not properly register as saved. * merge cleanup * Converted check tracker data to the sectional saves, adding `CheckTrackerData` to `SaveContext`. Implemented section ID returning and fullSave boolean passing to section functions from my PR temporarily for it to work properly. Moved `RandomizerCheckTrackerData` enum to `randomizerTypes.h` to accommodate that. Changed `Randomizer_SaveInit` to a `SaveManager::InitFunc` to allow for other randomizer-dependent sections to be initialized after that. Required a little refactoring to maintain intro cutscene skip when starting a randomizer file. * Revert section index return and randomizer init changes. Will need to wait on yet more changes to main. * Fixed check tracker initialization (shouldn't be tied to window initialization), restored saving/loading functionality. * Removed `CheckTracker::Init` and put SaveManager calls in `CheckTrackerWindow::InitElement`. Also a bit of cleanup from transition back to save file use. * Fixed tracker displaying check categories while file not loaded. * Fix Darunia's Joy check not marking in vanilla. * Fix autosave not triggering change from collected to saved in tracker data. * Changed default colors for scummed and collected display. * Merge upgrade code cleanup. * Add `OnTransitionEnd` calls to sandstorm transitions both to and from Wasteland. Also improved `gSaveContext.lastScene` assignment for both transition types. Allowed a bit of cleanup in `GetCheckArea`. * Added `StateButton`, a button like `ArrowButton` but that allows text instead of arrow icons. Apparently the changes from ArrowButton to StateButton happened in a previous commit... * Changed section name to `trackerDataCheck` to force SoH to load it after the randomizer section, as it required some randoSettings to be loaded first, and nothing else I tried to make the randomizer section load before it worked. This hacks a solution to checks not displaying on fast file load to a specific slot. F*** you, SaveManager, and f*** you too, JSON. * Forgot to change the section string for loading with the name change. * Fix check ordering for checks that trigger the autosave. * Adds option to remove right-side shop items (slots 1-4) from the tracker list. Enabled by default. * Fix default state of Hide Shop Right Checks checkbox. * Fixes grotto and great fairy scrolling and checks. Fixes array overflow from `checkTrackerData` which was creating the issue trying to load the base and randomizer sections first, among other things. That also fixed the massive file loads that were being exhibited in debug mode. * Fix shooting galleries being set as collected again when being played a second time after getting the checks. * Fix Bazaar autoscroll. * Add Saria's Song to `GetCheckFromActor` and removed some limitations from the messageCloseCheck function to make that check track properly. * Fix Song from Impa check. Implemented prevention for multiple "collections" of great fairies, just in case getting the health refill would trigger it with the previous setup. * Fix ice traps on GS tokens not triggering OnItemReceive. * Complete fix for ice trap collection from GS. Add autoscroll when clicking "Expand All". * Add `OnShopSlotChange` with cursorSlot and basePrice parameters. * Fixed include in en_ossan for shop slot hook. Added registration for `OnShopSlotChange` in the tracker, storing the price in a new `price` field in `CheckTrackerData`. Added "seen" functionality to shop checks. Displays the model item name upon first entering a shop, adding the price and switching to trickName (if it's an ice trap) upon navigating to the slot in buy mode, triggered by an invisible "identified" status that mirrors "seen" in every other way. Added tooltips to most options for check tracker color picking to describe what each status actually means. * `std::format` pls * So apparently std::format just decided to break with the latest merge from develop, but fmt::format exists and works? * Removed the last vestiges of `locationsSkipped`. Other general code and formatting cleanups. Moved `IsGameRunning` to `OTRGlobals` so the item tracker could also access it. Used preceding to "fix" item and bottle display in the item tracker on startup. * Some more code cleanup. Removed "Recheck Area" button and relevant code. Backported changes to Anchor branch applicable for single-player, including making a checkAreas vector and structuring the frame by frame checks around that. Also includes fix for Silver Gauntlets and Mirror Shield check collection crash associated with those changes. Fixed Kakariko Bazaar "seen" updates. Fixed tracker window not showing on initial load like it should. * Forgot 1 formatting fix. * Removed conditions for showing Song from Impa (isn't junk under certain conditions, so should show all the time). * Fix vanilla checks, add Zelda's Letter and Malon's Egg to manual check collection. Fix autoscroll while in child stealth section. * Fix crash in Happy Mask Shop in OnSlotChange (referenced non-existent shop id in a tracker-specific enum). * General code cleanup. * Missed one reversion. * One more. * Fix column alignment in `randomizer_check_objects`. * Fix file encoding on `randomizer_check_tracker`. Again. * Fix indentation for `actualItemtrackerItemMap`. Also removed unnecessary parts of the map. * Rename `HasEqItem` to `HasEquipment`. * Slightly better indentation for `actualItemTrackerItemMap`. * Add magic bean salesman to vanilla check tracking, and genericized deku shield to trigger KF shop item 3 wherever you get the shield. Renamed `vanillaCheck` to `vanillaHundoCheck` to (supposedly) clarify the meaning of the usage. * One more rename to `vanillaCompletion` to avoid possible confusion with 100% speedrun conditions. * give me a break XD Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * Changes suggested by briaguya (rename `RandomizerCheckShow` to `Status`, unused code, newline formatting) * Remove unused `itemNames` table. * Remove `IsGameRunning` in favor of `GameInteractor::IsSaveLoaded`. * Restore anti-spoiler functionality for dungeons with dungeon maps. * Review cleanup. * Fix prices not showing for Kak bazaar items. --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com>
2023-10-04 11:03:36 -04:00
for (int i = 0; i < RCAREA_INVALID; i++) {
UpdateOrdering(static_cast<RandomizerCheckArea>(i));
Randomizer Auto Location tracker (#1942) * Initial Auto-Location Tracking * Updates styling for checked items in Check Tracker * Fixes crashing issues with Check Tracker rendering * Auto scroll Check Tracker windows to current area * Checks Tracker only shows checked locations once in game * Fixes issue where Check Tracker would auto-scroll to wrong location when entering a grotto * Fixes gerudo fortress checks showing in tracker when settings have them removed * InfTable Check Location Fixes: Lost Dog Richard, Rolling Gorons, HBA 1000, Thawed Zora * Fixes most Event Chk Inf Checks on Check Tracker, and Frogs * Check Tracker - Song from Malon now works * Check Tracker - Fixes Claim Check check not tracking - Fixes spoiler for Claim Check check when getting Biggoron's Sword - Fixes LACS being spoiled and not tracking * Check Tracker - Fixes #2 for Skull Mask and Mask of Truth checks * Check Tracker - Adds support for merchants - Fixes #7 for Bomchu Salesman - Fixes #12 for Medigoron * Check Tracker - Fixes #8 for Song from Saria * Check Tracker - Fixes #9 for Adult Shooting Gallery * Check Tracker - Fixes #10 for Composer Grave * Check Tracker - Fixes #14 for Song from Ocarina of Time * Check Tracker - Fixes #16 for Shooting the Sun * Check Tracker - Fixes #19 for Darunia's Joy * Save Editor - Adds missing label for Treasure Chest Game * Check Tracker - Fixes Great Faries checks * Check Tracker - Fixes Sheik at Temple * Check Tracker - Fixes Great Fairy auto-scroll to wrong location * Check Tracker - Updates blue warp checks - Fixes Bongo Bongo and Twinrova checks * Check Tracker - Fixes Dampe's Gravedigging Tour * Check Tracker - Fixes Prescription to King Zora * Check Tracker - Fixes Bazaar showing under wrong area on tracker between adult/child * Check Tracker - Fixes scroll for Hyrule Market and Bazaar * Check Tracker - Fixes giving Adult Trade Items shown on tracker: Broken Sword, Saw, Cojiro, Eyeball Froge, and Eyedrops * Cleans up item_location * Check Tracker - Item List - Fixes item list not updating when changing seeds/options - Separates item exclusion list from item check list - Clean up comments * Check Tracker - Adds Skip functionality to buttons * Check Tracker - Refactors adult trade items to RandomizerInf * Check Tracker - Fixes an issue where any time an item is removed the tracker would cause an application crash * Check Tracker - Item names are now dependent on file language * Check Tracker - Fixes Gerudo Card check not showing in Fast setting * Reorders headers to (hopefully) avoid CI build conflicts on linux/consoles * Explicitly defines vector header in randomizer.h to fix compile errors * Complete Refactor of Check Tracker ImGui * Adds missing check tracker files to CMakeLists * Reverts the Item_location whitespace cleanup from ad10807c * Check Tracker - Loading Fixes - Fixes a bug where loading a save file a second time would add all the checks again - Fixes a bug where the check tracker would not render at all until in a save file * Check Tracker - Fixes a bug where checks would sometimes fail to load * Check Tracker - Fixes duplicated checks when using Only on Pause or Only on Combo * Check Tracker - Works around issue where single characters don't show in EnhancementCombobox, and fixes a label for combo buttons held option * Check Tracker - Applies all Check Tracker changes to Item Location * Check Tracker - Updated Check List - Adds Link's pocket, either in KF or HM depending on starting age - Supports Scrubs and Merchants - Uses enums instead of magic numbers - Updates DC Scrub Short Names for MQ * Check Tracker - Adds a performance mode option * Check Tracker - List Fixes (requires new rando generation) - Fixes Frogs Rupees always visible - Fixes Kokiri Sword Chest not showing - Fixes Weird Egg not showing * Check Tracker - MQ List basic support * Check Tracker - MQ/Vanilla anti-spoilers * Check Tracker - Collecting a compass now spoils the area * Check Tracker - Basic Vanilla Support and fixes - Vanilla items show in check tracker, even if many won't auto check - Fixes an issue with Gerudo Fortress Keys - Refactors IsVisibleInCheckTracker to randomizer_check_tracjer * Check Tracker - Fixes merge conflict from 08a487f35e1d760ab9e69b932edbe4da6bcd9edb * Check Tracker - Fixes tracker loading as Floating when default value is set to Windowed * Randomizer Location Exclusion List - Adds Scrubs, Merchants, Shops. Adult Trade items, MQ Dungeons, and Bean Salesman - Fixes Kokiri Sword Chest, Weird Egg, and Frog Song Rupees from misbehaving - Updates Gerudo Fortress logic to be dependent on Open/Fast/Normal Fortress - Removes Invalid Check - Adds RO Enum for MQ settings - Updates magic values to RO enum * Location Exclusion List - Scrubs that are always randomized now always show on the list * For now, removes some extra code only needed for a Check Tracker. * Randomizer Location Exclusion List - Fixes Eyeball Frog from showing up when Adult Trade Items was off * Location Tracker - Updates Eyedrops to use RandomizerInf instead of Chest * Check Tracker - Fixes a bug where Link's Pocket item wasn't acting as checked for area item count * Check Tracker - Fixes a bug where Locations would incorrectly say Vanilla due to the first check in the area being a non-MQ check * Check Tracker - Fixes a crash when Check Tracker is docked but not visible * Check Tracker - Fixes areas being spoiled when loading different save files * Check Tracker - Only reset variables if they are initialized * Check Tracker - Cleans up old comments, unused variables, methods, and macros, adds language TODOs, * Check Tracker - Readds rainbow UI elements after Cosmetics Editor refactor * Check Tracker - Removal of flag lookup that was refactored, no longer needed header, and some trivial whitespace fixes. * Check Tracker - Refactors Index to Bitmask code to a macro * Check Tracker - Changes ordering from alphabetical to RandomizerCheck ordering * Check Tracker - Wraps everything in a namespace to avoid global variable usage * Check Tracker - Explicitly defines for-loop scope * Check Tracker - refactors dungeon lookup from static array to function * Fixes a bug when using EnhancementColor with alpha * Check Tracker - Refactors all colour to use direct conversions * Check Tracker - refactors settings loading and check visibility for readability * Check Tracker - Fixes a bug where the wrong label showed on the Check Tracker BG Color * UIWidgets - Adds Alpha bar to EnhancementColor when using alpha parameter
2022-12-10 22:39:23 -05:00
}
Check Tracker Update (#2668) * Initial commit. What works so far: Data file loads, saves, deletes, and is created properly. - Need to run `HasItemBeenCollected` when creating in case of mid-seed regen. Organized checks into maps set by area. Areas show in tracker. - Checks pulled from checkObjectsByArea are not currently listed. - Areas are being assumed completed and hidden at the start. * Checks now populate. Still not counting area totals properly. * Don't track RC_LINKS_POCKET in the data file, and instead manually add it in every time a save is load. rcObjects doesn't contain Link's Pocket location (duh). * Moved ItemReceive hook to randomizer_check_tracker.cpp. Skipped items are properly sorted and formatted. Saved items contribute to an area's gotten/skipped checks on load. Changed skipped items default main color to gray. General code cleanup. * Skipped checks now contribute to area totals for area completion logic. * Mid-menu rework transfer. * Started check lookup on item receive. Tried to enable scum checking on save. * Fixed scum check on save. * More code cleanup, which revealed some issues with loading and saving. Loading now works 100%, but entries in checkTrackerData are disappearing in code somewhere, causing issues with later checks. Scummed color now displays properly. Collected but unsaved displays properly. Unchecked, Skipped, Seen and Scummed checks all have arrows for skipping/unskipping. Counts a little messed up, probably double adding skips. * Fixed item counts being off across resets. Restarts were fine. * Beginning of rework for individual check updates. Adds `Actor lastCheck` to PlayState to allow assigning of last actor to give an item. This allows precise tracking of GS, freestanding PoH, etc. Works for chests too. Currently does not work for shops, unknown for normal NPC gives. Doesn't track last gives for non-checks, like drops from grass, pots, crates, etc. * Actor-based checks fully fleshed out, but can't help with sale-based checks. Implemented `pendingSaleCheck` to back out of an RC check cycle if `gSaveContext->pendingSale` is not NONE when `OnItemReceive` is called, processed through `OnSaleEnd`. This should be the final change necessary to streamline the checks. * Temporary hook to message box close to tie in trackers for non-gs/chest actors that aren't added to `GetCheckFromActor`. This triggers a 2-frame countdown to check with `HasItemBeenCollected` since half of the methods in there aren't updated until after a text box closes. Added scene tracking to get last scene so that checks in scenes that span several overworld areas could be tied to their areas properly. Modified tracker data creation to apply Link's Pocket and Song from Impa conditionally based on randomizer settings instead of just being assumed to be done. May need modification for checking click and drag spoiler loading. Removed the scene equivalence check from CheckChecks so that an entire area is checked each time to avoid issues with, e.g., leaving a shop before a pending sale finishes. * Changed check data creation to use RSKs from gRandomizer to account for settings loaded from drag and drop spoilers. * Beginning of tracker code organization. Changed check color defaults. * Reverted moving tracker colors to header. Some individual check fixes. * Missed something from previous merge? * Removed last remnant of removed performance mode. * Better handle checking when skullsanity is off. * Song checks sceneIDs don't match the scenes they're actually in for some reason. Removed that check. * SaleEnd checks don't need the GetItemEntry parameter. Also set a flag that should prevent the check tracker from running during vanilla saves should that not be resolved by the time it's merged. * Attempting to have only the relevant checks added to the tracker data, as well as showing vanilla checks for non-rando saves. Not working yet (everything is displayed in vanilla). * Added vanilla check tracker population via `vanillaCheck` bool in `RandomizerCheckObject`. This is also added to `IsVisibleInImGui` to handle file loading and saving to eliminate checks that aren't part of vanilla or the rando seed. Implemented deleted tracker data file recreation. Added some extra item name text checks. Songs are still... tricky, so they stay blank. Utilize local copies of the randomizer check objects that are applicable for performance purposes. Fixed vanilla item-giving cutscene crashes when triggered mid-transition. * Apparently not all toolchains can handle macro instantiation without all parameters, like VS can. * Fixed scummed detail color not showing properly on tracker. * Fixed dungeon area totals and GS checks not functioning properly. * Major revamp of checking code. Doesn't rely on `GetCheckFromActor` at all anymore, but instead simply sets a flag to evaluate a number of checks in an area every frame until the check that was gotten is identified. With the new setup, it's much less hardware intensive, and at 60fps 6 checks per frame shows no noticeable effect on framerate. I can envision needing to add a collectedCount in order to account for times when two checks are gotten one right after the other. Changed area scroll to happen from `OnTransitionEnd`, and allow for scrolling in bazaar (was disabled previously because it would jump back and forth between Kak and Market while you were in one). Also setup area check order updating by area instead of all at the same time. * Fixed shooting gallery not reporting proper area. Prevent checks from actually happening if area is RCAREA_INVALID, now that all areas are reporting something if they have checks. Fixed `GetCheckArea()` not updating checks for standard scenes. Lots of vanilla tracking updates, mainly manual checks for gems, medallions and songs, since the often don't have proper scenes in the data. Prevent vanilla from triggering check loops if junk items are collected. Fixed sorting based on saved vs collected. Prevent item name display for vanilla runs. Change coloring of checks so the check name reflects status in vanilla runs. * Fixed "Recheck Area" button erroneously adding to an area's check totals? * Fix DMC vanilla checks. * Fix check tracker data recreation on data file loss. Removed redundant file exists check from SaveTrackerDataHook, as it doesn't matter if it exists or not at that point. Limited check loops to 3 to avoid infinite check loops on non-check/junk item pickup. Added more checks to disable tracker operations if a save is not running. Changed check ordering to put boss reward and heart container checks at the end of whatever RCSHOW group they belong to. * Fixed IsRunning calculation. Further improving vanilla checking. Starting framework for checking medallions, stones, and songs on data file recreation. Fixed medallion check collection. Added GIFT_FROM_SAGES to check list for vanilla file for tracking light medallion. Added check loop limitation to prevent infinite checking after picking up junk item from the ground. * Finished vanilla file recreation and recheck (songs and dungeon rewards all check properly now). This includes deku shield with KF shop item 3. Finished Gift from Raoru light medallion tracking for vanilla. Commented all CheckByScene functionality for now. * Fixed new save data file creation. Disabled entrance area calculation for now, as it only tracks the previous entrance for some reason. Fixed area detection for ToT checks. * GetCheckArea() now utilizes EntranceData almost exclusively, via either `gSaveContext.entranceIndex` or the entrance tracker's `currentGrottoId` in the case of grottos. This also means that EVERYTHING CAN AUTOSCROLL NOW. Entrance shuffles are now much easier to track. Autoscroll is now also triggered on save, just in case someone isn't autosaving and has a lot of checks that get converted to saved. * Fixed missing GS check in LW. * Added area scroll on toggling Show Hidden Items. May configure differently later. Fixed area detection for entrances in Gerudo Fortress/Valley and Collossus. Haunted wasteland doesn't autoscroll due to a bug in `OnTransitionEnd` hook, but checks still evaluate properly there. Rely on scene-based area detection if scene is a main overworld or dungeon scene. * Fixed grotto detection when shuffle is off. * Small code cleanup. Fixed Colossus hand chest checks. * Missing lus bump from merge conflict resolution * Fixed Colossus Grotto making `GetCheckArea` return Wasteland. * Improved OnItemReceive processing for non-token GS checks, since they can sometimes take long enough for the checking process to time out before the item is registered as received. * First attempt at thread safety for tracker data file writing. Seems to work, but might need more testing. * Fixed Recheck Area not unskipping items that register as saved. Improved delayed saving with autosaving, as the autosave triggered quite often before the tracker data save, making things not properly register as saved. * merge cleanup * Converted check tracker data to the sectional saves, adding `CheckTrackerData` to `SaveContext`. Implemented section ID returning and fullSave boolean passing to section functions from my PR temporarily for it to work properly. Moved `RandomizerCheckTrackerData` enum to `randomizerTypes.h` to accommodate that. Changed `Randomizer_SaveInit` to a `SaveManager::InitFunc` to allow for other randomizer-dependent sections to be initialized after that. Required a little refactoring to maintain intro cutscene skip when starting a randomizer file. * Revert section index return and randomizer init changes. Will need to wait on yet more changes to main. * Fixed check tracker initialization (shouldn't be tied to window initialization), restored saving/loading functionality. * Removed `CheckTracker::Init` and put SaveManager calls in `CheckTrackerWindow::InitElement`. Also a bit of cleanup from transition back to save file use. * Fixed tracker displaying check categories while file not loaded. * Fix Darunia's Joy check not marking in vanilla. * Fix autosave not triggering change from collected to saved in tracker data. * Changed default colors for scummed and collected display. * Merge upgrade code cleanup. * Add `OnTransitionEnd` calls to sandstorm transitions both to and from Wasteland. Also improved `gSaveContext.lastScene` assignment for both transition types. Allowed a bit of cleanup in `GetCheckArea`. * Added `StateButton`, a button like `ArrowButton` but that allows text instead of arrow icons. Apparently the changes from ArrowButton to StateButton happened in a previous commit... * Changed section name to `trackerDataCheck` to force SoH to load it after the randomizer section, as it required some randoSettings to be loaded first, and nothing else I tried to make the randomizer section load before it worked. This hacks a solution to checks not displaying on fast file load to a specific slot. F*** you, SaveManager, and f*** you too, JSON. * Forgot to change the section string for loading with the name change. * Fix check ordering for checks that trigger the autosave. * Adds option to remove right-side shop items (slots 1-4) from the tracker list. Enabled by default. * Fix default state of Hide Shop Right Checks checkbox. * Fixes grotto and great fairy scrolling and checks. Fixes array overflow from `checkTrackerData` which was creating the issue trying to load the base and randomizer sections first, among other things. That also fixed the massive file loads that were being exhibited in debug mode. * Fix shooting galleries being set as collected again when being played a second time after getting the checks. * Fix Bazaar autoscroll. * Add Saria's Song to `GetCheckFromActor` and removed some limitations from the messageCloseCheck function to make that check track properly. * Fix Song from Impa check. Implemented prevention for multiple "collections" of great fairies, just in case getting the health refill would trigger it with the previous setup. * Fix ice traps on GS tokens not triggering OnItemReceive. * Complete fix for ice trap collection from GS. Add autoscroll when clicking "Expand All". * Add `OnShopSlotChange` with cursorSlot and basePrice parameters. * Fixed include in en_ossan for shop slot hook. Added registration for `OnShopSlotChange` in the tracker, storing the price in a new `price` field in `CheckTrackerData`. Added "seen" functionality to shop checks. Displays the model item name upon first entering a shop, adding the price and switching to trickName (if it's an ice trap) upon navigating to the slot in buy mode, triggered by an invisible "identified" status that mirrors "seen" in every other way. Added tooltips to most options for check tracker color picking to describe what each status actually means. * `std::format` pls * So apparently std::format just decided to break with the latest merge from develop, but fmt::format exists and works? * Removed the last vestiges of `locationsSkipped`. Other general code and formatting cleanups. Moved `IsGameRunning` to `OTRGlobals` so the item tracker could also access it. Used preceding to "fix" item and bottle display in the item tracker on startup. * Some more code cleanup. Removed "Recheck Area" button and relevant code. Backported changes to Anchor branch applicable for single-player, including making a checkAreas vector and structuring the frame by frame checks around that. Also includes fix for Silver Gauntlets and Mirror Shield check collection crash associated with those changes. Fixed Kakariko Bazaar "seen" updates. Fixed tracker window not showing on initial load like it should. * Forgot 1 formatting fix. * Removed conditions for showing Song from Impa (isn't junk under certain conditions, so should show all the time). * Fix vanilla checks, add Zelda's Letter and Malon's Egg to manual check collection. Fix autoscroll while in child stealth section. * Fix crash in Happy Mask Shop in OnSlotChange (referenced non-existent shop id in a tracker-specific enum). * General code cleanup. * Missed one reversion. * One more. * Fix column alignment in `randomizer_check_objects`. * Fix file encoding on `randomizer_check_tracker`. Again. * Fix indentation for `actualItemtrackerItemMap`. Also removed unnecessary parts of the map. * Rename `HasEqItem` to `HasEquipment`. * Slightly better indentation for `actualItemTrackerItemMap`. * Add magic bean salesman to vanilla check tracking, and genericized deku shield to trigger KF shop item 3 wherever you get the shield. Renamed `vanillaCheck` to `vanillaHundoCheck` to (supposedly) clarify the meaning of the usage. * One more rename to `vanillaCompletion` to avoid possible confusion with 100% speedrun conditions. * give me a break XD Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * Changes suggested by briaguya (rename `RandomizerCheckShow` to `Status`, unused code, newline formatting) * Remove unused `itemNames` table. * Remove `IsGameRunning` in favor of `GameInteractor::IsSaveLoaded`. * Restore anti-spoiler functionality for dungeons with dungeon maps. * Review cleanup. * Fix prices not showing for Kak bazaar items. --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com>
2023-10-04 11:03:36 -04:00
}
void UpdateOrdering(RandomizerCheckArea rcArea) {
// Sort a single area
if(checksByArea.contains(rcArea)) {
std::sort(checksByArea.find(rcArea)->second.begin(), checksByArea.find(rcArea)->second.end(), CompareChecks);
Randomizer Auto Location tracker (#1942) * Initial Auto-Location Tracking * Updates styling for checked items in Check Tracker * Fixes crashing issues with Check Tracker rendering * Auto scroll Check Tracker windows to current area * Checks Tracker only shows checked locations once in game * Fixes issue where Check Tracker would auto-scroll to wrong location when entering a grotto * Fixes gerudo fortress checks showing in tracker when settings have them removed * InfTable Check Location Fixes: Lost Dog Richard, Rolling Gorons, HBA 1000, Thawed Zora * Fixes most Event Chk Inf Checks on Check Tracker, and Frogs * Check Tracker - Song from Malon now works * Check Tracker - Fixes Claim Check check not tracking - Fixes spoiler for Claim Check check when getting Biggoron's Sword - Fixes LACS being spoiled and not tracking * Check Tracker - Fixes #2 for Skull Mask and Mask of Truth checks * Check Tracker - Adds support for merchants - Fixes #7 for Bomchu Salesman - Fixes #12 for Medigoron * Check Tracker - Fixes #8 for Song from Saria * Check Tracker - Fixes #9 for Adult Shooting Gallery * Check Tracker - Fixes #10 for Composer Grave * Check Tracker - Fixes #14 for Song from Ocarina of Time * Check Tracker - Fixes #16 for Shooting the Sun * Check Tracker - Fixes #19 for Darunia's Joy * Save Editor - Adds missing label for Treasure Chest Game * Check Tracker - Fixes Great Faries checks * Check Tracker - Fixes Sheik at Temple * Check Tracker - Fixes Great Fairy auto-scroll to wrong location * Check Tracker - Updates blue warp checks - Fixes Bongo Bongo and Twinrova checks * Check Tracker - Fixes Dampe's Gravedigging Tour * Check Tracker - Fixes Prescription to King Zora * Check Tracker - Fixes Bazaar showing under wrong area on tracker between adult/child * Check Tracker - Fixes scroll for Hyrule Market and Bazaar * Check Tracker - Fixes giving Adult Trade Items shown on tracker: Broken Sword, Saw, Cojiro, Eyeball Froge, and Eyedrops * Cleans up item_location * Check Tracker - Item List - Fixes item list not updating when changing seeds/options - Separates item exclusion list from item check list - Clean up comments * Check Tracker - Adds Skip functionality to buttons * Check Tracker - Refactors adult trade items to RandomizerInf * Check Tracker - Fixes an issue where any time an item is removed the tracker would cause an application crash * Check Tracker - Item names are now dependent on file language * Check Tracker - Fixes Gerudo Card check not showing in Fast setting * Reorders headers to (hopefully) avoid CI build conflicts on linux/consoles * Explicitly defines vector header in randomizer.h to fix compile errors * Complete Refactor of Check Tracker ImGui * Adds missing check tracker files to CMakeLists * Reverts the Item_location whitespace cleanup from ad10807c * Check Tracker - Loading Fixes - Fixes a bug where loading a save file a second time would add all the checks again - Fixes a bug where the check tracker would not render at all until in a save file * Check Tracker - Fixes a bug where checks would sometimes fail to load * Check Tracker - Fixes duplicated checks when using Only on Pause or Only on Combo * Check Tracker - Works around issue where single characters don't show in EnhancementCombobox, and fixes a label for combo buttons held option * Check Tracker - Applies all Check Tracker changes to Item Location * Check Tracker - Updated Check List - Adds Link's pocket, either in KF or HM depending on starting age - Supports Scrubs and Merchants - Uses enums instead of magic numbers - Updates DC Scrub Short Names for MQ * Check Tracker - Adds a performance mode option * Check Tracker - List Fixes (requires new rando generation) - Fixes Frogs Rupees always visible - Fixes Kokiri Sword Chest not showing - Fixes Weird Egg not showing * Check Tracker - MQ List basic support * Check Tracker - MQ/Vanilla anti-spoilers * Check Tracker - Collecting a compass now spoils the area * Check Tracker - Basic Vanilla Support and fixes - Vanilla items show in check tracker, even if many won't auto check - Fixes an issue with Gerudo Fortress Keys - Refactors IsVisibleInCheckTracker to randomizer_check_tracjer * Check Tracker - Fixes merge conflict from 08a487f35e1d760ab9e69b932edbe4da6bcd9edb * Check Tracker - Fixes tracker loading as Floating when default value is set to Windowed * Randomizer Location Exclusion List - Adds Scrubs, Merchants, Shops. Adult Trade items, MQ Dungeons, and Bean Salesman - Fixes Kokiri Sword Chest, Weird Egg, and Frog Song Rupees from misbehaving - Updates Gerudo Fortress logic to be dependent on Open/Fast/Normal Fortress - Removes Invalid Check - Adds RO Enum for MQ settings - Updates magic values to RO enum * Location Exclusion List - Scrubs that are always randomized now always show on the list * For now, removes some extra code only needed for a Check Tracker. * Randomizer Location Exclusion List - Fixes Eyeball Frog from showing up when Adult Trade Items was off * Location Tracker - Updates Eyedrops to use RandomizerInf instead of Chest * Check Tracker - Fixes a bug where Link's Pocket item wasn't acting as checked for area item count * Check Tracker - Fixes a bug where Locations would incorrectly say Vanilla due to the first check in the area being a non-MQ check * Check Tracker - Fixes a crash when Check Tracker is docked but not visible * Check Tracker - Fixes areas being spoiled when loading different save files * Check Tracker - Only reset variables if they are initialized * Check Tracker - Cleans up old comments, unused variables, methods, and macros, adds language TODOs, * Check Tracker - Readds rainbow UI elements after Cosmetics Editor refactor * Check Tracker - Removal of flag lookup that was refactored, no longer needed header, and some trivial whitespace fixes. * Check Tracker - Refactors Index to Bitmask code to a macro * Check Tracker - Changes ordering from alphabetical to RandomizerCheck ordering * Check Tracker - Wraps everything in a namespace to avoid global variable usage * Check Tracker - Explicitly defines for-loop scope * Check Tracker - refactors dungeon lookup from static array to function * Fixes a bug when using EnhancementColor with alpha * Check Tracker - Refactors all colour to use direct conversions * Check Tracker - refactors settings loading and check visibility for readability * Check Tracker - Fixes a bug where the wrong label showed on the Check Tracker BG Color * UIWidgets - Adds Alpha bar to EnhancementColor when using alpha parameter
2022-12-10 22:39:23 -05:00
}
}
Check Tracker Update (#2668) * Initial commit. What works so far: Data file loads, saves, deletes, and is created properly. - Need to run `HasItemBeenCollected` when creating in case of mid-seed regen. Organized checks into maps set by area. Areas show in tracker. - Checks pulled from checkObjectsByArea are not currently listed. - Areas are being assumed completed and hidden at the start. * Checks now populate. Still not counting area totals properly. * Don't track RC_LINKS_POCKET in the data file, and instead manually add it in every time a save is load. rcObjects doesn't contain Link's Pocket location (duh). * Moved ItemReceive hook to randomizer_check_tracker.cpp. Skipped items are properly sorted and formatted. Saved items contribute to an area's gotten/skipped checks on load. Changed skipped items default main color to gray. General code cleanup. * Skipped checks now contribute to area totals for area completion logic. * Mid-menu rework transfer. * Started check lookup on item receive. Tried to enable scum checking on save. * Fixed scum check on save. * More code cleanup, which revealed some issues with loading and saving. Loading now works 100%, but entries in checkTrackerData are disappearing in code somewhere, causing issues with later checks. Scummed color now displays properly. Collected but unsaved displays properly. Unchecked, Skipped, Seen and Scummed checks all have arrows for skipping/unskipping. Counts a little messed up, probably double adding skips. * Fixed item counts being off across resets. Restarts were fine. * Beginning of rework for individual check updates. Adds `Actor lastCheck` to PlayState to allow assigning of last actor to give an item. This allows precise tracking of GS, freestanding PoH, etc. Works for chests too. Currently does not work for shops, unknown for normal NPC gives. Doesn't track last gives for non-checks, like drops from grass, pots, crates, etc. * Actor-based checks fully fleshed out, but can't help with sale-based checks. Implemented `pendingSaleCheck` to back out of an RC check cycle if `gSaveContext->pendingSale` is not NONE when `OnItemReceive` is called, processed through `OnSaleEnd`. This should be the final change necessary to streamline the checks. * Temporary hook to message box close to tie in trackers for non-gs/chest actors that aren't added to `GetCheckFromActor`. This triggers a 2-frame countdown to check with `HasItemBeenCollected` since half of the methods in there aren't updated until after a text box closes. Added scene tracking to get last scene so that checks in scenes that span several overworld areas could be tied to their areas properly. Modified tracker data creation to apply Link's Pocket and Song from Impa conditionally based on randomizer settings instead of just being assumed to be done. May need modification for checking click and drag spoiler loading. Removed the scene equivalence check from CheckChecks so that an entire area is checked each time to avoid issues with, e.g., leaving a shop before a pending sale finishes. * Changed check data creation to use RSKs from gRandomizer to account for settings loaded from drag and drop spoilers. * Beginning of tracker code organization. Changed check color defaults. * Reverted moving tracker colors to header. Some individual check fixes. * Missed something from previous merge? * Removed last remnant of removed performance mode. * Better handle checking when skullsanity is off. * Song checks sceneIDs don't match the scenes they're actually in for some reason. Removed that check. * SaleEnd checks don't need the GetItemEntry parameter. Also set a flag that should prevent the check tracker from running during vanilla saves should that not be resolved by the time it's merged. * Attempting to have only the relevant checks added to the tracker data, as well as showing vanilla checks for non-rando saves. Not working yet (everything is displayed in vanilla). * Added vanilla check tracker population via `vanillaCheck` bool in `RandomizerCheckObject`. This is also added to `IsVisibleInImGui` to handle file loading and saving to eliminate checks that aren't part of vanilla or the rando seed. Implemented deleted tracker data file recreation. Added some extra item name text checks. Songs are still... tricky, so they stay blank. Utilize local copies of the randomizer check objects that are applicable for performance purposes. Fixed vanilla item-giving cutscene crashes when triggered mid-transition. * Apparently not all toolchains can handle macro instantiation without all parameters, like VS can. * Fixed scummed detail color not showing properly on tracker. * Fixed dungeon area totals and GS checks not functioning properly. * Major revamp of checking code. Doesn't rely on `GetCheckFromActor` at all anymore, but instead simply sets a flag to evaluate a number of checks in an area every frame until the check that was gotten is identified. With the new setup, it's much less hardware intensive, and at 60fps 6 checks per frame shows no noticeable effect on framerate. I can envision needing to add a collectedCount in order to account for times when two checks are gotten one right after the other. Changed area scroll to happen from `OnTransitionEnd`, and allow for scrolling in bazaar (was disabled previously because it would jump back and forth between Kak and Market while you were in one). Also setup area check order updating by area instead of all at the same time. * Fixed shooting gallery not reporting proper area. Prevent checks from actually happening if area is RCAREA_INVALID, now that all areas are reporting something if they have checks. Fixed `GetCheckArea()` not updating checks for standard scenes. Lots of vanilla tracking updates, mainly manual checks for gems, medallions and songs, since the often don't have proper scenes in the data. Prevent vanilla from triggering check loops if junk items are collected. Fixed sorting based on saved vs collected. Prevent item name display for vanilla runs. Change coloring of checks so the check name reflects status in vanilla runs. * Fixed "Recheck Area" button erroneously adding to an area's check totals? * Fix DMC vanilla checks. * Fix check tracker data recreation on data file loss. Removed redundant file exists check from SaveTrackerDataHook, as it doesn't matter if it exists or not at that point. Limited check loops to 3 to avoid infinite check loops on non-check/junk item pickup. Added more checks to disable tracker operations if a save is not running. Changed check ordering to put boss reward and heart container checks at the end of whatever RCSHOW group they belong to. * Fixed IsRunning calculation. Further improving vanilla checking. Starting framework for checking medallions, stones, and songs on data file recreation. Fixed medallion check collection. Added GIFT_FROM_SAGES to check list for vanilla file for tracking light medallion. Added check loop limitation to prevent infinite checking after picking up junk item from the ground. * Finished vanilla file recreation and recheck (songs and dungeon rewards all check properly now). This includes deku shield with KF shop item 3. Finished Gift from Raoru light medallion tracking for vanilla. Commented all CheckByScene functionality for now. * Fixed new save data file creation. Disabled entrance area calculation for now, as it only tracks the previous entrance for some reason. Fixed area detection for ToT checks. * GetCheckArea() now utilizes EntranceData almost exclusively, via either `gSaveContext.entranceIndex` or the entrance tracker's `currentGrottoId` in the case of grottos. This also means that EVERYTHING CAN AUTOSCROLL NOW. Entrance shuffles are now much easier to track. Autoscroll is now also triggered on save, just in case someone isn't autosaving and has a lot of checks that get converted to saved. * Fixed missing GS check in LW. * Added area scroll on toggling Show Hidden Items. May configure differently later. Fixed area detection for entrances in Gerudo Fortress/Valley and Collossus. Haunted wasteland doesn't autoscroll due to a bug in `OnTransitionEnd` hook, but checks still evaluate properly there. Rely on scene-based area detection if scene is a main overworld or dungeon scene. * Fixed grotto detection when shuffle is off. * Small code cleanup. Fixed Colossus hand chest checks. * Missing lus bump from merge conflict resolution * Fixed Colossus Grotto making `GetCheckArea` return Wasteland. * Improved OnItemReceive processing for non-token GS checks, since they can sometimes take long enough for the checking process to time out before the item is registered as received. * First attempt at thread safety for tracker data file writing. Seems to work, but might need more testing. * Fixed Recheck Area not unskipping items that register as saved. Improved delayed saving with autosaving, as the autosave triggered quite often before the tracker data save, making things not properly register as saved. * merge cleanup * Converted check tracker data to the sectional saves, adding `CheckTrackerData` to `SaveContext`. Implemented section ID returning and fullSave boolean passing to section functions from my PR temporarily for it to work properly. Moved `RandomizerCheckTrackerData` enum to `randomizerTypes.h` to accommodate that. Changed `Randomizer_SaveInit` to a `SaveManager::InitFunc` to allow for other randomizer-dependent sections to be initialized after that. Required a little refactoring to maintain intro cutscene skip when starting a randomizer file. * Revert section index return and randomizer init changes. Will need to wait on yet more changes to main. * Fixed check tracker initialization (shouldn't be tied to window initialization), restored saving/loading functionality. * Removed `CheckTracker::Init` and put SaveManager calls in `CheckTrackerWindow::InitElement`. Also a bit of cleanup from transition back to save file use. * Fixed tracker displaying check categories while file not loaded. * Fix Darunia's Joy check not marking in vanilla. * Fix autosave not triggering change from collected to saved in tracker data. * Changed default colors for scummed and collected display. * Merge upgrade code cleanup. * Add `OnTransitionEnd` calls to sandstorm transitions both to and from Wasteland. Also improved `gSaveContext.lastScene` assignment for both transition types. Allowed a bit of cleanup in `GetCheckArea`. * Added `StateButton`, a button like `ArrowButton` but that allows text instead of arrow icons. Apparently the changes from ArrowButton to StateButton happened in a previous commit... * Changed section name to `trackerDataCheck` to force SoH to load it after the randomizer section, as it required some randoSettings to be loaded first, and nothing else I tried to make the randomizer section load before it worked. This hacks a solution to checks not displaying on fast file load to a specific slot. F*** you, SaveManager, and f*** you too, JSON. * Forgot to change the section string for loading with the name change. * Fix check ordering for checks that trigger the autosave. * Adds option to remove right-side shop items (slots 1-4) from the tracker list. Enabled by default. * Fix default state of Hide Shop Right Checks checkbox. * Fixes grotto and great fairy scrolling and checks. Fixes array overflow from `checkTrackerData` which was creating the issue trying to load the base and randomizer sections first, among other things. That also fixed the massive file loads that were being exhibited in debug mode. * Fix shooting galleries being set as collected again when being played a second time after getting the checks. * Fix Bazaar autoscroll. * Add Saria's Song to `GetCheckFromActor` and removed some limitations from the messageCloseCheck function to make that check track properly. * Fix Song from Impa check. Implemented prevention for multiple "collections" of great fairies, just in case getting the health refill would trigger it with the previous setup. * Fix ice traps on GS tokens not triggering OnItemReceive. * Complete fix for ice trap collection from GS. Add autoscroll when clicking "Expand All". * Add `OnShopSlotChange` with cursorSlot and basePrice parameters. * Fixed include in en_ossan for shop slot hook. Added registration for `OnShopSlotChange` in the tracker, storing the price in a new `price` field in `CheckTrackerData`. Added "seen" functionality to shop checks. Displays the model item name upon first entering a shop, adding the price and switching to trickName (if it's an ice trap) upon navigating to the slot in buy mode, triggered by an invisible "identified" status that mirrors "seen" in every other way. Added tooltips to most options for check tracker color picking to describe what each status actually means. * `std::format` pls * So apparently std::format just decided to break with the latest merge from develop, but fmt::format exists and works? * Removed the last vestiges of `locationsSkipped`. Other general code and formatting cleanups. Moved `IsGameRunning` to `OTRGlobals` so the item tracker could also access it. Used preceding to "fix" item and bottle display in the item tracker on startup. * Some more code cleanup. Removed "Recheck Area" button and relevant code. Backported changes to Anchor branch applicable for single-player, including making a checkAreas vector and structuring the frame by frame checks around that. Also includes fix for Silver Gauntlets and Mirror Shield check collection crash associated with those changes. Fixed Kakariko Bazaar "seen" updates. Fixed tracker window not showing on initial load like it should. * Forgot 1 formatting fix. * Removed conditions for showing Song from Impa (isn't junk under certain conditions, so should show all the time). * Fix vanilla checks, add Zelda's Letter and Malon's Egg to manual check collection. Fix autoscroll while in child stealth section. * Fix crash in Happy Mask Shop in OnSlotChange (referenced non-existent shop id in a tracker-specific enum). * General code cleanup. * Missed one reversion. * One more. * Fix column alignment in `randomizer_check_objects`. * Fix file encoding on `randomizer_check_tracker`. Again. * Fix indentation for `actualItemtrackerItemMap`. Also removed unnecessary parts of the map. * Rename `HasEqItem` to `HasEquipment`. * Slightly better indentation for `actualItemTrackerItemMap`. * Add magic bean salesman to vanilla check tracking, and genericized deku shield to trigger KF shop item 3 wherever you get the shield. Renamed `vanillaCheck` to `vanillaHundoCheck` to (supposedly) clarify the meaning of the usage. * One more rename to `vanillaCompletion` to avoid possible confusion with 100% speedrun conditions. * give me a break XD Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * Changes suggested by briaguya (rename `RandomizerCheckShow` to `Status`, unused code, newline formatting) * Remove unused `itemNames` table. * Remove `IsGameRunning` in favor of `GameInteractor::IsSaveLoaded`. * Restore anti-spoiler functionality for dungeons with dungeon maps. * Review cleanup. * Fix prices not showing for Kak bazaar items. --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com>
2023-10-04 11:03:36 -04:00
bool IsEoDCheck(RandomizerCheckType type) {
return type == RCTYPE_BOSS_HEART_OR_OTHER_REWARD || type == RCTYPE_DUNGEON_REWARD;
}
bool CompareChecks(RandomizerCheckObject i, RandomizerCheckObject j) {
RandomizerCheckTrackerData iShow = gSaveContext.checkTrackerData[i.rc];
RandomizerCheckTrackerData jShow = gSaveContext.checkTrackerData[j.rc];
bool iCollected = iShow.status == RCSHOW_COLLECTED || iShow.status == RCSHOW_SAVED;
bool iSaved = iShow.status == RCSHOW_SAVED;
bool jCollected = jShow.status == RCSHOW_COLLECTED || jShow.status == RCSHOW_SAVED;
bool jSaved = jShow.status == RCSHOW_SAVED;
if (!iCollected && jCollected) {
Randomizer Auto Location tracker (#1942) * Initial Auto-Location Tracking * Updates styling for checked items in Check Tracker * Fixes crashing issues with Check Tracker rendering * Auto scroll Check Tracker windows to current area * Checks Tracker only shows checked locations once in game * Fixes issue where Check Tracker would auto-scroll to wrong location when entering a grotto * Fixes gerudo fortress checks showing in tracker when settings have them removed * InfTable Check Location Fixes: Lost Dog Richard, Rolling Gorons, HBA 1000, Thawed Zora * Fixes most Event Chk Inf Checks on Check Tracker, and Frogs * Check Tracker - Song from Malon now works * Check Tracker - Fixes Claim Check check not tracking - Fixes spoiler for Claim Check check when getting Biggoron's Sword - Fixes LACS being spoiled and not tracking * Check Tracker - Fixes #2 for Skull Mask and Mask of Truth checks * Check Tracker - Adds support for merchants - Fixes #7 for Bomchu Salesman - Fixes #12 for Medigoron * Check Tracker - Fixes #8 for Song from Saria * Check Tracker - Fixes #9 for Adult Shooting Gallery * Check Tracker - Fixes #10 for Composer Grave * Check Tracker - Fixes #14 for Song from Ocarina of Time * Check Tracker - Fixes #16 for Shooting the Sun * Check Tracker - Fixes #19 for Darunia's Joy * Save Editor - Adds missing label for Treasure Chest Game * Check Tracker - Fixes Great Faries checks * Check Tracker - Fixes Sheik at Temple * Check Tracker - Fixes Great Fairy auto-scroll to wrong location * Check Tracker - Updates blue warp checks - Fixes Bongo Bongo and Twinrova checks * Check Tracker - Fixes Dampe's Gravedigging Tour * Check Tracker - Fixes Prescription to King Zora * Check Tracker - Fixes Bazaar showing under wrong area on tracker between adult/child * Check Tracker - Fixes scroll for Hyrule Market and Bazaar * Check Tracker - Fixes giving Adult Trade Items shown on tracker: Broken Sword, Saw, Cojiro, Eyeball Froge, and Eyedrops * Cleans up item_location * Check Tracker - Item List - Fixes item list not updating when changing seeds/options - Separates item exclusion list from item check list - Clean up comments * Check Tracker - Adds Skip functionality to buttons * Check Tracker - Refactors adult trade items to RandomizerInf * Check Tracker - Fixes an issue where any time an item is removed the tracker would cause an application crash * Check Tracker - Item names are now dependent on file language * Check Tracker - Fixes Gerudo Card check not showing in Fast setting * Reorders headers to (hopefully) avoid CI build conflicts on linux/consoles * Explicitly defines vector header in randomizer.h to fix compile errors * Complete Refactor of Check Tracker ImGui * Adds missing check tracker files to CMakeLists * Reverts the Item_location whitespace cleanup from ad10807c * Check Tracker - Loading Fixes - Fixes a bug where loading a save file a second time would add all the checks again - Fixes a bug where the check tracker would not render at all until in a save file * Check Tracker - Fixes a bug where checks would sometimes fail to load * Check Tracker - Fixes duplicated checks when using Only on Pause or Only on Combo * Check Tracker - Works around issue where single characters don't show in EnhancementCombobox, and fixes a label for combo buttons held option * Check Tracker - Applies all Check Tracker changes to Item Location * Check Tracker - Updated Check List - Adds Link's pocket, either in KF or HM depending on starting age - Supports Scrubs and Merchants - Uses enums instead of magic numbers - Updates DC Scrub Short Names for MQ * Check Tracker - Adds a performance mode option * Check Tracker - List Fixes (requires new rando generation) - Fixes Frogs Rupees always visible - Fixes Kokiri Sword Chest not showing - Fixes Weird Egg not showing * Check Tracker - MQ List basic support * Check Tracker - MQ/Vanilla anti-spoilers * Check Tracker - Collecting a compass now spoils the area * Check Tracker - Basic Vanilla Support and fixes - Vanilla items show in check tracker, even if many won't auto check - Fixes an issue with Gerudo Fortress Keys - Refactors IsVisibleInCheckTracker to randomizer_check_tracjer * Check Tracker - Fixes merge conflict from 08a487f35e1d760ab9e69b932edbe4da6bcd9edb * Check Tracker - Fixes tracker loading as Floating when default value is set to Windowed * Randomizer Location Exclusion List - Adds Scrubs, Merchants, Shops. Adult Trade items, MQ Dungeons, and Bean Salesman - Fixes Kokiri Sword Chest, Weird Egg, and Frog Song Rupees from misbehaving - Updates Gerudo Fortress logic to be dependent on Open/Fast/Normal Fortress - Removes Invalid Check - Adds RO Enum for MQ settings - Updates magic values to RO enum * Location Exclusion List - Scrubs that are always randomized now always show on the list * For now, removes some extra code only needed for a Check Tracker. * Randomizer Location Exclusion List - Fixes Eyeball Frog from showing up when Adult Trade Items was off * Location Tracker - Updates Eyedrops to use RandomizerInf instead of Chest * Check Tracker - Fixes a bug where Link's Pocket item wasn't acting as checked for area item count * Check Tracker - Fixes a bug where Locations would incorrectly say Vanilla due to the first check in the area being a non-MQ check * Check Tracker - Fixes a crash when Check Tracker is docked but not visible * Check Tracker - Fixes areas being spoiled when loading different save files * Check Tracker - Only reset variables if they are initialized * Check Tracker - Cleans up old comments, unused variables, methods, and macros, adds language TODOs, * Check Tracker - Readds rainbow UI elements after Cosmetics Editor refactor * Check Tracker - Removal of flag lookup that was refactored, no longer needed header, and some trivial whitespace fixes. * Check Tracker - Refactors Index to Bitmask code to a macro * Check Tracker - Changes ordering from alphabetical to RandomizerCheck ordering * Check Tracker - Wraps everything in a namespace to avoid global variable usage * Check Tracker - Explicitly defines for-loop scope * Check Tracker - refactors dungeon lookup from static array to function * Fixes a bug when using EnhancementColor with alpha * Check Tracker - Refactors all colour to use direct conversions * Check Tracker - refactors settings loading and check visibility for readability * Check Tracker - Fixes a bug where the wrong label showed on the Check Tracker BG Color * UIWidgets - Adds Alpha bar to EnhancementColor when using alpha parameter
2022-12-10 22:39:23 -05:00
return true;
} else if (iCollected && !jCollected) {
Randomizer Auto Location tracker (#1942) * Initial Auto-Location Tracking * Updates styling for checked items in Check Tracker * Fixes crashing issues with Check Tracker rendering * Auto scroll Check Tracker windows to current area * Checks Tracker only shows checked locations once in game * Fixes issue where Check Tracker would auto-scroll to wrong location when entering a grotto * Fixes gerudo fortress checks showing in tracker when settings have them removed * InfTable Check Location Fixes: Lost Dog Richard, Rolling Gorons, HBA 1000, Thawed Zora * Fixes most Event Chk Inf Checks on Check Tracker, and Frogs * Check Tracker - Song from Malon now works * Check Tracker - Fixes Claim Check check not tracking - Fixes spoiler for Claim Check check when getting Biggoron's Sword - Fixes LACS being spoiled and not tracking * Check Tracker - Fixes #2 for Skull Mask and Mask of Truth checks * Check Tracker - Adds support for merchants - Fixes #7 for Bomchu Salesman - Fixes #12 for Medigoron * Check Tracker - Fixes #8 for Song from Saria * Check Tracker - Fixes #9 for Adult Shooting Gallery * Check Tracker - Fixes #10 for Composer Grave * Check Tracker - Fixes #14 for Song from Ocarina of Time * Check Tracker - Fixes #16 for Shooting the Sun * Check Tracker - Fixes #19 for Darunia's Joy * Save Editor - Adds missing label for Treasure Chest Game * Check Tracker - Fixes Great Faries checks * Check Tracker - Fixes Sheik at Temple * Check Tracker - Fixes Great Fairy auto-scroll to wrong location * Check Tracker - Updates blue warp checks - Fixes Bongo Bongo and Twinrova checks * Check Tracker - Fixes Dampe's Gravedigging Tour * Check Tracker - Fixes Prescription to King Zora * Check Tracker - Fixes Bazaar showing under wrong area on tracker between adult/child * Check Tracker - Fixes scroll for Hyrule Market and Bazaar * Check Tracker - Fixes giving Adult Trade Items shown on tracker: Broken Sword, Saw, Cojiro, Eyeball Froge, and Eyedrops * Cleans up item_location * Check Tracker - Item List - Fixes item list not updating when changing seeds/options - Separates item exclusion list from item check list - Clean up comments * Check Tracker - Adds Skip functionality to buttons * Check Tracker - Refactors adult trade items to RandomizerInf * Check Tracker - Fixes an issue where any time an item is removed the tracker would cause an application crash * Check Tracker - Item names are now dependent on file language * Check Tracker - Fixes Gerudo Card check not showing in Fast setting * Reorders headers to (hopefully) avoid CI build conflicts on linux/consoles * Explicitly defines vector header in randomizer.h to fix compile errors * Complete Refactor of Check Tracker ImGui * Adds missing check tracker files to CMakeLists * Reverts the Item_location whitespace cleanup from ad10807c * Check Tracker - Loading Fixes - Fixes a bug where loading a save file a second time would add all the checks again - Fixes a bug where the check tracker would not render at all until in a save file * Check Tracker - Fixes a bug where checks would sometimes fail to load * Check Tracker - Fixes duplicated checks when using Only on Pause or Only on Combo * Check Tracker - Works around issue where single characters don't show in EnhancementCombobox, and fixes a label for combo buttons held option * Check Tracker - Applies all Check Tracker changes to Item Location * Check Tracker - Updated Check List - Adds Link's pocket, either in KF or HM depending on starting age - Supports Scrubs and Merchants - Uses enums instead of magic numbers - Updates DC Scrub Short Names for MQ * Check Tracker - Adds a performance mode option * Check Tracker - List Fixes (requires new rando generation) - Fixes Frogs Rupees always visible - Fixes Kokiri Sword Chest not showing - Fixes Weird Egg not showing * Check Tracker - MQ List basic support * Check Tracker - MQ/Vanilla anti-spoilers * Check Tracker - Collecting a compass now spoils the area * Check Tracker - Basic Vanilla Support and fixes - Vanilla items show in check tracker, even if many won't auto check - Fixes an issue with Gerudo Fortress Keys - Refactors IsVisibleInCheckTracker to randomizer_check_tracjer * Check Tracker - Fixes merge conflict from 08a487f35e1d760ab9e69b932edbe4da6bcd9edb * Check Tracker - Fixes tracker loading as Floating when default value is set to Windowed * Randomizer Location Exclusion List - Adds Scrubs, Merchants, Shops. Adult Trade items, MQ Dungeons, and Bean Salesman - Fixes Kokiri Sword Chest, Weird Egg, and Frog Song Rupees from misbehaving - Updates Gerudo Fortress logic to be dependent on Open/Fast/Normal Fortress - Removes Invalid Check - Adds RO Enum for MQ settings - Updates magic values to RO enum * Location Exclusion List - Scrubs that are always randomized now always show on the list * For now, removes some extra code only needed for a Check Tracker. * Randomizer Location Exclusion List - Fixes Eyeball Frog from showing up when Adult Trade Items was off * Location Tracker - Updates Eyedrops to use RandomizerInf instead of Chest * Check Tracker - Fixes a bug where Link's Pocket item wasn't acting as checked for area item count * Check Tracker - Fixes a bug where Locations would incorrectly say Vanilla due to the first check in the area being a non-MQ check * Check Tracker - Fixes a crash when Check Tracker is docked but not visible * Check Tracker - Fixes areas being spoiled when loading different save files * Check Tracker - Only reset variables if they are initialized * Check Tracker - Cleans up old comments, unused variables, methods, and macros, adds language TODOs, * Check Tracker - Readds rainbow UI elements after Cosmetics Editor refactor * Check Tracker - Removal of flag lookup that was refactored, no longer needed header, and some trivial whitespace fixes. * Check Tracker - Refactors Index to Bitmask code to a macro * Check Tracker - Changes ordering from alphabetical to RandomizerCheck ordering * Check Tracker - Wraps everything in a namespace to avoid global variable usage * Check Tracker - Explicitly defines for-loop scope * Check Tracker - refactors dungeon lookup from static array to function * Fixes a bug when using EnhancementColor with alpha * Check Tracker - Refactors all colour to use direct conversions * Check Tracker - refactors settings loading and check visibility for readability * Check Tracker - Fixes a bug where the wrong label showed on the Check Tracker BG Color * UIWidgets - Adds Alpha bar to EnhancementColor when using alpha parameter
2022-12-10 22:39:23 -05:00
return false;
}
Randomizer Auto Location tracker (#1942) * Initial Auto-Location Tracking * Updates styling for checked items in Check Tracker * Fixes crashing issues with Check Tracker rendering * Auto scroll Check Tracker windows to current area * Checks Tracker only shows checked locations once in game * Fixes issue where Check Tracker would auto-scroll to wrong location when entering a grotto * Fixes gerudo fortress checks showing in tracker when settings have them removed * InfTable Check Location Fixes: Lost Dog Richard, Rolling Gorons, HBA 1000, Thawed Zora * Fixes most Event Chk Inf Checks on Check Tracker, and Frogs * Check Tracker - Song from Malon now works * Check Tracker - Fixes Claim Check check not tracking - Fixes spoiler for Claim Check check when getting Biggoron's Sword - Fixes LACS being spoiled and not tracking * Check Tracker - Fixes #2 for Skull Mask and Mask of Truth checks * Check Tracker - Adds support for merchants - Fixes #7 for Bomchu Salesman - Fixes #12 for Medigoron * Check Tracker - Fixes #8 for Song from Saria * Check Tracker - Fixes #9 for Adult Shooting Gallery * Check Tracker - Fixes #10 for Composer Grave * Check Tracker - Fixes #14 for Song from Ocarina of Time * Check Tracker - Fixes #16 for Shooting the Sun * Check Tracker - Fixes #19 for Darunia's Joy * Save Editor - Adds missing label for Treasure Chest Game * Check Tracker - Fixes Great Faries checks * Check Tracker - Fixes Sheik at Temple * Check Tracker - Fixes Great Fairy auto-scroll to wrong location * Check Tracker - Updates blue warp checks - Fixes Bongo Bongo and Twinrova checks * Check Tracker - Fixes Dampe's Gravedigging Tour * Check Tracker - Fixes Prescription to King Zora * Check Tracker - Fixes Bazaar showing under wrong area on tracker between adult/child * Check Tracker - Fixes scroll for Hyrule Market and Bazaar * Check Tracker - Fixes giving Adult Trade Items shown on tracker: Broken Sword, Saw, Cojiro, Eyeball Froge, and Eyedrops * Cleans up item_location * Check Tracker - Item List - Fixes item list not updating when changing seeds/options - Separates item exclusion list from item check list - Clean up comments * Check Tracker - Adds Skip functionality to buttons * Check Tracker - Refactors adult trade items to RandomizerInf * Check Tracker - Fixes an issue where any time an item is removed the tracker would cause an application crash * Check Tracker - Item names are now dependent on file language * Check Tracker - Fixes Gerudo Card check not showing in Fast setting * Reorders headers to (hopefully) avoid CI build conflicts on linux/consoles * Explicitly defines vector header in randomizer.h to fix compile errors * Complete Refactor of Check Tracker ImGui * Adds missing check tracker files to CMakeLists * Reverts the Item_location whitespace cleanup from ad10807c * Check Tracker - Loading Fixes - Fixes a bug where loading a save file a second time would add all the checks again - Fixes a bug where the check tracker would not render at all until in a save file * Check Tracker - Fixes a bug where checks would sometimes fail to load * Check Tracker - Fixes duplicated checks when using Only on Pause or Only on Combo * Check Tracker - Works around issue where single characters don't show in EnhancementCombobox, and fixes a label for combo buttons held option * Check Tracker - Applies all Check Tracker changes to Item Location * Check Tracker - Updated Check List - Adds Link's pocket, either in KF or HM depending on starting age - Supports Scrubs and Merchants - Uses enums instead of magic numbers - Updates DC Scrub Short Names for MQ * Check Tracker - Adds a performance mode option * Check Tracker - List Fixes (requires new rando generation) - Fixes Frogs Rupees always visible - Fixes Kokiri Sword Chest not showing - Fixes Weird Egg not showing * Check Tracker - MQ List basic support * Check Tracker - MQ/Vanilla anti-spoilers * Check Tracker - Collecting a compass now spoils the area * Check Tracker - Basic Vanilla Support and fixes - Vanilla items show in check tracker, even if many won't auto check - Fixes an issue with Gerudo Fortress Keys - Refactors IsVisibleInCheckTracker to randomizer_check_tracjer * Check Tracker - Fixes merge conflict from 08a487f35e1d760ab9e69b932edbe4da6bcd9edb * Check Tracker - Fixes tracker loading as Floating when default value is set to Windowed * Randomizer Location Exclusion List - Adds Scrubs, Merchants, Shops. Adult Trade items, MQ Dungeons, and Bean Salesman - Fixes Kokiri Sword Chest, Weird Egg, and Frog Song Rupees from misbehaving - Updates Gerudo Fortress logic to be dependent on Open/Fast/Normal Fortress - Removes Invalid Check - Adds RO Enum for MQ settings - Updates magic values to RO enum * Location Exclusion List - Scrubs that are always randomized now always show on the list * For now, removes some extra code only needed for a Check Tracker. * Randomizer Location Exclusion List - Fixes Eyeball Frog from showing up when Adult Trade Items was off * Location Tracker - Updates Eyedrops to use RandomizerInf instead of Chest * Check Tracker - Fixes a bug where Link's Pocket item wasn't acting as checked for area item count * Check Tracker - Fixes a bug where Locations would incorrectly say Vanilla due to the first check in the area being a non-MQ check * Check Tracker - Fixes a crash when Check Tracker is docked but not visible * Check Tracker - Fixes areas being spoiled when loading different save files * Check Tracker - Only reset variables if they are initialized * Check Tracker - Cleans up old comments, unused variables, methods, and macros, adds language TODOs, * Check Tracker - Readds rainbow UI elements after Cosmetics Editor refactor * Check Tracker - Removal of flag lookup that was refactored, no longer needed header, and some trivial whitespace fixes. * Check Tracker - Refactors Index to Bitmask code to a macro * Check Tracker - Changes ordering from alphabetical to RandomizerCheck ordering * Check Tracker - Wraps everything in a namespace to avoid global variable usage * Check Tracker - Explicitly defines for-loop scope * Check Tracker - refactors dungeon lookup from static array to function * Fixes a bug when using EnhancementColor with alpha * Check Tracker - Refactors all colour to use direct conversions * Check Tracker - refactors settings loading and check visibility for readability * Check Tracker - Fixes a bug where the wrong label showed on the Check Tracker BG Color * UIWidgets - Adds Alpha bar to EnhancementColor when using alpha parameter
2022-12-10 22:39:23 -05:00
if (!iSaved && jSaved) {
Randomizer Auto Location tracker (#1942) * Initial Auto-Location Tracking * Updates styling for checked items in Check Tracker * Fixes crashing issues with Check Tracker rendering * Auto scroll Check Tracker windows to current area * Checks Tracker only shows checked locations once in game * Fixes issue where Check Tracker would auto-scroll to wrong location when entering a grotto * Fixes gerudo fortress checks showing in tracker when settings have them removed * InfTable Check Location Fixes: Lost Dog Richard, Rolling Gorons, HBA 1000, Thawed Zora * Fixes most Event Chk Inf Checks on Check Tracker, and Frogs * Check Tracker - Song from Malon now works * Check Tracker - Fixes Claim Check check not tracking - Fixes spoiler for Claim Check check when getting Biggoron's Sword - Fixes LACS being spoiled and not tracking * Check Tracker - Fixes #2 for Skull Mask and Mask of Truth checks * Check Tracker - Adds support for merchants - Fixes #7 for Bomchu Salesman - Fixes #12 for Medigoron * Check Tracker - Fixes #8 for Song from Saria * Check Tracker - Fixes #9 for Adult Shooting Gallery * Check Tracker - Fixes #10 for Composer Grave * Check Tracker - Fixes #14 for Song from Ocarina of Time * Check Tracker - Fixes #16 for Shooting the Sun * Check Tracker - Fixes #19 for Darunia's Joy * Save Editor - Adds missing label for Treasure Chest Game * Check Tracker - Fixes Great Faries checks * Check Tracker - Fixes Sheik at Temple * Check Tracker - Fixes Great Fairy auto-scroll to wrong location * Check Tracker - Updates blue warp checks - Fixes Bongo Bongo and Twinrova checks * Check Tracker - Fixes Dampe's Gravedigging Tour * Check Tracker - Fixes Prescription to King Zora * Check Tracker - Fixes Bazaar showing under wrong area on tracker between adult/child * Check Tracker - Fixes scroll for Hyrule Market and Bazaar * Check Tracker - Fixes giving Adult Trade Items shown on tracker: Broken Sword, Saw, Cojiro, Eyeball Froge, and Eyedrops * Cleans up item_location * Check Tracker - Item List - Fixes item list not updating when changing seeds/options - Separates item exclusion list from item check list - Clean up comments * Check Tracker - Adds Skip functionality to buttons * Check Tracker - Refactors adult trade items to RandomizerInf * Check Tracker - Fixes an issue where any time an item is removed the tracker would cause an application crash * Check Tracker - Item names are now dependent on file language * Check Tracker - Fixes Gerudo Card check not showing in Fast setting * Reorders headers to (hopefully) avoid CI build conflicts on linux/consoles * Explicitly defines vector header in randomizer.h to fix compile errors * Complete Refactor of Check Tracker ImGui * Adds missing check tracker files to CMakeLists * Reverts the Item_location whitespace cleanup from ad10807c * Check Tracker - Loading Fixes - Fixes a bug where loading a save file a second time would add all the checks again - Fixes a bug where the check tracker would not render at all until in a save file * Check Tracker - Fixes a bug where checks would sometimes fail to load * Check Tracker - Fixes duplicated checks when using Only on Pause or Only on Combo * Check Tracker - Works around issue where single characters don't show in EnhancementCombobox, and fixes a label for combo buttons held option * Check Tracker - Applies all Check Tracker changes to Item Location * Check Tracker - Updated Check List - Adds Link's pocket, either in KF or HM depending on starting age - Supports Scrubs and Merchants - Uses enums instead of magic numbers - Updates DC Scrub Short Names for MQ * Check Tracker - Adds a performance mode option * Check Tracker - List Fixes (requires new rando generation) - Fixes Frogs Rupees always visible - Fixes Kokiri Sword Chest not showing - Fixes Weird Egg not showing * Check Tracker - MQ List basic support * Check Tracker - MQ/Vanilla anti-spoilers * Check Tracker - Collecting a compass now spoils the area * Check Tracker - Basic Vanilla Support and fixes - Vanilla items show in check tracker, even if many won't auto check - Fixes an issue with Gerudo Fortress Keys - Refactors IsVisibleInCheckTracker to randomizer_check_tracjer * Check Tracker - Fixes merge conflict from 08a487f35e1d760ab9e69b932edbe4da6bcd9edb * Check Tracker - Fixes tracker loading as Floating when default value is set to Windowed * Randomizer Location Exclusion List - Adds Scrubs, Merchants, Shops. Adult Trade items, MQ Dungeons, and Bean Salesman - Fixes Kokiri Sword Chest, Weird Egg, and Frog Song Rupees from misbehaving - Updates Gerudo Fortress logic to be dependent on Open/Fast/Normal Fortress - Removes Invalid Check - Adds RO Enum for MQ settings - Updates magic values to RO enum * Location Exclusion List - Scrubs that are always randomized now always show on the list * For now, removes some extra code only needed for a Check Tracker. * Randomizer Location Exclusion List - Fixes Eyeball Frog from showing up when Adult Trade Items was off * Location Tracker - Updates Eyedrops to use RandomizerInf instead of Chest * Check Tracker - Fixes a bug where Link's Pocket item wasn't acting as checked for area item count * Check Tracker - Fixes a bug where Locations would incorrectly say Vanilla due to the first check in the area being a non-MQ check * Check Tracker - Fixes a crash when Check Tracker is docked but not visible * Check Tracker - Fixes areas being spoiled when loading different save files * Check Tracker - Only reset variables if they are initialized * Check Tracker - Cleans up old comments, unused variables, methods, and macros, adds language TODOs, * Check Tracker - Readds rainbow UI elements after Cosmetics Editor refactor * Check Tracker - Removal of flag lookup that was refactored, no longer needed header, and some trivial whitespace fixes. * Check Tracker - Refactors Index to Bitmask code to a macro * Check Tracker - Changes ordering from alphabetical to RandomizerCheck ordering * Check Tracker - Wraps everything in a namespace to avoid global variable usage * Check Tracker - Explicitly defines for-loop scope * Check Tracker - refactors dungeon lookup from static array to function * Fixes a bug when using EnhancementColor with alpha * Check Tracker - Refactors all colour to use direct conversions * Check Tracker - refactors settings loading and check visibility for readability * Check Tracker - Fixes a bug where the wrong label showed on the Check Tracker BG Color * UIWidgets - Adds Alpha bar to EnhancementColor when using alpha parameter
2022-12-10 22:39:23 -05:00
return true;
} else if (iSaved && !jSaved) {
Check Tracker Update (#2668) * Initial commit. What works so far: Data file loads, saves, deletes, and is created properly. - Need to run `HasItemBeenCollected` when creating in case of mid-seed regen. Organized checks into maps set by area. Areas show in tracker. - Checks pulled from checkObjectsByArea are not currently listed. - Areas are being assumed completed and hidden at the start. * Checks now populate. Still not counting area totals properly. * Don't track RC_LINKS_POCKET in the data file, and instead manually add it in every time a save is load. rcObjects doesn't contain Link's Pocket location (duh). * Moved ItemReceive hook to randomizer_check_tracker.cpp. Skipped items are properly sorted and formatted. Saved items contribute to an area's gotten/skipped checks on load. Changed skipped items default main color to gray. General code cleanup. * Skipped checks now contribute to area totals for area completion logic. * Mid-menu rework transfer. * Started check lookup on item receive. Tried to enable scum checking on save. * Fixed scum check on save. * More code cleanup, which revealed some issues with loading and saving. Loading now works 100%, but entries in checkTrackerData are disappearing in code somewhere, causing issues with later checks. Scummed color now displays properly. Collected but unsaved displays properly. Unchecked, Skipped, Seen and Scummed checks all have arrows for skipping/unskipping. Counts a little messed up, probably double adding skips. * Fixed item counts being off across resets. Restarts were fine. * Beginning of rework for individual check updates. Adds `Actor lastCheck` to PlayState to allow assigning of last actor to give an item. This allows precise tracking of GS, freestanding PoH, etc. Works for chests too. Currently does not work for shops, unknown for normal NPC gives. Doesn't track last gives for non-checks, like drops from grass, pots, crates, etc. * Actor-based checks fully fleshed out, but can't help with sale-based checks. Implemented `pendingSaleCheck` to back out of an RC check cycle if `gSaveContext->pendingSale` is not NONE when `OnItemReceive` is called, processed through `OnSaleEnd`. This should be the final change necessary to streamline the checks. * Temporary hook to message box close to tie in trackers for non-gs/chest actors that aren't added to `GetCheckFromActor`. This triggers a 2-frame countdown to check with `HasItemBeenCollected` since half of the methods in there aren't updated until after a text box closes. Added scene tracking to get last scene so that checks in scenes that span several overworld areas could be tied to their areas properly. Modified tracker data creation to apply Link's Pocket and Song from Impa conditionally based on randomizer settings instead of just being assumed to be done. May need modification for checking click and drag spoiler loading. Removed the scene equivalence check from CheckChecks so that an entire area is checked each time to avoid issues with, e.g., leaving a shop before a pending sale finishes. * Changed check data creation to use RSKs from gRandomizer to account for settings loaded from drag and drop spoilers. * Beginning of tracker code organization. Changed check color defaults. * Reverted moving tracker colors to header. Some individual check fixes. * Missed something from previous merge? * Removed last remnant of removed performance mode. * Better handle checking when skullsanity is off. * Song checks sceneIDs don't match the scenes they're actually in for some reason. Removed that check. * SaleEnd checks don't need the GetItemEntry parameter. Also set a flag that should prevent the check tracker from running during vanilla saves should that not be resolved by the time it's merged. * Attempting to have only the relevant checks added to the tracker data, as well as showing vanilla checks for non-rando saves. Not working yet (everything is displayed in vanilla). * Added vanilla check tracker population via `vanillaCheck` bool in `RandomizerCheckObject`. This is also added to `IsVisibleInImGui` to handle file loading and saving to eliminate checks that aren't part of vanilla or the rando seed. Implemented deleted tracker data file recreation. Added some extra item name text checks. Songs are still... tricky, so they stay blank. Utilize local copies of the randomizer check objects that are applicable for performance purposes. Fixed vanilla item-giving cutscene crashes when triggered mid-transition. * Apparently not all toolchains can handle macro instantiation without all parameters, like VS can. * Fixed scummed detail color not showing properly on tracker. * Fixed dungeon area totals and GS checks not functioning properly. * Major revamp of checking code. Doesn't rely on `GetCheckFromActor` at all anymore, but instead simply sets a flag to evaluate a number of checks in an area every frame until the check that was gotten is identified. With the new setup, it's much less hardware intensive, and at 60fps 6 checks per frame shows no noticeable effect on framerate. I can envision needing to add a collectedCount in order to account for times when two checks are gotten one right after the other. Changed area scroll to happen from `OnTransitionEnd`, and allow for scrolling in bazaar (was disabled previously because it would jump back and forth between Kak and Market while you were in one). Also setup area check order updating by area instead of all at the same time. * Fixed shooting gallery not reporting proper area. Prevent checks from actually happening if area is RCAREA_INVALID, now that all areas are reporting something if they have checks. Fixed `GetCheckArea()` not updating checks for standard scenes. Lots of vanilla tracking updates, mainly manual checks for gems, medallions and songs, since the often don't have proper scenes in the data. Prevent vanilla from triggering check loops if junk items are collected. Fixed sorting based on saved vs collected. Prevent item name display for vanilla runs. Change coloring of checks so the check name reflects status in vanilla runs. * Fixed "Recheck Area" button erroneously adding to an area's check totals? * Fix DMC vanilla checks. * Fix check tracker data recreation on data file loss. Removed redundant file exists check from SaveTrackerDataHook, as it doesn't matter if it exists or not at that point. Limited check loops to 3 to avoid infinite check loops on non-check/junk item pickup. Added more checks to disable tracker operations if a save is not running. Changed check ordering to put boss reward and heart container checks at the end of whatever RCSHOW group they belong to. * Fixed IsRunning calculation. Further improving vanilla checking. Starting framework for checking medallions, stones, and songs on data file recreation. Fixed medallion check collection. Added GIFT_FROM_SAGES to check list for vanilla file for tracking light medallion. Added check loop limitation to prevent infinite checking after picking up junk item from the ground. * Finished vanilla file recreation and recheck (songs and dungeon rewards all check properly now). This includes deku shield with KF shop item 3. Finished Gift from Raoru light medallion tracking for vanilla. Commented all CheckByScene functionality for now. * Fixed new save data file creation. Disabled entrance area calculation for now, as it only tracks the previous entrance for some reason. Fixed area detection for ToT checks. * GetCheckArea() now utilizes EntranceData almost exclusively, via either `gSaveContext.entranceIndex` or the entrance tracker's `currentGrottoId` in the case of grottos. This also means that EVERYTHING CAN AUTOSCROLL NOW. Entrance shuffles are now much easier to track. Autoscroll is now also triggered on save, just in case someone isn't autosaving and has a lot of checks that get converted to saved. * Fixed missing GS check in LW. * Added area scroll on toggling Show Hidden Items. May configure differently later. Fixed area detection for entrances in Gerudo Fortress/Valley and Collossus. Haunted wasteland doesn't autoscroll due to a bug in `OnTransitionEnd` hook, but checks still evaluate properly there. Rely on scene-based area detection if scene is a main overworld or dungeon scene. * Fixed grotto detection when shuffle is off. * Small code cleanup. Fixed Colossus hand chest checks. * Missing lus bump from merge conflict resolution * Fixed Colossus Grotto making `GetCheckArea` return Wasteland. * Improved OnItemReceive processing for non-token GS checks, since they can sometimes take long enough for the checking process to time out before the item is registered as received. * First attempt at thread safety for tracker data file writing. Seems to work, but might need more testing. * Fixed Recheck Area not unskipping items that register as saved. Improved delayed saving with autosaving, as the autosave triggered quite often before the tracker data save, making things not properly register as saved. * merge cleanup * Converted check tracker data to the sectional saves, adding `CheckTrackerData` to `SaveContext`. Implemented section ID returning and fullSave boolean passing to section functions from my PR temporarily for it to work properly. Moved `RandomizerCheckTrackerData` enum to `randomizerTypes.h` to accommodate that. Changed `Randomizer_SaveInit` to a `SaveManager::InitFunc` to allow for other randomizer-dependent sections to be initialized after that. Required a little refactoring to maintain intro cutscene skip when starting a randomizer file. * Revert section index return and randomizer init changes. Will need to wait on yet more changes to main. * Fixed check tracker initialization (shouldn't be tied to window initialization), restored saving/loading functionality. * Removed `CheckTracker::Init` and put SaveManager calls in `CheckTrackerWindow::InitElement`. Also a bit of cleanup from transition back to save file use. * Fixed tracker displaying check categories while file not loaded. * Fix Darunia's Joy check not marking in vanilla. * Fix autosave not triggering change from collected to saved in tracker data. * Changed default colors for scummed and collected display. * Merge upgrade code cleanup. * Add `OnTransitionEnd` calls to sandstorm transitions both to and from Wasteland. Also improved `gSaveContext.lastScene` assignment for both transition types. Allowed a bit of cleanup in `GetCheckArea`. * Added `StateButton`, a button like `ArrowButton` but that allows text instead of arrow icons. Apparently the changes from ArrowButton to StateButton happened in a previous commit... * Changed section name to `trackerDataCheck` to force SoH to load it after the randomizer section, as it required some randoSettings to be loaded first, and nothing else I tried to make the randomizer section load before it worked. This hacks a solution to checks not displaying on fast file load to a specific slot. F*** you, SaveManager, and f*** you too, JSON. * Forgot to change the section string for loading with the name change. * Fix check ordering for checks that trigger the autosave. * Adds option to remove right-side shop items (slots 1-4) from the tracker list. Enabled by default. * Fix default state of Hide Shop Right Checks checkbox. * Fixes grotto and great fairy scrolling and checks. Fixes array overflow from `checkTrackerData` which was creating the issue trying to load the base and randomizer sections first, among other things. That also fixed the massive file loads that were being exhibited in debug mode. * Fix shooting galleries being set as collected again when being played a second time after getting the checks. * Fix Bazaar autoscroll. * Add Saria's Song to `GetCheckFromActor` and removed some limitations from the messageCloseCheck function to make that check track properly. * Fix Song from Impa check. Implemented prevention for multiple "collections" of great fairies, just in case getting the health refill would trigger it with the previous setup. * Fix ice traps on GS tokens not triggering OnItemReceive. * Complete fix for ice trap collection from GS. Add autoscroll when clicking "Expand All". * Add `OnShopSlotChange` with cursorSlot and basePrice parameters. * Fixed include in en_ossan for shop slot hook. Added registration for `OnShopSlotChange` in the tracker, storing the price in a new `price` field in `CheckTrackerData`. Added "seen" functionality to shop checks. Displays the model item name upon first entering a shop, adding the price and switching to trickName (if it's an ice trap) upon navigating to the slot in buy mode, triggered by an invisible "identified" status that mirrors "seen" in every other way. Added tooltips to most options for check tracker color picking to describe what each status actually means. * `std::format` pls * So apparently std::format just decided to break with the latest merge from develop, but fmt::format exists and works? * Removed the last vestiges of `locationsSkipped`. Other general code and formatting cleanups. Moved `IsGameRunning` to `OTRGlobals` so the item tracker could also access it. Used preceding to "fix" item and bottle display in the item tracker on startup. * Some more code cleanup. Removed "Recheck Area" button and relevant code. Backported changes to Anchor branch applicable for single-player, including making a checkAreas vector and structuring the frame by frame checks around that. Also includes fix for Silver Gauntlets and Mirror Shield check collection crash associated with those changes. Fixed Kakariko Bazaar "seen" updates. Fixed tracker window not showing on initial load like it should. * Forgot 1 formatting fix. * Removed conditions for showing Song from Impa (isn't junk under certain conditions, so should show all the time). * Fix vanilla checks, add Zelda's Letter and Malon's Egg to manual check collection. Fix autoscroll while in child stealth section. * Fix crash in Happy Mask Shop in OnSlotChange (referenced non-existent shop id in a tracker-specific enum). * General code cleanup. * Missed one reversion. * One more. * Fix column alignment in `randomizer_check_objects`. * Fix file encoding on `randomizer_check_tracker`. Again. * Fix indentation for `actualItemtrackerItemMap`. Also removed unnecessary parts of the map. * Rename `HasEqItem` to `HasEquipment`. * Slightly better indentation for `actualItemTrackerItemMap`. * Add magic bean salesman to vanilla check tracking, and genericized deku shield to trigger KF shop item 3 wherever you get the shield. Renamed `vanillaCheck` to `vanillaHundoCheck` to (supposedly) clarify the meaning of the usage. * One more rename to `vanillaCompletion` to avoid possible confusion with 100% speedrun conditions. * give me a break XD Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * Changes suggested by briaguya (rename `RandomizerCheckShow` to `Status`, unused code, newline formatting) * Remove unused `itemNames` table. * Remove `IsGameRunning` in favor of `GameInteractor::IsSaveLoaded`. * Restore anti-spoiler functionality for dungeons with dungeon maps. * Review cleanup. * Fix prices not showing for Kak bazaar items. --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com>
2023-10-04 11:03:36 -04:00
return false;
}
Check Tracker Update (#2668) * Initial commit. What works so far: Data file loads, saves, deletes, and is created properly. - Need to run `HasItemBeenCollected` when creating in case of mid-seed regen. Organized checks into maps set by area. Areas show in tracker. - Checks pulled from checkObjectsByArea are not currently listed. - Areas are being assumed completed and hidden at the start. * Checks now populate. Still not counting area totals properly. * Don't track RC_LINKS_POCKET in the data file, and instead manually add it in every time a save is load. rcObjects doesn't contain Link's Pocket location (duh). * Moved ItemReceive hook to randomizer_check_tracker.cpp. Skipped items are properly sorted and formatted. Saved items contribute to an area's gotten/skipped checks on load. Changed skipped items default main color to gray. General code cleanup. * Skipped checks now contribute to area totals for area completion logic. * Mid-menu rework transfer. * Started check lookup on item receive. Tried to enable scum checking on save. * Fixed scum check on save. * More code cleanup, which revealed some issues with loading and saving. Loading now works 100%, but entries in checkTrackerData are disappearing in code somewhere, causing issues with later checks. Scummed color now displays properly. Collected but unsaved displays properly. Unchecked, Skipped, Seen and Scummed checks all have arrows for skipping/unskipping. Counts a little messed up, probably double adding skips. * Fixed item counts being off across resets. Restarts were fine. * Beginning of rework for individual check updates. Adds `Actor lastCheck` to PlayState to allow assigning of last actor to give an item. This allows precise tracking of GS, freestanding PoH, etc. Works for chests too. Currently does not work for shops, unknown for normal NPC gives. Doesn't track last gives for non-checks, like drops from grass, pots, crates, etc. * Actor-based checks fully fleshed out, but can't help with sale-based checks. Implemented `pendingSaleCheck` to back out of an RC check cycle if `gSaveContext->pendingSale` is not NONE when `OnItemReceive` is called, processed through `OnSaleEnd`. This should be the final change necessary to streamline the checks. * Temporary hook to message box close to tie in trackers for non-gs/chest actors that aren't added to `GetCheckFromActor`. This triggers a 2-frame countdown to check with `HasItemBeenCollected` since half of the methods in there aren't updated until after a text box closes. Added scene tracking to get last scene so that checks in scenes that span several overworld areas could be tied to their areas properly. Modified tracker data creation to apply Link's Pocket and Song from Impa conditionally based on randomizer settings instead of just being assumed to be done. May need modification for checking click and drag spoiler loading. Removed the scene equivalence check from CheckChecks so that an entire area is checked each time to avoid issues with, e.g., leaving a shop before a pending sale finishes. * Changed check data creation to use RSKs from gRandomizer to account for settings loaded from drag and drop spoilers. * Beginning of tracker code organization. Changed check color defaults. * Reverted moving tracker colors to header. Some individual check fixes. * Missed something from previous merge? * Removed last remnant of removed performance mode. * Better handle checking when skullsanity is off. * Song checks sceneIDs don't match the scenes they're actually in for some reason. Removed that check. * SaleEnd checks don't need the GetItemEntry parameter. Also set a flag that should prevent the check tracker from running during vanilla saves should that not be resolved by the time it's merged. * Attempting to have only the relevant checks added to the tracker data, as well as showing vanilla checks for non-rando saves. Not working yet (everything is displayed in vanilla). * Added vanilla check tracker population via `vanillaCheck` bool in `RandomizerCheckObject`. This is also added to `IsVisibleInImGui` to handle file loading and saving to eliminate checks that aren't part of vanilla or the rando seed. Implemented deleted tracker data file recreation. Added some extra item name text checks. Songs are still... tricky, so they stay blank. Utilize local copies of the randomizer check objects that are applicable for performance purposes. Fixed vanilla item-giving cutscene crashes when triggered mid-transition. * Apparently not all toolchains can handle macro instantiation without all parameters, like VS can. * Fixed scummed detail color not showing properly on tracker. * Fixed dungeon area totals and GS checks not functioning properly. * Major revamp of checking code. Doesn't rely on `GetCheckFromActor` at all anymore, but instead simply sets a flag to evaluate a number of checks in an area every frame until the check that was gotten is identified. With the new setup, it's much less hardware intensive, and at 60fps 6 checks per frame shows no noticeable effect on framerate. I can envision needing to add a collectedCount in order to account for times when two checks are gotten one right after the other. Changed area scroll to happen from `OnTransitionEnd`, and allow for scrolling in bazaar (was disabled previously because it would jump back and forth between Kak and Market while you were in one). Also setup area check order updating by area instead of all at the same time. * Fixed shooting gallery not reporting proper area. Prevent checks from actually happening if area is RCAREA_INVALID, now that all areas are reporting something if they have checks. Fixed `GetCheckArea()` not updating checks for standard scenes. Lots of vanilla tracking updates, mainly manual checks for gems, medallions and songs, since the often don't have proper scenes in the data. Prevent vanilla from triggering check loops if junk items are collected. Fixed sorting based on saved vs collected. Prevent item name display for vanilla runs. Change coloring of checks so the check name reflects status in vanilla runs. * Fixed "Recheck Area" button erroneously adding to an area's check totals? * Fix DMC vanilla checks. * Fix check tracker data recreation on data file loss. Removed redundant file exists check from SaveTrackerDataHook, as it doesn't matter if it exists or not at that point. Limited check loops to 3 to avoid infinite check loops on non-check/junk item pickup. Added more checks to disable tracker operations if a save is not running. Changed check ordering to put boss reward and heart container checks at the end of whatever RCSHOW group they belong to. * Fixed IsRunning calculation. Further improving vanilla checking. Starting framework for checking medallions, stones, and songs on data file recreation. Fixed medallion check collection. Added GIFT_FROM_SAGES to check list for vanilla file for tracking light medallion. Added check loop limitation to prevent infinite checking after picking up junk item from the ground. * Finished vanilla file recreation and recheck (songs and dungeon rewards all check properly now). This includes deku shield with KF shop item 3. Finished Gift from Raoru light medallion tracking for vanilla. Commented all CheckByScene functionality for now. * Fixed new save data file creation. Disabled entrance area calculation for now, as it only tracks the previous entrance for some reason. Fixed area detection for ToT checks. * GetCheckArea() now utilizes EntranceData almost exclusively, via either `gSaveContext.entranceIndex` or the entrance tracker's `currentGrottoId` in the case of grottos. This also means that EVERYTHING CAN AUTOSCROLL NOW. Entrance shuffles are now much easier to track. Autoscroll is now also triggered on save, just in case someone isn't autosaving and has a lot of checks that get converted to saved. * Fixed missing GS check in LW. * Added area scroll on toggling Show Hidden Items. May configure differently later. Fixed area detection for entrances in Gerudo Fortress/Valley and Collossus. Haunted wasteland doesn't autoscroll due to a bug in `OnTransitionEnd` hook, but checks still evaluate properly there. Rely on scene-based area detection if scene is a main overworld or dungeon scene. * Fixed grotto detection when shuffle is off. * Small code cleanup. Fixed Colossus hand chest checks. * Missing lus bump from merge conflict resolution * Fixed Colossus Grotto making `GetCheckArea` return Wasteland. * Improved OnItemReceive processing for non-token GS checks, since they can sometimes take long enough for the checking process to time out before the item is registered as received. * First attempt at thread safety for tracker data file writing. Seems to work, but might need more testing. * Fixed Recheck Area not unskipping items that register as saved. Improved delayed saving with autosaving, as the autosave triggered quite often before the tracker data save, making things not properly register as saved. * merge cleanup * Converted check tracker data to the sectional saves, adding `CheckTrackerData` to `SaveContext`. Implemented section ID returning and fullSave boolean passing to section functions from my PR temporarily for it to work properly. Moved `RandomizerCheckTrackerData` enum to `randomizerTypes.h` to accommodate that. Changed `Randomizer_SaveInit` to a `SaveManager::InitFunc` to allow for other randomizer-dependent sections to be initialized after that. Required a little refactoring to maintain intro cutscene skip when starting a randomizer file. * Revert section index return and randomizer init changes. Will need to wait on yet more changes to main. * Fixed check tracker initialization (shouldn't be tied to window initialization), restored saving/loading functionality. * Removed `CheckTracker::Init` and put SaveManager calls in `CheckTrackerWindow::InitElement`. Also a bit of cleanup from transition back to save file use. * Fixed tracker displaying check categories while file not loaded. * Fix Darunia's Joy check not marking in vanilla. * Fix autosave not triggering change from collected to saved in tracker data. * Changed default colors for scummed and collected display. * Merge upgrade code cleanup. * Add `OnTransitionEnd` calls to sandstorm transitions both to and from Wasteland. Also improved `gSaveContext.lastScene` assignment for both transition types. Allowed a bit of cleanup in `GetCheckArea`. * Added `StateButton`, a button like `ArrowButton` but that allows text instead of arrow icons. Apparently the changes from ArrowButton to StateButton happened in a previous commit... * Changed section name to `trackerDataCheck` to force SoH to load it after the randomizer section, as it required some randoSettings to be loaded first, and nothing else I tried to make the randomizer section load before it worked. This hacks a solution to checks not displaying on fast file load to a specific slot. F*** you, SaveManager, and f*** you too, JSON. * Forgot to change the section string for loading with the name change. * Fix check ordering for checks that trigger the autosave. * Adds option to remove right-side shop items (slots 1-4) from the tracker list. Enabled by default. * Fix default state of Hide Shop Right Checks checkbox. * Fixes grotto and great fairy scrolling and checks. Fixes array overflow from `checkTrackerData` which was creating the issue trying to load the base and randomizer sections first, among other things. That also fixed the massive file loads that were being exhibited in debug mode. * Fix shooting galleries being set as collected again when being played a second time after getting the checks. * Fix Bazaar autoscroll. * Add Saria's Song to `GetCheckFromActor` and removed some limitations from the messageCloseCheck function to make that check track properly. * Fix Song from Impa check. Implemented prevention for multiple "collections" of great fairies, just in case getting the health refill would trigger it with the previous setup. * Fix ice traps on GS tokens not triggering OnItemReceive. * Complete fix for ice trap collection from GS. Add autoscroll when clicking "Expand All". * Add `OnShopSlotChange` with cursorSlot and basePrice parameters. * Fixed include in en_ossan for shop slot hook. Added registration for `OnShopSlotChange` in the tracker, storing the price in a new `price` field in `CheckTrackerData`. Added "seen" functionality to shop checks. Displays the model item name upon first entering a shop, adding the price and switching to trickName (if it's an ice trap) upon navigating to the slot in buy mode, triggered by an invisible "identified" status that mirrors "seen" in every other way. Added tooltips to most options for check tracker color picking to describe what each status actually means. * `std::format` pls * So apparently std::format just decided to break with the latest merge from develop, but fmt::format exists and works? * Removed the last vestiges of `locationsSkipped`. Other general code and formatting cleanups. Moved `IsGameRunning` to `OTRGlobals` so the item tracker could also access it. Used preceding to "fix" item and bottle display in the item tracker on startup. * Some more code cleanup. Removed "Recheck Area" button and relevant code. Backported changes to Anchor branch applicable for single-player, including making a checkAreas vector and structuring the frame by frame checks around that. Also includes fix for Silver Gauntlets and Mirror Shield check collection crash associated with those changes. Fixed Kakariko Bazaar "seen" updates. Fixed tracker window not showing on initial load like it should. * Forgot 1 formatting fix. * Removed conditions for showing Song from Impa (isn't junk under certain conditions, so should show all the time). * Fix vanilla checks, add Zelda's Letter and Malon's Egg to manual check collection. Fix autoscroll while in child stealth section. * Fix crash in Happy Mask Shop in OnSlotChange (referenced non-existent shop id in a tracker-specific enum). * General code cleanup. * Missed one reversion. * One more. * Fix column alignment in `randomizer_check_objects`. * Fix file encoding on `randomizer_check_tracker`. Again. * Fix indentation for `actualItemtrackerItemMap`. Also removed unnecessary parts of the map. * Rename `HasEqItem` to `HasEquipment`. * Slightly better indentation for `actualItemTrackerItemMap`. * Add magic bean salesman to vanilla check tracking, and genericized deku shield to trigger KF shop item 3 wherever you get the shield. Renamed `vanillaCheck` to `vanillaHundoCheck` to (supposedly) clarify the meaning of the usage. * One more rename to `vanillaCompletion` to avoid possible confusion with 100% speedrun conditions. * give me a break XD Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * Changes suggested by briaguya (rename `RandomizerCheckShow` to `Status`, unused code, newline formatting) * Remove unused `itemNames` table. * Remove `IsGameRunning` in favor of `GameInteractor::IsSaveLoaded`. * Restore anti-spoiler functionality for dungeons with dungeon maps. * Review cleanup. * Fix prices not showing for Kak bazaar items. --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com>
2023-10-04 11:03:36 -04:00
if (!iShow.skipped && jShow.skipped) {
Check Tracker Update (#2668) * Initial commit. What works so far: Data file loads, saves, deletes, and is created properly. - Need to run `HasItemBeenCollected` when creating in case of mid-seed regen. Organized checks into maps set by area. Areas show in tracker. - Checks pulled from checkObjectsByArea are not currently listed. - Areas are being assumed completed and hidden at the start. * Checks now populate. Still not counting area totals properly. * Don't track RC_LINKS_POCKET in the data file, and instead manually add it in every time a save is load. rcObjects doesn't contain Link's Pocket location (duh). * Moved ItemReceive hook to randomizer_check_tracker.cpp. Skipped items are properly sorted and formatted. Saved items contribute to an area's gotten/skipped checks on load. Changed skipped items default main color to gray. General code cleanup. * Skipped checks now contribute to area totals for area completion logic. * Mid-menu rework transfer. * Started check lookup on item receive. Tried to enable scum checking on save. * Fixed scum check on save. * More code cleanup, which revealed some issues with loading and saving. Loading now works 100%, but entries in checkTrackerData are disappearing in code somewhere, causing issues with later checks. Scummed color now displays properly. Collected but unsaved displays properly. Unchecked, Skipped, Seen and Scummed checks all have arrows for skipping/unskipping. Counts a little messed up, probably double adding skips. * Fixed item counts being off across resets. Restarts were fine. * Beginning of rework for individual check updates. Adds `Actor lastCheck` to PlayState to allow assigning of last actor to give an item. This allows precise tracking of GS, freestanding PoH, etc. Works for chests too. Currently does not work for shops, unknown for normal NPC gives. Doesn't track last gives for non-checks, like drops from grass, pots, crates, etc. * Actor-based checks fully fleshed out, but can't help with sale-based checks. Implemented `pendingSaleCheck` to back out of an RC check cycle if `gSaveContext->pendingSale` is not NONE when `OnItemReceive` is called, processed through `OnSaleEnd`. This should be the final change necessary to streamline the checks. * Temporary hook to message box close to tie in trackers for non-gs/chest actors that aren't added to `GetCheckFromActor`. This triggers a 2-frame countdown to check with `HasItemBeenCollected` since half of the methods in there aren't updated until after a text box closes. Added scene tracking to get last scene so that checks in scenes that span several overworld areas could be tied to their areas properly. Modified tracker data creation to apply Link's Pocket and Song from Impa conditionally based on randomizer settings instead of just being assumed to be done. May need modification for checking click and drag spoiler loading. Removed the scene equivalence check from CheckChecks so that an entire area is checked each time to avoid issues with, e.g., leaving a shop before a pending sale finishes. * Changed check data creation to use RSKs from gRandomizer to account for settings loaded from drag and drop spoilers. * Beginning of tracker code organization. Changed check color defaults. * Reverted moving tracker colors to header. Some individual check fixes. * Missed something from previous merge? * Removed last remnant of removed performance mode. * Better handle checking when skullsanity is off. * Song checks sceneIDs don't match the scenes they're actually in for some reason. Removed that check. * SaleEnd checks don't need the GetItemEntry parameter. Also set a flag that should prevent the check tracker from running during vanilla saves should that not be resolved by the time it's merged. * Attempting to have only the relevant checks added to the tracker data, as well as showing vanilla checks for non-rando saves. Not working yet (everything is displayed in vanilla). * Added vanilla check tracker population via `vanillaCheck` bool in `RandomizerCheckObject`. This is also added to `IsVisibleInImGui` to handle file loading and saving to eliminate checks that aren't part of vanilla or the rando seed. Implemented deleted tracker data file recreation. Added some extra item name text checks. Songs are still... tricky, so they stay blank. Utilize local copies of the randomizer check objects that are applicable for performance purposes. Fixed vanilla item-giving cutscene crashes when triggered mid-transition. * Apparently not all toolchains can handle macro instantiation without all parameters, like VS can. * Fixed scummed detail color not showing properly on tracker. * Fixed dungeon area totals and GS checks not functioning properly. * Major revamp of checking code. Doesn't rely on `GetCheckFromActor` at all anymore, but instead simply sets a flag to evaluate a number of checks in an area every frame until the check that was gotten is identified. With the new setup, it's much less hardware intensive, and at 60fps 6 checks per frame shows no noticeable effect on framerate. I can envision needing to add a collectedCount in order to account for times when two checks are gotten one right after the other. Changed area scroll to happen from `OnTransitionEnd`, and allow for scrolling in bazaar (was disabled previously because it would jump back and forth between Kak and Market while you were in one). Also setup area check order updating by area instead of all at the same time. * Fixed shooting gallery not reporting proper area. Prevent checks from actually happening if area is RCAREA_INVALID, now that all areas are reporting something if they have checks. Fixed `GetCheckArea()` not updating checks for standard scenes. Lots of vanilla tracking updates, mainly manual checks for gems, medallions and songs, since the often don't have proper scenes in the data. Prevent vanilla from triggering check loops if junk items are collected. Fixed sorting based on saved vs collected. Prevent item name display for vanilla runs. Change coloring of checks so the check name reflects status in vanilla runs. * Fixed "Recheck Area" button erroneously adding to an area's check totals? * Fix DMC vanilla checks. * Fix check tracker data recreation on data file loss. Removed redundant file exists check from SaveTrackerDataHook, as it doesn't matter if it exists or not at that point. Limited check loops to 3 to avoid infinite check loops on non-check/junk item pickup. Added more checks to disable tracker operations if a save is not running. Changed check ordering to put boss reward and heart container checks at the end of whatever RCSHOW group they belong to. * Fixed IsRunning calculation. Further improving vanilla checking. Starting framework for checking medallions, stones, and songs on data file recreation. Fixed medallion check collection. Added GIFT_FROM_SAGES to check list for vanilla file for tracking light medallion. Added check loop limitation to prevent infinite checking after picking up junk item from the ground. * Finished vanilla file recreation and recheck (songs and dungeon rewards all check properly now). This includes deku shield with KF shop item 3. Finished Gift from Raoru light medallion tracking for vanilla. Commented all CheckByScene functionality for now. * Fixed new save data file creation. Disabled entrance area calculation for now, as it only tracks the previous entrance for some reason. Fixed area detection for ToT checks. * GetCheckArea() now utilizes EntranceData almost exclusively, via either `gSaveContext.entranceIndex` or the entrance tracker's `currentGrottoId` in the case of grottos. This also means that EVERYTHING CAN AUTOSCROLL NOW. Entrance shuffles are now much easier to track. Autoscroll is now also triggered on save, just in case someone isn't autosaving and has a lot of checks that get converted to saved. * Fixed missing GS check in LW. * Added area scroll on toggling Show Hidden Items. May configure differently later. Fixed area detection for entrances in Gerudo Fortress/Valley and Collossus. Haunted wasteland doesn't autoscroll due to a bug in `OnTransitionEnd` hook, but checks still evaluate properly there. Rely on scene-based area detection if scene is a main overworld or dungeon scene. * Fixed grotto detection when shuffle is off. * Small code cleanup. Fixed Colossus hand chest checks. * Missing lus bump from merge conflict resolution * Fixed Colossus Grotto making `GetCheckArea` return Wasteland. * Improved OnItemReceive processing for non-token GS checks, since they can sometimes take long enough for the checking process to time out before the item is registered as received. * First attempt at thread safety for tracker data file writing. Seems to work, but might need more testing. * Fixed Recheck Area not unskipping items that register as saved. Improved delayed saving with autosaving, as the autosave triggered quite often before the tracker data save, making things not properly register as saved. * merge cleanup * Converted check tracker data to the sectional saves, adding `CheckTrackerData` to `SaveContext`. Implemented section ID returning and fullSave boolean passing to section functions from my PR temporarily for it to work properly. Moved `RandomizerCheckTrackerData` enum to `randomizerTypes.h` to accommodate that. Changed `Randomizer_SaveInit` to a `SaveManager::InitFunc` to allow for other randomizer-dependent sections to be initialized after that. Required a little refactoring to maintain intro cutscene skip when starting a randomizer file. * Revert section index return and randomizer init changes. Will need to wait on yet more changes to main. * Fixed check tracker initialization (shouldn't be tied to window initialization), restored saving/loading functionality. * Removed `CheckTracker::Init` and put SaveManager calls in `CheckTrackerWindow::InitElement`. Also a bit of cleanup from transition back to save file use. * Fixed tracker displaying check categories while file not loaded. * Fix Darunia's Joy check not marking in vanilla. * Fix autosave not triggering change from collected to saved in tracker data. * Changed default colors for scummed and collected display. * Merge upgrade code cleanup. * Add `OnTransitionEnd` calls to sandstorm transitions both to and from Wasteland. Also improved `gSaveContext.lastScene` assignment for both transition types. Allowed a bit of cleanup in `GetCheckArea`. * Added `StateButton`, a button like `ArrowButton` but that allows text instead of arrow icons. Apparently the changes from ArrowButton to StateButton happened in a previous commit... * Changed section name to `trackerDataCheck` to force SoH to load it after the randomizer section, as it required some randoSettings to be loaded first, and nothing else I tried to make the randomizer section load before it worked. This hacks a solution to checks not displaying on fast file load to a specific slot. F*** you, SaveManager, and f*** you too, JSON. * Forgot to change the section string for loading with the name change. * Fix check ordering for checks that trigger the autosave. * Adds option to remove right-side shop items (slots 1-4) from the tracker list. Enabled by default. * Fix default state of Hide Shop Right Checks checkbox. * Fixes grotto and great fairy scrolling and checks. Fixes array overflow from `checkTrackerData` which was creating the issue trying to load the base and randomizer sections first, among other things. That also fixed the massive file loads that were being exhibited in debug mode. * Fix shooting galleries being set as collected again when being played a second time after getting the checks. * Fix Bazaar autoscroll. * Add Saria's Song to `GetCheckFromActor` and removed some limitations from the messageCloseCheck function to make that check track properly. * Fix Song from Impa check. Implemented prevention for multiple "collections" of great fairies, just in case getting the health refill would trigger it with the previous setup. * Fix ice traps on GS tokens not triggering OnItemReceive. * Complete fix for ice trap collection from GS. Add autoscroll when clicking "Expand All". * Add `OnShopSlotChange` with cursorSlot and basePrice parameters. * Fixed include in en_ossan for shop slot hook. Added registration for `OnShopSlotChange` in the tracker, storing the price in a new `price` field in `CheckTrackerData`. Added "seen" functionality to shop checks. Displays the model item name upon first entering a shop, adding the price and switching to trickName (if it's an ice trap) upon navigating to the slot in buy mode, triggered by an invisible "identified" status that mirrors "seen" in every other way. Added tooltips to most options for check tracker color picking to describe what each status actually means. * `std::format` pls * So apparently std::format just decided to break with the latest merge from develop, but fmt::format exists and works? * Removed the last vestiges of `locationsSkipped`. Other general code and formatting cleanups. Moved `IsGameRunning` to `OTRGlobals` so the item tracker could also access it. Used preceding to "fix" item and bottle display in the item tracker on startup. * Some more code cleanup. Removed "Recheck Area" button and relevant code. Backported changes to Anchor branch applicable for single-player, including making a checkAreas vector and structuring the frame by frame checks around that. Also includes fix for Silver Gauntlets and Mirror Shield check collection crash associated with those changes. Fixed Kakariko Bazaar "seen" updates. Fixed tracker window not showing on initial load like it should. * Forgot 1 formatting fix. * Removed conditions for showing Song from Impa (isn't junk under certain conditions, so should show all the time). * Fix vanilla checks, add Zelda's Letter and Malon's Egg to manual check collection. Fix autoscroll while in child stealth section. * Fix crash in Happy Mask Shop in OnSlotChange (referenced non-existent shop id in a tracker-specific enum). * General code cleanup. * Missed one reversion. * One more. * Fix column alignment in `randomizer_check_objects`. * Fix file encoding on `randomizer_check_tracker`. Again. * Fix indentation for `actualItemtrackerItemMap`. Also removed unnecessary parts of the map. * Rename `HasEqItem` to `HasEquipment`. * Slightly better indentation for `actualItemTrackerItemMap`. * Add magic bean salesman to vanilla check tracking, and genericized deku shield to trigger KF shop item 3 wherever you get the shield. Renamed `vanillaCheck` to `vanillaHundoCheck` to (supposedly) clarify the meaning of the usage. * One more rename to `vanillaCompletion` to avoid possible confusion with 100% speedrun conditions. * give me a break XD Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * Changes suggested by briaguya (rename `RandomizerCheckShow` to `Status`, unused code, newline formatting) * Remove unused `itemNames` table. * Remove `IsGameRunning` in favor of `GameInteractor::IsSaveLoaded`. * Restore anti-spoiler functionality for dungeons with dungeon maps. * Review cleanup. * Fix prices not showing for Kak bazaar items. --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com>
2023-10-04 11:03:36 -04:00
return true;
} else if (iShow.skipped && !jShow.skipped) {
Check Tracker Update (#2668) * Initial commit. What works so far: Data file loads, saves, deletes, and is created properly. - Need to run `HasItemBeenCollected` when creating in case of mid-seed regen. Organized checks into maps set by area. Areas show in tracker. - Checks pulled from checkObjectsByArea are not currently listed. - Areas are being assumed completed and hidden at the start. * Checks now populate. Still not counting area totals properly. * Don't track RC_LINKS_POCKET in the data file, and instead manually add it in every time a save is load. rcObjects doesn't contain Link's Pocket location (duh). * Moved ItemReceive hook to randomizer_check_tracker.cpp. Skipped items are properly sorted and formatted. Saved items contribute to an area's gotten/skipped checks on load. Changed skipped items default main color to gray. General code cleanup. * Skipped checks now contribute to area totals for area completion logic. * Mid-menu rework transfer. * Started check lookup on item receive. Tried to enable scum checking on save. * Fixed scum check on save. * More code cleanup, which revealed some issues with loading and saving. Loading now works 100%, but entries in checkTrackerData are disappearing in code somewhere, causing issues with later checks. Scummed color now displays properly. Collected but unsaved displays properly. Unchecked, Skipped, Seen and Scummed checks all have arrows for skipping/unskipping. Counts a little messed up, probably double adding skips. * Fixed item counts being off across resets. Restarts were fine. * Beginning of rework for individual check updates. Adds `Actor lastCheck` to PlayState to allow assigning of last actor to give an item. This allows precise tracking of GS, freestanding PoH, etc. Works for chests too. Currently does not work for shops, unknown for normal NPC gives. Doesn't track last gives for non-checks, like drops from grass, pots, crates, etc. * Actor-based checks fully fleshed out, but can't help with sale-based checks. Implemented `pendingSaleCheck` to back out of an RC check cycle if `gSaveContext->pendingSale` is not NONE when `OnItemReceive` is called, processed through `OnSaleEnd`. This should be the final change necessary to streamline the checks. * Temporary hook to message box close to tie in trackers for non-gs/chest actors that aren't added to `GetCheckFromActor`. This triggers a 2-frame countdown to check with `HasItemBeenCollected` since half of the methods in there aren't updated until after a text box closes. Added scene tracking to get last scene so that checks in scenes that span several overworld areas could be tied to their areas properly. Modified tracker data creation to apply Link's Pocket and Song from Impa conditionally based on randomizer settings instead of just being assumed to be done. May need modification for checking click and drag spoiler loading. Removed the scene equivalence check from CheckChecks so that an entire area is checked each time to avoid issues with, e.g., leaving a shop before a pending sale finishes. * Changed check data creation to use RSKs from gRandomizer to account for settings loaded from drag and drop spoilers. * Beginning of tracker code organization. Changed check color defaults. * Reverted moving tracker colors to header. Some individual check fixes. * Missed something from previous merge? * Removed last remnant of removed performance mode. * Better handle checking when skullsanity is off. * Song checks sceneIDs don't match the scenes they're actually in for some reason. Removed that check. * SaleEnd checks don't need the GetItemEntry parameter. Also set a flag that should prevent the check tracker from running during vanilla saves should that not be resolved by the time it's merged. * Attempting to have only the relevant checks added to the tracker data, as well as showing vanilla checks for non-rando saves. Not working yet (everything is displayed in vanilla). * Added vanilla check tracker population via `vanillaCheck` bool in `RandomizerCheckObject`. This is also added to `IsVisibleInImGui` to handle file loading and saving to eliminate checks that aren't part of vanilla or the rando seed. Implemented deleted tracker data file recreation. Added some extra item name text checks. Songs are still... tricky, so they stay blank. Utilize local copies of the randomizer check objects that are applicable for performance purposes. Fixed vanilla item-giving cutscene crashes when triggered mid-transition. * Apparently not all toolchains can handle macro instantiation without all parameters, like VS can. * Fixed scummed detail color not showing properly on tracker. * Fixed dungeon area totals and GS checks not functioning properly. * Major revamp of checking code. Doesn't rely on `GetCheckFromActor` at all anymore, but instead simply sets a flag to evaluate a number of checks in an area every frame until the check that was gotten is identified. With the new setup, it's much less hardware intensive, and at 60fps 6 checks per frame shows no noticeable effect on framerate. I can envision needing to add a collectedCount in order to account for times when two checks are gotten one right after the other. Changed area scroll to happen from `OnTransitionEnd`, and allow for scrolling in bazaar (was disabled previously because it would jump back and forth between Kak and Market while you were in one). Also setup area check order updating by area instead of all at the same time. * Fixed shooting gallery not reporting proper area. Prevent checks from actually happening if area is RCAREA_INVALID, now that all areas are reporting something if they have checks. Fixed `GetCheckArea()` not updating checks for standard scenes. Lots of vanilla tracking updates, mainly manual checks for gems, medallions and songs, since the often don't have proper scenes in the data. Prevent vanilla from triggering check loops if junk items are collected. Fixed sorting based on saved vs collected. Prevent item name display for vanilla runs. Change coloring of checks so the check name reflects status in vanilla runs. * Fixed "Recheck Area" button erroneously adding to an area's check totals? * Fix DMC vanilla checks. * Fix check tracker data recreation on data file loss. Removed redundant file exists check from SaveTrackerDataHook, as it doesn't matter if it exists or not at that point. Limited check loops to 3 to avoid infinite check loops on non-check/junk item pickup. Added more checks to disable tracker operations if a save is not running. Changed check ordering to put boss reward and heart container checks at the end of whatever RCSHOW group they belong to. * Fixed IsRunning calculation. Further improving vanilla checking. Starting framework for checking medallions, stones, and songs on data file recreation. Fixed medallion check collection. Added GIFT_FROM_SAGES to check list for vanilla file for tracking light medallion. Added check loop limitation to prevent infinite checking after picking up junk item from the ground. * Finished vanilla file recreation and recheck (songs and dungeon rewards all check properly now). This includes deku shield with KF shop item 3. Finished Gift from Raoru light medallion tracking for vanilla. Commented all CheckByScene functionality for now. * Fixed new save data file creation. Disabled entrance area calculation for now, as it only tracks the previous entrance for some reason. Fixed area detection for ToT checks. * GetCheckArea() now utilizes EntranceData almost exclusively, via either `gSaveContext.entranceIndex` or the entrance tracker's `currentGrottoId` in the case of grottos. This also means that EVERYTHING CAN AUTOSCROLL NOW. Entrance shuffles are now much easier to track. Autoscroll is now also triggered on save, just in case someone isn't autosaving and has a lot of checks that get converted to saved. * Fixed missing GS check in LW. * Added area scroll on toggling Show Hidden Items. May configure differently later. Fixed area detection for entrances in Gerudo Fortress/Valley and Collossus. Haunted wasteland doesn't autoscroll due to a bug in `OnTransitionEnd` hook, but checks still evaluate properly there. Rely on scene-based area detection if scene is a main overworld or dungeon scene. * Fixed grotto detection when shuffle is off. * Small code cleanup. Fixed Colossus hand chest checks. * Missing lus bump from merge conflict resolution * Fixed Colossus Grotto making `GetCheckArea` return Wasteland. * Improved OnItemReceive processing for non-token GS checks, since they can sometimes take long enough for the checking process to time out before the item is registered as received. * First attempt at thread safety for tracker data file writing. Seems to work, but might need more testing. * Fixed Recheck Area not unskipping items that register as saved. Improved delayed saving with autosaving, as the autosave triggered quite often before the tracker data save, making things not properly register as saved. * merge cleanup * Converted check tracker data to the sectional saves, adding `CheckTrackerData` to `SaveContext`. Implemented section ID returning and fullSave boolean passing to section functions from my PR temporarily for it to work properly. Moved `RandomizerCheckTrackerData` enum to `randomizerTypes.h` to accommodate that. Changed `Randomizer_SaveInit` to a `SaveManager::InitFunc` to allow for other randomizer-dependent sections to be initialized after that. Required a little refactoring to maintain intro cutscene skip when starting a randomizer file. * Revert section index return and randomizer init changes. Will need to wait on yet more changes to main. * Fixed check tracker initialization (shouldn't be tied to window initialization), restored saving/loading functionality. * Removed `CheckTracker::Init` and put SaveManager calls in `CheckTrackerWindow::InitElement`. Also a bit of cleanup from transition back to save file use. * Fixed tracker displaying check categories while file not loaded. * Fix Darunia's Joy check not marking in vanilla. * Fix autosave not triggering change from collected to saved in tracker data. * Changed default colors for scummed and collected display. * Merge upgrade code cleanup. * Add `OnTransitionEnd` calls to sandstorm transitions both to and from Wasteland. Also improved `gSaveContext.lastScene` assignment for both transition types. Allowed a bit of cleanup in `GetCheckArea`. * Added `StateButton`, a button like `ArrowButton` but that allows text instead of arrow icons. Apparently the changes from ArrowButton to StateButton happened in a previous commit... * Changed section name to `trackerDataCheck` to force SoH to load it after the randomizer section, as it required some randoSettings to be loaded first, and nothing else I tried to make the randomizer section load before it worked. This hacks a solution to checks not displaying on fast file load to a specific slot. F*** you, SaveManager, and f*** you too, JSON. * Forgot to change the section string for loading with the name change. * Fix check ordering for checks that trigger the autosave. * Adds option to remove right-side shop items (slots 1-4) from the tracker list. Enabled by default. * Fix default state of Hide Shop Right Checks checkbox. * Fixes grotto and great fairy scrolling and checks. Fixes array overflow from `checkTrackerData` which was creating the issue trying to load the base and randomizer sections first, among other things. That also fixed the massive file loads that were being exhibited in debug mode. * Fix shooting galleries being set as collected again when being played a second time after getting the checks. * Fix Bazaar autoscroll. * Add Saria's Song to `GetCheckFromActor` and removed some limitations from the messageCloseCheck function to make that check track properly. * Fix Song from Impa check. Implemented prevention for multiple "collections" of great fairies, just in case getting the health refill would trigger it with the previous setup. * Fix ice traps on GS tokens not triggering OnItemReceive. * Complete fix for ice trap collection from GS. Add autoscroll when clicking "Expand All". * Add `OnShopSlotChange` with cursorSlot and basePrice parameters. * Fixed include in en_ossan for shop slot hook. Added registration for `OnShopSlotChange` in the tracker, storing the price in a new `price` field in `CheckTrackerData`. Added "seen" functionality to shop checks. Displays the model item name upon first entering a shop, adding the price and switching to trickName (if it's an ice trap) upon navigating to the slot in buy mode, triggered by an invisible "identified" status that mirrors "seen" in every other way. Added tooltips to most options for check tracker color picking to describe what each status actually means. * `std::format` pls * So apparently std::format just decided to break with the latest merge from develop, but fmt::format exists and works? * Removed the last vestiges of `locationsSkipped`. Other general code and formatting cleanups. Moved `IsGameRunning` to `OTRGlobals` so the item tracker could also access it. Used preceding to "fix" item and bottle display in the item tracker on startup. * Some more code cleanup. Removed "Recheck Area" button and relevant code. Backported changes to Anchor branch applicable for single-player, including making a checkAreas vector and structuring the frame by frame checks around that. Also includes fix for Silver Gauntlets and Mirror Shield check collection crash associated with those changes. Fixed Kakariko Bazaar "seen" updates. Fixed tracker window not showing on initial load like it should. * Forgot 1 formatting fix. * Removed conditions for showing Song from Impa (isn't junk under certain conditions, so should show all the time). * Fix vanilla checks, add Zelda's Letter and Malon's Egg to manual check collection. Fix autoscroll while in child stealth section. * Fix crash in Happy Mask Shop in OnSlotChange (referenced non-existent shop id in a tracker-specific enum). * General code cleanup. * Missed one reversion. * One more. * Fix column alignment in `randomizer_check_objects`. * Fix file encoding on `randomizer_check_tracker`. Again. * Fix indentation for `actualItemtrackerItemMap`. Also removed unnecessary parts of the map. * Rename `HasEqItem` to `HasEquipment`. * Slightly better indentation for `actualItemTrackerItemMap`. * Add magic bean salesman to vanilla check tracking, and genericized deku shield to trigger KF shop item 3 wherever you get the shield. Renamed `vanillaCheck` to `vanillaHundoCheck` to (supposedly) clarify the meaning of the usage. * One more rename to `vanillaCompletion` to avoid possible confusion with 100% speedrun conditions. * give me a break XD Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * Changes suggested by briaguya (rename `RandomizerCheckShow` to `Status`, unused code, newline formatting) * Remove unused `itemNames` table. * Remove `IsGameRunning` in favor of `GameInteractor::IsSaveLoaded`. * Restore anti-spoiler functionality for dungeons with dungeon maps. * Review cleanup. * Fix prices not showing for Kak bazaar items. --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com>
2023-10-04 11:03:36 -04:00
return false;
}
Check Tracker Update (#2668) * Initial commit. What works so far: Data file loads, saves, deletes, and is created properly. - Need to run `HasItemBeenCollected` when creating in case of mid-seed regen. Organized checks into maps set by area. Areas show in tracker. - Checks pulled from checkObjectsByArea are not currently listed. - Areas are being assumed completed and hidden at the start. * Checks now populate. Still not counting area totals properly. * Don't track RC_LINKS_POCKET in the data file, and instead manually add it in every time a save is load. rcObjects doesn't contain Link's Pocket location (duh). * Moved ItemReceive hook to randomizer_check_tracker.cpp. Skipped items are properly sorted and formatted. Saved items contribute to an area's gotten/skipped checks on load. Changed skipped items default main color to gray. General code cleanup. * Skipped checks now contribute to area totals for area completion logic. * Mid-menu rework transfer. * Started check lookup on item receive. Tried to enable scum checking on save. * Fixed scum check on save. * More code cleanup, which revealed some issues with loading and saving. Loading now works 100%, but entries in checkTrackerData are disappearing in code somewhere, causing issues with later checks. Scummed color now displays properly. Collected but unsaved displays properly. Unchecked, Skipped, Seen and Scummed checks all have arrows for skipping/unskipping. Counts a little messed up, probably double adding skips. * Fixed item counts being off across resets. Restarts were fine. * Beginning of rework for individual check updates. Adds `Actor lastCheck` to PlayState to allow assigning of last actor to give an item. This allows precise tracking of GS, freestanding PoH, etc. Works for chests too. Currently does not work for shops, unknown for normal NPC gives. Doesn't track last gives for non-checks, like drops from grass, pots, crates, etc. * Actor-based checks fully fleshed out, but can't help with sale-based checks. Implemented `pendingSaleCheck` to back out of an RC check cycle if `gSaveContext->pendingSale` is not NONE when `OnItemReceive` is called, processed through `OnSaleEnd`. This should be the final change necessary to streamline the checks. * Temporary hook to message box close to tie in trackers for non-gs/chest actors that aren't added to `GetCheckFromActor`. This triggers a 2-frame countdown to check with `HasItemBeenCollected` since half of the methods in there aren't updated until after a text box closes. Added scene tracking to get last scene so that checks in scenes that span several overworld areas could be tied to their areas properly. Modified tracker data creation to apply Link's Pocket and Song from Impa conditionally based on randomizer settings instead of just being assumed to be done. May need modification for checking click and drag spoiler loading. Removed the scene equivalence check from CheckChecks so that an entire area is checked each time to avoid issues with, e.g., leaving a shop before a pending sale finishes. * Changed check data creation to use RSKs from gRandomizer to account for settings loaded from drag and drop spoilers. * Beginning of tracker code organization. Changed check color defaults. * Reverted moving tracker colors to header. Some individual check fixes. * Missed something from previous merge? * Removed last remnant of removed performance mode. * Better handle checking when skullsanity is off. * Song checks sceneIDs don't match the scenes they're actually in for some reason. Removed that check. * SaleEnd checks don't need the GetItemEntry parameter. Also set a flag that should prevent the check tracker from running during vanilla saves should that not be resolved by the time it's merged. * Attempting to have only the relevant checks added to the tracker data, as well as showing vanilla checks for non-rando saves. Not working yet (everything is displayed in vanilla). * Added vanilla check tracker population via `vanillaCheck` bool in `RandomizerCheckObject`. This is also added to `IsVisibleInImGui` to handle file loading and saving to eliminate checks that aren't part of vanilla or the rando seed. Implemented deleted tracker data file recreation. Added some extra item name text checks. Songs are still... tricky, so they stay blank. Utilize local copies of the randomizer check objects that are applicable for performance purposes. Fixed vanilla item-giving cutscene crashes when triggered mid-transition. * Apparently not all toolchains can handle macro instantiation without all parameters, like VS can. * Fixed scummed detail color not showing properly on tracker. * Fixed dungeon area totals and GS checks not functioning properly. * Major revamp of checking code. Doesn't rely on `GetCheckFromActor` at all anymore, but instead simply sets a flag to evaluate a number of checks in an area every frame until the check that was gotten is identified. With the new setup, it's much less hardware intensive, and at 60fps 6 checks per frame shows no noticeable effect on framerate. I can envision needing to add a collectedCount in order to account for times when two checks are gotten one right after the other. Changed area scroll to happen from `OnTransitionEnd`, and allow for scrolling in bazaar (was disabled previously because it would jump back and forth between Kak and Market while you were in one). Also setup area check order updating by area instead of all at the same time. * Fixed shooting gallery not reporting proper area. Prevent checks from actually happening if area is RCAREA_INVALID, now that all areas are reporting something if they have checks. Fixed `GetCheckArea()` not updating checks for standard scenes. Lots of vanilla tracking updates, mainly manual checks for gems, medallions and songs, since the often don't have proper scenes in the data. Prevent vanilla from triggering check loops if junk items are collected. Fixed sorting based on saved vs collected. Prevent item name display for vanilla runs. Change coloring of checks so the check name reflects status in vanilla runs. * Fixed "Recheck Area" button erroneously adding to an area's check totals? * Fix DMC vanilla checks. * Fix check tracker data recreation on data file loss. Removed redundant file exists check from SaveTrackerDataHook, as it doesn't matter if it exists or not at that point. Limited check loops to 3 to avoid infinite check loops on non-check/junk item pickup. Added more checks to disable tracker operations if a save is not running. Changed check ordering to put boss reward and heart container checks at the end of whatever RCSHOW group they belong to. * Fixed IsRunning calculation. Further improving vanilla checking. Starting framework for checking medallions, stones, and songs on data file recreation. Fixed medallion check collection. Added GIFT_FROM_SAGES to check list for vanilla file for tracking light medallion. Added check loop limitation to prevent infinite checking after picking up junk item from the ground. * Finished vanilla file recreation and recheck (songs and dungeon rewards all check properly now). This includes deku shield with KF shop item 3. Finished Gift from Raoru light medallion tracking for vanilla. Commented all CheckByScene functionality for now. * Fixed new save data file creation. Disabled entrance area calculation for now, as it only tracks the previous entrance for some reason. Fixed area detection for ToT checks. * GetCheckArea() now utilizes EntranceData almost exclusively, via either `gSaveContext.entranceIndex` or the entrance tracker's `currentGrottoId` in the case of grottos. This also means that EVERYTHING CAN AUTOSCROLL NOW. Entrance shuffles are now much easier to track. Autoscroll is now also triggered on save, just in case someone isn't autosaving and has a lot of checks that get converted to saved. * Fixed missing GS check in LW. * Added area scroll on toggling Show Hidden Items. May configure differently later. Fixed area detection for entrances in Gerudo Fortress/Valley and Collossus. Haunted wasteland doesn't autoscroll due to a bug in `OnTransitionEnd` hook, but checks still evaluate properly there. Rely on scene-based area detection if scene is a main overworld or dungeon scene. * Fixed grotto detection when shuffle is off. * Small code cleanup. Fixed Colossus hand chest checks. * Missing lus bump from merge conflict resolution * Fixed Colossus Grotto making `GetCheckArea` return Wasteland. * Improved OnItemReceive processing for non-token GS checks, since they can sometimes take long enough for the checking process to time out before the item is registered as received. * First attempt at thread safety for tracker data file writing. Seems to work, but might need more testing. * Fixed Recheck Area not unskipping items that register as saved. Improved delayed saving with autosaving, as the autosave triggered quite often before the tracker data save, making things not properly register as saved. * merge cleanup * Converted check tracker data to the sectional saves, adding `CheckTrackerData` to `SaveContext`. Implemented section ID returning and fullSave boolean passing to section functions from my PR temporarily for it to work properly. Moved `RandomizerCheckTrackerData` enum to `randomizerTypes.h` to accommodate that. Changed `Randomizer_SaveInit` to a `SaveManager::InitFunc` to allow for other randomizer-dependent sections to be initialized after that. Required a little refactoring to maintain intro cutscene skip when starting a randomizer file. * Revert section index return and randomizer init changes. Will need to wait on yet more changes to main. * Fixed check tracker initialization (shouldn't be tied to window initialization), restored saving/loading functionality. * Removed `CheckTracker::Init` and put SaveManager calls in `CheckTrackerWindow::InitElement`. Also a bit of cleanup from transition back to save file use. * Fixed tracker displaying check categories while file not loaded. * Fix Darunia's Joy check not marking in vanilla. * Fix autosave not triggering change from collected to saved in tracker data. * Changed default colors for scummed and collected display. * Merge upgrade code cleanup. * Add `OnTransitionEnd` calls to sandstorm transitions both to and from Wasteland. Also improved `gSaveContext.lastScene` assignment for both transition types. Allowed a bit of cleanup in `GetCheckArea`. * Added `StateButton`, a button like `ArrowButton` but that allows text instead of arrow icons. Apparently the changes from ArrowButton to StateButton happened in a previous commit... * Changed section name to `trackerDataCheck` to force SoH to load it after the randomizer section, as it required some randoSettings to be loaded first, and nothing else I tried to make the randomizer section load before it worked. This hacks a solution to checks not displaying on fast file load to a specific slot. F*** you, SaveManager, and f*** you too, JSON. * Forgot to change the section string for loading with the name change. * Fix check ordering for checks that trigger the autosave. * Adds option to remove right-side shop items (slots 1-4) from the tracker list. Enabled by default. * Fix default state of Hide Shop Right Checks checkbox. * Fixes grotto and great fairy scrolling and checks. Fixes array overflow from `checkTrackerData` which was creating the issue trying to load the base and randomizer sections first, among other things. That also fixed the massive file loads that were being exhibited in debug mode. * Fix shooting galleries being set as collected again when being played a second time after getting the checks. * Fix Bazaar autoscroll. * Add Saria's Song to `GetCheckFromActor` and removed some limitations from the messageCloseCheck function to make that check track properly. * Fix Song from Impa check. Implemented prevention for multiple "collections" of great fairies, just in case getting the health refill would trigger it with the previous setup. * Fix ice traps on GS tokens not triggering OnItemReceive. * Complete fix for ice trap collection from GS. Add autoscroll when clicking "Expand All". * Add `OnShopSlotChange` with cursorSlot and basePrice parameters. * Fixed include in en_ossan for shop slot hook. Added registration for `OnShopSlotChange` in the tracker, storing the price in a new `price` field in `CheckTrackerData`. Added "seen" functionality to shop checks. Displays the model item name upon first entering a shop, adding the price and switching to trickName (if it's an ice trap) upon navigating to the slot in buy mode, triggered by an invisible "identified" status that mirrors "seen" in every other way. Added tooltips to most options for check tracker color picking to describe what each status actually means. * `std::format` pls * So apparently std::format just decided to break with the latest merge from develop, but fmt::format exists and works? * Removed the last vestiges of `locationsSkipped`. Other general code and formatting cleanups. Moved `IsGameRunning` to `OTRGlobals` so the item tracker could also access it. Used preceding to "fix" item and bottle display in the item tracker on startup. * Some more code cleanup. Removed "Recheck Area" button and relevant code. Backported changes to Anchor branch applicable for single-player, including making a checkAreas vector and structuring the frame by frame checks around that. Also includes fix for Silver Gauntlets and Mirror Shield check collection crash associated with those changes. Fixed Kakariko Bazaar "seen" updates. Fixed tracker window not showing on initial load like it should. * Forgot 1 formatting fix. * Removed conditions for showing Song from Impa (isn't junk under certain conditions, so should show all the time). * Fix vanilla checks, add Zelda's Letter and Malon's Egg to manual check collection. Fix autoscroll while in child stealth section. * Fix crash in Happy Mask Shop in OnSlotChange (referenced non-existent shop id in a tracker-specific enum). * General code cleanup. * Missed one reversion. * One more. * Fix column alignment in `randomizer_check_objects`. * Fix file encoding on `randomizer_check_tracker`. Again. * Fix indentation for `actualItemtrackerItemMap`. Also removed unnecessary parts of the map. * Rename `HasEqItem` to `HasEquipment`. * Slightly better indentation for `actualItemTrackerItemMap`. * Add magic bean salesman to vanilla check tracking, and genericized deku shield to trigger KF shop item 3 wherever you get the shield. Renamed `vanillaCheck` to `vanillaHundoCheck` to (supposedly) clarify the meaning of the usage. * One more rename to `vanillaCompletion` to avoid possible confusion with 100% speedrun conditions. * give me a break XD Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * Changes suggested by briaguya (rename `RandomizerCheckShow` to `Status`, unused code, newline formatting) * Remove unused `itemNames` table. * Remove `IsGameRunning` in favor of `GameInteractor::IsSaveLoaded`. * Restore anti-spoiler functionality for dungeons with dungeon maps. * Review cleanup. * Fix prices not showing for Kak bazaar items. --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com>
2023-10-04 11:03:36 -04:00
if (!IsEoDCheck(i.rcType) && IsEoDCheck(j.rcType)) {
Check Tracker Update (#2668) * Initial commit. What works so far: Data file loads, saves, deletes, and is created properly. - Need to run `HasItemBeenCollected` when creating in case of mid-seed regen. Organized checks into maps set by area. Areas show in tracker. - Checks pulled from checkObjectsByArea are not currently listed. - Areas are being assumed completed and hidden at the start. * Checks now populate. Still not counting area totals properly. * Don't track RC_LINKS_POCKET in the data file, and instead manually add it in every time a save is load. rcObjects doesn't contain Link's Pocket location (duh). * Moved ItemReceive hook to randomizer_check_tracker.cpp. Skipped items are properly sorted and formatted. Saved items contribute to an area's gotten/skipped checks on load. Changed skipped items default main color to gray. General code cleanup. * Skipped checks now contribute to area totals for area completion logic. * Mid-menu rework transfer. * Started check lookup on item receive. Tried to enable scum checking on save. * Fixed scum check on save. * More code cleanup, which revealed some issues with loading and saving. Loading now works 100%, but entries in checkTrackerData are disappearing in code somewhere, causing issues with later checks. Scummed color now displays properly. Collected but unsaved displays properly. Unchecked, Skipped, Seen and Scummed checks all have arrows for skipping/unskipping. Counts a little messed up, probably double adding skips. * Fixed item counts being off across resets. Restarts were fine. * Beginning of rework for individual check updates. Adds `Actor lastCheck` to PlayState to allow assigning of last actor to give an item. This allows precise tracking of GS, freestanding PoH, etc. Works for chests too. Currently does not work for shops, unknown for normal NPC gives. Doesn't track last gives for non-checks, like drops from grass, pots, crates, etc. * Actor-based checks fully fleshed out, but can't help with sale-based checks. Implemented `pendingSaleCheck` to back out of an RC check cycle if `gSaveContext->pendingSale` is not NONE when `OnItemReceive` is called, processed through `OnSaleEnd`. This should be the final change necessary to streamline the checks. * Temporary hook to message box close to tie in trackers for non-gs/chest actors that aren't added to `GetCheckFromActor`. This triggers a 2-frame countdown to check with `HasItemBeenCollected` since half of the methods in there aren't updated until after a text box closes. Added scene tracking to get last scene so that checks in scenes that span several overworld areas could be tied to their areas properly. Modified tracker data creation to apply Link's Pocket and Song from Impa conditionally based on randomizer settings instead of just being assumed to be done. May need modification for checking click and drag spoiler loading. Removed the scene equivalence check from CheckChecks so that an entire area is checked each time to avoid issues with, e.g., leaving a shop before a pending sale finishes. * Changed check data creation to use RSKs from gRandomizer to account for settings loaded from drag and drop spoilers. * Beginning of tracker code organization. Changed check color defaults. * Reverted moving tracker colors to header. Some individual check fixes. * Missed something from previous merge? * Removed last remnant of removed performance mode. * Better handle checking when skullsanity is off. * Song checks sceneIDs don't match the scenes they're actually in for some reason. Removed that check. * SaleEnd checks don't need the GetItemEntry parameter. Also set a flag that should prevent the check tracker from running during vanilla saves should that not be resolved by the time it's merged. * Attempting to have only the relevant checks added to the tracker data, as well as showing vanilla checks for non-rando saves. Not working yet (everything is displayed in vanilla). * Added vanilla check tracker population via `vanillaCheck` bool in `RandomizerCheckObject`. This is also added to `IsVisibleInImGui` to handle file loading and saving to eliminate checks that aren't part of vanilla or the rando seed. Implemented deleted tracker data file recreation. Added some extra item name text checks. Songs are still... tricky, so they stay blank. Utilize local copies of the randomizer check objects that are applicable for performance purposes. Fixed vanilla item-giving cutscene crashes when triggered mid-transition. * Apparently not all toolchains can handle macro instantiation without all parameters, like VS can. * Fixed scummed detail color not showing properly on tracker. * Fixed dungeon area totals and GS checks not functioning properly. * Major revamp of checking code. Doesn't rely on `GetCheckFromActor` at all anymore, but instead simply sets a flag to evaluate a number of checks in an area every frame until the check that was gotten is identified. With the new setup, it's much less hardware intensive, and at 60fps 6 checks per frame shows no noticeable effect on framerate. I can envision needing to add a collectedCount in order to account for times when two checks are gotten one right after the other. Changed area scroll to happen from `OnTransitionEnd`, and allow for scrolling in bazaar (was disabled previously because it would jump back and forth between Kak and Market while you were in one). Also setup area check order updating by area instead of all at the same time. * Fixed shooting gallery not reporting proper area. Prevent checks from actually happening if area is RCAREA_INVALID, now that all areas are reporting something if they have checks. Fixed `GetCheckArea()` not updating checks for standard scenes. Lots of vanilla tracking updates, mainly manual checks for gems, medallions and songs, since the often don't have proper scenes in the data. Prevent vanilla from triggering check loops if junk items are collected. Fixed sorting based on saved vs collected. Prevent item name display for vanilla runs. Change coloring of checks so the check name reflects status in vanilla runs. * Fixed "Recheck Area" button erroneously adding to an area's check totals? * Fix DMC vanilla checks. * Fix check tracker data recreation on data file loss. Removed redundant file exists check from SaveTrackerDataHook, as it doesn't matter if it exists or not at that point. Limited check loops to 3 to avoid infinite check loops on non-check/junk item pickup. Added more checks to disable tracker operations if a save is not running. Changed check ordering to put boss reward and heart container checks at the end of whatever RCSHOW group they belong to. * Fixed IsRunning calculation. Further improving vanilla checking. Starting framework for checking medallions, stones, and songs on data file recreation. Fixed medallion check collection. Added GIFT_FROM_SAGES to check list for vanilla file for tracking light medallion. Added check loop limitation to prevent infinite checking after picking up junk item from the ground. * Finished vanilla file recreation and recheck (songs and dungeon rewards all check properly now). This includes deku shield with KF shop item 3. Finished Gift from Raoru light medallion tracking for vanilla. Commented all CheckByScene functionality for now. * Fixed new save data file creation. Disabled entrance area calculation for now, as it only tracks the previous entrance for some reason. Fixed area detection for ToT checks. * GetCheckArea() now utilizes EntranceData almost exclusively, via either `gSaveContext.entranceIndex` or the entrance tracker's `currentGrottoId` in the case of grottos. This also means that EVERYTHING CAN AUTOSCROLL NOW. Entrance shuffles are now much easier to track. Autoscroll is now also triggered on save, just in case someone isn't autosaving and has a lot of checks that get converted to saved. * Fixed missing GS check in LW. * Added area scroll on toggling Show Hidden Items. May configure differently later. Fixed area detection for entrances in Gerudo Fortress/Valley and Collossus. Haunted wasteland doesn't autoscroll due to a bug in `OnTransitionEnd` hook, but checks still evaluate properly there. Rely on scene-based area detection if scene is a main overworld or dungeon scene. * Fixed grotto detection when shuffle is off. * Small code cleanup. Fixed Colossus hand chest checks. * Missing lus bump from merge conflict resolution * Fixed Colossus Grotto making `GetCheckArea` return Wasteland. * Improved OnItemReceive processing for non-token GS checks, since they can sometimes take long enough for the checking process to time out before the item is registered as received. * First attempt at thread safety for tracker data file writing. Seems to work, but might need more testing. * Fixed Recheck Area not unskipping items that register as saved. Improved delayed saving with autosaving, as the autosave triggered quite often before the tracker data save, making things not properly register as saved. * merge cleanup * Converted check tracker data to the sectional saves, adding `CheckTrackerData` to `SaveContext`. Implemented section ID returning and fullSave boolean passing to section functions from my PR temporarily for it to work properly. Moved `RandomizerCheckTrackerData` enum to `randomizerTypes.h` to accommodate that. Changed `Randomizer_SaveInit` to a `SaveManager::InitFunc` to allow for other randomizer-dependent sections to be initialized after that. Required a little refactoring to maintain intro cutscene skip when starting a randomizer file. * Revert section index return and randomizer init changes. Will need to wait on yet more changes to main. * Fixed check tracker initialization (shouldn't be tied to window initialization), restored saving/loading functionality. * Removed `CheckTracker::Init` and put SaveManager calls in `CheckTrackerWindow::InitElement`. Also a bit of cleanup from transition back to save file use. * Fixed tracker displaying check categories while file not loaded. * Fix Darunia's Joy check not marking in vanilla. * Fix autosave not triggering change from collected to saved in tracker data. * Changed default colors for scummed and collected display. * Merge upgrade code cleanup. * Add `OnTransitionEnd` calls to sandstorm transitions both to and from Wasteland. Also improved `gSaveContext.lastScene` assignment for both transition types. Allowed a bit of cleanup in `GetCheckArea`. * Added `StateButton`, a button like `ArrowButton` but that allows text instead of arrow icons. Apparently the changes from ArrowButton to StateButton happened in a previous commit... * Changed section name to `trackerDataCheck` to force SoH to load it after the randomizer section, as it required some randoSettings to be loaded first, and nothing else I tried to make the randomizer section load before it worked. This hacks a solution to checks not displaying on fast file load to a specific slot. F*** you, SaveManager, and f*** you too, JSON. * Forgot to change the section string for loading with the name change. * Fix check ordering for checks that trigger the autosave. * Adds option to remove right-side shop items (slots 1-4) from the tracker list. Enabled by default. * Fix default state of Hide Shop Right Checks checkbox. * Fixes grotto and great fairy scrolling and checks. Fixes array overflow from `checkTrackerData` which was creating the issue trying to load the base and randomizer sections first, among other things. That also fixed the massive file loads that were being exhibited in debug mode. * Fix shooting galleries being set as collected again when being played a second time after getting the checks. * Fix Bazaar autoscroll. * Add Saria's Song to `GetCheckFromActor` and removed some limitations from the messageCloseCheck function to make that check track properly. * Fix Song from Impa check. Implemented prevention for multiple "collections" of great fairies, just in case getting the health refill would trigger it with the previous setup. * Fix ice traps on GS tokens not triggering OnItemReceive. * Complete fix for ice trap collection from GS. Add autoscroll when clicking "Expand All". * Add `OnShopSlotChange` with cursorSlot and basePrice parameters. * Fixed include in en_ossan for shop slot hook. Added registration for `OnShopSlotChange` in the tracker, storing the price in a new `price` field in `CheckTrackerData`. Added "seen" functionality to shop checks. Displays the model item name upon first entering a shop, adding the price and switching to trickName (if it's an ice trap) upon navigating to the slot in buy mode, triggered by an invisible "identified" status that mirrors "seen" in every other way. Added tooltips to most options for check tracker color picking to describe what each status actually means. * `std::format` pls * So apparently std::format just decided to break with the latest merge from develop, but fmt::format exists and works? * Removed the last vestiges of `locationsSkipped`. Other general code and formatting cleanups. Moved `IsGameRunning` to `OTRGlobals` so the item tracker could also access it. Used preceding to "fix" item and bottle display in the item tracker on startup. * Some more code cleanup. Removed "Recheck Area" button and relevant code. Backported changes to Anchor branch applicable for single-player, including making a checkAreas vector and structuring the frame by frame checks around that. Also includes fix for Silver Gauntlets and Mirror Shield check collection crash associated with those changes. Fixed Kakariko Bazaar "seen" updates. Fixed tracker window not showing on initial load like it should. * Forgot 1 formatting fix. * Removed conditions for showing Song from Impa (isn't junk under certain conditions, so should show all the time). * Fix vanilla checks, add Zelda's Letter and Malon's Egg to manual check collection. Fix autoscroll while in child stealth section. * Fix crash in Happy Mask Shop in OnSlotChange (referenced non-existent shop id in a tracker-specific enum). * General code cleanup. * Missed one reversion. * One more. * Fix column alignment in `randomizer_check_objects`. * Fix file encoding on `randomizer_check_tracker`. Again. * Fix indentation for `actualItemtrackerItemMap`. Also removed unnecessary parts of the map. * Rename `HasEqItem` to `HasEquipment`. * Slightly better indentation for `actualItemTrackerItemMap`. * Add magic bean salesman to vanilla check tracking, and genericized deku shield to trigger KF shop item 3 wherever you get the shield. Renamed `vanillaCheck` to `vanillaHundoCheck` to (supposedly) clarify the meaning of the usage. * One more rename to `vanillaCompletion` to avoid possible confusion with 100% speedrun conditions. * give me a break XD Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * Changes suggested by briaguya (rename `RandomizerCheckShow` to `Status`, unused code, newline formatting) * Remove unused `itemNames` table. * Remove `IsGameRunning` in favor of `GameInteractor::IsSaveLoaded`. * Restore anti-spoiler functionality for dungeons with dungeon maps. * Review cleanup. * Fix prices not showing for Kak bazaar items. --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com>
2023-10-04 11:03:36 -04:00
return true;
} else if (IsEoDCheck(i.rcType) && !IsEoDCheck(j.rcType)) {
Randomizer Auto Location tracker (#1942) * Initial Auto-Location Tracking * Updates styling for checked items in Check Tracker * Fixes crashing issues with Check Tracker rendering * Auto scroll Check Tracker windows to current area * Checks Tracker only shows checked locations once in game * Fixes issue where Check Tracker would auto-scroll to wrong location when entering a grotto * Fixes gerudo fortress checks showing in tracker when settings have them removed * InfTable Check Location Fixes: Lost Dog Richard, Rolling Gorons, HBA 1000, Thawed Zora * Fixes most Event Chk Inf Checks on Check Tracker, and Frogs * Check Tracker - Song from Malon now works * Check Tracker - Fixes Claim Check check not tracking - Fixes spoiler for Claim Check check when getting Biggoron's Sword - Fixes LACS being spoiled and not tracking * Check Tracker - Fixes #2 for Skull Mask and Mask of Truth checks * Check Tracker - Adds support for merchants - Fixes #7 for Bomchu Salesman - Fixes #12 for Medigoron * Check Tracker - Fixes #8 for Song from Saria * Check Tracker - Fixes #9 for Adult Shooting Gallery * Check Tracker - Fixes #10 for Composer Grave * Check Tracker - Fixes #14 for Song from Ocarina of Time * Check Tracker - Fixes #16 for Shooting the Sun * Check Tracker - Fixes #19 for Darunia's Joy * Save Editor - Adds missing label for Treasure Chest Game * Check Tracker - Fixes Great Faries checks * Check Tracker - Fixes Sheik at Temple * Check Tracker - Fixes Great Fairy auto-scroll to wrong location * Check Tracker - Updates blue warp checks - Fixes Bongo Bongo and Twinrova checks * Check Tracker - Fixes Dampe's Gravedigging Tour * Check Tracker - Fixes Prescription to King Zora * Check Tracker - Fixes Bazaar showing under wrong area on tracker between adult/child * Check Tracker - Fixes scroll for Hyrule Market and Bazaar * Check Tracker - Fixes giving Adult Trade Items shown on tracker: Broken Sword, Saw, Cojiro, Eyeball Froge, and Eyedrops * Cleans up item_location * Check Tracker - Item List - Fixes item list not updating when changing seeds/options - Separates item exclusion list from item check list - Clean up comments * Check Tracker - Adds Skip functionality to buttons * Check Tracker - Refactors adult trade items to RandomizerInf * Check Tracker - Fixes an issue where any time an item is removed the tracker would cause an application crash * Check Tracker - Item names are now dependent on file language * Check Tracker - Fixes Gerudo Card check not showing in Fast setting * Reorders headers to (hopefully) avoid CI build conflicts on linux/consoles * Explicitly defines vector header in randomizer.h to fix compile errors * Complete Refactor of Check Tracker ImGui * Adds missing check tracker files to CMakeLists * Reverts the Item_location whitespace cleanup from ad10807c * Check Tracker - Loading Fixes - Fixes a bug where loading a save file a second time would add all the checks again - Fixes a bug where the check tracker would not render at all until in a save file * Check Tracker - Fixes a bug where checks would sometimes fail to load * Check Tracker - Fixes duplicated checks when using Only on Pause or Only on Combo * Check Tracker - Works around issue where single characters don't show in EnhancementCombobox, and fixes a label for combo buttons held option * Check Tracker - Applies all Check Tracker changes to Item Location * Check Tracker - Updated Check List - Adds Link's pocket, either in KF or HM depending on starting age - Supports Scrubs and Merchants - Uses enums instead of magic numbers - Updates DC Scrub Short Names for MQ * Check Tracker - Adds a performance mode option * Check Tracker - List Fixes (requires new rando generation) - Fixes Frogs Rupees always visible - Fixes Kokiri Sword Chest not showing - Fixes Weird Egg not showing * Check Tracker - MQ List basic support * Check Tracker - MQ/Vanilla anti-spoilers * Check Tracker - Collecting a compass now spoils the area * Check Tracker - Basic Vanilla Support and fixes - Vanilla items show in check tracker, even if many won't auto check - Fixes an issue with Gerudo Fortress Keys - Refactors IsVisibleInCheckTracker to randomizer_check_tracjer * Check Tracker - Fixes merge conflict from 08a487f35e1d760ab9e69b932edbe4da6bcd9edb * Check Tracker - Fixes tracker loading as Floating when default value is set to Windowed * Randomizer Location Exclusion List - Adds Scrubs, Merchants, Shops. Adult Trade items, MQ Dungeons, and Bean Salesman - Fixes Kokiri Sword Chest, Weird Egg, and Frog Song Rupees from misbehaving - Updates Gerudo Fortress logic to be dependent on Open/Fast/Normal Fortress - Removes Invalid Check - Adds RO Enum for MQ settings - Updates magic values to RO enum * Location Exclusion List - Scrubs that are always randomized now always show on the list * For now, removes some extra code only needed for a Check Tracker. * Randomizer Location Exclusion List - Fixes Eyeball Frog from showing up when Adult Trade Items was off * Location Tracker - Updates Eyedrops to use RandomizerInf instead of Chest * Check Tracker - Fixes a bug where Link's Pocket item wasn't acting as checked for area item count * Check Tracker - Fixes a bug where Locations would incorrectly say Vanilla due to the first check in the area being a non-MQ check * Check Tracker - Fixes a crash when Check Tracker is docked but not visible * Check Tracker - Fixes areas being spoiled when loading different save files * Check Tracker - Only reset variables if they are initialized * Check Tracker - Cleans up old comments, unused variables, methods, and macros, adds language TODOs, * Check Tracker - Readds rainbow UI elements after Cosmetics Editor refactor * Check Tracker - Removal of flag lookup that was refactored, no longer needed header, and some trivial whitespace fixes. * Check Tracker - Refactors Index to Bitmask code to a macro * Check Tracker - Changes ordering from alphabetical to RandomizerCheck ordering * Check Tracker - Wraps everything in a namespace to avoid global variable usage * Check Tracker - Explicitly defines for-loop scope * Check Tracker - refactors dungeon lookup from static array to function * Fixes a bug when using EnhancementColor with alpha * Check Tracker - Refactors all colour to use direct conversions * Check Tracker - refactors settings loading and check visibility for readability * Check Tracker - Fixes a bug where the wrong label showed on the Check Tracker BG Color * UIWidgets - Adds Alpha bar to EnhancementColor when using alpha parameter
2022-12-10 22:39:23 -05:00
return false;
}
Randomizer Auto Location tracker (#1942) * Initial Auto-Location Tracking * Updates styling for checked items in Check Tracker * Fixes crashing issues with Check Tracker rendering * Auto scroll Check Tracker windows to current area * Checks Tracker only shows checked locations once in game * Fixes issue where Check Tracker would auto-scroll to wrong location when entering a grotto * Fixes gerudo fortress checks showing in tracker when settings have them removed * InfTable Check Location Fixes: Lost Dog Richard, Rolling Gorons, HBA 1000, Thawed Zora * Fixes most Event Chk Inf Checks on Check Tracker, and Frogs * Check Tracker - Song from Malon now works * Check Tracker - Fixes Claim Check check not tracking - Fixes spoiler for Claim Check check when getting Biggoron's Sword - Fixes LACS being spoiled and not tracking * Check Tracker - Fixes #2 for Skull Mask and Mask of Truth checks * Check Tracker - Adds support for merchants - Fixes #7 for Bomchu Salesman - Fixes #12 for Medigoron * Check Tracker - Fixes #8 for Song from Saria * Check Tracker - Fixes #9 for Adult Shooting Gallery * Check Tracker - Fixes #10 for Composer Grave * Check Tracker - Fixes #14 for Song from Ocarina of Time * Check Tracker - Fixes #16 for Shooting the Sun * Check Tracker - Fixes #19 for Darunia's Joy * Save Editor - Adds missing label for Treasure Chest Game * Check Tracker - Fixes Great Faries checks * Check Tracker - Fixes Sheik at Temple * Check Tracker - Fixes Great Fairy auto-scroll to wrong location * Check Tracker - Updates blue warp checks - Fixes Bongo Bongo and Twinrova checks * Check Tracker - Fixes Dampe's Gravedigging Tour * Check Tracker - Fixes Prescription to King Zora * Check Tracker - Fixes Bazaar showing under wrong area on tracker between adult/child * Check Tracker - Fixes scroll for Hyrule Market and Bazaar * Check Tracker - Fixes giving Adult Trade Items shown on tracker: Broken Sword, Saw, Cojiro, Eyeball Froge, and Eyedrops * Cleans up item_location * Check Tracker - Item List - Fixes item list not updating when changing seeds/options - Separates item exclusion list from item check list - Clean up comments * Check Tracker - Adds Skip functionality to buttons * Check Tracker - Refactors adult trade items to RandomizerInf * Check Tracker - Fixes an issue where any time an item is removed the tracker would cause an application crash * Check Tracker - Item names are now dependent on file language * Check Tracker - Fixes Gerudo Card check not showing in Fast setting * Reorders headers to (hopefully) avoid CI build conflicts on linux/consoles * Explicitly defines vector header in randomizer.h to fix compile errors * Complete Refactor of Check Tracker ImGui * Adds missing check tracker files to CMakeLists * Reverts the Item_location whitespace cleanup from ad10807c * Check Tracker - Loading Fixes - Fixes a bug where loading a save file a second time would add all the checks again - Fixes a bug where the check tracker would not render at all until in a save file * Check Tracker - Fixes a bug where checks would sometimes fail to load * Check Tracker - Fixes duplicated checks when using Only on Pause or Only on Combo * Check Tracker - Works around issue where single characters don't show in EnhancementCombobox, and fixes a label for combo buttons held option * Check Tracker - Applies all Check Tracker changes to Item Location * Check Tracker - Updated Check List - Adds Link's pocket, either in KF or HM depending on starting age - Supports Scrubs and Merchants - Uses enums instead of magic numbers - Updates DC Scrub Short Names for MQ * Check Tracker - Adds a performance mode option * Check Tracker - List Fixes (requires new rando generation) - Fixes Frogs Rupees always visible - Fixes Kokiri Sword Chest not showing - Fixes Weird Egg not showing * Check Tracker - MQ List basic support * Check Tracker - MQ/Vanilla anti-spoilers * Check Tracker - Collecting a compass now spoils the area * Check Tracker - Basic Vanilla Support and fixes - Vanilla items show in check tracker, even if many won't auto check - Fixes an issue with Gerudo Fortress Keys - Refactors IsVisibleInCheckTracker to randomizer_check_tracjer * Check Tracker - Fixes merge conflict from 08a487f35e1d760ab9e69b932edbe4da6bcd9edb * Check Tracker - Fixes tracker loading as Floating when default value is set to Windowed * Randomizer Location Exclusion List - Adds Scrubs, Merchants, Shops. Adult Trade items, MQ Dungeons, and Bean Salesman - Fixes Kokiri Sword Chest, Weird Egg, and Frog Song Rupees from misbehaving - Updates Gerudo Fortress logic to be dependent on Open/Fast/Normal Fortress - Removes Invalid Check - Adds RO Enum for MQ settings - Updates magic values to RO enum * Location Exclusion List - Scrubs that are always randomized now always show on the list * For now, removes some extra code only needed for a Check Tracker. * Randomizer Location Exclusion List - Fixes Eyeball Frog from showing up when Adult Trade Items was off * Location Tracker - Updates Eyedrops to use RandomizerInf instead of Chest * Check Tracker - Fixes a bug where Link's Pocket item wasn't acting as checked for area item count * Check Tracker - Fixes a bug where Locations would incorrectly say Vanilla due to the first check in the area being a non-MQ check * Check Tracker - Fixes a crash when Check Tracker is docked but not visible * Check Tracker - Fixes areas being spoiled when loading different save files * Check Tracker - Only reset variables if they are initialized * Check Tracker - Cleans up old comments, unused variables, methods, and macros, adds language TODOs, * Check Tracker - Readds rainbow UI elements after Cosmetics Editor refactor * Check Tracker - Removal of flag lookup that was refactored, no longer needed header, and some trivial whitespace fixes. * Check Tracker - Refactors Index to Bitmask code to a macro * Check Tracker - Changes ordering from alphabetical to RandomizerCheck ordering * Check Tracker - Wraps everything in a namespace to avoid global variable usage * Check Tracker - Explicitly defines for-loop scope * Check Tracker - refactors dungeon lookup from static array to function * Fixes a bug when using EnhancementColor with alpha * Check Tracker - Refactors all colour to use direct conversions * Check Tracker - refactors settings loading and check visibility for readability * Check Tracker - Fixes a bug where the wrong label showed on the Check Tracker BG Color * UIWidgets - Adds Alpha bar to EnhancementColor when using alpha parameter
2022-12-10 22:39:23 -05:00
if (i.rc < j.rc) {
Randomizer Auto Location tracker (#1942) * Initial Auto-Location Tracking * Updates styling for checked items in Check Tracker * Fixes crashing issues with Check Tracker rendering * Auto scroll Check Tracker windows to current area * Checks Tracker only shows checked locations once in game * Fixes issue where Check Tracker would auto-scroll to wrong location when entering a grotto * Fixes gerudo fortress checks showing in tracker when settings have them removed * InfTable Check Location Fixes: Lost Dog Richard, Rolling Gorons, HBA 1000, Thawed Zora * Fixes most Event Chk Inf Checks on Check Tracker, and Frogs * Check Tracker - Song from Malon now works * Check Tracker - Fixes Claim Check check not tracking - Fixes spoiler for Claim Check check when getting Biggoron's Sword - Fixes LACS being spoiled and not tracking * Check Tracker - Fixes #2 for Skull Mask and Mask of Truth checks * Check Tracker - Adds support for merchants - Fixes #7 for Bomchu Salesman - Fixes #12 for Medigoron * Check Tracker - Fixes #8 for Song from Saria * Check Tracker - Fixes #9 for Adult Shooting Gallery * Check Tracker - Fixes #10 for Composer Grave * Check Tracker - Fixes #14 for Song from Ocarina of Time * Check Tracker - Fixes #16 for Shooting the Sun * Check Tracker - Fixes #19 for Darunia's Joy * Save Editor - Adds missing label for Treasure Chest Game * Check Tracker - Fixes Great Faries checks * Check Tracker - Fixes Sheik at Temple * Check Tracker - Fixes Great Fairy auto-scroll to wrong location * Check Tracker - Updates blue warp checks - Fixes Bongo Bongo and Twinrova checks * Check Tracker - Fixes Dampe's Gravedigging Tour * Check Tracker - Fixes Prescription to King Zora * Check Tracker - Fixes Bazaar showing under wrong area on tracker between adult/child * Check Tracker - Fixes scroll for Hyrule Market and Bazaar * Check Tracker - Fixes giving Adult Trade Items shown on tracker: Broken Sword, Saw, Cojiro, Eyeball Froge, and Eyedrops * Cleans up item_location * Check Tracker - Item List - Fixes item list not updating when changing seeds/options - Separates item exclusion list from item check list - Clean up comments * Check Tracker - Adds Skip functionality to buttons * Check Tracker - Refactors adult trade items to RandomizerInf * Check Tracker - Fixes an issue where any time an item is removed the tracker would cause an application crash * Check Tracker - Item names are now dependent on file language * Check Tracker - Fixes Gerudo Card check not showing in Fast setting * Reorders headers to (hopefully) avoid CI build conflicts on linux/consoles * Explicitly defines vector header in randomizer.h to fix compile errors * Complete Refactor of Check Tracker ImGui * Adds missing check tracker files to CMakeLists * Reverts the Item_location whitespace cleanup from ad10807c * Check Tracker - Loading Fixes - Fixes a bug where loading a save file a second time would add all the checks again - Fixes a bug where the check tracker would not render at all until in a save file * Check Tracker - Fixes a bug where checks would sometimes fail to load * Check Tracker - Fixes duplicated checks when using Only on Pause or Only on Combo * Check Tracker - Works around issue where single characters don't show in EnhancementCombobox, and fixes a label for combo buttons held option * Check Tracker - Applies all Check Tracker changes to Item Location * Check Tracker - Updated Check List - Adds Link's pocket, either in KF or HM depending on starting age - Supports Scrubs and Merchants - Uses enums instead of magic numbers - Updates DC Scrub Short Names for MQ * Check Tracker - Adds a performance mode option * Check Tracker - List Fixes (requires new rando generation) - Fixes Frogs Rupees always visible - Fixes Kokiri Sword Chest not showing - Fixes Weird Egg not showing * Check Tracker - MQ List basic support * Check Tracker - MQ/Vanilla anti-spoilers * Check Tracker - Collecting a compass now spoils the area * Check Tracker - Basic Vanilla Support and fixes - Vanilla items show in check tracker, even if many won't auto check - Fixes an issue with Gerudo Fortress Keys - Refactors IsVisibleInCheckTracker to randomizer_check_tracjer * Check Tracker - Fixes merge conflict from 08a487f35e1d760ab9e69b932edbe4da6bcd9edb * Check Tracker - Fixes tracker loading as Floating when default value is set to Windowed * Randomizer Location Exclusion List - Adds Scrubs, Merchants, Shops. Adult Trade items, MQ Dungeons, and Bean Salesman - Fixes Kokiri Sword Chest, Weird Egg, and Frog Song Rupees from misbehaving - Updates Gerudo Fortress logic to be dependent on Open/Fast/Normal Fortress - Removes Invalid Check - Adds RO Enum for MQ settings - Updates magic values to RO enum * Location Exclusion List - Scrubs that are always randomized now always show on the list * For now, removes some extra code only needed for a Check Tracker. * Randomizer Location Exclusion List - Fixes Eyeball Frog from showing up when Adult Trade Items was off * Location Tracker - Updates Eyedrops to use RandomizerInf instead of Chest * Check Tracker - Fixes a bug where Link's Pocket item wasn't acting as checked for area item count * Check Tracker - Fixes a bug where Locations would incorrectly say Vanilla due to the first check in the area being a non-MQ check * Check Tracker - Fixes a crash when Check Tracker is docked but not visible * Check Tracker - Fixes areas being spoiled when loading different save files * Check Tracker - Only reset variables if they are initialized * Check Tracker - Cleans up old comments, unused variables, methods, and macros, adds language TODOs, * Check Tracker - Readds rainbow UI elements after Cosmetics Editor refactor * Check Tracker - Removal of flag lookup that was refactored, no longer needed header, and some trivial whitespace fixes. * Check Tracker - Refactors Index to Bitmask code to a macro * Check Tracker - Changes ordering from alphabetical to RandomizerCheck ordering * Check Tracker - Wraps everything in a namespace to avoid global variable usage * Check Tracker - Explicitly defines for-loop scope * Check Tracker - refactors dungeon lookup from static array to function * Fixes a bug when using EnhancementColor with alpha * Check Tracker - Refactors all colour to use direct conversions * Check Tracker - refactors settings loading and check visibility for readability * Check Tracker - Fixes a bug where the wrong label showed on the Check Tracker BG Color * UIWidgets - Adds Alpha bar to EnhancementColor when using alpha parameter
2022-12-10 22:39:23 -05:00
return true;
} else if (i.rc > j.rc) {
Randomizer Auto Location tracker (#1942) * Initial Auto-Location Tracking * Updates styling for checked items in Check Tracker * Fixes crashing issues with Check Tracker rendering * Auto scroll Check Tracker windows to current area * Checks Tracker only shows checked locations once in game * Fixes issue where Check Tracker would auto-scroll to wrong location when entering a grotto * Fixes gerudo fortress checks showing in tracker when settings have them removed * InfTable Check Location Fixes: Lost Dog Richard, Rolling Gorons, HBA 1000, Thawed Zora * Fixes most Event Chk Inf Checks on Check Tracker, and Frogs * Check Tracker - Song from Malon now works * Check Tracker - Fixes Claim Check check not tracking - Fixes spoiler for Claim Check check when getting Biggoron's Sword - Fixes LACS being spoiled and not tracking * Check Tracker - Fixes #2 for Skull Mask and Mask of Truth checks * Check Tracker - Adds support for merchants - Fixes #7 for Bomchu Salesman - Fixes #12 for Medigoron * Check Tracker - Fixes #8 for Song from Saria * Check Tracker - Fixes #9 for Adult Shooting Gallery * Check Tracker - Fixes #10 for Composer Grave * Check Tracker - Fixes #14 for Song from Ocarina of Time * Check Tracker - Fixes #16 for Shooting the Sun * Check Tracker - Fixes #19 for Darunia's Joy * Save Editor - Adds missing label for Treasure Chest Game * Check Tracker - Fixes Great Faries checks * Check Tracker - Fixes Sheik at Temple * Check Tracker - Fixes Great Fairy auto-scroll to wrong location * Check Tracker - Updates blue warp checks - Fixes Bongo Bongo and Twinrova checks * Check Tracker - Fixes Dampe's Gravedigging Tour * Check Tracker - Fixes Prescription to King Zora * Check Tracker - Fixes Bazaar showing under wrong area on tracker between adult/child * Check Tracker - Fixes scroll for Hyrule Market and Bazaar * Check Tracker - Fixes giving Adult Trade Items shown on tracker: Broken Sword, Saw, Cojiro, Eyeball Froge, and Eyedrops * Cleans up item_location * Check Tracker - Item List - Fixes item list not updating when changing seeds/options - Separates item exclusion list from item check list - Clean up comments * Check Tracker - Adds Skip functionality to buttons * Check Tracker - Refactors adult trade items to RandomizerInf * Check Tracker - Fixes an issue where any time an item is removed the tracker would cause an application crash * Check Tracker - Item names are now dependent on file language * Check Tracker - Fixes Gerudo Card check not showing in Fast setting * Reorders headers to (hopefully) avoid CI build conflicts on linux/consoles * Explicitly defines vector header in randomizer.h to fix compile errors * Complete Refactor of Check Tracker ImGui * Adds missing check tracker files to CMakeLists * Reverts the Item_location whitespace cleanup from ad10807c * Check Tracker - Loading Fixes - Fixes a bug where loading a save file a second time would add all the checks again - Fixes a bug where the check tracker would not render at all until in a save file * Check Tracker - Fixes a bug where checks would sometimes fail to load * Check Tracker - Fixes duplicated checks when using Only on Pause or Only on Combo * Check Tracker - Works around issue where single characters don't show in EnhancementCombobox, and fixes a label for combo buttons held option * Check Tracker - Applies all Check Tracker changes to Item Location * Check Tracker - Updated Check List - Adds Link's pocket, either in KF or HM depending on starting age - Supports Scrubs and Merchants - Uses enums instead of magic numbers - Updates DC Scrub Short Names for MQ * Check Tracker - Adds a performance mode option * Check Tracker - List Fixes (requires new rando generation) - Fixes Frogs Rupees always visible - Fixes Kokiri Sword Chest not showing - Fixes Weird Egg not showing * Check Tracker - MQ List basic support * Check Tracker - MQ/Vanilla anti-spoilers * Check Tracker - Collecting a compass now spoils the area * Check Tracker - Basic Vanilla Support and fixes - Vanilla items show in check tracker, even if many won't auto check - Fixes an issue with Gerudo Fortress Keys - Refactors IsVisibleInCheckTracker to randomizer_check_tracjer * Check Tracker - Fixes merge conflict from 08a487f35e1d760ab9e69b932edbe4da6bcd9edb * Check Tracker - Fixes tracker loading as Floating when default value is set to Windowed * Randomizer Location Exclusion List - Adds Scrubs, Merchants, Shops. Adult Trade items, MQ Dungeons, and Bean Salesman - Fixes Kokiri Sword Chest, Weird Egg, and Frog Song Rupees from misbehaving - Updates Gerudo Fortress logic to be dependent on Open/Fast/Normal Fortress - Removes Invalid Check - Adds RO Enum for MQ settings - Updates magic values to RO enum * Location Exclusion List - Scrubs that are always randomized now always show on the list * For now, removes some extra code only needed for a Check Tracker. * Randomizer Location Exclusion List - Fixes Eyeball Frog from showing up when Adult Trade Items was off * Location Tracker - Updates Eyedrops to use RandomizerInf instead of Chest * Check Tracker - Fixes a bug where Link's Pocket item wasn't acting as checked for area item count * Check Tracker - Fixes a bug where Locations would incorrectly say Vanilla due to the first check in the area being a non-MQ check * Check Tracker - Fixes a crash when Check Tracker is docked but not visible * Check Tracker - Fixes areas being spoiled when loading different save files * Check Tracker - Only reset variables if they are initialized * Check Tracker - Cleans up old comments, unused variables, methods, and macros, adds language TODOs, * Check Tracker - Readds rainbow UI elements after Cosmetics Editor refactor * Check Tracker - Removal of flag lookup that was refactored, no longer needed header, and some trivial whitespace fixes. * Check Tracker - Refactors Index to Bitmask code to a macro * Check Tracker - Changes ordering from alphabetical to RandomizerCheck ordering * Check Tracker - Wraps everything in a namespace to avoid global variable usage * Check Tracker - Explicitly defines for-loop scope * Check Tracker - refactors dungeon lookup from static array to function * Fixes a bug when using EnhancementColor with alpha * Check Tracker - Refactors all colour to use direct conversions * Check Tracker - refactors settings loading and check visibility for readability * Check Tracker - Fixes a bug where the wrong label showed on the Check Tracker BG Color * UIWidgets - Adds Alpha bar to EnhancementColor when using alpha parameter
2022-12-10 22:39:23 -05:00
return false;
}
Randomizer Auto Location tracker (#1942) * Initial Auto-Location Tracking * Updates styling for checked items in Check Tracker * Fixes crashing issues with Check Tracker rendering * Auto scroll Check Tracker windows to current area * Checks Tracker only shows checked locations once in game * Fixes issue where Check Tracker would auto-scroll to wrong location when entering a grotto * Fixes gerudo fortress checks showing in tracker when settings have them removed * InfTable Check Location Fixes: Lost Dog Richard, Rolling Gorons, HBA 1000, Thawed Zora * Fixes most Event Chk Inf Checks on Check Tracker, and Frogs * Check Tracker - Song from Malon now works * Check Tracker - Fixes Claim Check check not tracking - Fixes spoiler for Claim Check check when getting Biggoron's Sword - Fixes LACS being spoiled and not tracking * Check Tracker - Fixes #2 for Skull Mask and Mask of Truth checks * Check Tracker - Adds support for merchants - Fixes #7 for Bomchu Salesman - Fixes #12 for Medigoron * Check Tracker - Fixes #8 for Song from Saria * Check Tracker - Fixes #9 for Adult Shooting Gallery * Check Tracker - Fixes #10 for Composer Grave * Check Tracker - Fixes #14 for Song from Ocarina of Time * Check Tracker - Fixes #16 for Shooting the Sun * Check Tracker - Fixes #19 for Darunia's Joy * Save Editor - Adds missing label for Treasure Chest Game * Check Tracker - Fixes Great Faries checks * Check Tracker - Fixes Sheik at Temple * Check Tracker - Fixes Great Fairy auto-scroll to wrong location * Check Tracker - Updates blue warp checks - Fixes Bongo Bongo and Twinrova checks * Check Tracker - Fixes Dampe's Gravedigging Tour * Check Tracker - Fixes Prescription to King Zora * Check Tracker - Fixes Bazaar showing under wrong area on tracker between adult/child * Check Tracker - Fixes scroll for Hyrule Market and Bazaar * Check Tracker - Fixes giving Adult Trade Items shown on tracker: Broken Sword, Saw, Cojiro, Eyeball Froge, and Eyedrops * Cleans up item_location * Check Tracker - Item List - Fixes item list not updating when changing seeds/options - Separates item exclusion list from item check list - Clean up comments * Check Tracker - Adds Skip functionality to buttons * Check Tracker - Refactors adult trade items to RandomizerInf * Check Tracker - Fixes an issue where any time an item is removed the tracker would cause an application crash * Check Tracker - Item names are now dependent on file language * Check Tracker - Fixes Gerudo Card check not showing in Fast setting * Reorders headers to (hopefully) avoid CI build conflicts on linux/consoles * Explicitly defines vector header in randomizer.h to fix compile errors * Complete Refactor of Check Tracker ImGui * Adds missing check tracker files to CMakeLists * Reverts the Item_location whitespace cleanup from ad10807c * Check Tracker - Loading Fixes - Fixes a bug where loading a save file a second time would add all the checks again - Fixes a bug where the check tracker would not render at all until in a save file * Check Tracker - Fixes a bug where checks would sometimes fail to load * Check Tracker - Fixes duplicated checks when using Only on Pause or Only on Combo * Check Tracker - Works around issue where single characters don't show in EnhancementCombobox, and fixes a label for combo buttons held option * Check Tracker - Applies all Check Tracker changes to Item Location * Check Tracker - Updated Check List - Adds Link's pocket, either in KF or HM depending on starting age - Supports Scrubs and Merchants - Uses enums instead of magic numbers - Updates DC Scrub Short Names for MQ * Check Tracker - Adds a performance mode option * Check Tracker - List Fixes (requires new rando generation) - Fixes Frogs Rupees always visible - Fixes Kokiri Sword Chest not showing - Fixes Weird Egg not showing * Check Tracker - MQ List basic support * Check Tracker - MQ/Vanilla anti-spoilers * Check Tracker - Collecting a compass now spoils the area * Check Tracker - Basic Vanilla Support and fixes - Vanilla items show in check tracker, even if many won't auto check - Fixes an issue with Gerudo Fortress Keys - Refactors IsVisibleInCheckTracker to randomizer_check_tracjer * Check Tracker - Fixes merge conflict from 08a487f35e1d760ab9e69b932edbe4da6bcd9edb * Check Tracker - Fixes tracker loading as Floating when default value is set to Windowed * Randomizer Location Exclusion List - Adds Scrubs, Merchants, Shops. Adult Trade items, MQ Dungeons, and Bean Salesman - Fixes Kokiri Sword Chest, Weird Egg, and Frog Song Rupees from misbehaving - Updates Gerudo Fortress logic to be dependent on Open/Fast/Normal Fortress - Removes Invalid Check - Adds RO Enum for MQ settings - Updates magic values to RO enum * Location Exclusion List - Scrubs that are always randomized now always show on the list * For now, removes some extra code only needed for a Check Tracker. * Randomizer Location Exclusion List - Fixes Eyeball Frog from showing up when Adult Trade Items was off * Location Tracker - Updates Eyedrops to use RandomizerInf instead of Chest * Check Tracker - Fixes a bug where Link's Pocket item wasn't acting as checked for area item count * Check Tracker - Fixes a bug where Locations would incorrectly say Vanilla due to the first check in the area being a non-MQ check * Check Tracker - Fixes a crash when Check Tracker is docked but not visible * Check Tracker - Fixes areas being spoiled when loading different save files * Check Tracker - Only reset variables if they are initialized * Check Tracker - Cleans up old comments, unused variables, methods, and macros, adds language TODOs, * Check Tracker - Readds rainbow UI elements after Cosmetics Editor refactor * Check Tracker - Removal of flag lookup that was refactored, no longer needed header, and some trivial whitespace fixes. * Check Tracker - Refactors Index to Bitmask code to a macro * Check Tracker - Changes ordering from alphabetical to RandomizerCheck ordering * Check Tracker - Wraps everything in a namespace to avoid global variable usage * Check Tracker - Explicitly defines for-loop scope * Check Tracker - refactors dungeon lookup from static array to function * Fixes a bug when using EnhancementColor with alpha * Check Tracker - Refactors all colour to use direct conversions * Check Tracker - refactors settings loading and check visibility for readability * Check Tracker - Fixes a bug where the wrong label showed on the Check Tracker BG Color * UIWidgets - Adds Alpha bar to EnhancementColor when using alpha parameter
2022-12-10 22:39:23 -05:00
return false;
}
Check Tracker Update (#2668) * Initial commit. What works so far: Data file loads, saves, deletes, and is created properly. - Need to run `HasItemBeenCollected` when creating in case of mid-seed regen. Organized checks into maps set by area. Areas show in tracker. - Checks pulled from checkObjectsByArea are not currently listed. - Areas are being assumed completed and hidden at the start. * Checks now populate. Still not counting area totals properly. * Don't track RC_LINKS_POCKET in the data file, and instead manually add it in every time a save is load. rcObjects doesn't contain Link's Pocket location (duh). * Moved ItemReceive hook to randomizer_check_tracker.cpp. Skipped items are properly sorted and formatted. Saved items contribute to an area's gotten/skipped checks on load. Changed skipped items default main color to gray. General code cleanup. * Skipped checks now contribute to area totals for area completion logic. * Mid-menu rework transfer. * Started check lookup on item receive. Tried to enable scum checking on save. * Fixed scum check on save. * More code cleanup, which revealed some issues with loading and saving. Loading now works 100%, but entries in checkTrackerData are disappearing in code somewhere, causing issues with later checks. Scummed color now displays properly. Collected but unsaved displays properly. Unchecked, Skipped, Seen and Scummed checks all have arrows for skipping/unskipping. Counts a little messed up, probably double adding skips. * Fixed item counts being off across resets. Restarts were fine. * Beginning of rework for individual check updates. Adds `Actor lastCheck` to PlayState to allow assigning of last actor to give an item. This allows precise tracking of GS, freestanding PoH, etc. Works for chests too. Currently does not work for shops, unknown for normal NPC gives. Doesn't track last gives for non-checks, like drops from grass, pots, crates, etc. * Actor-based checks fully fleshed out, but can't help with sale-based checks. Implemented `pendingSaleCheck` to back out of an RC check cycle if `gSaveContext->pendingSale` is not NONE when `OnItemReceive` is called, processed through `OnSaleEnd`. This should be the final change necessary to streamline the checks. * Temporary hook to message box close to tie in trackers for non-gs/chest actors that aren't added to `GetCheckFromActor`. This triggers a 2-frame countdown to check with `HasItemBeenCollected` since half of the methods in there aren't updated until after a text box closes. Added scene tracking to get last scene so that checks in scenes that span several overworld areas could be tied to their areas properly. Modified tracker data creation to apply Link's Pocket and Song from Impa conditionally based on randomizer settings instead of just being assumed to be done. May need modification for checking click and drag spoiler loading. Removed the scene equivalence check from CheckChecks so that an entire area is checked each time to avoid issues with, e.g., leaving a shop before a pending sale finishes. * Changed check data creation to use RSKs from gRandomizer to account for settings loaded from drag and drop spoilers. * Beginning of tracker code organization. Changed check color defaults. * Reverted moving tracker colors to header. Some individual check fixes. * Missed something from previous merge? * Removed last remnant of removed performance mode. * Better handle checking when skullsanity is off. * Song checks sceneIDs don't match the scenes they're actually in for some reason. Removed that check. * SaleEnd checks don't need the GetItemEntry parameter. Also set a flag that should prevent the check tracker from running during vanilla saves should that not be resolved by the time it's merged. * Attempting to have only the relevant checks added to the tracker data, as well as showing vanilla checks for non-rando saves. Not working yet (everything is displayed in vanilla). * Added vanilla check tracker population via `vanillaCheck` bool in `RandomizerCheckObject`. This is also added to `IsVisibleInImGui` to handle file loading and saving to eliminate checks that aren't part of vanilla or the rando seed. Implemented deleted tracker data file recreation. Added some extra item name text checks. Songs are still... tricky, so they stay blank. Utilize local copies of the randomizer check objects that are applicable for performance purposes. Fixed vanilla item-giving cutscene crashes when triggered mid-transition. * Apparently not all toolchains can handle macro instantiation without all parameters, like VS can. * Fixed scummed detail color not showing properly on tracker. * Fixed dungeon area totals and GS checks not functioning properly. * Major revamp of checking code. Doesn't rely on `GetCheckFromActor` at all anymore, but instead simply sets a flag to evaluate a number of checks in an area every frame until the check that was gotten is identified. With the new setup, it's much less hardware intensive, and at 60fps 6 checks per frame shows no noticeable effect on framerate. I can envision needing to add a collectedCount in order to account for times when two checks are gotten one right after the other. Changed area scroll to happen from `OnTransitionEnd`, and allow for scrolling in bazaar (was disabled previously because it would jump back and forth between Kak and Market while you were in one). Also setup area check order updating by area instead of all at the same time. * Fixed shooting gallery not reporting proper area. Prevent checks from actually happening if area is RCAREA_INVALID, now that all areas are reporting something if they have checks. Fixed `GetCheckArea()` not updating checks for standard scenes. Lots of vanilla tracking updates, mainly manual checks for gems, medallions and songs, since the often don't have proper scenes in the data. Prevent vanilla from triggering check loops if junk items are collected. Fixed sorting based on saved vs collected. Prevent item name display for vanilla runs. Change coloring of checks so the check name reflects status in vanilla runs. * Fixed "Recheck Area" button erroneously adding to an area's check totals? * Fix DMC vanilla checks. * Fix check tracker data recreation on data file loss. Removed redundant file exists check from SaveTrackerDataHook, as it doesn't matter if it exists or not at that point. Limited check loops to 3 to avoid infinite check loops on non-check/junk item pickup. Added more checks to disable tracker operations if a save is not running. Changed check ordering to put boss reward and heart container checks at the end of whatever RCSHOW group they belong to. * Fixed IsRunning calculation. Further improving vanilla checking. Starting framework for checking medallions, stones, and songs on data file recreation. Fixed medallion check collection. Added GIFT_FROM_SAGES to check list for vanilla file for tracking light medallion. Added check loop limitation to prevent infinite checking after picking up junk item from the ground. * Finished vanilla file recreation and recheck (songs and dungeon rewards all check properly now). This includes deku shield with KF shop item 3. Finished Gift from Raoru light medallion tracking for vanilla. Commented all CheckByScene functionality for now. * Fixed new save data file creation. Disabled entrance area calculation for now, as it only tracks the previous entrance for some reason. Fixed area detection for ToT checks. * GetCheckArea() now utilizes EntranceData almost exclusively, via either `gSaveContext.entranceIndex` or the entrance tracker's `currentGrottoId` in the case of grottos. This also means that EVERYTHING CAN AUTOSCROLL NOW. Entrance shuffles are now much easier to track. Autoscroll is now also triggered on save, just in case someone isn't autosaving and has a lot of checks that get converted to saved. * Fixed missing GS check in LW. * Added area scroll on toggling Show Hidden Items. May configure differently later. Fixed area detection for entrances in Gerudo Fortress/Valley and Collossus. Haunted wasteland doesn't autoscroll due to a bug in `OnTransitionEnd` hook, but checks still evaluate properly there. Rely on scene-based area detection if scene is a main overworld or dungeon scene. * Fixed grotto detection when shuffle is off. * Small code cleanup. Fixed Colossus hand chest checks. * Missing lus bump from merge conflict resolution * Fixed Colossus Grotto making `GetCheckArea` return Wasteland. * Improved OnItemReceive processing for non-token GS checks, since they can sometimes take long enough for the checking process to time out before the item is registered as received. * First attempt at thread safety for tracker data file writing. Seems to work, but might need more testing. * Fixed Recheck Area not unskipping items that register as saved. Improved delayed saving with autosaving, as the autosave triggered quite often before the tracker data save, making things not properly register as saved. * merge cleanup * Converted check tracker data to the sectional saves, adding `CheckTrackerData` to `SaveContext`. Implemented section ID returning and fullSave boolean passing to section functions from my PR temporarily for it to work properly. Moved `RandomizerCheckTrackerData` enum to `randomizerTypes.h` to accommodate that. Changed `Randomizer_SaveInit` to a `SaveManager::InitFunc` to allow for other randomizer-dependent sections to be initialized after that. Required a little refactoring to maintain intro cutscene skip when starting a randomizer file. * Revert section index return and randomizer init changes. Will need to wait on yet more changes to main. * Fixed check tracker initialization (shouldn't be tied to window initialization), restored saving/loading functionality. * Removed `CheckTracker::Init` and put SaveManager calls in `CheckTrackerWindow::InitElement`. Also a bit of cleanup from transition back to save file use. * Fixed tracker displaying check categories while file not loaded. * Fix Darunia's Joy check not marking in vanilla. * Fix autosave not triggering change from collected to saved in tracker data. * Changed default colors for scummed and collected display. * Merge upgrade code cleanup. * Add `OnTransitionEnd` calls to sandstorm transitions both to and from Wasteland. Also improved `gSaveContext.lastScene` assignment for both transition types. Allowed a bit of cleanup in `GetCheckArea`. * Added `StateButton`, a button like `ArrowButton` but that allows text instead of arrow icons. Apparently the changes from ArrowButton to StateButton happened in a previous commit... * Changed section name to `trackerDataCheck` to force SoH to load it after the randomizer section, as it required some randoSettings to be loaded first, and nothing else I tried to make the randomizer section load before it worked. This hacks a solution to checks not displaying on fast file load to a specific slot. F*** you, SaveManager, and f*** you too, JSON. * Forgot to change the section string for loading with the name change. * Fix check ordering for checks that trigger the autosave. * Adds option to remove right-side shop items (slots 1-4) from the tracker list. Enabled by default. * Fix default state of Hide Shop Right Checks checkbox. * Fixes grotto and great fairy scrolling and checks. Fixes array overflow from `checkTrackerData` which was creating the issue trying to load the base and randomizer sections first, among other things. That also fixed the massive file loads that were being exhibited in debug mode. * Fix shooting galleries being set as collected again when being played a second time after getting the checks. * Fix Bazaar autoscroll. * Add Saria's Song to `GetCheckFromActor` and removed some limitations from the messageCloseCheck function to make that check track properly. * Fix Song from Impa check. Implemented prevention for multiple "collections" of great fairies, just in case getting the health refill would trigger it with the previous setup. * Fix ice traps on GS tokens not triggering OnItemReceive. * Complete fix for ice trap collection from GS. Add autoscroll when clicking "Expand All". * Add `OnShopSlotChange` with cursorSlot and basePrice parameters. * Fixed include in en_ossan for shop slot hook. Added registration for `OnShopSlotChange` in the tracker, storing the price in a new `price` field in `CheckTrackerData`. Added "seen" functionality to shop checks. Displays the model item name upon first entering a shop, adding the price and switching to trickName (if it's an ice trap) upon navigating to the slot in buy mode, triggered by an invisible "identified" status that mirrors "seen" in every other way. Added tooltips to most options for check tracker color picking to describe what each status actually means. * `std::format` pls * So apparently std::format just decided to break with the latest merge from develop, but fmt::format exists and works? * Removed the last vestiges of `locationsSkipped`. Other general code and formatting cleanups. Moved `IsGameRunning` to `OTRGlobals` so the item tracker could also access it. Used preceding to "fix" item and bottle display in the item tracker on startup. * Some more code cleanup. Removed "Recheck Area" button and relevant code. Backported changes to Anchor branch applicable for single-player, including making a checkAreas vector and structuring the frame by frame checks around that. Also includes fix for Silver Gauntlets and Mirror Shield check collection crash associated with those changes. Fixed Kakariko Bazaar "seen" updates. Fixed tracker window not showing on initial load like it should. * Forgot 1 formatting fix. * Removed conditions for showing Song from Impa (isn't junk under certain conditions, so should show all the time). * Fix vanilla checks, add Zelda's Letter and Malon's Egg to manual check collection. Fix autoscroll while in child stealth section. * Fix crash in Happy Mask Shop in OnSlotChange (referenced non-existent shop id in a tracker-specific enum). * General code cleanup. * Missed one reversion. * One more. * Fix column alignment in `randomizer_check_objects`. * Fix file encoding on `randomizer_check_tracker`. Again. * Fix indentation for `actualItemtrackerItemMap`. Also removed unnecessary parts of the map. * Rename `HasEqItem` to `HasEquipment`. * Slightly better indentation for `actualItemTrackerItemMap`. * Add magic bean salesman to vanilla check tracking, and genericized deku shield to trigger KF shop item 3 wherever you get the shield. Renamed `vanillaCheck` to `vanillaHundoCheck` to (supposedly) clarify the meaning of the usage. * One more rename to `vanillaCompletion` to avoid possible confusion with 100% speedrun conditions. * give me a break XD Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * Changes suggested by briaguya (rename `RandomizerCheckShow` to `Status`, unused code, newline formatting) * Remove unused `itemNames` table. * Remove `IsGameRunning` in favor of `GameInteractor::IsSaveLoaded`. * Restore anti-spoiler functionality for dungeons with dungeon maps. * Review cleanup. * Fix prices not showing for Kak bazaar items. --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com>
2023-10-04 11:03:36 -04:00
bool IsHeartPiece(GetItemID giid) {
return giid == GI_HEART_PIECE || giid == GI_HEART_PIECE_WIN;
2023-02-14 20:50:59 -05:00
}
Randomizer Auto Location tracker (#1942) * Initial Auto-Location Tracking * Updates styling for checked items in Check Tracker * Fixes crashing issues with Check Tracker rendering * Auto scroll Check Tracker windows to current area * Checks Tracker only shows checked locations once in game * Fixes issue where Check Tracker would auto-scroll to wrong location when entering a grotto * Fixes gerudo fortress checks showing in tracker when settings have them removed * InfTable Check Location Fixes: Lost Dog Richard, Rolling Gorons, HBA 1000, Thawed Zora * Fixes most Event Chk Inf Checks on Check Tracker, and Frogs * Check Tracker - Song from Malon now works * Check Tracker - Fixes Claim Check check not tracking - Fixes spoiler for Claim Check check when getting Biggoron's Sword - Fixes LACS being spoiled and not tracking * Check Tracker - Fixes #2 for Skull Mask and Mask of Truth checks * Check Tracker - Adds support for merchants - Fixes #7 for Bomchu Salesman - Fixes #12 for Medigoron * Check Tracker - Fixes #8 for Song from Saria * Check Tracker - Fixes #9 for Adult Shooting Gallery * Check Tracker - Fixes #10 for Composer Grave * Check Tracker - Fixes #14 for Song from Ocarina of Time * Check Tracker - Fixes #16 for Shooting the Sun * Check Tracker - Fixes #19 for Darunia's Joy * Save Editor - Adds missing label for Treasure Chest Game * Check Tracker - Fixes Great Faries checks * Check Tracker - Fixes Sheik at Temple * Check Tracker - Fixes Great Fairy auto-scroll to wrong location * Check Tracker - Updates blue warp checks - Fixes Bongo Bongo and Twinrova checks * Check Tracker - Fixes Dampe's Gravedigging Tour * Check Tracker - Fixes Prescription to King Zora * Check Tracker - Fixes Bazaar showing under wrong area on tracker between adult/child * Check Tracker - Fixes scroll for Hyrule Market and Bazaar * Check Tracker - Fixes giving Adult Trade Items shown on tracker: Broken Sword, Saw, Cojiro, Eyeball Froge, and Eyedrops * Cleans up item_location * Check Tracker - Item List - Fixes item list not updating when changing seeds/options - Separates item exclusion list from item check list - Clean up comments * Check Tracker - Adds Skip functionality to buttons * Check Tracker - Refactors adult trade items to RandomizerInf * Check Tracker - Fixes an issue where any time an item is removed the tracker would cause an application crash * Check Tracker - Item names are now dependent on file language * Check Tracker - Fixes Gerudo Card check not showing in Fast setting * Reorders headers to (hopefully) avoid CI build conflicts on linux/consoles * Explicitly defines vector header in randomizer.h to fix compile errors * Complete Refactor of Check Tracker ImGui * Adds missing check tracker files to CMakeLists * Reverts the Item_location whitespace cleanup from ad10807c * Check Tracker - Loading Fixes - Fixes a bug where loading a save file a second time would add all the checks again - Fixes a bug where the check tracker would not render at all until in a save file * Check Tracker - Fixes a bug where checks would sometimes fail to load * Check Tracker - Fixes duplicated checks when using Only on Pause or Only on Combo * Check Tracker - Works around issue where single characters don't show in EnhancementCombobox, and fixes a label for combo buttons held option * Check Tracker - Applies all Check Tracker changes to Item Location * Check Tracker - Updated Check List - Adds Link's pocket, either in KF or HM depending on starting age - Supports Scrubs and Merchants - Uses enums instead of magic numbers - Updates DC Scrub Short Names for MQ * Check Tracker - Adds a performance mode option * Check Tracker - List Fixes (requires new rando generation) - Fixes Frogs Rupees always visible - Fixes Kokiri Sword Chest not showing - Fixes Weird Egg not showing * Check Tracker - MQ List basic support * Check Tracker - MQ/Vanilla anti-spoilers * Check Tracker - Collecting a compass now spoils the area * Check Tracker - Basic Vanilla Support and fixes - Vanilla items show in check tracker, even if many won't auto check - Fixes an issue with Gerudo Fortress Keys - Refactors IsVisibleInCheckTracker to randomizer_check_tracjer * Check Tracker - Fixes merge conflict from 08a487f35e1d760ab9e69b932edbe4da6bcd9edb * Check Tracker - Fixes tracker loading as Floating when default value is set to Windowed * Randomizer Location Exclusion List - Adds Scrubs, Merchants, Shops. Adult Trade items, MQ Dungeons, and Bean Salesman - Fixes Kokiri Sword Chest, Weird Egg, and Frog Song Rupees from misbehaving - Updates Gerudo Fortress logic to be dependent on Open/Fast/Normal Fortress - Removes Invalid Check - Adds RO Enum for MQ settings - Updates magic values to RO enum * Location Exclusion List - Scrubs that are always randomized now always show on the list * For now, removes some extra code only needed for a Check Tracker. * Randomizer Location Exclusion List - Fixes Eyeball Frog from showing up when Adult Trade Items was off * Location Tracker - Updates Eyedrops to use RandomizerInf instead of Chest * Check Tracker - Fixes a bug where Link's Pocket item wasn't acting as checked for area item count * Check Tracker - Fixes a bug where Locations would incorrectly say Vanilla due to the first check in the area being a non-MQ check * Check Tracker - Fixes a crash when Check Tracker is docked but not visible * Check Tracker - Fixes areas being spoiled when loading different save files * Check Tracker - Only reset variables if they are initialized * Check Tracker - Cleans up old comments, unused variables, methods, and macros, adds language TODOs, * Check Tracker - Readds rainbow UI elements after Cosmetics Editor refactor * Check Tracker - Removal of flag lookup that was refactored, no longer needed header, and some trivial whitespace fixes. * Check Tracker - Refactors Index to Bitmask code to a macro * Check Tracker - Changes ordering from alphabetical to RandomizerCheck ordering * Check Tracker - Wraps everything in a namespace to avoid global variable usage * Check Tracker - Explicitly defines for-loop scope * Check Tracker - refactors dungeon lookup from static array to function * Fixes a bug when using EnhancementColor with alpha * Check Tracker - Refactors all colour to use direct conversions * Check Tracker - refactors settings loading and check visibility for readability * Check Tracker - Fixes a bug where the wrong label showed on the Check Tracker BG Color * UIWidgets - Adds Alpha bar to EnhancementColor when using alpha parameter
2022-12-10 22:39:23 -05:00
Check Tracker Update (#2668) * Initial commit. What works so far: Data file loads, saves, deletes, and is created properly. - Need to run `HasItemBeenCollected` when creating in case of mid-seed regen. Organized checks into maps set by area. Areas show in tracker. - Checks pulled from checkObjectsByArea are not currently listed. - Areas are being assumed completed and hidden at the start. * Checks now populate. Still not counting area totals properly. * Don't track RC_LINKS_POCKET in the data file, and instead manually add it in every time a save is load. rcObjects doesn't contain Link's Pocket location (duh). * Moved ItemReceive hook to randomizer_check_tracker.cpp. Skipped items are properly sorted and formatted. Saved items contribute to an area's gotten/skipped checks on load. Changed skipped items default main color to gray. General code cleanup. * Skipped checks now contribute to area totals for area completion logic. * Mid-menu rework transfer. * Started check lookup on item receive. Tried to enable scum checking on save. * Fixed scum check on save. * More code cleanup, which revealed some issues with loading and saving. Loading now works 100%, but entries in checkTrackerData are disappearing in code somewhere, causing issues with later checks. Scummed color now displays properly. Collected but unsaved displays properly. Unchecked, Skipped, Seen and Scummed checks all have arrows for skipping/unskipping. Counts a little messed up, probably double adding skips. * Fixed item counts being off across resets. Restarts were fine. * Beginning of rework for individual check updates. Adds `Actor lastCheck` to PlayState to allow assigning of last actor to give an item. This allows precise tracking of GS, freestanding PoH, etc. Works for chests too. Currently does not work for shops, unknown for normal NPC gives. Doesn't track last gives for non-checks, like drops from grass, pots, crates, etc. * Actor-based checks fully fleshed out, but can't help with sale-based checks. Implemented `pendingSaleCheck` to back out of an RC check cycle if `gSaveContext->pendingSale` is not NONE when `OnItemReceive` is called, processed through `OnSaleEnd`. This should be the final change necessary to streamline the checks. * Temporary hook to message box close to tie in trackers for non-gs/chest actors that aren't added to `GetCheckFromActor`. This triggers a 2-frame countdown to check with `HasItemBeenCollected` since half of the methods in there aren't updated until after a text box closes. Added scene tracking to get last scene so that checks in scenes that span several overworld areas could be tied to their areas properly. Modified tracker data creation to apply Link's Pocket and Song from Impa conditionally based on randomizer settings instead of just being assumed to be done. May need modification for checking click and drag spoiler loading. Removed the scene equivalence check from CheckChecks so that an entire area is checked each time to avoid issues with, e.g., leaving a shop before a pending sale finishes. * Changed check data creation to use RSKs from gRandomizer to account for settings loaded from drag and drop spoilers. * Beginning of tracker code organization. Changed check color defaults. * Reverted moving tracker colors to header. Some individual check fixes. * Missed something from previous merge? * Removed last remnant of removed performance mode. * Better handle checking when skullsanity is off. * Song checks sceneIDs don't match the scenes they're actually in for some reason. Removed that check. * SaleEnd checks don't need the GetItemEntry parameter. Also set a flag that should prevent the check tracker from running during vanilla saves should that not be resolved by the time it's merged. * Attempting to have only the relevant checks added to the tracker data, as well as showing vanilla checks for non-rando saves. Not working yet (everything is displayed in vanilla). * Added vanilla check tracker population via `vanillaCheck` bool in `RandomizerCheckObject`. This is also added to `IsVisibleInImGui` to handle file loading and saving to eliminate checks that aren't part of vanilla or the rando seed. Implemented deleted tracker data file recreation. Added some extra item name text checks. Songs are still... tricky, so they stay blank. Utilize local copies of the randomizer check objects that are applicable for performance purposes. Fixed vanilla item-giving cutscene crashes when triggered mid-transition. * Apparently not all toolchains can handle macro instantiation without all parameters, like VS can. * Fixed scummed detail color not showing properly on tracker. * Fixed dungeon area totals and GS checks not functioning properly. * Major revamp of checking code. Doesn't rely on `GetCheckFromActor` at all anymore, but instead simply sets a flag to evaluate a number of checks in an area every frame until the check that was gotten is identified. With the new setup, it's much less hardware intensive, and at 60fps 6 checks per frame shows no noticeable effect on framerate. I can envision needing to add a collectedCount in order to account for times when two checks are gotten one right after the other. Changed area scroll to happen from `OnTransitionEnd`, and allow for scrolling in bazaar (was disabled previously because it would jump back and forth between Kak and Market while you were in one). Also setup area check order updating by area instead of all at the same time. * Fixed shooting gallery not reporting proper area. Prevent checks from actually happening if area is RCAREA_INVALID, now that all areas are reporting something if they have checks. Fixed `GetCheckArea()` not updating checks for standard scenes. Lots of vanilla tracking updates, mainly manual checks for gems, medallions and songs, since the often don't have proper scenes in the data. Prevent vanilla from triggering check loops if junk items are collected. Fixed sorting based on saved vs collected. Prevent item name display for vanilla runs. Change coloring of checks so the check name reflects status in vanilla runs. * Fixed "Recheck Area" button erroneously adding to an area's check totals? * Fix DMC vanilla checks. * Fix check tracker data recreation on data file loss. Removed redundant file exists check from SaveTrackerDataHook, as it doesn't matter if it exists or not at that point. Limited check loops to 3 to avoid infinite check loops on non-check/junk item pickup. Added more checks to disable tracker operations if a save is not running. Changed check ordering to put boss reward and heart container checks at the end of whatever RCSHOW group they belong to. * Fixed IsRunning calculation. Further improving vanilla checking. Starting framework for checking medallions, stones, and songs on data file recreation. Fixed medallion check collection. Added GIFT_FROM_SAGES to check list for vanilla file for tracking light medallion. Added check loop limitation to prevent infinite checking after picking up junk item from the ground. * Finished vanilla file recreation and recheck (songs and dungeon rewards all check properly now). This includes deku shield with KF shop item 3. Finished Gift from Raoru light medallion tracking for vanilla. Commented all CheckByScene functionality for now. * Fixed new save data file creation. Disabled entrance area calculation for now, as it only tracks the previous entrance for some reason. Fixed area detection for ToT checks. * GetCheckArea() now utilizes EntranceData almost exclusively, via either `gSaveContext.entranceIndex` or the entrance tracker's `currentGrottoId` in the case of grottos. This also means that EVERYTHING CAN AUTOSCROLL NOW. Entrance shuffles are now much easier to track. Autoscroll is now also triggered on save, just in case someone isn't autosaving and has a lot of checks that get converted to saved. * Fixed missing GS check in LW. * Added area scroll on toggling Show Hidden Items. May configure differently later. Fixed area detection for entrances in Gerudo Fortress/Valley and Collossus. Haunted wasteland doesn't autoscroll due to a bug in `OnTransitionEnd` hook, but checks still evaluate properly there. Rely on scene-based area detection if scene is a main overworld or dungeon scene. * Fixed grotto detection when shuffle is off. * Small code cleanup. Fixed Colossus hand chest checks. * Missing lus bump from merge conflict resolution * Fixed Colossus Grotto making `GetCheckArea` return Wasteland. * Improved OnItemReceive processing for non-token GS checks, since they can sometimes take long enough for the checking process to time out before the item is registered as received. * First attempt at thread safety for tracker data file writing. Seems to work, but might need more testing. * Fixed Recheck Area not unskipping items that register as saved. Improved delayed saving with autosaving, as the autosave triggered quite often before the tracker data save, making things not properly register as saved. * merge cleanup * Converted check tracker data to the sectional saves, adding `CheckTrackerData` to `SaveContext`. Implemented section ID returning and fullSave boolean passing to section functions from my PR temporarily for it to work properly. Moved `RandomizerCheckTrackerData` enum to `randomizerTypes.h` to accommodate that. Changed `Randomizer_SaveInit` to a `SaveManager::InitFunc` to allow for other randomizer-dependent sections to be initialized after that. Required a little refactoring to maintain intro cutscene skip when starting a randomizer file. * Revert section index return and randomizer init changes. Will need to wait on yet more changes to main. * Fixed check tracker initialization (shouldn't be tied to window initialization), restored saving/loading functionality. * Removed `CheckTracker::Init` and put SaveManager calls in `CheckTrackerWindow::InitElement`. Also a bit of cleanup from transition back to save file use. * Fixed tracker displaying check categories while file not loaded. * Fix Darunia's Joy check not marking in vanilla. * Fix autosave not triggering change from collected to saved in tracker data. * Changed default colors for scummed and collected display. * Merge upgrade code cleanup. * Add `OnTransitionEnd` calls to sandstorm transitions both to and from Wasteland. Also improved `gSaveContext.lastScene` assignment for both transition types. Allowed a bit of cleanup in `GetCheckArea`. * Added `StateButton`, a button like `ArrowButton` but that allows text instead of arrow icons. Apparently the changes from ArrowButton to StateButton happened in a previous commit... * Changed section name to `trackerDataCheck` to force SoH to load it after the randomizer section, as it required some randoSettings to be loaded first, and nothing else I tried to make the randomizer section load before it worked. This hacks a solution to checks not displaying on fast file load to a specific slot. F*** you, SaveManager, and f*** you too, JSON. * Forgot to change the section string for loading with the name change. * Fix check ordering for checks that trigger the autosave. * Adds option to remove right-side shop items (slots 1-4) from the tracker list. Enabled by default. * Fix default state of Hide Shop Right Checks checkbox. * Fixes grotto and great fairy scrolling and checks. Fixes array overflow from `checkTrackerData` which was creating the issue trying to load the base and randomizer sections first, among other things. That also fixed the massive file loads that were being exhibited in debug mode. * Fix shooting galleries being set as collected again when being played a second time after getting the checks. * Fix Bazaar autoscroll. * Add Saria's Song to `GetCheckFromActor` and removed some limitations from the messageCloseCheck function to make that check track properly. * Fix Song from Impa check. Implemented prevention for multiple "collections" of great fairies, just in case getting the health refill would trigger it with the previous setup. * Fix ice traps on GS tokens not triggering OnItemReceive. * Complete fix for ice trap collection from GS. Add autoscroll when clicking "Expand All". * Add `OnShopSlotChange` with cursorSlot and basePrice parameters. * Fixed include in en_ossan for shop slot hook. Added registration for `OnShopSlotChange` in the tracker, storing the price in a new `price` field in `CheckTrackerData`. Added "seen" functionality to shop checks. Displays the model item name upon first entering a shop, adding the price and switching to trickName (if it's an ice trap) upon navigating to the slot in buy mode, triggered by an invisible "identified" status that mirrors "seen" in every other way. Added tooltips to most options for check tracker color picking to describe what each status actually means. * `std::format` pls * So apparently std::format just decided to break with the latest merge from develop, but fmt::format exists and works? * Removed the last vestiges of `locationsSkipped`. Other general code and formatting cleanups. Moved `IsGameRunning` to `OTRGlobals` so the item tracker could also access it. Used preceding to "fix" item and bottle display in the item tracker on startup. * Some more code cleanup. Removed "Recheck Area" button and relevant code. Backported changes to Anchor branch applicable for single-player, including making a checkAreas vector and structuring the frame by frame checks around that. Also includes fix for Silver Gauntlets and Mirror Shield check collection crash associated with those changes. Fixed Kakariko Bazaar "seen" updates. Fixed tracker window not showing on initial load like it should. * Forgot 1 formatting fix. * Removed conditions for showing Song from Impa (isn't junk under certain conditions, so should show all the time). * Fix vanilla checks, add Zelda's Letter and Malon's Egg to manual check collection. Fix autoscroll while in child stealth section. * Fix crash in Happy Mask Shop in OnSlotChange (referenced non-existent shop id in a tracker-specific enum). * General code cleanup. * Missed one reversion. * One more. * Fix column alignment in `randomizer_check_objects`. * Fix file encoding on `randomizer_check_tracker`. Again. * Fix indentation for `actualItemtrackerItemMap`. Also removed unnecessary parts of the map. * Rename `HasEqItem` to `HasEquipment`. * Slightly better indentation for `actualItemTrackerItemMap`. * Add magic bean salesman to vanilla check tracking, and genericized deku shield to trigger KF shop item 3 wherever you get the shield. Renamed `vanillaCheck` to `vanillaHundoCheck` to (supposedly) clarify the meaning of the usage. * One more rename to `vanillaCompletion` to avoid possible confusion with 100% speedrun conditions. * give me a break XD Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * Changes suggested by briaguya (rename `RandomizerCheckShow` to `Status`, unused code, newline formatting) * Remove unused `itemNames` table. * Remove `IsGameRunning` in favor of `GameInteractor::IsSaveLoaded`. * Restore anti-spoiler functionality for dungeons with dungeon maps. * Review cleanup. * Fix prices not showing for Kak bazaar items. --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com>
2023-10-04 11:03:36 -04:00
void DrawLocation(RandomizerCheckObject rcObj) {
Color_RGBA8 mainColor;
Randomizer Auto Location tracker (#1942) * Initial Auto-Location Tracking * Updates styling for checked items in Check Tracker * Fixes crashing issues with Check Tracker rendering * Auto scroll Check Tracker windows to current area * Checks Tracker only shows checked locations once in game * Fixes issue where Check Tracker would auto-scroll to wrong location when entering a grotto * Fixes gerudo fortress checks showing in tracker when settings have them removed * InfTable Check Location Fixes: Lost Dog Richard, Rolling Gorons, HBA 1000, Thawed Zora * Fixes most Event Chk Inf Checks on Check Tracker, and Frogs * Check Tracker - Song from Malon now works * Check Tracker - Fixes Claim Check check not tracking - Fixes spoiler for Claim Check check when getting Biggoron's Sword - Fixes LACS being spoiled and not tracking * Check Tracker - Fixes #2 for Skull Mask and Mask of Truth checks * Check Tracker - Adds support for merchants - Fixes #7 for Bomchu Salesman - Fixes #12 for Medigoron * Check Tracker - Fixes #8 for Song from Saria * Check Tracker - Fixes #9 for Adult Shooting Gallery * Check Tracker - Fixes #10 for Composer Grave * Check Tracker - Fixes #14 for Song from Ocarina of Time * Check Tracker - Fixes #16 for Shooting the Sun * Check Tracker - Fixes #19 for Darunia's Joy * Save Editor - Adds missing label for Treasure Chest Game * Check Tracker - Fixes Great Faries checks * Check Tracker - Fixes Sheik at Temple * Check Tracker - Fixes Great Fairy auto-scroll to wrong location * Check Tracker - Updates blue warp checks - Fixes Bongo Bongo and Twinrova checks * Check Tracker - Fixes Dampe's Gravedigging Tour * Check Tracker - Fixes Prescription to King Zora * Check Tracker - Fixes Bazaar showing under wrong area on tracker between adult/child * Check Tracker - Fixes scroll for Hyrule Market and Bazaar * Check Tracker - Fixes giving Adult Trade Items shown on tracker: Broken Sword, Saw, Cojiro, Eyeball Froge, and Eyedrops * Cleans up item_location * Check Tracker - Item List - Fixes item list not updating when changing seeds/options - Separates item exclusion list from item check list - Clean up comments * Check Tracker - Adds Skip functionality to buttons * Check Tracker - Refactors adult trade items to RandomizerInf * Check Tracker - Fixes an issue where any time an item is removed the tracker would cause an application crash * Check Tracker - Item names are now dependent on file language * Check Tracker - Fixes Gerudo Card check not showing in Fast setting * Reorders headers to (hopefully) avoid CI build conflicts on linux/consoles * Explicitly defines vector header in randomizer.h to fix compile errors * Complete Refactor of Check Tracker ImGui * Adds missing check tracker files to CMakeLists * Reverts the Item_location whitespace cleanup from ad10807c * Check Tracker - Loading Fixes - Fixes a bug where loading a save file a second time would add all the checks again - Fixes a bug where the check tracker would not render at all until in a save file * Check Tracker - Fixes a bug where checks would sometimes fail to load * Check Tracker - Fixes duplicated checks when using Only on Pause or Only on Combo * Check Tracker - Works around issue where single characters don't show in EnhancementCombobox, and fixes a label for combo buttons held option * Check Tracker - Applies all Check Tracker changes to Item Location * Check Tracker - Updated Check List - Adds Link's pocket, either in KF or HM depending on starting age - Supports Scrubs and Merchants - Uses enums instead of magic numbers - Updates DC Scrub Short Names for MQ * Check Tracker - Adds a performance mode option * Check Tracker - List Fixes (requires new rando generation) - Fixes Frogs Rupees always visible - Fixes Kokiri Sword Chest not showing - Fixes Weird Egg not showing * Check Tracker - MQ List basic support * Check Tracker - MQ/Vanilla anti-spoilers * Check Tracker - Collecting a compass now spoils the area * Check Tracker - Basic Vanilla Support and fixes - Vanilla items show in check tracker, even if many won't auto check - Fixes an issue with Gerudo Fortress Keys - Refactors IsVisibleInCheckTracker to randomizer_check_tracjer * Check Tracker - Fixes merge conflict from 08a487f35e1d760ab9e69b932edbe4da6bcd9edb * Check Tracker - Fixes tracker loading as Floating when default value is set to Windowed * Randomizer Location Exclusion List - Adds Scrubs, Merchants, Shops. Adult Trade items, MQ Dungeons, and Bean Salesman - Fixes Kokiri Sword Chest, Weird Egg, and Frog Song Rupees from misbehaving - Updates Gerudo Fortress logic to be dependent on Open/Fast/Normal Fortress - Removes Invalid Check - Adds RO Enum for MQ settings - Updates magic values to RO enum * Location Exclusion List - Scrubs that are always randomized now always show on the list * For now, removes some extra code only needed for a Check Tracker. * Randomizer Location Exclusion List - Fixes Eyeball Frog from showing up when Adult Trade Items was off * Location Tracker - Updates Eyedrops to use RandomizerInf instead of Chest * Check Tracker - Fixes a bug where Link's Pocket item wasn't acting as checked for area item count * Check Tracker - Fixes a bug where Locations would incorrectly say Vanilla due to the first check in the area being a non-MQ check * Check Tracker - Fixes a crash when Check Tracker is docked but not visible * Check Tracker - Fixes areas being spoiled when loading different save files * Check Tracker - Only reset variables if they are initialized * Check Tracker - Cleans up old comments, unused variables, methods, and macros, adds language TODOs, * Check Tracker - Readds rainbow UI elements after Cosmetics Editor refactor * Check Tracker - Removal of flag lookup that was refactored, no longer needed header, and some trivial whitespace fixes. * Check Tracker - Refactors Index to Bitmask code to a macro * Check Tracker - Changes ordering from alphabetical to RandomizerCheck ordering * Check Tracker - Wraps everything in a namespace to avoid global variable usage * Check Tracker - Explicitly defines for-loop scope * Check Tracker - refactors dungeon lookup from static array to function * Fixes a bug when using EnhancementColor with alpha * Check Tracker - Refactors all colour to use direct conversions * Check Tracker - refactors settings loading and check visibility for readability * Check Tracker - Fixes a bug where the wrong label showed on the Check Tracker BG Color * UIWidgets - Adds Alpha bar to EnhancementColor when using alpha parameter
2022-12-10 22:39:23 -05:00
Color_RGBA8 extraColor;
std::string txt;
bool showHidden = CVarGetInteger("gCheckTrackerOptionShowHidden", 0);
Check Tracker Update (#2668) * Initial commit. What works so far: Data file loads, saves, deletes, and is created properly. - Need to run `HasItemBeenCollected` when creating in case of mid-seed regen. Organized checks into maps set by area. Areas show in tracker. - Checks pulled from checkObjectsByArea are not currently listed. - Areas are being assumed completed and hidden at the start. * Checks now populate. Still not counting area totals properly. * Don't track RC_LINKS_POCKET in the data file, and instead manually add it in every time a save is load. rcObjects doesn't contain Link's Pocket location (duh). * Moved ItemReceive hook to randomizer_check_tracker.cpp. Skipped items are properly sorted and formatted. Saved items contribute to an area's gotten/skipped checks on load. Changed skipped items default main color to gray. General code cleanup. * Skipped checks now contribute to area totals for area completion logic. * Mid-menu rework transfer. * Started check lookup on item receive. Tried to enable scum checking on save. * Fixed scum check on save. * More code cleanup, which revealed some issues with loading and saving. Loading now works 100%, but entries in checkTrackerData are disappearing in code somewhere, causing issues with later checks. Scummed color now displays properly. Collected but unsaved displays properly. Unchecked, Skipped, Seen and Scummed checks all have arrows for skipping/unskipping. Counts a little messed up, probably double adding skips. * Fixed item counts being off across resets. Restarts were fine. * Beginning of rework for individual check updates. Adds `Actor lastCheck` to PlayState to allow assigning of last actor to give an item. This allows precise tracking of GS, freestanding PoH, etc. Works for chests too. Currently does not work for shops, unknown for normal NPC gives. Doesn't track last gives for non-checks, like drops from grass, pots, crates, etc. * Actor-based checks fully fleshed out, but can't help with sale-based checks. Implemented `pendingSaleCheck` to back out of an RC check cycle if `gSaveContext->pendingSale` is not NONE when `OnItemReceive` is called, processed through `OnSaleEnd`. This should be the final change necessary to streamline the checks. * Temporary hook to message box close to tie in trackers for non-gs/chest actors that aren't added to `GetCheckFromActor`. This triggers a 2-frame countdown to check with `HasItemBeenCollected` since half of the methods in there aren't updated until after a text box closes. Added scene tracking to get last scene so that checks in scenes that span several overworld areas could be tied to their areas properly. Modified tracker data creation to apply Link's Pocket and Song from Impa conditionally based on randomizer settings instead of just being assumed to be done. May need modification for checking click and drag spoiler loading. Removed the scene equivalence check from CheckChecks so that an entire area is checked each time to avoid issues with, e.g., leaving a shop before a pending sale finishes. * Changed check data creation to use RSKs from gRandomizer to account for settings loaded from drag and drop spoilers. * Beginning of tracker code organization. Changed check color defaults. * Reverted moving tracker colors to header. Some individual check fixes. * Missed something from previous merge? * Removed last remnant of removed performance mode. * Better handle checking when skullsanity is off. * Song checks sceneIDs don't match the scenes they're actually in for some reason. Removed that check. * SaleEnd checks don't need the GetItemEntry parameter. Also set a flag that should prevent the check tracker from running during vanilla saves should that not be resolved by the time it's merged. * Attempting to have only the relevant checks added to the tracker data, as well as showing vanilla checks for non-rando saves. Not working yet (everything is displayed in vanilla). * Added vanilla check tracker population via `vanillaCheck` bool in `RandomizerCheckObject`. This is also added to `IsVisibleInImGui` to handle file loading and saving to eliminate checks that aren't part of vanilla or the rando seed. Implemented deleted tracker data file recreation. Added some extra item name text checks. Songs are still... tricky, so they stay blank. Utilize local copies of the randomizer check objects that are applicable for performance purposes. Fixed vanilla item-giving cutscene crashes when triggered mid-transition. * Apparently not all toolchains can handle macro instantiation without all parameters, like VS can. * Fixed scummed detail color not showing properly on tracker. * Fixed dungeon area totals and GS checks not functioning properly. * Major revamp of checking code. Doesn't rely on `GetCheckFromActor` at all anymore, but instead simply sets a flag to evaluate a number of checks in an area every frame until the check that was gotten is identified. With the new setup, it's much less hardware intensive, and at 60fps 6 checks per frame shows no noticeable effect on framerate. I can envision needing to add a collectedCount in order to account for times when two checks are gotten one right after the other. Changed area scroll to happen from `OnTransitionEnd`, and allow for scrolling in bazaar (was disabled previously because it would jump back and forth between Kak and Market while you were in one). Also setup area check order updating by area instead of all at the same time. * Fixed shooting gallery not reporting proper area. Prevent checks from actually happening if area is RCAREA_INVALID, now that all areas are reporting something if they have checks. Fixed `GetCheckArea()` not updating checks for standard scenes. Lots of vanilla tracking updates, mainly manual checks for gems, medallions and songs, since the often don't have proper scenes in the data. Prevent vanilla from triggering check loops if junk items are collected. Fixed sorting based on saved vs collected. Prevent item name display for vanilla runs. Change coloring of checks so the check name reflects status in vanilla runs. * Fixed "Recheck Area" button erroneously adding to an area's check totals? * Fix DMC vanilla checks. * Fix check tracker data recreation on data file loss. Removed redundant file exists check from SaveTrackerDataHook, as it doesn't matter if it exists or not at that point. Limited check loops to 3 to avoid infinite check loops on non-check/junk item pickup. Added more checks to disable tracker operations if a save is not running. Changed check ordering to put boss reward and heart container checks at the end of whatever RCSHOW group they belong to. * Fixed IsRunning calculation. Further improving vanilla checking. Starting framework for checking medallions, stones, and songs on data file recreation. Fixed medallion check collection. Added GIFT_FROM_SAGES to check list for vanilla file for tracking light medallion. Added check loop limitation to prevent infinite checking after picking up junk item from the ground. * Finished vanilla file recreation and recheck (songs and dungeon rewards all check properly now). This includes deku shield with KF shop item 3. Finished Gift from Raoru light medallion tracking for vanilla. Commented all CheckByScene functionality for now. * Fixed new save data file creation. Disabled entrance area calculation for now, as it only tracks the previous entrance for some reason. Fixed area detection for ToT checks. * GetCheckArea() now utilizes EntranceData almost exclusively, via either `gSaveContext.entranceIndex` or the entrance tracker's `currentGrottoId` in the case of grottos. This also means that EVERYTHING CAN AUTOSCROLL NOW. Entrance shuffles are now much easier to track. Autoscroll is now also triggered on save, just in case someone isn't autosaving and has a lot of checks that get converted to saved. * Fixed missing GS check in LW. * Added area scroll on toggling Show Hidden Items. May configure differently later. Fixed area detection for entrances in Gerudo Fortress/Valley and Collossus. Haunted wasteland doesn't autoscroll due to a bug in `OnTransitionEnd` hook, but checks still evaluate properly there. Rely on scene-based area detection if scene is a main overworld or dungeon scene. * Fixed grotto detection when shuffle is off. * Small code cleanup. Fixed Colossus hand chest checks. * Missing lus bump from merge conflict resolution * Fixed Colossus Grotto making `GetCheckArea` return Wasteland. * Improved OnItemReceive processing for non-token GS checks, since they can sometimes take long enough for the checking process to time out before the item is registered as received. * First attempt at thread safety for tracker data file writing. Seems to work, but might need more testing. * Fixed Recheck Area not unskipping items that register as saved. Improved delayed saving with autosaving, as the autosave triggered quite often before the tracker data save, making things not properly register as saved. * merge cleanup * Converted check tracker data to the sectional saves, adding `CheckTrackerData` to `SaveContext`. Implemented section ID returning and fullSave boolean passing to section functions from my PR temporarily for it to work properly. Moved `RandomizerCheckTrackerData` enum to `randomizerTypes.h` to accommodate that. Changed `Randomizer_SaveInit` to a `SaveManager::InitFunc` to allow for other randomizer-dependent sections to be initialized after that. Required a little refactoring to maintain intro cutscene skip when starting a randomizer file. * Revert section index return and randomizer init changes. Will need to wait on yet more changes to main. * Fixed check tracker initialization (shouldn't be tied to window initialization), restored saving/loading functionality. * Removed `CheckTracker::Init` and put SaveManager calls in `CheckTrackerWindow::InitElement`. Also a bit of cleanup from transition back to save file use. * Fixed tracker displaying check categories while file not loaded. * Fix Darunia's Joy check not marking in vanilla. * Fix autosave not triggering change from collected to saved in tracker data. * Changed default colors for scummed and collected display. * Merge upgrade code cleanup. * Add `OnTransitionEnd` calls to sandstorm transitions both to and from Wasteland. Also improved `gSaveContext.lastScene` assignment for both transition types. Allowed a bit of cleanup in `GetCheckArea`. * Added `StateButton`, a button like `ArrowButton` but that allows text instead of arrow icons. Apparently the changes from ArrowButton to StateButton happened in a previous commit... * Changed section name to `trackerDataCheck` to force SoH to load it after the randomizer section, as it required some randoSettings to be loaded first, and nothing else I tried to make the randomizer section load before it worked. This hacks a solution to checks not displaying on fast file load to a specific slot. F*** you, SaveManager, and f*** you too, JSON. * Forgot to change the section string for loading with the name change. * Fix check ordering for checks that trigger the autosave. * Adds option to remove right-side shop items (slots 1-4) from the tracker list. Enabled by default. * Fix default state of Hide Shop Right Checks checkbox. * Fixes grotto and great fairy scrolling and checks. Fixes array overflow from `checkTrackerData` which was creating the issue trying to load the base and randomizer sections first, among other things. That also fixed the massive file loads that were being exhibited in debug mode. * Fix shooting galleries being set as collected again when being played a second time after getting the checks. * Fix Bazaar autoscroll. * Add Saria's Song to `GetCheckFromActor` and removed some limitations from the messageCloseCheck function to make that check track properly. * Fix Song from Impa check. Implemented prevention for multiple "collections" of great fairies, just in case getting the health refill would trigger it with the previous setup. * Fix ice traps on GS tokens not triggering OnItemReceive. * Complete fix for ice trap collection from GS. Add autoscroll when clicking "Expand All". * Add `OnShopSlotChange` with cursorSlot and basePrice parameters. * Fixed include in en_ossan for shop slot hook. Added registration for `OnShopSlotChange` in the tracker, storing the price in a new `price` field in `CheckTrackerData`. Added "seen" functionality to shop checks. Displays the model item name upon first entering a shop, adding the price and switching to trickName (if it's an ice trap) upon navigating to the slot in buy mode, triggered by an invisible "identified" status that mirrors "seen" in every other way. Added tooltips to most options for check tracker color picking to describe what each status actually means. * `std::format` pls * So apparently std::format just decided to break with the latest merge from develop, but fmt::format exists and works? * Removed the last vestiges of `locationsSkipped`. Other general code and formatting cleanups. Moved `IsGameRunning` to `OTRGlobals` so the item tracker could also access it. Used preceding to "fix" item and bottle display in the item tracker on startup. * Some more code cleanup. Removed "Recheck Area" button and relevant code. Backported changes to Anchor branch applicable for single-player, including making a checkAreas vector and structuring the frame by frame checks around that. Also includes fix for Silver Gauntlets and Mirror Shield check collection crash associated with those changes. Fixed Kakariko Bazaar "seen" updates. Fixed tracker window not showing on initial load like it should. * Forgot 1 formatting fix. * Removed conditions for showing Song from Impa (isn't junk under certain conditions, so should show all the time). * Fix vanilla checks, add Zelda's Letter and Malon's Egg to manual check collection. Fix autoscroll while in child stealth section. * Fix crash in Happy Mask Shop in OnSlotChange (referenced non-existent shop id in a tracker-specific enum). * General code cleanup. * Missed one reversion. * One more. * Fix column alignment in `randomizer_check_objects`. * Fix file encoding on `randomizer_check_tracker`. Again. * Fix indentation for `actualItemtrackerItemMap`. Also removed unnecessary parts of the map. * Rename `HasEqItem` to `HasEquipment`. * Slightly better indentation for `actualItemTrackerItemMap`. * Add magic bean salesman to vanilla check tracking, and genericized deku shield to trigger KF shop item 3 wherever you get the shield. Renamed `vanillaCheck` to `vanillaHundoCheck` to (supposedly) clarify the meaning of the usage. * One more rename to `vanillaCompletion` to avoid possible confusion with 100% speedrun conditions. * give me a break XD Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * Changes suggested by briaguya (rename `RandomizerCheckShow` to `Status`, unused code, newline formatting) * Remove unused `itemNames` table. * Remove `IsGameRunning` in favor of `GameInteractor::IsSaveLoaded`. * Restore anti-spoiler functionality for dungeons with dungeon maps. * Review cleanup. * Fix prices not showing for Kak bazaar items. --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com>
2023-10-04 11:03:36 -04:00
RandomizerCheckTrackerData checkData = gSaveContext.checkTrackerData[rcObj.rc];
RandomizerCheckStatus status = checkData.status;
bool skipped = checkData.skipped;
if (status == RCSHOW_COLLECTED) {
if (!showHidden && CVarGetInteger("gCheckTrackerCollectedHide", 0)) {
Randomizer Auto Location tracker (#1942) * Initial Auto-Location Tracking * Updates styling for checked items in Check Tracker * Fixes crashing issues with Check Tracker rendering * Auto scroll Check Tracker windows to current area * Checks Tracker only shows checked locations once in game * Fixes issue where Check Tracker would auto-scroll to wrong location when entering a grotto * Fixes gerudo fortress checks showing in tracker when settings have them removed * InfTable Check Location Fixes: Lost Dog Richard, Rolling Gorons, HBA 1000, Thawed Zora * Fixes most Event Chk Inf Checks on Check Tracker, and Frogs * Check Tracker - Song from Malon now works * Check Tracker - Fixes Claim Check check not tracking - Fixes spoiler for Claim Check check when getting Biggoron's Sword - Fixes LACS being spoiled and not tracking * Check Tracker - Fixes #2 for Skull Mask and Mask of Truth checks * Check Tracker - Adds support for merchants - Fixes #7 for Bomchu Salesman - Fixes #12 for Medigoron * Check Tracker - Fixes #8 for Song from Saria * Check Tracker - Fixes #9 for Adult Shooting Gallery * Check Tracker - Fixes #10 for Composer Grave * Check Tracker - Fixes #14 for Song from Ocarina of Time * Check Tracker - Fixes #16 for Shooting the Sun * Check Tracker - Fixes #19 for Darunia's Joy * Save Editor - Adds missing label for Treasure Chest Game * Check Tracker - Fixes Great Faries checks * Check Tracker - Fixes Sheik at Temple * Check Tracker - Fixes Great Fairy auto-scroll to wrong location * Check Tracker - Updates blue warp checks - Fixes Bongo Bongo and Twinrova checks * Check Tracker - Fixes Dampe's Gravedigging Tour * Check Tracker - Fixes Prescription to King Zora * Check Tracker - Fixes Bazaar showing under wrong area on tracker between adult/child * Check Tracker - Fixes scroll for Hyrule Market and Bazaar * Check Tracker - Fixes giving Adult Trade Items shown on tracker: Broken Sword, Saw, Cojiro, Eyeball Froge, and Eyedrops * Cleans up item_location * Check Tracker - Item List - Fixes item list not updating when changing seeds/options - Separates item exclusion list from item check list - Clean up comments * Check Tracker - Adds Skip functionality to buttons * Check Tracker - Refactors adult trade items to RandomizerInf * Check Tracker - Fixes an issue where any time an item is removed the tracker would cause an application crash * Check Tracker - Item names are now dependent on file language * Check Tracker - Fixes Gerudo Card check not showing in Fast setting * Reorders headers to (hopefully) avoid CI build conflicts on linux/consoles * Explicitly defines vector header in randomizer.h to fix compile errors * Complete Refactor of Check Tracker ImGui * Adds missing check tracker files to CMakeLists * Reverts the Item_location whitespace cleanup from ad10807c * Check Tracker - Loading Fixes - Fixes a bug where loading a save file a second time would add all the checks again - Fixes a bug where the check tracker would not render at all until in a save file * Check Tracker - Fixes a bug where checks would sometimes fail to load * Check Tracker - Fixes duplicated checks when using Only on Pause or Only on Combo * Check Tracker - Works around issue where single characters don't show in EnhancementCombobox, and fixes a label for combo buttons held option * Check Tracker - Applies all Check Tracker changes to Item Location * Check Tracker - Updated Check List - Adds Link's pocket, either in KF or HM depending on starting age - Supports Scrubs and Merchants - Uses enums instead of magic numbers - Updates DC Scrub Short Names for MQ * Check Tracker - Adds a performance mode option * Check Tracker - List Fixes (requires new rando generation) - Fixes Frogs Rupees always visible - Fixes Kokiri Sword Chest not showing - Fixes Weird Egg not showing * Check Tracker - MQ List basic support * Check Tracker - MQ/Vanilla anti-spoilers * Check Tracker - Collecting a compass now spoils the area * Check Tracker - Basic Vanilla Support and fixes - Vanilla items show in check tracker, even if many won't auto check - Fixes an issue with Gerudo Fortress Keys - Refactors IsVisibleInCheckTracker to randomizer_check_tracjer * Check Tracker - Fixes merge conflict from 08a487f35e1d760ab9e69b932edbe4da6bcd9edb * Check Tracker - Fixes tracker loading as Floating when default value is set to Windowed * Randomizer Location Exclusion List - Adds Scrubs, Merchants, Shops. Adult Trade items, MQ Dungeons, and Bean Salesman - Fixes Kokiri Sword Chest, Weird Egg, and Frog Song Rupees from misbehaving - Updates Gerudo Fortress logic to be dependent on Open/Fast/Normal Fortress - Removes Invalid Check - Adds RO Enum for MQ settings - Updates magic values to RO enum * Location Exclusion List - Scrubs that are always randomized now always show on the list * For now, removes some extra code only needed for a Check Tracker. * Randomizer Location Exclusion List - Fixes Eyeball Frog from showing up when Adult Trade Items was off * Location Tracker - Updates Eyedrops to use RandomizerInf instead of Chest * Check Tracker - Fixes a bug where Link's Pocket item wasn't acting as checked for area item count * Check Tracker - Fixes a bug where Locations would incorrectly say Vanilla due to the first check in the area being a non-MQ check * Check Tracker - Fixes a crash when Check Tracker is docked but not visible * Check Tracker - Fixes areas being spoiled when loading different save files * Check Tracker - Only reset variables if they are initialized * Check Tracker - Cleans up old comments, unused variables, methods, and macros, adds language TODOs, * Check Tracker - Readds rainbow UI elements after Cosmetics Editor refactor * Check Tracker - Removal of flag lookup that was refactored, no longer needed header, and some trivial whitespace fixes. * Check Tracker - Refactors Index to Bitmask code to a macro * Check Tracker - Changes ordering from alphabetical to RandomizerCheck ordering * Check Tracker - Wraps everything in a namespace to avoid global variable usage * Check Tracker - Explicitly defines for-loop scope * Check Tracker - refactors dungeon lookup from static array to function * Fixes a bug when using EnhancementColor with alpha * Check Tracker - Refactors all colour to use direct conversions * Check Tracker - refactors settings loading and check visibility for readability * Check Tracker - Fixes a bug where the wrong label showed on the Check Tracker BG Color * UIWidgets - Adds Alpha bar to EnhancementColor when using alpha parameter
2022-12-10 22:39:23 -05:00
return;
}
Check Tracker Update (#2668) * Initial commit. What works so far: Data file loads, saves, deletes, and is created properly. - Need to run `HasItemBeenCollected` when creating in case of mid-seed regen. Organized checks into maps set by area. Areas show in tracker. - Checks pulled from checkObjectsByArea are not currently listed. - Areas are being assumed completed and hidden at the start. * Checks now populate. Still not counting area totals properly. * Don't track RC_LINKS_POCKET in the data file, and instead manually add it in every time a save is load. rcObjects doesn't contain Link's Pocket location (duh). * Moved ItemReceive hook to randomizer_check_tracker.cpp. Skipped items are properly sorted and formatted. Saved items contribute to an area's gotten/skipped checks on load. Changed skipped items default main color to gray. General code cleanup. * Skipped checks now contribute to area totals for area completion logic. * Mid-menu rework transfer. * Started check lookup on item receive. Tried to enable scum checking on save. * Fixed scum check on save. * More code cleanup, which revealed some issues with loading and saving. Loading now works 100%, but entries in checkTrackerData are disappearing in code somewhere, causing issues with later checks. Scummed color now displays properly. Collected but unsaved displays properly. Unchecked, Skipped, Seen and Scummed checks all have arrows for skipping/unskipping. Counts a little messed up, probably double adding skips. * Fixed item counts being off across resets. Restarts were fine. * Beginning of rework for individual check updates. Adds `Actor lastCheck` to PlayState to allow assigning of last actor to give an item. This allows precise tracking of GS, freestanding PoH, etc. Works for chests too. Currently does not work for shops, unknown for normal NPC gives. Doesn't track last gives for non-checks, like drops from grass, pots, crates, etc. * Actor-based checks fully fleshed out, but can't help with sale-based checks. Implemented `pendingSaleCheck` to back out of an RC check cycle if `gSaveContext->pendingSale` is not NONE when `OnItemReceive` is called, processed through `OnSaleEnd`. This should be the final change necessary to streamline the checks. * Temporary hook to message box close to tie in trackers for non-gs/chest actors that aren't added to `GetCheckFromActor`. This triggers a 2-frame countdown to check with `HasItemBeenCollected` since half of the methods in there aren't updated until after a text box closes. Added scene tracking to get last scene so that checks in scenes that span several overworld areas could be tied to their areas properly. Modified tracker data creation to apply Link's Pocket and Song from Impa conditionally based on randomizer settings instead of just being assumed to be done. May need modification for checking click and drag spoiler loading. Removed the scene equivalence check from CheckChecks so that an entire area is checked each time to avoid issues with, e.g., leaving a shop before a pending sale finishes. * Changed check data creation to use RSKs from gRandomizer to account for settings loaded from drag and drop spoilers. * Beginning of tracker code organization. Changed check color defaults. * Reverted moving tracker colors to header. Some individual check fixes. * Missed something from previous merge? * Removed last remnant of removed performance mode. * Better handle checking when skullsanity is off. * Song checks sceneIDs don't match the scenes they're actually in for some reason. Removed that check. * SaleEnd checks don't need the GetItemEntry parameter. Also set a flag that should prevent the check tracker from running during vanilla saves should that not be resolved by the time it's merged. * Attempting to have only the relevant checks added to the tracker data, as well as showing vanilla checks for non-rando saves. Not working yet (everything is displayed in vanilla). * Added vanilla check tracker population via `vanillaCheck` bool in `RandomizerCheckObject`. This is also added to `IsVisibleInImGui` to handle file loading and saving to eliminate checks that aren't part of vanilla or the rando seed. Implemented deleted tracker data file recreation. Added some extra item name text checks. Songs are still... tricky, so they stay blank. Utilize local copies of the randomizer check objects that are applicable for performance purposes. Fixed vanilla item-giving cutscene crashes when triggered mid-transition. * Apparently not all toolchains can handle macro instantiation without all parameters, like VS can. * Fixed scummed detail color not showing properly on tracker. * Fixed dungeon area totals and GS checks not functioning properly. * Major revamp of checking code. Doesn't rely on `GetCheckFromActor` at all anymore, but instead simply sets a flag to evaluate a number of checks in an area every frame until the check that was gotten is identified. With the new setup, it's much less hardware intensive, and at 60fps 6 checks per frame shows no noticeable effect on framerate. I can envision needing to add a collectedCount in order to account for times when two checks are gotten one right after the other. Changed area scroll to happen from `OnTransitionEnd`, and allow for scrolling in bazaar (was disabled previously because it would jump back and forth between Kak and Market while you were in one). Also setup area check order updating by area instead of all at the same time. * Fixed shooting gallery not reporting proper area. Prevent checks from actually happening if area is RCAREA_INVALID, now that all areas are reporting something if they have checks. Fixed `GetCheckArea()` not updating checks for standard scenes. Lots of vanilla tracking updates, mainly manual checks for gems, medallions and songs, since the often don't have proper scenes in the data. Prevent vanilla from triggering check loops if junk items are collected. Fixed sorting based on saved vs collected. Prevent item name display for vanilla runs. Change coloring of checks so the check name reflects status in vanilla runs. * Fixed "Recheck Area" button erroneously adding to an area's check totals? * Fix DMC vanilla checks. * Fix check tracker data recreation on data file loss. Removed redundant file exists check from SaveTrackerDataHook, as it doesn't matter if it exists or not at that point. Limited check loops to 3 to avoid infinite check loops on non-check/junk item pickup. Added more checks to disable tracker operations if a save is not running. Changed check ordering to put boss reward and heart container checks at the end of whatever RCSHOW group they belong to. * Fixed IsRunning calculation. Further improving vanilla checking. Starting framework for checking medallions, stones, and songs on data file recreation. Fixed medallion check collection. Added GIFT_FROM_SAGES to check list for vanilla file for tracking light medallion. Added check loop limitation to prevent infinite checking after picking up junk item from the ground. * Finished vanilla file recreation and recheck (songs and dungeon rewards all check properly now). This includes deku shield with KF shop item 3. Finished Gift from Raoru light medallion tracking for vanilla. Commented all CheckByScene functionality for now. * Fixed new save data file creation. Disabled entrance area calculation for now, as it only tracks the previous entrance for some reason. Fixed area detection for ToT checks. * GetCheckArea() now utilizes EntranceData almost exclusively, via either `gSaveContext.entranceIndex` or the entrance tracker's `currentGrottoId` in the case of grottos. This also means that EVERYTHING CAN AUTOSCROLL NOW. Entrance shuffles are now much easier to track. Autoscroll is now also triggered on save, just in case someone isn't autosaving and has a lot of checks that get converted to saved. * Fixed missing GS check in LW. * Added area scroll on toggling Show Hidden Items. May configure differently later. Fixed area detection for entrances in Gerudo Fortress/Valley and Collossus. Haunted wasteland doesn't autoscroll due to a bug in `OnTransitionEnd` hook, but checks still evaluate properly there. Rely on scene-based area detection if scene is a main overworld or dungeon scene. * Fixed grotto detection when shuffle is off. * Small code cleanup. Fixed Colossus hand chest checks. * Missing lus bump from merge conflict resolution * Fixed Colossus Grotto making `GetCheckArea` return Wasteland. * Improved OnItemReceive processing for non-token GS checks, since they can sometimes take long enough for the checking process to time out before the item is registered as received. * First attempt at thread safety for tracker data file writing. Seems to work, but might need more testing. * Fixed Recheck Area not unskipping items that register as saved. Improved delayed saving with autosaving, as the autosave triggered quite often before the tracker data save, making things not properly register as saved. * merge cleanup * Converted check tracker data to the sectional saves, adding `CheckTrackerData` to `SaveContext`. Implemented section ID returning and fullSave boolean passing to section functions from my PR temporarily for it to work properly. Moved `RandomizerCheckTrackerData` enum to `randomizerTypes.h` to accommodate that. Changed `Randomizer_SaveInit` to a `SaveManager::InitFunc` to allow for other randomizer-dependent sections to be initialized after that. Required a little refactoring to maintain intro cutscene skip when starting a randomizer file. * Revert section index return and randomizer init changes. Will need to wait on yet more changes to main. * Fixed check tracker initialization (shouldn't be tied to window initialization), restored saving/loading functionality. * Removed `CheckTracker::Init` and put SaveManager calls in `CheckTrackerWindow::InitElement`. Also a bit of cleanup from transition back to save file use. * Fixed tracker displaying check categories while file not loaded. * Fix Darunia's Joy check not marking in vanilla. * Fix autosave not triggering change from collected to saved in tracker data. * Changed default colors for scummed and collected display. * Merge upgrade code cleanup. * Add `OnTransitionEnd` calls to sandstorm transitions both to and from Wasteland. Also improved `gSaveContext.lastScene` assignment for both transition types. Allowed a bit of cleanup in `GetCheckArea`. * Added `StateButton`, a button like `ArrowButton` but that allows text instead of arrow icons. Apparently the changes from ArrowButton to StateButton happened in a previous commit... * Changed section name to `trackerDataCheck` to force SoH to load it after the randomizer section, as it required some randoSettings to be loaded first, and nothing else I tried to make the randomizer section load before it worked. This hacks a solution to checks not displaying on fast file load to a specific slot. F*** you, SaveManager, and f*** you too, JSON. * Forgot to change the section string for loading with the name change. * Fix check ordering for checks that trigger the autosave. * Adds option to remove right-side shop items (slots 1-4) from the tracker list. Enabled by default. * Fix default state of Hide Shop Right Checks checkbox. * Fixes grotto and great fairy scrolling and checks. Fixes array overflow from `checkTrackerData` which was creating the issue trying to load the base and randomizer sections first, among other things. That also fixed the massive file loads that were being exhibited in debug mode. * Fix shooting galleries being set as collected again when being played a second time after getting the checks. * Fix Bazaar autoscroll. * Add Saria's Song to `GetCheckFromActor` and removed some limitations from the messageCloseCheck function to make that check track properly. * Fix Song from Impa check. Implemented prevention for multiple "collections" of great fairies, just in case getting the health refill would trigger it with the previous setup. * Fix ice traps on GS tokens not triggering OnItemReceive. * Complete fix for ice trap collection from GS. Add autoscroll when clicking "Expand All". * Add `OnShopSlotChange` with cursorSlot and basePrice parameters. * Fixed include in en_ossan for shop slot hook. Added registration for `OnShopSlotChange` in the tracker, storing the price in a new `price` field in `CheckTrackerData`. Added "seen" functionality to shop checks. Displays the model item name upon first entering a shop, adding the price and switching to trickName (if it's an ice trap) upon navigating to the slot in buy mode, triggered by an invisible "identified" status that mirrors "seen" in every other way. Added tooltips to most options for check tracker color picking to describe what each status actually means. * `std::format` pls * So apparently std::format just decided to break with the latest merge from develop, but fmt::format exists and works? * Removed the last vestiges of `locationsSkipped`. Other general code and formatting cleanups. Moved `IsGameRunning` to `OTRGlobals` so the item tracker could also access it. Used preceding to "fix" item and bottle display in the item tracker on startup. * Some more code cleanup. Removed "Recheck Area" button and relevant code. Backported changes to Anchor branch applicable for single-player, including making a checkAreas vector and structuring the frame by frame checks around that. Also includes fix for Silver Gauntlets and Mirror Shield check collection crash associated with those changes. Fixed Kakariko Bazaar "seen" updates. Fixed tracker window not showing on initial load like it should. * Forgot 1 formatting fix. * Removed conditions for showing Song from Impa (isn't junk under certain conditions, so should show all the time). * Fix vanilla checks, add Zelda's Letter and Malon's Egg to manual check collection. Fix autoscroll while in child stealth section. * Fix crash in Happy Mask Shop in OnSlotChange (referenced non-existent shop id in a tracker-specific enum). * General code cleanup. * Missed one reversion. * One more. * Fix column alignment in `randomizer_check_objects`. * Fix file encoding on `randomizer_check_tracker`. Again. * Fix indentation for `actualItemtrackerItemMap`. Also removed unnecessary parts of the map. * Rename `HasEqItem` to `HasEquipment`. * Slightly better indentation for `actualItemTrackerItemMap`. * Add magic bean salesman to vanilla check tracking, and genericized deku shield to trigger KF shop item 3 wherever you get the shield. Renamed `vanillaCheck` to `vanillaHundoCheck` to (supposedly) clarify the meaning of the usage. * One more rename to `vanillaCompletion` to avoid possible confusion with 100% speedrun conditions. * give me a break XD Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * Changes suggested by briaguya (rename `RandomizerCheckShow` to `Status`, unused code, newline formatting) * Remove unused `itemNames` table. * Remove `IsGameRunning` in favor of `GameInteractor::IsSaveLoaded`. * Restore anti-spoiler functionality for dungeons with dungeon maps. * Review cleanup. * Fix prices not showing for Kak bazaar items. --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com>
2023-10-04 11:03:36 -04:00
mainColor = !IsHeartPiece(rcObj.ogItemId) && !IS_RANDO ? CVarGetColor("gCheckTrackerCollectedExtraColor", Color_Collected_Extra_Default) :
CVarGetColor("gCheckTrackerCollectedMainColor", Color_Main_Default);
Check Tracker Update (#2668) * Initial commit. What works so far: Data file loads, saves, deletes, and is created properly. - Need to run `HasItemBeenCollected` when creating in case of mid-seed regen. Organized checks into maps set by area. Areas show in tracker. - Checks pulled from checkObjectsByArea are not currently listed. - Areas are being assumed completed and hidden at the start. * Checks now populate. Still not counting area totals properly. * Don't track RC_LINKS_POCKET in the data file, and instead manually add it in every time a save is load. rcObjects doesn't contain Link's Pocket location (duh). * Moved ItemReceive hook to randomizer_check_tracker.cpp. Skipped items are properly sorted and formatted. Saved items contribute to an area's gotten/skipped checks on load. Changed skipped items default main color to gray. General code cleanup. * Skipped checks now contribute to area totals for area completion logic. * Mid-menu rework transfer. * Started check lookup on item receive. Tried to enable scum checking on save. * Fixed scum check on save. * More code cleanup, which revealed some issues with loading and saving. Loading now works 100%, but entries in checkTrackerData are disappearing in code somewhere, causing issues with later checks. Scummed color now displays properly. Collected but unsaved displays properly. Unchecked, Skipped, Seen and Scummed checks all have arrows for skipping/unskipping. Counts a little messed up, probably double adding skips. * Fixed item counts being off across resets. Restarts were fine. * Beginning of rework for individual check updates. Adds `Actor lastCheck` to PlayState to allow assigning of last actor to give an item. This allows precise tracking of GS, freestanding PoH, etc. Works for chests too. Currently does not work for shops, unknown for normal NPC gives. Doesn't track last gives for non-checks, like drops from grass, pots, crates, etc. * Actor-based checks fully fleshed out, but can't help with sale-based checks. Implemented `pendingSaleCheck` to back out of an RC check cycle if `gSaveContext->pendingSale` is not NONE when `OnItemReceive` is called, processed through `OnSaleEnd`. This should be the final change necessary to streamline the checks. * Temporary hook to message box close to tie in trackers for non-gs/chest actors that aren't added to `GetCheckFromActor`. This triggers a 2-frame countdown to check with `HasItemBeenCollected` since half of the methods in there aren't updated until after a text box closes. Added scene tracking to get last scene so that checks in scenes that span several overworld areas could be tied to their areas properly. Modified tracker data creation to apply Link's Pocket and Song from Impa conditionally based on randomizer settings instead of just being assumed to be done. May need modification for checking click and drag spoiler loading. Removed the scene equivalence check from CheckChecks so that an entire area is checked each time to avoid issues with, e.g., leaving a shop before a pending sale finishes. * Changed check data creation to use RSKs from gRandomizer to account for settings loaded from drag and drop spoilers. * Beginning of tracker code organization. Changed check color defaults. * Reverted moving tracker colors to header. Some individual check fixes. * Missed something from previous merge? * Removed last remnant of removed performance mode. * Better handle checking when skullsanity is off. * Song checks sceneIDs don't match the scenes they're actually in for some reason. Removed that check. * SaleEnd checks don't need the GetItemEntry parameter. Also set a flag that should prevent the check tracker from running during vanilla saves should that not be resolved by the time it's merged. * Attempting to have only the relevant checks added to the tracker data, as well as showing vanilla checks for non-rando saves. Not working yet (everything is displayed in vanilla). * Added vanilla check tracker population via `vanillaCheck` bool in `RandomizerCheckObject`. This is also added to `IsVisibleInImGui` to handle file loading and saving to eliminate checks that aren't part of vanilla or the rando seed. Implemented deleted tracker data file recreation. Added some extra item name text checks. Songs are still... tricky, so they stay blank. Utilize local copies of the randomizer check objects that are applicable for performance purposes. Fixed vanilla item-giving cutscene crashes when triggered mid-transition. * Apparently not all toolchains can handle macro instantiation without all parameters, like VS can. * Fixed scummed detail color not showing properly on tracker. * Fixed dungeon area totals and GS checks not functioning properly. * Major revamp of checking code. Doesn't rely on `GetCheckFromActor` at all anymore, but instead simply sets a flag to evaluate a number of checks in an area every frame until the check that was gotten is identified. With the new setup, it's much less hardware intensive, and at 60fps 6 checks per frame shows no noticeable effect on framerate. I can envision needing to add a collectedCount in order to account for times when two checks are gotten one right after the other. Changed area scroll to happen from `OnTransitionEnd`, and allow for scrolling in bazaar (was disabled previously because it would jump back and forth between Kak and Market while you were in one). Also setup area check order updating by area instead of all at the same time. * Fixed shooting gallery not reporting proper area. Prevent checks from actually happening if area is RCAREA_INVALID, now that all areas are reporting something if they have checks. Fixed `GetCheckArea()` not updating checks for standard scenes. Lots of vanilla tracking updates, mainly manual checks for gems, medallions and songs, since the often don't have proper scenes in the data. Prevent vanilla from triggering check loops if junk items are collected. Fixed sorting based on saved vs collected. Prevent item name display for vanilla runs. Change coloring of checks so the check name reflects status in vanilla runs. * Fixed "Recheck Area" button erroneously adding to an area's check totals? * Fix DMC vanilla checks. * Fix check tracker data recreation on data file loss. Removed redundant file exists check from SaveTrackerDataHook, as it doesn't matter if it exists or not at that point. Limited check loops to 3 to avoid infinite check loops on non-check/junk item pickup. Added more checks to disable tracker operations if a save is not running. Changed check ordering to put boss reward and heart container checks at the end of whatever RCSHOW group they belong to. * Fixed IsRunning calculation. Further improving vanilla checking. Starting framework for checking medallions, stones, and songs on data file recreation. Fixed medallion check collection. Added GIFT_FROM_SAGES to check list for vanilla file for tracking light medallion. Added check loop limitation to prevent infinite checking after picking up junk item from the ground. * Finished vanilla file recreation and recheck (songs and dungeon rewards all check properly now). This includes deku shield with KF shop item 3. Finished Gift from Raoru light medallion tracking for vanilla. Commented all CheckByScene functionality for now. * Fixed new save data file creation. Disabled entrance area calculation for now, as it only tracks the previous entrance for some reason. Fixed area detection for ToT checks. * GetCheckArea() now utilizes EntranceData almost exclusively, via either `gSaveContext.entranceIndex` or the entrance tracker's `currentGrottoId` in the case of grottos. This also means that EVERYTHING CAN AUTOSCROLL NOW. Entrance shuffles are now much easier to track. Autoscroll is now also triggered on save, just in case someone isn't autosaving and has a lot of checks that get converted to saved. * Fixed missing GS check in LW. * Added area scroll on toggling Show Hidden Items. May configure differently later. Fixed area detection for entrances in Gerudo Fortress/Valley and Collossus. Haunted wasteland doesn't autoscroll due to a bug in `OnTransitionEnd` hook, but checks still evaluate properly there. Rely on scene-based area detection if scene is a main overworld or dungeon scene. * Fixed grotto detection when shuffle is off. * Small code cleanup. Fixed Colossus hand chest checks. * Missing lus bump from merge conflict resolution * Fixed Colossus Grotto making `GetCheckArea` return Wasteland. * Improved OnItemReceive processing for non-token GS checks, since they can sometimes take long enough for the checking process to time out before the item is registered as received. * First attempt at thread safety for tracker data file writing. Seems to work, but might need more testing. * Fixed Recheck Area not unskipping items that register as saved. Improved delayed saving with autosaving, as the autosave triggered quite often before the tracker data save, making things not properly register as saved. * merge cleanup * Converted check tracker data to the sectional saves, adding `CheckTrackerData` to `SaveContext`. Implemented section ID returning and fullSave boolean passing to section functions from my PR temporarily for it to work properly. Moved `RandomizerCheckTrackerData` enum to `randomizerTypes.h` to accommodate that. Changed `Randomizer_SaveInit` to a `SaveManager::InitFunc` to allow for other randomizer-dependent sections to be initialized after that. Required a little refactoring to maintain intro cutscene skip when starting a randomizer file. * Revert section index return and randomizer init changes. Will need to wait on yet more changes to main. * Fixed check tracker initialization (shouldn't be tied to window initialization), restored saving/loading functionality. * Removed `CheckTracker::Init` and put SaveManager calls in `CheckTrackerWindow::InitElement`. Also a bit of cleanup from transition back to save file use. * Fixed tracker displaying check categories while file not loaded. * Fix Darunia's Joy check not marking in vanilla. * Fix autosave not triggering change from collected to saved in tracker data. * Changed default colors for scummed and collected display. * Merge upgrade code cleanup. * Add `OnTransitionEnd` calls to sandstorm transitions both to and from Wasteland. Also improved `gSaveContext.lastScene` assignment for both transition types. Allowed a bit of cleanup in `GetCheckArea`. * Added `StateButton`, a button like `ArrowButton` but that allows text instead of arrow icons. Apparently the changes from ArrowButton to StateButton happened in a previous commit... * Changed section name to `trackerDataCheck` to force SoH to load it after the randomizer section, as it required some randoSettings to be loaded first, and nothing else I tried to make the randomizer section load before it worked. This hacks a solution to checks not displaying on fast file load to a specific slot. F*** you, SaveManager, and f*** you too, JSON. * Forgot to change the section string for loading with the name change. * Fix check ordering for checks that trigger the autosave. * Adds option to remove right-side shop items (slots 1-4) from the tracker list. Enabled by default. * Fix default state of Hide Shop Right Checks checkbox. * Fixes grotto and great fairy scrolling and checks. Fixes array overflow from `checkTrackerData` which was creating the issue trying to load the base and randomizer sections first, among other things. That also fixed the massive file loads that were being exhibited in debug mode. * Fix shooting galleries being set as collected again when being played a second time after getting the checks. * Fix Bazaar autoscroll. * Add Saria's Song to `GetCheckFromActor` and removed some limitations from the messageCloseCheck function to make that check track properly. * Fix Song from Impa check. Implemented prevention for multiple "collections" of great fairies, just in case getting the health refill would trigger it with the previous setup. * Fix ice traps on GS tokens not triggering OnItemReceive. * Complete fix for ice trap collection from GS. Add autoscroll when clicking "Expand All". * Add `OnShopSlotChange` with cursorSlot and basePrice parameters. * Fixed include in en_ossan for shop slot hook. Added registration for `OnShopSlotChange` in the tracker, storing the price in a new `price` field in `CheckTrackerData`. Added "seen" functionality to shop checks. Displays the model item name upon first entering a shop, adding the price and switching to trickName (if it's an ice trap) upon navigating to the slot in buy mode, triggered by an invisible "identified" status that mirrors "seen" in every other way. Added tooltips to most options for check tracker color picking to describe what each status actually means. * `std::format` pls * So apparently std::format just decided to break with the latest merge from develop, but fmt::format exists and works? * Removed the last vestiges of `locationsSkipped`. Other general code and formatting cleanups. Moved `IsGameRunning` to `OTRGlobals` so the item tracker could also access it. Used preceding to "fix" item and bottle display in the item tracker on startup. * Some more code cleanup. Removed "Recheck Area" button and relevant code. Backported changes to Anchor branch applicable for single-player, including making a checkAreas vector and structuring the frame by frame checks around that. Also includes fix for Silver Gauntlets and Mirror Shield check collection crash associated with those changes. Fixed Kakariko Bazaar "seen" updates. Fixed tracker window not showing on initial load like it should. * Forgot 1 formatting fix. * Removed conditions for showing Song from Impa (isn't junk under certain conditions, so should show all the time). * Fix vanilla checks, add Zelda's Letter and Malon's Egg to manual check collection. Fix autoscroll while in child stealth section. * Fix crash in Happy Mask Shop in OnSlotChange (referenced non-existent shop id in a tracker-specific enum). * General code cleanup. * Missed one reversion. * One more. * Fix column alignment in `randomizer_check_objects`. * Fix file encoding on `randomizer_check_tracker`. Again. * Fix indentation for `actualItemtrackerItemMap`. Also removed unnecessary parts of the map. * Rename `HasEqItem` to `HasEquipment`. * Slightly better indentation for `actualItemTrackerItemMap`. * Add magic bean salesman to vanilla check tracking, and genericized deku shield to trigger KF shop item 3 wherever you get the shield. Renamed `vanillaCheck` to `vanillaHundoCheck` to (supposedly) clarify the meaning of the usage. * One more rename to `vanillaCompletion` to avoid possible confusion with 100% speedrun conditions. * give me a break XD Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * Changes suggested by briaguya (rename `RandomizerCheckShow` to `Status`, unused code, newline formatting) * Remove unused `itemNames` table. * Remove `IsGameRunning` in favor of `GameInteractor::IsSaveLoaded`. * Restore anti-spoiler functionality for dungeons with dungeon maps. * Review cleanup. * Fix prices not showing for Kak bazaar items. --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com>
2023-10-04 11:03:36 -04:00
extraColor = CVarGetColor("gCheckTrackerCollectedExtraColor", Color_Collected_Extra_Default);
} else if (status == RCSHOW_SAVED) {
if (!showHidden && CVarGetInteger("gCheckTrackerSavedHide", 0)) {
Check Tracker Update (#2668) * Initial commit. What works so far: Data file loads, saves, deletes, and is created properly. - Need to run `HasItemBeenCollected` when creating in case of mid-seed regen. Organized checks into maps set by area. Areas show in tracker. - Checks pulled from checkObjectsByArea are not currently listed. - Areas are being assumed completed and hidden at the start. * Checks now populate. Still not counting area totals properly. * Don't track RC_LINKS_POCKET in the data file, and instead manually add it in every time a save is load. rcObjects doesn't contain Link's Pocket location (duh). * Moved ItemReceive hook to randomizer_check_tracker.cpp. Skipped items are properly sorted and formatted. Saved items contribute to an area's gotten/skipped checks on load. Changed skipped items default main color to gray. General code cleanup. * Skipped checks now contribute to area totals for area completion logic. * Mid-menu rework transfer. * Started check lookup on item receive. Tried to enable scum checking on save. * Fixed scum check on save. * More code cleanup, which revealed some issues with loading and saving. Loading now works 100%, but entries in checkTrackerData are disappearing in code somewhere, causing issues with later checks. Scummed color now displays properly. Collected but unsaved displays properly. Unchecked, Skipped, Seen and Scummed checks all have arrows for skipping/unskipping. Counts a little messed up, probably double adding skips. * Fixed item counts being off across resets. Restarts were fine. * Beginning of rework for individual check updates. Adds `Actor lastCheck` to PlayState to allow assigning of last actor to give an item. This allows precise tracking of GS, freestanding PoH, etc. Works for chests too. Currently does not work for shops, unknown for normal NPC gives. Doesn't track last gives for non-checks, like drops from grass, pots, crates, etc. * Actor-based checks fully fleshed out, but can't help with sale-based checks. Implemented `pendingSaleCheck` to back out of an RC check cycle if `gSaveContext->pendingSale` is not NONE when `OnItemReceive` is called, processed through `OnSaleEnd`. This should be the final change necessary to streamline the checks. * Temporary hook to message box close to tie in trackers for non-gs/chest actors that aren't added to `GetCheckFromActor`. This triggers a 2-frame countdown to check with `HasItemBeenCollected` since half of the methods in there aren't updated until after a text box closes. Added scene tracking to get last scene so that checks in scenes that span several overworld areas could be tied to their areas properly. Modified tracker data creation to apply Link's Pocket and Song from Impa conditionally based on randomizer settings instead of just being assumed to be done. May need modification for checking click and drag spoiler loading. Removed the scene equivalence check from CheckChecks so that an entire area is checked each time to avoid issues with, e.g., leaving a shop before a pending sale finishes. * Changed check data creation to use RSKs from gRandomizer to account for settings loaded from drag and drop spoilers. * Beginning of tracker code organization. Changed check color defaults. * Reverted moving tracker colors to header. Some individual check fixes. * Missed something from previous merge? * Removed last remnant of removed performance mode. * Better handle checking when skullsanity is off. * Song checks sceneIDs don't match the scenes they're actually in for some reason. Removed that check. * SaleEnd checks don't need the GetItemEntry parameter. Also set a flag that should prevent the check tracker from running during vanilla saves should that not be resolved by the time it's merged. * Attempting to have only the relevant checks added to the tracker data, as well as showing vanilla checks for non-rando saves. Not working yet (everything is displayed in vanilla). * Added vanilla check tracker population via `vanillaCheck` bool in `RandomizerCheckObject`. This is also added to `IsVisibleInImGui` to handle file loading and saving to eliminate checks that aren't part of vanilla or the rando seed. Implemented deleted tracker data file recreation. Added some extra item name text checks. Songs are still... tricky, so they stay blank. Utilize local copies of the randomizer check objects that are applicable for performance purposes. Fixed vanilla item-giving cutscene crashes when triggered mid-transition. * Apparently not all toolchains can handle macro instantiation without all parameters, like VS can. * Fixed scummed detail color not showing properly on tracker. * Fixed dungeon area totals and GS checks not functioning properly. * Major revamp of checking code. Doesn't rely on `GetCheckFromActor` at all anymore, but instead simply sets a flag to evaluate a number of checks in an area every frame until the check that was gotten is identified. With the new setup, it's much less hardware intensive, and at 60fps 6 checks per frame shows no noticeable effect on framerate. I can envision needing to add a collectedCount in order to account for times when two checks are gotten one right after the other. Changed area scroll to happen from `OnTransitionEnd`, and allow for scrolling in bazaar (was disabled previously because it would jump back and forth between Kak and Market while you were in one). Also setup area check order updating by area instead of all at the same time. * Fixed shooting gallery not reporting proper area. Prevent checks from actually happening if area is RCAREA_INVALID, now that all areas are reporting something if they have checks. Fixed `GetCheckArea()` not updating checks for standard scenes. Lots of vanilla tracking updates, mainly manual checks for gems, medallions and songs, since the often don't have proper scenes in the data. Prevent vanilla from triggering check loops if junk items are collected. Fixed sorting based on saved vs collected. Prevent item name display for vanilla runs. Change coloring of checks so the check name reflects status in vanilla runs. * Fixed "Recheck Area" button erroneously adding to an area's check totals? * Fix DMC vanilla checks. * Fix check tracker data recreation on data file loss. Removed redundant file exists check from SaveTrackerDataHook, as it doesn't matter if it exists or not at that point. Limited check loops to 3 to avoid infinite check loops on non-check/junk item pickup. Added more checks to disable tracker operations if a save is not running. Changed check ordering to put boss reward and heart container checks at the end of whatever RCSHOW group they belong to. * Fixed IsRunning calculation. Further improving vanilla checking. Starting framework for checking medallions, stones, and songs on data file recreation. Fixed medallion check collection. Added GIFT_FROM_SAGES to check list for vanilla file for tracking light medallion. Added check loop limitation to prevent infinite checking after picking up junk item from the ground. * Finished vanilla file recreation and recheck (songs and dungeon rewards all check properly now). This includes deku shield with KF shop item 3. Finished Gift from Raoru light medallion tracking for vanilla. Commented all CheckByScene functionality for now. * Fixed new save data file creation. Disabled entrance area calculation for now, as it only tracks the previous entrance for some reason. Fixed area detection for ToT checks. * GetCheckArea() now utilizes EntranceData almost exclusively, via either `gSaveContext.entranceIndex` or the entrance tracker's `currentGrottoId` in the case of grottos. This also means that EVERYTHING CAN AUTOSCROLL NOW. Entrance shuffles are now much easier to track. Autoscroll is now also triggered on save, just in case someone isn't autosaving and has a lot of checks that get converted to saved. * Fixed missing GS check in LW. * Added area scroll on toggling Show Hidden Items. May configure differently later. Fixed area detection for entrances in Gerudo Fortress/Valley and Collossus. Haunted wasteland doesn't autoscroll due to a bug in `OnTransitionEnd` hook, but checks still evaluate properly there. Rely on scene-based area detection if scene is a main overworld or dungeon scene. * Fixed grotto detection when shuffle is off. * Small code cleanup. Fixed Colossus hand chest checks. * Missing lus bump from merge conflict resolution * Fixed Colossus Grotto making `GetCheckArea` return Wasteland. * Improved OnItemReceive processing for non-token GS checks, since they can sometimes take long enough for the checking process to time out before the item is registered as received. * First attempt at thread safety for tracker data file writing. Seems to work, but might need more testing. * Fixed Recheck Area not unskipping items that register as saved. Improved delayed saving with autosaving, as the autosave triggered quite often before the tracker data save, making things not properly register as saved. * merge cleanup * Converted check tracker data to the sectional saves, adding `CheckTrackerData` to `SaveContext`. Implemented section ID returning and fullSave boolean passing to section functions from my PR temporarily for it to work properly. Moved `RandomizerCheckTrackerData` enum to `randomizerTypes.h` to accommodate that. Changed `Randomizer_SaveInit` to a `SaveManager::InitFunc` to allow for other randomizer-dependent sections to be initialized after that. Required a little refactoring to maintain intro cutscene skip when starting a randomizer file. * Revert section index return and randomizer init changes. Will need to wait on yet more changes to main. * Fixed check tracker initialization (shouldn't be tied to window initialization), restored saving/loading functionality. * Removed `CheckTracker::Init` and put SaveManager calls in `CheckTrackerWindow::InitElement`. Also a bit of cleanup from transition back to save file use. * Fixed tracker displaying check categories while file not loaded. * Fix Darunia's Joy check not marking in vanilla. * Fix autosave not triggering change from collected to saved in tracker data. * Changed default colors for scummed and collected display. * Merge upgrade code cleanup. * Add `OnTransitionEnd` calls to sandstorm transitions both to and from Wasteland. Also improved `gSaveContext.lastScene` assignment for both transition types. Allowed a bit of cleanup in `GetCheckArea`. * Added `StateButton`, a button like `ArrowButton` but that allows text instead of arrow icons. Apparently the changes from ArrowButton to StateButton happened in a previous commit... * Changed section name to `trackerDataCheck` to force SoH to load it after the randomizer section, as it required some randoSettings to be loaded first, and nothing else I tried to make the randomizer section load before it worked. This hacks a solution to checks not displaying on fast file load to a specific slot. F*** you, SaveManager, and f*** you too, JSON. * Forgot to change the section string for loading with the name change. * Fix check ordering for checks that trigger the autosave. * Adds option to remove right-side shop items (slots 1-4) from the tracker list. Enabled by default. * Fix default state of Hide Shop Right Checks checkbox. * Fixes grotto and great fairy scrolling and checks. Fixes array overflow from `checkTrackerData` which was creating the issue trying to load the base and randomizer sections first, among other things. That also fixed the massive file loads that were being exhibited in debug mode. * Fix shooting galleries being set as collected again when being played a second time after getting the checks. * Fix Bazaar autoscroll. * Add Saria's Song to `GetCheckFromActor` and removed some limitations from the messageCloseCheck function to make that check track properly. * Fix Song from Impa check. Implemented prevention for multiple "collections" of great fairies, just in case getting the health refill would trigger it with the previous setup. * Fix ice traps on GS tokens not triggering OnItemReceive. * Complete fix for ice trap collection from GS. Add autoscroll when clicking "Expand All". * Add `OnShopSlotChange` with cursorSlot and basePrice parameters. * Fixed include in en_ossan for shop slot hook. Added registration for `OnShopSlotChange` in the tracker, storing the price in a new `price` field in `CheckTrackerData`. Added "seen" functionality to shop checks. Displays the model item name upon first entering a shop, adding the price and switching to trickName (if it's an ice trap) upon navigating to the slot in buy mode, triggered by an invisible "identified" status that mirrors "seen" in every other way. Added tooltips to most options for check tracker color picking to describe what each status actually means. * `std::format` pls * So apparently std::format just decided to break with the latest merge from develop, but fmt::format exists and works? * Removed the last vestiges of `locationsSkipped`. Other general code and formatting cleanups. Moved `IsGameRunning` to `OTRGlobals` so the item tracker could also access it. Used preceding to "fix" item and bottle display in the item tracker on startup. * Some more code cleanup. Removed "Recheck Area" button and relevant code. Backported changes to Anchor branch applicable for single-player, including making a checkAreas vector and structuring the frame by frame checks around that. Also includes fix for Silver Gauntlets and Mirror Shield check collection crash associated with those changes. Fixed Kakariko Bazaar "seen" updates. Fixed tracker window not showing on initial load like it should. * Forgot 1 formatting fix. * Removed conditions for showing Song from Impa (isn't junk under certain conditions, so should show all the time). * Fix vanilla checks, add Zelda's Letter and Malon's Egg to manual check collection. Fix autoscroll while in child stealth section. * Fix crash in Happy Mask Shop in OnSlotChange (referenced non-existent shop id in a tracker-specific enum). * General code cleanup. * Missed one reversion. * One more. * Fix column alignment in `randomizer_check_objects`. * Fix file encoding on `randomizer_check_tracker`. Again. * Fix indentation for `actualItemtrackerItemMap`. Also removed unnecessary parts of the map. * Rename `HasEqItem` to `HasEquipment`. * Slightly better indentation for `actualItemTrackerItemMap`. * Add magic bean salesman to vanilla check tracking, and genericized deku shield to trigger KF shop item 3 wherever you get the shield. Renamed `vanillaCheck` to `vanillaHundoCheck` to (supposedly) clarify the meaning of the usage. * One more rename to `vanillaCompletion` to avoid possible confusion with 100% speedrun conditions. * give me a break XD Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * Changes suggested by briaguya (rename `RandomizerCheckShow` to `Status`, unused code, newline formatting) * Remove unused `itemNames` table. * Remove `IsGameRunning` in favor of `GameInteractor::IsSaveLoaded`. * Restore anti-spoiler functionality for dungeons with dungeon maps. * Review cleanup. * Fix prices not showing for Kak bazaar items. --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com>
2023-10-04 11:03:36 -04:00
return;
}
mainColor = !IsHeartPiece(rcObj.ogItemId) && !IS_RANDO ? CVarGetColor("gCheckTrackerSavedExtraColor", Color_Saved_Extra_Default) :
CVarGetColor("gCheckTrackerSavedMainColor", Color_Main_Default);
Check Tracker Update (#2668) * Initial commit. What works so far: Data file loads, saves, deletes, and is created properly. - Need to run `HasItemBeenCollected` when creating in case of mid-seed regen. Organized checks into maps set by area. Areas show in tracker. - Checks pulled from checkObjectsByArea are not currently listed. - Areas are being assumed completed and hidden at the start. * Checks now populate. Still not counting area totals properly. * Don't track RC_LINKS_POCKET in the data file, and instead manually add it in every time a save is load. rcObjects doesn't contain Link's Pocket location (duh). * Moved ItemReceive hook to randomizer_check_tracker.cpp. Skipped items are properly sorted and formatted. Saved items contribute to an area's gotten/skipped checks on load. Changed skipped items default main color to gray. General code cleanup. * Skipped checks now contribute to area totals for area completion logic. * Mid-menu rework transfer. * Started check lookup on item receive. Tried to enable scum checking on save. * Fixed scum check on save. * More code cleanup, which revealed some issues with loading and saving. Loading now works 100%, but entries in checkTrackerData are disappearing in code somewhere, causing issues with later checks. Scummed color now displays properly. Collected but unsaved displays properly. Unchecked, Skipped, Seen and Scummed checks all have arrows for skipping/unskipping. Counts a little messed up, probably double adding skips. * Fixed item counts being off across resets. Restarts were fine. * Beginning of rework for individual check updates. Adds `Actor lastCheck` to PlayState to allow assigning of last actor to give an item. This allows precise tracking of GS, freestanding PoH, etc. Works for chests too. Currently does not work for shops, unknown for normal NPC gives. Doesn't track last gives for non-checks, like drops from grass, pots, crates, etc. * Actor-based checks fully fleshed out, but can't help with sale-based checks. Implemented `pendingSaleCheck` to back out of an RC check cycle if `gSaveContext->pendingSale` is not NONE when `OnItemReceive` is called, processed through `OnSaleEnd`. This should be the final change necessary to streamline the checks. * Temporary hook to message box close to tie in trackers for non-gs/chest actors that aren't added to `GetCheckFromActor`. This triggers a 2-frame countdown to check with `HasItemBeenCollected` since half of the methods in there aren't updated until after a text box closes. Added scene tracking to get last scene so that checks in scenes that span several overworld areas could be tied to their areas properly. Modified tracker data creation to apply Link's Pocket and Song from Impa conditionally based on randomizer settings instead of just being assumed to be done. May need modification for checking click and drag spoiler loading. Removed the scene equivalence check from CheckChecks so that an entire area is checked each time to avoid issues with, e.g., leaving a shop before a pending sale finishes. * Changed check data creation to use RSKs from gRandomizer to account for settings loaded from drag and drop spoilers. * Beginning of tracker code organization. Changed check color defaults. * Reverted moving tracker colors to header. Some individual check fixes. * Missed something from previous merge? * Removed last remnant of removed performance mode. * Better handle checking when skullsanity is off. * Song checks sceneIDs don't match the scenes they're actually in for some reason. Removed that check. * SaleEnd checks don't need the GetItemEntry parameter. Also set a flag that should prevent the check tracker from running during vanilla saves should that not be resolved by the time it's merged. * Attempting to have only the relevant checks added to the tracker data, as well as showing vanilla checks for non-rando saves. Not working yet (everything is displayed in vanilla). * Added vanilla check tracker population via `vanillaCheck` bool in `RandomizerCheckObject`. This is also added to `IsVisibleInImGui` to handle file loading and saving to eliminate checks that aren't part of vanilla or the rando seed. Implemented deleted tracker data file recreation. Added some extra item name text checks. Songs are still... tricky, so they stay blank. Utilize local copies of the randomizer check objects that are applicable for performance purposes. Fixed vanilla item-giving cutscene crashes when triggered mid-transition. * Apparently not all toolchains can handle macro instantiation without all parameters, like VS can. * Fixed scummed detail color not showing properly on tracker. * Fixed dungeon area totals and GS checks not functioning properly. * Major revamp of checking code. Doesn't rely on `GetCheckFromActor` at all anymore, but instead simply sets a flag to evaluate a number of checks in an area every frame until the check that was gotten is identified. With the new setup, it's much less hardware intensive, and at 60fps 6 checks per frame shows no noticeable effect on framerate. I can envision needing to add a collectedCount in order to account for times when two checks are gotten one right after the other. Changed area scroll to happen from `OnTransitionEnd`, and allow for scrolling in bazaar (was disabled previously because it would jump back and forth between Kak and Market while you were in one). Also setup area check order updating by area instead of all at the same time. * Fixed shooting gallery not reporting proper area. Prevent checks from actually happening if area is RCAREA_INVALID, now that all areas are reporting something if they have checks. Fixed `GetCheckArea()` not updating checks for standard scenes. Lots of vanilla tracking updates, mainly manual checks for gems, medallions and songs, since the often don't have proper scenes in the data. Prevent vanilla from triggering check loops if junk items are collected. Fixed sorting based on saved vs collected. Prevent item name display for vanilla runs. Change coloring of checks so the check name reflects status in vanilla runs. * Fixed "Recheck Area" button erroneously adding to an area's check totals? * Fix DMC vanilla checks. * Fix check tracker data recreation on data file loss. Removed redundant file exists check from SaveTrackerDataHook, as it doesn't matter if it exists or not at that point. Limited check loops to 3 to avoid infinite check loops on non-check/junk item pickup. Added more checks to disable tracker operations if a save is not running. Changed check ordering to put boss reward and heart container checks at the end of whatever RCSHOW group they belong to. * Fixed IsRunning calculation. Further improving vanilla checking. Starting framework for checking medallions, stones, and songs on data file recreation. Fixed medallion check collection. Added GIFT_FROM_SAGES to check list for vanilla file for tracking light medallion. Added check loop limitation to prevent infinite checking after picking up junk item from the ground. * Finished vanilla file recreation and recheck (songs and dungeon rewards all check properly now). This includes deku shield with KF shop item 3. Finished Gift from Raoru light medallion tracking for vanilla. Commented all CheckByScene functionality for now. * Fixed new save data file creation. Disabled entrance area calculation for now, as it only tracks the previous entrance for some reason. Fixed area detection for ToT checks. * GetCheckArea() now utilizes EntranceData almost exclusively, via either `gSaveContext.entranceIndex` or the entrance tracker's `currentGrottoId` in the case of grottos. This also means that EVERYTHING CAN AUTOSCROLL NOW. Entrance shuffles are now much easier to track. Autoscroll is now also triggered on save, just in case someone isn't autosaving and has a lot of checks that get converted to saved. * Fixed missing GS check in LW. * Added area scroll on toggling Show Hidden Items. May configure differently later. Fixed area detection for entrances in Gerudo Fortress/Valley and Collossus. Haunted wasteland doesn't autoscroll due to a bug in `OnTransitionEnd` hook, but checks still evaluate properly there. Rely on scene-based area detection if scene is a main overworld or dungeon scene. * Fixed grotto detection when shuffle is off. * Small code cleanup. Fixed Colossus hand chest checks. * Missing lus bump from merge conflict resolution * Fixed Colossus Grotto making `GetCheckArea` return Wasteland. * Improved OnItemReceive processing for non-token GS checks, since they can sometimes take long enough for the checking process to time out before the item is registered as received. * First attempt at thread safety for tracker data file writing. Seems to work, but might need more testing. * Fixed Recheck Area not unskipping items that register as saved. Improved delayed saving with autosaving, as the autosave triggered quite often before the tracker data save, making things not properly register as saved. * merge cleanup * Converted check tracker data to the sectional saves, adding `CheckTrackerData` to `SaveContext`. Implemented section ID returning and fullSave boolean passing to section functions from my PR temporarily for it to work properly. Moved `RandomizerCheckTrackerData` enum to `randomizerTypes.h` to accommodate that. Changed `Randomizer_SaveInit` to a `SaveManager::InitFunc` to allow for other randomizer-dependent sections to be initialized after that. Required a little refactoring to maintain intro cutscene skip when starting a randomizer file. * Revert section index return and randomizer init changes. Will need to wait on yet more changes to main. * Fixed check tracker initialization (shouldn't be tied to window initialization), restored saving/loading functionality. * Removed `CheckTracker::Init` and put SaveManager calls in `CheckTrackerWindow::InitElement`. Also a bit of cleanup from transition back to save file use. * Fixed tracker displaying check categories while file not loaded. * Fix Darunia's Joy check not marking in vanilla. * Fix autosave not triggering change from collected to saved in tracker data. * Changed default colors for scummed and collected display. * Merge upgrade code cleanup. * Add `OnTransitionEnd` calls to sandstorm transitions both to and from Wasteland. Also improved `gSaveContext.lastScene` assignment for both transition types. Allowed a bit of cleanup in `GetCheckArea`. * Added `StateButton`, a button like `ArrowButton` but that allows text instead of arrow icons. Apparently the changes from ArrowButton to StateButton happened in a previous commit... * Changed section name to `trackerDataCheck` to force SoH to load it after the randomizer section, as it required some randoSettings to be loaded first, and nothing else I tried to make the randomizer section load before it worked. This hacks a solution to checks not displaying on fast file load to a specific slot. F*** you, SaveManager, and f*** you too, JSON. * Forgot to change the section string for loading with the name change. * Fix check ordering for checks that trigger the autosave. * Adds option to remove right-side shop items (slots 1-4) from the tracker list. Enabled by default. * Fix default state of Hide Shop Right Checks checkbox. * Fixes grotto and great fairy scrolling and checks. Fixes array overflow from `checkTrackerData` which was creating the issue trying to load the base and randomizer sections first, among other things. That also fixed the massive file loads that were being exhibited in debug mode. * Fix shooting galleries being set as collected again when being played a second time after getting the checks. * Fix Bazaar autoscroll. * Add Saria's Song to `GetCheckFromActor` and removed some limitations from the messageCloseCheck function to make that check track properly. * Fix Song from Impa check. Implemented prevention for multiple "collections" of great fairies, just in case getting the health refill would trigger it with the previous setup. * Fix ice traps on GS tokens not triggering OnItemReceive. * Complete fix for ice trap collection from GS. Add autoscroll when clicking "Expand All". * Add `OnShopSlotChange` with cursorSlot and basePrice parameters. * Fixed include in en_ossan for shop slot hook. Added registration for `OnShopSlotChange` in the tracker, storing the price in a new `price` field in `CheckTrackerData`. Added "seen" functionality to shop checks. Displays the model item name upon first entering a shop, adding the price and switching to trickName (if it's an ice trap) upon navigating to the slot in buy mode, triggered by an invisible "identified" status that mirrors "seen" in every other way. Added tooltips to most options for check tracker color picking to describe what each status actually means. * `std::format` pls * So apparently std::format just decided to break with the latest merge from develop, but fmt::format exists and works? * Removed the last vestiges of `locationsSkipped`. Other general code and formatting cleanups. Moved `IsGameRunning` to `OTRGlobals` so the item tracker could also access it. Used preceding to "fix" item and bottle display in the item tracker on startup. * Some more code cleanup. Removed "Recheck Area" button and relevant code. Backported changes to Anchor branch applicable for single-player, including making a checkAreas vector and structuring the frame by frame checks around that. Also includes fix for Silver Gauntlets and Mirror Shield check collection crash associated with those changes. Fixed Kakariko Bazaar "seen" updates. Fixed tracker window not showing on initial load like it should. * Forgot 1 formatting fix. * Removed conditions for showing Song from Impa (isn't junk under certain conditions, so should show all the time). * Fix vanilla checks, add Zelda's Letter and Malon's Egg to manual check collection. Fix autoscroll while in child stealth section. * Fix crash in Happy Mask Shop in OnSlotChange (referenced non-existent shop id in a tracker-specific enum). * General code cleanup. * Missed one reversion. * One more. * Fix column alignment in `randomizer_check_objects`. * Fix file encoding on `randomizer_check_tracker`. Again. * Fix indentation for `actualItemtrackerItemMap`. Also removed unnecessary parts of the map. * Rename `HasEqItem` to `HasEquipment`. * Slightly better indentation for `actualItemTrackerItemMap`. * Add magic bean salesman to vanilla check tracking, and genericized deku shield to trigger KF shop item 3 wherever you get the shield. Renamed `vanillaCheck` to `vanillaHundoCheck` to (supposedly) clarify the meaning of the usage. * One more rename to `vanillaCompletion` to avoid possible confusion with 100% speedrun conditions. * give me a break XD Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * Changes suggested by briaguya (rename `RandomizerCheckShow` to `Status`, unused code, newline formatting) * Remove unused `itemNames` table. * Remove `IsGameRunning` in favor of `GameInteractor::IsSaveLoaded`. * Restore anti-spoiler functionality for dungeons with dungeon maps. * Review cleanup. * Fix prices not showing for Kak bazaar items. --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com>
2023-10-04 11:03:36 -04:00
extraColor = CVarGetColor("gCheckTrackerSavedExtraColor", Color_Saved_Extra_Default);
} else if (skipped) {
if (!showHidden && CVarGetInteger("gCheckTrackerSkippedHide", 0)) {
Randomizer Auto Location tracker (#1942) * Initial Auto-Location Tracking * Updates styling for checked items in Check Tracker * Fixes crashing issues with Check Tracker rendering * Auto scroll Check Tracker windows to current area * Checks Tracker only shows checked locations once in game * Fixes issue where Check Tracker would auto-scroll to wrong location when entering a grotto * Fixes gerudo fortress checks showing in tracker when settings have them removed * InfTable Check Location Fixes: Lost Dog Richard, Rolling Gorons, HBA 1000, Thawed Zora * Fixes most Event Chk Inf Checks on Check Tracker, and Frogs * Check Tracker - Song from Malon now works * Check Tracker - Fixes Claim Check check not tracking - Fixes spoiler for Claim Check check when getting Biggoron's Sword - Fixes LACS being spoiled and not tracking * Check Tracker - Fixes #2 for Skull Mask and Mask of Truth checks * Check Tracker - Adds support for merchants - Fixes #7 for Bomchu Salesman - Fixes #12 for Medigoron * Check Tracker - Fixes #8 for Song from Saria * Check Tracker - Fixes #9 for Adult Shooting Gallery * Check Tracker - Fixes #10 for Composer Grave * Check Tracker - Fixes #14 for Song from Ocarina of Time * Check Tracker - Fixes #16 for Shooting the Sun * Check Tracker - Fixes #19 for Darunia's Joy * Save Editor - Adds missing label for Treasure Chest Game * Check Tracker - Fixes Great Faries checks * Check Tracker - Fixes Sheik at Temple * Check Tracker - Fixes Great Fairy auto-scroll to wrong location * Check Tracker - Updates blue warp checks - Fixes Bongo Bongo and Twinrova checks * Check Tracker - Fixes Dampe's Gravedigging Tour * Check Tracker - Fixes Prescription to King Zora * Check Tracker - Fixes Bazaar showing under wrong area on tracker between adult/child * Check Tracker - Fixes scroll for Hyrule Market and Bazaar * Check Tracker - Fixes giving Adult Trade Items shown on tracker: Broken Sword, Saw, Cojiro, Eyeball Froge, and Eyedrops * Cleans up item_location * Check Tracker - Item List - Fixes item list not updating when changing seeds/options - Separates item exclusion list from item check list - Clean up comments * Check Tracker - Adds Skip functionality to buttons * Check Tracker - Refactors adult trade items to RandomizerInf * Check Tracker - Fixes an issue where any time an item is removed the tracker would cause an application crash * Check Tracker - Item names are now dependent on file language * Check Tracker - Fixes Gerudo Card check not showing in Fast setting * Reorders headers to (hopefully) avoid CI build conflicts on linux/consoles * Explicitly defines vector header in randomizer.h to fix compile errors * Complete Refactor of Check Tracker ImGui * Adds missing check tracker files to CMakeLists * Reverts the Item_location whitespace cleanup from ad10807c * Check Tracker - Loading Fixes - Fixes a bug where loading a save file a second time would add all the checks again - Fixes a bug where the check tracker would not render at all until in a save file * Check Tracker - Fixes a bug where checks would sometimes fail to load * Check Tracker - Fixes duplicated checks when using Only on Pause or Only on Combo * Check Tracker - Works around issue where single characters don't show in EnhancementCombobox, and fixes a label for combo buttons held option * Check Tracker - Applies all Check Tracker changes to Item Location * Check Tracker - Updated Check List - Adds Link's pocket, either in KF or HM depending on starting age - Supports Scrubs and Merchants - Uses enums instead of magic numbers - Updates DC Scrub Short Names for MQ * Check Tracker - Adds a performance mode option * Check Tracker - List Fixes (requires new rando generation) - Fixes Frogs Rupees always visible - Fixes Kokiri Sword Chest not showing - Fixes Weird Egg not showing * Check Tracker - MQ List basic support * Check Tracker - MQ/Vanilla anti-spoilers * Check Tracker - Collecting a compass now spoils the area * Check Tracker - Basic Vanilla Support and fixes - Vanilla items show in check tracker, even if many won't auto check - Fixes an issue with Gerudo Fortress Keys - Refactors IsVisibleInCheckTracker to randomizer_check_tracjer * Check Tracker - Fixes merge conflict from 08a487f35e1d760ab9e69b932edbe4da6bcd9edb * Check Tracker - Fixes tracker loading as Floating when default value is set to Windowed * Randomizer Location Exclusion List - Adds Scrubs, Merchants, Shops. Adult Trade items, MQ Dungeons, and Bean Salesman - Fixes Kokiri Sword Chest, Weird Egg, and Frog Song Rupees from misbehaving - Updates Gerudo Fortress logic to be dependent on Open/Fast/Normal Fortress - Removes Invalid Check - Adds RO Enum for MQ settings - Updates magic values to RO enum * Location Exclusion List - Scrubs that are always randomized now always show on the list * For now, removes some extra code only needed for a Check Tracker. * Randomizer Location Exclusion List - Fixes Eyeball Frog from showing up when Adult Trade Items was off * Location Tracker - Updates Eyedrops to use RandomizerInf instead of Chest * Check Tracker - Fixes a bug where Link's Pocket item wasn't acting as checked for area item count * Check Tracker - Fixes a bug where Locations would incorrectly say Vanilla due to the first check in the area being a non-MQ check * Check Tracker - Fixes a crash when Check Tracker is docked but not visible * Check Tracker - Fixes areas being spoiled when loading different save files * Check Tracker - Only reset variables if they are initialized * Check Tracker - Cleans up old comments, unused variables, methods, and macros, adds language TODOs, * Check Tracker - Readds rainbow UI elements after Cosmetics Editor refactor * Check Tracker - Removal of flag lookup that was refactored, no longer needed header, and some trivial whitespace fixes. * Check Tracker - Refactors Index to Bitmask code to a macro * Check Tracker - Changes ordering from alphabetical to RandomizerCheck ordering * Check Tracker - Wraps everything in a namespace to avoid global variable usage * Check Tracker - Explicitly defines for-loop scope * Check Tracker - refactors dungeon lookup from static array to function * Fixes a bug when using EnhancementColor with alpha * Check Tracker - Refactors all colour to use direct conversions * Check Tracker - refactors settings loading and check visibility for readability * Check Tracker - Fixes a bug where the wrong label showed on the Check Tracker BG Color * UIWidgets - Adds Alpha bar to EnhancementColor when using alpha parameter
2022-12-10 22:39:23 -05:00
return;
}
mainColor = !IsHeartPiece(rcObj.ogItemId) && !IS_RANDO ? CVarGetColor("gCheckTrackerSkippedExtraColor", Color_Skipped_Extra_Default) :
CVarGetColor("gCheckTrackerSkippedMainColor", Color_Main_Default);
extraColor = CVarGetColor("gCheckTrackerSkippedExtraColor", Color_Skipped_Extra_Default);
Check Tracker Update (#2668) * Initial commit. What works so far: Data file loads, saves, deletes, and is created properly. - Need to run `HasItemBeenCollected` when creating in case of mid-seed regen. Organized checks into maps set by area. Areas show in tracker. - Checks pulled from checkObjectsByArea are not currently listed. - Areas are being assumed completed and hidden at the start. * Checks now populate. Still not counting area totals properly. * Don't track RC_LINKS_POCKET in the data file, and instead manually add it in every time a save is load. rcObjects doesn't contain Link's Pocket location (duh). * Moved ItemReceive hook to randomizer_check_tracker.cpp. Skipped items are properly sorted and formatted. Saved items contribute to an area's gotten/skipped checks on load. Changed skipped items default main color to gray. General code cleanup. * Skipped checks now contribute to area totals for area completion logic. * Mid-menu rework transfer. * Started check lookup on item receive. Tried to enable scum checking on save. * Fixed scum check on save. * More code cleanup, which revealed some issues with loading and saving. Loading now works 100%, but entries in checkTrackerData are disappearing in code somewhere, causing issues with later checks. Scummed color now displays properly. Collected but unsaved displays properly. Unchecked, Skipped, Seen and Scummed checks all have arrows for skipping/unskipping. Counts a little messed up, probably double adding skips. * Fixed item counts being off across resets. Restarts were fine. * Beginning of rework for individual check updates. Adds `Actor lastCheck` to PlayState to allow assigning of last actor to give an item. This allows precise tracking of GS, freestanding PoH, etc. Works for chests too. Currently does not work for shops, unknown for normal NPC gives. Doesn't track last gives for non-checks, like drops from grass, pots, crates, etc. * Actor-based checks fully fleshed out, but can't help with sale-based checks. Implemented `pendingSaleCheck` to back out of an RC check cycle if `gSaveContext->pendingSale` is not NONE when `OnItemReceive` is called, processed through `OnSaleEnd`. This should be the final change necessary to streamline the checks. * Temporary hook to message box close to tie in trackers for non-gs/chest actors that aren't added to `GetCheckFromActor`. This triggers a 2-frame countdown to check with `HasItemBeenCollected` since half of the methods in there aren't updated until after a text box closes. Added scene tracking to get last scene so that checks in scenes that span several overworld areas could be tied to their areas properly. Modified tracker data creation to apply Link's Pocket and Song from Impa conditionally based on randomizer settings instead of just being assumed to be done. May need modification for checking click and drag spoiler loading. Removed the scene equivalence check from CheckChecks so that an entire area is checked each time to avoid issues with, e.g., leaving a shop before a pending sale finishes. * Changed check data creation to use RSKs from gRandomizer to account for settings loaded from drag and drop spoilers. * Beginning of tracker code organization. Changed check color defaults. * Reverted moving tracker colors to header. Some individual check fixes. * Missed something from previous merge? * Removed last remnant of removed performance mode. * Better handle checking when skullsanity is off. * Song checks sceneIDs don't match the scenes they're actually in for some reason. Removed that check. * SaleEnd checks don't need the GetItemEntry parameter. Also set a flag that should prevent the check tracker from running during vanilla saves should that not be resolved by the time it's merged. * Attempting to have only the relevant checks added to the tracker data, as well as showing vanilla checks for non-rando saves. Not working yet (everything is displayed in vanilla). * Added vanilla check tracker population via `vanillaCheck` bool in `RandomizerCheckObject`. This is also added to `IsVisibleInImGui` to handle file loading and saving to eliminate checks that aren't part of vanilla or the rando seed. Implemented deleted tracker data file recreation. Added some extra item name text checks. Songs are still... tricky, so they stay blank. Utilize local copies of the randomizer check objects that are applicable for performance purposes. Fixed vanilla item-giving cutscene crashes when triggered mid-transition. * Apparently not all toolchains can handle macro instantiation without all parameters, like VS can. * Fixed scummed detail color not showing properly on tracker. * Fixed dungeon area totals and GS checks not functioning properly. * Major revamp of checking code. Doesn't rely on `GetCheckFromActor` at all anymore, but instead simply sets a flag to evaluate a number of checks in an area every frame until the check that was gotten is identified. With the new setup, it's much less hardware intensive, and at 60fps 6 checks per frame shows no noticeable effect on framerate. I can envision needing to add a collectedCount in order to account for times when two checks are gotten one right after the other. Changed area scroll to happen from `OnTransitionEnd`, and allow for scrolling in bazaar (was disabled previously because it would jump back and forth between Kak and Market while you were in one). Also setup area check order updating by area instead of all at the same time. * Fixed shooting gallery not reporting proper area. Prevent checks from actually happening if area is RCAREA_INVALID, now that all areas are reporting something if they have checks. Fixed `GetCheckArea()` not updating checks for standard scenes. Lots of vanilla tracking updates, mainly manual checks for gems, medallions and songs, since the often don't have proper scenes in the data. Prevent vanilla from triggering check loops if junk items are collected. Fixed sorting based on saved vs collected. Prevent item name display for vanilla runs. Change coloring of checks so the check name reflects status in vanilla runs. * Fixed "Recheck Area" button erroneously adding to an area's check totals? * Fix DMC vanilla checks. * Fix check tracker data recreation on data file loss. Removed redundant file exists check from SaveTrackerDataHook, as it doesn't matter if it exists or not at that point. Limited check loops to 3 to avoid infinite check loops on non-check/junk item pickup. Added more checks to disable tracker operations if a save is not running. Changed check ordering to put boss reward and heart container checks at the end of whatever RCSHOW group they belong to. * Fixed IsRunning calculation. Further improving vanilla checking. Starting framework for checking medallions, stones, and songs on data file recreation. Fixed medallion check collection. Added GIFT_FROM_SAGES to check list for vanilla file for tracking light medallion. Added check loop limitation to prevent infinite checking after picking up junk item from the ground. * Finished vanilla file recreation and recheck (songs and dungeon rewards all check properly now). This includes deku shield with KF shop item 3. Finished Gift from Raoru light medallion tracking for vanilla. Commented all CheckByScene functionality for now. * Fixed new save data file creation. Disabled entrance area calculation for now, as it only tracks the previous entrance for some reason. Fixed area detection for ToT checks. * GetCheckArea() now utilizes EntranceData almost exclusively, via either `gSaveContext.entranceIndex` or the entrance tracker's `currentGrottoId` in the case of grottos. This also means that EVERYTHING CAN AUTOSCROLL NOW. Entrance shuffles are now much easier to track. Autoscroll is now also triggered on save, just in case someone isn't autosaving and has a lot of checks that get converted to saved. * Fixed missing GS check in LW. * Added area scroll on toggling Show Hidden Items. May configure differently later. Fixed area detection for entrances in Gerudo Fortress/Valley and Collossus. Haunted wasteland doesn't autoscroll due to a bug in `OnTransitionEnd` hook, but checks still evaluate properly there. Rely on scene-based area detection if scene is a main overworld or dungeon scene. * Fixed grotto detection when shuffle is off. * Small code cleanup. Fixed Colossus hand chest checks. * Missing lus bump from merge conflict resolution * Fixed Colossus Grotto making `GetCheckArea` return Wasteland. * Improved OnItemReceive processing for non-token GS checks, since they can sometimes take long enough for the checking process to time out before the item is registered as received. * First attempt at thread safety for tracker data file writing. Seems to work, but might need more testing. * Fixed Recheck Area not unskipping items that register as saved. Improved delayed saving with autosaving, as the autosave triggered quite often before the tracker data save, making things not properly register as saved. * merge cleanup * Converted check tracker data to the sectional saves, adding `CheckTrackerData` to `SaveContext`. Implemented section ID returning and fullSave boolean passing to section functions from my PR temporarily for it to work properly. Moved `RandomizerCheckTrackerData` enum to `randomizerTypes.h` to accommodate that. Changed `Randomizer_SaveInit` to a `SaveManager::InitFunc` to allow for other randomizer-dependent sections to be initialized after that. Required a little refactoring to maintain intro cutscene skip when starting a randomizer file. * Revert section index return and randomizer init changes. Will need to wait on yet more changes to main. * Fixed check tracker initialization (shouldn't be tied to window initialization), restored saving/loading functionality. * Removed `CheckTracker::Init` and put SaveManager calls in `CheckTrackerWindow::InitElement`. Also a bit of cleanup from transition back to save file use. * Fixed tracker displaying check categories while file not loaded. * Fix Darunia's Joy check not marking in vanilla. * Fix autosave not triggering change from collected to saved in tracker data. * Changed default colors for scummed and collected display. * Merge upgrade code cleanup. * Add `OnTransitionEnd` calls to sandstorm transitions both to and from Wasteland. Also improved `gSaveContext.lastScene` assignment for both transition types. Allowed a bit of cleanup in `GetCheckArea`. * Added `StateButton`, a button like `ArrowButton` but that allows text instead of arrow icons. Apparently the changes from ArrowButton to StateButton happened in a previous commit... * Changed section name to `trackerDataCheck` to force SoH to load it after the randomizer section, as it required some randoSettings to be loaded first, and nothing else I tried to make the randomizer section load before it worked. This hacks a solution to checks not displaying on fast file load to a specific slot. F*** you, SaveManager, and f*** you too, JSON. * Forgot to change the section string for loading with the name change. * Fix check ordering for checks that trigger the autosave. * Adds option to remove right-side shop items (slots 1-4) from the tracker list. Enabled by default. * Fix default state of Hide Shop Right Checks checkbox. * Fixes grotto and great fairy scrolling and checks. Fixes array overflow from `checkTrackerData` which was creating the issue trying to load the base and randomizer sections first, among other things. That also fixed the massive file loads that were being exhibited in debug mode. * Fix shooting galleries being set as collected again when being played a second time after getting the checks. * Fix Bazaar autoscroll. * Add Saria's Song to `GetCheckFromActor` and removed some limitations from the messageCloseCheck function to make that check track properly. * Fix Song from Impa check. Implemented prevention for multiple "collections" of great fairies, just in case getting the health refill would trigger it with the previous setup. * Fix ice traps on GS tokens not triggering OnItemReceive. * Complete fix for ice trap collection from GS. Add autoscroll when clicking "Expand All". * Add `OnShopSlotChange` with cursorSlot and basePrice parameters. * Fixed include in en_ossan for shop slot hook. Added registration for `OnShopSlotChange` in the tracker, storing the price in a new `price` field in `CheckTrackerData`. Added "seen" functionality to shop checks. Displays the model item name upon first entering a shop, adding the price and switching to trickName (if it's an ice trap) upon navigating to the slot in buy mode, triggered by an invisible "identified" status that mirrors "seen" in every other way. Added tooltips to most options for check tracker color picking to describe what each status actually means. * `std::format` pls * So apparently std::format just decided to break with the latest merge from develop, but fmt::format exists and works? * Removed the last vestiges of `locationsSkipped`. Other general code and formatting cleanups. Moved `IsGameRunning` to `OTRGlobals` so the item tracker could also access it. Used preceding to "fix" item and bottle display in the item tracker on startup. * Some more code cleanup. Removed "Recheck Area" button and relevant code. Backported changes to Anchor branch applicable for single-player, including making a checkAreas vector and structuring the frame by frame checks around that. Also includes fix for Silver Gauntlets and Mirror Shield check collection crash associated with those changes. Fixed Kakariko Bazaar "seen" updates. Fixed tracker window not showing on initial load like it should. * Forgot 1 formatting fix. * Removed conditions for showing Song from Impa (isn't junk under certain conditions, so should show all the time). * Fix vanilla checks, add Zelda's Letter and Malon's Egg to manual check collection. Fix autoscroll while in child stealth section. * Fix crash in Happy Mask Shop in OnSlotChange (referenced non-existent shop id in a tracker-specific enum). * General code cleanup. * Missed one reversion. * One more. * Fix column alignment in `randomizer_check_objects`. * Fix file encoding on `randomizer_check_tracker`. Again. * Fix indentation for `actualItemtrackerItemMap`. Also removed unnecessary parts of the map. * Rename `HasEqItem` to `HasEquipment`. * Slightly better indentation for `actualItemTrackerItemMap`. * Add magic bean salesman to vanilla check tracking, and genericized deku shield to trigger KF shop item 3 wherever you get the shield. Renamed `vanillaCheck` to `vanillaHundoCheck` to (supposedly) clarify the meaning of the usage. * One more rename to `vanillaCompletion` to avoid possible confusion with 100% speedrun conditions. * give me a break XD Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * Changes suggested by briaguya (rename `RandomizerCheckShow` to `Status`, unused code, newline formatting) * Remove unused `itemNames` table. * Remove `IsGameRunning` in favor of `GameInteractor::IsSaveLoaded`. * Restore anti-spoiler functionality for dungeons with dungeon maps. * Review cleanup. * Fix prices not showing for Kak bazaar items. --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com>
2023-10-04 11:03:36 -04:00
} else if (status == RCSHOW_SEEN || status == RCSHOW_IDENTIFIED) {
if (!showHidden && CVarGetInteger("gCheckTrackerSeenHide", 0)) {
Randomizer Auto Location tracker (#1942) * Initial Auto-Location Tracking * Updates styling for checked items in Check Tracker * Fixes crashing issues with Check Tracker rendering * Auto scroll Check Tracker windows to current area * Checks Tracker only shows checked locations once in game * Fixes issue where Check Tracker would auto-scroll to wrong location when entering a grotto * Fixes gerudo fortress checks showing in tracker when settings have them removed * InfTable Check Location Fixes: Lost Dog Richard, Rolling Gorons, HBA 1000, Thawed Zora * Fixes most Event Chk Inf Checks on Check Tracker, and Frogs * Check Tracker - Song from Malon now works * Check Tracker - Fixes Claim Check check not tracking - Fixes spoiler for Claim Check check when getting Biggoron's Sword - Fixes LACS being spoiled and not tracking * Check Tracker - Fixes #2 for Skull Mask and Mask of Truth checks * Check Tracker - Adds support for merchants - Fixes #7 for Bomchu Salesman - Fixes #12 for Medigoron * Check Tracker - Fixes #8 for Song from Saria * Check Tracker - Fixes #9 for Adult Shooting Gallery * Check Tracker - Fixes #10 for Composer Grave * Check Tracker - Fixes #14 for Song from Ocarina of Time * Check Tracker - Fixes #16 for Shooting the Sun * Check Tracker - Fixes #19 for Darunia's Joy * Save Editor - Adds missing label for Treasure Chest Game * Check Tracker - Fixes Great Faries checks * Check Tracker - Fixes Sheik at Temple * Check Tracker - Fixes Great Fairy auto-scroll to wrong location * Check Tracker - Updates blue warp checks - Fixes Bongo Bongo and Twinrova checks * Check Tracker - Fixes Dampe's Gravedigging Tour * Check Tracker - Fixes Prescription to King Zora * Check Tracker - Fixes Bazaar showing under wrong area on tracker between adult/child * Check Tracker - Fixes scroll for Hyrule Market and Bazaar * Check Tracker - Fixes giving Adult Trade Items shown on tracker: Broken Sword, Saw, Cojiro, Eyeball Froge, and Eyedrops * Cleans up item_location * Check Tracker - Item List - Fixes item list not updating when changing seeds/options - Separates item exclusion list from item check list - Clean up comments * Check Tracker - Adds Skip functionality to buttons * Check Tracker - Refactors adult trade items to RandomizerInf * Check Tracker - Fixes an issue where any time an item is removed the tracker would cause an application crash * Check Tracker - Item names are now dependent on file language * Check Tracker - Fixes Gerudo Card check not showing in Fast setting * Reorders headers to (hopefully) avoid CI build conflicts on linux/consoles * Explicitly defines vector header in randomizer.h to fix compile errors * Complete Refactor of Check Tracker ImGui * Adds missing check tracker files to CMakeLists * Reverts the Item_location whitespace cleanup from ad10807c * Check Tracker - Loading Fixes - Fixes a bug where loading a save file a second time would add all the checks again - Fixes a bug where the check tracker would not render at all until in a save file * Check Tracker - Fixes a bug where checks would sometimes fail to load * Check Tracker - Fixes duplicated checks when using Only on Pause or Only on Combo * Check Tracker - Works around issue where single characters don't show in EnhancementCombobox, and fixes a label for combo buttons held option * Check Tracker - Applies all Check Tracker changes to Item Location * Check Tracker - Updated Check List - Adds Link's pocket, either in KF or HM depending on starting age - Supports Scrubs and Merchants - Uses enums instead of magic numbers - Updates DC Scrub Short Names for MQ * Check Tracker - Adds a performance mode option * Check Tracker - List Fixes (requires new rando generation) - Fixes Frogs Rupees always visible - Fixes Kokiri Sword Chest not showing - Fixes Weird Egg not showing * Check Tracker - MQ List basic support * Check Tracker - MQ/Vanilla anti-spoilers * Check Tracker - Collecting a compass now spoils the area * Check Tracker - Basic Vanilla Support and fixes - Vanilla items show in check tracker, even if many won't auto check - Fixes an issue with Gerudo Fortress Keys - Refactors IsVisibleInCheckTracker to randomizer_check_tracjer * Check Tracker - Fixes merge conflict from 08a487f35e1d760ab9e69b932edbe4da6bcd9edb * Check Tracker - Fixes tracker loading as Floating when default value is set to Windowed * Randomizer Location Exclusion List - Adds Scrubs, Merchants, Shops. Adult Trade items, MQ Dungeons, and Bean Salesman - Fixes Kokiri Sword Chest, Weird Egg, and Frog Song Rupees from misbehaving - Updates Gerudo Fortress logic to be dependent on Open/Fast/Normal Fortress - Removes Invalid Check - Adds RO Enum for MQ settings - Updates magic values to RO enum * Location Exclusion List - Scrubs that are always randomized now always show on the list * For now, removes some extra code only needed for a Check Tracker. * Randomizer Location Exclusion List - Fixes Eyeball Frog from showing up when Adult Trade Items was off * Location Tracker - Updates Eyedrops to use RandomizerInf instead of Chest * Check Tracker - Fixes a bug where Link's Pocket item wasn't acting as checked for area item count * Check Tracker - Fixes a bug where Locations would incorrectly say Vanilla due to the first check in the area being a non-MQ check * Check Tracker - Fixes a crash when Check Tracker is docked but not visible * Check Tracker - Fixes areas being spoiled when loading different save files * Check Tracker - Only reset variables if they are initialized * Check Tracker - Cleans up old comments, unused variables, methods, and macros, adds language TODOs, * Check Tracker - Readds rainbow UI elements after Cosmetics Editor refactor * Check Tracker - Removal of flag lookup that was refactored, no longer needed header, and some trivial whitespace fixes. * Check Tracker - Refactors Index to Bitmask code to a macro * Check Tracker - Changes ordering from alphabetical to RandomizerCheck ordering * Check Tracker - Wraps everything in a namespace to avoid global variable usage * Check Tracker - Explicitly defines for-loop scope * Check Tracker - refactors dungeon lookup from static array to function * Fixes a bug when using EnhancementColor with alpha * Check Tracker - Refactors all colour to use direct conversions * Check Tracker - refactors settings loading and check visibility for readability * Check Tracker - Fixes a bug where the wrong label showed on the Check Tracker BG Color * UIWidgets - Adds Alpha bar to EnhancementColor when using alpha parameter
2022-12-10 22:39:23 -05:00
return;
}
mainColor = !IsHeartPiece(rcObj.ogItemId) && !IS_RANDO ? CVarGetColor("gCheckTrackerSeenExtraColor", Color_Seen_Extra_Default) :
CVarGetColor("gCheckTrackerSeenMainColor", Color_Main_Default);
extraColor = CVarGetColor("gCheckTrackerSeenExtraColor", Color_Seen_Extra_Default);
Check Tracker Update (#2668) * Initial commit. What works so far: Data file loads, saves, deletes, and is created properly. - Need to run `HasItemBeenCollected` when creating in case of mid-seed regen. Organized checks into maps set by area. Areas show in tracker. - Checks pulled from checkObjectsByArea are not currently listed. - Areas are being assumed completed and hidden at the start. * Checks now populate. Still not counting area totals properly. * Don't track RC_LINKS_POCKET in the data file, and instead manually add it in every time a save is load. rcObjects doesn't contain Link's Pocket location (duh). * Moved ItemReceive hook to randomizer_check_tracker.cpp. Skipped items are properly sorted and formatted. Saved items contribute to an area's gotten/skipped checks on load. Changed skipped items default main color to gray. General code cleanup. * Skipped checks now contribute to area totals for area completion logic. * Mid-menu rework transfer. * Started check lookup on item receive. Tried to enable scum checking on save. * Fixed scum check on save. * More code cleanup, which revealed some issues with loading and saving. Loading now works 100%, but entries in checkTrackerData are disappearing in code somewhere, causing issues with later checks. Scummed color now displays properly. Collected but unsaved displays properly. Unchecked, Skipped, Seen and Scummed checks all have arrows for skipping/unskipping. Counts a little messed up, probably double adding skips. * Fixed item counts being off across resets. Restarts were fine. * Beginning of rework for individual check updates. Adds `Actor lastCheck` to PlayState to allow assigning of last actor to give an item. This allows precise tracking of GS, freestanding PoH, etc. Works for chests too. Currently does not work for shops, unknown for normal NPC gives. Doesn't track last gives for non-checks, like drops from grass, pots, crates, etc. * Actor-based checks fully fleshed out, but can't help with sale-based checks. Implemented `pendingSaleCheck` to back out of an RC check cycle if `gSaveContext->pendingSale` is not NONE when `OnItemReceive` is called, processed through `OnSaleEnd`. This should be the final change necessary to streamline the checks. * Temporary hook to message box close to tie in trackers for non-gs/chest actors that aren't added to `GetCheckFromActor`. This triggers a 2-frame countdown to check with `HasItemBeenCollected` since half of the methods in there aren't updated until after a text box closes. Added scene tracking to get last scene so that checks in scenes that span several overworld areas could be tied to their areas properly. Modified tracker data creation to apply Link's Pocket and Song from Impa conditionally based on randomizer settings instead of just being assumed to be done. May need modification for checking click and drag spoiler loading. Removed the scene equivalence check from CheckChecks so that an entire area is checked each time to avoid issues with, e.g., leaving a shop before a pending sale finishes. * Changed check data creation to use RSKs from gRandomizer to account for settings loaded from drag and drop spoilers. * Beginning of tracker code organization. Changed check color defaults. * Reverted moving tracker colors to header. Some individual check fixes. * Missed something from previous merge? * Removed last remnant of removed performance mode. * Better handle checking when skullsanity is off. * Song checks sceneIDs don't match the scenes they're actually in for some reason. Removed that check. * SaleEnd checks don't need the GetItemEntry parameter. Also set a flag that should prevent the check tracker from running during vanilla saves should that not be resolved by the time it's merged. * Attempting to have only the relevant checks added to the tracker data, as well as showing vanilla checks for non-rando saves. Not working yet (everything is displayed in vanilla). * Added vanilla check tracker population via `vanillaCheck` bool in `RandomizerCheckObject`. This is also added to `IsVisibleInImGui` to handle file loading and saving to eliminate checks that aren't part of vanilla or the rando seed. Implemented deleted tracker data file recreation. Added some extra item name text checks. Songs are still... tricky, so they stay blank. Utilize local copies of the randomizer check objects that are applicable for performance purposes. Fixed vanilla item-giving cutscene crashes when triggered mid-transition. * Apparently not all toolchains can handle macro instantiation without all parameters, like VS can. * Fixed scummed detail color not showing properly on tracker. * Fixed dungeon area totals and GS checks not functioning properly. * Major revamp of checking code. Doesn't rely on `GetCheckFromActor` at all anymore, but instead simply sets a flag to evaluate a number of checks in an area every frame until the check that was gotten is identified. With the new setup, it's much less hardware intensive, and at 60fps 6 checks per frame shows no noticeable effect on framerate. I can envision needing to add a collectedCount in order to account for times when two checks are gotten one right after the other. Changed area scroll to happen from `OnTransitionEnd`, and allow for scrolling in bazaar (was disabled previously because it would jump back and forth between Kak and Market while you were in one). Also setup area check order updating by area instead of all at the same time. * Fixed shooting gallery not reporting proper area. Prevent checks from actually happening if area is RCAREA_INVALID, now that all areas are reporting something if they have checks. Fixed `GetCheckArea()` not updating checks for standard scenes. Lots of vanilla tracking updates, mainly manual checks for gems, medallions and songs, since the often don't have proper scenes in the data. Prevent vanilla from triggering check loops if junk items are collected. Fixed sorting based on saved vs collected. Prevent item name display for vanilla runs. Change coloring of checks so the check name reflects status in vanilla runs. * Fixed "Recheck Area" button erroneously adding to an area's check totals? * Fix DMC vanilla checks. * Fix check tracker data recreation on data file loss. Removed redundant file exists check from SaveTrackerDataHook, as it doesn't matter if it exists or not at that point. Limited check loops to 3 to avoid infinite check loops on non-check/junk item pickup. Added more checks to disable tracker operations if a save is not running. Changed check ordering to put boss reward and heart container checks at the end of whatever RCSHOW group they belong to. * Fixed IsRunning calculation. Further improving vanilla checking. Starting framework for checking medallions, stones, and songs on data file recreation. Fixed medallion check collection. Added GIFT_FROM_SAGES to check list for vanilla file for tracking light medallion. Added check loop limitation to prevent infinite checking after picking up junk item from the ground. * Finished vanilla file recreation and recheck (songs and dungeon rewards all check properly now). This includes deku shield with KF shop item 3. Finished Gift from Raoru light medallion tracking for vanilla. Commented all CheckByScene functionality for now. * Fixed new save data file creation. Disabled entrance area calculation for now, as it only tracks the previous entrance for some reason. Fixed area detection for ToT checks. * GetCheckArea() now utilizes EntranceData almost exclusively, via either `gSaveContext.entranceIndex` or the entrance tracker's `currentGrottoId` in the case of grottos. This also means that EVERYTHING CAN AUTOSCROLL NOW. Entrance shuffles are now much easier to track. Autoscroll is now also triggered on save, just in case someone isn't autosaving and has a lot of checks that get converted to saved. * Fixed missing GS check in LW. * Added area scroll on toggling Show Hidden Items. May configure differently later. Fixed area detection for entrances in Gerudo Fortress/Valley and Collossus. Haunted wasteland doesn't autoscroll due to a bug in `OnTransitionEnd` hook, but checks still evaluate properly there. Rely on scene-based area detection if scene is a main overworld or dungeon scene. * Fixed grotto detection when shuffle is off. * Small code cleanup. Fixed Colossus hand chest checks. * Missing lus bump from merge conflict resolution * Fixed Colossus Grotto making `GetCheckArea` return Wasteland. * Improved OnItemReceive processing for non-token GS checks, since they can sometimes take long enough for the checking process to time out before the item is registered as received. * First attempt at thread safety for tracker data file writing. Seems to work, but might need more testing. * Fixed Recheck Area not unskipping items that register as saved. Improved delayed saving with autosaving, as the autosave triggered quite often before the tracker data save, making things not properly register as saved. * merge cleanup * Converted check tracker data to the sectional saves, adding `CheckTrackerData` to `SaveContext`. Implemented section ID returning and fullSave boolean passing to section functions from my PR temporarily for it to work properly. Moved `RandomizerCheckTrackerData` enum to `randomizerTypes.h` to accommodate that. Changed `Randomizer_SaveInit` to a `SaveManager::InitFunc` to allow for other randomizer-dependent sections to be initialized after that. Required a little refactoring to maintain intro cutscene skip when starting a randomizer file. * Revert section index return and randomizer init changes. Will need to wait on yet more changes to main. * Fixed check tracker initialization (shouldn't be tied to window initialization), restored saving/loading functionality. * Removed `CheckTracker::Init` and put SaveManager calls in `CheckTrackerWindow::InitElement`. Also a bit of cleanup from transition back to save file use. * Fixed tracker displaying check categories while file not loaded. * Fix Darunia's Joy check not marking in vanilla. * Fix autosave not triggering change from collected to saved in tracker data. * Changed default colors for scummed and collected display. * Merge upgrade code cleanup. * Add `OnTransitionEnd` calls to sandstorm transitions both to and from Wasteland. Also improved `gSaveContext.lastScene` assignment for both transition types. Allowed a bit of cleanup in `GetCheckArea`. * Added `StateButton`, a button like `ArrowButton` but that allows text instead of arrow icons. Apparently the changes from ArrowButton to StateButton happened in a previous commit... * Changed section name to `trackerDataCheck` to force SoH to load it after the randomizer section, as it required some randoSettings to be loaded first, and nothing else I tried to make the randomizer section load before it worked. This hacks a solution to checks not displaying on fast file load to a specific slot. F*** you, SaveManager, and f*** you too, JSON. * Forgot to change the section string for loading with the name change. * Fix check ordering for checks that trigger the autosave. * Adds option to remove right-side shop items (slots 1-4) from the tracker list. Enabled by default. * Fix default state of Hide Shop Right Checks checkbox. * Fixes grotto and great fairy scrolling and checks. Fixes array overflow from `checkTrackerData` which was creating the issue trying to load the base and randomizer sections first, among other things. That also fixed the massive file loads that were being exhibited in debug mode. * Fix shooting galleries being set as collected again when being played a second time after getting the checks. * Fix Bazaar autoscroll. * Add Saria's Song to `GetCheckFromActor` and removed some limitations from the messageCloseCheck function to make that check track properly. * Fix Song from Impa check. Implemented prevention for multiple "collections" of great fairies, just in case getting the health refill would trigger it with the previous setup. * Fix ice traps on GS tokens not triggering OnItemReceive. * Complete fix for ice trap collection from GS. Add autoscroll when clicking "Expand All". * Add `OnShopSlotChange` with cursorSlot and basePrice parameters. * Fixed include in en_ossan for shop slot hook. Added registration for `OnShopSlotChange` in the tracker, storing the price in a new `price` field in `CheckTrackerData`. Added "seen" functionality to shop checks. Displays the model item name upon first entering a shop, adding the price and switching to trickName (if it's an ice trap) upon navigating to the slot in buy mode, triggered by an invisible "identified" status that mirrors "seen" in every other way. Added tooltips to most options for check tracker color picking to describe what each status actually means. * `std::format` pls * So apparently std::format just decided to break with the latest merge from develop, but fmt::format exists and works? * Removed the last vestiges of `locationsSkipped`. Other general code and formatting cleanups. Moved `IsGameRunning` to `OTRGlobals` so the item tracker could also access it. Used preceding to "fix" item and bottle display in the item tracker on startup. * Some more code cleanup. Removed "Recheck Area" button and relevant code. Backported changes to Anchor branch applicable for single-player, including making a checkAreas vector and structuring the frame by frame checks around that. Also includes fix for Silver Gauntlets and Mirror Shield check collection crash associated with those changes. Fixed Kakariko Bazaar "seen" updates. Fixed tracker window not showing on initial load like it should. * Forgot 1 formatting fix. * Removed conditions for showing Song from Impa (isn't junk under certain conditions, so should show all the time). * Fix vanilla checks, add Zelda's Letter and Malon's Egg to manual check collection. Fix autoscroll while in child stealth section. * Fix crash in Happy Mask Shop in OnSlotChange (referenced non-existent shop id in a tracker-specific enum). * General code cleanup. * Missed one reversion. * One more. * Fix column alignment in `randomizer_check_objects`. * Fix file encoding on `randomizer_check_tracker`. Again. * Fix indentation for `actualItemtrackerItemMap`. Also removed unnecessary parts of the map. * Rename `HasEqItem` to `HasEquipment`. * Slightly better indentation for `actualItemTrackerItemMap`. * Add magic bean salesman to vanilla check tracking, and genericized deku shield to trigger KF shop item 3 wherever you get the shield. Renamed `vanillaCheck` to `vanillaHundoCheck` to (supposedly) clarify the meaning of the usage. * One more rename to `vanillaCompletion` to avoid possible confusion with 100% speedrun conditions. * give me a break XD Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * Changes suggested by briaguya (rename `RandomizerCheckShow` to `Status`, unused code, newline formatting) * Remove unused `itemNames` table. * Remove `IsGameRunning` in favor of `GameInteractor::IsSaveLoaded`. * Restore anti-spoiler functionality for dungeons with dungeon maps. * Review cleanup. * Fix prices not showing for Kak bazaar items. --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com>
2023-10-04 11:03:36 -04:00
} else if (status == RCSHOW_SCUMMED) {
if (!showHidden && CVarGetInteger("gCheckTrackerScummedHide", 0)) {
Randomizer Auto Location tracker (#1942) * Initial Auto-Location Tracking * Updates styling for checked items in Check Tracker * Fixes crashing issues with Check Tracker rendering * Auto scroll Check Tracker windows to current area * Checks Tracker only shows checked locations once in game * Fixes issue where Check Tracker would auto-scroll to wrong location when entering a grotto * Fixes gerudo fortress checks showing in tracker when settings have them removed * InfTable Check Location Fixes: Lost Dog Richard, Rolling Gorons, HBA 1000, Thawed Zora * Fixes most Event Chk Inf Checks on Check Tracker, and Frogs * Check Tracker - Song from Malon now works * Check Tracker - Fixes Claim Check check not tracking - Fixes spoiler for Claim Check check when getting Biggoron's Sword - Fixes LACS being spoiled and not tracking * Check Tracker - Fixes #2 for Skull Mask and Mask of Truth checks * Check Tracker - Adds support for merchants - Fixes #7 for Bomchu Salesman - Fixes #12 for Medigoron * Check Tracker - Fixes #8 for Song from Saria * Check Tracker - Fixes #9 for Adult Shooting Gallery * Check Tracker - Fixes #10 for Composer Grave * Check Tracker - Fixes #14 for Song from Ocarina of Time * Check Tracker - Fixes #16 for Shooting the Sun * Check Tracker - Fixes #19 for Darunia's Joy * Save Editor - Adds missing label for Treasure Chest Game * Check Tracker - Fixes Great Faries checks * Check Tracker - Fixes Sheik at Temple * Check Tracker - Fixes Great Fairy auto-scroll to wrong location * Check Tracker - Updates blue warp checks - Fixes Bongo Bongo and Twinrova checks * Check Tracker - Fixes Dampe's Gravedigging Tour * Check Tracker - Fixes Prescription to King Zora * Check Tracker - Fixes Bazaar showing under wrong area on tracker between adult/child * Check Tracker - Fixes scroll for Hyrule Market and Bazaar * Check Tracker - Fixes giving Adult Trade Items shown on tracker: Broken Sword, Saw, Cojiro, Eyeball Froge, and Eyedrops * Cleans up item_location * Check Tracker - Item List - Fixes item list not updating when changing seeds/options - Separates item exclusion list from item check list - Clean up comments * Check Tracker - Adds Skip functionality to buttons * Check Tracker - Refactors adult trade items to RandomizerInf * Check Tracker - Fixes an issue where any time an item is removed the tracker would cause an application crash * Check Tracker - Item names are now dependent on file language * Check Tracker - Fixes Gerudo Card check not showing in Fast setting * Reorders headers to (hopefully) avoid CI build conflicts on linux/consoles * Explicitly defines vector header in randomizer.h to fix compile errors * Complete Refactor of Check Tracker ImGui * Adds missing check tracker files to CMakeLists * Reverts the Item_location whitespace cleanup from ad10807c * Check Tracker - Loading Fixes - Fixes a bug where loading a save file a second time would add all the checks again - Fixes a bug where the check tracker would not render at all until in a save file * Check Tracker - Fixes a bug where checks would sometimes fail to load * Check Tracker - Fixes duplicated checks when using Only on Pause or Only on Combo * Check Tracker - Works around issue where single characters don't show in EnhancementCombobox, and fixes a label for combo buttons held option * Check Tracker - Applies all Check Tracker changes to Item Location * Check Tracker - Updated Check List - Adds Link's pocket, either in KF or HM depending on starting age - Supports Scrubs and Merchants - Uses enums instead of magic numbers - Updates DC Scrub Short Names for MQ * Check Tracker - Adds a performance mode option * Check Tracker - List Fixes (requires new rando generation) - Fixes Frogs Rupees always visible - Fixes Kokiri Sword Chest not showing - Fixes Weird Egg not showing * Check Tracker - MQ List basic support * Check Tracker - MQ/Vanilla anti-spoilers * Check Tracker - Collecting a compass now spoils the area * Check Tracker - Basic Vanilla Support and fixes - Vanilla items show in check tracker, even if many won't auto check - Fixes an issue with Gerudo Fortress Keys - Refactors IsVisibleInCheckTracker to randomizer_check_tracjer * Check Tracker - Fixes merge conflict from 08a487f35e1d760ab9e69b932edbe4da6bcd9edb * Check Tracker - Fixes tracker loading as Floating when default value is set to Windowed * Randomizer Location Exclusion List - Adds Scrubs, Merchants, Shops. Adult Trade items, MQ Dungeons, and Bean Salesman - Fixes Kokiri Sword Chest, Weird Egg, and Frog Song Rupees from misbehaving - Updates Gerudo Fortress logic to be dependent on Open/Fast/Normal Fortress - Removes Invalid Check - Adds RO Enum for MQ settings - Updates magic values to RO enum * Location Exclusion List - Scrubs that are always randomized now always show on the list * For now, removes some extra code only needed for a Check Tracker. * Randomizer Location Exclusion List - Fixes Eyeball Frog from showing up when Adult Trade Items was off * Location Tracker - Updates Eyedrops to use RandomizerInf instead of Chest * Check Tracker - Fixes a bug where Link's Pocket item wasn't acting as checked for area item count * Check Tracker - Fixes a bug where Locations would incorrectly say Vanilla due to the first check in the area being a non-MQ check * Check Tracker - Fixes a crash when Check Tracker is docked but not visible * Check Tracker - Fixes areas being spoiled when loading different save files * Check Tracker - Only reset variables if they are initialized * Check Tracker - Cleans up old comments, unused variables, methods, and macros, adds language TODOs, * Check Tracker - Readds rainbow UI elements after Cosmetics Editor refactor * Check Tracker - Removal of flag lookup that was refactored, no longer needed header, and some trivial whitespace fixes. * Check Tracker - Refactors Index to Bitmask code to a macro * Check Tracker - Changes ordering from alphabetical to RandomizerCheck ordering * Check Tracker - Wraps everything in a namespace to avoid global variable usage * Check Tracker - Explicitly defines for-loop scope * Check Tracker - refactors dungeon lookup from static array to function * Fixes a bug when using EnhancementColor with alpha * Check Tracker - Refactors all colour to use direct conversions * Check Tracker - refactors settings loading and check visibility for readability * Check Tracker - Fixes a bug where the wrong label showed on the Check Tracker BG Color * UIWidgets - Adds Alpha bar to EnhancementColor when using alpha parameter
2022-12-10 22:39:23 -05:00
return;
}
mainColor = !IsHeartPiece(rcObj.ogItemId) && !IS_RANDO ? CVarGetColor("gCheckTrackerScummedExtraColor", Color_Scummed_Extra_Default) :
CVarGetColor("gCheckTrackerScummedMainColor", Color_Main_Default);
extraColor = CVarGetColor("gCheckTrackerScummedExtraColor", Color_Scummed_Extra_Default);
Check Tracker Update (#2668) * Initial commit. What works so far: Data file loads, saves, deletes, and is created properly. - Need to run `HasItemBeenCollected` when creating in case of mid-seed regen. Organized checks into maps set by area. Areas show in tracker. - Checks pulled from checkObjectsByArea are not currently listed. - Areas are being assumed completed and hidden at the start. * Checks now populate. Still not counting area totals properly. * Don't track RC_LINKS_POCKET in the data file, and instead manually add it in every time a save is load. rcObjects doesn't contain Link's Pocket location (duh). * Moved ItemReceive hook to randomizer_check_tracker.cpp. Skipped items are properly sorted and formatted. Saved items contribute to an area's gotten/skipped checks on load. Changed skipped items default main color to gray. General code cleanup. * Skipped checks now contribute to area totals for area completion logic. * Mid-menu rework transfer. * Started check lookup on item receive. Tried to enable scum checking on save. * Fixed scum check on save. * More code cleanup, which revealed some issues with loading and saving. Loading now works 100%, but entries in checkTrackerData are disappearing in code somewhere, causing issues with later checks. Scummed color now displays properly. Collected but unsaved displays properly. Unchecked, Skipped, Seen and Scummed checks all have arrows for skipping/unskipping. Counts a little messed up, probably double adding skips. * Fixed item counts being off across resets. Restarts were fine. * Beginning of rework for individual check updates. Adds `Actor lastCheck` to PlayState to allow assigning of last actor to give an item. This allows precise tracking of GS, freestanding PoH, etc. Works for chests too. Currently does not work for shops, unknown for normal NPC gives. Doesn't track last gives for non-checks, like drops from grass, pots, crates, etc. * Actor-based checks fully fleshed out, but can't help with sale-based checks. Implemented `pendingSaleCheck` to back out of an RC check cycle if `gSaveContext->pendingSale` is not NONE when `OnItemReceive` is called, processed through `OnSaleEnd`. This should be the final change necessary to streamline the checks. * Temporary hook to message box close to tie in trackers for non-gs/chest actors that aren't added to `GetCheckFromActor`. This triggers a 2-frame countdown to check with `HasItemBeenCollected` since half of the methods in there aren't updated until after a text box closes. Added scene tracking to get last scene so that checks in scenes that span several overworld areas could be tied to their areas properly. Modified tracker data creation to apply Link's Pocket and Song from Impa conditionally based on randomizer settings instead of just being assumed to be done. May need modification for checking click and drag spoiler loading. Removed the scene equivalence check from CheckChecks so that an entire area is checked each time to avoid issues with, e.g., leaving a shop before a pending sale finishes. * Changed check data creation to use RSKs from gRandomizer to account for settings loaded from drag and drop spoilers. * Beginning of tracker code organization. Changed check color defaults. * Reverted moving tracker colors to header. Some individual check fixes. * Missed something from previous merge? * Removed last remnant of removed performance mode. * Better handle checking when skullsanity is off. * Song checks sceneIDs don't match the scenes they're actually in for some reason. Removed that check. * SaleEnd checks don't need the GetItemEntry parameter. Also set a flag that should prevent the check tracker from running during vanilla saves should that not be resolved by the time it's merged. * Attempting to have only the relevant checks added to the tracker data, as well as showing vanilla checks for non-rando saves. Not working yet (everything is displayed in vanilla). * Added vanilla check tracker population via `vanillaCheck` bool in `RandomizerCheckObject`. This is also added to `IsVisibleInImGui` to handle file loading and saving to eliminate checks that aren't part of vanilla or the rando seed. Implemented deleted tracker data file recreation. Added some extra item name text checks. Songs are still... tricky, so they stay blank. Utilize local copies of the randomizer check objects that are applicable for performance purposes. Fixed vanilla item-giving cutscene crashes when triggered mid-transition. * Apparently not all toolchains can handle macro instantiation without all parameters, like VS can. * Fixed scummed detail color not showing properly on tracker. * Fixed dungeon area totals and GS checks not functioning properly. * Major revamp of checking code. Doesn't rely on `GetCheckFromActor` at all anymore, but instead simply sets a flag to evaluate a number of checks in an area every frame until the check that was gotten is identified. With the new setup, it's much less hardware intensive, and at 60fps 6 checks per frame shows no noticeable effect on framerate. I can envision needing to add a collectedCount in order to account for times when two checks are gotten one right after the other. Changed area scroll to happen from `OnTransitionEnd`, and allow for scrolling in bazaar (was disabled previously because it would jump back and forth between Kak and Market while you were in one). Also setup area check order updating by area instead of all at the same time. * Fixed shooting gallery not reporting proper area. Prevent checks from actually happening if area is RCAREA_INVALID, now that all areas are reporting something if they have checks. Fixed `GetCheckArea()` not updating checks for standard scenes. Lots of vanilla tracking updates, mainly manual checks for gems, medallions and songs, since the often don't have proper scenes in the data. Prevent vanilla from triggering check loops if junk items are collected. Fixed sorting based on saved vs collected. Prevent item name display for vanilla runs. Change coloring of checks so the check name reflects status in vanilla runs. * Fixed "Recheck Area" button erroneously adding to an area's check totals? * Fix DMC vanilla checks. * Fix check tracker data recreation on data file loss. Removed redundant file exists check from SaveTrackerDataHook, as it doesn't matter if it exists or not at that point. Limited check loops to 3 to avoid infinite check loops on non-check/junk item pickup. Added more checks to disable tracker operations if a save is not running. Changed check ordering to put boss reward and heart container checks at the end of whatever RCSHOW group they belong to. * Fixed IsRunning calculation. Further improving vanilla checking. Starting framework for checking medallions, stones, and songs on data file recreation. Fixed medallion check collection. Added GIFT_FROM_SAGES to check list for vanilla file for tracking light medallion. Added check loop limitation to prevent infinite checking after picking up junk item from the ground. * Finished vanilla file recreation and recheck (songs and dungeon rewards all check properly now). This includes deku shield with KF shop item 3. Finished Gift from Raoru light medallion tracking for vanilla. Commented all CheckByScene functionality for now. * Fixed new save data file creation. Disabled entrance area calculation for now, as it only tracks the previous entrance for some reason. Fixed area detection for ToT checks. * GetCheckArea() now utilizes EntranceData almost exclusively, via either `gSaveContext.entranceIndex` or the entrance tracker's `currentGrottoId` in the case of grottos. This also means that EVERYTHING CAN AUTOSCROLL NOW. Entrance shuffles are now much easier to track. Autoscroll is now also triggered on save, just in case someone isn't autosaving and has a lot of checks that get converted to saved. * Fixed missing GS check in LW. * Added area scroll on toggling Show Hidden Items. May configure differently later. Fixed area detection for entrances in Gerudo Fortress/Valley and Collossus. Haunted wasteland doesn't autoscroll due to a bug in `OnTransitionEnd` hook, but checks still evaluate properly there. Rely on scene-based area detection if scene is a main overworld or dungeon scene. * Fixed grotto detection when shuffle is off. * Small code cleanup. Fixed Colossus hand chest checks. * Missing lus bump from merge conflict resolution * Fixed Colossus Grotto making `GetCheckArea` return Wasteland. * Improved OnItemReceive processing for non-token GS checks, since they can sometimes take long enough for the checking process to time out before the item is registered as received. * First attempt at thread safety for tracker data file writing. Seems to work, but might need more testing. * Fixed Recheck Area not unskipping items that register as saved. Improved delayed saving with autosaving, as the autosave triggered quite often before the tracker data save, making things not properly register as saved. * merge cleanup * Converted check tracker data to the sectional saves, adding `CheckTrackerData` to `SaveContext`. Implemented section ID returning and fullSave boolean passing to section functions from my PR temporarily for it to work properly. Moved `RandomizerCheckTrackerData` enum to `randomizerTypes.h` to accommodate that. Changed `Randomizer_SaveInit` to a `SaveManager::InitFunc` to allow for other randomizer-dependent sections to be initialized after that. Required a little refactoring to maintain intro cutscene skip when starting a randomizer file. * Revert section index return and randomizer init changes. Will need to wait on yet more changes to main. * Fixed check tracker initialization (shouldn't be tied to window initialization), restored saving/loading functionality. * Removed `CheckTracker::Init` and put SaveManager calls in `CheckTrackerWindow::InitElement`. Also a bit of cleanup from transition back to save file use. * Fixed tracker displaying check categories while file not loaded. * Fix Darunia's Joy check not marking in vanilla. * Fix autosave not triggering change from collected to saved in tracker data. * Changed default colors for scummed and collected display. * Merge upgrade code cleanup. * Add `OnTransitionEnd` calls to sandstorm transitions both to and from Wasteland. Also improved `gSaveContext.lastScene` assignment for both transition types. Allowed a bit of cleanup in `GetCheckArea`. * Added `StateButton`, a button like `ArrowButton` but that allows text instead of arrow icons. Apparently the changes from ArrowButton to StateButton happened in a previous commit... * Changed section name to `trackerDataCheck` to force SoH to load it after the randomizer section, as it required some randoSettings to be loaded first, and nothing else I tried to make the randomizer section load before it worked. This hacks a solution to checks not displaying on fast file load to a specific slot. F*** you, SaveManager, and f*** you too, JSON. * Forgot to change the section string for loading with the name change. * Fix check ordering for checks that trigger the autosave. * Adds option to remove right-side shop items (slots 1-4) from the tracker list. Enabled by default. * Fix default state of Hide Shop Right Checks checkbox. * Fixes grotto and great fairy scrolling and checks. Fixes array overflow from `checkTrackerData` which was creating the issue trying to load the base and randomizer sections first, among other things. That also fixed the massive file loads that were being exhibited in debug mode. * Fix shooting galleries being set as collected again when being played a second time after getting the checks. * Fix Bazaar autoscroll. * Add Saria's Song to `GetCheckFromActor` and removed some limitations from the messageCloseCheck function to make that check track properly. * Fix Song from Impa check. Implemented prevention for multiple "collections" of great fairies, just in case getting the health refill would trigger it with the previous setup. * Fix ice traps on GS tokens not triggering OnItemReceive. * Complete fix for ice trap collection from GS. Add autoscroll when clicking "Expand All". * Add `OnShopSlotChange` with cursorSlot and basePrice parameters. * Fixed include in en_ossan for shop slot hook. Added registration for `OnShopSlotChange` in the tracker, storing the price in a new `price` field in `CheckTrackerData`. Added "seen" functionality to shop checks. Displays the model item name upon first entering a shop, adding the price and switching to trickName (if it's an ice trap) upon navigating to the slot in buy mode, triggered by an invisible "identified" status that mirrors "seen" in every other way. Added tooltips to most options for check tracker color picking to describe what each status actually means. * `std::format` pls * So apparently std::format just decided to break with the latest merge from develop, but fmt::format exists and works? * Removed the last vestiges of `locationsSkipped`. Other general code and formatting cleanups. Moved `IsGameRunning` to `OTRGlobals` so the item tracker could also access it. Used preceding to "fix" item and bottle display in the item tracker on startup. * Some more code cleanup. Removed "Recheck Area" button and relevant code. Backported changes to Anchor branch applicable for single-player, including making a checkAreas vector and structuring the frame by frame checks around that. Also includes fix for Silver Gauntlets and Mirror Shield check collection crash associated with those changes. Fixed Kakariko Bazaar "seen" updates. Fixed tracker window not showing on initial load like it should. * Forgot 1 formatting fix. * Removed conditions for showing Song from Impa (isn't junk under certain conditions, so should show all the time). * Fix vanilla checks, add Zelda's Letter and Malon's Egg to manual check collection. Fix autoscroll while in child stealth section. * Fix crash in Happy Mask Shop in OnSlotChange (referenced non-existent shop id in a tracker-specific enum). * General code cleanup. * Missed one reversion. * One more. * Fix column alignment in `randomizer_check_objects`. * Fix file encoding on `randomizer_check_tracker`. Again. * Fix indentation for `actualItemtrackerItemMap`. Also removed unnecessary parts of the map. * Rename `HasEqItem` to `HasEquipment`. * Slightly better indentation for `actualItemTrackerItemMap`. * Add magic bean salesman to vanilla check tracking, and genericized deku shield to trigger KF shop item 3 wherever you get the shield. Renamed `vanillaCheck` to `vanillaHundoCheck` to (supposedly) clarify the meaning of the usage. * One more rename to `vanillaCompletion` to avoid possible confusion with 100% speedrun conditions. * give me a break XD Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * Changes suggested by briaguya (rename `RandomizerCheckShow` to `Status`, unused code, newline formatting) * Remove unused `itemNames` table. * Remove `IsGameRunning` in favor of `GameInteractor::IsSaveLoaded`. * Restore anti-spoiler functionality for dungeons with dungeon maps. * Review cleanup. * Fix prices not showing for Kak bazaar items. --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com>
2023-10-04 11:03:36 -04:00
} else if (status == RCSHOW_UNCHECKED) {
if (!showHidden && CVarGetInteger("gCheckTrackerUncheckedHide", 0)) {
Randomizer Auto Location tracker (#1942) * Initial Auto-Location Tracking * Updates styling for checked items in Check Tracker * Fixes crashing issues with Check Tracker rendering * Auto scroll Check Tracker windows to current area * Checks Tracker only shows checked locations once in game * Fixes issue where Check Tracker would auto-scroll to wrong location when entering a grotto * Fixes gerudo fortress checks showing in tracker when settings have them removed * InfTable Check Location Fixes: Lost Dog Richard, Rolling Gorons, HBA 1000, Thawed Zora * Fixes most Event Chk Inf Checks on Check Tracker, and Frogs * Check Tracker - Song from Malon now works * Check Tracker - Fixes Claim Check check not tracking - Fixes spoiler for Claim Check check when getting Biggoron's Sword - Fixes LACS being spoiled and not tracking * Check Tracker - Fixes #2 for Skull Mask and Mask of Truth checks * Check Tracker - Adds support for merchants - Fixes #7 for Bomchu Salesman - Fixes #12 for Medigoron * Check Tracker - Fixes #8 for Song from Saria * Check Tracker - Fixes #9 for Adult Shooting Gallery * Check Tracker - Fixes #10 for Composer Grave * Check Tracker - Fixes #14 for Song from Ocarina of Time * Check Tracker - Fixes #16 for Shooting the Sun * Check Tracker - Fixes #19 for Darunia's Joy * Save Editor - Adds missing label for Treasure Chest Game * Check Tracker - Fixes Great Faries checks * Check Tracker - Fixes Sheik at Temple * Check Tracker - Fixes Great Fairy auto-scroll to wrong location * Check Tracker - Updates blue warp checks - Fixes Bongo Bongo and Twinrova checks * Check Tracker - Fixes Dampe's Gravedigging Tour * Check Tracker - Fixes Prescription to King Zora * Check Tracker - Fixes Bazaar showing under wrong area on tracker between adult/child * Check Tracker - Fixes scroll for Hyrule Market and Bazaar * Check Tracker - Fixes giving Adult Trade Items shown on tracker: Broken Sword, Saw, Cojiro, Eyeball Froge, and Eyedrops * Cleans up item_location * Check Tracker - Item List - Fixes item list not updating when changing seeds/options - Separates item exclusion list from item check list - Clean up comments * Check Tracker - Adds Skip functionality to buttons * Check Tracker - Refactors adult trade items to RandomizerInf * Check Tracker - Fixes an issue where any time an item is removed the tracker would cause an application crash * Check Tracker - Item names are now dependent on file language * Check Tracker - Fixes Gerudo Card check not showing in Fast setting * Reorders headers to (hopefully) avoid CI build conflicts on linux/consoles * Explicitly defines vector header in randomizer.h to fix compile errors * Complete Refactor of Check Tracker ImGui * Adds missing check tracker files to CMakeLists * Reverts the Item_location whitespace cleanup from ad10807c * Check Tracker - Loading Fixes - Fixes a bug where loading a save file a second time would add all the checks again - Fixes a bug where the check tracker would not render at all until in a save file * Check Tracker - Fixes a bug where checks would sometimes fail to load * Check Tracker - Fixes duplicated checks when using Only on Pause or Only on Combo * Check Tracker - Works around issue where single characters don't show in EnhancementCombobox, and fixes a label for combo buttons held option * Check Tracker - Applies all Check Tracker changes to Item Location * Check Tracker - Updated Check List - Adds Link's pocket, either in KF or HM depending on starting age - Supports Scrubs and Merchants - Uses enums instead of magic numbers - Updates DC Scrub Short Names for MQ * Check Tracker - Adds a performance mode option * Check Tracker - List Fixes (requires new rando generation) - Fixes Frogs Rupees always visible - Fixes Kokiri Sword Chest not showing - Fixes Weird Egg not showing * Check Tracker - MQ List basic support * Check Tracker - MQ/Vanilla anti-spoilers * Check Tracker - Collecting a compass now spoils the area * Check Tracker - Basic Vanilla Support and fixes - Vanilla items show in check tracker, even if many won't auto check - Fixes an issue with Gerudo Fortress Keys - Refactors IsVisibleInCheckTracker to randomizer_check_tracjer * Check Tracker - Fixes merge conflict from 08a487f35e1d760ab9e69b932edbe4da6bcd9edb * Check Tracker - Fixes tracker loading as Floating when default value is set to Windowed * Randomizer Location Exclusion List - Adds Scrubs, Merchants, Shops. Adult Trade items, MQ Dungeons, and Bean Salesman - Fixes Kokiri Sword Chest, Weird Egg, and Frog Song Rupees from misbehaving - Updates Gerudo Fortress logic to be dependent on Open/Fast/Normal Fortress - Removes Invalid Check - Adds RO Enum for MQ settings - Updates magic values to RO enum * Location Exclusion List - Scrubs that are always randomized now always show on the list * For now, removes some extra code only needed for a Check Tracker. * Randomizer Location Exclusion List - Fixes Eyeball Frog from showing up when Adult Trade Items was off * Location Tracker - Updates Eyedrops to use RandomizerInf instead of Chest * Check Tracker - Fixes a bug where Link's Pocket item wasn't acting as checked for area item count * Check Tracker - Fixes a bug where Locations would incorrectly say Vanilla due to the first check in the area being a non-MQ check * Check Tracker - Fixes a crash when Check Tracker is docked but not visible * Check Tracker - Fixes areas being spoiled when loading different save files * Check Tracker - Only reset variables if they are initialized * Check Tracker - Cleans up old comments, unused variables, methods, and macros, adds language TODOs, * Check Tracker - Readds rainbow UI elements after Cosmetics Editor refactor * Check Tracker - Removal of flag lookup that was refactored, no longer needed header, and some trivial whitespace fixes. * Check Tracker - Refactors Index to Bitmask code to a macro * Check Tracker - Changes ordering from alphabetical to RandomizerCheck ordering * Check Tracker - Wraps everything in a namespace to avoid global variable usage * Check Tracker - Explicitly defines for-loop scope * Check Tracker - refactors dungeon lookup from static array to function * Fixes a bug when using EnhancementColor with alpha * Check Tracker - Refactors all colour to use direct conversions * Check Tracker - refactors settings loading and check visibility for readability * Check Tracker - Fixes a bug where the wrong label showed on the Check Tracker BG Color * UIWidgets - Adds Alpha bar to EnhancementColor when using alpha parameter
2022-12-10 22:39:23 -05:00
return;
}
mainColor = !IsHeartPiece(rcObj.ogItemId) && !IS_RANDO ? CVarGetColor("gCheckTrackerUncheckedExtraColor", Color_Unchecked_Extra_Default) :
CVarGetColor("gCheckTrackerUncheckedMainColor", Color_Main_Default);
Check Tracker Update (#2668) * Initial commit. What works so far: Data file loads, saves, deletes, and is created properly. - Need to run `HasItemBeenCollected` when creating in case of mid-seed regen. Organized checks into maps set by area. Areas show in tracker. - Checks pulled from checkObjectsByArea are not currently listed. - Areas are being assumed completed and hidden at the start. * Checks now populate. Still not counting area totals properly. * Don't track RC_LINKS_POCKET in the data file, and instead manually add it in every time a save is load. rcObjects doesn't contain Link's Pocket location (duh). * Moved ItemReceive hook to randomizer_check_tracker.cpp. Skipped items are properly sorted and formatted. Saved items contribute to an area's gotten/skipped checks on load. Changed skipped items default main color to gray. General code cleanup. * Skipped checks now contribute to area totals for area completion logic. * Mid-menu rework transfer. * Started check lookup on item receive. Tried to enable scum checking on save. * Fixed scum check on save. * More code cleanup, which revealed some issues with loading and saving. Loading now works 100%, but entries in checkTrackerData are disappearing in code somewhere, causing issues with later checks. Scummed color now displays properly. Collected but unsaved displays properly. Unchecked, Skipped, Seen and Scummed checks all have arrows for skipping/unskipping. Counts a little messed up, probably double adding skips. * Fixed item counts being off across resets. Restarts were fine. * Beginning of rework for individual check updates. Adds `Actor lastCheck` to PlayState to allow assigning of last actor to give an item. This allows precise tracking of GS, freestanding PoH, etc. Works for chests too. Currently does not work for shops, unknown for normal NPC gives. Doesn't track last gives for non-checks, like drops from grass, pots, crates, etc. * Actor-based checks fully fleshed out, but can't help with sale-based checks. Implemented `pendingSaleCheck` to back out of an RC check cycle if `gSaveContext->pendingSale` is not NONE when `OnItemReceive` is called, processed through `OnSaleEnd`. This should be the final change necessary to streamline the checks. * Temporary hook to message box close to tie in trackers for non-gs/chest actors that aren't added to `GetCheckFromActor`. This triggers a 2-frame countdown to check with `HasItemBeenCollected` since half of the methods in there aren't updated until after a text box closes. Added scene tracking to get last scene so that checks in scenes that span several overworld areas could be tied to their areas properly. Modified tracker data creation to apply Link's Pocket and Song from Impa conditionally based on randomizer settings instead of just being assumed to be done. May need modification for checking click and drag spoiler loading. Removed the scene equivalence check from CheckChecks so that an entire area is checked each time to avoid issues with, e.g., leaving a shop before a pending sale finishes. * Changed check data creation to use RSKs from gRandomizer to account for settings loaded from drag and drop spoilers. * Beginning of tracker code organization. Changed check color defaults. * Reverted moving tracker colors to header. Some individual check fixes. * Missed something from previous merge? * Removed last remnant of removed performance mode. * Better handle checking when skullsanity is off. * Song checks sceneIDs don't match the scenes they're actually in for some reason. Removed that check. * SaleEnd checks don't need the GetItemEntry parameter. Also set a flag that should prevent the check tracker from running during vanilla saves should that not be resolved by the time it's merged. * Attempting to have only the relevant checks added to the tracker data, as well as showing vanilla checks for non-rando saves. Not working yet (everything is displayed in vanilla). * Added vanilla check tracker population via `vanillaCheck` bool in `RandomizerCheckObject`. This is also added to `IsVisibleInImGui` to handle file loading and saving to eliminate checks that aren't part of vanilla or the rando seed. Implemented deleted tracker data file recreation. Added some extra item name text checks. Songs are still... tricky, so they stay blank. Utilize local copies of the randomizer check objects that are applicable for performance purposes. Fixed vanilla item-giving cutscene crashes when triggered mid-transition. * Apparently not all toolchains can handle macro instantiation without all parameters, like VS can. * Fixed scummed detail color not showing properly on tracker. * Fixed dungeon area totals and GS checks not functioning properly. * Major revamp of checking code. Doesn't rely on `GetCheckFromActor` at all anymore, but instead simply sets a flag to evaluate a number of checks in an area every frame until the check that was gotten is identified. With the new setup, it's much less hardware intensive, and at 60fps 6 checks per frame shows no noticeable effect on framerate. I can envision needing to add a collectedCount in order to account for times when two checks are gotten one right after the other. Changed area scroll to happen from `OnTransitionEnd`, and allow for scrolling in bazaar (was disabled previously because it would jump back and forth between Kak and Market while you were in one). Also setup area check order updating by area instead of all at the same time. * Fixed shooting gallery not reporting proper area. Prevent checks from actually happening if area is RCAREA_INVALID, now that all areas are reporting something if they have checks. Fixed `GetCheckArea()` not updating checks for standard scenes. Lots of vanilla tracking updates, mainly manual checks for gems, medallions and songs, since the often don't have proper scenes in the data. Prevent vanilla from triggering check loops if junk items are collected. Fixed sorting based on saved vs collected. Prevent item name display for vanilla runs. Change coloring of checks so the check name reflects status in vanilla runs. * Fixed "Recheck Area" button erroneously adding to an area's check totals? * Fix DMC vanilla checks. * Fix check tracker data recreation on data file loss. Removed redundant file exists check from SaveTrackerDataHook, as it doesn't matter if it exists or not at that point. Limited check loops to 3 to avoid infinite check loops on non-check/junk item pickup. Added more checks to disable tracker operations if a save is not running. Changed check ordering to put boss reward and heart container checks at the end of whatever RCSHOW group they belong to. * Fixed IsRunning calculation. Further improving vanilla checking. Starting framework for checking medallions, stones, and songs on data file recreation. Fixed medallion check collection. Added GIFT_FROM_SAGES to check list for vanilla file for tracking light medallion. Added check loop limitation to prevent infinite checking after picking up junk item from the ground. * Finished vanilla file recreation and recheck (songs and dungeon rewards all check properly now). This includes deku shield with KF shop item 3. Finished Gift from Raoru light medallion tracking for vanilla. Commented all CheckByScene functionality for now. * Fixed new save data file creation. Disabled entrance area calculation for now, as it only tracks the previous entrance for some reason. Fixed area detection for ToT checks. * GetCheckArea() now utilizes EntranceData almost exclusively, via either `gSaveContext.entranceIndex` or the entrance tracker's `currentGrottoId` in the case of grottos. This also means that EVERYTHING CAN AUTOSCROLL NOW. Entrance shuffles are now much easier to track. Autoscroll is now also triggered on save, just in case someone isn't autosaving and has a lot of checks that get converted to saved. * Fixed missing GS check in LW. * Added area scroll on toggling Show Hidden Items. May configure differently later. Fixed area detection for entrances in Gerudo Fortress/Valley and Collossus. Haunted wasteland doesn't autoscroll due to a bug in `OnTransitionEnd` hook, but checks still evaluate properly there. Rely on scene-based area detection if scene is a main overworld or dungeon scene. * Fixed grotto detection when shuffle is off. * Small code cleanup. Fixed Colossus hand chest checks. * Missing lus bump from merge conflict resolution * Fixed Colossus Grotto making `GetCheckArea` return Wasteland. * Improved OnItemReceive processing for non-token GS checks, since they can sometimes take long enough for the checking process to time out before the item is registered as received. * First attempt at thread safety for tracker data file writing. Seems to work, but might need more testing. * Fixed Recheck Area not unskipping items that register as saved. Improved delayed saving with autosaving, as the autosave triggered quite often before the tracker data save, making things not properly register as saved. * merge cleanup * Converted check tracker data to the sectional saves, adding `CheckTrackerData` to `SaveContext`. Implemented section ID returning and fullSave boolean passing to section functions from my PR temporarily for it to work properly. Moved `RandomizerCheckTrackerData` enum to `randomizerTypes.h` to accommodate that. Changed `Randomizer_SaveInit` to a `SaveManager::InitFunc` to allow for other randomizer-dependent sections to be initialized after that. Required a little refactoring to maintain intro cutscene skip when starting a randomizer file. * Revert section index return and randomizer init changes. Will need to wait on yet more changes to main. * Fixed check tracker initialization (shouldn't be tied to window initialization), restored saving/loading functionality. * Removed `CheckTracker::Init` and put SaveManager calls in `CheckTrackerWindow::InitElement`. Also a bit of cleanup from transition back to save file use. * Fixed tracker displaying check categories while file not loaded. * Fix Darunia's Joy check not marking in vanilla. * Fix autosave not triggering change from collected to saved in tracker data. * Changed default colors for scummed and collected display. * Merge upgrade code cleanup. * Add `OnTransitionEnd` calls to sandstorm transitions both to and from Wasteland. Also improved `gSaveContext.lastScene` assignment for both transition types. Allowed a bit of cleanup in `GetCheckArea`. * Added `StateButton`, a button like `ArrowButton` but that allows text instead of arrow icons. Apparently the changes from ArrowButton to StateButton happened in a previous commit... * Changed section name to `trackerDataCheck` to force SoH to load it after the randomizer section, as it required some randoSettings to be loaded first, and nothing else I tried to make the randomizer section load before it worked. This hacks a solution to checks not displaying on fast file load to a specific slot. F*** you, SaveManager, and f*** you too, JSON. * Forgot to change the section string for loading with the name change. * Fix check ordering for checks that trigger the autosave. * Adds option to remove right-side shop items (slots 1-4) from the tracker list. Enabled by default. * Fix default state of Hide Shop Right Checks checkbox. * Fixes grotto and great fairy scrolling and checks. Fixes array overflow from `checkTrackerData` which was creating the issue trying to load the base and randomizer sections first, among other things. That also fixed the massive file loads that were being exhibited in debug mode. * Fix shooting galleries being set as collected again when being played a second time after getting the checks. * Fix Bazaar autoscroll. * Add Saria's Song to `GetCheckFromActor` and removed some limitations from the messageCloseCheck function to make that check track properly. * Fix Song from Impa check. Implemented prevention for multiple "collections" of great fairies, just in case getting the health refill would trigger it with the previous setup. * Fix ice traps on GS tokens not triggering OnItemReceive. * Complete fix for ice trap collection from GS. Add autoscroll when clicking "Expand All". * Add `OnShopSlotChange` with cursorSlot and basePrice parameters. * Fixed include in en_ossan for shop slot hook. Added registration for `OnShopSlotChange` in the tracker, storing the price in a new `price` field in `CheckTrackerData`. Added "seen" functionality to shop checks. Displays the model item name upon first entering a shop, adding the price and switching to trickName (if it's an ice trap) upon navigating to the slot in buy mode, triggered by an invisible "identified" status that mirrors "seen" in every other way. Added tooltips to most options for check tracker color picking to describe what each status actually means. * `std::format` pls * So apparently std::format just decided to break with the latest merge from develop, but fmt::format exists and works? * Removed the last vestiges of `locationsSkipped`. Other general code and formatting cleanups. Moved `IsGameRunning` to `OTRGlobals` so the item tracker could also access it. Used preceding to "fix" item and bottle display in the item tracker on startup. * Some more code cleanup. Removed "Recheck Area" button and relevant code. Backported changes to Anchor branch applicable for single-player, including making a checkAreas vector and structuring the frame by frame checks around that. Also includes fix for Silver Gauntlets and Mirror Shield check collection crash associated with those changes. Fixed Kakariko Bazaar "seen" updates. Fixed tracker window not showing on initial load like it should. * Forgot 1 formatting fix. * Removed conditions for showing Song from Impa (isn't junk under certain conditions, so should show all the time). * Fix vanilla checks, add Zelda's Letter and Malon's Egg to manual check collection. Fix autoscroll while in child stealth section. * Fix crash in Happy Mask Shop in OnSlotChange (referenced non-existent shop id in a tracker-specific enum). * General code cleanup. * Missed one reversion. * One more. * Fix column alignment in `randomizer_check_objects`. * Fix file encoding on `randomizer_check_tracker`. Again. * Fix indentation for `actualItemtrackerItemMap`. Also removed unnecessary parts of the map. * Rename `HasEqItem` to `HasEquipment`. * Slightly better indentation for `actualItemTrackerItemMap`. * Add magic bean salesman to vanilla check tracking, and genericized deku shield to trigger KF shop item 3 wherever you get the shield. Renamed `vanillaCheck` to `vanillaHundoCheck` to (supposedly) clarify the meaning of the usage. * One more rename to `vanillaCompletion` to avoid possible confusion with 100% speedrun conditions. * give me a break XD Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * Changes suggested by briaguya (rename `RandomizerCheckShow` to `Status`, unused code, newline formatting) * Remove unused `itemNames` table. * Remove `IsGameRunning` in favor of `GameInteractor::IsSaveLoaded`. * Restore anti-spoiler functionality for dungeons with dungeon maps. * Review cleanup. * Fix prices not showing for Kak bazaar items. --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com>
2023-10-04 11:03:36 -04:00
extraColor = CVarGetColor("gCheckTrackerUncheckedExtraColor", Color_Unchecked_Extra_Default);
Randomizer Auto Location tracker (#1942) * Initial Auto-Location Tracking * Updates styling for checked items in Check Tracker * Fixes crashing issues with Check Tracker rendering * Auto scroll Check Tracker windows to current area * Checks Tracker only shows checked locations once in game * Fixes issue where Check Tracker would auto-scroll to wrong location when entering a grotto * Fixes gerudo fortress checks showing in tracker when settings have them removed * InfTable Check Location Fixes: Lost Dog Richard, Rolling Gorons, HBA 1000, Thawed Zora * Fixes most Event Chk Inf Checks on Check Tracker, and Frogs * Check Tracker - Song from Malon now works * Check Tracker - Fixes Claim Check check not tracking - Fixes spoiler for Claim Check check when getting Biggoron's Sword - Fixes LACS being spoiled and not tracking * Check Tracker - Fixes #2 for Skull Mask and Mask of Truth checks * Check Tracker - Adds support for merchants - Fixes #7 for Bomchu Salesman - Fixes #12 for Medigoron * Check Tracker - Fixes #8 for Song from Saria * Check Tracker - Fixes #9 for Adult Shooting Gallery * Check Tracker - Fixes #10 for Composer Grave * Check Tracker - Fixes #14 for Song from Ocarina of Time * Check Tracker - Fixes #16 for Shooting the Sun * Check Tracker - Fixes #19 for Darunia's Joy * Save Editor - Adds missing label for Treasure Chest Game * Check Tracker - Fixes Great Faries checks * Check Tracker - Fixes Sheik at Temple * Check Tracker - Fixes Great Fairy auto-scroll to wrong location * Check Tracker - Updates blue warp checks - Fixes Bongo Bongo and Twinrova checks * Check Tracker - Fixes Dampe's Gravedigging Tour * Check Tracker - Fixes Prescription to King Zora * Check Tracker - Fixes Bazaar showing under wrong area on tracker between adult/child * Check Tracker - Fixes scroll for Hyrule Market and Bazaar * Check Tracker - Fixes giving Adult Trade Items shown on tracker: Broken Sword, Saw, Cojiro, Eyeball Froge, and Eyedrops * Cleans up item_location * Check Tracker - Item List - Fixes item list not updating when changing seeds/options - Separates item exclusion list from item check list - Clean up comments * Check Tracker - Adds Skip functionality to buttons * Check Tracker - Refactors adult trade items to RandomizerInf * Check Tracker - Fixes an issue where any time an item is removed the tracker would cause an application crash * Check Tracker - Item names are now dependent on file language * Check Tracker - Fixes Gerudo Card check not showing in Fast setting * Reorders headers to (hopefully) avoid CI build conflicts on linux/consoles * Explicitly defines vector header in randomizer.h to fix compile errors * Complete Refactor of Check Tracker ImGui * Adds missing check tracker files to CMakeLists * Reverts the Item_location whitespace cleanup from ad10807c * Check Tracker - Loading Fixes - Fixes a bug where loading a save file a second time would add all the checks again - Fixes a bug where the check tracker would not render at all until in a save file * Check Tracker - Fixes a bug where checks would sometimes fail to load * Check Tracker - Fixes duplicated checks when using Only on Pause or Only on Combo * Check Tracker - Works around issue where single characters don't show in EnhancementCombobox, and fixes a label for combo buttons held option * Check Tracker - Applies all Check Tracker changes to Item Location * Check Tracker - Updated Check List - Adds Link's pocket, either in KF or HM depending on starting age - Supports Scrubs and Merchants - Uses enums instead of magic numbers - Updates DC Scrub Short Names for MQ * Check Tracker - Adds a performance mode option * Check Tracker - List Fixes (requires new rando generation) - Fixes Frogs Rupees always visible - Fixes Kokiri Sword Chest not showing - Fixes Weird Egg not showing * Check Tracker - MQ List basic support * Check Tracker - MQ/Vanilla anti-spoilers * Check Tracker - Collecting a compass now spoils the area * Check Tracker - Basic Vanilla Support and fixes - Vanilla items show in check tracker, even if many won't auto check - Fixes an issue with Gerudo Fortress Keys - Refactors IsVisibleInCheckTracker to randomizer_check_tracjer * Check Tracker - Fixes merge conflict from 08a487f35e1d760ab9e69b932edbe4da6bcd9edb * Check Tracker - Fixes tracker loading as Floating when default value is set to Windowed * Randomizer Location Exclusion List - Adds Scrubs, Merchants, Shops. Adult Trade items, MQ Dungeons, and Bean Salesman - Fixes Kokiri Sword Chest, Weird Egg, and Frog Song Rupees from misbehaving - Updates Gerudo Fortress logic to be dependent on Open/Fast/Normal Fortress - Removes Invalid Check - Adds RO Enum for MQ settings - Updates magic values to RO enum * Location Exclusion List - Scrubs that are always randomized now always show on the list * For now, removes some extra code only needed for a Check Tracker. * Randomizer Location Exclusion List - Fixes Eyeball Frog from showing up when Adult Trade Items was off * Location Tracker - Updates Eyedrops to use RandomizerInf instead of Chest * Check Tracker - Fixes a bug where Link's Pocket item wasn't acting as checked for area item count * Check Tracker - Fixes a bug where Locations would incorrectly say Vanilla due to the first check in the area being a non-MQ check * Check Tracker - Fixes a crash when Check Tracker is docked but not visible * Check Tracker - Fixes areas being spoiled when loading different save files * Check Tracker - Only reset variables if they are initialized * Check Tracker - Cleans up old comments, unused variables, methods, and macros, adds language TODOs, * Check Tracker - Readds rainbow UI elements after Cosmetics Editor refactor * Check Tracker - Removal of flag lookup that was refactored, no longer needed header, and some trivial whitespace fixes. * Check Tracker - Refactors Index to Bitmask code to a macro * Check Tracker - Changes ordering from alphabetical to RandomizerCheck ordering * Check Tracker - Wraps everything in a namespace to avoid global variable usage * Check Tracker - Explicitly defines for-loop scope * Check Tracker - refactors dungeon lookup from static array to function * Fixes a bug when using EnhancementColor with alpha * Check Tracker - Refactors all colour to use direct conversions * Check Tracker - refactors settings loading and check visibility for readability * Check Tracker - Fixes a bug where the wrong label showed on the Check Tracker BG Color * UIWidgets - Adds Alpha bar to EnhancementColor when using alpha parameter
2022-12-10 22:39:23 -05:00
}
//Main Text
txt = rcObj.rcShortName;
if (lastLocationChecked == rcObj.rc) {
Randomizer Auto Location tracker (#1942) * Initial Auto-Location Tracking * Updates styling for checked items in Check Tracker * Fixes crashing issues with Check Tracker rendering * Auto scroll Check Tracker windows to current area * Checks Tracker only shows checked locations once in game * Fixes issue where Check Tracker would auto-scroll to wrong location when entering a grotto * Fixes gerudo fortress checks showing in tracker when settings have them removed * InfTable Check Location Fixes: Lost Dog Richard, Rolling Gorons, HBA 1000, Thawed Zora * Fixes most Event Chk Inf Checks on Check Tracker, and Frogs * Check Tracker - Song from Malon now works * Check Tracker - Fixes Claim Check check not tracking - Fixes spoiler for Claim Check check when getting Biggoron's Sword - Fixes LACS being spoiled and not tracking * Check Tracker - Fixes #2 for Skull Mask and Mask of Truth checks * Check Tracker - Adds support for merchants - Fixes #7 for Bomchu Salesman - Fixes #12 for Medigoron * Check Tracker - Fixes #8 for Song from Saria * Check Tracker - Fixes #9 for Adult Shooting Gallery * Check Tracker - Fixes #10 for Composer Grave * Check Tracker - Fixes #14 for Song from Ocarina of Time * Check Tracker - Fixes #16 for Shooting the Sun * Check Tracker - Fixes #19 for Darunia's Joy * Save Editor - Adds missing label for Treasure Chest Game * Check Tracker - Fixes Great Faries checks * Check Tracker - Fixes Sheik at Temple * Check Tracker - Fixes Great Fairy auto-scroll to wrong location * Check Tracker - Updates blue warp checks - Fixes Bongo Bongo and Twinrova checks * Check Tracker - Fixes Dampe's Gravedigging Tour * Check Tracker - Fixes Prescription to King Zora * Check Tracker - Fixes Bazaar showing under wrong area on tracker between adult/child * Check Tracker - Fixes scroll for Hyrule Market and Bazaar * Check Tracker - Fixes giving Adult Trade Items shown on tracker: Broken Sword, Saw, Cojiro, Eyeball Froge, and Eyedrops * Cleans up item_location * Check Tracker - Item List - Fixes item list not updating when changing seeds/options - Separates item exclusion list from item check list - Clean up comments * Check Tracker - Adds Skip functionality to buttons * Check Tracker - Refactors adult trade items to RandomizerInf * Check Tracker - Fixes an issue where any time an item is removed the tracker would cause an application crash * Check Tracker - Item names are now dependent on file language * Check Tracker - Fixes Gerudo Card check not showing in Fast setting * Reorders headers to (hopefully) avoid CI build conflicts on linux/consoles * Explicitly defines vector header in randomizer.h to fix compile errors * Complete Refactor of Check Tracker ImGui * Adds missing check tracker files to CMakeLists * Reverts the Item_location whitespace cleanup from ad10807c * Check Tracker - Loading Fixes - Fixes a bug where loading a save file a second time would add all the checks again - Fixes a bug where the check tracker would not render at all until in a save file * Check Tracker - Fixes a bug where checks would sometimes fail to load * Check Tracker - Fixes duplicated checks when using Only on Pause or Only on Combo * Check Tracker - Works around issue where single characters don't show in EnhancementCombobox, and fixes a label for combo buttons held option * Check Tracker - Applies all Check Tracker changes to Item Location * Check Tracker - Updated Check List - Adds Link's pocket, either in KF or HM depending on starting age - Supports Scrubs and Merchants - Uses enums instead of magic numbers - Updates DC Scrub Short Names for MQ * Check Tracker - Adds a performance mode option * Check Tracker - List Fixes (requires new rando generation) - Fixes Frogs Rupees always visible - Fixes Kokiri Sword Chest not showing - Fixes Weird Egg not showing * Check Tracker - MQ List basic support * Check Tracker - MQ/Vanilla anti-spoilers * Check Tracker - Collecting a compass now spoils the area * Check Tracker - Basic Vanilla Support and fixes - Vanilla items show in check tracker, even if many won't auto check - Fixes an issue with Gerudo Fortress Keys - Refactors IsVisibleInCheckTracker to randomizer_check_tracjer * Check Tracker - Fixes merge conflict from 08a487f35e1d760ab9e69b932edbe4da6bcd9edb * Check Tracker - Fixes tracker loading as Floating when default value is set to Windowed * Randomizer Location Exclusion List - Adds Scrubs, Merchants, Shops. Adult Trade items, MQ Dungeons, and Bean Salesman - Fixes Kokiri Sword Chest, Weird Egg, and Frog Song Rupees from misbehaving - Updates Gerudo Fortress logic to be dependent on Open/Fast/Normal Fortress - Removes Invalid Check - Adds RO Enum for MQ settings - Updates magic values to RO enum * Location Exclusion List - Scrubs that are always randomized now always show on the list * For now, removes some extra code only needed for a Check Tracker. * Randomizer Location Exclusion List - Fixes Eyeball Frog from showing up when Adult Trade Items was off * Location Tracker - Updates Eyedrops to use RandomizerInf instead of Chest * Check Tracker - Fixes a bug where Link's Pocket item wasn't acting as checked for area item count * Check Tracker - Fixes a bug where Locations would incorrectly say Vanilla due to the first check in the area being a non-MQ check * Check Tracker - Fixes a crash when Check Tracker is docked but not visible * Check Tracker - Fixes areas being spoiled when loading different save files * Check Tracker - Only reset variables if they are initialized * Check Tracker - Cleans up old comments, unused variables, methods, and macros, adds language TODOs, * Check Tracker - Readds rainbow UI elements after Cosmetics Editor refactor * Check Tracker - Removal of flag lookup that was refactored, no longer needed header, and some trivial whitespace fixes. * Check Tracker - Refactors Index to Bitmask code to a macro * Check Tracker - Changes ordering from alphabetical to RandomizerCheck ordering * Check Tracker - Wraps everything in a namespace to avoid global variable usage * Check Tracker - Explicitly defines for-loop scope * Check Tracker - refactors dungeon lookup from static array to function * Fixes a bug when using EnhancementColor with alpha * Check Tracker - Refactors all colour to use direct conversions * Check Tracker - refactors settings loading and check visibility for readability * Check Tracker - Fixes a bug where the wrong label showed on the Check Tracker BG Color * UIWidgets - Adds Alpha bar to EnhancementColor when using alpha parameter
2022-12-10 22:39:23 -05:00
txt = "* " + txt;
}
Randomizer Auto Location tracker (#1942) * Initial Auto-Location Tracking * Updates styling for checked items in Check Tracker * Fixes crashing issues with Check Tracker rendering * Auto scroll Check Tracker windows to current area * Checks Tracker only shows checked locations once in game * Fixes issue where Check Tracker would auto-scroll to wrong location when entering a grotto * Fixes gerudo fortress checks showing in tracker when settings have them removed * InfTable Check Location Fixes: Lost Dog Richard, Rolling Gorons, HBA 1000, Thawed Zora * Fixes most Event Chk Inf Checks on Check Tracker, and Frogs * Check Tracker - Song from Malon now works * Check Tracker - Fixes Claim Check check not tracking - Fixes spoiler for Claim Check check when getting Biggoron's Sword - Fixes LACS being spoiled and not tracking * Check Tracker - Fixes #2 for Skull Mask and Mask of Truth checks * Check Tracker - Adds support for merchants - Fixes #7 for Bomchu Salesman - Fixes #12 for Medigoron * Check Tracker - Fixes #8 for Song from Saria * Check Tracker - Fixes #9 for Adult Shooting Gallery * Check Tracker - Fixes #10 for Composer Grave * Check Tracker - Fixes #14 for Song from Ocarina of Time * Check Tracker - Fixes #16 for Shooting the Sun * Check Tracker - Fixes #19 for Darunia's Joy * Save Editor - Adds missing label for Treasure Chest Game * Check Tracker - Fixes Great Faries checks * Check Tracker - Fixes Sheik at Temple * Check Tracker - Fixes Great Fairy auto-scroll to wrong location * Check Tracker - Updates blue warp checks - Fixes Bongo Bongo and Twinrova checks * Check Tracker - Fixes Dampe's Gravedigging Tour * Check Tracker - Fixes Prescription to King Zora * Check Tracker - Fixes Bazaar showing under wrong area on tracker between adult/child * Check Tracker - Fixes scroll for Hyrule Market and Bazaar * Check Tracker - Fixes giving Adult Trade Items shown on tracker: Broken Sword, Saw, Cojiro, Eyeball Froge, and Eyedrops * Cleans up item_location * Check Tracker - Item List - Fixes item list not updating when changing seeds/options - Separates item exclusion list from item check list - Clean up comments * Check Tracker - Adds Skip functionality to buttons * Check Tracker - Refactors adult trade items to RandomizerInf * Check Tracker - Fixes an issue where any time an item is removed the tracker would cause an application crash * Check Tracker - Item names are now dependent on file language * Check Tracker - Fixes Gerudo Card check not showing in Fast setting * Reorders headers to (hopefully) avoid CI build conflicts on linux/consoles * Explicitly defines vector header in randomizer.h to fix compile errors * Complete Refactor of Check Tracker ImGui * Adds missing check tracker files to CMakeLists * Reverts the Item_location whitespace cleanup from ad10807c * Check Tracker - Loading Fixes - Fixes a bug where loading a save file a second time would add all the checks again - Fixes a bug where the check tracker would not render at all until in a save file * Check Tracker - Fixes a bug where checks would sometimes fail to load * Check Tracker - Fixes duplicated checks when using Only on Pause or Only on Combo * Check Tracker - Works around issue where single characters don't show in EnhancementCombobox, and fixes a label for combo buttons held option * Check Tracker - Applies all Check Tracker changes to Item Location * Check Tracker - Updated Check List - Adds Link's pocket, either in KF or HM depending on starting age - Supports Scrubs and Merchants - Uses enums instead of magic numbers - Updates DC Scrub Short Names for MQ * Check Tracker - Adds a performance mode option * Check Tracker - List Fixes (requires new rando generation) - Fixes Frogs Rupees always visible - Fixes Kokiri Sword Chest not showing - Fixes Weird Egg not showing * Check Tracker - MQ List basic support * Check Tracker - MQ/Vanilla anti-spoilers * Check Tracker - Collecting a compass now spoils the area * Check Tracker - Basic Vanilla Support and fixes - Vanilla items show in check tracker, even if many won't auto check - Fixes an issue with Gerudo Fortress Keys - Refactors IsVisibleInCheckTracker to randomizer_check_tracjer * Check Tracker - Fixes merge conflict from 08a487f35e1d760ab9e69b932edbe4da6bcd9edb * Check Tracker - Fixes tracker loading as Floating when default value is set to Windowed * Randomizer Location Exclusion List - Adds Scrubs, Merchants, Shops. Adult Trade items, MQ Dungeons, and Bean Salesman - Fixes Kokiri Sword Chest, Weird Egg, and Frog Song Rupees from misbehaving - Updates Gerudo Fortress logic to be dependent on Open/Fast/Normal Fortress - Removes Invalid Check - Adds RO Enum for MQ settings - Updates magic values to RO enum * Location Exclusion List - Scrubs that are always randomized now always show on the list * For now, removes some extra code only needed for a Check Tracker. * Randomizer Location Exclusion List - Fixes Eyeball Frog from showing up when Adult Trade Items was off * Location Tracker - Updates Eyedrops to use RandomizerInf instead of Chest * Check Tracker - Fixes a bug where Link's Pocket item wasn't acting as checked for area item count * Check Tracker - Fixes a bug where Locations would incorrectly say Vanilla due to the first check in the area being a non-MQ check * Check Tracker - Fixes a crash when Check Tracker is docked but not visible * Check Tracker - Fixes areas being spoiled when loading different save files * Check Tracker - Only reset variables if they are initialized * Check Tracker - Cleans up old comments, unused variables, methods, and macros, adds language TODOs, * Check Tracker - Readds rainbow UI elements after Cosmetics Editor refactor * Check Tracker - Removal of flag lookup that was refactored, no longer needed header, and some trivial whitespace fixes. * Check Tracker - Refactors Index to Bitmask code to a macro * Check Tracker - Changes ordering from alphabetical to RandomizerCheck ordering * Check Tracker - Wraps everything in a namespace to avoid global variable usage * Check Tracker - Explicitly defines for-loop scope * Check Tracker - refactors dungeon lookup from static array to function * Fixes a bug when using EnhancementColor with alpha * Check Tracker - Refactors all colour to use direct conversions * Check Tracker - refactors settings loading and check visibility for readability * Check Tracker - Fixes a bug where the wrong label showed on the Check Tracker BG Color * UIWidgets - Adds Alpha bar to EnhancementColor when using alpha parameter
2022-12-10 22:39:23 -05:00
Check Tracker Update (#2668) * Initial commit. What works so far: Data file loads, saves, deletes, and is created properly. - Need to run `HasItemBeenCollected` when creating in case of mid-seed regen. Organized checks into maps set by area. Areas show in tracker. - Checks pulled from checkObjectsByArea are not currently listed. - Areas are being assumed completed and hidden at the start. * Checks now populate. Still not counting area totals properly. * Don't track RC_LINKS_POCKET in the data file, and instead manually add it in every time a save is load. rcObjects doesn't contain Link's Pocket location (duh). * Moved ItemReceive hook to randomizer_check_tracker.cpp. Skipped items are properly sorted and formatted. Saved items contribute to an area's gotten/skipped checks on load. Changed skipped items default main color to gray. General code cleanup. * Skipped checks now contribute to area totals for area completion logic. * Mid-menu rework transfer. * Started check lookup on item receive. Tried to enable scum checking on save. * Fixed scum check on save. * More code cleanup, which revealed some issues with loading and saving. Loading now works 100%, but entries in checkTrackerData are disappearing in code somewhere, causing issues with later checks. Scummed color now displays properly. Collected but unsaved displays properly. Unchecked, Skipped, Seen and Scummed checks all have arrows for skipping/unskipping. Counts a little messed up, probably double adding skips. * Fixed item counts being off across resets. Restarts were fine. * Beginning of rework for individual check updates. Adds `Actor lastCheck` to PlayState to allow assigning of last actor to give an item. This allows precise tracking of GS, freestanding PoH, etc. Works for chests too. Currently does not work for shops, unknown for normal NPC gives. Doesn't track last gives for non-checks, like drops from grass, pots, crates, etc. * Actor-based checks fully fleshed out, but can't help with sale-based checks. Implemented `pendingSaleCheck` to back out of an RC check cycle if `gSaveContext->pendingSale` is not NONE when `OnItemReceive` is called, processed through `OnSaleEnd`. This should be the final change necessary to streamline the checks. * Temporary hook to message box close to tie in trackers for non-gs/chest actors that aren't added to `GetCheckFromActor`. This triggers a 2-frame countdown to check with `HasItemBeenCollected` since half of the methods in there aren't updated until after a text box closes. Added scene tracking to get last scene so that checks in scenes that span several overworld areas could be tied to their areas properly. Modified tracker data creation to apply Link's Pocket and Song from Impa conditionally based on randomizer settings instead of just being assumed to be done. May need modification for checking click and drag spoiler loading. Removed the scene equivalence check from CheckChecks so that an entire area is checked each time to avoid issues with, e.g., leaving a shop before a pending sale finishes. * Changed check data creation to use RSKs from gRandomizer to account for settings loaded from drag and drop spoilers. * Beginning of tracker code organization. Changed check color defaults. * Reverted moving tracker colors to header. Some individual check fixes. * Missed something from previous merge? * Removed last remnant of removed performance mode. * Better handle checking when skullsanity is off. * Song checks sceneIDs don't match the scenes they're actually in for some reason. Removed that check. * SaleEnd checks don't need the GetItemEntry parameter. Also set a flag that should prevent the check tracker from running during vanilla saves should that not be resolved by the time it's merged. * Attempting to have only the relevant checks added to the tracker data, as well as showing vanilla checks for non-rando saves. Not working yet (everything is displayed in vanilla). * Added vanilla check tracker population via `vanillaCheck` bool in `RandomizerCheckObject`. This is also added to `IsVisibleInImGui` to handle file loading and saving to eliminate checks that aren't part of vanilla or the rando seed. Implemented deleted tracker data file recreation. Added some extra item name text checks. Songs are still... tricky, so they stay blank. Utilize local copies of the randomizer check objects that are applicable for performance purposes. Fixed vanilla item-giving cutscene crashes when triggered mid-transition. * Apparently not all toolchains can handle macro instantiation without all parameters, like VS can. * Fixed scummed detail color not showing properly on tracker. * Fixed dungeon area totals and GS checks not functioning properly. * Major revamp of checking code. Doesn't rely on `GetCheckFromActor` at all anymore, but instead simply sets a flag to evaluate a number of checks in an area every frame until the check that was gotten is identified. With the new setup, it's much less hardware intensive, and at 60fps 6 checks per frame shows no noticeable effect on framerate. I can envision needing to add a collectedCount in order to account for times when two checks are gotten one right after the other. Changed area scroll to happen from `OnTransitionEnd`, and allow for scrolling in bazaar (was disabled previously because it would jump back and forth between Kak and Market while you were in one). Also setup area check order updating by area instead of all at the same time. * Fixed shooting gallery not reporting proper area. Prevent checks from actually happening if area is RCAREA_INVALID, now that all areas are reporting something if they have checks. Fixed `GetCheckArea()` not updating checks for standard scenes. Lots of vanilla tracking updates, mainly manual checks for gems, medallions and songs, since the often don't have proper scenes in the data. Prevent vanilla from triggering check loops if junk items are collected. Fixed sorting based on saved vs collected. Prevent item name display for vanilla runs. Change coloring of checks so the check name reflects status in vanilla runs. * Fixed "Recheck Area" button erroneously adding to an area's check totals? * Fix DMC vanilla checks. * Fix check tracker data recreation on data file loss. Removed redundant file exists check from SaveTrackerDataHook, as it doesn't matter if it exists or not at that point. Limited check loops to 3 to avoid infinite check loops on non-check/junk item pickup. Added more checks to disable tracker operations if a save is not running. Changed check ordering to put boss reward and heart container checks at the end of whatever RCSHOW group they belong to. * Fixed IsRunning calculation. Further improving vanilla checking. Starting framework for checking medallions, stones, and songs on data file recreation. Fixed medallion check collection. Added GIFT_FROM_SAGES to check list for vanilla file for tracking light medallion. Added check loop limitation to prevent infinite checking after picking up junk item from the ground. * Finished vanilla file recreation and recheck (songs and dungeon rewards all check properly now). This includes deku shield with KF shop item 3. Finished Gift from Raoru light medallion tracking for vanilla. Commented all CheckByScene functionality for now. * Fixed new save data file creation. Disabled entrance area calculation for now, as it only tracks the previous entrance for some reason. Fixed area detection for ToT checks. * GetCheckArea() now utilizes EntranceData almost exclusively, via either `gSaveContext.entranceIndex` or the entrance tracker's `currentGrottoId` in the case of grottos. This also means that EVERYTHING CAN AUTOSCROLL NOW. Entrance shuffles are now much easier to track. Autoscroll is now also triggered on save, just in case someone isn't autosaving and has a lot of checks that get converted to saved. * Fixed missing GS check in LW. * Added area scroll on toggling Show Hidden Items. May configure differently later. Fixed area detection for entrances in Gerudo Fortress/Valley and Collossus. Haunted wasteland doesn't autoscroll due to a bug in `OnTransitionEnd` hook, but checks still evaluate properly there. Rely on scene-based area detection if scene is a main overworld or dungeon scene. * Fixed grotto detection when shuffle is off. * Small code cleanup. Fixed Colossus hand chest checks. * Missing lus bump from merge conflict resolution * Fixed Colossus Grotto making `GetCheckArea` return Wasteland. * Improved OnItemReceive processing for non-token GS checks, since they can sometimes take long enough for the checking process to time out before the item is registered as received. * First attempt at thread safety for tracker data file writing. Seems to work, but might need more testing. * Fixed Recheck Area not unskipping items that register as saved. Improved delayed saving with autosaving, as the autosave triggered quite often before the tracker data save, making things not properly register as saved. * merge cleanup * Converted check tracker data to the sectional saves, adding `CheckTrackerData` to `SaveContext`. Implemented section ID returning and fullSave boolean passing to section functions from my PR temporarily for it to work properly. Moved `RandomizerCheckTrackerData` enum to `randomizerTypes.h` to accommodate that. Changed `Randomizer_SaveInit` to a `SaveManager::InitFunc` to allow for other randomizer-dependent sections to be initialized after that. Required a little refactoring to maintain intro cutscene skip when starting a randomizer file. * Revert section index return and randomizer init changes. Will need to wait on yet more changes to main. * Fixed check tracker initialization (shouldn't be tied to window initialization), restored saving/loading functionality. * Removed `CheckTracker::Init` and put SaveManager calls in `CheckTrackerWindow::InitElement`. Also a bit of cleanup from transition back to save file use. * Fixed tracker displaying check categories while file not loaded. * Fix Darunia's Joy check not marking in vanilla. * Fix autosave not triggering change from collected to saved in tracker data. * Changed default colors for scummed and collected display. * Merge upgrade code cleanup. * Add `OnTransitionEnd` calls to sandstorm transitions both to and from Wasteland. Also improved `gSaveContext.lastScene` assignment for both transition types. Allowed a bit of cleanup in `GetCheckArea`. * Added `StateButton`, a button like `ArrowButton` but that allows text instead of arrow icons. Apparently the changes from ArrowButton to StateButton happened in a previous commit... * Changed section name to `trackerDataCheck` to force SoH to load it after the randomizer section, as it required some randoSettings to be loaded first, and nothing else I tried to make the randomizer section load before it worked. This hacks a solution to checks not displaying on fast file load to a specific slot. F*** you, SaveManager, and f*** you too, JSON. * Forgot to change the section string for loading with the name change. * Fix check ordering for checks that trigger the autosave. * Adds option to remove right-side shop items (slots 1-4) from the tracker list. Enabled by default. * Fix default state of Hide Shop Right Checks checkbox. * Fixes grotto and great fairy scrolling and checks. Fixes array overflow from `checkTrackerData` which was creating the issue trying to load the base and randomizer sections first, among other things. That also fixed the massive file loads that were being exhibited in debug mode. * Fix shooting galleries being set as collected again when being played a second time after getting the checks. * Fix Bazaar autoscroll. * Add Saria's Song to `GetCheckFromActor` and removed some limitations from the messageCloseCheck function to make that check track properly. * Fix Song from Impa check. Implemented prevention for multiple "collections" of great fairies, just in case getting the health refill would trigger it with the previous setup. * Fix ice traps on GS tokens not triggering OnItemReceive. * Complete fix for ice trap collection from GS. Add autoscroll when clicking "Expand All". * Add `OnShopSlotChange` with cursorSlot and basePrice parameters. * Fixed include in en_ossan for shop slot hook. Added registration for `OnShopSlotChange` in the tracker, storing the price in a new `price` field in `CheckTrackerData`. Added "seen" functionality to shop checks. Displays the model item name upon first entering a shop, adding the price and switching to trickName (if it's an ice trap) upon navigating to the slot in buy mode, triggered by an invisible "identified" status that mirrors "seen" in every other way. Added tooltips to most options for check tracker color picking to describe what each status actually means. * `std::format` pls * So apparently std::format just decided to break with the latest merge from develop, but fmt::format exists and works? * Removed the last vestiges of `locationsSkipped`. Other general code and formatting cleanups. Moved `IsGameRunning` to `OTRGlobals` so the item tracker could also access it. Used preceding to "fix" item and bottle display in the item tracker on startup. * Some more code cleanup. Removed "Recheck Area" button and relevant code. Backported changes to Anchor branch applicable for single-player, including making a checkAreas vector and structuring the frame by frame checks around that. Also includes fix for Silver Gauntlets and Mirror Shield check collection crash associated with those changes. Fixed Kakariko Bazaar "seen" updates. Fixed tracker window not showing on initial load like it should. * Forgot 1 formatting fix. * Removed conditions for showing Song from Impa (isn't junk under certain conditions, so should show all the time). * Fix vanilla checks, add Zelda's Letter and Malon's Egg to manual check collection. Fix autoscroll while in child stealth section. * Fix crash in Happy Mask Shop in OnSlotChange (referenced non-existent shop id in a tracker-specific enum). * General code cleanup. * Missed one reversion. * One more. * Fix column alignment in `randomizer_check_objects`. * Fix file encoding on `randomizer_check_tracker`. Again. * Fix indentation for `actualItemtrackerItemMap`. Also removed unnecessary parts of the map. * Rename `HasEqItem` to `HasEquipment`. * Slightly better indentation for `actualItemTrackerItemMap`. * Add magic bean salesman to vanilla check tracking, and genericized deku shield to trigger KF shop item 3 wherever you get the shield. Renamed `vanillaCheck` to `vanillaHundoCheck` to (supposedly) clarify the meaning of the usage. * One more rename to `vanillaCompletion` to avoid possible confusion with 100% speedrun conditions. * give me a break XD Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * Changes suggested by briaguya (rename `RandomizerCheckShow` to `Status`, unused code, newline formatting) * Remove unused `itemNames` table. * Remove `IsGameRunning` in favor of `GameInteractor::IsSaveLoaded`. * Restore anti-spoiler functionality for dungeons with dungeon maps. * Review cleanup. * Fix prices not showing for Kak bazaar items. --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com>
2023-10-04 11:03:36 -04:00
// Draw button - for Skipped/Seen/Scummed/Unchecked only
if (status == RCSHOW_UNCHECKED || status == RCSHOW_SEEN || status == RCSHOW_IDENTIFIED || status == RCSHOW_SCUMMED || skipped) {
if (UIWidgets::StateButton(std::to_string(rcObj.rc).c_str(), skipped ? ICON_FA_PLUS : ICON_FA_TIMES)) {
2023-02-14 20:50:59 -05:00
if (skipped) {
Check Tracker Update (#2668) * Initial commit. What works so far: Data file loads, saves, deletes, and is created properly. - Need to run `HasItemBeenCollected` when creating in case of mid-seed regen. Organized checks into maps set by area. Areas show in tracker. - Checks pulled from checkObjectsByArea are not currently listed. - Areas are being assumed completed and hidden at the start. * Checks now populate. Still not counting area totals properly. * Don't track RC_LINKS_POCKET in the data file, and instead manually add it in every time a save is load. rcObjects doesn't contain Link's Pocket location (duh). * Moved ItemReceive hook to randomizer_check_tracker.cpp. Skipped items are properly sorted and formatted. Saved items contribute to an area's gotten/skipped checks on load. Changed skipped items default main color to gray. General code cleanup. * Skipped checks now contribute to area totals for area completion logic. * Mid-menu rework transfer. * Started check lookup on item receive. Tried to enable scum checking on save. * Fixed scum check on save. * More code cleanup, which revealed some issues with loading and saving. Loading now works 100%, but entries in checkTrackerData are disappearing in code somewhere, causing issues with later checks. Scummed color now displays properly. Collected but unsaved displays properly. Unchecked, Skipped, Seen and Scummed checks all have arrows for skipping/unskipping. Counts a little messed up, probably double adding skips. * Fixed item counts being off across resets. Restarts were fine. * Beginning of rework for individual check updates. Adds `Actor lastCheck` to PlayState to allow assigning of last actor to give an item. This allows precise tracking of GS, freestanding PoH, etc. Works for chests too. Currently does not work for shops, unknown for normal NPC gives. Doesn't track last gives for non-checks, like drops from grass, pots, crates, etc. * Actor-based checks fully fleshed out, but can't help with sale-based checks. Implemented `pendingSaleCheck` to back out of an RC check cycle if `gSaveContext->pendingSale` is not NONE when `OnItemReceive` is called, processed through `OnSaleEnd`. This should be the final change necessary to streamline the checks. * Temporary hook to message box close to tie in trackers for non-gs/chest actors that aren't added to `GetCheckFromActor`. This triggers a 2-frame countdown to check with `HasItemBeenCollected` since half of the methods in there aren't updated until after a text box closes. Added scene tracking to get last scene so that checks in scenes that span several overworld areas could be tied to their areas properly. Modified tracker data creation to apply Link's Pocket and Song from Impa conditionally based on randomizer settings instead of just being assumed to be done. May need modification for checking click and drag spoiler loading. Removed the scene equivalence check from CheckChecks so that an entire area is checked each time to avoid issues with, e.g., leaving a shop before a pending sale finishes. * Changed check data creation to use RSKs from gRandomizer to account for settings loaded from drag and drop spoilers. * Beginning of tracker code organization. Changed check color defaults. * Reverted moving tracker colors to header. Some individual check fixes. * Missed something from previous merge? * Removed last remnant of removed performance mode. * Better handle checking when skullsanity is off. * Song checks sceneIDs don't match the scenes they're actually in for some reason. Removed that check. * SaleEnd checks don't need the GetItemEntry parameter. Also set a flag that should prevent the check tracker from running during vanilla saves should that not be resolved by the time it's merged. * Attempting to have only the relevant checks added to the tracker data, as well as showing vanilla checks for non-rando saves. Not working yet (everything is displayed in vanilla). * Added vanilla check tracker population via `vanillaCheck` bool in `RandomizerCheckObject`. This is also added to `IsVisibleInImGui` to handle file loading and saving to eliminate checks that aren't part of vanilla or the rando seed. Implemented deleted tracker data file recreation. Added some extra item name text checks. Songs are still... tricky, so they stay blank. Utilize local copies of the randomizer check objects that are applicable for performance purposes. Fixed vanilla item-giving cutscene crashes when triggered mid-transition. * Apparently not all toolchains can handle macro instantiation without all parameters, like VS can. * Fixed scummed detail color not showing properly on tracker. * Fixed dungeon area totals and GS checks not functioning properly. * Major revamp of checking code. Doesn't rely on `GetCheckFromActor` at all anymore, but instead simply sets a flag to evaluate a number of checks in an area every frame until the check that was gotten is identified. With the new setup, it's much less hardware intensive, and at 60fps 6 checks per frame shows no noticeable effect on framerate. I can envision needing to add a collectedCount in order to account for times when two checks are gotten one right after the other. Changed area scroll to happen from `OnTransitionEnd`, and allow for scrolling in bazaar (was disabled previously because it would jump back and forth between Kak and Market while you were in one). Also setup area check order updating by area instead of all at the same time. * Fixed shooting gallery not reporting proper area. Prevent checks from actually happening if area is RCAREA_INVALID, now that all areas are reporting something if they have checks. Fixed `GetCheckArea()` not updating checks for standard scenes. Lots of vanilla tracking updates, mainly manual checks for gems, medallions and songs, since the often don't have proper scenes in the data. Prevent vanilla from triggering check loops if junk items are collected. Fixed sorting based on saved vs collected. Prevent item name display for vanilla runs. Change coloring of checks so the check name reflects status in vanilla runs. * Fixed "Recheck Area" button erroneously adding to an area's check totals? * Fix DMC vanilla checks. * Fix check tracker data recreation on data file loss. Removed redundant file exists check from SaveTrackerDataHook, as it doesn't matter if it exists or not at that point. Limited check loops to 3 to avoid infinite check loops on non-check/junk item pickup. Added more checks to disable tracker operations if a save is not running. Changed check ordering to put boss reward and heart container checks at the end of whatever RCSHOW group they belong to. * Fixed IsRunning calculation. Further improving vanilla checking. Starting framework for checking medallions, stones, and songs on data file recreation. Fixed medallion check collection. Added GIFT_FROM_SAGES to check list for vanilla file for tracking light medallion. Added check loop limitation to prevent infinite checking after picking up junk item from the ground. * Finished vanilla file recreation and recheck (songs and dungeon rewards all check properly now). This includes deku shield with KF shop item 3. Finished Gift from Raoru light medallion tracking for vanilla. Commented all CheckByScene functionality for now. * Fixed new save data file creation. Disabled entrance area calculation for now, as it only tracks the previous entrance for some reason. Fixed area detection for ToT checks. * GetCheckArea() now utilizes EntranceData almost exclusively, via either `gSaveContext.entranceIndex` or the entrance tracker's `currentGrottoId` in the case of grottos. This also means that EVERYTHING CAN AUTOSCROLL NOW. Entrance shuffles are now much easier to track. Autoscroll is now also triggered on save, just in case someone isn't autosaving and has a lot of checks that get converted to saved. * Fixed missing GS check in LW. * Added area scroll on toggling Show Hidden Items. May configure differently later. Fixed area detection for entrances in Gerudo Fortress/Valley and Collossus. Haunted wasteland doesn't autoscroll due to a bug in `OnTransitionEnd` hook, but checks still evaluate properly there. Rely on scene-based area detection if scene is a main overworld or dungeon scene. * Fixed grotto detection when shuffle is off. * Small code cleanup. Fixed Colossus hand chest checks. * Missing lus bump from merge conflict resolution * Fixed Colossus Grotto making `GetCheckArea` return Wasteland. * Improved OnItemReceive processing for non-token GS checks, since they can sometimes take long enough for the checking process to time out before the item is registered as received. * First attempt at thread safety for tracker data file writing. Seems to work, but might need more testing. * Fixed Recheck Area not unskipping items that register as saved. Improved delayed saving with autosaving, as the autosave triggered quite often before the tracker data save, making things not properly register as saved. * merge cleanup * Converted check tracker data to the sectional saves, adding `CheckTrackerData` to `SaveContext`. Implemented section ID returning and fullSave boolean passing to section functions from my PR temporarily for it to work properly. Moved `RandomizerCheckTrackerData` enum to `randomizerTypes.h` to accommodate that. Changed `Randomizer_SaveInit` to a `SaveManager::InitFunc` to allow for other randomizer-dependent sections to be initialized after that. Required a little refactoring to maintain intro cutscene skip when starting a randomizer file. * Revert section index return and randomizer init changes. Will need to wait on yet more changes to main. * Fixed check tracker initialization (shouldn't be tied to window initialization), restored saving/loading functionality. * Removed `CheckTracker::Init` and put SaveManager calls in `CheckTrackerWindow::InitElement`. Also a bit of cleanup from transition back to save file use. * Fixed tracker displaying check categories while file not loaded. * Fix Darunia's Joy check not marking in vanilla. * Fix autosave not triggering change from collected to saved in tracker data. * Changed default colors for scummed and collected display. * Merge upgrade code cleanup. * Add `OnTransitionEnd` calls to sandstorm transitions both to and from Wasteland. Also improved `gSaveContext.lastScene` assignment for both transition types. Allowed a bit of cleanup in `GetCheckArea`. * Added `StateButton`, a button like `ArrowButton` but that allows text instead of arrow icons. Apparently the changes from ArrowButton to StateButton happened in a previous commit... * Changed section name to `trackerDataCheck` to force SoH to load it after the randomizer section, as it required some randoSettings to be loaded first, and nothing else I tried to make the randomizer section load before it worked. This hacks a solution to checks not displaying on fast file load to a specific slot. F*** you, SaveManager, and f*** you too, JSON. * Forgot to change the section string for loading with the name change. * Fix check ordering for checks that trigger the autosave. * Adds option to remove right-side shop items (slots 1-4) from the tracker list. Enabled by default. * Fix default state of Hide Shop Right Checks checkbox. * Fixes grotto and great fairy scrolling and checks. Fixes array overflow from `checkTrackerData` which was creating the issue trying to load the base and randomizer sections first, among other things. That also fixed the massive file loads that were being exhibited in debug mode. * Fix shooting galleries being set as collected again when being played a second time after getting the checks. * Fix Bazaar autoscroll. * Add Saria's Song to `GetCheckFromActor` and removed some limitations from the messageCloseCheck function to make that check track properly. * Fix Song from Impa check. Implemented prevention for multiple "collections" of great fairies, just in case getting the health refill would trigger it with the previous setup. * Fix ice traps on GS tokens not triggering OnItemReceive. * Complete fix for ice trap collection from GS. Add autoscroll when clicking "Expand All". * Add `OnShopSlotChange` with cursorSlot and basePrice parameters. * Fixed include in en_ossan for shop slot hook. Added registration for `OnShopSlotChange` in the tracker, storing the price in a new `price` field in `CheckTrackerData`. Added "seen" functionality to shop checks. Displays the model item name upon first entering a shop, adding the price and switching to trickName (if it's an ice trap) upon navigating to the slot in buy mode, triggered by an invisible "identified" status that mirrors "seen" in every other way. Added tooltips to most options for check tracker color picking to describe what each status actually means. * `std::format` pls * So apparently std::format just decided to break with the latest merge from develop, but fmt::format exists and works? * Removed the last vestiges of `locationsSkipped`. Other general code and formatting cleanups. Moved `IsGameRunning` to `OTRGlobals` so the item tracker could also access it. Used preceding to "fix" item and bottle display in the item tracker on startup. * Some more code cleanup. Removed "Recheck Area" button and relevant code. Backported changes to Anchor branch applicable for single-player, including making a checkAreas vector and structuring the frame by frame checks around that. Also includes fix for Silver Gauntlets and Mirror Shield check collection crash associated with those changes. Fixed Kakariko Bazaar "seen" updates. Fixed tracker window not showing on initial load like it should. * Forgot 1 formatting fix. * Removed conditions for showing Song from Impa (isn't junk under certain conditions, so should show all the time). * Fix vanilla checks, add Zelda's Letter and Malon's Egg to manual check collection. Fix autoscroll while in child stealth section. * Fix crash in Happy Mask Shop in OnSlotChange (referenced non-existent shop id in a tracker-specific enum). * General code cleanup. * Missed one reversion. * One more. * Fix column alignment in `randomizer_check_objects`. * Fix file encoding on `randomizer_check_tracker`. Again. * Fix indentation for `actualItemtrackerItemMap`. Also removed unnecessary parts of the map. * Rename `HasEqItem` to `HasEquipment`. * Slightly better indentation for `actualItemTrackerItemMap`. * Add magic bean salesman to vanilla check tracking, and genericized deku shield to trigger KF shop item 3 wherever you get the shield. Renamed `vanillaCheck` to `vanillaHundoCheck` to (supposedly) clarify the meaning of the usage. * One more rename to `vanillaCompletion` to avoid possible confusion with 100% speedrun conditions. * give me a break XD Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * Changes suggested by briaguya (rename `RandomizerCheckShow` to `Status`, unused code, newline formatting) * Remove unused `itemNames` table. * Remove `IsGameRunning` in favor of `GameInteractor::IsSaveLoaded`. * Restore anti-spoiler functionality for dungeons with dungeon maps. * Review cleanup. * Fix prices not showing for Kak bazaar items. --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com>
2023-10-04 11:03:36 -04:00
gSaveContext.checkTrackerData[rcObj.rc].skipped = false;
areaChecksGotten[rcObj.rcArea]--;
2023-02-14 20:50:59 -05:00
} else {
Check Tracker Update (#2668) * Initial commit. What works so far: Data file loads, saves, deletes, and is created properly. - Need to run `HasItemBeenCollected` when creating in case of mid-seed regen. Organized checks into maps set by area. Areas show in tracker. - Checks pulled from checkObjectsByArea are not currently listed. - Areas are being assumed completed and hidden at the start. * Checks now populate. Still not counting area totals properly. * Don't track RC_LINKS_POCKET in the data file, and instead manually add it in every time a save is load. rcObjects doesn't contain Link's Pocket location (duh). * Moved ItemReceive hook to randomizer_check_tracker.cpp. Skipped items are properly sorted and formatted. Saved items contribute to an area's gotten/skipped checks on load. Changed skipped items default main color to gray. General code cleanup. * Skipped checks now contribute to area totals for area completion logic. * Mid-menu rework transfer. * Started check lookup on item receive. Tried to enable scum checking on save. * Fixed scum check on save. * More code cleanup, which revealed some issues with loading and saving. Loading now works 100%, but entries in checkTrackerData are disappearing in code somewhere, causing issues with later checks. Scummed color now displays properly. Collected but unsaved displays properly. Unchecked, Skipped, Seen and Scummed checks all have arrows for skipping/unskipping. Counts a little messed up, probably double adding skips. * Fixed item counts being off across resets. Restarts were fine. * Beginning of rework for individual check updates. Adds `Actor lastCheck` to PlayState to allow assigning of last actor to give an item. This allows precise tracking of GS, freestanding PoH, etc. Works for chests too. Currently does not work for shops, unknown for normal NPC gives. Doesn't track last gives for non-checks, like drops from grass, pots, crates, etc. * Actor-based checks fully fleshed out, but can't help with sale-based checks. Implemented `pendingSaleCheck` to back out of an RC check cycle if `gSaveContext->pendingSale` is not NONE when `OnItemReceive` is called, processed through `OnSaleEnd`. This should be the final change necessary to streamline the checks. * Temporary hook to message box close to tie in trackers for non-gs/chest actors that aren't added to `GetCheckFromActor`. This triggers a 2-frame countdown to check with `HasItemBeenCollected` since half of the methods in there aren't updated until after a text box closes. Added scene tracking to get last scene so that checks in scenes that span several overworld areas could be tied to their areas properly. Modified tracker data creation to apply Link's Pocket and Song from Impa conditionally based on randomizer settings instead of just being assumed to be done. May need modification for checking click and drag spoiler loading. Removed the scene equivalence check from CheckChecks so that an entire area is checked each time to avoid issues with, e.g., leaving a shop before a pending sale finishes. * Changed check data creation to use RSKs from gRandomizer to account for settings loaded from drag and drop spoilers. * Beginning of tracker code organization. Changed check color defaults. * Reverted moving tracker colors to header. Some individual check fixes. * Missed something from previous merge? * Removed last remnant of removed performance mode. * Better handle checking when skullsanity is off. * Song checks sceneIDs don't match the scenes they're actually in for some reason. Removed that check. * SaleEnd checks don't need the GetItemEntry parameter. Also set a flag that should prevent the check tracker from running during vanilla saves should that not be resolved by the time it's merged. * Attempting to have only the relevant checks added to the tracker data, as well as showing vanilla checks for non-rando saves. Not working yet (everything is displayed in vanilla). * Added vanilla check tracker population via `vanillaCheck` bool in `RandomizerCheckObject`. This is also added to `IsVisibleInImGui` to handle file loading and saving to eliminate checks that aren't part of vanilla or the rando seed. Implemented deleted tracker data file recreation. Added some extra item name text checks. Songs are still... tricky, so they stay blank. Utilize local copies of the randomizer check objects that are applicable for performance purposes. Fixed vanilla item-giving cutscene crashes when triggered mid-transition. * Apparently not all toolchains can handle macro instantiation without all parameters, like VS can. * Fixed scummed detail color not showing properly on tracker. * Fixed dungeon area totals and GS checks not functioning properly. * Major revamp of checking code. Doesn't rely on `GetCheckFromActor` at all anymore, but instead simply sets a flag to evaluate a number of checks in an area every frame until the check that was gotten is identified. With the new setup, it's much less hardware intensive, and at 60fps 6 checks per frame shows no noticeable effect on framerate. I can envision needing to add a collectedCount in order to account for times when two checks are gotten one right after the other. Changed area scroll to happen from `OnTransitionEnd`, and allow for scrolling in bazaar (was disabled previously because it would jump back and forth between Kak and Market while you were in one). Also setup area check order updating by area instead of all at the same time. * Fixed shooting gallery not reporting proper area. Prevent checks from actually happening if area is RCAREA_INVALID, now that all areas are reporting something if they have checks. Fixed `GetCheckArea()` not updating checks for standard scenes. Lots of vanilla tracking updates, mainly manual checks for gems, medallions and songs, since the often don't have proper scenes in the data. Prevent vanilla from triggering check loops if junk items are collected. Fixed sorting based on saved vs collected. Prevent item name display for vanilla runs. Change coloring of checks so the check name reflects status in vanilla runs. * Fixed "Recheck Area" button erroneously adding to an area's check totals? * Fix DMC vanilla checks. * Fix check tracker data recreation on data file loss. Removed redundant file exists check from SaveTrackerDataHook, as it doesn't matter if it exists or not at that point. Limited check loops to 3 to avoid infinite check loops on non-check/junk item pickup. Added more checks to disable tracker operations if a save is not running. Changed check ordering to put boss reward and heart container checks at the end of whatever RCSHOW group they belong to. * Fixed IsRunning calculation. Further improving vanilla checking. Starting framework for checking medallions, stones, and songs on data file recreation. Fixed medallion check collection. Added GIFT_FROM_SAGES to check list for vanilla file for tracking light medallion. Added check loop limitation to prevent infinite checking after picking up junk item from the ground. * Finished vanilla file recreation and recheck (songs and dungeon rewards all check properly now). This includes deku shield with KF shop item 3. Finished Gift from Raoru light medallion tracking for vanilla. Commented all CheckByScene functionality for now. * Fixed new save data file creation. Disabled entrance area calculation for now, as it only tracks the previous entrance for some reason. Fixed area detection for ToT checks. * GetCheckArea() now utilizes EntranceData almost exclusively, via either `gSaveContext.entranceIndex` or the entrance tracker's `currentGrottoId` in the case of grottos. This also means that EVERYTHING CAN AUTOSCROLL NOW. Entrance shuffles are now much easier to track. Autoscroll is now also triggered on save, just in case someone isn't autosaving and has a lot of checks that get converted to saved. * Fixed missing GS check in LW. * Added area scroll on toggling Show Hidden Items. May configure differently later. Fixed area detection for entrances in Gerudo Fortress/Valley and Collossus. Haunted wasteland doesn't autoscroll due to a bug in `OnTransitionEnd` hook, but checks still evaluate properly there. Rely on scene-based area detection if scene is a main overworld or dungeon scene. * Fixed grotto detection when shuffle is off. * Small code cleanup. Fixed Colossus hand chest checks. * Missing lus bump from merge conflict resolution * Fixed Colossus Grotto making `GetCheckArea` return Wasteland. * Improved OnItemReceive processing for non-token GS checks, since they can sometimes take long enough for the checking process to time out before the item is registered as received. * First attempt at thread safety for tracker data file writing. Seems to work, but might need more testing. * Fixed Recheck Area not unskipping items that register as saved. Improved delayed saving with autosaving, as the autosave triggered quite often before the tracker data save, making things not properly register as saved. * merge cleanup * Converted check tracker data to the sectional saves, adding `CheckTrackerData` to `SaveContext`. Implemented section ID returning and fullSave boolean passing to section functions from my PR temporarily for it to work properly. Moved `RandomizerCheckTrackerData` enum to `randomizerTypes.h` to accommodate that. Changed `Randomizer_SaveInit` to a `SaveManager::InitFunc` to allow for other randomizer-dependent sections to be initialized after that. Required a little refactoring to maintain intro cutscene skip when starting a randomizer file. * Revert section index return and randomizer init changes. Will need to wait on yet more changes to main. * Fixed check tracker initialization (shouldn't be tied to window initialization), restored saving/loading functionality. * Removed `CheckTracker::Init` and put SaveManager calls in `CheckTrackerWindow::InitElement`. Also a bit of cleanup from transition back to save file use. * Fixed tracker displaying check categories while file not loaded. * Fix Darunia's Joy check not marking in vanilla. * Fix autosave not triggering change from collected to saved in tracker data. * Changed default colors for scummed and collected display. * Merge upgrade code cleanup. * Add `OnTransitionEnd` calls to sandstorm transitions both to and from Wasteland. Also improved `gSaveContext.lastScene` assignment for both transition types. Allowed a bit of cleanup in `GetCheckArea`. * Added `StateButton`, a button like `ArrowButton` but that allows text instead of arrow icons. Apparently the changes from ArrowButton to StateButton happened in a previous commit... * Changed section name to `trackerDataCheck` to force SoH to load it after the randomizer section, as it required some randoSettings to be loaded first, and nothing else I tried to make the randomizer section load before it worked. This hacks a solution to checks not displaying on fast file load to a specific slot. F*** you, SaveManager, and f*** you too, JSON. * Forgot to change the section string for loading with the name change. * Fix check ordering for checks that trigger the autosave. * Adds option to remove right-side shop items (slots 1-4) from the tracker list. Enabled by default. * Fix default state of Hide Shop Right Checks checkbox. * Fixes grotto and great fairy scrolling and checks. Fixes array overflow from `checkTrackerData` which was creating the issue trying to load the base and randomizer sections first, among other things. That also fixed the massive file loads that were being exhibited in debug mode. * Fix shooting galleries being set as collected again when being played a second time after getting the checks. * Fix Bazaar autoscroll. * Add Saria's Song to `GetCheckFromActor` and removed some limitations from the messageCloseCheck function to make that check track properly. * Fix Song from Impa check. Implemented prevention for multiple "collections" of great fairies, just in case getting the health refill would trigger it with the previous setup. * Fix ice traps on GS tokens not triggering OnItemReceive. * Complete fix for ice trap collection from GS. Add autoscroll when clicking "Expand All". * Add `OnShopSlotChange` with cursorSlot and basePrice parameters. * Fixed include in en_ossan for shop slot hook. Added registration for `OnShopSlotChange` in the tracker, storing the price in a new `price` field in `CheckTrackerData`. Added "seen" functionality to shop checks. Displays the model item name upon first entering a shop, adding the price and switching to trickName (if it's an ice trap) upon navigating to the slot in buy mode, triggered by an invisible "identified" status that mirrors "seen" in every other way. Added tooltips to most options for check tracker color picking to describe what each status actually means. * `std::format` pls * So apparently std::format just decided to break with the latest merge from develop, but fmt::format exists and works? * Removed the last vestiges of `locationsSkipped`. Other general code and formatting cleanups. Moved `IsGameRunning` to `OTRGlobals` so the item tracker could also access it. Used preceding to "fix" item and bottle display in the item tracker on startup. * Some more code cleanup. Removed "Recheck Area" button and relevant code. Backported changes to Anchor branch applicable for single-player, including making a checkAreas vector and structuring the frame by frame checks around that. Also includes fix for Silver Gauntlets and Mirror Shield check collection crash associated with those changes. Fixed Kakariko Bazaar "seen" updates. Fixed tracker window not showing on initial load like it should. * Forgot 1 formatting fix. * Removed conditions for showing Song from Impa (isn't junk under certain conditions, so should show all the time). * Fix vanilla checks, add Zelda's Letter and Malon's Egg to manual check collection. Fix autoscroll while in child stealth section. * Fix crash in Happy Mask Shop in OnSlotChange (referenced non-existent shop id in a tracker-specific enum). * General code cleanup. * Missed one reversion. * One more. * Fix column alignment in `randomizer_check_objects`. * Fix file encoding on `randomizer_check_tracker`. Again. * Fix indentation for `actualItemtrackerItemMap`. Also removed unnecessary parts of the map. * Rename `HasEqItem` to `HasEquipment`. * Slightly better indentation for `actualItemTrackerItemMap`. * Add magic bean salesman to vanilla check tracking, and genericized deku shield to trigger KF shop item 3 wherever you get the shield. Renamed `vanillaCheck` to `vanillaHundoCheck` to (supposedly) clarify the meaning of the usage. * One more rename to `vanillaCompletion` to avoid possible confusion with 100% speedrun conditions. * give me a break XD Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * Changes suggested by briaguya (rename `RandomizerCheckShow` to `Status`, unused code, newline formatting) * Remove unused `itemNames` table. * Remove `IsGameRunning` in favor of `GameInteractor::IsSaveLoaded`. * Restore anti-spoiler functionality for dungeons with dungeon maps. * Review cleanup. * Fix prices not showing for Kak bazaar items. --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com>
2023-10-04 11:03:36 -04:00
gSaveContext.checkTrackerData[rcObj.rc].skipped = true;
areaChecksGotten[rcObj.rcArea]++;
2023-02-14 20:50:59 -05:00
}
Check Tracker Update (#2668) * Initial commit. What works so far: Data file loads, saves, deletes, and is created properly. - Need to run `HasItemBeenCollected` when creating in case of mid-seed regen. Organized checks into maps set by area. Areas show in tracker. - Checks pulled from checkObjectsByArea are not currently listed. - Areas are being assumed completed and hidden at the start. * Checks now populate. Still not counting area totals properly. * Don't track RC_LINKS_POCKET in the data file, and instead manually add it in every time a save is load. rcObjects doesn't contain Link's Pocket location (duh). * Moved ItemReceive hook to randomizer_check_tracker.cpp. Skipped items are properly sorted and formatted. Saved items contribute to an area's gotten/skipped checks on load. Changed skipped items default main color to gray. General code cleanup. * Skipped checks now contribute to area totals for area completion logic. * Mid-menu rework transfer. * Started check lookup on item receive. Tried to enable scum checking on save. * Fixed scum check on save. * More code cleanup, which revealed some issues with loading and saving. Loading now works 100%, but entries in checkTrackerData are disappearing in code somewhere, causing issues with later checks. Scummed color now displays properly. Collected but unsaved displays properly. Unchecked, Skipped, Seen and Scummed checks all have arrows for skipping/unskipping. Counts a little messed up, probably double adding skips. * Fixed item counts being off across resets. Restarts were fine. * Beginning of rework for individual check updates. Adds `Actor lastCheck` to PlayState to allow assigning of last actor to give an item. This allows precise tracking of GS, freestanding PoH, etc. Works for chests too. Currently does not work for shops, unknown for normal NPC gives. Doesn't track last gives for non-checks, like drops from grass, pots, crates, etc. * Actor-based checks fully fleshed out, but can't help with sale-based checks. Implemented `pendingSaleCheck` to back out of an RC check cycle if `gSaveContext->pendingSale` is not NONE when `OnItemReceive` is called, processed through `OnSaleEnd`. This should be the final change necessary to streamline the checks. * Temporary hook to message box close to tie in trackers for non-gs/chest actors that aren't added to `GetCheckFromActor`. This triggers a 2-frame countdown to check with `HasItemBeenCollected` since half of the methods in there aren't updated until after a text box closes. Added scene tracking to get last scene so that checks in scenes that span several overworld areas could be tied to their areas properly. Modified tracker data creation to apply Link's Pocket and Song from Impa conditionally based on randomizer settings instead of just being assumed to be done. May need modification for checking click and drag spoiler loading. Removed the scene equivalence check from CheckChecks so that an entire area is checked each time to avoid issues with, e.g., leaving a shop before a pending sale finishes. * Changed check data creation to use RSKs from gRandomizer to account for settings loaded from drag and drop spoilers. * Beginning of tracker code organization. Changed check color defaults. * Reverted moving tracker colors to header. Some individual check fixes. * Missed something from previous merge? * Removed last remnant of removed performance mode. * Better handle checking when skullsanity is off. * Song checks sceneIDs don't match the scenes they're actually in for some reason. Removed that check. * SaleEnd checks don't need the GetItemEntry parameter. Also set a flag that should prevent the check tracker from running during vanilla saves should that not be resolved by the time it's merged. * Attempting to have only the relevant checks added to the tracker data, as well as showing vanilla checks for non-rando saves. Not working yet (everything is displayed in vanilla). * Added vanilla check tracker population via `vanillaCheck` bool in `RandomizerCheckObject`. This is also added to `IsVisibleInImGui` to handle file loading and saving to eliminate checks that aren't part of vanilla or the rando seed. Implemented deleted tracker data file recreation. Added some extra item name text checks. Songs are still... tricky, so they stay blank. Utilize local copies of the randomizer check objects that are applicable for performance purposes. Fixed vanilla item-giving cutscene crashes when triggered mid-transition. * Apparently not all toolchains can handle macro instantiation without all parameters, like VS can. * Fixed scummed detail color not showing properly on tracker. * Fixed dungeon area totals and GS checks not functioning properly. * Major revamp of checking code. Doesn't rely on `GetCheckFromActor` at all anymore, but instead simply sets a flag to evaluate a number of checks in an area every frame until the check that was gotten is identified. With the new setup, it's much less hardware intensive, and at 60fps 6 checks per frame shows no noticeable effect on framerate. I can envision needing to add a collectedCount in order to account for times when two checks are gotten one right after the other. Changed area scroll to happen from `OnTransitionEnd`, and allow for scrolling in bazaar (was disabled previously because it would jump back and forth between Kak and Market while you were in one). Also setup area check order updating by area instead of all at the same time. * Fixed shooting gallery not reporting proper area. Prevent checks from actually happening if area is RCAREA_INVALID, now that all areas are reporting something if they have checks. Fixed `GetCheckArea()` not updating checks for standard scenes. Lots of vanilla tracking updates, mainly manual checks for gems, medallions and songs, since the often don't have proper scenes in the data. Prevent vanilla from triggering check loops if junk items are collected. Fixed sorting based on saved vs collected. Prevent item name display for vanilla runs. Change coloring of checks so the check name reflects status in vanilla runs. * Fixed "Recheck Area" button erroneously adding to an area's check totals? * Fix DMC vanilla checks. * Fix check tracker data recreation on data file loss. Removed redundant file exists check from SaveTrackerDataHook, as it doesn't matter if it exists or not at that point. Limited check loops to 3 to avoid infinite check loops on non-check/junk item pickup. Added more checks to disable tracker operations if a save is not running. Changed check ordering to put boss reward and heart container checks at the end of whatever RCSHOW group they belong to. * Fixed IsRunning calculation. Further improving vanilla checking. Starting framework for checking medallions, stones, and songs on data file recreation. Fixed medallion check collection. Added GIFT_FROM_SAGES to check list for vanilla file for tracking light medallion. Added check loop limitation to prevent infinite checking after picking up junk item from the ground. * Finished vanilla file recreation and recheck (songs and dungeon rewards all check properly now). This includes deku shield with KF shop item 3. Finished Gift from Raoru light medallion tracking for vanilla. Commented all CheckByScene functionality for now. * Fixed new save data file creation. Disabled entrance area calculation for now, as it only tracks the previous entrance for some reason. Fixed area detection for ToT checks. * GetCheckArea() now utilizes EntranceData almost exclusively, via either `gSaveContext.entranceIndex` or the entrance tracker's `currentGrottoId` in the case of grottos. This also means that EVERYTHING CAN AUTOSCROLL NOW. Entrance shuffles are now much easier to track. Autoscroll is now also triggered on save, just in case someone isn't autosaving and has a lot of checks that get converted to saved. * Fixed missing GS check in LW. * Added area scroll on toggling Show Hidden Items. May configure differently later. Fixed area detection for entrances in Gerudo Fortress/Valley and Collossus. Haunted wasteland doesn't autoscroll due to a bug in `OnTransitionEnd` hook, but checks still evaluate properly there. Rely on scene-based area detection if scene is a main overworld or dungeon scene. * Fixed grotto detection when shuffle is off. * Small code cleanup. Fixed Colossus hand chest checks. * Missing lus bump from merge conflict resolution * Fixed Colossus Grotto making `GetCheckArea` return Wasteland. * Improved OnItemReceive processing for non-token GS checks, since they can sometimes take long enough for the checking process to time out before the item is registered as received. * First attempt at thread safety for tracker data file writing. Seems to work, but might need more testing. * Fixed Recheck Area not unskipping items that register as saved. Improved delayed saving with autosaving, as the autosave triggered quite often before the tracker data save, making things not properly register as saved. * merge cleanup * Converted check tracker data to the sectional saves, adding `CheckTrackerData` to `SaveContext`. Implemented section ID returning and fullSave boolean passing to section functions from my PR temporarily for it to work properly. Moved `RandomizerCheckTrackerData` enum to `randomizerTypes.h` to accommodate that. Changed `Randomizer_SaveInit` to a `SaveManager::InitFunc` to allow for other randomizer-dependent sections to be initialized after that. Required a little refactoring to maintain intro cutscene skip when starting a randomizer file. * Revert section index return and randomizer init changes. Will need to wait on yet more changes to main. * Fixed check tracker initialization (shouldn't be tied to window initialization), restored saving/loading functionality. * Removed `CheckTracker::Init` and put SaveManager calls in `CheckTrackerWindow::InitElement`. Also a bit of cleanup from transition back to save file use. * Fixed tracker displaying check categories while file not loaded. * Fix Darunia's Joy check not marking in vanilla. * Fix autosave not triggering change from collected to saved in tracker data. * Changed default colors for scummed and collected display. * Merge upgrade code cleanup. * Add `OnTransitionEnd` calls to sandstorm transitions both to and from Wasteland. Also improved `gSaveContext.lastScene` assignment for both transition types. Allowed a bit of cleanup in `GetCheckArea`. * Added `StateButton`, a button like `ArrowButton` but that allows text instead of arrow icons. Apparently the changes from ArrowButton to StateButton happened in a previous commit... * Changed section name to `trackerDataCheck` to force SoH to load it after the randomizer section, as it required some randoSettings to be loaded first, and nothing else I tried to make the randomizer section load before it worked. This hacks a solution to checks not displaying on fast file load to a specific slot. F*** you, SaveManager, and f*** you too, JSON. * Forgot to change the section string for loading with the name change. * Fix check ordering for checks that trigger the autosave. * Adds option to remove right-side shop items (slots 1-4) from the tracker list. Enabled by default. * Fix default state of Hide Shop Right Checks checkbox. * Fixes grotto and great fairy scrolling and checks. Fixes array overflow from `checkTrackerData` which was creating the issue trying to load the base and randomizer sections first, among other things. That also fixed the massive file loads that were being exhibited in debug mode. * Fix shooting galleries being set as collected again when being played a second time after getting the checks. * Fix Bazaar autoscroll. * Add Saria's Song to `GetCheckFromActor` and removed some limitations from the messageCloseCheck function to make that check track properly. * Fix Song from Impa check. Implemented prevention for multiple "collections" of great fairies, just in case getting the health refill would trigger it with the previous setup. * Fix ice traps on GS tokens not triggering OnItemReceive. * Complete fix for ice trap collection from GS. Add autoscroll when clicking "Expand All". * Add `OnShopSlotChange` with cursorSlot and basePrice parameters. * Fixed include in en_ossan for shop slot hook. Added registration for `OnShopSlotChange` in the tracker, storing the price in a new `price` field in `CheckTrackerData`. Added "seen" functionality to shop checks. Displays the model item name upon first entering a shop, adding the price and switching to trickName (if it's an ice trap) upon navigating to the slot in buy mode, triggered by an invisible "identified" status that mirrors "seen" in every other way. Added tooltips to most options for check tracker color picking to describe what each status actually means. * `std::format` pls * So apparently std::format just decided to break with the latest merge from develop, but fmt::format exists and works? * Removed the last vestiges of `locationsSkipped`. Other general code and formatting cleanups. Moved `IsGameRunning` to `OTRGlobals` so the item tracker could also access it. Used preceding to "fix" item and bottle display in the item tracker on startup. * Some more code cleanup. Removed "Recheck Area" button and relevant code. Backported changes to Anchor branch applicable for single-player, including making a checkAreas vector and structuring the frame by frame checks around that. Also includes fix for Silver Gauntlets and Mirror Shield check collection crash associated with those changes. Fixed Kakariko Bazaar "seen" updates. Fixed tracker window not showing on initial load like it should. * Forgot 1 formatting fix. * Removed conditions for showing Song from Impa (isn't junk under certain conditions, so should show all the time). * Fix vanilla checks, add Zelda's Letter and Malon's Egg to manual check collection. Fix autoscroll while in child stealth section. * Fix crash in Happy Mask Shop in OnSlotChange (referenced non-existent shop id in a tracker-specific enum). * General code cleanup. * Missed one reversion. * One more. * Fix column alignment in `randomizer_check_objects`. * Fix file encoding on `randomizer_check_tracker`. Again. * Fix indentation for `actualItemtrackerItemMap`. Also removed unnecessary parts of the map. * Rename `HasEqItem` to `HasEquipment`. * Slightly better indentation for `actualItemTrackerItemMap`. * Add magic bean salesman to vanilla check tracking, and genericized deku shield to trigger KF shop item 3 wherever you get the shield. Renamed `vanillaCheck` to `vanillaHundoCheck` to (supposedly) clarify the meaning of the usage. * One more rename to `vanillaCompletion` to avoid possible confusion with 100% speedrun conditions. * give me a break XD Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * Changes suggested by briaguya (rename `RandomizerCheckShow` to `Status`, unused code, newline formatting) * Remove unused `itemNames` table. * Remove `IsGameRunning` in favor of `GameInteractor::IsSaveLoaded`. * Restore anti-spoiler functionality for dungeons with dungeon maps. * Review cleanup. * Fix prices not showing for Kak bazaar items. --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com>
2023-10-04 11:03:36 -04:00
UpdateOrdering(rcObj.rcArea);
UpdateInventoryChecks();
SaveManager::Instance->SaveSection(gSaveContext.fileNum, sectionId, true);
Randomizer Auto Location tracker (#1942) * Initial Auto-Location Tracking * Updates styling for checked items in Check Tracker * Fixes crashing issues with Check Tracker rendering * Auto scroll Check Tracker windows to current area * Checks Tracker only shows checked locations once in game * Fixes issue where Check Tracker would auto-scroll to wrong location when entering a grotto * Fixes gerudo fortress checks showing in tracker when settings have them removed * InfTable Check Location Fixes: Lost Dog Richard, Rolling Gorons, HBA 1000, Thawed Zora * Fixes most Event Chk Inf Checks on Check Tracker, and Frogs * Check Tracker - Song from Malon now works * Check Tracker - Fixes Claim Check check not tracking - Fixes spoiler for Claim Check check when getting Biggoron's Sword - Fixes LACS being spoiled and not tracking * Check Tracker - Fixes #2 for Skull Mask and Mask of Truth checks * Check Tracker - Adds support for merchants - Fixes #7 for Bomchu Salesman - Fixes #12 for Medigoron * Check Tracker - Fixes #8 for Song from Saria * Check Tracker - Fixes #9 for Adult Shooting Gallery * Check Tracker - Fixes #10 for Composer Grave * Check Tracker - Fixes #14 for Song from Ocarina of Time * Check Tracker - Fixes #16 for Shooting the Sun * Check Tracker - Fixes #19 for Darunia's Joy * Save Editor - Adds missing label for Treasure Chest Game * Check Tracker - Fixes Great Faries checks * Check Tracker - Fixes Sheik at Temple * Check Tracker - Fixes Great Fairy auto-scroll to wrong location * Check Tracker - Updates blue warp checks - Fixes Bongo Bongo and Twinrova checks * Check Tracker - Fixes Dampe's Gravedigging Tour * Check Tracker - Fixes Prescription to King Zora * Check Tracker - Fixes Bazaar showing under wrong area on tracker between adult/child * Check Tracker - Fixes scroll for Hyrule Market and Bazaar * Check Tracker - Fixes giving Adult Trade Items shown on tracker: Broken Sword, Saw, Cojiro, Eyeball Froge, and Eyedrops * Cleans up item_location * Check Tracker - Item List - Fixes item list not updating when changing seeds/options - Separates item exclusion list from item check list - Clean up comments * Check Tracker - Adds Skip functionality to buttons * Check Tracker - Refactors adult trade items to RandomizerInf * Check Tracker - Fixes an issue where any time an item is removed the tracker would cause an application crash * Check Tracker - Item names are now dependent on file language * Check Tracker - Fixes Gerudo Card check not showing in Fast setting * Reorders headers to (hopefully) avoid CI build conflicts on linux/consoles * Explicitly defines vector header in randomizer.h to fix compile errors * Complete Refactor of Check Tracker ImGui * Adds missing check tracker files to CMakeLists * Reverts the Item_location whitespace cleanup from ad10807c * Check Tracker - Loading Fixes - Fixes a bug where loading a save file a second time would add all the checks again - Fixes a bug where the check tracker would not render at all until in a save file * Check Tracker - Fixes a bug where checks would sometimes fail to load * Check Tracker - Fixes duplicated checks when using Only on Pause or Only on Combo * Check Tracker - Works around issue where single characters don't show in EnhancementCombobox, and fixes a label for combo buttons held option * Check Tracker - Applies all Check Tracker changes to Item Location * Check Tracker - Updated Check List - Adds Link's pocket, either in KF or HM depending on starting age - Supports Scrubs and Merchants - Uses enums instead of magic numbers - Updates DC Scrub Short Names for MQ * Check Tracker - Adds a performance mode option * Check Tracker - List Fixes (requires new rando generation) - Fixes Frogs Rupees always visible - Fixes Kokiri Sword Chest not showing - Fixes Weird Egg not showing * Check Tracker - MQ List basic support * Check Tracker - MQ/Vanilla anti-spoilers * Check Tracker - Collecting a compass now spoils the area * Check Tracker - Basic Vanilla Support and fixes - Vanilla items show in check tracker, even if many won't auto check - Fixes an issue with Gerudo Fortress Keys - Refactors IsVisibleInCheckTracker to randomizer_check_tracjer * Check Tracker - Fixes merge conflict from 08a487f35e1d760ab9e69b932edbe4da6bcd9edb * Check Tracker - Fixes tracker loading as Floating when default value is set to Windowed * Randomizer Location Exclusion List - Adds Scrubs, Merchants, Shops. Adult Trade items, MQ Dungeons, and Bean Salesman - Fixes Kokiri Sword Chest, Weird Egg, and Frog Song Rupees from misbehaving - Updates Gerudo Fortress logic to be dependent on Open/Fast/Normal Fortress - Removes Invalid Check - Adds RO Enum for MQ settings - Updates magic values to RO enum * Location Exclusion List - Scrubs that are always randomized now always show on the list * For now, removes some extra code only needed for a Check Tracker. * Randomizer Location Exclusion List - Fixes Eyeball Frog from showing up when Adult Trade Items was off * Location Tracker - Updates Eyedrops to use RandomizerInf instead of Chest * Check Tracker - Fixes a bug where Link's Pocket item wasn't acting as checked for area item count * Check Tracker - Fixes a bug where Locations would incorrectly say Vanilla due to the first check in the area being a non-MQ check * Check Tracker - Fixes a crash when Check Tracker is docked but not visible * Check Tracker - Fixes areas being spoiled when loading different save files * Check Tracker - Only reset variables if they are initialized * Check Tracker - Cleans up old comments, unused variables, methods, and macros, adds language TODOs, * Check Tracker - Readds rainbow UI elements after Cosmetics Editor refactor * Check Tracker - Removal of flag lookup that was refactored, no longer needed header, and some trivial whitespace fixes. * Check Tracker - Refactors Index to Bitmask code to a macro * Check Tracker - Changes ordering from alphabetical to RandomizerCheck ordering * Check Tracker - Wraps everything in a namespace to avoid global variable usage * Check Tracker - Explicitly defines for-loop scope * Check Tracker - refactors dungeon lookup from static array to function * Fixes a bug when using EnhancementColor with alpha * Check Tracker - Refactors all colour to use direct conversions * Check Tracker - refactors settings loading and check visibility for readability * Check Tracker - Fixes a bug where the wrong label showed on the Check Tracker BG Color * UIWidgets - Adds Alpha bar to EnhancementColor when using alpha parameter
2022-12-10 22:39:23 -05:00
}
} else {
ImGui::InvisibleButton("", ImVec2(20.0f, 10.0f));
}
ImGui::SameLine();
//Draw
ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(mainColor.r / 255.0f, mainColor.g / 255.0f, mainColor.b / 255.0f, mainColor.a / 255.0f));
ImGui::Text("%s", txt.c_str());
ImGui::PopStyleColor();
//Draw the extra info
Check Tracker Update (#2668) * Initial commit. What works so far: Data file loads, saves, deletes, and is created properly. - Need to run `HasItemBeenCollected` when creating in case of mid-seed regen. Organized checks into maps set by area. Areas show in tracker. - Checks pulled from checkObjectsByArea are not currently listed. - Areas are being assumed completed and hidden at the start. * Checks now populate. Still not counting area totals properly. * Don't track RC_LINKS_POCKET in the data file, and instead manually add it in every time a save is load. rcObjects doesn't contain Link's Pocket location (duh). * Moved ItemReceive hook to randomizer_check_tracker.cpp. Skipped items are properly sorted and formatted. Saved items contribute to an area's gotten/skipped checks on load. Changed skipped items default main color to gray. General code cleanup. * Skipped checks now contribute to area totals for area completion logic. * Mid-menu rework transfer. * Started check lookup on item receive. Tried to enable scum checking on save. * Fixed scum check on save. * More code cleanup, which revealed some issues with loading and saving. Loading now works 100%, but entries in checkTrackerData are disappearing in code somewhere, causing issues with later checks. Scummed color now displays properly. Collected but unsaved displays properly. Unchecked, Skipped, Seen and Scummed checks all have arrows for skipping/unskipping. Counts a little messed up, probably double adding skips. * Fixed item counts being off across resets. Restarts were fine. * Beginning of rework for individual check updates. Adds `Actor lastCheck` to PlayState to allow assigning of last actor to give an item. This allows precise tracking of GS, freestanding PoH, etc. Works for chests too. Currently does not work for shops, unknown for normal NPC gives. Doesn't track last gives for non-checks, like drops from grass, pots, crates, etc. * Actor-based checks fully fleshed out, but can't help with sale-based checks. Implemented `pendingSaleCheck` to back out of an RC check cycle if `gSaveContext->pendingSale` is not NONE when `OnItemReceive` is called, processed through `OnSaleEnd`. This should be the final change necessary to streamline the checks. * Temporary hook to message box close to tie in trackers for non-gs/chest actors that aren't added to `GetCheckFromActor`. This triggers a 2-frame countdown to check with `HasItemBeenCollected` since half of the methods in there aren't updated until after a text box closes. Added scene tracking to get last scene so that checks in scenes that span several overworld areas could be tied to their areas properly. Modified tracker data creation to apply Link's Pocket and Song from Impa conditionally based on randomizer settings instead of just being assumed to be done. May need modification for checking click and drag spoiler loading. Removed the scene equivalence check from CheckChecks so that an entire area is checked each time to avoid issues with, e.g., leaving a shop before a pending sale finishes. * Changed check data creation to use RSKs from gRandomizer to account for settings loaded from drag and drop spoilers. * Beginning of tracker code organization. Changed check color defaults. * Reverted moving tracker colors to header. Some individual check fixes. * Missed something from previous merge? * Removed last remnant of removed performance mode. * Better handle checking when skullsanity is off. * Song checks sceneIDs don't match the scenes they're actually in for some reason. Removed that check. * SaleEnd checks don't need the GetItemEntry parameter. Also set a flag that should prevent the check tracker from running during vanilla saves should that not be resolved by the time it's merged. * Attempting to have only the relevant checks added to the tracker data, as well as showing vanilla checks for non-rando saves. Not working yet (everything is displayed in vanilla). * Added vanilla check tracker population via `vanillaCheck` bool in `RandomizerCheckObject`. This is also added to `IsVisibleInImGui` to handle file loading and saving to eliminate checks that aren't part of vanilla or the rando seed. Implemented deleted tracker data file recreation. Added some extra item name text checks. Songs are still... tricky, so they stay blank. Utilize local copies of the randomizer check objects that are applicable for performance purposes. Fixed vanilla item-giving cutscene crashes when triggered mid-transition. * Apparently not all toolchains can handle macro instantiation without all parameters, like VS can. * Fixed scummed detail color not showing properly on tracker. * Fixed dungeon area totals and GS checks not functioning properly. * Major revamp of checking code. Doesn't rely on `GetCheckFromActor` at all anymore, but instead simply sets a flag to evaluate a number of checks in an area every frame until the check that was gotten is identified. With the new setup, it's much less hardware intensive, and at 60fps 6 checks per frame shows no noticeable effect on framerate. I can envision needing to add a collectedCount in order to account for times when two checks are gotten one right after the other. Changed area scroll to happen from `OnTransitionEnd`, and allow for scrolling in bazaar (was disabled previously because it would jump back and forth between Kak and Market while you were in one). Also setup area check order updating by area instead of all at the same time. * Fixed shooting gallery not reporting proper area. Prevent checks from actually happening if area is RCAREA_INVALID, now that all areas are reporting something if they have checks. Fixed `GetCheckArea()` not updating checks for standard scenes. Lots of vanilla tracking updates, mainly manual checks for gems, medallions and songs, since the often don't have proper scenes in the data. Prevent vanilla from triggering check loops if junk items are collected. Fixed sorting based on saved vs collected. Prevent item name display for vanilla runs. Change coloring of checks so the check name reflects status in vanilla runs. * Fixed "Recheck Area" button erroneously adding to an area's check totals? * Fix DMC vanilla checks. * Fix check tracker data recreation on data file loss. Removed redundant file exists check from SaveTrackerDataHook, as it doesn't matter if it exists or not at that point. Limited check loops to 3 to avoid infinite check loops on non-check/junk item pickup. Added more checks to disable tracker operations if a save is not running. Changed check ordering to put boss reward and heart container checks at the end of whatever RCSHOW group they belong to. * Fixed IsRunning calculation. Further improving vanilla checking. Starting framework for checking medallions, stones, and songs on data file recreation. Fixed medallion check collection. Added GIFT_FROM_SAGES to check list for vanilla file for tracking light medallion. Added check loop limitation to prevent infinite checking after picking up junk item from the ground. * Finished vanilla file recreation and recheck (songs and dungeon rewards all check properly now). This includes deku shield with KF shop item 3. Finished Gift from Raoru light medallion tracking for vanilla. Commented all CheckByScene functionality for now. * Fixed new save data file creation. Disabled entrance area calculation for now, as it only tracks the previous entrance for some reason. Fixed area detection for ToT checks. * GetCheckArea() now utilizes EntranceData almost exclusively, via either `gSaveContext.entranceIndex` or the entrance tracker's `currentGrottoId` in the case of grottos. This also means that EVERYTHING CAN AUTOSCROLL NOW. Entrance shuffles are now much easier to track. Autoscroll is now also triggered on save, just in case someone isn't autosaving and has a lot of checks that get converted to saved. * Fixed missing GS check in LW. * Added area scroll on toggling Show Hidden Items. May configure differently later. Fixed area detection for entrances in Gerudo Fortress/Valley and Collossus. Haunted wasteland doesn't autoscroll due to a bug in `OnTransitionEnd` hook, but checks still evaluate properly there. Rely on scene-based area detection if scene is a main overworld or dungeon scene. * Fixed grotto detection when shuffle is off. * Small code cleanup. Fixed Colossus hand chest checks. * Missing lus bump from merge conflict resolution * Fixed Colossus Grotto making `GetCheckArea` return Wasteland. * Improved OnItemReceive processing for non-token GS checks, since they can sometimes take long enough for the checking process to time out before the item is registered as received. * First attempt at thread safety for tracker data file writing. Seems to work, but might need more testing. * Fixed Recheck Area not unskipping items that register as saved. Improved delayed saving with autosaving, as the autosave triggered quite often before the tracker data save, making things not properly register as saved. * merge cleanup * Converted check tracker data to the sectional saves, adding `CheckTrackerData` to `SaveContext`. Implemented section ID returning and fullSave boolean passing to section functions from my PR temporarily for it to work properly. Moved `RandomizerCheckTrackerData` enum to `randomizerTypes.h` to accommodate that. Changed `Randomizer_SaveInit` to a `SaveManager::InitFunc` to allow for other randomizer-dependent sections to be initialized after that. Required a little refactoring to maintain intro cutscene skip when starting a randomizer file. * Revert section index return and randomizer init changes. Will need to wait on yet more changes to main. * Fixed check tracker initialization (shouldn't be tied to window initialization), restored saving/loading functionality. * Removed `CheckTracker::Init` and put SaveManager calls in `CheckTrackerWindow::InitElement`. Also a bit of cleanup from transition back to save file use. * Fixed tracker displaying check categories while file not loaded. * Fix Darunia's Joy check not marking in vanilla. * Fix autosave not triggering change from collected to saved in tracker data. * Changed default colors for scummed and collected display. * Merge upgrade code cleanup. * Add `OnTransitionEnd` calls to sandstorm transitions both to and from Wasteland. Also improved `gSaveContext.lastScene` assignment for both transition types. Allowed a bit of cleanup in `GetCheckArea`. * Added `StateButton`, a button like `ArrowButton` but that allows text instead of arrow icons. Apparently the changes from ArrowButton to StateButton happened in a previous commit... * Changed section name to `trackerDataCheck` to force SoH to load it after the randomizer section, as it required some randoSettings to be loaded first, and nothing else I tried to make the randomizer section load before it worked. This hacks a solution to checks not displaying on fast file load to a specific slot. F*** you, SaveManager, and f*** you too, JSON. * Forgot to change the section string for loading with the name change. * Fix check ordering for checks that trigger the autosave. * Adds option to remove right-side shop items (slots 1-4) from the tracker list. Enabled by default. * Fix default state of Hide Shop Right Checks checkbox. * Fixes grotto and great fairy scrolling and checks. Fixes array overflow from `checkTrackerData` which was creating the issue trying to load the base and randomizer sections first, among other things. That also fixed the massive file loads that were being exhibited in debug mode. * Fix shooting galleries being set as collected again when being played a second time after getting the checks. * Fix Bazaar autoscroll. * Add Saria's Song to `GetCheckFromActor` and removed some limitations from the messageCloseCheck function to make that check track properly. * Fix Song from Impa check. Implemented prevention for multiple "collections" of great fairies, just in case getting the health refill would trigger it with the previous setup. * Fix ice traps on GS tokens not triggering OnItemReceive. * Complete fix for ice trap collection from GS. Add autoscroll when clicking "Expand All". * Add `OnShopSlotChange` with cursorSlot and basePrice parameters. * Fixed include in en_ossan for shop slot hook. Added registration for `OnShopSlotChange` in the tracker, storing the price in a new `price` field in `CheckTrackerData`. Added "seen" functionality to shop checks. Displays the model item name upon first entering a shop, adding the price and switching to trickName (if it's an ice trap) upon navigating to the slot in buy mode, triggered by an invisible "identified" status that mirrors "seen" in every other way. Added tooltips to most options for check tracker color picking to describe what each status actually means. * `std::format` pls * So apparently std::format just decided to break with the latest merge from develop, but fmt::format exists and works? * Removed the last vestiges of `locationsSkipped`. Other general code and formatting cleanups. Moved `IsGameRunning` to `OTRGlobals` so the item tracker could also access it. Used preceding to "fix" item and bottle display in the item tracker on startup. * Some more code cleanup. Removed "Recheck Area" button and relevant code. Backported changes to Anchor branch applicable for single-player, including making a checkAreas vector and structuring the frame by frame checks around that. Also includes fix for Silver Gauntlets and Mirror Shield check collection crash associated with those changes. Fixed Kakariko Bazaar "seen" updates. Fixed tracker window not showing on initial load like it should. * Forgot 1 formatting fix. * Removed conditions for showing Song from Impa (isn't junk under certain conditions, so should show all the time). * Fix vanilla checks, add Zelda's Letter and Malon's Egg to manual check collection. Fix autoscroll while in child stealth section. * Fix crash in Happy Mask Shop in OnSlotChange (referenced non-existent shop id in a tracker-specific enum). * General code cleanup. * Missed one reversion. * One more. * Fix column alignment in `randomizer_check_objects`. * Fix file encoding on `randomizer_check_tracker`. Again. * Fix indentation for `actualItemtrackerItemMap`. Also removed unnecessary parts of the map. * Rename `HasEqItem` to `HasEquipment`. * Slightly better indentation for `actualItemTrackerItemMap`. * Add magic bean salesman to vanilla check tracking, and genericized deku shield to trigger KF shop item 3 wherever you get the shield. Renamed `vanillaCheck` to `vanillaHundoCheck` to (supposedly) clarify the meaning of the usage. * One more rename to `vanillaCompletion` to avoid possible confusion with 100% speedrun conditions. * give me a break XD Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * Changes suggested by briaguya (rename `RandomizerCheckShow` to `Status`, unused code, newline formatting) * Remove unused `itemNames` table. * Remove `IsGameRunning` in favor of `GameInteractor::IsSaveLoaded`. * Restore anti-spoiler functionality for dungeons with dungeon maps. * Review cleanup. * Fix prices not showing for Kak bazaar items. --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com>
2023-10-04 11:03:36 -04:00
txt = "";
if (checkData.hintItem != 0) {
// TODO hints
} else if (status != RCSHOW_UNCHECKED) {
switch (status) {
Randomizer Auto Location tracker (#1942) * Initial Auto-Location Tracking * Updates styling for checked items in Check Tracker * Fixes crashing issues with Check Tracker rendering * Auto scroll Check Tracker windows to current area * Checks Tracker only shows checked locations once in game * Fixes issue where Check Tracker would auto-scroll to wrong location when entering a grotto * Fixes gerudo fortress checks showing in tracker when settings have them removed * InfTable Check Location Fixes: Lost Dog Richard, Rolling Gorons, HBA 1000, Thawed Zora * Fixes most Event Chk Inf Checks on Check Tracker, and Frogs * Check Tracker - Song from Malon now works * Check Tracker - Fixes Claim Check check not tracking - Fixes spoiler for Claim Check check when getting Biggoron's Sword - Fixes LACS being spoiled and not tracking * Check Tracker - Fixes #2 for Skull Mask and Mask of Truth checks * Check Tracker - Adds support for merchants - Fixes #7 for Bomchu Salesman - Fixes #12 for Medigoron * Check Tracker - Fixes #8 for Song from Saria * Check Tracker - Fixes #9 for Adult Shooting Gallery * Check Tracker - Fixes #10 for Composer Grave * Check Tracker - Fixes #14 for Song from Ocarina of Time * Check Tracker - Fixes #16 for Shooting the Sun * Check Tracker - Fixes #19 for Darunia's Joy * Save Editor - Adds missing label for Treasure Chest Game * Check Tracker - Fixes Great Faries checks * Check Tracker - Fixes Sheik at Temple * Check Tracker - Fixes Great Fairy auto-scroll to wrong location * Check Tracker - Updates blue warp checks - Fixes Bongo Bongo and Twinrova checks * Check Tracker - Fixes Dampe's Gravedigging Tour * Check Tracker - Fixes Prescription to King Zora * Check Tracker - Fixes Bazaar showing under wrong area on tracker between adult/child * Check Tracker - Fixes scroll for Hyrule Market and Bazaar * Check Tracker - Fixes giving Adult Trade Items shown on tracker: Broken Sword, Saw, Cojiro, Eyeball Froge, and Eyedrops * Cleans up item_location * Check Tracker - Item List - Fixes item list not updating when changing seeds/options - Separates item exclusion list from item check list - Clean up comments * Check Tracker - Adds Skip functionality to buttons * Check Tracker - Refactors adult trade items to RandomizerInf * Check Tracker - Fixes an issue where any time an item is removed the tracker would cause an application crash * Check Tracker - Item names are now dependent on file language * Check Tracker - Fixes Gerudo Card check not showing in Fast setting * Reorders headers to (hopefully) avoid CI build conflicts on linux/consoles * Explicitly defines vector header in randomizer.h to fix compile errors * Complete Refactor of Check Tracker ImGui * Adds missing check tracker files to CMakeLists * Reverts the Item_location whitespace cleanup from ad10807c * Check Tracker - Loading Fixes - Fixes a bug where loading a save file a second time would add all the checks again - Fixes a bug where the check tracker would not render at all until in a save file * Check Tracker - Fixes a bug where checks would sometimes fail to load * Check Tracker - Fixes duplicated checks when using Only on Pause or Only on Combo * Check Tracker - Works around issue where single characters don't show in EnhancementCombobox, and fixes a label for combo buttons held option * Check Tracker - Applies all Check Tracker changes to Item Location * Check Tracker - Updated Check List - Adds Link's pocket, either in KF or HM depending on starting age - Supports Scrubs and Merchants - Uses enums instead of magic numbers - Updates DC Scrub Short Names for MQ * Check Tracker - Adds a performance mode option * Check Tracker - List Fixes (requires new rando generation) - Fixes Frogs Rupees always visible - Fixes Kokiri Sword Chest not showing - Fixes Weird Egg not showing * Check Tracker - MQ List basic support * Check Tracker - MQ/Vanilla anti-spoilers * Check Tracker - Collecting a compass now spoils the area * Check Tracker - Basic Vanilla Support and fixes - Vanilla items show in check tracker, even if many won't auto check - Fixes an issue with Gerudo Fortress Keys - Refactors IsVisibleInCheckTracker to randomizer_check_tracjer * Check Tracker - Fixes merge conflict from 08a487f35e1d760ab9e69b932edbe4da6bcd9edb * Check Tracker - Fixes tracker loading as Floating when default value is set to Windowed * Randomizer Location Exclusion List - Adds Scrubs, Merchants, Shops. Adult Trade items, MQ Dungeons, and Bean Salesman - Fixes Kokiri Sword Chest, Weird Egg, and Frog Song Rupees from misbehaving - Updates Gerudo Fortress logic to be dependent on Open/Fast/Normal Fortress - Removes Invalid Check - Adds RO Enum for MQ settings - Updates magic values to RO enum * Location Exclusion List - Scrubs that are always randomized now always show on the list * For now, removes some extra code only needed for a Check Tracker. * Randomizer Location Exclusion List - Fixes Eyeball Frog from showing up when Adult Trade Items was off * Location Tracker - Updates Eyedrops to use RandomizerInf instead of Chest * Check Tracker - Fixes a bug where Link's Pocket item wasn't acting as checked for area item count * Check Tracker - Fixes a bug where Locations would incorrectly say Vanilla due to the first check in the area being a non-MQ check * Check Tracker - Fixes a crash when Check Tracker is docked but not visible * Check Tracker - Fixes areas being spoiled when loading different save files * Check Tracker - Only reset variables if they are initialized * Check Tracker - Cleans up old comments, unused variables, methods, and macros, adds language TODOs, * Check Tracker - Readds rainbow UI elements after Cosmetics Editor refactor * Check Tracker - Removal of flag lookup that was refactored, no longer needed header, and some trivial whitespace fixes. * Check Tracker - Refactors Index to Bitmask code to a macro * Check Tracker - Changes ordering from alphabetical to RandomizerCheck ordering * Check Tracker - Wraps everything in a namespace to avoid global variable usage * Check Tracker - Explicitly defines for-loop scope * Check Tracker - refactors dungeon lookup from static array to function * Fixes a bug when using EnhancementColor with alpha * Check Tracker - Refactors all colour to use direct conversions * Check Tracker - refactors settings loading and check visibility for readability * Check Tracker - Fixes a bug where the wrong label showed on the Check Tracker BG Color * UIWidgets - Adds Alpha bar to EnhancementColor when using alpha parameter
2022-12-10 22:39:23 -05:00
case RCSHOW_SAVED:
Check Tracker Update (#2668) * Initial commit. What works so far: Data file loads, saves, deletes, and is created properly. - Need to run `HasItemBeenCollected` when creating in case of mid-seed regen. Organized checks into maps set by area. Areas show in tracker. - Checks pulled from checkObjectsByArea are not currently listed. - Areas are being assumed completed and hidden at the start. * Checks now populate. Still not counting area totals properly. * Don't track RC_LINKS_POCKET in the data file, and instead manually add it in every time a save is load. rcObjects doesn't contain Link's Pocket location (duh). * Moved ItemReceive hook to randomizer_check_tracker.cpp. Skipped items are properly sorted and formatted. Saved items contribute to an area's gotten/skipped checks on load. Changed skipped items default main color to gray. General code cleanup. * Skipped checks now contribute to area totals for area completion logic. * Mid-menu rework transfer. * Started check lookup on item receive. Tried to enable scum checking on save. * Fixed scum check on save. * More code cleanup, which revealed some issues with loading and saving. Loading now works 100%, but entries in checkTrackerData are disappearing in code somewhere, causing issues with later checks. Scummed color now displays properly. Collected but unsaved displays properly. Unchecked, Skipped, Seen and Scummed checks all have arrows for skipping/unskipping. Counts a little messed up, probably double adding skips. * Fixed item counts being off across resets. Restarts were fine. * Beginning of rework for individual check updates. Adds `Actor lastCheck` to PlayState to allow assigning of last actor to give an item. This allows precise tracking of GS, freestanding PoH, etc. Works for chests too. Currently does not work for shops, unknown for normal NPC gives. Doesn't track last gives for non-checks, like drops from grass, pots, crates, etc. * Actor-based checks fully fleshed out, but can't help with sale-based checks. Implemented `pendingSaleCheck` to back out of an RC check cycle if `gSaveContext->pendingSale` is not NONE when `OnItemReceive` is called, processed through `OnSaleEnd`. This should be the final change necessary to streamline the checks. * Temporary hook to message box close to tie in trackers for non-gs/chest actors that aren't added to `GetCheckFromActor`. This triggers a 2-frame countdown to check with `HasItemBeenCollected` since half of the methods in there aren't updated until after a text box closes. Added scene tracking to get last scene so that checks in scenes that span several overworld areas could be tied to their areas properly. Modified tracker data creation to apply Link's Pocket and Song from Impa conditionally based on randomizer settings instead of just being assumed to be done. May need modification for checking click and drag spoiler loading. Removed the scene equivalence check from CheckChecks so that an entire area is checked each time to avoid issues with, e.g., leaving a shop before a pending sale finishes. * Changed check data creation to use RSKs from gRandomizer to account for settings loaded from drag and drop spoilers. * Beginning of tracker code organization. Changed check color defaults. * Reverted moving tracker colors to header. Some individual check fixes. * Missed something from previous merge? * Removed last remnant of removed performance mode. * Better handle checking when skullsanity is off. * Song checks sceneIDs don't match the scenes they're actually in for some reason. Removed that check. * SaleEnd checks don't need the GetItemEntry parameter. Also set a flag that should prevent the check tracker from running during vanilla saves should that not be resolved by the time it's merged. * Attempting to have only the relevant checks added to the tracker data, as well as showing vanilla checks for non-rando saves. Not working yet (everything is displayed in vanilla). * Added vanilla check tracker population via `vanillaCheck` bool in `RandomizerCheckObject`. This is also added to `IsVisibleInImGui` to handle file loading and saving to eliminate checks that aren't part of vanilla or the rando seed. Implemented deleted tracker data file recreation. Added some extra item name text checks. Songs are still... tricky, so they stay blank. Utilize local copies of the randomizer check objects that are applicable for performance purposes. Fixed vanilla item-giving cutscene crashes when triggered mid-transition. * Apparently not all toolchains can handle macro instantiation without all parameters, like VS can. * Fixed scummed detail color not showing properly on tracker. * Fixed dungeon area totals and GS checks not functioning properly. * Major revamp of checking code. Doesn't rely on `GetCheckFromActor` at all anymore, but instead simply sets a flag to evaluate a number of checks in an area every frame until the check that was gotten is identified. With the new setup, it's much less hardware intensive, and at 60fps 6 checks per frame shows no noticeable effect on framerate. I can envision needing to add a collectedCount in order to account for times when two checks are gotten one right after the other. Changed area scroll to happen from `OnTransitionEnd`, and allow for scrolling in bazaar (was disabled previously because it would jump back and forth between Kak and Market while you were in one). Also setup area check order updating by area instead of all at the same time. * Fixed shooting gallery not reporting proper area. Prevent checks from actually happening if area is RCAREA_INVALID, now that all areas are reporting something if they have checks. Fixed `GetCheckArea()` not updating checks for standard scenes. Lots of vanilla tracking updates, mainly manual checks for gems, medallions and songs, since the often don't have proper scenes in the data. Prevent vanilla from triggering check loops if junk items are collected. Fixed sorting based on saved vs collected. Prevent item name display for vanilla runs. Change coloring of checks so the check name reflects status in vanilla runs. * Fixed "Recheck Area" button erroneously adding to an area's check totals? * Fix DMC vanilla checks. * Fix check tracker data recreation on data file loss. Removed redundant file exists check from SaveTrackerDataHook, as it doesn't matter if it exists or not at that point. Limited check loops to 3 to avoid infinite check loops on non-check/junk item pickup. Added more checks to disable tracker operations if a save is not running. Changed check ordering to put boss reward and heart container checks at the end of whatever RCSHOW group they belong to. * Fixed IsRunning calculation. Further improving vanilla checking. Starting framework for checking medallions, stones, and songs on data file recreation. Fixed medallion check collection. Added GIFT_FROM_SAGES to check list for vanilla file for tracking light medallion. Added check loop limitation to prevent infinite checking after picking up junk item from the ground. * Finished vanilla file recreation and recheck (songs and dungeon rewards all check properly now). This includes deku shield with KF shop item 3. Finished Gift from Raoru light medallion tracking for vanilla. Commented all CheckByScene functionality for now. * Fixed new save data file creation. Disabled entrance area calculation for now, as it only tracks the previous entrance for some reason. Fixed area detection for ToT checks. * GetCheckArea() now utilizes EntranceData almost exclusively, via either `gSaveContext.entranceIndex` or the entrance tracker's `currentGrottoId` in the case of grottos. This also means that EVERYTHING CAN AUTOSCROLL NOW. Entrance shuffles are now much easier to track. Autoscroll is now also triggered on save, just in case someone isn't autosaving and has a lot of checks that get converted to saved. * Fixed missing GS check in LW. * Added area scroll on toggling Show Hidden Items. May configure differently later. Fixed area detection for entrances in Gerudo Fortress/Valley and Collossus. Haunted wasteland doesn't autoscroll due to a bug in `OnTransitionEnd` hook, but checks still evaluate properly there. Rely on scene-based area detection if scene is a main overworld or dungeon scene. * Fixed grotto detection when shuffle is off. * Small code cleanup. Fixed Colossus hand chest checks. * Missing lus bump from merge conflict resolution * Fixed Colossus Grotto making `GetCheckArea` return Wasteland. * Improved OnItemReceive processing for non-token GS checks, since they can sometimes take long enough for the checking process to time out before the item is registered as received. * First attempt at thread safety for tracker data file writing. Seems to work, but might need more testing. * Fixed Recheck Area not unskipping items that register as saved. Improved delayed saving with autosaving, as the autosave triggered quite often before the tracker data save, making things not properly register as saved. * merge cleanup * Converted check tracker data to the sectional saves, adding `CheckTrackerData` to `SaveContext`. Implemented section ID returning and fullSave boolean passing to section functions from my PR temporarily for it to work properly. Moved `RandomizerCheckTrackerData` enum to `randomizerTypes.h` to accommodate that. Changed `Randomizer_SaveInit` to a `SaveManager::InitFunc` to allow for other randomizer-dependent sections to be initialized after that. Required a little refactoring to maintain intro cutscene skip when starting a randomizer file. * Revert section index return and randomizer init changes. Will need to wait on yet more changes to main. * Fixed check tracker initialization (shouldn't be tied to window initialization), restored saving/loading functionality. * Removed `CheckTracker::Init` and put SaveManager calls in `CheckTrackerWindow::InitElement`. Also a bit of cleanup from transition back to save file use. * Fixed tracker displaying check categories while file not loaded. * Fix Darunia's Joy check not marking in vanilla. * Fix autosave not triggering change from collected to saved in tracker data. * Changed default colors for scummed and collected display. * Merge upgrade code cleanup. * Add `OnTransitionEnd` calls to sandstorm transitions both to and from Wasteland. Also improved `gSaveContext.lastScene` assignment for both transition types. Allowed a bit of cleanup in `GetCheckArea`. * Added `StateButton`, a button like `ArrowButton` but that allows text instead of arrow icons. Apparently the changes from ArrowButton to StateButton happened in a previous commit... * Changed section name to `trackerDataCheck` to force SoH to load it after the randomizer section, as it required some randoSettings to be loaded first, and nothing else I tried to make the randomizer section load before it worked. This hacks a solution to checks not displaying on fast file load to a specific slot. F*** you, SaveManager, and f*** you too, JSON. * Forgot to change the section string for loading with the name change. * Fix check ordering for checks that trigger the autosave. * Adds option to remove right-side shop items (slots 1-4) from the tracker list. Enabled by default. * Fix default state of Hide Shop Right Checks checkbox. * Fixes grotto and great fairy scrolling and checks. Fixes array overflow from `checkTrackerData` which was creating the issue trying to load the base and randomizer sections first, among other things. That also fixed the massive file loads that were being exhibited in debug mode. * Fix shooting galleries being set as collected again when being played a second time after getting the checks. * Fix Bazaar autoscroll. * Add Saria's Song to `GetCheckFromActor` and removed some limitations from the messageCloseCheck function to make that check track properly. * Fix Song from Impa check. Implemented prevention for multiple "collections" of great fairies, just in case getting the health refill would trigger it with the previous setup. * Fix ice traps on GS tokens not triggering OnItemReceive. * Complete fix for ice trap collection from GS. Add autoscroll when clicking "Expand All". * Add `OnShopSlotChange` with cursorSlot and basePrice parameters. * Fixed include in en_ossan for shop slot hook. Added registration for `OnShopSlotChange` in the tracker, storing the price in a new `price` field in `CheckTrackerData`. Added "seen" functionality to shop checks. Displays the model item name upon first entering a shop, adding the price and switching to trickName (if it's an ice trap) upon navigating to the slot in buy mode, triggered by an invisible "identified" status that mirrors "seen" in every other way. Added tooltips to most options for check tracker color picking to describe what each status actually means. * `std::format` pls * So apparently std::format just decided to break with the latest merge from develop, but fmt::format exists and works? * Removed the last vestiges of `locationsSkipped`. Other general code and formatting cleanups. Moved `IsGameRunning` to `OTRGlobals` so the item tracker could also access it. Used preceding to "fix" item and bottle display in the item tracker on startup. * Some more code cleanup. Removed "Recheck Area" button and relevant code. Backported changes to Anchor branch applicable for single-player, including making a checkAreas vector and structuring the frame by frame checks around that. Also includes fix for Silver Gauntlets and Mirror Shield check collection crash associated with those changes. Fixed Kakariko Bazaar "seen" updates. Fixed tracker window not showing on initial load like it should. * Forgot 1 formatting fix. * Removed conditions for showing Song from Impa (isn't junk under certain conditions, so should show all the time). * Fix vanilla checks, add Zelda's Letter and Malon's Egg to manual check collection. Fix autoscroll while in child stealth section. * Fix crash in Happy Mask Shop in OnSlotChange (referenced non-existent shop id in a tracker-specific enum). * General code cleanup. * Missed one reversion. * One more. * Fix column alignment in `randomizer_check_objects`. * Fix file encoding on `randomizer_check_tracker`. Again. * Fix indentation for `actualItemtrackerItemMap`. Also removed unnecessary parts of the map. * Rename `HasEqItem` to `HasEquipment`. * Slightly better indentation for `actualItemTrackerItemMap`. * Add magic bean salesman to vanilla check tracking, and genericized deku shield to trigger KF shop item 3 wherever you get the shield. Renamed `vanillaCheck` to `vanillaHundoCheck` to (supposedly) clarify the meaning of the usage. * One more rename to `vanillaCompletion` to avoid possible confusion with 100% speedrun conditions. * give me a break XD Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * Changes suggested by briaguya (rename `RandomizerCheckShow` to `Status`, unused code, newline formatting) * Remove unused `itemNames` table. * Remove `IsGameRunning` in favor of `GameInteractor::IsSaveLoaded`. * Restore anti-spoiler functionality for dungeons with dungeon maps. * Review cleanup. * Fix prices not showing for Kak bazaar items. --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com>
2023-10-04 11:03:36 -04:00
case RCSHOW_COLLECTED:
Randomizer Auto Location tracker (#1942) * Initial Auto-Location Tracking * Updates styling for checked items in Check Tracker * Fixes crashing issues with Check Tracker rendering * Auto scroll Check Tracker windows to current area * Checks Tracker only shows checked locations once in game * Fixes issue where Check Tracker would auto-scroll to wrong location when entering a grotto * Fixes gerudo fortress checks showing in tracker when settings have them removed * InfTable Check Location Fixes: Lost Dog Richard, Rolling Gorons, HBA 1000, Thawed Zora * Fixes most Event Chk Inf Checks on Check Tracker, and Frogs * Check Tracker - Song from Malon now works * Check Tracker - Fixes Claim Check check not tracking - Fixes spoiler for Claim Check check when getting Biggoron's Sword - Fixes LACS being spoiled and not tracking * Check Tracker - Fixes #2 for Skull Mask and Mask of Truth checks * Check Tracker - Adds support for merchants - Fixes #7 for Bomchu Salesman - Fixes #12 for Medigoron * Check Tracker - Fixes #8 for Song from Saria * Check Tracker - Fixes #9 for Adult Shooting Gallery * Check Tracker - Fixes #10 for Composer Grave * Check Tracker - Fixes #14 for Song from Ocarina of Time * Check Tracker - Fixes #16 for Shooting the Sun * Check Tracker - Fixes #19 for Darunia's Joy * Save Editor - Adds missing label for Treasure Chest Game * Check Tracker - Fixes Great Faries checks * Check Tracker - Fixes Sheik at Temple * Check Tracker - Fixes Great Fairy auto-scroll to wrong location * Check Tracker - Updates blue warp checks - Fixes Bongo Bongo and Twinrova checks * Check Tracker - Fixes Dampe's Gravedigging Tour * Check Tracker - Fixes Prescription to King Zora * Check Tracker - Fixes Bazaar showing under wrong area on tracker between adult/child * Check Tracker - Fixes scroll for Hyrule Market and Bazaar * Check Tracker - Fixes giving Adult Trade Items shown on tracker: Broken Sword, Saw, Cojiro, Eyeball Froge, and Eyedrops * Cleans up item_location * Check Tracker - Item List - Fixes item list not updating when changing seeds/options - Separates item exclusion list from item check list - Clean up comments * Check Tracker - Adds Skip functionality to buttons * Check Tracker - Refactors adult trade items to RandomizerInf * Check Tracker - Fixes an issue where any time an item is removed the tracker would cause an application crash * Check Tracker - Item names are now dependent on file language * Check Tracker - Fixes Gerudo Card check not showing in Fast setting * Reorders headers to (hopefully) avoid CI build conflicts on linux/consoles * Explicitly defines vector header in randomizer.h to fix compile errors * Complete Refactor of Check Tracker ImGui * Adds missing check tracker files to CMakeLists * Reverts the Item_location whitespace cleanup from ad10807c * Check Tracker - Loading Fixes - Fixes a bug where loading a save file a second time would add all the checks again - Fixes a bug where the check tracker would not render at all until in a save file * Check Tracker - Fixes a bug where checks would sometimes fail to load * Check Tracker - Fixes duplicated checks when using Only on Pause or Only on Combo * Check Tracker - Works around issue where single characters don't show in EnhancementCombobox, and fixes a label for combo buttons held option * Check Tracker - Applies all Check Tracker changes to Item Location * Check Tracker - Updated Check List - Adds Link's pocket, either in KF or HM depending on starting age - Supports Scrubs and Merchants - Uses enums instead of magic numbers - Updates DC Scrub Short Names for MQ * Check Tracker - Adds a performance mode option * Check Tracker - List Fixes (requires new rando generation) - Fixes Frogs Rupees always visible - Fixes Kokiri Sword Chest not showing - Fixes Weird Egg not showing * Check Tracker - MQ List basic support * Check Tracker - MQ/Vanilla anti-spoilers * Check Tracker - Collecting a compass now spoils the area * Check Tracker - Basic Vanilla Support and fixes - Vanilla items show in check tracker, even if many won't auto check - Fixes an issue with Gerudo Fortress Keys - Refactors IsVisibleInCheckTracker to randomizer_check_tracjer * Check Tracker - Fixes merge conflict from 08a487f35e1d760ab9e69b932edbe4da6bcd9edb * Check Tracker - Fixes tracker loading as Floating when default value is set to Windowed * Randomizer Location Exclusion List - Adds Scrubs, Merchants, Shops. Adult Trade items, MQ Dungeons, and Bean Salesman - Fixes Kokiri Sword Chest, Weird Egg, and Frog Song Rupees from misbehaving - Updates Gerudo Fortress logic to be dependent on Open/Fast/Normal Fortress - Removes Invalid Check - Adds RO Enum for MQ settings - Updates magic values to RO enum * Location Exclusion List - Scrubs that are always randomized now always show on the list * For now, removes some extra code only needed for a Check Tracker. * Randomizer Location Exclusion List - Fixes Eyeball Frog from showing up when Adult Trade Items was off * Location Tracker - Updates Eyedrops to use RandomizerInf instead of Chest * Check Tracker - Fixes a bug where Link's Pocket item wasn't acting as checked for area item count * Check Tracker - Fixes a bug where Locations would incorrectly say Vanilla due to the first check in the area being a non-MQ check * Check Tracker - Fixes a crash when Check Tracker is docked but not visible * Check Tracker - Fixes areas being spoiled when loading different save files * Check Tracker - Only reset variables if they are initialized * Check Tracker - Cleans up old comments, unused variables, methods, and macros, adds language TODOs, * Check Tracker - Readds rainbow UI elements after Cosmetics Editor refactor * Check Tracker - Removal of flag lookup that was refactored, no longer needed header, and some trivial whitespace fixes. * Check Tracker - Refactors Index to Bitmask code to a macro * Check Tracker - Changes ordering from alphabetical to RandomizerCheck ordering * Check Tracker - Wraps everything in a namespace to avoid global variable usage * Check Tracker - Explicitly defines for-loop scope * Check Tracker - refactors dungeon lookup from static array to function * Fixes a bug when using EnhancementColor with alpha * Check Tracker - Refactors all colour to use direct conversions * Check Tracker - refactors settings loading and check visibility for readability * Check Tracker - Fixes a bug where the wrong label showed on the Check Tracker BG Color * UIWidgets - Adds Alpha bar to EnhancementColor when using alpha parameter
2022-12-10 22:39:23 -05:00
case RCSHOW_SCUMMED:
Check Tracker Update (#2668) * Initial commit. What works so far: Data file loads, saves, deletes, and is created properly. - Need to run `HasItemBeenCollected` when creating in case of mid-seed regen. Organized checks into maps set by area. Areas show in tracker. - Checks pulled from checkObjectsByArea are not currently listed. - Areas are being assumed completed and hidden at the start. * Checks now populate. Still not counting area totals properly. * Don't track RC_LINKS_POCKET in the data file, and instead manually add it in every time a save is load. rcObjects doesn't contain Link's Pocket location (duh). * Moved ItemReceive hook to randomizer_check_tracker.cpp. Skipped items are properly sorted and formatted. Saved items contribute to an area's gotten/skipped checks on load. Changed skipped items default main color to gray. General code cleanup. * Skipped checks now contribute to area totals for area completion logic. * Mid-menu rework transfer. * Started check lookup on item receive. Tried to enable scum checking on save. * Fixed scum check on save. * More code cleanup, which revealed some issues with loading and saving. Loading now works 100%, but entries in checkTrackerData are disappearing in code somewhere, causing issues with later checks. Scummed color now displays properly. Collected but unsaved displays properly. Unchecked, Skipped, Seen and Scummed checks all have arrows for skipping/unskipping. Counts a little messed up, probably double adding skips. * Fixed item counts being off across resets. Restarts were fine. * Beginning of rework for individual check updates. Adds `Actor lastCheck` to PlayState to allow assigning of last actor to give an item. This allows precise tracking of GS, freestanding PoH, etc. Works for chests too. Currently does not work for shops, unknown for normal NPC gives. Doesn't track last gives for non-checks, like drops from grass, pots, crates, etc. * Actor-based checks fully fleshed out, but can't help with sale-based checks. Implemented `pendingSaleCheck` to back out of an RC check cycle if `gSaveContext->pendingSale` is not NONE when `OnItemReceive` is called, processed through `OnSaleEnd`. This should be the final change necessary to streamline the checks. * Temporary hook to message box close to tie in trackers for non-gs/chest actors that aren't added to `GetCheckFromActor`. This triggers a 2-frame countdown to check with `HasItemBeenCollected` since half of the methods in there aren't updated until after a text box closes. Added scene tracking to get last scene so that checks in scenes that span several overworld areas could be tied to their areas properly. Modified tracker data creation to apply Link's Pocket and Song from Impa conditionally based on randomizer settings instead of just being assumed to be done. May need modification for checking click and drag spoiler loading. Removed the scene equivalence check from CheckChecks so that an entire area is checked each time to avoid issues with, e.g., leaving a shop before a pending sale finishes. * Changed check data creation to use RSKs from gRandomizer to account for settings loaded from drag and drop spoilers. * Beginning of tracker code organization. Changed check color defaults. * Reverted moving tracker colors to header. Some individual check fixes. * Missed something from previous merge? * Removed last remnant of removed performance mode. * Better handle checking when skullsanity is off. * Song checks sceneIDs don't match the scenes they're actually in for some reason. Removed that check. * SaleEnd checks don't need the GetItemEntry parameter. Also set a flag that should prevent the check tracker from running during vanilla saves should that not be resolved by the time it's merged. * Attempting to have only the relevant checks added to the tracker data, as well as showing vanilla checks for non-rando saves. Not working yet (everything is displayed in vanilla). * Added vanilla check tracker population via `vanillaCheck` bool in `RandomizerCheckObject`. This is also added to `IsVisibleInImGui` to handle file loading and saving to eliminate checks that aren't part of vanilla or the rando seed. Implemented deleted tracker data file recreation. Added some extra item name text checks. Songs are still... tricky, so they stay blank. Utilize local copies of the randomizer check objects that are applicable for performance purposes. Fixed vanilla item-giving cutscene crashes when triggered mid-transition. * Apparently not all toolchains can handle macro instantiation without all parameters, like VS can. * Fixed scummed detail color not showing properly on tracker. * Fixed dungeon area totals and GS checks not functioning properly. * Major revamp of checking code. Doesn't rely on `GetCheckFromActor` at all anymore, but instead simply sets a flag to evaluate a number of checks in an area every frame until the check that was gotten is identified. With the new setup, it's much less hardware intensive, and at 60fps 6 checks per frame shows no noticeable effect on framerate. I can envision needing to add a collectedCount in order to account for times when two checks are gotten one right after the other. Changed area scroll to happen from `OnTransitionEnd`, and allow for scrolling in bazaar (was disabled previously because it would jump back and forth between Kak and Market while you were in one). Also setup area check order updating by area instead of all at the same time. * Fixed shooting gallery not reporting proper area. Prevent checks from actually happening if area is RCAREA_INVALID, now that all areas are reporting something if they have checks. Fixed `GetCheckArea()` not updating checks for standard scenes. Lots of vanilla tracking updates, mainly manual checks for gems, medallions and songs, since the often don't have proper scenes in the data. Prevent vanilla from triggering check loops if junk items are collected. Fixed sorting based on saved vs collected. Prevent item name display for vanilla runs. Change coloring of checks so the check name reflects status in vanilla runs. * Fixed "Recheck Area" button erroneously adding to an area's check totals? * Fix DMC vanilla checks. * Fix check tracker data recreation on data file loss. Removed redundant file exists check from SaveTrackerDataHook, as it doesn't matter if it exists or not at that point. Limited check loops to 3 to avoid infinite check loops on non-check/junk item pickup. Added more checks to disable tracker operations if a save is not running. Changed check ordering to put boss reward and heart container checks at the end of whatever RCSHOW group they belong to. * Fixed IsRunning calculation. Further improving vanilla checking. Starting framework for checking medallions, stones, and songs on data file recreation. Fixed medallion check collection. Added GIFT_FROM_SAGES to check list for vanilla file for tracking light medallion. Added check loop limitation to prevent infinite checking after picking up junk item from the ground. * Finished vanilla file recreation and recheck (songs and dungeon rewards all check properly now). This includes deku shield with KF shop item 3. Finished Gift from Raoru light medallion tracking for vanilla. Commented all CheckByScene functionality for now. * Fixed new save data file creation. Disabled entrance area calculation for now, as it only tracks the previous entrance for some reason. Fixed area detection for ToT checks. * GetCheckArea() now utilizes EntranceData almost exclusively, via either `gSaveContext.entranceIndex` or the entrance tracker's `currentGrottoId` in the case of grottos. This also means that EVERYTHING CAN AUTOSCROLL NOW. Entrance shuffles are now much easier to track. Autoscroll is now also triggered on save, just in case someone isn't autosaving and has a lot of checks that get converted to saved. * Fixed missing GS check in LW. * Added area scroll on toggling Show Hidden Items. May configure differently later. Fixed area detection for entrances in Gerudo Fortress/Valley and Collossus. Haunted wasteland doesn't autoscroll due to a bug in `OnTransitionEnd` hook, but checks still evaluate properly there. Rely on scene-based area detection if scene is a main overworld or dungeon scene. * Fixed grotto detection when shuffle is off. * Small code cleanup. Fixed Colossus hand chest checks. * Missing lus bump from merge conflict resolution * Fixed Colossus Grotto making `GetCheckArea` return Wasteland. * Improved OnItemReceive processing for non-token GS checks, since they can sometimes take long enough for the checking process to time out before the item is registered as received. * First attempt at thread safety for tracker data file writing. Seems to work, but might need more testing. * Fixed Recheck Area not unskipping items that register as saved. Improved delayed saving with autosaving, as the autosave triggered quite often before the tracker data save, making things not properly register as saved. * merge cleanup * Converted check tracker data to the sectional saves, adding `CheckTrackerData` to `SaveContext`. Implemented section ID returning and fullSave boolean passing to section functions from my PR temporarily for it to work properly. Moved `RandomizerCheckTrackerData` enum to `randomizerTypes.h` to accommodate that. Changed `Randomizer_SaveInit` to a `SaveManager::InitFunc` to allow for other randomizer-dependent sections to be initialized after that. Required a little refactoring to maintain intro cutscene skip when starting a randomizer file. * Revert section index return and randomizer init changes. Will need to wait on yet more changes to main. * Fixed check tracker initialization (shouldn't be tied to window initialization), restored saving/loading functionality. * Removed `CheckTracker::Init` and put SaveManager calls in `CheckTrackerWindow::InitElement`. Also a bit of cleanup from transition back to save file use. * Fixed tracker displaying check categories while file not loaded. * Fix Darunia's Joy check not marking in vanilla. * Fix autosave not triggering change from collected to saved in tracker data. * Changed default colors for scummed and collected display. * Merge upgrade code cleanup. * Add `OnTransitionEnd` calls to sandstorm transitions both to and from Wasteland. Also improved `gSaveContext.lastScene` assignment for both transition types. Allowed a bit of cleanup in `GetCheckArea`. * Added `StateButton`, a button like `ArrowButton` but that allows text instead of arrow icons. Apparently the changes from ArrowButton to StateButton happened in a previous commit... * Changed section name to `trackerDataCheck` to force SoH to load it after the randomizer section, as it required some randoSettings to be loaded first, and nothing else I tried to make the randomizer section load before it worked. This hacks a solution to checks not displaying on fast file load to a specific slot. F*** you, SaveManager, and f*** you too, JSON. * Forgot to change the section string for loading with the name change. * Fix check ordering for checks that trigger the autosave. * Adds option to remove right-side shop items (slots 1-4) from the tracker list. Enabled by default. * Fix default state of Hide Shop Right Checks checkbox. * Fixes grotto and great fairy scrolling and checks. Fixes array overflow from `checkTrackerData` which was creating the issue trying to load the base and randomizer sections first, among other things. That also fixed the massive file loads that were being exhibited in debug mode. * Fix shooting galleries being set as collected again when being played a second time after getting the checks. * Fix Bazaar autoscroll. * Add Saria's Song to `GetCheckFromActor` and removed some limitations from the messageCloseCheck function to make that check track properly. * Fix Song from Impa check. Implemented prevention for multiple "collections" of great fairies, just in case getting the health refill would trigger it with the previous setup. * Fix ice traps on GS tokens not triggering OnItemReceive. * Complete fix for ice trap collection from GS. Add autoscroll when clicking "Expand All". * Add `OnShopSlotChange` with cursorSlot and basePrice parameters. * Fixed include in en_ossan for shop slot hook. Added registration for `OnShopSlotChange` in the tracker, storing the price in a new `price` field in `CheckTrackerData`. Added "seen" functionality to shop checks. Displays the model item name upon first entering a shop, adding the price and switching to trickName (if it's an ice trap) upon navigating to the slot in buy mode, triggered by an invisible "identified" status that mirrors "seen" in every other way. Added tooltips to most options for check tracker color picking to describe what each status actually means. * `std::format` pls * So apparently std::format just decided to break with the latest merge from develop, but fmt::format exists and works? * Removed the last vestiges of `locationsSkipped`. Other general code and formatting cleanups. Moved `IsGameRunning` to `OTRGlobals` so the item tracker could also access it. Used preceding to "fix" item and bottle display in the item tracker on startup. * Some more code cleanup. Removed "Recheck Area" button and relevant code. Backported changes to Anchor branch applicable for single-player, including making a checkAreas vector and structuring the frame by frame checks around that. Also includes fix for Silver Gauntlets and Mirror Shield check collection crash associated with those changes. Fixed Kakariko Bazaar "seen" updates. Fixed tracker window not showing on initial load like it should. * Forgot 1 formatting fix. * Removed conditions for showing Song from Impa (isn't junk under certain conditions, so should show all the time). * Fix vanilla checks, add Zelda's Letter and Malon's Egg to manual check collection. Fix autoscroll while in child stealth section. * Fix crash in Happy Mask Shop in OnSlotChange (referenced non-existent shop id in a tracker-specific enum). * General code cleanup. * Missed one reversion. * One more. * Fix column alignment in `randomizer_check_objects`. * Fix file encoding on `randomizer_check_tracker`. Again. * Fix indentation for `actualItemtrackerItemMap`. Also removed unnecessary parts of the map. * Rename `HasEqItem` to `HasEquipment`. * Slightly better indentation for `actualItemTrackerItemMap`. * Add magic bean salesman to vanilla check tracking, and genericized deku shield to trigger KF shop item 3 wherever you get the shield. Renamed `vanillaCheck` to `vanillaHundoCheck` to (supposedly) clarify the meaning of the usage. * One more rename to `vanillaCompletion` to avoid possible confusion with 100% speedrun conditions. * give me a break XD Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * Changes suggested by briaguya (rename `RandomizerCheckShow` to `Status`, unused code, newline formatting) * Remove unused `itemNames` table. * Remove `IsGameRunning` in favor of `GameInteractor::IsSaveLoaded`. * Restore anti-spoiler functionality for dungeons with dungeon maps. * Review cleanup. * Fix prices not showing for Kak bazaar items. --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com>
2023-10-04 11:03:36 -04:00
if (IS_RANDO) {
txt = OTRGlobals::Instance->gRandomizer->EnumToSpoilerfileGetName[gSaveContext.itemLocations[rcObj.rc].get.rgID][gSaveContext.language];
} else {
if (IsHeartPiece(rcObj.ogItemId)) {
if (gSaveContext.language == LANGUAGE_ENG || gSaveContext.language == LANGUAGE_GER) {
txt = ItemFromGIID(rcObj.ogItemId).GetName().english;
} else if (gSaveContext.language == LANGUAGE_FRA) {
txt = ItemFromGIID(rcObj.ogItemId).GetName().french;
}
}
}
Randomizer Auto Location tracker (#1942) * Initial Auto-Location Tracking * Updates styling for checked items in Check Tracker * Fixes crashing issues with Check Tracker rendering * Auto scroll Check Tracker windows to current area * Checks Tracker only shows checked locations once in game * Fixes issue where Check Tracker would auto-scroll to wrong location when entering a grotto * Fixes gerudo fortress checks showing in tracker when settings have them removed * InfTable Check Location Fixes: Lost Dog Richard, Rolling Gorons, HBA 1000, Thawed Zora * Fixes most Event Chk Inf Checks on Check Tracker, and Frogs * Check Tracker - Song from Malon now works * Check Tracker - Fixes Claim Check check not tracking - Fixes spoiler for Claim Check check when getting Biggoron's Sword - Fixes LACS being spoiled and not tracking * Check Tracker - Fixes #2 for Skull Mask and Mask of Truth checks * Check Tracker - Adds support for merchants - Fixes #7 for Bomchu Salesman - Fixes #12 for Medigoron * Check Tracker - Fixes #8 for Song from Saria * Check Tracker - Fixes #9 for Adult Shooting Gallery * Check Tracker - Fixes #10 for Composer Grave * Check Tracker - Fixes #14 for Song from Ocarina of Time * Check Tracker - Fixes #16 for Shooting the Sun * Check Tracker - Fixes #19 for Darunia's Joy * Save Editor - Adds missing label for Treasure Chest Game * Check Tracker - Fixes Great Faries checks * Check Tracker - Fixes Sheik at Temple * Check Tracker - Fixes Great Fairy auto-scroll to wrong location * Check Tracker - Updates blue warp checks - Fixes Bongo Bongo and Twinrova checks * Check Tracker - Fixes Dampe's Gravedigging Tour * Check Tracker - Fixes Prescription to King Zora * Check Tracker - Fixes Bazaar showing under wrong area on tracker between adult/child * Check Tracker - Fixes scroll for Hyrule Market and Bazaar * Check Tracker - Fixes giving Adult Trade Items shown on tracker: Broken Sword, Saw, Cojiro, Eyeball Froge, and Eyedrops * Cleans up item_location * Check Tracker - Item List - Fixes item list not updating when changing seeds/options - Separates item exclusion list from item check list - Clean up comments * Check Tracker - Adds Skip functionality to buttons * Check Tracker - Refactors adult trade items to RandomizerInf * Check Tracker - Fixes an issue where any time an item is removed the tracker would cause an application crash * Check Tracker - Item names are now dependent on file language * Check Tracker - Fixes Gerudo Card check not showing in Fast setting * Reorders headers to (hopefully) avoid CI build conflicts on linux/consoles * Explicitly defines vector header in randomizer.h to fix compile errors * Complete Refactor of Check Tracker ImGui * Adds missing check tracker files to CMakeLists * Reverts the Item_location whitespace cleanup from ad10807c * Check Tracker - Loading Fixes - Fixes a bug where loading a save file a second time would add all the checks again - Fixes a bug where the check tracker would not render at all until in a save file * Check Tracker - Fixes a bug where checks would sometimes fail to load * Check Tracker - Fixes duplicated checks when using Only on Pause or Only on Combo * Check Tracker - Works around issue where single characters don't show in EnhancementCombobox, and fixes a label for combo buttons held option * Check Tracker - Applies all Check Tracker changes to Item Location * Check Tracker - Updated Check List - Adds Link's pocket, either in KF or HM depending on starting age - Supports Scrubs and Merchants - Uses enums instead of magic numbers - Updates DC Scrub Short Names for MQ * Check Tracker - Adds a performance mode option * Check Tracker - List Fixes (requires new rando generation) - Fixes Frogs Rupees always visible - Fixes Kokiri Sword Chest not showing - Fixes Weird Egg not showing * Check Tracker - MQ List basic support * Check Tracker - MQ/Vanilla anti-spoilers * Check Tracker - Collecting a compass now spoils the area * Check Tracker - Basic Vanilla Support and fixes - Vanilla items show in check tracker, even if many won't auto check - Fixes an issue with Gerudo Fortress Keys - Refactors IsVisibleInCheckTracker to randomizer_check_tracjer * Check Tracker - Fixes merge conflict from 08a487f35e1d760ab9e69b932edbe4da6bcd9edb * Check Tracker - Fixes tracker loading as Floating when default value is set to Windowed * Randomizer Location Exclusion List - Adds Scrubs, Merchants, Shops. Adult Trade items, MQ Dungeons, and Bean Salesman - Fixes Kokiri Sword Chest, Weird Egg, and Frog Song Rupees from misbehaving - Updates Gerudo Fortress logic to be dependent on Open/Fast/Normal Fortress - Removes Invalid Check - Adds RO Enum for MQ settings - Updates magic values to RO enum * Location Exclusion List - Scrubs that are always randomized now always show on the list * For now, removes some extra code only needed for a Check Tracker. * Randomizer Location Exclusion List - Fixes Eyeball Frog from showing up when Adult Trade Items was off * Location Tracker - Updates Eyedrops to use RandomizerInf instead of Chest * Check Tracker - Fixes a bug where Link's Pocket item wasn't acting as checked for area item count * Check Tracker - Fixes a bug where Locations would incorrectly say Vanilla due to the first check in the area being a non-MQ check * Check Tracker - Fixes a crash when Check Tracker is docked but not visible * Check Tracker - Fixes areas being spoiled when loading different save files * Check Tracker - Only reset variables if they are initialized * Check Tracker - Cleans up old comments, unused variables, methods, and macros, adds language TODOs, * Check Tracker - Readds rainbow UI elements after Cosmetics Editor refactor * Check Tracker - Removal of flag lookup that was refactored, no longer needed header, and some trivial whitespace fixes. * Check Tracker - Refactors Index to Bitmask code to a macro * Check Tracker - Changes ordering from alphabetical to RandomizerCheck ordering * Check Tracker - Wraps everything in a namespace to avoid global variable usage * Check Tracker - Explicitly defines for-loop scope * Check Tracker - refactors dungeon lookup from static array to function * Fixes a bug when using EnhancementColor with alpha * Check Tracker - Refactors all colour to use direct conversions * Check Tracker - refactors settings loading and check visibility for readability * Check Tracker - Fixes a bug where the wrong label showed on the Check Tracker BG Color * UIWidgets - Adds Alpha bar to EnhancementColor when using alpha parameter
2022-12-10 22:39:23 -05:00
break;
Check Tracker Update (#2668) * Initial commit. What works so far: Data file loads, saves, deletes, and is created properly. - Need to run `HasItemBeenCollected` when creating in case of mid-seed regen. Organized checks into maps set by area. Areas show in tracker. - Checks pulled from checkObjectsByArea are not currently listed. - Areas are being assumed completed and hidden at the start. * Checks now populate. Still not counting area totals properly. * Don't track RC_LINKS_POCKET in the data file, and instead manually add it in every time a save is load. rcObjects doesn't contain Link's Pocket location (duh). * Moved ItemReceive hook to randomizer_check_tracker.cpp. Skipped items are properly sorted and formatted. Saved items contribute to an area's gotten/skipped checks on load. Changed skipped items default main color to gray. General code cleanup. * Skipped checks now contribute to area totals for area completion logic. * Mid-menu rework transfer. * Started check lookup on item receive. Tried to enable scum checking on save. * Fixed scum check on save. * More code cleanup, which revealed some issues with loading and saving. Loading now works 100%, but entries in checkTrackerData are disappearing in code somewhere, causing issues with later checks. Scummed color now displays properly. Collected but unsaved displays properly. Unchecked, Skipped, Seen and Scummed checks all have arrows for skipping/unskipping. Counts a little messed up, probably double adding skips. * Fixed item counts being off across resets. Restarts were fine. * Beginning of rework for individual check updates. Adds `Actor lastCheck` to PlayState to allow assigning of last actor to give an item. This allows precise tracking of GS, freestanding PoH, etc. Works for chests too. Currently does not work for shops, unknown for normal NPC gives. Doesn't track last gives for non-checks, like drops from grass, pots, crates, etc. * Actor-based checks fully fleshed out, but can't help with sale-based checks. Implemented `pendingSaleCheck` to back out of an RC check cycle if `gSaveContext->pendingSale` is not NONE when `OnItemReceive` is called, processed through `OnSaleEnd`. This should be the final change necessary to streamline the checks. * Temporary hook to message box close to tie in trackers for non-gs/chest actors that aren't added to `GetCheckFromActor`. This triggers a 2-frame countdown to check with `HasItemBeenCollected` since half of the methods in there aren't updated until after a text box closes. Added scene tracking to get last scene so that checks in scenes that span several overworld areas could be tied to their areas properly. Modified tracker data creation to apply Link's Pocket and Song from Impa conditionally based on randomizer settings instead of just being assumed to be done. May need modification for checking click and drag spoiler loading. Removed the scene equivalence check from CheckChecks so that an entire area is checked each time to avoid issues with, e.g., leaving a shop before a pending sale finishes. * Changed check data creation to use RSKs from gRandomizer to account for settings loaded from drag and drop spoilers. * Beginning of tracker code organization. Changed check color defaults. * Reverted moving tracker colors to header. Some individual check fixes. * Missed something from previous merge? * Removed last remnant of removed performance mode. * Better handle checking when skullsanity is off. * Song checks sceneIDs don't match the scenes they're actually in for some reason. Removed that check. * SaleEnd checks don't need the GetItemEntry parameter. Also set a flag that should prevent the check tracker from running during vanilla saves should that not be resolved by the time it's merged. * Attempting to have only the relevant checks added to the tracker data, as well as showing vanilla checks for non-rando saves. Not working yet (everything is displayed in vanilla). * Added vanilla check tracker population via `vanillaCheck` bool in `RandomizerCheckObject`. This is also added to `IsVisibleInImGui` to handle file loading and saving to eliminate checks that aren't part of vanilla or the rando seed. Implemented deleted tracker data file recreation. Added some extra item name text checks. Songs are still... tricky, so they stay blank. Utilize local copies of the randomizer check objects that are applicable for performance purposes. Fixed vanilla item-giving cutscene crashes when triggered mid-transition. * Apparently not all toolchains can handle macro instantiation without all parameters, like VS can. * Fixed scummed detail color not showing properly on tracker. * Fixed dungeon area totals and GS checks not functioning properly. * Major revamp of checking code. Doesn't rely on `GetCheckFromActor` at all anymore, but instead simply sets a flag to evaluate a number of checks in an area every frame until the check that was gotten is identified. With the new setup, it's much less hardware intensive, and at 60fps 6 checks per frame shows no noticeable effect on framerate. I can envision needing to add a collectedCount in order to account for times when two checks are gotten one right after the other. Changed area scroll to happen from `OnTransitionEnd`, and allow for scrolling in bazaar (was disabled previously because it would jump back and forth between Kak and Market while you were in one). Also setup area check order updating by area instead of all at the same time. * Fixed shooting gallery not reporting proper area. Prevent checks from actually happening if area is RCAREA_INVALID, now that all areas are reporting something if they have checks. Fixed `GetCheckArea()` not updating checks for standard scenes. Lots of vanilla tracking updates, mainly manual checks for gems, medallions and songs, since the often don't have proper scenes in the data. Prevent vanilla from triggering check loops if junk items are collected. Fixed sorting based on saved vs collected. Prevent item name display for vanilla runs. Change coloring of checks so the check name reflects status in vanilla runs. * Fixed "Recheck Area" button erroneously adding to an area's check totals? * Fix DMC vanilla checks. * Fix check tracker data recreation on data file loss. Removed redundant file exists check from SaveTrackerDataHook, as it doesn't matter if it exists or not at that point. Limited check loops to 3 to avoid infinite check loops on non-check/junk item pickup. Added more checks to disable tracker operations if a save is not running. Changed check ordering to put boss reward and heart container checks at the end of whatever RCSHOW group they belong to. * Fixed IsRunning calculation. Further improving vanilla checking. Starting framework for checking medallions, stones, and songs on data file recreation. Fixed medallion check collection. Added GIFT_FROM_SAGES to check list for vanilla file for tracking light medallion. Added check loop limitation to prevent infinite checking after picking up junk item from the ground. * Finished vanilla file recreation and recheck (songs and dungeon rewards all check properly now). This includes deku shield with KF shop item 3. Finished Gift from Raoru light medallion tracking for vanilla. Commented all CheckByScene functionality for now. * Fixed new save data file creation. Disabled entrance area calculation for now, as it only tracks the previous entrance for some reason. Fixed area detection for ToT checks. * GetCheckArea() now utilizes EntranceData almost exclusively, via either `gSaveContext.entranceIndex` or the entrance tracker's `currentGrottoId` in the case of grottos. This also means that EVERYTHING CAN AUTOSCROLL NOW. Entrance shuffles are now much easier to track. Autoscroll is now also triggered on save, just in case someone isn't autosaving and has a lot of checks that get converted to saved. * Fixed missing GS check in LW. * Added area scroll on toggling Show Hidden Items. May configure differently later. Fixed area detection for entrances in Gerudo Fortress/Valley and Collossus. Haunted wasteland doesn't autoscroll due to a bug in `OnTransitionEnd` hook, but checks still evaluate properly there. Rely on scene-based area detection if scene is a main overworld or dungeon scene. * Fixed grotto detection when shuffle is off. * Small code cleanup. Fixed Colossus hand chest checks. * Missing lus bump from merge conflict resolution * Fixed Colossus Grotto making `GetCheckArea` return Wasteland. * Improved OnItemReceive processing for non-token GS checks, since they can sometimes take long enough for the checking process to time out before the item is registered as received. * First attempt at thread safety for tracker data file writing. Seems to work, but might need more testing. * Fixed Recheck Area not unskipping items that register as saved. Improved delayed saving with autosaving, as the autosave triggered quite often before the tracker data save, making things not properly register as saved. * merge cleanup * Converted check tracker data to the sectional saves, adding `CheckTrackerData` to `SaveContext`. Implemented section ID returning and fullSave boolean passing to section functions from my PR temporarily for it to work properly. Moved `RandomizerCheckTrackerData` enum to `randomizerTypes.h` to accommodate that. Changed `Randomizer_SaveInit` to a `SaveManager::InitFunc` to allow for other randomizer-dependent sections to be initialized after that. Required a little refactoring to maintain intro cutscene skip when starting a randomizer file. * Revert section index return and randomizer init changes. Will need to wait on yet more changes to main. * Fixed check tracker initialization (shouldn't be tied to window initialization), restored saving/loading functionality. * Removed `CheckTracker::Init` and put SaveManager calls in `CheckTrackerWindow::InitElement`. Also a bit of cleanup from transition back to save file use. * Fixed tracker displaying check categories while file not loaded. * Fix Darunia's Joy check not marking in vanilla. * Fix autosave not triggering change from collected to saved in tracker data. * Changed default colors for scummed and collected display. * Merge upgrade code cleanup. * Add `OnTransitionEnd` calls to sandstorm transitions both to and from Wasteland. Also improved `gSaveContext.lastScene` assignment for both transition types. Allowed a bit of cleanup in `GetCheckArea`. * Added `StateButton`, a button like `ArrowButton` but that allows text instead of arrow icons. Apparently the changes from ArrowButton to StateButton happened in a previous commit... * Changed section name to `trackerDataCheck` to force SoH to load it after the randomizer section, as it required some randoSettings to be loaded first, and nothing else I tried to make the randomizer section load before it worked. This hacks a solution to checks not displaying on fast file load to a specific slot. F*** you, SaveManager, and f*** you too, JSON. * Forgot to change the section string for loading with the name change. * Fix check ordering for checks that trigger the autosave. * Adds option to remove right-side shop items (slots 1-4) from the tracker list. Enabled by default. * Fix default state of Hide Shop Right Checks checkbox. * Fixes grotto and great fairy scrolling and checks. Fixes array overflow from `checkTrackerData` which was creating the issue trying to load the base and randomizer sections first, among other things. That also fixed the massive file loads that were being exhibited in debug mode. * Fix shooting galleries being set as collected again when being played a second time after getting the checks. * Fix Bazaar autoscroll. * Add Saria's Song to `GetCheckFromActor` and removed some limitations from the messageCloseCheck function to make that check track properly. * Fix Song from Impa check. Implemented prevention for multiple "collections" of great fairies, just in case getting the health refill would trigger it with the previous setup. * Fix ice traps on GS tokens not triggering OnItemReceive. * Complete fix for ice trap collection from GS. Add autoscroll when clicking "Expand All". * Add `OnShopSlotChange` with cursorSlot and basePrice parameters. * Fixed include in en_ossan for shop slot hook. Added registration for `OnShopSlotChange` in the tracker, storing the price in a new `price` field in `CheckTrackerData`. Added "seen" functionality to shop checks. Displays the model item name upon first entering a shop, adding the price and switching to trickName (if it's an ice trap) upon navigating to the slot in buy mode, triggered by an invisible "identified" status that mirrors "seen" in every other way. Added tooltips to most options for check tracker color picking to describe what each status actually means. * `std::format` pls * So apparently std::format just decided to break with the latest merge from develop, but fmt::format exists and works? * Removed the last vestiges of `locationsSkipped`. Other general code and formatting cleanups. Moved `IsGameRunning` to `OTRGlobals` so the item tracker could also access it. Used preceding to "fix" item and bottle display in the item tracker on startup. * Some more code cleanup. Removed "Recheck Area" button and relevant code. Backported changes to Anchor branch applicable for single-player, including making a checkAreas vector and structuring the frame by frame checks around that. Also includes fix for Silver Gauntlets and Mirror Shield check collection crash associated with those changes. Fixed Kakariko Bazaar "seen" updates. Fixed tracker window not showing on initial load like it should. * Forgot 1 formatting fix. * Removed conditions for showing Song from Impa (isn't junk under certain conditions, so should show all the time). * Fix vanilla checks, add Zelda's Letter and Malon's Egg to manual check collection. Fix autoscroll while in child stealth section. * Fix crash in Happy Mask Shop in OnSlotChange (referenced non-existent shop id in a tracker-specific enum). * General code cleanup. * Missed one reversion. * One more. * Fix column alignment in `randomizer_check_objects`. * Fix file encoding on `randomizer_check_tracker`. Again. * Fix indentation for `actualItemtrackerItemMap`. Also removed unnecessary parts of the map. * Rename `HasEqItem` to `HasEquipment`. * Slightly better indentation for `actualItemTrackerItemMap`. * Add magic bean salesman to vanilla check tracking, and genericized deku shield to trigger KF shop item 3 wherever you get the shield. Renamed `vanillaCheck` to `vanillaHundoCheck` to (supposedly) clarify the meaning of the usage. * One more rename to `vanillaCompletion` to avoid possible confusion with 100% speedrun conditions. * give me a break XD Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * Changes suggested by briaguya (rename `RandomizerCheckShow` to `Status`, unused code, newline formatting) * Remove unused `itemNames` table. * Remove `IsGameRunning` in favor of `GameInteractor::IsSaveLoaded`. * Restore anti-spoiler functionality for dungeons with dungeon maps. * Review cleanup. * Fix prices not showing for Kak bazaar items. --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com>
2023-10-04 11:03:36 -04:00
case RCSHOW_IDENTIFIED:
Randomizer Auto Location tracker (#1942) * Initial Auto-Location Tracking * Updates styling for checked items in Check Tracker * Fixes crashing issues with Check Tracker rendering * Auto scroll Check Tracker windows to current area * Checks Tracker only shows checked locations once in game * Fixes issue where Check Tracker would auto-scroll to wrong location when entering a grotto * Fixes gerudo fortress checks showing in tracker when settings have them removed * InfTable Check Location Fixes: Lost Dog Richard, Rolling Gorons, HBA 1000, Thawed Zora * Fixes most Event Chk Inf Checks on Check Tracker, and Frogs * Check Tracker - Song from Malon now works * Check Tracker - Fixes Claim Check check not tracking - Fixes spoiler for Claim Check check when getting Biggoron's Sword - Fixes LACS being spoiled and not tracking * Check Tracker - Fixes #2 for Skull Mask and Mask of Truth checks * Check Tracker - Adds support for merchants - Fixes #7 for Bomchu Salesman - Fixes #12 for Medigoron * Check Tracker - Fixes #8 for Song from Saria * Check Tracker - Fixes #9 for Adult Shooting Gallery * Check Tracker - Fixes #10 for Composer Grave * Check Tracker - Fixes #14 for Song from Ocarina of Time * Check Tracker - Fixes #16 for Shooting the Sun * Check Tracker - Fixes #19 for Darunia's Joy * Save Editor - Adds missing label for Treasure Chest Game * Check Tracker - Fixes Great Faries checks * Check Tracker - Fixes Sheik at Temple * Check Tracker - Fixes Great Fairy auto-scroll to wrong location * Check Tracker - Updates blue warp checks - Fixes Bongo Bongo and Twinrova checks * Check Tracker - Fixes Dampe's Gravedigging Tour * Check Tracker - Fixes Prescription to King Zora * Check Tracker - Fixes Bazaar showing under wrong area on tracker between adult/child * Check Tracker - Fixes scroll for Hyrule Market and Bazaar * Check Tracker - Fixes giving Adult Trade Items shown on tracker: Broken Sword, Saw, Cojiro, Eyeball Froge, and Eyedrops * Cleans up item_location * Check Tracker - Item List - Fixes item list not updating when changing seeds/options - Separates item exclusion list from item check list - Clean up comments * Check Tracker - Adds Skip functionality to buttons * Check Tracker - Refactors adult trade items to RandomizerInf * Check Tracker - Fixes an issue where any time an item is removed the tracker would cause an application crash * Check Tracker - Item names are now dependent on file language * Check Tracker - Fixes Gerudo Card check not showing in Fast setting * Reorders headers to (hopefully) avoid CI build conflicts on linux/consoles * Explicitly defines vector header in randomizer.h to fix compile errors * Complete Refactor of Check Tracker ImGui * Adds missing check tracker files to CMakeLists * Reverts the Item_location whitespace cleanup from ad10807c * Check Tracker - Loading Fixes - Fixes a bug where loading a save file a second time would add all the checks again - Fixes a bug where the check tracker would not render at all until in a save file * Check Tracker - Fixes a bug where checks would sometimes fail to load * Check Tracker - Fixes duplicated checks when using Only on Pause or Only on Combo * Check Tracker - Works around issue where single characters don't show in EnhancementCombobox, and fixes a label for combo buttons held option * Check Tracker - Applies all Check Tracker changes to Item Location * Check Tracker - Updated Check List - Adds Link's pocket, either in KF or HM depending on starting age - Supports Scrubs and Merchants - Uses enums instead of magic numbers - Updates DC Scrub Short Names for MQ * Check Tracker - Adds a performance mode option * Check Tracker - List Fixes (requires new rando generation) - Fixes Frogs Rupees always visible - Fixes Kokiri Sword Chest not showing - Fixes Weird Egg not showing * Check Tracker - MQ List basic support * Check Tracker - MQ/Vanilla anti-spoilers * Check Tracker - Collecting a compass now spoils the area * Check Tracker - Basic Vanilla Support and fixes - Vanilla items show in check tracker, even if many won't auto check - Fixes an issue with Gerudo Fortress Keys - Refactors IsVisibleInCheckTracker to randomizer_check_tracjer * Check Tracker - Fixes merge conflict from 08a487f35e1d760ab9e69b932edbe4da6bcd9edb * Check Tracker - Fixes tracker loading as Floating when default value is set to Windowed * Randomizer Location Exclusion List - Adds Scrubs, Merchants, Shops. Adult Trade items, MQ Dungeons, and Bean Salesman - Fixes Kokiri Sword Chest, Weird Egg, and Frog Song Rupees from misbehaving - Updates Gerudo Fortress logic to be dependent on Open/Fast/Normal Fortress - Removes Invalid Check - Adds RO Enum for MQ settings - Updates magic values to RO enum * Location Exclusion List - Scrubs that are always randomized now always show on the list * For now, removes some extra code only needed for a Check Tracker. * Randomizer Location Exclusion List - Fixes Eyeball Frog from showing up when Adult Trade Items was off * Location Tracker - Updates Eyedrops to use RandomizerInf instead of Chest * Check Tracker - Fixes a bug where Link's Pocket item wasn't acting as checked for area item count * Check Tracker - Fixes a bug where Locations would incorrectly say Vanilla due to the first check in the area being a non-MQ check * Check Tracker - Fixes a crash when Check Tracker is docked but not visible * Check Tracker - Fixes areas being spoiled when loading different save files * Check Tracker - Only reset variables if they are initialized * Check Tracker - Cleans up old comments, unused variables, methods, and macros, adds language TODOs, * Check Tracker - Readds rainbow UI elements after Cosmetics Editor refactor * Check Tracker - Removal of flag lookup that was refactored, no longer needed header, and some trivial whitespace fixes. * Check Tracker - Refactors Index to Bitmask code to a macro * Check Tracker - Changes ordering from alphabetical to RandomizerCheck ordering * Check Tracker - Wraps everything in a namespace to avoid global variable usage * Check Tracker - Explicitly defines for-loop scope * Check Tracker - refactors dungeon lookup from static array to function * Fixes a bug when using EnhancementColor with alpha * Check Tracker - Refactors all colour to use direct conversions * Check Tracker - refactors settings loading and check visibility for readability * Check Tracker - Fixes a bug where the wrong label showed on the Check Tracker BG Color * UIWidgets - Adds Alpha bar to EnhancementColor when using alpha parameter
2022-12-10 22:39:23 -05:00
case RCSHOW_SEEN:
Check Tracker Update (#2668) * Initial commit. What works so far: Data file loads, saves, deletes, and is created properly. - Need to run `HasItemBeenCollected` when creating in case of mid-seed regen. Organized checks into maps set by area. Areas show in tracker. - Checks pulled from checkObjectsByArea are not currently listed. - Areas are being assumed completed and hidden at the start. * Checks now populate. Still not counting area totals properly. * Don't track RC_LINKS_POCKET in the data file, and instead manually add it in every time a save is load. rcObjects doesn't contain Link's Pocket location (duh). * Moved ItemReceive hook to randomizer_check_tracker.cpp. Skipped items are properly sorted and formatted. Saved items contribute to an area's gotten/skipped checks on load. Changed skipped items default main color to gray. General code cleanup. * Skipped checks now contribute to area totals for area completion logic. * Mid-menu rework transfer. * Started check lookup on item receive. Tried to enable scum checking on save. * Fixed scum check on save. * More code cleanup, which revealed some issues with loading and saving. Loading now works 100%, but entries in checkTrackerData are disappearing in code somewhere, causing issues with later checks. Scummed color now displays properly. Collected but unsaved displays properly. Unchecked, Skipped, Seen and Scummed checks all have arrows for skipping/unskipping. Counts a little messed up, probably double adding skips. * Fixed item counts being off across resets. Restarts were fine. * Beginning of rework for individual check updates. Adds `Actor lastCheck` to PlayState to allow assigning of last actor to give an item. This allows precise tracking of GS, freestanding PoH, etc. Works for chests too. Currently does not work for shops, unknown for normal NPC gives. Doesn't track last gives for non-checks, like drops from grass, pots, crates, etc. * Actor-based checks fully fleshed out, but can't help with sale-based checks. Implemented `pendingSaleCheck` to back out of an RC check cycle if `gSaveContext->pendingSale` is not NONE when `OnItemReceive` is called, processed through `OnSaleEnd`. This should be the final change necessary to streamline the checks. * Temporary hook to message box close to tie in trackers for non-gs/chest actors that aren't added to `GetCheckFromActor`. This triggers a 2-frame countdown to check with `HasItemBeenCollected` since half of the methods in there aren't updated until after a text box closes. Added scene tracking to get last scene so that checks in scenes that span several overworld areas could be tied to their areas properly. Modified tracker data creation to apply Link's Pocket and Song from Impa conditionally based on randomizer settings instead of just being assumed to be done. May need modification for checking click and drag spoiler loading. Removed the scene equivalence check from CheckChecks so that an entire area is checked each time to avoid issues with, e.g., leaving a shop before a pending sale finishes. * Changed check data creation to use RSKs from gRandomizer to account for settings loaded from drag and drop spoilers. * Beginning of tracker code organization. Changed check color defaults. * Reverted moving tracker colors to header. Some individual check fixes. * Missed something from previous merge? * Removed last remnant of removed performance mode. * Better handle checking when skullsanity is off. * Song checks sceneIDs don't match the scenes they're actually in for some reason. Removed that check. * SaleEnd checks don't need the GetItemEntry parameter. Also set a flag that should prevent the check tracker from running during vanilla saves should that not be resolved by the time it's merged. * Attempting to have only the relevant checks added to the tracker data, as well as showing vanilla checks for non-rando saves. Not working yet (everything is displayed in vanilla). * Added vanilla check tracker population via `vanillaCheck` bool in `RandomizerCheckObject`. This is also added to `IsVisibleInImGui` to handle file loading and saving to eliminate checks that aren't part of vanilla or the rando seed. Implemented deleted tracker data file recreation. Added some extra item name text checks. Songs are still... tricky, so they stay blank. Utilize local copies of the randomizer check objects that are applicable for performance purposes. Fixed vanilla item-giving cutscene crashes when triggered mid-transition. * Apparently not all toolchains can handle macro instantiation without all parameters, like VS can. * Fixed scummed detail color not showing properly on tracker. * Fixed dungeon area totals and GS checks not functioning properly. * Major revamp of checking code. Doesn't rely on `GetCheckFromActor` at all anymore, but instead simply sets a flag to evaluate a number of checks in an area every frame until the check that was gotten is identified. With the new setup, it's much less hardware intensive, and at 60fps 6 checks per frame shows no noticeable effect on framerate. I can envision needing to add a collectedCount in order to account for times when two checks are gotten one right after the other. Changed area scroll to happen from `OnTransitionEnd`, and allow for scrolling in bazaar (was disabled previously because it would jump back and forth between Kak and Market while you were in one). Also setup area check order updating by area instead of all at the same time. * Fixed shooting gallery not reporting proper area. Prevent checks from actually happening if area is RCAREA_INVALID, now that all areas are reporting something if they have checks. Fixed `GetCheckArea()` not updating checks for standard scenes. Lots of vanilla tracking updates, mainly manual checks for gems, medallions and songs, since the often don't have proper scenes in the data. Prevent vanilla from triggering check loops if junk items are collected. Fixed sorting based on saved vs collected. Prevent item name display for vanilla runs. Change coloring of checks so the check name reflects status in vanilla runs. * Fixed "Recheck Area" button erroneously adding to an area's check totals? * Fix DMC vanilla checks. * Fix check tracker data recreation on data file loss. Removed redundant file exists check from SaveTrackerDataHook, as it doesn't matter if it exists or not at that point. Limited check loops to 3 to avoid infinite check loops on non-check/junk item pickup. Added more checks to disable tracker operations if a save is not running. Changed check ordering to put boss reward and heart container checks at the end of whatever RCSHOW group they belong to. * Fixed IsRunning calculation. Further improving vanilla checking. Starting framework for checking medallions, stones, and songs on data file recreation. Fixed medallion check collection. Added GIFT_FROM_SAGES to check list for vanilla file for tracking light medallion. Added check loop limitation to prevent infinite checking after picking up junk item from the ground. * Finished vanilla file recreation and recheck (songs and dungeon rewards all check properly now). This includes deku shield with KF shop item 3. Finished Gift from Raoru light medallion tracking for vanilla. Commented all CheckByScene functionality for now. * Fixed new save data file creation. Disabled entrance area calculation for now, as it only tracks the previous entrance for some reason. Fixed area detection for ToT checks. * GetCheckArea() now utilizes EntranceData almost exclusively, via either `gSaveContext.entranceIndex` or the entrance tracker's `currentGrottoId` in the case of grottos. This also means that EVERYTHING CAN AUTOSCROLL NOW. Entrance shuffles are now much easier to track. Autoscroll is now also triggered on save, just in case someone isn't autosaving and has a lot of checks that get converted to saved. * Fixed missing GS check in LW. * Added area scroll on toggling Show Hidden Items. May configure differently later. Fixed area detection for entrances in Gerudo Fortress/Valley and Collossus. Haunted wasteland doesn't autoscroll due to a bug in `OnTransitionEnd` hook, but checks still evaluate properly there. Rely on scene-based area detection if scene is a main overworld or dungeon scene. * Fixed grotto detection when shuffle is off. * Small code cleanup. Fixed Colossus hand chest checks. * Missing lus bump from merge conflict resolution * Fixed Colossus Grotto making `GetCheckArea` return Wasteland. * Improved OnItemReceive processing for non-token GS checks, since they can sometimes take long enough for the checking process to time out before the item is registered as received. * First attempt at thread safety for tracker data file writing. Seems to work, but might need more testing. * Fixed Recheck Area not unskipping items that register as saved. Improved delayed saving with autosaving, as the autosave triggered quite often before the tracker data save, making things not properly register as saved. * merge cleanup * Converted check tracker data to the sectional saves, adding `CheckTrackerData` to `SaveContext`. Implemented section ID returning and fullSave boolean passing to section functions from my PR temporarily for it to work properly. Moved `RandomizerCheckTrackerData` enum to `randomizerTypes.h` to accommodate that. Changed `Randomizer_SaveInit` to a `SaveManager::InitFunc` to allow for other randomizer-dependent sections to be initialized after that. Required a little refactoring to maintain intro cutscene skip when starting a randomizer file. * Revert section index return and randomizer init changes. Will need to wait on yet more changes to main. * Fixed check tracker initialization (shouldn't be tied to window initialization), restored saving/loading functionality. * Removed `CheckTracker::Init` and put SaveManager calls in `CheckTrackerWindow::InitElement`. Also a bit of cleanup from transition back to save file use. * Fixed tracker displaying check categories while file not loaded. * Fix Darunia's Joy check not marking in vanilla. * Fix autosave not triggering change from collected to saved in tracker data. * Changed default colors for scummed and collected display. * Merge upgrade code cleanup. * Add `OnTransitionEnd` calls to sandstorm transitions both to and from Wasteland. Also improved `gSaveContext.lastScene` assignment for both transition types. Allowed a bit of cleanup in `GetCheckArea`. * Added `StateButton`, a button like `ArrowButton` but that allows text instead of arrow icons. Apparently the changes from ArrowButton to StateButton happened in a previous commit... * Changed section name to `trackerDataCheck` to force SoH to load it after the randomizer section, as it required some randoSettings to be loaded first, and nothing else I tried to make the randomizer section load before it worked. This hacks a solution to checks not displaying on fast file load to a specific slot. F*** you, SaveManager, and f*** you too, JSON. * Forgot to change the section string for loading with the name change. * Fix check ordering for checks that trigger the autosave. * Adds option to remove right-side shop items (slots 1-4) from the tracker list. Enabled by default. * Fix default state of Hide Shop Right Checks checkbox. * Fixes grotto and great fairy scrolling and checks. Fixes array overflow from `checkTrackerData` which was creating the issue trying to load the base and randomizer sections first, among other things. That also fixed the massive file loads that were being exhibited in debug mode. * Fix shooting galleries being set as collected again when being played a second time after getting the checks. * Fix Bazaar autoscroll. * Add Saria's Song to `GetCheckFromActor` and removed some limitations from the messageCloseCheck function to make that check track properly. * Fix Song from Impa check. Implemented prevention for multiple "collections" of great fairies, just in case getting the health refill would trigger it with the previous setup. * Fix ice traps on GS tokens not triggering OnItemReceive. * Complete fix for ice trap collection from GS. Add autoscroll when clicking "Expand All". * Add `OnShopSlotChange` with cursorSlot and basePrice parameters. * Fixed include in en_ossan for shop slot hook. Added registration for `OnShopSlotChange` in the tracker, storing the price in a new `price` field in `CheckTrackerData`. Added "seen" functionality to shop checks. Displays the model item name upon first entering a shop, adding the price and switching to trickName (if it's an ice trap) upon navigating to the slot in buy mode, triggered by an invisible "identified" status that mirrors "seen" in every other way. Added tooltips to most options for check tracker color picking to describe what each status actually means. * `std::format` pls * So apparently std::format just decided to break with the latest merge from develop, but fmt::format exists and works? * Removed the last vestiges of `locationsSkipped`. Other general code and formatting cleanups. Moved `IsGameRunning` to `OTRGlobals` so the item tracker could also access it. Used preceding to "fix" item and bottle display in the item tracker on startup. * Some more code cleanup. Removed "Recheck Area" button and relevant code. Backported changes to Anchor branch applicable for single-player, including making a checkAreas vector and structuring the frame by frame checks around that. Also includes fix for Silver Gauntlets and Mirror Shield check collection crash associated with those changes. Fixed Kakariko Bazaar "seen" updates. Fixed tracker window not showing on initial load like it should. * Forgot 1 formatting fix. * Removed conditions for showing Song from Impa (isn't junk under certain conditions, so should show all the time). * Fix vanilla checks, add Zelda's Letter and Malon's Egg to manual check collection. Fix autoscroll while in child stealth section. * Fix crash in Happy Mask Shop in OnSlotChange (referenced non-existent shop id in a tracker-specific enum). * General code cleanup. * Missed one reversion. * One more. * Fix column alignment in `randomizer_check_objects`. * Fix file encoding on `randomizer_check_tracker`. Again. * Fix indentation for `actualItemtrackerItemMap`. Also removed unnecessary parts of the map. * Rename `HasEqItem` to `HasEquipment`. * Slightly better indentation for `actualItemTrackerItemMap`. * Add magic bean salesman to vanilla check tracking, and genericized deku shield to trigger KF shop item 3 wherever you get the shield. Renamed `vanillaCheck` to `vanillaHundoCheck` to (supposedly) clarify the meaning of the usage. * One more rename to `vanillaCompletion` to avoid possible confusion with 100% speedrun conditions. * give me a break XD Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * Changes suggested by briaguya (rename `RandomizerCheckShow` to `Status`, unused code, newline formatting) * Remove unused `itemNames` table. * Remove `IsGameRunning` in favor of `GameInteractor::IsSaveLoaded`. * Restore anti-spoiler functionality for dungeons with dungeon maps. * Review cleanup. * Fix prices not showing for Kak bazaar items. --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com>
2023-10-04 11:03:36 -04:00
if (IS_RANDO) {
if (gSaveContext.itemLocations[rcObj.rc].get.rgID == RG_ICE_TRAP) {
if (status == RCSHOW_IDENTIFIED) {
txt = gSaveContext.itemLocations[rcObj.rc].get.trickName;
} else {
txt = OTRGlobals::Instance->gRandomizer->EnumToSpoilerfileGetName[gSaveContext.itemLocations[rcObj.rc].get.fakeRgID][gSaveContext.language];
}
} else {
txt = OTRGlobals::Instance->gRandomizer->EnumToSpoilerfileGetName[gSaveContext.itemLocations[rcObj.rc].get.rgID][gSaveContext.language];
}
if (status == RCSHOW_IDENTIFIED) {
txt += fmt::format(" - {}", gSaveContext.checkTrackerData[rcObj.rc].price);
}
} else {
if (IsHeartPiece(rcObj.ogItemId)) {
if (gSaveContext.language == LANGUAGE_ENG || gSaveContext.language == LANGUAGE_GER) {
txt = ItemFromGIID(rcObj.ogItemId).GetName().english;
} else if (gSaveContext.language == LANGUAGE_FRA) {
txt = ItemFromGIID(rcObj.ogItemId).GetName().french;
}
}
}
break;
Randomizer Auto Location tracker (#1942) * Initial Auto-Location Tracking * Updates styling for checked items in Check Tracker * Fixes crashing issues with Check Tracker rendering * Auto scroll Check Tracker windows to current area * Checks Tracker only shows checked locations once in game * Fixes issue where Check Tracker would auto-scroll to wrong location when entering a grotto * Fixes gerudo fortress checks showing in tracker when settings have them removed * InfTable Check Location Fixes: Lost Dog Richard, Rolling Gorons, HBA 1000, Thawed Zora * Fixes most Event Chk Inf Checks on Check Tracker, and Frogs * Check Tracker - Song from Malon now works * Check Tracker - Fixes Claim Check check not tracking - Fixes spoiler for Claim Check check when getting Biggoron's Sword - Fixes LACS being spoiled and not tracking * Check Tracker - Fixes #2 for Skull Mask and Mask of Truth checks * Check Tracker - Adds support for merchants - Fixes #7 for Bomchu Salesman - Fixes #12 for Medigoron * Check Tracker - Fixes #8 for Song from Saria * Check Tracker - Fixes #9 for Adult Shooting Gallery * Check Tracker - Fixes #10 for Composer Grave * Check Tracker - Fixes #14 for Song from Ocarina of Time * Check Tracker - Fixes #16 for Shooting the Sun * Check Tracker - Fixes #19 for Darunia's Joy * Save Editor - Adds missing label for Treasure Chest Game * Check Tracker - Fixes Great Faries checks * Check Tracker - Fixes Sheik at Temple * Check Tracker - Fixes Great Fairy auto-scroll to wrong location * Check Tracker - Updates blue warp checks - Fixes Bongo Bongo and Twinrova checks * Check Tracker - Fixes Dampe's Gravedigging Tour * Check Tracker - Fixes Prescription to King Zora * Check Tracker - Fixes Bazaar showing under wrong area on tracker between adult/child * Check Tracker - Fixes scroll for Hyrule Market and Bazaar * Check Tracker - Fixes giving Adult Trade Items shown on tracker: Broken Sword, Saw, Cojiro, Eyeball Froge, and Eyedrops * Cleans up item_location * Check Tracker - Item List - Fixes item list not updating when changing seeds/options - Separates item exclusion list from item check list - Clean up comments * Check Tracker - Adds Skip functionality to buttons * Check Tracker - Refactors adult trade items to RandomizerInf * Check Tracker - Fixes an issue where any time an item is removed the tracker would cause an application crash * Check Tracker - Item names are now dependent on file language * Check Tracker - Fixes Gerudo Card check not showing in Fast setting * Reorders headers to (hopefully) avoid CI build conflicts on linux/consoles * Explicitly defines vector header in randomizer.h to fix compile errors * Complete Refactor of Check Tracker ImGui * Adds missing check tracker files to CMakeLists * Reverts the Item_location whitespace cleanup from ad10807c * Check Tracker - Loading Fixes - Fixes a bug where loading a save file a second time would add all the checks again - Fixes a bug where the check tracker would not render at all until in a save file * Check Tracker - Fixes a bug where checks would sometimes fail to load * Check Tracker - Fixes duplicated checks when using Only on Pause or Only on Combo * Check Tracker - Works around issue where single characters don't show in EnhancementCombobox, and fixes a label for combo buttons held option * Check Tracker - Applies all Check Tracker changes to Item Location * Check Tracker - Updated Check List - Adds Link's pocket, either in KF or HM depending on starting age - Supports Scrubs and Merchants - Uses enums instead of magic numbers - Updates DC Scrub Short Names for MQ * Check Tracker - Adds a performance mode option * Check Tracker - List Fixes (requires new rando generation) - Fixes Frogs Rupees always visible - Fixes Kokiri Sword Chest not showing - Fixes Weird Egg not showing * Check Tracker - MQ List basic support * Check Tracker - MQ/Vanilla anti-spoilers * Check Tracker - Collecting a compass now spoils the area * Check Tracker - Basic Vanilla Support and fixes - Vanilla items show in check tracker, even if many won't auto check - Fixes an issue with Gerudo Fortress Keys - Refactors IsVisibleInCheckTracker to randomizer_check_tracjer * Check Tracker - Fixes merge conflict from 08a487f35e1d760ab9e69b932edbe4da6bcd9edb * Check Tracker - Fixes tracker loading as Floating when default value is set to Windowed * Randomizer Location Exclusion List - Adds Scrubs, Merchants, Shops. Adult Trade items, MQ Dungeons, and Bean Salesman - Fixes Kokiri Sword Chest, Weird Egg, and Frog Song Rupees from misbehaving - Updates Gerudo Fortress logic to be dependent on Open/Fast/Normal Fortress - Removes Invalid Check - Adds RO Enum for MQ settings - Updates magic values to RO enum * Location Exclusion List - Scrubs that are always randomized now always show on the list * For now, removes some extra code only needed for a Check Tracker. * Randomizer Location Exclusion List - Fixes Eyeball Frog from showing up when Adult Trade Items was off * Location Tracker - Updates Eyedrops to use RandomizerInf instead of Chest * Check Tracker - Fixes a bug where Link's Pocket item wasn't acting as checked for area item count * Check Tracker - Fixes a bug where Locations would incorrectly say Vanilla due to the first check in the area being a non-MQ check * Check Tracker - Fixes a crash when Check Tracker is docked but not visible * Check Tracker - Fixes areas being spoiled when loading different save files * Check Tracker - Only reset variables if they are initialized * Check Tracker - Cleans up old comments, unused variables, methods, and macros, adds language TODOs, * Check Tracker - Readds rainbow UI elements after Cosmetics Editor refactor * Check Tracker - Removal of flag lookup that was refactored, no longer needed header, and some trivial whitespace fixes. * Check Tracker - Refactors Index to Bitmask code to a macro * Check Tracker - Changes ordering from alphabetical to RandomizerCheck ordering * Check Tracker - Wraps everything in a namespace to avoid global variable usage * Check Tracker - Explicitly defines for-loop scope * Check Tracker - refactors dungeon lookup from static array to function * Fixes a bug when using EnhancementColor with alpha * Check Tracker - Refactors all colour to use direct conversions * Check Tracker - refactors settings loading and check visibility for readability * Check Tracker - Fixes a bug where the wrong label showed on the Check Tracker BG Color * UIWidgets - Adds Alpha bar to EnhancementColor when using alpha parameter
2022-12-10 22:39:23 -05:00
}
Check Tracker Update (#2668) * Initial commit. What works so far: Data file loads, saves, deletes, and is created properly. - Need to run `HasItemBeenCollected` when creating in case of mid-seed regen. Organized checks into maps set by area. Areas show in tracker. - Checks pulled from checkObjectsByArea are not currently listed. - Areas are being assumed completed and hidden at the start. * Checks now populate. Still not counting area totals properly. * Don't track RC_LINKS_POCKET in the data file, and instead manually add it in every time a save is load. rcObjects doesn't contain Link's Pocket location (duh). * Moved ItemReceive hook to randomizer_check_tracker.cpp. Skipped items are properly sorted and formatted. Saved items contribute to an area's gotten/skipped checks on load. Changed skipped items default main color to gray. General code cleanup. * Skipped checks now contribute to area totals for area completion logic. * Mid-menu rework transfer. * Started check lookup on item receive. Tried to enable scum checking on save. * Fixed scum check on save. * More code cleanup, which revealed some issues with loading and saving. Loading now works 100%, but entries in checkTrackerData are disappearing in code somewhere, causing issues with later checks. Scummed color now displays properly. Collected but unsaved displays properly. Unchecked, Skipped, Seen and Scummed checks all have arrows for skipping/unskipping. Counts a little messed up, probably double adding skips. * Fixed item counts being off across resets. Restarts were fine. * Beginning of rework for individual check updates. Adds `Actor lastCheck` to PlayState to allow assigning of last actor to give an item. This allows precise tracking of GS, freestanding PoH, etc. Works for chests too. Currently does not work for shops, unknown for normal NPC gives. Doesn't track last gives for non-checks, like drops from grass, pots, crates, etc. * Actor-based checks fully fleshed out, but can't help with sale-based checks. Implemented `pendingSaleCheck` to back out of an RC check cycle if `gSaveContext->pendingSale` is not NONE when `OnItemReceive` is called, processed through `OnSaleEnd`. This should be the final change necessary to streamline the checks. * Temporary hook to message box close to tie in trackers for non-gs/chest actors that aren't added to `GetCheckFromActor`. This triggers a 2-frame countdown to check with `HasItemBeenCollected` since half of the methods in there aren't updated until after a text box closes. Added scene tracking to get last scene so that checks in scenes that span several overworld areas could be tied to their areas properly. Modified tracker data creation to apply Link's Pocket and Song from Impa conditionally based on randomizer settings instead of just being assumed to be done. May need modification for checking click and drag spoiler loading. Removed the scene equivalence check from CheckChecks so that an entire area is checked each time to avoid issues with, e.g., leaving a shop before a pending sale finishes. * Changed check data creation to use RSKs from gRandomizer to account for settings loaded from drag and drop spoilers. * Beginning of tracker code organization. Changed check color defaults. * Reverted moving tracker colors to header. Some individual check fixes. * Missed something from previous merge? * Removed last remnant of removed performance mode. * Better handle checking when skullsanity is off. * Song checks sceneIDs don't match the scenes they're actually in for some reason. Removed that check. * SaleEnd checks don't need the GetItemEntry parameter. Also set a flag that should prevent the check tracker from running during vanilla saves should that not be resolved by the time it's merged. * Attempting to have only the relevant checks added to the tracker data, as well as showing vanilla checks for non-rando saves. Not working yet (everything is displayed in vanilla). * Added vanilla check tracker population via `vanillaCheck` bool in `RandomizerCheckObject`. This is also added to `IsVisibleInImGui` to handle file loading and saving to eliminate checks that aren't part of vanilla or the rando seed. Implemented deleted tracker data file recreation. Added some extra item name text checks. Songs are still... tricky, so they stay blank. Utilize local copies of the randomizer check objects that are applicable for performance purposes. Fixed vanilla item-giving cutscene crashes when triggered mid-transition. * Apparently not all toolchains can handle macro instantiation without all parameters, like VS can. * Fixed scummed detail color not showing properly on tracker. * Fixed dungeon area totals and GS checks not functioning properly. * Major revamp of checking code. Doesn't rely on `GetCheckFromActor` at all anymore, but instead simply sets a flag to evaluate a number of checks in an area every frame until the check that was gotten is identified. With the new setup, it's much less hardware intensive, and at 60fps 6 checks per frame shows no noticeable effect on framerate. I can envision needing to add a collectedCount in order to account for times when two checks are gotten one right after the other. Changed area scroll to happen from `OnTransitionEnd`, and allow for scrolling in bazaar (was disabled previously because it would jump back and forth between Kak and Market while you were in one). Also setup area check order updating by area instead of all at the same time. * Fixed shooting gallery not reporting proper area. Prevent checks from actually happening if area is RCAREA_INVALID, now that all areas are reporting something if they have checks. Fixed `GetCheckArea()` not updating checks for standard scenes. Lots of vanilla tracking updates, mainly manual checks for gems, medallions and songs, since the often don't have proper scenes in the data. Prevent vanilla from triggering check loops if junk items are collected. Fixed sorting based on saved vs collected. Prevent item name display for vanilla runs. Change coloring of checks so the check name reflects status in vanilla runs. * Fixed "Recheck Area" button erroneously adding to an area's check totals? * Fix DMC vanilla checks. * Fix check tracker data recreation on data file loss. Removed redundant file exists check from SaveTrackerDataHook, as it doesn't matter if it exists or not at that point. Limited check loops to 3 to avoid infinite check loops on non-check/junk item pickup. Added more checks to disable tracker operations if a save is not running. Changed check ordering to put boss reward and heart container checks at the end of whatever RCSHOW group they belong to. * Fixed IsRunning calculation. Further improving vanilla checking. Starting framework for checking medallions, stones, and songs on data file recreation. Fixed medallion check collection. Added GIFT_FROM_SAGES to check list for vanilla file for tracking light medallion. Added check loop limitation to prevent infinite checking after picking up junk item from the ground. * Finished vanilla file recreation and recheck (songs and dungeon rewards all check properly now). This includes deku shield with KF shop item 3. Finished Gift from Raoru light medallion tracking for vanilla. Commented all CheckByScene functionality for now. * Fixed new save data file creation. Disabled entrance area calculation for now, as it only tracks the previous entrance for some reason. Fixed area detection for ToT checks. * GetCheckArea() now utilizes EntranceData almost exclusively, via either `gSaveContext.entranceIndex` or the entrance tracker's `currentGrottoId` in the case of grottos. This also means that EVERYTHING CAN AUTOSCROLL NOW. Entrance shuffles are now much easier to track. Autoscroll is now also triggered on save, just in case someone isn't autosaving and has a lot of checks that get converted to saved. * Fixed missing GS check in LW. * Added area scroll on toggling Show Hidden Items. May configure differently later. Fixed area detection for entrances in Gerudo Fortress/Valley and Collossus. Haunted wasteland doesn't autoscroll due to a bug in `OnTransitionEnd` hook, but checks still evaluate properly there. Rely on scene-based area detection if scene is a main overworld or dungeon scene. * Fixed grotto detection when shuffle is off. * Small code cleanup. Fixed Colossus hand chest checks. * Missing lus bump from merge conflict resolution * Fixed Colossus Grotto making `GetCheckArea` return Wasteland. * Improved OnItemReceive processing for non-token GS checks, since they can sometimes take long enough for the checking process to time out before the item is registered as received. * First attempt at thread safety for tracker data file writing. Seems to work, but might need more testing. * Fixed Recheck Area not unskipping items that register as saved. Improved delayed saving with autosaving, as the autosave triggered quite often before the tracker data save, making things not properly register as saved. * merge cleanup * Converted check tracker data to the sectional saves, adding `CheckTrackerData` to `SaveContext`. Implemented section ID returning and fullSave boolean passing to section functions from my PR temporarily for it to work properly. Moved `RandomizerCheckTrackerData` enum to `randomizerTypes.h` to accommodate that. Changed `Randomizer_SaveInit` to a `SaveManager::InitFunc` to allow for other randomizer-dependent sections to be initialized after that. Required a little refactoring to maintain intro cutscene skip when starting a randomizer file. * Revert section index return and randomizer init changes. Will need to wait on yet more changes to main. * Fixed check tracker initialization (shouldn't be tied to window initialization), restored saving/loading functionality. * Removed `CheckTracker::Init` and put SaveManager calls in `CheckTrackerWindow::InitElement`. Also a bit of cleanup from transition back to save file use. * Fixed tracker displaying check categories while file not loaded. * Fix Darunia's Joy check not marking in vanilla. * Fix autosave not triggering change from collected to saved in tracker data. * Changed default colors for scummed and collected display. * Merge upgrade code cleanup. * Add `OnTransitionEnd` calls to sandstorm transitions both to and from Wasteland. Also improved `gSaveContext.lastScene` assignment for both transition types. Allowed a bit of cleanup in `GetCheckArea`. * Added `StateButton`, a button like `ArrowButton` but that allows text instead of arrow icons. Apparently the changes from ArrowButton to StateButton happened in a previous commit... * Changed section name to `trackerDataCheck` to force SoH to load it after the randomizer section, as it required some randoSettings to be loaded first, and nothing else I tried to make the randomizer section load before it worked. This hacks a solution to checks not displaying on fast file load to a specific slot. F*** you, SaveManager, and f*** you too, JSON. * Forgot to change the section string for loading with the name change. * Fix check ordering for checks that trigger the autosave. * Adds option to remove right-side shop items (slots 1-4) from the tracker list. Enabled by default. * Fix default state of Hide Shop Right Checks checkbox. * Fixes grotto and great fairy scrolling and checks. Fixes array overflow from `checkTrackerData` which was creating the issue trying to load the base and randomizer sections first, among other things. That also fixed the massive file loads that were being exhibited in debug mode. * Fix shooting galleries being set as collected again when being played a second time after getting the checks. * Fix Bazaar autoscroll. * Add Saria's Song to `GetCheckFromActor` and removed some limitations from the messageCloseCheck function to make that check track properly. * Fix Song from Impa check. Implemented prevention for multiple "collections" of great fairies, just in case getting the health refill would trigger it with the previous setup. * Fix ice traps on GS tokens not triggering OnItemReceive. * Complete fix for ice trap collection from GS. Add autoscroll when clicking "Expand All". * Add `OnShopSlotChange` with cursorSlot and basePrice parameters. * Fixed include in en_ossan for shop slot hook. Added registration for `OnShopSlotChange` in the tracker, storing the price in a new `price` field in `CheckTrackerData`. Added "seen" functionality to shop checks. Displays the model item name upon first entering a shop, adding the price and switching to trickName (if it's an ice trap) upon navigating to the slot in buy mode, triggered by an invisible "identified" status that mirrors "seen" in every other way. Added tooltips to most options for check tracker color picking to describe what each status actually means. * `std::format` pls * So apparently std::format just decided to break with the latest merge from develop, but fmt::format exists and works? * Removed the last vestiges of `locationsSkipped`. Other general code and formatting cleanups. Moved `IsGameRunning` to `OTRGlobals` so the item tracker could also access it. Used preceding to "fix" item and bottle display in the item tracker on startup. * Some more code cleanup. Removed "Recheck Area" button and relevant code. Backported changes to Anchor branch applicable for single-player, including making a checkAreas vector and structuring the frame by frame checks around that. Also includes fix for Silver Gauntlets and Mirror Shield check collection crash associated with those changes. Fixed Kakariko Bazaar "seen" updates. Fixed tracker window not showing on initial load like it should. * Forgot 1 formatting fix. * Removed conditions for showing Song from Impa (isn't junk under certain conditions, so should show all the time). * Fix vanilla checks, add Zelda's Letter and Malon's Egg to manual check collection. Fix autoscroll while in child stealth section. * Fix crash in Happy Mask Shop in OnSlotChange (referenced non-existent shop id in a tracker-specific enum). * General code cleanup. * Missed one reversion. * One more. * Fix column alignment in `randomizer_check_objects`. * Fix file encoding on `randomizer_check_tracker`. Again. * Fix indentation for `actualItemtrackerItemMap`. Also removed unnecessary parts of the map. * Rename `HasEqItem` to `HasEquipment`. * Slightly better indentation for `actualItemTrackerItemMap`. * Add magic bean salesman to vanilla check tracking, and genericized deku shield to trigger KF shop item 3 wherever you get the shield. Renamed `vanillaCheck` to `vanillaHundoCheck` to (supposedly) clarify the meaning of the usage. * One more rename to `vanillaCompletion` to avoid possible confusion with 100% speedrun conditions. * give me a break XD Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * Changes suggested by briaguya (rename `RandomizerCheckShow` to `Status`, unused code, newline formatting) * Remove unused `itemNames` table. * Remove `IsGameRunning` in favor of `GameInteractor::IsSaveLoaded`. * Restore anti-spoiler functionality for dungeons with dungeon maps. * Review cleanup. * Fix prices not showing for Kak bazaar items. --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com>
2023-10-04 11:03:36 -04:00
}
if (txt == "" && skipped) {
txt = "Skipped"; // TODO language
}
Randomizer Auto Location tracker (#1942) * Initial Auto-Location Tracking * Updates styling for checked items in Check Tracker * Fixes crashing issues with Check Tracker rendering * Auto scroll Check Tracker windows to current area * Checks Tracker only shows checked locations once in game * Fixes issue where Check Tracker would auto-scroll to wrong location when entering a grotto * Fixes gerudo fortress checks showing in tracker when settings have them removed * InfTable Check Location Fixes: Lost Dog Richard, Rolling Gorons, HBA 1000, Thawed Zora * Fixes most Event Chk Inf Checks on Check Tracker, and Frogs * Check Tracker - Song from Malon now works * Check Tracker - Fixes Claim Check check not tracking - Fixes spoiler for Claim Check check when getting Biggoron's Sword - Fixes LACS being spoiled and not tracking * Check Tracker - Fixes #2 for Skull Mask and Mask of Truth checks * Check Tracker - Adds support for merchants - Fixes #7 for Bomchu Salesman - Fixes #12 for Medigoron * Check Tracker - Fixes #8 for Song from Saria * Check Tracker - Fixes #9 for Adult Shooting Gallery * Check Tracker - Fixes #10 for Composer Grave * Check Tracker - Fixes #14 for Song from Ocarina of Time * Check Tracker - Fixes #16 for Shooting the Sun * Check Tracker - Fixes #19 for Darunia's Joy * Save Editor - Adds missing label for Treasure Chest Game * Check Tracker - Fixes Great Faries checks * Check Tracker - Fixes Sheik at Temple * Check Tracker - Fixes Great Fairy auto-scroll to wrong location * Check Tracker - Updates blue warp checks - Fixes Bongo Bongo and Twinrova checks * Check Tracker - Fixes Dampe's Gravedigging Tour * Check Tracker - Fixes Prescription to King Zora * Check Tracker - Fixes Bazaar showing under wrong area on tracker between adult/child * Check Tracker - Fixes scroll for Hyrule Market and Bazaar * Check Tracker - Fixes giving Adult Trade Items shown on tracker: Broken Sword, Saw, Cojiro, Eyeball Froge, and Eyedrops * Cleans up item_location * Check Tracker - Item List - Fixes item list not updating when changing seeds/options - Separates item exclusion list from item check list - Clean up comments * Check Tracker - Adds Skip functionality to buttons * Check Tracker - Refactors adult trade items to RandomizerInf * Check Tracker - Fixes an issue where any time an item is removed the tracker would cause an application crash * Check Tracker - Item names are now dependent on file language * Check Tracker - Fixes Gerudo Card check not showing in Fast setting * Reorders headers to (hopefully) avoid CI build conflicts on linux/consoles * Explicitly defines vector header in randomizer.h to fix compile errors * Complete Refactor of Check Tracker ImGui * Adds missing check tracker files to CMakeLists * Reverts the Item_location whitespace cleanup from ad10807c * Check Tracker - Loading Fixes - Fixes a bug where loading a save file a second time would add all the checks again - Fixes a bug where the check tracker would not render at all until in a save file * Check Tracker - Fixes a bug where checks would sometimes fail to load * Check Tracker - Fixes duplicated checks when using Only on Pause or Only on Combo * Check Tracker - Works around issue where single characters don't show in EnhancementCombobox, and fixes a label for combo buttons held option * Check Tracker - Applies all Check Tracker changes to Item Location * Check Tracker - Updated Check List - Adds Link's pocket, either in KF or HM depending on starting age - Supports Scrubs and Merchants - Uses enums instead of magic numbers - Updates DC Scrub Short Names for MQ * Check Tracker - Adds a performance mode option * Check Tracker - List Fixes (requires new rando generation) - Fixes Frogs Rupees always visible - Fixes Kokiri Sword Chest not showing - Fixes Weird Egg not showing * Check Tracker - MQ List basic support * Check Tracker - MQ/Vanilla anti-spoilers * Check Tracker - Collecting a compass now spoils the area * Check Tracker - Basic Vanilla Support and fixes - Vanilla items show in check tracker, even if many won't auto check - Fixes an issue with Gerudo Fortress Keys - Refactors IsVisibleInCheckTracker to randomizer_check_tracjer * Check Tracker - Fixes merge conflict from 08a487f35e1d760ab9e69b932edbe4da6bcd9edb * Check Tracker - Fixes tracker loading as Floating when default value is set to Windowed * Randomizer Location Exclusion List - Adds Scrubs, Merchants, Shops. Adult Trade items, MQ Dungeons, and Bean Salesman - Fixes Kokiri Sword Chest, Weird Egg, and Frog Song Rupees from misbehaving - Updates Gerudo Fortress logic to be dependent on Open/Fast/Normal Fortress - Removes Invalid Check - Adds RO Enum for MQ settings - Updates magic values to RO enum * Location Exclusion List - Scrubs that are always randomized now always show on the list * For now, removes some extra code only needed for a Check Tracker. * Randomizer Location Exclusion List - Fixes Eyeball Frog from showing up when Adult Trade Items was off * Location Tracker - Updates Eyedrops to use RandomizerInf instead of Chest * Check Tracker - Fixes a bug where Link's Pocket item wasn't acting as checked for area item count * Check Tracker - Fixes a bug where Locations would incorrectly say Vanilla due to the first check in the area being a non-MQ check * Check Tracker - Fixes a crash when Check Tracker is docked but not visible * Check Tracker - Fixes areas being spoiled when loading different save files * Check Tracker - Only reset variables if they are initialized * Check Tracker - Cleans up old comments, unused variables, methods, and macros, adds language TODOs, * Check Tracker - Readds rainbow UI elements after Cosmetics Editor refactor * Check Tracker - Removal of flag lookup that was refactored, no longer needed header, and some trivial whitespace fixes. * Check Tracker - Refactors Index to Bitmask code to a macro * Check Tracker - Changes ordering from alphabetical to RandomizerCheck ordering * Check Tracker - Wraps everything in a namespace to avoid global variable usage * Check Tracker - Explicitly defines for-loop scope * Check Tracker - refactors dungeon lookup from static array to function * Fixes a bug when using EnhancementColor with alpha * Check Tracker - Refactors all colour to use direct conversions * Check Tracker - refactors settings loading and check visibility for readability * Check Tracker - Fixes a bug where the wrong label showed on the Check Tracker BG Color * UIWidgets - Adds Alpha bar to EnhancementColor when using alpha parameter
2022-12-10 22:39:23 -05:00
Check Tracker Update (#2668) * Initial commit. What works so far: Data file loads, saves, deletes, and is created properly. - Need to run `HasItemBeenCollected` when creating in case of mid-seed regen. Organized checks into maps set by area. Areas show in tracker. - Checks pulled from checkObjectsByArea are not currently listed. - Areas are being assumed completed and hidden at the start. * Checks now populate. Still not counting area totals properly. * Don't track RC_LINKS_POCKET in the data file, and instead manually add it in every time a save is load. rcObjects doesn't contain Link's Pocket location (duh). * Moved ItemReceive hook to randomizer_check_tracker.cpp. Skipped items are properly sorted and formatted. Saved items contribute to an area's gotten/skipped checks on load. Changed skipped items default main color to gray. General code cleanup. * Skipped checks now contribute to area totals for area completion logic. * Mid-menu rework transfer. * Started check lookup on item receive. Tried to enable scum checking on save. * Fixed scum check on save. * More code cleanup, which revealed some issues with loading and saving. Loading now works 100%, but entries in checkTrackerData are disappearing in code somewhere, causing issues with later checks. Scummed color now displays properly. Collected but unsaved displays properly. Unchecked, Skipped, Seen and Scummed checks all have arrows for skipping/unskipping. Counts a little messed up, probably double adding skips. * Fixed item counts being off across resets. Restarts were fine. * Beginning of rework for individual check updates. Adds `Actor lastCheck` to PlayState to allow assigning of last actor to give an item. This allows precise tracking of GS, freestanding PoH, etc. Works for chests too. Currently does not work for shops, unknown for normal NPC gives. Doesn't track last gives for non-checks, like drops from grass, pots, crates, etc. * Actor-based checks fully fleshed out, but can't help with sale-based checks. Implemented `pendingSaleCheck` to back out of an RC check cycle if `gSaveContext->pendingSale` is not NONE when `OnItemReceive` is called, processed through `OnSaleEnd`. This should be the final change necessary to streamline the checks. * Temporary hook to message box close to tie in trackers for non-gs/chest actors that aren't added to `GetCheckFromActor`. This triggers a 2-frame countdown to check with `HasItemBeenCollected` since half of the methods in there aren't updated until after a text box closes. Added scene tracking to get last scene so that checks in scenes that span several overworld areas could be tied to their areas properly. Modified tracker data creation to apply Link's Pocket and Song from Impa conditionally based on randomizer settings instead of just being assumed to be done. May need modification for checking click and drag spoiler loading. Removed the scene equivalence check from CheckChecks so that an entire area is checked each time to avoid issues with, e.g., leaving a shop before a pending sale finishes. * Changed check data creation to use RSKs from gRandomizer to account for settings loaded from drag and drop spoilers. * Beginning of tracker code organization. Changed check color defaults. * Reverted moving tracker colors to header. Some individual check fixes. * Missed something from previous merge? * Removed last remnant of removed performance mode. * Better handle checking when skullsanity is off. * Song checks sceneIDs don't match the scenes they're actually in for some reason. Removed that check. * SaleEnd checks don't need the GetItemEntry parameter. Also set a flag that should prevent the check tracker from running during vanilla saves should that not be resolved by the time it's merged. * Attempting to have only the relevant checks added to the tracker data, as well as showing vanilla checks for non-rando saves. Not working yet (everything is displayed in vanilla). * Added vanilla check tracker population via `vanillaCheck` bool in `RandomizerCheckObject`. This is also added to `IsVisibleInImGui` to handle file loading and saving to eliminate checks that aren't part of vanilla or the rando seed. Implemented deleted tracker data file recreation. Added some extra item name text checks. Songs are still... tricky, so they stay blank. Utilize local copies of the randomizer check objects that are applicable for performance purposes. Fixed vanilla item-giving cutscene crashes when triggered mid-transition. * Apparently not all toolchains can handle macro instantiation without all parameters, like VS can. * Fixed scummed detail color not showing properly on tracker. * Fixed dungeon area totals and GS checks not functioning properly. * Major revamp of checking code. Doesn't rely on `GetCheckFromActor` at all anymore, but instead simply sets a flag to evaluate a number of checks in an area every frame until the check that was gotten is identified. With the new setup, it's much less hardware intensive, and at 60fps 6 checks per frame shows no noticeable effect on framerate. I can envision needing to add a collectedCount in order to account for times when two checks are gotten one right after the other. Changed area scroll to happen from `OnTransitionEnd`, and allow for scrolling in bazaar (was disabled previously because it would jump back and forth between Kak and Market while you were in one). Also setup area check order updating by area instead of all at the same time. * Fixed shooting gallery not reporting proper area. Prevent checks from actually happening if area is RCAREA_INVALID, now that all areas are reporting something if they have checks. Fixed `GetCheckArea()` not updating checks for standard scenes. Lots of vanilla tracking updates, mainly manual checks for gems, medallions and songs, since the often don't have proper scenes in the data. Prevent vanilla from triggering check loops if junk items are collected. Fixed sorting based on saved vs collected. Prevent item name display for vanilla runs. Change coloring of checks so the check name reflects status in vanilla runs. * Fixed "Recheck Area" button erroneously adding to an area's check totals? * Fix DMC vanilla checks. * Fix check tracker data recreation on data file loss. Removed redundant file exists check from SaveTrackerDataHook, as it doesn't matter if it exists or not at that point. Limited check loops to 3 to avoid infinite check loops on non-check/junk item pickup. Added more checks to disable tracker operations if a save is not running. Changed check ordering to put boss reward and heart container checks at the end of whatever RCSHOW group they belong to. * Fixed IsRunning calculation. Further improving vanilla checking. Starting framework for checking medallions, stones, and songs on data file recreation. Fixed medallion check collection. Added GIFT_FROM_SAGES to check list for vanilla file for tracking light medallion. Added check loop limitation to prevent infinite checking after picking up junk item from the ground. * Finished vanilla file recreation and recheck (songs and dungeon rewards all check properly now). This includes deku shield with KF shop item 3. Finished Gift from Raoru light medallion tracking for vanilla. Commented all CheckByScene functionality for now. * Fixed new save data file creation. Disabled entrance area calculation for now, as it only tracks the previous entrance for some reason. Fixed area detection for ToT checks. * GetCheckArea() now utilizes EntranceData almost exclusively, via either `gSaveContext.entranceIndex` or the entrance tracker's `currentGrottoId` in the case of grottos. This also means that EVERYTHING CAN AUTOSCROLL NOW. Entrance shuffles are now much easier to track. Autoscroll is now also triggered on save, just in case someone isn't autosaving and has a lot of checks that get converted to saved. * Fixed missing GS check in LW. * Added area scroll on toggling Show Hidden Items. May configure differently later. Fixed area detection for entrances in Gerudo Fortress/Valley and Collossus. Haunted wasteland doesn't autoscroll due to a bug in `OnTransitionEnd` hook, but checks still evaluate properly there. Rely on scene-based area detection if scene is a main overworld or dungeon scene. * Fixed grotto detection when shuffle is off. * Small code cleanup. Fixed Colossus hand chest checks. * Missing lus bump from merge conflict resolution * Fixed Colossus Grotto making `GetCheckArea` return Wasteland. * Improved OnItemReceive processing for non-token GS checks, since they can sometimes take long enough for the checking process to time out before the item is registered as received. * First attempt at thread safety for tracker data file writing. Seems to work, but might need more testing. * Fixed Recheck Area not unskipping items that register as saved. Improved delayed saving with autosaving, as the autosave triggered quite often before the tracker data save, making things not properly register as saved. * merge cleanup * Converted check tracker data to the sectional saves, adding `CheckTrackerData` to `SaveContext`. Implemented section ID returning and fullSave boolean passing to section functions from my PR temporarily for it to work properly. Moved `RandomizerCheckTrackerData` enum to `randomizerTypes.h` to accommodate that. Changed `Randomizer_SaveInit` to a `SaveManager::InitFunc` to allow for other randomizer-dependent sections to be initialized after that. Required a little refactoring to maintain intro cutscene skip when starting a randomizer file. * Revert section index return and randomizer init changes. Will need to wait on yet more changes to main. * Fixed check tracker initialization (shouldn't be tied to window initialization), restored saving/loading functionality. * Removed `CheckTracker::Init` and put SaveManager calls in `CheckTrackerWindow::InitElement`. Also a bit of cleanup from transition back to save file use. * Fixed tracker displaying check categories while file not loaded. * Fix Darunia's Joy check not marking in vanilla. * Fix autosave not triggering change from collected to saved in tracker data. * Changed default colors for scummed and collected display. * Merge upgrade code cleanup. * Add `OnTransitionEnd` calls to sandstorm transitions both to and from Wasteland. Also improved `gSaveContext.lastScene` assignment for both transition types. Allowed a bit of cleanup in `GetCheckArea`. * Added `StateButton`, a button like `ArrowButton` but that allows text instead of arrow icons. Apparently the changes from ArrowButton to StateButton happened in a previous commit... * Changed section name to `trackerDataCheck` to force SoH to load it after the randomizer section, as it required some randoSettings to be loaded first, and nothing else I tried to make the randomizer section load before it worked. This hacks a solution to checks not displaying on fast file load to a specific slot. F*** you, SaveManager, and f*** you too, JSON. * Forgot to change the section string for loading with the name change. * Fix check ordering for checks that trigger the autosave. * Adds option to remove right-side shop items (slots 1-4) from the tracker list. Enabled by default. * Fix default state of Hide Shop Right Checks checkbox. * Fixes grotto and great fairy scrolling and checks. Fixes array overflow from `checkTrackerData` which was creating the issue trying to load the base and randomizer sections first, among other things. That also fixed the massive file loads that were being exhibited in debug mode. * Fix shooting galleries being set as collected again when being played a second time after getting the checks. * Fix Bazaar autoscroll. * Add Saria's Song to `GetCheckFromActor` and removed some limitations from the messageCloseCheck function to make that check track properly. * Fix Song from Impa check. Implemented prevention for multiple "collections" of great fairies, just in case getting the health refill would trigger it with the previous setup. * Fix ice traps on GS tokens not triggering OnItemReceive. * Complete fix for ice trap collection from GS. Add autoscroll when clicking "Expand All". * Add `OnShopSlotChange` with cursorSlot and basePrice parameters. * Fixed include in en_ossan for shop slot hook. Added registration for `OnShopSlotChange` in the tracker, storing the price in a new `price` field in `CheckTrackerData`. Added "seen" functionality to shop checks. Displays the model item name upon first entering a shop, adding the price and switching to trickName (if it's an ice trap) upon navigating to the slot in buy mode, triggered by an invisible "identified" status that mirrors "seen" in every other way. Added tooltips to most options for check tracker color picking to describe what each status actually means. * `std::format` pls * So apparently std::format just decided to break with the latest merge from develop, but fmt::format exists and works? * Removed the last vestiges of `locationsSkipped`. Other general code and formatting cleanups. Moved `IsGameRunning` to `OTRGlobals` so the item tracker could also access it. Used preceding to "fix" item and bottle display in the item tracker on startup. * Some more code cleanup. Removed "Recheck Area" button and relevant code. Backported changes to Anchor branch applicable for single-player, including making a checkAreas vector and structuring the frame by frame checks around that. Also includes fix for Silver Gauntlets and Mirror Shield check collection crash associated with those changes. Fixed Kakariko Bazaar "seen" updates. Fixed tracker window not showing on initial load like it should. * Forgot 1 formatting fix. * Removed conditions for showing Song from Impa (isn't junk under certain conditions, so should show all the time). * Fix vanilla checks, add Zelda's Letter and Malon's Egg to manual check collection. Fix autoscroll while in child stealth section. * Fix crash in Happy Mask Shop in OnSlotChange (referenced non-existent shop id in a tracker-specific enum). * General code cleanup. * Missed one reversion. * One more. * Fix column alignment in `randomizer_check_objects`. * Fix file encoding on `randomizer_check_tracker`. Again. * Fix indentation for `actualItemtrackerItemMap`. Also removed unnecessary parts of the map. * Rename `HasEqItem` to `HasEquipment`. * Slightly better indentation for `actualItemTrackerItemMap`. * Add magic bean salesman to vanilla check tracking, and genericized deku shield to trigger KF shop item 3 wherever you get the shield. Renamed `vanillaCheck` to `vanillaHundoCheck` to (supposedly) clarify the meaning of the usage. * One more rename to `vanillaCompletion` to avoid possible confusion with 100% speedrun conditions. * give me a break XD Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * Changes suggested by briaguya (rename `RandomizerCheckShow` to `Status`, unused code, newline formatting) * Remove unused `itemNames` table. * Remove `IsGameRunning` in favor of `GameInteractor::IsSaveLoaded`. * Restore anti-spoiler functionality for dungeons with dungeon maps. * Review cleanup. * Fix prices not showing for Kak bazaar items. --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com>
2023-10-04 11:03:36 -04:00
if (txt != "") {
Randomizer Auto Location tracker (#1942) * Initial Auto-Location Tracking * Updates styling for checked items in Check Tracker * Fixes crashing issues with Check Tracker rendering * Auto scroll Check Tracker windows to current area * Checks Tracker only shows checked locations once in game * Fixes issue where Check Tracker would auto-scroll to wrong location when entering a grotto * Fixes gerudo fortress checks showing in tracker when settings have them removed * InfTable Check Location Fixes: Lost Dog Richard, Rolling Gorons, HBA 1000, Thawed Zora * Fixes most Event Chk Inf Checks on Check Tracker, and Frogs * Check Tracker - Song from Malon now works * Check Tracker - Fixes Claim Check check not tracking - Fixes spoiler for Claim Check check when getting Biggoron's Sword - Fixes LACS being spoiled and not tracking * Check Tracker - Fixes #2 for Skull Mask and Mask of Truth checks * Check Tracker - Adds support for merchants - Fixes #7 for Bomchu Salesman - Fixes #12 for Medigoron * Check Tracker - Fixes #8 for Song from Saria * Check Tracker - Fixes #9 for Adult Shooting Gallery * Check Tracker - Fixes #10 for Composer Grave * Check Tracker - Fixes #14 for Song from Ocarina of Time * Check Tracker - Fixes #16 for Shooting the Sun * Check Tracker - Fixes #19 for Darunia's Joy * Save Editor - Adds missing label for Treasure Chest Game * Check Tracker - Fixes Great Faries checks * Check Tracker - Fixes Sheik at Temple * Check Tracker - Fixes Great Fairy auto-scroll to wrong location * Check Tracker - Updates blue warp checks - Fixes Bongo Bongo and Twinrova checks * Check Tracker - Fixes Dampe's Gravedigging Tour * Check Tracker - Fixes Prescription to King Zora * Check Tracker - Fixes Bazaar showing under wrong area on tracker between adult/child * Check Tracker - Fixes scroll for Hyrule Market and Bazaar * Check Tracker - Fixes giving Adult Trade Items shown on tracker: Broken Sword, Saw, Cojiro, Eyeball Froge, and Eyedrops * Cleans up item_location * Check Tracker - Item List - Fixes item list not updating when changing seeds/options - Separates item exclusion list from item check list - Clean up comments * Check Tracker - Adds Skip functionality to buttons * Check Tracker - Refactors adult trade items to RandomizerInf * Check Tracker - Fixes an issue where any time an item is removed the tracker would cause an application crash * Check Tracker - Item names are now dependent on file language * Check Tracker - Fixes Gerudo Card check not showing in Fast setting * Reorders headers to (hopefully) avoid CI build conflicts on linux/consoles * Explicitly defines vector header in randomizer.h to fix compile errors * Complete Refactor of Check Tracker ImGui * Adds missing check tracker files to CMakeLists * Reverts the Item_location whitespace cleanup from ad10807c * Check Tracker - Loading Fixes - Fixes a bug where loading a save file a second time would add all the checks again - Fixes a bug where the check tracker would not render at all until in a save file * Check Tracker - Fixes a bug where checks would sometimes fail to load * Check Tracker - Fixes duplicated checks when using Only on Pause or Only on Combo * Check Tracker - Works around issue where single characters don't show in EnhancementCombobox, and fixes a label for combo buttons held option * Check Tracker - Applies all Check Tracker changes to Item Location * Check Tracker - Updated Check List - Adds Link's pocket, either in KF or HM depending on starting age - Supports Scrubs and Merchants - Uses enums instead of magic numbers - Updates DC Scrub Short Names for MQ * Check Tracker - Adds a performance mode option * Check Tracker - List Fixes (requires new rando generation) - Fixes Frogs Rupees always visible - Fixes Kokiri Sword Chest not showing - Fixes Weird Egg not showing * Check Tracker - MQ List basic support * Check Tracker - MQ/Vanilla anti-spoilers * Check Tracker - Collecting a compass now spoils the area * Check Tracker - Basic Vanilla Support and fixes - Vanilla items show in check tracker, even if many won't auto check - Fixes an issue with Gerudo Fortress Keys - Refactors IsVisibleInCheckTracker to randomizer_check_tracjer * Check Tracker - Fixes merge conflict from 08a487f35e1d760ab9e69b932edbe4da6bcd9edb * Check Tracker - Fixes tracker loading as Floating when default value is set to Windowed * Randomizer Location Exclusion List - Adds Scrubs, Merchants, Shops. Adult Trade items, MQ Dungeons, and Bean Salesman - Fixes Kokiri Sword Chest, Weird Egg, and Frog Song Rupees from misbehaving - Updates Gerudo Fortress logic to be dependent on Open/Fast/Normal Fortress - Removes Invalid Check - Adds RO Enum for MQ settings - Updates magic values to RO enum * Location Exclusion List - Scrubs that are always randomized now always show on the list * For now, removes some extra code only needed for a Check Tracker. * Randomizer Location Exclusion List - Fixes Eyeball Frog from showing up when Adult Trade Items was off * Location Tracker - Updates Eyedrops to use RandomizerInf instead of Chest * Check Tracker - Fixes a bug where Link's Pocket item wasn't acting as checked for area item count * Check Tracker - Fixes a bug where Locations would incorrectly say Vanilla due to the first check in the area being a non-MQ check * Check Tracker - Fixes a crash when Check Tracker is docked but not visible * Check Tracker - Fixes areas being spoiled when loading different save files * Check Tracker - Only reset variables if they are initialized * Check Tracker - Cleans up old comments, unused variables, methods, and macros, adds language TODOs, * Check Tracker - Readds rainbow UI elements after Cosmetics Editor refactor * Check Tracker - Removal of flag lookup that was refactored, no longer needed header, and some trivial whitespace fixes. * Check Tracker - Refactors Index to Bitmask code to a macro * Check Tracker - Changes ordering from alphabetical to RandomizerCheck ordering * Check Tracker - Wraps everything in a namespace to avoid global variable usage * Check Tracker - Explicitly defines for-loop scope * Check Tracker - refactors dungeon lookup from static array to function * Fixes a bug when using EnhancementColor with alpha * Check Tracker - Refactors all colour to use direct conversions * Check Tracker - refactors settings loading and check visibility for readability * Check Tracker - Fixes a bug where the wrong label showed on the Check Tracker BG Color * UIWidgets - Adds Alpha bar to EnhancementColor when using alpha parameter
2022-12-10 22:39:23 -05:00
ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(extraColor.r / 255.0f, extraColor.g / 255.0f, extraColor.b / 255.0f, extraColor.a / 255.0f));
ImGui::SameLine();
ImGui::Text(" (%s)", txt.c_str());
ImGui::PopStyleColor();
}
}
static std::set<std::string> rainbowCVars = {
"gCheckTrackerAreaMainIncompleteColor", "gCheckTrackerAreaExtraIncompleteColor",
"gCheckTrackerAreaMainCompleteColor", "gCheckTrackerAreaExtraCompleteColor",
"gCheckTrackerUncheckedMainColor", "gCheckTrackerUncheckedExtraColor",
"gCheckTrackerSkippedMainColor", "gCheckTrackerSkippedExtraColor",
"gCheckTrackerSeenMainColor", "gCheckTrackerSeenExtraColor",
"gCheckTrackerHintedMainColor", "gCheckTrackerHintedExtraColor",
Check Tracker Update (#2668) * Initial commit. What works so far: Data file loads, saves, deletes, and is created properly. - Need to run `HasItemBeenCollected` when creating in case of mid-seed regen. Organized checks into maps set by area. Areas show in tracker. - Checks pulled from checkObjectsByArea are not currently listed. - Areas are being assumed completed and hidden at the start. * Checks now populate. Still not counting area totals properly. * Don't track RC_LINKS_POCKET in the data file, and instead manually add it in every time a save is load. rcObjects doesn't contain Link's Pocket location (duh). * Moved ItemReceive hook to randomizer_check_tracker.cpp. Skipped items are properly sorted and formatted. Saved items contribute to an area's gotten/skipped checks on load. Changed skipped items default main color to gray. General code cleanup. * Skipped checks now contribute to area totals for area completion logic. * Mid-menu rework transfer. * Started check lookup on item receive. Tried to enable scum checking on save. * Fixed scum check on save. * More code cleanup, which revealed some issues with loading and saving. Loading now works 100%, but entries in checkTrackerData are disappearing in code somewhere, causing issues with later checks. Scummed color now displays properly. Collected but unsaved displays properly. Unchecked, Skipped, Seen and Scummed checks all have arrows for skipping/unskipping. Counts a little messed up, probably double adding skips. * Fixed item counts being off across resets. Restarts were fine. * Beginning of rework for individual check updates. Adds `Actor lastCheck` to PlayState to allow assigning of last actor to give an item. This allows precise tracking of GS, freestanding PoH, etc. Works for chests too. Currently does not work for shops, unknown for normal NPC gives. Doesn't track last gives for non-checks, like drops from grass, pots, crates, etc. * Actor-based checks fully fleshed out, but can't help with sale-based checks. Implemented `pendingSaleCheck` to back out of an RC check cycle if `gSaveContext->pendingSale` is not NONE when `OnItemReceive` is called, processed through `OnSaleEnd`. This should be the final change necessary to streamline the checks. * Temporary hook to message box close to tie in trackers for non-gs/chest actors that aren't added to `GetCheckFromActor`. This triggers a 2-frame countdown to check with `HasItemBeenCollected` since half of the methods in there aren't updated until after a text box closes. Added scene tracking to get last scene so that checks in scenes that span several overworld areas could be tied to their areas properly. Modified tracker data creation to apply Link's Pocket and Song from Impa conditionally based on randomizer settings instead of just being assumed to be done. May need modification for checking click and drag spoiler loading. Removed the scene equivalence check from CheckChecks so that an entire area is checked each time to avoid issues with, e.g., leaving a shop before a pending sale finishes. * Changed check data creation to use RSKs from gRandomizer to account for settings loaded from drag and drop spoilers. * Beginning of tracker code organization. Changed check color defaults. * Reverted moving tracker colors to header. Some individual check fixes. * Missed something from previous merge? * Removed last remnant of removed performance mode. * Better handle checking when skullsanity is off. * Song checks sceneIDs don't match the scenes they're actually in for some reason. Removed that check. * SaleEnd checks don't need the GetItemEntry parameter. Also set a flag that should prevent the check tracker from running during vanilla saves should that not be resolved by the time it's merged. * Attempting to have only the relevant checks added to the tracker data, as well as showing vanilla checks for non-rando saves. Not working yet (everything is displayed in vanilla). * Added vanilla check tracker population via `vanillaCheck` bool in `RandomizerCheckObject`. This is also added to `IsVisibleInImGui` to handle file loading and saving to eliminate checks that aren't part of vanilla or the rando seed. Implemented deleted tracker data file recreation. Added some extra item name text checks. Songs are still... tricky, so they stay blank. Utilize local copies of the randomizer check objects that are applicable for performance purposes. Fixed vanilla item-giving cutscene crashes when triggered mid-transition. * Apparently not all toolchains can handle macro instantiation without all parameters, like VS can. * Fixed scummed detail color not showing properly on tracker. * Fixed dungeon area totals and GS checks not functioning properly. * Major revamp of checking code. Doesn't rely on `GetCheckFromActor` at all anymore, but instead simply sets a flag to evaluate a number of checks in an area every frame until the check that was gotten is identified. With the new setup, it's much less hardware intensive, and at 60fps 6 checks per frame shows no noticeable effect on framerate. I can envision needing to add a collectedCount in order to account for times when two checks are gotten one right after the other. Changed area scroll to happen from `OnTransitionEnd`, and allow for scrolling in bazaar (was disabled previously because it would jump back and forth between Kak and Market while you were in one). Also setup area check order updating by area instead of all at the same time. * Fixed shooting gallery not reporting proper area. Prevent checks from actually happening if area is RCAREA_INVALID, now that all areas are reporting something if they have checks. Fixed `GetCheckArea()` not updating checks for standard scenes. Lots of vanilla tracking updates, mainly manual checks for gems, medallions and songs, since the often don't have proper scenes in the data. Prevent vanilla from triggering check loops if junk items are collected. Fixed sorting based on saved vs collected. Prevent item name display for vanilla runs. Change coloring of checks so the check name reflects status in vanilla runs. * Fixed "Recheck Area" button erroneously adding to an area's check totals? * Fix DMC vanilla checks. * Fix check tracker data recreation on data file loss. Removed redundant file exists check from SaveTrackerDataHook, as it doesn't matter if it exists or not at that point. Limited check loops to 3 to avoid infinite check loops on non-check/junk item pickup. Added more checks to disable tracker operations if a save is not running. Changed check ordering to put boss reward and heart container checks at the end of whatever RCSHOW group they belong to. * Fixed IsRunning calculation. Further improving vanilla checking. Starting framework for checking medallions, stones, and songs on data file recreation. Fixed medallion check collection. Added GIFT_FROM_SAGES to check list for vanilla file for tracking light medallion. Added check loop limitation to prevent infinite checking after picking up junk item from the ground. * Finished vanilla file recreation and recheck (songs and dungeon rewards all check properly now). This includes deku shield with KF shop item 3. Finished Gift from Raoru light medallion tracking for vanilla. Commented all CheckByScene functionality for now. * Fixed new save data file creation. Disabled entrance area calculation for now, as it only tracks the previous entrance for some reason. Fixed area detection for ToT checks. * GetCheckArea() now utilizes EntranceData almost exclusively, via either `gSaveContext.entranceIndex` or the entrance tracker's `currentGrottoId` in the case of grottos. This also means that EVERYTHING CAN AUTOSCROLL NOW. Entrance shuffles are now much easier to track. Autoscroll is now also triggered on save, just in case someone isn't autosaving and has a lot of checks that get converted to saved. * Fixed missing GS check in LW. * Added area scroll on toggling Show Hidden Items. May configure differently later. Fixed area detection for entrances in Gerudo Fortress/Valley and Collossus. Haunted wasteland doesn't autoscroll due to a bug in `OnTransitionEnd` hook, but checks still evaluate properly there. Rely on scene-based area detection if scene is a main overworld or dungeon scene. * Fixed grotto detection when shuffle is off. * Small code cleanup. Fixed Colossus hand chest checks. * Missing lus bump from merge conflict resolution * Fixed Colossus Grotto making `GetCheckArea` return Wasteland. * Improved OnItemReceive processing for non-token GS checks, since they can sometimes take long enough for the checking process to time out before the item is registered as received. * First attempt at thread safety for tracker data file writing. Seems to work, but might need more testing. * Fixed Recheck Area not unskipping items that register as saved. Improved delayed saving with autosaving, as the autosave triggered quite often before the tracker data save, making things not properly register as saved. * merge cleanup * Converted check tracker data to the sectional saves, adding `CheckTrackerData` to `SaveContext`. Implemented section ID returning and fullSave boolean passing to section functions from my PR temporarily for it to work properly. Moved `RandomizerCheckTrackerData` enum to `randomizerTypes.h` to accommodate that. Changed `Randomizer_SaveInit` to a `SaveManager::InitFunc` to allow for other randomizer-dependent sections to be initialized after that. Required a little refactoring to maintain intro cutscene skip when starting a randomizer file. * Revert section index return and randomizer init changes. Will need to wait on yet more changes to main. * Fixed check tracker initialization (shouldn't be tied to window initialization), restored saving/loading functionality. * Removed `CheckTracker::Init` and put SaveManager calls in `CheckTrackerWindow::InitElement`. Also a bit of cleanup from transition back to save file use. * Fixed tracker displaying check categories while file not loaded. * Fix Darunia's Joy check not marking in vanilla. * Fix autosave not triggering change from collected to saved in tracker data. * Changed default colors for scummed and collected display. * Merge upgrade code cleanup. * Add `OnTransitionEnd` calls to sandstorm transitions both to and from Wasteland. Also improved `gSaveContext.lastScene` assignment for both transition types. Allowed a bit of cleanup in `GetCheckArea`. * Added `StateButton`, a button like `ArrowButton` but that allows text instead of arrow icons. Apparently the changes from ArrowButton to StateButton happened in a previous commit... * Changed section name to `trackerDataCheck` to force SoH to load it after the randomizer section, as it required some randoSettings to be loaded first, and nothing else I tried to make the randomizer section load before it worked. This hacks a solution to checks not displaying on fast file load to a specific slot. F*** you, SaveManager, and f*** you too, JSON. * Forgot to change the section string for loading with the name change. * Fix check ordering for checks that trigger the autosave. * Adds option to remove right-side shop items (slots 1-4) from the tracker list. Enabled by default. * Fix default state of Hide Shop Right Checks checkbox. * Fixes grotto and great fairy scrolling and checks. Fixes array overflow from `checkTrackerData` which was creating the issue trying to load the base and randomizer sections first, among other things. That also fixed the massive file loads that were being exhibited in debug mode. * Fix shooting galleries being set as collected again when being played a second time after getting the checks. * Fix Bazaar autoscroll. * Add Saria's Song to `GetCheckFromActor` and removed some limitations from the messageCloseCheck function to make that check track properly. * Fix Song from Impa check. Implemented prevention for multiple "collections" of great fairies, just in case getting the health refill would trigger it with the previous setup. * Fix ice traps on GS tokens not triggering OnItemReceive. * Complete fix for ice trap collection from GS. Add autoscroll when clicking "Expand All". * Add `OnShopSlotChange` with cursorSlot and basePrice parameters. * Fixed include in en_ossan for shop slot hook. Added registration for `OnShopSlotChange` in the tracker, storing the price in a new `price` field in `CheckTrackerData`. Added "seen" functionality to shop checks. Displays the model item name upon first entering a shop, adding the price and switching to trickName (if it's an ice trap) upon navigating to the slot in buy mode, triggered by an invisible "identified" status that mirrors "seen" in every other way. Added tooltips to most options for check tracker color picking to describe what each status actually means. * `std::format` pls * So apparently std::format just decided to break with the latest merge from develop, but fmt::format exists and works? * Removed the last vestiges of `locationsSkipped`. Other general code and formatting cleanups. Moved `IsGameRunning` to `OTRGlobals` so the item tracker could also access it. Used preceding to "fix" item and bottle display in the item tracker on startup. * Some more code cleanup. Removed "Recheck Area" button and relevant code. Backported changes to Anchor branch applicable for single-player, including making a checkAreas vector and structuring the frame by frame checks around that. Also includes fix for Silver Gauntlets and Mirror Shield check collection crash associated with those changes. Fixed Kakariko Bazaar "seen" updates. Fixed tracker window not showing on initial load like it should. * Forgot 1 formatting fix. * Removed conditions for showing Song from Impa (isn't junk under certain conditions, so should show all the time). * Fix vanilla checks, add Zelda's Letter and Malon's Egg to manual check collection. Fix autoscroll while in child stealth section. * Fix crash in Happy Mask Shop in OnSlotChange (referenced non-existent shop id in a tracker-specific enum). * General code cleanup. * Missed one reversion. * One more. * Fix column alignment in `randomizer_check_objects`. * Fix file encoding on `randomizer_check_tracker`. Again. * Fix indentation for `actualItemtrackerItemMap`. Also removed unnecessary parts of the map. * Rename `HasEqItem` to `HasEquipment`. * Slightly better indentation for `actualItemTrackerItemMap`. * Add magic bean salesman to vanilla check tracking, and genericized deku shield to trigger KF shop item 3 wherever you get the shield. Renamed `vanillaCheck` to `vanillaHundoCheck` to (supposedly) clarify the meaning of the usage. * One more rename to `vanillaCompletion` to avoid possible confusion with 100% speedrun conditions. * give me a break XD Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * Changes suggested by briaguya (rename `RandomizerCheckShow` to `Status`, unused code, newline formatting) * Remove unused `itemNames` table. * Remove `IsGameRunning` in favor of `GameInteractor::IsSaveLoaded`. * Restore anti-spoiler functionality for dungeons with dungeon maps. * Review cleanup. * Fix prices not showing for Kak bazaar items. --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com>
2023-10-04 11:03:36 -04:00
"gCheckTrackerCollectedMainColor", "gCheckTrackerCollectedExtraColor",
Randomizer Auto Location tracker (#1942) * Initial Auto-Location Tracking * Updates styling for checked items in Check Tracker * Fixes crashing issues with Check Tracker rendering * Auto scroll Check Tracker windows to current area * Checks Tracker only shows checked locations once in game * Fixes issue where Check Tracker would auto-scroll to wrong location when entering a grotto * Fixes gerudo fortress checks showing in tracker when settings have them removed * InfTable Check Location Fixes: Lost Dog Richard, Rolling Gorons, HBA 1000, Thawed Zora * Fixes most Event Chk Inf Checks on Check Tracker, and Frogs * Check Tracker - Song from Malon now works * Check Tracker - Fixes Claim Check check not tracking - Fixes spoiler for Claim Check check when getting Biggoron's Sword - Fixes LACS being spoiled and not tracking * Check Tracker - Fixes #2 for Skull Mask and Mask of Truth checks * Check Tracker - Adds support for merchants - Fixes #7 for Bomchu Salesman - Fixes #12 for Medigoron * Check Tracker - Fixes #8 for Song from Saria * Check Tracker - Fixes #9 for Adult Shooting Gallery * Check Tracker - Fixes #10 for Composer Grave * Check Tracker - Fixes #14 for Song from Ocarina of Time * Check Tracker - Fixes #16 for Shooting the Sun * Check Tracker - Fixes #19 for Darunia's Joy * Save Editor - Adds missing label for Treasure Chest Game * Check Tracker - Fixes Great Faries checks * Check Tracker - Fixes Sheik at Temple * Check Tracker - Fixes Great Fairy auto-scroll to wrong location * Check Tracker - Updates blue warp checks - Fixes Bongo Bongo and Twinrova checks * Check Tracker - Fixes Dampe's Gravedigging Tour * Check Tracker - Fixes Prescription to King Zora * Check Tracker - Fixes Bazaar showing under wrong area on tracker between adult/child * Check Tracker - Fixes scroll for Hyrule Market and Bazaar * Check Tracker - Fixes giving Adult Trade Items shown on tracker: Broken Sword, Saw, Cojiro, Eyeball Froge, and Eyedrops * Cleans up item_location * Check Tracker - Item List - Fixes item list not updating when changing seeds/options - Separates item exclusion list from item check list - Clean up comments * Check Tracker - Adds Skip functionality to buttons * Check Tracker - Refactors adult trade items to RandomizerInf * Check Tracker - Fixes an issue where any time an item is removed the tracker would cause an application crash * Check Tracker - Item names are now dependent on file language * Check Tracker - Fixes Gerudo Card check not showing in Fast setting * Reorders headers to (hopefully) avoid CI build conflicts on linux/consoles * Explicitly defines vector header in randomizer.h to fix compile errors * Complete Refactor of Check Tracker ImGui * Adds missing check tracker files to CMakeLists * Reverts the Item_location whitespace cleanup from ad10807c * Check Tracker - Loading Fixes - Fixes a bug where loading a save file a second time would add all the checks again - Fixes a bug where the check tracker would not render at all until in a save file * Check Tracker - Fixes a bug where checks would sometimes fail to load * Check Tracker - Fixes duplicated checks when using Only on Pause or Only on Combo * Check Tracker - Works around issue where single characters don't show in EnhancementCombobox, and fixes a label for combo buttons held option * Check Tracker - Applies all Check Tracker changes to Item Location * Check Tracker - Updated Check List - Adds Link's pocket, either in KF or HM depending on starting age - Supports Scrubs and Merchants - Uses enums instead of magic numbers - Updates DC Scrub Short Names for MQ * Check Tracker - Adds a performance mode option * Check Tracker - List Fixes (requires new rando generation) - Fixes Frogs Rupees always visible - Fixes Kokiri Sword Chest not showing - Fixes Weird Egg not showing * Check Tracker - MQ List basic support * Check Tracker - MQ/Vanilla anti-spoilers * Check Tracker - Collecting a compass now spoils the area * Check Tracker - Basic Vanilla Support and fixes - Vanilla items show in check tracker, even if many won't auto check - Fixes an issue with Gerudo Fortress Keys - Refactors IsVisibleInCheckTracker to randomizer_check_tracjer * Check Tracker - Fixes merge conflict from 08a487f35e1d760ab9e69b932edbe4da6bcd9edb * Check Tracker - Fixes tracker loading as Floating when default value is set to Windowed * Randomizer Location Exclusion List - Adds Scrubs, Merchants, Shops. Adult Trade items, MQ Dungeons, and Bean Salesman - Fixes Kokiri Sword Chest, Weird Egg, and Frog Song Rupees from misbehaving - Updates Gerudo Fortress logic to be dependent on Open/Fast/Normal Fortress - Removes Invalid Check - Adds RO Enum for MQ settings - Updates magic values to RO enum * Location Exclusion List - Scrubs that are always randomized now always show on the list * For now, removes some extra code only needed for a Check Tracker. * Randomizer Location Exclusion List - Fixes Eyeball Frog from showing up when Adult Trade Items was off * Location Tracker - Updates Eyedrops to use RandomizerInf instead of Chest * Check Tracker - Fixes a bug where Link's Pocket item wasn't acting as checked for area item count * Check Tracker - Fixes a bug where Locations would incorrectly say Vanilla due to the first check in the area being a non-MQ check * Check Tracker - Fixes a crash when Check Tracker is docked but not visible * Check Tracker - Fixes areas being spoiled when loading different save files * Check Tracker - Only reset variables if they are initialized * Check Tracker - Cleans up old comments, unused variables, methods, and macros, adds language TODOs, * Check Tracker - Readds rainbow UI elements after Cosmetics Editor refactor * Check Tracker - Removal of flag lookup that was refactored, no longer needed header, and some trivial whitespace fixes. * Check Tracker - Refactors Index to Bitmask code to a macro * Check Tracker - Changes ordering from alphabetical to RandomizerCheck ordering * Check Tracker - Wraps everything in a namespace to avoid global variable usage * Check Tracker - Explicitly defines for-loop scope * Check Tracker - refactors dungeon lookup from static array to function * Fixes a bug when using EnhancementColor with alpha * Check Tracker - Refactors all colour to use direct conversions * Check Tracker - refactors settings loading and check visibility for readability * Check Tracker - Fixes a bug where the wrong label showed on the Check Tracker BG Color * UIWidgets - Adds Alpha bar to EnhancementColor when using alpha parameter
2022-12-10 22:39:23 -05:00
"gCheckTrackerScummedMainColor", "gCheckTrackerScummedExtraColor",
"gCheckTrackerSavedMainColor", "gCheckTrackerSavedExtraColor",
};
int hue = 0;
void RainbowTick() {
float freqHue = hue * 2 * M_PI / (360 * CVarGetFloat("gCosmetics.RainbowSpeed", 0.6f));
for (auto& cvar : rainbowCVars) {
if (CVarGetInteger((cvar + "RBM").c_str(), 0) == 0) {
Randomizer Auto Location tracker (#1942) * Initial Auto-Location Tracking * Updates styling for checked items in Check Tracker * Fixes crashing issues with Check Tracker rendering * Auto scroll Check Tracker windows to current area * Checks Tracker only shows checked locations once in game * Fixes issue where Check Tracker would auto-scroll to wrong location when entering a grotto * Fixes gerudo fortress checks showing in tracker when settings have them removed * InfTable Check Location Fixes: Lost Dog Richard, Rolling Gorons, HBA 1000, Thawed Zora * Fixes most Event Chk Inf Checks on Check Tracker, and Frogs * Check Tracker - Song from Malon now works * Check Tracker - Fixes Claim Check check not tracking - Fixes spoiler for Claim Check check when getting Biggoron's Sword - Fixes LACS being spoiled and not tracking * Check Tracker - Fixes #2 for Skull Mask and Mask of Truth checks * Check Tracker - Adds support for merchants - Fixes #7 for Bomchu Salesman - Fixes #12 for Medigoron * Check Tracker - Fixes #8 for Song from Saria * Check Tracker - Fixes #9 for Adult Shooting Gallery * Check Tracker - Fixes #10 for Composer Grave * Check Tracker - Fixes #14 for Song from Ocarina of Time * Check Tracker - Fixes #16 for Shooting the Sun * Check Tracker - Fixes #19 for Darunia's Joy * Save Editor - Adds missing label for Treasure Chest Game * Check Tracker - Fixes Great Faries checks * Check Tracker - Fixes Sheik at Temple * Check Tracker - Fixes Great Fairy auto-scroll to wrong location * Check Tracker - Updates blue warp checks - Fixes Bongo Bongo and Twinrova checks * Check Tracker - Fixes Dampe's Gravedigging Tour * Check Tracker - Fixes Prescription to King Zora * Check Tracker - Fixes Bazaar showing under wrong area on tracker between adult/child * Check Tracker - Fixes scroll for Hyrule Market and Bazaar * Check Tracker - Fixes giving Adult Trade Items shown on tracker: Broken Sword, Saw, Cojiro, Eyeball Froge, and Eyedrops * Cleans up item_location * Check Tracker - Item List - Fixes item list not updating when changing seeds/options - Separates item exclusion list from item check list - Clean up comments * Check Tracker - Adds Skip functionality to buttons * Check Tracker - Refactors adult trade items to RandomizerInf * Check Tracker - Fixes an issue where any time an item is removed the tracker would cause an application crash * Check Tracker - Item names are now dependent on file language * Check Tracker - Fixes Gerudo Card check not showing in Fast setting * Reorders headers to (hopefully) avoid CI build conflicts on linux/consoles * Explicitly defines vector header in randomizer.h to fix compile errors * Complete Refactor of Check Tracker ImGui * Adds missing check tracker files to CMakeLists * Reverts the Item_location whitespace cleanup from ad10807c * Check Tracker - Loading Fixes - Fixes a bug where loading a save file a second time would add all the checks again - Fixes a bug where the check tracker would not render at all until in a save file * Check Tracker - Fixes a bug where checks would sometimes fail to load * Check Tracker - Fixes duplicated checks when using Only on Pause or Only on Combo * Check Tracker - Works around issue where single characters don't show in EnhancementCombobox, and fixes a label for combo buttons held option * Check Tracker - Applies all Check Tracker changes to Item Location * Check Tracker - Updated Check List - Adds Link's pocket, either in KF or HM depending on starting age - Supports Scrubs and Merchants - Uses enums instead of magic numbers - Updates DC Scrub Short Names for MQ * Check Tracker - Adds a performance mode option * Check Tracker - List Fixes (requires new rando generation) - Fixes Frogs Rupees always visible - Fixes Kokiri Sword Chest not showing - Fixes Weird Egg not showing * Check Tracker - MQ List basic support * Check Tracker - MQ/Vanilla anti-spoilers * Check Tracker - Collecting a compass now spoils the area * Check Tracker - Basic Vanilla Support and fixes - Vanilla items show in check tracker, even if many won't auto check - Fixes an issue with Gerudo Fortress Keys - Refactors IsVisibleInCheckTracker to randomizer_check_tracjer * Check Tracker - Fixes merge conflict from 08a487f35e1d760ab9e69b932edbe4da6bcd9edb * Check Tracker - Fixes tracker loading as Floating when default value is set to Windowed * Randomizer Location Exclusion List - Adds Scrubs, Merchants, Shops. Adult Trade items, MQ Dungeons, and Bean Salesman - Fixes Kokiri Sword Chest, Weird Egg, and Frog Song Rupees from misbehaving - Updates Gerudo Fortress logic to be dependent on Open/Fast/Normal Fortress - Removes Invalid Check - Adds RO Enum for MQ settings - Updates magic values to RO enum * Location Exclusion List - Scrubs that are always randomized now always show on the list * For now, removes some extra code only needed for a Check Tracker. * Randomizer Location Exclusion List - Fixes Eyeball Frog from showing up when Adult Trade Items was off * Location Tracker - Updates Eyedrops to use RandomizerInf instead of Chest * Check Tracker - Fixes a bug where Link's Pocket item wasn't acting as checked for area item count * Check Tracker - Fixes a bug where Locations would incorrectly say Vanilla due to the first check in the area being a non-MQ check * Check Tracker - Fixes a crash when Check Tracker is docked but not visible * Check Tracker - Fixes areas being spoiled when loading different save files * Check Tracker - Only reset variables if they are initialized * Check Tracker - Cleans up old comments, unused variables, methods, and macros, adds language TODOs, * Check Tracker - Readds rainbow UI elements after Cosmetics Editor refactor * Check Tracker - Removal of flag lookup that was refactored, no longer needed header, and some trivial whitespace fixes. * Check Tracker - Refactors Index to Bitmask code to a macro * Check Tracker - Changes ordering from alphabetical to RandomizerCheck ordering * Check Tracker - Wraps everything in a namespace to avoid global variable usage * Check Tracker - Explicitly defines for-loop scope * Check Tracker - refactors dungeon lookup from static array to function * Fixes a bug when using EnhancementColor with alpha * Check Tracker - Refactors all colour to use direct conversions * Check Tracker - refactors settings loading and check visibility for readability * Check Tracker - Fixes a bug where the wrong label showed on the Check Tracker BG Color * UIWidgets - Adds Alpha bar to EnhancementColor when using alpha parameter
2022-12-10 22:39:23 -05:00
continue;
}
Randomizer Auto Location tracker (#1942) * Initial Auto-Location Tracking * Updates styling for checked items in Check Tracker * Fixes crashing issues with Check Tracker rendering * Auto scroll Check Tracker windows to current area * Checks Tracker only shows checked locations once in game * Fixes issue where Check Tracker would auto-scroll to wrong location when entering a grotto * Fixes gerudo fortress checks showing in tracker when settings have them removed * InfTable Check Location Fixes: Lost Dog Richard, Rolling Gorons, HBA 1000, Thawed Zora * Fixes most Event Chk Inf Checks on Check Tracker, and Frogs * Check Tracker - Song from Malon now works * Check Tracker - Fixes Claim Check check not tracking - Fixes spoiler for Claim Check check when getting Biggoron's Sword - Fixes LACS being spoiled and not tracking * Check Tracker - Fixes #2 for Skull Mask and Mask of Truth checks * Check Tracker - Adds support for merchants - Fixes #7 for Bomchu Salesman - Fixes #12 for Medigoron * Check Tracker - Fixes #8 for Song from Saria * Check Tracker - Fixes #9 for Adult Shooting Gallery * Check Tracker - Fixes #10 for Composer Grave * Check Tracker - Fixes #14 for Song from Ocarina of Time * Check Tracker - Fixes #16 for Shooting the Sun * Check Tracker - Fixes #19 for Darunia's Joy * Save Editor - Adds missing label for Treasure Chest Game * Check Tracker - Fixes Great Faries checks * Check Tracker - Fixes Sheik at Temple * Check Tracker - Fixes Great Fairy auto-scroll to wrong location * Check Tracker - Updates blue warp checks - Fixes Bongo Bongo and Twinrova checks * Check Tracker - Fixes Dampe's Gravedigging Tour * Check Tracker - Fixes Prescription to King Zora * Check Tracker - Fixes Bazaar showing under wrong area on tracker between adult/child * Check Tracker - Fixes scroll for Hyrule Market and Bazaar * Check Tracker - Fixes giving Adult Trade Items shown on tracker: Broken Sword, Saw, Cojiro, Eyeball Froge, and Eyedrops * Cleans up item_location * Check Tracker - Item List - Fixes item list not updating when changing seeds/options - Separates item exclusion list from item check list - Clean up comments * Check Tracker - Adds Skip functionality to buttons * Check Tracker - Refactors adult trade items to RandomizerInf * Check Tracker - Fixes an issue where any time an item is removed the tracker would cause an application crash * Check Tracker - Item names are now dependent on file language * Check Tracker - Fixes Gerudo Card check not showing in Fast setting * Reorders headers to (hopefully) avoid CI build conflicts on linux/consoles * Explicitly defines vector header in randomizer.h to fix compile errors * Complete Refactor of Check Tracker ImGui * Adds missing check tracker files to CMakeLists * Reverts the Item_location whitespace cleanup from ad10807c * Check Tracker - Loading Fixes - Fixes a bug where loading a save file a second time would add all the checks again - Fixes a bug where the check tracker would not render at all until in a save file * Check Tracker - Fixes a bug where checks would sometimes fail to load * Check Tracker - Fixes duplicated checks when using Only on Pause or Only on Combo * Check Tracker - Works around issue where single characters don't show in EnhancementCombobox, and fixes a label for combo buttons held option * Check Tracker - Applies all Check Tracker changes to Item Location * Check Tracker - Updated Check List - Adds Link's pocket, either in KF or HM depending on starting age - Supports Scrubs and Merchants - Uses enums instead of magic numbers - Updates DC Scrub Short Names for MQ * Check Tracker - Adds a performance mode option * Check Tracker - List Fixes (requires new rando generation) - Fixes Frogs Rupees always visible - Fixes Kokiri Sword Chest not showing - Fixes Weird Egg not showing * Check Tracker - MQ List basic support * Check Tracker - MQ/Vanilla anti-spoilers * Check Tracker - Collecting a compass now spoils the area * Check Tracker - Basic Vanilla Support and fixes - Vanilla items show in check tracker, even if many won't auto check - Fixes an issue with Gerudo Fortress Keys - Refactors IsVisibleInCheckTracker to randomizer_check_tracjer * Check Tracker - Fixes merge conflict from 08a487f35e1d760ab9e69b932edbe4da6bcd9edb * Check Tracker - Fixes tracker loading as Floating when default value is set to Windowed * Randomizer Location Exclusion List - Adds Scrubs, Merchants, Shops. Adult Trade items, MQ Dungeons, and Bean Salesman - Fixes Kokiri Sword Chest, Weird Egg, and Frog Song Rupees from misbehaving - Updates Gerudo Fortress logic to be dependent on Open/Fast/Normal Fortress - Removes Invalid Check - Adds RO Enum for MQ settings - Updates magic values to RO enum * Location Exclusion List - Scrubs that are always randomized now always show on the list * For now, removes some extra code only needed for a Check Tracker. * Randomizer Location Exclusion List - Fixes Eyeball Frog from showing up when Adult Trade Items was off * Location Tracker - Updates Eyedrops to use RandomizerInf instead of Chest * Check Tracker - Fixes a bug where Link's Pocket item wasn't acting as checked for area item count * Check Tracker - Fixes a bug where Locations would incorrectly say Vanilla due to the first check in the area being a non-MQ check * Check Tracker - Fixes a crash when Check Tracker is docked but not visible * Check Tracker - Fixes areas being spoiled when loading different save files * Check Tracker - Only reset variables if they are initialized * Check Tracker - Cleans up old comments, unused variables, methods, and macros, adds language TODOs, * Check Tracker - Readds rainbow UI elements after Cosmetics Editor refactor * Check Tracker - Removal of flag lookup that was refactored, no longer needed header, and some trivial whitespace fixes. * Check Tracker - Refactors Index to Bitmask code to a macro * Check Tracker - Changes ordering from alphabetical to RandomizerCheck ordering * Check Tracker - Wraps everything in a namespace to avoid global variable usage * Check Tracker - Explicitly defines for-loop scope * Check Tracker - refactors dungeon lookup from static array to function * Fixes a bug when using EnhancementColor with alpha * Check Tracker - Refactors all colour to use direct conversions * Check Tracker - refactors settings loading and check visibility for readability * Check Tracker - Fixes a bug where the wrong label showed on the Check Tracker BG Color * UIWidgets - Adds Alpha bar to EnhancementColor when using alpha parameter
2022-12-10 22:39:23 -05:00
Color_RGBA8 newColor;
newColor.r = sin(freqHue + 0) * 127 + 128;
newColor.g = sin(freqHue + (2 * M_PI / 3)) * 127 + 128;
newColor.b = sin(freqHue + (4 * M_PI / 3)) * 127 + 128;
newColor.a = 255;
CVarSetColor(cvar.c_str(), newColor);
Randomizer Auto Location tracker (#1942) * Initial Auto-Location Tracking * Updates styling for checked items in Check Tracker * Fixes crashing issues with Check Tracker rendering * Auto scroll Check Tracker windows to current area * Checks Tracker only shows checked locations once in game * Fixes issue where Check Tracker would auto-scroll to wrong location when entering a grotto * Fixes gerudo fortress checks showing in tracker when settings have them removed * InfTable Check Location Fixes: Lost Dog Richard, Rolling Gorons, HBA 1000, Thawed Zora * Fixes most Event Chk Inf Checks on Check Tracker, and Frogs * Check Tracker - Song from Malon now works * Check Tracker - Fixes Claim Check check not tracking - Fixes spoiler for Claim Check check when getting Biggoron's Sword - Fixes LACS being spoiled and not tracking * Check Tracker - Fixes #2 for Skull Mask and Mask of Truth checks * Check Tracker - Adds support for merchants - Fixes #7 for Bomchu Salesman - Fixes #12 for Medigoron * Check Tracker - Fixes #8 for Song from Saria * Check Tracker - Fixes #9 for Adult Shooting Gallery * Check Tracker - Fixes #10 for Composer Grave * Check Tracker - Fixes #14 for Song from Ocarina of Time * Check Tracker - Fixes #16 for Shooting the Sun * Check Tracker - Fixes #19 for Darunia's Joy * Save Editor - Adds missing label for Treasure Chest Game * Check Tracker - Fixes Great Faries checks * Check Tracker - Fixes Sheik at Temple * Check Tracker - Fixes Great Fairy auto-scroll to wrong location * Check Tracker - Updates blue warp checks - Fixes Bongo Bongo and Twinrova checks * Check Tracker - Fixes Dampe's Gravedigging Tour * Check Tracker - Fixes Prescription to King Zora * Check Tracker - Fixes Bazaar showing under wrong area on tracker between adult/child * Check Tracker - Fixes scroll for Hyrule Market and Bazaar * Check Tracker - Fixes giving Adult Trade Items shown on tracker: Broken Sword, Saw, Cojiro, Eyeball Froge, and Eyedrops * Cleans up item_location * Check Tracker - Item List - Fixes item list not updating when changing seeds/options - Separates item exclusion list from item check list - Clean up comments * Check Tracker - Adds Skip functionality to buttons * Check Tracker - Refactors adult trade items to RandomizerInf * Check Tracker - Fixes an issue where any time an item is removed the tracker would cause an application crash * Check Tracker - Item names are now dependent on file language * Check Tracker - Fixes Gerudo Card check not showing in Fast setting * Reorders headers to (hopefully) avoid CI build conflicts on linux/consoles * Explicitly defines vector header in randomizer.h to fix compile errors * Complete Refactor of Check Tracker ImGui * Adds missing check tracker files to CMakeLists * Reverts the Item_location whitespace cleanup from ad10807c * Check Tracker - Loading Fixes - Fixes a bug where loading a save file a second time would add all the checks again - Fixes a bug where the check tracker would not render at all until in a save file * Check Tracker - Fixes a bug where checks would sometimes fail to load * Check Tracker - Fixes duplicated checks when using Only on Pause or Only on Combo * Check Tracker - Works around issue where single characters don't show in EnhancementCombobox, and fixes a label for combo buttons held option * Check Tracker - Applies all Check Tracker changes to Item Location * Check Tracker - Updated Check List - Adds Link's pocket, either in KF or HM depending on starting age - Supports Scrubs and Merchants - Uses enums instead of magic numbers - Updates DC Scrub Short Names for MQ * Check Tracker - Adds a performance mode option * Check Tracker - List Fixes (requires new rando generation) - Fixes Frogs Rupees always visible - Fixes Kokiri Sword Chest not showing - Fixes Weird Egg not showing * Check Tracker - MQ List basic support * Check Tracker - MQ/Vanilla anti-spoilers * Check Tracker - Collecting a compass now spoils the area * Check Tracker - Basic Vanilla Support and fixes - Vanilla items show in check tracker, even if many won't auto check - Fixes an issue with Gerudo Fortress Keys - Refactors IsVisibleInCheckTracker to randomizer_check_tracjer * Check Tracker - Fixes merge conflict from 08a487f35e1d760ab9e69b932edbe4da6bcd9edb * Check Tracker - Fixes tracker loading as Floating when default value is set to Windowed * Randomizer Location Exclusion List - Adds Scrubs, Merchants, Shops. Adult Trade items, MQ Dungeons, and Bean Salesman - Fixes Kokiri Sword Chest, Weird Egg, and Frog Song Rupees from misbehaving - Updates Gerudo Fortress logic to be dependent on Open/Fast/Normal Fortress - Removes Invalid Check - Adds RO Enum for MQ settings - Updates magic values to RO enum * Location Exclusion List - Scrubs that are always randomized now always show on the list * For now, removes some extra code only needed for a Check Tracker. * Randomizer Location Exclusion List - Fixes Eyeball Frog from showing up when Adult Trade Items was off * Location Tracker - Updates Eyedrops to use RandomizerInf instead of Chest * Check Tracker - Fixes a bug where Link's Pocket item wasn't acting as checked for area item count * Check Tracker - Fixes a bug where Locations would incorrectly say Vanilla due to the first check in the area being a non-MQ check * Check Tracker - Fixes a crash when Check Tracker is docked but not visible * Check Tracker - Fixes areas being spoiled when loading different save files * Check Tracker - Only reset variables if they are initialized * Check Tracker - Cleans up old comments, unused variables, methods, and macros, adds language TODOs, * Check Tracker - Readds rainbow UI elements after Cosmetics Editor refactor * Check Tracker - Removal of flag lookup that was refactored, no longer needed header, and some trivial whitespace fixes. * Check Tracker - Refactors Index to Bitmask code to a macro * Check Tracker - Changes ordering from alphabetical to RandomizerCheck ordering * Check Tracker - Wraps everything in a namespace to avoid global variable usage * Check Tracker - Explicitly defines for-loop scope * Check Tracker - refactors dungeon lookup from static array to function * Fixes a bug when using EnhancementColor with alpha * Check Tracker - Refactors all colour to use direct conversions * Check Tracker - refactors settings loading and check visibility for readability * Check Tracker - Fixes a bug where the wrong label showed on the Check Tracker BG Color * UIWidgets - Adds Alpha bar to EnhancementColor when using alpha parameter
2022-12-10 22:39:23 -05:00
}
hue++;
hue %= 360;
}
void ImGuiDrawTwoColorPickerSection(const char* text, const char* cvarMainName, const char* cvarExtraName,
Color_RGBA8& main_color, Color_RGBA8& extra_color, Color_RGBA8& main_default_color,
Check Tracker Update (#2668) * Initial commit. What works so far: Data file loads, saves, deletes, and is created properly. - Need to run `HasItemBeenCollected` when creating in case of mid-seed regen. Organized checks into maps set by area. Areas show in tracker. - Checks pulled from checkObjectsByArea are not currently listed. - Areas are being assumed completed and hidden at the start. * Checks now populate. Still not counting area totals properly. * Don't track RC_LINKS_POCKET in the data file, and instead manually add it in every time a save is load. rcObjects doesn't contain Link's Pocket location (duh). * Moved ItemReceive hook to randomizer_check_tracker.cpp. Skipped items are properly sorted and formatted. Saved items contribute to an area's gotten/skipped checks on load. Changed skipped items default main color to gray. General code cleanup. * Skipped checks now contribute to area totals for area completion logic. * Mid-menu rework transfer. * Started check lookup on item receive. Tried to enable scum checking on save. * Fixed scum check on save. * More code cleanup, which revealed some issues with loading and saving. Loading now works 100%, but entries in checkTrackerData are disappearing in code somewhere, causing issues with later checks. Scummed color now displays properly. Collected but unsaved displays properly. Unchecked, Skipped, Seen and Scummed checks all have arrows for skipping/unskipping. Counts a little messed up, probably double adding skips. * Fixed item counts being off across resets. Restarts were fine. * Beginning of rework for individual check updates. Adds `Actor lastCheck` to PlayState to allow assigning of last actor to give an item. This allows precise tracking of GS, freestanding PoH, etc. Works for chests too. Currently does not work for shops, unknown for normal NPC gives. Doesn't track last gives for non-checks, like drops from grass, pots, crates, etc. * Actor-based checks fully fleshed out, but can't help with sale-based checks. Implemented `pendingSaleCheck` to back out of an RC check cycle if `gSaveContext->pendingSale` is not NONE when `OnItemReceive` is called, processed through `OnSaleEnd`. This should be the final change necessary to streamline the checks. * Temporary hook to message box close to tie in trackers for non-gs/chest actors that aren't added to `GetCheckFromActor`. This triggers a 2-frame countdown to check with `HasItemBeenCollected` since half of the methods in there aren't updated until after a text box closes. Added scene tracking to get last scene so that checks in scenes that span several overworld areas could be tied to their areas properly. Modified tracker data creation to apply Link's Pocket and Song from Impa conditionally based on randomizer settings instead of just being assumed to be done. May need modification for checking click and drag spoiler loading. Removed the scene equivalence check from CheckChecks so that an entire area is checked each time to avoid issues with, e.g., leaving a shop before a pending sale finishes. * Changed check data creation to use RSKs from gRandomizer to account for settings loaded from drag and drop spoilers. * Beginning of tracker code organization. Changed check color defaults. * Reverted moving tracker colors to header. Some individual check fixes. * Missed something from previous merge? * Removed last remnant of removed performance mode. * Better handle checking when skullsanity is off. * Song checks sceneIDs don't match the scenes they're actually in for some reason. Removed that check. * SaleEnd checks don't need the GetItemEntry parameter. Also set a flag that should prevent the check tracker from running during vanilla saves should that not be resolved by the time it's merged. * Attempting to have only the relevant checks added to the tracker data, as well as showing vanilla checks for non-rando saves. Not working yet (everything is displayed in vanilla). * Added vanilla check tracker population via `vanillaCheck` bool in `RandomizerCheckObject`. This is also added to `IsVisibleInImGui` to handle file loading and saving to eliminate checks that aren't part of vanilla or the rando seed. Implemented deleted tracker data file recreation. Added some extra item name text checks. Songs are still... tricky, so they stay blank. Utilize local copies of the randomizer check objects that are applicable for performance purposes. Fixed vanilla item-giving cutscene crashes when triggered mid-transition. * Apparently not all toolchains can handle macro instantiation without all parameters, like VS can. * Fixed scummed detail color not showing properly on tracker. * Fixed dungeon area totals and GS checks not functioning properly. * Major revamp of checking code. Doesn't rely on `GetCheckFromActor` at all anymore, but instead simply sets a flag to evaluate a number of checks in an area every frame until the check that was gotten is identified. With the new setup, it's much less hardware intensive, and at 60fps 6 checks per frame shows no noticeable effect on framerate. I can envision needing to add a collectedCount in order to account for times when two checks are gotten one right after the other. Changed area scroll to happen from `OnTransitionEnd`, and allow for scrolling in bazaar (was disabled previously because it would jump back and forth between Kak and Market while you were in one). Also setup area check order updating by area instead of all at the same time. * Fixed shooting gallery not reporting proper area. Prevent checks from actually happening if area is RCAREA_INVALID, now that all areas are reporting something if they have checks. Fixed `GetCheckArea()` not updating checks for standard scenes. Lots of vanilla tracking updates, mainly manual checks for gems, medallions and songs, since the often don't have proper scenes in the data. Prevent vanilla from triggering check loops if junk items are collected. Fixed sorting based on saved vs collected. Prevent item name display for vanilla runs. Change coloring of checks so the check name reflects status in vanilla runs. * Fixed "Recheck Area" button erroneously adding to an area's check totals? * Fix DMC vanilla checks. * Fix check tracker data recreation on data file loss. Removed redundant file exists check from SaveTrackerDataHook, as it doesn't matter if it exists or not at that point. Limited check loops to 3 to avoid infinite check loops on non-check/junk item pickup. Added more checks to disable tracker operations if a save is not running. Changed check ordering to put boss reward and heart container checks at the end of whatever RCSHOW group they belong to. * Fixed IsRunning calculation. Further improving vanilla checking. Starting framework for checking medallions, stones, and songs on data file recreation. Fixed medallion check collection. Added GIFT_FROM_SAGES to check list for vanilla file for tracking light medallion. Added check loop limitation to prevent infinite checking after picking up junk item from the ground. * Finished vanilla file recreation and recheck (songs and dungeon rewards all check properly now). This includes deku shield with KF shop item 3. Finished Gift from Raoru light medallion tracking for vanilla. Commented all CheckByScene functionality for now. * Fixed new save data file creation. Disabled entrance area calculation for now, as it only tracks the previous entrance for some reason. Fixed area detection for ToT checks. * GetCheckArea() now utilizes EntranceData almost exclusively, via either `gSaveContext.entranceIndex` or the entrance tracker's `currentGrottoId` in the case of grottos. This also means that EVERYTHING CAN AUTOSCROLL NOW. Entrance shuffles are now much easier to track. Autoscroll is now also triggered on save, just in case someone isn't autosaving and has a lot of checks that get converted to saved. * Fixed missing GS check in LW. * Added area scroll on toggling Show Hidden Items. May configure differently later. Fixed area detection for entrances in Gerudo Fortress/Valley and Collossus. Haunted wasteland doesn't autoscroll due to a bug in `OnTransitionEnd` hook, but checks still evaluate properly there. Rely on scene-based area detection if scene is a main overworld or dungeon scene. * Fixed grotto detection when shuffle is off. * Small code cleanup. Fixed Colossus hand chest checks. * Missing lus bump from merge conflict resolution * Fixed Colossus Grotto making `GetCheckArea` return Wasteland. * Improved OnItemReceive processing for non-token GS checks, since they can sometimes take long enough for the checking process to time out before the item is registered as received. * First attempt at thread safety for tracker data file writing. Seems to work, but might need more testing. * Fixed Recheck Area not unskipping items that register as saved. Improved delayed saving with autosaving, as the autosave triggered quite often before the tracker data save, making things not properly register as saved. * merge cleanup * Converted check tracker data to the sectional saves, adding `CheckTrackerData` to `SaveContext`. Implemented section ID returning and fullSave boolean passing to section functions from my PR temporarily for it to work properly. Moved `RandomizerCheckTrackerData` enum to `randomizerTypes.h` to accommodate that. Changed `Randomizer_SaveInit` to a `SaveManager::InitFunc` to allow for other randomizer-dependent sections to be initialized after that. Required a little refactoring to maintain intro cutscene skip when starting a randomizer file. * Revert section index return and randomizer init changes. Will need to wait on yet more changes to main. * Fixed check tracker initialization (shouldn't be tied to window initialization), restored saving/loading functionality. * Removed `CheckTracker::Init` and put SaveManager calls in `CheckTrackerWindow::InitElement`. Also a bit of cleanup from transition back to save file use. * Fixed tracker displaying check categories while file not loaded. * Fix Darunia's Joy check not marking in vanilla. * Fix autosave not triggering change from collected to saved in tracker data. * Changed default colors for scummed and collected display. * Merge upgrade code cleanup. * Add `OnTransitionEnd` calls to sandstorm transitions both to and from Wasteland. Also improved `gSaveContext.lastScene` assignment for both transition types. Allowed a bit of cleanup in `GetCheckArea`. * Added `StateButton`, a button like `ArrowButton` but that allows text instead of arrow icons. Apparently the changes from ArrowButton to StateButton happened in a previous commit... * Changed section name to `trackerDataCheck` to force SoH to load it after the randomizer section, as it required some randoSettings to be loaded first, and nothing else I tried to make the randomizer section load before it worked. This hacks a solution to checks not displaying on fast file load to a specific slot. F*** you, SaveManager, and f*** you too, JSON. * Forgot to change the section string for loading with the name change. * Fix check ordering for checks that trigger the autosave. * Adds option to remove right-side shop items (slots 1-4) from the tracker list. Enabled by default. * Fix default state of Hide Shop Right Checks checkbox. * Fixes grotto and great fairy scrolling and checks. Fixes array overflow from `checkTrackerData` which was creating the issue trying to load the base and randomizer sections first, among other things. That also fixed the massive file loads that were being exhibited in debug mode. * Fix shooting galleries being set as collected again when being played a second time after getting the checks. * Fix Bazaar autoscroll. * Add Saria's Song to `GetCheckFromActor` and removed some limitations from the messageCloseCheck function to make that check track properly. * Fix Song from Impa check. Implemented prevention for multiple "collections" of great fairies, just in case getting the health refill would trigger it with the previous setup. * Fix ice traps on GS tokens not triggering OnItemReceive. * Complete fix for ice trap collection from GS. Add autoscroll when clicking "Expand All". * Add `OnShopSlotChange` with cursorSlot and basePrice parameters. * Fixed include in en_ossan for shop slot hook. Added registration for `OnShopSlotChange` in the tracker, storing the price in a new `price` field in `CheckTrackerData`. Added "seen" functionality to shop checks. Displays the model item name upon first entering a shop, adding the price and switching to trickName (if it's an ice trap) upon navigating to the slot in buy mode, triggered by an invisible "identified" status that mirrors "seen" in every other way. Added tooltips to most options for check tracker color picking to describe what each status actually means. * `std::format` pls * So apparently std::format just decided to break with the latest merge from develop, but fmt::format exists and works? * Removed the last vestiges of `locationsSkipped`. Other general code and formatting cleanups. Moved `IsGameRunning` to `OTRGlobals` so the item tracker could also access it. Used preceding to "fix" item and bottle display in the item tracker on startup. * Some more code cleanup. Removed "Recheck Area" button and relevant code. Backported changes to Anchor branch applicable for single-player, including making a checkAreas vector and structuring the frame by frame checks around that. Also includes fix for Silver Gauntlets and Mirror Shield check collection crash associated with those changes. Fixed Kakariko Bazaar "seen" updates. Fixed tracker window not showing on initial load like it should. * Forgot 1 formatting fix. * Removed conditions for showing Song from Impa (isn't junk under certain conditions, so should show all the time). * Fix vanilla checks, add Zelda's Letter and Malon's Egg to manual check collection. Fix autoscroll while in child stealth section. * Fix crash in Happy Mask Shop in OnSlotChange (referenced non-existent shop id in a tracker-specific enum). * General code cleanup. * Missed one reversion. * One more. * Fix column alignment in `randomizer_check_objects`. * Fix file encoding on `randomizer_check_tracker`. Again. * Fix indentation for `actualItemtrackerItemMap`. Also removed unnecessary parts of the map. * Rename `HasEqItem` to `HasEquipment`. * Slightly better indentation for `actualItemTrackerItemMap`. * Add magic bean salesman to vanilla check tracking, and genericized deku shield to trigger KF shop item 3 wherever you get the shield. Renamed `vanillaCheck` to `vanillaHundoCheck` to (supposedly) clarify the meaning of the usage. * One more rename to `vanillaCompletion` to avoid possible confusion with 100% speedrun conditions. * give me a break XD Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * Changes suggested by briaguya (rename `RandomizerCheckShow` to `Status`, unused code, newline formatting) * Remove unused `itemNames` table. * Remove `IsGameRunning` in favor of `GameInteractor::IsSaveLoaded`. * Restore anti-spoiler functionality for dungeons with dungeon maps. * Review cleanup. * Fix prices not showing for Kak bazaar items. --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com>
2023-10-04 11:03:36 -04:00
Color_RGBA8& extra_default_color, const char* cvarHideName, const char* tooltip) {
Color_RGBA8 cvarMainColor = CVarGetColor(cvarMainName, main_default_color);
Color_RGBA8 cvarExtraColor = CVarGetColor(cvarExtraName, extra_default_color);
Randomizer Auto Location tracker (#1942) * Initial Auto-Location Tracking * Updates styling for checked items in Check Tracker * Fixes crashing issues with Check Tracker rendering * Auto scroll Check Tracker windows to current area * Checks Tracker only shows checked locations once in game * Fixes issue where Check Tracker would auto-scroll to wrong location when entering a grotto * Fixes gerudo fortress checks showing in tracker when settings have them removed * InfTable Check Location Fixes: Lost Dog Richard, Rolling Gorons, HBA 1000, Thawed Zora * Fixes most Event Chk Inf Checks on Check Tracker, and Frogs * Check Tracker - Song from Malon now works * Check Tracker - Fixes Claim Check check not tracking - Fixes spoiler for Claim Check check when getting Biggoron's Sword - Fixes LACS being spoiled and not tracking * Check Tracker - Fixes #2 for Skull Mask and Mask of Truth checks * Check Tracker - Adds support for merchants - Fixes #7 for Bomchu Salesman - Fixes #12 for Medigoron * Check Tracker - Fixes #8 for Song from Saria * Check Tracker - Fixes #9 for Adult Shooting Gallery * Check Tracker - Fixes #10 for Composer Grave * Check Tracker - Fixes #14 for Song from Ocarina of Time * Check Tracker - Fixes #16 for Shooting the Sun * Check Tracker - Fixes #19 for Darunia's Joy * Save Editor - Adds missing label for Treasure Chest Game * Check Tracker - Fixes Great Faries checks * Check Tracker - Fixes Sheik at Temple * Check Tracker - Fixes Great Fairy auto-scroll to wrong location * Check Tracker - Updates blue warp checks - Fixes Bongo Bongo and Twinrova checks * Check Tracker - Fixes Dampe's Gravedigging Tour * Check Tracker - Fixes Prescription to King Zora * Check Tracker - Fixes Bazaar showing under wrong area on tracker between adult/child * Check Tracker - Fixes scroll for Hyrule Market and Bazaar * Check Tracker - Fixes giving Adult Trade Items shown on tracker: Broken Sword, Saw, Cojiro, Eyeball Froge, and Eyedrops * Cleans up item_location * Check Tracker - Item List - Fixes item list not updating when changing seeds/options - Separates item exclusion list from item check list - Clean up comments * Check Tracker - Adds Skip functionality to buttons * Check Tracker - Refactors adult trade items to RandomizerInf * Check Tracker - Fixes an issue where any time an item is removed the tracker would cause an application crash * Check Tracker - Item names are now dependent on file language * Check Tracker - Fixes Gerudo Card check not showing in Fast setting * Reorders headers to (hopefully) avoid CI build conflicts on linux/consoles * Explicitly defines vector header in randomizer.h to fix compile errors * Complete Refactor of Check Tracker ImGui * Adds missing check tracker files to CMakeLists * Reverts the Item_location whitespace cleanup from ad10807c * Check Tracker - Loading Fixes - Fixes a bug where loading a save file a second time would add all the checks again - Fixes a bug where the check tracker would not render at all until in a save file * Check Tracker - Fixes a bug where checks would sometimes fail to load * Check Tracker - Fixes duplicated checks when using Only on Pause or Only on Combo * Check Tracker - Works around issue where single characters don't show in EnhancementCombobox, and fixes a label for combo buttons held option * Check Tracker - Applies all Check Tracker changes to Item Location * Check Tracker - Updated Check List - Adds Link's pocket, either in KF or HM depending on starting age - Supports Scrubs and Merchants - Uses enums instead of magic numbers - Updates DC Scrub Short Names for MQ * Check Tracker - Adds a performance mode option * Check Tracker - List Fixes (requires new rando generation) - Fixes Frogs Rupees always visible - Fixes Kokiri Sword Chest not showing - Fixes Weird Egg not showing * Check Tracker - MQ List basic support * Check Tracker - MQ/Vanilla anti-spoilers * Check Tracker - Collecting a compass now spoils the area * Check Tracker - Basic Vanilla Support and fixes - Vanilla items show in check tracker, even if many won't auto check - Fixes an issue with Gerudo Fortress Keys - Refactors IsVisibleInCheckTracker to randomizer_check_tracjer * Check Tracker - Fixes merge conflict from 08a487f35e1d760ab9e69b932edbe4da6bcd9edb * Check Tracker - Fixes tracker loading as Floating when default value is set to Windowed * Randomizer Location Exclusion List - Adds Scrubs, Merchants, Shops. Adult Trade items, MQ Dungeons, and Bean Salesman - Fixes Kokiri Sword Chest, Weird Egg, and Frog Song Rupees from misbehaving - Updates Gerudo Fortress logic to be dependent on Open/Fast/Normal Fortress - Removes Invalid Check - Adds RO Enum for MQ settings - Updates magic values to RO enum * Location Exclusion List - Scrubs that are always randomized now always show on the list * For now, removes some extra code only needed for a Check Tracker. * Randomizer Location Exclusion List - Fixes Eyeball Frog from showing up when Adult Trade Items was off * Location Tracker - Updates Eyedrops to use RandomizerInf instead of Chest * Check Tracker - Fixes a bug where Link's Pocket item wasn't acting as checked for area item count * Check Tracker - Fixes a bug where Locations would incorrectly say Vanilla due to the first check in the area being a non-MQ check * Check Tracker - Fixes a crash when Check Tracker is docked but not visible * Check Tracker - Fixes areas being spoiled when loading different save files * Check Tracker - Only reset variables if they are initialized * Check Tracker - Cleans up old comments, unused variables, methods, and macros, adds language TODOs, * Check Tracker - Readds rainbow UI elements after Cosmetics Editor refactor * Check Tracker - Removal of flag lookup that was refactored, no longer needed header, and some trivial whitespace fixes. * Check Tracker - Refactors Index to Bitmask code to a macro * Check Tracker - Changes ordering from alphabetical to RandomizerCheck ordering * Check Tracker - Wraps everything in a namespace to avoid global variable usage * Check Tracker - Explicitly defines for-loop scope * Check Tracker - refactors dungeon lookup from static array to function * Fixes a bug when using EnhancementColor with alpha * Check Tracker - Refactors all colour to use direct conversions * Check Tracker - refactors settings loading and check visibility for readability * Check Tracker - Fixes a bug where the wrong label showed on the Check Tracker BG Color * UIWidgets - Adds Alpha bar to EnhancementColor when using alpha parameter
2022-12-10 22:39:23 -05:00
main_color = cvarMainColor;
extra_color = cvarExtraColor;
if (ImGui::CollapsingHeader(text)) {
if (*cvarHideName != '\0') {
std::string label = cvarHideName;
label += "##Hidden";
ImGui::PushID(label.c_str());
UIWidgets::EnhancementCheckbox("Hidden", cvarHideName, false,
"When active, checks will hide by default when updated to this state. Can "
"be overriden with the \"Show Hidden Items\" option.");
ImGui::PopID();
}
if (ImGui::BeginTable(text, 2, ImGuiTableFlags_BordersH | ImGuiTableFlags_BordersV | ImGuiTableFlags_Hideable)) {
ImGui::TableNextRow();
ImGui::TableNextColumn();
ImGui::PushItemWidth(ImGui::GetContentRegionAvail().x);
if (UIWidgets::EnhancementColor("Check", cvarMainName,
ImVec4(main_color.r, main_color.g, main_color.b, main_color.a),
ImVec4(main_default_color.r, main_default_color.g, main_default_color.b, main_default_color.a)))
Randomizer Auto Location tracker (#1942) * Initial Auto-Location Tracking * Updates styling for checked items in Check Tracker * Fixes crashing issues with Check Tracker rendering * Auto scroll Check Tracker windows to current area * Checks Tracker only shows checked locations once in game * Fixes issue where Check Tracker would auto-scroll to wrong location when entering a grotto * Fixes gerudo fortress checks showing in tracker when settings have them removed * InfTable Check Location Fixes: Lost Dog Richard, Rolling Gorons, HBA 1000, Thawed Zora * Fixes most Event Chk Inf Checks on Check Tracker, and Frogs * Check Tracker - Song from Malon now works * Check Tracker - Fixes Claim Check check not tracking - Fixes spoiler for Claim Check check when getting Biggoron's Sword - Fixes LACS being spoiled and not tracking * Check Tracker - Fixes #2 for Skull Mask and Mask of Truth checks * Check Tracker - Adds support for merchants - Fixes #7 for Bomchu Salesman - Fixes #12 for Medigoron * Check Tracker - Fixes #8 for Song from Saria * Check Tracker - Fixes #9 for Adult Shooting Gallery * Check Tracker - Fixes #10 for Composer Grave * Check Tracker - Fixes #14 for Song from Ocarina of Time * Check Tracker - Fixes #16 for Shooting the Sun * Check Tracker - Fixes #19 for Darunia's Joy * Save Editor - Adds missing label for Treasure Chest Game * Check Tracker - Fixes Great Faries checks * Check Tracker - Fixes Sheik at Temple * Check Tracker - Fixes Great Fairy auto-scroll to wrong location * Check Tracker - Updates blue warp checks - Fixes Bongo Bongo and Twinrova checks * Check Tracker - Fixes Dampe's Gravedigging Tour * Check Tracker - Fixes Prescription to King Zora * Check Tracker - Fixes Bazaar showing under wrong area on tracker between adult/child * Check Tracker - Fixes scroll for Hyrule Market and Bazaar * Check Tracker - Fixes giving Adult Trade Items shown on tracker: Broken Sword, Saw, Cojiro, Eyeball Froge, and Eyedrops * Cleans up item_location * Check Tracker - Item List - Fixes item list not updating when changing seeds/options - Separates item exclusion list from item check list - Clean up comments * Check Tracker - Adds Skip functionality to buttons * Check Tracker - Refactors adult trade items to RandomizerInf * Check Tracker - Fixes an issue where any time an item is removed the tracker would cause an application crash * Check Tracker - Item names are now dependent on file language * Check Tracker - Fixes Gerudo Card check not showing in Fast setting * Reorders headers to (hopefully) avoid CI build conflicts on linux/consoles * Explicitly defines vector header in randomizer.h to fix compile errors * Complete Refactor of Check Tracker ImGui * Adds missing check tracker files to CMakeLists * Reverts the Item_location whitespace cleanup from ad10807c * Check Tracker - Loading Fixes - Fixes a bug where loading a save file a second time would add all the checks again - Fixes a bug where the check tracker would not render at all until in a save file * Check Tracker - Fixes a bug where checks would sometimes fail to load * Check Tracker - Fixes duplicated checks when using Only on Pause or Only on Combo * Check Tracker - Works around issue where single characters don't show in EnhancementCombobox, and fixes a label for combo buttons held option * Check Tracker - Applies all Check Tracker changes to Item Location * Check Tracker - Updated Check List - Adds Link's pocket, either in KF or HM depending on starting age - Supports Scrubs and Merchants - Uses enums instead of magic numbers - Updates DC Scrub Short Names for MQ * Check Tracker - Adds a performance mode option * Check Tracker - List Fixes (requires new rando generation) - Fixes Frogs Rupees always visible - Fixes Kokiri Sword Chest not showing - Fixes Weird Egg not showing * Check Tracker - MQ List basic support * Check Tracker - MQ/Vanilla anti-spoilers * Check Tracker - Collecting a compass now spoils the area * Check Tracker - Basic Vanilla Support and fixes - Vanilla items show in check tracker, even if many won't auto check - Fixes an issue with Gerudo Fortress Keys - Refactors IsVisibleInCheckTracker to randomizer_check_tracjer * Check Tracker - Fixes merge conflict from 08a487f35e1d760ab9e69b932edbe4da6bcd9edb * Check Tracker - Fixes tracker loading as Floating when default value is set to Windowed * Randomizer Location Exclusion List - Adds Scrubs, Merchants, Shops. Adult Trade items, MQ Dungeons, and Bean Salesman - Fixes Kokiri Sword Chest, Weird Egg, and Frog Song Rupees from misbehaving - Updates Gerudo Fortress logic to be dependent on Open/Fast/Normal Fortress - Removes Invalid Check - Adds RO Enum for MQ settings - Updates magic values to RO enum * Location Exclusion List - Scrubs that are always randomized now always show on the list * For now, removes some extra code only needed for a Check Tracker. * Randomizer Location Exclusion List - Fixes Eyeball Frog from showing up when Adult Trade Items was off * Location Tracker - Updates Eyedrops to use RandomizerInf instead of Chest * Check Tracker - Fixes a bug where Link's Pocket item wasn't acting as checked for area item count * Check Tracker - Fixes a bug where Locations would incorrectly say Vanilla due to the first check in the area being a non-MQ check * Check Tracker - Fixes a crash when Check Tracker is docked but not visible * Check Tracker - Fixes areas being spoiled when loading different save files * Check Tracker - Only reset variables if they are initialized * Check Tracker - Cleans up old comments, unused variables, methods, and macros, adds language TODOs, * Check Tracker - Readds rainbow UI elements after Cosmetics Editor refactor * Check Tracker - Removal of flag lookup that was refactored, no longer needed header, and some trivial whitespace fixes. * Check Tracker - Refactors Index to Bitmask code to a macro * Check Tracker - Changes ordering from alphabetical to RandomizerCheck ordering * Check Tracker - Wraps everything in a namespace to avoid global variable usage * Check Tracker - Explicitly defines for-loop scope * Check Tracker - refactors dungeon lookup from static array to function * Fixes a bug when using EnhancementColor with alpha * Check Tracker - Refactors all colour to use direct conversions * Check Tracker - refactors settings loading and check visibility for readability * Check Tracker - Fixes a bug where the wrong label showed on the Check Tracker BG Color * UIWidgets - Adds Alpha bar to EnhancementColor when using alpha parameter
2022-12-10 22:39:23 -05:00
{
main_color = CVarGetColor(cvarMainName, main_default_color);
Randomizer Auto Location tracker (#1942) * Initial Auto-Location Tracking * Updates styling for checked items in Check Tracker * Fixes crashing issues with Check Tracker rendering * Auto scroll Check Tracker windows to current area * Checks Tracker only shows checked locations once in game * Fixes issue where Check Tracker would auto-scroll to wrong location when entering a grotto * Fixes gerudo fortress checks showing in tracker when settings have them removed * InfTable Check Location Fixes: Lost Dog Richard, Rolling Gorons, HBA 1000, Thawed Zora * Fixes most Event Chk Inf Checks on Check Tracker, and Frogs * Check Tracker - Song from Malon now works * Check Tracker - Fixes Claim Check check not tracking - Fixes spoiler for Claim Check check when getting Biggoron's Sword - Fixes LACS being spoiled and not tracking * Check Tracker - Fixes #2 for Skull Mask and Mask of Truth checks * Check Tracker - Adds support for merchants - Fixes #7 for Bomchu Salesman - Fixes #12 for Medigoron * Check Tracker - Fixes #8 for Song from Saria * Check Tracker - Fixes #9 for Adult Shooting Gallery * Check Tracker - Fixes #10 for Composer Grave * Check Tracker - Fixes #14 for Song from Ocarina of Time * Check Tracker - Fixes #16 for Shooting the Sun * Check Tracker - Fixes #19 for Darunia's Joy * Save Editor - Adds missing label for Treasure Chest Game * Check Tracker - Fixes Great Faries checks * Check Tracker - Fixes Sheik at Temple * Check Tracker - Fixes Great Fairy auto-scroll to wrong location * Check Tracker - Updates blue warp checks - Fixes Bongo Bongo and Twinrova checks * Check Tracker - Fixes Dampe's Gravedigging Tour * Check Tracker - Fixes Prescription to King Zora * Check Tracker - Fixes Bazaar showing under wrong area on tracker between adult/child * Check Tracker - Fixes scroll for Hyrule Market and Bazaar * Check Tracker - Fixes giving Adult Trade Items shown on tracker: Broken Sword, Saw, Cojiro, Eyeball Froge, and Eyedrops * Cleans up item_location * Check Tracker - Item List - Fixes item list not updating when changing seeds/options - Separates item exclusion list from item check list - Clean up comments * Check Tracker - Adds Skip functionality to buttons * Check Tracker - Refactors adult trade items to RandomizerInf * Check Tracker - Fixes an issue where any time an item is removed the tracker would cause an application crash * Check Tracker - Item names are now dependent on file language * Check Tracker - Fixes Gerudo Card check not showing in Fast setting * Reorders headers to (hopefully) avoid CI build conflicts on linux/consoles * Explicitly defines vector header in randomizer.h to fix compile errors * Complete Refactor of Check Tracker ImGui * Adds missing check tracker files to CMakeLists * Reverts the Item_location whitespace cleanup from ad10807c * Check Tracker - Loading Fixes - Fixes a bug where loading a save file a second time would add all the checks again - Fixes a bug where the check tracker would not render at all until in a save file * Check Tracker - Fixes a bug where checks would sometimes fail to load * Check Tracker - Fixes duplicated checks when using Only on Pause or Only on Combo * Check Tracker - Works around issue where single characters don't show in EnhancementCombobox, and fixes a label for combo buttons held option * Check Tracker - Applies all Check Tracker changes to Item Location * Check Tracker - Updated Check List - Adds Link's pocket, either in KF or HM depending on starting age - Supports Scrubs and Merchants - Uses enums instead of magic numbers - Updates DC Scrub Short Names for MQ * Check Tracker - Adds a performance mode option * Check Tracker - List Fixes (requires new rando generation) - Fixes Frogs Rupees always visible - Fixes Kokiri Sword Chest not showing - Fixes Weird Egg not showing * Check Tracker - MQ List basic support * Check Tracker - MQ/Vanilla anti-spoilers * Check Tracker - Collecting a compass now spoils the area * Check Tracker - Basic Vanilla Support and fixes - Vanilla items show in check tracker, even if many won't auto check - Fixes an issue with Gerudo Fortress Keys - Refactors IsVisibleInCheckTracker to randomizer_check_tracjer * Check Tracker - Fixes merge conflict from 08a487f35e1d760ab9e69b932edbe4da6bcd9edb * Check Tracker - Fixes tracker loading as Floating when default value is set to Windowed * Randomizer Location Exclusion List - Adds Scrubs, Merchants, Shops. Adult Trade items, MQ Dungeons, and Bean Salesman - Fixes Kokiri Sword Chest, Weird Egg, and Frog Song Rupees from misbehaving - Updates Gerudo Fortress logic to be dependent on Open/Fast/Normal Fortress - Removes Invalid Check - Adds RO Enum for MQ settings - Updates magic values to RO enum * Location Exclusion List - Scrubs that are always randomized now always show on the list * For now, removes some extra code only needed for a Check Tracker. * Randomizer Location Exclusion List - Fixes Eyeball Frog from showing up when Adult Trade Items was off * Location Tracker - Updates Eyedrops to use RandomizerInf instead of Chest * Check Tracker - Fixes a bug where Link's Pocket item wasn't acting as checked for area item count * Check Tracker - Fixes a bug where Locations would incorrectly say Vanilla due to the first check in the area being a non-MQ check * Check Tracker - Fixes a crash when Check Tracker is docked but not visible * Check Tracker - Fixes areas being spoiled when loading different save files * Check Tracker - Only reset variables if they are initialized * Check Tracker - Cleans up old comments, unused variables, methods, and macros, adds language TODOs, * Check Tracker - Readds rainbow UI elements after Cosmetics Editor refactor * Check Tracker - Removal of flag lookup that was refactored, no longer needed header, and some trivial whitespace fixes. * Check Tracker - Refactors Index to Bitmask code to a macro * Check Tracker - Changes ordering from alphabetical to RandomizerCheck ordering * Check Tracker - Wraps everything in a namespace to avoid global variable usage * Check Tracker - Explicitly defines for-loop scope * Check Tracker - refactors dungeon lookup from static array to function * Fixes a bug when using EnhancementColor with alpha * Check Tracker - Refactors all colour to use direct conversions * Check Tracker - refactors settings loading and check visibility for readability * Check Tracker - Fixes a bug where the wrong label showed on the Check Tracker BG Color * UIWidgets - Adds Alpha bar to EnhancementColor when using alpha parameter
2022-12-10 22:39:23 -05:00
};
ImGui::PopItemWidth();
ImGui::TableNextColumn();
ImGui::AlignTextToFramePadding();
ImGui::PushItemWidth(ImGui::GetContentRegionAvail().x);
if (UIWidgets::EnhancementColor("Details", cvarExtraName,
ImVec4(extra_color.r, extra_color.g, extra_color.b, extra_color.a),
ImVec4(extra_default_color.r, extra_default_color.g, extra_default_color.b, extra_default_color.a)))
Randomizer Auto Location tracker (#1942) * Initial Auto-Location Tracking * Updates styling for checked items in Check Tracker * Fixes crashing issues with Check Tracker rendering * Auto scroll Check Tracker windows to current area * Checks Tracker only shows checked locations once in game * Fixes issue where Check Tracker would auto-scroll to wrong location when entering a grotto * Fixes gerudo fortress checks showing in tracker when settings have them removed * InfTable Check Location Fixes: Lost Dog Richard, Rolling Gorons, HBA 1000, Thawed Zora * Fixes most Event Chk Inf Checks on Check Tracker, and Frogs * Check Tracker - Song from Malon now works * Check Tracker - Fixes Claim Check check not tracking - Fixes spoiler for Claim Check check when getting Biggoron's Sword - Fixes LACS being spoiled and not tracking * Check Tracker - Fixes #2 for Skull Mask and Mask of Truth checks * Check Tracker - Adds support for merchants - Fixes #7 for Bomchu Salesman - Fixes #12 for Medigoron * Check Tracker - Fixes #8 for Song from Saria * Check Tracker - Fixes #9 for Adult Shooting Gallery * Check Tracker - Fixes #10 for Composer Grave * Check Tracker - Fixes #14 for Song from Ocarina of Time * Check Tracker - Fixes #16 for Shooting the Sun * Check Tracker - Fixes #19 for Darunia's Joy * Save Editor - Adds missing label for Treasure Chest Game * Check Tracker - Fixes Great Faries checks * Check Tracker - Fixes Sheik at Temple * Check Tracker - Fixes Great Fairy auto-scroll to wrong location * Check Tracker - Updates blue warp checks - Fixes Bongo Bongo and Twinrova checks * Check Tracker - Fixes Dampe's Gravedigging Tour * Check Tracker - Fixes Prescription to King Zora * Check Tracker - Fixes Bazaar showing under wrong area on tracker between adult/child * Check Tracker - Fixes scroll for Hyrule Market and Bazaar * Check Tracker - Fixes giving Adult Trade Items shown on tracker: Broken Sword, Saw, Cojiro, Eyeball Froge, and Eyedrops * Cleans up item_location * Check Tracker - Item List - Fixes item list not updating when changing seeds/options - Separates item exclusion list from item check list - Clean up comments * Check Tracker - Adds Skip functionality to buttons * Check Tracker - Refactors adult trade items to RandomizerInf * Check Tracker - Fixes an issue where any time an item is removed the tracker would cause an application crash * Check Tracker - Item names are now dependent on file language * Check Tracker - Fixes Gerudo Card check not showing in Fast setting * Reorders headers to (hopefully) avoid CI build conflicts on linux/consoles * Explicitly defines vector header in randomizer.h to fix compile errors * Complete Refactor of Check Tracker ImGui * Adds missing check tracker files to CMakeLists * Reverts the Item_location whitespace cleanup from ad10807c * Check Tracker - Loading Fixes - Fixes a bug where loading a save file a second time would add all the checks again - Fixes a bug where the check tracker would not render at all until in a save file * Check Tracker - Fixes a bug where checks would sometimes fail to load * Check Tracker - Fixes duplicated checks when using Only on Pause or Only on Combo * Check Tracker - Works around issue where single characters don't show in EnhancementCombobox, and fixes a label for combo buttons held option * Check Tracker - Applies all Check Tracker changes to Item Location * Check Tracker - Updated Check List - Adds Link's pocket, either in KF or HM depending on starting age - Supports Scrubs and Merchants - Uses enums instead of magic numbers - Updates DC Scrub Short Names for MQ * Check Tracker - Adds a performance mode option * Check Tracker - List Fixes (requires new rando generation) - Fixes Frogs Rupees always visible - Fixes Kokiri Sword Chest not showing - Fixes Weird Egg not showing * Check Tracker - MQ List basic support * Check Tracker - MQ/Vanilla anti-spoilers * Check Tracker - Collecting a compass now spoils the area * Check Tracker - Basic Vanilla Support and fixes - Vanilla items show in check tracker, even if many won't auto check - Fixes an issue with Gerudo Fortress Keys - Refactors IsVisibleInCheckTracker to randomizer_check_tracjer * Check Tracker - Fixes merge conflict from 08a487f35e1d760ab9e69b932edbe4da6bcd9edb * Check Tracker - Fixes tracker loading as Floating when default value is set to Windowed * Randomizer Location Exclusion List - Adds Scrubs, Merchants, Shops. Adult Trade items, MQ Dungeons, and Bean Salesman - Fixes Kokiri Sword Chest, Weird Egg, and Frog Song Rupees from misbehaving - Updates Gerudo Fortress logic to be dependent on Open/Fast/Normal Fortress - Removes Invalid Check - Adds RO Enum for MQ settings - Updates magic values to RO enum * Location Exclusion List - Scrubs that are always randomized now always show on the list * For now, removes some extra code only needed for a Check Tracker. * Randomizer Location Exclusion List - Fixes Eyeball Frog from showing up when Adult Trade Items was off * Location Tracker - Updates Eyedrops to use RandomizerInf instead of Chest * Check Tracker - Fixes a bug where Link's Pocket item wasn't acting as checked for area item count * Check Tracker - Fixes a bug where Locations would incorrectly say Vanilla due to the first check in the area being a non-MQ check * Check Tracker - Fixes a crash when Check Tracker is docked but not visible * Check Tracker - Fixes areas being spoiled when loading different save files * Check Tracker - Only reset variables if they are initialized * Check Tracker - Cleans up old comments, unused variables, methods, and macros, adds language TODOs, * Check Tracker - Readds rainbow UI elements after Cosmetics Editor refactor * Check Tracker - Removal of flag lookup that was refactored, no longer needed header, and some trivial whitespace fixes. * Check Tracker - Refactors Index to Bitmask code to a macro * Check Tracker - Changes ordering from alphabetical to RandomizerCheck ordering * Check Tracker - Wraps everything in a namespace to avoid global variable usage * Check Tracker - Explicitly defines for-loop scope * Check Tracker - refactors dungeon lookup from static array to function * Fixes a bug when using EnhancementColor with alpha * Check Tracker - Refactors all colour to use direct conversions * Check Tracker - refactors settings loading and check visibility for readability * Check Tracker - Fixes a bug where the wrong label showed on the Check Tracker BG Color * UIWidgets - Adds Alpha bar to EnhancementColor when using alpha parameter
2022-12-10 22:39:23 -05:00
{
extra_color = CVarGetColor(cvarExtraName, extra_default_color);
Randomizer Auto Location tracker (#1942) * Initial Auto-Location Tracking * Updates styling for checked items in Check Tracker * Fixes crashing issues with Check Tracker rendering * Auto scroll Check Tracker windows to current area * Checks Tracker only shows checked locations once in game * Fixes issue where Check Tracker would auto-scroll to wrong location when entering a grotto * Fixes gerudo fortress checks showing in tracker when settings have them removed * InfTable Check Location Fixes: Lost Dog Richard, Rolling Gorons, HBA 1000, Thawed Zora * Fixes most Event Chk Inf Checks on Check Tracker, and Frogs * Check Tracker - Song from Malon now works * Check Tracker - Fixes Claim Check check not tracking - Fixes spoiler for Claim Check check when getting Biggoron's Sword - Fixes LACS being spoiled and not tracking * Check Tracker - Fixes #2 for Skull Mask and Mask of Truth checks * Check Tracker - Adds support for merchants - Fixes #7 for Bomchu Salesman - Fixes #12 for Medigoron * Check Tracker - Fixes #8 for Song from Saria * Check Tracker - Fixes #9 for Adult Shooting Gallery * Check Tracker - Fixes #10 for Composer Grave * Check Tracker - Fixes #14 for Song from Ocarina of Time * Check Tracker - Fixes #16 for Shooting the Sun * Check Tracker - Fixes #19 for Darunia's Joy * Save Editor - Adds missing label for Treasure Chest Game * Check Tracker - Fixes Great Faries checks * Check Tracker - Fixes Sheik at Temple * Check Tracker - Fixes Great Fairy auto-scroll to wrong location * Check Tracker - Updates blue warp checks - Fixes Bongo Bongo and Twinrova checks * Check Tracker - Fixes Dampe's Gravedigging Tour * Check Tracker - Fixes Prescription to King Zora * Check Tracker - Fixes Bazaar showing under wrong area on tracker between adult/child * Check Tracker - Fixes scroll for Hyrule Market and Bazaar * Check Tracker - Fixes giving Adult Trade Items shown on tracker: Broken Sword, Saw, Cojiro, Eyeball Froge, and Eyedrops * Cleans up item_location * Check Tracker - Item List - Fixes item list not updating when changing seeds/options - Separates item exclusion list from item check list - Clean up comments * Check Tracker - Adds Skip functionality to buttons * Check Tracker - Refactors adult trade items to RandomizerInf * Check Tracker - Fixes an issue where any time an item is removed the tracker would cause an application crash * Check Tracker - Item names are now dependent on file language * Check Tracker - Fixes Gerudo Card check not showing in Fast setting * Reorders headers to (hopefully) avoid CI build conflicts on linux/consoles * Explicitly defines vector header in randomizer.h to fix compile errors * Complete Refactor of Check Tracker ImGui * Adds missing check tracker files to CMakeLists * Reverts the Item_location whitespace cleanup from ad10807c * Check Tracker - Loading Fixes - Fixes a bug where loading a save file a second time would add all the checks again - Fixes a bug where the check tracker would not render at all until in a save file * Check Tracker - Fixes a bug where checks would sometimes fail to load * Check Tracker - Fixes duplicated checks when using Only on Pause or Only on Combo * Check Tracker - Works around issue where single characters don't show in EnhancementCombobox, and fixes a label for combo buttons held option * Check Tracker - Applies all Check Tracker changes to Item Location * Check Tracker - Updated Check List - Adds Link's pocket, either in KF or HM depending on starting age - Supports Scrubs and Merchants - Uses enums instead of magic numbers - Updates DC Scrub Short Names for MQ * Check Tracker - Adds a performance mode option * Check Tracker - List Fixes (requires new rando generation) - Fixes Frogs Rupees always visible - Fixes Kokiri Sword Chest not showing - Fixes Weird Egg not showing * Check Tracker - MQ List basic support * Check Tracker - MQ/Vanilla anti-spoilers * Check Tracker - Collecting a compass now spoils the area * Check Tracker - Basic Vanilla Support and fixes - Vanilla items show in check tracker, even if many won't auto check - Fixes an issue with Gerudo Fortress Keys - Refactors IsVisibleInCheckTracker to randomizer_check_tracjer * Check Tracker - Fixes merge conflict from 08a487f35e1d760ab9e69b932edbe4da6bcd9edb * Check Tracker - Fixes tracker loading as Floating when default value is set to Windowed * Randomizer Location Exclusion List - Adds Scrubs, Merchants, Shops. Adult Trade items, MQ Dungeons, and Bean Salesman - Fixes Kokiri Sword Chest, Weird Egg, and Frog Song Rupees from misbehaving - Updates Gerudo Fortress logic to be dependent on Open/Fast/Normal Fortress - Removes Invalid Check - Adds RO Enum for MQ settings - Updates magic values to RO enum * Location Exclusion List - Scrubs that are always randomized now always show on the list * For now, removes some extra code only needed for a Check Tracker. * Randomizer Location Exclusion List - Fixes Eyeball Frog from showing up when Adult Trade Items was off * Location Tracker - Updates Eyedrops to use RandomizerInf instead of Chest * Check Tracker - Fixes a bug where Link's Pocket item wasn't acting as checked for area item count * Check Tracker - Fixes a bug where Locations would incorrectly say Vanilla due to the first check in the area being a non-MQ check * Check Tracker - Fixes a crash when Check Tracker is docked but not visible * Check Tracker - Fixes areas being spoiled when loading different save files * Check Tracker - Only reset variables if they are initialized * Check Tracker - Cleans up old comments, unused variables, methods, and macros, adds language TODOs, * Check Tracker - Readds rainbow UI elements after Cosmetics Editor refactor * Check Tracker - Removal of flag lookup that was refactored, no longer needed header, and some trivial whitespace fixes. * Check Tracker - Refactors Index to Bitmask code to a macro * Check Tracker - Changes ordering from alphabetical to RandomizerCheck ordering * Check Tracker - Wraps everything in a namespace to avoid global variable usage * Check Tracker - Explicitly defines for-loop scope * Check Tracker - refactors dungeon lookup from static array to function * Fixes a bug when using EnhancementColor with alpha * Check Tracker - Refactors all colour to use direct conversions * Check Tracker - refactors settings loading and check visibility for readability * Check Tracker - Fixes a bug where the wrong label showed on the Check Tracker BG Color * UIWidgets - Adds Alpha bar to EnhancementColor when using alpha parameter
2022-12-10 22:39:23 -05:00
}
ImGui::PopItemWidth();
ImGui::EndTable();
}
}
Check Tracker Update (#2668) * Initial commit. What works so far: Data file loads, saves, deletes, and is created properly. - Need to run `HasItemBeenCollected` when creating in case of mid-seed regen. Organized checks into maps set by area. Areas show in tracker. - Checks pulled from checkObjectsByArea are not currently listed. - Areas are being assumed completed and hidden at the start. * Checks now populate. Still not counting area totals properly. * Don't track RC_LINKS_POCKET in the data file, and instead manually add it in every time a save is load. rcObjects doesn't contain Link's Pocket location (duh). * Moved ItemReceive hook to randomizer_check_tracker.cpp. Skipped items are properly sorted and formatted. Saved items contribute to an area's gotten/skipped checks on load. Changed skipped items default main color to gray. General code cleanup. * Skipped checks now contribute to area totals for area completion logic. * Mid-menu rework transfer. * Started check lookup on item receive. Tried to enable scum checking on save. * Fixed scum check on save. * More code cleanup, which revealed some issues with loading and saving. Loading now works 100%, but entries in checkTrackerData are disappearing in code somewhere, causing issues with later checks. Scummed color now displays properly. Collected but unsaved displays properly. Unchecked, Skipped, Seen and Scummed checks all have arrows for skipping/unskipping. Counts a little messed up, probably double adding skips. * Fixed item counts being off across resets. Restarts were fine. * Beginning of rework for individual check updates. Adds `Actor lastCheck` to PlayState to allow assigning of last actor to give an item. This allows precise tracking of GS, freestanding PoH, etc. Works for chests too. Currently does not work for shops, unknown for normal NPC gives. Doesn't track last gives for non-checks, like drops from grass, pots, crates, etc. * Actor-based checks fully fleshed out, but can't help with sale-based checks. Implemented `pendingSaleCheck` to back out of an RC check cycle if `gSaveContext->pendingSale` is not NONE when `OnItemReceive` is called, processed through `OnSaleEnd`. This should be the final change necessary to streamline the checks. * Temporary hook to message box close to tie in trackers for non-gs/chest actors that aren't added to `GetCheckFromActor`. This triggers a 2-frame countdown to check with `HasItemBeenCollected` since half of the methods in there aren't updated until after a text box closes. Added scene tracking to get last scene so that checks in scenes that span several overworld areas could be tied to their areas properly. Modified tracker data creation to apply Link's Pocket and Song from Impa conditionally based on randomizer settings instead of just being assumed to be done. May need modification for checking click and drag spoiler loading. Removed the scene equivalence check from CheckChecks so that an entire area is checked each time to avoid issues with, e.g., leaving a shop before a pending sale finishes. * Changed check data creation to use RSKs from gRandomizer to account for settings loaded from drag and drop spoilers. * Beginning of tracker code organization. Changed check color defaults. * Reverted moving tracker colors to header. Some individual check fixes. * Missed something from previous merge? * Removed last remnant of removed performance mode. * Better handle checking when skullsanity is off. * Song checks sceneIDs don't match the scenes they're actually in for some reason. Removed that check. * SaleEnd checks don't need the GetItemEntry parameter. Also set a flag that should prevent the check tracker from running during vanilla saves should that not be resolved by the time it's merged. * Attempting to have only the relevant checks added to the tracker data, as well as showing vanilla checks for non-rando saves. Not working yet (everything is displayed in vanilla). * Added vanilla check tracker population via `vanillaCheck` bool in `RandomizerCheckObject`. This is also added to `IsVisibleInImGui` to handle file loading and saving to eliminate checks that aren't part of vanilla or the rando seed. Implemented deleted tracker data file recreation. Added some extra item name text checks. Songs are still... tricky, so they stay blank. Utilize local copies of the randomizer check objects that are applicable for performance purposes. Fixed vanilla item-giving cutscene crashes when triggered mid-transition. * Apparently not all toolchains can handle macro instantiation without all parameters, like VS can. * Fixed scummed detail color not showing properly on tracker. * Fixed dungeon area totals and GS checks not functioning properly. * Major revamp of checking code. Doesn't rely on `GetCheckFromActor` at all anymore, but instead simply sets a flag to evaluate a number of checks in an area every frame until the check that was gotten is identified. With the new setup, it's much less hardware intensive, and at 60fps 6 checks per frame shows no noticeable effect on framerate. I can envision needing to add a collectedCount in order to account for times when two checks are gotten one right after the other. Changed area scroll to happen from `OnTransitionEnd`, and allow for scrolling in bazaar (was disabled previously because it would jump back and forth between Kak and Market while you were in one). Also setup area check order updating by area instead of all at the same time. * Fixed shooting gallery not reporting proper area. Prevent checks from actually happening if area is RCAREA_INVALID, now that all areas are reporting something if they have checks. Fixed `GetCheckArea()` not updating checks for standard scenes. Lots of vanilla tracking updates, mainly manual checks for gems, medallions and songs, since the often don't have proper scenes in the data. Prevent vanilla from triggering check loops if junk items are collected. Fixed sorting based on saved vs collected. Prevent item name display for vanilla runs. Change coloring of checks so the check name reflects status in vanilla runs. * Fixed "Recheck Area" button erroneously adding to an area's check totals? * Fix DMC vanilla checks. * Fix check tracker data recreation on data file loss. Removed redundant file exists check from SaveTrackerDataHook, as it doesn't matter if it exists or not at that point. Limited check loops to 3 to avoid infinite check loops on non-check/junk item pickup. Added more checks to disable tracker operations if a save is not running. Changed check ordering to put boss reward and heart container checks at the end of whatever RCSHOW group they belong to. * Fixed IsRunning calculation. Further improving vanilla checking. Starting framework for checking medallions, stones, and songs on data file recreation. Fixed medallion check collection. Added GIFT_FROM_SAGES to check list for vanilla file for tracking light medallion. Added check loop limitation to prevent infinite checking after picking up junk item from the ground. * Finished vanilla file recreation and recheck (songs and dungeon rewards all check properly now). This includes deku shield with KF shop item 3. Finished Gift from Raoru light medallion tracking for vanilla. Commented all CheckByScene functionality for now. * Fixed new save data file creation. Disabled entrance area calculation for now, as it only tracks the previous entrance for some reason. Fixed area detection for ToT checks. * GetCheckArea() now utilizes EntranceData almost exclusively, via either `gSaveContext.entranceIndex` or the entrance tracker's `currentGrottoId` in the case of grottos. This also means that EVERYTHING CAN AUTOSCROLL NOW. Entrance shuffles are now much easier to track. Autoscroll is now also triggered on save, just in case someone isn't autosaving and has a lot of checks that get converted to saved. * Fixed missing GS check in LW. * Added area scroll on toggling Show Hidden Items. May configure differently later. Fixed area detection for entrances in Gerudo Fortress/Valley and Collossus. Haunted wasteland doesn't autoscroll due to a bug in `OnTransitionEnd` hook, but checks still evaluate properly there. Rely on scene-based area detection if scene is a main overworld or dungeon scene. * Fixed grotto detection when shuffle is off. * Small code cleanup. Fixed Colossus hand chest checks. * Missing lus bump from merge conflict resolution * Fixed Colossus Grotto making `GetCheckArea` return Wasteland. * Improved OnItemReceive processing for non-token GS checks, since they can sometimes take long enough for the checking process to time out before the item is registered as received. * First attempt at thread safety for tracker data file writing. Seems to work, but might need more testing. * Fixed Recheck Area not unskipping items that register as saved. Improved delayed saving with autosaving, as the autosave triggered quite often before the tracker data save, making things not properly register as saved. * merge cleanup * Converted check tracker data to the sectional saves, adding `CheckTrackerData` to `SaveContext`. Implemented section ID returning and fullSave boolean passing to section functions from my PR temporarily for it to work properly. Moved `RandomizerCheckTrackerData` enum to `randomizerTypes.h` to accommodate that. Changed `Randomizer_SaveInit` to a `SaveManager::InitFunc` to allow for other randomizer-dependent sections to be initialized after that. Required a little refactoring to maintain intro cutscene skip when starting a randomizer file. * Revert section index return and randomizer init changes. Will need to wait on yet more changes to main. * Fixed check tracker initialization (shouldn't be tied to window initialization), restored saving/loading functionality. * Removed `CheckTracker::Init` and put SaveManager calls in `CheckTrackerWindow::InitElement`. Also a bit of cleanup from transition back to save file use. * Fixed tracker displaying check categories while file not loaded. * Fix Darunia's Joy check not marking in vanilla. * Fix autosave not triggering change from collected to saved in tracker data. * Changed default colors for scummed and collected display. * Merge upgrade code cleanup. * Add `OnTransitionEnd` calls to sandstorm transitions both to and from Wasteland. Also improved `gSaveContext.lastScene` assignment for both transition types. Allowed a bit of cleanup in `GetCheckArea`. * Added `StateButton`, a button like `ArrowButton` but that allows text instead of arrow icons. Apparently the changes from ArrowButton to StateButton happened in a previous commit... * Changed section name to `trackerDataCheck` to force SoH to load it after the randomizer section, as it required some randoSettings to be loaded first, and nothing else I tried to make the randomizer section load before it worked. This hacks a solution to checks not displaying on fast file load to a specific slot. F*** you, SaveManager, and f*** you too, JSON. * Forgot to change the section string for loading with the name change. * Fix check ordering for checks that trigger the autosave. * Adds option to remove right-side shop items (slots 1-4) from the tracker list. Enabled by default. * Fix default state of Hide Shop Right Checks checkbox. * Fixes grotto and great fairy scrolling and checks. Fixes array overflow from `checkTrackerData` which was creating the issue trying to load the base and randomizer sections first, among other things. That also fixed the massive file loads that were being exhibited in debug mode. * Fix shooting galleries being set as collected again when being played a second time after getting the checks. * Fix Bazaar autoscroll. * Add Saria's Song to `GetCheckFromActor` and removed some limitations from the messageCloseCheck function to make that check track properly. * Fix Song from Impa check. Implemented prevention for multiple "collections" of great fairies, just in case getting the health refill would trigger it with the previous setup. * Fix ice traps on GS tokens not triggering OnItemReceive. * Complete fix for ice trap collection from GS. Add autoscroll when clicking "Expand All". * Add `OnShopSlotChange` with cursorSlot and basePrice parameters. * Fixed include in en_ossan for shop slot hook. Added registration for `OnShopSlotChange` in the tracker, storing the price in a new `price` field in `CheckTrackerData`. Added "seen" functionality to shop checks. Displays the model item name upon first entering a shop, adding the price and switching to trickName (if it's an ice trap) upon navigating to the slot in buy mode, triggered by an invisible "identified" status that mirrors "seen" in every other way. Added tooltips to most options for check tracker color picking to describe what each status actually means. * `std::format` pls * So apparently std::format just decided to break with the latest merge from develop, but fmt::format exists and works? * Removed the last vestiges of `locationsSkipped`. Other general code and formatting cleanups. Moved `IsGameRunning` to `OTRGlobals` so the item tracker could also access it. Used preceding to "fix" item and bottle display in the item tracker on startup. * Some more code cleanup. Removed "Recheck Area" button and relevant code. Backported changes to Anchor branch applicable for single-player, including making a checkAreas vector and structuring the frame by frame checks around that. Also includes fix for Silver Gauntlets and Mirror Shield check collection crash associated with those changes. Fixed Kakariko Bazaar "seen" updates. Fixed tracker window not showing on initial load like it should. * Forgot 1 formatting fix. * Removed conditions for showing Song from Impa (isn't junk under certain conditions, so should show all the time). * Fix vanilla checks, add Zelda's Letter and Malon's Egg to manual check collection. Fix autoscroll while in child stealth section. * Fix crash in Happy Mask Shop in OnSlotChange (referenced non-existent shop id in a tracker-specific enum). * General code cleanup. * Missed one reversion. * One more. * Fix column alignment in `randomizer_check_objects`. * Fix file encoding on `randomizer_check_tracker`. Again. * Fix indentation for `actualItemtrackerItemMap`. Also removed unnecessary parts of the map. * Rename `HasEqItem` to `HasEquipment`. * Slightly better indentation for `actualItemTrackerItemMap`. * Add magic bean salesman to vanilla check tracking, and genericized deku shield to trigger KF shop item 3 wherever you get the shield. Renamed `vanillaCheck` to `vanillaHundoCheck` to (supposedly) clarify the meaning of the usage. * One more rename to `vanillaCompletion` to avoid possible confusion with 100% speedrun conditions. * give me a break XD Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * Changes suggested by briaguya (rename `RandomizerCheckShow` to `Status`, unused code, newline formatting) * Remove unused `itemNames` table. * Remove `IsGameRunning` in favor of `GameInteractor::IsSaveLoaded`. * Restore anti-spoiler functionality for dungeons with dungeon maps. * Review cleanup. * Fix prices not showing for Kak bazaar items. --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com>
2023-10-04 11:03:36 -04:00
if (tooltip != "") {
ImGui::SameLine();
ImGui::Text(" ?");
UIWidgets::Tooltip(tooltip);
}
Randomizer Auto Location tracker (#1942) * Initial Auto-Location Tracking * Updates styling for checked items in Check Tracker * Fixes crashing issues with Check Tracker rendering * Auto scroll Check Tracker windows to current area * Checks Tracker only shows checked locations once in game * Fixes issue where Check Tracker would auto-scroll to wrong location when entering a grotto * Fixes gerudo fortress checks showing in tracker when settings have them removed * InfTable Check Location Fixes: Lost Dog Richard, Rolling Gorons, HBA 1000, Thawed Zora * Fixes most Event Chk Inf Checks on Check Tracker, and Frogs * Check Tracker - Song from Malon now works * Check Tracker - Fixes Claim Check check not tracking - Fixes spoiler for Claim Check check when getting Biggoron's Sword - Fixes LACS being spoiled and not tracking * Check Tracker - Fixes #2 for Skull Mask and Mask of Truth checks * Check Tracker - Adds support for merchants - Fixes #7 for Bomchu Salesman - Fixes #12 for Medigoron * Check Tracker - Fixes #8 for Song from Saria * Check Tracker - Fixes #9 for Adult Shooting Gallery * Check Tracker - Fixes #10 for Composer Grave * Check Tracker - Fixes #14 for Song from Ocarina of Time * Check Tracker - Fixes #16 for Shooting the Sun * Check Tracker - Fixes #19 for Darunia's Joy * Save Editor - Adds missing label for Treasure Chest Game * Check Tracker - Fixes Great Faries checks * Check Tracker - Fixes Sheik at Temple * Check Tracker - Fixes Great Fairy auto-scroll to wrong location * Check Tracker - Updates blue warp checks - Fixes Bongo Bongo and Twinrova checks * Check Tracker - Fixes Dampe's Gravedigging Tour * Check Tracker - Fixes Prescription to King Zora * Check Tracker - Fixes Bazaar showing under wrong area on tracker between adult/child * Check Tracker - Fixes scroll for Hyrule Market and Bazaar * Check Tracker - Fixes giving Adult Trade Items shown on tracker: Broken Sword, Saw, Cojiro, Eyeball Froge, and Eyedrops * Cleans up item_location * Check Tracker - Item List - Fixes item list not updating when changing seeds/options - Separates item exclusion list from item check list - Clean up comments * Check Tracker - Adds Skip functionality to buttons * Check Tracker - Refactors adult trade items to RandomizerInf * Check Tracker - Fixes an issue where any time an item is removed the tracker would cause an application crash * Check Tracker - Item names are now dependent on file language * Check Tracker - Fixes Gerudo Card check not showing in Fast setting * Reorders headers to (hopefully) avoid CI build conflicts on linux/consoles * Explicitly defines vector header in randomizer.h to fix compile errors * Complete Refactor of Check Tracker ImGui * Adds missing check tracker files to CMakeLists * Reverts the Item_location whitespace cleanup from ad10807c * Check Tracker - Loading Fixes - Fixes a bug where loading a save file a second time would add all the checks again - Fixes a bug where the check tracker would not render at all until in a save file * Check Tracker - Fixes a bug where checks would sometimes fail to load * Check Tracker - Fixes duplicated checks when using Only on Pause or Only on Combo * Check Tracker - Works around issue where single characters don't show in EnhancementCombobox, and fixes a label for combo buttons held option * Check Tracker - Applies all Check Tracker changes to Item Location * Check Tracker - Updated Check List - Adds Link's pocket, either in KF or HM depending on starting age - Supports Scrubs and Merchants - Uses enums instead of magic numbers - Updates DC Scrub Short Names for MQ * Check Tracker - Adds a performance mode option * Check Tracker - List Fixes (requires new rando generation) - Fixes Frogs Rupees always visible - Fixes Kokiri Sword Chest not showing - Fixes Weird Egg not showing * Check Tracker - MQ List basic support * Check Tracker - MQ/Vanilla anti-spoilers * Check Tracker - Collecting a compass now spoils the area * Check Tracker - Basic Vanilla Support and fixes - Vanilla items show in check tracker, even if many won't auto check - Fixes an issue with Gerudo Fortress Keys - Refactors IsVisibleInCheckTracker to randomizer_check_tracjer * Check Tracker - Fixes merge conflict from 08a487f35e1d760ab9e69b932edbe4da6bcd9edb * Check Tracker - Fixes tracker loading as Floating when default value is set to Windowed * Randomizer Location Exclusion List - Adds Scrubs, Merchants, Shops. Adult Trade items, MQ Dungeons, and Bean Salesman - Fixes Kokiri Sword Chest, Weird Egg, and Frog Song Rupees from misbehaving - Updates Gerudo Fortress logic to be dependent on Open/Fast/Normal Fortress - Removes Invalid Check - Adds RO Enum for MQ settings - Updates magic values to RO enum * Location Exclusion List - Scrubs that are always randomized now always show on the list * For now, removes some extra code only needed for a Check Tracker. * Randomizer Location Exclusion List - Fixes Eyeball Frog from showing up when Adult Trade Items was off * Location Tracker - Updates Eyedrops to use RandomizerInf instead of Chest * Check Tracker - Fixes a bug where Link's Pocket item wasn't acting as checked for area item count * Check Tracker - Fixes a bug where Locations would incorrectly say Vanilla due to the first check in the area being a non-MQ check * Check Tracker - Fixes a crash when Check Tracker is docked but not visible * Check Tracker - Fixes areas being spoiled when loading different save files * Check Tracker - Only reset variables if they are initialized * Check Tracker - Cleans up old comments, unused variables, methods, and macros, adds language TODOs, * Check Tracker - Readds rainbow UI elements after Cosmetics Editor refactor * Check Tracker - Removal of flag lookup that was refactored, no longer needed header, and some trivial whitespace fixes. * Check Tracker - Refactors Index to Bitmask code to a macro * Check Tracker - Changes ordering from alphabetical to RandomizerCheck ordering * Check Tracker - Wraps everything in a namespace to avoid global variable usage * Check Tracker - Explicitly defines for-loop scope * Check Tracker - refactors dungeon lookup from static array to function * Fixes a bug when using EnhancementColor with alpha * Check Tracker - Refactors all colour to use direct conversions * Check Tracker - refactors settings loading and check visibility for readability * Check Tracker - Fixes a bug where the wrong label showed on the Check Tracker BG Color * UIWidgets - Adds Alpha bar to EnhancementColor when using alpha parameter
2022-12-10 22:39:23 -05:00
}
static const char* windowType[] = { "Floating", "Window" };
static const char* displayType[] = { "Always", "Combo Button Hold" };
static const char* buttonStrings[] = { "A Button", "B Button", "C-Up", "C-Down", "C-Left", "C-Right", "L Button",
"Z Button", "R Button", "Start", "D-Up", "D-Down", "D-Left", "D-Right" };
build soh with LUS 1.0.0 (#2881) * Bump LUS * Ship -> LUS namespace change * z_scene_otr Ship -> LUS namespace * Starting to get SoH to build with LUS imgui changes. * start stuff * gamecontroleditor build issues resolved maybe * cosmetics editor and what not * console * actor viewer * more stuff * more stuff * on to errors that make sense * putting this down for a bit * no idea what these errors mean now * some kind of progress maybe * latest lus main * more * back to linker errors and being lost * Fixes command function signature. * More fixes * Even more fixes * Bump LUS * More Fixes. * Fixes even more errors. * lus bump * input editor as var * audio editor working * it builds with this * bump lus * it opens * bump lus to latest main again * make sure to do all the command registering in debugconsole * lus and what not * switch type stuff plz * undo * do the thing that fixes the thing * fix mac? * correctly show/hide menubar on boot * bump lus * input blocking updates * bump lus * Bump LUS * Press F1 to open enhancement menus moved to SoH * lus and rendering backend stuff * audio backend and lus * Bump LUS * Fixes WindowBackend dropdown * Bump LUS * misc -> utils and moves binarytools to utils. * Window refactor * bump lus * make it work * Fixes for moved files again * Bump LUS * Mercury -> Config * Bump LUS * Reacts to removed LUS hooks and bump LUS * Remove Hook: GfxInit * Removes debug audio_setgamevolume to 1 * use non-crashing branch of lus * fix: make audio init work without hooks * game icon stuff * multifix bmp * use input viewer class branch for now * just "Ship" it's cleaner * Bump LUS * Removed ExitGame hook. * Bump LUS * Hook system removed from LUS. * More LUS updates * Changes to make window position saving. * Bump LUS * Bump LUS (for real) * LUS resources now return a specialized pointer. * Bump LUS * Fixes issue in SetPathways::GetPointerSize * Bump LUS to 1.0.0 * builds but crashes * fix crash * better macro names in debug console * remove commeted out line * remove redundant check tracker settings window logic * remove commented out line * move the * * remove extra seqplayers enum def * this sneaky little guy was hiding behind a wii u ifdef * remove extra check tracker header --------- Co-authored-by: Kenix <kenixwhisperwind@gmail.com> Co-authored-by: briaguya <briaguya@alice>
2023-06-03 15:27:45 -04:00
void CheckTrackerSettingsWindow::DrawElement() {
Randomizer Auto Location tracker (#1942) * Initial Auto-Location Tracking * Updates styling for checked items in Check Tracker * Fixes crashing issues with Check Tracker rendering * Auto scroll Check Tracker windows to current area * Checks Tracker only shows checked locations once in game * Fixes issue where Check Tracker would auto-scroll to wrong location when entering a grotto * Fixes gerudo fortress checks showing in tracker when settings have them removed * InfTable Check Location Fixes: Lost Dog Richard, Rolling Gorons, HBA 1000, Thawed Zora * Fixes most Event Chk Inf Checks on Check Tracker, and Frogs * Check Tracker - Song from Malon now works * Check Tracker - Fixes Claim Check check not tracking - Fixes spoiler for Claim Check check when getting Biggoron's Sword - Fixes LACS being spoiled and not tracking * Check Tracker - Fixes #2 for Skull Mask and Mask of Truth checks * Check Tracker - Adds support for merchants - Fixes #7 for Bomchu Salesman - Fixes #12 for Medigoron * Check Tracker - Fixes #8 for Song from Saria * Check Tracker - Fixes #9 for Adult Shooting Gallery * Check Tracker - Fixes #10 for Composer Grave * Check Tracker - Fixes #14 for Song from Ocarina of Time * Check Tracker - Fixes #16 for Shooting the Sun * Check Tracker - Fixes #19 for Darunia's Joy * Save Editor - Adds missing label for Treasure Chest Game * Check Tracker - Fixes Great Faries checks * Check Tracker - Fixes Sheik at Temple * Check Tracker - Fixes Great Fairy auto-scroll to wrong location * Check Tracker - Updates blue warp checks - Fixes Bongo Bongo and Twinrova checks * Check Tracker - Fixes Dampe's Gravedigging Tour * Check Tracker - Fixes Prescription to King Zora * Check Tracker - Fixes Bazaar showing under wrong area on tracker between adult/child * Check Tracker - Fixes scroll for Hyrule Market and Bazaar * Check Tracker - Fixes giving Adult Trade Items shown on tracker: Broken Sword, Saw, Cojiro, Eyeball Froge, and Eyedrops * Cleans up item_location * Check Tracker - Item List - Fixes item list not updating when changing seeds/options - Separates item exclusion list from item check list - Clean up comments * Check Tracker - Adds Skip functionality to buttons * Check Tracker - Refactors adult trade items to RandomizerInf * Check Tracker - Fixes an issue where any time an item is removed the tracker would cause an application crash * Check Tracker - Item names are now dependent on file language * Check Tracker - Fixes Gerudo Card check not showing in Fast setting * Reorders headers to (hopefully) avoid CI build conflicts on linux/consoles * Explicitly defines vector header in randomizer.h to fix compile errors * Complete Refactor of Check Tracker ImGui * Adds missing check tracker files to CMakeLists * Reverts the Item_location whitespace cleanup from ad10807c * Check Tracker - Loading Fixes - Fixes a bug where loading a save file a second time would add all the checks again - Fixes a bug where the check tracker would not render at all until in a save file * Check Tracker - Fixes a bug where checks would sometimes fail to load * Check Tracker - Fixes duplicated checks when using Only on Pause or Only on Combo * Check Tracker - Works around issue where single characters don't show in EnhancementCombobox, and fixes a label for combo buttons held option * Check Tracker - Applies all Check Tracker changes to Item Location * Check Tracker - Updated Check List - Adds Link's pocket, either in KF or HM depending on starting age - Supports Scrubs and Merchants - Uses enums instead of magic numbers - Updates DC Scrub Short Names for MQ * Check Tracker - Adds a performance mode option * Check Tracker - List Fixes (requires new rando generation) - Fixes Frogs Rupees always visible - Fixes Kokiri Sword Chest not showing - Fixes Weird Egg not showing * Check Tracker - MQ List basic support * Check Tracker - MQ/Vanilla anti-spoilers * Check Tracker - Collecting a compass now spoils the area * Check Tracker - Basic Vanilla Support and fixes - Vanilla items show in check tracker, even if many won't auto check - Fixes an issue with Gerudo Fortress Keys - Refactors IsVisibleInCheckTracker to randomizer_check_tracjer * Check Tracker - Fixes merge conflict from 08a487f35e1d760ab9e69b932edbe4da6bcd9edb * Check Tracker - Fixes tracker loading as Floating when default value is set to Windowed * Randomizer Location Exclusion List - Adds Scrubs, Merchants, Shops. Adult Trade items, MQ Dungeons, and Bean Salesman - Fixes Kokiri Sword Chest, Weird Egg, and Frog Song Rupees from misbehaving - Updates Gerudo Fortress logic to be dependent on Open/Fast/Normal Fortress - Removes Invalid Check - Adds RO Enum for MQ settings - Updates magic values to RO enum * Location Exclusion List - Scrubs that are always randomized now always show on the list * For now, removes some extra code only needed for a Check Tracker. * Randomizer Location Exclusion List - Fixes Eyeball Frog from showing up when Adult Trade Items was off * Location Tracker - Updates Eyedrops to use RandomizerInf instead of Chest * Check Tracker - Fixes a bug where Link's Pocket item wasn't acting as checked for area item count * Check Tracker - Fixes a bug where Locations would incorrectly say Vanilla due to the first check in the area being a non-MQ check * Check Tracker - Fixes a crash when Check Tracker is docked but not visible * Check Tracker - Fixes areas being spoiled when loading different save files * Check Tracker - Only reset variables if they are initialized * Check Tracker - Cleans up old comments, unused variables, methods, and macros, adds language TODOs, * Check Tracker - Readds rainbow UI elements after Cosmetics Editor refactor * Check Tracker - Removal of flag lookup that was refactored, no longer needed header, and some trivial whitespace fixes. * Check Tracker - Refactors Index to Bitmask code to a macro * Check Tracker - Changes ordering from alphabetical to RandomizerCheck ordering * Check Tracker - Wraps everything in a namespace to avoid global variable usage * Check Tracker - Explicitly defines for-loop scope * Check Tracker - refactors dungeon lookup from static array to function * Fixes a bug when using EnhancementColor with alpha * Check Tracker - Refactors all colour to use direct conversions * Check Tracker - refactors settings loading and check visibility for readability * Check Tracker - Fixes a bug where the wrong label showed on the Check Tracker BG Color * UIWidgets - Adds Alpha bar to EnhancementColor when using alpha parameter
2022-12-10 22:39:23 -05:00
ImGui::SetNextWindowSize(ImVec2(600, 375), ImGuiCond_FirstUseEver);
build soh with LUS 1.0.0 (#2881) * Bump LUS * Ship -> LUS namespace change * z_scene_otr Ship -> LUS namespace * Starting to get SoH to build with LUS imgui changes. * start stuff * gamecontroleditor build issues resolved maybe * cosmetics editor and what not * console * actor viewer * more stuff * more stuff * on to errors that make sense * putting this down for a bit * no idea what these errors mean now * some kind of progress maybe * latest lus main * more * back to linker errors and being lost * Fixes command function signature. * More fixes * Even more fixes * Bump LUS * More Fixes. * Fixes even more errors. * lus bump * input editor as var * audio editor working * it builds with this * bump lus * it opens * bump lus to latest main again * make sure to do all the command registering in debugconsole * lus and what not * switch type stuff plz * undo * do the thing that fixes the thing * fix mac? * correctly show/hide menubar on boot * bump lus * input blocking updates * bump lus * Bump LUS * Press F1 to open enhancement menus moved to SoH * lus and rendering backend stuff * audio backend and lus * Bump LUS * Fixes WindowBackend dropdown * Bump LUS * misc -> utils and moves binarytools to utils. * Window refactor * bump lus * make it work * Fixes for moved files again * Bump LUS * Mercury -> Config * Bump LUS * Reacts to removed LUS hooks and bump LUS * Remove Hook: GfxInit * Removes debug audio_setgamevolume to 1 * use non-crashing branch of lus * fix: make audio init work without hooks * game icon stuff * multifix bmp * use input viewer class branch for now * just "Ship" it's cleaner * Bump LUS * Removed ExitGame hook. * Bump LUS * Hook system removed from LUS. * More LUS updates * Changes to make window position saving. * Bump LUS * Bump LUS (for real) * LUS resources now return a specialized pointer. * Bump LUS * Fixes issue in SetPathways::GetPointerSize * Bump LUS to 1.0.0 * builds but crashes * fix crash * better macro names in debug console * remove commeted out line * remove redundant check tracker settings window logic * remove commented out line * move the * * remove extra seqplayers enum def * this sneaky little guy was hiding behind a wii u ifdef * remove extra check tracker header --------- Co-authored-by: Kenix <kenixwhisperwind@gmail.com> Co-authored-by: briaguya <briaguya@alice>
2023-06-03 15:27:45 -04:00
if (!ImGui::Begin("Check Tracker Settings", &mIsVisible, ImGuiWindowFlags_NoFocusOnAppearing)) {
Randomizer Auto Location tracker (#1942) * Initial Auto-Location Tracking * Updates styling for checked items in Check Tracker * Fixes crashing issues with Check Tracker rendering * Auto scroll Check Tracker windows to current area * Checks Tracker only shows checked locations once in game * Fixes issue where Check Tracker would auto-scroll to wrong location when entering a grotto * Fixes gerudo fortress checks showing in tracker when settings have them removed * InfTable Check Location Fixes: Lost Dog Richard, Rolling Gorons, HBA 1000, Thawed Zora * Fixes most Event Chk Inf Checks on Check Tracker, and Frogs * Check Tracker - Song from Malon now works * Check Tracker - Fixes Claim Check check not tracking - Fixes spoiler for Claim Check check when getting Biggoron's Sword - Fixes LACS being spoiled and not tracking * Check Tracker - Fixes #2 for Skull Mask and Mask of Truth checks * Check Tracker - Adds support for merchants - Fixes #7 for Bomchu Salesman - Fixes #12 for Medigoron * Check Tracker - Fixes #8 for Song from Saria * Check Tracker - Fixes #9 for Adult Shooting Gallery * Check Tracker - Fixes #10 for Composer Grave * Check Tracker - Fixes #14 for Song from Ocarina of Time * Check Tracker - Fixes #16 for Shooting the Sun * Check Tracker - Fixes #19 for Darunia's Joy * Save Editor - Adds missing label for Treasure Chest Game * Check Tracker - Fixes Great Faries checks * Check Tracker - Fixes Sheik at Temple * Check Tracker - Fixes Great Fairy auto-scroll to wrong location * Check Tracker - Updates blue warp checks - Fixes Bongo Bongo and Twinrova checks * Check Tracker - Fixes Dampe's Gravedigging Tour * Check Tracker - Fixes Prescription to King Zora * Check Tracker - Fixes Bazaar showing under wrong area on tracker between adult/child * Check Tracker - Fixes scroll for Hyrule Market and Bazaar * Check Tracker - Fixes giving Adult Trade Items shown on tracker: Broken Sword, Saw, Cojiro, Eyeball Froge, and Eyedrops * Cleans up item_location * Check Tracker - Item List - Fixes item list not updating when changing seeds/options - Separates item exclusion list from item check list - Clean up comments * Check Tracker - Adds Skip functionality to buttons * Check Tracker - Refactors adult trade items to RandomizerInf * Check Tracker - Fixes an issue where any time an item is removed the tracker would cause an application crash * Check Tracker - Item names are now dependent on file language * Check Tracker - Fixes Gerudo Card check not showing in Fast setting * Reorders headers to (hopefully) avoid CI build conflicts on linux/consoles * Explicitly defines vector header in randomizer.h to fix compile errors * Complete Refactor of Check Tracker ImGui * Adds missing check tracker files to CMakeLists * Reverts the Item_location whitespace cleanup from ad10807c * Check Tracker - Loading Fixes - Fixes a bug where loading a save file a second time would add all the checks again - Fixes a bug where the check tracker would not render at all until in a save file * Check Tracker - Fixes a bug where checks would sometimes fail to load * Check Tracker - Fixes duplicated checks when using Only on Pause or Only on Combo * Check Tracker - Works around issue where single characters don't show in EnhancementCombobox, and fixes a label for combo buttons held option * Check Tracker - Applies all Check Tracker changes to Item Location * Check Tracker - Updated Check List - Adds Link's pocket, either in KF or HM depending on starting age - Supports Scrubs and Merchants - Uses enums instead of magic numbers - Updates DC Scrub Short Names for MQ * Check Tracker - Adds a performance mode option * Check Tracker - List Fixes (requires new rando generation) - Fixes Frogs Rupees always visible - Fixes Kokiri Sword Chest not showing - Fixes Weird Egg not showing * Check Tracker - MQ List basic support * Check Tracker - MQ/Vanilla anti-spoilers * Check Tracker - Collecting a compass now spoils the area * Check Tracker - Basic Vanilla Support and fixes - Vanilla items show in check tracker, even if many won't auto check - Fixes an issue with Gerudo Fortress Keys - Refactors IsVisibleInCheckTracker to randomizer_check_tracjer * Check Tracker - Fixes merge conflict from 08a487f35e1d760ab9e69b932edbe4da6bcd9edb * Check Tracker - Fixes tracker loading as Floating when default value is set to Windowed * Randomizer Location Exclusion List - Adds Scrubs, Merchants, Shops. Adult Trade items, MQ Dungeons, and Bean Salesman - Fixes Kokiri Sword Chest, Weird Egg, and Frog Song Rupees from misbehaving - Updates Gerudo Fortress logic to be dependent on Open/Fast/Normal Fortress - Removes Invalid Check - Adds RO Enum for MQ settings - Updates magic values to RO enum * Location Exclusion List - Scrubs that are always randomized now always show on the list * For now, removes some extra code only needed for a Check Tracker. * Randomizer Location Exclusion List - Fixes Eyeball Frog from showing up when Adult Trade Items was off * Location Tracker - Updates Eyedrops to use RandomizerInf instead of Chest * Check Tracker - Fixes a bug where Link's Pocket item wasn't acting as checked for area item count * Check Tracker - Fixes a bug where Locations would incorrectly say Vanilla due to the first check in the area being a non-MQ check * Check Tracker - Fixes a crash when Check Tracker is docked but not visible * Check Tracker - Fixes areas being spoiled when loading different save files * Check Tracker - Only reset variables if they are initialized * Check Tracker - Cleans up old comments, unused variables, methods, and macros, adds language TODOs, * Check Tracker - Readds rainbow UI elements after Cosmetics Editor refactor * Check Tracker - Removal of flag lookup that was refactored, no longer needed header, and some trivial whitespace fixes. * Check Tracker - Refactors Index to Bitmask code to a macro * Check Tracker - Changes ordering from alphabetical to RandomizerCheck ordering * Check Tracker - Wraps everything in a namespace to avoid global variable usage * Check Tracker - Explicitly defines for-loop scope * Check Tracker - refactors dungeon lookup from static array to function * Fixes a bug when using EnhancementColor with alpha * Check Tracker - Refactors all colour to use direct conversions * Check Tracker - refactors settings loading and check visibility for readability * Check Tracker - Fixes a bug where the wrong label showed on the Check Tracker BG Color * UIWidgets - Adds Alpha bar to EnhancementColor when using alpha parameter
2022-12-10 22:39:23 -05:00
ImGui::End();
return;
}
ImGui::PushStyleVar(ImGuiStyleVar_CellPadding, { 8.0f, 8.0f });
ImGui::BeginTable("CheckTrackerSettingsTable", 2, ImGuiTableFlags_BordersH | ImGuiTableFlags_BordersV);
ImGui::TableSetupColumn("General settings", ImGuiTableColumnFlags_WidthStretch, 200.0f);
ImGui::TableSetupColumn("Section settings", ImGuiTableColumnFlags_WidthStretch, 200.0f);
ImGui::TableHeadersRow();
ImGui::TableNextRow();
ImGui::TableNextColumn();
ImGui::PushItemWidth(ImGui::GetContentRegionAvail().x);
if (UIWidgets::EnhancementColor("BG Color", "gCheckTrackerBgColor",
ImVec4(Color_Background.r, Color_Background.g, Color_Background.b, Color_Background.a),
ImVec4(Color_Bg_Default.r, Color_Bg_Default.g, Color_Bg_Default.b, Color_Bg_Default.a),
Randomizer Auto Location tracker (#1942) * Initial Auto-Location Tracking * Updates styling for checked items in Check Tracker * Fixes crashing issues with Check Tracker rendering * Auto scroll Check Tracker windows to current area * Checks Tracker only shows checked locations once in game * Fixes issue where Check Tracker would auto-scroll to wrong location when entering a grotto * Fixes gerudo fortress checks showing in tracker when settings have them removed * InfTable Check Location Fixes: Lost Dog Richard, Rolling Gorons, HBA 1000, Thawed Zora * Fixes most Event Chk Inf Checks on Check Tracker, and Frogs * Check Tracker - Song from Malon now works * Check Tracker - Fixes Claim Check check not tracking - Fixes spoiler for Claim Check check when getting Biggoron's Sword - Fixes LACS being spoiled and not tracking * Check Tracker - Fixes #2 for Skull Mask and Mask of Truth checks * Check Tracker - Adds support for merchants - Fixes #7 for Bomchu Salesman - Fixes #12 for Medigoron * Check Tracker - Fixes #8 for Song from Saria * Check Tracker - Fixes #9 for Adult Shooting Gallery * Check Tracker - Fixes #10 for Composer Grave * Check Tracker - Fixes #14 for Song from Ocarina of Time * Check Tracker - Fixes #16 for Shooting the Sun * Check Tracker - Fixes #19 for Darunia's Joy * Save Editor - Adds missing label for Treasure Chest Game * Check Tracker - Fixes Great Faries checks * Check Tracker - Fixes Sheik at Temple * Check Tracker - Fixes Great Fairy auto-scroll to wrong location * Check Tracker - Updates blue warp checks - Fixes Bongo Bongo and Twinrova checks * Check Tracker - Fixes Dampe's Gravedigging Tour * Check Tracker - Fixes Prescription to King Zora * Check Tracker - Fixes Bazaar showing under wrong area on tracker between adult/child * Check Tracker - Fixes scroll for Hyrule Market and Bazaar * Check Tracker - Fixes giving Adult Trade Items shown on tracker: Broken Sword, Saw, Cojiro, Eyeball Froge, and Eyedrops * Cleans up item_location * Check Tracker - Item List - Fixes item list not updating when changing seeds/options - Separates item exclusion list from item check list - Clean up comments * Check Tracker - Adds Skip functionality to buttons * Check Tracker - Refactors adult trade items to RandomizerInf * Check Tracker - Fixes an issue where any time an item is removed the tracker would cause an application crash * Check Tracker - Item names are now dependent on file language * Check Tracker - Fixes Gerudo Card check not showing in Fast setting * Reorders headers to (hopefully) avoid CI build conflicts on linux/consoles * Explicitly defines vector header in randomizer.h to fix compile errors * Complete Refactor of Check Tracker ImGui * Adds missing check tracker files to CMakeLists * Reverts the Item_location whitespace cleanup from ad10807c * Check Tracker - Loading Fixes - Fixes a bug where loading a save file a second time would add all the checks again - Fixes a bug where the check tracker would not render at all until in a save file * Check Tracker - Fixes a bug where checks would sometimes fail to load * Check Tracker - Fixes duplicated checks when using Only on Pause or Only on Combo * Check Tracker - Works around issue where single characters don't show in EnhancementCombobox, and fixes a label for combo buttons held option * Check Tracker - Applies all Check Tracker changes to Item Location * Check Tracker - Updated Check List - Adds Link's pocket, either in KF or HM depending on starting age - Supports Scrubs and Merchants - Uses enums instead of magic numbers - Updates DC Scrub Short Names for MQ * Check Tracker - Adds a performance mode option * Check Tracker - List Fixes (requires new rando generation) - Fixes Frogs Rupees always visible - Fixes Kokiri Sword Chest not showing - Fixes Weird Egg not showing * Check Tracker - MQ List basic support * Check Tracker - MQ/Vanilla anti-spoilers * Check Tracker - Collecting a compass now spoils the area * Check Tracker - Basic Vanilla Support and fixes - Vanilla items show in check tracker, even if many won't auto check - Fixes an issue with Gerudo Fortress Keys - Refactors IsVisibleInCheckTracker to randomizer_check_tracjer * Check Tracker - Fixes merge conflict from 08a487f35e1d760ab9e69b932edbe4da6bcd9edb * Check Tracker - Fixes tracker loading as Floating when default value is set to Windowed * Randomizer Location Exclusion List - Adds Scrubs, Merchants, Shops. Adult Trade items, MQ Dungeons, and Bean Salesman - Fixes Kokiri Sword Chest, Weird Egg, and Frog Song Rupees from misbehaving - Updates Gerudo Fortress logic to be dependent on Open/Fast/Normal Fortress - Removes Invalid Check - Adds RO Enum for MQ settings - Updates magic values to RO enum * Location Exclusion List - Scrubs that are always randomized now always show on the list * For now, removes some extra code only needed for a Check Tracker. * Randomizer Location Exclusion List - Fixes Eyeball Frog from showing up when Adult Trade Items was off * Location Tracker - Updates Eyedrops to use RandomizerInf instead of Chest * Check Tracker - Fixes a bug where Link's Pocket item wasn't acting as checked for area item count * Check Tracker - Fixes a bug where Locations would incorrectly say Vanilla due to the first check in the area being a non-MQ check * Check Tracker - Fixes a crash when Check Tracker is docked but not visible * Check Tracker - Fixes areas being spoiled when loading different save files * Check Tracker - Only reset variables if they are initialized * Check Tracker - Cleans up old comments, unused variables, methods, and macros, adds language TODOs, * Check Tracker - Readds rainbow UI elements after Cosmetics Editor refactor * Check Tracker - Removal of flag lookup that was refactored, no longer needed header, and some trivial whitespace fixes. * Check Tracker - Refactors Index to Bitmask code to a macro * Check Tracker - Changes ordering from alphabetical to RandomizerCheck ordering * Check Tracker - Wraps everything in a namespace to avoid global variable usage * Check Tracker - Explicitly defines for-loop scope * Check Tracker - refactors dungeon lookup from static array to function * Fixes a bug when using EnhancementColor with alpha * Check Tracker - Refactors all colour to use direct conversions * Check Tracker - refactors settings loading and check visibility for readability * Check Tracker - Fixes a bug where the wrong label showed on the Check Tracker BG Color * UIWidgets - Adds Alpha bar to EnhancementColor when using alpha parameter
2022-12-10 22:39:23 -05:00
false, true))
{
Color_Background = CVarGetColor("gCheckTrackerBgColor", Color_Bg_Default);
Randomizer Auto Location tracker (#1942) * Initial Auto-Location Tracking * Updates styling for checked items in Check Tracker * Fixes crashing issues with Check Tracker rendering * Auto scroll Check Tracker windows to current area * Checks Tracker only shows checked locations once in game * Fixes issue where Check Tracker would auto-scroll to wrong location when entering a grotto * Fixes gerudo fortress checks showing in tracker when settings have them removed * InfTable Check Location Fixes: Lost Dog Richard, Rolling Gorons, HBA 1000, Thawed Zora * Fixes most Event Chk Inf Checks on Check Tracker, and Frogs * Check Tracker - Song from Malon now works * Check Tracker - Fixes Claim Check check not tracking - Fixes spoiler for Claim Check check when getting Biggoron's Sword - Fixes LACS being spoiled and not tracking * Check Tracker - Fixes #2 for Skull Mask and Mask of Truth checks * Check Tracker - Adds support for merchants - Fixes #7 for Bomchu Salesman - Fixes #12 for Medigoron * Check Tracker - Fixes #8 for Song from Saria * Check Tracker - Fixes #9 for Adult Shooting Gallery * Check Tracker - Fixes #10 for Composer Grave * Check Tracker - Fixes #14 for Song from Ocarina of Time * Check Tracker - Fixes #16 for Shooting the Sun * Check Tracker - Fixes #19 for Darunia's Joy * Save Editor - Adds missing label for Treasure Chest Game * Check Tracker - Fixes Great Faries checks * Check Tracker - Fixes Sheik at Temple * Check Tracker - Fixes Great Fairy auto-scroll to wrong location * Check Tracker - Updates blue warp checks - Fixes Bongo Bongo and Twinrova checks * Check Tracker - Fixes Dampe's Gravedigging Tour * Check Tracker - Fixes Prescription to King Zora * Check Tracker - Fixes Bazaar showing under wrong area on tracker between adult/child * Check Tracker - Fixes scroll for Hyrule Market and Bazaar * Check Tracker - Fixes giving Adult Trade Items shown on tracker: Broken Sword, Saw, Cojiro, Eyeball Froge, and Eyedrops * Cleans up item_location * Check Tracker - Item List - Fixes item list not updating when changing seeds/options - Separates item exclusion list from item check list - Clean up comments * Check Tracker - Adds Skip functionality to buttons * Check Tracker - Refactors adult trade items to RandomizerInf * Check Tracker - Fixes an issue where any time an item is removed the tracker would cause an application crash * Check Tracker - Item names are now dependent on file language * Check Tracker - Fixes Gerudo Card check not showing in Fast setting * Reorders headers to (hopefully) avoid CI build conflicts on linux/consoles * Explicitly defines vector header in randomizer.h to fix compile errors * Complete Refactor of Check Tracker ImGui * Adds missing check tracker files to CMakeLists * Reverts the Item_location whitespace cleanup from ad10807c * Check Tracker - Loading Fixes - Fixes a bug where loading a save file a second time would add all the checks again - Fixes a bug where the check tracker would not render at all until in a save file * Check Tracker - Fixes a bug where checks would sometimes fail to load * Check Tracker - Fixes duplicated checks when using Only on Pause or Only on Combo * Check Tracker - Works around issue where single characters don't show in EnhancementCombobox, and fixes a label for combo buttons held option * Check Tracker - Applies all Check Tracker changes to Item Location * Check Tracker - Updated Check List - Adds Link's pocket, either in KF or HM depending on starting age - Supports Scrubs and Merchants - Uses enums instead of magic numbers - Updates DC Scrub Short Names for MQ * Check Tracker - Adds a performance mode option * Check Tracker - List Fixes (requires new rando generation) - Fixes Frogs Rupees always visible - Fixes Kokiri Sword Chest not showing - Fixes Weird Egg not showing * Check Tracker - MQ List basic support * Check Tracker - MQ/Vanilla anti-spoilers * Check Tracker - Collecting a compass now spoils the area * Check Tracker - Basic Vanilla Support and fixes - Vanilla items show in check tracker, even if many won't auto check - Fixes an issue with Gerudo Fortress Keys - Refactors IsVisibleInCheckTracker to randomizer_check_tracjer * Check Tracker - Fixes merge conflict from 08a487f35e1d760ab9e69b932edbe4da6bcd9edb * Check Tracker - Fixes tracker loading as Floating when default value is set to Windowed * Randomizer Location Exclusion List - Adds Scrubs, Merchants, Shops. Adult Trade items, MQ Dungeons, and Bean Salesman - Fixes Kokiri Sword Chest, Weird Egg, and Frog Song Rupees from misbehaving - Updates Gerudo Fortress logic to be dependent on Open/Fast/Normal Fortress - Removes Invalid Check - Adds RO Enum for MQ settings - Updates magic values to RO enum * Location Exclusion List - Scrubs that are always randomized now always show on the list * For now, removes some extra code only needed for a Check Tracker. * Randomizer Location Exclusion List - Fixes Eyeball Frog from showing up when Adult Trade Items was off * Location Tracker - Updates Eyedrops to use RandomizerInf instead of Chest * Check Tracker - Fixes a bug where Link's Pocket item wasn't acting as checked for area item count * Check Tracker - Fixes a bug where Locations would incorrectly say Vanilla due to the first check in the area being a non-MQ check * Check Tracker - Fixes a crash when Check Tracker is docked but not visible * Check Tracker - Fixes areas being spoiled when loading different save files * Check Tracker - Only reset variables if they are initialized * Check Tracker - Cleans up old comments, unused variables, methods, and macros, adds language TODOs, * Check Tracker - Readds rainbow UI elements after Cosmetics Editor refactor * Check Tracker - Removal of flag lookup that was refactored, no longer needed header, and some trivial whitespace fixes. * Check Tracker - Refactors Index to Bitmask code to a macro * Check Tracker - Changes ordering from alphabetical to RandomizerCheck ordering * Check Tracker - Wraps everything in a namespace to avoid global variable usage * Check Tracker - Explicitly defines for-loop scope * Check Tracker - refactors dungeon lookup from static array to function * Fixes a bug when using EnhancementColor with alpha * Check Tracker - Refactors all colour to use direct conversions * Check Tracker - refactors settings loading and check visibility for readability * Check Tracker - Fixes a bug where the wrong label showed on the Check Tracker BG Color * UIWidgets - Adds Alpha bar to EnhancementColor when using alpha parameter
2022-12-10 22:39:23 -05:00
}
ImGui::PopItemWidth();
UIWidgets::LabeledRightAlignedEnhancementCombobox("Window Type", "gCheckTrackerWindowType", windowType, TRACKER_WINDOW_WINDOW);
if (CVarGetInteger("gCheckTrackerWindowType", TRACKER_WINDOW_WINDOW) == TRACKER_WINDOW_FLOATING) {
Randomizer Auto Location tracker (#1942) * Initial Auto-Location Tracking * Updates styling for checked items in Check Tracker * Fixes crashing issues with Check Tracker rendering * Auto scroll Check Tracker windows to current area * Checks Tracker only shows checked locations once in game * Fixes issue where Check Tracker would auto-scroll to wrong location when entering a grotto * Fixes gerudo fortress checks showing in tracker when settings have them removed * InfTable Check Location Fixes: Lost Dog Richard, Rolling Gorons, HBA 1000, Thawed Zora * Fixes most Event Chk Inf Checks on Check Tracker, and Frogs * Check Tracker - Song from Malon now works * Check Tracker - Fixes Claim Check check not tracking - Fixes spoiler for Claim Check check when getting Biggoron's Sword - Fixes LACS being spoiled and not tracking * Check Tracker - Fixes #2 for Skull Mask and Mask of Truth checks * Check Tracker - Adds support for merchants - Fixes #7 for Bomchu Salesman - Fixes #12 for Medigoron * Check Tracker - Fixes #8 for Song from Saria * Check Tracker - Fixes #9 for Adult Shooting Gallery * Check Tracker - Fixes #10 for Composer Grave * Check Tracker - Fixes #14 for Song from Ocarina of Time * Check Tracker - Fixes #16 for Shooting the Sun * Check Tracker - Fixes #19 for Darunia's Joy * Save Editor - Adds missing label for Treasure Chest Game * Check Tracker - Fixes Great Faries checks * Check Tracker - Fixes Sheik at Temple * Check Tracker - Fixes Great Fairy auto-scroll to wrong location * Check Tracker - Updates blue warp checks - Fixes Bongo Bongo and Twinrova checks * Check Tracker - Fixes Dampe's Gravedigging Tour * Check Tracker - Fixes Prescription to King Zora * Check Tracker - Fixes Bazaar showing under wrong area on tracker between adult/child * Check Tracker - Fixes scroll for Hyrule Market and Bazaar * Check Tracker - Fixes giving Adult Trade Items shown on tracker: Broken Sword, Saw, Cojiro, Eyeball Froge, and Eyedrops * Cleans up item_location * Check Tracker - Item List - Fixes item list not updating when changing seeds/options - Separates item exclusion list from item check list - Clean up comments * Check Tracker - Adds Skip functionality to buttons * Check Tracker - Refactors adult trade items to RandomizerInf * Check Tracker - Fixes an issue where any time an item is removed the tracker would cause an application crash * Check Tracker - Item names are now dependent on file language * Check Tracker - Fixes Gerudo Card check not showing in Fast setting * Reorders headers to (hopefully) avoid CI build conflicts on linux/consoles * Explicitly defines vector header in randomizer.h to fix compile errors * Complete Refactor of Check Tracker ImGui * Adds missing check tracker files to CMakeLists * Reverts the Item_location whitespace cleanup from ad10807c * Check Tracker - Loading Fixes - Fixes a bug where loading a save file a second time would add all the checks again - Fixes a bug where the check tracker would not render at all until in a save file * Check Tracker - Fixes a bug where checks would sometimes fail to load * Check Tracker - Fixes duplicated checks when using Only on Pause or Only on Combo * Check Tracker - Works around issue where single characters don't show in EnhancementCombobox, and fixes a label for combo buttons held option * Check Tracker - Applies all Check Tracker changes to Item Location * Check Tracker - Updated Check List - Adds Link's pocket, either in KF or HM depending on starting age - Supports Scrubs and Merchants - Uses enums instead of magic numbers - Updates DC Scrub Short Names for MQ * Check Tracker - Adds a performance mode option * Check Tracker - List Fixes (requires new rando generation) - Fixes Frogs Rupees always visible - Fixes Kokiri Sword Chest not showing - Fixes Weird Egg not showing * Check Tracker - MQ List basic support * Check Tracker - MQ/Vanilla anti-spoilers * Check Tracker - Collecting a compass now spoils the area * Check Tracker - Basic Vanilla Support and fixes - Vanilla items show in check tracker, even if many won't auto check - Fixes an issue with Gerudo Fortress Keys - Refactors IsVisibleInCheckTracker to randomizer_check_tracjer * Check Tracker - Fixes merge conflict from 08a487f35e1d760ab9e69b932edbe4da6bcd9edb * Check Tracker - Fixes tracker loading as Floating when default value is set to Windowed * Randomizer Location Exclusion List - Adds Scrubs, Merchants, Shops. Adult Trade items, MQ Dungeons, and Bean Salesman - Fixes Kokiri Sword Chest, Weird Egg, and Frog Song Rupees from misbehaving - Updates Gerudo Fortress logic to be dependent on Open/Fast/Normal Fortress - Removes Invalid Check - Adds RO Enum for MQ settings - Updates magic values to RO enum * Location Exclusion List - Scrubs that are always randomized now always show on the list * For now, removes some extra code only needed for a Check Tracker. * Randomizer Location Exclusion List - Fixes Eyeball Frog from showing up when Adult Trade Items was off * Location Tracker - Updates Eyedrops to use RandomizerInf instead of Chest * Check Tracker - Fixes a bug where Link's Pocket item wasn't acting as checked for area item count * Check Tracker - Fixes a bug where Locations would incorrectly say Vanilla due to the first check in the area being a non-MQ check * Check Tracker - Fixes a crash when Check Tracker is docked but not visible * Check Tracker - Fixes areas being spoiled when loading different save files * Check Tracker - Only reset variables if they are initialized * Check Tracker - Cleans up old comments, unused variables, methods, and macros, adds language TODOs, * Check Tracker - Readds rainbow UI elements after Cosmetics Editor refactor * Check Tracker - Removal of flag lookup that was refactored, no longer needed header, and some trivial whitespace fixes. * Check Tracker - Refactors Index to Bitmask code to a macro * Check Tracker - Changes ordering from alphabetical to RandomizerCheck ordering * Check Tracker - Wraps everything in a namespace to avoid global variable usage * Check Tracker - Explicitly defines for-loop scope * Check Tracker - refactors dungeon lookup from static array to function * Fixes a bug when using EnhancementColor with alpha * Check Tracker - Refactors all colour to use direct conversions * Check Tracker - refactors settings loading and check visibility for readability * Check Tracker - Fixes a bug where the wrong label showed on the Check Tracker BG Color * UIWidgets - Adds Alpha bar to EnhancementColor when using alpha parameter
2022-12-10 22:39:23 -05:00
UIWidgets::EnhancementCheckbox("Enable Dragging", "gCheckTrackerHudEditMode");
UIWidgets::EnhancementCheckbox("Only enable while paused", "gCheckTrackerShowOnlyPaused");
UIWidgets::LabeledRightAlignedEnhancementCombobox("Display Mode", "gCheckTrackerDisplayType", displayType, 0);
if (CVarGetInteger("gCheckTrackerDisplayType", TRACKER_DISPLAY_ALWAYS) == TRACKER_DISPLAY_COMBO_BUTTON) {
UIWidgets::LabeledRightAlignedEnhancementCombobox("Combo Button 1", "gCheckTrackerComboButton1", buttonStrings, TRACKER_COMBO_BUTTON_L);
UIWidgets::LabeledRightAlignedEnhancementCombobox("Combo Button 2", "gCheckTrackerComboButton2", buttonStrings, TRACKER_COMBO_BUTTON_R);
Randomizer Auto Location tracker (#1942) * Initial Auto-Location Tracking * Updates styling for checked items in Check Tracker * Fixes crashing issues with Check Tracker rendering * Auto scroll Check Tracker windows to current area * Checks Tracker only shows checked locations once in game * Fixes issue where Check Tracker would auto-scroll to wrong location when entering a grotto * Fixes gerudo fortress checks showing in tracker when settings have them removed * InfTable Check Location Fixes: Lost Dog Richard, Rolling Gorons, HBA 1000, Thawed Zora * Fixes most Event Chk Inf Checks on Check Tracker, and Frogs * Check Tracker - Song from Malon now works * Check Tracker - Fixes Claim Check check not tracking - Fixes spoiler for Claim Check check when getting Biggoron's Sword - Fixes LACS being spoiled and not tracking * Check Tracker - Fixes #2 for Skull Mask and Mask of Truth checks * Check Tracker - Adds support for merchants - Fixes #7 for Bomchu Salesman - Fixes #12 for Medigoron * Check Tracker - Fixes #8 for Song from Saria * Check Tracker - Fixes #9 for Adult Shooting Gallery * Check Tracker - Fixes #10 for Composer Grave * Check Tracker - Fixes #14 for Song from Ocarina of Time * Check Tracker - Fixes #16 for Shooting the Sun * Check Tracker - Fixes #19 for Darunia's Joy * Save Editor - Adds missing label for Treasure Chest Game * Check Tracker - Fixes Great Faries checks * Check Tracker - Fixes Sheik at Temple * Check Tracker - Fixes Great Fairy auto-scroll to wrong location * Check Tracker - Updates blue warp checks - Fixes Bongo Bongo and Twinrova checks * Check Tracker - Fixes Dampe's Gravedigging Tour * Check Tracker - Fixes Prescription to King Zora * Check Tracker - Fixes Bazaar showing under wrong area on tracker between adult/child * Check Tracker - Fixes scroll for Hyrule Market and Bazaar * Check Tracker - Fixes giving Adult Trade Items shown on tracker: Broken Sword, Saw, Cojiro, Eyeball Froge, and Eyedrops * Cleans up item_location * Check Tracker - Item List - Fixes item list not updating when changing seeds/options - Separates item exclusion list from item check list - Clean up comments * Check Tracker - Adds Skip functionality to buttons * Check Tracker - Refactors adult trade items to RandomizerInf * Check Tracker - Fixes an issue where any time an item is removed the tracker would cause an application crash * Check Tracker - Item names are now dependent on file language * Check Tracker - Fixes Gerudo Card check not showing in Fast setting * Reorders headers to (hopefully) avoid CI build conflicts on linux/consoles * Explicitly defines vector header in randomizer.h to fix compile errors * Complete Refactor of Check Tracker ImGui * Adds missing check tracker files to CMakeLists * Reverts the Item_location whitespace cleanup from ad10807c * Check Tracker - Loading Fixes - Fixes a bug where loading a save file a second time would add all the checks again - Fixes a bug where the check tracker would not render at all until in a save file * Check Tracker - Fixes a bug where checks would sometimes fail to load * Check Tracker - Fixes duplicated checks when using Only on Pause or Only on Combo * Check Tracker - Works around issue where single characters don't show in EnhancementCombobox, and fixes a label for combo buttons held option * Check Tracker - Applies all Check Tracker changes to Item Location * Check Tracker - Updated Check List - Adds Link's pocket, either in KF or HM depending on starting age - Supports Scrubs and Merchants - Uses enums instead of magic numbers - Updates DC Scrub Short Names for MQ * Check Tracker - Adds a performance mode option * Check Tracker - List Fixes (requires new rando generation) - Fixes Frogs Rupees always visible - Fixes Kokiri Sword Chest not showing - Fixes Weird Egg not showing * Check Tracker - MQ List basic support * Check Tracker - MQ/Vanilla anti-spoilers * Check Tracker - Collecting a compass now spoils the area * Check Tracker - Basic Vanilla Support and fixes - Vanilla items show in check tracker, even if many won't auto check - Fixes an issue with Gerudo Fortress Keys - Refactors IsVisibleInCheckTracker to randomizer_check_tracjer * Check Tracker - Fixes merge conflict from 08a487f35e1d760ab9e69b932edbe4da6bcd9edb * Check Tracker - Fixes tracker loading as Floating when default value is set to Windowed * Randomizer Location Exclusion List - Adds Scrubs, Merchants, Shops. Adult Trade items, MQ Dungeons, and Bean Salesman - Fixes Kokiri Sword Chest, Weird Egg, and Frog Song Rupees from misbehaving - Updates Gerudo Fortress logic to be dependent on Open/Fast/Normal Fortress - Removes Invalid Check - Adds RO Enum for MQ settings - Updates magic values to RO enum * Location Exclusion List - Scrubs that are always randomized now always show on the list * For now, removes some extra code only needed for a Check Tracker. * Randomizer Location Exclusion List - Fixes Eyeball Frog from showing up when Adult Trade Items was off * Location Tracker - Updates Eyedrops to use RandomizerInf instead of Chest * Check Tracker - Fixes a bug where Link's Pocket item wasn't acting as checked for area item count * Check Tracker - Fixes a bug where Locations would incorrectly say Vanilla due to the first check in the area being a non-MQ check * Check Tracker - Fixes a crash when Check Tracker is docked but not visible * Check Tracker - Fixes areas being spoiled when loading different save files * Check Tracker - Only reset variables if they are initialized * Check Tracker - Cleans up old comments, unused variables, methods, and macros, adds language TODOs, * Check Tracker - Readds rainbow UI elements after Cosmetics Editor refactor * Check Tracker - Removal of flag lookup that was refactored, no longer needed header, and some trivial whitespace fixes. * Check Tracker - Refactors Index to Bitmask code to a macro * Check Tracker - Changes ordering from alphabetical to RandomizerCheck ordering * Check Tracker - Wraps everything in a namespace to avoid global variable usage * Check Tracker - Explicitly defines for-loop scope * Check Tracker - refactors dungeon lookup from static array to function * Fixes a bug when using EnhancementColor with alpha * Check Tracker - Refactors all colour to use direct conversions * Check Tracker - refactors settings loading and check visibility for readability * Check Tracker - Fixes a bug where the wrong label showed on the Check Tracker BG Color * UIWidgets - Adds Alpha bar to EnhancementColor when using alpha parameter
2022-12-10 22:39:23 -05:00
}
}
UIWidgets::EnhancementCheckbox("Vanilla/MQ Dungeon Spoilers", "gCheckTrackerOptionMQSpoilers");
Check Tracker Update (#2668) * Initial commit. What works so far: Data file loads, saves, deletes, and is created properly. - Need to run `HasItemBeenCollected` when creating in case of mid-seed regen. Organized checks into maps set by area. Areas show in tracker. - Checks pulled from checkObjectsByArea are not currently listed. - Areas are being assumed completed and hidden at the start. * Checks now populate. Still not counting area totals properly. * Don't track RC_LINKS_POCKET in the data file, and instead manually add it in every time a save is load. rcObjects doesn't contain Link's Pocket location (duh). * Moved ItemReceive hook to randomizer_check_tracker.cpp. Skipped items are properly sorted and formatted. Saved items contribute to an area's gotten/skipped checks on load. Changed skipped items default main color to gray. General code cleanup. * Skipped checks now contribute to area totals for area completion logic. * Mid-menu rework transfer. * Started check lookup on item receive. Tried to enable scum checking on save. * Fixed scum check on save. * More code cleanup, which revealed some issues with loading and saving. Loading now works 100%, but entries in checkTrackerData are disappearing in code somewhere, causing issues with later checks. Scummed color now displays properly. Collected but unsaved displays properly. Unchecked, Skipped, Seen and Scummed checks all have arrows for skipping/unskipping. Counts a little messed up, probably double adding skips. * Fixed item counts being off across resets. Restarts were fine. * Beginning of rework for individual check updates. Adds `Actor lastCheck` to PlayState to allow assigning of last actor to give an item. This allows precise tracking of GS, freestanding PoH, etc. Works for chests too. Currently does not work for shops, unknown for normal NPC gives. Doesn't track last gives for non-checks, like drops from grass, pots, crates, etc. * Actor-based checks fully fleshed out, but can't help with sale-based checks. Implemented `pendingSaleCheck` to back out of an RC check cycle if `gSaveContext->pendingSale` is not NONE when `OnItemReceive` is called, processed through `OnSaleEnd`. This should be the final change necessary to streamline the checks. * Temporary hook to message box close to tie in trackers for non-gs/chest actors that aren't added to `GetCheckFromActor`. This triggers a 2-frame countdown to check with `HasItemBeenCollected` since half of the methods in there aren't updated until after a text box closes. Added scene tracking to get last scene so that checks in scenes that span several overworld areas could be tied to their areas properly. Modified tracker data creation to apply Link's Pocket and Song from Impa conditionally based on randomizer settings instead of just being assumed to be done. May need modification for checking click and drag spoiler loading. Removed the scene equivalence check from CheckChecks so that an entire area is checked each time to avoid issues with, e.g., leaving a shop before a pending sale finishes. * Changed check data creation to use RSKs from gRandomizer to account for settings loaded from drag and drop spoilers. * Beginning of tracker code organization. Changed check color defaults. * Reverted moving tracker colors to header. Some individual check fixes. * Missed something from previous merge? * Removed last remnant of removed performance mode. * Better handle checking when skullsanity is off. * Song checks sceneIDs don't match the scenes they're actually in for some reason. Removed that check. * SaleEnd checks don't need the GetItemEntry parameter. Also set a flag that should prevent the check tracker from running during vanilla saves should that not be resolved by the time it's merged. * Attempting to have only the relevant checks added to the tracker data, as well as showing vanilla checks for non-rando saves. Not working yet (everything is displayed in vanilla). * Added vanilla check tracker population via `vanillaCheck` bool in `RandomizerCheckObject`. This is also added to `IsVisibleInImGui` to handle file loading and saving to eliminate checks that aren't part of vanilla or the rando seed. Implemented deleted tracker data file recreation. Added some extra item name text checks. Songs are still... tricky, so they stay blank. Utilize local copies of the randomizer check objects that are applicable for performance purposes. Fixed vanilla item-giving cutscene crashes when triggered mid-transition. * Apparently not all toolchains can handle macro instantiation without all parameters, like VS can. * Fixed scummed detail color not showing properly on tracker. * Fixed dungeon area totals and GS checks not functioning properly. * Major revamp of checking code. Doesn't rely on `GetCheckFromActor` at all anymore, but instead simply sets a flag to evaluate a number of checks in an area every frame until the check that was gotten is identified. With the new setup, it's much less hardware intensive, and at 60fps 6 checks per frame shows no noticeable effect on framerate. I can envision needing to add a collectedCount in order to account for times when two checks are gotten one right after the other. Changed area scroll to happen from `OnTransitionEnd`, and allow for scrolling in bazaar (was disabled previously because it would jump back and forth between Kak and Market while you were in one). Also setup area check order updating by area instead of all at the same time. * Fixed shooting gallery not reporting proper area. Prevent checks from actually happening if area is RCAREA_INVALID, now that all areas are reporting something if they have checks. Fixed `GetCheckArea()` not updating checks for standard scenes. Lots of vanilla tracking updates, mainly manual checks for gems, medallions and songs, since the often don't have proper scenes in the data. Prevent vanilla from triggering check loops if junk items are collected. Fixed sorting based on saved vs collected. Prevent item name display for vanilla runs. Change coloring of checks so the check name reflects status in vanilla runs. * Fixed "Recheck Area" button erroneously adding to an area's check totals? * Fix DMC vanilla checks. * Fix check tracker data recreation on data file loss. Removed redundant file exists check from SaveTrackerDataHook, as it doesn't matter if it exists or not at that point. Limited check loops to 3 to avoid infinite check loops on non-check/junk item pickup. Added more checks to disable tracker operations if a save is not running. Changed check ordering to put boss reward and heart container checks at the end of whatever RCSHOW group they belong to. * Fixed IsRunning calculation. Further improving vanilla checking. Starting framework for checking medallions, stones, and songs on data file recreation. Fixed medallion check collection. Added GIFT_FROM_SAGES to check list for vanilla file for tracking light medallion. Added check loop limitation to prevent infinite checking after picking up junk item from the ground. * Finished vanilla file recreation and recheck (songs and dungeon rewards all check properly now). This includes deku shield with KF shop item 3. Finished Gift from Raoru light medallion tracking for vanilla. Commented all CheckByScene functionality for now. * Fixed new save data file creation. Disabled entrance area calculation for now, as it only tracks the previous entrance for some reason. Fixed area detection for ToT checks. * GetCheckArea() now utilizes EntranceData almost exclusively, via either `gSaveContext.entranceIndex` or the entrance tracker's `currentGrottoId` in the case of grottos. This also means that EVERYTHING CAN AUTOSCROLL NOW. Entrance shuffles are now much easier to track. Autoscroll is now also triggered on save, just in case someone isn't autosaving and has a lot of checks that get converted to saved. * Fixed missing GS check in LW. * Added area scroll on toggling Show Hidden Items. May configure differently later. Fixed area detection for entrances in Gerudo Fortress/Valley and Collossus. Haunted wasteland doesn't autoscroll due to a bug in `OnTransitionEnd` hook, but checks still evaluate properly there. Rely on scene-based area detection if scene is a main overworld or dungeon scene. * Fixed grotto detection when shuffle is off. * Small code cleanup. Fixed Colossus hand chest checks. * Missing lus bump from merge conflict resolution * Fixed Colossus Grotto making `GetCheckArea` return Wasteland. * Improved OnItemReceive processing for non-token GS checks, since they can sometimes take long enough for the checking process to time out before the item is registered as received. * First attempt at thread safety for tracker data file writing. Seems to work, but might need more testing. * Fixed Recheck Area not unskipping items that register as saved. Improved delayed saving with autosaving, as the autosave triggered quite often before the tracker data save, making things not properly register as saved. * merge cleanup * Converted check tracker data to the sectional saves, adding `CheckTrackerData` to `SaveContext`. Implemented section ID returning and fullSave boolean passing to section functions from my PR temporarily for it to work properly. Moved `RandomizerCheckTrackerData` enum to `randomizerTypes.h` to accommodate that. Changed `Randomizer_SaveInit` to a `SaveManager::InitFunc` to allow for other randomizer-dependent sections to be initialized after that. Required a little refactoring to maintain intro cutscene skip when starting a randomizer file. * Revert section index return and randomizer init changes. Will need to wait on yet more changes to main. * Fixed check tracker initialization (shouldn't be tied to window initialization), restored saving/loading functionality. * Removed `CheckTracker::Init` and put SaveManager calls in `CheckTrackerWindow::InitElement`. Also a bit of cleanup from transition back to save file use. * Fixed tracker displaying check categories while file not loaded. * Fix Darunia's Joy check not marking in vanilla. * Fix autosave not triggering change from collected to saved in tracker data. * Changed default colors for scummed and collected display. * Merge upgrade code cleanup. * Add `OnTransitionEnd` calls to sandstorm transitions both to and from Wasteland. Also improved `gSaveContext.lastScene` assignment for both transition types. Allowed a bit of cleanup in `GetCheckArea`. * Added `StateButton`, a button like `ArrowButton` but that allows text instead of arrow icons. Apparently the changes from ArrowButton to StateButton happened in a previous commit... * Changed section name to `trackerDataCheck` to force SoH to load it after the randomizer section, as it required some randoSettings to be loaded first, and nothing else I tried to make the randomizer section load before it worked. This hacks a solution to checks not displaying on fast file load to a specific slot. F*** you, SaveManager, and f*** you too, JSON. * Forgot to change the section string for loading with the name change. * Fix check ordering for checks that trigger the autosave. * Adds option to remove right-side shop items (slots 1-4) from the tracker list. Enabled by default. * Fix default state of Hide Shop Right Checks checkbox. * Fixes grotto and great fairy scrolling and checks. Fixes array overflow from `checkTrackerData` which was creating the issue trying to load the base and randomizer sections first, among other things. That also fixed the massive file loads that were being exhibited in debug mode. * Fix shooting galleries being set as collected again when being played a second time after getting the checks. * Fix Bazaar autoscroll. * Add Saria's Song to `GetCheckFromActor` and removed some limitations from the messageCloseCheck function to make that check track properly. * Fix Song from Impa check. Implemented prevention for multiple "collections" of great fairies, just in case getting the health refill would trigger it with the previous setup. * Fix ice traps on GS tokens not triggering OnItemReceive. * Complete fix for ice trap collection from GS. Add autoscroll when clicking "Expand All". * Add `OnShopSlotChange` with cursorSlot and basePrice parameters. * Fixed include in en_ossan for shop slot hook. Added registration for `OnShopSlotChange` in the tracker, storing the price in a new `price` field in `CheckTrackerData`. Added "seen" functionality to shop checks. Displays the model item name upon first entering a shop, adding the price and switching to trickName (if it's an ice trap) upon navigating to the slot in buy mode, triggered by an invisible "identified" status that mirrors "seen" in every other way. Added tooltips to most options for check tracker color picking to describe what each status actually means. * `std::format` pls * So apparently std::format just decided to break with the latest merge from develop, but fmt::format exists and works? * Removed the last vestiges of `locationsSkipped`. Other general code and formatting cleanups. Moved `IsGameRunning` to `OTRGlobals` so the item tracker could also access it. Used preceding to "fix" item and bottle display in the item tracker on startup. * Some more code cleanup. Removed "Recheck Area" button and relevant code. Backported changes to Anchor branch applicable for single-player, including making a checkAreas vector and structuring the frame by frame checks around that. Also includes fix for Silver Gauntlets and Mirror Shield check collection crash associated with those changes. Fixed Kakariko Bazaar "seen" updates. Fixed tracker window not showing on initial load like it should. * Forgot 1 formatting fix. * Removed conditions for showing Song from Impa (isn't junk under certain conditions, so should show all the time). * Fix vanilla checks, add Zelda's Letter and Malon's Egg to manual check collection. Fix autoscroll while in child stealth section. * Fix crash in Happy Mask Shop in OnSlotChange (referenced non-existent shop id in a tracker-specific enum). * General code cleanup. * Missed one reversion. * One more. * Fix column alignment in `randomizer_check_objects`. * Fix file encoding on `randomizer_check_tracker`. Again. * Fix indentation for `actualItemtrackerItemMap`. Also removed unnecessary parts of the map. * Rename `HasEqItem` to `HasEquipment`. * Slightly better indentation for `actualItemTrackerItemMap`. * Add magic bean salesman to vanilla check tracking, and genericized deku shield to trigger KF shop item 3 wherever you get the shield. Renamed `vanillaCheck` to `vanillaHundoCheck` to (supposedly) clarify the meaning of the usage. * One more rename to `vanillaCompletion` to avoid possible confusion with 100% speedrun conditions. * give me a break XD Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * Changes suggested by briaguya (rename `RandomizerCheckShow` to `Status`, unused code, newline formatting) * Remove unused `itemNames` table. * Remove `IsGameRunning` in favor of `GameInteractor::IsSaveLoaded`. * Restore anti-spoiler functionality for dungeons with dungeon maps. * Review cleanup. * Fix prices not showing for Kak bazaar items. --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com>
2023-10-04 11:03:36 -04:00
UIWidgets::Tooltip("If enabled, Vanilla/MQ dungeons will show on the tracker immediately. Otherwise, Vanilla/MQ dungeon locations must be unlocked.");
if (UIWidgets::EnhancementCheckbox("Hide right-side shop item checks", "gCheckTrackerOptionHideRightShopChecks", false, "", UIWidgets::CheckboxGraphics::Cross, true)) {
hideShopRightChecks = !hideShopRightChecks;
RecalculateAreaTotals();
}
UIWidgets::Tooltip("If enabled, will prevent the tracker from displaying slots 1-4 in all shops.");
if (UIWidgets::EnhancementCheckbox("Always show gold skulltulas", "gCheckTrackerOptionAlwaysShowGSLocs", false, "")) {
alwaysShowGS = !alwaysShowGS;
RecalculateAreaTotals();
}
UIWidgets::Tooltip("If enabled, will show GS locations in the tracker regardless of tokensanity settings.");
Randomizer Auto Location tracker (#1942) * Initial Auto-Location Tracking * Updates styling for checked items in Check Tracker * Fixes crashing issues with Check Tracker rendering * Auto scroll Check Tracker windows to current area * Checks Tracker only shows checked locations once in game * Fixes issue where Check Tracker would auto-scroll to wrong location when entering a grotto * Fixes gerudo fortress checks showing in tracker when settings have them removed * InfTable Check Location Fixes: Lost Dog Richard, Rolling Gorons, HBA 1000, Thawed Zora * Fixes most Event Chk Inf Checks on Check Tracker, and Frogs * Check Tracker - Song from Malon now works * Check Tracker - Fixes Claim Check check not tracking - Fixes spoiler for Claim Check check when getting Biggoron's Sword - Fixes LACS being spoiled and not tracking * Check Tracker - Fixes #2 for Skull Mask and Mask of Truth checks * Check Tracker - Adds support for merchants - Fixes #7 for Bomchu Salesman - Fixes #12 for Medigoron * Check Tracker - Fixes #8 for Song from Saria * Check Tracker - Fixes #9 for Adult Shooting Gallery * Check Tracker - Fixes #10 for Composer Grave * Check Tracker - Fixes #14 for Song from Ocarina of Time * Check Tracker - Fixes #16 for Shooting the Sun * Check Tracker - Fixes #19 for Darunia's Joy * Save Editor - Adds missing label for Treasure Chest Game * Check Tracker - Fixes Great Faries checks * Check Tracker - Fixes Sheik at Temple * Check Tracker - Fixes Great Fairy auto-scroll to wrong location * Check Tracker - Updates blue warp checks - Fixes Bongo Bongo and Twinrova checks * Check Tracker - Fixes Dampe's Gravedigging Tour * Check Tracker - Fixes Prescription to King Zora * Check Tracker - Fixes Bazaar showing under wrong area on tracker between adult/child * Check Tracker - Fixes scroll for Hyrule Market and Bazaar * Check Tracker - Fixes giving Adult Trade Items shown on tracker: Broken Sword, Saw, Cojiro, Eyeball Froge, and Eyedrops * Cleans up item_location * Check Tracker - Item List - Fixes item list not updating when changing seeds/options - Separates item exclusion list from item check list - Clean up comments * Check Tracker - Adds Skip functionality to buttons * Check Tracker - Refactors adult trade items to RandomizerInf * Check Tracker - Fixes an issue where any time an item is removed the tracker would cause an application crash * Check Tracker - Item names are now dependent on file language * Check Tracker - Fixes Gerudo Card check not showing in Fast setting * Reorders headers to (hopefully) avoid CI build conflicts on linux/consoles * Explicitly defines vector header in randomizer.h to fix compile errors * Complete Refactor of Check Tracker ImGui * Adds missing check tracker files to CMakeLists * Reverts the Item_location whitespace cleanup from ad10807c * Check Tracker - Loading Fixes - Fixes a bug where loading a save file a second time would add all the checks again - Fixes a bug where the check tracker would not render at all until in a save file * Check Tracker - Fixes a bug where checks would sometimes fail to load * Check Tracker - Fixes duplicated checks when using Only on Pause or Only on Combo * Check Tracker - Works around issue where single characters don't show in EnhancementCombobox, and fixes a label for combo buttons held option * Check Tracker - Applies all Check Tracker changes to Item Location * Check Tracker - Updated Check List - Adds Link's pocket, either in KF or HM depending on starting age - Supports Scrubs and Merchants - Uses enums instead of magic numbers - Updates DC Scrub Short Names for MQ * Check Tracker - Adds a performance mode option * Check Tracker - List Fixes (requires new rando generation) - Fixes Frogs Rupees always visible - Fixes Kokiri Sword Chest not showing - Fixes Weird Egg not showing * Check Tracker - MQ List basic support * Check Tracker - MQ/Vanilla anti-spoilers * Check Tracker - Collecting a compass now spoils the area * Check Tracker - Basic Vanilla Support and fixes - Vanilla items show in check tracker, even if many won't auto check - Fixes an issue with Gerudo Fortress Keys - Refactors IsVisibleInCheckTracker to randomizer_check_tracjer * Check Tracker - Fixes merge conflict from 08a487f35e1d760ab9e69b932edbe4da6bcd9edb * Check Tracker - Fixes tracker loading as Floating when default value is set to Windowed * Randomizer Location Exclusion List - Adds Scrubs, Merchants, Shops. Adult Trade items, MQ Dungeons, and Bean Salesman - Fixes Kokiri Sword Chest, Weird Egg, and Frog Song Rupees from misbehaving - Updates Gerudo Fortress logic to be dependent on Open/Fast/Normal Fortress - Removes Invalid Check - Adds RO Enum for MQ settings - Updates magic values to RO enum * Location Exclusion List - Scrubs that are always randomized now always show on the list * For now, removes some extra code only needed for a Check Tracker. * Randomizer Location Exclusion List - Fixes Eyeball Frog from showing up when Adult Trade Items was off * Location Tracker - Updates Eyedrops to use RandomizerInf instead of Chest * Check Tracker - Fixes a bug where Link's Pocket item wasn't acting as checked for area item count * Check Tracker - Fixes a bug where Locations would incorrectly say Vanilla due to the first check in the area being a non-MQ check * Check Tracker - Fixes a crash when Check Tracker is docked but not visible * Check Tracker - Fixes areas being spoiled when loading different save files * Check Tracker - Only reset variables if they are initialized * Check Tracker - Cleans up old comments, unused variables, methods, and macros, adds language TODOs, * Check Tracker - Readds rainbow UI elements after Cosmetics Editor refactor * Check Tracker - Removal of flag lookup that was refactored, no longer needed header, and some trivial whitespace fixes. * Check Tracker - Refactors Index to Bitmask code to a macro * Check Tracker - Changes ordering from alphabetical to RandomizerCheck ordering * Check Tracker - Wraps everything in a namespace to avoid global variable usage * Check Tracker - Explicitly defines for-loop scope * Check Tracker - refactors dungeon lookup from static array to function * Fixes a bug when using EnhancementColor with alpha * Check Tracker - Refactors all colour to use direct conversions * Check Tracker - refactors settings loading and check visibility for readability * Check Tracker - Fixes a bug where the wrong label showed on the Check Tracker BG Color * UIWidgets - Adds Alpha bar to EnhancementColor when using alpha parameter
2022-12-10 22:39:23 -05:00
ImGui::TableNextColumn();
Check Tracker Update (#2668) * Initial commit. What works so far: Data file loads, saves, deletes, and is created properly. - Need to run `HasItemBeenCollected` when creating in case of mid-seed regen. Organized checks into maps set by area. Areas show in tracker. - Checks pulled from checkObjectsByArea are not currently listed. - Areas are being assumed completed and hidden at the start. * Checks now populate. Still not counting area totals properly. * Don't track RC_LINKS_POCKET in the data file, and instead manually add it in every time a save is load. rcObjects doesn't contain Link's Pocket location (duh). * Moved ItemReceive hook to randomizer_check_tracker.cpp. Skipped items are properly sorted and formatted. Saved items contribute to an area's gotten/skipped checks on load. Changed skipped items default main color to gray. General code cleanup. * Skipped checks now contribute to area totals for area completion logic. * Mid-menu rework transfer. * Started check lookup on item receive. Tried to enable scum checking on save. * Fixed scum check on save. * More code cleanup, which revealed some issues with loading and saving. Loading now works 100%, but entries in checkTrackerData are disappearing in code somewhere, causing issues with later checks. Scummed color now displays properly. Collected but unsaved displays properly. Unchecked, Skipped, Seen and Scummed checks all have arrows for skipping/unskipping. Counts a little messed up, probably double adding skips. * Fixed item counts being off across resets. Restarts were fine. * Beginning of rework for individual check updates. Adds `Actor lastCheck` to PlayState to allow assigning of last actor to give an item. This allows precise tracking of GS, freestanding PoH, etc. Works for chests too. Currently does not work for shops, unknown for normal NPC gives. Doesn't track last gives for non-checks, like drops from grass, pots, crates, etc. * Actor-based checks fully fleshed out, but can't help with sale-based checks. Implemented `pendingSaleCheck` to back out of an RC check cycle if `gSaveContext->pendingSale` is not NONE when `OnItemReceive` is called, processed through `OnSaleEnd`. This should be the final change necessary to streamline the checks. * Temporary hook to message box close to tie in trackers for non-gs/chest actors that aren't added to `GetCheckFromActor`. This triggers a 2-frame countdown to check with `HasItemBeenCollected` since half of the methods in there aren't updated until after a text box closes. Added scene tracking to get last scene so that checks in scenes that span several overworld areas could be tied to their areas properly. Modified tracker data creation to apply Link's Pocket and Song from Impa conditionally based on randomizer settings instead of just being assumed to be done. May need modification for checking click and drag spoiler loading. Removed the scene equivalence check from CheckChecks so that an entire area is checked each time to avoid issues with, e.g., leaving a shop before a pending sale finishes. * Changed check data creation to use RSKs from gRandomizer to account for settings loaded from drag and drop spoilers. * Beginning of tracker code organization. Changed check color defaults. * Reverted moving tracker colors to header. Some individual check fixes. * Missed something from previous merge? * Removed last remnant of removed performance mode. * Better handle checking when skullsanity is off. * Song checks sceneIDs don't match the scenes they're actually in for some reason. Removed that check. * SaleEnd checks don't need the GetItemEntry parameter. Also set a flag that should prevent the check tracker from running during vanilla saves should that not be resolved by the time it's merged. * Attempting to have only the relevant checks added to the tracker data, as well as showing vanilla checks for non-rando saves. Not working yet (everything is displayed in vanilla). * Added vanilla check tracker population via `vanillaCheck` bool in `RandomizerCheckObject`. This is also added to `IsVisibleInImGui` to handle file loading and saving to eliminate checks that aren't part of vanilla or the rando seed. Implemented deleted tracker data file recreation. Added some extra item name text checks. Songs are still... tricky, so they stay blank. Utilize local copies of the randomizer check objects that are applicable for performance purposes. Fixed vanilla item-giving cutscene crashes when triggered mid-transition. * Apparently not all toolchains can handle macro instantiation without all parameters, like VS can. * Fixed scummed detail color not showing properly on tracker. * Fixed dungeon area totals and GS checks not functioning properly. * Major revamp of checking code. Doesn't rely on `GetCheckFromActor` at all anymore, but instead simply sets a flag to evaluate a number of checks in an area every frame until the check that was gotten is identified. With the new setup, it's much less hardware intensive, and at 60fps 6 checks per frame shows no noticeable effect on framerate. I can envision needing to add a collectedCount in order to account for times when two checks are gotten one right after the other. Changed area scroll to happen from `OnTransitionEnd`, and allow for scrolling in bazaar (was disabled previously because it would jump back and forth between Kak and Market while you were in one). Also setup area check order updating by area instead of all at the same time. * Fixed shooting gallery not reporting proper area. Prevent checks from actually happening if area is RCAREA_INVALID, now that all areas are reporting something if they have checks. Fixed `GetCheckArea()` not updating checks for standard scenes. Lots of vanilla tracking updates, mainly manual checks for gems, medallions and songs, since the often don't have proper scenes in the data. Prevent vanilla from triggering check loops if junk items are collected. Fixed sorting based on saved vs collected. Prevent item name display for vanilla runs. Change coloring of checks so the check name reflects status in vanilla runs. * Fixed "Recheck Area" button erroneously adding to an area's check totals? * Fix DMC vanilla checks. * Fix check tracker data recreation on data file loss. Removed redundant file exists check from SaveTrackerDataHook, as it doesn't matter if it exists or not at that point. Limited check loops to 3 to avoid infinite check loops on non-check/junk item pickup. Added more checks to disable tracker operations if a save is not running. Changed check ordering to put boss reward and heart container checks at the end of whatever RCSHOW group they belong to. * Fixed IsRunning calculation. Further improving vanilla checking. Starting framework for checking medallions, stones, and songs on data file recreation. Fixed medallion check collection. Added GIFT_FROM_SAGES to check list for vanilla file for tracking light medallion. Added check loop limitation to prevent infinite checking after picking up junk item from the ground. * Finished vanilla file recreation and recheck (songs and dungeon rewards all check properly now). This includes deku shield with KF shop item 3. Finished Gift from Raoru light medallion tracking for vanilla. Commented all CheckByScene functionality for now. * Fixed new save data file creation. Disabled entrance area calculation for now, as it only tracks the previous entrance for some reason. Fixed area detection for ToT checks. * GetCheckArea() now utilizes EntranceData almost exclusively, via either `gSaveContext.entranceIndex` or the entrance tracker's `currentGrottoId` in the case of grottos. This also means that EVERYTHING CAN AUTOSCROLL NOW. Entrance shuffles are now much easier to track. Autoscroll is now also triggered on save, just in case someone isn't autosaving and has a lot of checks that get converted to saved. * Fixed missing GS check in LW. * Added area scroll on toggling Show Hidden Items. May configure differently later. Fixed area detection for entrances in Gerudo Fortress/Valley and Collossus. Haunted wasteland doesn't autoscroll due to a bug in `OnTransitionEnd` hook, but checks still evaluate properly there. Rely on scene-based area detection if scene is a main overworld or dungeon scene. * Fixed grotto detection when shuffle is off. * Small code cleanup. Fixed Colossus hand chest checks. * Missing lus bump from merge conflict resolution * Fixed Colossus Grotto making `GetCheckArea` return Wasteland. * Improved OnItemReceive processing for non-token GS checks, since they can sometimes take long enough for the checking process to time out before the item is registered as received. * First attempt at thread safety for tracker data file writing. Seems to work, but might need more testing. * Fixed Recheck Area not unskipping items that register as saved. Improved delayed saving with autosaving, as the autosave triggered quite often before the tracker data save, making things not properly register as saved. * merge cleanup * Converted check tracker data to the sectional saves, adding `CheckTrackerData` to `SaveContext`. Implemented section ID returning and fullSave boolean passing to section functions from my PR temporarily for it to work properly. Moved `RandomizerCheckTrackerData` enum to `randomizerTypes.h` to accommodate that. Changed `Randomizer_SaveInit` to a `SaveManager::InitFunc` to allow for other randomizer-dependent sections to be initialized after that. Required a little refactoring to maintain intro cutscene skip when starting a randomizer file. * Revert section index return and randomizer init changes. Will need to wait on yet more changes to main. * Fixed check tracker initialization (shouldn't be tied to window initialization), restored saving/loading functionality. * Removed `CheckTracker::Init` and put SaveManager calls in `CheckTrackerWindow::InitElement`. Also a bit of cleanup from transition back to save file use. * Fixed tracker displaying check categories while file not loaded. * Fix Darunia's Joy check not marking in vanilla. * Fix autosave not triggering change from collected to saved in tracker data. * Changed default colors for scummed and collected display. * Merge upgrade code cleanup. * Add `OnTransitionEnd` calls to sandstorm transitions both to and from Wasteland. Also improved `gSaveContext.lastScene` assignment for both transition types. Allowed a bit of cleanup in `GetCheckArea`. * Added `StateButton`, a button like `ArrowButton` but that allows text instead of arrow icons. Apparently the changes from ArrowButton to StateButton happened in a previous commit... * Changed section name to `trackerDataCheck` to force SoH to load it after the randomizer section, as it required some randoSettings to be loaded first, and nothing else I tried to make the randomizer section load before it worked. This hacks a solution to checks not displaying on fast file load to a specific slot. F*** you, SaveManager, and f*** you too, JSON. * Forgot to change the section string for loading with the name change. * Fix check ordering for checks that trigger the autosave. * Adds option to remove right-side shop items (slots 1-4) from the tracker list. Enabled by default. * Fix default state of Hide Shop Right Checks checkbox. * Fixes grotto and great fairy scrolling and checks. Fixes array overflow from `checkTrackerData` which was creating the issue trying to load the base and randomizer sections first, among other things. That also fixed the massive file loads that were being exhibited in debug mode. * Fix shooting galleries being set as collected again when being played a second time after getting the checks. * Fix Bazaar autoscroll. * Add Saria's Song to `GetCheckFromActor` and removed some limitations from the messageCloseCheck function to make that check track properly. * Fix Song from Impa check. Implemented prevention for multiple "collections" of great fairies, just in case getting the health refill would trigger it with the previous setup. * Fix ice traps on GS tokens not triggering OnItemReceive. * Complete fix for ice trap collection from GS. Add autoscroll when clicking "Expand All". * Add `OnShopSlotChange` with cursorSlot and basePrice parameters. * Fixed include in en_ossan for shop slot hook. Added registration for `OnShopSlotChange` in the tracker, storing the price in a new `price` field in `CheckTrackerData`. Added "seen" functionality to shop checks. Displays the model item name upon first entering a shop, adding the price and switching to trickName (if it's an ice trap) upon navigating to the slot in buy mode, triggered by an invisible "identified" status that mirrors "seen" in every other way. Added tooltips to most options for check tracker color picking to describe what each status actually means. * `std::format` pls * So apparently std::format just decided to break with the latest merge from develop, but fmt::format exists and works? * Removed the last vestiges of `locationsSkipped`. Other general code and formatting cleanups. Moved `IsGameRunning` to `OTRGlobals` so the item tracker could also access it. Used preceding to "fix" item and bottle display in the item tracker on startup. * Some more code cleanup. Removed "Recheck Area" button and relevant code. Backported changes to Anchor branch applicable for single-player, including making a checkAreas vector and structuring the frame by frame checks around that. Also includes fix for Silver Gauntlets and Mirror Shield check collection crash associated with those changes. Fixed Kakariko Bazaar "seen" updates. Fixed tracker window not showing on initial load like it should. * Forgot 1 formatting fix. * Removed conditions for showing Song from Impa (isn't junk under certain conditions, so should show all the time). * Fix vanilla checks, add Zelda's Letter and Malon's Egg to manual check collection. Fix autoscroll while in child stealth section. * Fix crash in Happy Mask Shop in OnSlotChange (referenced non-existent shop id in a tracker-specific enum). * General code cleanup. * Missed one reversion. * One more. * Fix column alignment in `randomizer_check_objects`. * Fix file encoding on `randomizer_check_tracker`. Again. * Fix indentation for `actualItemtrackerItemMap`. Also removed unnecessary parts of the map. * Rename `HasEqItem` to `HasEquipment`. * Slightly better indentation for `actualItemTrackerItemMap`. * Add magic bean salesman to vanilla check tracking, and genericized deku shield to trigger KF shop item 3 wherever you get the shield. Renamed `vanillaCheck` to `vanillaHundoCheck` to (supposedly) clarify the meaning of the usage. * One more rename to `vanillaCompletion` to avoid possible confusion with 100% speedrun conditions. * give me a break XD Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * Changes suggested by briaguya (rename `RandomizerCheckShow` to `Status`, unused code, newline formatting) * Remove unused `itemNames` table. * Remove `IsGameRunning` in favor of `GameInteractor::IsSaveLoaded`. * Restore anti-spoiler functionality for dungeons with dungeon maps. * Review cleanup. * Fix prices not showing for Kak bazaar items. --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com>
2023-10-04 11:03:36 -04:00
CheckTracker::ImGuiDrawTwoColorPickerSection("Area Incomplete", "gCheckTrackerAreaMainIncompleteColor", "gCheckTrackerAreaExtraIncompleteColor", Color_Area_Incomplete_Main, Color_Area_Incomplete_Extra, Color_Main_Default, Color_Area_Incomplete_Extra_Default, "gCheckTrackerAreaIncompleteHide", "");
CheckTracker::ImGuiDrawTwoColorPickerSection("Area Complete", "gCheckTrackerAreaMainCompleteColor", "gCheckTrackerAreaExtraCompleteColor", Color_Area_Complete_Main, Color_Area_Complete_Extra, Color_Main_Default, Color_Area_Complete_Extra_Default, "gCheckTrackerAreaCompleteHide", "");
CheckTracker::ImGuiDrawTwoColorPickerSection("Unchecked", "gCheckTrackerUncheckedMainColor", "gCheckTrackerUncheckedExtraColor", Color_Unchecked_Main, Color_Unchecked_Extra, Color_Main_Default, Color_Unchecked_Extra_Default, "gCheckTrackerUncheckedHide", "Checks you have not interacted with at all.");
CheckTracker::ImGuiDrawTwoColorPickerSection("Skipped", "gCheckTrackerSkippedMainColor", "gCheckTrackerSkippedExtraColor", Color_Skipped_Main, Color_Skipped_Extra, Color_Main_Default, Color_Skipped_Extra_Default, "gCheckTrackerSkippedHide", "");
CheckTracker::ImGuiDrawTwoColorPickerSection("Seen", "gCheckTrackerSeenMainColor", "gCheckTrackerSeenExtraColor", Color_Seen_Main, Color_Seen_Extra, Color_Main_Default, Color_Seen_Extra_Default, "gCheckTrackerSeenHide", "Used for shops. Shows item names for shop slots when walking in, and prices when highlighting them in buy mode.");
CheckTracker::ImGuiDrawTwoColorPickerSection("Scummed", "gCheckTrackerScummedMainColor", "gCheckTrackerScummedExtraColor", Color_Scummed_Main, Color_Scummed_Extra, Color_Main_Default, Color_Scummed_Extra_Default, "gCheckTrackerScummedHide", "Checks you collect, but then reload before saving so you no longer have them.");
//CheckTracker::ImGuiDrawTwoColorPickerSection("Hinted (WIP)", "gCheckTrackerHintedMainColor", "gCheckTrackerHintedExtraColor", Color_Hinted_Main, Color_Hinted_Extra, Color_Main_Default, Color_Hinted_Extra_Default, "gCheckTrackerHintedHide", "");
CheckTracker::ImGuiDrawTwoColorPickerSection("Collected", "gCheckTrackerCollectedMainColor", "gCheckTrackerCollectedExtraColor", Color_Collected_Main, Color_Collected_Extra, Color_Main_Default, Color_Collected_Extra_Default, "gCheckTrackerCollectedHide", "Checks you have collected without saving or reloading yet.");
CheckTracker::ImGuiDrawTwoColorPickerSection("Saved", "gCheckTrackerSavedMainColor", "gCheckTrackerSavedExtraColor", Color_Saved_Main, Color_Saved_Extra, Color_Main_Default, Color_Saved_Extra_Default, "gCheckTrackerSavedHide", "Checks that you saved the game while having collected.");
Randomizer Auto Location tracker (#1942) * Initial Auto-Location Tracking * Updates styling for checked items in Check Tracker * Fixes crashing issues with Check Tracker rendering * Auto scroll Check Tracker windows to current area * Checks Tracker only shows checked locations once in game * Fixes issue where Check Tracker would auto-scroll to wrong location when entering a grotto * Fixes gerudo fortress checks showing in tracker when settings have them removed * InfTable Check Location Fixes: Lost Dog Richard, Rolling Gorons, HBA 1000, Thawed Zora * Fixes most Event Chk Inf Checks on Check Tracker, and Frogs * Check Tracker - Song from Malon now works * Check Tracker - Fixes Claim Check check not tracking - Fixes spoiler for Claim Check check when getting Biggoron's Sword - Fixes LACS being spoiled and not tracking * Check Tracker - Fixes #2 for Skull Mask and Mask of Truth checks * Check Tracker - Adds support for merchants - Fixes #7 for Bomchu Salesman - Fixes #12 for Medigoron * Check Tracker - Fixes #8 for Song from Saria * Check Tracker - Fixes #9 for Adult Shooting Gallery * Check Tracker - Fixes #10 for Composer Grave * Check Tracker - Fixes #14 for Song from Ocarina of Time * Check Tracker - Fixes #16 for Shooting the Sun * Check Tracker - Fixes #19 for Darunia's Joy * Save Editor - Adds missing label for Treasure Chest Game * Check Tracker - Fixes Great Faries checks * Check Tracker - Fixes Sheik at Temple * Check Tracker - Fixes Great Fairy auto-scroll to wrong location * Check Tracker - Updates blue warp checks - Fixes Bongo Bongo and Twinrova checks * Check Tracker - Fixes Dampe's Gravedigging Tour * Check Tracker - Fixes Prescription to King Zora * Check Tracker - Fixes Bazaar showing under wrong area on tracker between adult/child * Check Tracker - Fixes scroll for Hyrule Market and Bazaar * Check Tracker - Fixes giving Adult Trade Items shown on tracker: Broken Sword, Saw, Cojiro, Eyeball Froge, and Eyedrops * Cleans up item_location * Check Tracker - Item List - Fixes item list not updating when changing seeds/options - Separates item exclusion list from item check list - Clean up comments * Check Tracker - Adds Skip functionality to buttons * Check Tracker - Refactors adult trade items to RandomizerInf * Check Tracker - Fixes an issue where any time an item is removed the tracker would cause an application crash * Check Tracker - Item names are now dependent on file language * Check Tracker - Fixes Gerudo Card check not showing in Fast setting * Reorders headers to (hopefully) avoid CI build conflicts on linux/consoles * Explicitly defines vector header in randomizer.h to fix compile errors * Complete Refactor of Check Tracker ImGui * Adds missing check tracker files to CMakeLists * Reverts the Item_location whitespace cleanup from ad10807c * Check Tracker - Loading Fixes - Fixes a bug where loading a save file a second time would add all the checks again - Fixes a bug where the check tracker would not render at all until in a save file * Check Tracker - Fixes a bug where checks would sometimes fail to load * Check Tracker - Fixes duplicated checks when using Only on Pause or Only on Combo * Check Tracker - Works around issue where single characters don't show in EnhancementCombobox, and fixes a label for combo buttons held option * Check Tracker - Applies all Check Tracker changes to Item Location * Check Tracker - Updated Check List - Adds Link's pocket, either in KF or HM depending on starting age - Supports Scrubs and Merchants - Uses enums instead of magic numbers - Updates DC Scrub Short Names for MQ * Check Tracker - Adds a performance mode option * Check Tracker - List Fixes (requires new rando generation) - Fixes Frogs Rupees always visible - Fixes Kokiri Sword Chest not showing - Fixes Weird Egg not showing * Check Tracker - MQ List basic support * Check Tracker - MQ/Vanilla anti-spoilers * Check Tracker - Collecting a compass now spoils the area * Check Tracker - Basic Vanilla Support and fixes - Vanilla items show in check tracker, even if many won't auto check - Fixes an issue with Gerudo Fortress Keys - Refactors IsVisibleInCheckTracker to randomizer_check_tracjer * Check Tracker - Fixes merge conflict from 08a487f35e1d760ab9e69b932edbe4da6bcd9edb * Check Tracker - Fixes tracker loading as Floating when default value is set to Windowed * Randomizer Location Exclusion List - Adds Scrubs, Merchants, Shops. Adult Trade items, MQ Dungeons, and Bean Salesman - Fixes Kokiri Sword Chest, Weird Egg, and Frog Song Rupees from misbehaving - Updates Gerudo Fortress logic to be dependent on Open/Fast/Normal Fortress - Removes Invalid Check - Adds RO Enum for MQ settings - Updates magic values to RO enum * Location Exclusion List - Scrubs that are always randomized now always show on the list * For now, removes some extra code only needed for a Check Tracker. * Randomizer Location Exclusion List - Fixes Eyeball Frog from showing up when Adult Trade Items was off * Location Tracker - Updates Eyedrops to use RandomizerInf instead of Chest * Check Tracker - Fixes a bug where Link's Pocket item wasn't acting as checked for area item count * Check Tracker - Fixes a bug where Locations would incorrectly say Vanilla due to the first check in the area being a non-MQ check * Check Tracker - Fixes a crash when Check Tracker is docked but not visible * Check Tracker - Fixes areas being spoiled when loading different save files * Check Tracker - Only reset variables if they are initialized * Check Tracker - Cleans up old comments, unused variables, methods, and macros, adds language TODOs, * Check Tracker - Readds rainbow UI elements after Cosmetics Editor refactor * Check Tracker - Removal of flag lookup that was refactored, no longer needed header, and some trivial whitespace fixes. * Check Tracker - Refactors Index to Bitmask code to a macro * Check Tracker - Changes ordering from alphabetical to RandomizerCheck ordering * Check Tracker - Wraps everything in a namespace to avoid global variable usage * Check Tracker - Explicitly defines for-loop scope * Check Tracker - refactors dungeon lookup from static array to function * Fixes a bug when using EnhancementColor with alpha * Check Tracker - Refactors all colour to use direct conversions * Check Tracker - refactors settings loading and check visibility for readability * Check Tracker - Fixes a bug where the wrong label showed on the Check Tracker BG Color * UIWidgets - Adds Alpha bar to EnhancementColor when using alpha parameter
2022-12-10 22:39:23 -05:00
ImGui::PopStyleVar(1);
ImGui::EndTable();
ImGui::End();
}
build soh with LUS 1.0.0 (#2881) * Bump LUS * Ship -> LUS namespace change * z_scene_otr Ship -> LUS namespace * Starting to get SoH to build with LUS imgui changes. * start stuff * gamecontroleditor build issues resolved maybe * cosmetics editor and what not * console * actor viewer * more stuff * more stuff * on to errors that make sense * putting this down for a bit * no idea what these errors mean now * some kind of progress maybe * latest lus main * more * back to linker errors and being lost * Fixes command function signature. * More fixes * Even more fixes * Bump LUS * More Fixes. * Fixes even more errors. * lus bump * input editor as var * audio editor working * it builds with this * bump lus * it opens * bump lus to latest main again * make sure to do all the command registering in debugconsole * lus and what not * switch type stuff plz * undo * do the thing that fixes the thing * fix mac? * correctly show/hide menubar on boot * bump lus * input blocking updates * bump lus * Bump LUS * Press F1 to open enhancement menus moved to SoH * lus and rendering backend stuff * audio backend and lus * Bump LUS * Fixes WindowBackend dropdown * Bump LUS * misc -> utils and moves binarytools to utils. * Window refactor * bump lus * make it work * Fixes for moved files again * Bump LUS * Mercury -> Config * Bump LUS * Reacts to removed LUS hooks and bump LUS * Remove Hook: GfxInit * Removes debug audio_setgamevolume to 1 * use non-crashing branch of lus * fix: make audio init work without hooks * game icon stuff * multifix bmp * use input viewer class branch for now * just "Ship" it's cleaner * Bump LUS * Removed ExitGame hook. * Bump LUS * Hook system removed from LUS. * More LUS updates * Changes to make window position saving. * Bump LUS * Bump LUS (for real) * LUS resources now return a specialized pointer. * Bump LUS * Fixes issue in SetPathways::GetPointerSize * Bump LUS to 1.0.0 * builds but crashes * fix crash * better macro names in debug console * remove commeted out line * remove redundant check tracker settings window logic * remove commented out line * move the * * remove extra seqplayers enum def * this sneaky little guy was hiding behind a wii u ifdef * remove extra check tracker header --------- Co-authored-by: Kenix <kenixwhisperwind@gmail.com> Co-authored-by: briaguya <briaguya@alice>
2023-06-03 15:27:45 -04:00
void CheckTrackerWindow::InitElement() {
Check Tracker Update (#2668) * Initial commit. What works so far: Data file loads, saves, deletes, and is created properly. - Need to run `HasItemBeenCollected` when creating in case of mid-seed regen. Organized checks into maps set by area. Areas show in tracker. - Checks pulled from checkObjectsByArea are not currently listed. - Areas are being assumed completed and hidden at the start. * Checks now populate. Still not counting area totals properly. * Don't track RC_LINKS_POCKET in the data file, and instead manually add it in every time a save is load. rcObjects doesn't contain Link's Pocket location (duh). * Moved ItemReceive hook to randomizer_check_tracker.cpp. Skipped items are properly sorted and formatted. Saved items contribute to an area's gotten/skipped checks on load. Changed skipped items default main color to gray. General code cleanup. * Skipped checks now contribute to area totals for area completion logic. * Mid-menu rework transfer. * Started check lookup on item receive. Tried to enable scum checking on save. * Fixed scum check on save. * More code cleanup, which revealed some issues with loading and saving. Loading now works 100%, but entries in checkTrackerData are disappearing in code somewhere, causing issues with later checks. Scummed color now displays properly. Collected but unsaved displays properly. Unchecked, Skipped, Seen and Scummed checks all have arrows for skipping/unskipping. Counts a little messed up, probably double adding skips. * Fixed item counts being off across resets. Restarts were fine. * Beginning of rework for individual check updates. Adds `Actor lastCheck` to PlayState to allow assigning of last actor to give an item. This allows precise tracking of GS, freestanding PoH, etc. Works for chests too. Currently does not work for shops, unknown for normal NPC gives. Doesn't track last gives for non-checks, like drops from grass, pots, crates, etc. * Actor-based checks fully fleshed out, but can't help with sale-based checks. Implemented `pendingSaleCheck` to back out of an RC check cycle if `gSaveContext->pendingSale` is not NONE when `OnItemReceive` is called, processed through `OnSaleEnd`. This should be the final change necessary to streamline the checks. * Temporary hook to message box close to tie in trackers for non-gs/chest actors that aren't added to `GetCheckFromActor`. This triggers a 2-frame countdown to check with `HasItemBeenCollected` since half of the methods in there aren't updated until after a text box closes. Added scene tracking to get last scene so that checks in scenes that span several overworld areas could be tied to their areas properly. Modified tracker data creation to apply Link's Pocket and Song from Impa conditionally based on randomizer settings instead of just being assumed to be done. May need modification for checking click and drag spoiler loading. Removed the scene equivalence check from CheckChecks so that an entire area is checked each time to avoid issues with, e.g., leaving a shop before a pending sale finishes. * Changed check data creation to use RSKs from gRandomizer to account for settings loaded from drag and drop spoilers. * Beginning of tracker code organization. Changed check color defaults. * Reverted moving tracker colors to header. Some individual check fixes. * Missed something from previous merge? * Removed last remnant of removed performance mode. * Better handle checking when skullsanity is off. * Song checks sceneIDs don't match the scenes they're actually in for some reason. Removed that check. * SaleEnd checks don't need the GetItemEntry parameter. Also set a flag that should prevent the check tracker from running during vanilla saves should that not be resolved by the time it's merged. * Attempting to have only the relevant checks added to the tracker data, as well as showing vanilla checks for non-rando saves. Not working yet (everything is displayed in vanilla). * Added vanilla check tracker population via `vanillaCheck` bool in `RandomizerCheckObject`. This is also added to `IsVisibleInImGui` to handle file loading and saving to eliminate checks that aren't part of vanilla or the rando seed. Implemented deleted tracker data file recreation. Added some extra item name text checks. Songs are still... tricky, so they stay blank. Utilize local copies of the randomizer check objects that are applicable for performance purposes. Fixed vanilla item-giving cutscene crashes when triggered mid-transition. * Apparently not all toolchains can handle macro instantiation without all parameters, like VS can. * Fixed scummed detail color not showing properly on tracker. * Fixed dungeon area totals and GS checks not functioning properly. * Major revamp of checking code. Doesn't rely on `GetCheckFromActor` at all anymore, but instead simply sets a flag to evaluate a number of checks in an area every frame until the check that was gotten is identified. With the new setup, it's much less hardware intensive, and at 60fps 6 checks per frame shows no noticeable effect on framerate. I can envision needing to add a collectedCount in order to account for times when two checks are gotten one right after the other. Changed area scroll to happen from `OnTransitionEnd`, and allow for scrolling in bazaar (was disabled previously because it would jump back and forth between Kak and Market while you were in one). Also setup area check order updating by area instead of all at the same time. * Fixed shooting gallery not reporting proper area. Prevent checks from actually happening if area is RCAREA_INVALID, now that all areas are reporting something if they have checks. Fixed `GetCheckArea()` not updating checks for standard scenes. Lots of vanilla tracking updates, mainly manual checks for gems, medallions and songs, since the often don't have proper scenes in the data. Prevent vanilla from triggering check loops if junk items are collected. Fixed sorting based on saved vs collected. Prevent item name display for vanilla runs. Change coloring of checks so the check name reflects status in vanilla runs. * Fixed "Recheck Area" button erroneously adding to an area's check totals? * Fix DMC vanilla checks. * Fix check tracker data recreation on data file loss. Removed redundant file exists check from SaveTrackerDataHook, as it doesn't matter if it exists or not at that point. Limited check loops to 3 to avoid infinite check loops on non-check/junk item pickup. Added more checks to disable tracker operations if a save is not running. Changed check ordering to put boss reward and heart container checks at the end of whatever RCSHOW group they belong to. * Fixed IsRunning calculation. Further improving vanilla checking. Starting framework for checking medallions, stones, and songs on data file recreation. Fixed medallion check collection. Added GIFT_FROM_SAGES to check list for vanilla file for tracking light medallion. Added check loop limitation to prevent infinite checking after picking up junk item from the ground. * Finished vanilla file recreation and recheck (songs and dungeon rewards all check properly now). This includes deku shield with KF shop item 3. Finished Gift from Raoru light medallion tracking for vanilla. Commented all CheckByScene functionality for now. * Fixed new save data file creation. Disabled entrance area calculation for now, as it only tracks the previous entrance for some reason. Fixed area detection for ToT checks. * GetCheckArea() now utilizes EntranceData almost exclusively, via either `gSaveContext.entranceIndex` or the entrance tracker's `currentGrottoId` in the case of grottos. This also means that EVERYTHING CAN AUTOSCROLL NOW. Entrance shuffles are now much easier to track. Autoscroll is now also triggered on save, just in case someone isn't autosaving and has a lot of checks that get converted to saved. * Fixed missing GS check in LW. * Added area scroll on toggling Show Hidden Items. May configure differently later. Fixed area detection for entrances in Gerudo Fortress/Valley and Collossus. Haunted wasteland doesn't autoscroll due to a bug in `OnTransitionEnd` hook, but checks still evaluate properly there. Rely on scene-based area detection if scene is a main overworld or dungeon scene. * Fixed grotto detection when shuffle is off. * Small code cleanup. Fixed Colossus hand chest checks. * Missing lus bump from merge conflict resolution * Fixed Colossus Grotto making `GetCheckArea` return Wasteland. * Improved OnItemReceive processing for non-token GS checks, since they can sometimes take long enough for the checking process to time out before the item is registered as received. * First attempt at thread safety for tracker data file writing. Seems to work, but might need more testing. * Fixed Recheck Area not unskipping items that register as saved. Improved delayed saving with autosaving, as the autosave triggered quite often before the tracker data save, making things not properly register as saved. * merge cleanup * Converted check tracker data to the sectional saves, adding `CheckTrackerData` to `SaveContext`. Implemented section ID returning and fullSave boolean passing to section functions from my PR temporarily for it to work properly. Moved `RandomizerCheckTrackerData` enum to `randomizerTypes.h` to accommodate that. Changed `Randomizer_SaveInit` to a `SaveManager::InitFunc` to allow for other randomizer-dependent sections to be initialized after that. Required a little refactoring to maintain intro cutscene skip when starting a randomizer file. * Revert section index return and randomizer init changes. Will need to wait on yet more changes to main. * Fixed check tracker initialization (shouldn't be tied to window initialization), restored saving/loading functionality. * Removed `CheckTracker::Init` and put SaveManager calls in `CheckTrackerWindow::InitElement`. Also a bit of cleanup from transition back to save file use. * Fixed tracker displaying check categories while file not loaded. * Fix Darunia's Joy check not marking in vanilla. * Fix autosave not triggering change from collected to saved in tracker data. * Changed default colors for scummed and collected display. * Merge upgrade code cleanup. * Add `OnTransitionEnd` calls to sandstorm transitions both to and from Wasteland. Also improved `gSaveContext.lastScene` assignment for both transition types. Allowed a bit of cleanup in `GetCheckArea`. * Added `StateButton`, a button like `ArrowButton` but that allows text instead of arrow icons. Apparently the changes from ArrowButton to StateButton happened in a previous commit... * Changed section name to `trackerDataCheck` to force SoH to load it after the randomizer section, as it required some randoSettings to be loaded first, and nothing else I tried to make the randomizer section load before it worked. This hacks a solution to checks not displaying on fast file load to a specific slot. F*** you, SaveManager, and f*** you too, JSON. * Forgot to change the section string for loading with the name change. * Fix check ordering for checks that trigger the autosave. * Adds option to remove right-side shop items (slots 1-4) from the tracker list. Enabled by default. * Fix default state of Hide Shop Right Checks checkbox. * Fixes grotto and great fairy scrolling and checks. Fixes array overflow from `checkTrackerData` which was creating the issue trying to load the base and randomizer sections first, among other things. That also fixed the massive file loads that were being exhibited in debug mode. * Fix shooting galleries being set as collected again when being played a second time after getting the checks. * Fix Bazaar autoscroll. * Add Saria's Song to `GetCheckFromActor` and removed some limitations from the messageCloseCheck function to make that check track properly. * Fix Song from Impa check. Implemented prevention for multiple "collections" of great fairies, just in case getting the health refill would trigger it with the previous setup. * Fix ice traps on GS tokens not triggering OnItemReceive. * Complete fix for ice trap collection from GS. Add autoscroll when clicking "Expand All". * Add `OnShopSlotChange` with cursorSlot and basePrice parameters. * Fixed include in en_ossan for shop slot hook. Added registration for `OnShopSlotChange` in the tracker, storing the price in a new `price` field in `CheckTrackerData`. Added "seen" functionality to shop checks. Displays the model item name upon first entering a shop, adding the price and switching to trickName (if it's an ice trap) upon navigating to the slot in buy mode, triggered by an invisible "identified" status that mirrors "seen" in every other way. Added tooltips to most options for check tracker color picking to describe what each status actually means. * `std::format` pls * So apparently std::format just decided to break with the latest merge from develop, but fmt::format exists and works? * Removed the last vestiges of `locationsSkipped`. Other general code and formatting cleanups. Moved `IsGameRunning` to `OTRGlobals` so the item tracker could also access it. Used preceding to "fix" item and bottle display in the item tracker on startup. * Some more code cleanup. Removed "Recheck Area" button and relevant code. Backported changes to Anchor branch applicable for single-player, including making a checkAreas vector and structuring the frame by frame checks around that. Also includes fix for Silver Gauntlets and Mirror Shield check collection crash associated with those changes. Fixed Kakariko Bazaar "seen" updates. Fixed tracker window not showing on initial load like it should. * Forgot 1 formatting fix. * Removed conditions for showing Song from Impa (isn't junk under certain conditions, so should show all the time). * Fix vanilla checks, add Zelda's Letter and Malon's Egg to manual check collection. Fix autoscroll while in child stealth section. * Fix crash in Happy Mask Shop in OnSlotChange (referenced non-existent shop id in a tracker-specific enum). * General code cleanup. * Missed one reversion. * One more. * Fix column alignment in `randomizer_check_objects`. * Fix file encoding on `randomizer_check_tracker`. Again. * Fix indentation for `actualItemtrackerItemMap`. Also removed unnecessary parts of the map. * Rename `HasEqItem` to `HasEquipment`. * Slightly better indentation for `actualItemTrackerItemMap`. * Add magic bean salesman to vanilla check tracking, and genericized deku shield to trigger KF shop item 3 wherever you get the shield. Renamed `vanillaCheck` to `vanillaHundoCheck` to (supposedly) clarify the meaning of the usage. * One more rename to `vanillaCompletion` to avoid possible confusion with 100% speedrun conditions. * give me a break XD Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * Changes suggested by briaguya (rename `RandomizerCheckShow` to `Status`, unused code, newline formatting) * Remove unused `itemNames` table. * Remove `IsGameRunning` in favor of `GameInteractor::IsSaveLoaded`. * Restore anti-spoiler functionality for dungeons with dungeon maps. * Review cleanup. * Fix prices not showing for Kak bazaar items. --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com>
2023-10-04 11:03:36 -04:00
Color_Background = CVarGetColor("gCheckTrackerBgColor", Color_Bg_Default);
Color_Area_Incomplete_Main = CVarGetColor("gCheckTrackerAreaMainIncompleteColor", Color_Main_Default);
Color_Area_Incomplete_Extra = CVarGetColor("gCheckTrackerAreaExtraIncompleteColor", Color_Area_Incomplete_Extra_Default);
Color_Area_Complete_Main = CVarGetColor("gCheckTrackerAreaMainCompleteColor", Color_Main_Default);
Color_Area_Complete_Extra = CVarGetColor("gCheckTrackerAreaExtraCompleteColor", Color_Area_Complete_Extra_Default);
Color_Unchecked_Main = CVarGetColor("gCheckTrackerUncheckedMainColor", Color_Main_Default);
Color_Unchecked_Extra = CVarGetColor("gCheckTrackerUncheckedExtraColor", Color_Unchecked_Extra_Default);
Color_Skipped_Main = CVarGetColor("gCheckTrackerSkippedMainColor", Color_Main_Default);
Color_Skipped_Extra = CVarGetColor("gCheckTrackerSkippedExtraColor", Color_Skipped_Extra_Default);
Color_Seen_Main = CVarGetColor("gCheckTrackerSeenMainColor", Color_Main_Default);
Color_Seen_Extra = CVarGetColor("gCheckTrackerSeenExtraColor", Color_Seen_Extra_Default);
Color_Hinted_Main = CVarGetColor("gCheckTrackerHintedMainColor", Color_Main_Default);
Color_Hinted_Extra = CVarGetColor("gCheckTrackerHintedExtraColor", Color_Hinted_Extra_Default);
Check Tracker Update (#2668) * Initial commit. What works so far: Data file loads, saves, deletes, and is created properly. - Need to run `HasItemBeenCollected` when creating in case of mid-seed regen. Organized checks into maps set by area. Areas show in tracker. - Checks pulled from checkObjectsByArea are not currently listed. - Areas are being assumed completed and hidden at the start. * Checks now populate. Still not counting area totals properly. * Don't track RC_LINKS_POCKET in the data file, and instead manually add it in every time a save is load. rcObjects doesn't contain Link's Pocket location (duh). * Moved ItemReceive hook to randomizer_check_tracker.cpp. Skipped items are properly sorted and formatted. Saved items contribute to an area's gotten/skipped checks on load. Changed skipped items default main color to gray. General code cleanup. * Skipped checks now contribute to area totals for area completion logic. * Mid-menu rework transfer. * Started check lookup on item receive. Tried to enable scum checking on save. * Fixed scum check on save. * More code cleanup, which revealed some issues with loading and saving. Loading now works 100%, but entries in checkTrackerData are disappearing in code somewhere, causing issues with later checks. Scummed color now displays properly. Collected but unsaved displays properly. Unchecked, Skipped, Seen and Scummed checks all have arrows for skipping/unskipping. Counts a little messed up, probably double adding skips. * Fixed item counts being off across resets. Restarts were fine. * Beginning of rework for individual check updates. Adds `Actor lastCheck` to PlayState to allow assigning of last actor to give an item. This allows precise tracking of GS, freestanding PoH, etc. Works for chests too. Currently does not work for shops, unknown for normal NPC gives. Doesn't track last gives for non-checks, like drops from grass, pots, crates, etc. * Actor-based checks fully fleshed out, but can't help with sale-based checks. Implemented `pendingSaleCheck` to back out of an RC check cycle if `gSaveContext->pendingSale` is not NONE when `OnItemReceive` is called, processed through `OnSaleEnd`. This should be the final change necessary to streamline the checks. * Temporary hook to message box close to tie in trackers for non-gs/chest actors that aren't added to `GetCheckFromActor`. This triggers a 2-frame countdown to check with `HasItemBeenCollected` since half of the methods in there aren't updated until after a text box closes. Added scene tracking to get last scene so that checks in scenes that span several overworld areas could be tied to their areas properly. Modified tracker data creation to apply Link's Pocket and Song from Impa conditionally based on randomizer settings instead of just being assumed to be done. May need modification for checking click and drag spoiler loading. Removed the scene equivalence check from CheckChecks so that an entire area is checked each time to avoid issues with, e.g., leaving a shop before a pending sale finishes. * Changed check data creation to use RSKs from gRandomizer to account for settings loaded from drag and drop spoilers. * Beginning of tracker code organization. Changed check color defaults. * Reverted moving tracker colors to header. Some individual check fixes. * Missed something from previous merge? * Removed last remnant of removed performance mode. * Better handle checking when skullsanity is off. * Song checks sceneIDs don't match the scenes they're actually in for some reason. Removed that check. * SaleEnd checks don't need the GetItemEntry parameter. Also set a flag that should prevent the check tracker from running during vanilla saves should that not be resolved by the time it's merged. * Attempting to have only the relevant checks added to the tracker data, as well as showing vanilla checks for non-rando saves. Not working yet (everything is displayed in vanilla). * Added vanilla check tracker population via `vanillaCheck` bool in `RandomizerCheckObject`. This is also added to `IsVisibleInImGui` to handle file loading and saving to eliminate checks that aren't part of vanilla or the rando seed. Implemented deleted tracker data file recreation. Added some extra item name text checks. Songs are still... tricky, so they stay blank. Utilize local copies of the randomizer check objects that are applicable for performance purposes. Fixed vanilla item-giving cutscene crashes when triggered mid-transition. * Apparently not all toolchains can handle macro instantiation without all parameters, like VS can. * Fixed scummed detail color not showing properly on tracker. * Fixed dungeon area totals and GS checks not functioning properly. * Major revamp of checking code. Doesn't rely on `GetCheckFromActor` at all anymore, but instead simply sets a flag to evaluate a number of checks in an area every frame until the check that was gotten is identified. With the new setup, it's much less hardware intensive, and at 60fps 6 checks per frame shows no noticeable effect on framerate. I can envision needing to add a collectedCount in order to account for times when two checks are gotten one right after the other. Changed area scroll to happen from `OnTransitionEnd`, and allow for scrolling in bazaar (was disabled previously because it would jump back and forth between Kak and Market while you were in one). Also setup area check order updating by area instead of all at the same time. * Fixed shooting gallery not reporting proper area. Prevent checks from actually happening if area is RCAREA_INVALID, now that all areas are reporting something if they have checks. Fixed `GetCheckArea()` not updating checks for standard scenes. Lots of vanilla tracking updates, mainly manual checks for gems, medallions and songs, since the often don't have proper scenes in the data. Prevent vanilla from triggering check loops if junk items are collected. Fixed sorting based on saved vs collected. Prevent item name display for vanilla runs. Change coloring of checks so the check name reflects status in vanilla runs. * Fixed "Recheck Area" button erroneously adding to an area's check totals? * Fix DMC vanilla checks. * Fix check tracker data recreation on data file loss. Removed redundant file exists check from SaveTrackerDataHook, as it doesn't matter if it exists or not at that point. Limited check loops to 3 to avoid infinite check loops on non-check/junk item pickup. Added more checks to disable tracker operations if a save is not running. Changed check ordering to put boss reward and heart container checks at the end of whatever RCSHOW group they belong to. * Fixed IsRunning calculation. Further improving vanilla checking. Starting framework for checking medallions, stones, and songs on data file recreation. Fixed medallion check collection. Added GIFT_FROM_SAGES to check list for vanilla file for tracking light medallion. Added check loop limitation to prevent infinite checking after picking up junk item from the ground. * Finished vanilla file recreation and recheck (songs and dungeon rewards all check properly now). This includes deku shield with KF shop item 3. Finished Gift from Raoru light medallion tracking for vanilla. Commented all CheckByScene functionality for now. * Fixed new save data file creation. Disabled entrance area calculation for now, as it only tracks the previous entrance for some reason. Fixed area detection for ToT checks. * GetCheckArea() now utilizes EntranceData almost exclusively, via either `gSaveContext.entranceIndex` or the entrance tracker's `currentGrottoId` in the case of grottos. This also means that EVERYTHING CAN AUTOSCROLL NOW. Entrance shuffles are now much easier to track. Autoscroll is now also triggered on save, just in case someone isn't autosaving and has a lot of checks that get converted to saved. * Fixed missing GS check in LW. * Added area scroll on toggling Show Hidden Items. May configure differently later. Fixed area detection for entrances in Gerudo Fortress/Valley and Collossus. Haunted wasteland doesn't autoscroll due to a bug in `OnTransitionEnd` hook, but checks still evaluate properly there. Rely on scene-based area detection if scene is a main overworld or dungeon scene. * Fixed grotto detection when shuffle is off. * Small code cleanup. Fixed Colossus hand chest checks. * Missing lus bump from merge conflict resolution * Fixed Colossus Grotto making `GetCheckArea` return Wasteland. * Improved OnItemReceive processing for non-token GS checks, since they can sometimes take long enough for the checking process to time out before the item is registered as received. * First attempt at thread safety for tracker data file writing. Seems to work, but might need more testing. * Fixed Recheck Area not unskipping items that register as saved. Improved delayed saving with autosaving, as the autosave triggered quite often before the tracker data save, making things not properly register as saved. * merge cleanup * Converted check tracker data to the sectional saves, adding `CheckTrackerData` to `SaveContext`. Implemented section ID returning and fullSave boolean passing to section functions from my PR temporarily for it to work properly. Moved `RandomizerCheckTrackerData` enum to `randomizerTypes.h` to accommodate that. Changed `Randomizer_SaveInit` to a `SaveManager::InitFunc` to allow for other randomizer-dependent sections to be initialized after that. Required a little refactoring to maintain intro cutscene skip when starting a randomizer file. * Revert section index return and randomizer init changes. Will need to wait on yet more changes to main. * Fixed check tracker initialization (shouldn't be tied to window initialization), restored saving/loading functionality. * Removed `CheckTracker::Init` and put SaveManager calls in `CheckTrackerWindow::InitElement`. Also a bit of cleanup from transition back to save file use. * Fixed tracker displaying check categories while file not loaded. * Fix Darunia's Joy check not marking in vanilla. * Fix autosave not triggering change from collected to saved in tracker data. * Changed default colors for scummed and collected display. * Merge upgrade code cleanup. * Add `OnTransitionEnd` calls to sandstorm transitions both to and from Wasteland. Also improved `gSaveContext.lastScene` assignment for both transition types. Allowed a bit of cleanup in `GetCheckArea`. * Added `StateButton`, a button like `ArrowButton` but that allows text instead of arrow icons. Apparently the changes from ArrowButton to StateButton happened in a previous commit... * Changed section name to `trackerDataCheck` to force SoH to load it after the randomizer section, as it required some randoSettings to be loaded first, and nothing else I tried to make the randomizer section load before it worked. This hacks a solution to checks not displaying on fast file load to a specific slot. F*** you, SaveManager, and f*** you too, JSON. * Forgot to change the section string for loading with the name change. * Fix check ordering for checks that trigger the autosave. * Adds option to remove right-side shop items (slots 1-4) from the tracker list. Enabled by default. * Fix default state of Hide Shop Right Checks checkbox. * Fixes grotto and great fairy scrolling and checks. Fixes array overflow from `checkTrackerData` which was creating the issue trying to load the base and randomizer sections first, among other things. That also fixed the massive file loads that were being exhibited in debug mode. * Fix shooting galleries being set as collected again when being played a second time after getting the checks. * Fix Bazaar autoscroll. * Add Saria's Song to `GetCheckFromActor` and removed some limitations from the messageCloseCheck function to make that check track properly. * Fix Song from Impa check. Implemented prevention for multiple "collections" of great fairies, just in case getting the health refill would trigger it with the previous setup. * Fix ice traps on GS tokens not triggering OnItemReceive. * Complete fix for ice trap collection from GS. Add autoscroll when clicking "Expand All". * Add `OnShopSlotChange` with cursorSlot and basePrice parameters. * Fixed include in en_ossan for shop slot hook. Added registration for `OnShopSlotChange` in the tracker, storing the price in a new `price` field in `CheckTrackerData`. Added "seen" functionality to shop checks. Displays the model item name upon first entering a shop, adding the price and switching to trickName (if it's an ice trap) upon navigating to the slot in buy mode, triggered by an invisible "identified" status that mirrors "seen" in every other way. Added tooltips to most options for check tracker color picking to describe what each status actually means. * `std::format` pls * So apparently std::format just decided to break with the latest merge from develop, but fmt::format exists and works? * Removed the last vestiges of `locationsSkipped`. Other general code and formatting cleanups. Moved `IsGameRunning` to `OTRGlobals` so the item tracker could also access it. Used preceding to "fix" item and bottle display in the item tracker on startup. * Some more code cleanup. Removed "Recheck Area" button and relevant code. Backported changes to Anchor branch applicable for single-player, including making a checkAreas vector and structuring the frame by frame checks around that. Also includes fix for Silver Gauntlets and Mirror Shield check collection crash associated with those changes. Fixed Kakariko Bazaar "seen" updates. Fixed tracker window not showing on initial load like it should. * Forgot 1 formatting fix. * Removed conditions for showing Song from Impa (isn't junk under certain conditions, so should show all the time). * Fix vanilla checks, add Zelda's Letter and Malon's Egg to manual check collection. Fix autoscroll while in child stealth section. * Fix crash in Happy Mask Shop in OnSlotChange (referenced non-existent shop id in a tracker-specific enum). * General code cleanup. * Missed one reversion. * One more. * Fix column alignment in `randomizer_check_objects`. * Fix file encoding on `randomizer_check_tracker`. Again. * Fix indentation for `actualItemtrackerItemMap`. Also removed unnecessary parts of the map. * Rename `HasEqItem` to `HasEquipment`. * Slightly better indentation for `actualItemTrackerItemMap`. * Add magic bean salesman to vanilla check tracking, and genericized deku shield to trigger KF shop item 3 wherever you get the shield. Renamed `vanillaCheck` to `vanillaHundoCheck` to (supposedly) clarify the meaning of the usage. * One more rename to `vanillaCompletion` to avoid possible confusion with 100% speedrun conditions. * give me a break XD Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * Changes suggested by briaguya (rename `RandomizerCheckShow` to `Status`, unused code, newline formatting) * Remove unused `itemNames` table. * Remove `IsGameRunning` in favor of `GameInteractor::IsSaveLoaded`. * Restore anti-spoiler functionality for dungeons with dungeon maps. * Review cleanup. * Fix prices not showing for Kak bazaar items. --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com>
2023-10-04 11:03:36 -04:00
Color_Collected_Main = CVarGetColor("gCheckTrackerCollectedMainColor", Color_Main_Default);
Color_Collected_Extra = CVarGetColor("gCheckTrackerCollectedExtraColor", Color_Collected_Extra_Default);
Color_Scummed_Main = CVarGetColor("gCheckTrackerScummedMainColor", Color_Main_Default);
Color_Scummed_Extra = CVarGetColor("gCheckTrackerScummedExtraColor", Color_Scummed_Extra_Default);
Color_Saved_Main = CVarGetColor("gCheckTrackerSavedMainColor", Color_Main_Default);
Color_Saved_Extra = CVarGetColor("gCheckTrackerSavedExtraColor", Color_Saved_Extra_Default);
Randomizer Auto Location tracker (#1942) * Initial Auto-Location Tracking * Updates styling for checked items in Check Tracker * Fixes crashing issues with Check Tracker rendering * Auto scroll Check Tracker windows to current area * Checks Tracker only shows checked locations once in game * Fixes issue where Check Tracker would auto-scroll to wrong location when entering a grotto * Fixes gerudo fortress checks showing in tracker when settings have them removed * InfTable Check Location Fixes: Lost Dog Richard, Rolling Gorons, HBA 1000, Thawed Zora * Fixes most Event Chk Inf Checks on Check Tracker, and Frogs * Check Tracker - Song from Malon now works * Check Tracker - Fixes Claim Check check not tracking - Fixes spoiler for Claim Check check when getting Biggoron's Sword - Fixes LACS being spoiled and not tracking * Check Tracker - Fixes #2 for Skull Mask and Mask of Truth checks * Check Tracker - Adds support for merchants - Fixes #7 for Bomchu Salesman - Fixes #12 for Medigoron * Check Tracker - Fixes #8 for Song from Saria * Check Tracker - Fixes #9 for Adult Shooting Gallery * Check Tracker - Fixes #10 for Composer Grave * Check Tracker - Fixes #14 for Song from Ocarina of Time * Check Tracker - Fixes #16 for Shooting the Sun * Check Tracker - Fixes #19 for Darunia's Joy * Save Editor - Adds missing label for Treasure Chest Game * Check Tracker - Fixes Great Faries checks * Check Tracker - Fixes Sheik at Temple * Check Tracker - Fixes Great Fairy auto-scroll to wrong location * Check Tracker - Updates blue warp checks - Fixes Bongo Bongo and Twinrova checks * Check Tracker - Fixes Dampe's Gravedigging Tour * Check Tracker - Fixes Prescription to King Zora * Check Tracker - Fixes Bazaar showing under wrong area on tracker between adult/child * Check Tracker - Fixes scroll for Hyrule Market and Bazaar * Check Tracker - Fixes giving Adult Trade Items shown on tracker: Broken Sword, Saw, Cojiro, Eyeball Froge, and Eyedrops * Cleans up item_location * Check Tracker - Item List - Fixes item list not updating when changing seeds/options - Separates item exclusion list from item check list - Clean up comments * Check Tracker - Adds Skip functionality to buttons * Check Tracker - Refactors adult trade items to RandomizerInf * Check Tracker - Fixes an issue where any time an item is removed the tracker would cause an application crash * Check Tracker - Item names are now dependent on file language * Check Tracker - Fixes Gerudo Card check not showing in Fast setting * Reorders headers to (hopefully) avoid CI build conflicts on linux/consoles * Explicitly defines vector header in randomizer.h to fix compile errors * Complete Refactor of Check Tracker ImGui * Adds missing check tracker files to CMakeLists * Reverts the Item_location whitespace cleanup from ad10807c * Check Tracker - Loading Fixes - Fixes a bug where loading a save file a second time would add all the checks again - Fixes a bug where the check tracker would not render at all until in a save file * Check Tracker - Fixes a bug where checks would sometimes fail to load * Check Tracker - Fixes duplicated checks when using Only on Pause or Only on Combo * Check Tracker - Works around issue where single characters don't show in EnhancementCombobox, and fixes a label for combo buttons held option * Check Tracker - Applies all Check Tracker changes to Item Location * Check Tracker - Updated Check List - Adds Link's pocket, either in KF or HM depending on starting age - Supports Scrubs and Merchants - Uses enums instead of magic numbers - Updates DC Scrub Short Names for MQ * Check Tracker - Adds a performance mode option * Check Tracker - List Fixes (requires new rando generation) - Fixes Frogs Rupees always visible - Fixes Kokiri Sword Chest not showing - Fixes Weird Egg not showing * Check Tracker - MQ List basic support * Check Tracker - MQ/Vanilla anti-spoilers * Check Tracker - Collecting a compass now spoils the area * Check Tracker - Basic Vanilla Support and fixes - Vanilla items show in check tracker, even if many won't auto check - Fixes an issue with Gerudo Fortress Keys - Refactors IsVisibleInCheckTracker to randomizer_check_tracjer * Check Tracker - Fixes merge conflict from 08a487f35e1d760ab9e69b932edbe4da6bcd9edb * Check Tracker - Fixes tracker loading as Floating when default value is set to Windowed * Randomizer Location Exclusion List - Adds Scrubs, Merchants, Shops. Adult Trade items, MQ Dungeons, and Bean Salesman - Fixes Kokiri Sword Chest, Weird Egg, and Frog Song Rupees from misbehaving - Updates Gerudo Fortress logic to be dependent on Open/Fast/Normal Fortress - Removes Invalid Check - Adds RO Enum for MQ settings - Updates magic values to RO enum * Location Exclusion List - Scrubs that are always randomized now always show on the list * For now, removes some extra code only needed for a Check Tracker. * Randomizer Location Exclusion List - Fixes Eyeball Frog from showing up when Adult Trade Items was off * Location Tracker - Updates Eyedrops to use RandomizerInf instead of Chest * Check Tracker - Fixes a bug where Link's Pocket item wasn't acting as checked for area item count * Check Tracker - Fixes a bug where Locations would incorrectly say Vanilla due to the first check in the area being a non-MQ check * Check Tracker - Fixes a crash when Check Tracker is docked but not visible * Check Tracker - Fixes areas being spoiled when loading different save files * Check Tracker - Only reset variables if they are initialized * Check Tracker - Cleans up old comments, unused variables, methods, and macros, adds language TODOs, * Check Tracker - Readds rainbow UI elements after Cosmetics Editor refactor * Check Tracker - Removal of flag lookup that was refactored, no longer needed header, and some trivial whitespace fixes. * Check Tracker - Refactors Index to Bitmask code to a macro * Check Tracker - Changes ordering from alphabetical to RandomizerCheck ordering * Check Tracker - Wraps everything in a namespace to avoid global variable usage * Check Tracker - Explicitly defines for-loop scope * Check Tracker - refactors dungeon lookup from static array to function * Fixes a bug when using EnhancementColor with alpha * Check Tracker - Refactors all colour to use direct conversions * Check Tracker - refactors settings loading and check visibility for readability * Check Tracker - Fixes a bug where the wrong label showed on the Check Tracker BG Color * UIWidgets - Adds Alpha bar to EnhancementColor when using alpha parameter
2022-12-10 22:39:23 -05:00
Check Tracker Update (#2668) * Initial commit. What works so far: Data file loads, saves, deletes, and is created properly. - Need to run `HasItemBeenCollected` when creating in case of mid-seed regen. Organized checks into maps set by area. Areas show in tracker. - Checks pulled from checkObjectsByArea are not currently listed. - Areas are being assumed completed and hidden at the start. * Checks now populate. Still not counting area totals properly. * Don't track RC_LINKS_POCKET in the data file, and instead manually add it in every time a save is load. rcObjects doesn't contain Link's Pocket location (duh). * Moved ItemReceive hook to randomizer_check_tracker.cpp. Skipped items are properly sorted and formatted. Saved items contribute to an area's gotten/skipped checks on load. Changed skipped items default main color to gray. General code cleanup. * Skipped checks now contribute to area totals for area completion logic. * Mid-menu rework transfer. * Started check lookup on item receive. Tried to enable scum checking on save. * Fixed scum check on save. * More code cleanup, which revealed some issues with loading and saving. Loading now works 100%, but entries in checkTrackerData are disappearing in code somewhere, causing issues with later checks. Scummed color now displays properly. Collected but unsaved displays properly. Unchecked, Skipped, Seen and Scummed checks all have arrows for skipping/unskipping. Counts a little messed up, probably double adding skips. * Fixed item counts being off across resets. Restarts were fine. * Beginning of rework for individual check updates. Adds `Actor lastCheck` to PlayState to allow assigning of last actor to give an item. This allows precise tracking of GS, freestanding PoH, etc. Works for chests too. Currently does not work for shops, unknown for normal NPC gives. Doesn't track last gives for non-checks, like drops from grass, pots, crates, etc. * Actor-based checks fully fleshed out, but can't help with sale-based checks. Implemented `pendingSaleCheck` to back out of an RC check cycle if `gSaveContext->pendingSale` is not NONE when `OnItemReceive` is called, processed through `OnSaleEnd`. This should be the final change necessary to streamline the checks. * Temporary hook to message box close to tie in trackers for non-gs/chest actors that aren't added to `GetCheckFromActor`. This triggers a 2-frame countdown to check with `HasItemBeenCollected` since half of the methods in there aren't updated until after a text box closes. Added scene tracking to get last scene so that checks in scenes that span several overworld areas could be tied to their areas properly. Modified tracker data creation to apply Link's Pocket and Song from Impa conditionally based on randomizer settings instead of just being assumed to be done. May need modification for checking click and drag spoiler loading. Removed the scene equivalence check from CheckChecks so that an entire area is checked each time to avoid issues with, e.g., leaving a shop before a pending sale finishes. * Changed check data creation to use RSKs from gRandomizer to account for settings loaded from drag and drop spoilers. * Beginning of tracker code organization. Changed check color defaults. * Reverted moving tracker colors to header. Some individual check fixes. * Missed something from previous merge? * Removed last remnant of removed performance mode. * Better handle checking when skullsanity is off. * Song checks sceneIDs don't match the scenes they're actually in for some reason. Removed that check. * SaleEnd checks don't need the GetItemEntry parameter. Also set a flag that should prevent the check tracker from running during vanilla saves should that not be resolved by the time it's merged. * Attempting to have only the relevant checks added to the tracker data, as well as showing vanilla checks for non-rando saves. Not working yet (everything is displayed in vanilla). * Added vanilla check tracker population via `vanillaCheck` bool in `RandomizerCheckObject`. This is also added to `IsVisibleInImGui` to handle file loading and saving to eliminate checks that aren't part of vanilla or the rando seed. Implemented deleted tracker data file recreation. Added some extra item name text checks. Songs are still... tricky, so they stay blank. Utilize local copies of the randomizer check objects that are applicable for performance purposes. Fixed vanilla item-giving cutscene crashes when triggered mid-transition. * Apparently not all toolchains can handle macro instantiation without all parameters, like VS can. * Fixed scummed detail color not showing properly on tracker. * Fixed dungeon area totals and GS checks not functioning properly. * Major revamp of checking code. Doesn't rely on `GetCheckFromActor` at all anymore, but instead simply sets a flag to evaluate a number of checks in an area every frame until the check that was gotten is identified. With the new setup, it's much less hardware intensive, and at 60fps 6 checks per frame shows no noticeable effect on framerate. I can envision needing to add a collectedCount in order to account for times when two checks are gotten one right after the other. Changed area scroll to happen from `OnTransitionEnd`, and allow for scrolling in bazaar (was disabled previously because it would jump back and forth between Kak and Market while you were in one). Also setup area check order updating by area instead of all at the same time. * Fixed shooting gallery not reporting proper area. Prevent checks from actually happening if area is RCAREA_INVALID, now that all areas are reporting something if they have checks. Fixed `GetCheckArea()` not updating checks for standard scenes. Lots of vanilla tracking updates, mainly manual checks for gems, medallions and songs, since the often don't have proper scenes in the data. Prevent vanilla from triggering check loops if junk items are collected. Fixed sorting based on saved vs collected. Prevent item name display for vanilla runs. Change coloring of checks so the check name reflects status in vanilla runs. * Fixed "Recheck Area" button erroneously adding to an area's check totals? * Fix DMC vanilla checks. * Fix check tracker data recreation on data file loss. Removed redundant file exists check from SaveTrackerDataHook, as it doesn't matter if it exists or not at that point. Limited check loops to 3 to avoid infinite check loops on non-check/junk item pickup. Added more checks to disable tracker operations if a save is not running. Changed check ordering to put boss reward and heart container checks at the end of whatever RCSHOW group they belong to. * Fixed IsRunning calculation. Further improving vanilla checking. Starting framework for checking medallions, stones, and songs on data file recreation. Fixed medallion check collection. Added GIFT_FROM_SAGES to check list for vanilla file for tracking light medallion. Added check loop limitation to prevent infinite checking after picking up junk item from the ground. * Finished vanilla file recreation and recheck (songs and dungeon rewards all check properly now). This includes deku shield with KF shop item 3. Finished Gift from Raoru light medallion tracking for vanilla. Commented all CheckByScene functionality for now. * Fixed new save data file creation. Disabled entrance area calculation for now, as it only tracks the previous entrance for some reason. Fixed area detection for ToT checks. * GetCheckArea() now utilizes EntranceData almost exclusively, via either `gSaveContext.entranceIndex` or the entrance tracker's `currentGrottoId` in the case of grottos. This also means that EVERYTHING CAN AUTOSCROLL NOW. Entrance shuffles are now much easier to track. Autoscroll is now also triggered on save, just in case someone isn't autosaving and has a lot of checks that get converted to saved. * Fixed missing GS check in LW. * Added area scroll on toggling Show Hidden Items. May configure differently later. Fixed area detection for entrances in Gerudo Fortress/Valley and Collossus. Haunted wasteland doesn't autoscroll due to a bug in `OnTransitionEnd` hook, but checks still evaluate properly there. Rely on scene-based area detection if scene is a main overworld or dungeon scene. * Fixed grotto detection when shuffle is off. * Small code cleanup. Fixed Colossus hand chest checks. * Missing lus bump from merge conflict resolution * Fixed Colossus Grotto making `GetCheckArea` return Wasteland. * Improved OnItemReceive processing for non-token GS checks, since they can sometimes take long enough for the checking process to time out before the item is registered as received. * First attempt at thread safety for tracker data file writing. Seems to work, but might need more testing. * Fixed Recheck Area not unskipping items that register as saved. Improved delayed saving with autosaving, as the autosave triggered quite often before the tracker data save, making things not properly register as saved. * merge cleanup * Converted check tracker data to the sectional saves, adding `CheckTrackerData` to `SaveContext`. Implemented section ID returning and fullSave boolean passing to section functions from my PR temporarily for it to work properly. Moved `RandomizerCheckTrackerData` enum to `randomizerTypes.h` to accommodate that. Changed `Randomizer_SaveInit` to a `SaveManager::InitFunc` to allow for other randomizer-dependent sections to be initialized after that. Required a little refactoring to maintain intro cutscene skip when starting a randomizer file. * Revert section index return and randomizer init changes. Will need to wait on yet more changes to main. * Fixed check tracker initialization (shouldn't be tied to window initialization), restored saving/loading functionality. * Removed `CheckTracker::Init` and put SaveManager calls in `CheckTrackerWindow::InitElement`. Also a bit of cleanup from transition back to save file use. * Fixed tracker displaying check categories while file not loaded. * Fix Darunia's Joy check not marking in vanilla. * Fix autosave not triggering change from collected to saved in tracker data. * Changed default colors for scummed and collected display. * Merge upgrade code cleanup. * Add `OnTransitionEnd` calls to sandstorm transitions both to and from Wasteland. Also improved `gSaveContext.lastScene` assignment for both transition types. Allowed a bit of cleanup in `GetCheckArea`. * Added `StateButton`, a button like `ArrowButton` but that allows text instead of arrow icons. Apparently the changes from ArrowButton to StateButton happened in a previous commit... * Changed section name to `trackerDataCheck` to force SoH to load it after the randomizer section, as it required some randoSettings to be loaded first, and nothing else I tried to make the randomizer section load before it worked. This hacks a solution to checks not displaying on fast file load to a specific slot. F*** you, SaveManager, and f*** you too, JSON. * Forgot to change the section string for loading with the name change. * Fix check ordering for checks that trigger the autosave. * Adds option to remove right-side shop items (slots 1-4) from the tracker list. Enabled by default. * Fix default state of Hide Shop Right Checks checkbox. * Fixes grotto and great fairy scrolling and checks. Fixes array overflow from `checkTrackerData` which was creating the issue trying to load the base and randomizer sections first, among other things. That also fixed the massive file loads that were being exhibited in debug mode. * Fix shooting galleries being set as collected again when being played a second time after getting the checks. * Fix Bazaar autoscroll. * Add Saria's Song to `GetCheckFromActor` and removed some limitations from the messageCloseCheck function to make that check track properly. * Fix Song from Impa check. Implemented prevention for multiple "collections" of great fairies, just in case getting the health refill would trigger it with the previous setup. * Fix ice traps on GS tokens not triggering OnItemReceive. * Complete fix for ice trap collection from GS. Add autoscroll when clicking "Expand All". * Add `OnShopSlotChange` with cursorSlot and basePrice parameters. * Fixed include in en_ossan for shop slot hook. Added registration for `OnShopSlotChange` in the tracker, storing the price in a new `price` field in `CheckTrackerData`. Added "seen" functionality to shop checks. Displays the model item name upon first entering a shop, adding the price and switching to trickName (if it's an ice trap) upon navigating to the slot in buy mode, triggered by an invisible "identified" status that mirrors "seen" in every other way. Added tooltips to most options for check tracker color picking to describe what each status actually means. * `std::format` pls * So apparently std::format just decided to break with the latest merge from develop, but fmt::format exists and works? * Removed the last vestiges of `locationsSkipped`. Other general code and formatting cleanups. Moved `IsGameRunning` to `OTRGlobals` so the item tracker could also access it. Used preceding to "fix" item and bottle display in the item tracker on startup. * Some more code cleanup. Removed "Recheck Area" button and relevant code. Backported changes to Anchor branch applicable for single-player, including making a checkAreas vector and structuring the frame by frame checks around that. Also includes fix for Silver Gauntlets and Mirror Shield check collection crash associated with those changes. Fixed Kakariko Bazaar "seen" updates. Fixed tracker window not showing on initial load like it should. * Forgot 1 formatting fix. * Removed conditions for showing Song from Impa (isn't junk under certain conditions, so should show all the time). * Fix vanilla checks, add Zelda's Letter and Malon's Egg to manual check collection. Fix autoscroll while in child stealth section. * Fix crash in Happy Mask Shop in OnSlotChange (referenced non-existent shop id in a tracker-specific enum). * General code cleanup. * Missed one reversion. * One more. * Fix column alignment in `randomizer_check_objects`. * Fix file encoding on `randomizer_check_tracker`. Again. * Fix indentation for `actualItemtrackerItemMap`. Also removed unnecessary parts of the map. * Rename `HasEqItem` to `HasEquipment`. * Slightly better indentation for `actualItemTrackerItemMap`. * Add magic bean salesman to vanilla check tracking, and genericized deku shield to trigger KF shop item 3 wherever you get the shield. Renamed `vanillaCheck` to `vanillaHundoCheck` to (supposedly) clarify the meaning of the usage. * One more rename to `vanillaCompletion` to avoid possible confusion with 100% speedrun conditions. * give me a break XD Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * Changes suggested by briaguya (rename `RandomizerCheckShow` to `Status`, unused code, newline formatting) * Remove unused `itemNames` table. * Remove `IsGameRunning` in favor of `GameInteractor::IsSaveLoaded`. * Restore anti-spoiler functionality for dungeons with dungeon maps. * Review cleanup. * Fix prices not showing for Kak bazaar items. --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com>
2023-10-04 11:03:36 -04:00
SaveManager::Instance->AddInitFunction(InitTrackerData);
sectionId = SaveManager::Instance->AddSaveFunction("trackerData", 1, SaveFile, true, -1);
SaveManager::Instance->AddLoadFunction("trackerData", 1, LoadFile);
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnLoadGame>(CheckTrackerLoadGame);
Check Tracker Update (#2668) * Initial commit. What works so far: Data file loads, saves, deletes, and is created properly. - Need to run `HasItemBeenCollected` when creating in case of mid-seed regen. Organized checks into maps set by area. Areas show in tracker. - Checks pulled from checkObjectsByArea are not currently listed. - Areas are being assumed completed and hidden at the start. * Checks now populate. Still not counting area totals properly. * Don't track RC_LINKS_POCKET in the data file, and instead manually add it in every time a save is load. rcObjects doesn't contain Link's Pocket location (duh). * Moved ItemReceive hook to randomizer_check_tracker.cpp. Skipped items are properly sorted and formatted. Saved items contribute to an area's gotten/skipped checks on load. Changed skipped items default main color to gray. General code cleanup. * Skipped checks now contribute to area totals for area completion logic. * Mid-menu rework transfer. * Started check lookup on item receive. Tried to enable scum checking on save. * Fixed scum check on save. * More code cleanup, which revealed some issues with loading and saving. Loading now works 100%, but entries in checkTrackerData are disappearing in code somewhere, causing issues with later checks. Scummed color now displays properly. Collected but unsaved displays properly. Unchecked, Skipped, Seen and Scummed checks all have arrows for skipping/unskipping. Counts a little messed up, probably double adding skips. * Fixed item counts being off across resets. Restarts were fine. * Beginning of rework for individual check updates. Adds `Actor lastCheck` to PlayState to allow assigning of last actor to give an item. This allows precise tracking of GS, freestanding PoH, etc. Works for chests too. Currently does not work for shops, unknown for normal NPC gives. Doesn't track last gives for non-checks, like drops from grass, pots, crates, etc. * Actor-based checks fully fleshed out, but can't help with sale-based checks. Implemented `pendingSaleCheck` to back out of an RC check cycle if `gSaveContext->pendingSale` is not NONE when `OnItemReceive` is called, processed through `OnSaleEnd`. This should be the final change necessary to streamline the checks. * Temporary hook to message box close to tie in trackers for non-gs/chest actors that aren't added to `GetCheckFromActor`. This triggers a 2-frame countdown to check with `HasItemBeenCollected` since half of the methods in there aren't updated until after a text box closes. Added scene tracking to get last scene so that checks in scenes that span several overworld areas could be tied to their areas properly. Modified tracker data creation to apply Link's Pocket and Song from Impa conditionally based on randomizer settings instead of just being assumed to be done. May need modification for checking click and drag spoiler loading. Removed the scene equivalence check from CheckChecks so that an entire area is checked each time to avoid issues with, e.g., leaving a shop before a pending sale finishes. * Changed check data creation to use RSKs from gRandomizer to account for settings loaded from drag and drop spoilers. * Beginning of tracker code organization. Changed check color defaults. * Reverted moving tracker colors to header. Some individual check fixes. * Missed something from previous merge? * Removed last remnant of removed performance mode. * Better handle checking when skullsanity is off. * Song checks sceneIDs don't match the scenes they're actually in for some reason. Removed that check. * SaleEnd checks don't need the GetItemEntry parameter. Also set a flag that should prevent the check tracker from running during vanilla saves should that not be resolved by the time it's merged. * Attempting to have only the relevant checks added to the tracker data, as well as showing vanilla checks for non-rando saves. Not working yet (everything is displayed in vanilla). * Added vanilla check tracker population via `vanillaCheck` bool in `RandomizerCheckObject`. This is also added to `IsVisibleInImGui` to handle file loading and saving to eliminate checks that aren't part of vanilla or the rando seed. Implemented deleted tracker data file recreation. Added some extra item name text checks. Songs are still... tricky, so they stay blank. Utilize local copies of the randomizer check objects that are applicable for performance purposes. Fixed vanilla item-giving cutscene crashes when triggered mid-transition. * Apparently not all toolchains can handle macro instantiation without all parameters, like VS can. * Fixed scummed detail color not showing properly on tracker. * Fixed dungeon area totals and GS checks not functioning properly. * Major revamp of checking code. Doesn't rely on `GetCheckFromActor` at all anymore, but instead simply sets a flag to evaluate a number of checks in an area every frame until the check that was gotten is identified. With the new setup, it's much less hardware intensive, and at 60fps 6 checks per frame shows no noticeable effect on framerate. I can envision needing to add a collectedCount in order to account for times when two checks are gotten one right after the other. Changed area scroll to happen from `OnTransitionEnd`, and allow for scrolling in bazaar (was disabled previously because it would jump back and forth between Kak and Market while you were in one). Also setup area check order updating by area instead of all at the same time. * Fixed shooting gallery not reporting proper area. Prevent checks from actually happening if area is RCAREA_INVALID, now that all areas are reporting something if they have checks. Fixed `GetCheckArea()` not updating checks for standard scenes. Lots of vanilla tracking updates, mainly manual checks for gems, medallions and songs, since the often don't have proper scenes in the data. Prevent vanilla from triggering check loops if junk items are collected. Fixed sorting based on saved vs collected. Prevent item name display for vanilla runs. Change coloring of checks so the check name reflects status in vanilla runs. * Fixed "Recheck Area" button erroneously adding to an area's check totals? * Fix DMC vanilla checks. * Fix check tracker data recreation on data file loss. Removed redundant file exists check from SaveTrackerDataHook, as it doesn't matter if it exists or not at that point. Limited check loops to 3 to avoid infinite check loops on non-check/junk item pickup. Added more checks to disable tracker operations if a save is not running. Changed check ordering to put boss reward and heart container checks at the end of whatever RCSHOW group they belong to. * Fixed IsRunning calculation. Further improving vanilla checking. Starting framework for checking medallions, stones, and songs on data file recreation. Fixed medallion check collection. Added GIFT_FROM_SAGES to check list for vanilla file for tracking light medallion. Added check loop limitation to prevent infinite checking after picking up junk item from the ground. * Finished vanilla file recreation and recheck (songs and dungeon rewards all check properly now). This includes deku shield with KF shop item 3. Finished Gift from Raoru light medallion tracking for vanilla. Commented all CheckByScene functionality for now. * Fixed new save data file creation. Disabled entrance area calculation for now, as it only tracks the previous entrance for some reason. Fixed area detection for ToT checks. * GetCheckArea() now utilizes EntranceData almost exclusively, via either `gSaveContext.entranceIndex` or the entrance tracker's `currentGrottoId` in the case of grottos. This also means that EVERYTHING CAN AUTOSCROLL NOW. Entrance shuffles are now much easier to track. Autoscroll is now also triggered on save, just in case someone isn't autosaving and has a lot of checks that get converted to saved. * Fixed missing GS check in LW. * Added area scroll on toggling Show Hidden Items. May configure differently later. Fixed area detection for entrances in Gerudo Fortress/Valley and Collossus. Haunted wasteland doesn't autoscroll due to a bug in `OnTransitionEnd` hook, but checks still evaluate properly there. Rely on scene-based area detection if scene is a main overworld or dungeon scene. * Fixed grotto detection when shuffle is off. * Small code cleanup. Fixed Colossus hand chest checks. * Missing lus bump from merge conflict resolution * Fixed Colossus Grotto making `GetCheckArea` return Wasteland. * Improved OnItemReceive processing for non-token GS checks, since they can sometimes take long enough for the checking process to time out before the item is registered as received. * First attempt at thread safety for tracker data file writing. Seems to work, but might need more testing. * Fixed Recheck Area not unskipping items that register as saved. Improved delayed saving with autosaving, as the autosave triggered quite often before the tracker data save, making things not properly register as saved. * merge cleanup * Converted check tracker data to the sectional saves, adding `CheckTrackerData` to `SaveContext`. Implemented section ID returning and fullSave boolean passing to section functions from my PR temporarily for it to work properly. Moved `RandomizerCheckTrackerData` enum to `randomizerTypes.h` to accommodate that. Changed `Randomizer_SaveInit` to a `SaveManager::InitFunc` to allow for other randomizer-dependent sections to be initialized after that. Required a little refactoring to maintain intro cutscene skip when starting a randomizer file. * Revert section index return and randomizer init changes. Will need to wait on yet more changes to main. * Fixed check tracker initialization (shouldn't be tied to window initialization), restored saving/loading functionality. * Removed `CheckTracker::Init` and put SaveManager calls in `CheckTrackerWindow::InitElement`. Also a bit of cleanup from transition back to save file use. * Fixed tracker displaying check categories while file not loaded. * Fix Darunia's Joy check not marking in vanilla. * Fix autosave not triggering change from collected to saved in tracker data. * Changed default colors for scummed and collected display. * Merge upgrade code cleanup. * Add `OnTransitionEnd` calls to sandstorm transitions both to and from Wasteland. Also improved `gSaveContext.lastScene` assignment for both transition types. Allowed a bit of cleanup in `GetCheckArea`. * Added `StateButton`, a button like `ArrowButton` but that allows text instead of arrow icons. Apparently the changes from ArrowButton to StateButton happened in a previous commit... * Changed section name to `trackerDataCheck` to force SoH to load it after the randomizer section, as it required some randoSettings to be loaded first, and nothing else I tried to make the randomizer section load before it worked. This hacks a solution to checks not displaying on fast file load to a specific slot. F*** you, SaveManager, and f*** you too, JSON. * Forgot to change the section string for loading with the name change. * Fix check ordering for checks that trigger the autosave. * Adds option to remove right-side shop items (slots 1-4) from the tracker list. Enabled by default. * Fix default state of Hide Shop Right Checks checkbox. * Fixes grotto and great fairy scrolling and checks. Fixes array overflow from `checkTrackerData` which was creating the issue trying to load the base and randomizer sections first, among other things. That also fixed the massive file loads that were being exhibited in debug mode. * Fix shooting galleries being set as collected again when being played a second time after getting the checks. * Fix Bazaar autoscroll. * Add Saria's Song to `GetCheckFromActor` and removed some limitations from the messageCloseCheck function to make that check track properly. * Fix Song from Impa check. Implemented prevention for multiple "collections" of great fairies, just in case getting the health refill would trigger it with the previous setup. * Fix ice traps on GS tokens not triggering OnItemReceive. * Complete fix for ice trap collection from GS. Add autoscroll when clicking "Expand All". * Add `OnShopSlotChange` with cursorSlot and basePrice parameters. * Fixed include in en_ossan for shop slot hook. Added registration for `OnShopSlotChange` in the tracker, storing the price in a new `price` field in `CheckTrackerData`. Added "seen" functionality to shop checks. Displays the model item name upon first entering a shop, adding the price and switching to trickName (if it's an ice trap) upon navigating to the slot in buy mode, triggered by an invisible "identified" status that mirrors "seen" in every other way. Added tooltips to most options for check tracker color picking to describe what each status actually means. * `std::format` pls * So apparently std::format just decided to break with the latest merge from develop, but fmt::format exists and works? * Removed the last vestiges of `locationsSkipped`. Other general code and formatting cleanups. Moved `IsGameRunning` to `OTRGlobals` so the item tracker could also access it. Used preceding to "fix" item and bottle display in the item tracker on startup. * Some more code cleanup. Removed "Recheck Area" button and relevant code. Backported changes to Anchor branch applicable for single-player, including making a checkAreas vector and structuring the frame by frame checks around that. Also includes fix for Silver Gauntlets and Mirror Shield check collection crash associated with those changes. Fixed Kakariko Bazaar "seen" updates. Fixed tracker window not showing on initial load like it should. * Forgot 1 formatting fix. * Removed conditions for showing Song from Impa (isn't junk under certain conditions, so should show all the time). * Fix vanilla checks, add Zelda's Letter and Malon's Egg to manual check collection. Fix autoscroll while in child stealth section. * Fix crash in Happy Mask Shop in OnSlotChange (referenced non-existent shop id in a tracker-specific enum). * General code cleanup. * Missed one reversion. * One more. * Fix column alignment in `randomizer_check_objects`. * Fix file encoding on `randomizer_check_tracker`. Again. * Fix indentation for `actualItemtrackerItemMap`. Also removed unnecessary parts of the map. * Rename `HasEqItem` to `HasEquipment`. * Slightly better indentation for `actualItemTrackerItemMap`. * Add magic bean salesman to vanilla check tracking, and genericized deku shield to trigger KF shop item 3 wherever you get the shield. Renamed `vanillaCheck` to `vanillaHundoCheck` to (supposedly) clarify the meaning of the usage. * One more rename to `vanillaCompletion` to avoid possible confusion with 100% speedrun conditions. * give me a break XD Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * Changes suggested by briaguya (rename `RandomizerCheckShow` to `Status`, unused code, newline formatting) * Remove unused `itemNames` table. * Remove `IsGameRunning` in favor of `GameInteractor::IsSaveLoaded`. * Restore anti-spoiler functionality for dungeons with dungeon maps. * Review cleanup. * Fix prices not showing for Kak bazaar items. --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com>
2023-10-04 11:03:36 -04:00
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnExitGame>([](uint32_t fileNum) {
Randomizer Auto Location tracker (#1942) * Initial Auto-Location Tracking * Updates styling for checked items in Check Tracker * Fixes crashing issues with Check Tracker rendering * Auto scroll Check Tracker windows to current area * Checks Tracker only shows checked locations once in game * Fixes issue where Check Tracker would auto-scroll to wrong location when entering a grotto * Fixes gerudo fortress checks showing in tracker when settings have them removed * InfTable Check Location Fixes: Lost Dog Richard, Rolling Gorons, HBA 1000, Thawed Zora * Fixes most Event Chk Inf Checks on Check Tracker, and Frogs * Check Tracker - Song from Malon now works * Check Tracker - Fixes Claim Check check not tracking - Fixes spoiler for Claim Check check when getting Biggoron's Sword - Fixes LACS being spoiled and not tracking * Check Tracker - Fixes #2 for Skull Mask and Mask of Truth checks * Check Tracker - Adds support for merchants - Fixes #7 for Bomchu Salesman - Fixes #12 for Medigoron * Check Tracker - Fixes #8 for Song from Saria * Check Tracker - Fixes #9 for Adult Shooting Gallery * Check Tracker - Fixes #10 for Composer Grave * Check Tracker - Fixes #14 for Song from Ocarina of Time * Check Tracker - Fixes #16 for Shooting the Sun * Check Tracker - Fixes #19 for Darunia's Joy * Save Editor - Adds missing label for Treasure Chest Game * Check Tracker - Fixes Great Faries checks * Check Tracker - Fixes Sheik at Temple * Check Tracker - Fixes Great Fairy auto-scroll to wrong location * Check Tracker - Updates blue warp checks - Fixes Bongo Bongo and Twinrova checks * Check Tracker - Fixes Dampe's Gravedigging Tour * Check Tracker - Fixes Prescription to King Zora * Check Tracker - Fixes Bazaar showing under wrong area on tracker between adult/child * Check Tracker - Fixes scroll for Hyrule Market and Bazaar * Check Tracker - Fixes giving Adult Trade Items shown on tracker: Broken Sword, Saw, Cojiro, Eyeball Froge, and Eyedrops * Cleans up item_location * Check Tracker - Item List - Fixes item list not updating when changing seeds/options - Separates item exclusion list from item check list - Clean up comments * Check Tracker - Adds Skip functionality to buttons * Check Tracker - Refactors adult trade items to RandomizerInf * Check Tracker - Fixes an issue where any time an item is removed the tracker would cause an application crash * Check Tracker - Item names are now dependent on file language * Check Tracker - Fixes Gerudo Card check not showing in Fast setting * Reorders headers to (hopefully) avoid CI build conflicts on linux/consoles * Explicitly defines vector header in randomizer.h to fix compile errors * Complete Refactor of Check Tracker ImGui * Adds missing check tracker files to CMakeLists * Reverts the Item_location whitespace cleanup from ad10807c * Check Tracker - Loading Fixes - Fixes a bug where loading a save file a second time would add all the checks again - Fixes a bug where the check tracker would not render at all until in a save file * Check Tracker - Fixes a bug where checks would sometimes fail to load * Check Tracker - Fixes duplicated checks when using Only on Pause or Only on Combo * Check Tracker - Works around issue where single characters don't show in EnhancementCombobox, and fixes a label for combo buttons held option * Check Tracker - Applies all Check Tracker changes to Item Location * Check Tracker - Updated Check List - Adds Link's pocket, either in KF or HM depending on starting age - Supports Scrubs and Merchants - Uses enums instead of magic numbers - Updates DC Scrub Short Names for MQ * Check Tracker - Adds a performance mode option * Check Tracker - List Fixes (requires new rando generation) - Fixes Frogs Rupees always visible - Fixes Kokiri Sword Chest not showing - Fixes Weird Egg not showing * Check Tracker - MQ List basic support * Check Tracker - MQ/Vanilla anti-spoilers * Check Tracker - Collecting a compass now spoils the area * Check Tracker - Basic Vanilla Support and fixes - Vanilla items show in check tracker, even if many won't auto check - Fixes an issue with Gerudo Fortress Keys - Refactors IsVisibleInCheckTracker to randomizer_check_tracjer * Check Tracker - Fixes merge conflict from 08a487f35e1d760ab9e69b932edbe4da6bcd9edb * Check Tracker - Fixes tracker loading as Floating when default value is set to Windowed * Randomizer Location Exclusion List - Adds Scrubs, Merchants, Shops. Adult Trade items, MQ Dungeons, and Bean Salesman - Fixes Kokiri Sword Chest, Weird Egg, and Frog Song Rupees from misbehaving - Updates Gerudo Fortress logic to be dependent on Open/Fast/Normal Fortress - Removes Invalid Check - Adds RO Enum for MQ settings - Updates magic values to RO enum * Location Exclusion List - Scrubs that are always randomized now always show on the list * For now, removes some extra code only needed for a Check Tracker. * Randomizer Location Exclusion List - Fixes Eyeball Frog from showing up when Adult Trade Items was off * Location Tracker - Updates Eyedrops to use RandomizerInf instead of Chest * Check Tracker - Fixes a bug where Link's Pocket item wasn't acting as checked for area item count * Check Tracker - Fixes a bug where Locations would incorrectly say Vanilla due to the first check in the area being a non-MQ check * Check Tracker - Fixes a crash when Check Tracker is docked but not visible * Check Tracker - Fixes areas being spoiled when loading different save files * Check Tracker - Only reset variables if they are initialized * Check Tracker - Cleans up old comments, unused variables, methods, and macros, adds language TODOs, * Check Tracker - Readds rainbow UI elements after Cosmetics Editor refactor * Check Tracker - Removal of flag lookup that was refactored, no longer needed header, and some trivial whitespace fixes. * Check Tracker - Refactors Index to Bitmask code to a macro * Check Tracker - Changes ordering from alphabetical to RandomizerCheck ordering * Check Tracker - Wraps everything in a namespace to avoid global variable usage * Check Tracker - Explicitly defines for-loop scope * Check Tracker - refactors dungeon lookup from static array to function * Fixes a bug when using EnhancementColor with alpha * Check Tracker - Refactors all colour to use direct conversions * Check Tracker - refactors settings loading and check visibility for readability * Check Tracker - Fixes a bug where the wrong label showed on the Check Tracker BG Color * UIWidgets - Adds Alpha bar to EnhancementColor when using alpha parameter
2022-12-10 22:39:23 -05:00
Teardown();
});
Check Tracker Update (#2668) * Initial commit. What works so far: Data file loads, saves, deletes, and is created properly. - Need to run `HasItemBeenCollected` when creating in case of mid-seed regen. Organized checks into maps set by area. Areas show in tracker. - Checks pulled from checkObjectsByArea are not currently listed. - Areas are being assumed completed and hidden at the start. * Checks now populate. Still not counting area totals properly. * Don't track RC_LINKS_POCKET in the data file, and instead manually add it in every time a save is load. rcObjects doesn't contain Link's Pocket location (duh). * Moved ItemReceive hook to randomizer_check_tracker.cpp. Skipped items are properly sorted and formatted. Saved items contribute to an area's gotten/skipped checks on load. Changed skipped items default main color to gray. General code cleanup. * Skipped checks now contribute to area totals for area completion logic. * Mid-menu rework transfer. * Started check lookup on item receive. Tried to enable scum checking on save. * Fixed scum check on save. * More code cleanup, which revealed some issues with loading and saving. Loading now works 100%, but entries in checkTrackerData are disappearing in code somewhere, causing issues with later checks. Scummed color now displays properly. Collected but unsaved displays properly. Unchecked, Skipped, Seen and Scummed checks all have arrows for skipping/unskipping. Counts a little messed up, probably double adding skips. * Fixed item counts being off across resets. Restarts were fine. * Beginning of rework for individual check updates. Adds `Actor lastCheck` to PlayState to allow assigning of last actor to give an item. This allows precise tracking of GS, freestanding PoH, etc. Works for chests too. Currently does not work for shops, unknown for normal NPC gives. Doesn't track last gives for non-checks, like drops from grass, pots, crates, etc. * Actor-based checks fully fleshed out, but can't help with sale-based checks. Implemented `pendingSaleCheck` to back out of an RC check cycle if `gSaveContext->pendingSale` is not NONE when `OnItemReceive` is called, processed through `OnSaleEnd`. This should be the final change necessary to streamline the checks. * Temporary hook to message box close to tie in trackers for non-gs/chest actors that aren't added to `GetCheckFromActor`. This triggers a 2-frame countdown to check with `HasItemBeenCollected` since half of the methods in there aren't updated until after a text box closes. Added scene tracking to get last scene so that checks in scenes that span several overworld areas could be tied to their areas properly. Modified tracker data creation to apply Link's Pocket and Song from Impa conditionally based on randomizer settings instead of just being assumed to be done. May need modification for checking click and drag spoiler loading. Removed the scene equivalence check from CheckChecks so that an entire area is checked each time to avoid issues with, e.g., leaving a shop before a pending sale finishes. * Changed check data creation to use RSKs from gRandomizer to account for settings loaded from drag and drop spoilers. * Beginning of tracker code organization. Changed check color defaults. * Reverted moving tracker colors to header. Some individual check fixes. * Missed something from previous merge? * Removed last remnant of removed performance mode. * Better handle checking when skullsanity is off. * Song checks sceneIDs don't match the scenes they're actually in for some reason. Removed that check. * SaleEnd checks don't need the GetItemEntry parameter. Also set a flag that should prevent the check tracker from running during vanilla saves should that not be resolved by the time it's merged. * Attempting to have only the relevant checks added to the tracker data, as well as showing vanilla checks for non-rando saves. Not working yet (everything is displayed in vanilla). * Added vanilla check tracker population via `vanillaCheck` bool in `RandomizerCheckObject`. This is also added to `IsVisibleInImGui` to handle file loading and saving to eliminate checks that aren't part of vanilla or the rando seed. Implemented deleted tracker data file recreation. Added some extra item name text checks. Songs are still... tricky, so they stay blank. Utilize local copies of the randomizer check objects that are applicable for performance purposes. Fixed vanilla item-giving cutscene crashes when triggered mid-transition. * Apparently not all toolchains can handle macro instantiation without all parameters, like VS can. * Fixed scummed detail color not showing properly on tracker. * Fixed dungeon area totals and GS checks not functioning properly. * Major revamp of checking code. Doesn't rely on `GetCheckFromActor` at all anymore, but instead simply sets a flag to evaluate a number of checks in an area every frame until the check that was gotten is identified. With the new setup, it's much less hardware intensive, and at 60fps 6 checks per frame shows no noticeable effect on framerate. I can envision needing to add a collectedCount in order to account for times when two checks are gotten one right after the other. Changed area scroll to happen from `OnTransitionEnd`, and allow for scrolling in bazaar (was disabled previously because it would jump back and forth between Kak and Market while you were in one). Also setup area check order updating by area instead of all at the same time. * Fixed shooting gallery not reporting proper area. Prevent checks from actually happening if area is RCAREA_INVALID, now that all areas are reporting something if they have checks. Fixed `GetCheckArea()` not updating checks for standard scenes. Lots of vanilla tracking updates, mainly manual checks for gems, medallions and songs, since the often don't have proper scenes in the data. Prevent vanilla from triggering check loops if junk items are collected. Fixed sorting based on saved vs collected. Prevent item name display for vanilla runs. Change coloring of checks so the check name reflects status in vanilla runs. * Fixed "Recheck Area" button erroneously adding to an area's check totals? * Fix DMC vanilla checks. * Fix check tracker data recreation on data file loss. Removed redundant file exists check from SaveTrackerDataHook, as it doesn't matter if it exists or not at that point. Limited check loops to 3 to avoid infinite check loops on non-check/junk item pickup. Added more checks to disable tracker operations if a save is not running. Changed check ordering to put boss reward and heart container checks at the end of whatever RCSHOW group they belong to. * Fixed IsRunning calculation. Further improving vanilla checking. Starting framework for checking medallions, stones, and songs on data file recreation. Fixed medallion check collection. Added GIFT_FROM_SAGES to check list for vanilla file for tracking light medallion. Added check loop limitation to prevent infinite checking after picking up junk item from the ground. * Finished vanilla file recreation and recheck (songs and dungeon rewards all check properly now). This includes deku shield with KF shop item 3. Finished Gift from Raoru light medallion tracking for vanilla. Commented all CheckByScene functionality for now. * Fixed new save data file creation. Disabled entrance area calculation for now, as it only tracks the previous entrance for some reason. Fixed area detection for ToT checks. * GetCheckArea() now utilizes EntranceData almost exclusively, via either `gSaveContext.entranceIndex` or the entrance tracker's `currentGrottoId` in the case of grottos. This also means that EVERYTHING CAN AUTOSCROLL NOW. Entrance shuffles are now much easier to track. Autoscroll is now also triggered on save, just in case someone isn't autosaving and has a lot of checks that get converted to saved. * Fixed missing GS check in LW. * Added area scroll on toggling Show Hidden Items. May configure differently later. Fixed area detection for entrances in Gerudo Fortress/Valley and Collossus. Haunted wasteland doesn't autoscroll due to a bug in `OnTransitionEnd` hook, but checks still evaluate properly there. Rely on scene-based area detection if scene is a main overworld or dungeon scene. * Fixed grotto detection when shuffle is off. * Small code cleanup. Fixed Colossus hand chest checks. * Missing lus bump from merge conflict resolution * Fixed Colossus Grotto making `GetCheckArea` return Wasteland. * Improved OnItemReceive processing for non-token GS checks, since they can sometimes take long enough for the checking process to time out before the item is registered as received. * First attempt at thread safety for tracker data file writing. Seems to work, but might need more testing. * Fixed Recheck Area not unskipping items that register as saved. Improved delayed saving with autosaving, as the autosave triggered quite often before the tracker data save, making things not properly register as saved. * merge cleanup * Converted check tracker data to the sectional saves, adding `CheckTrackerData` to `SaveContext`. Implemented section ID returning and fullSave boolean passing to section functions from my PR temporarily for it to work properly. Moved `RandomizerCheckTrackerData` enum to `randomizerTypes.h` to accommodate that. Changed `Randomizer_SaveInit` to a `SaveManager::InitFunc` to allow for other randomizer-dependent sections to be initialized after that. Required a little refactoring to maintain intro cutscene skip when starting a randomizer file. * Revert section index return and randomizer init changes. Will need to wait on yet more changes to main. * Fixed check tracker initialization (shouldn't be tied to window initialization), restored saving/loading functionality. * Removed `CheckTracker::Init` and put SaveManager calls in `CheckTrackerWindow::InitElement`. Also a bit of cleanup from transition back to save file use. * Fixed tracker displaying check categories while file not loaded. * Fix Darunia's Joy check not marking in vanilla. * Fix autosave not triggering change from collected to saved in tracker data. * Changed default colors for scummed and collected display. * Merge upgrade code cleanup. * Add `OnTransitionEnd` calls to sandstorm transitions both to and from Wasteland. Also improved `gSaveContext.lastScene` assignment for both transition types. Allowed a bit of cleanup in `GetCheckArea`. * Added `StateButton`, a button like `ArrowButton` but that allows text instead of arrow icons. Apparently the changes from ArrowButton to StateButton happened in a previous commit... * Changed section name to `trackerDataCheck` to force SoH to load it after the randomizer section, as it required some randoSettings to be loaded first, and nothing else I tried to make the randomizer section load before it worked. This hacks a solution to checks not displaying on fast file load to a specific slot. F*** you, SaveManager, and f*** you too, JSON. * Forgot to change the section string for loading with the name change. * Fix check ordering for checks that trigger the autosave. * Adds option to remove right-side shop items (slots 1-4) from the tracker list. Enabled by default. * Fix default state of Hide Shop Right Checks checkbox. * Fixes grotto and great fairy scrolling and checks. Fixes array overflow from `checkTrackerData` which was creating the issue trying to load the base and randomizer sections first, among other things. That also fixed the massive file loads that were being exhibited in debug mode. * Fix shooting galleries being set as collected again when being played a second time after getting the checks. * Fix Bazaar autoscroll. * Add Saria's Song to `GetCheckFromActor` and removed some limitations from the messageCloseCheck function to make that check track properly. * Fix Song from Impa check. Implemented prevention for multiple "collections" of great fairies, just in case getting the health refill would trigger it with the previous setup. * Fix ice traps on GS tokens not triggering OnItemReceive. * Complete fix for ice trap collection from GS. Add autoscroll when clicking "Expand All". * Add `OnShopSlotChange` with cursorSlot and basePrice parameters. * Fixed include in en_ossan for shop slot hook. Added registration for `OnShopSlotChange` in the tracker, storing the price in a new `price` field in `CheckTrackerData`. Added "seen" functionality to shop checks. Displays the model item name upon first entering a shop, adding the price and switching to trickName (if it's an ice trap) upon navigating to the slot in buy mode, triggered by an invisible "identified" status that mirrors "seen" in every other way. Added tooltips to most options for check tracker color picking to describe what each status actually means. * `std::format` pls * So apparently std::format just decided to break with the latest merge from develop, but fmt::format exists and works? * Removed the last vestiges of `locationsSkipped`. Other general code and formatting cleanups. Moved `IsGameRunning` to `OTRGlobals` so the item tracker could also access it. Used preceding to "fix" item and bottle display in the item tracker on startup. * Some more code cleanup. Removed "Recheck Area" button and relevant code. Backported changes to Anchor branch applicable for single-player, including making a checkAreas vector and structuring the frame by frame checks around that. Also includes fix for Silver Gauntlets and Mirror Shield check collection crash associated with those changes. Fixed Kakariko Bazaar "seen" updates. Fixed tracker window not showing on initial load like it should. * Forgot 1 formatting fix. * Removed conditions for showing Song from Impa (isn't junk under certain conditions, so should show all the time). * Fix vanilla checks, add Zelda's Letter and Malon's Egg to manual check collection. Fix autoscroll while in child stealth section. * Fix crash in Happy Mask Shop in OnSlotChange (referenced non-existent shop id in a tracker-specific enum). * General code cleanup. * Missed one reversion. * One more. * Fix column alignment in `randomizer_check_objects`. * Fix file encoding on `randomizer_check_tracker`. Again. * Fix indentation for `actualItemtrackerItemMap`. Also removed unnecessary parts of the map. * Rename `HasEqItem` to `HasEquipment`. * Slightly better indentation for `actualItemTrackerItemMap`. * Add magic bean salesman to vanilla check tracking, and genericized deku shield to trigger KF shop item 3 wherever you get the shield. Renamed `vanillaCheck` to `vanillaHundoCheck` to (supposedly) clarify the meaning of the usage. * One more rename to `vanillaCompletion` to avoid possible confusion with 100% speedrun conditions. * give me a break XD Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * Changes suggested by briaguya (rename `RandomizerCheckShow` to `Status`, unused code, newline formatting) * Remove unused `itemNames` table. * Remove `IsGameRunning` in favor of `GameInteractor::IsSaveLoaded`. * Restore anti-spoiler functionality for dungeons with dungeon maps. * Review cleanup. * Fix prices not showing for Kak bazaar items. --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com>
2023-10-04 11:03:36 -04:00
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnItemReceive>(CheckTrackerItemReceive);
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnGameFrameUpdate>(CheckTrackerFrame);
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnTransitionEnd>(CheckTrackerTransition);
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnShopSlotChange>(CheckTrackerShopSlotChange);
Flag tracker (#3447) * Hook into flagset hooks for processing check tracking. Has some manual workarounds (some breaks still need to be found). Remove areaChecks and looping functionality as redundant. * Additional vanilla handling. * Fix tracker not showing MQ checks in MQ non-rando. Fix tracker marking non-MQ variants of dungeon checks (e.g. map chest, etc) when collecting in MQ. * Set all areas to spoiled if not rando. * Revert attempt to spoil in randomizer based on MQ dungeon count as I don't know how that works at the moment. * Restore and update spoiling based on MQ dungeon settings (none, selection, or count of 12). Fix Anju As Adult check. * Remove Anchor-specific code :baguette: * Use `ClearAreaTotals()` in `Teardown()` instead of the duplicate code there. * Update to `ClearAreaChecksAndTotals()` with `vec.clear()` added. * Fix type spoiling again. Now spoils on 0 MQ dungeons, not rando, if the option is enabled in check tracker settings, selection, or set number of 12. Fix vanilla checks being marked collected in MQ dungeons. * Fix 100 GS check. * ACTUALLY fix 100 GS: change flag type to `RandomizerInf()` in `item_location.cpp`, add RC to RandoInf for it to the table. Also don't send GI for flag if father, falsely triggers ZR frogs minigame. * Fix gravedigging tour tracking. * Fix membership card check tracking. Change scene and flag values to any existing enums. Clarifying formatting for the checking loop vOrMQ conditions. * Fix Gravedigging Tour tracking. Simplify Always Win Gravedigging Tour and Fix Gravedigging Tour Glitch applications. Modified all necessary paths to use vanilla GDT PoH collection flag instead of randomizer variant. * Fix Kak Potion Shop being "seen" when entering as child.
2023-11-28 21:25:48 -05:00
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnSceneFlagSet>(CheckTrackerSceneFlagSet);
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnFlagSet>(CheckTrackerFlagSet);
Check Tracker Update (#2668) * Initial commit. What works so far: Data file loads, saves, deletes, and is created properly. - Need to run `HasItemBeenCollected` when creating in case of mid-seed regen. Organized checks into maps set by area. Areas show in tracker. - Checks pulled from checkObjectsByArea are not currently listed. - Areas are being assumed completed and hidden at the start. * Checks now populate. Still not counting area totals properly. * Don't track RC_LINKS_POCKET in the data file, and instead manually add it in every time a save is load. rcObjects doesn't contain Link's Pocket location (duh). * Moved ItemReceive hook to randomizer_check_tracker.cpp. Skipped items are properly sorted and formatted. Saved items contribute to an area's gotten/skipped checks on load. Changed skipped items default main color to gray. General code cleanup. * Skipped checks now contribute to area totals for area completion logic. * Mid-menu rework transfer. * Started check lookup on item receive. Tried to enable scum checking on save. * Fixed scum check on save. * More code cleanup, which revealed some issues with loading and saving. Loading now works 100%, but entries in checkTrackerData are disappearing in code somewhere, causing issues with later checks. Scummed color now displays properly. Collected but unsaved displays properly. Unchecked, Skipped, Seen and Scummed checks all have arrows for skipping/unskipping. Counts a little messed up, probably double adding skips. * Fixed item counts being off across resets. Restarts were fine. * Beginning of rework for individual check updates. Adds `Actor lastCheck` to PlayState to allow assigning of last actor to give an item. This allows precise tracking of GS, freestanding PoH, etc. Works for chests too. Currently does not work for shops, unknown for normal NPC gives. Doesn't track last gives for non-checks, like drops from grass, pots, crates, etc. * Actor-based checks fully fleshed out, but can't help with sale-based checks. Implemented `pendingSaleCheck` to back out of an RC check cycle if `gSaveContext->pendingSale` is not NONE when `OnItemReceive` is called, processed through `OnSaleEnd`. This should be the final change necessary to streamline the checks. * Temporary hook to message box close to tie in trackers for non-gs/chest actors that aren't added to `GetCheckFromActor`. This triggers a 2-frame countdown to check with `HasItemBeenCollected` since half of the methods in there aren't updated until after a text box closes. Added scene tracking to get last scene so that checks in scenes that span several overworld areas could be tied to their areas properly. Modified tracker data creation to apply Link's Pocket and Song from Impa conditionally based on randomizer settings instead of just being assumed to be done. May need modification for checking click and drag spoiler loading. Removed the scene equivalence check from CheckChecks so that an entire area is checked each time to avoid issues with, e.g., leaving a shop before a pending sale finishes. * Changed check data creation to use RSKs from gRandomizer to account for settings loaded from drag and drop spoilers. * Beginning of tracker code organization. Changed check color defaults. * Reverted moving tracker colors to header. Some individual check fixes. * Missed something from previous merge? * Removed last remnant of removed performance mode. * Better handle checking when skullsanity is off. * Song checks sceneIDs don't match the scenes they're actually in for some reason. Removed that check. * SaleEnd checks don't need the GetItemEntry parameter. Also set a flag that should prevent the check tracker from running during vanilla saves should that not be resolved by the time it's merged. * Attempting to have only the relevant checks added to the tracker data, as well as showing vanilla checks for non-rando saves. Not working yet (everything is displayed in vanilla). * Added vanilla check tracker population via `vanillaCheck` bool in `RandomizerCheckObject`. This is also added to `IsVisibleInImGui` to handle file loading and saving to eliminate checks that aren't part of vanilla or the rando seed. Implemented deleted tracker data file recreation. Added some extra item name text checks. Songs are still... tricky, so they stay blank. Utilize local copies of the randomizer check objects that are applicable for performance purposes. Fixed vanilla item-giving cutscene crashes when triggered mid-transition. * Apparently not all toolchains can handle macro instantiation without all parameters, like VS can. * Fixed scummed detail color not showing properly on tracker. * Fixed dungeon area totals and GS checks not functioning properly. * Major revamp of checking code. Doesn't rely on `GetCheckFromActor` at all anymore, but instead simply sets a flag to evaluate a number of checks in an area every frame until the check that was gotten is identified. With the new setup, it's much less hardware intensive, and at 60fps 6 checks per frame shows no noticeable effect on framerate. I can envision needing to add a collectedCount in order to account for times when two checks are gotten one right after the other. Changed area scroll to happen from `OnTransitionEnd`, and allow for scrolling in bazaar (was disabled previously because it would jump back and forth between Kak and Market while you were in one). Also setup area check order updating by area instead of all at the same time. * Fixed shooting gallery not reporting proper area. Prevent checks from actually happening if area is RCAREA_INVALID, now that all areas are reporting something if they have checks. Fixed `GetCheckArea()` not updating checks for standard scenes. Lots of vanilla tracking updates, mainly manual checks for gems, medallions and songs, since the often don't have proper scenes in the data. Prevent vanilla from triggering check loops if junk items are collected. Fixed sorting based on saved vs collected. Prevent item name display for vanilla runs. Change coloring of checks so the check name reflects status in vanilla runs. * Fixed "Recheck Area" button erroneously adding to an area's check totals? * Fix DMC vanilla checks. * Fix check tracker data recreation on data file loss. Removed redundant file exists check from SaveTrackerDataHook, as it doesn't matter if it exists or not at that point. Limited check loops to 3 to avoid infinite check loops on non-check/junk item pickup. Added more checks to disable tracker operations if a save is not running. Changed check ordering to put boss reward and heart container checks at the end of whatever RCSHOW group they belong to. * Fixed IsRunning calculation. Further improving vanilla checking. Starting framework for checking medallions, stones, and songs on data file recreation. Fixed medallion check collection. Added GIFT_FROM_SAGES to check list for vanilla file for tracking light medallion. Added check loop limitation to prevent infinite checking after picking up junk item from the ground. * Finished vanilla file recreation and recheck (songs and dungeon rewards all check properly now). This includes deku shield with KF shop item 3. Finished Gift from Raoru light medallion tracking for vanilla. Commented all CheckByScene functionality for now. * Fixed new save data file creation. Disabled entrance area calculation for now, as it only tracks the previous entrance for some reason. Fixed area detection for ToT checks. * GetCheckArea() now utilizes EntranceData almost exclusively, via either `gSaveContext.entranceIndex` or the entrance tracker's `currentGrottoId` in the case of grottos. This also means that EVERYTHING CAN AUTOSCROLL NOW. Entrance shuffles are now much easier to track. Autoscroll is now also triggered on save, just in case someone isn't autosaving and has a lot of checks that get converted to saved. * Fixed missing GS check in LW. * Added area scroll on toggling Show Hidden Items. May configure differently later. Fixed area detection for entrances in Gerudo Fortress/Valley and Collossus. Haunted wasteland doesn't autoscroll due to a bug in `OnTransitionEnd` hook, but checks still evaluate properly there. Rely on scene-based area detection if scene is a main overworld or dungeon scene. * Fixed grotto detection when shuffle is off. * Small code cleanup. Fixed Colossus hand chest checks. * Missing lus bump from merge conflict resolution * Fixed Colossus Grotto making `GetCheckArea` return Wasteland. * Improved OnItemReceive processing for non-token GS checks, since they can sometimes take long enough for the checking process to time out before the item is registered as received. * First attempt at thread safety for tracker data file writing. Seems to work, but might need more testing. * Fixed Recheck Area not unskipping items that register as saved. Improved delayed saving with autosaving, as the autosave triggered quite often before the tracker data save, making things not properly register as saved. * merge cleanup * Converted check tracker data to the sectional saves, adding `CheckTrackerData` to `SaveContext`. Implemented section ID returning and fullSave boolean passing to section functions from my PR temporarily for it to work properly. Moved `RandomizerCheckTrackerData` enum to `randomizerTypes.h` to accommodate that. Changed `Randomizer_SaveInit` to a `SaveManager::InitFunc` to allow for other randomizer-dependent sections to be initialized after that. Required a little refactoring to maintain intro cutscene skip when starting a randomizer file. * Revert section index return and randomizer init changes. Will need to wait on yet more changes to main. * Fixed check tracker initialization (shouldn't be tied to window initialization), restored saving/loading functionality. * Removed `CheckTracker::Init` and put SaveManager calls in `CheckTrackerWindow::InitElement`. Also a bit of cleanup from transition back to save file use. * Fixed tracker displaying check categories while file not loaded. * Fix Darunia's Joy check not marking in vanilla. * Fix autosave not triggering change from collected to saved in tracker data. * Changed default colors for scummed and collected display. * Merge upgrade code cleanup. * Add `OnTransitionEnd` calls to sandstorm transitions both to and from Wasteland. Also improved `gSaveContext.lastScene` assignment for both transition types. Allowed a bit of cleanup in `GetCheckArea`. * Added `StateButton`, a button like `ArrowButton` but that allows text instead of arrow icons. Apparently the changes from ArrowButton to StateButton happened in a previous commit... * Changed section name to `trackerDataCheck` to force SoH to load it after the randomizer section, as it required some randoSettings to be loaded first, and nothing else I tried to make the randomizer section load before it worked. This hacks a solution to checks not displaying on fast file load to a specific slot. F*** you, SaveManager, and f*** you too, JSON. * Forgot to change the section string for loading with the name change. * Fix check ordering for checks that trigger the autosave. * Adds option to remove right-side shop items (slots 1-4) from the tracker list. Enabled by default. * Fix default state of Hide Shop Right Checks checkbox. * Fixes grotto and great fairy scrolling and checks. Fixes array overflow from `checkTrackerData` which was creating the issue trying to load the base and randomizer sections first, among other things. That also fixed the massive file loads that were being exhibited in debug mode. * Fix shooting galleries being set as collected again when being played a second time after getting the checks. * Fix Bazaar autoscroll. * Add Saria's Song to `GetCheckFromActor` and removed some limitations from the messageCloseCheck function to make that check track properly. * Fix Song from Impa check. Implemented prevention for multiple "collections" of great fairies, just in case getting the health refill would trigger it with the previous setup. * Fix ice traps on GS tokens not triggering OnItemReceive. * Complete fix for ice trap collection from GS. Add autoscroll when clicking "Expand All". * Add `OnShopSlotChange` with cursorSlot and basePrice parameters. * Fixed include in en_ossan for shop slot hook. Added registration for `OnShopSlotChange` in the tracker, storing the price in a new `price` field in `CheckTrackerData`. Added "seen" functionality to shop checks. Displays the model item name upon first entering a shop, adding the price and switching to trickName (if it's an ice trap) upon navigating to the slot in buy mode, triggered by an invisible "identified" status that mirrors "seen" in every other way. Added tooltips to most options for check tracker color picking to describe what each status actually means. * `std::format` pls * So apparently std::format just decided to break with the latest merge from develop, but fmt::format exists and works? * Removed the last vestiges of `locationsSkipped`. Other general code and formatting cleanups. Moved `IsGameRunning` to `OTRGlobals` so the item tracker could also access it. Used preceding to "fix" item and bottle display in the item tracker on startup. * Some more code cleanup. Removed "Recheck Area" button and relevant code. Backported changes to Anchor branch applicable for single-player, including making a checkAreas vector and structuring the frame by frame checks around that. Also includes fix for Silver Gauntlets and Mirror Shield check collection crash associated with those changes. Fixed Kakariko Bazaar "seen" updates. Fixed tracker window not showing on initial load like it should. * Forgot 1 formatting fix. * Removed conditions for showing Song from Impa (isn't junk under certain conditions, so should show all the time). * Fix vanilla checks, add Zelda's Letter and Malon's Egg to manual check collection. Fix autoscroll while in child stealth section. * Fix crash in Happy Mask Shop in OnSlotChange (referenced non-existent shop id in a tracker-specific enum). * General code cleanup. * Missed one reversion. * One more. * Fix column alignment in `randomizer_check_objects`. * Fix file encoding on `randomizer_check_tracker`. Again. * Fix indentation for `actualItemtrackerItemMap`. Also removed unnecessary parts of the map. * Rename `HasEqItem` to `HasEquipment`. * Slightly better indentation for `actualItemTrackerItemMap`. * Add magic bean salesman to vanilla check tracking, and genericized deku shield to trigger KF shop item 3 wherever you get the shield. Renamed `vanillaCheck` to `vanillaHundoCheck` to (supposedly) clarify the meaning of the usage. * One more rename to `vanillaCompletion` to avoid possible confusion with 100% speedrun conditions. * give me a break XD Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * Changes suggested by briaguya (rename `RandomizerCheckShow` to `Status`, unused code, newline formatting) * Remove unused `itemNames` table. * Remove `IsGameRunning` in favor of `GameInteractor::IsSaveLoaded`. * Restore anti-spoiler functionality for dungeons with dungeon maps. * Review cleanup. * Fix prices not showing for Kak bazaar items. --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com>
2023-10-04 11:03:36 -04:00
hideShopRightChecks = CVarGetInteger("gCheckTrackerOptionHideRightShopChecks", 1);
alwaysShowGS = CVarGetInteger("gCheckTrackerOptionAlwaysShowGSLocs", 0);
Randomizer Auto Location tracker (#1942) * Initial Auto-Location Tracking * Updates styling for checked items in Check Tracker * Fixes crashing issues with Check Tracker rendering * Auto scroll Check Tracker windows to current area * Checks Tracker only shows checked locations once in game * Fixes issue where Check Tracker would auto-scroll to wrong location when entering a grotto * Fixes gerudo fortress checks showing in tracker when settings have them removed * InfTable Check Location Fixes: Lost Dog Richard, Rolling Gorons, HBA 1000, Thawed Zora * Fixes most Event Chk Inf Checks on Check Tracker, and Frogs * Check Tracker - Song from Malon now works * Check Tracker - Fixes Claim Check check not tracking - Fixes spoiler for Claim Check check when getting Biggoron's Sword - Fixes LACS being spoiled and not tracking * Check Tracker - Fixes #2 for Skull Mask and Mask of Truth checks * Check Tracker - Adds support for merchants - Fixes #7 for Bomchu Salesman - Fixes #12 for Medigoron * Check Tracker - Fixes #8 for Song from Saria * Check Tracker - Fixes #9 for Adult Shooting Gallery * Check Tracker - Fixes #10 for Composer Grave * Check Tracker - Fixes #14 for Song from Ocarina of Time * Check Tracker - Fixes #16 for Shooting the Sun * Check Tracker - Fixes #19 for Darunia's Joy * Save Editor - Adds missing label for Treasure Chest Game * Check Tracker - Fixes Great Faries checks * Check Tracker - Fixes Sheik at Temple * Check Tracker - Fixes Great Fairy auto-scroll to wrong location * Check Tracker - Updates blue warp checks - Fixes Bongo Bongo and Twinrova checks * Check Tracker - Fixes Dampe's Gravedigging Tour * Check Tracker - Fixes Prescription to King Zora * Check Tracker - Fixes Bazaar showing under wrong area on tracker between adult/child * Check Tracker - Fixes scroll for Hyrule Market and Bazaar * Check Tracker - Fixes giving Adult Trade Items shown on tracker: Broken Sword, Saw, Cojiro, Eyeball Froge, and Eyedrops * Cleans up item_location * Check Tracker - Item List - Fixes item list not updating when changing seeds/options - Separates item exclusion list from item check list - Clean up comments * Check Tracker - Adds Skip functionality to buttons * Check Tracker - Refactors adult trade items to RandomizerInf * Check Tracker - Fixes an issue where any time an item is removed the tracker would cause an application crash * Check Tracker - Item names are now dependent on file language * Check Tracker - Fixes Gerudo Card check not showing in Fast setting * Reorders headers to (hopefully) avoid CI build conflicts on linux/consoles * Explicitly defines vector header in randomizer.h to fix compile errors * Complete Refactor of Check Tracker ImGui * Adds missing check tracker files to CMakeLists * Reverts the Item_location whitespace cleanup from ad10807c * Check Tracker - Loading Fixes - Fixes a bug where loading a save file a second time would add all the checks again - Fixes a bug where the check tracker would not render at all until in a save file * Check Tracker - Fixes a bug where checks would sometimes fail to load * Check Tracker - Fixes duplicated checks when using Only on Pause or Only on Combo * Check Tracker - Works around issue where single characters don't show in EnhancementCombobox, and fixes a label for combo buttons held option * Check Tracker - Applies all Check Tracker changes to Item Location * Check Tracker - Updated Check List - Adds Link's pocket, either in KF or HM depending on starting age - Supports Scrubs and Merchants - Uses enums instead of magic numbers - Updates DC Scrub Short Names for MQ * Check Tracker - Adds a performance mode option * Check Tracker - List Fixes (requires new rando generation) - Fixes Frogs Rupees always visible - Fixes Kokiri Sword Chest not showing - Fixes Weird Egg not showing * Check Tracker - MQ List basic support * Check Tracker - MQ/Vanilla anti-spoilers * Check Tracker - Collecting a compass now spoils the area * Check Tracker - Basic Vanilla Support and fixes - Vanilla items show in check tracker, even if many won't auto check - Fixes an issue with Gerudo Fortress Keys - Refactors IsVisibleInCheckTracker to randomizer_check_tracjer * Check Tracker - Fixes merge conflict from 08a487f35e1d760ab9e69b932edbe4da6bcd9edb * Check Tracker - Fixes tracker loading as Floating when default value is set to Windowed * Randomizer Location Exclusion List - Adds Scrubs, Merchants, Shops. Adult Trade items, MQ Dungeons, and Bean Salesman - Fixes Kokiri Sword Chest, Weird Egg, and Frog Song Rupees from misbehaving - Updates Gerudo Fortress logic to be dependent on Open/Fast/Normal Fortress - Removes Invalid Check - Adds RO Enum for MQ settings - Updates magic values to RO enum * Location Exclusion List - Scrubs that are always randomized now always show on the list * For now, removes some extra code only needed for a Check Tracker. * Randomizer Location Exclusion List - Fixes Eyeball Frog from showing up when Adult Trade Items was off * Location Tracker - Updates Eyedrops to use RandomizerInf instead of Chest * Check Tracker - Fixes a bug where Link's Pocket item wasn't acting as checked for area item count * Check Tracker - Fixes a bug where Locations would incorrectly say Vanilla due to the first check in the area being a non-MQ check * Check Tracker - Fixes a crash when Check Tracker is docked but not visible * Check Tracker - Fixes areas being spoiled when loading different save files * Check Tracker - Only reset variables if they are initialized * Check Tracker - Cleans up old comments, unused variables, methods, and macros, adds language TODOs, * Check Tracker - Readds rainbow UI elements after Cosmetics Editor refactor * Check Tracker - Removal of flag lookup that was refactored, no longer needed header, and some trivial whitespace fixes. * Check Tracker - Refactors Index to Bitmask code to a macro * Check Tracker - Changes ordering from alphabetical to RandomizerCheck ordering * Check Tracker - Wraps everything in a namespace to avoid global variable usage * Check Tracker - Explicitly defines for-loop scope * Check Tracker - refactors dungeon lookup from static array to function * Fixes a bug when using EnhancementColor with alpha * Check Tracker - Refactors all colour to use direct conversions * Check Tracker - refactors settings loading and check visibility for readability * Check Tracker - Fixes a bug where the wrong label showed on the Check Tracker BG Color * UIWidgets - Adds Alpha bar to EnhancementColor when using alpha parameter
2022-12-10 22:39:23 -05:00
LocationTable_Init();
}
} // namespace CheckTracker