changeset 1610:fa0e700bcc80

m
author Ritor1
date Sat, 14 Sep 2013 10:28:13 +0600
parents debc6edce54c
children 8e99b4a7176f
files UI/UIHouses.cpp UI/UiGame.cpp
diffstat 2 files changed, 44 insertions(+), 64 deletions(-) [+]
line wrap: on
line diff
--- a/UI/UIHouses.cpp	Thu Sep 12 11:55:16 2013 +0600
+++ b/UI/UIHouses.cpp	Sat Sep 14 10:28:13 2013 +0600
@@ -91,19 +91,19 @@
   {  2,   3,   4,   5},  // HOUSE_STABLES_STEADWICK
   {  6,   7,   8,   8},  // HOUSE_STABLES_TULAREAN_FOREST
   {  9,  10,  10,  10},  // HOUSE_STABLES_DEYJA
-  { 11,  11,  12,  12},  // HOUSE_STABLES_58
-  { 13,  13,  13,  13},  // HOUSE_STABLES_59
-  { 14,  14,  15,  15},  // HOUSE_STABLES_60
+  { 11,  11,  12,  12},  // HOUSE_STABLES_BRACADA_DESERT
+  { 13,  13,  13,  13},  // HOUSE_STABLES_TATALIA
+  { 14,  14,  15,  15},  // HOUSE_STABLES_AVLEE
   {255, 255, 255, 255},  // HOUSE_STABLES_61
   {255, 255, 255, 255},  // HOUSE_STABLES_62
-  {255, 255, 255, 255},  // HOUSE_BOATS_63
-  { 16,  17,  18,  19},  // HOUSE_BOATS_64
-  { 18,  20,  21,  21},  // HOUSE_BOATS_65
-  { 22,  23,  24,  25},  // HOUSE_BOATS_66
-  { 22,  22,  23,  23},  // HOUSE_BOATS_67
+  {255, 255, 255, 255},  // HOUSE_BOATS_EMERALD_ISLE
+  { 16,  17,  18,  19},  // HOUSE_BOATS_ERATHIA
+  { 18,  20,  21,  21},  // HOUSE_BOATS_TULAREAN_FOREST
+  { 22,  23,  24,  25},  // HOUSE_BOATS_BRACADA_DESERT
+  { 22,  22,  23,  23},  // HOUSE_BOATS_EVENMORN_ISLAND
   {255, 255, 255, 255},  // HOUSE_BOATS_68
-  { 27,  28,  29,  30},  // HOUSE_BOATS_69
-  { 31,  32,  33,  33},  // HOUSE_BOATS_70
+  { 27,  28,  29,  30},  // HOUSE_BOATS_TATALIA
+  { 31,  32,  33,  33},  // HOUSE_BOATS_AVLEE
   { 24,  24,  24,  24},  // HOUSE_BOATS_71
   {255, 255, 255, 255},  // HOUSE_BOATS_72
   {255, 255, 255, 255}   // HOUSE_BOATS_73
@@ -1925,9 +1925,7 @@
   char pTopicArray[5][100]; // [sp+14h] [bp-27Ch]@37
   GUIWindow travel_window; // [sp+208h] [bp-88h]@1
   int pPrimaryTextHeight; // [sp+260h] [bp-30h]@36
-  //unsigned int v60; // [sp+274h] [bp-1Ch]@36
   int index; // [sp+27Ch] [bp-14h]@36
-  //char *a1; // [sp+284h] [bp-Ch]@37
   unsigned int pPrice; // [sp+288h] [bp-8h]@1
   int travel_time; // [sp+28Ch] [bp-4h]@48
   enum PlayerSpeech pSpeech;
