diff UIHouses.cpp @ 870:a0ae8d36c2d6

TavernDialog fixed
author Ritor1
date Mon, 01 Apr 2013 13:02:05 +0600
parents 06fc66ceecd6
children aa0172fd88c6
line wrap: on
line diff
--- a/UIHouses.cpp	Mon Apr 01 09:05:51 2013 +0600
+++ b/UIHouses.cpp	Mon Apr 01 13:02:05 2013 +0600
@@ -2451,25 +2451,27 @@
   unsigned int v71; // [sp-4h] [bp-278h]@75
   const char *v72; // [sp-4h] [bp-278h]@93
   unsigned int v73; // [sp-4h] [bp-278h]@99
-  char Dest[100]; // [sp+Ch] [bp-268h]@55
-  char v75[100]; // [sp+70h] [bp-204h]@59
-  char a1[100]; // [sp+D4h] [bp-1A0h]@57
-  char v77[100]; // [sp+138h] [bp-13Ch]@59
+  char pTopic1[100]; // [sp+Ch] [bp-268h]@55
+  char pTopic4[100]; // [sp+70h] [bp-204h]@59
+  char pTopic2[100]; // [sp+D4h] [bp-1A0h]@57
+  char pTopic3[100]; // [sp+138h] [bp-13Ch]@59
   //GUIWindow v78; // [sp+19Ch] [bp-D8h]@99
   GUIWindow dialog_window; // [sp+1F0h] [bp-84h]@1
   char *Str[2]; // [sp+244h] [bp-30h]@30
   unsigned int pColorWhite; // [sp+24Ch] [bp-28h]@1
-  unsigned __int8 v82; // [sp+253h] [bp-21h]@59
+  unsigned __int8 pTopic3Height; // [sp+253h] [bp-21h]@59
   int v83; // [sp+254h] [bp-20h]@1
   int pColorYellow; // [sp+258h] [bp-1Ch]@1
   Player *pPlayer; // [sp+25Ch] [bp-18h]@1
   int all_text_height; // [sp+260h] [bp-14h]@18
   unsigned __int8 v87; // [sp+266h] [bp-Eh]@59
-  unsigned __int8 v88; // [sp+267h] [bp-Dh]@57
+  unsigned __int8 pTopic2Height; // [sp+267h] [bp-Dh]@57
   int v89; // [sp+268h] [bp-Ch]@1
-  unsigned int pTextHeight; // [sp+26Fh] [bp-5h]@55
+  unsigned int pTopic1Height; // [sp+26Fh] [bp-5h]@55
   int v91; // [sp+270h] [bp-4h]@3
   GUIFont *pOutString;
+  unsigned __int8 pTopic4Height;
+  int pTextHeight;
 
   pPlayer = pPlayers[uActiveCharacter];
   memcpy(&dialog_window, window_SpeakInHouse, sizeof(dialog_window));
@@ -2507,90 +2509,84 @@
       if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
           return;
 
-      sprintf(Dest, "\f%05d", pDialogueWindow->pCurrentPosActiveItem == 2 ? pColorYellow : pColorWhite);
+      sprintf(pTopic1, "\f%05d", pDialogueWindow->pCurrentPosActiveItem == 2 ? pColorYellow : pColorWhite);
       sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[178], pOutString); // Rent room for %d gold
-      strcat(Dest, pTmpBuf2);
-      pTextHeight = pFontArrus->CalcTextHeight(Dest, &dialog_window, 0, 0);
-      strcat(Dest, "\n \n");
+      strcat(pTopic1, pTmpBuf2);
+      pTopic1Height = pFontArrus->CalcTextHeight(pTopic1, &dialog_window, 0, 0);
+      strcat(pTopic1, "\n \n");
 
-      sprintf(a1, "\f%05d", pDialogueWindow->pCurrentPosActiveItem == 3 ? pColorYellow : pColorWhite);
+      sprintf(pTopic2, "\f%05d", pDialogueWindow->pCurrentPosActiveItem == 3 ? pColorYellow : pColorWhite);
       sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[86], // Buy food for %d days for %d gold
-        (unsigned int)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier,
-         v83);
-      strcat(a1, pTmpBuf2);
-      v88 = pFontArrus->CalcTextHeight(a1, &dialog_window, 0, 0);
-      strcat(a1, "\n \n");
+        (unsigned int)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier, v83);
+      strcat(pTopic2, pTmpBuf2);
+      pTopic2Height = pFontArrus->CalcTextHeight(pTopic2, &dialog_window, 0, 0);
+      strcat(pTopic2, "\n \n");
 
