diff --git a/soh/soh/Enhancements/custom-message/CustomMessageManager.cpp b/soh/soh/Enhancements/custom-message/CustomMessageManager.cpp index 0745c6fc0..b5e4163cd 100644 --- a/soh/soh/Enhancements/custom-message/CustomMessageManager.cpp +++ b/soh/soh/Enhancements/custom-message/CustomMessageManager.cpp @@ -353,6 +353,14 @@ void CustomMessage::AutoFormat() { } } +void CustomMessage::AutoFormat(ItemID iid) { + for (std::string &str : messages) { + str.insert(0, ITEM_OBTAINED(iid)); + } + AutoFormat(); + Replace(WAIT_FOR_INPUT(), WAIT_FOR_INPUT() + ITEM_OBTAINED(iid)); +} + void CustomMessage::Clean() { for (std::string& str : messages) { CleanString(str); @@ -408,7 +416,7 @@ static size_t NextLineLength(const std::string* textStr, const size_t lastNewlin // Skip over control codes if (textStr->at(currentPos) == '%') { nextPosJump = 2; - } else if (textStr->at(currentPos) == '$') { + } else if (textStr->at(currentPos) == '\x13') { nextPosJump = 2; } else if (textStr->at(currentPos) == '@') { nextPosJump = 1; @@ -512,7 +520,7 @@ void CustomMessage::AutoFormatString(std::string& str) const { ReplaceColors(str); // insert newlines either manually or when encountering a '&' size_t lastNewline = 0; - const bool hasIcon = str.find('$', 0) != std::string::npos; + const bool hasIcon = str.find('\x13') != std::string::npos; size_t lineLength = NextLineLength(&str, lastNewline, hasIcon); size_t lineCount = 1; size_t yesNo = str.find("\x1B"s[0], lastNewline); diff --git a/soh/soh/Enhancements/custom-message/CustomMessageManager.h b/soh/soh/Enhancements/custom-message/CustomMessageManager.h index 506c2c43c..943b18970 100644 --- a/soh/soh/Enhancements/custom-message/CustomMessageManager.h +++ b/soh/soh/Enhancements/custom-message/CustomMessageManager.h @@ -163,6 +163,7 @@ class CustomMessage { * textboxes, and use it's formatting. */ void AutoFormat(); + void AutoFormat(ItemID iid); /** * @brief Removes all OoT formatting from the message,