comparison UI/UIHouses.cpp @ 1609:debc6edce54c

Слияние
author Ritor1
date Thu, 12 Sep 2013 11:55:16 +0600
parents fb809d1891bd d687f6e7c610
children fa0e700bcc80
comparison
equal deleted inserted replaced
1608:fb809d1891bd 1609:debc6edce54c
87 87
88 unsigned char transport_routes[20][4] = 88 unsigned char transport_routes[20][4] =
89 { 89 {
90 { 0, 1, 1, 34}, // HOUSE_STABLES_HARMONDALE 90 { 0, 1, 1, 34}, // HOUSE_STABLES_HARMONDALE
91 { 2, 3, 4, 5}, // HOUSE_STABLES_STEADWICK 91 { 2, 3, 4, 5}, // HOUSE_STABLES_STEADWICK
92 { 6, 7, 8, 8}, // HOUSE_STABLES_56 92 { 6, 7, 8, 8}, // HOUSE_STABLES_TULAREAN_FOREST
93 { 9, 10, 10, 10}, // HOUSE_STABLES_57 93 { 9, 10, 10, 10}, // HOUSE_STABLES_DEYJA
94 { 11, 11, 12, 12}, // HOUSE_STABLES_58 94 { 11, 11, 12, 12}, // HOUSE_STABLES_58
95 { 13, 13, 13, 13}, // HOUSE_STABLES_59 95 { 13, 13, 13, 13}, // HOUSE_STABLES_59
96 { 14, 14, 15, 15}, // HOUSE_STABLES_60 96 { 14, 14, 15, 15}, // HOUSE_STABLES_60
97 {255, 255, 255, 255}, // HOUSE_STABLES_61 97 {255, 255, 255, 255}, // HOUSE_STABLES_61
98 {255, 255, 255, 255}, // HOUSE_STABLES_62 98 {255, 255, 255, 255}, // HOUSE_STABLES_62
987 //----- (004BCACC) -------------------------------------------------------- 987 //----- (004BCACC) --------------------------------------------------------
988 void __fastcall OnSelectShopDialogueOption(signed int uMessageParam) 988 void __fastcall OnSelectShopDialogueOption(signed int uMessageParam)
989 { 989 {
990 int experience_for_next_level; // eax@5 990 int experience_for_next_level; // eax@5
991 GUIWindow *v8; // esi@10 991 GUIWindow *v8; // esi@10
992 //int v11; // edi@31
993 int v16; // eax@32 992 int v16; // eax@32
994 int v17; // eax@33 993 int v17; // eax@33
995 int v18; // eax@34 994 int v18; // eax@34
996 int v19; // eax@35 995 int v19; // eax@35
997 __int16 v20; // ax@37 996 __int16 v20; // ax@37
1908 */ 1907 */
1909 } 1908 }
1910 //----- (004B6943) -------------------------------------------------------- 1909 //----- (004B6943) --------------------------------------------------------
1911 void TravelByTransport() 1910 void TravelByTransport()
1912 { 1911 {
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 1912 signed int v4; // ebx@1
1918 stru365_travel_info *v5; // esi@7 1913 stru365_travel_info *pTravel; // esi@7
1919 int v11; // ecx@12
1920 signed int v12; // esi@13 1914 signed int v12; // esi@13
1921 signed int v13; // edi@14 1915 signed int v13; // edi@14
1922 DWORD v14; // eax@26 1916 DWORD v14; // eax@26
1923 DWORD v15; // edi@26 1917 DWORD v15; // edi@26
1924 GUIWindow *v16; // ebx@36 1918 int pTextHeight; // eax@36
1925 int v17; // esi@36 1919 int pRealTextHeight; // esi@36
1926 int v18; // eax@36 1920 int schedule_id; // esi@39
1927 int v19; // ecx@36 1921 GUIButton *pButton; // ebx@39
1928 int v20; // esi@36
1929 int v21; // eax@36
1930 void *v22; // eax@39
1931 int v23; // esi@39
1932 GUIButton *v24; // ebx@39
1933 signed int v25; // eax@41 1922 signed int v25; // eax@41
1934 //int v26; // esi@44
1935 //const char *v27; // eax@46
1936 char *v28; // eax@62
1937 int v29; // eax@62
1938 unsigned int v30; // ecx@62 1923 unsigned int v30; // ecx@62
1939 char *v31; // eax@63 1924 MapInfo pMap; // [sp-3Ch] [bp-2CCh]@62
1940 MapInfo v32; // [sp-3Ch] [bp-2CCh]@62 1925 char pTopicArray[5][100]; // [sp+14h] [bp-27Ch]@37
1941 /*int v33; // [sp-38h] [bp-2C8h]@62 1926 GUIWindow travel_window; // [sp+208h] [bp-88h]@1
1942 int v34; // [sp-34h] [bp-2C4h]@62 1927 int pPrimaryTextHeight; // [sp+260h] [bp-30h]@36
1943 int v35; // [sp-30h] [bp-2C0h]@62 1928 //unsigned int v60; // [sp+274h] [bp-1Ch]@36
1944 int v36; // [sp-2Ch] [bp-2BCh]@62 1929 int index; // [sp+27Ch] [bp-14h]@36
1945 int v37; // [sp-28h] [bp-2B8h]@62 1930 //char *a1; // [sp+284h] [bp-Ch]@37
1946 int v38; // [sp-24h] [bp-2B4h]@62 1931 unsigned int pPrice; // [sp+288h] [bp-8h]@1
1947 int v39; // [sp-20h] [bp-2B0h]@62 1932 int travel_time; // [sp+28Ch] [bp-4h]@48
1948 int v40; // [sp-1Ch] [bp-2ACh]@62 1933 enum PlayerSpeech pSpeech;
1949 int v41; // [sp-18h] [bp-2A8h]@62 1934 unsigned int pCurrentButton;
1950 int v42; // [sp-14h] [bp-2A4h]@62 1935
1951 char *v43; // [sp-10h] [bp-2A0h]@62 1936 memcpy(&travel_window, window_SpeakInHouse, sizeof(travel_window));
1952 char *v44; // [sp-Ch] [bp-29Ch]@62 1937 travel_window.uFrameX = 483;
1953 unsigned int v45; // [sp-8h] [bp-298h]@62 1938 travel_window.uFrameWidth = 148;
1954 char *v46; // [sp-4h] [bp-294h]@62 1939 travel_window.uFrameZ = 334;
1955 const char *v47[5]; // [sp+0h] [bp-290h]@7*/ 1940
1956 char v48[5][100]; // [sp+14h] [bp-27Ch]@37 1941 v4 = p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType == BuildingType_Stables ? 25 : 50;
1957 //char v49[100]; // [sp+78h] [bp-218h]@68 1942 v4 *= p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier;
1958 //char v50[100]; // [sp+DCh] [bp-1B4h]@68 1943
1959 //char v51[100]; // [sp+140h] [bp-150h]@68 1944 pPrice = v4 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100;
1960 //char Dest[100]; // [sp+1A4h] [bp-ECh]@36 1945 if ( (signed int)pPrice < v4 / 3 )
1961 GUIWindow v53; // [sp+208h] [bp-88h]@1 1946 pPrice = v4 / 3;
1962 int v54; // [sp+25Ch] [bp-34h]@36
1963 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
1969 //Player *v61; // [sp+278h] [bp-18h]@1
1970 int v62; // [sp+27Ch] [bp-14h]@36
1971 int v63; // [sp+280h] [bp-10h]@14
1972 char *a1; // [sp+284h] [bp-Ch]@37
1973 unsigned int s1; // [sp+288h] [bp-8h]@1
1974 int v66; // [sp+28Ch] [bp-4h]@48
1975
1976 v0 = window_SpeakInHouse;
1977 memcpy(&v53, window_SpeakInHouse, sizeof(v53));
1978 v2 = 255;
1979 //v61 = pPlayers[uActiveCharacter];
1980 v1 = pPlayers[uActiveCharacter];
1981 v53.uFrameX = 483;
1982 v53.uFrameWidth = 148;
1983 v53.uFrameZ = 334;
1984 auto color_default = TargetColor(255, 255, 255);
1985 auto color_selected = TargetColor(255, 255, 155);
1986 v3 = 52 * (unsigned int)v0->ptr_1C;
1987 //v59 = (GUIWindow *)((((p2DEvents_minus1___00[v3 / 2] != 27) - 1) & 0xFFFFFFE7) + 50);
1988 //v59 = (GUIWindow *)((((p2DEvents[(unsigned int)v0->ptr_1C - 1].uType != BuildingType_Stables) - 1) & 0xFFFFFFE7) + 50);
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 )
1996 s1 = v4 / 3;
1997 if ( dialog_menu_id == HOUSE_DIALOGUE_MAIN) 1947 if ( dialog_menu_id == HOUSE_DIALOGUE_MAIN)
1998 { 1948 {
1999 if ( HouseUI_CheckIfPlayerCanInteract() ) 1949 if ( HouseUI_CheckIfPlayerCanInteract() )
2000 { 1950 {
2001 v16 = pDialogueWindow; 1951 index = 0;
2002 v58 = 255; 1952 strcpy(pTopicArray[4], "");
2003 v62 = 0; 1953 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[405], pPrice); // Price: %lu gold
2004 v17 = LOBYTE(pFontArrus->uFontHeight) - 3; 1954 pTextHeight = pFontArrus->CalcTextHeight(pTmpBuf2.data(), &travel_window, 0, 0);
2005 //v59 = pDialogueWindow; 1955 pRealTextHeight = pTextHeight + (LOBYTE(pFontArrus->uFontHeight) - 3) + 146;
2006 v54 = v17; 1956 pPrimaryTextHeight = pRealTextHeight;
2007 strcpy(v48[4], ""); 1957 pCurrentButton = 2;
2008 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[405], s1); // Price: %lu gold 1958 for ( uint i = pDialogueWindow->pStartingPosActiveItem; i < (unsigned int)(pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem); ++i )
2009 v18 = pFontArrus->CalcTextHeight(pTmpBuf2.data(), &v53, 0, 0); 1959 {
2010 v19 = v16->pNumPresenceButton; 1960 schedule_id = transport_routes[(unsigned int)window_SpeakInHouse->ptr_1C - HOUSE_STABLES_HARMONDALE][index];
2011 v20 = v18 + v17 + 146; 1961 pButton = pDialogueWindow->GetControl(i);
2012 v21 = v16->pStartingPosActiveItem; 1962
2013 v63 = v20; 1963 if (schedule_id != 255)
2014 v55 = v20; 1964 {
2015 v60 = v21; 1965 if (schedule_id >= 25)
2016 if ( v21 >= v21 + v19 )
2017 goto LABEL_71;
2018 s1 = 2;
2019 a1 = (char *)v48;
2020 while ( 1 )
2021 {
2022 int v47 = v60;
2023 v22 = window_SpeakInHouse->ptr_1C;
2024 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
2026 //v61 = (Player *)(unsigned __int8)*(&_4F0D38_TravelInfo[4 * (unsigned int)v22] + v62); // + 0x3F for sea travels, less for land
2027 v24 = v16->GetControl(v60);
2028
2029 if (v23 != v58)
2030 {
2031 if (v23 >= 25)
2032 Log::Warning(L"Transport UI: scedule overflow"); 1966 Log::Warning(L"Transport UI: scedule overflow");
2033 if (s1 >= 6) 1967 if ( pCurrentButton >= 6 )
2034 v25 = true; 1968 v25 = true;
2035 else 1969 else
2036 v25 = transport_schedule[v23].pSchedule[pParty->uDaysPlayed % 7]; 1970 v25 = transport_schedule[schedule_id].pSchedule[pParty->uDaysPlayed % 7];
2037 } 1971 }
2038 1972
2039 if (v23 != v58 && v25 && (!transport_schedule[v23].uQuestBit || _449B57_test_bit(pParty->_quest_bits, transport_schedule[v23].uQuestBit)) ) 1973 if (schedule_id != 255 && v25 && (!transport_schedule[schedule_id].uQuestBit
2040 { 1974 || _449B57_test_bit(pParty->_quest_bits, transport_schedule[schedule_id].uQuestBit)) )
2041 v58 = v23; 1975 {
2042 if ( pDialogueWindow->pCurrentPosActiveItem == s1 ) 1976 //get color for current string( )------------
2043 sprintf(a1, "\f%05d", color_selected); 1977 if ( pDialogueWindow->pCurrentPosActiveItem == pCurrentButton )
2044 else 1978 sprintf(pTopicArray[index], "\f%05d", TargetColor(255, 255, 155));
2045 sprintf(a1, "\f%05d", color_default); 1979 else
2046 1980 sprintf(pTopicArray[index], "\f%05d", TargetColor(255, 255, 255));
2047 //v32.uRedbookTrackID = v27; 1981 //hired NPC premium( )----------------------------------
2048 v66 = transport_schedule[v23].uTravelTime; 1982 travel_time = transport_schedule[schedule_id].uTravelTime;
2049 if ( (unsigned int)window_SpeakInHouse->ptr_1C >= HOUSE_BOATS_63 ) 1983 if ( (unsigned int)window_SpeakInHouse->ptr_1C >= HOUSE_BOATS_EMERALD_ISLE )
2050 { 1984 {
2051 if ( CheckHiredNPCSpeciality(Sailor) ) 1985 if ( CheckHiredNPCSpeciality(Sailor) )
2052 v66 -= 2; 1986 travel_time -= 2;
2053 if ( CheckHiredNPCSpeciality(Navigator) ) 1987 if ( CheckHiredNPCSpeciality(Navigator) )
2054 v66 -= 3; 1988 travel_time -= 3;
2055 if ( CheckHiredNPCSpeciality(Pirate) ) 1989 if ( CheckHiredNPCSpeciality(Pirate) )
2056 v66 -= 2; 1990 travel_time -= 2;
2057 } 1991 }
2058 else 1992 else
2059 { 1993 {
2060 if ( CheckHiredNPCSpeciality(Horseman) ) 1994 if ( CheckHiredNPCSpeciality(Horseman) )
2061 v66 -= 2; 1995 travel_time -= 2;
2062 } 1996 }
2063 if ( CheckHiredNPCSpeciality(Explorer) ) 1997 if ( CheckHiredNPCSpeciality(Explorer) )
2064 --v66; 1998 --travel_time;
2065 if ( v66 < 1 ) 1999
2066 v66 = 1; 2000 if ( travel_time < 1 )
2067 if ( v23 != v2 ) 2001 travel_time = 1;
2068 { 2002 if ( schedule_id != 255 )
2069 memcpy(&v32, &pMapStats->pInfos[transport_schedule[v23].uMapInfoID], 0x44u); 2003 {
2070 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[404], // Time - %d days, destination %s 2004 memcpy(&pMap, &pMapStats->pInfos[transport_schedule[schedule_id].uMapInfoID], 0x44u);
2071 v66, v32.pName); 2005 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[404], travel_time, pMap.pName); // Time - %d days, destination %s
2072 strcat(a1, pTmpBuf.data()); 2006 strcat(pTopicArray[index], pTmpBuf.data());
2073 v28 = a1; 2007 strcat(pTopicArray[index], "\n \n");
2074 a1 += 100; 2008 pButton->uY = pRealTextHeight;
2075 ++v62; 2009 pTextHeight = pFontArrus->CalcTextHeight(pTmpBuf.data(), &travel_window, 0, 0);
2076 ++s1; 2010 v30 = pButton->uY;
2077 strcat(v28, "\n \n"); 2011 pButton->uHeight = pTextHeight;
2078 v24->uY = v63; 2012 pButton->uW = v30 + pTextHeight - 1;
2079 v29 = pFontArrus->CalcTextHeight(pTmpBuf.data(), &v53, 0, 0); 2013 pRealTextHeight += (LOBYTE(pFontArrus->uFontHeight) - 3) + pTextHeight;
2080 v30 = v24->uY;
2081 v24->uHeight = v29;
2082 v2 = 255;
2083 v24->uW = v30 + v29 - 1;
2084 v63 += v54 + v29;
2085 } 2014 }
2086 } 2015 }
2087 else 2016 else
2088 { 2017 {
2089 v31 = a1; 2018 strcpy(pTopicArray[index], "");
2090 ++v62; 2019 if ( pButton )
2091 ++s1; 2020 {
2092 a1 += 100; 2021 pButton->uW = 0;
2093 strcpy(v31, ""); 2022 pButton->uHeight = 0;
2094 if ( v24 ) 2023 pButton->uY = 0;
2095 { 2024 }
2096 v24->uW = 0; 2025 }
2097 v24->uHeight = 0; 2026 ++index;
2098 v24->uY = 0; 2027 ++pCurrentButton;
2099 } 2028 }
2100 } 2029 if ( pRealTextHeight != pPrimaryTextHeight )
2101 ++v60; 2030 {
2102 if ( (signed int)v60 >= v16->pNumPresenceButton + v16->pStartingPosActiveItem ) 2031 sprintf(pTmpBuf.data(), "%s\n \n%s%s%s%s%s", pTmpBuf2.data(), pTopicArray[0], pTopicArray[1], pTopicArray[2], pTopicArray[3], pTopicArray[4]);
2103 break; 2032 travel_window.DrawTitleText(pFontArrus, 0, 146, 0, pTmpBuf.data(), 3);
2104 //v16 = v59;
2105 }
2106 if ( v63 != v55 )
2107 {
2108 /*v47[1] = &Dest;
2109 v47[0] = &v51;
2110 v46 = &v50;
2111 v45 = (unsigned int)&v49;
2112 v44 = &v48;
2113 v43 = pTmpBuf2.data();*/
2114 sprintf(pTmpBuf.data(), "%s\n \n%s%s%s%s%s", pTmpBuf2.data(), v48[0], v48[1], v48[2], v48[3], v48[4]);
2115 v53.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3u);
2116 } 2033 }
2117 else 2034 else
2118 { 2035 {
2119 LABEL_71: 2036 travel_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[561], &travel_window, 0, 0)) / 2 + 138,//", "
2120 v53.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[561], &v53, 0, 0)) / 2 + 138, 2037 TargetColor(255, 255, 255), pGlobalTXT_LocalizationStrings[561], 3);
2121 color_default, pGlobalTXT_LocalizationStrings[561], 3);
2122 pAudioPlayer->StopChannels(-1, -1); 2038 pAudioPlayer->StopChannels(-1, -1);
2123 } 2039 }
2124 } 2040 }
2125 } 2041 }
2126 else 2042 else//
2127 { 2043 {
2128 if ( dialog_menu_id >= HOUSE_DIALOGUE_TRANSPORT_SCHEDULE_1 && dialog_menu_id <= HOUSE_DIALOGUE_TRANSPORT_SCHEDULE_4 ) 2044 if ( dialog_menu_id >= HOUSE_DIALOGUE_TRANSPORT_SCHEDULE_1 && dialog_menu_id <= HOUSE_DIALOGUE_TRANSPORT_SCHEDULE_4 )
2129 { 2045 {
2130 if ( pParty->uNumGold < s1 ) 2046 if ( pParty->uNumGold < pPrice )
2131 { 2047 {
2132 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u); 2048 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);//" "
2133 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_Greeting_2); 2049 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_Greeting_2);
2134 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); 2050 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
2135 return; 2051 return;
2136 } 2052 }
2137 2053
2138 Party::TakeGold(s1); 2054 Party::TakeGold(pPrice);
2139 2055
2140 v5 = &transport_schedule[transport_routes[(unsigned int)window_SpeakInHouse->ptr_1C - HOUSE_STABLES_HARMONDALE][dialog_menu_id - HOUSE_DIALOGUE_TRANSPORT_SCHEDULE_1]]; 2056 pTravel = &transport_schedule[transport_routes[(unsigned int)window_SpeakInHouse->ptr_1C - HOUSE_STABLES_HARMONDALE][dialog_menu_id - HOUSE_DIALOGUE_TRANSPORT_SCHEDULE_1]];
2141 if ( v5->pSchedule[pParty->uDaysPlayed % 7] ) 2057 if ( pTravel->pSchedule[pParty->uDaysPlayed % 7] )
2142 { 2058 {
2143 if ( _stricmp(pCurrentMapName, pMapStats->pInfos[v5->uMapInfoID].pFilename) ) 2059 if ( _stricmp(pCurrentMapName, pMapStats->pInfos[pTravel->uMapInfoID].pFilename) )
2144 { 2060 {
2145 SaveGame(1, 0); 2061 SaveGame(1, 0);
2146 strcpy(pCurrentMapName, pMapStats->pInfos[v5->uMapInfoID].pFilename); 2062 strcpy(pCurrentMapName, pMapStats->pInfos[pTravel->uMapInfoID].pFilename);
2147 2063
2148 dword_6BE364_game_settings_1 |= 1u; 2064 dword_6BE364_game_settings_1 |= 1u;
2149 _5B65B8_npcdata_hiword_house_or_other = 0; 2065 _5B65B8_npcdata_hiword_house_or_other = 0;
2150 dword_5B65BC = 0; 2066 dword_5B65BC = 0;
2151 _5B65B4_npcdata_loword_house_or_other = v5->arrival_rot_y; 2067 _5B65B4_npcdata_loword_house_or_other = pTravel->arrival_rot_y;
2152 v11 = *((int *)v5 + 3);
2153 uGameState = GAME_STATE_2; 2068 uGameState = GAME_STATE_2;
2154 _5B65A8_npcdata_uflags_or_other = v11; 2069 _5B65A8_npcdata_uflags_or_other = pTravel->arrival_x;
2155 _5B65AC_npcdata_fame_or_other = v5->arrival_y; 2070 _5B65AC_npcdata_fame_or_other = pTravel->arrival_y;
2156 _5B65B0_npcdata_rep_or_other = v5->arrival_z; 2071 _5B65B0_npcdata_rep_or_other = pTravel->arrival_z;
2157 dword_5B65C0 = v11 | v5->arrival_y | v5->arrival_z | v5->arrival_rot_y; 2072 dword_5B65C0 = pTravel->arrival_x | pTravel->arrival_y | pTravel->arrival_z | pTravel->arrival_rot_y;
2158 } 2073 }
2159 else 2074 else
2160 { 2075 {
2161 pIndoorCamera->sRotationY = 0; 2076 pIndoorCamera->sRotationY = 0;
2162 pParty->uFlags |= 2u; 2077 pParty->uFlags |= 2u;
2163 pParty->vPosition.x = v5->arrival_x; 2078 pParty->vPosition.x = pTravel->arrival_x;
2164 pParty->vPosition.y = v5->arrival_y; 2079 pParty->vPosition.y = pTravel->arrival_y;
2165 pParty->vPosition.z = v5->arrival_z; 2080 pParty->vPosition.z = pTravel->arrival_z;
2166 pParty->uFallStartY = pParty->vPosition.z; 2081 pParty->uFallStartY = pParty->vPosition.z;
2167 pParty->sRotationX = 0; 2082 pParty->sRotationX = 0;
2168 pParty->sRotationY = v5->arrival_rot_y; 2083 pParty->sRotationY = pTravel->arrival_rot_y;
2169 } 2084 }
2170 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful); 2085 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful);
2171 v12 = v5->uTravelTime; 2086 v12 = pTravel->uTravelTime;
2172 int _v47;
2173 if ( (signed int)window_SpeakInHouse->ptr_1C >= 63 ) 2087 if ( (signed int)window_SpeakInHouse->ptr_1C >= 63 )
2174 { 2088 {
2175 v63 = SPEECH_SetSail; 2089 pSpeech = SPEECH_SetSail;
2176 v13 = 2500; 2090 v13 = 2500;
2177 if ( CheckHiredNPCSpeciality(Sailor) ) 2091 if ( CheckHiredNPCSpeciality(Sailor) )
2178 v12 -= 2; 2092 v12 -= 2;
2179 if ( CheckHiredNPCSpeciality(Navigator) ) 2093 if ( CheckHiredNPCSpeciality(Navigator) )
2180 v12 -= 3; 2094 v12 -= 3;
2181 //_v47 = 45;
2182 if ( CheckHiredNPCSpeciality(Pirate) ) 2095 if ( CheckHiredNPCSpeciality(Pirate) )
2183 v12 -= 2; 2096 v12 -= 2;
2184 } 2097 }
2185 else 2098 else
2186 { 2099 {
2187 v63 = SPEECH_CarriageReady; 2100 pSpeech = SPEECH_CarriageReady;
2188 v13 = 1500; 2101 v13 = 1500;
2189 //_v47 = 35;
2190 if ( CheckHiredNPCSpeciality(Horseman) ) 2102 if ( CheckHiredNPCSpeciality(Horseman) )
2191 v12 -= 2; 2103 v12 -= 2;
2192 } 2104 }
2193 if ( CheckHiredNPCSpeciality(Explorer) ) 2105 if ( CheckHiredNPCSpeciality(Explorer) )
2194 --v12; 2106 --v12;
2195 if ( v12 < 1 ) 2107 if ( v12 < 1 )
2196 v12 = 1; 2108 v12 = 1;
2197 RestAndHeal(1440 * v12); 2109 RestAndHeal(1440 * v12);
2198 v1->PlaySound((PlayerSpeech)v63, 0); 2110 pPlayers[uActiveCharacter]->PlaySound(pSpeech, 0);
2199 v14 = GetTickCount(); 2111 v14 = GetTickCount();
2200 v15 = v14 + v13; 2112 v15 = v14 + v13;
2201 if ( v15 < v14 ) 2113 if ( v15 < v14 )
2202 v15 = v14; 2114 v15 = v14;
2203 while ( GetTickCount() < v15 ) 2115 while ( GetTickCount() < v15 )
2216 } 2128 }
2217 } 2129 }
2218 //----- (004B68EA) -------------------------------------------------------- 2130 //----- (004B68EA) --------------------------------------------------------
2219 bool __fastcall IsTravelAvailable(int a1) 2131 bool __fastcall IsTravelAvailable(int a1)
2220 { 2132 {
2221 for (uint i = 0; i < 4; ++i) 2133 for ( uint i = 0; i < 4; ++i )
2222 { 2134 {
2223 uint route = transport_routes[a1][i]; 2135 if ( transport_schedule[transport_routes[a1][i]].pSchedule[pParty->uDaysPlayed % 7] )
2224 if (transport_schedule[route].pSchedule[pParty->uDaysPlayed % 7]) 2136 {
2225 { 2137 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; 2138 return true;
2228 } 2139 }
2229 } 2140 }
2230 return false; 2141 return false;
2231 } 2142 }
2232
2233
2234 2143
2235 //----- (004B7911) -------------------------------------------------------- 2144 //----- (004B7911) --------------------------------------------------------
2236 void TownHallDialog() 2145 void TownHallDialog()
2237 { 2146 {
2238 int v1; // eax@10 2147 int v1; // eax@10