@@ -62,9 +62,9 @@ namespace RTE {
6262 m_BlackColor = 245 ;
6363 m_AlmostBlackColor = 245 ;
6464 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 ) ;
6868 m_TextBlinkTimer.Reset ();
6969
7070 for (int screenCount = 0 ; screenCount < c_MaxScreenCount; ++screenCount) {
@@ -187,10 +187,15 @@ namespace RTE {
187187// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
188188
189189 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+ }
194199 Clear ();
195200 }
196201
@@ -326,7 +331,7 @@ namespace RTE {
326331 // ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
327332
328333 std::string FrameMan::SplitStringToFitWidth (const std::string &stringToSplit, int widthLimit, bool useSmallFont) {
329- GUIFont *fontToUse = GetFont (useSmallFont);
334+ GUIFont *fontToUse = GetFont (useSmallFont, false );
330335 auto SplitSingleLineAsNeeded = [this , &widthLimit, &fontToUse](std::string &lineToSplitAsNeeded) {
331336 int numberOfScreenWidthsForText = static_cast <int >(std::ceil (static_cast <float >(fontToUse->CalculateWidth (lineToSplitAsNeeded)) / static_cast <float >(widthLimit)));
332337 if (numberOfScreenWidthsForText > 1 ) {
@@ -714,21 +719,39 @@ namespace RTE {
714719
715720// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
716721
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+ }
719728
720729 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);
724740 }
725- return m_SmallFont ;
741+ return m_SmallFonts[colorIndex] ;
726742 }
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);
730753 }
731- return m_LargeFont ;
754+ return m_LargeFonts[colorIndex] ;
732755 }
733756
734757// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
0 commit comments