Skip to content

PokemonLZA AutoStory: dialog, choice, Confirm Choices and objective marker readers - #557

Draft
dayfine wants to merge 7 commits into
plza/upstream/p1-02from
plza/upstream/p1-03
Draft

dayfine wants to merge 7 commits into
plza/upstream/p1-02from
plza/upstream/p1-03

Conversation

@dayfine

@dayfine dayfine commented Nov 15, 2026 •

Copy link
Copy Markdown
Owner

Depends on #556

Adds the AutoStory readers for text and choices: the dialog box while its text is still typing (DialogDetector::detect_box()), the choice menu and its highlighted row, the new game's "Confirm Choices" screen, the objective marker on the minimap, the tutorial card and the Pokedex "Registered" banner. The screen events (#558), dialogs (#559) and catches (#564) call them. Tested by PokemonLZA::AutoStoryDialogChoiceBox, AutoStoryConfirmChoicesReader and AutoStoryObjectiveMarkerReader, on drawn frames and on console frames (the AutoStoryConfirmChoices and AutoStoryDialogChoices folders are not on PokemonAutomation/CommandLineTests yet).

@dayfine

dayfine commented Nov 15, 2026

Copy link
Copy Markdown
Owner Author

API review (claude-sonnet-5-5) at df1065e: changes_requested

The readers are tidy and the synthetic cases check out against the thresholds. The main problem is that the console-frame tests are registered unconditionally while their fixtures are not in CommandLineTests yet. The rest are style items: a new -1 sentinel, a comment that disagrees with the code, undocumented thresholds, and untested new detectors.

  • [bug] SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/Detectors/PokemonLZA_AutoStoryConfirmChoicesReader_Tests.cpp:241 Test_ConfirmChoicesFrames (and Test_DialogChoiceRowsFrame for AutoStoryDialogChoices/elevator_3rows_row0.png) are registered unconditionally, but the PR says those image folders are not on CommandLineTests yet. ImageUnitTest normally fails when it cannot load an image, so the command-line test run goes red on this PR (11 cases across the two tests). Fix: Land the fixtures in PokemonAutomation/CommandLineTests first, or make these cases skip when the file is missing, as Test_ConfirmChoicesCapture already does with UnitTestResult::SKIPPED.
  • [style] SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/Detectors/PokemonLZA_AutoStoryObjectiveMarkerReader.h:25 New API with a sentinel: ObjectiveMarker::distance = -1 means "the digits did not read", and every caller must remember to test it. Fix: Use std::optional<int> distance;, and convert OCR's -1 to nullopt in read_objective_marker().
  • [nit] SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/Detectors/PokemonLZA_AutoStoryObjectiveMarkerReader.cpp:39 The comment above says the minimap is a circle of radius 125, but the code tests < 140 * 140. The other literals (500, 4000, 0.6/1.4, 0.70) also have no stated reason. Fix: Add a named MINIMAP_RADIUS (or fix the comment to say why 140 gives margin over 125). Name the area limits and the party-bar cutoff as constants with one-line why-comments.
  • [nit] SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/Detectors/PokemonLZA_AutoStoryDexRegisteredDetector.cpp:30 The thresholds 0.6 / 0.4 / 0.4 / 0.08 are unexplained, and the left and right arcs use different cutoffs with no reason given. The header comment, "matched its 2 frames and none of 553 other console frames", is a tuning-run note, not a description of the code. Fix: Name the thresholds and say why the arcs differ. Move the tuning statistics to the PR description.
  • [style] SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/Detectors/PokemonLZA_AutoStoryTutorialCardDetector.cpp:21 tutorial_card_shows, DexRegisteredDetector and StoryDialogDetector (including BOX_ONLY) are new threshold logic with no tests, although the PR adds a test file for each of the other readers. The comment above tutorial_card_shows is also garbled ("9 other screens (...) on, at full resolution:"). Fix: Add synthetic cases (a bright panel over dark edges, and busy or bright edges) and a detect_box versus detect case. Fix the comment wording.
  • [nit] SerialPrograms/Source/VideoGames/PokemonLZA/PokemonLZA_Tests.cpp:25 Include order is off: AutoStoryDialogChoiceBox_Tests.h comes before AutoStoryDetectors_Tests.h, but alphabetically Detectors < DialogChoiceBox. The same misplacement applies to the new DialogDetector entries in SourceFiles.cmake, which sit before Detectors_Tests. Fix: Order the entries alphabetically: ConfirmChoices, Detectors_Tests, DialogChoiceBox, ObjectiveMarker. In SourceFiles.cmake: ControlsHint, Detectors_Tests, DexRegistered, DialogChoiceBox, DialogDetector.

…ng; comment fixes

Test_ConfirmChoicesFrames and Test_DialogChoiceRowsFrame register through
add_pending_fixture_test(), so a CommandLineTests checkout without the new
folders skips them. The minimap comment says why 140, the tutorial-card
comment reads as a sentence, and the Dex banner header drops its tuning
statistics.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant