changeset 870:a0ae8d36c2d6

TavernDialog fixed
author Ritor1
date Mon, 01 Apr 2013 13:02:05 +0600
parents 715064ae1792
children 2db21a810d48 aa0172fd88c6
files GUIWindow.cpp UIHouses.cpp mm7_3.cpp
diffstat 3 files changed, 75 insertions(+), 82 deletions(-) [+]
line wrap: on
line diff
--- a/GUIWindow.cpp	Mon Apr 01 09:05:51 2013 +0600
+++ b/GUIWindow.cpp	Mon Apr 01 13:02:05 2013 +0600
@@ -1095,7 +1095,6 @@
       v7 = FitTextInAWindow(current_npc_text, pFontArrus, &pDialogWindow, 0xDu, 0);
       window_SpeakInHouse->DrawText(pFontArrus, 13, 354 - v6, 0, v7, 0, 0, 0);
     }
-    v8 = 0;
     if ( uNumDialogueNPCPortraits <= 0 )
     {
       if ( pDialogueNPCCount == uNumDialogueNPCPortraits && uHouse_ExitPic )
@@ -1109,6 +1108,7 @@
       }
       return;
     }
+    v8 = 0;
     while ( 1 )
     {
       //pRenderer->DrawTextureIndexed(*(&pNPCPortraits_x + v8 + 6 * uNumDialogueNPCPortraits - 6) - 4,
@@ -1124,7 +1124,6 @@
 LABEL_57:
       ++v8;
       if ( v8 >= uNumDialogueNPCPortraits )
-        //goto LABEL_58;
       {
         if ( pDialogueNPCCount == uNumDialogueNPCPortraits && uHouse_ExitPic )
         {
@@ -1155,7 +1154,7 @@
         goto LABEL_57;
       }
       v15 = 3;
-      v13 = HouseNPCData[(v8 +1) - (dword_591080 != 0)]->pName;
+      v13 = HouseNPCData[v8 - (dword_591080 != 0)]->pName;
       v9 = pNPCPortraits_x[6 + (uNumDialogueNPCPortraits - 1)][v8] + pDialogueNPCPortraits[v8]->uTextureHeight + 2;
     }
     //v11 = pColor2;
@@ -1169,7 +1168,6 @@
   if ( pCurrentScreen == SCREEN_E )
   {
     CharacterUI_InventoryTab_Draw(uActiveCharacter, 1);
-    //goto LABEL_58;
     if ( pDialogueNPCCount == uNumDialogueNPCPortraits && uHouse_ExitPic )
     {
       pRenderer->DrawTextureIndexed(556, 451, &pIcons_LOD->pTextures[uTextureID_x_x_u]);
@@ -1246,7 +1244,6 @@
           break;
       }
   }
-//LABEL_58:
   if ( pDialogueNPCCount == uNumDialogueNPCPortraits && uHouse_ExitPic )
   {
     pRenderer->DrawTextureIndexed(556, 451, &pIcons_LOD->pTextures[uTextureID_x_x_u]);
@@ -1971,7 +1968,7 @@
         else
         {
           if ( v26 || !dword_591080 )
-            v27 = HouseNPCData[(v26 +1) - (dword_591080 != 0)]->pName;
+            v27 = HouseNPCData[v26 - (dword_591080 != 0)]->pName;//problem in Harmondale tavern(v26 == 0)
           else
             //v27 = (char *)p2DEvents_minus1_::08[13 * a4];
             v27 = (char *)p2DEvents[pButton - 1].pProprieterName;
--- 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;
--- a/mm7_3.cpp	Mon Apr 01 09:05:51 2013 +0600
+++ b/mm7_3.cpp	Mon Apr 01 13:02:05 2013 +0600
@@ -6086,8 +6086,8 @@
 
     v37 += ((unsigned __int64)(_this.ptr_38->field_10 * v13) >> 16);
     v36 += ((unsigned __int64)(_this.ptr_38->field_1C * v13) >> 16);
-    v35 = 224 * pMiscTimer->uTotalGameTimeElapsed + (signed int)((unsigned __int64)(v37 * v18) >> 16) / 8;
-    v36 = 224 * pMiscTimer->uTotalGameTimeElapsed + (signed int)((unsigned __int64)(v36 * v18) >> 16) / 8;
+    v35 = 224 * pMiscTimer->uTotalGameTimeElapsed + fixpoint_mul(v37, v18) / 8;
+    v36 = 224 * pMiscTimer->uTotalGameTimeElapsed + fixpoint_mul(v37, v18) / 8;
 
     //array_50AC10[i].vWorldViewPosition.x = pOutdoorCamera->shading_dist_mist;
     //array_50AC10[i].vWorldPosition.x = v36 / (_this.pTexture->uTextureHeight * 65536.0);