comparison UI/UIHouses.cpp @ 1622:01c04ff9b7a5

m
author Ritor1
date Sun, 15 Sep 2013 19:12:34 +0600
parents 11f12a34b397
children 15667a0ec5b9
comparison
equal deleted inserted replaced
1614:85a099ea7975 1622:01c04ff9b7a5
2814 } 2814 }
2815 2815
2816 //----- (004B705E) -------------------------------------------------------- 2816 //----- (004B705E) --------------------------------------------------------
2817 void TempleDialog() 2817 void TempleDialog()
2818 { 2818 {
2819 int pPrice; // edi@1 2819 int pPrice; // edi@1
2820 int result; // eax@4 2820 int pTextHeight; // eax@11
2821 unsigned int v9; // eax@9 2821 unsigned __int16 pTextColor; // ax@21
2822 int pTextHeight; // eax@11 2822 DDM_DLV_Header *v26; // edi@29
2823 int v11; // eax@12 2823 unsigned int v30; // edx@36
2824 GUIWindow *v12; // ecx@16 2824 int v35; // edi@50
2825 int v13; // edx@16 2825 GUIButton *pButton; // edi@64
2826 GUIButton *v14; // eax@19 2826 int v47; // edi@71
2827 GUIButton *v15; // edi@19 2827 GUIWindow tample_window; // [sp+13Ch] [bp-88h]@1
2828 int v16; // eax@19 2828 unsigned __int8 index; // [sp+1B7h] [bp-Dh]@64
2829 unsigned int v19; // ecx@21 2829 int v64; // [sp+1B8h] [bp-Ch]@6
2830 int v20; // eax@21 2830 unsigned int pCurrentItem; // [sp+1BCh] [bp-8h]@6
2831 unsigned __int16 pTextColor; // ax@21 2831 int all_text_height; // [sp+1C0h] [bp-4h]@6
2832 double v24; // st7@28
2833 unsigned int v25; // ebx@28
2834 DDM_DLV_Header *v26; // edi@29
2835 int v27; // eax@31
2836 int v28; // eax@32
2837 unsigned int v30; // edx@36
2838 unsigned int v31; // edx@38
2839 unsigned int v32; // edx@40
2840 unsigned int v33; // edx@42
2841 unsigned int v34; // edx@44
2842 int v35; // edi@50
2843 signed int v36; // eax@50
2844 unsigned __int8 v37; // al@54
2845 int v38; // ecx@54
2846 GUIWindow *v39; // eax@56
2847 unsigned __int8 v40; // al@61
2848 GUIButton *pButton; // edi@64
2849 int v47; // edi@71
2850 unsigned int v52; // ecx@73
2851 GUIWindow tample_window; // [sp+13Ch] [bp-88h]@1
2852 unsigned int v62; // [sp+1B0h] [bp-14h]@8
2853 unsigned __int8 index; // [sp+1B7h] [bp-Dh]@64
2854 int v64; // [sp+1B8h] [bp-Ch]@6
2855 unsigned int pCurrentItem; // [sp+1BCh] [bp-8h]@6
2856 int all_text_height; // [sp+1C0h] [bp-4h]@6
2857 2832
2858 memcpy(&tample_window, window_SpeakInHouse, sizeof(tample_window)); 2833 memcpy(&tample_window, window_SpeakInHouse, sizeof(tample_window));
2859 tample_window.uFrameX = 483; 2834 tample_window.uFrameX = 483;
2860 tample_window.uFrameWidth = 148; 2835 tample_window.uFrameWidth = 148;
2861 tample_window.uFrameZ = 334; 2836 tample_window.uFrameZ = 334;
2885 } 2860 }
2886 } 2861 }
2887 v64 = (174 - (signed int)all_text_height) / (pDialogueWindow->pNumPresenceButton - index); 2862 v64 = (174 - (signed int)all_text_height) / (pDialogueWindow->pNumPresenceButton - index);
2888 if ( v64 > 32 ) 2863 if ( v64 > 32 )
2889 v64 = 32; 2864 v64 = 32;
2890 v47 = (174 - v64 * (pDialogueWindow->pNumPresenceButton - index) - (signed int)all_text_height) / 2 - v64 / 2 + 138; 2865 all_text_height = (174 - v64 * (pDialogueWindow->pNumPresenceButton - index) - (signed int)all_text_height) / 2 - v64 / 2 + 138;
2891 if ( index + pDialogueWindow->pStartingPosActiveItem < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton ) 2866 if ( index + pDialogueWindow->pStartingPosActiveItem < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton )
2892 { 2867 {
2893 uint i = index; 2868 uint i = index;
2894 for ( pCurrentItem = index + pDialogueWindow->pStartingPosActiveItem; 2869 for ( pCurrentItem = index + pDialogueWindow->pStartingPosActiveItem;
2895 (signed int)pCurrentItem < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++pCurrentItem ) 2870 (signed int)pCurrentItem < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++pCurrentItem )
2896 { 2871 {
2897 pButton = pDialogueWindow->GetControl(pCurrentItem); 2872 pButton = pDialogueWindow->GetControl(pCurrentItem);
2898 pButton->uY = v64 + v47; 2873 pButton->uY = v64 + all_text_height;
2899 pTextHeight = pFontArrus->CalcTextHeight(pShopOptions[1 * i], &tample_window, 0, 0); 2874 pTextHeight = pFontArrus->CalcTextHeight(pShopOptions[1 * i], &tample_window, 0, 0);
2900 v52 = pButton->uY;
2901 pButton->uHeight = pTextHeight; 2875 pButton->uHeight = pTextHeight;
2902 v47 = v52 + pTextHeight - 1; 2876 pButton->uW = pButton->uY + pTextHeight - 1;
2903 pButton->uW = v47; 2877 all_text_height = pButton->uW;
2904 pTextColor = TargetColor(0xFFu, 0xFFu, 0x9Bu); 2878 pTextColor = TargetColor(0xFFu, 0xFFu, 0x9Bu);
2905 if ( pDialogueWindow->pCurrentPosActiveItem != index + 2 ) 2879 if ( pDialogueWindow->pCurrentPosActiveItem != index + 2 )
2906 pTextColor = TargetColor(0xFFu, 0xFFu, 0xFFu); 2880 pTextColor = TargetColor(0xFFu, 0xFFu, 0xFFu);
2907 tample_window.DrawTitleText(pFontArrus, 0, v52, pTextColor, pShopOptions[1 * i], 3); 2881 tample_window.DrawTitleText(pFontArrus, 0, pButton->uY, pTextColor, pShopOptions[1 * i], 3);
2908 i++; 2882 i++;
2909 index++; 2883 index++;
2910 } 2884 }
2911 } 2885 }
2912 return; 2886 return;
2914 //------------------------------------------------- 2888 //-------------------------------------------------
2915 if ( dialog_menu_id == HOUSE_DIALOGUE_TEMPLE_HEAL ) 2889 if ( dialog_menu_id == HOUSE_DIALOGUE_TEMPLE_HEAL )
2916 { 2890 {
2917 if ( !pPlayers[uActiveCharacter]->IsPlayerHealableByTemple() ) 2891 if ( !pPlayers[uActiveCharacter]->IsPlayerHealableByTemple() )
2918 return; 2892 return;
2919 v25 = 0;
2920 if ( pParty->uNumGold < pPrice ) 2893 if ( pParty->uNumGold < pPrice )
2921 { 2894 {
2922 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2); 2895 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);//"У вас не хватает золота"
2923 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful); 2896 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful);
2924 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, v25); 2897 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
2925 return; 2898 return;
2926 } 2899 }
2927 Party::TakeGold(pPrice); 2900 Party::TakeGold(pPrice);
2928 v35 = LODWORD(pPlayers[uActiveCharacter]->pConditions[17]); 2901 v35 = LODWORD(pPlayers[uActiveCharacter]->pConditions[17]);
2929 memset(pPlayers[uActiveCharacter], 0, 0xA0u); 2902 memset(pPlayers[uActiveCharacter], 0, 0xA0u);
2930 pPlayers[uActiveCharacter]->sHealth = pPlayers[uActiveCharacter]->GetMaxHealth(); 2903 pPlayers[uActiveCharacter]->sHealth = pPlayers[uActiveCharacter]->GetMaxHealth();
2931 pPlayers[uActiveCharacter]->sMana = pPlayers[uActiveCharacter]->GetMaxMana(); 2904 pPlayers[uActiveCharacter]->sMana = pPlayers[uActiveCharacter]->GetMaxMana();
2932 v36 = (signed int)window_SpeakInHouse->ptr_1C; 2905 if ( (signed int)window_SpeakInHouse->ptr_1C != 78 && ((signed int)window_SpeakInHouse->ptr_1C <= 80 || (signed int)window_SpeakInHouse->ptr_1C > 82) )
2933 if ( v36 != 78 && (v36 <= 80 || v36 > 82) )
2934 { 2906 {
2935 if ( (unsigned int)pPlayers[uActiveCharacter]->pConditions[17] | v35 ) 2907 if ( (unsigned int)pPlayers[uActiveCharacter]->pConditions[17] | v35 )
2936 { 2908 {
2937 v37 = LOBYTE(pPlayers[uActiveCharacter]->uPrevFace); 2909 pPlayers[uActiveCharacter]->uCurrentFace = pPlayers[uActiveCharacter]->uPrevFace;
2938 v38 = pPlayers[uActiveCharacter]->uPrevVoiceID; 2910 pPlayers[uActiveCharacter]->uVoiceID = pPlayers[uActiveCharacter]->uPrevVoiceID;
2939 pPlayers[uActiveCharacter]->uCurrentFace = v37; 2911 ReloadPlayerPortraits(uActiveCharacter - 1, pPlayers[uActiveCharacter]->uPrevFace);
2940 pPlayers[uActiveCharacter]->uVoiceID = v38;
2941 ReloadPlayerPortraits(uActiveCharacter - 1, (char)v37);
2942 } 2912 }
2943 pAudioPlayer->PlaySound((SoundID)(SOUND_GoldReceived|0x2), -1, 0, -1, 0, 0, 0, 0); 2913 pAudioPlayer->PlaySound((SoundID)(SOUND_GoldReceived|0x2), -1, 0, -1, 0, 0, 0, 0);
2944 pPlayers[uActiveCharacter]->PlaySound(SPEECH_82, 0); 2914 pPlayers[uActiveCharacter]->PlaySound(SPEECH_82, 0);
2945 pOtherOverlayList->_4418B1(20, uActiveCharacter + 99, 0, 65536); 2915 pOtherOverlayList->_4418B1(20, uActiveCharacter + 99, 0, 65536);
2946 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, v25); 2916 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
2947 return; 2917 return;
2948 } 2918 }
2949 if ( (unsigned int)pPlayers[uActiveCharacter]->pConditions[17] | v35 ) 2919 if ( (unsigned int)pPlayers[uActiveCharacter]->pConditions[17] | v35 )
2950 { 2920 {
2951 LODWORD(pPlayers[uActiveCharacter]->pConditions[17]) = v35; 2921 LODWORD(pPlayers[uActiveCharacter]->pConditions[17]) = v35;
2956 && !pPlayers[uActiveCharacter]->pConditions[15] && !pPlayers[uActiveCharacter]->pConditions[14] ) 2926 && !pPlayers[uActiveCharacter]->pConditions[15] && !pPlayers[uActiveCharacter]->pConditions[14] )
2957 { 2927 {
2958 pAudioPlayer->PlaySound((SoundID)(SOUND_GoldReceived|0x2), -1, 0, -1, 0, 0, 0, 0); 2928 pAudioPlayer->PlaySound((SoundID)(SOUND_GoldReceived|0x2), -1, 0, -1, 0, 0, 0, 0);
2959 pPlayers[uActiveCharacter]->PlaySound(SPEECH_82, 0); 2929 pPlayers[uActiveCharacter]->PlaySound(SPEECH_82, 0);
2960 pOtherOverlayList->_4418B1(20, uActiveCharacter + 99, 0, 65536); 2930 pOtherOverlayList->_4418B1(20, uActiveCharacter + 99, 0, 65536);
2961 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, v25); 2931 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
2962 return; 2932 return;
2963 } 2933 }
2964 pPlayers[uActiveCharacter]->uPrevFace = pPlayers[uActiveCharacter]->uCurrentFace; 2934 pPlayers[uActiveCharacter]->uPrevFace = pPlayers[uActiveCharacter]->uCurrentFace;
2965 pPlayers[uActiveCharacter]->uPrevVoiceID = pPlayers[uActiveCharacter]->uVoiceID; 2935 pPlayers[uActiveCharacter]->uPrevVoiceID = pPlayers[uActiveCharacter]->uVoiceID;
2966 pPlayers[uActiveCharacter]->SetCondition(0x11u, 1); 2936 pPlayers[uActiveCharacter]->SetCondition(0x11u, 1);
2967 pPlayers[uActiveCharacter]->uVoiceID = (pPlayers[uActiveCharacter]->GetSexByVoice() != 0) + 23; 2937 pPlayers[uActiveCharacter]->uVoiceID = (pPlayers[uActiveCharacter]->GetSexByVoice() != 0) + 23;
2968 v40 = (pPlayers[uActiveCharacter]->GetSexByVoice() != 0) + 23; 2938 pPlayers[uActiveCharacter]->uCurrentFace = (pPlayers[uActiveCharacter]->GetSexByVoice() != 0) + 23;
2969 pPlayers[uActiveCharacter]->uCurrentFace = v40; 2939 ReloadPlayerPortraits(uActiveCharacter - 1, (pPlayers[uActiveCharacter]->GetSexByVoice() != 0) + 23);
2970 ReloadPlayerPortraits(uActiveCharacter - 1, (char)v40);
2971 LODWORD(pPlayers[uActiveCharacter]->pConditions[17]) = LODWORD(pParty->uTimePlayed); 2940 LODWORD(pPlayers[uActiveCharacter]->pConditions[17]) = LODWORD(pParty->uTimePlayed);
2972 v39 = (GUIWindow *)HIDWORD(pParty->uTimePlayed); 2941 //v39 = (GUIWindow *)HIDWORD(pParty->uTimePlayed);
2973 } 2942 }
2974 HIDWORD(pPlayers[uActiveCharacter]->pConditions[17]) = (int)v39; 2943 //HIDWORD(pPlayers[uActiveCharacter]->pConditions[17]) = (int)v39;
2944 pPlayers[uActiveCharacter]->pConditions[17] =pParty->uTimePlayed;
2975 pAudioPlayer->PlaySound((SoundID)(SOUND_GoldReceived|0x2), -1, 0, -1, 0, 0, 0, 0); 2945 pAudioPlayer->PlaySound((SoundID)(SOUND_GoldReceived|0x2), -1, 0, -1, 0, 0, 0, 0);
2976 pPlayers[uActiveCharacter]->PlaySound(SPEECH_82, 0); 2946 pPlayers[uActiveCharacter]->PlaySound(SPEECH_82, 0);
2977 pOtherOverlayList->_4418B1(20, uActiveCharacter + 99, 0, 65536); 2947 pOtherOverlayList->_4418B1(20, uActiveCharacter + 99, 0, 65536);
2978 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, v25); 2948 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
2979 return; 2949 return;
2980 } 2950 }
2981 //--------------------------------------------------- 2951 //---------------------------------------------------
2982 if ( dialog_menu_id == HOUSE_DIALOGUE_TEMPLE_DONATE ) 2952 if ( dialog_menu_id == HOUSE_DIALOGUE_TEMPLE_DONATE )
2983 { 2953 {
2984 v24 = p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier; 2954 pPrice = p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier;
2985 v25 = 0; 2955 if ( pParty->uNumGold >= (unsigned int)pPrice )
2986 if ( pParty->uNumGold >= (unsigned int)(signed __int64)v24 ) 2956 {
2987 { 2957 Party::TakeGold((unsigned int)pPrice);
2988 Party::TakeGold((signed __int64)v24); 2958 v26 = &pOutdoor->ddm;
2989 v26 = &pOutdoor->ddm; 2959 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor )
2990 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) 2960 v26 = &pIndoor->dlv;
2991 v26 = &pIndoor->dlv; 2961 if ( v26->uReputation > -5 )
2992 v27 = v26->uReputation; 2962 {
2993 //v66 = v26; 2963 v26->uReputation = v26->uReputation - 1;
2994 if ( v27 > -5 ) 2964 if ( v26->uReputation - 1 < -5 )
2995 { 2965 v26->uReputation = -5;
2996 v28 = v27 - 1; 2966 }
2997 v26->uReputation = v28; 2967 if ( (unsigned __int8)byte_F8B1EF[uActiveCharacter] == pParty->uDaysPlayed % 7 )
2998 if ( v28 < -5 ) 2968 {
2999 v26->uReputation = -5; 2969 if ( v26->uReputation <= -5 )
3000 } 2970 {
3001 if ( (unsigned __int8)byte_F8B1EF[uActiveCharacter] == pParty->uDaysPlayed % 7 ) 2971 v30 = pParty->uDaysPlayed % 7 + 1;
3002 { 2972 LOBYTE(v30) = v30 | 0x80;
3003 if ( v26->uReputation <= -5 ) 2973 _42777D_CastSpell_UseWand_ShootArrow(SPELL_AIR_WIZARD_EYE, uActiveCharacter - 1, v30, 48, 0);
3004 { 2974 }
3005 v30 = pParty->uDaysPlayed % 7 + 1; 2975 if ( v26->uReputation <= -10 )
3006 LOBYTE(v30) = v30 | 0x80; 2976 {
3007 _42777D_CastSpell_UseWand_ShootArrow(SPELL_AIR_WIZARD_EYE, uActiveCharacter - 1, v30, 48, 0); 2977 v30 = pParty->uDaysPlayed % 7 + 1;
3008 } 2978 LOBYTE(v30) = v30 | 0x80;
3009 if ( v26->uReputation <= -10 ) 2979 _42777D_CastSpell_UseWand_ShootArrow(SPELL_SPIRIT_PRESERVATION, uActiveCharacter - 1, v30, 48, 0);
3010 { 2980 }
3011 v31 = pParty->uDaysPlayed % 7 + 1; 2981 if ( v26->uReputation <= -15 )
3012 LOBYTE(v31) = v31 | 0x80; 2982 {
3013 _42777D_CastSpell_UseWand_ShootArrow(SPELL_SPIRIT_PRESERVATION, uActiveCharacter - 1, v31, 48, 0); 2983 v30 = pParty->uDaysPlayed % 7 + 1;
3014 //v26 = v66; 2984 LOBYTE(v30) = v30 | 0x80;
3015 } 2985 _42777D_CastSpell_UseWand_ShootArrow(SPELL_BODY_PROTECTION_FROM_MAGIC, uActiveCharacter - 1, v30, 48, 0);
3016 if ( v26->uReputation <= -15 ) 2986 }
3017 { 2987 if ( v26->uReputation <= -20 )
3018 v32 = pParty->uDaysPlayed % 7 + 1; 2988 {
3019 LOBYTE(v32) = v32 | 0x80; 2989 v30 = pParty->uDaysPlayed % 7 + 1;
3020 _42777D_CastSpell_UseWand_ShootArrow(SPELL_BODY_PROTECTION_FROM_MAGIC, uActiveCharacter - 1, v32, 48, 0); 2990 LOBYTE(v30) = v30 | 0x80;
3021 //v26 = v66; 2991 _42777D_CastSpell_UseWand_ShootArrow(SPELL_LIGHT_HOUR_OF_POWER, uActiveCharacter - 1, v30, 48, 0);
3022 } 2992 }
3023 if ( v26->uReputation <= -20 ) 2993 if ( v26->uReputation <= -25 )
3024 { 2994 {
3025 v33 = pParty->uDaysPlayed % 7 + 1; 2995 v30 = pParty->uDaysPlayed % 7 + 1;
3026 LOBYTE(v33) = v33 | 0x80; 2996 LOBYTE(v30) = v30 | 0x80;
3027 _42777D_CastSpell_UseWand_ShootArrow(SPELL_LIGHT_HOUR_OF_POWER, uActiveCharacter - 1, v33, 48, 0); 2997 _42777D_CastSpell_UseWand_ShootArrow(SPELL_LIGHT_DAY_OF_PROTECTION, uActiveCharacter - 1, v30, 48, 0);
3028 //v26 = v66; 2998 }
3029 } 2999 }
3030 if ( v26->uReputation <= -25 ) 3000 ++byte_F8B1EF[uActiveCharacter];
3031 { 3001 pPlayers[uActiveCharacter]->PlaySound(SPEECH_83, 0);
3032 v34 = pParty->uDaysPlayed % 7 + 1; 3002 ShowStatusBarString(pGlobalTXT_LocalizationStrings[527], 2); // "Thank You!"
3033 LOBYTE(v34) = v34 | 0x80; 3003 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
3034 _42777D_CastSpell_UseWand_ShootArrow(SPELL_LIGHT_DAY_OF_PROTECTION, uActiveCharacter - 1, v34, 48, 0);
3035 }
3036 }
3037 ++byte_F8B1EF[uActiveCharacter];
3038 pPlayers[uActiveCharacter]->PlaySound(SPEECH_83, 0);
3039 ShowStatusBarString(pGlobalTXT_LocalizationStrings[527], 2); // "Thank You!"
3040 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, v25);
3041 return;
3042 }
3043 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);
3044 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful);
3045 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, v25);
3046 return; 3004 return;
3005 }
3006 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);//"У вас не хватает золота"
3007 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful);
3008 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
3009 return;
3047 } 3010 }
3048 //------------------------------------------------ 3011 //------------------------------------------------
3049 if ( dialog_menu_id == HOUSE_DIALOGUE_LEARN_SKILLS ) 3012 if ( dialog_menu_id == HOUSE_DIALOGUE_LEARN_SKILLS )
3050 { 3013 {
3051 if ( HouseUI_CheckIfPlayerCanInteract() ) 3014 if ( HouseUI_CheckIfPlayerCanInteract() )
3052 { 3015 {
3053 //v61 = pDialogueWindow;
3054 all_text_height = 0; 3016 all_text_height = 0;
3055 pCurrentItem = (signed __int64)(p2DEvents[(signed int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0); 3017 pCurrentItem = (signed __int64)(p2DEvents[(signed int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0);
3056 v64 = (signed int)(pCurrentItem * (100 - pPlayers[uActiveCharacter]->GetMerchant())) / 100; 3018 v64 = (signed int)(pCurrentItem * (100 - pPlayers[uActiveCharacter]->GetMerchant())) / 100;
3057 if ( v64 < (signed int)pCurrentItem / 3 ) 3019 if ( v64 < (signed int)pCurrentItem / 3 )
3058 v64 = (signed int)pCurrentItem / 3; 3020 v64 = (signed int)pCurrentItem / 3;
3059 pCurrentItem = 0; 3021 pCurrentItem = 0;
3060 //if ( (signed int)pDialogueWindow->pStartingPosActiveItem >= v8 ) 3022 for ( int i = pDialogueWindow->pStartingPosActiveItem; i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i )
3061 //goto LABEL_78; 3023 {
3062 for ( v62 = pDialogueWindow->pStartingPosActiveItem; (signed int)v62 < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++v62 ) 3024 if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][pDialogueWindow->GetControl(i)->msg_param - 36]
3063 { 3025 && !pPlayers[uActiveCharacter]->pActiveSkills[pDialogueWindow->GetControl(i)->msg_param - 36] )
3064 v9 = pDialogueWindow->GetControl(v62)->msg_param - 36; 3026 {
3065 if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][v9] && !pPlayers[uActiveCharacter]->pActiveSkills[v9] ) 3027 all_text_height += pFontArrus->CalcTextHeight(pSkillNames[pDialogueWindow->GetControl(i)->msg_param - 36], &tample_window, 0, 0);
3066 {
3067 all_text_height += pFontArrus->CalcTextHeight(pSkillNames[v9], &tample_window, 0, 0);
3068 //v66 = (DDM_DLV_Header *)((char *)v66 + pTextHeight);
3069 ++pCurrentItem; 3028 ++pCurrentItem;
3070 } 3029 }
3071 v11 = pDialogueWindow->pStartingPosActiveItem;
3072 } 3030 }
3073 if ( pCurrentItem ) 3031 if ( pCurrentItem )
3074 { 3032 {
3075 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[401], v64); 3033 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[401], v64);
3076 tample_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3); 3034 tample_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3);
3077 v64 = (149 - (signed int)all_text_height) / (signed int)pCurrentItem; 3035 v64 = (149 - (signed int)all_text_height) / (signed int)pCurrentItem;
3078 if ( v64 > 32 ) 3036 if ( v64 > 32 )
3079 v64 = 32; 3037 v64 = 32;
3080 pCurrentItem = (signed int)(149 - pCurrentItem * v64 - (int)all_text_height) / 2 - v64 / 2 + 162; 3038 all_text_height = (signed int)(149 - pCurrentItem * v64 - (int)all_text_height) / 2 - v64 / 2 + 162;
3081 v12 = pDialogueWindow; 3039 if ( pDialogueWindow->pStartingPosActiveItem < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton )
3082 result = pDialogueWindow->pStartingPosActiveItem; 3040 {
3083 v13 = result + pDialogueWindow->pNumPresenceButton; 3041 pCurrentItem = 2;
3084 v62 = pDialogueWindow->pStartingPosActiveItem; 3042 for ( int i = pDialogueWindow->pStartingPosActiveItem;
3085 if ( result < v13 ) 3043 i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i )
3086 { 3044 {
3087 all_text_height = 2; 3045 pButton = pDialogueWindow->GetControl(i);
3088 while ( 1 ) 3046 if ( !byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][pButton->msg_param - 36]
3089 { 3047 || pPlayers[uActiveCharacter]->pActiveSkills[pButton->msg_param - 36] )
3090 v14 = v12->GetControl(v62);
3091 v15 = v14;
3092 v16 = v14->msg_param - 36;
3093 if ( !byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][v16] || pPlayers[uActiveCharacter]->pActiveSkills[v16] )
3094 { 3048 {
3095 v15->uW = 0; 3049 pButton->uW = 0;
3096 v15->uHeight = 0; 3050 pButton->uHeight = 0;
3097 v15->uY = 0; 3051 pButton->uY = 0;
3098 } 3052 }
3099 else 3053 else
3100 { 3054 {
3101 v15->uY = v64 + pCurrentItem; 3055 pButton->uY = v64 + all_text_height;
3102 pTextHeight = pFontArrus->CalcTextHeight(pSkillNames[v16], &tample_window, 0, 0); 3056 pTextHeight = pFontArrus->CalcTextHeight(pSkillNames[pButton->msg_param - 36], &tample_window, 0, 0);
3103 v19 = v15->uY; 3057 pButton->uHeight = pTextHeight;
3104 v15->uHeight = pTextHeight; 3058 pButton->uW = pButton->uY + pTextHeight - 1;
3105 v20 = v19 + pTextHeight - 1; 3059 all_text_height = pButton->uW;
3106 v15->uW = v20;
3107 pCurrentItem = v20;
3108 pTextColor = TargetColor(0xFFu, 0xFFu, 0x9Bu); 3060 pTextColor = TargetColor(0xFFu, 0xFFu, 0x9Bu);
3109 if ( pDialogueWindow->pCurrentPosActiveItem != all_text_height ) 3061 if ( pDialogueWindow->pCurrentPosActiveItem != pCurrentItem )
3110 pTextColor = TargetColor(0xFFu, 0xFFu, 0xFFu); 3062 pTextColor = TargetColor(0xFFu, 0xFFu, 0xFFu);
3111 tample_window.DrawTitleText(pFontArrus, 0, v19, pTextColor, pSkillNames[v16], 3); 3063 tample_window.DrawTitleText(pFontArrus, 0, pButton->uY, pTextColor, pSkillNames[pButton->msg_param - 36], 3);
3112 } 3064 }
3113 result = (int)pDialogueWindow; 3065 pCurrentItem++;
3114 ++v62;
3115 //v66 = (DDM_DLV_Header *)((char *)v66 + 1);
3116 all_text_height++;
3117 if ( (signed int)v62 >= pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem )
3118 break;
3119 v12 = pDialogueWindow;
3120 } 3066 }
3121 } 3067 }
3122 } 3068 }
3123 else 3069 else
3124 { 3070 {
3125 LABEL_78:
3126 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]); 3071 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]);
3127 strcat(pTmpBuf.data(), "\n \n"); 3072 strcat(pTmpBuf.data(), "\n \n");
3128 strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]); 3073 strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]);
3129 pTextHeight = pFontArrus->CalcTextHeight(pTmpBuf.data(), &tample_window, 0, 0); 3074 pTextHeight = pFontArrus->CalcTextHeight(pTmpBuf.data(), &tample_window, 0, 0);
3130 tample_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, TargetColor(0xFFu, 0xFFu, 0x9Bu), pTmpBuf.data(), 3); 3075 tample_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, TargetColor(0xFFu, 0xFFu, 0x9Bu), pTmpBuf.data(), 3);
3135 } 3080 }
3136 3081
3137 //----- (004B4710) -------------------------------------------------------- 3082 //----- (004B4710) --------------------------------------------------------
3138 void TrainingDialog() 3083 void TrainingDialog()
3139 { 3084 {
3140 //Player *v0; // ebx@1
3141 int color2; // eax@1 3085 int color2; // eax@1
3142 //unsigned int v2; // ecx@1 3086 //unsigned int v2; // ecx@1
3143 //int v3; // eax@1 3087 //int v3; // eax@1
3144 //signed int v4; // edx@1 3088 //signed int v4; // edx@1
3145 unsigned __int64 v5; // edi@3 3089 unsigned __int64 v5; // edi@3