changeset 1587:b42e6f35e03d

m
author Ritor1
date Mon, 09 Sep 2013 09:13:23 +0600
parents 2ae4c5a5b4e5
children e6ac4919b22c
files UI/UIHouses.cpp
diffstat 1 files changed, 21 insertions(+), 67 deletions(-) [+]
line wrap: on
line diff
--- a/UI/UIHouses.cpp	Fri Sep 06 16:43:54 2013 +0600
+++ b/UI/UIHouses.cpp	Mon Sep 09 09:13:23 2013 +0600
@@ -1910,10 +1910,6 @@
 //----- (004B6943) --------------------------------------------------------
 void  TravelByTransport()
 {
-  GUIWindow *v0; // ebx@1
-  Player *v1; // esi@1
-  signed int v2; // edi@1
-  unsigned int v3; // eax@1
   signed int v4; // ebx@1
   stru365_travel_info *v5; // esi@7
   int v11; // ecx@12
@@ -1921,7 +1917,7 @@
   signed int v13; // edi@14
   DWORD v14; // eax@26
   DWORD v15; // edi@26
-  GUIWindow *v16; // ebx@36
+  //GUIWindow *v16; // ebx@36
   int v17; // esi@36
   int v18; // eax@36
   int v19; // ecx@36
@@ -1931,85 +1927,46 @@
   int v23; // esi@39
   GUIButton *v24; // ebx@39
   signed int v25; // eax@41
-  //int v26; // esi@44
-  //const char *v27; // eax@46
   char *v28; // eax@62
   int v29; // eax@62
   unsigned int v30; // ecx@62
   char *v31; // eax@63
   MapInfo v32; // [sp-3Ch] [bp-2CCh]@62
-  /*int v33; // [sp-38h] [bp-2C8h]@62
-  int v34; // [sp-34h] [bp-2C4h]@62
-  int v35; // [sp-30h] [bp-2C0h]@62
-  int v36; // [sp-2Ch] [bp-2BCh]@62
-  int v37; // [sp-28h] [bp-2B8h]@62
-  int v38; // [sp-24h] [bp-2B4h]@62
-  int v39; // [sp-20h] [bp-2B0h]@62
-  int v40; // [sp-1Ch] [bp-2ACh]@62
-  int v41; // [sp-18h] [bp-2A8h]@62
-  int v42; // [sp-14h] [bp-2A4h]@62
-  char *v43; // [sp-10h] [bp-2A0h]@62
-  char *v44; // [sp-Ch] [bp-29Ch]@62
-  unsigned int v45; // [sp-8h] [bp-298h]@62
-  char *v46; // [sp-4h] [bp-294h]@62
-  const char *v47[5]; // [sp+0h] [bp-290h]@7*/
   char v48[5][100]; // [sp+14h] [bp-27Ch]@37
-  //char v49[100]; // [sp+78h] [bp-218h]@68
-  //char v50[100]; // [sp+DCh] [bp-1B4h]@68
-  //char v51[100]; // [sp+140h] [bp-150h]@68
-  //char Dest[100]; // [sp+1A4h] [bp-ECh]@36
   GUIWindow v53; // [sp+208h] [bp-88h]@1
   int v54; // [sp+25Ch] [bp-34h]@36
   int v55; // [sp+260h] [bp-30h]@36
-  //unsigned int v56; // [sp+264h] [bp-2Ch]@1
-  //int v57; // [sp+268h] [bp-28h]@1
-  int v58; // [sp+26Ch] [bp-24h]@36
-  //GUIWindow *v59; // [sp+270h] [bp-20h]@1
   unsigned int v60; // [sp+274h] [bp-1Ch]@36
-  //Player *v61; // [sp+278h] [bp-18h]@1
   int v62; // [sp+27Ch] [bp-14h]@36
   int v63; // [sp+280h] [bp-10h]@14
   char *a1; // [sp+284h] [bp-Ch]@37
   unsigned int s1; // [sp+288h] [bp-8h]@1
   int v66; // [sp+28Ch] [bp-4h]@48
 
-  v0 = window_SpeakInHouse;
   memcpy(&v53, window_SpeakInHouse, sizeof(v53));
-  v2 = 255;
-  //v61 = pPlayers[uActiveCharacter];
-  v1 = pPlayers[uActiveCharacter];
   v53.uFrameX = 483;
   v53.uFrameWidth = 148;
   v53.uFrameZ = 334;
-  auto color_default = TargetColor(255, 255, 255);
-  auto color_selected = TargetColor(255, 255, 155);
-  v3 = 52 * (unsigned int)v0->ptr_1C;
-  //v59 = (GUIWindow *)((((p2DEvents_minus1___00[v3 / 2] != 27) - 1) & 0xFFFFFFE7) + 50);
-  //v59 = (GUIWindow *)((((p2DEvents[(unsigned int)v0->ptr_1C - 1].uType != BuildingType_Stables) - 1) & 0xFFFFFFE7) + 50);
-  //v4 = (signed __int64)((double)(signed int)v59 * p2DEvents_minus1__20[v3 / 4]);
 
-  v4 = p2DEvents[(unsigned int)v0->ptr_1C - 1].uType == BuildingType_Stables ? 25 : 50;
-  v4 *= p2DEvents[(unsigned int)v0->ptr_1C - 1].fPriceMultiplier;
+  v4 = p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType == BuildingType_Stables ? 25 : 50;
+  v4 *= p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier;
 
-  s1 = v4 * (100 - v1->GetMerchant()) / 100;
+  s1 = v4 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100;
   if ( (signed int)s1 < v4 / 3 )
     s1 = v4 / 3;
   if ( dialog_menu_id == HOUSE_DIALOGUE_MAIN)
   {
     if ( HouseUI_CheckIfPlayerCanInteract() )
     {
-      v16 = pDialogueWindow;
-      v58 = 255;
       v62 = 0;
       v17 = LOBYTE(pFontArrus->uFontHeight) - 3;
-      //v59 = pDialogueWindow;
       v54 = v17;
       strcpy(v48[4], "");
       sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[405], s1); // Price: %lu gold
       v18 = pFontArrus->CalcTextHeight(pTmpBuf2.data(), &v53, 0, 0);
-      v19 = v16->pNumPresenceButton;
+      v19 = pDialogueWindow->pNumPresenceButton;
       v20 = v18 + v17 + 146;
-      v21 = v16->pStartingPosActiveItem;
+      v21 = pDialogueWindow->pStartingPosActiveItem;
       v63 = v20;
       v55 = v20;
       v60 = v21;
@@ -2024,9 +1981,9 @@
         v23 = transport_routes[(unsigned int)v22 - HOUSE_STABLES_HARMONDALE][v62];
         //v23 = (unsigned __int8)*(&_4F0D38_TravelInfo[4 * (unsigned int)v22] + v62); // negindex. actual address is around + 0x36
         //v61 = (Player *)(unsigned __int8)*(&_4F0D38_TravelInfo[4 * (unsigned int)v22] + v62); // + 0x3F for sea travels, less for land
-        v24 = v16->GetControl(v60);
+        v24 = pDialogueWindow->GetControl(v60);
 
-        if (v23 != v58)
+        if (v23 != 255)
         {
           if (v23 >= 25)
             Log::Warning(L"Transport UI: scedule overflow");
@@ -2036,13 +1993,13 @@
             v25 = transport_schedule[v23].pSchedule[pParty->uDaysPlayed % 7];
         }
 
-        if (v23 != v58 && v25 && (!transport_schedule[v23].uQuestBit || _449B57_test_bit(pParty->_quest_bits, transport_schedule[v23].uQuestBit)) )
+        if (v23 != 255 && v25 && (!transport_schedule[v23].uQuestBit || _449B57_test_bit(pParty->_quest_bits, transport_schedule[v23].uQuestBit)) )
         {
-            v58 = v23;
+            //v58 = v23;
             if ( pDialogueWindow->pCurrentPosActiveItem == s1 )
-              sprintf(a1, "\f%05d", color_selected);
+              sprintf(a1, "\f%05d", TargetColor(255, 255, 155));
             else
-              sprintf(a1, "\f%05d", color_default);
+              sprintf(a1, "\f%05d", TargetColor(255, 255, 255));
 
           //v32.uRedbookTrackID = v27;
           v66 = transport_schedule[v23].uTravelTime;
@@ -2064,7 +2021,7 @@
             --v66;
           if ( v66 < 1 )
             v66 = 1;
-          if ( v23 != v2 )
+          if ( v23 != 255 )
           {
             memcpy(&v32, &pMapStats->pInfos[transport_schedule[v23].uMapInfoID], 0x44u);
             sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[404], // Time - %d days, destination %s
@@ -2079,7 +2036,7 @@
             v29 = pFontArrus->CalcTextHeight(pTmpBuf.data(), &v53, 0, 0);
             v30 = v24->uY;
             v24->uHeight = v29;
-            v2 = 255;
+            //v2 = 255;
             v24->uW = v30 + v29 - 1;
             v63 += v54 + v29;
           }
@@ -2099,7 +2056,7 @@
           }
         }
         ++v60;
-        if ( (signed int)v60 >= v16->pNumPresenceButton + v16->pStartingPosActiveItem )
+        if ( (signed int)v60 >= pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem )
           break;
         //v16 = v59;
       }
