diff mm7_4.cpp @ 502:dd5124185551

Слияние
author Ritor1
date Fri, 01 Mar 2013 17:38:04 +0600
parents 6fa3ff8ef729 0e20e886365d
children 7c86030324a5
line wrap: on
line diff
--- a/mm7_4.cpp	Fri Mar 01 17:37:47 2013 +0600
+++ b/mm7_4.cpp	Fri Mar 01 17:38:04 2013 +0600
@@ -9263,17 +9263,11 @@
 void __fastcall HousePlaySomeSound(unsigned int uHouseID, int a2)
 {
   //if ( BYTE1(pAnimatedRooms[p2DEvents_minus1___02[26 * uHouseID]].field_C) )
-  if ( pAnimatedRooms[p2DEvents[uHouseID - 1].uAnimationID].field_d )
+  if ( pAnimatedRooms[p2DEvents[uHouseID - 1].uAnimationID].uRoomSoundId )
     pAudioPlayer->PlaySound(
       //(SoundID)(a2 + 100 * (BYTE1(pAnimatedRooms[p2DEvents_minus1___02[26 * uHouseID]].field_C) + 300)),
-      (SoundID)(a2 + 100 * (pAnimatedRooms[p2DEvents[uHouseID - 1].uAnimationID].field_d) + 300),
-      806,
-      0,
-      -1,
-      0,
-      0,
-      0,
-      0);
+      (SoundID)(a2 + 100 * (pAnimatedRooms[p2DEvents[uHouseID - 1].uAnimationID].uRoomSoundId) + 300),
+      806, 0, -1, 0, 0, 0, 0);
 }
 
 //----- (004B1ECE) --------------------------------------------------------
@@ -11726,7 +11720,7 @@
       return (int)v112.DrawTitleText(pFontArrus, v3, v6, v92, v95, v97);
     }
   }
-  pRenderer->DrawTextureIndexed(8u, 8u, dword_F8B164);
+  pRenderer->DrawTextureIndexed(8u, 8u, ShopTexture);
   v3 = 0;
   v49 = 0;
   v122 = 0;
@@ -12274,11 +12268,11 @@
 
 
 //----- (004B5D7C) --------------------------------------------------------
-int __cdecl GuildDialog()
+void GuildDialog()
 {
   GUIWindow *v0; // ebx@1
-  Player *v1; // edi@1
-  signed int v2; // ebx@1
+  Player *currPlayer; // edi@1
+  signed int base_teach_price; // ebx@1
   int v3; // edi@6
   int result; // eax@11
   unsigned int v5; // ebx@13
@@ -12287,7 +12281,7 @@
   int v8; // esi@22
   signed int v9; // ecx@22
   char *v10; // eax@22
-  const char *v11; // ecx@26
+  const char *statusbar_string; // ecx@26
   POINT *v12; // esi@30
   int v13; // ecx@30
   void *v14; // ST1C_4@31
@@ -12328,12 +12322,12 @@
   char v49[100]; // [sp+19Ch] [bp-150h]@3
   POINT v50; // [sp+264h] [bp-88h]@30
   POINT v51; // [sp+26Ch] [bp-80h]@30
-  GUIWindow v52; // [sp+274h] [bp-78h]@1
+  GUIWindow working_window; // [sp+274h] [bp-78h]@1
   signed int v53; // [sp+27Ch] [bp-70h]@1
   signed int v54; // [sp+284h] [bp-68h]@1
   int v55; // [sp+2C8h] [bp-24h]@47
-  int v56; // [sp+2CCh] [bp-20h]@1
-  int v57; // [sp+2D0h] [bp-1Ch]@1
+  int main_text_color; // [sp+2CCh] [bp-20h]@1
+  int hi_text_color; // [sp+2D0h] [bp-1Ch]@1
   Player *v58; // [sp+2D4h] [bp-18h]@1
   unsigned __int8 uPlayerID; // [sp+2DBh] [bp-11h]@31
   char *Str; // [sp+2DCh] [bp-10h]@35
@@ -12342,19 +12336,19 @@
   int v63; // [sp+2E8h] [bp-4h]@1
 
   v0 = window_SpeakInHouse;
-  memcpy(&v52, window_SpeakInHouse, sizeof(v52));
+  memcpy(&working_window, window_SpeakInHouse, sizeof(GUIWindow));
   v58 = pPlayers[uActiveCharacter];
-  v1 = v58;
-  v52.uFrameX = 483;
-  v53 = 148;
-  v54 = 334;
-  v56 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu);
-  v57 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu);
+  currPlayer = v58;
+  working_window.uFrameX = 483;
+  working_window.uFrameWidth = 148;
+  working_window.uFrameZ = 334;
+  main_text_color = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu);
+  hi_text_color = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu);
   //v2 = (signed __int64)(p2DEvents_minus1__20[13 * (unsigned int)v0->ptr_1C] * 500.0);
