Mercurial > mm7
comparison UI/UIShops.cpp @ 1741:4b0e19d91505
ArmorShop cleaning(continue)
author | Ritor1 |
---|---|
date | Fri, 27 Sep 2013 17:33:05 +0600 |
parents | 1776d4f033a7 |
children | f305a00a6d98 |
comparison
equal
deleted
inserted
replaced
1740:0155fb9254dd | 1741:4b0e19d91505 |
---|---|
52 for ( int i = 0; i < 4; ++i ) | 52 for ( int i = 0; i < 4; ++i ) |
53 all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0); | 53 all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0); |
54 v103 = (174 - all_text_height) / 4; | 54 v103 = (174 - all_text_height) / 4; |
55 v19 = (174 - 4 * (174 - all_text_height) / 4 - all_text_height) / 2 - (174 - all_text_height) / 4 / 2 + 138; | 55 v19 = (174 - 4 * (174 - all_text_height) / 4 - all_text_height) / 2 - (174 - all_text_height) / 4 / 2 + 138; |
56 pNumString = 0; | 56 pNumString = 0; |
57 for ( uint i = pDialogueWindow->pStartingPosActiveItem; i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) | 57 for ( int i = pDialogueWindow->pStartingPosActiveItem; i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) |
58 { | 58 { |
59 pButton = pDialogueWindow->GetControl(i); | 59 pButton = pDialogueWindow->GetControl(i); |
60 pButton->uY = v103 + v19; | 60 pButton->uY = v103 + v19; |
61 pButton->uHeight = pFontArrus->CalcTextHeight((const char *)pShopOptions[pNumString], &dialog_window, 0, 0); | 61 pButton->uHeight = pFontArrus->CalcTextHeight((const char *)pShopOptions[pNumString], &dialog_window, 0, 0); |
62 v19 = pButton->uY + pFontArrus->CalcTextHeight((const char *)pShopOptions[pNumString], &dialog_window, 0, 0) - 1; | 62 v19 = pButton->uY + pFontArrus->CalcTextHeight((const char *)pShopOptions[pNumString], &dialog_window, 0, 0) - 1; |
92 ++item_num; | 92 ++item_num; |
93 } | 93 } |
94 if ( GetAsyncKeyState(17) && pPlayers[uActiveCharacter]->CanSteal() ) | 94 if ( GetAsyncKeyState(17) && pPlayers[uActiveCharacter]->CanSteal() ) |
95 pText = pGlobalTXT_LocalizationStrings[185];//Украсть предмет | 95 pText = pGlobalTXT_LocalizationStrings[185];//Украсть предмет |
96 else | 96 else |
97 { | |
98 pText = pGlobalTXT_LocalizationStrings[195];//Выберите предмет для покупки | 97 pText = pGlobalTXT_LocalizationStrings[195];//Выберите предмет для покупки |
99 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD) | |
100 pText = pGlobalTXT_LocalizationStrings[196];//Выберите особый предмет для покупки | |
101 } | |
102 DrawTextAtStatusBar(pText, 0); | 98 DrawTextAtStatusBar(pText, 0); |
103 if ( item_num ) | 99 if ( item_num ) |
104 { | 100 { |
105 pMouse->GetCursorPos(&mouse); | 101 pMouse->GetCursorPos(&mouse); |
106 if ( pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF ) | 102 if ( pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF ) |
147 ++item_num; | 143 ++item_num; |
148 } | 144 } |
149 if ( GetAsyncKeyState(17) && pPlayers[uActiveCharacter]->CanSteal() ) | 145 if ( GetAsyncKeyState(17) && pPlayers[uActiveCharacter]->CanSteal() ) |
150 pText = pGlobalTXT_LocalizationStrings[185]; | 146 pText = pGlobalTXT_LocalizationStrings[185]; |
151 else | 147 else |
152 { | |
153 pText = pGlobalTXT_LocalizationStrings[195]; | |
154 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD) | |
155 pText = pGlobalTXT_LocalizationStrings[196]; | 148 pText = pGlobalTXT_LocalizationStrings[196]; |
156 } | |
157 DrawTextAtStatusBar(pText, 0); | 149 DrawTextAtStatusBar(pText, 0); |
158 if ( item_num ) | 150 if ( item_num ) |
159 { | 151 { |
160 pMouse->GetCursorPos(&mouse); | 152 pMouse->GetCursorPos(&mouse); |
161 if ( pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF ) | 153 if ( pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF ) |
262 for ( int i = 0; i < 3; ++i ) | 254 for ( int i = 0; i < 3; ++i ) |
263 all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0); | 255 all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0); |
264 v103 = (174 - all_text_height) / 3; | 256 v103 = (174 - all_text_height) / 3; |
265 v19 = (3 * (58 - (signed int)v103) - all_text_height) / 2 - ((174 - all_text_height) / 3) / 2 + 138; | 257 v19 = (3 * (58 - (signed int)v103) - all_text_height) / 2 - ((174 - all_text_height) / 3) / 2 + 138; |
266 pNumString = 0; | 258 pNumString = 0; |
267 for ( uint i = pDialogueWindow->pStartingPosActiveItem; i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) | 259 for ( int i = pDialogueWindow->pStartingPosActiveItem; i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) |
268 { | 260 { |
269 pButton = pDialogueWindow->GetControl(i); | 261 pButton = pDialogueWindow->GetControl(i); |
270 pButton->uY = v103 + v19; | 262 pButton->uY = v103 + v19; |
271 pButton->uHeight = pFontArrus->CalcTextHeight((const char *)pShopOptions[pNumString], &dialog_window, 0, 0); | 263 pButton->uHeight = pFontArrus->CalcTextHeight((const char *)pShopOptions[pNumString], &dialog_window, 0, 0); |
272 v19 = pButton->uY + pFontArrus->CalcTextHeight((const char *)pShopOptions[pNumString], &dialog_window, 0, 0) - 1; | 264 v19 = pButton->uY + pFontArrus->CalcTextHeight((const char *)pShopOptions[pNumString], &dialog_window, 0, 0) - 1; |
288 all_text_height = 0; | 280 all_text_height = 0; |
289 v32 = (signed __int64)(p2DEvents[(signed int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0); | 281 v32 = (signed __int64)(p2DEvents[(signed int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0); |
290 pPrice = v32 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; | 282 pPrice = v32 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; |
291 if ( pPrice < v32 / 3 ) | 283 if ( pPrice < v32 / 3 ) |
292 pPrice = v32 / 3; | 284 pPrice = v32 / 3; |
293 for ( uint i = pDialogueWindow->pStartingPosActiveItem; | 285 for ( int i = pDialogueWindow->pStartingPosActiveItem; |
294 i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) | 286 i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) |
295 { | 287 { |
296 if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][pDialogueWindow->GetControl(i)->msg_param - 36] | 288 if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][pDialogueWindow->GetControl(i)->msg_param - 36] |
297 && !pPlayers[uActiveCharacter]->pActiveSkills[pDialogueWindow->GetControl(i)->msg_param - 36] ) | 289 && !pPlayers[uActiveCharacter]->pActiveSkills[pDialogueWindow->GetControl(i)->msg_param - 36] ) |
298 { | 290 { |
401 Texture *v64; // ST1C_4@76 | 393 Texture *v64; // ST1C_4@76 |
402 unsigned int v65; // ST18_4@76 | 394 unsigned int v65; // ST18_4@76 |
403 int v66; // eax@76 | 395 int v66; // eax@76 |
404 int v67; // edi@77 | 396 int v67; // edi@77 |
405 signed int v68; // ecx@81 | 397 signed int v68; // ecx@81 |
406 const char *pStatusText; // ecx@91 | 398 const char *pText; // ecx@91 |
407 void *v72; // eax@95 | 399 void *v72; // eax@95 |
408 POINT *v73; // esi@97 | 400 POINT *v73; // esi@97 |
409 int v74; // ecx@97 | 401 int v74; // ecx@97 |
410 int v75; // eax@98 | 402 int v75; // eax@98 |
411 int v76; // ecx@98 | 403 int v76; // ecx@98 |
456 POINT a2; // [sp+24h] [bp-E0h]@8 | 448 POINT a2; // [sp+24h] [bp-E0h]@8 |
457 POINT v132; // [sp+2Ch] [bp-D8h]@120 | 449 POINT v132; // [sp+2Ch] [bp-D8h]@120 |
458 POINT v133; // [sp+34h] [bp-D0h]@17 | 450 POINT v133; // [sp+34h] [bp-D0h]@17 |
459 POINT v134; // [sp+3Ch] [bp-C8h]@97 | 451 POINT v134; // [sp+3Ch] [bp-C8h]@97 |
460 POINT v135; // [sp+44h] [bp-C0h]@31 | 452 POINT v135; // [sp+44h] [bp-C0h]@31 |
461 POINT v136; // [sp+4Ch] [bp-B8h]@97 | 453 POINT mouse; // [sp+4Ch] [bp-B8h]@97 |
462 POINT v137; // [sp+54h] [bp-B0h]@17 | 454 POINT v137; // [sp+54h] [bp-B0h]@17 |
463 POINT v138; // [sp+5Ch] [bp-A8h]@32 | 455 POINT v138; // [sp+5Ch] [bp-A8h]@32 |
464 POINT v139; // [sp+64h] [bp-A0h]@17 | 456 POINT v139; // [sp+64h] [bp-A0h]@17 |
465 POINT v140; // [sp+6Ch] [bp-98h]@31 | 457 POINT v140; // [sp+6Ch] [bp-98h]@31 |
466 POINT v141; // [sp+74h] [bp-90h]@8 | 458 POINT v141; // [sp+74h] [bp-90h]@8 |
467 POINT v142; // [sp+7Ch] [bp-88h]@31 | 459 POINT v142; // [sp+7Ch] [bp-88h]@31 |
468 POINT v143; // [sp+84h] [bp-80h]@9 | 460 POINT v143; // [sp+84h] [bp-80h]@9 |
469 GUIWindow dialog_window; // [sp+8Ch] [bp-78h]@1 | 461 GUIWindow dialog_window; // [sp+8Ch] [bp-78h]@1 |
470 int v146; // [sp+E4h] [bp-20h]@24 | 462 int v146; // [sp+E4h] [bp-20h]@24 |
471 int pYellowColor; // [sp+E8h] [bp-1Ch]@1 | 463 //int pYellowColor; // [sp+E8h] [bp-1Ch]@1 |
472 int pWhiteColor; // [sp+ECh] [bp-18h]@1 | 464 //int pWhiteColor; // [sp+ECh] [bp-18h]@1 |
473 __int32 pItemCount; // [sp+F0h] [bp-14h]@8 | 465 __int32 pItemCount; // [sp+F0h] [bp-14h]@8 |
474 int v152; // [sp+FCh] [bp-8h]@24 | 466 int v152; // [sp+FCh] [bp-8h]@24 |
475 int v153; // [sp+100h] [bp-4h]@44 | 467 int item_x; // [sp+100h] [bp-4h]@44 |
476 int th; | 468 int th; |
477 short text_color; | 469 short text_color; |
478 int pActiveButton; | 470 int pActiveButton; |
479 | 471 |
480 //__debugbreak(); // uishops.cpp(952): warning C4700: uninitialized local variable 'v33' used | |
481 //__debugbreak(); // uishops.cpp(981): warning C4700: uninitialized local variable 'v98' used | |
482 memcpy(&dialog_window, window_SpeakInHouse, sizeof(dialog_window)); | 472 memcpy(&dialog_window, window_SpeakInHouse, sizeof(dialog_window)); |
483 dialog_window.uFrameX = 483; | 473 dialog_window.uFrameX = 483; |
484 dialog_window.uFrameWidth = 148; | 474 dialog_window.uFrameWidth = 148; |
485 dialog_window.uFrameZ = 334; | 475 dialog_window.uFrameZ = 334; |
486 pWhiteColor = TargetColor(0xFFu, 0xFFu, 0xFFu); | |
487 pYellowColor = TargetColor(0xE1u, 0xCDu, 0x23u); | |
488 switch (dialog_menu_id) | 476 switch (dialog_menu_id) |
489 { | 477 { |
490 case HOUSE_DIALOGUE_MAIN: | 478 case HOUSE_DIALOGUE_MAIN: |
491 { | 479 { |
492 if ( !HouseUI_CheckIfPlayerCanInteract() ) | 480 if ( !HouseUI_CheckIfPlayerCanInteract() ) |
499 for( int i = 0; i < 4; ++i ) | 487 for( int i = 0; i < 4; ++i ) |
500 all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0); | 488 all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0); |
501 v146 = ( 174 - all_text_height ) / 4; | 489 v146 = ( 174 - all_text_height ) / 4; |
502 v23 = ( 174 - 4 * ( 174 - all_text_height ) / 4 - all_text_height ) / 2 - ( 174 - all_text_height ) / 4 / 2 + 138; | 490 v23 = ( 174 - 4 * ( 174 - all_text_height ) / 4 - all_text_height ) / 2 - ( 174 - all_text_height ) / 4 / 2 + 138; |
503 pNumString = 0; | 491 pNumString = 0; |
504 if ( pDialogueWindow->pNumPresenceButton>=0 ) | 492 for (int i = pDialogueWindow->pStartingPosActiveItem; |
505 { | 493 i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i) |
506 for (pActiveButton = pDialogueWindow->pStartingPosActiveItem; pActiveButton < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++pActiveButton) | 494 { |
507 { | 495 pButton = pDialogueWindow->GetControl(i); |
508 pButton = pDialogueWindow->GetControl(pActiveButton); | 496 pButton->uY = v146 + v23; |
509 pButton->uY = v146 + v23; | 497 pButton->uHeight = pFontArrus->CalcTextHeight(pShopOptions[pNumString], &dialog_window, 0, 0); |
510 pTextHeight = pFontArrus->CalcTextHeight(pShopOptions[pNumString], &dialog_window, 0, 0); | 498 v23 = pButton->uY + pFontArrus->CalcTextHeight(pShopOptions[pNumString], &dialog_window, 0, 0) - 1; |
511 pButton->uHeight = pTextHeight; | 499 pButton->uW = v23; |
512 v23 = pButton->uY + pButton->uHeight - 1; | 500 pTextColor = TargetColor(0xE1u, 0xCDu, 0x23u); |
513 pButton->uW = v23; | 501 if ( pDialogueWindow->pCurrentPosActiveItem != i ) |
514 pTextColor = pYellowColor; | 502 pTextColor = TargetColor(0xFFu, 0xFFu, 0xFFu); |
515 if ( pDialogueWindow->pCurrentPosActiveItem != pActiveButton ) | 503 dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pTextColor, pShopOptions[pNumString], 3); |
516 pTextColor = pWhiteColor; | 504 ++pNumString; |
517 dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pTextColor, pShopOptions[pNumString], 3); | |
518 ++pNumString; | |
519 } | |
520 } | 505 } |
521 } | 506 } |
522 break; | 507 break; |
508 | |
523 case HOUSE_DIALOGUE_SHOP_BUY_STANDARD: | 509 case HOUSE_DIALOGUE_SHOP_BUY_STANDARD: |
524 { | 510 { |
525 pRenderer->DrawTextureIndexed(8, 8, ShopTexture);// подложка | 511 pRenderer->DrawTextureIndexed(8, 8, ShopTexture);// подложка |
526 textureW = 0; | 512 item_x = 0; |
527 v153 = 0; | |
528 for ( int i = 0; i < 8; ++i )// разместить вещи | 513 for ( int i = 0; i < 8; ++i )// разместить вещи |
529 { | 514 { |
530 if ( pParty->StandartItemsInShops[window_SpeakInHouse->par1C][i].uItemID) | 515 if ( pParty->StandartItemsInShops[window_SpeakInHouse->par1C][i].uItemID) |
531 { | 516 { |
532 textureW = ItemsInShopTexture[i]->uTextureWidth; | |
533 textureH = ItemsInShopTexture[i]->uTextureHeight; | |
534 if ( i >= 4 ) //low row | 517 if ( i >= 4 ) //low row |
535 { | 518 { |
536 v60 = 90 - (textureW/2); | 519 pRenderer->DrawTextureTransparent((90 - (ItemsInShopTexture[i]->uTextureWidth / 2)) + item_x - 420, 126, ItemsInShopTexture[i]); |
537 pRenderer->DrawTextureTransparent(v60 + v153 - 420, 126, ItemsInShopTexture[i]); | 520 v59 = (90 - (ItemsInShopTexture[i]->uTextureWidth / 2)) + item_x + 80220; |
538 v59 = v60 + v153 + 80220; | |
539 } | 521 } |
540 else | 522 else |
541 { | 523 { |
542 pY_item = 98 - textureH; | 524 pRenderer->DrawTextureTransparent(( 86 - (ItemsInShopTexture[i]->uTextureWidth / 2)) + item_x, 98 - ItemsInShopTexture[i]->uTextureHeight, ItemsInShopTexture[i]); |
543 v152 = 86 - (textureW/2); | 525 v59 = item_x + (86 - (ItemsInShopTexture[i]->uTextureWidth / 2)) + 640 * (98 - ItemsInShopTexture[i]->uTextureHeight); |
544 pRenderer->DrawTextureTransparent(v152 + v153, pY_item, ItemsInShopTexture[i]); | |
545 v59 = v153 + v152 + 640 * pY_item; | |
546 } | 526 } |
547 ZBuffer_DoFill(&pRenderer->pActiveZBuffer[v59], ItemsInShopTexture[i], i + 1); | 527 ZBuffer_DoFill(&pRenderer->pActiveZBuffer[v59], ItemsInShopTexture[i], i + 1); |
548 } | 528 } |
549 v153 += 105; | 529 item_x += 105; |
550 } | 530 } |
551 if ( !HouseUI_CheckIfPlayerCanInteract() ) | 531 if ( !HouseUI_CheckIfPlayerCanInteract() ) |
552 return; | 532 return; |
553 pItemCount = 0; | 533 pItemCount = 0; |
554 for ( int i = 0; i < 8; ++i ) | 534 for ( int i = 0; i < 8; ++i ) |
555 { | 535 { |
556 if ( pParty->StandartItemsInShops[window_SpeakInHouse->par1C][i].uItemID ) | 536 if ( pParty->StandartItemsInShops[window_SpeakInHouse->par1C][i].uItemID ) |
557 ++pItemCount; | 537 ++pItemCount; |
558 } | 538 } |
559 if ( GetAsyncKeyState(17) == 0 || pPlayers[uActiveCharacter]->CanSteal() == 0 ) | 539 if ( GetAsyncKeyState(17) == 0 || pPlayers[uActiveCharacter]->CanSteal() == 0 ) |
560 pStatusText = pGlobalTXT_LocalizationStrings[195]; //"Select the Item to Buy" | 540 pText = pGlobalTXT_LocalizationStrings[195]; //"Select the Item to Buy" |
561 else | 541 else |
562 pStatusText = pGlobalTXT_LocalizationStrings[185];//"Steal item" | 542 pText = pGlobalTXT_LocalizationStrings[185];//"Steal item" |
563 DrawTextAtStatusBar(pStatusText, 0); | 543 DrawTextAtStatusBar(pText, 0); |
564 if ( pItemCount != 0 ) | 544 if ( pItemCount ) |
565 { | 545 { |
566 v73 = pMouse->GetCursorPos(&v136); | 546 pMouse->GetCursorPos(&mouse); |
567 v74 = pRenderer->pActiveZBuffer[v73->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v134)->y]] & 0xFFFF; | 547 if ( !(pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF) ) |
568 if ( !v74 ) | |
569 return; | 548 return; |
570 pItemCount = v74 - 1; | 549 selected_item = &pParty->StandartItemsInShops[window_SpeakInHouse->par1C][(pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF) - 1]; |
571 selected_item = &pParty->StandartItemsInShops[window_SpeakInHouse->par1C][v74-1]; | 550 if ( !GetAsyncKeyState(17) || !pPlayers[uActiveCharacter]->CanSteal()) |
572 if ( GetAsyncKeyState(17) == 0 || pPlayers[uActiveCharacter]->CanSteal() == 0) | 551 { |
573 v15 = (char *)pMerchantsBuyPhrases[pPlayers[uActiveCharacter]->SelectPhrasesTransaction(selected_item, BuildingType_ArmorShop, window_SpeakInHouse->par1C, 2)]; | 552 pText = BuildDialogueString((char *)pMerchantsBuyPhrases[pPlayers[uActiveCharacter]->SelectPhrasesTransaction(selected_item, BuildingType_ArmorShop, window_SpeakInHouse->par1C, 2)], |
553 uActiveCharacter - 1, selected_item, (char *)window_SpeakInHouse->ptr_1C, 2, 0); | |
554 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, TargetColor(0xFFu, 0xFFu, 0xFFu), v36, 3); | |
555 } | |
574 else | 556 else |
575 v15 = pGlobalTXT_LocalizationStrings[181]; //"Steal %24" | 557 { |
576 v36 = BuildDialogueString(v15, uActiveCharacter - 1, selected_item, (char *)window_SpeakInHouse->ptr_1C, 2, 0); | 558 pText = BuildDialogueString(pGlobalTXT_LocalizationStrings[181], uActiveCharacter - 1, selected_item, (char *)window_SpeakInHouse->ptr_1C, 2, 0); //"Steal %24" |
577 v115 = (174 - pFontArrus->CalcTextHeight(v36, &dialog_window, 0, 0)) / 2 + 138; | 559 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, TargetColor(0xFFu, 0xFFu, 0xFFu), v36, 3); |
578 dialog_window.DrawTitleText(pFontArrus, 0, v115, pWhiteColor, v36, 3); | 560 } |
579 return; | 561 return; |
580 } | 562 } |
581 dialog_window.DrawCurrentTime( pParty->field_3C.Shops_next_generation_time[window_SpeakInHouse->par1C]- pParty->uTimePlayed); | 563 dialog_window.DrawCurrentTime( pParty->field_3C.Shops_next_generation_time[window_SpeakInHouse->par1C]- pParty->uTimePlayed); |
582 return; | 564 return; |
583 } | 565 } |
584 break; | 566 break; |
567 | |
585 case HOUSE_DIALOGUE_SHOP_BUY_SPECIAL: | 568 case HOUSE_DIALOGUE_SHOP_BUY_SPECIAL: |
586 { | 569 { |
587 pRenderer->DrawTextureIndexed(8, 8, ShopTexture); | 570 pRenderer->DrawTextureIndexed(8, 8, ShopTexture); |
588 v11 = 0; | 571 item_x = 0; |
589 v61 = 0; | 572 for ( int i = 0; i < 8; ++i ) |
590 v153 = 0; | 573 { |
591 do | 574 if ( pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][i].uItemID ) |
592 { | 575 { |
593 if (pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][v61].uItemID) | 576 //v62 = ItemsInShopTexture[i]; |
594 { | 577 if ( i >= 4 ) |
595 v62 = ItemsInShopTexture[v61]; | 578 { |
596 if ( v61 >= 4 ) | 579 //v67 = 90 - ((signed int)ItemsInShopTexture[i]->uTextureWidth / 2); |
597 { | 580 pRenderer->DrawTextureTransparent(item_x + (90 - ((signed int)ItemsInShopTexture[i]->uTextureWidth / 2)) - 420, 126, ItemsInShopTexture[i]); |
598 v67 = 90 - ((signed int)v62->uTextureWidth >> 1); | 581 v66 = item_x + (90 - ((signed int)ItemsInShopTexture[i]->uTextureWidth / 2)) + 80220; |
599 pRenderer->DrawTextureTransparent(v153 + v67 - 420, 0x7Eu, ItemsInShopTexture[v61]); | |
600 v66 = v153 + v67 + 80220; | |
601 } | 582 } |
602 else | 583 else |
603 { | 584 { |
604 v63 = 98 - v62->uTextureHeight; | 585 //v63 = 98 - ItemsInShopTexture[i]->uTextureHeight; |
605 v64 = ItemsInShopTexture[v61]; | 586 //v64 = ItemsInShopTexture[i]; |
606 v65 = 98 - v62->uTextureHeight; | 587 //v65 = 98 - ItemsInShopTexture[i]->uTextureHeight; |
607 v152 = 86 - ((signed int)v62->uTextureWidth >> 1); | 588 //v152 = 86 - ((signed int)ItemsInShopTexture[i]->uTextureWidth / 2); |
608 pRenderer->DrawTextureTransparent(v152 + v153, v65, v64); | 589 pRenderer->DrawTextureTransparent(86 - ((signed int)ItemsInShopTexture[i]->uTextureWidth / 2) + item_x, 98 - ItemsInShopTexture[i]->uTextureHeight, ItemsInShopTexture[i]); |
609 v66 = v152 + v153 + 640 * v63; | 590 v66 = (86 - ((signed int)ItemsInShopTexture[i]->uTextureWidth / 2)) + item_x + 640 * (98 - ItemsInShopTexture[i]->uTextureHeight); |
610 } | 591 } |
611 ZBuffer_DoFill(&pRenderer->pActiveZBuffer[v66], ItemsInShopTexture[v61], v61 + 1); | 592 ZBuffer_DoFill(&pRenderer->pActiveZBuffer[v66], ItemsInShopTexture[i], i + 1); |
612 } | 593 } |
613 v153 += 105; | 594 item_x += 105; |
614 ++v61; | 595 } |
615 } | |
616 while ( v61 < 8 ); | |
617 if ( !HouseUI_CheckIfPlayerCanInteract() ) | 596 if ( !HouseUI_CheckIfPlayerCanInteract() ) |
618 return; | 597 return; |
619 v68 = 0; | 598 v68 = 0; |
620 pItemCount = 0; | 599 pItemCount = 0; |
621 do | 600 do |
624 ++pItemCount; | 603 ++pItemCount; |
625 ++v68; | 604 ++v68; |
626 } | 605 } |
627 while ( v68 < 6 ); | 606 while ( v68 < 6 ); |
628 if ( GetAsyncKeyState(17) == 0 || pPlayers[uActiveCharacter]->CanSteal() == 0 ) | 607 if ( GetAsyncKeyState(17) == 0 || pPlayers[uActiveCharacter]->CanSteal() == 0 ) |
629 pStatusText = pGlobalTXT_LocalizationStrings[196]; //Select the Special Item to Buy" | 608 pText = pGlobalTXT_LocalizationStrings[196]; //Select the Special Item to Buy" |
630 else | 609 else |
631 pStatusText = pGlobalTXT_LocalizationStrings[185]; | 610 pText = pGlobalTXT_LocalizationStrings[185]; |
632 DrawTextAtStatusBar(pStatusText, 0); | 611 DrawTextAtStatusBar(pText, 0); |
633 if ( (char *)pItemCount != 0 ) | 612 if ( (char *)pItemCount != 0 ) |
634 { | 613 { |
635 v73 = pMouse->GetCursorPos(&v136); | 614 pMouse->GetCursorPos(&mouse); |
636 v74 = pRenderer->pActiveZBuffer[v73->x + pSRZBufferLineOffsets[pMouse->GetCursorPos((POINT *)&v134)->y]] & 0xFFFF; | 615 if ( !(pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF) ) |
637 if ( !v74 ) | |
638 return; | 616 return; |
639 pItemCount = v74 - 1; | 617 pItemCount = (pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF) - 1; |
640 if ( dialog_menu_id == 2 ) | 618 if ( dialog_menu_id == 2 ) |
641 selected_item = &pParty->StandartItemsInShops[window_SpeakInHouse->par1C][v74 - 1]; | 619 selected_item = &pParty->StandartItemsInShops[window_SpeakInHouse->par1C][(pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF) - 1]; |
642 else | 620 else |
643 selected_item = &pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][v74 - 1]; | 621 selected_item = &pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][(pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF) - 1]; |
644 if ( GetAsyncKeyState(17) == 0 || pPlayers[uActiveCharacter]->CanSteal() == 0 ) | 622 if ( GetAsyncKeyState(17) == 0 || pPlayers[uActiveCharacter]->CanSteal() == 0 ) |
645 v15 = (char *)pMerchantsBuyPhrases[pPlayers[uActiveCharacter]->SelectPhrasesTransaction(selected_item, BuildingType_ArmorShop, window_SpeakInHouse->par1C, 2)]; | 623 v15 = (char *)pMerchantsBuyPhrases[pPlayers[uActiveCharacter]->SelectPhrasesTransaction(selected_item, BuildingType_ArmorShop, window_SpeakInHouse->par1C, 2)]; |
646 else | 624 else |
647 v15 = pGlobalTXT_LocalizationStrings[181]; //"Steal %24" | 625 v15 = pGlobalTXT_LocalizationStrings[181]; //"Steal %24" |
648 v36 = BuildDialogueString(v15, uActiveCharacter - 1, selected_item, (char *)window_SpeakInHouse->ptr_1C, 2, 0); | 626 v36 = BuildDialogueString(v15, uActiveCharacter - 1, selected_item, (char *)window_SpeakInHouse->ptr_1C, 2, 0); |
649 v115 = (174 - pFontArrus->CalcTextHeight(v36, &dialog_window, 0, 0)) / 2 + 138; | 627 v115 = (174 - pFontArrus->CalcTextHeight(v36, &dialog_window, 0, 0)) / 2 + 138; |
650 dialog_window.DrawTitleText(pFontArrus, 0, v115, pWhiteColor, v36, 3); | 628 dialog_window.DrawTitleText(pFontArrus, 0, v115, TargetColor(0xFFu, 0xFFu, 0xFFu), v36, 3); |
651 return; | 629 return; |
652 } | 630 } |
653 dialog_window.DrawCurrentTime( pParty->field_3C.Shops_next_generation_time[window_SpeakInHouse->par1C]- pParty->uTimePlayed); | 631 dialog_window.DrawCurrentTime( pParty->field_3C.Shops_next_generation_time[window_SpeakInHouse->par1C]- pParty->uTimePlayed); |
654 return; | 632 return; |
655 } | 633 } |
678 pTextHeight = pFontArrus->CalcTextHeight(pShopOptions[pNumString], &dialog_window, 0, 0); | 656 pTextHeight = pFontArrus->CalcTextHeight(pShopOptions[pNumString], &dialog_window, 0, 0); |
679 v90 = pButton->uY; | 657 v90 = pButton->uY; |
680 pButton->uHeight = pTextHeight; | 658 pButton->uHeight = pTextHeight; |
681 v86 = v90 + pTextHeight - 1; | 659 v86 = v90 + pTextHeight - 1; |
682 pButton->uW = v86; | 660 pButton->uW = v86; |
683 pTextColor = pYellowColor; | 661 pTextColor = TargetColor(0xE1u, 0xCDu, 0x23u); |
684 if ( pDialogueWindow->pCurrentPosActiveItem != pActiveButton ) | 662 if ( pDialogueWindow->pCurrentPosActiveItem != pActiveButton ) |
685 pTextColor = pWhiteColor; | 663 pTextColor = TargetColor(0xFFu, 0xFFu, 0xFFu); |
686 dialog_window.DrawTitleText(pFontArrus, 0, v90, pTextColor, pShopOptions[pNumString], 3); | 664 dialog_window.DrawTitleText(pFontArrus, 0, v90, pTextColor, pShopOptions[pNumString], 3); |
687 ++pNumString; | 665 ++pNumString; |
688 ++pActiveButton; | 666 ++pActiveButton; |
689 } | 667 } |
690 while ( (signed int)pActiveButton < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem ); | 668 while ( (signed int)pActiveButton < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem ); |
706 v116 = (ItemGen *)&pPlayers[uActiveCharacter]->pInventoryItemList[v10 - 1]; | 684 v116 = (ItemGen *)&pPlayers[uActiveCharacter]->pInventoryItemList[v10 - 1]; |
707 v13 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(v116, BuildingType_ArmorShop, window_SpeakInHouse->par1C, 3); | 685 v13 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(v116, BuildingType_ArmorShop, window_SpeakInHouse->par1C, 3); |
708 v15 = (char *)pMerchantsSellPhrases[pPlayers[uActiveCharacter]->SelectPhrasesTransaction(v116, BuildingType_ArmorShop, window_SpeakInHouse->par1C, 3)]; | 686 v15 = (char *)pMerchantsSellPhrases[pPlayers[uActiveCharacter]->SelectPhrasesTransaction(v116, BuildingType_ArmorShop, window_SpeakInHouse->par1C, 3)]; |
709 v36 = BuildDialogueString(v15, uActiveCharacter - 1, v116, (char *) window_SpeakInHouse->par1C, 3, 0); | 687 v36 = BuildDialogueString(v15, uActiveCharacter - 1, v116, (char *) window_SpeakInHouse->par1C, 3, 0); |
710 v115 = (174 - pFontArrus->CalcTextHeight(v36, &dialog_window, 0, 0)) / 2 + 138; | 688 v115 = (174 - pFontArrus->CalcTextHeight(v36, &dialog_window, 0, 0)) / 2 + 138; |
711 dialog_window.DrawTitleText(pFontArrus, 0, v115, pWhiteColor, v36, 3); | 689 dialog_window.DrawTitleText(pFontArrus, 0, v115, TargetColor(0xFFu, 0xFFu, 0xFFu), v36, 3); |
712 return; | 690 return; |
713 } | 691 } |
714 break; | 692 break; |
715 case HOUSE_DIALOGUE_SHOP_IDENTIFY: | 693 case HOUSE_DIALOGUE_SHOP_IDENTIFY: |
716 { | 694 { |
736 v8 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(v3, BuildingType_ArmorShop, (int)window_SpeakInHouse->ptr_1C, 4); | 714 v8 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(v3, BuildingType_ArmorShop, (int)window_SpeakInHouse->ptr_1C, 4); |
737 v5 = (char *)pMerchantsIdentifyPhrases[v8]; | 715 v5 = (char *)pMerchantsIdentifyPhrases[v8]; |
738 } | 716 } |
739 v6 = BuildDialogueString(v5, uActiveCharacter - 1, v3, (char *)window_SpeakInHouse->ptr_1C, 4, 0); | 717 v6 = BuildDialogueString(v5, uActiveCharacter - 1, v3, (char *)window_SpeakInHouse->ptr_1C, 4, 0); |
740 v115 = (174 - pFontArrus->CalcTextHeight(v6, &dialog_window, 0, 0)) / 2 + 138; | 718 v115 = (174 - pFontArrus->CalcTextHeight(v6, &dialog_window, 0, 0)) / 2 + 138; |
741 dialog_window.DrawTitleText(pFontArrus, 0, v115, pWhiteColor, v6, 3); | 719 dialog_window.DrawTitleText(pFontArrus, 0, v115, TargetColor(0xFFu, 0xFFu, 0xFFu), v6, 3); |
742 return; | 720 return; |
743 } | 721 } |
744 } | 722 } |
745 } | 723 } |
746 } | 724 } |
764 v116 = &pPlayers[uActiveCharacter]->pInventoryItemList[v32 - 1]; | 742 v116 = &pPlayers[uActiveCharacter]->pInventoryItemList[v32 - 1]; |
765 v35 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(&pPlayers[uActiveCharacter]->pInventoryItemList[v32 - 1], BuildingType_ArmorShop, window_SpeakInHouse->par1C, 5); | 743 v35 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(&pPlayers[uActiveCharacter]->pInventoryItemList[v32 - 1], BuildingType_ArmorShop, window_SpeakInHouse->par1C, 5); |
766 v15 = (char *)pMerchantsRepairPhrases[v35]; | 744 v15 = (char *)pMerchantsRepairPhrases[v35]; |
767 v36 = BuildDialogueString(v15, uActiveCharacter - 1, v116, (char *)window_SpeakInHouse->ptr_1C, 5, 0); | 745 v36 = BuildDialogueString(v15, uActiveCharacter - 1, v116, (char *)window_SpeakInHouse->ptr_1C, 5, 0); |
768 v115 = (174 - pFontArrus->CalcTextHeight(v36, &dialog_window, 0, 0)) / 2 + 138; | 746 v115 = (174 - pFontArrus->CalcTextHeight(v36, &dialog_window, 0, 0)) / 2 + 138; |
769 dialog_window.DrawTitleText(pFontArrus, 0, v115, pWhiteColor, v36, 3); | 747 dialog_window.DrawTitleText(pFontArrus, 0, v115, TargetColor(0xFFu, 0xFFu, 0xFFu), v36, 3); |
770 return; | 748 return; |
771 } | 749 } |
772 break; | 750 break; |
773 case HOUSE_DIALOGUE_SHOP_6: //buy standart ??? | 751 case HOUSE_DIALOGUE_SHOP_6: //buy standart ??? |
774 { | 752 { |
791 v97 = uActiveCharacter - 1; | 769 v97 = uActiveCharacter - 1; |
792 //__debugbreak(); // warning C4700: uninitialized local variable 'v98' used | 770 //__debugbreak(); // warning C4700: uninitialized local variable 'v98' used |
793 v99 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(&pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][v95-1], BuildingType_ArmorShop, window_SpeakInHouse->par1C, 2); | 771 v99 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(&pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][v95-1], BuildingType_ArmorShop, window_SpeakInHouse->par1C, 2); |
794 v100 = BuildDialogueString((char *)pMerchantsBuyPhrases[v99], uActiveCharacter - 1, &pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][v95-1], (char *)window_SpeakInHouse->par1C, 2, 0); | 772 v100 = BuildDialogueString((char *)pMerchantsBuyPhrases[v99], uActiveCharacter - 1, &pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][v95-1], (char *)window_SpeakInHouse->par1C, 2, 0); |
795 v103 = pFontArrus->CalcTextHeight(v100, &dialog_window, 0, 0); | 773 v103 = pFontArrus->CalcTextHeight(v100, &dialog_window, 0, 0); |
796 dialog_window.DrawTitleText(pFontArrus, 0, (174 - v103) / 2 + 138, pWhiteColor, v100, 3); | 774 dialog_window.DrawTitleText(pFontArrus, 0, (174 - v103) / 2 + 138, TargetColor(0xFFu, 0xFFu, 0xFFu), v100, 3); |
797 } | 775 } |
798 v104 = 0; | 776 v104 = 0; |
799 v153 = 0; | 777 int v153 = 0; |
800 do | 778 do |
801 { | 779 { |
802 //if ( pParty->field_C59C[9 * (v104 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] ) | 780 //if ( pParty->field_C59C[9 * (v104 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] ) |
803 if (pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][v104].uItemID) | 781 if (pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][v104].uItemID) |
804 { | 782 { |
840 pActiveButton = v38 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; | 818 pActiveButton = v38 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; |
841 if ( (signed int)pActiveButton < v38 / 3 ) | 819 if ( (signed int)pActiveButton < v38 / 3 ) |
842 pActiveButton = v38 / 3; | 820 pActiveButton = v38 / 3; |
843 v39 = pDialogueWindow->pStartingPosActiveItem; | 821 v39 = pDialogueWindow->pStartingPosActiveItem; |
844 v40 = pDialogueWindow->pNumPresenceButton; | 822 v40 = pDialogueWindow->pNumPresenceButton; |
845 v153 = 0; | 823 int v153 = 0; |
846 if ( (signed int)v39 < (signed int)(v39 + v40) ) | 824 if ( (signed int)v39 < (signed int)(v39 + v40) ) |
847 { | 825 { |
848 do | 826 do |
849 { | 827 { |
850 v41 = pDialogueWindow->GetControl(v39)->msg_param - 36; | 828 v41 = pDialogueWindow->GetControl(v39)->msg_param - 36; |
887 v49 = pButton->uY; | 865 v49 = pButton->uY; |
888 pButton->uHeight = pTextHeight; | 866 pButton->uHeight = pTextHeight; |
889 v51 = v49 + pTextHeight - 1; | 867 v51 = v49 + pTextHeight - 1; |
890 pButton->uW = v51; | 868 pButton->uW = v51; |
891 v146 = v51; | 869 v146 = v51; |
892 pTextColor = pYellowColor; | 870 pTextColor = TargetColor(0xE1u, 0xCDu, 0x23u); |
893 if ( pDialogueWindow->pCurrentPosActiveItem != v153 ) | 871 if ( pDialogueWindow->pCurrentPosActiveItem != v153 ) |
894 pTextColor = pWhiteColor; | 872 pTextColor = TargetColor(0xFFu, 0xFFu, 0xFFu); |
895 dialog_window.DrawTitleText(pFontArrus, 0, v49, pTextColor, pSkillNames[v46], 3); | 873 dialog_window.DrawTitleText(pFontArrus, 0, v49, pTextColor, pSkillNames[v46], 3); |
896 } | 874 } |
897 v53 = pDialogueWindow->pStartingPosActiveItem; | 875 v53 = pDialogueWindow->pStartingPosActiveItem; |
898 ++v152; | 876 ++v152; |
899 textureH = pDialogueWindow->pNumPresenceButton + v53; | 877 textureH = pDialogueWindow->pNumPresenceButton + v53; |
906 } | 884 } |
907 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]); //"Seek knowledge elsewhere %s the %s" | 885 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]); //"Seek knowledge elsewhere %s the %s" |
908 strcat(pTmpBuf.data(), "\n \n"); | 886 strcat(pTmpBuf.data(), "\n \n"); |
909 strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]); //"I can offer you nothing further." | 887 strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]); //"I can offer you nothing further." |
910 v115 = (174 - pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 0, 0)) / 2 + 138; | 888 v115 = (174 - pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 0, 0)) / 2 + 138; |
911 dialog_window.DrawTitleText(pFontArrus, 0, v115, pYellowColor, pTmpBuf.data(), 3); | 889 dialog_window.DrawTitleText(pFontArrus, 0, v115, TargetColor(0xE1u, 0xCDu, 0x23u), pTmpBuf.data(), 3); |
912 return; | 890 return; |
913 } | 891 } |
914 break; | 892 break; |
915 } | 893 } |
916 } | 894 } |