Mercurial > mm7
comparison UI/UIHouses.cpp @ 1625:2d374de0a364
TrainingDialog cleaning(continue)
author | Ritor1 |
---|---|
date | Mon, 16 Sep 2013 01:14:17 +0600 |
parents | 15667a0ec5b9 |
children | 2149b14614ad |
comparison
equal
deleted
inserted
replaced
1624:15667a0ec5b9 | 1625:2d374de0a364 |
---|---|
1918 int pTextHeight; // eax@36 | 1918 int pTextHeight; // eax@36 |
1919 int pRealTextHeight; // esi@36 | 1919 int pRealTextHeight; // esi@36 |
1920 int schedule_id; // esi@39 | 1920 int schedule_id; // esi@39 |
1921 GUIButton *pButton; // ebx@39 | 1921 GUIButton *pButton; // ebx@39 |
1922 signed int v25; // eax@41 | 1922 signed int v25; // eax@41 |
1923 unsigned int v30; // ecx@62 | |
1924 MapInfo pMap; // [sp-3Ch] [bp-2CCh]@62 | 1923 MapInfo pMap; // [sp-3Ch] [bp-2CCh]@62 |
1925 char pTopicArray[5][100]; // [sp+14h] [bp-27Ch]@37 | 1924 char pTopicArray[5][100]; // [sp+14h] [bp-27Ch]@37 |
1926 GUIWindow travel_window; // [sp+208h] [bp-88h]@1 | 1925 GUIWindow travel_window; // [sp+208h] [bp-88h]@1 |
1927 int pPrimaryTextHeight; // [sp+260h] [bp-30h]@36 | 1926 int pPrimaryTextHeight; // [sp+260h] [bp-30h]@36 |
1928 int index; // [sp+27Ch] [bp-14h]@36 | 1927 int index; // [sp+27Ch] [bp-14h]@36 |
1967 else | 1966 else |
1968 v25 = transport_schedule[schedule_id].pSchedule[pParty->uDaysPlayed % 7]; | 1967 v25 = transport_schedule[schedule_id].pSchedule[pParty->uDaysPlayed % 7]; |
1969 } | 1968 } |
1970 | 1969 |
1971 if (schedule_id != 255 && v25 && (!transport_schedule[schedule_id].uQuestBit | 1970 if (schedule_id != 255 && v25 && (!transport_schedule[schedule_id].uQuestBit |
1972 || _449B57_test_bit(pParty->_quest_bits, transport_schedule[schedule_id].uQuestBit)) ) | 1971 || _449B57_test_bit(pParty->_quest_bits, transport_schedule[schedule_id].uQuestBit)) )//ошибка: рисуется несколько строчек одного направления путешествия |
1973 { | 1972 { |
1974 //get color for current string(определение цвета текущей строки)---------- | 1973 //get color for current string(определение цвета текущей строки)---------- |
1975 if ( pDialogueWindow->pCurrentPosActiveItem == pCurrentButton ) | 1974 if ( pDialogueWindow->pCurrentPosActiveItem == pCurrentButton ) |
1976 sprintf(pTopicArray[index], "\f%05d", TargetColor(255, 255, 155)); | 1975 sprintf(pTopicArray[index], "\f%05d", TargetColor(255, 255, 155)); |
1977 else | 1976 else |
2003 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[404], travel_time, pMap.pName); // Time - %d days, destination %s | 2002 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[404], travel_time, pMap.pName); // Time - %d days, destination %s |
2004 strcat(pTopicArray[index], pTmpBuf.data()); | 2003 strcat(pTopicArray[index], pTmpBuf.data()); |
2005 strcat(pTopicArray[index], "\n \n"); | 2004 strcat(pTopicArray[index], "\n \n"); |
2006 pButton->uY = pRealTextHeight; | 2005 pButton->uY = pRealTextHeight; |
2007 pTextHeight = pFontArrus->CalcTextHeight(pTmpBuf.data(), &travel_window, 0, 0); | 2006 pTextHeight = pFontArrus->CalcTextHeight(pTmpBuf.data(), &travel_window, 0, 0); |
2008 v30 = pButton->uY; | |
2009 pButton->uHeight = pTextHeight; | 2007 pButton->uHeight = pTextHeight; |
2010 pButton->uW = v30 + pTextHeight - 1; | 2008 pButton->uW = pButton->uY + pTextHeight - 1; |
2011 pRealTextHeight += (LOBYTE(pFontArrus->uFontHeight) - 3) + pTextHeight; | 2009 pRealTextHeight += (LOBYTE(pFontArrus->uFontHeight) - 3) + pTextHeight; |
2012 } | 2010 } |
2013 } | 2011 } |
2014 else | 2012 else |
2015 { | 2013 { |
2147 signed int pStringSum; // ebx@24 | 2145 signed int pStringSum; // ebx@24 |
2148 signed int v16; // ebx@28 | 2146 signed int v16; // ebx@28 |
2149 int v17; // ebx@28 | 2147 int v17; // ebx@28 |
2150 GUIButton *pButton; // eax@30 | 2148 GUIButton *pButton; // eax@30 |
2151 int pTextHeight; // eax@30 | 2149 int pTextHeight; // eax@30 |
2152 unsigned int v23; // ecx@30 | |
2153 unsigned __int16 pTextColor; // ax@30 | 2150 unsigned __int16 pTextColor; // ax@30 |
2154 GUIWindow window; // [sp+60h] [bp-BCh]@21 | 2151 GUIWindow window; // [sp+60h] [bp-BCh]@21 |
2155 GUIWindow townHall_window; // [sp+B4h] [bp-68h]@1 | 2152 GUIWindow townHall_window; // [sp+B4h] [bp-68h]@1 |
2156 int v29; // [sp+10Ch] [bp-10h]@28 | 2153 int v29; // [sp+10Ch] [bp-10h]@28 |
2157 int v31; // [sp+114h] [bp-8h]@29 | 2154 int v31; // [sp+114h] [bp-8h]@29 |
2188 i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) | 2185 i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) |
2189 { | 2186 { |
2190 pButton = pDialogueWindow->GetControl(i); | 2187 pButton = pDialogueWindow->GetControl(i); |
2191 pButton->uY = v29 + v17; | 2188 pButton->uY = v29 + v17; |
2192 pTextHeight = pFontArrus->CalcTextHeight(pShopOptions[j], &townHall_window, 0, 0); | 2189 pTextHeight = pFontArrus->CalcTextHeight(pShopOptions[j], &townHall_window, 0, 0); |
2193 v23 = pButton->uY; | |
2194 pButton->uHeight = pTextHeight; | 2190 pButton->uHeight = pTextHeight; |
2195 v17 = v23 + pTextHeight - 1; | 2191 v17 = pButton->uY + pTextHeight - 1; |
2196 pButton->uW = v17; | 2192 pButton->uW = v17; |
2197 pTextColor = TargetColor(0xFFu, 0xFFu, 0x9Bu); | 2193 pTextColor = TargetColor(0xFFu, 0xFFu, 0x9Bu); |
2198 if ( pDialogueWindow->pCurrentPosActiveItem != v31 ) | 2194 if ( pDialogueWindow->pCurrentPosActiveItem != v31 ) |
2199 pTextColor = TargetColor(0xFFu, 0xFFu, 0xFFu); | 2195 pTextColor = TargetColor(0xFFu, 0xFFu, 0xFFu); |
2200 townHall_window.DrawTitleText(pFontArrus, 0, v23, pTextColor, pShopOptions[j], 3); | 2196 townHall_window.DrawTitleText(pFontArrus, 0, pButton->uY, pTextColor, pShopOptions[j], 3); |
2201 ++v31; | 2197 ++v31; |
2202 ++j; | 2198 ++j; |
2203 } | 2199 } |
2204 } | 2200 } |
2205 break; | 2201 break; |
3080 } | 3076 } |
3081 | 3077 |
3082 //----- (004B4710) -------------------------------------------------------- | 3078 //----- (004B4710) -------------------------------------------------------- |
3083 void TrainingDialog() | 3079 void TrainingDialog() |
3084 { | 3080 { |
3085 int color2; // eax@1 | |
3086 //unsigned int v2; // ecx@1 | |
3087 //int v3; // eax@1 | |
3088 //signed int v4; // edx@1 | |
3089 unsigned __int64 v5; // edi@3 | 3081 unsigned __int64 v5; // edi@3 |
3090 //unsigned int v6; // esi@3 | |
3091 //void *v7; // ecx@3 | |
3092 int v8; // edx@4 | 3082 int v8; // edx@4 |
3093 double v9; // st7@6 | 3083 double v9; // st7@6 |
3094 signed int v10; // esi@6 | 3084 signed int v10; // esi@6 |
3095 int v11; // ecx@6 | 3085 int pPrice; // ecx@6 |
3096 //int result; // eax@9 | |
3097 GUIWindow *v13; // edi@14 | |
3098 signed int v14; // esi@14 | 3086 signed int v14; // esi@14 |
3099 unsigned int v15; // esi@16 | 3087 unsigned int v15; // esi@16 |
3100 int v16; // eax@16 | 3088 int v16; // eax@16 |
3101 unsigned int v17; // eax@17 | 3089 unsigned int v17; // eax@17 |
3102 int v18; // eax@19 | |
3103 int v19; // ecx@24 | 3090 int v19; // ecx@24 |
3104 GUIButton *v20; // eax@26 | 3091 GUIButton *v20; // eax@26 |
3105 GUIButton *v21; // esi@26 | 3092 GUIButton *v21; // esi@26 |
3106 int v22; // eax@26 | 3093 int v22; // eax@26 |
3107 const char *v23; // eax@28 | 3094 const char *v23; // eax@28 |
3108 int v24; // eax@28 | 3095 int v24; // eax@28 |
3109 unsigned int v25; // ecx@28 | 3096 unsigned int v25; // ecx@28 |
3110 int v26; // eax@28 | 3097 int v26; // eax@28 |
3111 unsigned __int16 v27; // ax@28 | 3098 unsigned __int16 v27; // ax@28 |
3112 //int v28; // eax@32 | |
3113 unsigned __int16 v29; // ST14_2@34 | 3099 unsigned __int16 v29; // ST14_2@34 |
3114 int v30; // eax@34 | 3100 int v30; // eax@34 |
3115 //const char *v31; // ST18_4@36 | |
3116 //unsigned __int16 v32; // ST14_2@36 | |
3117 int v33; // eax@36 | 3101 int v33; // eax@36 |
3118 int v34; // eax@37 | |
3119 unsigned int v35; // edi@38 | |
3120 unsigned int v36; // eax@38 | 3102 unsigned int v36; // eax@38 |
3121 //int v37; // ecx@41 | |
3122 //char *v38; // eax@41 | |
3123 //int *v39; // eax@45 | |
3124 unsigned int v40; // eax@46 | |
3125 //void *v41; // ecx@46 | |
3126 unsigned int v42; // eax@46 | 3103 unsigned int v42; // eax@46 |
3127 GUIWindow *v43; // ecx@59 | 3104 int index; |
3128 int v44; // edx@59 | 3105 int all_text_height; // eax@68 |
3129 char **v45; // esi@60 | |
3130 //int v46; // eax@62 | |
3131 int v47; // eax@68 | |
3132 //int v48; // edx@69 | |
3133 int v49; // ebx@69 | 3106 int v49; // ebx@69 |
3134 //unsigned __int8 v50; // sf@69 | 3107 GUIButton *pButton; // eax@71 |
3135 char **v51; // edi@70 | 3108 int pTextHeight; // eax@71 |
3136 GUIButton *v52; // eax@71 | 3109 unsigned __int16 pTextColor; // ax@71 |
3137 GUIButton *v53; // esi@71 | 3110 GUIWindow training_dialog_window; // [sp+Ch] [bp-78h]@1 |
3138 int v54; // eax@71 | |
3139 unsigned int v55; // ecx@71 | |
3140 int v56; // eax@71 | |
3141 unsigned __int16 v57; // ax@71 | |
3142 unsigned __int16 v58; // [sp-Ch] [bp-90h]@38 | |
3143 //const char *v59; // [sp-Ch] [bp-90h]@63 | |
3144 char *v60; // [sp-8h] [bp-8Ch]@38 | |
3145 //char *v61; // [sp-8h] [bp-8Ch]@63 | |
3146 unsigned int v62; // [sp-4h] [bp-88h]@38 | |
3147 int v63; // [sp-4h] [bp-88h]@52 | |
3148 //char *v64; // [sp-4h] [bp-88h]@63 | |
3149 GUIWindow v65; // [sp+Ch] [bp-78h]@1 | |
3150 //__int64 v66; // [sp+60h] [bp-24h]@3 | |
3151 unsigned int white; // [sp+68h] [bp-1Ch]@1 | |
3152 int v68; // [sp+6Ch] [bp-18h]@3 | 3111 int v68; // [sp+6Ch] [bp-18h]@3 |
3153 int v69; // [sp+70h] [bp-14h]@6 | 3112 int v69; // [sp+70h] [bp-14h]@6 |
3154 //unsigned int i; // [sp+74h] [bp-10h]@1 | |
3155 //int v71; // [sp+78h] [bp-Ch]@1 | |
3156 int v72; // [sp+7Ch] [bp-8h]@16 | |
3157 int v73; // [sp+80h] [bp-4h]@14 | 3113 int v73; // [sp+80h] [bp-4h]@14 |
3158 | 3114 |
3159 //v0 = pPlayers[uActiveCharacter]; | 3115 memcpy(&training_dialog_window, window_SpeakInHouse, sizeof(training_dialog_window)); |
3160 memcpy(&v65, window_SpeakInHouse, sizeof(v65)); | 3116 training_dialog_window.uFrameX = 483; |
3161 v65.uFrameX = 483; | 3117 training_dialog_window.uFrameWidth = 148; |
3162 v65.uFrameWidth = 148; | 3118 training_dialog_window.uFrameZ = 334; |
3163 v65.uFrameZ = 334; | |
3164 white = TargetColor(255, 255, 255); | |
3165 color2 = TargetColor(0xE1u, 0xCDu, 0x23u); | |
3166 //v71 = color2; | |
3167 //v2 = v0->uLevel; | |
3168 //v3 = 0; | |
3169 //v4 = 0; | |
3170 //for ( i = v2; v4 < (signed int)v2; ++v4 ) | |
3171 // v3 += v4 + 1; | |
3172 //v5 = 1000 * v3; | |
3173 v5 = 1000ui64 * pPlayers[uActiveCharacter]->uLevel * (pPlayers[uActiveCharacter]->uLevel + 1) / 2; // E n = n(n + 1) / 2 | 3119 v5 = 1000ui64 * pPlayers[uActiveCharacter]->uLevel * (pPlayers[uActiveCharacter]->uLevel + 1) / 2; // E n = n(n + 1) / 2 |
3174 //v6 = HIDWORD(v0->uExperience); | |
3175 //v7 = window_SpeakInHouse->ptr_1C; | |
3176 v68 = pMaxLevelPerTrainingHallType[(unsigned int)window_SpeakInHouse->ptr_1C - HOUSE_TRAINING_HALL_EMERALD_ISLE]; | 3120 v68 = pMaxLevelPerTrainingHallType[(unsigned int)window_SpeakInHouse->ptr_1C - HOUSE_TRAINING_HALL_EMERALD_ISLE]; |
3177 //v66 = 1000 * v3; | |
3178 if (pPlayers[uActiveCharacter]->uExperience >= v5) | 3121 if (pPlayers[uActiveCharacter]->uExperience >= v5) |
3179 { | 3122 { |
3180 v8 = pPlayers[uActiveCharacter]->classType % 4 + 1; | 3123 v8 = pPlayers[uActiveCharacter]->classType % 4 + 1; |
3181 if ( v8 == 4 ) | 3124 if ( v8 == 4 ) |
3182 v8 = 3; | 3125 v8 = 3; |
3183 v9 = (double)pPlayers[uActiveCharacter]->uLevel; | 3126 v9 = (double)pPlayers[uActiveCharacter]->uLevel; |
3184 //i = 0; | |
3185 v69 = v8; | 3127 v69 = v8; |
3186 //v10 = (signed __int64)(v9 * p2DEvents_minus1__20[13 * (signed int)v7] * (double)v8); | |
3187 v10 = (signed __int64)(v9 * p2DEvents[(signed int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier * (double)v8); | 3128 v10 = (signed __int64)(v9 * p2DEvents[(signed int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier * (double)v8); |
3188 v11 = v10 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; | 3129 pPrice = v10 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; |
3189 if ( v11 < v10 / 3 ) | 3130 if ( pPrice < v10 / 3 ) |
3190 v11 = v10 / 3; | 3131 pPrice = v10 / 3; |
3191 //i = v11; | 3132 } |
3192 } | 3133 //------------------------------------------------------- |
3193 | 3134 all_text_height = 0; |
3194 if (HouseUI_CheckIfPlayerCanInteract()) | 3135 if (HouseUI_CheckIfPlayerCanInteract()) |
3195 { | 3136 { |
3196 if ( dialog_menu_id != HOUSE_DIALOGUE_MAIN ) | 3137 if ( dialog_menu_id == HOUSE_DIALOGUE_MAIN ) |
3197 { | 3138 { |
3198 if ( dialog_menu_id != HOUSE_DIALOGUE_TRAININGHALL_TRAIN ) | 3139 if (HouseUI_CheckIfPlayerCanInteract()) |
3199 { | 3140 { |
3200 if ( dialog_menu_id == HOUSE_DIALOGUE_LEARN_SKILLS ) | 3141 index = 0; |
3201 { | 3142 pShopOptions[0] = pTmpBuf.data(); |
3202 if (HouseUI_CheckIfPlayerCanInteract()) | 3143 pShopOptions[1] = pGlobalTXT_LocalizationStrings[160];// "Learn Skills" |
3203 { | 3144 if ( pDialogueWindow->pStartingPosActiveItem < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton ) |
3204 //i = 0; | 3145 { |
3205 int _v0 = 0; | 3146 for ( int i = pDialogueWindow->pStartingPosActiveItem; |
3206 v13 = pDialogueWindow; | 3147 i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) |
3207 //v14 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (unsigned int)ptr_507BC0->ptr_1C] * 500.0); | 3148 { |
3208 v14 = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0); | 3149 if ( pDialogueWindow->GetControl(i)->msg_param == HOUSE_DIALOGUE_TRAININGHALL_TRAIN ) |
3209 v73 = v14 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; | |
3210 if ( v73 < v14 / 3 ) | |
3211 v73 = v14 / 3; | |
3212 v15 = v13->pStartingPosActiveItem; | |
3213 v16 = v13->pNumPresenceButton; | |
3214 v72 = 0; | |
3215 if ( (signed int)v15 >= (signed int)(v15 + v16) ) | |
3216 goto LABEL_76; | |
3217 do | |
3218 { | 3150 { |
3219 v17 = v13->GetControl(v15)->msg_param - 36; | 3151 if (pPlayers[uActiveCharacter]->uLevel >= v68) |
3220 if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][v17] && !pPlayers[uActiveCharacter]->pActiveSkills[v17] ) | 3152 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." |
3153 else | |
3221 { | 3154 { |
3222 v18 = pFontArrus->CalcTextHeight(pSkillNames[v17], &v65, 0, 0); | 3155 if (pPlayers[uActiveCharacter]->uExperience < v5) |
3223 _v0 += v18; | 3156 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" |
3224 ++v72; | 3157 else |
3225 } | 3158 sprintfex(pShopOptions[index], pGlobalTXT_LocalizationStrings[537], pPlayers[uActiveCharacter]->uLevel + 1, pPrice); // "Train to level %d for %d gold" |
3226 ++v15; | |
3227 } | |
3228 while ( (signed int)v15 < v13->pNumPresenceButton + v13->pStartingPosActiveItem ); | |
3229 if ( v72 ) | |
3230 { | |
3231 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[401], v73);// "Skill Cost: %lu" | |
3232 v65.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3u); | |
3233 v73 = (signed int)(149 - _v0) / v72; | |
3234 if ( v73 > 32 ) | |
3235 v73 = 32; | |
3236 //result = v13->pStartingPosActiveItem; | |
3237 v19 = (signed int)(149 - v72 * v73 - _v0) / 2 - v73 / 2 + 162; | |
3238 int _v1 = v13->pStartingPosActiveItem; | |
3239 v68 = v19; | |
3240 if (v13->pStartingPosActiveItem < v13->pStartingPosActiveItem + v13->pNumPresenceButton ) | |
3241 { | |
3242 v72 = 2; | |
3243 do | |
3244 { | |
3245 v20 = v13->GetControl(_v1); | |
3246 v21 = v20; | |
3247 v22 = v20->msg_param - 36; | |
3248 if ( !byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][v22] || pPlayers[uActiveCharacter]->pActiveSkills[v22] ) | |
3249 { | |
3250 v21->uW = 0; | |
3251 v21->uHeight = 0; | |
3252 v21->uY = 0; | |
3253 } | |
3254 else | |
3255 { | |
3256 v23 = pSkillNames[v22]; | |
3257 v21->uY = v73 + v68; | |
3258 //HIDWORD(v66) = (int)v23; | |
3259 v24 = pFontArrus->CalcTextHeight(v23, &v65, 0, 0); | |
3260 v25 = v21->uY; | |
3261 v21->uHeight = v24; | |
3262 v26 = v25 + v24 - 1; | |
3263 v21->uW = v26; | |
3264 v68 = v26; | |
3265 v27 = color2; | |
3266 if ( pDialogueWindow->pCurrentPosActiveItem != v72 ) | |
3267 v27 = white; | |
3268 v65.DrawTitleText(pFontArrus, 0, v25, v27, v23, 3u); | |
3269 } | |
3270 ++_v1; | |
3271 ++v72; | |
3272 } | |
3273 while ( (signed int)_v1 < v13->pStartingPosActiveItem + v13->pNumPresenceButton ); | |
3274 } | 3159 } |
3275 } | 3160 } |
3276 else | 3161 all_text_height += pFontArrus->CalcTextHeight(pShopOptions[index], &training_dialog_window, 0, 0); |
3277 { | 3162 ++index; |
3278 LABEL_76: | 3163 } |
3279 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]);// | 3164 } |
3280 // "Seek knowledge elsewhere %s the %s" | 3165 v49 = (2 * (87 - (174 - all_text_height) / 2) - all_text_height) / 2 - (174 - all_text_height) / 2 / 2 + 138; |
3281 strcat(pTmpBuf.data(), "\n \n"); | 3166 if (pDialogueWindow->pStartingPosActiveItem < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton) |
3282 strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]);// "I can offer you nothing further." | 3167 { |
3283 v29 = color2; | 3168 int pCurrentItem = 2; |
3284 v30 = pFontArrus->CalcTextHeight(pTmpBuf.data(), &v65, 0, 0); | 3169 index = 0; |
3285 v65.DrawTitleText(pFontArrus, 0, (174 - v30) / 2 + 138, v29, pTmpBuf.data(), 3u); | 3170 for ( int i = pDialogueWindow->pStartingPosActiveItem; |
3286 } | 3171 i < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton; ++i ) |
3287 } | 3172 { |
3288 } | 3173 pButton = pDialogueWindow->GetControl(i); |
3289 return; | 3174 pButton->uY = (174 - all_text_height) / 2 + v49; |
3290 } | 3175 pTextHeight = pFontArrus->CalcTextHeight(pShopOptions[index], &training_dialog_window, 0, 0); |
3176 pButton->uHeight = pTextHeight; | |
3177 pButton->uW = pTextHeight + pButton->uY - 1; | |
3178 v49 = pButton->uW; | |
3179 pTextColor = TargetColor(0xE1u, 0xCDu, 0x23u); | |
3180 if ( pDialogueWindow->pCurrentPosActiveItem != pCurrentItem ) | |
3181 pTextColor = TargetColor(255, 255, 255); | |
3182 training_dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pTextColor, pShopOptions[index], 3); | |
3183 ++pCurrentItem; | |
3184 ++index; | |
3185 } | |
3186 } | |
3187 } | |
3188 } | |
3189 //------------------------------------------------------------------ | |
3190 if ( dialog_menu_id == HOUSE_DIALOGUE_TRAININGHALL_TRAIN ) | |
3191 { | |
3291 if ( !HouseUI_CheckIfPlayerCanInteract() ) | 3192 if ( !HouseUI_CheckIfPlayerCanInteract() ) |
3292 { | 3193 { |
3293 //v31 = pNPCTopics[122].pText; | 3194 v33 = pFontArrus->CalcTextHeight(pNPCTopics[122].pText, &training_dialog_window, 0, 0); |
3294 //v32 = color2; | 3195 training_dialog_window.DrawTitleText(pFontArrus, 0, (212 - v33) / 2 + 101, TargetColor(0xE1u, 0xCDu, 0x23u), pNPCTopics[122].pText, 3); |
3295 v33 = pFontArrus->CalcTextHeight(pNPCTopics[122].pText, &v65, 0, 0); | |
3296 v65.DrawTitleText(pFontArrus, 0, (212 - v33) / 2 + 101, color2, pNPCTopics[122].pText, 3); | |
3297 pDialogueWindow->pNumPresenceButton = 0; | 3196 pDialogueWindow->pNumPresenceButton = 0; |
3298 return; | 3197 return; |
3299 } | 3198 } |
3300 v34 = pPlayers[uActiveCharacter]->uLevel; | 3199 //v34 = pPlayers[uActiveCharacter]->uLevel; |
3301 if ( v34 < v68 ) | 3200 if ( pPlayers[uActiveCharacter]->uLevel < v68 ) |
3302 { | 3201 { |
3303 if ( (signed __int64)pPlayers[uActiveCharacter]->uExperience >= v5 ) | 3202 if ( (signed __int64)pPlayers[uActiveCharacter]->uExperience >= v5 ) |
3304 { | 3203 { |
3305 if ( pParty->uNumGold >= v11) | 3204 if ( pParty->uNumGold >= pPrice) |
3306 { | 3205 { |
3307 Party::TakeGold(v11); | 3206 Party::TakeGold(pPrice); |
3308 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful); | 3207 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful); |
3309 ++pPlayers[uActiveCharacter]->uLevel; | 3208 ++pPlayers[uActiveCharacter]->uLevel; |
3310 pPlayers[uActiveCharacter]->uSkillPoints += pPlayers[uActiveCharacter]->uLevel / 10 + 5; | 3209 pPlayers[uActiveCharacter]->uSkillPoints += pPlayers[uActiveCharacter]->uLevel / 10 + 5; |
3311 pPlayers[uActiveCharacter]->sHealth = pPlayers[uActiveCharacter]->GetMaxHealth(); | 3210 pPlayers[uActiveCharacter]->sHealth = pPlayers[uActiveCharacter]->GetMaxHealth(); |
3312 pPlayers[uActiveCharacter]->sMana = pPlayers[uActiveCharacter]->GetMaxMana(); | 3211 pPlayers[uActiveCharacter]->sMana = pPlayers[uActiveCharacter]->GetMaxMana(); |
3313 | |
3314 uint max_level_in_party = player_levels[0]; | 3212 uint max_level_in_party = player_levels[0]; |
3315 for (uint _it = 1; _it < 4; ++_it) | 3213 for (uint _it = 1; _it < 4; ++_it) |
3316 { | 3214 { |
3317 if (player_levels[_it] > max_level_in_party) | 3215 if (player_levels[_it] > max_level_in_party) |
3318 max_level_in_party = player_levels[_it]; | 3216 max_level_in_party = player_levels[_it]; |
3319 } | 3217 } |
3320 | |
3321 ++player_levels[uActiveCharacter - 1]; | 3218 ++player_levels[uActiveCharacter - 1]; |
3322 if (player_levels[uActiveCharacter - 1] > max_level_in_party) // if we reach new maximum party level | 3219 if (player_levels[uActiveCharacter - 1] > max_level_in_party) // if we reach new maximum party level |
3323 // feature is broken thou, since this array is always zeroed in EnterHouse | 3220 // feature is broken thou, since this array is always zeroed in EnterHouse |
3324 { | 3221 { |
3325 v40 = _494820_training_time(pParty->uCurrentHour); | 3222 v42 = 60 * (_494820_training_time(pParty->uCurrentHour) + 4) - pParty->uCurrentMinute; |
3326 //v41 = window_SpeakInHouse->ptr_1C; | |
3327 v42 = 60 * (v40 + 4) - pParty->uCurrentMinute; | |
3328 if ((unsigned int)window_SpeakInHouse->ptr_1C == HOUSE_TRAINING_HALL_94 || | 3223 if ((unsigned int)window_SpeakInHouse->ptr_1C == HOUSE_TRAINING_HALL_94 || |
3329 (unsigned int)window_SpeakInHouse->ptr_1C == HOUSE_TRAINING_HALL_95) | 3224 (unsigned int)window_SpeakInHouse->ptr_1C == HOUSE_TRAINING_HALL_95) |
3330 v42 += 720; | 3225 v42 += 720; |
3331 RestAndHeal((signed int)(v42 + 10080)); | 3226 RestAndHeal((signed int)(v42 + 10080)); |
3332 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor ) | 3227 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor ) |
3338 ShowStatusBarString(pTmpBuf.data(), 2); | 3233 ShowStatusBarString(pTmpBuf.data(), 2); |
3339 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | 3234 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); |
3340 return; | 3235 return; |
3341 } | 3236 } |
3342 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);// "You don't have enough gold" | 3237 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);// "You don't have enough gold" |
3343 v63 = 4; | 3238 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)4); |
3344 LABEL_55: | |
3345 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)v63); | |
3346 //LABEL_56: | |
3347 /*result = pMessageQueue_50CBD0->uNumMessages; | |
3348 if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) | |
3349 { | |
3350 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; | |
3351 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1; | |
3352 result = 3 * pMessageQueue_50CBD0->uNumMessages + 3; | |
3353 *(&pMessageQueue_50CBD0->uNumMessages + result) = 0; | |
3354 ++pMessageQueue_50CBD0->uNumMessages; | |
3355 } | |
3356 return result;*/ | |
3357 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | 3239 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); |
3358 return; | 3240 return; |
3359 } | 3241 } |
3360 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[538], (unsigned int)(v5 - pPlayers[uActiveCharacter]->uExperience), v34 + 1);// | 3242 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[538], (unsigned int)(v5 - pPlayers[uActiveCharacter]->uExperience), pPlayers[uActiveCharacter]->uLevel + 1);// |
3361 // "You need %d more experience to train to level %d" | 3243 // "You need %d more experience to train to level %d" |
3362 v35 = 0; | 3244 v36 = (212 - pFontArrus->CalcTextHeight(pTmpBuf.data(), &training_dialog_window, 0, 0)) / 2 + 88; |
3363 v62 = 3; | |
3364 v60 = pTmpBuf.data(); | |
3365 v58 = color2; | |
3366 v36 = (212 - pFontArrus->CalcTextHeight(pTmpBuf.data(), &v65, 0, 0)) / 2 + 88; | |
3367 } | 3245 } |
3368 else | 3246 else |
3369 { | 3247 { |
3370 sprintf(pTmpBuf.data(), "%s\n \n%s", pGlobalTXT_LocalizationStrings[536], pGlobalTXT_LocalizationStrings[529]);// | 3248 sprintf(pTmpBuf.data(), "%s\n \n%s", pGlobalTXT_LocalizationStrings[536], pGlobalTXT_LocalizationStrings[529]);// |
3371 // ""With your skills, you should be working here as a teacher."" | 3249 // ""With your skills, you should be working here as a teacher."" |
3372 // ""Sorry, but we are unable to train you."" | 3250 // ""Sorry, but we are unable to train you."" |
3373 v35 = 0; | 3251 v36 = (212 - pFontArrus->CalcTextHeight(pTmpBuf.data(), &training_dialog_window, 0, 0)) / 2 + 101; |
3374 v62 = 3; | 3252 } |
3375 v60 = pTmpBuf.data(); | 3253 training_dialog_window.DrawTitleText(pFontArrus, 0, v36, TargetColor(0xE1u, 0xCDu, 0x23u), pTmpBuf.data(), 3); |
3376 v58 = color2; | 3254 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)3); |
3377 v36 = (212 - pFontArrus->CalcTextHeight(pTmpBuf.data(), &v65, 0, 0)) / 2 + 101; | 3255 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); |
3378 } | 3256 return; |
3379 v65.DrawTitleText(pFontArrus, v35, v36, v58, v60, v62); | 3257 } |
3380 v63 = 3; | 3258 } |
3381 goto LABEL_55; | 3259 //------------------------------------------------------------- |
3382 } | 3260 if ( dialog_menu_id == HOUSE_DIALOGUE_LEARN_SKILLS ) |
3383 | 3261 { |
3384 if (HouseUI_CheckIfPlayerCanInteract()) | 3262 if (HouseUI_CheckIfPlayerCanInteract()) |
3385 { | 3263 { |
3386 v43 = pDialogueWindow; | 3264 v14 = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0); |
3387 v72 = 0; | 3265 v73 = v14 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; |
3388 pShopOptions[0] = pTmpBuf.data(); | 3266 if ( v73 < v14 / 3 ) |
3389 pShopOptions[1] = pGlobalTXT_LocalizationStrings[160];// "Learn Skills" | 3267 v73 = v14 / 3; |
3390 v44 = pDialogueWindow->pNumPresenceButton; | 3268 v15 = pDialogueWindow->pStartingPosActiveItem; |
3391 v73 = pDialogueWindow->pStartingPosActiveItem; | 3269 v16 = pDialogueWindow->pNumPresenceButton; |
3392 if ( v73 < v73 + v44 ) | 3270 index = 0; |
3393 { | 3271 if ( (signed int)v15 >= (signed int)(v15 + v16) ) |
3394 v45 = pShopOptions.data(); | 3272 goto LABEL_76; |
3395 do | 3273 do |
3396 { | 3274 { |
3397 if ( v43->GetControl(v73)->msg_param == HOUSE_DIALOGUE_TRAININGHALL_TRAIN ) | 3275 v17 = pDialogueWindow->GetControl(v15)->msg_param - 36; |
3398 { | 3276 if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][v17] && !pPlayers[uActiveCharacter]->pActiveSkills[v17] ) |
3399 //v46 = pPlayers[uActiveCharacter]->uLevel; | 3277 { |
3400 if (pPlayers[uActiveCharacter]->uLevel >= v68) | 3278 all_text_height += pFontArrus->CalcTextHeight(pSkillNames[v17], &training_dialog_window, 0, 0); |
3401 sprintfex(*v45, "%s\n \n%s", | 3279 ++index; |
3402 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." | 3280 } |
3281 ++v15; | |
3282 } | |
3283 while ( (signed int)v15 < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem ); | |
3284 if ( index ) | |
3285 { | |
3286 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[401], v73);// "Skill Cost: %lu" | |
3287 training_dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3); | |
3288 v73 = (signed int)(149 - all_text_height) / index; | |
3289 if ( v73 > 32 ) | |
3290 v73 = 32; | |
3291 v19 = (signed int)(149 - index * v73 - all_text_height) / 2 - v73 / 2 + 162; | |
3292 int _v1 = pDialogueWindow->pStartingPosActiveItem; | |
3293 v68 = v19; | |
3294 if (pDialogueWindow->pStartingPosActiveItem < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton ) | |
3295 { | |
3296 index = 2; | |
3297 do | |
3298 { | |
3299 v20 = pDialogueWindow->GetControl(_v1); | |
3300 v21 = v20; | |
3301 v22 = v20->msg_param - 36; | |
3302 if ( !byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][v22] || pPlayers[uActiveCharacter]->pActiveSkills[v22] ) | |
3303 { | |
3304 v21->uW = 0; | |
3305 v21->uHeight = 0; | |
3306 v21->uY = 0; | |
3307 } | |
3403 else | 3308 else |
3404 { | 3309 { |
3405 if (pPlayers[uActiveCharacter]->uExperience < v5) | 3310 v23 = pSkillNames[v22]; |
3406 sprintfex(*v45, pGlobalTXT_LocalizationStrings[538], // "You need %d more experience to train to level %d" | 3311 v21->uY = v73 + v68; |
3407 (uint)(v5 - pPlayers[uActiveCharacter]->uExperience), pPlayers[uActiveCharacter]->uLevel + 1); | 3312 //HIDWORD(v66) = (int)v23; |
3408 else | 3313 v24 = pFontArrus->CalcTextHeight(v23, &training_dialog_window, 0, 0); |
3409 sprintfex(*v45, pGlobalTXT_LocalizationStrings[537], // "Train to level %d for %d gold" | 3314 v25 = v21->uY; |
3410 pPlayers[uActiveCharacter]->uLevel + 1, v11); | 3315 v21->uHeight = v24; |
3316 v26 = v25 + v24 - 1; | |
3317 v21->uW = v26; | |
3318 v68 = v26; | |
3319 v27 = TargetColor(0xE1u, 0xCDu, 0x23u); | |
3320 if ( pDialogueWindow->pCurrentPosActiveItem != index ) | |
3321 v27 = TargetColor(255, 255, 255); | |
3322 training_dialog_window.DrawTitleText(pFontArrus, 0, v25, v27, v23, 3); | |
3411 } | 3323 } |
3412 } | 3324 ++_v1; |
3413 v47 = pFontArrus->CalcTextHeight(*v45, &v65, 0, 0); | 3325 ++index; |
3414 v43 = pDialogueWindow; | 3326 } |
3415 v72 += v47; | 3327 while ( (signed int)_v1 < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton ); |
3416 ++v45; | 3328 } |
3417 ++v73; | 3329 } |
3418 } | 3330 else |
3419 while ( v73 < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem ); | 3331 { |
3420 } | 3332 LABEL_76: |
3421 | 3333 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]);// |
3422 v49 = (2 * (87 - (174 - v72) / 2) - v72) / 2 - (174 - v72) / 2 / 2 + 138; | 3334 // "Seek knowledge elsewhere %s the %s" |
3423 v73 = v43->pStartingPosActiveItem; | 3335 strcat(pTmpBuf.data(), "\n \n"); |
3424 if (v43->pStartingPosActiveItem < v43->pStartingPosActiveItem + v43->pNumPresenceButton) | 3336 strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]);// "I can offer you nothing further." |
3425 { | 3337 v29 = TargetColor(0xE1u, 0xCDu, 0x23u); |
3426 int _v3 = 2; | 3338 v30 = pFontArrus->CalcTextHeight(pTmpBuf.data(), &training_dialog_window, 0, 0); |
3427 v51 = pShopOptions.data(); | 3339 training_dialog_window.DrawTitleText(pFontArrus, 0, (174 - v30) / 2 + 138, v29, pTmpBuf.data(), 3); |
3428 do | 3340 } |
3429 { | 3341 } |
3430 v52 = v43->GetControl(v73); | 3342 } |
3431 v53 = v52; | 3343 return; |
3432 v52->uY = (174 - v72) / 2 + v49; | |
3433 v54 = pFontArrus->CalcTextHeight(*v51, &v65, 0, 0); | |
3434 v55 = v53->uY; | |
3435 v53->uHeight = v54; | |
3436 v56 = v54 + v55 - 1; | |
3437 v53->uW = v56; | |
3438 v49 = v56; | |
3439 v57 = color2; | |
3440 if ( pDialogueWindow->pCurrentPosActiveItem != _v3 ) | |
3441 v57 = white; | |
3442 v65.DrawTitleText(pFontArrus, 0, v55, v57, *v51, 3u); | |
3443 v43 = pDialogueWindow; | |
3444 ++_v3; | |
3445 ++v51; | |
3446 ++v73; | |
3447 } | |
3448 while ( v73 < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton); | |
3449 } | |
3450 } | |
3451 } | |
3452 } | 3344 } |
3453 | 3345 |
3454 //----- (004B6478) -------------------------------------------------------- | 3346 //----- (004B6478) -------------------------------------------------------- |
3455 void sub_4B6478() | 3347 void sub_4B6478() |
3456 { | 3348 { |