Skip to content

Commit e4d7d1f

Browse files
committed
Add overlays to outbreak finder.
1 parent 8914b83 commit e4d7d1f

File tree

4 files changed

+14
-5
lines changed

4 files changed

+14
-5
lines changed

SerialPrograms/Source/CommonFramework/Globals.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ namespace PokemonAutomation{
2525
const bool IS_BETA_VERSION = true;
2626
const int PROGRAM_VERSION_MAJOR = 0;
2727
const int PROGRAM_VERSION_MINOR = 50;
28-
const int PROGRAM_VERSION_PATCH = 11;
28+
const int PROGRAM_VERSION_PATCH = 12;
2929

3030
const std::string PROGRAM_VERSION_BASE =
3131
"v" + std::to_string(PROGRAM_VERSION_MAJOR) +

SerialPrograms/Source/PokemonLA/Inference/Map/PokemonLA_OutbreakReader.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ OutbreakReader::OutbreakReader(Logger& logger, Language language, VideoOverlay&
2424
, m_text_box(overlay, {0.050, 0.177, 0.200, 0.038})
2525
{}
2626

27+
void OutbreakReader::make_overlays(VideoOverlaySet& items) const{
28+
items.add(COLOR_RED, m_dialog_box0);
29+
items.add(COLOR_RED, m_dialog_box1);
30+
}
2731
OCR::StringMatchResult OutbreakReader::read(const ImageViewRGB32& screen) const{
2832
OCR::StringMatchResult result;
2933
ImageStats box0 = image_stats(extract_box_reference(screen, m_dialog_box0));

SerialPrograms/Source/PokemonLA/Inference/Map/PokemonLA_OutbreakReader.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ class OutbreakReader{
2323
public:
2424
OutbreakReader(Logger& logger, Language language, VideoOverlay& overlay);
2525

26+
void make_overlays(VideoOverlaySet& items) const;
2627
OCR::StringMatchResult read(const ImageViewRGB32& screen) const;
2728

2829

SerialPrograms/Source/PokemonLA/Programs/General/PokemonLA_OutbreakFinder.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,8 @@ std::set<std::string> OutbreakFinder::read_travel_map_outbreaks(
236236
){
237237
OutbreakFinder_Descriptor::Stats& stats = env.current_stats<OutbreakFinder_Descriptor::Stats>();
238238

239+
VideoOverlaySet overlays(env.console);
240+
239241
MapRegion start_region = MapRegion::NONE;
240242

241243
MapRegion current_region = detect_selected_region(env.console, context);
@@ -244,10 +246,13 @@ std::set<std::string> OutbreakFinder::read_travel_map_outbreaks(
244246
return std::set<std::string>();
245247
}
246248

249+
OutbreakReader reader(env.console, LANGUAGE, env.console);
250+
reader.make_overlays(overlays);
251+
247252
MMOQuestionMarkDetector question_mark_detector(env.logger());
248-
VideoOverlaySet mmo_overlay_set(env.console);
253+
// VideoOverlaySet mmo_overlay_set(env.console);
249254
std::array<bool, 5> mmo_appears = question_mark_detector.detect_MMO_on_hisui_map(env.console.video().snapshot());
250-
add_hisui_MMO_detection_to_overlay(mmo_appears, mmo_overlay_set);
255+
add_hisui_MMO_detection_to_overlay(mmo_appears, overlays);
251256

252257
// If the current region is a wild area, the yellow cursor may overlap with the MMO question marker, causing
253258
// wrong detection. So we have to check it's location again by moving the cursor to the next location
@@ -259,7 +264,7 @@ std::set<std::string> OutbreakFinder::read_travel_map_outbreaks(
259264
auto new_mmo_read = question_mark_detector.detect_MMO_on_hisui_map(env.console.video().snapshot());
260265
mmo_appears[current_wild_area_index] = new_mmo_read[current_wild_area_index];
261266
if (new_mmo_read[current_wild_area_index]){
262-
add_hisui_MMO_detection_to_overlay(mmo_appears, mmo_overlay_set);
267+
add_hisui_MMO_detection_to_overlay(mmo_appears, overlays);
263268
}
264269
// now mmo_appears should contain correct detection of MMO question marks.
265270
}
@@ -303,7 +308,6 @@ std::set<std::string> OutbreakFinder::read_travel_map_outbreaks(
303308
if (mmo_appears[wild_region_index]){
304309
env.log(std::string(MAP_REGION_NAMES[(int)current_region]) + " have MMO.", COLOR_ORANGE);
305310
}else{
306-
OutbreakReader reader(env.console, LANGUAGE, env.console);
307311
OCR::StringMatchResult result = reader.read(env.console.video().snapshot());
308312
if (!result.results.empty()){
309313
stats.outbreaks++;

0 commit comments

Comments
 (0)