Mercurial > mm7
comparison UI/UIShops.cpp @ 1746:f305a00a6d98
AlchemistDialog() cleared
author | Ritor1 |
---|---|
date | Sun, 29 Sep 2013 21:32:47 +0600 |
parents | 4b0e19d91505 |
children | 19684d4bbe9a 07c7f446a929 |
comparison
equal
deleted
inserted
replaced
1745:9ab644fb39aa | 1746:f305a00a6d98 |
---|---|
339 } | 339 } |
340 | 340 |
341 //----- (004BA928) -------------------------------------------------------- | 341 //----- (004BA928) -------------------------------------------------------- |
342 void ArmorShopDialog() | 342 void ArmorShopDialog() |
343 { | 343 { |
344 signed int v1; // esi@8 | 344 int phrases_id; // eax@20 |
345 unsigned int v2; // eax@10 | |
346 ItemGen *v3; // eax@11 | |
347 char *v5; // ecx@12 | |
348 char *v6; // eax@13 | |
349 int v8; // eax@15 | |
350 signed int v9; // esi@17 | |
351 unsigned int v10; // eax@19 | |
352 char *v11; // edi@19 | |
353 int v12; // ST08_4@20 | |
354 int v13; // eax@20 | |
355 char *v15; // ecx@20 | |
356 char **v16; // edi@22 | |
357 int all_text_height; // ebx@22 | 345 int all_text_height; // ebx@22 |
358 char **v18; // esi@22 | 346 int v146; // [sp+E4h] [bp-20h]@24 |
359 int v19; // eax@23 | |
360 GUIWindow *v20; // ecx@24 | |
361 int v21; // eax@24 | |
362 int v22; // edx@24 | |
363 int v23; // ebx@24 | 347 int v23; // ebx@24 |
364 unsigned __int8 v24; // sf@24 | |
365 GUIButton *pButton; // eax@26 | 348 GUIButton *pButton; // eax@26 |
366 unsigned int v28; // ecx@26 | |
367 int v29; // edx@26 | |
368 signed int v31; // esi@31 | |
369 unsigned int v32; // eax@33 | |
370 //int v33; // eax@34 | |
371 int v35; // eax@35 | |
372 char *v36; // edx@36 | |
373 signed int v38; // esi@42 | 349 signed int v38; // esi@42 |
374 unsigned int v39; // esi@44 | |
375 int v40; // eax@44 | |
376 unsigned int v41; // eax@45 | |
377 int v42; // eax@47 | |
378 int v43; // ecx@52 | |
379 int v46; // eax@54 | |
380 unsigned int v49; // ecx@56 | |
381 int v51; // eax@56 | |
382 int v53; // eax@60 | |
383 int textureH; // eax@60 | |
384 signed int textureW; // ebx@65 | |
385 Texture *v56; // eax@67 | |
386 unsigned int pY_item; // edi@68 | |
387 Texture *v58; // ST1C_4@68 | |
388 int v59; // eax@68 | 350 int v59; // eax@68 |
389 int v60; // edi@69 | |
390 signed int v61; // ebx@73 | |
391 Texture *v62; // eax@75 | |
392 int v63; // edi@76 | |
393 Texture *v64; // ST1C_4@76 | |
394 unsigned int v65; // ST18_4@76 | |
395 int v66; // eax@76 | |
396 int v67; // edi@77 | |
397 signed int v68; // ecx@81 | |
398 const char *pText; // ecx@91 | 351 const char *pText; // ecx@91 |
399 void *v72; // eax@95 | |
400 POINT *v73; // esi@97 | |
401 int v74; // ecx@97 | |
402 int v75; // eax@98 | |
403 int v76; // ecx@98 | |
404 ItemGen *selected_item; // ecx@99 | 352 ItemGen *selected_item; // ecx@99 |
405 unsigned __int8 v78; // bl@104 | |
406 int v80; // ebx@105 | |
407 char **v81; // esi@105 | |
408 int v82; // eax@106 | |
409 int v86; // ebx@107 | |
410 int pTextHeight; // eax@109 | |
411 unsigned int v90; // ecx@109 | |
412 int pNumString; // edx@109 | 353 int pNumString; // edx@109 |
413 unsigned __int16 pTextColor; // ax@109 | 354 unsigned __int16 pTextColor; // ax@109 |
414 signed int v93; // edx@114 | |
415 POINT *v94; // edi@120 | |
416 __int32 v95; // ecx@120 | |
417 void *v96; // ST14_4@122 | |
418 unsigned __int8 v97; // bl@122 | |
419 //ItemGen *v98; // ST10_4@122 | |
420 int v99; // eax@122 | |
421 char *v100; // eax@122 | |
422 const char *v101; // ST18_4@122 | |
423 unsigned __int16 v102; // ST14_2@122 | |
424 int v103; // eax@122 | |
425 signed int v104; // edi@123 | |
426 Texture *v105; // eax@125 | |
427 int v106; // ebx@126 | |
428 unsigned int v108; // ST18_4@126 | |
429 int v109; // eax@126 | |
430 int v110; // ebx@127 | |
431 GUIWindow *v111; // [sp-18h] [bp-11Ch]@36 | |
432 unsigned int v112; // [sp-14h] [bp-118h]@13 | |
433 int v113; // [sp-14h] [bp-118h]@36 | |
434 unsigned int v115; // [sp-10h] [bp-114h]@13 | |
435 ItemGen *v116; // [sp-10h] [bp-114h]@20 | |
436 int v117; // [sp-10h] [bp-114h]@36 | |
437 unsigned __int16 v119; // [sp-Ch] [bp-110h]@13 | |
438 char *v121; // [sp-8h] [bp-10Ch]@13 | |
439 int v122; // [sp-8h] [bp-10Ch]@20 | |
440 unsigned int v123; // [sp-4h] [bp-108h]@13 | |
441 __int64 *v124; // [sp-4h] [bp-108h]@20 | |
442 int v125; // [sp-4h] [bp-108h]@68 | |
443 int v126; // [sp-4h] [bp-108h]@76 | |
444 int v127; // [sp-4h] [bp-108h]@126 | |
445 POINT v128; // [sp+Ch] [bp-F8h]@8 | |
446 POINT v129; // [sp+14h] [bp-F0h]@18 | |
447 char v130; // [sp+1Ch] [bp-E8h]@120 | |
448 POINT a2; // [sp+24h] [bp-E0h]@8 | |
449 POINT v132; // [sp+2Ch] [bp-D8h]@120 | |
450 POINT v133; // [sp+34h] [bp-D0h]@17 | |
451 POINT v134; // [sp+3Ch] [bp-C8h]@97 | |
452 POINT v135; // [sp+44h] [bp-C0h]@31 | |
453 POINT mouse; // [sp+4Ch] [bp-B8h]@97 | 355 POINT mouse; // [sp+4Ch] [bp-B8h]@97 |
454 POINT v137; // [sp+54h] [bp-B0h]@17 | |
455 POINT v138; // [sp+5Ch] [bp-A8h]@32 | |
456 POINT v139; // [sp+64h] [bp-A0h]@17 | |
457 POINT v140; // [sp+6Ch] [bp-98h]@31 | |
458 POINT v141; // [sp+74h] [bp-90h]@8 | |
459 POINT v142; // [sp+7Ch] [bp-88h]@31 | |
460 POINT v143; // [sp+84h] [bp-80h]@9 | |
461 GUIWindow dialog_window; // [sp+8Ch] [bp-78h]@1 | 356 GUIWindow dialog_window; // [sp+8Ch] [bp-78h]@1 |
462 int v146; // [sp+E4h] [bp-20h]@24 | |
463 //int pYellowColor; // [sp+E8h] [bp-1Ch]@1 | |
464 //int pWhiteColor; // [sp+ECh] [bp-18h]@1 | |
465 __int32 pItemCount; // [sp+F0h] [bp-14h]@8 | 357 __int32 pItemCount; // [sp+F0h] [bp-14h]@8 |
466 int v152; // [sp+FCh] [bp-8h]@24 | |
467 int item_x; // [sp+100h] [bp-4h]@44 | 358 int item_x; // [sp+100h] [bp-4h]@44 |
468 int th; | 359 int pPrice; |
469 short text_color; | 360 unsigned int v153; |
470 int pActiveButton; | |
471 | 361 |
472 memcpy(&dialog_window, window_SpeakInHouse, sizeof(dialog_window)); | 362 memcpy(&dialog_window, window_SpeakInHouse, sizeof(dialog_window)); |
473 dialog_window.uFrameX = 483; | 363 dialog_window.uFrameX = 483; |
474 dialog_window.uFrameWidth = 148; | 364 dialog_window.uFrameWidth = 148; |
475 dialog_window.uFrameZ = 334; | 365 dialog_window.uFrameZ = 334; |
549 selected_item = &pParty->StandartItemsInShops[window_SpeakInHouse->par1C][(pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF) - 1]; | 439 selected_item = &pParty->StandartItemsInShops[window_SpeakInHouse->par1C][(pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF) - 1]; |
550 if ( !GetAsyncKeyState(17) || !pPlayers[uActiveCharacter]->CanSteal()) | 440 if ( !GetAsyncKeyState(17) || !pPlayers[uActiveCharacter]->CanSteal()) |
551 { | 441 { |
552 pText = BuildDialogueString((char *)pMerchantsBuyPhrases[pPlayers[uActiveCharacter]->SelectPhrasesTransaction(selected_item, BuildingType_ArmorShop, window_SpeakInHouse->par1C, 2)], | 442 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); | 443 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); | 444 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, TargetColor(0xFFu, 0xFFu, 0xFFu), pText, 3); |
555 } | 445 } |
556 else | 446 else |
557 { | 447 { |
558 pText = BuildDialogueString(pGlobalTXT_LocalizationStrings[181], uActiveCharacter - 1, selected_item, (char *)window_SpeakInHouse->ptr_1C, 2, 0); //"Steal %24" | 448 pText = BuildDialogueString(pGlobalTXT_LocalizationStrings[181], uActiveCharacter - 1, selected_item, (char *)window_SpeakInHouse->ptr_1C, 2, 0); //"Steal %24" |
559 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, TargetColor(0xFFu, 0xFFu, 0xFFu), v36, 3); | 449 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, TargetColor(0xFFu, 0xFFu, 0xFFu), pText, 3); |
560 } | 450 } |
561 return; | 451 return; |
562 } | 452 } |
563 dialog_window.DrawCurrentTime( pParty->field_3C.Shops_next_generation_time[window_SpeakInHouse->par1C]- pParty->uTimePlayed); | 453 dialog_window.DrawCurrentTime( pParty->field_3C.Shops_next_generation_time[window_SpeakInHouse->par1C]- pParty->uTimePlayed); |
564 return; | 454 return; |
571 item_x = 0; | 461 item_x = 0; |
572 for ( int i = 0; i < 8; ++i ) | 462 for ( int i = 0; i < 8; ++i ) |
573 { | 463 { |
574 if ( pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][i].uItemID ) | 464 if ( pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][i].uItemID ) |
575 { | 465 { |
576 //v62 = ItemsInShopTexture[i]; | |
577 if ( i >= 4 ) | 466 if ( i >= 4 ) |
578 { | 467 { |
579 //v67 = 90 - ((signed int)ItemsInShopTexture[i]->uTextureWidth / 2); | |
580 pRenderer->DrawTextureTransparent(item_x + (90 - ((signed int)ItemsInShopTexture[i]->uTextureWidth / 2)) - 420, 126, ItemsInShopTexture[i]); | 468 pRenderer->DrawTextureTransparent(item_x + (90 - ((signed int)ItemsInShopTexture[i]->uTextureWidth / 2)) - 420, 126, ItemsInShopTexture[i]); |
581 v66 = item_x + (90 - ((signed int)ItemsInShopTexture[i]->uTextureWidth / 2)) + 80220; | 469 v59 = item_x + (90 - ((signed int)ItemsInShopTexture[i]->uTextureWidth / 2)) + 80220; |
582 } | 470 } |
583 else | 471 else |
584 { | 472 { |
585 //v63 = 98 - ItemsInShopTexture[i]->uTextureHeight; | |
586 //v64 = ItemsInShopTexture[i]; | |
587 //v65 = 98 - ItemsInShopTexture[i]->uTextureHeight; | |
588 //v152 = 86 - ((signed int)ItemsInShopTexture[i]->uTextureWidth / 2); | |
589 pRenderer->DrawTextureTransparent(86 - ((signed int)ItemsInShopTexture[i]->uTextureWidth / 2) + item_x, 98 - ItemsInShopTexture[i]->uTextureHeight, ItemsInShopTexture[i]); | 473 pRenderer->DrawTextureTransparent(86 - ((signed int)ItemsInShopTexture[i]->uTextureWidth / 2) + item_x, 98 - ItemsInShopTexture[i]->uTextureHeight, ItemsInShopTexture[i]); |
590 v66 = (86 - ((signed int)ItemsInShopTexture[i]->uTextureWidth / 2)) + item_x + 640 * (98 - ItemsInShopTexture[i]->uTextureHeight); | 474 v59 = (86 - ((signed int)ItemsInShopTexture[i]->uTextureWidth / 2)) + item_x + 640 * (98 - ItemsInShopTexture[i]->uTextureHeight); |
591 } | 475 } |
592 ZBuffer_DoFill(&pRenderer->pActiveZBuffer[v66], ItemsInShopTexture[i], i + 1); | 476 ZBuffer_DoFill(&pRenderer->pActiveZBuffer[v59], ItemsInShopTexture[i], i + 1); |
593 } | 477 } |
594 item_x += 105; | 478 item_x += 105; |
595 } | 479 } |
596 if ( !HouseUI_CheckIfPlayerCanInteract() ) | 480 if ( !HouseUI_CheckIfPlayerCanInteract() ) |
597 return; | 481 return; |
598 v68 = 0; | |
599 pItemCount = 0; | 482 pItemCount = 0; |
600 do | 483 for ( uint i = 0; i < 6; ++i ) |
601 { | 484 { |
602 if (pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][(signed int)v68].uItemID) | 485 if (pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][i].uItemID) |
603 ++pItemCount; | 486 ++pItemCount; |
604 ++v68; | 487 } |
605 } | 488 if ( !GetAsyncKeyState(17) || !pPlayers[uActiveCharacter]->CanSteal() ) |
606 while ( v68 < 6 ); | |
607 if ( GetAsyncKeyState(17) == 0 || pPlayers[uActiveCharacter]->CanSteal() == 0 ) | |
608 pText = pGlobalTXT_LocalizationStrings[196]; //Select the Special Item to Buy" | 489 pText = pGlobalTXT_LocalizationStrings[196]; //Select the Special Item to Buy" |
609 else | 490 else |
610 pText = pGlobalTXT_LocalizationStrings[185]; | 491 pText = pGlobalTXT_LocalizationStrings[185]; |
611 DrawTextAtStatusBar(pText, 0); | 492 DrawTextAtStatusBar(pText, 0); |
612 if ( (char *)pItemCount != 0 ) | 493 if ( pItemCount ) |
613 { | 494 { |
614 pMouse->GetCursorPos(&mouse); | 495 pMouse->GetCursorPos(&mouse); |
615 if ( !(pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF) ) | 496 if ( !(pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF) ) |
616 return; | 497 return; |
617 pItemCount = (pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF) - 1; | 498 pItemCount = (pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF) - 1; |
618 if ( dialog_menu_id == 2 ) | 499 if ( dialog_menu_id == 2 ) |
619 selected_item = &pParty->StandartItemsInShops[window_SpeakInHouse->par1C][(pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF) - 1]; | 500 selected_item = &pParty->StandartItemsInShops[window_SpeakInHouse->par1C][(pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF) - 1]; |
620 else | 501 else |
621 selected_item = &pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][(pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF) - 1]; | 502 selected_item = &pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][(pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF) - 1]; |
622 if ( GetAsyncKeyState(17) == 0 || pPlayers[uActiveCharacter]->CanSteal() == 0 ) | 503 if ( !GetAsyncKeyState(17) || !pPlayers[uActiveCharacter]->CanSteal() ) |
623 v15 = (char *)pMerchantsBuyPhrases[pPlayers[uActiveCharacter]->SelectPhrasesTransaction(selected_item, BuildingType_ArmorShop, window_SpeakInHouse->par1C, 2)]; | 504 { |
505 pText = BuildDialogueString((char *)pMerchantsBuyPhrases[pPlayers[uActiveCharacter]->SelectPhrasesTransaction(selected_item, BuildingType_ArmorShop, window_SpeakInHouse->par1C, 2)], | |
506 uActiveCharacter - 1, selected_item, (char *)window_SpeakInHouse->ptr_1C, 2, 0); | |
507 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, TargetColor(0xFFu, 0xFFu, 0xFFu), pText, 3); | |
508 } | |
624 else | 509 else |
625 v15 = pGlobalTXT_LocalizationStrings[181]; //"Steal %24" | 510 { |
626 v36 = BuildDialogueString(v15, uActiveCharacter - 1, selected_item, (char *)window_SpeakInHouse->ptr_1C, 2, 0); | 511 pText = BuildDialogueString(pGlobalTXT_LocalizationStrings[181], uActiveCharacter - 1, selected_item, (char *)window_SpeakInHouse->ptr_1C, 2, 0);//"Steal %24" |
627 v115 = (174 - pFontArrus->CalcTextHeight(v36, &dialog_window, 0, 0)) / 2 + 138; | 512 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, TargetColor(0xFFu, 0xFFu, 0xFFu), pText, 3); |
628 dialog_window.DrawTitleText(pFontArrus, 0, v115, TargetColor(0xFFu, 0xFFu, 0xFFu), v36, 3); | 513 } |
629 return; | 514 return; |
630 } | 515 } |
631 dialog_window.DrawCurrentTime( pParty->field_3C.Shops_next_generation_time[window_SpeakInHouse->par1C]- pParty->uTimePlayed); | 516 dialog_window.DrawCurrentTime( pParty->field_3C.Shops_next_generation_time[window_SpeakInHouse->par1C]- pParty->uTimePlayed); |
632 return; | 517 return; |
633 } | 518 } |
634 break; | 519 break; |
520 | |
635 case HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT: | 521 case HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT: |
636 { | 522 { |
637 draw_leather(); | 523 draw_leather(); |
638 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); | 524 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); |
639 pShopOptions[0] = pGlobalTXT_LocalizationStrings[200]; //"Sell" | 525 pShopOptions[0] = pGlobalTXT_LocalizationStrings[200]; //"Sell" |
640 pShopOptions[1] = pGlobalTXT_LocalizationStrings[113]; //"Identify" | 526 pShopOptions[1] = pGlobalTXT_LocalizationStrings[113]; //"Identify" |
641 pShopOptions[2] = pGlobalTXT_LocalizationStrings[179]; //"Repair" | 527 pShopOptions[2] = pGlobalTXT_LocalizationStrings[179]; //"Repair" |
642 all_text_height = 0; | 528 all_text_height = 0; |
643 for ( int i = 0; i < 3; ++i ) | 529 for ( int i = 0; i < 3; ++i ) |
644 all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0); | 530 all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0); |
645 v152 = (174 - all_text_height) / 3; | 531 v146 = (174 - all_text_height) / 3; |
646 v86 = (3 * (58 - v152) - all_text_height) / 2 - v152 / 2 + 138; | 532 v23 = (3 * (58 - v146) - all_text_height) / 2 - v146 / 2 + 138; |
647 v24 = -pDialogueWindow->pNumPresenceButton < 0; | 533 pNumString = 0; |
648 pActiveButton = pDialogueWindow->pStartingPosActiveItem; | 534 for ( int i = pDialogueWindow->pStartingPosActiveItem; |
649 if ( v24 ^ (pDialogueWindow->pStartingPosActiveItem > pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton) ) | 535 i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) |
650 { | 536 { |
651 pNumString = 0; | 537 pButton = pDialogueWindow->GetControl(i); |
652 do | 538 pButton->uY = v146 + v23; |
653 { | 539 pButton->uHeight = pFontArrus->CalcTextHeight(pShopOptions[pNumString], &dialog_window, 0, 0); |
654 pButton = pDialogueWindow->GetControl((unsigned int)pActiveButton); | 540 v23 = pButton->uY + pFontArrus->CalcTextHeight(pShopOptions[pNumString], &dialog_window, 0, 0) - 1; |
655 pButton->uY = v152 + v86; | 541 pButton->uW = v23; |
656 pTextHeight = pFontArrus->CalcTextHeight(pShopOptions[pNumString], &dialog_window, 0, 0); | 542 pTextColor = TargetColor(0xE1u, 0xCDu, 0x23u); |
657 v90 = pButton->uY; | 543 if ( pDialogueWindow->pCurrentPosActiveItem != i ) |
658 pButton->uHeight = pTextHeight; | 544 pTextColor = TargetColor(0xFFu, 0xFFu, 0xFFu); |
659 v86 = v90 + pTextHeight - 1; | 545 dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pTextColor, pShopOptions[pNumString], 3); |
660 pButton->uW = v86; | 546 ++pNumString; |
661 pTextColor = TargetColor(0xE1u, 0xCDu, 0x23u); | |
662 if ( pDialogueWindow->pCurrentPosActiveItem != pActiveButton ) | |
663 pTextColor = TargetColor(0xFFu, 0xFFu, 0xFFu); | |
664 dialog_window.DrawTitleText(pFontArrus, 0, v90, pTextColor, pShopOptions[pNumString], 3); | |
665 ++pNumString; | |
666 ++pActiveButton; | |
667 } | |
668 while ( (signed int)pActiveButton < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem ); | |
669 } | 547 } |
670 return; | 548 return; |
671 } | 549 } |
672 break; | 550 break; |
551 | |
673 case HOUSE_DIALOGUE_SHOP_SELL: | 552 case HOUSE_DIALOGUE_SHOP_SELL: |
674 { | 553 { |
675 draw_leather(); | 554 draw_leather(); |
676 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); | 555 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); |
677 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[199], 0);//"Select the Item to Sell" | 556 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[199], 0);//"Select the Item to Sell" |
678 if ( !HouseUI_CheckIfPlayerCanInteract()) | 557 if ( !HouseUI_CheckIfPlayerCanInteract()) |
679 return; | 558 return; |
680 if((v9 = pMouse->GetCursorPos(&v139)->x - 14, pItemCount = (v9 >> 5) + 14 * ((pMouse->GetCursorPos(&v133)->y - 17) >> 5), | 559 pMouse->GetCursorPos(&mouse); |
681 pMouse->GetCursorPos(&v137)->x <= 13) || pMouse->GetCursorPos(&v129)->x >= 462 | 560 v153 = ((mouse.x - 14) >> 5) + 14 * ((mouse.y - 17) >> 5); |
682 || (v10 = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&pItemCount), v11 = 0, !v10) ) | 561 if ( mouse.x <= 13 || mouse.x >= 462 ) |
562 return; | |
563 if ( !pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v153) ) | |
683 return; | 564 return; |
684 v116 = (ItemGen *)&pPlayers[uActiveCharacter]->pInventoryItemList[v10 - 1]; | 565 selected_item = &pPlayers[uActiveCharacter]->pInventoryItemList[pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v153) - 1]; |
685 v13 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(v116, BuildingType_ArmorShop, window_SpeakInHouse->par1C, 3); | 566 pText = BuildDialogueString((char *)pMerchantsSellPhrases[pPlayers[uActiveCharacter]->SelectPhrasesTransaction(selected_item, BuildingType_ArmorShop, window_SpeakInHouse->par1C, 3)], |
686 v15 = (char *)pMerchantsSellPhrases[pPlayers[uActiveCharacter]->SelectPhrasesTransaction(v116, BuildingType_ArmorShop, window_SpeakInHouse->par1C, 3)]; | 567 uActiveCharacter - 1, selected_item, (char *) window_SpeakInHouse->par1C, 3, 0); |
687 v36 = BuildDialogueString(v15, uActiveCharacter - 1, v116, (char *) window_SpeakInHouse->par1C, 3, 0); | 568 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, TargetColor(0xFFu, 0xFFu, 0xFFu), pText, 3); |
688 v115 = (174 - pFontArrus->CalcTextHeight(v36, &dialog_window, 0, 0)) / 2 + 138; | |
689 dialog_window.DrawTitleText(pFontArrus, 0, v115, TargetColor(0xFFu, 0xFFu, 0xFFu), v36, 3); | |
690 return; | 569 return; |
691 } | 570 } |
692 break; | 571 break; |
693 case HOUSE_DIALOGUE_SHOP_IDENTIFY: | 572 case HOUSE_DIALOGUE_SHOP_IDENTIFY: |
694 { | 573 { |
695 draw_leather(); | 574 draw_leather(); |
696 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); | 575 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); |
697 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[197], 0); //"Select the Item to Identify" | 576 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[197], 0); //"Select the Item to Identify" |
698 if ( HouseUI_CheckIfPlayerCanInteract() ) | 577 if ( HouseUI_CheckIfPlayerCanInteract() ) |
699 { | 578 { |
700 v1 = pMouse->GetCursorPos(&a2)->x - 14; | 579 pMouse->GetCursorPos(&mouse); |
701 pItemCount = (v1 >> 5) + 14 * ((pMouse->GetCursorPos(&v128)->y - 17) >> 5); | 580 v153 = ((mouse.x - 14) >> 5) + 14 * ((mouse.y - 17) >> 5); |
702 if ( pMouse->GetCursorPos(&v141)->x > 13 ) | 581 if ( mouse.x > 13 && mouse.x < 462 ) |
703 { | 582 { |
704 if ( pMouse->GetCursorPos(&v143)->x < 462 ) | 583 if ( pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v153) ) |
705 { | 584 { |
706 v2 = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&pItemCount); | 585 selected_item = &pPlayers[uActiveCharacter]->pInventoryItemList[pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v153)-1]; |
707 if ( v2 ) | 586 if (selected_item->IsIdentified()) |
708 { | 587 pText = BuildDialogueString("%24", uActiveCharacter - 1, selected_item, (char *)window_SpeakInHouse->ptr_1C, 4, 0); |
709 v3 = (ItemGen *)&pPlayers[uActiveCharacter]->pInventoryItemList[v2-1]; | 588 else |
710 if (v3->IsIdentified()) | 589 pText = BuildDialogueString((char *)pMerchantsIdentifyPhrases[pPlayers[uActiveCharacter]->SelectPhrasesTransaction(selected_item, BuildingType_ArmorShop, |
711 v5 = "%24"; | 590 (int)window_SpeakInHouse->ptr_1C, 4)], uActiveCharacter - 1, selected_item, (char *)window_SpeakInHouse->ptr_1C, 4, 0); |
712 else | 591 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, TargetColor(0xFFu, 0xFFu, 0xFFu), pText, 3); |
713 { | 592 return; |
714 v8 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(v3, BuildingType_ArmorShop, (int)window_SpeakInHouse->ptr_1C, 4); | |
715 v5 = (char *)pMerchantsIdentifyPhrases[v8]; | |
716 } | |
717 v6 = BuildDialogueString(v5, uActiveCharacter - 1, v3, (char *)window_SpeakInHouse->ptr_1C, 4, 0); | |
718 v115 = (174 - pFontArrus->CalcTextHeight(v6, &dialog_window, 0, 0)) / 2 + 138; | |
719 dialog_window.DrawTitleText(pFontArrus, 0, v115, TargetColor(0xFFu, 0xFFu, 0xFFu), v6, 3); | |
720 return; | |
721 } | |
722 } | 593 } |
723 } | 594 } |
724 } | 595 } |
725 } | 596 } |
726 break; | 597 break; |
729 draw_leather(); | 600 draw_leather(); |
730 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); | 601 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); |
731 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[198], 0); | 602 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[198], 0); |
732 if ( !HouseUI_CheckIfPlayerCanInteract()) | 603 if ( !HouseUI_CheckIfPlayerCanInteract()) |
733 return; | 604 return; |
734 if( (v31 = pMouse->GetCursorPos(&v135)->x - 14, | 605 pMouse->GetCursorPos(&mouse); |
735 pItemCount = (v31 >> 5) + 14 * ((pMouse->GetCursorPos(&v142)->y - 17) >> 5), | 606 v153 = ((mouse.x -14) >> 5) + 14 * ((mouse.y - 17) >> 5); |
736 pMouse->GetCursorPos(&v140)->x <= 13) | 607 if( mouse.x <= 13 || mouse.x >= 462 ) |
737 || pMouse->GetCursorPos(&v138)->x >= 462 | 608 return; |
738 || (v32 = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&pItemCount), v11 = 0, !v32) | 609 if ( !pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v153) |
739 || (!(pPlayers[uActiveCharacter]->pOwnItems[v32-1].uAttributes& 2)) ) | 610 || (!(pPlayers[uActiveCharacter]->pOwnItems[pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v153) - 1].uAttributes& 2)) ) |
740 return; | 611 return; |
741 //__debugbreak(); // warning C4700: uninitialized local variable 'v33' used | 612 selected_item = &pPlayers[uActiveCharacter]->pInventoryItemList[pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v153) - 1]; |
742 v116 = &pPlayers[uActiveCharacter]->pInventoryItemList[v32 - 1]; | 613 phrases_id = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(&pPlayers[uActiveCharacter]->pInventoryItemList[pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v153) - 1], |
743 v35 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(&pPlayers[uActiveCharacter]->pInventoryItemList[v32 - 1], BuildingType_ArmorShop, window_SpeakInHouse->par1C, 5); | 614 BuildingType_ArmorShop, window_SpeakInHouse->par1C, 5); |
744 v15 = (char *)pMerchantsRepairPhrases[v35]; | 615 pText = BuildDialogueString((char *)pMerchantsRepairPhrases[phrases_id], uActiveCharacter - 1, selected_item, (char *)window_SpeakInHouse->ptr_1C, 5, 0); |
745 v36 = BuildDialogueString(v15, uActiveCharacter - 1, v116, (char *)window_SpeakInHouse->ptr_1C, 5, 0); | 616 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, TargetColor(0xFFu, 0xFFu, 0xFFu), pText, 3); |
746 v115 = (174 - pFontArrus->CalcTextHeight(v36, &dialog_window, 0, 0)) / 2 + 138; | |
747 dialog_window.DrawTitleText(pFontArrus, 0, v115, TargetColor(0xFFu, 0xFFu, 0xFFu), v36, 3); | |
748 return; | 617 return; |
749 } | 618 } |
750 break; | 619 break; |
751 case HOUSE_DIALOGUE_SHOP_6: //buy standart ??? | 620 |
752 { | |
753 pRenderer->DrawTextureIndexed(8u, 8u, ShopTexture); | |
754 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[195], 0); //"Select the Item to Buy" | |
755 if ( !HouseUI_CheckIfPlayerCanInteract() ) | |
756 return; | |
757 pItemCount = 0; | |
758 for( int i = 0; i < 6 ; ++i ) | |
759 if (pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][i].uItemID) | |
760 ++pItemCount; | |
761 if ( pItemCount ) | |
762 { | |
763 v94 = pMouse->GetCursorPos(&v132); | |
764 pItemCount = pRenderer->pActiveZBuffer[v94->x + pSRZBufferLineOffsets[pMouse->GetCursorPos((POINT *)&v130)->y]]; | |
765 v95 = pItemCount; | |
766 if ( pItemCount && pItemCount != -65536 ) | |
767 { | |
768 --pItemCount; | |
769 v97 = uActiveCharacter - 1; | |
770 //__debugbreak(); // warning C4700: uninitialized local variable 'v98' used | |
771 v99 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(&pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][v95-1], BuildingType_ArmorShop, window_SpeakInHouse->par1C, 2); | |
772 v100 = BuildDialogueString((char *)pMerchantsBuyPhrases[v99], uActiveCharacter - 1, &pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][v95-1], (char *)window_SpeakInHouse->par1C, 2, 0); | |
773 v103 = pFontArrus->CalcTextHeight(v100, &dialog_window, 0, 0); | |
774 dialog_window.DrawTitleText(pFontArrus, 0, (174 - v103) / 2 + 138, TargetColor(0xFFu, 0xFFu, 0xFFu), v100, 3); | |
775 } | |
776 v104 = 0; | |
777 int v153 = 0; | |
778 do | |
779 { | |
780 //if ( pParty->field_C59C[9 * (v104 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] ) | |
781 if (pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][v104].uItemID) | |
782 { | |
783 v105 = ItemsInShopTexture[v104]; | |
784 if ( v104 >= 4 ) | |
785 { | |
786 v110 = 90 - ((signed int)v105->uTextureWidth >> 1); | |
787 pRenderer->DrawTextureTransparent(v153 + v110 - 420, 0x7Eu, ItemsInShopTexture[v104]); | |
788 v127 = v104 + 1; | |
789 v109 = v153 + v110 + 80220; | |
790 } | |
791 else | |
792 { | |
793 v106 = 98 - v105->uTextureHeight; | |
794 v108 = 98 - v105->uTextureHeight; | |
795 v152 = 86 - ((signed int)v105->uTextureWidth >> 1); | |
796 pRenderer->DrawTextureTransparent(v152 + v153, v108, ItemsInShopTexture[v104]); | |
797 v127 = v104 + 1; | |
798 v109 = v152 + v153 + 640 * v106; | |
799 } | |
800 ZBuffer_DoFill(&pRenderer->pActiveZBuffer[v109], ItemsInShopTexture[v104], v127); | |
801 } | |
802 v153 += 105; | |
803 ++v104; | |
804 } | |
805 while ( v104 < 8 ); | |
806 return; | |
807 } | |
808 dialog_window.DrawCurrentTime(pParty->field_3C.Shops_next_generation_time[window_SpeakInHouse->par1C]- pParty->uTimePlayed); | |
809 return; | |
810 } | |
811 break; | |
812 case HOUSE_DIALOGUE_LEARN_SKILLS: | 621 case HOUSE_DIALOGUE_LEARN_SKILLS: |
813 { | 622 { |
814 if (!HouseUI_CheckIfPlayerCanInteract() ) | 623 if (!HouseUI_CheckIfPlayerCanInteract() ) |
815 return; | 624 return; |
816 v152 = 0; | 625 uint item_num = 0; |
817 v38 = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0); | 626 v38 = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0); |
818 pActiveButton = v38 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; | 627 pPrice = v38 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; |
819 if ( (signed int)pActiveButton < v38 / 3 ) | 628 if ( (signed int)pPrice < v38 / 3 ) |
820 pActiveButton = v38 / 3; | 629 pPrice = v38 / 3; |
821 v39 = pDialogueWindow->pStartingPosActiveItem; | 630 all_text_height = 0; |
822 v40 = pDialogueWindow->pNumPresenceButton; | 631 for ( int i = pDialogueWindow->pStartingPosActiveItem; |
823 int v153 = 0; | 632 i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) |
824 if ( (signed int)v39 < (signed int)(v39 + v40) ) | 633 { |
825 { | 634 if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][pDialogueWindow->GetControl(i)->msg_param - 36] |
826 do | 635 && !pPlayers[uActiveCharacter]->pActiveSkills[pDialogueWindow->GetControl(i)->msg_param - 36] ) |
827 { | 636 { |
828 v41 = pDialogueWindow->GetControl(v39)->msg_param - 36; | 637 all_text_height += pFontArrus->CalcTextHeight(pSkillNames[pDialogueWindow->GetControl(i)->msg_param - 36], &dialog_window, 0, 0); |
829 if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][v41] && !pPlayers[uActiveCharacter]->pActiveSkills[v41] ) | 638 item_num ++; |
830 { | 639 } |
831 v42 = pFontArrus->CalcTextHeight(pSkillNames[v41], &dialog_window, 0, 0); | 640 } |
832 v152 += v42; | 641 if ( item_num ) |
833 ++v153; | 642 { |
834 } | 643 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[401], pPrice); |
835 ++v39; | 644 dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3); |
836 } | 645 v146 = (149 - all_text_height) / item_num; |
837 while ( (signed int)v39 < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem ); | 646 if ( (149 - all_text_height) / item_num > 32 ) |
838 if ( v153 ) | 647 v146 = 32; |
839 { | 648 v23 = (149 - v146 * item_num - all_text_height) / 2 - v146 / 2 + 162; |
840 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[401], pActiveButton); | 649 for ( int i = pDialogueWindow->pStartingPosActiveItem; |
841 dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3); | 650 i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) |
842 pActiveButton = (149 - v152) / v153; | 651 { |
843 if ( (149 - v152) / v153 > 32 ) | 652 pButton = pDialogueWindow->GetControl(i); |
844 pActiveButton = 32; | 653 if ( !byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][pButton->msg_param - 36] |
845 v43 = (149 - v153 * (signed int)pActiveButton - v152) / 2 - (signed int)pActiveButton / 2 + 162; | 654 || pPlayers[uActiveCharacter]->pActiveSkills[pButton->msg_param - 36] ) |
846 v152 = pDialogueWindow->pStartingPosActiveItem; | 655 { |
847 v146 = v43; | 656 pButton->uW = 0; |
848 if ( v152 < v152 + pDialogueWindow->pNumPresenceButton ) | 657 pButton->uHeight = 0; |
849 { | 658 pButton->uY = 0; |
850 v153 = 2; | 659 } |
851 do | 660 else |
852 { | 661 { |
853 pButton = pDialogueWindow->GetControl(v152); | 662 pButton->uY = v146 + v23; |
854 v46 = pButton->msg_param - 36; | 663 pButton->uHeight = pFontArrus->CalcTextHeight(pSkillNames[pButton->msg_param - 36], &dialog_window, 0, 0); |
855 if ( !byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][v46] || pPlayers[uActiveCharacter]->pActiveSkills[v46] ) | 664 v23 = pButton->uY + pFontArrus->CalcTextHeight(pSkillNames[pButton->msg_param - 36], &dialog_window, 0, 0) - 1; |
856 { | 665 pButton->uW = v23; |
857 pButton->uW = 0; | 666 pTextColor = TargetColor(0xE1u, 0xCDu, 0x23u); |
858 pButton->uHeight = 0; | 667 if ( pDialogueWindow->pCurrentPosActiveItem != i ) |
859 pButton->uY = 0; | 668 pTextColor = TargetColor(0xFFu, 0xFFu, 0xFFu); |
860 } | 669 dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pTextColor, pSkillNames[pButton->msg_param - 36], 3); |
861 else | 670 } |
862 { | 671 } |
863 pButton->uY = (unsigned int)((char *)pActiveButton + v146); | 672 return; |
864 pTextHeight = pFontArrus->CalcTextHeight(pSkillNames[v46], &dialog_window, 0, 0); | |
865 v49 = pButton->uY; | |
866 pButton->uHeight = pTextHeight; | |
867 v51 = v49 + pTextHeight - 1; | |
868 pButton->uW = v51; | |
869 v146 = v51; | |
870 pTextColor = TargetColor(0xE1u, 0xCDu, 0x23u); | |
871 if ( pDialogueWindow->pCurrentPosActiveItem != v153 ) | |
872 pTextColor = TargetColor(0xFFu, 0xFFu, 0xFFu); | |
873 dialog_window.DrawTitleText(pFontArrus, 0, v49, pTextColor, pSkillNames[v46], 3); | |
874 } | |
875 v53 = pDialogueWindow->pStartingPosActiveItem; | |
876 ++v152; | |
877 textureH = pDialogueWindow->pNumPresenceButton + v53; | |
878 ++v153; | |
879 } | |
880 while ( v152 < textureH ); | |
881 } | |
882 return; | |
883 } | |
884 } | 673 } |
885 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]); //"Seek knowledge elsewhere %s the %s" | 674 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]); //"Seek knowledge elsewhere %s the %s" |
886 strcat(pTmpBuf.data(), "\n \n"); | 675 strcat(pTmpBuf.data(), "\n \n"); |
887 strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]); //"I can offer you nothing further." | 676 strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]); //"I can offer you nothing further." |
888 v115 = (174 - pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 0, 0)) / 2 + 138; | 677 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 0, 0)) / 2 + 138, TargetColor(0xE1u, 0xCDu, 0x23u), pTmpBuf.data(), 3); |
889 dialog_window.DrawTitleText(pFontArrus, 0, v115, TargetColor(0xE1u, 0xCDu, 0x23u), pTmpBuf.data(), 3); | |
890 return; | 678 return; |
891 } | 679 } |
892 break; | 680 break; |
681 default: | |
682 __debugbreak(); | |
893 } | 683 } |
894 } | 684 } |
895 //----- (004B9CC6) -------------------------------------------------------- | 685 //----- (004B9CC6) -------------------------------------------------------- |
896 void AlchemistDialog() | 686 void AlchemistDialog() |
897 { | 687 { |
898 int v0; | 688 int index; // eax@7 |
899 int pNumActiveItem; // eax@7 | |
900 signed int v5; // esi@9 | 689 signed int v5; // esi@9 |
901 unsigned int v6; // esi@11 | |
902 int v7; // eax@11 | |
903 unsigned int v8; // eax@12 | |
904 int v9; // eax@14 | |
905 int v10; // ecx@19 | |
906 int v13; // eax@21 | |
907 char *v14; // eax@23 | |
908 int v15; // eax@23 | |
909 unsigned int v16; // ecx@23 | |
910 int v17; // edx@23 | |
911 int v18; // eax@23 | 690 int v18; // eax@23 |
912 int v20; // eax@27 | 691 char *pText; // edx@29 |
913 char *v21; // edx@29 | |
914 int v22; // esi@30 | |
915 char **v23; // edi@30 | |
916 int v24; // eax@31 | |
917 int v26; // edx@32 | |
918 int v27; // edi@32 | |
919 unsigned __int8 v28; // sf@32 | |
920 const char **v30; // eax@34 | |
921 int v31; // eax@34 | |
922 unsigned int v32; // ecx@34 | |
923 int v34; // eax@34 | |
924 signed int v36; // esi@39 | |
925 ItemGen *v37; // eax@42 | |
926 char *v38; // ecx@43 | |
927 unsigned __int8 v39; // dl@44 | |
928 int v40; // eax@46 | |
929 int v41; // ST08_4@47 | |
930 int v42; // eax@47 | |
931 signed int v43; // esi@49 | |
932 int v44; // ST08_4@52 | |
933 int v45; // eax@52 | |
934 Texture *v46; // ecx@55 | |
935 unsigned int v47; // edi@55 | 692 unsigned int v47; // edi@55 |
936 unsigned int v48; // esi@57 | 693 unsigned int v48; // esi@57 |
937 int v49; // edx@61 | |
938 Texture *v50; // ecx@67 | |
939 unsigned int v51; // edi@67 | 694 unsigned int v51; // edi@67 |
940 unsigned int v52; // esi@69 | 695 unsigned int v52; // esi@69 |
941 int v53; // edx@73 | 696 ItemGen *item; // esi@118 |
942 Texture *v54; // ecx@79 | |
943 unsigned int v55; // edi@79 | |
944 unsigned int v56; // esi@81 | |
945 int v57; // edx@85 | |
946 Texture *v58; // ecx@91 | |
947 unsigned int v59; // edi@91 | |
948 unsigned int v60; // esi@93 | |
949 int v61; // edx@97 | |
950 signed int v62; // ecx@102 | |
951 SHORT v63; // di@110 | |
952 bool v64; // eax@110 | |
953 const char *v65; // ecx@112 | |
954 POINT *v66; // esi@117 | |
955 int v67; // ecx@118 | |
956 int v68; // eax@118 | |
957 int v69; // ecx@118 | |
958 ItemGen *v70; // esi@118 | |
959 int v71; // eax@123 | 697 int v71; // eax@123 |
960 int all_text_height; // edi@125 | 698 int all_text_height; // edi@125 |
961 char **v73; // esi@125 | |
962 int v74; // eax@126 | |
963 int pItemNum; | |
964 int v76; // edx@127 | |
965 int v77; // edi@127 | |
966 GUIButton *pButton; // esi@129 | 699 GUIButton *pButton; // esi@129 |
967 const char **v79; // eax@129 | |
968 int pTextHeight; // eax@129 | |
969 unsigned int v81; // ecx@129 | |
970 unsigned int pColorText; // ax@129 | 700 unsigned int pColorText; // ax@129 |
971 int v85; // [sp-14h] [bp-ECh]@29 | 701 POINT mouse; // [sp+2Ch] [bp-ACh]@117 |
972 int v86; // [sp-10h] [bp-E8h]@29 | |
973 ItemGen *v87; // [sp-10h] [bp-E8h]@43 | |
974 unsigned __int16 v88; // [sp-Ch] [bp-E4h]@29 | |
975 void *v89; // [sp-Ch] [bp-E4h]@43 | |
976 char *v90; // [sp-8h] [bp-E0h]@29 | |
977 int v91; // [sp-8h] [bp-E0h]@42 | |
978 unsigned int v92; // [sp-4h] [bp-DCh]@29 | |
979 __int64 *v93; // [sp-4h] [bp-DCh]@42 | |
980 POINT v94; // [sp+Ch] [bp-CCh]@39 | |
981 POINT v95; // [sp+14h] [bp-C4h]@49 | |
982 POINT v96; // [sp+1Ch] [bp-BCh]@117 | |
983 POINT v97; // [sp+24h] [bp-B4h]@40 | |
984 POINT v98; // [sp+2Ch] [bp-ACh]@117 | |
985 POINT v99; // [sp+34h] [bp-A4h]@49 | |
986 POINT v100; // [sp+3Ch] [bp-9Ch]@50 | |
987 POINT v101; // [sp+44h] [bp-94h]@39 | |
988 POINT v102; // [sp+4Ch] [bp-8Ch]@49 | |
989 POINT a2; // [sp+54h] [bp-84h]@39 | |
990 GUIWindow dialog_window; // [sp+5Ch] [bp-7Ch]@1 | 702 GUIWindow dialog_window; // [sp+5Ch] [bp-7Ch]@1 |
991 int v105; // [sp+B0h] [bp-28h]@19 | 703 int v105; // [sp+B0h] [bp-28h]@19 |
992 int pColorYellow; // [sp+B4h] [bp-24h]@1 | |
993 int Str; // [sp+B8h] [bp-20h]@23 | |
994 int pColorWhite; // [sp+BCh] [bp-1Ch]@1 | |
995 __int32 v109; // [sp+C0h] [bp-18h]@39 | |
996 Player *pPlayer; // [sp+C4h] [bp-14h]@1 | |
997 int pNumString; // [sp+C8h] [bp-10h]@9 | 704 int pNumString; // [sp+C8h] [bp-10h]@9 |
998 unsigned int v112; // [sp+CCh] [bp-Ch]@9 | 705 int item_num; // [sp+D4h] [bp-4h]@11 |
999 unsigned __int8 v113; // [sp+D3h] [bp-5h]@47 | 706 int pPrice; |
1000 int v114; // [sp+D4h] [bp-4h]@11 | 707 |
1001 | |
1002 pPlayer = pPlayers[uActiveCharacter]; | |
1003 memcpy(&dialog_window, window_SpeakInHouse, sizeof(dialog_window)); | 708 memcpy(&dialog_window, window_SpeakInHouse, sizeof(dialog_window)); |
1004 dialog_window.uFrameX = 483; | 709 dialog_window.uFrameX = 483; |
1005 dialog_window.uFrameWidth = 148; | 710 dialog_window.uFrameWidth = 148; |
1006 dialog_window.uFrameZ = 334; | 711 dialog_window.uFrameZ = 334; |
1007 pColorWhite = TargetColor(0xFFu, 0xFFu, 0xFFu); | |
1008 pColorYellow = TargetColor(0xE1u, 0xCDu, 0x23u); | |
1009 switch(dialog_menu_id) | 712 switch(dialog_menu_id) |
1010 { | 713 { |
1011 case HOUSE_DIALOGUE_MAIN: | 714 case HOUSE_DIALOGUE_MAIN: |
1012 { | 715 { |
1013 if ( HouseUI_CheckIfPlayerCanInteract() ) | 716 if ( HouseUI_CheckIfPlayerCanInteract() ) |
1015 pShopOptions[0] = pGlobalTXT_LocalizationStrings[134]; | 718 pShopOptions[0] = pGlobalTXT_LocalizationStrings[134]; |
1016 pShopOptions[1] = pGlobalTXT_LocalizationStrings[152]; | 719 pShopOptions[1] = pGlobalTXT_LocalizationStrings[152]; |
1017 pShopOptions[2] = pGlobalTXT_LocalizationStrings[159]; | 720 pShopOptions[2] = pGlobalTXT_LocalizationStrings[159]; |
1018 pShopOptions[3] = pGlobalTXT_LocalizationStrings[160]; | 721 pShopOptions[3] = pGlobalTXT_LocalizationStrings[160]; |
1019 all_text_height = 0; | 722 all_text_height = 0; |
1020 for (int i = 0; i < 4; ++i)//while ( (signed int)v15 < (signed int)&unk_F8B1C8 ); | 723 for ( int i = 0; i < 4; ++i ) |
1021 all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0); | 724 all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0); |
1022 Str = (174 - all_text_height) / 4; | 725 v18 = (174 - all_text_height) / 4; |
1023 pNumActiveItem = pDialogueWindow->pStartingPosActiveItem; | 726 v105 = (174 - 4 * (174 - all_text_height) / 4 - all_text_height) / 2 - (174 - all_text_height) / 4 / 2 + 138; |
1024 v76 = pNumActiveItem + pDialogueWindow->pNumPresenceButton; | 727 pNumString = 0; |
1025 v77 = (174 - 4 * (174 - all_text_height) / 4 - all_text_height) / 2 - (174 - all_text_height) / 4 / 2 + 138; | 728 for ( int i = pDialogueWindow->pStartingPosActiveItem; |
1026 v28 = -pDialogueWindow->pNumPresenceButton < 0; | 729 i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) |
1027 if ( v28 ^ (pNumActiveItem > v76) ) | 730 { |
1028 { | 731 pButton = pDialogueWindow->GetControl(i); |
1029 pItemNum = 2; | 732 pButton->uY = v18 + v105; |
1030 pNumString = 0; | 733 pButton->uHeight = pFontArrus->CalcTextHeight((const char *)pShopOptions[pNumString], &dialog_window, 0, 0); |
1031 do | 734 v105 = pButton->uY + pFontArrus->CalcTextHeight((const char *)pShopOptions[pNumString], &dialog_window, 0, 0) - 1; |
1032 { | 735 pButton->uW = v105; |
1033 pButton = pDialogueWindow->GetControl(pItemNum); | 736 pColorText = TargetColor(0xE1u, 0xCDu, 0x23u); |
1034 pButton->uY = Str + v77; | 737 if ( pDialogueWindow->pCurrentPosActiveItem != i ) |
1035 pTextHeight = pFontArrus->CalcTextHeight((const char *)pShopOptions[pNumString], &dialog_window, 0, 0); | 738 pColorText = TargetColor(0xFFu, 0xFFu, 0xFFu); |
1036 pButton->uHeight = pTextHeight; | 739 dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, (const char *)pShopOptions[pNumString], 3); |
1037 v77 = pButton->uY + pTextHeight - 1; | 740 ++pNumString; |
1038 pButton->uW = v77; | |
1039 pColorText = pColorYellow; | |
1040 if ( pDialogueWindow->pCurrentPosActiveItem != pItemNum ) | |
1041 pColorText = pColorWhite; | |
1042 dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, (const char *)pShopOptions[pNumString], 3); | |
1043 ++pItemNum; | |
1044 ++pNumString; | |
1045 pNumActiveItem = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; | |
1046 } | |
1047 while ( pItemNum < pNumActiveItem ); | |
1048 } | 741 } |
1049 } | 742 } |
1050 return; | 743 return; |
1051 } | 744 } |
745 | |
1052 case HOUSE_DIALOGUE_SHOP_BUY_STANDARD: | 746 case HOUSE_DIALOGUE_SHOP_BUY_STANDARD: |
1053 { | 747 { |
1054 pRenderer->DrawTextureIndexed(8, 8, ShopTexture); | 748 pRenderer->DrawTextureIndexed(8, 8, ShopTexture); |
1055 v114 = 0; | 749 for ( uint i = 0; i < 6; ++i ) |
1056 do | 750 { |
1057 { | 751 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].uItemID ) |
1058 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v114].uItemID) | 752 { |
1059 { | 753 v47 = 152 - ItemsInShopTexture[i]->uTextureHeight; |
1060 v46 = ItemsInShopTexture[v114]; | |
1061 v47 = 152 - v46->uTextureHeight; | |
1062 if ( (signed int)v47 < 1 ) | 754 if ( (signed int)v47 < 1 ) |
1063 v47 = 0; | 755 v47 = 0; |
1064 v48 = 75 * v114 - v46->uTextureWidth / 2 + 40; | 756 v48 = 75 * i - ItemsInShopTexture[i]->uTextureWidth / 2 + 40; |
1065 if ( v114 ) | 757 if ( i ) |
1066 { | 758 { |
1067 if ( v114 == 5 ) | 759 if ( i == 5 ) |
1068 { | 760 { |
1069 v49 = ItemsInShopTexture[5]->uTextureWidth; | 761 if ( (signed int)v48 > 457 - ItemsInShopTexture[5]->uTextureWidth ) |
1070 if ( (signed int)v48 > 457 - v49 ) | 762 v48 = 457 - ItemsInShopTexture[5]->uTextureWidth; |
1071 v48 = 457 - v49; | |
1072 } | 763 } |
1073 } | 764 } |
1074 else if ( (signed int)v48 < 18 ) | 765 else if ( (signed int)v48 < 18 ) |
1075 v48 = 18; | 766 v48 = 18; |
1076 pRenderer->DrawTextureTransparent(v48, v47, v46); | 767 pRenderer->DrawTextureTransparent(v48, v47, ItemsInShopTexture[i]); |
1077 ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[v48 + 640 * v47], ItemsInShopTexture[v114], v114 + 1); | 768 ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[v48 + 640 * v47], ItemsInShopTexture[i], i + 1); |
1078 } | 769 } |
1079 ++v114; | 770 } |
1080 } | 771 for ( uint i = 0; i < 6; ++i ) |
1081 while ( v114 < 6 ); | 772 { |
1082 v114 = 0; | 773 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i + 6].uItemID ) |
1083 do | 774 { |
1084 { | 775 v51 = 308 - ItemsInShopTexture[i + 6]->uTextureHeight; |
1085 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v114 + 6].uItemID) | |
1086 { | |
1087 v50 = ItemsInShopTexture[v114 + 6]; | |
1088 v51 = 308 - v50->uTextureHeight; | |
1089 if ( (signed int)v51 < 1 ) | 776 if ( (signed int)v51 < 1 ) |
1090 v51 = 0; | 777 v51 = 0; |
1091 v52 = 75 * v114 - v50->uTextureWidth / 2 + 40; | 778 v52 = 75 * i - ItemsInShopTexture[i + 6]->uTextureWidth / 2 + 40; |
1092 if ( v114 ) | 779 if ( i ) |
1093 { | 780 { |
1094 if ( v114 == 5 ) | 781 if ( i == 5 ) |
1095 { | 782 { |
1096 v53 = ItemsInShopTexture[11]->uTextureWidth; | 783 if ( (signed int)v52 > 457 - ItemsInShopTexture[11]->uTextureWidth ) |
1097 if ( (signed int)v52 > 457 - v53 ) | 784 v52 = 457 - ItemsInShopTexture[11]->uTextureWidth; |
1098 v52 = 457 - v53; | |
1099 } | 785 } |
1100 } | 786 } |
1101 else | 787 else |
1102 { | 788 { |
1103 if ( (signed int)v52 < 18 ) | 789 if ( (signed int)v52 < 18 ) |
1104 v52 = 18; | 790 v52 = 18; |
1105 } | 791 } |
1106 pRenderer->DrawTextureTransparent(v52, v51, v50); | 792 pRenderer->DrawTextureTransparent(v52, v51, ItemsInShopTexture[i + 6]); |
1107 ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[v52 + 640 * v51], ItemsInShopTexture[v114 + 6], v114 + 7); | 793 ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[v52 + 640 * v51], ItemsInShopTexture[i + 6], i + 7); |
1108 } | 794 } |
1109 ++v114; | 795 } |
1110 } | |
1111 while ( v114 < 6 ); | |
1112 if ( HouseUI_CheckIfPlayerCanInteract() ) | 796 if ( HouseUI_CheckIfPlayerCanInteract() ) |
1113 { | 797 { |
1114 v62 = 0; | 798 item_num = 0; |
1115 v109 = 0; | 799 for ( uint i = 0; i < 12; ++i ) |
1116 do | 800 { |
1117 { | 801 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].uItemID) |
1118 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v62].uItemID) | 802 ++item_num; |
1119 ++v109; | 803 } |
1120 ++v62; | 804 if ( GetAsyncKeyState(17) && pPlayers[uActiveCharacter]->CanSteal() ) |
1121 } | 805 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[185], 0); |
1122 while ( v62 < 12 ); | |
1123 v63 = GetAsyncKeyState(17); | |
1124 v64 = pPlayer->CanSteal(); | |
1125 Str = v64; | |
1126 if ( v63 && v64 ) | |
1127 { | |
1128 v65 = pGlobalTXT_LocalizationStrings[185]; | |
1129 } | |
1130 else if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_BUY_STANDARD) | |
1131 { | |
1132 v65 = pGlobalTXT_LocalizationStrings[195]; | |
1133 } | |
1134 else | 806 else |
1135 { | 807 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[195], 0); |
1136 v65 = pGlobalTXT_LocalizationStrings[196]; | 808 if ( !item_num ) |
1137 } | |
1138 DrawTextAtStatusBar(v65, 0); | |
1139 if ( !v109 ) | |
1140 { | 809 { |
1141 dialog_window.DrawCurrentTime( pParty->field_3C.Shops_next_generation_time[ (unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed); | 810 dialog_window.DrawCurrentTime( pParty->field_3C.Shops_next_generation_time[ (unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed); |
1142 return; | 811 return; |
1143 } | 812 } |
1144 pMouse->GetCursorPos(&v98); | 813 pMouse->GetCursorPos(&mouse); |
1145 pNumActiveItem = v98.x + pSRZBufferLineOffsets[v98.y]; | 814 if ( pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF ) |
1146 if ( pRenderer->pActiveZBuffer[pNumActiveItem] & 0xFFFF ) | 815 { |
1147 { | 816 item = &pParty->StandartItemsInShops[(int)window_SpeakInHouse->ptr_1C][(pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF) - 1]; |
1148 v67 = (pRenderer->pActiveZBuffer[pNumActiveItem] & 0xFFFF) - 1; | 817 if ( !GetAsyncKeyState(17) || !pPlayers[uActiveCharacter]->CanSteal() ) |
1149 v70 = (ItemGen *)&pParty->StandartItemsInShops[(int)window_SpeakInHouse->ptr_1C][v67]; | 818 { |
1150 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD) | 819 v71 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(item, BuildingType_AlchemistShop, (int)window_SpeakInHouse->ptr_1C, 2); |
1151 v70 = &pParty->SpecialItemsInShops[(int)window_SpeakInHouse->ptr_1C][v67];//v70 = (ItemGen *)&pParty->field_C59C[v69 + 724]; | 820 pText = BuildDialogueString((char *)pMerchantsBuyPhrases[v71], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 2, 0); |
1152 if ( !v63 || !Str ) | |
1153 { | |
1154 v71 = pPlayer->SelectPhrasesTransaction(v70, BuildingType_AlchemistShop, (int)window_SpeakInHouse->ptr_1C, 2); | |
1155 v38 = (char *)pMerchantsBuyPhrases[v71]; | |
1156 } | 821 } |
1157 else | 822 else |
1158 { | 823 pText = BuildDialogueString(pGlobalTXT_LocalizationStrings[181], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 2, 0); |
1159 v38 = pGlobalTXT_LocalizationStrings[181]; | 824 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, TargetColor(0xFFu, 0xFFu, 0xFFu), pText, 3); |
1160 } | |
1161 v21 = BuildDialogueString(v38, uActiveCharacter - 1, v70, (char *)window_SpeakInHouse->ptr_1C, 2, 0); | |
1162 v40 = pFontArrus->CalcTextHeight(v21, &dialog_window, 0, 0); | |
1163 dialog_window.DrawTitleText(pFontArrus, 0, (174 - v40) / 2 + 138, pColorWhite, v21, 3); | |
1164 return ; | 825 return ; |
1165 } | 826 } |
1166 } | 827 } |
1167 return; | 828 return; |
1168 } | 829 } |
830 | |
831 case HOUSE_DIALOGUE_SHOP_BUY_SPECIAL: | |
832 { | |
833 pRenderer->DrawTextureIndexed(8, 8, ShopTexture); | |
834 for ( uint i = 0; i < 6; ++i ) | |
835 { | |
836 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].uItemID) | |
837 { | |
838 v47 = 152 - ItemsInShopTexture[i]->uTextureHeight; | |
839 if ( (signed int)v47 < 1 ) | |
840 v47 = 0; | |
841 v48 = 75 * i - ItemsInShopTexture[i]->uTextureWidth / 2 + 40; | |
842 if ( i ) | |
843 { | |
844 if ( i == 5 ) | |
845 { | |
846 if ( (signed int)v48 > 457 - ItemsInShopTexture[5]->uTextureWidth ) | |
847 v48 = 457 - ItemsInShopTexture[5]->uTextureWidth; | |
848 } | |
849 } | |
850 else | |
851 { | |
852 if ( (signed int)v48 < 18 ) | |
853 v48 = 18; | |
854 } | |
855 pRenderer->DrawTextureTransparent(v48, v47, ItemsInShopTexture[i]); | |
856 ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[v48 + 640 * v47], ItemsInShopTexture[i], i + 1); | |
857 } | |
858 } | |
859 for ( uint i = 0; i < 6; ++i ) | |
860 { | |
861 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][(signed int)i + 6].uItemID) //not itemid | |
862 { | |
863 v51 = 308 - ItemsInShopTexture[i + 6]->uTextureHeight; | |
864 if ( (signed int)v51 < 1 ) | |
865 v51 = 0; | |
866 v52 = 75 * i - ItemsInShopTexture[i + 6]->uTextureWidth / 2 + 40; | |
867 if ( i ) | |
868 { | |
869 if ( i == 5 ) | |
870 { | |
871 if ( (signed int)v52 > 457 - ItemsInShopTexture[11]->uTextureWidth ) | |
872 v52 = 457 - ItemsInShopTexture[11]->uTextureWidth; | |
873 } | |
874 } | |
875 else | |
876 { | |
877 if ( (signed int)v52 < 18 ) | |
878 v52 = 18; | |
879 } | |
880 pRenderer->DrawTextureTransparent(v52, v51, ItemsInShopTexture[i + 6]); | |
881 ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[v52 + 640 * v51], ItemsInShopTexture[i + 6], i + 7); | |
882 } | |
883 } | |
884 if ( HouseUI_CheckIfPlayerCanInteract() ) | |
885 { | |
886 item_num = 0; | |
887 for ( uint i = 0; i < 12; ++i ) | |
888 { | |
889 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].uItemID) | |
890 ++item_num; | |
891 } | |
892 if ( GetAsyncKeyState(17) && pPlayers[uActiveCharacter]->CanSteal() ) | |
893 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[185], 0); | |
894 else | |
895 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[196], 0); | |
896 if ( !item_num ) | |
897 { | |
898 dialog_window.DrawCurrentTime( pParty->field_3C.Shops_next_generation_time[ (unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed); | |
899 return; | |
900 } | |
901 pMouse->GetCursorPos(&mouse); | |
902 if ( pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF ) | |
903 { | |
904 item = &pParty->SpecialItemsInShops[(int)window_SpeakInHouse->ptr_1C][(pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF) - 1]; | |
905 if ( !GetAsyncKeyState(17) || !pPlayers[uActiveCharacter]->CanSteal() ) | |
906 { | |
907 v71 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(item, BuildingType_AlchemistShop, (int)window_SpeakInHouse->ptr_1C, 2); | |
908 pText = BuildDialogueString((char *)pMerchantsBuyPhrases[v71], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 2, 0); | |
909 } | |
910 else | |
911 pText = BuildDialogueString(pGlobalTXT_LocalizationStrings[181], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 2, 0); | |
912 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, TargetColor(0xFFu, 0xFFu, 0xFFu), pText, 3); | |
913 return; | |
914 } | |
915 } | |
916 return; | |
917 } | |
918 | |
1169 case HOUSE_DIALOGUE_SHOP_SELL: | 919 case HOUSE_DIALOGUE_SHOP_SELL: |
1170 { | 920 { |
1171 draw_leather(); | 921 draw_leather(); |
1172 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); | 922 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); |
1173 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[199], 0); | 923 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[199], 0); |
1174 if ( !HouseUI_CheckIfPlayerCanInteract() ) | 924 if ( !HouseUI_CheckIfPlayerCanInteract() ) |
1175 return; | 925 return; |
1176 if ((v43 = pMouse->GetCursorPos(&v99)->x - 14, v109 = (v43 >> 5) + 14 * ((pMouse->GetCursorPos(&v95)->y - 17) >> 5), | 926 pMouse->GetCursorPos(&mouse); |
1177 pMouse->GetCursorPos(&v102)->x <= 13) || pMouse->GetCursorPos(&v100)->x >= 462 | 927 index = ((mouse.x - 14) >> 5) + 14 * ((mouse.y - 17) >> 5); |
1178 || (pNumActiveItem = pPlayer->GetItemIDAtInventoryIndex((int *)&v109), !pNumActiveItem) ) | 928 if ( mouse.x <= 13 || mouse.x >= 462 ) |
929 return; | |
930 if ( !pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&index) ) | |
1179 return; | 931 return; |
1180 v87 = (ItemGen *)&pPlayer->pInventoryItemList[pNumActiveItem - 1]; | 932 v71 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(&pPlayers[uActiveCharacter]->pInventoryItemList[pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&index) - 1], |
1181 v45 = pPlayer->SelectPhrasesTransaction(v87, BuildingType_AlchemistShop, (int)window_SpeakInHouse->ptr_1C, 3); | 933 BuildingType_AlchemistShop, (int)window_SpeakInHouse->ptr_1C, 3); |
1182 v21 = BuildDialogueString((char *)pMerchantsSellPhrases[v45], uActiveCharacter - 1, v87, (char *)window_SpeakInHouse->ptr_1C, 3, 0); | 934 pText = BuildDialogueString((char *)pMerchantsSellPhrases[v71], uActiveCharacter - 1, &pPlayers[uActiveCharacter]->pInventoryItemList[pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&index) - 1], |
1183 pTextHeight = pFontArrus->CalcTextHeight(v21, &dialog_window, 0, 0); | 935 (char *)window_SpeakInHouse->ptr_1C, 3, 0); |
1184 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, pColorWhite, v21, 3); | 936 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, TargetColor(0xFFu, 0xFFu, 0xFFu), pText, 3); |
1185 return; | 937 return; |
1186 } | 938 } |
939 | |
1187 case HOUSE_DIALOGUE_SHOP_IDENTIFY: | 940 case HOUSE_DIALOGUE_SHOP_IDENTIFY: |
1188 { | 941 { |
1189 draw_leather(); | 942 draw_leather(); |
1190 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); | 943 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); |
1191 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[197], 0); | 944 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[197], 0); |
1192 if ( HouseUI_CheckIfPlayerCanInteract() ) | 945 if ( HouseUI_CheckIfPlayerCanInteract() ) |
1193 return; | 946 return; |
1194 if ((v36 = pMouse->GetCursorPos(&a2)->x - 14, v109 = (v36 >> 5) + 14 * ((pMouse->GetCursorPos(&v94)->y - 17) >> 5), | 947 pMouse->GetCursorPos(&mouse); |
1195 pMouse->GetCursorPos(&v101)->x <= 13) || pMouse->GetCursorPos(&v97)->x >= 462 | 948 index = ((mouse.x - 14) >> 5) + 14 * ((mouse.y - 17) >> 5); |
1196 || (pNumActiveItem = pPlayer->GetItemIDAtInventoryIndex((int *)&v109), !pNumActiveItem) ) | 949 if ( mouse.x <= 13 || mouse.x >= 462 ) |
1197 return; | 950 return; |
1198 v37 = (ItemGen *)&pPlayer->pInventoryItemList[pNumActiveItem - 1]; | 951 if ( !pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&index) ) |
1199 if (!v37->IsIdentified()) | 952 return; |
1200 { | 953 item = &pPlayers[uActiveCharacter]->pInventoryItemList[pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&index) - 1]; |
1201 v42 = pPlayer->SelectPhrasesTransaction(v37, BuildingType_AlchemistShop, (int)window_SpeakInHouse->ptr_1C, 4); | 954 if (!item->IsIdentified()) |
1202 v38 = (char *)pMerchantsIdentifyPhrases[v42]; | 955 { |
956 v71 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(item, BuildingType_AlchemistShop, (int)window_SpeakInHouse->ptr_1C, 4); | |
957 pText = BuildDialogueString(pMerchantsIdentifyPhrases[v71], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 4, 0); | |
1203 } | 958 } |
1204 else | 959 else |
1205 { | 960 pText = BuildDialogueString("%24", uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 4, 0); |
1206 v38 = "%24"; | 961 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, TargetColor(0xFFu, 0xFFu, 0xFFu), pText, 3); |
1207 } | |
1208 v21 = BuildDialogueString(v38, uActiveCharacter - 1, v37, (char *)window_SpeakInHouse->ptr_1C, 4, 0); | |
1209 v40 = pFontArrus->CalcTextHeight(v21, &dialog_window, 0, 0); | |
1210 dialog_window.DrawTitleText(pFontArrus, 0, (174 - v40) / 2 + 138, pColorWhite, v21, 3); | |
1211 return; | 962 return; |
1212 } | 963 } |
964 | |
1213 case HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT: | 965 case HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT: |
1214 { | 966 { |
1215 draw_leather(); | 967 draw_leather(); |
1216 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); | 968 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); |
1217 pShopOptions[0] = pGlobalTXT_LocalizationStrings[200]; | 969 pShopOptions[0] = pGlobalTXT_LocalizationStrings[200]; |
1218 pShopOptions[1] = pGlobalTXT_LocalizationStrings[113]; | 970 pShopOptions[1] = pGlobalTXT_LocalizationStrings[113]; |
1219 all_text_height = 0; | 971 all_text_height = 0; |
1220 for ( int i = 0; i < 2; ++i ) | 972 for ( int i = 0; i < 2; ++i ) |
1221 all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0); | 973 all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0); |
1222 Str = (174 - all_text_height) / 2; | 974 v18 = (174 - all_text_height) / 2; |
1223 pNumActiveItem = pDialogueWindow->pStartingPosActiveItem; | 975 v105 = (2 * (87 - (174 - all_text_height) / 2) - all_text_height) / 2 - (174 - all_text_height) / 2 / 2 + 138; |
1224 v26 = pNumActiveItem + pDialogueWindow->pNumPresenceButton; | 976 pNumString = 0; |
1225 v27 = (2 * (87 - (174 - all_text_height) / 2) - all_text_height) / 2 - (174 - all_text_height) / 2 / 2 + 138; | 977 for ( int i = pDialogueWindow->pStartingPosActiveItem; |
1226 v28 = -pDialogueWindow->pNumPresenceButton < 0; | 978 i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) |
1227 if ( v28 ^ (pNumActiveItem > v26) ) | 979 { |
1228 { | 980 pButton = pDialogueWindow->GetControl(i); |
1229 pItemNum = 2; | 981 pButton->uY = v18 + v105; |
1230 pNumString = 0; | 982 pButton->uHeight = pFontArrus->CalcTextHeight((const char *)pShopOptions[pNumString], &dialog_window, 0, 0); |
1231 do | 983 v105 = pButton->uY + pFontArrus->CalcTextHeight((const char *)pShopOptions[pNumString], &dialog_window, 0, 0) - 1; |
1232 { | 984 pButton->uW = v105; |
1233 pButton = pDialogueWindow->GetControl(pItemNum); | 985 pColorText = TargetColor(0xE1u, 0xCDu, 0x23u); |
1234 pButton->uY = Str + v27; | 986 if ( pDialogueWindow->pCurrentPosActiveItem != i ) |
1235 pTextHeight = pFontArrus->CalcTextHeight((const char *)pShopOptions[pNumString], &dialog_window, 0, 0); | 987 pColorText = TargetColor(0xFFu, 0xFFu, 0xFFu); |
1236 pButton->uHeight = pTextHeight; | 988 dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, (const char *)pShopOptions[pNumString], 3); |
1237 v27 = pButton->uY + pTextHeight - 1; | 989 ++pNumString; |
1238 pButton->uW = v27; | |
1239 pColorText = pColorYellow; | |
1240 if ( pDialogueWindow->pCurrentPosActiveItem != pItemNum ) | |
1241 pColorText = pColorWhite; | |
1242 dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, (const char *)pShopOptions[pNumString], 3); | |
1243 ++pItemNum; | |
1244 ++pNumString; | |
1245 pNumActiveItem = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; | |
1246 } | |
1247 while ( pItemNum < pNumActiveItem ); | |
1248 } | 990 } |
1249 return; | 991 return; |
1250 } | 992 } |
1251 case HOUSE_DIALOGUE_SHOP_BUY_SPECIAL: | 993 |
1252 { | |
1253 pRenderer->DrawTextureIndexed(8, 8, ShopTexture); | |
1254 v114 = 0; | |
1255 do | |
1256 { | |
1257 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v114].uItemID) | |
1258 { | |
1259 v54 = ItemsInShopTexture[v114]; | |
1260 v55 = 152 - v54->uTextureHeight; | |
1261 if ( (signed int)v55 < 1 ) | |
1262 v55 = 0; | |
1263 v56 = 75 * v114 - v54->uTextureWidth / 2 + 40; | |
1264 if ( v114 ) | |
1265 { | |
1266 if ( v114 == 5 ) | |
1267 { | |
1268 v57 = ItemsInShopTexture[5]->uTextureWidth; | |
1269 if ( (signed int)v56 > 457 - v57 ) | |
1270 v56 = 457 - v57; | |
1271 } | |
1272 } | |
1273 else | |
1274 { | |
1275 if ( (signed int)v56 < 18 ) | |
1276 v56 = 18; | |
1277 } | |
1278 pRenderer->DrawTextureTransparent(v56, v55, v54); | |
1279 ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[v56 + 640 * v55], ItemsInShopTexture[v114], v114 + 1); | |
1280 } | |
1281 ++v114; | |
1282 } | |
1283 while ( v114 < 6 ); | |
1284 v114 = 0; | |
1285 do | |
1286 { | |
1287 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][(signed int)v114 + 6].uItemID) //not itemid | |
1288 { | |
1289 v58 = ItemsInShopTexture[v114 + 6]; | |
1290 v59 = 308 - v58->uTextureHeight; | |
1291 if ( (signed int)v59 < 1 ) | |
1292 v59 = 0; | |
1293 v60 = 75 * v114 - v58->uTextureWidth / 2 + 40; | |
1294 if ( v114 ) | |
1295 { | |
1296 if ( v114 == 5 ) | |
1297 { | |
1298 v61 = ItemsInShopTexture[11]->uTextureWidth; | |
1299 if ( (signed int)v60 > 457 - v61 ) | |
1300 v60 = 457 - v61; | |
1301 } | |
1302 } | |
1303 else | |
1304 { | |
1305 if ( (signed int)v60 < 18 ) | |
1306 v60 = 18; | |
1307 } | |
1308 pRenderer->DrawTextureTransparent(v60, v59, v58); | |
1309 ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[v60 + 640 * v59], ItemsInShopTexture[v114 + 6], v114 + 7); | |
1310 } | |
1311 ++v114; | |
1312 } | |
1313 while ( v114 < 6 ); | |
1314 if ( HouseUI_CheckIfPlayerCanInteract() ) | |
1315 { | |
1316 v62 = 0; | |
1317 v109 = 0; | |
1318 do | |
1319 { | |
1320 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v62].uItemID) | |
1321 ++v109; | |
1322 ++v62; | |
1323 } | |
1324 while ( v62 < 12 ); | |
1325 v63 = GetAsyncKeyState(17); | |
1326 v64 = pPlayer->CanSteal(); | |
1327 Str = v64; | |
1328 if ( v63 && v64 ) | |
1329 { | |
1330 v65 = pGlobalTXT_LocalizationStrings[185]; | |
1331 } | |
1332 else | |
1333 { | |
1334 v65 = pGlobalTXT_LocalizationStrings[195]; | |
1335 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD) | |
1336 v65 = pGlobalTXT_LocalizationStrings[196]; | |
1337 } | |
1338 DrawTextAtStatusBar(v65, 0); | |
1339 if ( !v109 ) | |
1340 { | |
1341 dialog_window.DrawCurrentTime( pParty->field_3C.Shops_next_generation_time[ (unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed); | |
1342 return; | |
1343 } | |
1344 v66 = pMouse->GetCursorPos(&v98); | |
1345 pNumActiveItem = v66->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v96)->y]; | |
1346 if ( pRenderer->pActiveZBuffer[pNumActiveItem] & 0xFFFF ) | |
1347 { | |
1348 v67 = (pRenderer->pActiveZBuffer[pNumActiveItem] & 0xFFFF) - 1; | |
1349 v109 = v67; | |
1350 v68 = (int)window_SpeakInHouse->ptr_1C; | |
1351 // v69 = 9 * (v67 + 12 * v68); | |
1352 v70 = (ItemGen *)&pParty->StandartItemsInShops[v68][v67]; | |
1353 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD) | |
1354 v70 = &pParty->SpecialItemsInShops[(int)v68][v67];//v70 = (ItemGen *)&pParty->field_C59C[v69 + 724]; | |
1355 if ( !v63 || !Str ) | |
1356 { | |
1357 v71 = pPlayer->SelectPhrasesTransaction(v70, BuildingType_AlchemistShop, v68, 2); | |
1358 v38 = (char *)pMerchantsBuyPhrases[v71]; | |
1359 } | |
1360 else | |
1361 { | |
1362 v38 = pGlobalTXT_LocalizationStrings[181]; | |
1363 } | |
1364 v21 = BuildDialogueString(v38, uActiveCharacter - 1, v70, (char *)window_SpeakInHouse->ptr_1C, 2, 0); | |
1365 v40 = pFontArrus->CalcTextHeight(v21, &dialog_window, 0, 0); | |
1366 dialog_window.DrawTitleText(pFontArrus, 0, (174 - v40) / 2 + 138, pColorWhite, v21, 3); | |
1367 return; | |
1368 } | |
1369 } | |
1370 return; | |
1371 } | |
1372 case HOUSE_DIALOGUE_LEARN_SKILLS: | 994 case HOUSE_DIALOGUE_LEARN_SKILLS: |
1373 { | 995 { |
1374 if (!HouseUI_CheckIfPlayerCanInteract()) | 996 if (!HouseUI_CheckIfPlayerCanInteract()) |
1375 return; | 997 return; |
1376 all_text_height = 0; | 998 all_text_height = 0; |
1377 v5 = (signed __int64)(p2DEvents[(signed int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0); | 999 v5 = (signed __int64)(p2DEvents[(signed int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0); |
1378 pItemNum = v5 * (100 - pPlayer->GetMerchant()) / 100; | 1000 pPrice = v5 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; |
1379 if ( pItemNum < v5 / 3 ) | 1001 if ( pPrice < v5 / 3 ) |
1380 pItemNum = v5 / 3; | 1002 pPrice = v5 / 3; |
1381 pNumActiveItem = pDialogueWindow->pStartingPosActiveItem; | 1003 item_num = 0; |
1382 v114 = 0; | 1004 for ( int i = pDialogueWindow->pStartingPosActiveItem; |
1383 if ( pNumActiveItem >= pNumActiveItem + pDialogueWindow->pNumPresenceButton ) | 1005 i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) |
1384 { | 1006 { |
1385 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayer->pName, pClassNames[pPlayer->classType]); | 1007 pButton = pDialogueWindow->GetControl(i); |
1008 if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][pButton->msg_param - 36] | |
1009 && !pPlayers[uActiveCharacter]->pActiveSkills[pButton->msg_param - 36] ) | |
1010 { | |
1011 all_text_height = pFontArrus->CalcTextHeight(pSkillNames[pButton->msg_param - 36], &dialog_window, 0, 0); | |
1012 ++item_num; | |
1013 } | |
1014 } | |
1015 if ( !item_num ) | |
1016 { | |
1017 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]); | |
1386 strcat(pTmpBuf.data(), "\n \n"); | 1018 strcat(pTmpBuf.data(), "\n \n"); |
1387 strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]); | 1019 strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]); |
1388 v40 = pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 0, 0); | 1020 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 0, 0)) / 2 + 138, TargetColor(0xE1u, 0xCDu, 0x23u), pTmpBuf.data(), 3); |
1389 dialog_window.DrawTitleText(pFontArrus, 0, (174 - v40) / 2 + 138, pColorYellow, pTmpBuf.data(), 3); | 1021 return; |
1390 return; | 1022 } |
1391 } | 1023 if ( item_num ) |
1392 do | 1024 { |
1393 { | 1025 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[401], pPrice); |
1394 v8 = pDialogueWindow->GetControl(pNumActiveItem)->msg_param - 36; | |
1395 if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayer->classType][v8] && !pPlayer->pActiveSkills[v8] ) | |
1396 { | |
1397 all_text_height = pFontArrus->CalcTextHeight(pSkillNames[v8], &dialog_window, 0, 0); | |
1398 ++v114; | |
1399 } | |
1400 ++pNumActiveItem; | |
1401 } | |
1402 while ( pNumActiveItem < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem ); | |
1403 if ( !v114 ) | |
1404 { | |
1405 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayer->pName, pClassNames[pPlayer->classType]); | |
1406 strcat(pTmpBuf.data(), "\n \n"); | |
1407 strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]); | |
1408 v40 = pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 0, 0); | |
1409 dialog_window.DrawTitleText(pFontArrus, 0, (174 - v40) / 2 + 138, pColorYellow, pTmpBuf.data(), 3); | |
1410 return; | |
1411 } | |
1412 if ( v114 ) | |
1413 { | |
1414 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[401], pItemNum); | |
1415 dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3); | 1026 dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3); |
1416 v18 = (149 - all_text_height) / v114; | 1027 v18 = (149 - all_text_height) / item_num; |
1417 if ( (149 - all_text_height) / v114 > 32 ) | 1028 if ( (149 - all_text_height) / item_num > 32 ) |
1418 v18 = 32; | 1029 v18 = 32; |
1419 pNumActiveItem = pDialogueWindow->pStartingPosActiveItem; | 1030 v105 = (149 - item_num * v18 - all_text_height) / 2 - v18 / 2 + 162; |
1420 v105 = (149 - v114 * v18 - all_text_height) / 2 - v18 / 2 + 162; | 1031 for ( int i = pDialogueWindow->pStartingPosActiveItem; |
1421 if ( pNumActiveItem < pNumActiveItem + pDialogueWindow->pNumPresenceButton ) | 1032 i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; i++ ) |
1422 { | 1033 { |
1423 pItemNum = 2; | 1034 pButton = pDialogueWindow->GetControl(i); |
1424 do | 1035 if ( !byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][pButton->msg_param - 36] |
1425 { | 1036 || pPlayers[uActiveCharacter]->pActiveSkills[pButton->msg_param - 36] ) |
1426 pButton = pDialogueWindow->GetControl(pItemNum); | 1037 { |
1427 v13 = pButton->msg_param - 36; | 1038 pButton->uW = 0; |
1428 if ( !byte_4ED970_skill_learn_ability_by_class_table[pPlayer->classType][v13] || pPlayer->pActiveSkills[v13] ) | 1039 pButton->uHeight = 0; |
1429 { | 1040 pButton->uY = 0; |
1430 pButton->uW = 0; | 1041 } |
1431 pButton->uHeight = 0; | 1042 else |
1432 pButton->uY = 0; | 1043 { |
1433 } | 1044 pButton->uY = v18 + v105; |
1434 else | 1045 pButton->uHeight = pFontArrus->CalcTextHeight(pSkillNames[pButton->msg_param - 36], &dialog_window, 0, 0); |
1435 { | 1046 v105 = pButton->uY + pFontArrus->CalcTextHeight(pSkillNames[pButton->msg_param - 36], &dialog_window, 0, 0) - 1; |
1436 pButton->uY = v18 + v105; | 1047 pButton->uW = v105; |
1437 pTextHeight = pFontArrus->CalcTextHeight(pSkillNames[v13], &dialog_window, 0, 0); | 1048 pColorText = TargetColor(0xE1u, 0xCDu, 0x23u); |
1438 pButton->uHeight = pTextHeight; | 1049 if ( pDialogueWindow->pCurrentPosActiveItem != i ) |
1439 v105 = pButton->uY + pTextHeight - 1; | 1050 pColorText = TargetColor(0xFFu, 0xFFu, 0xFFu); |
1440 pButton->uW = v105; | 1051 dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, pSkillNames[pButton->msg_param - 36], 3); |
1441 pColorText = pColorYellow; | 1052 } |
1442 if ( pDialogueWindow->pCurrentPosActiveItem != pItemNum ) | |
1443 pColorText = pColorWhite; | |
1444 dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, pSkillNames[v13], 3); | |
1445 } | |
1446 pNumActiveItem = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; | |
1447 pItemNum++; | |
1448 } | |
1449 while ( pItemNum < pNumActiveItem ); | |
1450 } | 1053 } |
1451 return; | 1054 return; |
1452 } | 1055 } |
1453 } | 1056 } |
1454 default: | 1057 default: |
1455 { | 1058 __debugbreak(); |
1456 return;// (POINT *)dialog_menu_id - 96; | |
1457 } | |
1458 } | 1059 } |
1459 } | 1060 } |
1061 | |
1460 //----- (004B4FCF) -------------------------------------------------------- | 1062 //----- (004B4FCF) -------------------------------------------------------- |
1461 void MagicShopDialog() | 1063 void MagicShopDialog() |
1462 { | 1064 { |
1463 int result; // eax@6 | 1065 int result; // eax@6 |
1464 signed int v2; // esi@8 | 1066 signed int v2; // esi@8 |