diff mm7_4.cpp @ 458:c0ab5f64b37b

Слияние
author Ritor1
date Sun, 24 Feb 2013 20:42:44 +0600
parents e5cf03a3d98e 4946b3ed74be
children a7869569e912
line wrap: on
line diff
--- a/mm7_4.cpp	Sun Feb 24 20:39:03 2013 +0600
+++ b/mm7_4.cpp	Sun Feb 24 20:42:44 2013 +0600
@@ -4915,8 +4915,8 @@
   NPCData *npc = nullptr;
   if ( dword_5C35D4 )
   {
-    __debugbreak(); // fix
-    npc = HouseNPCData[(unsigned int)((char *)pDialogueNPCCount + -(dword_591080 != 0) - 1)];
+    __debugbreak(); // fix  
+    npc = array_5913D8[(unsigned int)((char *)array_5913D8[6] + -(dword_591080 != 0) - 1)];
   }
   else
     npc = GetNPCData(uDialogue_SpeakingActorNPC_ID);
@@ -9112,7 +9112,8 @@
     v6 = 9 * (v5 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C);
     v7 = (ItemGen *)((char *)&pParty->pPickedItem + 4 * v6 + 4);
     if ( dword_F8B19C != 2 )
-      v7 = (ItemGen *)&pParty->field_C59C[v6 + 715];
+   //   v7 = (ItemGen *)&pParty->field_C59C[v6 + 715];
+		v7 =&pParty->Recipes_Item[(unsigned int)window_SpeakInHouse->ptr_1C][v5];
     goto LABEL_15;
   }
   if ( dword_F8B198 <= 16 && dword_F8B19C == 18 )
@@ -9375,11 +9376,11 @@
 // F8B1A8: using guessed type int dword_F8B1A8;
 
 //----- (004B2001) --------------------------------------------------------
