@@ -62,9 +62,9 @@ namespace RTE {
62
62
m_BlackColor = 245 ;
63
63
m_AlmostBlackColor = 245 ;
64
64
m_ColorTablePruneTimer.Reset ();
65
- m_GUIScreen = nullptr ;
66
- m_LargeFont = nullptr ;
67
- m_SmallFont = nullptr ;
65
+ m_GUIScreens. fill ( nullptr ) ;
66
+ m_LargeFonts. fill ( nullptr ) ;
67
+ m_SmallFonts. fill ( nullptr ) ;
68
68
m_TextBlinkTimer.Reset ();
69
69
70
70
for (int screenCount = 0 ; screenCount < c_MaxScreenCount; ++screenCount) {
@@ -187,10 +187,15 @@ namespace RTE {
187
187
// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
188
188
189
189
void FrameMan::Destroy () {
190
- delete m_GUIScreen;
191
- delete m_LargeFont;
192
- delete m_SmallFont;
193
-
190
+ for (const GUIScreen *guiScreen : m_GUIScreens) {
191
+ delete guiScreen;
192
+ }
193
+ for (const GUIFont *guiFont : m_LargeFonts) {
194
+ delete guiFont;
195
+ }
196
+ for (const GUIFont *guiFont : m_SmallFonts) {
197
+ delete guiFont;
198
+ }
194
199
Clear ();
195
200
}
196
201
@@ -326,7 +331,7 @@ namespace RTE {
326
331
// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
327
332
328
333
std::string FrameMan::SplitStringToFitWidth (const std::string &stringToSplit, int widthLimit, bool useSmallFont) {
329
- GUIFont *fontToUse = GetFont (useSmallFont);
334
+ GUIFont *fontToUse = GetFont (useSmallFont, false );
330
335
auto SplitSingleLineAsNeeded = [this , &widthLimit, &fontToUse](std::string &lineToSplitAsNeeded) {
331
336
int numberOfScreenWidthsForText = static_cast <int >(std::ceil (static_cast <float >(fontToUse->CalculateWidth (lineToSplitAsNeeded)) / static_cast <float >(widthLimit)));
332
337
if (numberOfScreenWidthsForText > 1 ) {
@@ -714,21 +719,39 @@ namespace RTE {
714
719
715
720
// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
716
721
717
- GUIFont * FrameMan::GetFont (bool isSmall) {
718
- if (!m_GUIScreen) { m_GUIScreen = new AllegroScreen (m_BackBuffer8.get ()); }
722
+ GUIFont * FrameMan::GetFont (bool isSmall, bool trueColor) {
723
+ size_t colorIndex = trueColor ? 1 : 0 ;
724
+
725
+ if (!m_GUIScreens[colorIndex]) {
726
+ m_GUIScreens[colorIndex] = new AllegroScreen (trueColor ? m_BackBuffer32.get () : m_BackBuffer8.get ());
727
+ }
719
728
720
729
if (isSmall) {
721
- if (!m_SmallFont) {
722
- m_SmallFont = new GUIFont (" SmallFont" );
723
- m_SmallFont->Load (m_GUIScreen, " Base.rte/GUIs/Skins/FontSmall.png" );
730
+ if (!m_SmallFonts[colorIndex]) {
731
+ std::string fontName = " SmallFont" ;
732
+ std::string fontPath = " Base.rte/GUIs/Skins/FontSmall.png" ;
733
+
734
+ if (trueColor) {
735
+ fontName = " SmallFont32" ;
736
+ fontPath = " Base.rte/GUIs/Skins/Menus/FontSmall.png" ;
737
+ }
738
+ m_SmallFonts[colorIndex] = new GUIFont (fontName);
739
+ m_SmallFonts[colorIndex]->Load (m_GUIScreens[colorIndex], fontPath);
724
740
}
725
- return m_SmallFont ;
741
+ return m_SmallFonts[colorIndex] ;
726
742
}
727
- if (!m_LargeFont) {
728
- m_LargeFont = new GUIFont (" FatFont" );
729
- m_LargeFont->Load (m_GUIScreen, " Base.rte/GUIs/Skins/FontLarge.png" );
743
+ if (!m_LargeFonts[colorIndex]) {
744
+ std::string fontName = " FatFont" ;
745
+ std::string fontPath = " Base.rte/GUIs/Skins/FontLarge.png" ;
746
+
747
+ if (trueColor) {
748
+ fontName = " FatFont32" ;
749
+ fontPath = " Base.rte/GUIs/Skins/Menus/FontLarge.png" ;
750
+ }
751
+ m_LargeFonts[colorIndex] = new GUIFont (fontName);
752
+ m_LargeFonts[colorIndex]->Load (m_GUIScreens[colorIndex], fontPath);
730
753
}
731
- return m_LargeFont ;
754
+ return m_LargeFonts[colorIndex] ;
732
755
}
733
756
734
757
// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
0 commit comments