comparison UI/UIHouses.cpp @ 1587:b42e6f35e03d

m
author Ritor1
date Mon, 09 Sep 2013 09:13:23 +0600
parents 2ae4c5a5b4e5
children e6ac4919b22c
comparison
equal deleted inserted replaced
1531:2ae4c5a5b4e5 1587:b42e6f35e03d
1908 */ 1908 */
1909 } 1909 }
1910 //----- (004B6943) -------------------------------------------------------- 1910 //----- (004B6943) --------------------------------------------------------
1911 void TravelByTransport() 1911 void TravelByTransport()
1912 { 1912 {
1913 GUIWindow *v0; // ebx@1
1914 Player *v1; // esi@1
1915 signed int v2; // edi@1
1916 unsigned int v3; // eax@1
1917 signed int v4; // ebx@1 1913 signed int v4; // ebx@1
1918 stru365_travel_info *v5; // esi@7 1914 stru365_travel_info *v5; // esi@7
1919 int v11; // ecx@12 1915 int v11; // ecx@12
1920 signed int v12; // esi@13 1916 signed int v12; // esi@13
1921 signed int v13; // edi@14 1917 signed int v13; // edi@14
1922 DWORD v14; // eax@26 1918 DWORD v14; // eax@26
1923 DWORD v15; // edi@26 1919 DWORD v15; // edi@26
1924 GUIWindow *v16; // ebx@36 1920 //GUIWindow *v16; // ebx@36
1925 int v17; // esi@36 1921 int v17; // esi@36
1926 int v18; // eax@36 1922 int v18; // eax@36
1927 int v19; // ecx@36 1923 int v19; // ecx@36
1928 int v20; // esi@36 1924 int v20; // esi@36
1929 int v21; // eax@36 1925 int v21; // eax@36
1930 void *v22; // eax@39 1926 void *v22; // eax@39
1931 int v23; // esi@39 1927 int v23; // esi@39
1932 GUIButton *v24; // ebx@39 1928 GUIButton *v24; // ebx@39
1933 signed int v25; // eax@41 1929 signed int v25; // eax@41
1934 //int v26; // esi@44
1935 //const char *v27; // eax@46
1936 char *v28; // eax@62 1930 char *v28; // eax@62
1937 int v29; // eax@62 1931 int v29; // eax@62
1938 unsigned int v30; // ecx@62 1932 unsigned int v30; // ecx@62
1939 char *v31; // eax@63 1933 char *v31; // eax@63
1940 MapInfo v32; // [sp-3Ch] [bp-2CCh]@62 1934 MapInfo v32; // [sp-3Ch] [bp-2CCh]@62
1941 /*int v33; // [sp-38h] [bp-2C8h]@62
1942 int v34; // [sp-34h] [bp-2C4h]@62
1943 int v35; // [sp-30h] [bp-2C0h]@62
1944 int v36; // [sp-2Ch] [bp-2BCh]@62
1945 int v37; // [sp-28h] [bp-2B8h]@62
1946 int v38; // [sp-24h] [bp-2B4h]@62
1947 int v39; // [sp-20h] [bp-2B0h]@62
1948 int v40; // [sp-1Ch] [bp-2ACh]@62
1949 int v41; // [sp-18h] [bp-2A8h]@62
1950 int v42; // [sp-14h] [bp-2A4h]@62
1951 char *v43; // [sp-10h] [bp-2A0h]@62
1952 char *v44; // [sp-Ch] [bp-29Ch]@62
1953 unsigned int v45; // [sp-8h] [bp-298h]@62
1954 char *v46; // [sp-4h] [bp-294h]@62
1955 const char *v47[5]; // [sp+0h] [bp-290h]@7*/
1956 char v48[5][100]; // [sp+14h] [bp-27Ch]@37 1935 char v48[5][100]; // [sp+14h] [bp-27Ch]@37
1957 //char v49[100]; // [sp+78h] [bp-218h]@68
1958 //char v50[100]; // [sp+DCh] [bp-1B4h]@68
1959 //char v51[100]; // [sp+140h] [bp-150h]@68
1960 //char Dest[100]; // [sp+1A4h] [bp-ECh]@36
1961 GUIWindow v53; // [sp+208h] [bp-88h]@1 1936 GUIWindow v53; // [sp+208h] [bp-88h]@1
1962 int v54; // [sp+25Ch] [bp-34h]@36 1937 int v54; // [sp+25Ch] [bp-34h]@36
1963 int v55; // [sp+260h] [bp-30h]@36 1938 int v55; // [sp+260h] [bp-30h]@36
1964 //unsigned int v56; // [sp+264h] [bp-2Ch]@1
1965 //int v57; // [sp+268h] [bp-28h]@1
1966 int v58; // [sp+26Ch] [bp-24h]@36
1967 //GUIWindow *v59; // [sp+270h] [bp-20h]@1
1968 unsigned int v60; // [sp+274h] [bp-1Ch]@36 1939 unsigned int v60; // [sp+274h] [bp-1Ch]@36
1969 //Player *v61; // [sp+278h] [bp-18h]@1
1970 int v62; // [sp+27Ch] [bp-14h]@36 1940 int v62; // [sp+27Ch] [bp-14h]@36
1971 int v63; // [sp+280h] [bp-10h]@14 1941 int v63; // [sp+280h] [bp-10h]@14
1972 char *a1; // [sp+284h] [bp-Ch]@37 1942 char *a1; // [sp+284h] [bp-Ch]@37
1973 unsigned int s1; // [sp+288h] [bp-8h]@1 1943 unsigned int s1; // [sp+288h] [bp-8h]@1
1974 int v66; // [sp+28Ch] [bp-4h]@48 1944 int v66; // [sp+28Ch] [bp-4h]@48
1975 1945
1976 v0 = window_SpeakInHouse;
1977 memcpy(&v53, window_SpeakInHouse, sizeof(v53)); 1946 memcpy(&v53, window_SpeakInHouse, sizeof(v53));
1978 v2 = 255;
1979 //v61 = pPlayers[uActiveCharacter];
1980 v1 = pPlayers[uActiveCharacter];
1981 v53.uFrameX = 483; 1947 v53.uFrameX = 483;
1982 v53.uFrameWidth = 148; 1948 v53.uFrameWidth = 148;
1983 v53.uFrameZ = 334; 1949 v53.uFrameZ = 334;
1984 auto color_default = TargetColor(255, 255, 255); 1950
1985 auto color_selected = TargetColor(255, 255, 155); 1951 v4 = p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType == BuildingType_Stables ? 25 : 50;
1986 v3 = 52 * (unsigned int)v0->ptr_1C; 1952 v4 *= p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier;
1987 //v59 = (GUIWindow *)((((p2DEvents_minus1___00[v3 / 2] != 27) - 1) & 0xFFFFFFE7) + 50); 1953
1988 //v59 = (GUIWindow *)((((p2DEvents[(unsigned int)v0->ptr_1C - 1].uType != BuildingType_Stables) - 1) & 0xFFFFFFE7) + 50); 1954 s1 = v4 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100;
1989 //v4 = (signed __int64)((double)(signed int)v59 * p2DEvents_minus1__20[v3 / 4]);
1990
1991 v4 = p2DEvents[(unsigned int)v0->ptr_1C - 1].uType == BuildingType_Stables ? 25 : 50;
1992 v4 *= p2DEvents[(unsigned int)v0->ptr_1C - 1].fPriceMultiplier;
1993
1994 s1 = v4 * (100 - v1->GetMerchant()) / 100;
1995 if ( (signed int)s1 < v4 / 3 ) 1955 if ( (signed int)s1 < v4 / 3 )
1996 s1 = v4 / 3; 1956 s1 = v4 / 3;
1997 if ( dialog_menu_id == HOUSE_DIALOGUE_MAIN) 1957 if ( dialog_menu_id == HOUSE_DIALOGUE_MAIN)
1998 { 1958 {
1999 if ( HouseUI_CheckIfPlayerCanInteract() ) 1959 if ( HouseUI_CheckIfPlayerCanInteract() )
2000 { 1960 {
2001 v16 = pDialogueWindow;
2002 v58 = 255;
2003 v62 = 0; 1961 v62 = 0;
2004 v17 = LOBYTE(pFontArrus->uFontHeight) - 3; 1962 v17 = LOBYTE(pFontArrus->uFontHeight) - 3;
2005 //v59 = pDialogueWindow;
2006 v54 = v17; 1963 v54 = v17;
2007 strcpy(v48[4], ""); 1964 strcpy(v48[4], "");
2008 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[405], s1); // Price: %lu gold 1965 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[405], s1); // Price: %lu gold
2009 v18 = pFontArrus->CalcTextHeight(pTmpBuf2.data(), &v53, 0, 0); 1966 v18 = pFontArrus->CalcTextHeight(pTmpBuf2.data(), &v53, 0, 0);
2010 v19 = v16->pNumPresenceButton; 1967 v19 = pDialogueWindow->pNumPresenceButton;
2011 v20 = v18 + v17 + 146; 1968 v20 = v18 + v17 + 146;
2012 v21 = v16->pStartingPosActiveItem; 1969 v21 = pDialogueWindow->pStartingPosActiveItem;
2013 v63 = v20; 1970 v63 = v20;
2014 v55 = v20; 1971 v55 = v20;
2015 v60 = v21; 1972 v60 = v21;
2016 if ( v21 >= v21 + v19 ) 1973 if ( v21 >= v21 + v19 )
2017 goto LABEL_71; 1974 goto LABEL_71;
2022 int v47 = v60; 1979 int v47 = v60;
2023 v22 = window_SpeakInHouse->ptr_1C; 1980 v22 = window_SpeakInHouse->ptr_1C;
2024 v23 = transport_routes[(unsigned int)v22 - HOUSE_STABLES_HARMONDALE][v62]; 1981 v23 = transport_routes[(unsigned int)v22 - HOUSE_STABLES_HARMONDALE][v62];
2025 //v23 = (unsigned __int8)*(&_4F0D38_TravelInfo[4 * (unsigned int)v22] + v62); // negindex. actual address is around + 0x36 1982 //v23 = (unsigned __int8)*(&_4F0D38_TravelInfo[4 * (unsigned int)v22] + v62); // negindex. actual address is around + 0x36
2026 //v61 = (Player *)(unsigned __int8)*(&_4F0D38_TravelInfo[4 * (unsigned int)v22] + v62); // + 0x3F for sea travels, less for land 1983 //v61 = (Player *)(unsigned __int8)*(&_4F0D38_TravelInfo[4 * (unsigned int)v22] + v62); // + 0x3F for sea travels, less for land
2027 v24 = v16->GetControl(v60); 1984 v24 = pDialogueWindow->GetControl(v60);
2028 1985
2029 if (v23 != v58) 1986 if (v23 != 255)
2030 { 1987 {
2031 if (v23 >= 25) 1988 if (v23 >= 25)
2032 Log::Warning(L"Transport UI: scedule overflow"); 1989 Log::Warning(L"Transport UI: scedule overflow");
2033 if (s1 >= 6) 1990 if (s1 >= 6)
2034 v25 = true; 1991 v25 = true;
2035 else 1992 else
2036 v25 = transport_schedule[v23].pSchedule[pParty->uDaysPlayed % 7]; 1993 v25 = transport_schedule[v23].pSchedule[pParty->uDaysPlayed % 7];
2037 } 1994 }
2038 1995
2039 if (v23 != v58 && v25 && (!transport_schedule[v23].uQuestBit || _449B57_test_bit(pParty->_quest_bits, transport_schedule[v23].uQuestBit)) ) 1996 if (v23 != 255 && v25 && (!transport_schedule[v23].uQuestBit || _449B57_test_bit(pParty->_quest_bits, transport_schedule[v23].uQuestBit)) )
2040 { 1997 {
2041 v58 = v23; 1998 //v58 = v23;
2042 if ( pDialogueWindow->pCurrentPosActiveItem == s1 ) 1999 if ( pDialogueWindow->pCurrentPosActiveItem == s1 )
2043 sprintf(a1, "\f%05d", color_selected); 2000 sprintf(a1, "\f%05d", TargetColor(255, 255, 155));
2044 else 2001 else
2045 sprintf(a1, "\f%05d", color_default); 2002 sprintf(a1, "\f%05d", TargetColor(255, 255, 255));
2046 2003
2047 //v32.uRedbookTrackID = v27; 2004 //v32.uRedbookTrackID = v27;
2048 v66 = transport_schedule[v23].uTravelTime; 2005 v66 = transport_schedule[v23].uTravelTime;
2049 if ( (unsigned int)window_SpeakInHouse->ptr_1C >= HOUSE_BOATS_63 ) 2006 if ( (unsigned int)window_SpeakInHouse->ptr_1C >= HOUSE_BOATS_63 )
2050 { 2007 {
2062 } 2019 }
2063 if ( CheckHiredNPCSpeciality(Explorer) ) 2020 if ( CheckHiredNPCSpeciality(Explorer) )
2064 --v66; 2021 --v66;
2065 if ( v66 < 1 ) 2022 if ( v66 < 1 )
2066 v66 = 1; 2023 v66 = 1;
2067 if ( v23 != v2 ) 2024 if ( v23 != 255 )
2068 { 2025 {
2069 memcpy(&v32, &pMapStats->pInfos[transport_schedule[v23].uMapInfoID], 0x44u); 2026 memcpy(&v32, &pMapStats->pInfos[transport_schedule[v23].uMapInfoID], 0x44u);
2070 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[404], // Time - %d days, destination %s 2027 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[404], // Time - %d days, destination %s
2071 v66, v32.pName); 2028 v66, v32.pName);
2072 strcat(a1, pTmpBuf.data()); 2029 strcat(a1, pTmpBuf.data());
2077 strcat(v28, "\n \n"); 2034 strcat(v28, "\n \n");
2078 v24->uY = v63; 2035 v24->uY = v63;
2079 v29 = pFontArrus->CalcTextHeight(pTmpBuf.data(), &v53, 0, 0); 2036 v29 = pFontArrus->CalcTextHeight(pTmpBuf.data(), &v53, 0, 0);
2080 v30 = v24->uY; 2037 v30 = v24->uY;
2081 v24->uHeight = v29; 2038 v24->uHeight = v29;
2082 v2 = 255; 2039 //v2 = 255;
2083 v24->uW = v30 + v29 - 1; 2040 v24->uW = v30 + v29 - 1;
2084 v63 += v54 + v29; 2041 v63 += v54 + v29;
2085 } 2042 }
2086 } 2043 }
2087 else 2044 else
2097 v24->uHeight = 0; 2054 v24->uHeight = 0;
2098 v24->uY = 0; 2055 v24->uY = 0;
2099 } 2056 }
2100 } 2057 }
2101 ++v60; 2058 ++v60;
2102 if ( (signed int)v60 >= v16->pNumPresenceButton + v16->pStartingPosActiveItem ) 2059 if ( (signed int)v60 >= pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem )
2103 break; 2060 break;
2104 //v16 = v59; 2061 //v16 = v59;
2105 } 2062 }
2106 if ( v63 != v55 ) 2063 if ( v63 != v55 )
2107 { 2064 {
2115 v53.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3u); 2072 v53.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3u);
2116 } 2073 }
2117 else 2074 else
2118 { 2075 {
2119 LABEL_71: 2076 LABEL_71:
2120 v53.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[561], &v53, 0, 0)) / 2 + 138, 2077 v53.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[561], &v53, 0, 0)) / 2 + 138,//"Извините, приходите в другой день"
2121 color_default, pGlobalTXT_LocalizationStrings[561], 3); 2078 TargetColor(255, 255, 255), pGlobalTXT_LocalizationStrings[561], 3);
2122 pAudioPlayer->StopChannels(-1, -1); 2079 pAudioPlayer->StopChannels(-1, -1);
2123 } 2080 }
2124 } 2081 }
2125 } 2082 }
2126 else 2083 else
2193 if ( CheckHiredNPCSpeciality(Explorer) ) 2150 if ( CheckHiredNPCSpeciality(Explorer) )
2194 --v12; 2151 --v12;
2195 if ( v12 < 1 ) 2152 if ( v12 < 1 )
2196 v12 = 1; 2153 v12 = 1;
2197 RestAndHeal(1440 * v12); 2154 RestAndHeal(1440 * v12);
2198 v1->PlaySound((PlayerSpeech)v63, 0); 2155 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)v63, 0);
2199 v14 = GetTickCount(); 2156 v14 = GetTickCount();
2200 v15 = v14 + v13; 2157 v15 = v14 + v13;
2201 if ( v15 < v14 ) 2158 if ( v15 < v14 )
2202 v15 = v14; 2159 v15 = v14;
2203 while ( GetTickCount() < v15 ) 2160 while ( GetTickCount() < v15 )
2216 } 2173 }
2217 } 2174 }
2218 //----- (004B68EA) -------------------------------------------------------- 2175 //----- (004B68EA) --------------------------------------------------------
2219 bool __fastcall IsTravelAvailable(int a1) 2176 bool __fastcall IsTravelAvailable(int a1)
2220 { 2177 {
2221 for (uint i = 0; i < 4; ++i) 2178 for ( uint i = 0; i < 4; ++i )
2222 { 2179 {
2223 uint route = transport_routes[a1][i]; 2180 if ( transport_schedule[transport_routes[a1][i]].pSchedule[pParty->uDaysPlayed % 7] )
2224 if (transport_schedule[route].pSchedule[pParty->uDaysPlayed % 7]) 2181 {
2225 { 2182 if (!transport_schedule[transport_routes[a1][i]].uQuestBit || _449B57_test_bit(pParty->_quest_bits, transport_schedule[transport_routes[a1][i]].uQuestBit))
2226 if (!transport_schedule[route].uQuestBit || _449B57_test_bit(pParty->_quest_bits, transport_schedule[route].uQuestBit))
2227 return true; 2183 return true;
2228 } 2184 }
2229 } 2185 }
2230 return false; 2186 return false;
2231 } 2187 }
2232
2233
2234 2188
2235 //----- (004B7911) -------------------------------------------------------- 2189 //----- (004B7911) --------------------------------------------------------
2236 void TownHallDialog() 2190 void TownHallDialog()
2237 { 2191 {
2238 int v1; // eax@10 2192 int v1; // eax@10