changeset 1672:f3986fd1a122

GameUI_DrawDialogue()
author Ritor1
date Wed, 18 Sep 2013 20:36:18 +0600
parents 4bbb80c7dba7
children 2a5f2aaec367 406872881eb6 eccd4278fc2f
files UI/UiGame.cpp
diffstat 1 files changed, 28 insertions(+), 43 deletions(-) [+]
line wrap: on
line diff
--- a/UI/UiGame.cpp	Wed Sep 18 20:04:49 2013 +0600
+++ b/UI/UiGame.cpp	Wed Sep 18 20:36:18 2013 +0600
@@ -347,16 +347,12 @@
   int pGreetType; // eax@2
   int pTextHeight; // esi@39
   GUIButton *pButton; // eax@43
-  int v32; // ebx@93
-  int v38; // eax@95
-  signed int v39; // esi@99
-  signed int v40; // eax@102
-  unsigned int v41; // ebx@102
+  int all_text_height; // ebx@93
+  signed int index; // esi@99
   int v42; // edi@102
-  unsigned int v45; // ecx@104
+  int v45;
   unsigned __int16 pTextColor; // ax@104
   GUIWindow window; // [sp+ACh] [bp-68h]@42
-  char *Str; // [sp+100h] [bp-14h]@104
   GUIFont *pOutString; // [sp+10Ch] [bp-8h]@39
   char *pInString=NULL; // [sp+110h] [bp-4h]@32
 
@@ -590,49 +586,38 @@
   }
 
   // Install Buttons(Установка кнопок)-------- 
-  v32 = 0;
-  //v35 = (uint)pDialogueWindow->pStartingPosActiveItem;
-  for ( int i = pDialogueWindow->pStartingPosActiveItem; i < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton; ++i )
+  index = 0;
+  all_text_height = 0;
+  for ( int i = pDialogueWindow->pStartingPosActiveItem;
+        i < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton; ++i )
   {
     pButton = pDialogueWindow->GetControl(i);
     if ( !pButton )
       break;
-    v38 = pFontArrus->CalcTextHeight(pButton->pButtonName, &window, 0, 0);
-    v32 += v38;
-    //++v35;
+    all_text_height += pFontArrus->CalcTextHeight(pButton->pButtonName, &window, 0, 0);
+    index++;
   }
-  v39 = pDialogueWindow->pNumPresenceButton;
-  if ( v39 )
+  if ( index )
   {
-    pOutString = (GUIFont *)((174 - v32) / v39);
-    if ( (174 - v32) / v39 > 32 )
-      pOutString = (GUIFont *)32;
-    int v55 = 1;
-    v40 = 174 - (int)pOutString * v39 - v32;
-    v41 = pDialogueWindow->pStartingPosActiveItem;
-    v42 = v40 / 2 - (signed int)pOutString / 2 + 138;
-    if ( (signed int)v41 < (signed int)(v41 + v39) )
+    v45 = (174 - all_text_height) / index;
+    if ( v45 > 32 )
+      v45 = 32;
+    v42 = (174 - v45 * index - all_text_height)/ 2 - v45 / 2 + 138;
+    for ( int i = pDialogueWindow->pStartingPosActiveItem;
+          i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i )
     {
-      do
-      {
-        pButton = pDialogueWindow->GetControl(v41);
-        if ( !pButton )
-          break;
-        pButton->uY = (unsigned int)((char *)pOutString + v42);
-        Str = pButton->pButtonName;
-        pTextHeight = pFontArrus->CalcTextHeight(pButton->pButtonName, &window, 0, 0);
-        v45 = pButton->uY;
-        pButton->uHeight = pTextHeight;
-        v42 = v45 + pTextHeight - 1;
-        pButton->uW = v42;
-        pTextColor = ui_game_dialogue_option_highlight_color;
-        if ( pDialogueWindow->pCurrentPosActiveItem != v55 )
-          pTextColor = ui_game_dialogue_option_normal_color;
-        window.DrawTitleText(pFontArrus, 0, v45, pTextColor, Str, 3);
-        ++v55;
-        ++v41;
-      }
-      while ( (signed int)v41 < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem );
+      pButton = pDialogueWindow->GetControl(i);
+      if ( !pButton )
+        break;
+      pButton->uY = (unsigned int)(v45 + v42);
+      pTextHeight = pFontArrus->CalcTextHeight(pButton->pButtonName, &window, 0, 0);
+      pButton->uHeight = pTextHeight;
+      v42 = pButton->uY + pTextHeight - 1;
+      pButton->uW = v42;
+      pTextColor = ui_game_dialogue_option_highlight_color;
+      if ( pDialogueWindow->pCurrentPosActiveItem != i )
+        pTextColor = ui_game_dialogue_option_normal_color;
+      window.DrawTitleText(pFontArrus, 0, pButton->uY, pTextColor, pButton->pButtonName, 3);
     }
   }
   pRenderer->DrawTextureIndexed(471, 445, pIcons_LOD->GetTexture(uExitCancelTextureId));