diff --git a/UnleashedRecomp/ui/imgui_utils.h b/UnleashedRecomp/ui/imgui_utils.h index 1fd6b755..e5767290 100644 --- a/UnleashedRecomp/ui/imgui_utils.h +++ b/UnleashedRecomp/ui/imgui_utils.h @@ -369,29 +369,18 @@ inline void DrawCentredParagraph(const ImFont* font, float fontSize, float maxWi auto paragraphSize = MeasureCentredParagraph(font, fontSize, lineMargin, lines); auto offsetY = 0.0f; - auto hasList = std::strstr(text, "- "); - auto isList = false; - auto listOffsetX = 0.0f; - for (int i = 0; i < lines.size(); i++) { auto& str = lines[i]; auto textSize = font->CalcTextSizeA(fontSize, FLT_MAX, 0, str.c_str()); - if (hasList) - { - if (!isList && str.starts_with("- ") && lines.size() > i + 1 && lines[i + 1].starts_with("- ")) - { - isList = true; - listOffsetX = centre.x - textSize.x / 2; - } - else if (isList && !str.starts_with("- ")) - { - isList = false; - } - } + auto textX = str.starts_with("- ") + ? centre.x - paragraphSize.x / 2 + : centre.x - textSize.x / 2; - drawMethod(str.c_str(), ImVec2(/* X */ isList ? listOffsetX : centre.x - textSize.x / 2, /* Y */ centre.y - paragraphSize.y / 2 + offsetY)); + auto textY = centre.y - paragraphSize.y / 2 + offsetY; + + drawMethod(str.c_str(), { textX, textY }); offsetY += textSize.y + Scale(lineMargin); }