comparison UIHouses.cpp @ 772:6fef3dae2551

Слияние
author Ritor1
date Sat, 23 Mar 2013 22:23:18 +0600
parents b2468462a360
children cf2fbac6edc9
comparison
equal deleted inserted replaced
771:fbae3100f991 772:6fef3dae2551
407 uCloseTime = p2DEvents[uHouseID - 1].uCloseTime; 407 uCloseTime = p2DEvents[uHouseID - 1].uCloseTime;
408 ptr_F8B1E8 = 0; 408 ptr_F8B1E8 = 0;
409 dword_F8B1E4 = 0; 409 dword_F8B1E4 = 0;
410 dword_F8B1F4 = 0; 410 dword_F8B1F4 = 0;
411 memset(byte_F8B1F0, 0, 4); 411 memset(byte_F8B1F0, 0, 4);
412 memset(byte_F8B148, 0, 16); 412 memset(player_levels, 0, 16);
413 pRenderer->ClearZBuffer(0, 479); 413 pRenderer->ClearZBuffer(0, 479);
414 414
415 if (((uCloseTime - 1 <= uOpenTime)&&((pParty->uCurrentHour <uOpenTime)&&(pParty->uCurrentHour >(uCloseTime - 1))))|| 415 if (((uCloseTime - 1 <= uOpenTime)&&((pParty->uCurrentHour <uOpenTime)&&(pParty->uCurrentHour >(uCloseTime - 1))))||
416 ((uCloseTime - 1 > uOpenTime)&&((pParty->uCurrentHour < uOpenTime)||(pParty->uCurrentHour > (uCloseTime - 1))))) 416 ((uCloseTime - 1 > uOpenTime)&&((pParty->uCurrentHour < uOpenTime)||(pParty->uCurrentHour > (uCloseTime - 1)))))
417 417
736 }*/ 736 }*/
737 return; 737 return;
738 } 738 }
739 if ( v1 > pParty->uNumGold ) 739 if ( v1 > pParty->uNumGold )
740 { 740 {
741 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney); 741 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful);
742 v2 = pParty->uNumGold; 742 v2 = pParty->uNumGold;
743 } 743 }
744 if ( v2 > pParty->uFine ) 744 if ( v2 > pParty->uFine )
745 v2 = pParty->uFine; 745 v2 = pParty->uFine;
746 Party::TakeGold(v2); 746 Party::TakeGold(v2);
832 }*/ 832 }*/
833 return; 833 return;
834 } 834 }
835 if ( v6 > pParty->uNumGold ) 835 if ( v6 > pParty->uNumGold )
836 { 836 {
837 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney); 837 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful);
838 v7 = pParty->uNumGold; 838 v7 = pParty->uNumGold;
839 } 839 }
840 if ( v7 ) 840 if ( v7 )
841 { 841 {
842 Party::TakeGold(v7); 842 Party::TakeGold(v7);
879 v3 = v2; 879 v3 = v2;
880 if ( v2 ) 880 if ( v2 )
881 { 881 {
882 if ( v2 > pParty->uNumGoldInBank ) 882 if ( v2 > pParty->uNumGoldInBank )
883 { 883 {
884 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney); 884 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful);
885 v3 = pParty->uNumGoldInBank; 885 v3 = pParty->uNumGoldInBank;
886 } 886 }
887 if ( v3 ) 887 if ( v3 )
888 { 888 {
889 Party::SetGold(pParty->uNumGold + v3); 889 Party::SetGold(pParty->uNumGold + v3);
1192 { 1192 {
1193 if ( pParty->uNumGold >= (unsigned int)pOutString ) 1193 if ( pParty->uNumGold >= (unsigned int)pOutString )
1194 { 1194 {
1195 Party::TakeGold((unsigned int)pOutString); 1195 Party::TakeGold((unsigned int)pOutString);
1196 v27 = (int)window_SpeakInHouse->ptr_1C; 1196 v27 = (int)window_SpeakInHouse->ptr_1C;
1197 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney); 1197 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful);
1198 dialog_menu_id = HOUSE_DIALOGUE_NULL; 1198 dialog_menu_id = HOUSE_DIALOGUE_NULL;
1199 sub_4BD8B5(); 1199 sub_4BD8B5();
1200 sub_4B1D27(); 1200 sub_4B1D27();
1201 pVideoPlayer->Unload(); 1201 pVideoPlayer->Unload();
1202 window_SpeakInHouse->Release(); 1202 window_SpeakInHouse->Release();
1551 v55 = 0; 1551 v55 = 0;
1552 v106.x = 0; 1552 v106.x = 0;
1553 v106.x = 0; 1553 v106.x = 0;
1554 do 1554 do
1555 { 1555 {
1556 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v55].uItemID);//9 * (v55 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] ) 1556 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v55].uItemID)//9 * (v55 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] )
1557 ++v106.x; 1557 ++v106.x;
1558 ++v55; 1558 ++v55;
1559 } 1559 }
1560 while ( v55 < 6 ); 1560 while ( v55 < 6 );
1561 v56 = GetAsyncKeyState(17); 1561 v56 = GetAsyncKeyState(17);
2054 { 2054 {
2055 pRenderer->DrawTextureIndexed(8, 8, ShopTexture); 2055 pRenderer->DrawTextureIndexed(8, 8, ShopTexture);
2056 v114 = 0; 2056 v114 = 0;
2057 do 2057 do
2058 { 2058 {
2059 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v114].uItemID); 2059 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v114].uItemID)
2060 { 2060 {
2061 v46 = ItemsInShopTexture[v114]; 2061 v46 = ItemsInShopTexture[v114];
2062 v47 = 152 - v46->uTextureHeight; 2062 v47 = 152 - v46->uTextureHeight;
2063 if ( (signed int)v47 < 1 ) 2063 if ( (signed int)v47 < 1 )
2064 v47 = 0; 2064 v47 = 0;
2081 } 2081 }
2082 while ( v114 < 6 ); 2082 while ( v114 < 6 );
2083 v114 = 0; 2083 v114 = 0;
2084 do 2084 do
2085 { 2085 {
2086 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v114+1].uItemID); 2086 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v114+1].uItemID)
2087 { 2087 {
2088 v50 = ItemsInShopTexture[v114 + 6]; 2088 v50 = ItemsInShopTexture[v114 + 6];
2089 v51 = 308 - v50->uTextureHeight; 2089 v51 = 308 - v50->uTextureHeight;
2090 if ( (signed int)v51 < 1 ) 2090 if ( (signed int)v51 < 1 )
2091 v51 = 0; 2091 v51 = 0;
2114 { 2114 {
2115 v62 = 0; 2115 v62 = 0;
2116 v109 = 0; 2116 v109 = 0;
2117 do 2117 do
2118 { 2118 {
2119 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v62].uItemID); 2119 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v62].uItemID)
2120 ++v109; 2120 ++v109;
2121 ++v62; 2121 ++v62;
2122 } 2122 }
2123 while ( v62 < 12 ); 2123 while ( v62 < 12 );
2124 v63 = GetAsyncKeyState(17); 2124 v63 = GetAsyncKeyState(17);
2700 return; 2700 return;
2701 2701
2702 v149 = 0; 2702 v149 = 0;
2703 for(int i=0; i<8; ++i) 2703 for(int i=0; i<8; ++i)
2704 { 2704 {
2705 if ( pParty->StandartItemsInShops[window_SpeakInHouse->par1C][i].uItemID); 2705 if ( pParty->StandartItemsInShops[window_SpeakInHouse->par1C][i].uItemID)
2706 ++v149; 2706 ++v149;
2707 2707
2708 } 2708 }
2709 2709
2710 v69 = GetAsyncKeyState(17); 2710 v69 = GetAsyncKeyState(17);
3240 else 3240 else
3241 { 3241 {
3242 if ( pParty->uNumGold < v63 ) 3242 if ( pParty->uNumGold < v63 )
3243 { 3243 {
3244 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u); //"You don't have enough gold" 3244 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u); //"You don't have enough gold"
3245 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney); 3245 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful);
3246 } 3246 }
3247 else 3247 else
3248 { 3248 {
3249 Party::TakeGold(v63); 3249 Party::TakeGold(v63);
3250 v58->pActiveSkills[dialog_menu_id-36] = 1; 3250 v58->pActiveSkills[dialog_menu_id-36] = 1;
3724 v25 = 0; 3724 v25 = 0;
3725 if ( pParty->uNumGold < v2 ) 3725 if ( pParty->uNumGold < v2 )
3726 { 3726 {
3727 LABEL_55: 3727 LABEL_55:
3728 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u); 3728 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u);
3729 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney); 3729 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful);
3730 goto LABEL_46; 3730 goto LABEL_46;
3731 } 3731 }
3732 Party::TakeGold(v2); 3732 Party::TakeGold(v2);
3733 v35 = LODWORD(v1->pConditions[17]); 3733 v35 = LODWORD(v1->pConditions[17]);
3734 v59 = v1->pConditions[14]; 3734 v59 = v1->pConditions[14];
3842 } 3842 }
3843 return; 3843 return;
3844 } 3844 }
3845 3845
3846 //----- (004B4710) -------------------------------------------------------- 3846 //----- (004B4710) --------------------------------------------------------
3847 int __cdecl TrainingDialog() 3847 void TrainingDialog()
3848 { 3848 {
3849 //Player *v0; // ebx@1 3849 //Player *v0; // ebx@1
3850 int color2; // eax@1 3850 int color2; // eax@1
3851 //unsigned int v2; // ecx@1 3851 //unsigned int v2; // ecx@1
3852 //int v3; // eax@1 3852 //int v3; // eax@1
3856 //void *v7; // ecx@3 3856 //void *v7; // ecx@3
3857 int v8; // edx@4 3857 int v8; // edx@4
3858 double v9; // st7@6 3858 double v9; // st7@6
3859 signed int v10; // esi@6 3859 signed int v10; // esi@6
3860 int v11; // ecx@6 3860 int v11; // ecx@6
3861 int result; // eax@9 3861 //int result; // eax@9
3862 GUIWindow *v13; // edi@14 3862 GUIWindow *v13; // edi@14
3863 signed int v14; // esi@14 3863 signed int v14; // esi@14
3864 unsigned int v15; // esi@16 3864 unsigned int v15; // esi@16
3865 int v16; // eax@16 3865 int v16; // eax@16
3866 unsigned int v17; // eax@17 3866 unsigned int v17; // eax@17
3872 const char *v23; // eax@28 3872 const char *v23; // eax@28
3873 int v24; // eax@28 3873 int v24; // eax@28
3874 unsigned int v25; // ecx@28 3874 unsigned int v25; // ecx@28
3875 int v26; // eax@28 3875 int v26; // eax@28
3876 unsigned __int16 v27; // ax@28 3876 unsigned __int16 v27; // ax@28
3877 int v28; // eax@32 3877 //int v28; // eax@32
3878 unsigned __int16 v29; // ST14_2@34 3878 unsigned __int16 v29; // ST14_2@34
3879 int v30; // eax@34 3879 int v30; // eax@34
3880 const char *v31; // ST18_4@36 3880 //const char *v31; // ST18_4@36
3881 unsigned __int16 v32; // ST14_2@36 3881 //unsigned __int16 v32; // ST14_2@36
3882 int v33; // eax@36 3882 int v33; // eax@36
3883 int v34; // eax@37 3883 int v34; // eax@37
3884 unsigned int v35; // edi@38 3884 unsigned int v35; // edi@38
3885 unsigned int v36; // eax@38 3885 unsigned int v36; // eax@38
3886 int v37; // ecx@41 3886 //int v37; // ecx@41
3887 char *v38; // eax@41 3887 //char *v38; // eax@41
3888 int *v39; // eax@45 3888 //int *v39; // eax@45
3889 unsigned int v40; // eax@46 3889 unsigned int v40; // eax@46
3890 void *v41; // ecx@46 3890 //void *v41; // ecx@46
3891 unsigned int v42; // eax@46 3891 unsigned int v42; // eax@46
3892 GUIWindow *v43; // ecx@59 3892 GUIWindow *v43; // ecx@59
3893 int v44; // edx@59 3893 int v44; // edx@59
3894 char **v45; // esi@60 3894 char **v45; // esi@60
3895 int v46; // eax@62 3895 //int v46; // eax@62
3896 int v47; // eax@68 3896 int v47; // eax@68
3897 int v48; // edx@69 3897 //int v48; // edx@69
3898 int v49; // ebx@69 3898 int v49; // ebx@69
3899 unsigned __int8 v50; // sf@69 3899 //unsigned __int8 v50; // sf@69
3900 char **v51; // edi@70 3900 char **v51; // edi@70
3901 GUIButton *v52; // eax@71 3901 GUIButton *v52; // eax@71
3902 GUIButton *v53; // esi@71 3902 GUIButton *v53; // esi@71
3903 int v54; // eax@71 3903 int v54; // eax@71
3904 unsigned int v55; // ecx@71 3904 unsigned int v55; // ecx@71
3905 int v56; // eax@71 3905 int v56; // eax@71
3906 unsigned __int16 v57; // ax@71 3906 unsigned __int16 v57; // ax@71
3907 unsigned __int16 v58; // [sp-Ch] [bp-90h]@38 3907 unsigned __int16 v58; // [sp-Ch] [bp-90h]@38
3908 const char *v59; // [sp-Ch] [bp-90h]@63 3908 //const char *v59; // [sp-Ch] [bp-90h]@63
3909 char *v60; // [sp-8h] [bp-8Ch]@38 3909 char *v60; // [sp-8h] [bp-8Ch]@38
3910 char *v61; // [sp-8h] [bp-8Ch]@63 3910 //char *v61; // [sp-8h] [bp-8Ch]@63
3911 unsigned int v62; // [sp-4h] [bp-88h]@38 3911 unsigned int v62; // [sp-4h] [bp-88h]@38
3912 int v63; // [sp-4h] [bp-88h]@52 3912 int v63; // [sp-4h] [bp-88h]@52
3913 char *v64; // [sp-4h] [bp-88h]@63 3913 //char *v64; // [sp-4h] [bp-88h]@63
3914 GUIWindow v65; // [sp+Ch] [bp-78h]@1 3914 GUIWindow v65; // [sp+Ch] [bp-78h]@1
3915 //__int64 v66; // [sp+60h] [bp-24h]@3 3915 //__int64 v66; // [sp+60h] [bp-24h]@3
3916 unsigned int white; // [sp+68h] [bp-1Ch]@1 3916 unsigned int white; // [sp+68h] [bp-1Ch]@1
3917 int v68; // [sp+6Ch] [bp-18h]@3 3917 int v68; // [sp+6Ch] [bp-18h]@3
3918 int v69; // [sp+70h] [bp-14h]@6 3918 int v69; // [sp+70h] [bp-14h]@6
3924 //v0 = pPlayers[uActiveCharacter]; 3924 //v0 = pPlayers[uActiveCharacter];
3925 memcpy(&v65, window_SpeakInHouse, sizeof(v65)); 3925 memcpy(&v65, window_SpeakInHouse, sizeof(v65));
3926 v65.uFrameX = 483; 3926 v65.uFrameX = 483;
3927 v65.uFrameWidth = 148; 3927 v65.uFrameWidth = 148;
3928 v65.uFrameZ = 334; 3928 v65.uFrameZ = 334;
3929 white = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); 3929 white = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(255, 255, 255);
3930 color2 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xCDu, 0x23u); 3930 color2 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xCDu, 0x23u);
3931 //v71 = color2; 3931 //v71 = color2;
3932 //v2 = v0->uLevel; 3932 //v2 = v0->uLevel;
3933 //v3 = 0; 3933 //v3 = 0;
3934 //v4 = 0; 3934 //v4 = 0;
3936 // v3 += v4 + 1; 3936 // v3 += v4 + 1;
3937 //v5 = 1000 * v3; 3937 //v5 = 1000 * v3;
3938 v5 = 1000ui64 * pPlayers[uActiveCharacter]->uLevel * (pPlayers[uActiveCharacter]->uLevel + 1) / 2; // E n = n(n + 1) / 2 3938 v5 = 1000ui64 * pPlayers[uActiveCharacter]->uLevel * (pPlayers[uActiveCharacter]->uLevel + 1) / 2; // E n = n(n + 1) / 2
3939 //v6 = HIDWORD(v0->uExperience); 3939 //v6 = HIDWORD(v0->uExperience);
3940 //v7 = window_SpeakInHouse->ptr_1C; 3940 //v7 = window_SpeakInHouse->ptr_1C;
3941 v68 = pMaxLevelPerTrainingHallType[(unsigned int)window_SpeakInHouse->ptr_1C - 89]; 3941 v68 = pMaxLevelPerTrainingHallType[(unsigned int)window_SpeakInHouse->ptr_1C - HOUSE_TRAINING_HALL_EMERALD_ISLE];
3942 //v66 = 1000 * v3; 3942 //v66 = 1000 * v3;
3943 if (pPlayers[uActiveCharacter]->uExperience >= v5) 3943 if (pPlayers[uActiveCharacter]->uExperience >= v5)
3944 { 3944 {
3945 v8 = pPlayers[uActiveCharacter]->classType % 4 + 1; 3945 v8 = pPlayers[uActiveCharacter]->classType % 4 + 1;
3946 if ( v8 == 4 ) 3946 if ( v8 == 4 )
3953 v11 = v10 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; 3953 v11 = v10 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100;
3954 if ( v11 < v10 / 3 ) 3954 if ( v11 < v10 / 3 )
3955 v11 = v10 / 3; 3955 v11 = v10 / 3;
3956 //i = v11; 3956 //i = v11;
3957 } 3957 }
3958 result = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); 3958
3959 if ( result ) 3959 if (sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win())
3960 { 3960 {
3961 if ( dialog_menu_id != HOUSE_DIALOGUE_MAIN ) 3961 if ( dialog_menu_id != HOUSE_DIALOGUE_MAIN )
3962 { 3962 {
3963 if ( dialog_menu_id != HOUSE_DIALOGUE_TRAININGHALL_17 ) 3963 if ( dialog_menu_id != HOUSE_DIALOGUE_TRAININGHALL_TRAIN )
3964 { 3964 {
3965 result = dialog_menu_id - 96;
3966 if ( dialog_menu_id == HOUSE_DIALOGUE_LEARN_SKILLS ) 3965 if ( dialog_menu_id == HOUSE_DIALOGUE_LEARN_SKILLS )
3967 { 3966 {
3968 result = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); 3967 if (sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win())
3969 if ( result )
3970 { 3968 {
3971 //i = 0; 3969 //i = 0;
3972 int _v0 = 0; 3970 int _v0 = 0;
3973 v13 = pDialogueWindow; 3971 v13 = pDialogueWindow;
3974 //v14 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (unsigned int)ptr_507BC0->ptr_1C] * 500.0); 3972 //v14 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (unsigned int)ptr_507BC0->ptr_1C] * 500.0);
3998 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], v73);// "Skill Cost: %lu" 3996 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], v73);// "Skill Cost: %lu"
3999 v65.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u); 3997 v65.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u);
4000 v73 = (signed int)(149 - _v0) / v72; 3998 v73 = (signed int)(149 - _v0) / v72;
4001 if ( v73 > 32 ) 3999 if ( v73 > 32 )
4002 v73 = 32; 4000 v73 = 32;
4003 result = v13->pStartingPosActiveItem; 4001 //result = v13->pStartingPosActiveItem;
4004 v19 = (signed int)(149 - v72 * v73 - _v0) / 2 - v73 / 2 + 162; 4002 v19 = (signed int)(149 - v72 * v73 - _v0) / 2 - v73 / 2 + 162;
4005 int _v1 = result; 4003 int _v1 = v13->pStartingPosActiveItem;
4006 v68 = v19; 4004 v68 = v19;
4007 if ( result < result + v13->pNumPresenceButton ) 4005 if (v13->pStartingPosActiveItem < v13->pStartingPosActiveItem + v13->pNumPresenceButton )
4008 { 4006 {
4009 v72 = 2; 4007 v72 = 2;
4010 do 4008 do
4011 { 4009 {
4012 v20 = v13->GetControl(_v1); 4010 v20 = v13->GetControl(_v1);
4032 v27 = color2; 4030 v27 = color2;
4033 if ( pDialogueWindow->pCurrentPosActiveItem != v72 ) 4031 if ( pDialogueWindow->pCurrentPosActiveItem != v72 )
4034 v27 = white; 4032 v27 = white;
4035 v65.DrawTitleText(pFontArrus, 0, v25, v27, v23, 3u); 4033 v65.DrawTitleText(pFontArrus, 0, v25, v27, v23, 3u);
4036 } 4034 }
4037 v28 = v13->pStartingPosActiveItem;
4038 ++_v1; 4035 ++_v1;
4039 result = v13->pNumPresenceButton + v28;
4040 ++v72; 4036 ++v72;
4041 } 4037 }
4042 while ( (signed int)_v1 < result ); 4038 while ( (signed int)_v1 < v13->pStartingPosActiveItem + v13->pNumPresenceButton );
4043 } 4039 }
4044 } 4040 }
4045 else 4041 else
4046 { 4042 {
4047 LABEL_76: 4043 LABEL_76:
4049 // "Seek knowledge elsewhere %s the %s" 4045 // "Seek knowledge elsewhere %s the %s"
4050 strcat(pTmpBuf, "\n \n"); 4046 strcat(pTmpBuf, "\n \n");
4051 strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]);// "I can offer you nothing further." 4047 strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]);// "I can offer you nothing further."
4052 v29 = color2; 4048 v29 = color2;
4053 v30 = pFontArrus->CalcTextHeight(pTmpBuf, &v65, 0, 0); 4049 v30 = pFontArrus->CalcTextHeight(pTmpBuf, &v65, 0, 0);
4054 result = (int)v65.DrawTitleText(pFontArrus, 0, (174 - v30) / 2 + 138, v29, pTmpBuf, 3u); 4050 (int)v65.DrawTitleText(pFontArrus, 0, (174 - v30) / 2 + 138, v29, pTmpBuf, 3u);
4055 } 4051 }
4056 } 4052 }
4057 } 4053 }
4058 return result; 4054 return;
4059 } 4055 }
4060 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) 4056 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
4061 { 4057 {
4062 v31 = pNPCTopics[122].pText; 4058 //v31 = pNPCTopics[122].pText;
4063 v32 = color2; 4059 //v32 = color2;
4064 v33 = pFontArrus->CalcTextHeight(pNPCTopics[122].pText, &v65, 0, 0); 4060 v33 = pFontArrus->CalcTextHeight(pNPCTopics[122].pText, &v65, 0, 0);
4065 v65.DrawTitleText(pFontArrus, 0, (212 - v33) / 2 + 101, v32, v31, 3); 4061 v65.DrawTitleText(pFontArrus, 0, (212 - v33) / 2 + 101, color2, pNPCTopics[122].pText, 3);
4066 result = (int)pDialogueWindow;
4067 pDialogueWindow->pNumPresenceButton = 0; 4062 pDialogueWindow->pNumPresenceButton = 0;
4068 return result; 4063 return;
4069 } 4064 }
4070 v34 = pPlayers[uActiveCharacter]->uLevel; 4065 v34 = pPlayers[uActiveCharacter]->uLevel;
4071 if ( v34 < v68 ) 4066 if ( v34 < v68 )
4072 { 4067 {
4073 if ( (signed __int64)pPlayers[uActiveCharacter]->uExperience >= v5 ) 4068 if ( (signed __int64)pPlayers[uActiveCharacter]->uExperience >= v5 )
4074 { 4069 {
4075 if ( pParty->uNumGold >= v11) 4070 if ( pParty->uNumGold >= v11)
4076 { 4071 {
4077 Party::TakeGold(v11); 4072 Party::TakeGold(v11);
4078 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney); 4073 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful);
4079 ++pPlayers[uActiveCharacter]->uLevel; 4074 ++pPlayers[uActiveCharacter]->uLevel;
4080 pPlayers[uActiveCharacter]->uSkillPoints += pPlayers[uActiveCharacter]->uLevel / 10 + 5; 4075 pPlayers[uActiveCharacter]->uSkillPoints += pPlayers[uActiveCharacter]->uLevel / 10 + 5;
4081 pPlayers[uActiveCharacter]->sHealth = pPlayers[uActiveCharacter]->GetMaxHealth(); 4076 pPlayers[uActiveCharacter]->sHealth = pPlayers[uActiveCharacter]->GetMaxHealth();
4082 pPlayers[uActiveCharacter]->sMana = pPlayers[uActiveCharacter]->GetMaxMana(); 4077 pPlayers[uActiveCharacter]->sMana = pPlayers[uActiveCharacter]->GetMaxMana();
4083 v37 = 0; 4078
4084 v38 = byte_F8B148; 4079 uint max_level_in_party = player_levels[0];
4085 do 4080 for (uint _it = 1; _it < 4; ++_it)
4086 { 4081 {
4087 if ( *(int *)v38 > v37 ) 4082 if (player_levels[_it] > max_level_in_party)
4088 v37 = *(int *)v38; 4083 max_level_in_party = player_levels[_it];
4089 v38 += 4;
4090 } 4084 }
4091 while ( (signed int)v38 < (signed int)word_F8B158 ); 4085
4092 v39 = &dword_F8B144 + uActiveCharacter; 4086 ++player_levels[uActiveCharacter - 1];
4093 ++*v39; 4087 if (player_levels[uActiveCharacter - 1] > max_level_in_party) // if we reach new maximum party level
4094 if ( *v39 > v37 ) 4088 // feature is broken thou, since this array is always zeroed in EnterHouse
4095 { 4089 {
4096 v40 = sub_494820(pParty->uCurrentHour); 4090 v40 = _494820_training_time(pParty->uCurrentHour);
4097 v41 = window_SpeakInHouse->ptr_1C; 4091 //v41 = window_SpeakInHouse->ptr_1C;
4098 v42 = 60 * (v40 + 4) - pParty->uCurrentMinute; 4092 v42 = 60 * (v40 + 4) - pParty->uCurrentMinute;
4099 if ( v41 == (void *)94 || v41 == (void *)95 ) 4093 if ((unsigned int)window_SpeakInHouse->ptr_1C == HOUSE_TRAINING_HALL_94 ||
4094 (unsigned int)window_SpeakInHouse->ptr_1C == HOUSE_TRAINING_HALL_95)
4100 v42 += 720; 4095 v42 += 720;
4101 RestAndHeal((signed int)(v42 + 10080)); 4096 RestAndHeal((signed int)(v42 + 10080));
4102 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor ) 4097 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor )
4103 pOutdoor->SetFog(); 4098 pOutdoor->SetFog();
4104 } 4099 }
4105 pPlayers[uActiveCharacter]->PlaySound(SPEECH_87, 0); 4100 pPlayers[uActiveCharacter]->PlaySound(SPEECH_87, 0);
4106 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[430], pPlayers[uActiveCharacter]->pName, pPlayers[uActiveCharacter]->uLevel, pPlayers[uActiveCharacter]->uLevel / 10 + 5);// 4101 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[430], pPlayers[uActiveCharacter]->pName, pPlayers[uActiveCharacter]->uLevel, pPlayers[uActiveCharacter]->uLevel / 10 + 5);//
4107 // "%s is now Level %lu and has earned %lu Skill Points!" 4102 // "%s is now Level %lu and has earned %lu Skill Points!"
4108 ShowStatusBarString(pTmpBuf, 2); 4103 ShowStatusBarString(pTmpBuf, 2);
4109 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); 4104 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
4110 return true; 4105 return;
4111 } 4106 }
4112 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);// "You don't have enough gold" 4107 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);// "You don't have enough gold"
4113 v63 = 4; 4108 v63 = 4;
4114 LABEL_55: 4109 LABEL_55:
4115 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)v63); 4110 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)v63);
4123 *(&pMessageQueue_50CBD0->uNumMessages + result) = 0; 4118 *(&pMessageQueue_50CBD0->uNumMessages + result) = 0;
4124 ++pMessageQueue_50CBD0->uNumMessages; 4119 ++pMessageQueue_50CBD0->uNumMessages;
4125 } 4120 }
4126 return result;*/ 4121 return result;*/
4127 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); 4122 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
4128 return 1; // void function actually 4123 return;
4129 } 4124 }
4130 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[538], (unsigned int)(v5 - pPlayers[uActiveCharacter]->uExperience), v34 + 1);// 4125 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[538], (unsigned int)(v5 - pPlayers[uActiveCharacter]->uExperience), v34 + 1);//
4131 // "You need %d more experience to train to level %d" 4126 // "You need %d more experience to train to level %d"
4132 v35 = 0; 4127 v35 = 0;
4133 v62 = 3; 4128 v62 = 3;
4148 } 4143 }
4149 v65.DrawTitleText(pFontArrus, v35, v36, v58, v60, v62); 4144 v65.DrawTitleText(pFontArrus, v35, v36, v58, v60, v62);
4150 v63 = 3; 4145 v63 = 3;
4151 goto LABEL_55; 4146 goto LABEL_55;
4152 } 4147 }
4153 result = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); 4148
4154 if ( result ) 4149 if (sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win())
4155 { 4150 {
4156 v43 = pDialogueWindow; 4151 v43 = pDialogueWindow;
4157 v72 = 0; 4152 v72 = 0;
4158 pShopOptions[0] = pTmpBuf; 4153 pShopOptions[0] = pTmpBuf;
4159 pShopOptions[1] = pGlobalTXT_LocalizationStrings[160];// "Learn Skills" 4154 pShopOptions[1] = pGlobalTXT_LocalizationStrings[160];// "Learn Skills"
4162 if ( v73 < v73 + v44 ) 4157 if ( v73 < v73 + v44 )
4163 { 4158 {
4164 v45 = pShopOptions; 4159 v45 = pShopOptions;
4165 do 4160 do
4166 { 4161 {
4167 if ( v43->GetControl(v73)->uControlParam == 17 ) 4162 if ( v43->GetControl(v73)->uControlParam == HOUSE_DIALOGUE_TRAININGHALL_TRAIN )
4168 { 4163 {
4169 v46 = pPlayers[uActiveCharacter]->uLevel; 4164 //v46 = pPlayers[uActiveCharacter]->uLevel;
4170 if ( v46 < v68 ) 4165 if (pPlayers[uActiveCharacter]->uLevel >= v68)
4171 { 4166 sprintfex(*v45, "%s\n \n%s",
4172 if ( (signed __int64)pPlayers[uActiveCharacter]->uExperience < v5 ) 4167 pGlobalTXT_LocalizationStrings[536], pGlobalTXT_LocalizationStrings[529]); //"With your skills, you should be working here as a teacher." "Sorry, but we are unable to train you."
4173 {
4174 v64 = (char *)(v46 + 1);
4175 v61 = (char *)(v5 - LODWORD(pPlayers[uActiveCharacter]->uExperience));
4176 v59 = pGlobalTXT_LocalizationStrings[538];// "You need %d more experience to train to level %d"
4177 }
4178 else
4179 {
4180 v64 = (char *)v11;
4181 v61 = (char *)(v46 + 1);
4182 v59 = pGlobalTXT_LocalizationStrings[537];// "Train to level %d for %d gold"
4183 }
4184 }
4185 else 4168 else
4186 { 4169 {
4187 v64 = pGlobalTXT_LocalizationStrings[529];// ""Sorry, but we are unable to train you."" 4170 if (pPlayers[uActiveCharacter]->uExperience < v5)
4188 v61 = pGlobalTXT_LocalizationStrings[536];// ""With your skills, you should be working here as a teacher."" 4171 sprintfex(*v45, pGlobalTXT_LocalizationStrings[538], // "You need %d more experience to train to level %d"
4189 v59 = "%s\n \n%s"; 4172 (uint)(v5 - pPlayers[uActiveCharacter]->uExperience), pPlayers[uActiveCharacter]->uLevel + 1);
4173 else
4174 sprintfex(*v45, pGlobalTXT_LocalizationStrings[537], // "Train to level %d for %d gold"
4175 pPlayers[uActiveCharacter]->uLevel + 1, v11);
4190 } 4176 }
4191 sprintfex(*v45, v59, v61, v64);
4192 } 4177 }
4193 v47 = pFontArrus->CalcTextHeight(*v45, &v65, 0, 0); 4178 v47 = pFontArrus->CalcTextHeight(*v45, &v65, 0, 0);
4194 v43 = pDialogueWindow; 4179 v43 = pDialogueWindow;
4195 v72 += v47; 4180 v72 += v47;
4196 ++v45; 4181 ++v45;
4197 ++v73; 4182 ++v73;
4198 } 4183 }
4199 while ( v73 < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem ); 4184 while ( v73 < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem );
4200 } 4185 }
4201 //HIDWORD(v66) = (174 - v72) / 2; 4186
4202 result = v43->pStartingPosActiveItem;
4203 v48 = result + v43->pNumPresenceButton;
4204 v49 = (2 * (87 - (174 - v72) / 2) - v72) / 2 - (174 - v72) / 2 / 2 + 138; 4187 v49 = (2 * (87 - (174 - v72) / 2) - v72) / 2 - (174 - v72) / 2 / 2 + 138;
4205 v50 = -v43->pNumPresenceButton < 0;
4206 v73 = v43->pStartingPosActiveItem; 4188 v73 = v43->pStartingPosActiveItem;
4207 if ( v50 ^ result < v48 ) 4189 if (v43->pStartingPosActiveItem < v43->pStartingPosActiveItem + v43->pNumPresenceButton)
4208 { 4190 {
4209 int _v3 = 2; 4191 int _v3 = 2;
4210 v51 = pShopOptions; 4192 v51 = pShopOptions;
4211 do 4193 do
4212 { 4194 {
4225 v65.DrawTitleText(pFontArrus, 0, v55, v57, *v51, 3u); 4207 v65.DrawTitleText(pFontArrus, 0, v55, v57, *v51, 3u);
4226 v43 = pDialogueWindow; 4208 v43 = pDialogueWindow;
4227 ++_v3; 4209 ++_v3;
4228 ++v51; 4210 ++v51;
4229 ++v73; 4211 ++v73;
4230 result = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; 4212 }
4231 } 4213 while ( v73 < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton);
4232 while ( v73 < result );
4233 } 4214 }
4234 } 4215 }
4235 } 4216 }
4236 return result;
4237 } 4217 }
4238 4218
4239 4219
4240 4220
4241 4221
4751 if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_BUY_STANDARD) 4731 if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_BUY_STANDARD)
4752 { 4732 {
4753 do 4733 do
4754 { 4734 {
4755 // if ( pParty->field_777C[9 * (v49 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] ) 4735 // if ( pParty->field_777C[9 * (v49 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] )
4756 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v49].uItemID); 4736 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v49].uItemID)
4757 { 4737 {
4758 v50 = ItemsInShopTexture[v49]; 4738 v50 = ItemsInShopTexture[v49];
4759 v51 = 152 - v50->uTextureHeight; 4739 v51 = 152 - v50->uTextureHeight;
4760 if ( (signed int)v51 < 1 ) 4740 if ( (signed int)v51 < 1 )
4761 v51 = 0; 4741 v51 = 0;
4784 while ( v49 < 6 ); 4764 while ( v49 < 6 );
4785 v122 = 0; 4765 v122 = 0;
4786 do 4766 do
4787 { 4767 {
4788 //if ( pParty->field_777C[9 * (v122 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 54] ) 4768 //if ( pParty->field_777C[9 * (v122 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 54] )
4789 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v122+1].uItemID); 4769 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v122+1].uItemID)
4790 { 4770 {
4791 v54 = ItemsInShopTexture[v122 + 6]; 4771 v54 = ItemsInShopTexture[v122 + 6];
4792 v55 = 306 - v54->uTextureHeight; 4772 v55 = 306 - v54->uTextureHeight;
4793 v56 = 75 * v122 - v54->uTextureWidth / 2 + 40; 4773 v56 = 75 * v122 - v54->uTextureWidth / 2 + 40;
4794 if ( v122 ) 4774 if ( v122 )
4880 } 4860 }
4881 result = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); 4861 result = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win();
4882 if ( result ) 4862 if ( result )
4883 { 4863 {
4884 v66 = 0; 4864 v66 = 0;
4885 v117 = 0; 4865 v117 = 0;\
4886 if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_BUY_STANDARD) 4866 if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_BUY_STANDARD)
4887 { 4867 {
4888 do 4868 do
4889 { 4869 {
4890 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v66].uItemID); //9 * (v66 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] ) 4870 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v66].uItemID) //9 * (v66 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] )
4891 ++v117; 4871 ++v117;
4892 ++v66; 4872 ++v66;
4893 } 4873 }
4894 while ( v66 < 12 ); 4874 while ( v66 < 12 );
4895 } 4875 }