diff UI/UIHouses.cpp @ 1636:ff3d7af671ec

SimpleHouseDialog cleaning(continue)
author Ritor1
date Tue, 17 Sep 2013 17:34:31 +0600
parents 08ebd0fee604
children b60ddd777d50
line wrap: on
line diff
--- a/UI/UIHouses.cpp	Tue Sep 17 16:30:43 2013 +0600
+++ b/UI/UIHouses.cpp	Tue Sep 17 17:34:31 2013 +0600
@@ -3260,7 +3260,7 @@
       pTextHeight = pFontArrus->CalcTextHeight(pNPCTopics[171].pText, &dialog_window, 0, 0);//
       dialog_window.DrawTitleText(pFontArrus, 0, (212 - pTextHeight) / 2 + 101, TargetColor(0xFFu, 0xFFu, 0x9Bu), pNPCTopics[171].pText, 3);
       pDialogueWindow->pNumPresenceButton = 0;
-      return ;
+      return;
     }
     if ( !HouseUI_CheckIfPlayerCanInteract() )
       return;
@@ -3386,7 +3386,7 @@
   GUIFont *v47; // ebx@64
   int v48; // esi@64
   GUIWindow w; // [sp+Ch] [bp-110h]@64
-  GUIWindow v52; // [sp+60h] [bp-BCh]@13
+  GUIWindow right_panel_window; // [sp+60h] [bp-BCh]@13
   GUIWindow house_window; // [sp+B4h] [bp-68h]@1
   char *pInString; // [sp+114h] [bp-8h]@12
 
@@ -3435,90 +3435,32 @@
       }
     }
   }