@@ -1962,8 +1960,8 @@
 
         if (schedule_id != 255)
         {
-          if (schedule_id >= 25)
-            Log::Warning(L"Transport UI: scedule overflow");
+          //if (schedule_id >= 25)
+            //Log::Warning(L"Transport UI: schedule overflow");
           if ( pCurrentButton >= 6 )
             v25 = true;
           else
@@ -1973,7 +1971,7 @@
         if (schedule_id != 255 && v25 && (!transport_schedule[schedule_id].uQuestBit
            || _449B57_test_bit(pParty->_quest_bits, transport_schedule[schedule_id].uQuestBit)) )
         {
-//get color for current string(определение цвета текущей строки)------------
+  //get color for current string(определение цвета текущей строки)----------
           if ( pDialogueWindow->pCurrentPosActiveItem == pCurrentButton )
             sprintf(pTopicArray[index], "\f%05d", TargetColor(255, 255, 155));
           else
@@ -2408,8 +2406,6 @@
   unsigned int v12; // eax@19
   int v13; // eax@21
   int v14; // ecx@26
-  //GUIButton *v15; // eax@28
-  //GUIButton *v16; // esi@28
   int v17; // eax@28
   char *v18; // eax@30
   int v19; // eax@30
@@ -2423,11 +2419,9 @@
   int v27; // edi@46
   unsigned int pColorText; // eax@57
   signed int v31; // eax@59
-  //GUIWindow *v33; // edi@64
   int v34; // eax@64
   int v35; // ecx@64
   int v36; // esi@64
-  char v37; // sf@64
   GUIButton *pButton; // eax@65
   int v39; // edx@69
   int v40; // ecx@69
@@ -2441,15 +2435,12 @@
   signed int v48; // edi@77
   signed int i; // esi@79
   int v50; // eax@80
-  //GUIWindow *v51; // ecx@81
   _QWORD v52; // qax@81
   signed int v53; // edi@81
   int v54; // edi@81
-  //GUIButton *v55; // esi@83
   const char **v56; // eax@83
   int v57; // eax@83
   unsigned int v58; // ecx@83
-  //Player *v59; // edx@83
   unsigned __int16 v60; // ax@83
   int v61; // eax@99
   char *v63; // eax@99
@@ -2467,14 +2458,10 @@
   char pTopic4[100]; // [sp+70h] [bp-204h]@59
   char pTopic2[100]; // [sp+D4h] [bp-1A0h]@57
   char pTopic3[100]; // [sp+138h] [bp-13Ch]@59
-  //GUIWindow v78; // [sp+19Ch] [bp-D8h]@99
   GUIWindow dialog_window; // [sp+1F0h] [bp-84h]@1
   char *Str[2]; // [sp+244h] [bp-30h]@30
-  unsigned int pColorWhite; // [sp+24Ch] [bp-28h]@1
   unsigned __int8 pTopic3Height; // [sp+253h] [bp-21h]@59
   int v83; // [sp+254h] [bp-20h]@1
-  int pColorYellow; // [sp+258h] [bp-1Ch]@1
-  Player *pPlayer; // [sp+25Ch] [bp-18h]@1
   int all_text_height; // [sp+260h] [bp-14h]@18
   unsigned __int8 v87; // [sp+266h] [bp-Eh]@59
   unsigned __int8 pTopic2Height; // [sp+267h] [bp-Dh]@57
@@ -2485,18 +2472,15 @@
   unsigned __int8 pTopic4Height;
   int pTextHeight;
 
-  pPlayer = pPlayers[uActiveCharacter];
   memcpy(&dialog_window, window_SpeakInHouse, sizeof(dialog_window));
   dialog_window.uFrameX = 483;
   dialog_window.uFrameWidth = 148;
   dialog_window.uFrameZ = 334;
-  pColorWhite = TargetColor(0xFFu, 0xFFu, 0xFFu);
-  pColorYellow = TargetColor(0xFFu, 0xFFu, 0x9Bu);
   v2 = p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier;
   *(float *)&v83 = v2;
   *(float *)&v89 = v2 * v2;
   v3 = (signed __int64)(*(float *)&v89 * 0.1);
-  pItemNum = v3 * (100 - pPlayer->GetMerchant()) / 100;
+  pItemNum = v3 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100;
   if ( pItemNum < v3 / 3 )
     pItemNum = v3 / 3;
   v5 = 1;
@@ -2504,7 +2488,7 @@
   if ( pItemNum <= 0 )
     pOutString = (GUIFont *)1;
   v6 = (signed __int64)(*(float *)&v89 * *(float *)&v83 * 0.0099999998);
-  v7 = v6 * (100 - pPlayer->GetMerchant()) / 100;
+  v7 = v6 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100;
   if ( v7 < v6 / 3 )
   v7 = v6 / 3;
   v83 = v7;
@@ -2521,36 +2505,36 @@
       if ( !HouseUI_CheckIfPlayerCanInteract() )
           return;
 
-      sprintf(pTopic1, "\f%05d", pDialogueWindow->pCurrentPosActiveItem == 2 ? pColorYellow : pColorWhite);
+      sprintf(pTopic1, "\f%05d", pDialogueWindow->pCurrentPosActiveItem == 2 ? TargetColor(0xFFu, 0xFFu, 0x9Bu) : TargetColor(0xFFu, 0xFFu, 0xFFu));
       sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[178], pOutString); // Rent room for %d gold
       strcat(pTopic1, pTmpBuf2.data());
       pTopic1Height = pFontArrus->CalcTextHeight(pTopic1, &dialog_window, 0, 0);
       strcat(pTopic1, "\n \n");
 
-      sprintf(pTopic2, "\f%05d", pDialogueWindow->pCurrentPosActiveItem == 3 ? pColorYellow : pColorWhite);
+      sprintf(pTopic2, "\f%05d", pDialogueWindow->pCurrentPosActiveItem == 3 ? TargetColor(0xFFu, 0xFFu, 0x9Bu) : TargetColor(0xFFu, 0xFFu, 0xFFu));
       sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[86], // Buy food for %d days for %d gold
         (unsigned int)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier, v83);
       strcat(pTopic2, pTmpBuf2.data());
       pTopic2Height = pFontArrus->CalcTextHeight(pTopic2, &dialog_window, 0, 0);
       strcat(pTopic2, "\n \n");
 