@@ -2117,8 +2074,8 @@
       else
       {
 LABEL_71:
-        v53.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[561], &v53, 0, 0)) / 2 + 138,
-                          color_default, pGlobalTXT_LocalizationStrings[561], 3);
+        v53.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[561], &v53, 0, 0)) / 2 + 138,//"Извините, приходите в другой день"
+                          TargetColor(255, 255, 255), pGlobalTXT_LocalizationStrings[561], 3);
         pAudioPlayer->StopChannels(-1, -1);
       }
     }
@@ -2195,7 +2152,7 @@
         if ( v12 < 1 )
           v12 = 1;
         RestAndHeal(1440 * v12);
-        v1->PlaySound((PlayerSpeech)v63, 0);
+        pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)v63, 0);
         v14 = GetTickCount();
         v15 = v14 + v13;
         if ( v15 < v14 )
@@ -2218,20 +2175,17 @@
 //----- (004B68EA) --------------------------------------------------------
 bool __fastcall IsTravelAvailable(int a1)
 {
-  for (uint i = 0; i < 4; ++i)
+  for ( uint i = 0; i < 4; ++i )
   {
-    uint route = transport_routes[a1][i];
-    if (transport_schedule[route].pSchedule[pParty->uDaysPlayed % 7])
+    if ( transport_schedule[transport_routes[a1][i]].pSchedule[pParty->uDaysPlayed % 7] )
     {
-      if (!transport_schedule[route].uQuestBit || _449B57_test_bit(pParty->_quest_bits, transport_schedule[route].uQuestBit))
+      if (!transport_schedule[transport_routes[a1][i]].uQuestBit || _449B57_test_bit(pParty->_quest_bits, transport_schedule[transport_routes[a1][i]].uQuestBit))
         return true;
     }
   }
   return false;
 }
 
-
-
 //----- (004B7911) --------------------------------------------------------
 void  TownHallDialog()
 {