-      sprintf(v77, "\f%05d", pDialogueWindow->pCurrentPosActiveItem == 4 ? pColorYellow : pColorWhite);
-      strcat(v77, pGlobalTXT_LocalizationStrings[160]); // Learn Skills
-      v82 = pFontArrus->CalcTextHeight(v77, &dialog_window, 0, 0);
-      strcat(v77, "\n \n");
-      v75[0] = 0;
-      pTextHeight = 0;
+      sprintf(pTopic3, "\f%05d", pDialogueWindow->pCurrentPosActiveItem == 4 ? pColorYellow : pColorWhite);
+      strcat(pTopic3, pGlobalTXT_LocalizationStrings[160]); // Learn Skills
+      pTopic3Height = pFontArrus->CalcTextHeight(pTopic3, &dialog_window, 0, 0);
+      strcat(pTopic3, "\n \n");
+      pTopic4[0] = 0;
       if ( (signed int)window_SpeakInHouse->par1C >= 108 && (signed int)window_SpeakInHouse->par1C <= 120 )
       {
-        sprintf(v75, "\f%05d", pDialogueWindow->pCurrentPosActiveItem == 5 ? pColorYellow : pColorWhite);
-        strcat(v75, pGlobalTXT_LocalizationStrings[611]); // Play Arcomage
-        pTextHeight = pFontArrus->CalcTextHeight(v75, &dialog_window, 0, 0);
+        sprintf(pTopic4, "\f%05d", pDialogueWindow->pCurrentPosActiveItem == 5 ? pColorYellow : pColorWhite);
+        strcat(pTopic4, pGlobalTXT_LocalizationStrings[611]); // Play Arcomage
+        pTopic4Height = pFontArrus->CalcTextHeight(pTopic4, &dialog_window, 0, 0);
       }
       pNumActiveItem = pDialogueWindow->pStartingPosActiveItem;
       v36 = LOBYTE(pFontArrus->uFontHeight) - 3;
       v37 = -pDialogueWindow->pNumPresenceButton < 0;
       if ( !(v37 ^ pNumActiveItem < pNumActiveItem + pDialogueWindow->pNumPresenceButton) )
       {
-        sprintf(pTmpBuf, "%s%s%s%s", Dest, a1, v77, v75);
-        dialog_window.DrawTitleText(pFontArrus, 0, 146, 0, pTmpBuf, 3);
-        return;
-      }
-      while ( 1 )
-      {
-        pButton = pDialogueWindow->GetControl(pNumActiveItem);
-        if ( pButton->msg_param == 15 )
+        do
         {
-          v46 = pTextHeight;
-          pButton->uHeight = pTextHeight;
-          pButton->uY = 146;
-          v41 = v46 + 145;
-          pButton->uW = v41;
-        }
-        else if ( pButton->msg_param == 16 )
-        {
-          v44 = v88;
-          v45 = pTextHeight + v36 + 146;
-          pButton->uHeight = v88;
-          pButton->uY = v45;
-          v41 = v45 + v44 - 1;
-          pButton->uW = v41;
+          pButton = pDialogueWindow->GetControl(pNumActiveItem);
+          if ( pButton->msg_param == 15 )
+          {
+            v46 = pTopic1Height;
+            pButton->uHeight = pTopic1Height;
+            pButton->uY = 146;
+            v41 = v46 + 145;
+            pButton->uW = v41;
+          }
+          else if ( pButton->msg_param == 16 )
+          {
+            v44 = pTopic2Height;
+            v45 = pTopic1Height + v36 + 146;
+            pButton->uHeight = pTopic2Height;
+            pButton->uY = v45;
+            v41 = v45 + v44 - 1;
+            pButton->uW = v41;
+          }
+          else if ( pButton->msg_param == 96 )
+          {
+            v42 = pTopic1Height + pTopic2Height + 2 * v36 + 146;
+            v43 = pTopic3Height;
+            pButton->uY = v42;
+            pButton->uHeight = v43;
+            v41 = v43 + v42 - 1;
+            pButton->uW = v41;
+          }
+          else if ( pButton->msg_param == 101 )
+          {
+            v39 = pTopic1Height + 3 * v36 + pTopic4Height + pTopic2Height + 146;
+            v40 = pTopic4Height;
+            pButton->uHeight = pTopic4Height;
+            pButton->uY = v39;
+            v41 = v39 + v40 - 1;
+            pButton->uW = v41;
+          }
+          pNumActiveItem++;
+          if ( pNumActiveItem >= pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem )
+          {
+            sprintfex(pTmpBuf, "%s%s%s%s", &pTopic1, &pTopic2, &pTopic3, &pTopic4);
+            dialog_window.DrawTitleText(pFontArrus, 0, 146, 0, pTmpBuf, 3);
+          }
         }
-        else if ( pButton->msg_param == 96 )
-        {
-          v42 = pTextHeight + v88 + 2 * v36 + 146;
-          v43 = v82;
-          pButton->uY = v42;
-          pButton->uHeight = v43;
-          v41 = v43 + v42 - 1;
-          pButton->uW = v41;
-        }
-        else if ( pButton->msg_param == 101 )
-        {
-          v39 = pTextHeight + 3 * v36 + pTextHeight + v88 + 146;
-          v40 = v87;
-          pButton->uHeight = pTextHeight;
-          pButton->uY = v39;
-          v41 = v39 + v40 - 1;
-          pButton->uW = v41;
-        }
-        pNumActiveItem++;
-        if ( pNumActiveItem >= pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem )
-        {
-          sprintf(pTmpBuf, "%s%s%s%s", &Dest, &a1, &v77, &v75);
-          dialog_window.DrawTitleText(pFontArrus, 0, 146, 0, pTmpBuf, 3);
-          return;
-        }
+        while ( pNumActiveItem < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton );
       }
       break;
     }
-
     case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_RULES:
     {
       pOutString = pFontArrus;