-  v2 = (signed __int64)(p2DEvents[(unsigned int)v0->ptr_1C - 1].fPriceMultiplier * 500.0);
-  v63 = v2 * (100 - v1->GetMerchant()) / 100;
-  if ( v63 < v2 / 3 )
-    v63 = v2 / 3;
+  base_teach_price = (signed __int64)(p2DEvents[(unsigned int)v0->ptr_1C - 1].fPriceMultiplier * 500.0);
+  v63 = base_teach_price * (100 - currPlayer->GetMerchant()) / 100;
+  if ( v63 < base_teach_price / 3 )
+    v63 = base_teach_price / 3;
   strcpy(Dest, "");
   strcpy(v46, "");
   strcpy(v47, "");
@@ -12362,14 +12356,14 @@
   strcpy(v49, "");
   if ( dword_F8B19C != 1 )
   {
-    if ( dword_F8B19C != 18 )
+    if ( dword_F8B19C != 18 ) //buy skill
     {
       if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
       {
-        v3 = (int)(&v1->uIntelligence + dword_F8B19C);
-        if ( *(short *)v3 )
-        {
-          sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[403], pClassNames[dword_F8B19C + 20]);
+        //v3 = (int)(&currPlayer->uIntelligence + dword_F8B19C); //test skill
+        if ( v58->pActiveSkills[dword_F8B19C-36] )
+        {
+          sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[403], pClassNames[dword_F8B19C - 16]); //"You already know the %s skill"
           ShowStatusBarString(pTmpBuf, 2u);
           pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0);
         }
@@ -12377,89 +12371,86 @@
         {
           if ( pParty->uNumGold < v63 )
           {
-            ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u);
+            ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u); //"You don't have enough gold"
             HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 2);
           }
           else
           {
             Party::TakeGold(v63);
-            *(short *)v3 = 1;
-          }
-        }
-      }
-      /*result = pMessageQueue_50CBD0->uNumMessages;
-      if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
-      {
-        pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113;
-        pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1;
-        result = 3 * pMessageQueue_50CBD0->uNumMessages + 3;
-        *(&pMessageQueue_50CBD0->uNumMessages + result) = 0;
-        ++pMessageQueue_50CBD0->uNumMessages;
-      }*/
+            v58->pActiveSkills[dword_F8B19C-36] = 1;
+          }
+        }
+      }
       pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
-      return 1; // void function actually
-    }
-    pRenderer->DrawTextureIndexed(8u, 8u, dword_F8B164);
+      return;
+    }
+    pRenderer->DrawTextureIndexed(8u, 8u, ShopTexture);
     v5 = 0;
     v6 = 0;
     v62 = 0;
     v63 = 32;
     do
     {
-      if ( *(&pParty->pPlayers[1].pInstalledBeacons[0].field_18 + 9 * (v6 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)) )
+		if (pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C-139][v6].uItemID)
+     // if ( *(&pParty->pPlayers[1].pInstalledBeacons[0].field_18 + 9 * (v6 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)) )
+	  
       {
         pRenderer->DrawTextureTransparent(v63, 0x5Au, ItemsInShopTexture[v6]);
         ZBuffer_DoFill((int *)((char *)pRenderer->pActiveZBuffer + v62 + 230528), ItemsInShopTexture[v6], v6 + 1);
-        v1 = v58;
+        currPlayer = v58;
       }
       v63 += 70;
       v62 += 280;
       ++v6;
     }
     while ( v63 < 452 );
+
     v62 = 1680;
     v7 = 6;
     v63 = 32;
     do
     {
-      if ( *(&pParty->pPlayers[1].pInstalledBeacons[0].field_18 + 9 * (v7 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)) )
+	if (pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C-139][v7].uItemID)
+     // if ( *(&pParty->pPlayers[1].pInstalledBeacons[0].field_18 + 9 * (v7 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)) )
       {
         pRenderer->DrawTextureTransparent(v63, 0xFAu, ItemsInShopTexture[v7]);
         ZBuffer_DoFill((int *)((char *)pRenderer->pActiveZBuffer + v62 + 638448), ItemsInShopTexture[v7], v7 + 1);
-        v1 = v58;
+        currPlayer = v58;
       }
       v63 += 70;
       v62 += 280;
       ++v7;
     }
     while ( v63 < 452 );
