diff --git a/src/Window.cpp b/src/Window.cpp index e843eca34..7a7b3be59 100644 --- a/src/Window.cpp +++ b/src/Window.cpp @@ -245,12 +245,36 @@ void Window::setHelpPrompts(const std::vector& prompts) std::vector addPrompts; - std::map seenMap; + std::map inputSeenMap; + std::map mappedToSeenMap; for(auto it = prompts.begin(); it != prompts.end(); it++) { // only add it if the same icon hasn't already been added - if(seenMap.insert(std::make_pair(it->first, true)).second) - addPrompts.push_back(*it); + if(inputSeenMap.insert(std::make_pair(it->first, true)).second) + { + // this symbol hasn't been seen yet, what about the action name? + auto mappedTo = mappedToSeenMap.find(it->second); + if(mappedTo != mappedToSeenMap.end()) + { + // yes, it has! + + // can we combine? (dpad only) + if((it->first == "up/down" && addPrompts.at(mappedTo->second).first == "left/right") || + (it->first == "left/right" && addPrompts.at(mappedTo->second).first == "up/down")) + { + // yes! + addPrompts.at(mappedTo->second).first = "up/down/left/right"; + // don't need to add this to addPrompts since we just merged + }else{ + // no, we can't combine! + addPrompts.push_back(*it); + } + }else{ + // no, it hasn't! + mappedToSeenMap.insert(std::pair(it->second, addPrompts.size())); + addPrompts.push_back(*it); + } + } } // sort prompts so it goes [dpad_all] [dpad_u/d] [dpad_l/r] [a/b/x/y/l/r] [start/select]