comparison UI/UIHouses.cpp @ 1634:08ebd0fee604

m
author Ritor1
date Tue, 17 Sep 2013 16:30:36 +0600
parents ee4a65ac9d21
children ff3d7af671ec
comparison
equal deleted inserted replaced
1630:ee4a65ac9d21 1634:08ebd0fee604
2981 int v8; // edx@4 2981 int v8; // edx@4
2982 double v9; // st7@6 2982 double v9; // st7@6
2983 signed int v10; // esi@6 2983 signed int v10; // esi@6
2984 int pPrice; // ecx@6 2984 int pPrice; // ecx@6
2985 signed int v14; // esi@14 2985 signed int v14; // esi@14
2986 unsigned int v15; // esi@16 2986 //unsigned int v15; // esi@16
2987 int v16; // eax@16 2987 int v16; // eax@16
2988 unsigned int v17; // eax@17 2988 //unsigned int v17; // eax@17
2989 int v19; // ecx@24 2989 int v19; // ecx@24
2990 GUIButton *v20; // eax@26 2990 //GUIButton *v20; // eax@26
2991 GUIButton *v21; // esi@26 2991 //GUIButton *v21; // esi@26
2992 int v22; // eax@26 2992 //int v22; // eax@26
2993 const char *v23; // eax@28 2993 //const char *v23; // eax@28
2994 int v24; // eax@28 2994 //int v24; // eax@28
2995 unsigned int v25; // ecx@28 2995 //unsigned int v25; // ecx@28
2996 int v26; // eax@28 2996 //int v26; // eax@28
2997 unsigned __int16 v27; // ax@28 2997 //unsigned __int16 v27; // ax@28
2998 unsigned __int16 v29; // ST14_2@34 2998 //unsigned __int16 v29; // ST14_2@34
2999 int v30; // eax@34 2999 //int v30; // eax@34
3000 int v33; // eax@36 3000 int v33; // eax@36
3001 unsigned int v36; // eax@38 3001 unsigned int v36; // eax@38
3002 unsigned int v42; // eax@46 3002 unsigned int v42; // eax@46
3003 int index; 3003 int index;
3004 int all_text_height; // eax@68 3004 int all_text_height; // eax@68
3005 int v49; // ebx@69 3005 int v49; // ebx@69
3006 GUIButton *pButton; // eax@71 3006 GUIButton *pButton; // eax@71
3007 int pTextHeight; // eax@71 3007 int pTextHeight; // eax@71
3008 unsigned __int16 pTextColor; // ax@71 3008 unsigned __int16 pTextColor; // ax@71
3009 GUIWindow training_dialog_window; // [sp+Ch] [bp-78h]@1 3009 GUIWindow training_dialog_window; // [sp+Ch] [bp-78h]@1
3010 int v68; // [sp+6Ch] [bp-18h]@3 3010 //int v68; // [sp+6Ch] [bp-18h]@3
3011 int v69; // [sp+70h] [bp-14h]@6 3011 int v69; // [sp+70h] [bp-14h]@6
3012 int v73; // [sp+80h] [bp-4h]@14 3012 int v73; // [sp+80h] [bp-4h]@14
3013 3013
3014 memcpy(&training_dialog_window, window_SpeakInHouse, sizeof(training_dialog_window)); 3014 memcpy(&training_dialog_window, window_SpeakInHouse, sizeof(training_dialog_window));
3015 training_dialog_window.uFrameX = 483; 3015 training_dialog_window.uFrameX = 483;
3016 training_dialog_window.uFrameWidth = 148; 3016 training_dialog_window.uFrameWidth = 148;
3017 training_dialog_window.uFrameZ = 334; 3017 training_dialog_window.uFrameZ = 334;
3018 v5 = 1000ui64 * pPlayers[uActiveCharacter]->uLevel * (pPlayers[uActiveCharacter]->uLevel + 1) / 2; // E n = n(n + 1) / 2 3018 v5 = 1000ui64 * pPlayers[uActiveCharacter]->uLevel * (pPlayers[uActiveCharacter]->uLevel + 1) / 2; // E n = n(n + 1) / 2
3019 v68 = pMaxLevelPerTrainingHallType[(unsigned int)window_SpeakInHouse->ptr_1C - HOUSE_TRAINING_HALL_EMERALD_ISLE]; 3019 //v68 = pMaxLevelPerTrainingHallType[(unsigned int)window_SpeakInHouse->ptr_1C - HOUSE_TRAINING_HALL_EMERALD_ISLE];
3020 if (pPlayers[uActiveCharacter]->uExperience >= v5) 3020 if (pPlayers[uActiveCharacter]->uExperience >= v5)
3021 { 3021 {
3022 v8 = pPlayers[uActiveCharacter]->classType % 4 + 1; 3022 v8 = pPlayers[uActiveCharacter]->classType % 4 + 1;
3023 if ( v8 == 4 ) 3023 if ( v8 == 4 )
3024 v8 = 3; 3024 v8 = 3;
3045 for ( int i = pDialogueWindow->pStartingPosActiveItem; 3045 for ( int i = pDialogueWindow->pStartingPosActiveItem;
3046 i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) 3046 i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i )
3047 { 3047 {
3048 if ( pDialogueWindow->GetControl(i)->msg_param == HOUSE_DIALOGUE_TRAININGHALL_TRAIN ) 3048 if ( pDialogueWindow->GetControl(i)->msg_param == HOUSE_DIALOGUE_TRAININGHALL_TRAIN )
3049 { 3049 {
3050 if (pPlayers[uActiveCharacter]->uLevel >= v68) 3050 if (pPlayers[uActiveCharacter]->uLevel >= pMaxLevelPerTrainingHallType[(unsigned int)window_SpeakInHouse->ptr_1C - HOUSE_TRAINING_HALL_EMERALD_ISLE])
3051 sprintfex(pShopOptions[index], "%s\n \n%s", 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." 3051 sprintfex(pShopOptions[index], "%s\n \n%s", 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."
3052 else 3052 else
3053 { 3053 {
3054 if (pPlayers[uActiveCharacter]->uExperience < v5) 3054 if (pPlayers[uActiveCharacter]->uExperience < v5)
3055 sprintfex(pShopOptions[index], pGlobalTXT_LocalizationStrings[538], (uint)(v5 - pPlayers[uActiveCharacter]->uExperience), pPlayers[uActiveCharacter]->uLevel + 1); // "You need %d more experience to train to level %d" 3055 sprintfex(pShopOptions[index], pGlobalTXT_LocalizationStrings[538], (uint)(v5 - pPlayers[uActiveCharacter]->uExperience), pPlayers[uActiveCharacter]->uLevel + 1); // "You need %d more experience to train to level %d"
3062 } 3062 }
3063 } 3063 }
3064 v49 = (2 * (87 - (174 - all_text_height) / 2) - all_text_height) / 2 - (174 - all_text_height) / 2 / 2 + 138; 3064 v49 = (2 * (87 - (174 - all_text_height) / 2) - all_text_height) / 2 - (174 - all_text_height) / 2 / 2 + 138;
3065 if (pDialogueWindow->pStartingPosActiveItem < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton) 3065 if (pDialogueWindow->pStartingPosActiveItem < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton)
3066 { 3066 {
3067 int pCurrentItem = 2; 3067 //int pCurrentItem = 2;
3068 index = 0; 3068 index = 0;
3069 for ( int i = pDialogueWindow->pStartingPosActiveItem; 3069 for ( int i = pDialogueWindow->pStartingPosActiveItem;
3070 i < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton; ++i ) 3070 i < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton; ++i )
3071 { 3071 {
3072 pButton = pDialogueWindow->GetControl(i); 3072 pButton = pDialogueWindow->GetControl(i);
3074 pTextHeight = pFontArrus->CalcTextHeight(pShopOptions[index], &training_dialog_window, 0, 0); 3074 pTextHeight = pFontArrus->CalcTextHeight(pShopOptions[index], &training_dialog_window, 0, 0);
3075 pButton->uHeight = pTextHeight; 3075 pButton->uHeight = pTextHeight;
3076 pButton->uW = pTextHeight + pButton->uY - 1; 3076 pButton->uW = pTextHeight + pButton->uY - 1;
3077 v49 = pButton->uW; 3077 v49 = pButton->uW;
3078 pTextColor = TargetColor(0xE1u, 0xCDu, 0x23u); 3078 pTextColor = TargetColor(0xE1u, 0xCDu, 0x23u);
3079 if ( pDialogueWindow->pCurrentPosActiveItem != pCurrentItem ) 3079 if ( pDialogueWindow->pCurrentPosActiveItem != i )
3080 pTextColor = TargetColor(255, 255, 255); 3080 pTextColor = TargetColor(255, 255, 255);
3081 training_dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pTextColor, pShopOptions[index], 3); 3081 training_dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pTextColor, pShopOptions[index], 3);
3082 ++pCurrentItem; 3082 //++pCurrentItem;
3083 ++index; 3083 ++index;
3084 } 3084 }
3085 } 3085 }
3086 } 3086 }
3087 } 3087 }
3094 training_dialog_window.DrawTitleText(pFontArrus, 0, (212 - v33) / 2 + 101, TargetColor(0xE1u, 0xCDu, 0x23u), pNPCTopics[122].pText, 3); 3094 training_dialog_window.DrawTitleText(pFontArrus, 0, (212 - v33) / 2 + 101, TargetColor(0xE1u, 0xCDu, 0x23u), pNPCTopics[122].pText, 3);
3095 pDialogueWindow->pNumPresenceButton = 0; 3095 pDialogueWindow->pNumPresenceButton = 0;
3096 return; 3096 return;
3097 } 3097 }
3098 //v34 = pPlayers[uActiveCharacter]->uLevel; 3098 //v34 = pPlayers[uActiveCharacter]->uLevel;
3099 if ( pPlayers[uActiveCharacter]->uLevel < v68 ) 3099 if ( pPlayers[uActiveCharacter]->uLevel < pMaxLevelPerTrainingHallType[(unsigned int)window_SpeakInHouse->ptr_1C - HOUSE_TRAINING_HALL_EMERALD_ISLE] )
3100 { 3100 {
3101 if ( (signed __int64)pPlayers[uActiveCharacter]->uExperience >= v5 ) 3101 if ( (signed __int64)pPlayers[uActiveCharacter]->uExperience >= v5 )
3102 { 3102 {
3103 if ( pParty->uNumGold >= pPrice) 3103 if ( pParty->uNumGold >= pPrice)
3104 { 3104 {
3159 if ( dialog_menu_id == HOUSE_DIALOGUE_LEARN_SKILLS ) 3159 if ( dialog_menu_id == HOUSE_DIALOGUE_LEARN_SKILLS )
3160 { 3160 {
3161 if (HouseUI_CheckIfPlayerCanInteract()) 3161 if (HouseUI_CheckIfPlayerCanInteract())
3162 { 3162 {
3163 v14 = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0); 3163 v14 = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0);
3164 v73 = v14 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; 3164 pPrice = v14 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100;
3165 if ( v73 < v14 / 3 ) 3165 if ( pPrice < v14 / 3 )
3166 v73 = v14 / 3; 3166 pPrice = v14 / 3;
3167 v15 = pDialogueWindow->pStartingPosActiveItem;
3168 v16 = pDialogueWindow->pNumPresenceButton;
3169 index = 0; 3167 index = 0;
3170 if ( (signed int)v15 >= (signed int)(v15 + v16) ) 3168 for ( int i = pDialogueWindow->pStartingPosActiveItem;
3171 goto LABEL_76; 3169 (signed int)i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i )
3172 do 3170 {
3173 { 3171 if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][pDialogueWindow->GetControl(i)->msg_param - 36]
3174 v17 = pDialogueWindow->GetControl(v15)->msg_param - 36; 3172 && !pPlayers[uActiveCharacter]->pActiveSkills[pDialogueWindow->GetControl(i)->msg_param - 36] )
3175 if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][v17] && !pPlayers[uActiveCharacter]->pActiveSkills[v17] ) 3173 {
3176 { 3174 all_text_height += pFontArrus->CalcTextHeight(pSkillNames[pDialogueWindow->GetControl(i)->msg_param - 36], &training_dialog_window, 0, 0);
3177 all_text_height += pFontArrus->CalcTextHeight(pSkillNames[v17], &training_dialog_window, 0, 0);
3178 ++index; 3175 ++index;
3179 } 3176 }
3180 ++v15; 3177 }
3181 }
3182 while ( (signed int)v15 < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem );
3183 if ( index ) 3178 if ( index )
3184 { 3179 {
3185 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[401], v73);// "Skill Cost: %lu" 3180 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[401], pPrice);// "Skill Cost: %lu"
3186 training_dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3); 3181 training_dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3);
3187 v73 = (signed int)(149 - all_text_height) / index; 3182 v73 = (signed int)(149 - all_text_height) / index;
3188 if ( v73 > 32 ) 3183 if ( v73 > 32 )
3189 v73 = 32; 3184 v73 = 32;
3190 v19 = (signed int)(149 - index * v73 - all_text_height) / 2 - v73 / 2 + 162; 3185 v19 = (signed int)(149 - index * v73 - all_text_height) / 2 - v73 / 2 + 162;
3191 int _v1 = pDialogueWindow->pStartingPosActiveItem; 3186 for ( int i = pDialogueWindow->pStartingPosActiveItem;
3192 v68 = v19; 3187 (signed int)i < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton; ++i )
3193 if (pDialogueWindow->pStartingPosActiveItem < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton ) 3188 {
3194 { 3189 pButton = pDialogueWindow->GetControl(i);
3195 index = 2; 3190 if ( !byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][pButton->msg_param - 36]
3196 do 3191 || pPlayers[uActiveCharacter]->pActiveSkills[pButton->msg_param - 36] )
3197 { 3192 {
3198 v20 = pDialogueWindow->GetControl(_v1); 3193 pButton->uW = 0;
3199 v21 = v20; 3194 pButton->uHeight = 0;
3200 v22 = v20->msg_param - 36; 3195 pButton->uY = 0;
3201 if ( !byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][v22] || pPlayers[uActiveCharacter]->pActiveSkills[v22] ) 3196 }
3202 { 3197 else
3203 v21->uW = 0; 3198 {
3204 v21->uHeight = 0; 3199 pButton->uY = v73 + v19;
3205 v21->uY = 0; 3200 pTextHeight = pFontArrus->CalcTextHeight(pSkillNames[pButton->msg_param - 36], &training_dialog_window, 0, 0);
3206 } 3201 pButton->uHeight = pTextHeight;
3207 else 3202 pButton->uW = pButton->uY + pTextHeight - 1;
3208 { 3203 v19 = pButton->uY + pTextHeight - 1;
3209 v23 = pSkillNames[v22]; 3204 pTextColor = TargetColor(0xE1u, 0xCDu, 0x23u);
3210 v21->uY = v73 + v68; 3205 if ( pDialogueWindow->pCurrentPosActiveItem != i )
3211 //HIDWORD(v66) = (int)v23; 3206 pTextColor = TargetColor(255, 255, 255);
3212 v24 = pFontArrus->CalcTextHeight(v23, &training_dialog_window, 0, 0); 3207 training_dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pTextColor, pSkillNames[pButton->msg_param - 36], 3);
3213 v25 = v21->uY; 3208 }
3214 v21->uHeight = v24;
3215 v26 = v25 + v24 - 1;
3216 v21->uW = v26;
3217 v68 = v26;
3218 v27 = TargetColor(0xE1u, 0xCDu, 0x23u);
3219 if ( pDialogueWindow->pCurrentPosActiveItem != index )
3220 v27 = TargetColor(255, 255, 255);
3221 training_dialog_window.DrawTitleText(pFontArrus, 0, v25, v27, v23, 3);
3222 }
3223 ++_v1;
3224 ++index;
3225 }
3226 while ( (signed int)_v1 < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton );
3227 } 3209 }
3228 } 3210 }
3229 else 3211 else
3230 { 3212 {
3231 LABEL_76:
3232 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]);// 3213 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]);//
3233 // "Seek knowledge elsewhere %s the %s" 3214 // "Seek knowledge elsewhere %s the %s"
3234 strcat(pTmpBuf.data(), "\n \n"); 3215 strcat(pTmpBuf.data(), "\n \n");
3235 strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]);// "I can offer you nothing further." 3216 strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]);// "I can offer you nothing further."
3236 v29 = TargetColor(0xE1u, 0xCDu, 0x23u); 3217 pTextHeight = pFontArrus->CalcTextHeight(pTmpBuf.data(), &training_dialog_window, 0, 0);
3237 v30 = pFontArrus->CalcTextHeight(pTmpBuf.data(), &training_dialog_window, 0, 0); 3218 training_dialog_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, TargetColor(0xE1u, 0xCDu, 0x23u), pTmpBuf.data(), 3);
3238 training_dialog_window.DrawTitleText(pFontArrus, 0, (174 - v30) / 2 + 138, v29, pTmpBuf.data(), 3);
3239 } 3219 }
3240 } 3220 }
3241 } 3221 }
3242 return; 3222 return;
3243 } 3223 }
3244 3224
3245 //----- (004B6478) -------------------------------------------------------- 3225 //----- (004B6478) --------------------------------------------------------
3246 void sub_4B6478() 3226 void sub_4B6478()
3247 { 3227 {
3248 GUIWindow *v0; // ebx@1
3249 Player *v1; // edi@1
3250 unsigned int v2; // eax@1 3228 unsigned int v2; // eax@1
3251 signed int v3; // esi@1 3229 signed int v3; // esi@1
3252 int v4; // ebx@1 3230 int pPrice; // ebx@1
3253 unsigned int v5; // esi@5 3231 unsigned int v5; // esi@5
3254 int v6; // edi@6 3232 int v6; // edi@6
3255 int result; // eax@13 3233 int result; // eax@13
3256 GUIWindow *v8; // ebx@17
3257 int v9; // eax@17
3258 int v10; // ecx@17
3259 unsigned int v11; // ecx@18
3260 int v12; // eax@20 3234 int v12; // eax@20
3261 int v13; // eax@21 3235 int v13; // eax@21
3262 GUIButton *v14; // esi@27 3236 GUIButton *pButton; // esi@27
3263 int v15; // ecx@27
3264 unsigned int v16; // eax@28 3237 unsigned int v16; // eax@28
3265 const char *v17; // ebx@29 3238 int pTextHeight; // eax@29
3266 int v18; // eax@29 3239 unsigned __int16 pTextColor; // ax@29
3267 unsigned int v19; // ecx@29
3268 int v20; // eax@29
3269 unsigned __int16 v21; // ax@29
3270 unsigned __int16 v22; // ST14_2@36 3240 unsigned __int16 v22; // ST14_2@36
3271 int v23; // eax@36
3272 const char *v24; // ST18_4@37
3273 unsigned __int16 v25; // ST14_2@37
3274 int v26; // eax@37
3275 int v27; // [sp-4h] [bp-80h]@8 3241 int v27; // [sp-4h] [bp-80h]@8
3276 GUIWindow v28; // [sp+Ch] [bp-70h]@1 3242 GUIWindow dialog_window; // [sp+Ch] [bp-70h]@1
3277 GUIWindow *v29; // [sp+60h] [bp-1Ch]@17
3278 unsigned int v30; // [sp+64h] [bp-18h]@1
3279 int v31; // [sp+68h] [bp-14h]@1
3280 int v32; // [sp+6Ch] [bp-10h]@1 3243 int v32; // [sp+6Ch] [bp-10h]@1
3281 int v33; // [sp+70h] [bp-Ch]@17
3282 int v34; // [sp+74h] [bp-8h]@17 3244 int v34; // [sp+74h] [bp-8h]@17
3283 int v35; // [sp+78h] [bp-4h]@17 3245
3284 3246 memcpy(&dialog_window, window_SpeakInHouse, sizeof(dialog_window));
3285 v0 = window_SpeakInHouse; 3247 dialog_window.uFrameX = 483;
3286 memcpy(&v28, window_SpeakInHouse, sizeof(v28)); 3248 dialog_window.uFrameWidth = 148;
3287 v1 = pPlayers[uActiveCharacter]; 3249 dialog_window.uFrameZ = 334;
3288 v28.uFrameX = 483; 3250 v2 = 52 * (unsigned int)window_SpeakInHouse->ptr_1C;
3289 v28.uFrameWidth = 148; 3251 v32 = (unsigned __int8)(((p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType != 18) - 1) & 0x96) + 100;
3290 v28.uFrameZ = 334; 3252 v3 = (signed __int64)((double)v32 * p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier);
3291 v30 = TargetColor(0xFFu, 0xFFu, 0xFFu); 3253 pPrice = v3 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100;
3292 v31 = TargetColor(0xFFu, 0xFFu, 0x9Bu); 3254 if ( pPrice < v3 / 3 )
3293 v2 = 52 * (unsigned int)v0->ptr_1C; 3255 pPrice = v3 / 3;
3294 //v32 = (unsigned __int8)(((p2DEvents_minus1___00[v2 / 2] != 18) - 1) & 0x96) + 100; 3256 if ( dialog_menu_id == HOUSE_DIALOGUE_MAIN)
3295 v32 = (unsigned __int8)(((p2DEvents[(unsigned int)v0->ptr_1C - 1].uType != 18) - 1) & 0x96) + 100; 3257 {
3296 //v3 = (signed __int64)((double)v32 * p2DEvents_minus1__20[v2 / 4]); 3258 if ( !(unsigned __int16)_449B57_test_bit((unsigned __int8 *)pPlayers[uActiveCharacter]->_achieved_awards_bits, word_4F0754[2 * (unsigned int)window_SpeakInHouse->ptr_1C]) )
3297 v3 = (signed __int64)((double)v32 * p2DEvents[(unsigned int)v0->ptr_1C - 1].fPriceMultiplier); 3259 {
3298 v4 = v3 * (100 - v1->GetMerchant()) / 100; 3260 pTextHeight = pFontArrus->CalcTextHeight(pNPCTopics[171].pText, &dialog_window, 0, 0);//
3299 v32 = v4; 3261 dialog_window.DrawTitleText(pFontArrus, 0, (212 - pTextHeight) / 2 + 101, TargetColor(0xFFu, 0xFFu, 0x9Bu), pNPCTopics[171].pText, 3);
3300 if ( v4 < v3 / 3 ) 3262 pDialogueWindow->pNumPresenceButton = 0;
3301 { 3263 return ;
3302 v4 = v3 / 3; 3264 }
3303 v32 = v3 / 3; 3265 if ( !HouseUI_CheckIfPlayerCanInteract() )
3304 } 3266 return;
3305 if ( dialog_menu_id != HOUSE_DIALOGUE_MAIN) 3267 v34 = 0;
3306 { 3268 for ( int i = pDialogueWindow->pStartingPosActiveItem;
3307 if ( HouseUI_CheckIfPlayerCanInteract() ) 3269 i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i )
3308 { 3270 {
3309 v5 = 0; 3271 if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType / 3][pDialogueWindow->GetControl(i)->msg_param - 36]
3310 3272 && !pPlayers[uActiveCharacter]->pActiveSkills[pDialogueWindow->GetControl(i)->msg_param - 36] )
3311 __debugbreak(); 3273 {
3312 //pSkillAvailabilityPerClass[8 + v58->uClass][4 + v23] 3274 v12 += pFontArrus->CalcTextHeight(pSkillNames[pDialogueWindow->GetControl(i)->msg_param - 36], &dialog_window, 0, 0);
3313 // or 3275 ++v34;
3314 //byte_4ED970_skill_learn_ability_by_class_table[v58->uClass][v23 - 36] 3276 }
3315 // or 3277 }
3316 //byte_4ED970_skill_learn_ability_by_class_table[v58->uClass - 1][v23 + 1] 3278 if ( !v34 )
3317 __debugbreak(); // whacky condition - fix 3279 {
3318 if (false 3280 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]);
3319 //if ( !*(&byte_4ED94C[37 * v1->uClass / 3] + dword_F8B19C) 3281 strcat(pTmpBuf.data(), "\n \n");
3320 || (v6 = (int)(&v1->uIntelligence + dialog_menu_id), *(short *)v6) ) 3282 strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]);//Больше ничего не могу предложить.
3321 { 3283 pTextHeight = pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 0, 0);
3322 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); 3284 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, TargetColor(0xFFu, 0xFFu, 0x9Bu), pTmpBuf.data(), 3);
3285 return;
3286 }
3287 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[401], pPrice);//Стоимость навыка: %lu
3288 dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3);
3289 v32 = (149 - v12) / v34;
3290 if ( (149 - v12) / v34 > 32 )
3291 v32 = 32;
3292 v34 = (149 - v34 * v32 - v12) / 2 - v32 / 2 + 162;
3293 if ( pDialogueWindow->pStartingPosActiveItem < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton )
3294 {
3295 for ( int i = pDialogueWindow->pStartingPosActiveItem;
3296 i <pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i )
3297 {
3298 pButton = pDialogueWindow->GetControl(i);
3299 if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType / 3][pButton->msg_param - 36] )
3300 {
3301 if ( !pPlayers[uActiveCharacter]->pActiveSkills[pButton->msg_param - 36] )
3302 {
3303 pButton->uY = v32 + v34;
3304 pTextHeight = pFontArrus->CalcTextHeight(pSkillNames[pButton->msg_param - 36], &dialog_window, 0, 0);
3305 pButton->uHeight = pTextHeight;
3306 pButton->uW = pButton->uY + pTextHeight - 1;
3307 v34 = pButton->uY + pTextHeight - 1;
3308 pTextColor = TargetColor(0xFFu, 0xFFu, 0x9Bu);
3309 if ( pDialogueWindow->pCurrentPosActiveItem != i )
3310 pTextColor = TargetColor(0xFFu, 0xFFu, 0xFFu);
3311 dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pTextColor, pSkillNames[pButton->msg_param - 36], 3);
3312 }
3313 }
3314 else
3315 {
3316 pButton->uW = 0;
3317 pButton->uHeight = 0;
3318 pButton->uY = 0;
3319 }
3320 }
3321 }
3322 return;
3323 }
3324
3325 if ( HouseUI_CheckIfPlayerCanInteract() )
3326 {
3327 v5 = 0;
3328 __debugbreak();
3329 //pSkillAvailabilityPerClass[8 + v58->uClass][4 + v23]
3330 // or
3331 //byte_4ED970_skill_learn_ability_by_class_table[v58->uClass][v23 - 36]
3332 // or
3333 //byte_4ED970_skill_learn_ability_by_class_table[v58->uClass - 1][v23 + 1]
3334 __debugbreak(); // whacky condition - fix
3335 if (false
3336 //if ( !*(&byte_4ED94C[37 * v1->uClass / 3] + dword_F8B19C)
3337 || (v6 = (int)(&pPlayers[uActiveCharacter]->uIntelligence + dialog_menu_id), *(short *)v6) )
3338 {
3339 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0);
3340 }
3341 else
3342 {
3343 if ( pParty->uNumGold < pPrice )
3344 {
3345 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);//У вас не хватает золота
3346 v27 = 4;
3323 } 3347 }
3324 else 3348 else
3325 { 3349 {
3326 if ( pParty->uNumGold < v4 ) 3350 Party::TakeGold(pPrice);
3327 { 3351 *(short *)v6 = 1;
3328 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u); 3352 v27 = 2;
3329 v27 = 4; 3353 }
3330 } 3354 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)v27);
3331 else 3355 }
3332 { 3356 }
3333 Party::TakeGold(v4); 3357 else
3334 *(short *)v6 = 1; 3358 {
3335 v27 = 2; 3359 v5 = 0;
3336 } 3360 }
3337 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)v27); 3361 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, v5);
3338 } 3362 return; // void func
3339 }
3340 else
3341 {
3342 v5 = 0;
3343 }
3344 /*result = pMessageQueue_50CBD0->uNumMessages;
3345 if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
3346 {
3347 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape;
3348 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1;
3349 result = 3 * pMessageQueue_50CBD0->uNumMessages + 3;
3350 *(&pMessageQueue_50CBD0->uNumMessages + result) = v5;
3351 ++pMessageQueue_50CBD0->uNumMessages;
3352 }*/
3353 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, v5);
3354 return; // void func
3355 }
3356 if ( !(unsigned __int16)_449B57_test_bit((unsigned __int8 *)v1->_achieved_awards_bits, word_4F0754[2 * (unsigned int)window_SpeakInHouse->ptr_1C]) )
3357 {
3358 v24 = pNPCTopics[171].pText;
3359 v25 = v31;
3360 v26 = pFontArrus->CalcTextHeight(pNPCTopics[171].pText, &v28, 0, 0);
3361 v28.DrawTitleText(pFontArrus, 0, (212 - v26) / 2 + 101, v25, v24, 3u);
3362 pDialogueWindow->pNumPresenceButton = 0;
3363 return ;
3364 }
3365
3366 if ( !HouseUI_CheckIfPlayerCanInteract() )
3367 return;
3368 v8 = pDialogueWindow;
3369 v33 = 0;
3370 v34 = 0;
3371 v29 = pDialogueWindow;
3372 v9 = pDialogueWindow->pStartingPosActiveItem;
3373 v10 = v9 + pDialogueWindow->pNumPresenceButton;
3374 v35 = pDialogueWindow->pStartingPosActiveItem;
3375 if ( v9 >= v10 )
3376 goto LABEL_40;
3377 do
3378 {
3379 v11 = v8->GetControl(v35)->msg_param - 36;
3380 if ( byte_4ED970_skill_learn_ability_by_class_table[v1->classType / 3][v11] && !v1->pActiveSkills[v11] )
3381 {
3382 v12 = pFontArrus->CalcTextHeight(pSkillNames[v11], &v28, 0, 0);
3383 v33 += v12;
3384 ++v34;
3385 }
3386 v13 = v8->pStartingPosActiveItem;
3387 ++v35;
3388 }
3389 while ( v35 < v8->pNumPresenceButton + v13 );
3390 if ( !v34 )
3391 {
3392 LABEL_40:
3393 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], v1->pName, pClassNames[v1->classType]);
3394 strcat(pTmpBuf.data(), "\n \n");
3395 strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]);
3396 v22 = v31;
3397 v23 = pFontArrus->CalcTextHeight(pTmpBuf.data(), &v28, 0, 0);
3398 v28.DrawTitleText(pFontArrus, 0, (174 - v23) / 2 + 138, v22, pTmpBuf.data(), 3u);
3399 return;
3400 }
3401 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[401], v32);
3402 v28.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3u);
3403 v32 = (149 - v33) / v34;
3404 if ( (149 - v33) / v34 > 32 )
3405 v32 = 32;
3406
3407 v35 = v8->pStartingPosActiveItem;
3408 v34 = (149 - v34 * v32 - v33) / 2 - v32 / 2 + 162;
3409 if ( v8->pStartingPosActiveItem < v8->pStartingPosActiveItem+ v8->pNumPresenceButton )
3410 {
3411 v33 = 2;
3412 do
3413 {
3414 v14 = v8->GetControl(v35);
3415 v15 = v14->msg_param - 36;
3416 if ( byte_4ED970_skill_learn_ability_by_class_table[v1->classType / 3][v15] )
3417 {
3418 v16 = 0;
3419 if ( !v1->pActiveSkills[v15] )
3420 {
3421 v17 = pSkillNames[v15];
3422 v14->uY = v32 + v34;
3423 v18 = pFontArrus->CalcTextHeight(v17, &v28, 0, 0);
3424 v19 = v14->uY;
3425 v14->uHeight = v18;
3426 v20 = v19 + v18 - 1;
3427 v14->uW = v20;
3428 v34 = v20;
3429 v21 = v31;
3430 if ( pDialogueWindow->pCurrentPosActiveItem != v33 )
3431 v21 = v30;
3432 v28.DrawTitleText(pFontArrus, 0, v19, v21, v17, 3u);
3433 goto LABEL_34;
3434 }
3435 }
3436 else
3437 {
3438 v16 = 0;
3439 }
3440 v14->uW = v16;
3441 v14->uHeight = v16;
3442 v14->uY = v16;
3443 LABEL_34:
3444 v8 = v29;
3445 ++v35;
3446 ++v33;
3447 }
3448 while ( v35 <v29->pNumPresenceButton + v29->pStartingPosActiveItem );
3449 }
3450 return;
3451 } 3363 }
3452 3364
3453 //----- (004B2A74) -------------------------------------------------------- 3365 //----- (004B2A74) --------------------------------------------------------
3454 void SimpleHouseAndBoatsDialog() 3366 void SimpleHouseDialog()
3455 { 3367 {
3456 char *v2; // eax@3 3368 char *v2; // eax@3
3457 unsigned int i; // eax@5 3369 unsigned int i; // eax@5
3458 NPCData *pNPC; // esi@6 3370 NPCData *pNPC; // esi@6
3459 char *v15; // esi@14 3371 char *v15; // esi@14
3720 memcpy(&jail_dialogue_window, window_SpeakInHouse, sizeof(jail_dialogue_window)); 3632 memcpy(&jail_dialogue_window, window_SpeakInHouse, sizeof(jail_dialogue_window));
3721 jail_dialogue_window.uFrameX = 483; 3633 jail_dialogue_window.uFrameX = 483;
3722 jail_dialogue_window.uFrameWidth = 148; 3634 jail_dialogue_window.uFrameWidth = 148;
3723 jail_dialogue_window.uFrameZ = 334; 3635 jail_dialogue_window.uFrameZ = 334;
3724 jail_dialogue_window.DrawTitleText(pFontArrus, 0, (310 - pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[672], &jail_dialogue_window, 0, 0)) / 2 + 18, 3636 jail_dialogue_window.DrawTitleText(pFontArrus, 0, (310 - pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[672], &jail_dialogue_window, 0, 0)) / 2 + 18,
3725 TargetColor(0xFFu, 0xFFu, 0x9Bu), pGlobalTXT_LocalizationStrings[672], 3); 3637 TargetColor(0xFFu, 0xFFu, 0x9Bu), pGlobalTXT_LocalizationStrings[672], 3);//"За многочисленные преступления и злодеяния вы были приговорены к одному году заключения."
3726 } 3638 }