Changed the tagname to match the values in settings.cfg

Changed the values from int to float in settings.cfg. This is consistent with the older format.

The prefix is no longer referenced and hardcoded. There were four original values in the old color format, the parsing had to be modified to account for floats and four values.
pull/3236/head
Kagernac 7 months ago
parent 3e6ccfce1f
commit aca39c919f

@ -61,25 +61,24 @@ namespace Gui
} }
else if (tag.starts_with(fontcolouroptional)) else if (tag.starts_with(fontcolouroptional))
{ {
std::string settingprefix = "color topic ";
std::string_view category = "GUI"; std::string_view category = "GUI";
settingprefix += tag.substr(fontcolouroptional.length()); std::string colortag = "";
std::replace(settingprefix.begin(), settingprefix.end(), '_', ' '); colortag += tag.substr(fontcolouroptional.length());
std::string str = Settings::Manager::getString(settingprefix, category); std::string str = Settings::Manager::getString(colortag, category);
if (str.empty()) if (str.empty())
throw std::runtime_error("Unable to map setting to value: " + settingprefix); throw std::runtime_error("Unable to map setting to value: " + colortag);
std::string ret[3]; std::string ret[4];
unsigned int j = 0; unsigned int j = 0;
for (unsigned int i = 0; i < str.length(); ++i) for (unsigned int i = 0; i < str.length(); ++i)
{ {
if (str[i] == ',') if (str[i] == ' ')
j++; j++;
else if (str[i] != ' ') else if (str[i] != ' ')
ret[j] += str[i]; ret[j] += str[i];
} }
MyGUI::Colour col(MyGUI::utility::parseInt(ret[0]) / 255.f, MyGUI::utility::parseInt(ret[1]) / 255.f, MyGUI::Colour col(MyGUI::utility::parseFloat(ret[0]), MyGUI::utility::parseFloat(ret[1]),
MyGUI::utility::parseInt(ret[2]) / 255.f); MyGUI::utility::parseFloat(ret[2]), MyGUI::utility::parseFloat(ret[3]));
out = col.print(); out = col.print();
return true; return true;
} }

@ -129,9 +129,9 @@
<Property key="TextAlign" value="Left VCenter"/> <Property key="TextAlign" value="Left VCenter"/>
<BasisSkin type="SimpleText" offset="2 0 1 5" align="Stretch"> <BasisSkin type="SimpleText" offset="2 0 1 5" align="Stretch">
<State name="normal" colour="#{fontcolouroptional=specific}"/> <State name="normal" colour="#{fontcolouroptional=color topic specific}"/>
<State name="highlighted" colour="#{fontcolouroptional=specific_over}"/> <State name="highlighted" colour="#{fontcolouroptional=color topic specific over}"/>
<State name="pushed" colour="#{fontcolouroptional=specific_pressed}"/> <State name="pushed" colour="#{fontcolouroptional=color topic specific pressed}"/>
</BasisSkin> </BasisSkin>
</Resource> </Resource>
@ -140,9 +140,9 @@
<Property key="TextAlign" value="Left VCenter"/> <Property key="TextAlign" value="Left VCenter"/>
<BasisSkin type="SimpleText" offset="2 0 1 5" align="Stretch"> <BasisSkin type="SimpleText" offset="2 0 1 5" align="Stretch">
<State name="normal" colour="#{fontcolouroptional=exhausted}"/> <State name="normal" colour="#{fontcolouroptional=color topic exhausted}"/>
<State name="highlighted" colour="#{fontcolouroptional=exhausted_over}"/> <State name="highlighted" colour="#{fontcolouroptional=color topic exhausted over}"/>
<State name="pushed" colour="#{fontcolouroptional=exhausted_pressed}"/> <State name="pushed" colour="#{fontcolouroptional=color topic exhausted pressed}"/>
</BasisSkin> </BasisSkin>
</Resource> </Resource>

@ -220,17 +220,17 @@ color topic enable = false
# The color of dialogue topic keywords that gives unique actor responses # The color of dialogue topic keywords that gives unique actor responses
# Format (R,G,B) (255,255,255) or empty for no special formatting # Format (R,G,B) (255,255,255) or empty for no special formatting
# Default to blue # Default to blue
color topic specific = 112,126,207 color topic specific = 0.45 0.5 0.8 1
color topic specific over = 143,155,218 color topic specific over = 0.58 0.62 0.85 1
color topic specific pressed = 175,184,228 color topic specific pressed = 0.29 0.36 0.75 1
# The color of dialogue topic keywords that gives already read responses # The color of dialogue topic keywords that gives already read responses
# Format (R,G,B) (255,255,255) or empty for no special formatting # Format (R,G,B) (255,255,255) or empty for no special formatting
# Default to grey # Default to grey
color topic exhausted = 103,103,111 color topic exhausted = 0.3 0.3 0.3 1
color topic exhausted over = 170,170,188 color topic exhausted over = 0.56 0.56 0.56 1
color topic exhausted pressed= 69,69,85 color topic exhausted pressed= 0.44 0.44 0.44 1
[HUD] [HUD]

Loading…
Cancel
Save