diff GUI/GUIWindow.cpp @ 2532:9ec6b8be16fe

Mobile light
author Ritor1
date Mon, 19 Jan 2015 22:39:03 +0600
parents dbaf6fc71525
children a902abdfc7f2
line wrap: on
line diff
--- a/GUI/GUIWindow.cpp	Sun Nov 23 15:30:17 2014 +0600
+++ b/GUI/GUIWindow.cpp	Mon Jan 19 22:39:03 2015 +0600
@@ -1072,9 +1072,8 @@
 
 //----- (0044CE08) --------------------------------------------------------
 void GUIWindow::DrawText(GUIFont *font, signed int uX, int uY, unsigned short uFontColor, const char *Str, bool present_time_transparency, int max_text_height, signed int uFontShadowColor )
-    {
+{
   int v14; // edx@9
-  int v18; // edi@32
   char Dest[6]; // [sp+Ch] [bp-2Ch]@32
   size_t v30; // [sp+2Ch] [bp-Ch]@4
 
@@ -1087,103 +1086,101 @@
   if (!strcmp(Str, "null"))
     return;
 
-    v30 = strlen(Str);
-    //int v11 = 0;
-    if ( !uX )
-      uX = 12;
+  v30 = strlen(Str);
+  if ( !uX )
+    uX = 12;
 
-   const char *string_begin = Str;
-    if ( max_text_height != 0 )
-      string_begin = FitTextInAWindow(Str, font, this, uX, 0);
-   auto string_end = string_begin;
-   auto string_base = string_begin;
+  const char *string_begin = Str;
+  if ( max_text_height == 0 )
+    string_begin = FitTextInAWindow(Str, font, this, uX, 0);
+  auto string_end = string_begin;
+  auto string_base = string_begin;
 
-    int out_x = uX + uFrameX;
-    int out_y = uY + uFrameY;
-    v14 = 0;
+  int out_x = uX + uFrameX;
+  int out_y = uY + uFrameY;
+  v14 = 0;
+
+  if (max_text_height != 0 && out_y + LOBYTE(font->uFontHeight) > max_text_height)
+    return;
 
-    if (max_text_height != 0 && out_y + LOBYTE(font->uFontHeight) > max_text_height)
-      return;
-
-      if ( (signed int)v30 > 0 )
+  if ( (signed int)v30 > 0 )
+  {
+    do
+    {
+      unsigned char c = string_base[v14];
+      if ( c >= font->cFirstChar && c <= font->cLastChar
+        || c == '\f'
+        || c == '\r'
+        || c == '\t'
+        || c == '\n' )
       {
-        do
+        switch ( c )
         {
-          unsigned char c = string_base[v14];
-          if ( c >= font->cFirstChar && c <= font->cLastChar
-            || c == '\f'
-            || c == '\r'
-            || c == '\t'
-            || c == '\n' )
-          {
-            switch ( c )
+          case '\t':
+            strncpy(Dest, &string_base[v14 + 1], 3);
+            Dest[3] = 0;
+            v14 += 3;
+            left_margin = atoi(Dest);
+            out_x = uX + uFrameX + left_margin;
+            break;
+          case '\n':
+            uY = uY + LOBYTE(font->uFontHeight) - 3;
+            out_y = uY + uFrameY;
+            out_x = uX + uFrameX + left_margin;
+            if ( max_text_height != 0 )
             {
-              case '\t':
-                strncpy(Dest, &string_base[v14 + 1], 3);
-                Dest[3] = 0;
-                v14 += 3;
-                left_margin = atoi(Dest);
-                out_x = uX + uFrameX + left_margin;
-                break;
-              case '\n':
-                uY = uY + LOBYTE(font->uFontHeight) - 3;
-                out_y = uY + uFrameY;
-                out_x = uX + uFrameX + left_margin;
-                if ( max_text_height != 0 )
-                {
-                  if (LOBYTE(font->uFontHeight) + out_y - 3 > max_text_height )
-                    return;
-                }
-                break;
-              case '\f':
-                strncpy(Dest, &string_base[v14 + 1], 5);
-                Dest[5] = 0;
-                uFontColor = atoi(Dest);
-                v14 += 5;
-                break;
-              case '\r':
-                strncpy(Dest, &string_base[v14 + 1], 3);
-                Dest[3] = 0;
-                v14 += 3;
-                v18 = atoi(Dest);
-                out_x = uFrameZ - font->GetLineWidth(&string_base[v14]) - v18;
-                out_y = uY + uFrameY;
-                if ( max_text_height != 0 )
-                {
-                  if (LOBYTE(font->uFontHeight) + out_y - 3 > max_text_height )
-                    return;
-                  break;
-                }
-                break;
+              if (LOBYTE(font->uFontHeight) + out_y - 3 > max_text_height )
+                return;
+            }
+            break;
+          case '\f':
+            strncpy(Dest, &string_base[v14 + 1], 5);
+            Dest[5] = 0;
+            uFontColor = atoi(Dest);
+            v14 += 5;
+            break;
+          case '\r':
+            strncpy(Dest, &string_base[v14 + 1], 3);
+            Dest[3] = 0;
+            v14 += 3;
+            left_margin = atoi(Dest);
+            out_x = uFrameZ - font->GetLineWidth(&string_base[v14]) - left_margin;
+            out_y = uY + uFrameY;
+            if ( max_text_height != 0 )
+            {
+              if (LOBYTE(font->uFontHeight) + out_y - 3 > max_text_height )
+                return;
+              break;
+            }
+            break;
 
-              default:
-                if (c == '\"' && string_base[v14 + 1] == '\"')
-                  ++v14;
+          default:
+            if (c == '\"' && string_base[v14 + 1] == '\"')
+              ++v14;
                 
-                c = (unsigned __int8)string_base[v14];
-                if ( v14 > 0 )
-                  out_x += font->pMetrics[c].uLeftSpacing;
+            c = (unsigned __int8)string_base[v14];
+            if ( v14 > 0 )
+              out_x += font->pMetrics[c].uLeftSpacing;
 
-                unsigned char *letter_pixels = &font->pFontData[font->font_pixels_offset[c]];
-                if ( uFontColor )
-                  pRenderer->DrawText(out_x, out_y, letter_pixels, font->pMetrics[c].uWidth, LOBYTE(font->uFontHeight),
-                    font->pFontPalettes[0], uFontColor, uFontShadowColor);
-                else
-                  pRenderer->DrawTextAlpha(out_x, out_y, letter_pixels, font->pMetrics[c].uWidth, LOBYTE(font->uFontHeight),
-                    font->pFontPalettes[0], present_time_transparency);
+            unsigned char *letter_pixels = &font->pFontData[font->font_pixels_offset[c]];
+            if ( uFontColor )
+              pRenderer->DrawText(out_x, out_y, letter_pixels, font->pMetrics[c].uWidth, LOBYTE(font->uFontHeight),
+                  font->pFontPalettes[0], uFontColor, uFontShadowColor);
+            else
+              pRenderer->DrawTextAlpha(out_x, out_y, letter_pixels, font->pMetrics[c].uWidth, LOBYTE(font->uFontHeight),
+                  font->pFontPalettes[0], present_time_transparency);
 
-                out_x += font->pMetrics[c].uWidth;
-                if ( (signed int)v14 < (signed int)v30 )
-                  out_x += font->pMetrics[c].uRightSpacing;
-                break;
-            }
+            out_x += font->pMetrics[c].uWidth;
+            if ( (signed int)v14 < (signed int)v30 )
+              out_x += font->pMetrics[c].uRightSpacing;
+            break;
           }
         }
-        while ( (signed int)++v14 < (signed int)v30 );
       }
+      while ( (signed int)++v14 < (signed int)v30 );
+    }
 }
 
-
 //----- (0044CB4F) --------------------------------------------------------
 int GUIWindow::DrawTextInRect( GUIFont *pFont, unsigned int uX, unsigned int uY, unsigned int uColor, const char *text, int rect_width, int reverse_text )
 {