-      sprintf(pTopic3, "\f%05d", pDialogueWindow->pCurrentPosActiveItem == 4 ? pColorYellow : pColorWhite);
+      sprintf(pTopic3, "\f%05d", pDialogueWindow->pCurrentPosActiveItem == 4 ? TargetColor(0xFFu, 0xFFu, 0x9Bu) : TargetColor(0xFFu, 0xFFu, 0xFFu));
       strcat(pTopic3, pGlobalTXT_LocalizationStrings[160]); // Learn Skills
       pTopic3Height = pFontArrus->CalcTextHeight(pTopic3, &dialog_window, 0, 0);
       strcat(pTopic3, "\n \n");
       pTopic4[0] = 0;
       if ( (signed int)window_SpeakInHouse->par1C >= 108 && (signed int)window_SpeakInHouse->par1C <= 120 )
       {
-        sprintf(pTopic4, "\f%05d", pDialogueWindow->pCurrentPosActiveItem == 5 ? pColorYellow : pColorWhite);
+        sprintf(pTopic4, "\f%05d", pDialogueWindow->pCurrentPosActiveItem == 5 ? TargetColor(0xFFu, 0xFFu, 0x9Bu) : TargetColor(0xFFu, 0xFFu, 0xFFu));
         strcat(pTopic4, pGlobalTXT_LocalizationStrings[611]); // Play Arcomage
         pTopic4Height = pFontArrus->CalcTextHeight(pTopic4, &dialog_window, 0, 0);
       }
-      pNumActiveItem = pDialogueWindow->pStartingPosActiveItem;
+
       v36 = LOBYTE(pFontArrus->uFontHeight) - 3;
