diff UI/UIHouses.cpp @ 1439:468f434a8d8a

Слияние
author Ritor1
date Mon, 22 Jul 2013 18:00:58 +0600
parents 94e4c3ef9b8e e6908823897f
children b67a3e0d6fc3
line wrap: on
line diff
--- a/UI/UIHouses.cpp	Mon Jul 22 18:00:34 2013 +0600
+++ b/UI/UIHouses.cpp	Mon Jul 22 18:00:58 2013 +0600
@@ -314,6 +314,38 @@
         {"Player Castle Bad",           0x24, 0, 25, 0, 0}
 }};
 
+
+//----- (004B1784) --------------------------------------------------------
+bool __cdecl HouseUI_CheckIfPlayerCanInteract()
+{
+  Player *pPlayer; // ebx@1
+  bool result; // eax@2
+  int v3; // eax@3
+  GUIWindow v4; // [sp+4h] [bp-54h]@3
+
+  pPlayer = pPlayers[uActiveCharacter];
+  if ( pPlayer->CanAct() )
+  {
+    pDialogueWindow->pNumPresenceButton = dword_F8B1E0;
+    result = 1;
+  }
+  else
+  {
+    pDialogueWindow->pNumPresenceButton = 0;
+    memcpy(&v4, pPrimaryWindow, sizeof(v4));
+    v4.uFrameX = 483;
+    v4.uFrameWidth = 148;
+    v4.uFrameZ = 334;
+    sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[427], pPlayer->pName, pGlobalTXT_LocalizationStrings[562]);// 
+                                                // "%s is in no condition to %s"
+                                                // "do anything"
+    v3 = pFontArrus->CalcTextHeight(pTmpBuf.data(), &v4, 0, 0);
+    v4.DrawTitleText(pFontArrus, 0, (212 - v3) / 2 + 101, ui_house_player_cant_interact_color, pTmpBuf.data(), 3u);
+    result = 0;
+  }
+  return result;
+}
+
 //----- (0044622E) --------------------------------------------------------
 bool EnterHouse(enum HOUSE_ID uHouseID)
 {
@@ -1679,7 +1711,7 @@
     s1 = v4 / 3;
   if ( dialog_menu_id == HOUSE_DIALOGUE_MAIN)
   {
-    if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
+    if ( HouseUI_CheckIfPlayerCanInteract() )
     {
       v16 = pDialogueWindow;
       v58 = 255;
@@ -2363,7 +2395,7 @@
   {
     case HOUSE_DIALOGUE_MAIN:
     {
-      if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
+      if ( !HouseUI_CheckIfPlayerCanInteract() )
           return;
 
       sprintf(pTopic1, "\f%05d", pDialogueWindow->pCurrentPosActiveItem == 2 ? pColorYellow : pColorWhite);
@@ -2436,7 +2468,7 @@
           pNumActiveItem++;
           if ( pNumActiveItem >= pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem )
           {
-            sprintfex(pTmpBuf.data(), "%s%s%s%s", &pTopic1, &pTopic2, &pTopic3, &pTopic4);
+            sprintfex(pTmpBuf.data(), "%s%s%s%s", pTopic1, pTopic2, pTopic3, pTopic4);
             dialog_window.DrawTitleText(pFontArrus, 0, 146, 0, pTmpBuf.data(), 3);
           }
         }
@@ -2526,7 +2558,7 @@
 
     case HOUSE_DIALOGUE_LEARN_SKILLS:
     {
-      if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
+      if ( !HouseUI_CheckIfPlayerCanInteract() )
         return;
       v0 = 0;
       v9 = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0);
@@ -2627,7 +2659,7 @@
 
     case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_MAIN:
     {
-      if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
+      if ( HouseUI_CheckIfPlayerCanInteract() )
       {
         v48 = 2;
         pShopOptions[0] = pGlobalTXT_LocalizationStrings[620];
@@ -2764,7 +2796,7 @@
         {
           if ( dialog_menu_id == HOUSE_DIALOGUE_LEARN_SKILLS )
           {
-            if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
+            if ( HouseUI_CheckIfPlayerCanInteract() )
             {
               v4 = pDialogueWindow;
               v61 = pDialogueWindow;
@@ -3171,7 +3203,7 @@
     //i = v11;
   }
 
-  if (sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win())
+  if (HouseUI_CheckIfPlayerCanInteract())
   {
     if ( dialog_menu_id != HOUSE_DIALOGUE_MAIN )
     {
@@ -3179,7 +3211,7 @@
       {
         if ( dialog_menu_id == HOUSE_DIALOGUE_LEARN_SKILLS )
         {
-          if (sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win())
+          if (HouseUI_CheckIfPlayerCanInteract())
           {
             //i = 0;
             int _v0 = 0;
@@ -3268,7 +3300,7 @@
         }
         return;
       }
-      if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
+      if ( !HouseUI_CheckIfPlayerCanInteract() )
       {
         //v31 = pNPCTopics[122].pText;
         //v32 = color2;
@@ -3361,7 +3393,7 @@
       goto LABEL_55;
     }
 
-    if (sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win())
+    if (HouseUI_CheckIfPlayerCanInteract())
     {
       v43 = pDialogueWindow;
       v72 = 0;
@@ -3493,7 +3525,7 @@
   }
   if ( dialog_menu_id != HOUSE_DIALOGUE_MAIN)
   {
-    if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
+    if ( HouseUI_CheckIfPlayerCanInteract() )
     {
       v5 = 0;
 
@@ -3552,7 +3584,7 @@
     return ;
   }
 
-  if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
+  if ( !HouseUI_CheckIfPlayerCanInteract() )
     return;
   v8 = pDialogueWindow;
   v33 = 0;