-    result = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win();
-    if ( result )
+
+    if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
     {
       v8 = 0;
       v9 = 12;
-      v10 = (char *)(&pParty->pPlayers[1].pInstalledBeacons[0].field_18 + 108 * (unsigned int)window_SpeakInHouse->ptr_1C);
+     // v10 = (char *)(&pParty->pPlayers[1].pInstalledBeacons[0].field_18 + 108 * (unsigned int)window_SpeakInHouse->ptr_1C);
+	//  v10 =
       do
       {
-        if ( *(int *)v10 )
+        if (pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C-139][v9].uItemID )
           ++v8;
-        v10 += 36;
+       // v10 += 36;
         --v9;
       }
       while ( v9 );
+
       GetAsyncKeyState(17);
-      v11 = pGlobalTXT_LocalizationStrings[195];
+      statusbar_string = pGlobalTXT_LocalizationStrings[195]; //"Select the Item to Buy"
       if ( dword_F8B19C != 2 )
-        v11 = pGlobalTXT_LocalizationStrings[196];
-      DrawTextAtStatusBar(v11, 0);
+        statusbar_string = pGlobalTXT_LocalizationStrings[196]; //"Select the Special Item to Buy"	
+      DrawTextAtStatusBar(statusbar_string, 0);
       if ( !v8 )
 		  {
-        v52.DrawCurrentTime(
+        working_window.DrawCurrentTime(
                       __PAIR__(
                         *(int *)&stru_AA1058[3].pSounds[8 * (unsigned int)window_SpeakInHouse->ptr_1C + 44472],
                         *(int *)&stru_AA1058[3].pSounds[8 * (unsigned int)window_SpeakInHouse->ptr_1C + 44468])
                     - pParty->uTimePlayed);
-		return 0;
+		return;
 		  }
       v12 = pMouse->GetCursorPos(&v51);
       result = v12->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v50)->y];
@@ -12470,40 +12461,27 @@
         v15 = (ItemGen *)(&pParty->pPlayers[1].uExpressionTimeLength + 18 * (v13 + 12 * (int)v14));
         v16 = (int)window_SpeakInHouse->ptr_1C;
         uPlayerID = uActiveCharacter - 1;
-        v17 = v1->_490EEE(
-                (ItemGen *)&pParty->pPlayers[1].uExpressionTimeLength + v13 + 12 * (int)v14,
-                3,
-                v16,
-                2);
-        v18 = BuilDialogueString((char *)pMerchantsBuyPhrases[v17], uPlayerID, v15, (char *)v14, 2, 0);
-        v44 = 3;
-        v43 = v18;
-        v42 = v56;
-        v41 = 0;
-        v40 = 0;
-        v39 = &v52;
-LABEL_32:
-        v19 = pFontArrus->CalcTextHeight(v18, v39, v40, v41);
-        return (int)v52.DrawTitleText(pFontArrus, v5, (174 - v19) / 2 + 138, v42, v43, v44);
-      }
-    }
-    return result;
+        v17 = currPlayer->_490EEE( (ItemGen *)&pParty->pPlayers[1].uExpressionTimeLength + v13 + 12 * (int)v14, 3, v16,  2);
+        v18 = BuilDialogueString((char *)pMerchantsBuyPhrases[v17], uPlayerID, v15, (char *)v14, 2, 0);     
+        v19 = pFontArrus->CalcTextHeight(v18, &working_window, 0, 0);
+        working_window.DrawTitleText(pFontArrus, 0, (174 - v19) / 2 + 138,  main_text_color, v18, 3);
+        return;
+      }
+    }
+    return;
   }
   if ( !(unsigned __int16)_449B57_test_bit(
-                            (unsigned __int8 *)v1->_guilds_member_bits,
-                            word_4F0704[(unsigned int)window_SpeakInHouse->ptr_1C-139]) )
-  {
-    v36 = pNPCTopics[121].pText;
-    v37 = v57;
-    v38 = pFontArrus->CalcTextHeight(pNPCTopics[121].pText, &v52, 0, 0);
-    v52.DrawTitleText(pFontArrus, 0, (212 - v38) / 2 + 101, v37, v36, 3u);
-    result = (int)pDialogueWindow;
+                            (unsigned __int8 *)currPlayer->_guilds_member_bits,
+                            guild_mambership_flags[(unsigned int)window_SpeakInHouse->ptr_1C-139]) )
+  { //you must me member
+    v38 = pFontArrus->CalcTextHeight(pNPCTopics[121].pText, &working_window, 0, 0);
+    working_window.DrawTitleText(pFontArrus, 0, (212 - v38) / 2 + 101, hi_text_color, pNPCTopics[121].pText, 3u);
     pDialogueWindow->pNumPresenceButton = 0;
-    return result;
-  }
-  result = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win();
-  if ( !result )
-    return result;
+    return;
+  }
+
+  if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
+    return;
   v20 = pDialogueWindow;
   v5 = 0;
   v62 = 0;