-      v37 = -pDialogueWindow->pNumPresenceButton < 0;
-      if ( !(v37 ^ (pNumActiveItem < pNumActiveItem + pDialogueWindow->pNumPresenceButton)) )
+      if ( pDialogueWindow->pNumPresenceButton )
       {
-        do
+        for ( pNumActiveItem = pDialogueWindow->pStartingPosActiveItem;
+              pNumActiveItem < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton; ++pNumActiveItem )
         {
           pButton = pDialogueWindow->GetControl(pNumActiveItem);
           if ( pButton->msg_param == 15 )
@@ -2588,14 +2572,9 @@
             v41 = v39 + v40 - 1;
             pButton->uW = v41;
           }
-          pNumActiveItem++;
-          if ( pNumActiveItem >= pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem )
-          {
-            sprintfex(pTmpBuf.data(), "%s%s%s%s", pTopic1, pTopic2, pTopic3, pTopic4);
-            dialog_window.DrawTitleText(pFontArrus, 0, 146, 0, pTmpBuf.data(), 3);
-          }
         }
-        while ( pNumActiveItem < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton );
+        sprintfex(pTmpBuf.data(), "%s%s%s%s", pTopic1, pTopic2, pTopic3, pTopic4);
+        dialog_window.DrawTitleText(pFontArrus, 0, 146, 0, pTmpBuf.data(), 3);
       }
       break;
     }
@@ -2649,7 +2628,7 @@
       }
       strcpy(pTmpBuf.data(), v72);
       v66 = (174 - pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 0, 0)) / 2 + 138;
-      dialog_window.DrawTitleText(pFontArrus, 0, v66, pColorYellow, pTmpBuf.data(), 3);
+      dialog_window.DrawTitleText(pFontArrus, 0, v66, TargetColor(0xFFu, 0xFFu, 0x9Bu), pTmpBuf.data(), 3);
       break;
     }
     case HOUSE_DIALOGUE_TAVERN_REST:
@@ -2685,7 +2664,7 @@
         return;
       v0 = 0;
       v9 = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0);
-      pItemNum = v9 * (100 - pPlayer->GetMerchant()) / 100;
+      pItemNum = v9 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100;
       if ( pItemNum < v9 / 3 )
         pItemNum = v9 / 3;
       pNumActiveItem = pDialogueWindow->pStartingPosActiveItem;
@@ -2695,7 +2674,8 @@
         do
         {
           v12 = pDialogueWindow->GetControl(pNumActiveItem)->msg_param - 36;
-          if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayer->classType][v12] && !pPlayer->pActiveSkills[v12] )
+          if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][v12]
+              && !pPlayers[uActiveCharacter]->pActiveSkills[v12] )
           {
             all_text_height = pFontArrus->CalcTextHeight(pSkillNames[v12], &dialog_window, 0, 0);
             v0++;
@@ -2719,7 +2699,8 @@
             {
               pButton = pDialogueWindow->GetControl(pItemNum);
               v17 = pButton->msg_param - 36;
-              if ( !byte_4ED970_skill_learn_ability_by_class_table[pPlayer->classType][v17] || pPlayer->pActiveSkills[v17] )
+              if ( !byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][v17]
+                 || pPlayers[uActiveCharacter]->pActiveSkills[v17] )
               {
                 pButton->uW = 0;
                 pButton->uHeight = 0;
@@ -2732,9 +2713,9 @@
                 pButton->uHeight = pTextHeight;
                 v14 = pTextHeight + pButton->uY - 1;
                 pButton->uW = v14;
-                pColorText = pColorYellow;
+                pColorText = TargetColor(0xFFu, 0xFFu, 0x9Bu);
                 if ( pDialogueWindow->pCurrentPosActiveItem != pItemNum )
-                  pColorText = pColorWhite;
+                  pColorText = TargetColor(0xFFu, 0xFFu, 0xFFu);
                 dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, pSkillNames[v17], 3);
               }
               pNumActiveItem = pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton;