-  memcpy(&v52, pDialogueWindow, sizeof(v52));
-  v52.uFrameX = 483;
-  v52.uFrameWidth = 148;
-  v52.uFrameZ = 334;
-  
-  if ( v52.pStartingPosActiveItem < v52.pStartingPosActiveItem + v52.pNumPresenceButton )
+  //for right panel
+  memcpy(&right_panel_window, pDialogueWindow, sizeof(right_panel_window));
+  right_panel_window.uFrameX = 483;
+  right_panel_window.uFrameWidth = 148;
+  right_panel_window.uFrameZ = 334;
+  for ( int i = right_panel_window.pStartingPosActiveItem;
+            i < right_panel_window.pStartingPosActiveItem + right_panel_window.pNumPresenceButton; ++i )
   {
-    v15 = "";
-    for ( int i = v52.pStartingPosActiveItem; i < v52.pStartingPosActiveItem + v52.pNumPresenceButton; ++i )
+    pButton = right_panel_window.GetControl(i);
+    switch ( pButton->msg_param )
     {
-      pButton = v52.GetControl(i);
-      if ( (signed int)pButton->msg_param > 24 )
-      {
-        if ( pButton->msg_param == 76 )
-        {
-          v15 = pGlobalTXT_LocalizationStrings[406];//Нанять
-          strcpy(pButton->pButtonName, v15);
-          continue;
-        }
-        if ( pButton->msg_param == 77 )
-        {
-          strcpy(pButton->pButtonName, pGlobalTXT_LocalizationStrings[407]);//Подробнее
-          continue;
-        }
-        if ( pButton->msg_param == 79 )
-        {
-          strcpy(pButton->pButtonName, _4B254D_SkillMasteryTeacher((int)v52.ptr_1C));
-          continue;
-        }
-        if ( pButton->msg_param == 82 )
-        {
-          strcpy(pButton->pButtonName, ContractSelectText((int)v52.ptr_1C));
-          continue;
-        }
-        if ( pButton->msg_param == 83 )
+      case 19://evt_A
+        v15 = (char *)pNPCTopics[pNPC->evt_A-1].pTopic;
+        if ( !v15 )
         {
-          v29 = pMonsterStats->pInfos[bountyHunting_monster_id_for_hunting].pName;
-          v31 = *(int *)v29;
-          sprintfex(pTmpBuf.data(), "\f%05d%s\f%05d", TargetColor(0xFFu, 0xFFu, 0x9Bu), v31, TargetColor(0xFFu, 0xFFu, 0xFFu));
-          sprintfex(pTmpBuf2.data(), bountyHunting_text, pTmpBuf.data(), 100 * (unsigned __int8)v29[8]);
-          current_npc_text = pTmpBuf2.data();
-          strcpy(pButton->pButtonName, "");
-          continue;
+          pButton->msg_param = 0;
+          v15 = "";
         }
-        if ( pButton->msg_param != 93 )
-        {
-          strcpy(pButton->pButtonName, "");
-          continue;
-        }
-      }
-      else
-      {
-        if ( pButton->msg_param == 24 )//evt_F
+        strcpy(pButton->pButtonName, v15);
+        continue;
+      case 20://evt_B
+        v15 = (char *)pNPCTopics[pNPC->evt_B-1].pTopic;
+        if ( !v15 )
         {
-          v15 = (char *)pNPCTopics[pNPC->evt_F-1].pTopic;
-          if ( !v15 )
-          {
-            pButton->msg_param = 0;
-            v15 = "";
-          }
-          strcpy(pButton->pButtonName, v15);
-          continue;
-        }
-        v18 = pButton->msg_param - 13;
-        if ( v18 )
-        {
-          if ( pButton->msg_param == 19 )//evt_A
-          {
-            v15 = (char *)pNPCTopics[pNPC->evt_A-1].pTopic;
-            if ( !v15 )
-            {
-              pButton->msg_param = 0;
-              v15 = "";
-            }
-            strcpy(pButton->pButtonName, v15);
-            continue;
-          }
-          if ( pButton->msg_param == 20 )//evt_B
-          {
-            v15 = (char *)pNPCTopics[pNPC->evt_B-1].pTopic;
-            if ( !v15 )
-            {
-              pButton->msg_param = 0;
-              v15 = "";
+          pButton->msg_param = 0;
+          v15 = "";
             }
             if ( uDialogueType != 84 )
             {
@@ -3530,9 +3472,7 @@
             current_npc_text = pTmpBuf2.data();
             strcpy(pButton->pButtonName, v15);
             continue;
-          }
-          if ( pButton->msg_param == 21 )//evt_C
-          {
+          case 21://evt_C
             v15 = (char *)pNPCTopics[pNPC->evt_C-1].pTopic;
             if ( !v15 )
             {
@@ -3541,9 +3481,7 @@
             }
             strcpy(pButton->pButtonName, v15);
             continue;
-          }
-          if ( pButton->msg_param == 22 )//evt_D
-          {
+          case 22://evt_D
             v15 = (char *)pNPCTopics[pNPC->evt_D-1].pTopic;
             if ( !v15 )
             {
@@ -3552,9 +3490,7 @@
             }
             strcpy(pButton->pButtonName, v15);
             continue;
-          }
-          if ( pButton->msg_param == 23 )//evt_E
-          {
+          case 23://evt_E
             v15 = (char *)pNPCTopics[pNPC->evt_E-1].pTopic;
             if ( !v15 )
             {
@@ -3563,21 +3499,59 @@
             }
             strcpy(pButton->pButtonName, v15);
             continue;
-          }
+          case 24://evt_F
+            v15 = (char *)pNPCTopics[pNPC->evt_F-1].pTopic;
+            if ( !v15 )
+            {
+              pButton->msg_param = 0;
+              v15 = "";
+            }
+            strcpy(pButton->pButtonName, v15);
+            continue;
+          case 76:
+            strcpy(pButton->pButtonName, pGlobalTXT_LocalizationStrings[406]);//Нанять
+            continue;
+          case 77:
+            strcpy(pButton->pButtonName, pGlobalTXT_LocalizationStrings[407]);//Подробнее
+            continue;
+          case 79:
+            strcpy(pButton->pButtonName, _4B254D_SkillMasteryTeacher((int)right_panel_window.ptr_1C));
+            continue;
+          case 82:
+            strcpy(pButton->pButtonName, ContractSelectText((int)right_panel_window.ptr_1C));
+            continue;
+          case 83:
+            v29 = pMonsterStats->pInfos[bountyHunting_monster_id_for_hunting].pName;
+            v31 = *(int *)v29;
+            sprintfex(pTmpBuf.data(), "\f%05d%s\f%05d", TargetColor(0xFFu, 0xFFu, 0x9Bu), v31, TargetColor(0xFFu, 0xFFu, 0xFFu));
+            sprintfex(pTmpBuf2.data(), bountyHunting_text, pTmpBuf.data(), 100 * (unsigned __int8)v29[8]);
+            current_npc_text = pTmpBuf2.data();
+            strcpy(pButton->pButtonName, "");
+            continue;
+        }
+        if ( pButton->msg_param < 13 )
+        {
+          strcpy(pButton->pButtonName, pGlobalTXT_LocalizationStrings[122]);//Вступить
+          continue;
+        }
+        if ( pButton->msg_param > 13 && pButton->msg_param < 19 )
+        {
           strcpy(pButton->pButtonName, "");
           continue;
         }
-        strcpy(pButton->pButtonName, pGlobalTXT_LocalizationStrings[122]);//Вступить
-      }
+        if ( pButton->msg_param != 93 )
+        {
+          strcpy(pButton->pButtonName, "");
+          continue;
+        }
     }
-  }
   v34 = 0;
   v36 = pDialogueWindow->pStartingPosActiveItem;
   for ( i = v36 + pDialogueWindow->pNumPresenceButton; (signed int)v36 < (signed int)i; i = pDialogueWindow->pNumPresenceButton
                                                                     + pDialogueWindow->pStartingPosActiveItem )
   {
     v37 = pDialogueWindow->GetControl(v36);
-    v38 = pFontArrus->CalcTextHeight(v37->pButtonName, &v52, 0, 0);
+    v38 = pFontArrus->CalcTextHeight(v37->pButtonName, &right_panel_window, 0, 0);
     v34 += v38;
     ++v36;
   }
@@ -3595,7 +3569,7 @@
       //v42 = v41;
       v43 = pButton->pButtonName;
       pButton->uY = (unsigned int)((char *)pNPC + v40);
-      v44 = pFontArrus->CalcTextHeight(pButton->pButtonName, &v52, 0, 0);
+      v44 = pFontArrus->CalcTextHeight(pButton->pButtonName, &right_panel_window, 0, 0);
       v45 = pButton->uY;
       pButton->uHeight = v44;
       v40 = v45 + v44 - 1;
@@ -3603,7 +3577,7 @@
       v46 = TargetColor(0xE1u, 0xCDu, 0x23u);
       if ( (char *)pDialogueWindow->pCurrentPosActiveItem != pInString )
         v46 = TargetColor(0xFFu, 0xFFu, 0xFFu);
-      v52.DrawTitleText(pFontArrus, 0, v45, v46, v43, 3);
+      right_panel_window.DrawTitleText(pFontArrus, 0, v45, v46, v43, 3);
       ++pInString;
     }
   }