@@ -12511,29 +12489,32 @@
   v21 = pDialogueWindow->pStartingPosActiveItem;
   v22 = v21 + pDialogueWindow->pNumPresenceButton;
   v61 = 0;
-  if ( v21 >= v22 )
-    goto LABEL_64;
+  if ( pDialogueWindow->pStartingPosActiveItem >= pDialogueWindow->pStartingPosActiveItem+pDialogueWindow->pNumPresenceButton )
+	  {
+	  sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]); // "Seek knowledge elsewhere %s the %s"	
+	strcat(pTmpBuf, "\n \n");
+	strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]); //"I can offer you nothing further."
+	v19 = pFontArrus->CalcTextHeight(pTmpBuf, &working_window, 0, 0);
+	working_window.DrawTitleText(pFontArrus, v5, (174 - v19) / 2 + 138, hi_text_color, pTmpBuf, 3);
+	return;
+	  }
   do
   {
     v23 = v20->GetControl(v21)->uControlParam;
     if ( v23 == 18 )
     {
-      v25 = pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[400], &v52, 0, 0);
+      v25 = pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[400], &working_window, 0, 0); //"Buy Spells"
       v62 += v25;
       ++v61;
     }
     else
     {
-      __debugbreak();
-      //pSkillAvailabilityPerClass[8 + v58->uClass][4 + v23]
-      // or
-      //byte_4ED970_skill_learn_ability_by_class_table[v58->uClass][v23 - 36]
+     
+     if((byte_4ED970_skill_learn_ability_by_class_table[v58->classType][v23-36])&&(v58->pActiveSkills[v23-36]))
       // or
       //byte_4ED970_skill_learn_ability_by_class_table[v58->uClass - 1][v23 + 1]
-
-      //if ( *(&byte_4ED94C[37 * v58->uClass] + v23) && !*(&v58->uIntelligence + v23) )
-      {
-        v24 = pFontArrus->CalcTextHeight(pClassNames[v23 + 20], &v52, 0, 0);
+      {
+        v24 = pFontArrus->CalcTextHeight(pClassNames[v23 - 16], &working_window, 0, 0);
         v62 += v24;
         ++v61;
         ++Str;
@@ -12545,31 +12526,25 @@
   if ( !v61 )
   {
 LABEL_64:
-    sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], v58->pName, pClassNames[v58->classType]);
+    sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], v58->pName, pClassNames[v58->classType]); // "Seek knowledge elsewhere %s the %s"	
     strcat(pTmpBuf, "\n \n");
-    strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]);
-    v18 = pTmpBuf;
-    v44 = 3;
-    v43 = pTmpBuf;
-    v42 = v57;
-    v41 = 0;
-    v40 = 0;
-    v39 = &v52;
-    goto LABEL_32;
+    strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]); //"I can offer you nothing further."
+	v19 = pFontArrus->CalcTextHeight(pTmpBuf, &working_window, 0, 0);
+	working_window.DrawTitleText(pFontArrus, v5, (174 - v19) / 2 + 138, hi_text_color, pTmpBuf, 3);
+	return;
   }
   if ( Str )
   {
-    sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], v63);
-    v52.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u);
+    sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], v63); //"Skill Cost: %lu"
+    working_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u);
   }
   v63 = (signed int)(149 - v62) / v61;
   if ( v63 > 32 )
     v63 = 32;
-  result = v20->pStartingPosActiveItem;
   v26 = (signed int)(149 - v61 * v63 - v62) / 2 - v63 / 2 + 162;