@@ -2745,11 +2726,12 @@
           return;
         }
       }
-      sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayer->pName, pClassNames[pPlayer->classType]);
+      sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName,
+              pClassNames[pPlayers[uActiveCharacter]->classType]);
       strcat(pTmpBuf.data(), "\n \n");
       strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]);
       pTextHeight = (174 - pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 0, 0)) / 2 + 138;
-      dialog_window.DrawTitleText(pFontArrus, 0, pTextHeight, pColorYellow, pTmpBuf.data(), 3);
+      dialog_window.DrawTitleText(pFontArrus, 0, pTextHeight, TargetColor(0xFFu, 0xFFu, 0x9Bu), pTmpBuf.data(), 3);
       return;
     }
 
@@ -2798,7 +2780,7 @@
         all_text_height = (174 - all_text_height) / v48;
         pNumActiveItem = pDialogueWindow->pStartingPosActiveItem;
         v54 = (174 - v48 * (174 - all_text_height) / v48 - all_text_height) / 2 - (174 - all_text_height) / v48 / 2 + 138;
-        v37 = -pDialogueWindow->pNumPresenceButton < 0;
+        //v37 = -pDialogueWindow->pNumPresenceButton < 0;
         if ( pNumActiveItem < pNumActiveItem + pDialogueWindow->pNumPresenceButton )
         {
           pItemNum = 2;
@@ -2811,9 +2793,9 @@
             pButton->uHeight = pTextHeight;
             v54 = pButton->uY + pTextHeight - 1;
             pButton->uW = v54;
-            pColorText = pColorYellow;
+            pColorText = TargetColor(0xFFu, 0xFFu, 0x9Bu);
             if ( pDialogueWindow->pCurrentPosActiveItem != pItemNum )
-              pColorText = pColorWhite;
+              pColorText = TargetColor(0xFFu, 0xFFu, 0xFFu);
             dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, (const char *)pShopOptions[pNumString], 3);
             pItemNum++;
             ++pNumString;
@@ -3811,8 +3793,6 @@
   int v38; // eax@52
   signed int v39; // ecx@54
   int v40; // edi@57
-  //GUIButton *v41; // eax@60
-  //GUIButton *v42; // esi@60
   const char *v43; // ebx@60
   int v44; // eax@60
   unsigned int v45; // ecx@60
--- a/UI/UiGame.cpp	Thu Sep 12 11:55:16 2013 +0600
+++ b/UI/UiGame.cpp	Sat Sep 14 10:28:13 2013 +0600
@@ -348,7 +348,7 @@
   int pTextHeight; // esi@39
   GUIButton *pButton; // eax@43
   int v32; // ebx@93
-  uint v35; // esi@93
+  //uint v35; // esi@93
   int v38; // eax@95
   signed int v39; // esi@99
   signed int v40; // eax@102
@@ -599,15 +599,15 @@
 
   // Install Buttons(Установка кнопок)-------- 
   v32 = 0;
-  v35 = (uint)pDialogueWindow->pStartingPosActiveItem;
-  for ( uint i = v35 + pDialogueWindow->pNumPresenceButton; v35 < i; i = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem )
+  //v35 = (uint)pDialogueWindow->pStartingPosActiveItem;
+  for ( int i = pDialogueWindow->pStartingPosActiveItem; i < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton; ++i )
   {
-    pButton = pDialogueWindow->GetControl(v35);
+    pButton = pDialogueWindow->GetControl(i);
     if ( !pButton )
       break;
     v38 = pFontArrus->CalcTextHeight(pButton->pButtonName, &window, 0, 0);
     v32 += v38;
-    ++v35;
+    //++v35;
   }
   v39 = pDialogueWindow->pNumPresenceButton;
   if ( v39 )