-void __fastcall ClickNPCTopic(signed int uMessageParam)
-{
-  //signed int v1; // eax@1
-  NPCData *pCurrentNPCInfo; // ebp@1
-  int pEventNumber; // ecx@8
+void __fastcall sub_4B2001(signed int a1)
+{
+  signed int v1; // eax@1
+  NPCData *v2; // ebp@1
+  int v3; // ecx@8
   Player *v4; // esi@20
   int v5; // eax@28
   int v6; // eax@31
@@ -9403,49 +9404,60 @@
   char *v24; // [sp-8h] [bp-14h]@73
   int v25; // [sp-4h] [bp-10h]@49
 
-  //v1 = a1;
-  uDialogueType = uMessageParam + 1;
-  pCurrentNPCInfo = HouseNPCData[(unsigned int)((char *)pDialogueNPCCount + -(dword_591080 != 0) - 1)];
-  switch ( uMessageParam )
-  {
-    case 13:
-      ptr_F8B1E8 = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession].pJoinText;//(char *)*(&pNPCStats->field_13A64 + 5 * v2->uProfession);
-      ptr_F8B1E8 = BuilDialogueString((char *)ptr_F8B1E8, uActiveCharacter - 1, 0, 0, 0, 0);
-      sub_4B40E6();
-      dialogue_show_profession_details = false;
-      goto _return;
-    case 19:
-      pEventNumber = pCurrentNPCInfo->evt_A;
-      break;
-    case 20:
-      pEventNumber = pCurrentNPCInfo->evt_B;
-      break;
-    case 21:
-      pEventNumber = pCurrentNPCInfo->evt_C;
-      break;
-    case 22:
-      pEventNumber = pCurrentNPCInfo->evt_D;
-      break;
-    case 23:
-      pEventNumber = pCurrentNPCInfo->evt_E;
-      break;
-    case 24:
-      pEventNumber = pCurrentNPCInfo->evt_F;
-      break;
-    default:
+  v1 = a1;
+  uDialogueType = a1 + 1;
+  v2 = array_5913D8[(unsigned int)((char *)array_5913D8[6] + -(dword_591080 != 0) - 1)];
+  if ( a1 <= 23 )
+  {
+    if ( a1 == 23 )
+    {
+      v3 = v2->evt_E;
+    }
+    else
+    {
+      if ( a1 == 13 )
+      {
+        ptr_F8B1E8 = pNPCStats->pProfessions[v2->uProfession].pJoinText;//(char *)*(&pNPCStats->field_13A64 + 5 * v2->uProfession);
+        ptr_F8B1E8 = BuilDialogueString((char *)ptr_F8B1E8, uActiveCharacter - 1, 0, 0, 0, 0);
+        sub_4B40E6();
+        dialogue_show_profession_details = false;
         goto _return;
-  }
-  if ( pEventNumber < 200 || pEventNumber > 310 )
-    {
-      if ( pEventNumber < 400 || pEventNumber > 410 )
-      {
-        if ( pEventNumber == 139 )
+      }
+      switch ( a1 )
+      {
+        case 19:
+          v3 = v2->evt_A;
+          break;
+        case 20:
+          v3 = v2->evt_B;
+          break;
+        case 21:
+          v3 = v2->evt_C;
+          break;
+        default:
+          if ( a1 != 22 )
+            goto _return;
+          v3 = v2->evt_D;
+          break;
+      }
+    }
+    goto LABEL_84;
+  }
+  if ( a1 == 24 )
+  {
+    v3 = v2->evt_F;
+LABEL_84:
+    if ( v3 < 200 || v3 > 310 )
+    {
+      if ( v3 < 400 || v3 > 410 )
+      {
+        if ( v3 == 139 )
         {
           sub_4B1ECE();
         }
         else
         {
-          if ( pEventNumber == 311 )
+          if ( v3 == 311 )
           {
             sub_4BBA85_bounties();
           }
@@ -9453,32 +9465,32 @@
           {
             ptr_F8B1E8 = 0;
             _5C3420_pDecoration = (LevelDecoration *)1;
-            EventProcessor(pEventNumber, 0, 1);
+            EventProcessor(v3, 0, 1);
             _5C3420_pDecoration = 0;
           }
         }
       }
       else
       {
-        dword_F8B1D8 = uMessageParam;
-        DrawJoinGuildWindow(pEventNumber - 400);
+        dword_F8B1D8 = v1;
+        sub_4B3EF0(v3 - 400);
       }
     }
     else
     {
-      sub_4B3FE5(pEventNumber);
+      sub_4B3FE5(v3);
     }
     goto _return;
-  
-  if ( uMessageParam != 76 )
-  {
-    if ( uMessageParam == 77 )
-    {
-      v16 = pCurrentNPCInfo->uProfession;
+  }
+  if ( a1 != 76 )
+  {
+    if ( a1 == 77 )
+    {
+      v16 = v2->uProfession;
       if (dialogue_show_profession_details)
-        v17 = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession - 1].pJoinText;
+        v17 = pNPCStats->pProfessions[v2->uProfession - 1].pJoinText;
       else
-        v17 = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession - 1].pBenefits;
+        v17 = pNPCStats->pProfessions[v2->uProfession - 1].pBenefits;
       ptr_F8B1E8 = v17;
       v18 = BuilDialogueString(v17, uActiveCharacter - 1, 0, 0, 0, 0);
       dialogue_show_profession_details = ~dialogue_show_profession_details;
@@ -9486,7 +9498,7 @@
     }
     else
     {
-      if ( uMessageParam == 79 )
+      if ( a1 == 79 )
       {
         if ( dword_F8B1A8 )
         {
@@ -9524,7 +9536,7 @@
       }
       else
       {
-        if ( uMessageParam == 82 && dword_F8B1A8 )
+        if ( a1 == 82 && dword_F8B1A8 )
         {
           Party::TakeGold(gold_transaction_amount);
           v4 = pParty->pPlayers;
@@ -9537,36 +9549,36 @@
           switch ( dword_F8B1D8 )
           {
             case 19:
-              v10 = pCurrentNPCInfo->evt_A;
+              v10 = v2->evt_A;
               if ( (signed int)v10 >= 400 && (signed int)v10 <= 416 )
-                pCurrentNPCInfo->evt_A = 0;
+                v2->evt_A = 0;
               break;
             case 20:
-              v9 = pCurrentNPCInfo->evt_B;
+              v9 = v2->evt_B;
               if ( v9 >= 400 && v9 <= 416 )
-                pCurrentNPCInfo->evt_B = 0;
+                v2->evt_B = 0;
               break;
             case 21:
-              v8 = pCurrentNPCInfo->evt_C;
+              v8 = v2->evt_C;
               if ( v8 >= 400 && v8 <= 416 )
-                pCurrentNPCInfo->evt_C = 0;
+                v2->evt_C = 0;
               break;
             case 22:
-              v7 = pCurrentNPCInfo->evt_D;
+              v7 = v2->evt_D;
               if ( v7 >= 400 && v7 <= 416 )
-                pCurrentNPCInfo->evt_D = 0;
+                v2->evt_D = 0;
               break;
             case 23:
-              v6 = pCurrentNPCInfo->evt_E;
+              v6 = v2->evt_E;
               if ( v6 >= 400 && v6 <= 416 )
-                pCurrentNPCInfo->evt_E = 0;
+                v2->evt_E = 0;
               break;
             case 24:
-              v5 = pCurrentNPCInfo->evt_F;
+              v5 = v2->evt_F;
               if ( v5 >= 400 )
               {
                 if ( v5 <= 416 )
-                  pCurrentNPCInfo->evt_F = 0;
+                  v2->evt_F = 0;
               }
               break;
           }
@@ -9600,15 +9612,15 @@
     goto _return;
   }
   //v20 = v2->uProfession;
-  if ( pCurrentNPCInfo->uProfession != 51 )
-  {
-    v21 = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession - 1].uHirePrice;
+  if ( v2->uProfession != 51 )
+  {
+    v21 = pNPCStats->pProfessions[v2->uProfession - 1].uHirePrice;
     if ( pParty->uNumGold < v21 )
     {
       ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u);
       dialogue_show_profession_details = false;
       uDialogueType = 13;
-      ptr_F8B1E8 = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession - 1].pJoinText;
+      ptr_F8B1E8 = pNPCStats->pProfessions[v2->uProfession - 1].pJoinText;
       ptr_F8B1E8 = BuilDialogueString((char *)ptr_F8B1E8, uActiveCharacter - 1, 0, 0, 0, 0);
       if ( uActiveCharacter )
         pPlayers[uActiveCharacter]->PlaySound(SPEECH_NotEnoughGold, 0);
@@ -9618,19 +9630,19 @@
     Party::TakeGold(v21);
   }
   //LOBYTE(v2->uFlags) |= 0x80u;
-  pCurrentNPCInfo->uFlags = 128;
+  v2->uFlags = 128;
   pParty->field_709 = 0;
   sub_44A56A();
   if ( pParty->pHirelings[0].pName )
   {
-    memcpy(&pParty->pHirelings[1], pCurrentNPCInfo, sizeof(pParty->pHirelings[1]));
-    v24 = pCurrentNPCInfo->pName;
+    memcpy(&pParty->pHirelings[1], v2, sizeof(pParty->pHirelings[1]));
+    v24 = v2->pName;
     v22 = pParty->pHireling2Name;
   }
   else
   {
-    memcpy(pParty->pHirelings, pCurrentNPCInfo, 0x4Cu);
-    v24 = pCurrentNPCInfo->pName;
+    memcpy(pParty->pHirelings, v2, 0x4Cu);
+    v24 = v2->pName;
     v22 = pParty->pHireling1Name;
   }
   strcpy(v22, v24);
@@ -9990,14 +10002,23 @@
 
 
 //----- (004B29F2) --------------------------------------------------------
-const char *__fastcall ContractSelectText(int pEventNumber)
-{
+const char *__fastcall sub_4B29F2(int a1)
+{
+  int v1; // esi@1
+  Player *v2; // edi@1
+  int v3; // eax@1
+  Player *v4; // ecx@1
+
+  v1 = a1;
   dword_F8B1A8 = 0;
-  dword_F8B1AC_something_todo_with_awards = pEventNumber + 50;
-  gold_transaction_amount = dword_4F08EC[pEventNumber];
-  if ( pPlayers[uActiveCharacter]->CanAct() )
-  {
-    if ( (unsigned __int16)_449B57_test_bit((unsigned __int8 *)pPlayers[uActiveCharacter]->field_152, dword_F8B1AC_something_todo_with_awards) )
+  v2 = pPlayers[uActiveCharacter];
+  v3 = a1 + 50;
+  v4 = pPlayers[uActiveCharacter];
+  dword_F8B1AC_something_todo_with_awards = v3;
+  gold_transaction_amount = dword_4F08EC[v1];
+  if ( v4->CanAct() )
+  {
+    if ( (unsigned __int16)_449B57_test_bit((unsigned __int8 *)v2->field_152, dword_F8B1AC_something_todo_with_awards) )
     {
       return pNPCTopics[123].pText;
     }
@@ -10006,7 +10027,7 @@
       if ( gold_transaction_amount <= pParty->uNumGold )
       {
         dword_F8B1A8 = 1;
-        return pNPCTopics[pEventNumber + 110].pText;
+        return pNPCTopics[v1 + 110].pText;
       }
       else
       {
@@ -10022,7 +10043,7 @@
 
 
 //----- (004B2A74) --------------------------------------------------------
-char __cdecl SimpleHouseAndBoatsDialog()
+char __cdecl SimpleHouseDialog()
 {
   char *v0; // esi@3
   char *v1; // ST1C_4@3
@@ -10084,7 +10105,7 @@
   NPCData *v58; // [sp+118h] [bp-4h]@6
 
   memcpy(&a1, pDialogueWindow, sizeof(a1));
-  if ( pDialogueNPCCount == uNumDialogueNPCPortraits && uHouse_ExitPic )
+  if ( array_5913D8[6] == (NPCData *)uNumDialogueNPCPortraits && uHouse_ExitPic )
   {
     v0 = pMapStats->pInfos[uHouse_ExitPic].pName;
     v1 = pMapStats->pInfos[uHouse_ExitPic].pName;
@@ -10108,7 +10129,7 @@
   }
   a1.uFrameWidth -= 10;
   a1.uFrameZ -= 10;
-  v58 = HouseNPCData[(unsigned int)((char *)pDialogueNPCCount + -(dword_591080 != 0) - 1)];
+  v58 = array_5913D8[(unsigned int)((char *)array_5913D8[6] + -(dword_591080 != 0) - 1)];
   v6 = v58;
   v55 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xCDu, 0x23u);
   v7 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0x15u, 0x99u, 0xE9u);
@@ -10183,7 +10204,7 @@
         v27 = v26 - 3;
         if ( !v27 )
         {
-          v33 = (char *)ContractSelectText((int)v52.ptr_1C);
+          v33 = (char *)sub_4B29F2((int)v52.ptr_1C);
           goto LABEL_44;
         }
         v28 = v27 - 1;
@@ -11040,20 +11061,42 @@
 }
 
 //----- (004B3EF0) --------------------------------------------------------
-void __fastcall DrawJoinGuildWindow(int pEventNumber)
-{
-  //int v1; // edi@1
-
-  //v1 = a4;
+void __fastcall sub_4B3EF0(int a4)
+{
+  int v1; // edi@1
+
+  v1 = a4;
   uDialogueType = 81;
-  ptr_F8B1E8 = (char *)pNPCTopics[pEventNumber + 99].pText;
-  ContractSelectText(pEventNumber);
+  ptr_F8B1E8 = (char *)pNPCTopics[a4 + 99].pText;
+  sub_4B29F2(a4);
   pDialogueWindow->Release();
-  pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x15E, WINDOW_MainMenu, pEventNumber, 0);
-  pBtn_ExitCancel = pDialogueWindow->CreateButton(0x1D7, 0x1BD, 0xA9, 0x23, 1, 0, 0x71, 0, 0, pGlobalTXT_LocalizationStrings[34],
-                 (Texture *)(uTextureID_506438 != -1 ? &pIcons_LOD->pTextures[uTextureID_506438] : 0), 0);
+  pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x15E, WINDOW_MainMenu, v1, 0);
+  pBtn_ExitCancel = pDialogueWindow->CreateButton(
+                 0x1D7,
+                 0x1BD,
+                 0xA9,
+                 0x23,
+                 1,
+                 0,
+                 0x71,
+                 0,
+                 0,
+                 pGlobalTXT_LocalizationStrings[34],
+                 (Texture *)(uTextureID_506438 != -1 ? &pIcons_LOD->pTextures[uTextureID_506438] : 0),
+                 0);
   pDialogueWindow->CreateButton(0, 0, 0, 0, 1, 0, 0x51u, 0, 0, "", 0);
-  pDialogueWindow->CreateButton(0x1E0u, 0xA0u, 0x8Cu, 0x1Eu, 1, 0, 0xAFu, 0x52u, 0, pGlobalTXT_LocalizationStrings[122], 0);
+  pDialogueWindow->CreateButton(
+    0x1E0u,
+    0xA0u,
+    0x8Cu,
+    0x1Eu,
+    1,
+    0,
+    0xAFu,
+    0x52u,
+    0,
+    pGlobalTXT_LocalizationStrings[122],
+    0);
   pDialogueWindow->_41D08F(1, 1, 0, 2);
   dword_F8B19C = -1;
 }
@@ -11102,7 +11145,7 @@
   NPCData *v1; // edi@1
 
   v0 = 0;
-  v1 = HouseNPCData[(unsigned int)((char *)pDialogueNPCCount + -(dword_591080 != 0) - 1)];
+  v1 = array_5913D8[(unsigned int)((char *)array_5913D8[6] + -(dword_591080 != 0) - 1)];
   pDialogueWindow->Release();
   pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x15Eu, WINDOW_MainMenu, 0, 0);
   pBtn_ExitCancel = pDialogueWindow->CreateButton(
@@ -11167,7 +11210,7 @@
   NPCData *v17; // [sp+10h] [bp-4h]@4
 
   num_menu_buttons = 0;
-  pDialogueNPCCount = (_this + 1);
+  array_5913D8[6] = (NPCData *)(_this + 1);
   if ( _this + 1 == uNumDialogueNPCPortraits && uHouse_ExitPic )
   {
     pDialogueWindow->Release();
@@ -11184,7 +11227,7 @@
   }
   else
   {
-    v17 = HouseNPCData[_this + 1 - ((dword_591080 != 0) + 1)];
+    v17 = array_5913D8[_this + 1 - ((dword_591080 != 0) + 1)];
     if ( dword_F8B19C == -1 )
     {
       pDialogueWindow->Release();
@@ -11192,14 +11235,14 @@
     else
     {
       for ( i = 0; i < uNumDialogueNPCPortraits; ++i )
-        GUIButton::_41D0D8((GUIButton *)HouseNPCData[i + 7]);
+        GUIButton::_41D0D8((GUIButton *)array_5913D8[i + 7]);
     }
     pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x159u, WINDOW_MainMenu, 0, 0);
     pBtn_ExitCancel = pDialogueWindow->CreateButton(  471u,  445u,  169u, 35u,  1,   0, 0x71u,  0,  0,
                    pGlobalTXT_LocalizationStrings[74],// "End Conversation"
                    (Texture *)(uTextureID_506438 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_506438] : 0),   0);
     pDialogueWindow->CreateButton(8u, 8u, 0x1C2u, 0x140u, 1, 0, 0x51u, 0, 0, "", 0);
-    if ( pDialogueNPCCount == 1 && dword_591080 )
+    if ( array_5913D8[6] == (NPCData *)1 && dword_591080 )
     {
       sub_4B3B42(dword_F8B198);
     }
@@ -12167,7 +12210,8 @@
   {
     do
     {
-      if ( pParty->field_777C[9 * (v49 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] )
+     // if ( pParty->field_777C[9 * (v49 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] )
+	 if ( pParty->field_777C[(unsigned int)window_SpeakInHouse->ptr_1C][v49].uItemID);
       {
         v50 = dword_F8B168[v49];
         v51 = 152 - v50->uTextureHeight;
@@ -12199,7 +12243,8 @@
     v122 = 0;
     do
     {
-      if ( pParty->field_777C[9 * (v122 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 54] )
+      //if ( pParty->field_777C[9 * (v122 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 54] )
+	if ( pParty->field_777C[(unsigned int)window_SpeakInHouse->ptr_1C][v122+1].uItemID);
       {
         v54 = dword_F8B168[v122 + 6];
         v55 = 306 - v54->uTextureHeight;
@@ -12229,7 +12274,8 @@
   {
     do
     {
-      if ( pParty->field_C59C[9 * (v49 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] )
+     // if ( pParty->field_C59C[9 * (v49 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] )
+	if (pParty->Recipes_Item[(unsigned int)window_SpeakInHouse->ptr_1C][v49].uItemID)
       {
         v58 = dword_F8B168[v49];
         v59 = 152 - v58->uTextureHeight;
@@ -12261,7 +12307,8 @@
     v122 = 0;
     do
     {
-      if ( pParty->field_C59C[9 * (v122 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 778] )
+      //if ( pParty->Spell_Item[(unsigned int)window_SpeakInHouse->ptr_1C][v49] + 778] )  //weak
+		if (pParty->Recipes_Item[(unsigned int)window_SpeakInHouse->ptr_1C][v49].uAttributes)
       {
         v62 = dword_F8B168[v122 + 6];
         v63 = 306 - v62->uTextureHeight;
@@ -12298,7 +12345,7 @@
     {
       do
       {
-        if ( pParty->field_777C[9 * (v66 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] )
+        if ( pParty->field_777C[(unsigned int)window_SpeakInHouse->ptr_1C][v66].uItemID); //9 * (v66 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] )
           ++v117;
         ++v66;
       }
@@ -12308,7 +12355,8 @@
     {
       do
       {
-        if ( pParty->field_C59C[9 * (v66 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] )
+        //if ( pParty->field_C59C[9 * (v66 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] )
+	  if (pParty->Recipes_Item[(unsigned int)window_SpeakInHouse->ptr_1C][v66].uItemID)
           ++v117;
         ++v66;
       }
@@ -12341,10 +12389,11 @@
       v71 = (pRenderer->pActiveZBuffer[result] & 0xFFFF) - 1;
       v117 = v71;
       v72 = (int)window_SpeakInHouse->ptr_1C;
-      v73 = 9 * (v71 + 12 * v72);
-      v74 = (ItemGen *)&pParty->field_777C[v73];
+     // v73 = 9 * (v71 + 12 * v72);
+      v74 = (ItemGen *)&pParty->field_777C[v72][v71];
       if ( dword_F8B19C != 2 )
-        v74 = (ItemGen *)&pParty->field_C59C[v73 + 724];
+       // v74 = (ItemGen *)&pParty->field_C59C[v73 + 724];
+	      v74 =&pParty->Recipes_Item[v72][v71];
       if ( v67 && Str )
       {
         v10 = pGlobalTXT_LocalizationStrings[181];// "Steal %24"
@@ -12377,7 +12426,7 @@
   //unsigned int v1; // esi@1
   NPCData *v2; // ebp@1
   //unsigned int v3; // eax@1
-  int pEventNumber; // ecx@10
+  int v4; // ecx@10
   signed int v5; // edi@14
   char *v6; // esi@15
   const char *v7; // ecx@22
@@ -12403,12 +12452,12 @@
   {
     if ( newDialogueType == DIALOGUE_23 )
     {
-      pEventNumber = v2->evt_E;
+      v4 = v2->evt_E;
       goto LABEL_74;
     }
     if (newDialogueType == DIALOGUE_24)
     {
-      pEventNumber = v2->evt_F;
+      v4 = v2->evt_F;
       goto LABEL_74;
     }
     if (newDialogueType != DIALOGUE_76)
@@ -12530,7 +12579,7 @@
   }
   if (newDialogueType == DIALOGUE_22)
   {
-    pEventNumber = v2->evt_D;
+    v4 = v2->evt_D;
     goto LABEL_74;
   }
   if (newDialogueType == DIALOGUE_9)
@@ -12579,23 +12628,23 @@
   }
   if (newDialogueType == DIALOGUE_19)
   {
-    pEventNumber = v2->evt_A;
+    v4 = v2->evt_A;
     goto LABEL_74;
   }
   if (newDialogueType == DIALOGUE_20)
   {
-    pEventNumber = v2->evt_B;
+    v4 = v2->evt_B;
     goto LABEL_74;
   }
   if (newDialogueType == DIALOGUE_21)
   {
-    pEventNumber = v2->evt_C;
+    v4 = v2->evt_C;
 LABEL_74:
-    if ( pEventNumber < 200 || pEventNumber > 310 )
-    {
-      if ( pEventNumber < 400 || pEventNumber > 410 )
-      {
-        switch ( pEventNumber )
+    if ( v4 < 200 || v4 > 310 )
+    {
+      if ( v4 < 400 || v4 > 410 )
+      {
+        switch ( v4 )
         {
           case 139:
             sub_4B1ECE();
@@ -12609,7 +12658,7 @@
           default:
             _5C3420_pDecoration = (LevelDecoration *)1;
             ptr_F8B1E8 = 0;
-            EventProcessor(pEventNumber, 0, 1);
+            EventProcessor(v4, 0, 1);
             _5C3420_pDecoration = 0;
             break;
         }
@@ -12617,12 +12666,12 @@
       else
       {
         dword_F8B1D8 = newDialogueType;
-        DrawJoinGuildWindow(pEventNumber - 400);
+        sub_4B3EF0(v4 - 400);
       }
     }
     else
     {
-      sub_4B3FE5(pEventNumber);
+      sub_4B3FE5(v4);
     }
   }
 LABEL_87:
@@ -13441,7 +13490,7 @@
 
 
 //----- (004B8F94) --------------------------------------------------------
-void *__cdecl sub_4B8F94()
+void  sub_4B8F94()
 {
   GUIWindow *v0; // edi@1
   signed int v1; // ebp@1
@@ -13491,18 +13540,21 @@
 LABEL_12:
           v6 = v12;
 LABEL_13:
-          pItemsTable->GenerateItem(v5, v6, (ItemGen *)&pParty->field_C59C[9 * (v1 + 12 * v3) + 724]);
+          pItemsTable->GenerateItem(v5, v6,&pParty->Recipes_Item[v3][v1]);//(ItemGen *)&pParty->field_C59C[9 * (v1 + 12 * v3) + 724]);
           v0 = window_SpeakInHouse;
           v2 = (int)&window_SpeakInHouse->ptr_1C;
-          pParty->field_C59C[9 * (v1 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 729] = 1;
+         // pParty->field_C59C[9 * (v1 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 729] = 1;
+		  pParty->Recipes_Item[(unsigned int)window_SpeakInHouse->ptr_1C][v1].uAttributes= 1;
           goto LABEL_14;
         }
-        auto _a = (ItemGen *)&pParty->field_C59C[9 * (v1 + 12 * v3) + 724];
+       // auto _a = (ItemGen *)&pParty->field_C59C[9 * (v1 + 12 * v3) + 724];
+		 auto _a =&pParty->Recipes_Item[v3][v1];
         _a->Reset();
-        v2 = (int)&v0->ptr_1C;
-        v10 = rand();
-        v0 = window_SpeakInHouse;
-        pParty->field_C59C[9 * (v1 + 12 * *(int *)v2) + 724] = v10 % 32 + 740;
+	//	v2 = (int)&v0->ptr_1C;
+		//v10 = rand();
+	//	v0 = window_SpeakInHouse;
+       // pParty->field_C59C[9 * (v1 + 12 * *(int *)v2) + 724] = v10 % 32 + 740;
+		   pParty->Recipes_Item[(int)v0->ptr_1C][v1].uItemID= rand() % 32 + 740;
       }
 LABEL_14:
       v3 = *(int *)v2;
@@ -13519,8 +13571,7 @@
   }
 LABEL_15:
   result = v0->ptr_1C;
-  *(int *)&pParty->field_16154[4 * (int)result] = 0;
-  return result;
+  pParty->field_16154[(int)v0->ptr_1C] = 0;
 }
 
 
@@ -14785,7 +14836,7 @@
         //if ( !(*(char *)v6 & 0x80) )
       {
         v7 = uNumDialogueNPCPortraits++ - dword_591080 ? 1 : 0;
-        HouseNPCData[v7] = npc;
+        array_5913D8[v7] = npc;
         //v6 = v17;
         //*(&v13 + v2) = *(v17 - 1);
         Dst[uNumDialogueNPCPortraits - 1] = npc->uPortraitID;
@@ -14999,14 +15050,14 @@
     }
 
     v17 = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
-    pDialogueNPCCount = 0;
+    array_5913D8[6] = 0;
     pTexture_Dialogue_Background = &pIcons_LOD->pTextures[v17];
     uTextureID_507B04 = uTextureID_right_panel;
     PrepareHouse(uHouseID);
     v18 = 1;
     uTextureID_507B04 = uTextureID_right_panel;
     if ( uNumDialogueNPCPortraits == 1 )
-      pDialogueNPCCount = 1;
+      array_5913D8[6] = (NPCData *)1;
     pVideoPlayer->_4BF28F(pAnimatedRooms[uCurrentHouse_Animation].field_0, 1u);
     if ( (signed int)uHouseID < 139 || (signed int)uHouseID > 172 )
     {