-  v62 = result;
+  v62 = v20->pStartingPosActiveItem;
   v55 = v26;
-  if ( result < result + v20->pNumPresenceButton )
+  if (v20->pStartingPosActiveItem < v20->pStartingPosActiveItem + v20->pNumPresenceButton )
   {
     v61 = 2;
     while ( 1 )
@@ -12580,30 +12555,33 @@
       if ( v29 == 18 )
         break;
 
-      __debugbreak();
+    //  __debugbreak();
       //pSkillAvailabilityPerClass[8 + v58->uClass][4 + v23]
       // or
-      //byte_4ED970_skill_learn_ability_by_class_table[v58->uClass][v23 - 36]
+      if ((byte_4ED970_skill_learn_ability_by_class_table[v58->classType][v29 - 36])&&(v58->pActiveSkills[v29-36]))
       // or
       //byte_4ED970_skill_learn_ability_by_class_table[v58->uClass - 1][v23 + 1]
 
-      //if ( *(&byte_4ED94C[37 * v58->uClass] + v29) && !*(&v58->uIntelligence + v29) )
-      {
-        v30 = pClassNames[v29 + 20];
+      {
+        v30 = pClassNames[v29 -16];
 LABEL_55:
         Str = v30;
         v28->uY = v63 + v55;
-        v31 = pFontArrus->CalcTextHeight(v30, &v52, 0, 0);
+        v31 = pFontArrus->CalcTextHeight(v30, &working_window, 0, 0);
         v32 = v28->uY;
         v28->uHeight = v31;
         v33 = v32 + v31 - 1;
         v28->uW = v33;
         v55 = v33;
-        v34 = v57;
+        v34 = hi_text_color;
         if ( pDialogueWindow->pCurrentPosActiveItem != v61 )
-          v34 = v56;
-        v52.DrawTitleText(pFontArrus, 0, v32, v34, Str, 3u);
-        goto LABEL_58;
+          v34 = main_text_color;
+        working_window.DrawTitleText(pFontArrus, 0, v32, v34, Str, 3u);
+		v35 = v20->pStartingPosActiveItem;
+		++v62;
+		++v61;
+		if ( (signed int)v62 >=v20->pNumPresenceButton +v20->pStartingPosActiveItem  )
+			return;
       }
       v28->uW = 0;
       v28->uHeight = 0;
@@ -12611,22 +12589,21 @@
 LABEL_58:
       v35 = v20->pStartingPosActiveItem;
       ++v62;
-      result = v20->pNumPresenceButton + v35;
       ++v61;
-      if ( (signed int)v62 >= result )
-        return result;
-    }
-    v30 = pGlobalTXT_LocalizationStrings[400];
+      if ( (signed int)v62 >=v20->pNumPresenceButton +v20->pStartingPosActiveItem  )
+        return;
+    }
+    v30 = pGlobalTXT_LocalizationStrings[400]; //"Buy Spells"
     goto LABEL_55;
   }
-  return result;
+  return;
 }
 
 
 
 //----- (004B705E) --------------------------------------------------------
-int __cdecl TampleDialog()
-{
+void TempleDialog()
+	{
   GUIWindow *v0; // ebx@1
   Player *v1; // esi@1
   int v2; // edi@1
@@ -12710,11 +12687,10 @@
     {
       if ( dword_F8B19C != 11 )
       {
-        result = dword_F8B19C - 96;
+
         if ( dword_F8B19C == 96 )
         {
-          result = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win();
-          if ( result )
+          if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
           {
             v4 = pDialogueWindow;
             v61 = pDialogueWindow;
@@ -12808,7 +12784,7 @@
             }
           }
         }
-        return result;
+        return;
       }
 
       // DONATION
@@ -12873,9 +12849,8 @@
       }
       goto LABEL_55;
     }
-    result = v1->_4B6FF9();
-    if ( !result )
-      return result;
+    if ( !v1->_4B6FF9() )
+      return;
     v25 = 0;
     if ( pParty->uNumGold < v2 )
     {
@@ -12931,17 +12906,8 @@
     v1->PlaySound(SPEECH_82, 0);
     pOtherOverlayList->_4418B1(20, uActiveCharacter + 99, 0, 65536);
 LABEL_46:
-    /*result = pMessageQueue_50CBD0->uNumMessages;
-    if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
-    {
-      pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113;
-      pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1;
-      result = 3 * pMessageQueue_50CBD0->uNumMessages + 3;
-      *(&pMessageQueue_50CBD0->uNumMessages + result) = v25;
-      ++pMessageQueue_50CBD0->uNumMessages;
-    }*/
     pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, v25);
