comparison UI/UIHouses.cpp @ 1671:4bbb80c7dba7

Merge
author Ritor1
date Wed, 18 Sep 2013 20:04:49 +0600
parents 014eb02bd0e6 620b6ba3e6b8
children 8251e59fd7c1
comparison
equal deleted inserted replaced
1670:014eb02bd0e6 1671:4bbb80c7dba7
457 CreateButtonInColumn(1, 56); 457 CreateButtonInColumn(1, 56);
458 pDialogueWindow->_41D08F_set_keyboard_control_group(2, 1, 0, 2); 458 pDialogueWindow->_41D08F_set_keyboard_control_group(2, 1, 0, 2);
459 } 459 }
460 break; 460 break;
461 461
462 case BuildingType_14: 462 case BuildingType_ElementalGuild:
463 { 463 {
464 CreateButtonInColumn(0, 18); 464 CreateButtonInColumn(0, 18);
465 CreateButtonInColumn(1, 48); 465 CreateButtonInColumn(1, 48);
466 CreateButtonInColumn(2, 49); 466 CreateButtonInColumn(2, 49);
467 CreateButtonInColumn(3, 50); 467 CreateButtonInColumn(3, 50);
468 CreateButtonInColumn(4, 51); 468 CreateButtonInColumn(4, 51);
469 pDialogueWindow->_41D08F_set_keyboard_control_group(5, 1, 0, 2); 469 pDialogueWindow->_41D08F_set_keyboard_control_group(5, 1, 0, 2);
470 } 470 }
471 break; 471 break;
472 472
473 case BuildingType_15: 473 case BuildingType_SelfGuild:
474 { 474 {
475 CreateButtonInColumn(0, 18); 475 CreateButtonInColumn(0, 18);
476 CreateButtonInColumn(1, 52); 476 CreateButtonInColumn(1, 52);
477 CreateButtonInColumn(2, 53); 477 CreateButtonInColumn(2, 53);
478 CreateButtonInColumn(3, 54); 478 CreateButtonInColumn(3, 54);
1085 case BuildingType_SpiritGuild: 1085 case BuildingType_SpiritGuild:
1086 case BuildingType_MindGuild: 1086 case BuildingType_MindGuild:
1087 case BuildingType_BodyGuild: 1087 case BuildingType_BodyGuild:
1088 case BuildingType_LightGuild: 1088 case BuildingType_LightGuild:
1089 case BuildingType_DarkGuild: 1089 case BuildingType_DarkGuild:
1090 case BuildingType_14: 1090 case BuildingType_ElementalGuild:
1091 case BuildingType_15: 1091 case BuildingType_SelfGuild:
1092 case BuildingType_16: 1092 case BuildingType_16:
1093 { 1093 {
1094 if ( pParty->field_3C.Shops_next_generation_time[window_SpeakInHouse->par1C] >= (signed __int64)pParty->uTimePlayed ) 1094 if ( pParty->field_3C.Shops_next_generation_time[window_SpeakInHouse->par1C] >= (signed __int64)pParty->uTimePlayed )
1095 { 1095 {
1096 for ( uint i = 0; i < 12; ++i ) 1096 for ( uint i = 0; i < 12; ++i )
2982 int v8; // edx@4 2982 int v8; // edx@4
2983 double v9; // st7@6 2983 double v9; // st7@6
2984 signed int v10; // esi@6 2984 signed int v10; // esi@6
2985 int pPrice; // ecx@6 2985 int pPrice; // ecx@6
2986 signed int v14; // esi@14 2986 signed int v14; // esi@14
2987 //unsigned int v15; // esi@16
2988 int v16; // eax@16 2987 int v16; // eax@16
2989 //unsigned int v17; // eax@17
2990 int v19; // ecx@24 2988 int v19; // ecx@24
2991 //GUIButton *v20; // eax@26
2992 //GUIButton *v21; // esi@26
2993 //int v22; // eax@26
2994 //const char *v23; // eax@28
2995 //int v24; // eax@28
2996 //unsigned int v25; // ecx@28
2997 //int v26; // eax@28
2998 //unsigned __int16 v27; // ax@28
2999 //unsigned __int16 v29; // ST14_2@34
3000 //int v30; // eax@34
3001 int v33; // eax@36 2989 int v33; // eax@36
3002 unsigned int v36; // eax@38 2990 unsigned int v36; // eax@38
3003 unsigned int v42; // eax@46 2991 unsigned int v42; // eax@46
3004 int index; 2992 int index;
3005 int all_text_height; // eax@68 2993 int all_text_height; // eax@68
3006 int v49; // ebx@69 2994 int v49; // ebx@69
3007 GUIButton *pButton; // eax@71 2995 GUIButton *pButton; // eax@71
3008 int pTextHeight; // eax@71 2996 int pTextHeight; // eax@71
3009 unsigned __int16 pTextColor; // ax@71 2997 unsigned __int16 pTextColor; // ax@71
3010 GUIWindow training_dialog_window; // [sp+Ch] [bp-78h]@1 2998 GUIWindow training_dialog_window; // [sp+Ch] [bp-78h]@1
3011 //int v68; // [sp+6Ch] [bp-18h]@3
3012 int v69; // [sp+70h] [bp-14h]@6 2999 int v69; // [sp+70h] [bp-14h]@6
3013 int v73; // [sp+80h] [bp-4h]@14 3000 int v73; // [sp+80h] [bp-4h]@14
3014 3001
3015 memcpy(&training_dialog_window, window_SpeakInHouse, sizeof(training_dialog_window)); 3002 memcpy(&training_dialog_window, window_SpeakInHouse, sizeof(training_dialog_window));
3016 training_dialog_window.uFrameX = 483; 3003 training_dialog_window.uFrameX = 483;
3063 } 3050 }
3064 } 3051 }
3065 v49 = (2 * (87 - (174 - all_text_height) / 2) - all_text_height) / 2 - (174 - all_text_height) / 2 / 2 + 138; 3052 v49 = (2 * (87 - (174 - all_text_height) / 2) - all_text_height) / 2 - (174 - all_text_height) / 2 / 2 + 138;
3066 if (pDialogueWindow->pStartingPosActiveItem < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton) 3053 if (pDialogueWindow->pStartingPosActiveItem < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton)
3067 { 3054 {
3068 //int pCurrentItem = 2;
3069 index = 0; 3055 index = 0;
3070 for ( int i = pDialogueWindow->pStartingPosActiveItem; 3056 for ( int i = pDialogueWindow->pStartingPosActiveItem;
3071 i < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton; ++i ) 3057 i < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton; ++i )
3072 { 3058 {
3073 pButton = pDialogueWindow->GetControl(i); 3059 pButton = pDialogueWindow->GetControl(i);
3078 v49 = pButton->uW; 3064 v49 = pButton->uW;
3079 pTextColor = TargetColor(0xE1u, 0xCDu, 0x23u); 3065 pTextColor = TargetColor(0xE1u, 0xCDu, 0x23u);
3080 if ( pDialogueWindow->pCurrentPosActiveItem != i ) 3066 if ( pDialogueWindow->pCurrentPosActiveItem != i )
3081 pTextColor = TargetColor(255, 255, 255); 3067 pTextColor = TargetColor(255, 255, 255);
3082 training_dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pTextColor, pShopOptions[index], 3); 3068 training_dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pTextColor, pShopOptions[index], 3);
3083 //++pCurrentItem;
3084 ++index; 3069 ++index;
3085 } 3070 }
3086 } 3071 }
3087 } 3072 }
3088 } 3073 }
3094 v33 = pFontArrus->CalcTextHeight(pNPCTopics[122].pText, &training_dialog_window, 0, 0); 3079 v33 = pFontArrus->CalcTextHeight(pNPCTopics[122].pText, &training_dialog_window, 0, 0);
3095 training_dialog_window.DrawTitleText(pFontArrus, 0, (212 - v33) / 2 + 101, TargetColor(0xE1u, 0xCDu, 0x23u), pNPCTopics[122].pText, 3); 3080 training_dialog_window.DrawTitleText(pFontArrus, 0, (212 - v33) / 2 + 101, TargetColor(0xE1u, 0xCDu, 0x23u), pNPCTopics[122].pText, 3);
3096 pDialogueWindow->pNumPresenceButton = 0; 3081 pDialogueWindow->pNumPresenceButton = 0;
3097 return; 3082 return;
3098 } 3083 }
3099 //v34 = pPlayers[uActiveCharacter]->uLevel;
3100 if ( pPlayers[uActiveCharacter]->uLevel < pMaxLevelPerTrainingHallType[(unsigned int)window_SpeakInHouse->ptr_1C - HOUSE_TRAINING_HALL_EMERALD_ISLE] ) 3084 if ( pPlayers[uActiveCharacter]->uLevel < pMaxLevelPerTrainingHallType[(unsigned int)window_SpeakInHouse->ptr_1C - HOUSE_TRAINING_HALL_EMERALD_ISLE] )
3101 { 3085 {
3102 if ( (signed __int64)pPlayers[uActiveCharacter]->uExperience >= v5 ) 3086 if ( (signed __int64)pPlayers[uActiveCharacter]->uExperience >= v5 )
3103 { 3087 {
3104 if ( pParty->uNumGold >= pPrice) 3088 if ( pParty->uNumGold >= pPrice)
3230 signed int v3; // esi@1 3214 signed int v3; // esi@1
3231 int pPrice; // ebx@1 3215 int pPrice; // ebx@1
3232 unsigned int v5; // esi@5 3216 unsigned int v5; // esi@5
3233 int v6; // edi@6 3217 int v6; // edi@6
3234 int result; // eax@13 3218 int result; // eax@13
3235 int v12; // eax@20 3219 int all_text_height; // eax@20
3236 int v13; // eax@21 3220 int v13; // eax@21
3237 GUIButton *pButton; // esi@27 3221 GUIButton *pButton; // esi@27
3238 unsigned int v16; // eax@28 3222 unsigned int v16; // eax@28
3239 int pTextHeight; // eax@29 3223 int pTextHeight; // eax@29
3240 unsigned __int16 pTextColor; // ax@29 3224 unsigned __int16 pTextColor; // ax@29
3241 unsigned __int16 v22; // ST14_2@36 3225 unsigned __int16 v22; // ST14_2@36
3242 int v27; // [sp-4h] [bp-80h]@8 3226 int v27; // [sp-4h] [bp-80h]@8
3243 GUIWindow dialog_window; // [sp+Ch] [bp-70h]@1 3227 GUIWindow dialog_window; // [sp+Ch] [bp-70h]@1
3244 int v32; // [sp+6Ch] [bp-10h]@1 3228 int v32; // [sp+6Ch] [bp-10h]@1
3245 int v34; // [sp+74h] [bp-8h]@17 3229 int index; // [sp+74h] [bp-8h]@17
3246 3230
3247 memcpy(&dialog_window, window_SpeakInHouse, sizeof(dialog_window)); 3231 memcpy(&dialog_window, window_SpeakInHouse, sizeof(dialog_window));
3248 dialog_window.uFrameX = 483; 3232 dialog_window.uFrameX = 483;
3249 dialog_window.uFrameWidth = 148; 3233 dialog_window.uFrameWidth = 148;
3250 dialog_window.uFrameZ = 334; 3234 dialog_window.uFrameZ = 334;
3263 pDialogueWindow->pNumPresenceButton = 0; 3247 pDialogueWindow->pNumPresenceButton = 0;
3264 return; 3248 return;
3265 } 3249 }
3266 if ( !HouseUI_CheckIfPlayerCanInteract() ) 3250 if ( !HouseUI_CheckIfPlayerCanInteract() )
3267 return; 3251 return;
3268 v34 = 0; 3252 all_text_height = 0;
3253 index = 0;
3269 for ( int i = pDialogueWindow->pStartingPosActiveItem; 3254 for ( int i = pDialogueWindow->pStartingPosActiveItem;
3270 i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) 3255 i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i )
3271 { 3256 {
3272 if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType / 3][pDialogueWindow->GetControl(i)->msg_param - 36] 3257 if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType / 3][pDialogueWindow->GetControl(i)->msg_param - 36]
3273 && !pPlayers[uActiveCharacter]->pActiveSkills[pDialogueWindow->GetControl(i)->msg_param - 36] ) 3258 && !pPlayers[uActiveCharacter]->pActiveSkills[pDialogueWindow->GetControl(i)->msg_param - 36] )
3274 { 3259 {
3275 v12 += pFontArrus->CalcTextHeight(pSkillNames[pDialogueWindow->GetControl(i)->msg_param - 36], &dialog_window, 0, 0); 3260 all_text_height += pFontArrus->CalcTextHeight(pSkillNames[pDialogueWindow->GetControl(i)->msg_param - 36], &dialog_window, 0, 0);
3276 ++v34; 3261 ++index;
3277 } 3262 }
3278 } 3263 }
3279 if ( !v34 ) 3264 if ( !index )
3280 { 3265 {
3281 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]); 3266 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]);
3282 strcat(pTmpBuf.data(), "\n \n"); 3267 strcat(pTmpBuf.data(), "\n \n");
3283 strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]);//Больше ничего не могу предложить. 3268 strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]);//Больше ничего не могу предложить.
3284 pTextHeight = pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 0, 0); 3269 pTextHeight = pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 0, 0);
3285 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, TargetColor(0xFFu, 0xFFu, 0x9Bu), pTmpBuf.data(), 3); 3270 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, TargetColor(0xFFu, 0xFFu, 0x9Bu), pTmpBuf.data(), 3);
3286 return; 3271 return;
3287 } 3272 }
3288 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[401], pPrice);//Стоимость навыка: %lu 3273 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[401], pPrice);//Стоимость навыка: %lu
3289 dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3); 3274 dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3);
3290 v32 = (149 - v12) / v34; 3275 v32 = (149 - all_text_height) / index;
3291 if ( (149 - v12) / v34 > 32 ) 3276 if ( v32 > 32 )
3292 v32 = 32; 3277 v32 = 32;
3293 v34 = (149 - v34 * v32 - v12) / 2 - v32 / 2 + 162; 3278 index = (149 - index * v32 - all_text_height) / 2 - v32 / 2 + 162;
3294 if ( pDialogueWindow->pStartingPosActiveItem < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton ) 3279 if ( pDialogueWindow->pStartingPosActiveItem < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton )
3295 { 3280 {
3296 for ( int i = pDialogueWindow->pStartingPosActiveItem; 3281 for ( int i = pDialogueWindow->pStartingPosActiveItem;
3297 i <pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) 3282 i <pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i )
3298 { 3283 {
3299 pButton = pDialogueWindow->GetControl(i); 3284 pButton = pDialogueWindow->GetControl(i);
3300 if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType / 3][pButton->msg_param - 36] ) 3285 if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType / 3][pButton->msg_param - 36] )
3301 { 3286 {
3302 if ( !pPlayers[uActiveCharacter]->pActiveSkills[pButton->msg_param - 36] ) 3287 if ( !pPlayers[uActiveCharacter]->pActiveSkills[pButton->msg_param - 36] )
3303 { 3288 {
3304 pButton->uY = v32 + v34; 3289 pButton->uY = v32 + index;
3305 pTextHeight = pFontArrus->CalcTextHeight(pSkillNames[pButton->msg_param - 36], &dialog_window, 0, 0); 3290 pTextHeight = pFontArrus->CalcTextHeight(pSkillNames[pButton->msg_param - 36], &dialog_window, 0, 0);
3306 pButton->uHeight = pTextHeight; 3291 pButton->uHeight = pTextHeight;
3307 pButton->uW = pButton->uY + pTextHeight - 1; 3292 pButton->uW = pButton->uY + pTextHeight - 1;
3308 v34 = pButton->uY + pTextHeight - 1; 3293 index = pButton->uY + pTextHeight - 1;
3309 pTextColor = TargetColor(0xFFu, 0xFFu, 0x9Bu); 3294 pTextColor = TargetColor(0xFFu, 0xFFu, 0x9Bu);
3310 if ( pDialogueWindow->pCurrentPosActiveItem != i ) 3295 if ( pDialogueWindow->pCurrentPosActiveItem != i )
3311 pTextColor = TargetColor(0xFFu, 0xFFu, 0xFFu); 3296 pTextColor = TargetColor(0xFFu, 0xFFu, 0xFFu);
3312 dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pTextColor, pSkillNames[pButton->msg_param - 36], 3); 3297 dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pTextColor, pSkillNames[pButton->msg_param - 36], 3);
3313 } 3298 }
3364 } 3349 }
3365 3350
3366 //----- (004B2A74) -------------------------------------------------------- 3351 //----- (004B2A74) --------------------------------------------------------
3367 void SimpleHouseDialog() 3352 void SimpleHouseDialog()
3368 { 3353 {
3369 char *v2; // eax@3
3370 unsigned int i; // eax@5
3371 NPCData *pNPC; // esi@6 3354 NPCData *pNPC; // esi@6
3372 char *v15; // esi@14 3355 char *v15; // esi@14
3373 GUIButton *pButton; // eax@15 3356 GUIButton *pButton; // eax@15
3374 int v18; // ecx@17
3375 char *v29; // esi@42 3357 char *v29; // esi@42
3376 int v31; // ST1C_4@42 3358 int v31; // ST1C_4@42
3377 int v34; // esi@51 3359 int index; // esi@51
3378 unsigned int v36; // edi@51 3360 int v36;
3379 GUIButton *v37; // eax@52 3361 signed int all_text_height; // ecx@54
3380 int v38; // eax@52
3381 signed int v39; // ecx@54
3382 int v40; // edi@57 3362 int v40; // edi@57
3383 const char *v43; // ebx@60 3363 unsigned __int16 pTextColor; // ax@60
3384 int v44; // eax@60 3364 GUIFont *pTextFont; // ebx@64
3385 unsigned int v45; // ecx@60 3365 int pTextHeight;
3386 unsigned __int16 v46; // ax@60
3387 GUIFont *v47; // ebx@64
3388 int v48; // esi@64
3389 GUIWindow w; // [sp+Ch] [bp-110h]@64 3366 GUIWindow w; // [sp+Ch] [bp-110h]@64
3390 GUIWindow right_panel_window; // [sp+60h] [bp-BCh]@13 3367 GUIWindow right_panel_window; // [sp+60h] [bp-BCh]@13
3391 GUIWindow house_window; // [sp+B4h] [bp-68h]@1 3368 GUIWindow house_window; // [sp+B4h] [bp-68h]@1
3392 char *pInString; // [sp+114h] [bp-8h]@12 3369 char *pInString; // [sp+114h] [bp-8h]@12
3393 3370
3399 house_window.uFrameZ = 366; 3376 house_window.uFrameZ = 366;
3400 house_window.DrawTitleText(pFontCreate, 0, 2, 0, pMapStats->pInfos[uHouse_ExitPic].pName, 3); 3377 house_window.DrawTitleText(pFontCreate, 0, 2, 0, pMapStats->pInfos[uHouse_ExitPic].pName, 3);
3401 house_window.uFrameX = 483; 3378 house_window.uFrameX = 483;
3402 house_window.uFrameWidth = 148; 3379 house_window.uFrameWidth = 148;
3403 house_window.uFrameZ = 334; 3380 house_window.uFrameZ = 334;
3404 v2 = pTransitionStrings[uHouse_ExitPic]; 3381 if ( !pTransitionStrings[uHouse_ExitPic] )
3405 if ( !v2 )
3406 { 3382 {
3407 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[411], pMapStats->pInfos[uHouse_ExitPic].pName);//Войти в ^Pv[%s] 3383 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[411], pMapStats->pInfos[uHouse_ExitPic].pName);//Войти в ^Pv[%s]
3408 v2 = pTmpBuf.data(); 3384 house_window.DrawTitleText(pFontCreate, 0, (212 - pFontCreate->CalcTextHeight(pTmpBuf.data(), &house_window, 0, 0)) / 2 + 101, 0, pTmpBuf.data(), 3);
3409 } 3385 return;
3410 house_window.DrawTitleText(pFontCreate, 0, (212 - pFontCreate->CalcTextHeight(v2, &house_window, 0, 0)) / 2 + 101, 0, v2, 3); 3386 }
3387 house_window.DrawTitleText(pFontCreate, 0,
3388 (212 - pFontCreate->CalcTextHeight(pTransitionStrings[uHouse_ExitPic], &house_window, 0, 0)) / 2 + 101, 0, pTransitionStrings[uHouse_ExitPic], 3);
3411 return; 3389 return;
3412 } 3390 }
3413 house_window.uFrameWidth -= 10; 3391 house_window.uFrameWidth -= 10;
3414 house_window.uFrameZ -= 10; 3392 house_window.uFrameZ -= 10;
3415 pNPC = HouseNPCData[(unsigned int)((char *)pDialogueNPCCount + -(dword_591080 != 0) )];//- 1 3393 pNPC = HouseNPCData[(unsigned int)((char *)pDialogueNPCCount + -(dword_591080 != 0) )];//- 1
3424 { 3402 {
3425 if ( pNPC->greet ) 3403 if ( pNPC->greet )
3426 { 3404 {
3427 house_window.uFrameWidth = game_viewport_width; 3405 house_window.uFrameWidth = game_viewport_width;
3428 house_window.uFrameZ = 452; 3406 house_window.uFrameZ = 452;
3429 pInString = (char *)*(&pNPCStats->field_17884 + ((pNPC->uFlags & 3) == 2) + 2 * pNPC->greet); 3407 pInString = pNPCStats->pNPCGreetings[pNPC->greet].pGreetings[((pNPC->uFlags & 3) == 2)];
3408 //pInString = (char *)*(&pNPCStats->field_17884 + ((pNPC->uFlags & 3) == 2) + 2 * pNPC->greet);
3430 pRenderer->GetLeather(8, 352 - (pFontArrus->CalcTextHeight(pInString, &house_window, 13, 0) + 7), 3409 pRenderer->GetLeather(8, 352 - (pFontArrus->CalcTextHeight(pInString, &house_window, 13, 0) + 7),
3431 pIcons_LOD->GetTexture(uTextureID_Leather), pIcons_LOD->GetTexture(uTextureID_Leather)->uTextureHeight 3410 pIcons_LOD->GetTexture(uTextureID_Leather), pIcons_LOD->GetTexture(uTextureID_Leather)->uTextureHeight
3432 - (pFontArrus->CalcTextHeight(pInString, &house_window, 13, 0) + 7)); 3411 - (pFontArrus->CalcTextHeight(pInString, &house_window, 13, 0) + 7));
3433 pRenderer->DrawTextureIndexed(8, 347 - (pFontArrus->CalcTextHeight(pInString, &house_window, 13, 0) + 7), pTexture_591428); 3412 pRenderer->DrawTextureIndexed(8, 347 - (pFontArrus->CalcTextHeight(pInString, &house_window, 13, 0) + 7), pTexture_591428);
3434 pDialogueWindow->DrawText(pFontArrus, 13, 354 - (pFontArrus->CalcTextHeight(pInString, &house_window, 13, 0) + 7), 3413 pDialogueWindow->DrawText(pFontArrus, 13, 354 - (pFontArrus->CalcTextHeight(pInString, &house_window, 13, 0) + 7),
3446 { 3425 {
3447 pButton = right_panel_window.GetControl(i); 3426 pButton = right_panel_window.GetControl(i);
3448 switch ( pButton->msg_param ) 3427 switch ( pButton->msg_param )
3449 { 3428 {
3450 case 19://evt_A 3429 case 19://evt_A
3451 v15 = (char *)pNPCTopics[pNPC->evt_A-1].pTopic; 3430 v15 = (char *)pNPCTopics[pNPC->evt_A].pTopic;
3452 if ( !v15 ) 3431 if ( !v15 )
3453 { 3432 {
3454 pButton->msg_param = 0; 3433 pButton->msg_param = 0;
3455 v15 = ""; 3434 v15 = "";
3456 } 3435 }
3457 strcpy(pButton->pButtonName, v15); 3436 strcpy(pButton->pButtonName, v15);
3458 continue; 3437 continue;
3459 case 20://evt_B 3438 case 20://evt_B
3460 v15 = (char *)pNPCTopics[pNPC->evt_B-1].pTopic; 3439 v15 = (char *)pNPCTopics[pNPC->evt_B].pTopic;
3461 if ( !v15 ) 3440 if ( !v15 )
3462 { 3441 {
3463 pButton->msg_param = 0; 3442 pButton->msg_param = 0;
3464 v15 = ""; 3443 v15 = "";
3465 } 3444 }
3466 if ( uDialogueType != 84 ) 3445 if ( uDialogueType != 84 )
3467 { 3446 {
3468 strcpy(pButton->pButtonName, v15); 3447 strcpy(pButton->pButtonName, v15);
3469 continue;
3470 }
3471 sprintf(pTmpBuf.data(), format_4E2D80, TargetColor(0xE1u, 0xCDu, 0x23u), pItemsTable->pItems[contract_approved].pUnidentifiedName);
3472 sprintf(pTmpBuf2.data(), current_npc_text, pTmpBuf.data());
3473 current_npc_text = pTmpBuf2.data();
3474 strcpy(pButton->pButtonName, v15);
3475 continue;
3476 case 21://evt_C
3477 v15 = (char *)pNPCTopics[pNPC->evt_C-1].pTopic;
3478 if ( !v15 )
3479 {
3480 pButton->msg_param = 0;
3481 v15 = "";
3482 }
3483 strcpy(pButton->pButtonName, v15);
3484 continue;
3485 case 22://evt_D
3486 v15 = (char *)pNPCTopics[pNPC->evt_D-1].pTopic;
3487 if ( !v15 )
3488 {
3489 pButton->msg_param = 0;
3490 v15 = "";
3491 }
3492 strcpy(pButton->pButtonName, v15);
3493 continue;
3494 case 23://evt_E
3495 v15 = (char *)pNPCTopics[pNPC->evt_E-1].pTopic;
3496 if ( !v15 )
3497 {
3498 pButton->msg_param = 0;
3499 v15 = "";
3500 }
3501 strcpy(pButton->pButtonName, v15);
3502 continue;
3503 case 24://evt_F
3504 v15 = (char *)pNPCTopics[pNPC->evt_F-1].pTopic;
3505 if ( !v15 )
3506 {
3507 pButton->msg_param = 0;
3508 v15 = "";
3509 }
3510 strcpy(pButton->pButtonName, v15);
3511 continue;
3512 case 76:
3513 strcpy(pButton->pButtonName, pGlobalTXT_LocalizationStrings[406]);//Нанять
3514 continue;
3515 case 77:
3516 strcpy(pButton->pButtonName, pGlobalTXT_LocalizationStrings[407]);//Подробнее
3517 continue;
3518 case 79:
3519 strcpy(pButton->pButtonName, _4B254D_SkillMasteryTeacher((int)right_panel_window.ptr_1C));
3520 continue;
3521 case 82:
3522 strcpy(pButton->pButtonName, ContractSelectText((int)right_panel_window.ptr_1C));
3523 continue;
3524 case 83:
3525 v29 = pMonsterStats->pInfos[bountyHunting_monster_id_for_hunting].pName;
3526 v31 = *(int *)v29;
3527 sprintfex(pTmpBuf.data(), "\f%05d%s\f%05d", TargetColor(0xFFu, 0xFFu, 0x9Bu), v31, TargetColor(0xFFu, 0xFFu, 0xFFu));
3528 sprintfex(pTmpBuf2.data(), bountyHunting_text, pTmpBuf.data(), 100 * (unsigned __int8)v29[8]);
3529 current_npc_text = pTmpBuf2.data();
3530 strcpy(pButton->pButtonName, "");
3531 continue;
3532 }
3533 if ( pButton->msg_param > 0 && pButton->msg_param < 13 )
3534 {
3535 strcpy(pButton->pButtonName, pGlobalTXT_LocalizationStrings[122]);//Вступить
3536 continue; 3448 continue;
3537 } 3449 }
3538 if ( pButton->msg_param > 13 && pButton->msg_param < 19 ) 3450 sprintf(pTmpBuf.data(), format_4E2D80, TargetColor(0xE1u, 0xCDu, 0x23u), pItemsTable->pItems[contract_approved].pUnidentifiedName);
3539 { 3451 sprintf(pTmpBuf2.data(), current_npc_text, pTmpBuf.data());
3540 strcpy(pButton->pButtonName, ""); 3452 current_npc_text = pTmpBuf2.data();
3541 continue; 3453 strcpy(pButton->pButtonName, v15);
3542 } 3454 continue;
3543 if ( pButton->msg_param != 93 ) 3455 case 21://evt_C
3544 { 3456 v15 = (char *)pNPCTopics[pNPC->evt_C].pTopic;
3545 strcpy(pButton->pButtonName, ""); 3457 if ( !v15 )
3546 continue; 3458 {
3547 } 3459 pButton->msg_param = 0;
3548 } 3460 v15 = "";
3549 v34 = 0; 3461 }
3550 v36 = pDialogueWindow->pStartingPosActiveItem; 3462 strcpy(pButton->pButtonName, v15);
3551 for ( i = v36 + pDialogueWindow->pNumPresenceButton; (signed int)v36 < (signed int)i; i = pDialogueWindow->pNumPresenceButton 3463 continue;
3552 + pDialogueWindow->pStartingPosActiveItem ) 3464 case 22://evt_D
3553 { 3465 v15 = (char *)pNPCTopics[pNPC->evt_D].pTopic;
3554 v37 = pDialogueWindow->GetControl(v36); 3466 if ( !v15 )
3555 v38 = pFontArrus->CalcTextHeight(v37->pButtonName, &right_panel_window, 0, 0); 3467 {
3556 v34 += v38; 3468 pButton->msg_param = 0;
3557 ++v36; 3469 v15 = "";
3558 } 3470 }
3559 v39 = pDialogueWindow->pNumPresenceButton; 3471 strcpy(pButton->pButtonName, v15);
3560 if ( v39 ) 3472 continue;
3561 { 3473 case 23://evt_E
3562 pNPC = (NPCData *)((174 - v34) / v39); 3474 v15 = (char *)pNPCTopics[pNPC->evt_E].pTopic;
3563 if ( (signed int)pNPC > 32 ) 3475 if ( !v15 )
3564 pNPC = (NPCData *)32; 3476 {
3565 pInString = (char *)2; 3477 pButton->msg_param = 0;
3566 v40 = (174 - (signed int)pNPC * v39 - v34) / 2 - (signed int)pNPC / 2 + 138; 3478 v15 = "";
3567 for ( i = pDialogueWindow->pStartingPosActiveItem; i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) 3479 }
3480 strcpy(pButton->pButtonName, v15);
3481 continue;
3482 case 24://evt_F
3483 v15 = (char *)pNPCTopics[pNPC->evt_F].pTopic;
3484 if ( !v15 )
3485 {
3486 pButton->msg_param = 0;
3487 v15 = "";
3488 }
3489 strcpy(pButton->pButtonName, v15);
3490 continue;
3491 case 76:
3492 strcpy(pButton->pButtonName, pGlobalTXT_LocalizationStrings[406]);//Нанять
3493 continue;
3494 case 77:
3495 strcpy(pButton->pButtonName, pGlobalTXT_LocalizationStrings[407]);//Подробнее
3496 continue;
3497 case 79:
3498 strcpy(pButton->pButtonName, _4B254D_SkillMasteryTeacher((int)right_panel_window.ptr_1C));
3499 continue;
3500 case 82:
3501 strcpy(pButton->pButtonName, ContractSelectText((int)right_panel_window.ptr_1C));
3502 continue;
3503 case 83:
3504 v29 = pMonsterStats->pInfos[bountyHunting_monster_id_for_hunting].pName;
3505 v31 = *(int *)v29;
3506 sprintfex(pTmpBuf.data(), "\f%05d%s\f%05d", TargetColor(0xFFu, 0xFFu, 0x9Bu), v31, TargetColor(0xFFu, 0xFFu, 0xFFu));
3507 sprintfex(pTmpBuf2.data(), bountyHunting_text, pTmpBuf.data(), 100 * (unsigned __int8)v29[8]);
3508 current_npc_text = pTmpBuf2.data();
3509 strcpy(pButton->pButtonName, "");
3510 continue;
3511 }
3512 if ( pButton->msg_param > 0 && pButton->msg_param < 13 )
3513 {
3514 strcpy(pButton->pButtonName, pGlobalTXT_LocalizationStrings[122]);//Вступить
3515 continue;
3516 }
3517 if ( pButton->msg_param > 13 && pButton->msg_param < 19 )
3518 {
3519 strcpy(pButton->pButtonName, "");
3520 continue;
3521 }
3522 if ( pButton->msg_param != 93 )
3523 {
3524 strcpy(pButton->pButtonName, "");
3525 continue;
3526 }
3527 }
3528 index = 0;
3529 all_text_height = 0;
3530 for ( int i = pDialogueWindow->pStartingPosActiveItem;
3531 i < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton; ++i )
3532 {
3533 pButton = pDialogueWindow->GetControl(i);
3534 all_text_height += pFontArrus->CalcTextHeight(pButton->pButtonName, &right_panel_window, 0, 0);
3535 index++;
3536 }
3537 if ( index )
3538 {
3539 v36 = (174 - all_text_height) / index;
3540 if ( v36 > 32 )
3541 v36 = 32;
3542 v40 = (174 - v36 * index - all_text_height) / 2 - v36 / 2 + 138;
3543 for ( int i = pDialogueWindow->pStartingPosActiveItem; i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i )
3568 { 3544 {
3569 pButton = pDialogueWindow->GetControl(i); 3545 pButton = pDialogueWindow->GetControl(i);
3570 //v42 = v41; 3546 pButton->uY = v36 + v40;
3571 v43 = pButton->pButtonName; 3547 pTextHeight = pFontArrus->CalcTextHeight(pButton->pButtonName, &right_panel_window, 0, 0);
3572 pButton->uY = (unsigned int)((char *)pNPC + v40); 3548 pButton->uHeight = pTextHeight;
3573 v44 = pFontArrus->CalcTextHeight(pButton->pButtonName, &right_panel_window, 0, 0); 3549 v40 = pButton->uY + pTextHeight - 1;
3574 v45 = pButton->uY;
3575 pButton->uHeight = v44;
3576 v40 = v45 + v44 - 1;
3577 pButton->uW = v40; 3550 pButton->uW = v40;
3578 v46 = TargetColor(0xE1u, 0xCDu, 0x23u); 3551 pTextColor = TargetColor(0xE1u, 0xCDu, 0x23u);
3579 if ( (char *)pDialogueWindow->pCurrentPosActiveItem != pInString ) 3552 if ( pDialogueWindow->pCurrentPosActiveItem != i )
3580 v46 = TargetColor(0xFFu, 0xFFu, 0xFFu); 3553 pTextColor = TargetColor(0xFFu, 0xFFu, 0xFFu);
3581 right_panel_window.DrawTitleText(pFontArrus, 0, v45, v46, v43, 3); 3554 right_panel_window.DrawTitleText(pFontArrus, 0, pButton->uY, pTextColor, pButton->pButtonName, 3);
3582 ++pInString;
3583 } 3555 }
3584 } 3556 }
3585 if ( current_npc_text ) 3557 if ( current_npc_text )
3586 { 3558 {
3587 w.uFrameWidth = 458; 3559 w.uFrameWidth = 458;
3588 w.uFrameZ = 457; 3560 w.uFrameZ = 457;
3589 v47 = pFontArrus; 3561 pTextFont = pFontArrus;
3590 v48 = pFontArrus->CalcTextHeight(current_npc_text, &w, 13, 0) + 7; 3562 pTextHeight = pFontArrus->CalcTextHeight(current_npc_text, &w, 13, 0) + 7;
3591 if ( 352 - v48 < 8 ) 3563 if ( 352 - pTextHeight < 8 )
3592 { 3564 {
3593 v47 = pFontCreate; 3565 pTextFont = pFontCreate;
3594 v48 = pFontCreate->CalcTextHeight(current_npc_text, &w, 13, 0) + 7; 3566 pTextHeight = pFontCreate->CalcTextHeight(current_npc_text, &w, 13, 0) + 7;
3595 } 3567 }
3596 pRenderer->GetLeather(8, 352 - v48, pIcons_LOD->GetTexture(uTextureID_Leather), pIcons_LOD->GetTexture(uTextureID_Leather)->uTextureHeight - v48); 3568 pRenderer->GetLeather(8, 352 - pTextHeight, pIcons_LOD->GetTexture(uTextureID_Leather), pIcons_LOD->GetTexture(uTextureID_Leather)->uTextureHeight - pTextHeight);
3597 pRenderer->DrawTextureIndexed(8, 347 - v48, pTexture_591428); 3569 pRenderer->DrawTextureIndexed(8, 347 - pTextHeight, pTexture_591428);
3598 house_window.DrawText(v47, 13, 354 - v48, 0, FitTextInAWindow(current_npc_text, v47, &w, 13, 0), 0, 0, 0); 3570 house_window.DrawText(pTextFont, 13, 354 - pTextHeight, 0, FitTextInAWindow(current_npc_text, pTextFont, &w, 13, 0), 0, 0, 0);
3599 } 3571 }
3600 } 3572 }
3601 3573
3602 //----- (004B4F4F) -------------------------------------------------------- 3574 //----- (004B4F4F) --------------------------------------------------------
3603 void JailDialog() 3575 void JailDialog()