changeset 873:aa0172fd88c6

TavernDialog second NPCName fix
author Ritor1
date Mon, 01 Apr 2013 16:28:10 +0600
parents a0ae8d36c2d6
children 231523a39203
files GUIWindow.cpp UIHouses.cpp
diffstat 2 files changed, 47 insertions(+), 41 deletions(-) [+]
line wrap: on
line diff
--- a/GUIWindow.cpp	Mon Apr 01 13:02:05 2013 +0600
+++ b/GUIWindow.cpp	Mon Apr 01 16:28:10 2013 +0600
@@ -1030,9 +1030,9 @@
   unsigned int v10; // [sp-10h] [bp-C8h]@53
   //unsigned __int16 v11; // [sp-Ch] [bp-C4h]@53
   //unsigned int v12; // [sp-Ch] [bp-C4h]@60
-  char *v13; // [sp-8h] [bp-C0h]@50
+  char *pTitleText; // [sp-8h] [bp-C0h]@50
   //unsigned int v14; // [sp-8h] [bp-C0h]@60
-  unsigned int v15; // [sp-4h] [bp-BCh]@50
+  //unsigned int v15; // [sp-4h] [bp-BCh]@50
   //Texture *v16; // [sp-4h] [bp-BCh]@60
   GUIWindow pDialogWindow; // [sp+Ch] [bp-ACh]@4
   GUIWindow pWindow; // [sp+60h] [bp-58h]@2
@@ -1108,8 +1108,9 @@
       }
       return;
     }
-    v8 = 0;
-    while ( 1 )
+    //v8 = 0;
+    //while ( 1 )
+    for ( v8 = 0; v8 < uNumDialogueNPCPortraits; ++v8 )
     {
       //pRenderer->DrawTextureIndexed(*(&pNPCPortraits_x + v8 + 6 * uNumDialogueNPCPortraits - 6) - 4,
       //                              *(&pNPCPortraits_y + v8 + 6 * uNumDialogueNPCPortraits - 6) - 4,
@@ -1120,47 +1121,51 @@
       pRenderer->DrawTextureIndexed(pNPCPortraits_x[uNumDialogueNPCPortraits - 1][v8],
                                     pNPCPortraits_y[uNumDialogueNPCPortraits - 1][v8], pDialogueNPCPortraits[v8]);
       if ( uNumDialogueNPCPortraits < 4 )
-        break;
-LABEL_57:
-      ++v8;
-      if ( v8 >= uNumDialogueNPCPortraits )
+        //break;
       {
-        if ( pDialogueNPCCount == uNumDialogueNPCPortraits && uHouse_ExitPic )
+        if ( v8 + 1 == uNumDialogueNPCPortraits && uHouse_ExitPic )
         {
-          pRenderer->DrawTextureIndexed(556, 451, &pIcons_LOD->pTextures[uTextureID_x_x_u]);
-          pRenderer->DrawTextureIndexed(476, 451, &pIcons_LOD->pTextures[uTextureID_x_ok_u]);
+          //v15 = 3;
+          pTitleText = pMapStats->pInfos[uHouse_ExitPic].pName;
+          v9 = 94 * v8 + 113;
         }
         else
         {
-          pRenderer->DrawTextureIndexed(471, 445, &pIcons_LOD->pTextures[uExitCancelTextureId]);
+          if ( !v8 && dword_591080 )
+          {
+            //v15 = 3;
+            //v13 = (char *)p2DEvents_minus1__10[13 * (unsigned int)ptr_507BC0->ptr_1C];
+            pTitleText = (char *)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].pProprieterTitle;
+            pWindow.DrawTitleText(pFontCreate, 0x1E3u, 113, pColor2, pTitleText, 3);
+            //goto LABEL_57;
+            continue;
+          }
+          //v15 = 3;
+          pTitleText = HouseNPCData[v8 - (dword_591080 != 0)]->pName;
+          v9 = pNPCPortraits_x[6 + (uNumDialogueNPCPortraits - 1)][v8] + pDialogueNPCPortraits[v8]->uTextureHeight + 2;
         }
-       return;
+        //v11 = pColor2;
+        v10 = v9;
+        pWindow.DrawTitleText(pFontCreate, 0x1E3u, v10, pColor2, pTitleText, 3);
+        //goto LABEL_57;
       }
