Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,8 @@ bool BattleDialogDetector::detect(const ImageViewRGB32& screen){
ImageViewRGB32 dialog_top_image = extract_box_reference(screen, m_dialog_top_box);
ImageViewRGB32 dialog_right_image = extract_box_reference(screen, m_dialog_right_box);

if (is_solid(dialog_top_image, { 0.176, 0.357, 0.467 })
&& is_solid(dialog_right_image, { 0.176, 0.357, 0.467 })
if (is_solid(dialog_top_image, { 0.176, 0.357, 0.467 }, 0.25, 20)
&& is_solid(dialog_right_image, { 0.176, 0.357, 0.467 }, 0.25, 20)
){
return true;
}
Expand Down Expand Up @@ -162,10 +162,10 @@ bool BattleMenuDetector::detect(const ImageViewRGB32& screen){
ImageViewRGB32 dialog_top_image = extract_box_reference(screen, m_dialog_top_box);
ImageViewRGB32 dialog_right_image = extract_box_reference(screen, m_dialog_right_box);

if (is_solid(menu_top_image, { 0.335, 0.332, 0.335 }) //253, 251, 254 white
&& is_solid(menu_right_image, { 0.335, 0.332, 0.335 })
&& is_solid(dialog_top_image, { 0.176, 0.357, 0.467 }) //40, 81, 106 teal
&& is_solid(dialog_right_image, { 0.176, 0.357, 0.467 })
if (is_white(menu_top_image)
&& is_white(menu_right_image)
&& is_solid(dialog_top_image, { 0.176, 0.357, 0.467 }, 0.25, 20) //40, 81, 106 teal
&& is_solid(dialog_right_image, { 0.176, 0.357, 0.467 }, 0.25, 20)
){
return true;
}
Expand Down Expand Up @@ -203,8 +203,8 @@ bool AdvanceBattleDialogDetector::detect(const ImageViewRGB32& screen){
ImageViewRGB32 dialog_top_image = extract_box_reference(screen, m_dialog_top_box);
ImageViewRGB32 dialog_right_image = extract_box_reference(screen, m_dialog_right_box);

if (is_solid(dialog_top_image, { 0.176, 0.357, 0.467 })
&& is_solid(dialog_right_image, { 0.176, 0.357, 0.467 })
if (is_solid(dialog_top_image, { 0.176, 0.357, 0.467 }, 0.25, 20)
&& is_solid(dialog_right_image, { 0.176, 0.357, 0.467 }, 0.25, 20)
&& (stats.average.r > stats.average.b + 180)
&& (stats.average.r > stats.average.g + 180)
)
Expand Down
8 changes: 8 additions & 0 deletions SerialPrograms/Source/Tests/PokemonFRLG_Tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,12 @@ int test_pokemonFRLG_SelectionDialogDetector(const ImageViewRGB32& image, bool t
return 0;
}

int test_pokemonFRLG_AdvanceBattleDialogDetector(const ImageViewRGB32& image, bool target){
auto overlay = DummyVideoOverlay();
AdvanceBattleDialogDetector detector(COLOR_RED);
bool result = detector.detect(image);
TEST_RESULT_EQUAL(result, target);
return 0;
}

}
2 changes: 2 additions & 0 deletions SerialPrograms/Source/Tests/PokemonFRLG_Tests.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ int test_pokemonFRLG_ShinySymbolDetector(const ImageViewRGB32& image, bool targe

int test_pokemonFRLG_SelectionDialogDetector(const ImageViewRGB32& image, bool target);

int test_pokemonFRLG_AdvanceBattleDialogDetector(const ImageViewRGB32& image, bool target);

}

#endif
1 change: 1 addition & 0 deletions SerialPrograms/Source/Tests/TestMap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,7 @@ const std::map<std::string, TestFunction> TEST_MAP = {
{"PokemonFRLG_AdvanceWhiteDialogDetector", std::bind(image_bool_detector_helper, test_pokemonFRLG_AdvanceWhiteDialogDetector, _1)},
{"PokemonFRLG_ShinySymbolDetector", std::bind(image_bool_detector_helper, test_pokemonFRLG_ShinySymbolDetector, _1)},
{"PokemonFRLG_SelectionDialogDetector", std::bind(image_bool_detector_helper, test_pokemonFRLG_SelectionDialogDetector, _1)},
{"PokemonFRLG_AdvanceBattleDialogDetector", std::bind(image_bool_detector_helper, test_pokemonFRLG_AdvanceBattleDialogDetector, _1)},
};

TestFunction find_test_function(const std::string& test_space, const std::string& test_name){
Expand Down