comparison UI/UIHouses.cpp @ 1653:d453ed393d6e

NPCGreetings
author Ritor1
date Wed, 18 Sep 2013 11:04:47 +0600
parents dbd6f940f26c
children a7eebb6ee7a2 e1d1fe32c194
comparison
equal deleted inserted replaced
1652:42055a4bd550 1653:d453ed393d6e
3230 signed int v3; // esi@1 3230 signed int v3; // esi@1
3231 int pPrice; // ebx@1 3231 int pPrice; // ebx@1
3232 unsigned int v5; // esi@5 3232 unsigned int v5; // esi@5
3233 int v6; // edi@6 3233 int v6; // edi@6
3234 int result; // eax@13 3234 int result; // eax@13
3235 int v12; // eax@20 3235 int all_text_height; // eax@20
3236 int v13; // eax@21 3236 int v13; // eax@21
3237 GUIButton *pButton; // esi@27 3237 GUIButton *pButton; // esi@27
3238 unsigned int v16; // eax@28 3238 unsigned int v16; // eax@28
3239 int pTextHeight; // eax@29 3239 int pTextHeight; // eax@29
3240 unsigned __int16 pTextColor; // ax@29 3240 unsigned __int16 pTextColor; // ax@29
3241 unsigned __int16 v22; // ST14_2@36 3241 unsigned __int16 v22; // ST14_2@36
3242 int v27; // [sp-4h] [bp-80h]@8 3242 int v27; // [sp-4h] [bp-80h]@8
3243 GUIWindow dialog_window; // [sp+Ch] [bp-70h]@1 3243 GUIWindow dialog_window; // [sp+Ch] [bp-70h]@1
3244 int v32; // [sp+6Ch] [bp-10h]@1 3244 int v32; // [sp+6Ch] [bp-10h]@1
3245 int v34; // [sp+74h] [bp-8h]@17 3245 int index; // [sp+74h] [bp-8h]@17
3246 3246
3247 memcpy(&dialog_window, window_SpeakInHouse, sizeof(dialog_window)); 3247 memcpy(&dialog_window, window_SpeakInHouse, sizeof(dialog_window));
3248 dialog_window.uFrameX = 483; 3248 dialog_window.uFrameX = 483;
3249 dialog_window.uFrameWidth = 148; 3249 dialog_window.uFrameWidth = 148;
3250 dialog_window.uFrameZ = 334; 3250 dialog_window.uFrameZ = 334;
3263 pDialogueWindow->pNumPresenceButton = 0; 3263 pDialogueWindow->pNumPresenceButton = 0;
3264 return; 3264 return;
3265 } 3265 }
3266 if ( !HouseUI_CheckIfPlayerCanInteract() ) 3266 if ( !HouseUI_CheckIfPlayerCanInteract() )
3267 return; 3267 return;
3268 v34 = 0; 3268 all_text_height = 0;
3269 index = 0;
3269 for ( int i = pDialogueWindow->pStartingPosActiveItem; 3270 for ( int i = pDialogueWindow->pStartingPosActiveItem;
3270 i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) 3271 i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i )
3271 { 3272 {
3272 if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType / 3][pDialogueWindow->GetControl(i)->msg_param - 36] 3273 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] ) 3274 && !pPlayers[uActiveCharacter]->pActiveSkills[pDialogueWindow->GetControl(i)->msg_param - 36] )
3274 { 3275 {
3275 v12 += pFontArrus->CalcTextHeight(pSkillNames[pDialogueWindow->GetControl(i)->msg_param - 36], &dialog_window, 0, 0); 3276 all_text_height += pFontArrus->CalcTextHeight(pSkillNames[pDialogueWindow->GetControl(i)->msg_param - 36], &dialog_window, 0, 0);
3276 ++v34; 3277 ++index;
3277 } 3278 }
3278 } 3279 }
3279 if ( !v34 ) 3280 if ( !index )
3280 { 3281 {
3281 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]); 3282 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]);
3282 strcat(pTmpBuf.data(), "\n \n"); 3283 strcat(pTmpBuf.data(), "\n \n");
3283 strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]);//Больше ничего не могу предложить. 3284 strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]);//Больше ничего не могу предложить.
3284 pTextHeight = pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 0, 0); 3285 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); 3286 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, TargetColor(0xFFu, 0xFFu, 0x9Bu), pTmpBuf.data(), 3);
3286 return; 3287 return;
3287 } 3288 }
3288 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[401], pPrice);//Стоимость навыка: %lu 3289 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[401], pPrice);//Стоимость навыка: %lu
3289 dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3); 3290 dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3);
3290 v32 = (149 - v12) / v34; 3291 v32 = (149 - all_text_height) / index;
3291 if ( (149 - v12) / v34 > 32 ) 3292 if ( v32 > 32 )
3292 v32 = 32; 3293 v32 = 32;
3293 v34 = (149 - v34 * v32 - v12) / 2 - v32 / 2 + 162; 3294 index = (149 - index * v32 - all_text_height) / 2 - v32 / 2 + 162;
3294 if ( pDialogueWindow->pStartingPosActiveItem < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton ) 3295 if ( pDialogueWindow->pStartingPosActiveItem < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton )
3295 { 3296 {
3296 for ( int i = pDialogueWindow->pStartingPosActiveItem; 3297 for ( int i = pDialogueWindow->pStartingPosActiveItem;
3297 i <pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) 3298 i <pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i )
3298 { 3299 {
3299 pButton = pDialogueWindow->GetControl(i); 3300 pButton = pDialogueWindow->GetControl(i);
3300 if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType / 3][pButton->msg_param - 36] ) 3301 if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType / 3][pButton->msg_param - 36] )
3301 { 3302 {
3302 if ( !pPlayers[uActiveCharacter]->pActiveSkills[pButton->msg_param - 36] ) 3303 if ( !pPlayers[uActiveCharacter]->pActiveSkills[pButton->msg_param - 36] )
3303 { 3304 {
3304 pButton->uY = v32 + v34; 3305 pButton->uY = v32 + index;
3305 pTextHeight = pFontArrus->CalcTextHeight(pSkillNames[pButton->msg_param - 36], &dialog_window, 0, 0); 3306 pTextHeight = pFontArrus->CalcTextHeight(pSkillNames[pButton->msg_param - 36], &dialog_window, 0, 0);
3306 pButton->uHeight = pTextHeight; 3307 pButton->uHeight = pTextHeight;
3307 pButton->uW = pButton->uY + pTextHeight - 1; 3308 pButton->uW = pButton->uY + pTextHeight - 1;
3308 v34 = pButton->uY + pTextHeight - 1; 3309 index = pButton->uY + pTextHeight - 1;
3309 pTextColor = TargetColor(0xFFu, 0xFFu, 0x9Bu); 3310 pTextColor = TargetColor(0xFFu, 0xFFu, 0x9Bu);
3310 if ( pDialogueWindow->pCurrentPosActiveItem != i ) 3311 if ( pDialogueWindow->pCurrentPosActiveItem != i )
3311 pTextColor = TargetColor(0xFFu, 0xFFu, 0xFFu); 3312 pTextColor = TargetColor(0xFFu, 0xFFu, 0xFFu);
3312 dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pTextColor, pSkillNames[pButton->msg_param - 36], 3); 3313 dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pTextColor, pSkillNames[pButton->msg_param - 36], 3);
3313 } 3314 }
3364 } 3365 }
3365 3366
3366 //----- (004B2A74) -------------------------------------------------------- 3367 //----- (004B2A74) --------------------------------------------------------
3367 void SimpleHouseDialog() 3368 void SimpleHouseDialog()
3368 { 3369 {
3369 char *v2; // eax@3
3370 unsigned int i; // eax@5
3371 NPCData *pNPC; // esi@6 3370 NPCData *pNPC; // esi@6
3372 char *v15; // esi@14 3371 char *v15; // esi@14
3373 GUIButton *pButton; // eax@15 3372 GUIButton *pButton; // eax@15
3374 int v18; // ecx@17
3375 char *v29; // esi@42 3373 char *v29; // esi@42
3376 int v31; // ST1C_4@42 3374 int v31; // ST1C_4@42
3377 int v34; // esi@51 3375 int index; // esi@51
3378 unsigned int v36; // edi@51 3376 int v36;
3379 GUIButton *v37; // eax@52 3377 signed int all_text_height; // ecx@54
3380 int v38; // eax@52
3381 signed int v39; // ecx@54
3382 int v40; // edi@57 3378 int v40; // edi@57
3383 const char *v43; // ebx@60 3379 unsigned __int16 pTextColor; // ax@60
3384 int v44; // eax@60 3380 GUIFont *pTextFont; // ebx@64
3385 unsigned int v45; // ecx@60 3381 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 3382 GUIWindow w; // [sp+Ch] [bp-110h]@64
3390 GUIWindow right_panel_window; // [sp+60h] [bp-BCh]@13 3383 GUIWindow right_panel_window; // [sp+60h] [bp-BCh]@13
3391 GUIWindow house_window; // [sp+B4h] [bp-68h]@1 3384 GUIWindow house_window; // [sp+B4h] [bp-68h]@1
3392 char *pInString; // [sp+114h] [bp-8h]@12 3385 char *pInString; // [sp+114h] [bp-8h]@12
3393 3386
3399 house_window.uFrameZ = 366; 3392 house_window.uFrameZ = 366;
3400 house_window.DrawTitleText(pFontCreate, 0, 2, 0, pMapStats->pInfos[uHouse_ExitPic].pName, 3); 3393 house_window.DrawTitleText(pFontCreate, 0, 2, 0, pMapStats->pInfos[uHouse_ExitPic].pName, 3);
3401 house_window.uFrameX = 483; 3394 house_window.uFrameX = 483;
3402 house_window.uFrameWidth = 148; 3395 house_window.uFrameWidth = 148;
3403 house_window.uFrameZ = 334; 3396 house_window.uFrameZ = 334;
3404 v2 = pTransitionStrings[uHouse_ExitPic]; 3397 if ( !pTransitionStrings[uHouse_ExitPic] )
3405 if ( !v2 )
3406 { 3398 {
3407 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[411], pMapStats->pInfos[uHouse_ExitPic].pName);//Войти в ^Pv[%s] 3399 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[411], pMapStats->pInfos[uHouse_ExitPic].pName);//Войти в ^Pv[%s]
3408 v2 = pTmpBuf.data(); 3400 house_window.DrawTitleText(pFontCreate, 0, (212 - pFontCreate->CalcTextHeight(pTmpBuf.data(), &house_window, 0, 0)) / 2 + 101, 0, pTmpBuf.data(), 3);
3409 } 3401 return;
3410 house_window.DrawTitleText(pFontCreate, 0, (212 - pFontCreate->CalcTextHeight(v2, &house_window, 0, 0)) / 2 + 101, 0, v2, 3); 3402 }
3403 house_window.DrawTitleText(pFontCreate, 0,
3404 (212 - pFontCreate->CalcTextHeight(pTransitionStrings[uHouse_ExitPic], &house_window, 0, 0)) / 2 + 101, 0, pTransitionStrings[uHouse_ExitPic], 3);
3411 return; 3405 return;
3412 } 3406 }
3413 house_window.uFrameWidth -= 10; 3407 house_window.uFrameWidth -= 10;
3414 house_window.uFrameZ -= 10; 3408 house_window.uFrameZ -= 10;
3415 pNPC = HouseNPCData[(unsigned int)((char *)pDialogueNPCCount + -(dword_591080 != 0) )];//- 1 3409 pNPC = HouseNPCData[(unsigned int)((char *)pDialogueNPCCount + -(dword_591080 != 0) )];//- 1
3424 { 3418 {
3425 if ( pNPC->greet ) 3419 if ( pNPC->greet )
3426 { 3420 {
3427 house_window.uFrameWidth = game_viewport_width; 3421 house_window.uFrameWidth = game_viewport_width;
3428 house_window.uFrameZ = 452; 3422 house_window.uFrameZ = 452;
3429 pInString = (char *)*(&pNPCStats->field_17884 + ((pNPC->uFlags & 3) == 2) + 2 * pNPC->greet); 3423 pInString = pNPCStats->pNPCGreetings[pNPC->greet].pGreeting[((pNPC->uFlags & 3) == 2)];
3424 //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), 3425 pRenderer->GetLeather(8, 352 - (pFontArrus->CalcTextHeight(pInString, &house_window, 13, 0) + 7),
3431 pIcons_LOD->GetTexture(uTextureID_Leather), pIcons_LOD->GetTexture(uTextureID_Leather)->uTextureHeight 3426 pIcons_LOD->GetTexture(uTextureID_Leather), pIcons_LOD->GetTexture(uTextureID_Leather)->uTextureHeight
3432 - (pFontArrus->CalcTextHeight(pInString, &house_window, 13, 0) + 7)); 3427 - (pFontArrus->CalcTextHeight(pInString, &house_window, 13, 0) + 7));
3433 pRenderer->DrawTextureIndexed(8, 347 - (pFontArrus->CalcTextHeight(pInString, &house_window, 13, 0) + 7), pTexture_591428); 3428 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), 3429 pDialogueWindow->DrawText(pFontArrus, 13, 354 - (pFontArrus->CalcTextHeight(pInString, &house_window, 13, 0) + 7),
3460 v15 = (char *)pNPCTopics[pNPC->evt_B-1].pTopic; 3455 v15 = (char *)pNPCTopics[pNPC->evt_B-1].pTopic;
3461 if ( !v15 ) 3456 if ( !v15 )
3462 { 3457 {
3463 pButton->msg_param = 0; 3458 pButton->msg_param = 0;
3464 v15 = ""; 3459 v15 = "";
3465 } 3460 }
3466 if ( uDialogueType != 84 ) 3461 if ( uDialogueType != 84 )
3467 { 3462 {
3468 strcpy(pButton->pButtonName, v15); 3463 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 < 13 )
3534 {
3535 strcpy(pButton->pButtonName, pGlobalTXT_LocalizationStrings[122]);//Вступить
3536 continue; 3464 continue;
3537 } 3465 }
3538 if ( pButton->msg_param > 13 && pButton->msg_param < 19 ) 3466 sprintf(pTmpBuf.data(), format_4E2D80, TargetColor(0xE1u, 0xCDu, 0x23u), pItemsTable->pItems[contract_approved].pUnidentifiedName);
3539 { 3467 sprintf(pTmpBuf2.data(), current_npc_text, pTmpBuf.data());
3540 strcpy(pButton->pButtonName, ""); 3468 current_npc_text = pTmpBuf2.data();
3541 continue; 3469 strcpy(pButton->pButtonName, v15);
3542 } 3470 continue;
3543 if ( pButton->msg_param != 93 ) 3471 case 21://evt_C
3544 { 3472 v15 = (char *)pNPCTopics[pNPC->evt_C-1].pTopic;
3545 strcpy(pButton->pButtonName, ""); 3473 if ( !v15 )
3546 continue; 3474 {
3547 } 3475 pButton->msg_param = 0;
3548 } 3476 v15 = "";
3549 v34 = 0; 3477 }
3550 v36 = pDialogueWindow->pStartingPosActiveItem; 3478 strcpy(pButton->pButtonName, v15);
3551 for ( i = v36 + pDialogueWindow->pNumPresenceButton; (signed int)v36 < (signed int)i; i = pDialogueWindow->pNumPresenceButton 3479 continue;
3552 + pDialogueWindow->pStartingPosActiveItem ) 3480 case 22://evt_D
3553 { 3481 v15 = (char *)pNPCTopics[pNPC->evt_D-1].pTopic;
3554 v37 = pDialogueWindow->GetControl(v36); 3482 if ( !v15 )
3555 v38 = pFontArrus->CalcTextHeight(v37->pButtonName, &right_panel_window, 0, 0); 3483 {
3556 v34 += v38; 3484 pButton->msg_param = 0;
3557 ++v36; 3485 v15 = "";
3558 } 3486 }
3559 v39 = pDialogueWindow->pNumPresenceButton; 3487 strcpy(pButton->pButtonName, v15);
3560 if ( v39 ) 3488 continue;
3561 { 3489 case 23://evt_E
3562 pNPC = (NPCData *)((174 - v34) / v39); 3490 v15 = (char *)pNPCTopics[pNPC->evt_E-1].pTopic;
3563 if ( (signed int)pNPC > 32 ) 3491 if ( !v15 )
3564 pNPC = (NPCData *)32; 3492 {
3565 pInString = (char *)2; 3493 pButton->msg_param = 0;
3566 v40 = (174 - (signed int)pNPC * v39 - v34) / 2 - (signed int)pNPC / 2 + 138; 3494 v15 = "";
3567 for ( i = pDialogueWindow->pStartingPosActiveItem; i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) 3495 }
3496 strcpy(pButton->pButtonName, v15);
3497 continue;
3498 case 24://evt_F
3499 v15 = (char *)pNPCTopics[pNPC->evt_F-1].pTopic;
3500 if ( !v15 )
3501 {
3502 pButton->msg_param = 0;
3503 v15 = "";
3504 }
3505 strcpy(pButton->pButtonName, v15);
3506 continue;
3507 case 76:
3508 strcpy(pButton->pButtonName, pGlobalTXT_LocalizationStrings[406]);//Нанять
3509 continue;
3510 case 77:
3511 strcpy(pButton->pButtonName, pGlobalTXT_LocalizationStrings[407]);//Подробнее
3512 continue;
3513 case 79:
3514 strcpy(pButton->pButtonName, _4B254D_SkillMasteryTeacher((int)right_panel_window.ptr_1C));
3515 continue;
3516 case 82:
3517 strcpy(pButton->pButtonName, ContractSelectText((int)right_panel_window.ptr_1C));
3518 continue;
3519 case 83:
3520 v29 = pMonsterStats->pInfos[bountyHunting_monster_id_for_hunting].pName;
3521 v31 = *(int *)v29;
3522 sprintfex(pTmpBuf.data(), "\f%05d%s\f%05d", TargetColor(0xFFu, 0xFFu, 0x9Bu), v31, TargetColor(0xFFu, 0xFFu, 0xFFu));
3523 sprintfex(pTmpBuf2.data(), bountyHunting_text, pTmpBuf.data(), 100 * (unsigned __int8)v29[8]);
3524 current_npc_text = pTmpBuf2.data();
3525 strcpy(pButton->pButtonName, "");
3526 continue;
3527 }
3528 if ( pButton->msg_param > 0 && pButton->msg_param < 13 )
3529 {
3530 strcpy(pButton->pButtonName, pGlobalTXT_LocalizationStrings[122]);//Вступить
3531 continue;
3532 }
3533 if ( pButton->msg_param > 13 && pButton->msg_param < 19 )
3534 {
3535 strcpy(pButton->pButtonName, "");
3536 continue;
3537 }
3538 if ( pButton->msg_param != 93 )
3539 {
3540 strcpy(pButton->pButtonName, "");
3541 continue;
3542 }
3543 }
3544 index = 0;
3545 all_text_height = 0;
3546 for ( int i = pDialogueWindow->pStartingPosActiveItem;
3547 i < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton; ++i )
3548 {
3549 pButton = pDialogueWindow->GetControl(i);
3550 all_text_height += pFontArrus->CalcTextHeight(pButton->pButtonName, &right_panel_window, 0, 0);
3551 index++;
3552 }
3553 if ( index )
3554 {
3555 v36 = (174 - all_text_height) / index;
3556 if ( v36 > 32 )
3557 v36 = 32;
3558 v40 = (174 - v36 * index - all_text_height) / 2 - v36 / 2 + 138;
3559 for ( int i = pDialogueWindow->pStartingPosActiveItem; i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i )
3568 { 3560 {
3569 pButton = pDialogueWindow->GetControl(i); 3561 pButton = pDialogueWindow->GetControl(i);
3570 //v42 = v41; 3562 pButton->uY = v36 + v40;
3571 v43 = pButton->pButtonName; 3563 pTextHeight = pFontArrus->CalcTextHeight(pButton->pButtonName, &right_panel_window, 0, 0);
3572 pButton->uY = (unsigned int)((char *)pNPC + v40); 3564 pButton->uHeight = pTextHeight;
3573 v44 = pFontArrus->CalcTextHeight(pButton->pButtonName, &right_panel_window, 0, 0); 3565 v40 = pButton->uY + pTextHeight - 1;
3574 v45 = pButton->uY;
3575 pButton->uHeight = v44;
3576 v40 = v45 + v44 - 1;
3577 pButton->uW = v40; 3566 pButton->uW = v40;
3578 v46 = TargetColor(0xE1u, 0xCDu, 0x23u); 3567 pTextColor = TargetColor(0xE1u, 0xCDu, 0x23u);
3579 if ( (char *)pDialogueWindow->pCurrentPosActiveItem != pInString ) 3568 if ( pDialogueWindow->pCurrentPosActiveItem != i )
3580 v46 = TargetColor(0xFFu, 0xFFu, 0xFFu); 3569 pTextColor = TargetColor(0xFFu, 0xFFu, 0xFFu);
3581 right_panel_window.DrawTitleText(pFontArrus, 0, v45, v46, v43, 3); 3570 right_panel_window.DrawTitleText(pFontArrus, 0, pButton->uY, pTextColor, pButton->pButtonName, 3);
3582 ++pInString;
3583 } 3571 }
3584 } 3572 }
3585 if ( current_npc_text ) 3573 if ( current_npc_text )
3586 { 3574 {
3587 w.uFrameWidth = 458; 3575 w.uFrameWidth = 458;
3588 w.uFrameZ = 457; 3576 w.uFrameZ = 457;
3589 v47 = pFontArrus; 3577 pTextFont = pFontArrus;
3590 v48 = pFontArrus->CalcTextHeight(current_npc_text, &w, 13, 0) + 7; 3578 pTextHeight = pFontArrus->CalcTextHeight(current_npc_text, &w, 13, 0) + 7;
3591 if ( 352 - v48 < 8 ) 3579 if ( 352 - pTextHeight < 8 )
3592 { 3580 {
3593 v47 = pFontCreate; 3581 pTextFont = pFontCreate;
3594 v48 = pFontCreate->CalcTextHeight(current_npc_text, &w, 13, 0) + 7; 3582 pTextHeight = pFontCreate->CalcTextHeight(current_npc_text, &w, 13, 0) + 7;
3595 } 3583 }
3596 pRenderer->GetLeather(8, 352 - v48, pIcons_LOD->GetTexture(uTextureID_Leather), pIcons_LOD->GetTexture(uTextureID_Leather)->uTextureHeight - v48); 3584 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); 3585 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); 3586 house_window.DrawText(pTextFont, 13, 354 - pTextHeight, 0, FitTextInAWindow(current_npc_text, pTextFont, &w, 13, 0), 0, 0, 0);
3599 } 3587 }
3600 } 3588 }
3601 3589
3602 //----- (004B4F4F) -------------------------------------------------------- 3590 //----- (004B4F4F) --------------------------------------------------------
3603 void JailDialog() 3591 void JailDialog()