-    }
-    if ( v8 + 1 == uNumDialogueNPCPortraits && uHouse_ExitPic )
-    {
-      v15 = 3;
-      v13 = pMapStats->pInfos[uHouse_ExitPic].pName;
-      v9 = 94 * v8 + 113;
-    }
-    else
-    {
-      if ( !v8 && dword_591080 )
+	}
+//LABEL_57:
+    //++v8;
+    //if ( v8 >= uNumDialogueNPCPortraits )
+    //{
+      if ( pDialogueNPCCount == uNumDialogueNPCPortraits && uHouse_ExitPic )
       {
-        v15 = 3;
-        //v13 = (char *)p2DEvents_minus1__10[13 * (unsigned int)ptr_507BC0->ptr_1C];
-        v13 = (char *)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].pProprieterTitle;
-        pWindow.DrawTitleText(pFontCreate, 0x1E3u, 113, pColor2, v13, 3);
-        goto LABEL_57;
+        pRenderer->DrawTextureIndexed(556, 451, &pIcons_LOD->pTextures[uTextureID_x_x_u]);
+        pRenderer->DrawTextureIndexed(476, 451, &pIcons_LOD->pTextures[uTextureID_x_ok_u]);
       }
-      v15 = 3;
-      v13 = HouseNPCData[v8 - (dword_591080 != 0)]->pName;
-      v9 = pNPCPortraits_x[6 + (uNumDialogueNPCPortraits - 1)][v8] + pDialogueNPCPortraits[v8]->uTextureHeight + 2;
-    }
-    //v11 = pColor2;
-    v10 = v9;
-    pWindow.DrawTitleText(pFontCreate, 0x1E3u, v10, pColor2, v13, v15);
-    goto LABEL_57;
+      else
+      {
+        pRenderer->DrawTextureIndexed(471, 445, &pIcons_LOD->pTextures[uExitCancelTextureId]);
+      }
+      return;
+      //}
+    //}
   }
   v4 = (char *)pDialogueNPCCount - 1;
   pRenderer->DrawTextureIndexed(pNPCPortraits_x[0][0] - 4, pNPCPortraits_y[0][0] - 4, &pIcons_LOD->pTextures[uTextureID_50795C]);
@@ -1957,9 +1962,10 @@
     v26 = 0;
     if ( uNumDialogueNPCPortraits > 0 )
     {
-      do
+      //do
+      for ( v26 = 0; v26 < uNumDialogueNPCPortraits; ++v26 )
       {
-        uWidtha = v26 + 1;
+        //uWidtha = v26 + 1;
         if ( v26 + 1 == v25 && uHouse_ExitPic )
         {
           v30 = pMapStats->pInfos[uHouse_ExitPic].pName;
@@ -1979,10 +1985,10 @@
         HouseNPCData[v26 + 7] = (NPCData *)pWindow->CreateButton(pNPCPortraits_x[uNumDialogueNPCPortraits - 1][v26],
                                                                  pNPCPortraits_y[uNumDialogueNPCPortraits - 1][v26],
                                              0x3Fu, 0x49u, 1, 0, UIMSG_19A, v26, 0, byte_591180[v26], 0, 0, 0);
-        ++v26;
+        //++v26;
         v25 = uNumDialogueNPCPortraits;
       }
-      while ( uWidtha < uNumDialogueNPCPortraits );
+      //while ( uWidtha < uNumDialogueNPCPortraits );
     }
     if ( v25 == 1 )
     {
--- a/UIHouses.cpp	Mon Apr 01 13:02:05 2013 +0600
+++ b/UIHouses.cpp	Mon Apr 01 16:28:10 2013 +0600
@@ -388,7 +388,7 @@
       if (~npc->uFlags & 0x80)
         //if ( !(*(char *)v6 & 0x80) )
       {
-        v7 = uNumDialogueNPCPortraits++ - dword_591080 ? 1 : 0;
+        v7 = uNumDialogueNPCPortraits++ - (dword_591080 != 0) ? 1 : 0;
         HouseNPCData[v7] = npc;
         //v6 = v17;
         //*(&v13 + v2) = *(v17 - 1);