comparison UI/UIHouses.cpp @ 1612:11f12a34b397

TampleDialog(cleaning continue)
author Ritor1
date Sun, 15 Sep 2013 00:41:34 +0600
parents fa0e700bcc80
children 01c04ff9b7a5
comparison
equal deleted inserted replaced
1611:8e99b4a7176f 1612:11f12a34b397
2813 } 2813 }
2814 } 2814 }
2815 2815
2816 //----- (004B705E) -------------------------------------------------------- 2816 //----- (004B705E) --------------------------------------------------------
2817 void TempleDialog() 2817 void TempleDialog()
2818 { 2818 {
2819 GUIWindow *v0; // ebx@1 2819 int pPrice; // edi@1
2820 Player *v1; // esi@1
2821 int v2; // edi@1
2822 int result; // eax@4 2820 int result; // eax@4
2823 GUIWindow *v4; // edi@6
2824 void *v5; // eax@6
2825 int v6; // eax@6
2826 unsigned int v7; // eax@8
2827 int v8; // ecx@8
2828 unsigned int v9; // eax@9 2821 unsigned int v9; // eax@9
2829 int v10; // eax@11 2822 int pTextHeight; // eax@11
2830 int v11; // eax@12 2823 int v11; // eax@12
2831 GUIWindow *v12; // ecx@16 2824 GUIWindow *v12; // ecx@16
2832 int v13; // edx@16 2825 int v13; // edx@16
2833 GUIButton *v14; // eax@19 2826 GUIButton *v14; // eax@19
2834 GUIButton *v15; // edi@19 2827 GUIButton *v15; // edi@19
2835 int v16; // eax@19 2828 int v16; // eax@19
2836 const char *v17; // eax@21
2837 int v18; // eax@21
2838 unsigned int v19; // ecx@21 2829 unsigned int v19; // ecx@21
2839 int v20; // eax@21 2830 int v20; // eax@21
2840 unsigned __int16 v21; // ax@21 2831 unsigned __int16 pTextColor; // ax@21
2841 unsigned __int16 v22; // ST14_2@27
2842 int v23; // eax@27
2843 double v24; // st7@28 2832 double v24; // st7@28
2844 unsigned int v25; // ebx@28 2833 unsigned int v25; // ebx@28
2845 DDM_DLV_Header *v26; // edi@29 2834 DDM_DLV_Header *v26; // edi@29
2846 int v27; // eax@31 2835 int v27; // eax@31
2847 int v28; // eax@32 2836 int v28; // eax@32
2848 //unsigned int v29; // ecx@34
2849 unsigned int v30; // edx@36 2837 unsigned int v30; // edx@36
2850 unsigned int v31; // edx@38 2838 unsigned int v31; // edx@38
2851 unsigned int v32; // edx@40 2839 unsigned int v32; // edx@40
2852 unsigned int v33; // edx@42 2840 unsigned int v33; // edx@42
2853 unsigned int v34; // edx@44 2841 unsigned int v34; // edx@44
2855 signed int v36; // eax@50 2843 signed int v36; // eax@50
2856 unsigned __int8 v37; // al@54 2844 unsigned __int8 v37; // al@54
2857 int v38; // ecx@54 2845 int v38; // ecx@54
2858 GUIWindow *v39; // eax@56 2846 GUIWindow *v39; // eax@56
2859 unsigned __int8 v40; // al@61 2847 unsigned __int8 v40; // al@61
2860 GUIButton *v41; // edi@64 2848 GUIButton *pButton; // edi@64
2861 int v42; // esi@66
2862 GUIWindow *v43; // ecx@66
2863 int v44; // edi@66
2864 int v45; // eax@68
2865 signed int v46; // edi@69
2866 int v47; // edi@71 2849 int v47; // edi@71
2867 GUIButton *v48; // eax@73
2868 const char *v49; // edx@73
2869 GUIButton *v50; // esi@73
2870 int v51; // eax@73
2871 unsigned int v52; // ecx@73 2850 unsigned int v52; // ecx@73
2872 unsigned __int16 v53; // ax@73 2851 GUIWindow tample_window; // [sp+13Ch] [bp-88h]@1
2873 char a1[300]; // [sp+10h] [bp-1B4h]@64
2874 GUIWindow v57; // [sp+13Ch] [bp-88h]@1
2875 __int64 v58; // [sp+190h] [bp-34h]@1
2876 __int64 v59; // [sp+198h] [bp-2Ch]@1
2877 __int64 v60; // [sp+1A0h] [bp-24h]@1
2878 GUIWindow *v61; // [sp+1ACh] [bp-18h]@6
2879 unsigned int v62; // [sp+1B0h] [bp-14h]@8 2852 unsigned int v62; // [sp+1B0h] [bp-14h]@8
2880 unsigned __int8 v63; // [sp+1B7h] [bp-Dh]@64 2853 unsigned __int8 index; // [sp+1B7h] [bp-Dh]@64
2881 int v64; // [sp+1B8h] [bp-Ch]@6 2854 int v64; // [sp+1B8h] [bp-Ch]@6
2882 unsigned int v65; // [sp+1BCh] [bp-8h]@6 2855 unsigned int pCurrentItem; // [sp+1BCh] [bp-8h]@6
2883 DDM_DLV_Header *v66; // [sp+1C0h] [bp-4h]@6 2856 int all_text_height; // [sp+1C0h] [bp-4h]@6
2884 2857
2885 v0 = window_SpeakInHouse; 2858 memcpy(&tample_window, window_SpeakInHouse, sizeof(tample_window));
2886 memcpy(&v57, window_SpeakInHouse, sizeof(v57)); 2859 tample_window.uFrameX = 483;
2887 v57.uFrameX = 483; 2860 tample_window.uFrameWidth = 148;
2888 v57.uFrameWidth = 148; 2861 tample_window.uFrameZ = 334;
2889 v57.uFrameZ = 334; 2862 pPrice = pPlayers[uActiveCharacter]->GetTempleHealCostModifier(p2DEvents[window_SpeakInHouse->par1C - 1].fPriceMultiplier);
2890 HIDWORD(v58) = TargetColor(0xFFu, 0xFFu, 0xFFu); 2863 if ( dialog_menu_id == HOUSE_DIALOGUE_MAIN )
2891 HIDWORD(v59) = TargetColor(0xFFu, 0xFFu, 0x9Bu); 2864 {
2892 v1 = pPlayers[uActiveCharacter]; 2865 index = 1;
2893 //v2 = pPlayers[uActiveCharacter]->_4B807C(p2DEvents_minus1__20[13 * (unsigned int)v0->ptr_1C]); 2866 pButton = pDialogueWindow->GetControl(pDialogueWindow->pStartingPosActiveItem);
2894 v2 = pPlayers[uActiveCharacter]->GetTempleHealCostModifier(p2DEvents[v0->par1C - 1].fPriceMultiplier); 2867 pButton->uHeight = 0;
2895 HIDWORD(v60) = v2; 2868 pButton->uY = 0;
2896 if ( dialog_menu_id != HOUSE_DIALOGUE_MAIN ) 2869 if ( pPlayers[uActiveCharacter]->IsPlayerHealableByTemple() )
2897 { 2870 {
2898 if ( dialog_menu_id != HOUSE_DIALOGUE_TEMPLE_HEAL ) 2871 sprintfex(pTmpBuf.data(), "%s %d %s", pGlobalTXT_LocalizationStrings[104], pPrice, pGlobalTXT_LocalizationStrings[97]);//"Лечить" "Золото"
2899 { 2872 pShopOptions[0] = pTmpBuf.data();
2900 if ( dialog_menu_id != HOUSE_DIALOGUE_TEMPLE_DONATE ) 2873 index = 0;
2901 { 2874 }
2902 if ( dialog_menu_id == HOUSE_DIALOGUE_LEARN_SKILLS ) 2875 pShopOptions[1] = pGlobalTXT_LocalizationStrings[68];//"Пожертвовать"
2903 { 2876 pShopOptions[2] = pGlobalTXT_LocalizationStrings[160];//"Обучиться навыкам"
2904 if ( HouseUI_CheckIfPlayerCanInteract() ) 2877 all_text_height = 0;
2905 { 2878 if ( index < pDialogueWindow->pNumPresenceButton )
2906 v4 = pDialogueWindow; 2879 {
2907 v61 = pDialogueWindow; 2880 uint i = index;
2908 v5 = window_SpeakInHouse->ptr_1C; 2881 for ( uint j = index; j < pDialogueWindow->pNumPresenceButton; ++j )
2909 v66 = 0; 2882 {
2910 //v65 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (signed int)v5] * 500.0); 2883 all_text_height += pFontArrus->CalcTextHeight(pShopOptions[1 * i], &tample_window, 0, 0);
2911 v65 = (signed __int64)(p2DEvents[(signed int)v5 - 1].flt_24 * 500.0); 2884 i++;
2912 v6 = v1->GetMerchant(); 2885 }
2913 v64 = (signed int)(v65 * (100 - v6)) / 100; 2886 }
2914 if ( v64 < (signed int)v65 / 3 ) 2887 v64 = (174 - (signed int)all_text_height) / (pDialogueWindow->pNumPresenceButton - index);
2915 v64 = (signed int)v65 / 3; 2888 if ( v64 > 32 )
2916 v7 = v4->pStartingPosActiveItem; 2889 v64 = 32;
2917 v8 = v7 + v4->pNumPresenceButton; 2890 v47 = (174 - v64 * (pDialogueWindow->pNumPresenceButton - index) - (signed int)all_text_height) / 2 - v64 / 2 + 138;
2918 v65 = 0; 2891 if ( index + pDialogueWindow->pStartingPosActiveItem < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton )
2919 v62 = v7; 2892 {
2920 if ( (signed int)v7 >= v8 ) 2893 uint i = index;
2921 goto LABEL_78; 2894 for ( pCurrentItem = index + pDialogueWindow->pStartingPosActiveItem;
2922 do 2895 (signed int)pCurrentItem < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++pCurrentItem )
2923 { 2896 {
2924 v9 = v4->GetControl(v62)->msg_param - 36; 2897 pButton = pDialogueWindow->GetControl(pCurrentItem);
2925 if ( byte_4ED970_skill_learn_ability_by_class_table[v1->classType][v9] && !v1->pActiveSkills[v9] ) 2898 pButton->uY = v64 + v47;
2926 { 2899 pTextHeight = pFontArrus->CalcTextHeight(pShopOptions[1 * i], &tample_window, 0, 0);
2927 v10 = pFontArrus->CalcTextHeight(pSkillNames[v9], &v57, 0, 0); 2900 v52 = pButton->uY;
2928 v66 = (DDM_DLV_Header *)((char *)v66 + v10); 2901 pButton->uHeight = pTextHeight;
2929 ++v65; 2902 v47 = v52 + pTextHeight - 1;
2930 } 2903 pButton->uW = v47;
2931 v11 = v4->pStartingPosActiveItem; 2904 pTextColor = TargetColor(0xFFu, 0xFFu, 0x9Bu);
2932 ++v62; 2905 if ( pDialogueWindow->pCurrentPosActiveItem != index + 2 )
2933 } 2906 pTextColor = TargetColor(0xFFu, 0xFFu, 0xFFu);
2934 while ( (signed int)v62 < v4->pNumPresenceButton + v11 ); 2907 tample_window.DrawTitleText(pFontArrus, 0, v52, pTextColor, pShopOptions[1 * i], 3);
2935 if ( v65 ) 2908 i++;
2936 { 2909 index++;
2937 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[401], v64); 2910 }
2938 v57.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3u); 2911 }
2939 v64 = (149 - (signed int)v66) / (signed int)v65; 2912 return;
2940 if ( v64 > 32 ) 2913 }
2941 v64 = 32; 2914 //-------------------------------------------------
2942 v65 = (signed int)(149 - v65 * v64 - (int)v66) / 2 - v64 / 2 + 162; 2915 if ( dialog_menu_id == HOUSE_DIALOGUE_TEMPLE_HEAL )
2943 v12 = v61; 2916 {
2944 result = v61->pStartingPosActiveItem; 2917 if ( !pPlayers[uActiveCharacter]->IsPlayerHealableByTemple() )
2945 v13 = result + v61->pNumPresenceButton; 2918 return;
2946 v62 = v61->pStartingPosActiveItem; 2919 v25 = 0;
2947 if ( result < v13 ) 2920 if ( pParty->uNumGold < pPrice )
2948 { 2921 {
2949 v66 = (DDM_DLV_Header *)2; 2922 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);
2950 while ( 1 ) 2923 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful);
2951 { 2924 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, v25);
2952 v14 = v12->GetControl(v62); 2925 return;
2953 v15 = v14; 2926 }
2954 v16 = v14->msg_param - 36; 2927 Party::TakeGold(pPrice);
2955 if ( !byte_4ED970_skill_learn_ability_by_class_table[v1->classType][v16] || v1->pActiveSkills[v16] ) 2928 v35 = LODWORD(pPlayers[uActiveCharacter]->pConditions[17]);
2956 { 2929 memset(pPlayers[uActiveCharacter], 0, 0xA0u);
2957 v15->uW = 0; 2930 pPlayers[uActiveCharacter]->sHealth = pPlayers[uActiveCharacter]->GetMaxHealth();
2958 v15->uHeight = 0; 2931 pPlayers[uActiveCharacter]->sMana = pPlayers[uActiveCharacter]->GetMaxMana();
2959 v15->uY = 0; 2932 v36 = (signed int)window_SpeakInHouse->ptr_1C;
2960 } 2933 if ( v36 != 78 && (v36 <= 80 || v36 > 82) )
2961 else 2934 {
2962 { 2935 if ( (unsigned int)pPlayers[uActiveCharacter]->pConditions[17] | v35 )
2963 v17 = pSkillNames[v16]; 2936 {
2964 v15->uY = v64 + v65; 2937 v37 = LOBYTE(pPlayers[uActiveCharacter]->uPrevFace);
2965 HIDWORD(v60) = (uint32)v17; 2938 v38 = pPlayers[uActiveCharacter]->uPrevVoiceID;
2966 v18 = pFontArrus->CalcTextHeight(v17, &v57, 0, 0); 2939 pPlayers[uActiveCharacter]->uCurrentFace = v37;
2967 v19 = v15->uY; 2940 pPlayers[uActiveCharacter]->uVoiceID = v38;
2968 v15->uHeight = v18; 2941 ReloadPlayerPortraits(uActiveCharacter - 1, (char)v37);
2969 v20 = v19 + v18 - 1; 2942 }
2970 v15->uW = v20; 2943 pAudioPlayer->PlaySound((SoundID)(SOUND_GoldReceived|0x2), -1, 0, -1, 0, 0, 0, 0);
2971 v65 = v20; 2944 pPlayers[uActiveCharacter]->PlaySound(SPEECH_82, 0);
2972 v21 = WORD2(v59); 2945 pOtherOverlayList->_4418B1(20, uActiveCharacter + 99, 0, 65536);
2973 if ( (DDM_DLV_Header *)pDialogueWindow->pCurrentPosActiveItem != v66 ) 2946 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, v25);
2974 v21 = WORD2(v58); 2947 return;
2975 v57.DrawTitleText(pFontArrus, 0, v19, v21, (const char *)HIDWORD(v60), 3u); 2948 }
2976 } 2949 if ( (unsigned int)pPlayers[uActiveCharacter]->pConditions[17] | v35 )
2977 result = (int)v61; 2950 {
2978 ++v62; 2951 LODWORD(pPlayers[uActiveCharacter]->pConditions[17]) = v35;
2979 v66 = (DDM_DLV_Header *)((char *)v66 + 1); 2952 }
2980 if ( (signed int)v62 >= v61->pNumPresenceButton + v61->pStartingPosActiveItem ) 2953 else
2981 break; 2954 {
2982 v12 = v61; 2955 if ( !pPlayers[uActiveCharacter]->pConditions[16]
2983 } 2956 && !pPlayers[uActiveCharacter]->pConditions[15] && !pPlayers[uActiveCharacter]->pConditions[14] )
2984 } 2957 {
2985 }
2986 else
2987 {
2988 LABEL_78:
2989 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], v1->pName, pClassNames[v1->classType]);
2990 strcat(pTmpBuf.data(), "\n \n");
2991 strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]);
2992 v22 = WORD2(v59);
2993 v23 = pFontArrus->CalcTextHeight(pTmpBuf.data(), &v57, 0, 0);
2994 v57.DrawTitleText(pFontArrus, 0, (174 - v23) / 2 + 138, v22, pTmpBuf.data(), 3u);
2995 }
2996 }
2997 }
2998 return;
2999 }
3000 // DONATION
3001 //v24 = p2DEvents_minus1__20[13 * (unsigned int)ptr_507BC0->ptr_1C];
3002 v24 = p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier;
3003 v25 = 0;
3004 if ( pParty->uNumGold >= (unsigned int)(signed __int64)v24 )
3005 {
3006 Party::TakeGold((signed __int64)v24);
3007 v26 = &pOutdoor->ddm;
3008 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor )
3009 v26 = &pIndoor->dlv;
3010 v27 = v26->uReputation;
3011 v66 = v26;
3012 if ( v27 > -5 )
3013 {
3014 v28 = v27 - 1;
3015 v26->uReputation = v28;
3016 if ( v28 < -5 )
3017 v26->uReputation = -5;
3018 }
3019 if ( (unsigned __int8)byte_F8B1EF[uActiveCharacter] == pParty->uDaysPlayed % 7 )
3020 {
3021 if ( v26->uReputation <= -5 )
3022 {
3023 v30 = pParty->uDaysPlayed % 7 + 1;
3024 LOBYTE(v30) = v30 | 0x80;
3025 _42777D_CastSpell_UseWand_ShootArrow(SPELL_AIR_WIZARD_EYE, uActiveCharacter - 1, v30, 48, 0);
3026 }
3027 if ( v26->uReputation <= -10 )
3028 {
3029 v31 = pParty->uDaysPlayed % 7 + 1;
3030 LOBYTE(v31) = v31 | 0x80;
3031 _42777D_CastSpell_UseWand_ShootArrow(SPELL_SPIRIT_PRESERVATION, uActiveCharacter - 1, v31, 48, 0);
3032 v26 = v66;
3033 }
3034 if ( v26->uReputation <= -15 )
3035 {
3036 v32 = pParty->uDaysPlayed % 7 + 1;
3037 LOBYTE(v32) = v32 | 0x80;
3038 _42777D_CastSpell_UseWand_ShootArrow(SPELL_BODY_PROTECTION_FROM_MAGIC, uActiveCharacter - 1, v32, 48, 0);
3039 v26 = v66;
3040 }
3041 if ( v26->uReputation <= -20 )
3042 {
3043 v33 = pParty->uDaysPlayed % 7 + 1;
3044 LOBYTE(v33) = v33 | 0x80;
3045 _42777D_CastSpell_UseWand_ShootArrow(SPELL_LIGHT_HOUR_OF_POWER, uActiveCharacter - 1, v33, 48, 0);
3046 v26 = v66;
3047 }
3048 if ( v26->uReputation <= -25 )
3049 {
3050 v34 = pParty->uDaysPlayed % 7 + 1;
3051 LOBYTE(v34) = v34 | 0x80;
3052 _42777D_CastSpell_UseWand_ShootArrow(SPELL_LIGHT_DAY_OF_PROTECTION, uActiveCharacter - 1, v34, 48, 0);
3053 }
3054 }
3055 ++byte_F8B1EF[uActiveCharacter];
3056 v1->PlaySound(SPEECH_83, 0);
3057 ShowStatusBarString(pGlobalTXT_LocalizationStrings[527], 2u); // "Thank You!"
3058 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, v25);
3059 return;
3060 }
3061 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u);
3062 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful);
3063 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, v25);
3064 return;
3065 }
3066 if ( !v1->IsPlayerHealableByTemple() )
3067 return;
3068 v25 = 0;
3069 if ( pParty->uNumGold < v2 )
3070 {
3071 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u);
3072 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful);
3073 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, v25);
3074 return;
3075 }
3076 Party::TakeGold(v2);
3077 v35 = LODWORD(v1->pConditions[17]);
3078 v59 = v1->pConditions[14];
3079 v58 = v1->pConditions[15];
3080 v60 = v1->pConditions[16];
3081 v61 = (GUIWindow *)HIDWORD(v1->pConditions[17]);
3082 memset(v1, 0, 0xA0u);
3083 v1->sHealth = v1->GetMaxHealth();
3084 v1->sMana = v1->GetMaxMana();
3085 v36 = (signed int)window_SpeakInHouse->ptr_1C;
3086 if ( v36 != 78 && (v36 <= 80 || v36 > 82) )
3087 {
3088 if ( (unsigned int)v61 | v35 )
3089 {
3090 v37 = LOBYTE(v1->uPrevFace);
3091 v38 = v1->uPrevVoiceID;
3092 v1->uCurrentFace = v37;
3093 v1->uVoiceID = v38;
3094 ReloadPlayerPortraits(uActiveCharacter - 1, (char)v37);
3095 }
3096 pAudioPlayer->PlaySound((SoundID)(SOUND_GoldReceived|0x2), -1, 0, -1, 0, 0, 0, 0);
3097 v1->PlaySound(SPEECH_82, 0);
3098 pOtherOverlayList->_4418B1(20, uActiveCharacter + 99, 0, 65536);
3099 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, v25);
3100 return;
3101 }
3102 v39 = v61;
3103 if ( (unsigned int)v61 | v35 )
3104 {
3105 LODWORD(v1->pConditions[17]) = v35;
3106 }
3107 else
3108 {
3109 if ( !v60 && !v58 && !v59 )
3110 {
3111 pAudioPlayer->PlaySound((SoundID)(SOUND_GoldReceived|0x2), -1, 0, -1, 0, 0, 0, 0);
3112 v1->PlaySound(SPEECH_82, 0);
3113 pOtherOverlayList->_4418B1(20, uActiveCharacter + 99, 0, 65536);
3114 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, v25);
3115 return;
3116 }
3117 v1->uPrevFace = v1->uCurrentFace;
3118 v1->uPrevVoiceID = v1->uVoiceID;
3119 v1->SetCondition(0x11u, 1);
3120 v1->uVoiceID = (v1->GetSexByVoice() != 0) + 23;
3121 v40 = (v1->GetSexByVoice() != 0) + 23;
3122 v1->uCurrentFace = v40;
3123 ReloadPlayerPortraits(uActiveCharacter - 1, (char)v40);
3124 LODWORD(v1->pConditions[17]) = LODWORD(pParty->uTimePlayed);
3125 v39 = (GUIWindow *)HIDWORD(pParty->uTimePlayed);
3126 }
3127 HIDWORD(v1->pConditions[17]) = (int)v39;
3128 pAudioPlayer->PlaySound((SoundID)(SOUND_GoldReceived|0x2), -1, 0, -1, 0, 0, 0, 0); 2958 pAudioPlayer->PlaySound((SoundID)(SOUND_GoldReceived|0x2), -1, 0, -1, 0, 0, 0, 0);
3129 v1->PlaySound(SPEECH_82, 0); 2959 pPlayers[uActiveCharacter]->PlaySound(SPEECH_82, 0);
3130 pOtherOverlayList->_4418B1(20, uActiveCharacter + 99, 0, 65536); 2960 pOtherOverlayList->_4418B1(20, uActiveCharacter + 99, 0, 65536);
3131 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, v25); 2961 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, v25);
3132 return; // void func 2962 return;
3133 } 2963 }
3134 v63 = 1; 2964 pPlayers[uActiveCharacter]->uPrevFace = pPlayers[uActiveCharacter]->uCurrentFace;
3135 v41 = pDialogueWindow->GetControl(pDialogueWindow->pStartingPosActiveItem); 2965 pPlayers[uActiveCharacter]->uPrevVoiceID = pPlayers[uActiveCharacter]->uVoiceID;
3136 strcpy(a1, ""); 2966 pPlayers[uActiveCharacter]->SetCondition(0x11u, 1);
3137 v41->uHeight = 0; 2967 pPlayers[uActiveCharacter]->uVoiceID = (pPlayers[uActiveCharacter]->GetSexByVoice() != 0) + 23;
3138 v41->uY = 0; 2968 v40 = (pPlayers[uActiveCharacter]->GetSexByVoice() != 0) + 23;
3139 if ( v1->IsPlayerHealableByTemple() ) 2969 pPlayers[uActiveCharacter]->uCurrentFace = v40;
3140 { 2970 ReloadPlayerPortraits(uActiveCharacter - 1, (char)v40);
3141 sprintf(a1, "%s %d %s", pGlobalTXT_LocalizationStrings[104], HIDWORD(v60), pGlobalTXT_LocalizationStrings[97]); 2971 LODWORD(pPlayers[uActiveCharacter]->pConditions[17]) = LODWORD(pParty->uTimePlayed);
3142 v63 = 0; 2972 v39 = (GUIWindow *)HIDWORD(pParty->uTimePlayed);
3143 } 2973 }
3144 strcpy(&a1[100], pGlobalTXT_LocalizationStrings[68]); 2974 HIDWORD(pPlayers[uActiveCharacter]->pConditions[17]) = (int)v39;
3145 strcpy(&a1[200], pGlobalTXT_LocalizationStrings[160]); 2975 pAudioPlayer->PlaySound((SoundID)(SOUND_GoldReceived|0x2), -1, 0, -1, 0, 0, 0, 0);
3146 v42 = v63; 2976 pPlayers[uActiveCharacter]->PlaySound(SPEECH_82, 0);
3147 v43 = pDialogueWindow; 2977 pOtherOverlayList->_4418B1(20, uActiveCharacter + 99, 0, 65536);
3148 v44 = v63; 2978 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, v25);
3149 v66 = 0; 2979 return;
3150 if ( v63 < pDialogueWindow->pNumPresenceButton ) 2980 }
3151 { 2981 //---------------------------------------------------
3152 v61 = (GUIWindow *)&a1[100 * v63]; 2982 if ( dialog_menu_id == HOUSE_DIALOGUE_TEMPLE_DONATE )
3153 do 2983 {
2984 v24 = p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier;
2985 v25 = 0;
2986 if ( pParty->uNumGold >= (unsigned int)(signed __int64)v24 )
2987 {
2988 Party::TakeGold((signed __int64)v24);
2989 v26 = &pOutdoor->ddm;
2990 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor )
2991 v26 = &pIndoor->dlv;
2992 v27 = v26->uReputation;
2993 //v66 = v26;
2994 if ( v27 > -5 )
2995 {
2996 v28 = v27 - 1;
2997 v26->uReputation = v28;
2998 if ( v28 < -5 )
2999 v26->uReputation = -5;
3000 }
3001 if ( (unsigned __int8)byte_F8B1EF[uActiveCharacter] == pParty->uDaysPlayed % 7 )
3002 {
3003 if ( v26->uReputation <= -5 )
3004 {
3005 v30 = pParty->uDaysPlayed % 7 + 1;
3006 LOBYTE(v30) = v30 | 0x80;
3007 _42777D_CastSpell_UseWand_ShootArrow(SPELL_AIR_WIZARD_EYE, uActiveCharacter - 1, v30, 48, 0);
3008 }
3009 if ( v26->uReputation <= -10 )
3010 {
3011 v31 = pParty->uDaysPlayed % 7 + 1;
3012 LOBYTE(v31) = v31 | 0x80;
3013 _42777D_CastSpell_UseWand_ShootArrow(SPELL_SPIRIT_PRESERVATION, uActiveCharacter - 1, v31, 48, 0);
3014 //v26 = v66;
3015 }
3016 if ( v26->uReputation <= -15 )
3017 {
3018 v32 = pParty->uDaysPlayed % 7 + 1;
3019 LOBYTE(v32) = v32 | 0x80;
3020 _42777D_CastSpell_UseWand_ShootArrow(SPELL_BODY_PROTECTION_FROM_MAGIC, uActiveCharacter - 1, v32, 48, 0);
3021 //v26 = v66;
3022 }
3023 if ( v26->uReputation <= -20 )
3024 {
3025 v33 = pParty->uDaysPlayed % 7 + 1;
3026 LOBYTE(v33) = v33 | 0x80;
3027 _42777D_CastSpell_UseWand_ShootArrow(SPELL_LIGHT_HOUR_OF_POWER, uActiveCharacter - 1, v33, 48, 0);
3028 //v26 = v66;
3029 }
3030 if ( v26->uReputation <= -25 )
3031 {
3032 v34 = pParty->uDaysPlayed % 7 + 1;
3033 LOBYTE(v34) = v34 | 0x80;
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;
3047 }
3048 //------------------------------------------------
3049 if ( dialog_menu_id == HOUSE_DIALOGUE_LEARN_SKILLS )
3050 {
3051 if ( HouseUI_CheckIfPlayerCanInteract() )
3052 {
3053 //v61 = pDialogueWindow;
3054 all_text_height = 0;
3055 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;
3057 if ( v64 < (signed int)pCurrentItem / 3 )
3058 v64 = (signed int)pCurrentItem / 3;
3059 pCurrentItem = 0;
3060 //if ( (signed int)pDialogueWindow->pStartingPosActiveItem >= v8 )
3061 //goto LABEL_78;
3062 for ( v62 = pDialogueWindow->pStartingPosActiveItem; (signed int)v62 < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++v62 )
3063 {
3064 v9 = pDialogueWindow->GetControl(v62)->msg_param - 36;
3065 if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][v9] && !pPlayers[uActiveCharacter]->pActiveSkills[v9] )
3066 {
3067 all_text_height += pFontArrus->CalcTextHeight(pSkillNames[v9], &tample_window, 0, 0);
3068 //v66 = (DDM_DLV_Header *)((char *)v66 + pTextHeight);
3069 ++pCurrentItem;
3070 }
3071 v11 = pDialogueWindow->pStartingPosActiveItem;
3072 }
3073 if ( pCurrentItem )
3074 {
3075 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[401], v64);
3076 tample_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3);
3077 v64 = (149 - (signed int)all_text_height) / (signed int)pCurrentItem;
3078 if ( v64 > 32 )
3079 v64 = 32;
3080 pCurrentItem = (signed int)(149 - pCurrentItem * v64 - (int)all_text_height) / 2 - v64 / 2 + 162;
3081 v12 = pDialogueWindow;
3082 result = pDialogueWindow->pStartingPosActiveItem;
3083 v13 = result + pDialogueWindow->pNumPresenceButton;
3084 v62 = pDialogueWindow->pStartingPosActiveItem;
3085 if ( result < v13 )
3086 {
3087 all_text_height = 2;
3088 while ( 1 )
3089 {
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] )
3154 { 3094 {
3155 v45 = pFontArrus->CalcTextHeight((const char *)v61, &v57, 0, 0); 3095 v15->uW = 0;
3156 v66 = (DDM_DLV_Header *)((char *)v66 + v45); 3096 v15->uHeight = 0;
3157 v43 = pDialogueWindow; 3097 v15->uY = 0;
3158 v61 = (GUIWindow *)((char *)v61 + 100);
3159 ++v44;
3160 } 3098 }
3161 while ( v44 < pDialogueWindow->pNumPresenceButton ); 3099 else
3162 }
3163 v46 = v43->pNumPresenceButton - v42;
3164 v64 = (174 - (signed int)v66) / v46;
3165 if ( v64 > 32 )
3166 v64 = 32;
3167 v47 = (174 - v64 * v46 - (signed int)v66) / 2 - v64 / 2 + 138;
3168 v65 = v42 + v43->pStartingPosActiveItem;
3169 if ( v42 + v43->pStartingPosActiveItem < v43->pStartingPosActiveItem + v43->pNumPresenceButton )
3170 {
3171 v61 = (GUIWindow *)(v42 + 2);
3172 v66 = (DDM_DLV_Header *)&a1[100 * v42];
3173 do
3174 { 3100 {
3175 v48 = v43->GetControl(v65); 3101 v15->uY = v64 + pCurrentItem;
3176 v49 = (const char *)v66; 3102 pTextHeight = pFontArrus->CalcTextHeight(pSkillNames[v16], &tample_window, 0, 0);
3177 v50 = v48; 3103 v19 = v15->uY;
3178 v48->uY = v64 + v47; 3104 v15->uHeight = pTextHeight;
3179 v51 = pFontArrus->CalcTextHeight(v49, &v57, 0, 0); 3105 v20 = v19 + pTextHeight - 1;
3180 v52 = v50->uY; 3106 v15->uW = v20;
3181 v50->uHeight = v51; 3107 pCurrentItem = v20;
3182 v47 = v52 + v51 - 1; 3108 pTextColor = TargetColor(0xFFu, 0xFFu, 0x9Bu);
3183 v50->uW = v47; 3109 if ( pDialogueWindow->pCurrentPosActiveItem != all_text_height )
3184 v53 = WORD2(v59); 3110 pTextColor = TargetColor(0xFFu, 0xFFu, 0xFFu);
3185 if ( (GUIWindow *)pDialogueWindow->pCurrentPosActiveItem != v61 ) 3111 tample_window.DrawTitleText(pFontArrus, 0, v19, pTextColor, pSkillNames[v16], 3);
3186 v53 = WORD2(v58);
3187 v57.DrawTitleText(pFontArrus, 0, v52, v53, (const char *)v66, 3u);
3188 v43 = pDialogueWindow;
3189 v66 = (DDM_DLV_Header *)((char *)v66 + 100);
3190 v61 = (GUIWindow *)((char *)v61 + 1);
3191 ++v65;
3192 } 3112 }
3193 while ( (signed int)v65 < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem ); 3113 result = (int)pDialogueWindow;
3194 } 3114 ++v62;
3195 return; 3115 //v66 = (DDM_DLV_Header *)((char *)v66 + 1);
3196 } 3116 all_text_height++;
3117 if ( (signed int)v62 >= pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem )
3118 break;
3119 v12 = pDialogueWindow;
3120 }
3121 }
3122 }
3123 else
3124 {
3125 LABEL_78:
3126 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]);
3127 strcat(pTmpBuf.data(), "\n \n");
3128 strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]);
3129 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);
3131 }
3132 }
3133 }
3134 return;
3135 }
3197 3136
3198 //----- (004B4710) -------------------------------------------------------- 3137 //----- (004B4710) --------------------------------------------------------
3199 void TrainingDialog() 3138 void TrainingDialog()
3200 { 3139 {
3201 //Player *v0; // ebx@1 3140 //Player *v0; // ebx@1