-    return result; // void func
+    return ; // void func
   }
   v63 = 1;
   v41 = pDialogueWindow->GetControl(pDialogueWindow->pStartingPosActiveItem);
@@ -12976,10 +12942,9 @@
   v64 = (174 - (signed int)v66) / v46;
   if ( v64 > 32 )
     v64 = 32;
-  result = v43->pStartingPosActiveItem;
   v47 = (174 - v64 * v46 - (signed int)v66) / 2 - v64 / 2 + 138;
-  v65 = v42 + result;
-  if ( v42 + result < result + v43->pNumPresenceButton )
+  v65 = v42 + v43->pStartingPosActiveItem;
+  if ( v42 + v43->pStartingPosActiveItem < v43->pStartingPosActiveItem + v43->pNumPresenceButton )
   {
     v61 = (GUIWindow *)(v42 + 2);
     v66 = (DDM_DLV_Header *)&a1[100 * v42];
@@ -13002,11 +12967,10 @@
       v66 = (DDM_DLV_Header *)((char *)v66 + 100);
       v61 = (GUIWindow *)((char *)v61 + 1);
       ++v65;
-      result = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem;
-    }
-    while ( (signed int)v65 < result );
-  }
-  return result;
+    }
+    while ( (signed int)v65 < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem );
+  }
+  return;
 }
 
 
@@ -14186,7 +14150,7 @@
 LABEL_20:
   pDialogueWindow = GUIWindow::Create(0, 0, 640, 480, (enum WindowType)26, 0, (int)sHouseName);
   //if ( BYTE1(pAnimatedRooms[p2DEvents_minus1___02[26 * v9]].field_C) )
-  if ( pAnimatedRooms[p2DEvents[v9 - 1].uAnimationID].field_d )
+  if ( pAnimatedRooms[p2DEvents[v9 - 1].uAnimationID].uRoomSoundId )
     HousePlaySomeSound(v9, 1);
   if ( uCurrentlyLoadedLevelType == LEVEL_Indoor && uActiveCharacter && pParty->uFlags & 0x30 )
     pPlayers[uActiveCharacter]->PlaySound(SPEECH_47, 0);
@@ -14236,7 +14200,8 @@
     if ( uExitMapID > 0 )
     {
       //v17 = (unsigned int *)(uExitMapID - 1);
-      if ( !((unsigned __int8)(0x80u >> (uExitMapID - 1) % 8) & pParty->_quest_bits[(uExitMapID - 1) >> 3]) )
+	  if(_449B57_test_bit(pParty->_quest_bits,uExitMapID))
+     // if ( !((unsigned __int8)(0x80u >> (uExitMapID - 1) % 8) & pParty->_quest_bits[(uExitMapID - 1) >> 3]) )
       {
         //uExitPic = 0;
         uHouse_ExitPic = 0;
@@ -14416,7 +14381,7 @@
 
 		uCurrentHouse_Animation = p2DEvents[uHouseID - 1].uAnimationID;
 		in_current_building_type = pAnimatedRooms[uCurrentHouse_Animation].uBuildingType;
-		if ( in_current_building_type == BildingType_20 && pParty->uFine )   // going 2 jail
+		if ( in_current_building_type == BildingType_Throne_Room && pParty->uFine )   // going 2 jail
 			{
 			uCurrentHouse_Animation = (signed __int16)p2DEvents[186].uAnimationID;
 			uHouseID = HOUSE_JAIL;
@@ -14462,9 +14427,10 @@
 			}
 		else
 			{ //guilds
-			v19 = word_4F0704[uHouseID-139] - 1; //some gild flag check
+			v19 = guild_mambership_flags[uHouseID-139]; //guilds flags 
 			//v20 = uHouseID;
-			if ( !((unsigned __int8)(0x80u >> v19 % 8) & pPlayers[uActiveCharacter]->_guilds_member_bits[v19 /8]) )
+			//if ( !((unsigned __int8)(0x80u >> v19 % 8) & pPlayers[uActiveCharacter]->_guilds_member_bits[v19 /8]) )
+			if(_449B57_test_bit((unsigned char*)pPlayers[uActiveCharacter]->_guilds_member_bits,v19))
 				{
 				HousePlaySomeSound(uHouseID, 3);
 				return 1;