comparison UIHouses.cpp @ 906:23655ae9cd18

Слияние
author Ritor1
date Fri, 19 Apr 2013 18:11:28 +0600
parents addae461eeb4 4dc2252e0b03
children f3ccfc765502
comparison
equal deleted inserted replaced
905:6daea87a3fe3 906:23655ae9cd18
567 PrepareHouse(uHouseID); 567 PrepareHouse(uHouseID);
568 v18 = 1; 568 v18 = 1;
569 uTextureID_507B04 = uTextureID_right_panel; 569 uTextureID_507B04 = uTextureID_right_panel;
570 if ( uNumDialogueNPCPortraits == 1 ) 570 if ( uNumDialogueNPCPortraits == 1 )
571 pDialogueNPCCount = 1; 571 pDialogueNPCCount = 1;
572 pVideoPlayer->_4BF28F(pAnimatedRooms[uCurrentHouse_Animation].video_name, 1u); 572 pVideoPlayer->OpenHouseMovie(pAnimatedRooms[uCurrentHouse_Animation].video_name, 1u);
573 dword_5C35D4 = 1; 573 dword_5C35D4 = 1;
574 if ( (signed int)uHouseID < 139 || (signed int)uHouseID > 172 ) 574 if ( (signed int)uHouseID < 139 || (signed int)uHouseID > 172 )
575 { 575 {
576 if ( (signed int)uHouseID >= HOUSE_STABLES_HARMONDALE && (signed int)uHouseID <= 73 && !IsTravelAvailable(uHouseID - HOUSE_STABLES_HARMONDALE) ) 576 if ( (signed int)uHouseID >= HOUSE_STABLES_HARMONDALE && (signed int)uHouseID <= 73 && !IsTravelAvailable(uHouseID - HOUSE_STABLES_HARMONDALE) )
577 { 577 {
671 int v37; // ecx@227 671 int v37; // ecx@227
672 int v38; // esi@230 672 int v38; // esi@230
673 int v39; // edx@235 673 int v39; // edx@235
674 int v40; // edi@243 674 int v40; // edi@243
675 unsigned __int64 v41; // qax@243 675 unsigned __int64 v41; // qax@243
676 void *v42; // eax@244 676 //void *v42; // eax@244
677 signed int v43; // edi@244 677 signed int v43; // edi@244
678 int v44; // edx@244 678 int v44; // edx@244
679 int v45; // eax@246 679 int v45; // eax@246
680 unsigned int v46; // eax@247 680 unsigned int v46; // eax@247
681 void *v47; // eax@250 681 void *v47; // eax@250
695 if ( !pDialogueWindow->pNumPresenceButton ) 695 if ( !pDialogueWindow->pNumPresenceButton )
696 return; 696 return;
697 pRenderer->ClearZBuffer(0, 479); 697 pRenderer->ClearZBuffer(0, 479);
698 //v3 = dword_F8B198; 698 //v3 = dword_F8B198;
699 if ( dialog_menu_id != HOUSE_DIALOGUE_MAIN) 699 if ( dialog_menu_id != HOUSE_DIALOGUE_MAIN)
700 { 700 v8 = window_SpeakInHouse;
701 v8 = window_SpeakInHouse;
702 }
703 //else 701 //else
704 if (dialog_menu_id == HOUSE_DIALOGUE_MAIN) 702 if (dialog_menu_id == HOUSE_DIALOGUE_MAIN)
705 { 703 {
706 if ( in_current_building_type == BildingType_Training ) 704 if ( in_current_building_type == BildingType_Training )
707 { 705 {
723 } 721 }
724 pDialogueWindow->Release(); 722 pDialogueWindow->Release();
725 pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x159u, WINDOW_MainMenu, 0, 0); 723 pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x159u, WINDOW_MainMenu, 0, 0);
726 pBtn_ExitCancel = pDialogueWindow->CreateButton(526, 445, 75, 33, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[74],// "End Conversation" 724 pBtn_ExitCancel = pDialogueWindow->CreateButton(526, 445, 75, 33, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[74],// "End Conversation"
727 pIcons_LOD->GetTexture(uTextureID_BUTTDESC2), 0); 725 pIcons_LOD->GetTexture(uTextureID_BUTTDESC2), 0);
728 pDialogueWindow->CreateButton(8u, 8u, 0x1C2u, 0x140u, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", nullptr); 726 pDialogueWindow->CreateButton(8, 8, 0x1C2, 0x140, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", nullptr);
729 // LABEL_10: 727 // LABEL_10:
730 //v3 = dword_F8B198; 728 //v3 = dword_F8B198;
731 v8 = window_SpeakInHouse; 729 v8 = window_SpeakInHouse;
732 } 730 }
733 //else 731 //else
768 } 766 }
769 767
770 //NEW 768 //NEW
771 switch(in_current_building_type) 769 switch(in_current_building_type)
772 { 770 {
773 case 5: 771 case BildingType_FireGuild:
774 case 6: 772 case BildingType_AirGuild:
775 case 7: 773 case BildingType_WaterGuild:
776 case 8: 774 case BildingType_EarthGuild:
777 case 9: 775 case BildingType_SpiritGuild:
778 case 10: 776 case BildingType_MindGuild:
779 case 11: 777 case BildingType_BodyGuild:
780 case 12: 778 case BildingType_LightGuild:
781 case 13: 779 case BildingType_DarkGuild:
782 case 14: 780 case BildingType_14:
783 case 15: 781 case BildingType_15:
784 case 16: 782 case BildingType_16:
785 { 783 {
786 if ( *(int *)&stru_AA1058[3].pSounds[8 * (unsigned int)v8->ptr_1C + 44472] >= (signed __int64)pParty->uTimePlayed && 784 if ( *(int *)&stru_AA1058[3].pSounds[8 * (unsigned int)v8->ptr_1C + 44472] >= (signed __int64)pParty->uTimePlayed &&
787 *(int *)&stru_AA1058[3].pSounds[8 * (unsigned int)v8->ptr_1C + 44468] >= (signed __int64)pParty->uTimePlayed ) 785 *(int *)&stru_AA1058[3].pSounds[8 * (unsigned int)v8->ptr_1C + 44468] >= (signed __int64)pParty->uTimePlayed )
788 { 786 {
789 v32 = 0; 787 v32 = 0;
790 do 788 do
791 { 789 {
792 //v33 = *(&pParty->pPlayers[1].pInstalledBeacons[0].field_18 + 9 * (v32 + 12 * (unsigned int)v8->ptr_1C)); 790 //v33 = *(&pParty->pPlayers[1].pInstalledBeacons[0].field_18 + 9 * (v32 + 12 * (unsigned int)v8->ptr_1C));
793 v33 = pParty->SpellBooksInGuilds[v8->par1C-139][v32].uItemID; 791 v33 = pParty->SpellBooksInGuilds[v8->par1C-139][v32].uItemID;
794 if ( v33 ) 792 if ( v33 )
795 { 793 {
796 v34 = pIcons_LOD->LoadTexture(pItemsTable->pItems[v33].pIconName, TEXTURE_16BIT_PALETTE); 794 v34 = pIcons_LOD->LoadTexture(pItemsTable->pItems[v33].pIconName, TEXTURE_16BIT_PALETTE);
797 v8 = window_SpeakInHouse; 795 v8 = window_SpeakInHouse;
798 ItemsInShopTexture[v32] = &pIcons_LOD->pTextures[v34]; 796 ItemsInShopTexture[v32] = &pIcons_LOD->pTextures[v34];
799 } 797 }
800 ++v32; 798 ++v32;
801 } 799 }
802 while ( v32 < 12 ); 800 while ( v32 < 12 );
801 }
802 else
803 {
804 SpellBookGenerator();
805 v30 = window_SpeakInHouse->ptr_1C;
806 v31 = pParty->uTimePlayed + (signed __int64)((double)(0xA8C000
807 //* (signed int)p2DEvents_minus1[26 * (unsigned int)ptr_507BC0->ptr_1C])
808 * (signed int)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].field_1C) * 0.033333335);
809 *(int *)&stru_AA1058[3].pSounds[8 * (int)v30 + 44468] = v31;
810 *(int *)&stru_AA1058[3].pSounds[8 * (int)v30 + 44472] = HIDWORD(v31);
811 }
812 //return;
813 break;
814 }
815 case BildingType_TownHall:
816 {
817 if ( uMessageParam == 99 )
818 {
819 v10 = (int)((char *)v8->ptr_1C - 102);
820 v56 = v10;
821 v11 = 8 * v10 + 11325428;
822 if ( pParty->field_3C.field_0[2 * v10 + 1] >= (signed __int64)pParty->uTimePlayed
823 && pParty->field_3C.field_0[2 * v10] >= (signed __int64)pParty->uTimePlayed )
824 {
825 v13 = 0;
803 } 826 }
804 else 827 else
805 { 828 {
806 SpellBookGenerator(); 829 v12 = v10;
807 v30 = window_SpeakInHouse->ptr_1C; 830 v13 = 0;
808 v31 = pParty->uTimePlayed 831 pParty->field_75A[v12] = 0;
809 + (signed __int64)((double)(0xA8C000 832 *(_QWORD *)v11 = (signed __int64)((double)(309657600 * (pParty->uCurrentMonth + 12i64 * pParty->uCurrentYear - 14015)) * 0.033333335);
810 //* (signed int)p2DEvents_minus1[26 * (unsigned int)ptr_507BC0->ptr_1C]) 833 v14 = rand() % 258;
811 * (signed int)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].field_1C) 834 v15 = window_SpeakInHouse;
812 * 0.033333335); 835 pParty->field_750[v12] = v14 + 1;
813 *(int *)&stru_AA1058[3].pSounds[8 * (int)v30 + 44468] = v31; 836 v16 = (int)((char *)v15->ptr_1C - 102);
814 *(int *)&stru_AA1058[3].pSounds[8 * (int)v30 + 44472] = HIDWORD(v31); 837 if ( v16 )
815 } 838 {
816 //return; 839 v17 = v16 - 1;
817 break; 840 if ( v17 )
818 } 841 {
819 case 17: 842 v18 = v17 - 1;
820 { 843 if ( v18 )
821 if ( uMessageParam == 99 )
822 {
823 v10 = (int)((char *)v8->ptr_1C - 102);
824 v56 = v10;
825 v11 = 8 * v10 + 11325428;
826 if ( pParty->field_3C.field_0[2 * v10 + 1] >= (signed __int64)pParty->uTimePlayed
827 && pParty->field_3C.field_0[2 * v10] >= (signed __int64)pParty->uTimePlayed )
828 {
829 v13 = 0;
830 }
831 else
832 {
833 v12 = v10;
834 v13 = 0;
835 pParty->field_75A[v12] = 0;
836 *(_QWORD *)v11 = (signed __int64)((double)(309657600 * (pParty->uCurrentMonth + 12i64 * pParty->uCurrentYear - 14015)) * 0.033333335);
837 v14 = rand() % 258;
838 v15 = window_SpeakInHouse;
839 pParty->field_750[v12] = v14 + 1;
840 v16 = (int)((char *)v15->ptr_1C - 102);
841 if ( v16 )
842 {
843 v17 = v16 - 1;
844 if ( v17 )
845 { 844 {
846 v18 = v17 - 1; 845 v19 = v18 - 1;
847 if ( v18 ) 846 if ( v19 )
848 { 847 {
849 v19 = v18 - 1; 848 if ( v19 == 1 )
850 if ( v19 )
851 {
852 if ( v19 == 1 )
853 {
854 while ( 1 )
855 {
856 v20 = pParty->field_750[v12];
857 if ( (unsigned __int16)v20 < 0x73u || (unsigned __int16)v20 > 0x84u )
858 {
859 if ( ((unsigned __int16)v20 < 0xE8u || (unsigned __int16)v20 > 0xF9u)
860 && ((unsigned __int16)v20 < 0x85u || (unsigned __int16)v20 > 0x96u)
861 && ((unsigned __int16)v20 < 0x97u || (unsigned __int16)v20 > 0xBAu)
862 && ((unsigned __int16)v20 < 0xBEu || (unsigned __int16)v20 > 0xC0u)
863 && ((unsigned __int16)v20 < 0xC4u || (unsigned __int16)v20 > 0xC6u)
864 && ((unsigned __int16)v20 < 0x2Bu || (unsigned __int16)v20 > 0x2Du)
865 && ((unsigned __int16)v20 < 0x6Du || (unsigned __int16)v20 > 0x6Fu)
866 && ((unsigned __int16)v20 < 0x46u || (unsigned __int16)v20 > 0x48u)
867 && ((unsigned __int16)v20 < 0x100u || (unsigned __int16)v20 > 0x102u)
868 && ((unsigned __int16)v20 < 0xD9u || (unsigned __int16)v20 > 0xDBu)
869 && ((unsigned __int16)v20 < 0xC7u || (unsigned __int16)v20 > 0xC9u)
870 && ((unsigned __int16)v20 < 0xE5u || (unsigned __int16)v20 > 0xE7u)
871 && ((unsigned __int16)v20 < 0xDFu || (unsigned __int16)v20 > 0xE1u)
872 && ((unsigned __int16)v20 < 0x5Bu || (unsigned __int16)v20 > 0x5Du)
873 && ((unsigned __int16)v20 < 0x49u || (unsigned __int16)v20 > 0x4Bu)
874 && ((unsigned __int16)v20 < 0xFDu || (unsigned __int16)v20 > 0xFFu)
875 && ((unsigned __int16)v20 < 0x61u || (unsigned __int16)v20 > 0x63u)
876 && ((unsigned __int16)v20 < 0x10u || (unsigned __int16)v20 > 0x12u) )
877 break;
878 }
879 pParty->field_750[v12] = rand() % 258 + 1;
880 }
881 }
882 }
883 else
884 { 849 {
885 while ( 1 ) 850 while ( 1 )
886 { 851 {
887 v21 = pParty->field_750[v12]; 852 v20 = pParty->field_750[v12];
888 if ( (unsigned __int16)v21 < 0x73u || (unsigned __int16)v21 > 0x84u ) 853 if ( (unsigned __int16)v20 < 0x73u || (unsigned __int16)v20 > 0x84u )
889 { 854 {
890 if ( ((unsigned __int16)v21 < 0xE8u || (unsigned __int16)v21 > 0xF9u) 855 if ( ((unsigned __int16)v20 < 0xE8u || (unsigned __int16)v20 > 0xF9u)
891 && ((unsigned __int16)v21 < 0x85u || (unsigned __int16)v21 > 0x96u) 856 && ((unsigned __int16)v20 < 0x85u || (unsigned __int16)v20 > 0x96u)
892 && ((unsigned __int16)v21 < 0x97u || (unsigned __int16)v21 > 0xBAu) 857 && ((unsigned __int16)v20 < 0x97u || (unsigned __int16)v20 > 0xBAu)
893 && ((unsigned __int16)v21 < 0xBEu || (unsigned __int16)v21 > 0xC0u) 858 && ((unsigned __int16)v20 < 0xBEu || (unsigned __int16)v20 > 0xC0u)
894 && ((unsigned __int16)v21 < 0xC4u || (unsigned __int16)v21 > 0xC6u) 859 && ((unsigned __int16)v20 < 0xC4u || (unsigned __int16)v20 > 0xC6u)
895 && ((unsigned __int16)v21 < 0x2Bu || (unsigned __int16)v21 > 0x2Du) 860 && ((unsigned __int16)v20 < 0x2Bu || (unsigned __int16)v20 > 0x2Du)
896 && ((unsigned __int16)v21 < 0x5Eu || (unsigned __int16)v21 > 0x60u) 861 && ((unsigned __int16)v20 < 0x6Du || (unsigned __int16)v20 > 0x6Fu)
897 && ((unsigned __int16)v21 < 0x43u || (unsigned __int16)v21 > 0x45u) 862 && ((unsigned __int16)v20 < 0x46u || (unsigned __int16)v20 > 0x48u)
898 && ((unsigned __int16)v21 < 0x4Fu || (unsigned __int16)v21 > 0x51u) 863 && ((unsigned __int16)v20 < 0x100u || (unsigned __int16)v20 > 0x102u)
899 && ((unsigned __int16)v21 < 0xC1u || (unsigned __int16)v21 > 0xC3u) 864 && ((unsigned __int16)v20 < 0xD9u || (unsigned __int16)v20 > 0xDBu)
900 && ((unsigned __int16)v21 < 0x13u || (unsigned __int16)v21 > 0x15u) 865 && ((unsigned __int16)v20 < 0xC7u || (unsigned __int16)v20 > 0xC9u)
901 && ((unsigned __int16)v21 < 0xFDu || (unsigned __int16)v21 > 0xFFu) 866 && ((unsigned __int16)v20 < 0xE5u || (unsigned __int16)v20 > 0xE7u)
902 && ((unsigned __int16)v21 < 0x61u || (unsigned __int16)v21 > 0x63u) 867 && ((unsigned __int16)v20 < 0xDFu || (unsigned __int16)v20 > 0xE1u)
903 && ((unsigned __int16)v21 < 0x6Au || (unsigned __int16)v21 > 0x6Cu) ) 868 && ((unsigned __int16)v20 < 0x5Bu || (unsigned __int16)v20 > 0x5Du)
869 && ((unsigned __int16)v20 < 0x49u || (unsigned __int16)v20 > 0x4Bu)
870 && ((unsigned __int16)v20 < 0xFDu || (unsigned __int16)v20 > 0xFFu)
871 && ((unsigned __int16)v20 < 0x61u || (unsigned __int16)v20 > 0x63u)
872 && ((unsigned __int16)v20 < 0x10u || (unsigned __int16)v20 > 0x12u) )
904 break; 873 break;
905 } 874 }
906 pParty->field_750[v12] = rand() % 258 + 1; 875 pParty->field_750[v12] = rand() % 258 + 1;
907 } 876 }
908 } 877 }
909 } 878 }
910 else 879 else
911 { 880 {
912 while ( 1 ) 881 while ( 1 )
913 { 882 {
914 v22 = pParty->field_750[v12]; 883 v21 = pParty->field_750[v12];
915 if ( (unsigned __int16)v22 < 0x73u || (unsigned __int16)v22 > 0x84u ) 884 if ( (unsigned __int16)v21 < 0x73u || (unsigned __int16)v21 > 0x84u )
916 { 885 {
917 if ( ((unsigned __int16)v22 < 0xE8u || (unsigned __int16)v22 > 0xF9u) 886 if ( ((unsigned __int16)v21 < 0xE8u || (unsigned __int16)v21 > 0xF9u)
918 && ((unsigned __int16)v22 < 0x85u || (unsigned __int16)v22 > 0x96u) 887 && ((unsigned __int16)v21 < 0x85u || (unsigned __int16)v21 > 0x96u)
919 && ((unsigned __int16)v22 < 0x97u || (unsigned __int16)v22 > 0xBAu) 888 && ((unsigned __int16)v21 < 0x97u || (unsigned __int16)v21 > 0xBAu)
920 && ((unsigned __int16)v22 < 0xBEu || (unsigned __int16)v22 > 0xC0u) 889 && ((unsigned __int16)v21 < 0xBEu || (unsigned __int16)v21 > 0xC0u)
921 && ((unsigned __int16)v22 < 0xC4u || (unsigned __int16)v22 > 0xC6u) 890 && ((unsigned __int16)v21 < 0xC4u || (unsigned __int16)v21 > 0xC6u)
922 && ((unsigned __int16)v22 < 0x2Bu || (unsigned __int16)v22 > 0x2Du) 891 && ((unsigned __int16)v21 < 0x2Bu || (unsigned __int16)v21 > 0x2Du)
923 && ((unsigned __int16)v22 < 0x31u || (unsigned __int16)v22 > 0x33u) 892 && ((unsigned __int16)v21 < 0x5Eu || (unsigned __int16)v21 > 0x60u)
924 && ((unsigned __int16)v22 < 0x34u || (unsigned __int16)v22 > 0x36u) 893 && ((unsigned __int16)v21 < 0x43u || (unsigned __int16)v21 > 0x45u)
925 && ((unsigned __int16)v22 < 0xFDu || (unsigned __int16)v22 > 0xFFu) 894 && ((unsigned __int16)v21 < 0x4Fu || (unsigned __int16)v21 > 0x51u)
926 && ((unsigned __int16)v22 < 0x61u || (unsigned __int16)v22 > 0x63u) 895 && ((unsigned __int16)v21 < 0xC1u || (unsigned __int16)v21 > 0xC3u)
927 && ((unsigned __int16)v22 < 0x1Cu || (unsigned __int16)v22 > 0x1Eu) ) 896 && ((unsigned __int16)v21 < 0x13u || (unsigned __int16)v21 > 0x15u)
928 break; 897 && ((unsigned __int16)v21 < 0xFDu || (unsigned __int16)v21 > 0xFFu)
898 && ((unsigned __int16)v21 < 0x61u || (unsigned __int16)v21 > 0x63u)
899 && ((unsigned __int16)v21 < 0x6Au || (unsigned __int16)v21 > 0x6Cu) )
900 break;
929 } 901 }
930 pParty->field_750[v12] = rand() % 258 + 1; 902 pParty->field_750[v12] = rand() % 258 + 1;
931 } 903 }
932 } 904 }
933 } 905 }
934 else 906 else
935 { 907 {
936 while ( 1 ) 908 while ( 1 )
937 { 909 {
938 v23 = pParty->field_750[v12]; 910 v22 = pParty->field_750[v12];
939 if ( (unsigned __int16)v23 < 0x73u || (unsigned __int16)v23 > 0x84u ) 911 if ( (unsigned __int16)v22 < 0x73u || (unsigned __int16)v22 > 0x84u )
940 { 912 {
941 if ( ((unsigned __int16)v23 < 0xE8u || (unsigned __int16)v23 > 0xF9u) 913 if ( ((unsigned __int16)v22 < 0xE8u || (unsigned __int16)v22 > 0xF9u)
942 && ((unsigned __int16)v23 < 0x85u || (unsigned __int16)v23 > 0x96u) 914 && ((unsigned __int16)v22 < 0x85u || (unsigned __int16)v22 > 0x96u)
943 && ((unsigned __int16)v23 < 0x97u || (unsigned __int16)v23 > 0xBAu) 915 && ((unsigned __int16)v22 < 0x97u || (unsigned __int16)v22 > 0xBAu)
944 && ((unsigned __int16)v23 < 0xBEu || (unsigned __int16)v23 > 0xC0u) 916 && ((unsigned __int16)v22 < 0xBEu || (unsigned __int16)v22 > 0xC0u)
945 && ((unsigned __int16)v23 < 0xC4u || (unsigned __int16)v23 > 0xC6u) 917 && ((unsigned __int16)v22 < 0xC4u || (unsigned __int16)v22 > 0xC6u)
946 && ((unsigned __int16)v23 < 0x2Bu || (unsigned __int16)v23 > 0x2Du) 918 && ((unsigned __int16)v22 < 0x2Bu || (unsigned __int16)v22 > 0x2Du)
947 && ((unsigned __int16)v23 < 0x52u || (unsigned __int16)v23 > 0x54u) 919 && ((unsigned __int16)v22 < 0x31u || (unsigned __int16)v22 > 0x33u)
948 && ((unsigned __int16)v23 < 4u || (unsigned __int16)v23 > 6u) 920 && ((unsigned __int16)v22 < 0x34u || (unsigned __int16)v22 > 0x36u)
949 && ((unsigned __int16)v23 < 0x37u || (unsigned __int16)v23 > 0x39u) 921 && ((unsigned __int16)v22 < 0xFDu || (unsigned __int16)v22 > 0xFFu)
950 && ((unsigned __int16)v23 < 0x3Au || (unsigned __int16)v23 > 0x3Cu) 922 && ((unsigned __int16)v22 < 0x61u || (unsigned __int16)v22 > 0x63u)
951 && ((unsigned __int16)v23 < 0x3Du || (unsigned __int16)v23 > 0x3Fu) 923 && ((unsigned __int16)v22 < 0x1Cu || (unsigned __int16)v22 > 0x1Eu) )
952 && ((unsigned __int16)v23 < 0xFDu || (unsigned __int16)v23 > 0xFFu) 924 break;
953 && ((unsigned __int16)v23 < 0x61u || (unsigned __int16)v23 > 0x63u)
954 && ((unsigned __int16)v23 < 0xCDu || (unsigned __int16)v23 > 0xCFu) )
955 break;
956 } 925 }
957 pParty->field_750[v12] = rand() % 258 + 1; 926 pParty->field_750[v12] = rand() % 258 + 1;
958 } 927 }
959 } 928 }
960 } 929 }
961 else 930 else
962 { 931 {
963 while ( 1 ) 932 while ( 1 )
964 { 933 {
965 v24 = pParty->field_750[v12]; 934 v23 = pParty->field_750[v12];
966 if ( (unsigned __int16)v24 < 0x73u || (unsigned __int16)v24 > 0x84u ) 935 if ( (unsigned __int16)v23 < 0x73u || (unsigned __int16)v23 > 0x84u )
967 { 936 {
968 if ( ((unsigned __int16)v24 < 0xEBu || (unsigned __int16)v24 > 0xFCu) 937 if ( ((unsigned __int16)v23 < 0xE8u || (unsigned __int16)v23 > 0xF9u)
969 && ((unsigned __int16)v24 < 0x85u || (unsigned __int16)v24 > 0x96u) 938 && ((unsigned __int16)v23 < 0x85u || (unsigned __int16)v23 > 0x96u)
970 && ((unsigned __int16)v24 < 0x97u || (unsigned __int16)v24 > 0xBAu) 939 && ((unsigned __int16)v23 < 0x97u || (unsigned __int16)v23 > 0xBAu)
971 && ((unsigned __int16)v24 < 0xBEu || (unsigned __int16)v24 > 0xC0u) 940 && ((unsigned __int16)v23 < 0xBEu || (unsigned __int16)v23 > 0xC0u)
972 && ((unsigned __int16)v24 < 0xC4u || (unsigned __int16)v24 > 0xC6u) 941 && ((unsigned __int16)v23 < 0xC4u || (unsigned __int16)v23 > 0xC6u)
973 && ((unsigned __int16)v24 < 0x2Bu || (unsigned __int16)v24 > 0x2Du) 942 && ((unsigned __int16)v23 < 0x2Bu || (unsigned __int16)v23 > 0x2Du)
974 && ((unsigned __int16)v24 < 0xCDu || (unsigned __int16)v24 > 0xCFu) 943 && ((unsigned __int16)v23 < 0x52u || (unsigned __int16)v23 > 0x54u)
975 && ((unsigned __int16)v24 < 0x5Eu || (unsigned __int16)v24 > 0x60u) 944 && ((unsigned __int16)v23 < 4u || (unsigned __int16)v23 > 6u)
976 && ((unsigned __int16)v24 < 0xFDu || (unsigned __int16)v24 > 0xFFu) 945 && ((unsigned __int16)v23 < 0x37u || (unsigned __int16)v23 > 0x39u)
977 && ((unsigned __int16)v24 < 0x6Du || (unsigned __int16)v24 > 0x6Fu) 946 && ((unsigned __int16)v23 < 0x3Au || (unsigned __int16)v23 > 0x3Cu)
978 && ((unsigned __int16)v24 < 0x61u || (unsigned __int16)v24 > 0x63u) ) 947 && ((unsigned __int16)v23 < 0x3Du || (unsigned __int16)v23 > 0x3Fu)
948 && ((unsigned __int16)v23 < 0xFDu || (unsigned __int16)v23 > 0xFFu)
949 && ((unsigned __int16)v23 < 0x61u || (unsigned __int16)v23 > 0x63u)
950 && ((unsigned __int16)v23 < 0xCDu || (unsigned __int16)v23 > 0xCFu) )
979 break; 951 break;
980 } 952 }
981 pParty->field_750[v12] = rand() % 258 + 1; 953 pParty->field_750[v12] = rand() % 258 + 1;
982 } 954 }
983 } 955 }
984 v10 = v56;
985 }
986 v25 = v10;
987 v26 = pParty->field_750[v25];
988 v27 = pParty->field_75A[v25] == v13;
989 word_F8B1A0 = pParty->field_750[v25];
990 if ( v27 )
991 {
992 //v1 = 0;
993 v27 = v26 == v13;
994 v29 = (int)pNPCTopics[351].pText;
995 if ( v27 )
996 v29 = (int)pNPCTopics[353].pText;
997 dword_F8B1A4 = (char *)v29;
998 } 956 }
999 else 957 else
1000 { 958 {
1001 if ( v26 != v13 ) 959 while ( 1 )
1002 { 960 {
1003 party_finds_gold(100 * pMonsterStats->pInfos[(unsigned __int16)v26].uLevel, 0); 961 v24 = pParty->field_750[v12];
1004 v28 = pParty->pPlayers; 962 if ( (unsigned __int16)v24 < 0x73u || (unsigned __int16)v24 > 0x84u )
1005 do
1006 { 963 {
1007 v28->SetVariable(VAR_Award, 86); 964 if ( ((unsigned __int16)v24 < 0xEBu || (unsigned __int16)v24 > 0xFCu)
1008 ++v28; 965 && ((unsigned __int16)v24 < 0x85u || (unsigned __int16)v24 > 0x96u)
966 && ((unsigned __int16)v24 < 0x97u || (unsigned __int16)v24 > 0xBAu)
967 && ((unsigned __int16)v24 < 0xBEu || (unsigned __int16)v24 > 0xC0u)
968 && ((unsigned __int16)v24 < 0xC4u || (unsigned __int16)v24 > 0xC6u)
969 && ((unsigned __int16)v24 < 0x2Bu || (unsigned __int16)v24 > 0x2Du)
970 && ((unsigned __int16)v24 < 0xCDu || (unsigned __int16)v24 > 0xCFu)
971 && ((unsigned __int16)v24 < 0x5Eu || (unsigned __int16)v24 > 0x60u)
972 && ((unsigned __int16)v24 < 0xFDu || (unsigned __int16)v24 > 0xFFu)
973 && ((unsigned __int16)v24 < 0x6Du || (unsigned __int16)v24 > 0x6Fu)
974 && ((unsigned __int16)v24 < 0x61u || (unsigned __int16)v24 > 0x63u) )
975 break;
1009 } 976 }
1010 while ( (signed int)v28 < (signed int)pParty->pHirelings ); 977 pParty->field_750[v12] = rand() % 258 + 1;
1011 pParty->uNumBountiesCollected += 100 * pMonsterStats->pInfos[pParty->field_750[v25]].uLevel;
1012 pParty->field_750[v25] = v13;
1013 pParty->field_75A[v25] = v13;
1014 } 978 }
1015 //v1 = 0;
1016 dword_F8B1A4 = pNPCTopics[352].pText;
1017 } 979 }
980 v10 = v56;
1018 } 981 }
1019 else if ( uMessageParam == 100 ) 982 v25 = v10;
983 v26 = pParty->field_750[v25];
984 v27 = pParty->field_75A[v25] == v13;
985 word_F8B1A0 = pParty->field_750[v25];
986 if ( v27 )
1020 { 987 {
1021 pKeyActionMap->EnterText(1, 10, v8); 988 //v1 = 0;
989 v27 = v26 == v13;
990 v29 = (int)pNPCTopics[351].pText;
991 if ( v27 )
992 v29 = (int)pNPCTopics[353].pText;
993 dword_F8B1A4 = (char *)v29;
1022 } 994 }
1023 break; 995 else
996 {
997 if ( v26 != v13 )
998 {
999 party_finds_gold(100 * pMonsterStats->pInfos[(unsigned __int16)v26].uLevel, 0);
1000 v28 = pParty->pPlayers;
1001 do
1002 {
1003 v28->SetVariable(VAR_Award, 86);
1004 ++v28;
1005 }
1006 while ( (signed int)v28 < (signed int)pParty->pHirelings );
1007 pParty->uNumBountiesCollected += 100 * pMonsterStats->pInfos[pParty->field_750[v25]].uLevel;
1008 pParty->field_750[v25] = v13;
1009 pParty->field_75A[v25] = v13;
1010 }
1011 //v1 = 0;
1012 dword_F8B1A4 = pNPCTopics[352].pText;
1024 } 1013 }
1025 case 22: 1014 }
1026 { 1015 else if ( uMessageParam == HOUSE_DIALOGUE_TOWNHALL_100 )
1027 if ( dialog_menu_id >= 7 && dialog_menu_id <= 8 ) 1016 {
1028 pKeyActionMap->EnterText(1, 10, v8); 1017 pKeyActionMap->EnterText(1, 10, v8);
1029 return; 1018 }
1030 break; 1019 break;
1031 } 1020 }
1032 case 1: 1021 case BildingType_Bank:
1033 case 2: 1022 {
1034 case 3: 1023 if ( dialog_menu_id >= 7 && dialog_menu_id <= 8 )
1035 case 4: 1024 pKeyActionMap->EnterText(1, 10, v8);
1036 case 21: 1025 return;
1037 case 23: 1026 break;
1038 case 30: 1027 }
1039 { 1028 case BildingType_WeaponShop:
1040 break; 1029 case BildingType_ArmorShop:
1041 } 1030 case BildingType_MagicShop:
1042 default: 1031 case BildingType_AlchemistShop:
1043 { 1032 case BildingType_Tavern:
1044 return; 1033 case BildingType_Temple:
1045 break; 1034 case BildingType_Training:
1046 } 1035 {
1036 break;
1037 }
1038 default:
1039 {
1040 return;
1041 break;
1042 }
1047 } 1043 }
1048 1044
1049 /* 1045 /*
1050 if ( in_current_building_type > BildingType_Tavern ) 1046 if ( in_current_building_type > BildingType_Tavern )
1051 { 1047 {
1312 1308
1313 1309
1314 //LABEL_196: 1310 //LABEL_196:
1315 switch ( uMessageParam ) 1311 switch ( uMessageParam )
1316 { 1312 {
1317 case 96: 1313 case HOUSE_DIALOGUE_LEARN_SKILLS:
1318 { 1314 {
1319 pDialogueWindow->eWindowType = WINDOW_MainMenu; 1315 pDialogueWindow->eWindowType = WINDOW_MainMenu;
1320 UI_CreateEndConversationButton(); 1316 UI_CreateEndConversationButton();
1321 FillAviableSkillsToTeach(in_current_building_type); 1317 FillAviableSkillsToTeach(in_current_building_type);
1318 break;
1319 }
1320 case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_MAIN:
1321 {
1322 pDialogueWindow->eWindowType = WINDOW_MainMenu;
1323 UI_CreateEndConversationButton();
1324 sub_4B3A72(in_current_building_type);
1325 break;
1326 }
1327 case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_RULES:
1328 case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_VICTORY_CONDITIONS:
1329 {
1330 dialog_menu_id = (HOUSE_DIALOGUE_MENU)uMessageParam;
1331 break;
1332 }
1333 case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_RESULT:
1334 {
1335 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
1336 {
1337 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)29;
1338 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v1;
1339 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = v1;
1340 ++pMessageQueue_50CBD0->uNumMessages;
1341 }*/
1342 pMessageQueue_50CBD0->AddMessage(UIMSG_PlayArcomage, 0, 0);
1343 dialog_menu_id = HOUSE_DIALOGUE_TAVERN_ARCOMAGE_RESULT;
1344 break;
1345 }
1346 case HOUSE_DIALOGUE_SHOP_BUY_STANDARD:
1347 case HOUSE_DIALOGUE_SHOP_BUY_SPECIAL:
1348 {
1349 if ( pParty->field_3C.field_50[(unsigned int)v8->ptr_1C] < (signed __int64)pParty->uTimePlayed )
1350 {
1351 GenerateStandartShopItems();
1352 GenerateSpecialShopItems();
1353 pParty->field_3C.field_50[window_SpeakInHouse->par1C] = pParty->uTimePlayed + (signed __int64)((double)(11059200 * (signed int)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].field_1C) * 0.033333335);
1354 }
1355 if ( uMessageParam == HOUSE_DIALOGUE_SHOP_BUY_STANDARD )
1356 {
1357 if ( uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType] )
1358 {
1359 for ( v43 = 0; v43 < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType]; ++v43 )
1360 {
1361 if ( pParty->StandartItemsInShops[(int)window_SpeakInHouse->ptr_1C][v43].uItemID )
1362 {
1363 v46 = pIcons_LOD->LoadTexture(pItemsTable->pItems[pParty->StandartItemsInShops[(int)window_SpeakInHouse->ptr_1C][v43].uItemID].pIconName, TEXTURE_16BIT_PALETTE);
1364 ItemsInShopTexture[v43] = &pIcons_LOD->pTextures[v46];
1365 }
1366 }
1367 }
1368 if ( in_current_building_type == BildingType_WeaponShop )
1369 {
1370 v48 = 0;
1371 if ( uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType] )
1372 {
1373 do
1374 {
1375 if ( pParty->StandartItemsInShops[(int)window_SpeakInHouse->ptr_1C][v48].uItemID)
1376 word_F8B158[v48] = rand() % (300 - ItemsInShopTexture[v48]->uTextureHeight);
1377 ++v48;
1378 }
1379 while ( v48 < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType] );
1380 }
1381 }
1382 }
1383 if ( uMessageParam == HOUSE_DIALOGUE_SHOP_BUY_SPECIAL )
1384 {
1385 if ( uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType] )
1386 {
1387 for ( v43 = 0; v43 < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType]; ++v43 )
1388 {
1389 if ( pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][(signed int)v43].uItemID )
1390 {
1391 v51 = pIcons_LOD->LoadTexture(pItemsTable->pItems[pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][(signed int)v43].uItemID].pIconName, TEXTURE_16BIT_PALETTE);
1392 ItemsInShopTexture[v43] = &pIcons_LOD->pTextures[v51];
1393 }
1394 }
1395 }
1396 if ( in_current_building_type == BildingType_WeaponShop )
1397 {
1398 v53 = 0;
1399 if ( uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType] )
1400 {
1401 do
1402 {
1403 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v53].uItemID)
1404 word_F8B158[v53] = rand() % (300 - ItemsInShopTexture[v53]->uTextureHeight);
1405 ++v53;
1406 }
1407 while ( v53 < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType ] );
1408 }
1409 }
1410 }
1322 break; 1411 break;
1323 } 1412 }
1324 case 101: 1413 case HOUSE_DIALOGUE_SHOP_SELL:
1325 { 1414 case HOUSE_DIALOGUE_SHOP_IDENTIFY:
1326 pDialogueWindow->eWindowType = WINDOW_MainMenu; 1415 case HOUSE_DIALOGUE_SHOP_REPAIR:
1327 UI_CreateEndConversationButton(); 1416 {
1328 sub_4B3A72(in_current_building_type); 1417 dialog_menu_id = (HOUSE_DIALOGUE_MENU)uMessageParam;
1329 break; 1418 sub_421B2C_PlaceInInventory_or_DropPickedItem();
1330 } 1419 break;
1331 case 102: 1420 }
1332 case 103: 1421 case HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT:
1333 { 1422 {
1334 dialog_menu_id = (HOUSE_DIALOGUE_MENU)uMessageParam; 1423 pDialogueWindow->eWindowType = WINDOW_MainMenu;
1335 break; 1424 UI_CreateEndConversationButton();
1336 } 1425 sub_4B3AD4(in_current_building_type);
1337 case 104: 1426 break;
1338 { 1427 }
1339 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) 1428 default:
1340 { 1429 {
1341 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)29; 1430 if( uMessageParam >= HOUSE_DIALOGUE_36 && uMessageParam <= HOUSE_DIALOGUE_GUILD_LEARN_SKILL )
1342 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v1; 1431 {
1343 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = v1; 1432 //v35 = pPlayers[uActiveCharacter];
1344 ++pMessageQueue_50CBD0->uNumMessages; 1433 //v36 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (unsigned int)v8->ptr_1C] * 500.0);
1345 }*/ 1434 v36 = (signed __int64)(p2DEvents[(unsigned int)v8->ptr_1C - 1].flt_24 * 500.0);
1346 pMessageQueue_50CBD0->AddMessage(UIMSG_PlayArcomage, 0, 0); 1435 v37 = v36 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100;
1347 dialog_menu_id = HOUSE_DIALOGUE_TAVERN_ARCOMAGE_RESULT; 1436 if ( v37 < v36 / 3 )
1348 break; 1437 v37 = v36 / 3;
1349 } 1438 //if (false)
1350 case 2: 1439 if(byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][uMessageParam-36])
1351 case 95: 1440 //if ( *(&byte_4ED94C[37 * v35->uClass] + v55) )
1352 { 1441 {
1353 if ( pParty->field_3C.field_50[(unsigned int)v8->ptr_1C] < (signed __int64)pParty->uTimePlayed ) 1442 //v38 = (int)(&pPlayers[uActiveCharacter]->uIntelligence + uMessageParam);
1354 { 1443 if ( !pPlayers[uActiveCharacter]->pActiveSkills[uMessageParam - 36] )
1355 GenerateStandartShopItems(); 1444 {
1356 GenerateSpecialShopItems(); 1445 if ( pParty->uNumGold < v37 )
1357 v8 = window_SpeakInHouse; 1446 {
1358 v40 = window_SpeakInHouse->par1C; 1447 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);
1359 //v3 = dword_F8B198; 1448 if ( in_current_building_type == BildingType_Training || in_current_building_type == BildingType_Tavern )
1360 v41 = pParty->uTimePlayed 1449 v39 = 4;
1361 //+ (signed __int64)((double)(11059200 * (signed int)p2DEvents_minus1[26 * (unsigned int)ptr_507BC0->ptr_1C]) 1450 else
1362 + (signed __int64)((double)(11059200 * (signed int)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].field_1C) 1451 v39 = 2;
1363 * 0.033333335); 1452 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)v39);
1364 pParty->field_3C.field_50[v40] = v41; 1453 }
1365 } 1454 else
1366 v42 = v8->ptr_1C; 1455 {
1367 v43 = 0; 1456 Party::TakeGold(v37);
1368 //v44 = p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]; 1457 dword_F8B1E4 = 1;
1369 v44 = p2DEvents[(unsigned int)v8->ptr_1C - 1].uType; 1458 pPlayers[uActiveCharacter]->pActiveSkills[uMessageParam - 36] = 1;
1370 if ( uMessageParam == 2 ) 1459 pPlayers[uActiveCharacter]->PlaySound(SPEECH_78, 0);
1371 { 1460 }
1372 if ( uItemsAmountPerShopType[v44] ) 1461 }
1373 { 1462 }
1374 do 1463 }
1375 { 1464 break;
1376 v45 = pParty->StandartItemsInShops[(int)v42][v43].uItemID; 1465 }
1377 if ( v45 )
1378 {
1379 v46 = pIcons_LOD->LoadTexture(pItemsTable->pItems[v45].pIconName, TEXTURE_16BIT_PALETTE);
1380 //v3 = dword_F8B198;
1381 v8 = window_SpeakInHouse;
1382 ItemsInShopTexture[v43] = &pIcons_LOD->pTextures[v46];
1383 }
1384 v42 = v8->ptr_1C;
1385 ++v43;
1386 }
1387 //while ( v43 < (unsigned __int8)_4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] );
1388 while ( v43 < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] );
1389 }
1390 if ( in_current_building_type == BildingType_WeaponShop )
1391 {
1392 v47 = v8->ptr_1C;
1393 v48 = 0;
1394 //if ( _4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] )
1395 if ( uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] )
1396 {
1397 do
1398 {
1399 // if ( pParty->field_777C[9 * (v48 + 12 * (int)v47)] )
1400 if ( pParty->StandartItemsInShops[(int)v47][v48].uItemID)
1401 {
1402 v49 = rand();
1403 v8 = window_SpeakInHouse;
1404 word_F8B158[v48] = v49 % (300 - ItemsInShopTexture[v48]->uTextureHeight);
1405 }
1406 v47 = v8->ptr_1C;
1407 ++v48;
1408 }
1409 //while ( v48 < (unsigned __int8)_4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] );
1410 while ( v48 < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] );
1411 }
1412 }
1413 }
1414 if ( uMessageParam == 95 )
1415 {
1416 if ( uItemsAmountPerShopType[v44] )
1417 {
1418 do
1419 {
1420 //v50 = pParty->field_C59C[9 * (v43 + 12 * (int)v42) + 724];
1421 v50=pParty->SpecialItemsInShops[(unsigned int)v42][(signed int)v43].uItemID;
1422 if ( v50 )
1423 {
1424 v51 = pIcons_LOD->LoadTexture(pItemsTable->pItems[v50].pIconName, TEXTURE_16BIT_PALETTE);
1425 //v3 = dword_F8B198;
1426 v8 = window_SpeakInHouse;
1427 ItemsInShopTexture[v43] = &pIcons_LOD->pTextures[v51];
1428 }
1429 v42 = v8->ptr_1C;
1430 ++v43;
1431 }
1432 //while ( v43 < (unsigned __int8)_4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] );
1433 while ( v43 < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] );
1434 }
1435 if ( in_current_building_type == BildingType_WeaponShop )
1436 {
1437 v52 = v8->ptr_1C;
1438 v53 = 0;
1439 //if ( _4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] )
1440 if ( uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] )
1441 {
1442 do
1443 {
1444 // if ( pParty->field_C59C[9 * (v53 + 12 * (int)v52) + 724] )
1445 if (pParty->SpecialItemsInShops[(unsigned int)v52][v53].uItemID)
1446 {
1447 v54 = rand();
1448 v8 = window_SpeakInHouse;
1449 word_F8B158[v53] = v54 % (300 - ItemsInShopTexture[v53]->uTextureHeight);
1450 }
1451 v52 = v8->ptr_1C;
1452 ++v53;
1453 }
1454 //while ( v53 < (unsigned __int8)_4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] );
1455 while ( v53 < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType ] );
1456 }
1457 }
1458 }
1459 break;
1460 }
1461 case 3:
1462 case 4:
1463 case 5:
1464 {
1465 dialog_menu_id = (HOUSE_DIALOGUE_MENU)uMessageParam;
1466 sub_421B2C_PlaceInInventory_or_DropPickedItem();
1467 break;
1468 }
1469 case 94:
1470 {
1471 pDialogueWindow->eWindowType = WINDOW_MainMenu;
1472 UI_CreateEndConversationButton();
1473 sub_4B3AD4(in_current_building_type);
1474 break;
1475 }
1476 default:
1477 {
1478 if( uMessageParam >= 36 && uMessageParam <= 72 )
1479 {
1480 //v35 = pPlayers[uActiveCharacter];
1481 //v36 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (unsigned int)v8->ptr_1C] * 500.0);
1482 v36 = (signed __int64)(p2DEvents[(unsigned int)v8->ptr_1C - 1].flt_24 * 500.0);
1483 v37 = v36 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100;
1484 if ( v37 < v36 / 3 )
1485 v37 = v36 / 3;
1486
1487 //if (false)
1488 if(byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][uMessageParam-36])
1489 //if ( *(&byte_4ED94C[37 * v35->uClass] + v55) )
1490 {
1491 //v38 = (int)(&pPlayers[uActiveCharacter]->uIntelligence + uMessageParam);
1492 if ( !pPlayers[uActiveCharacter]->pActiveSkills[uMessageParam - 36] )
1493 {
1494 if ( pParty->uNumGold < v37 )
1495 {
1496 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);
1497 if ( in_current_building_type == BildingType_Training || in_current_building_type == BildingType_Tavern )
1498 v39 = 4;
1499 else
1500 v39 = 2;
1501 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)v39);
1502 }
1503 else
1504 {
1505 Party::TakeGold(v37);
1506 dword_F8B1E4 = 1;
1507 pPlayers[uActiveCharacter]->pActiveSkills[uMessageParam - 36] = 1;
1508 pPlayers[uActiveCharacter]->PlaySound(SPEECH_78, 0);
1509 }
1510 }
1511 }
1512 }
1513 break;
1514 }
1515 } 1466 }
1516 /* 1467 /*
1517 if ( uMessageParam != 95 && uMessageParam != 2 ) 1468 if ( uMessageParam != 95 && uMessageParam != 2 )
1518 { 1469 {
1519 if ( uMessageParam == 3 ) 1470 if ( uMessageParam == 3 )
3913 } 3864 }
3914 } 3865 }
3915 3866
3916 //----- (004BA928) -------------------------------------------------------- 3867 //----- (004BA928) --------------------------------------------------------
3917 void __cdecl ArmorShopDialog() 3868 void __cdecl ArmorShopDialog()
3918 { 3869 {
3919 Player *v0; // ebx@1 3870 signed int v1; // esi@8
3920 signed int v1; // esi@8 3871 unsigned int v2; // eax@10
3921 unsigned int v2; // eax@10 3872 ItemGen *v3; // eax@11
3922 ItemGen *v3; // eax@11 3873 char *v5; // ecx@12
3923 unsigned __int8 v4; // dl@12 3874 char *v6; // eax@13
3924 char *v5; // ecx@12 3875 int v8; // eax@15
3925 char *v6; // eax@13 3876 signed int v9; // esi@17
3926 int v7; // ST08_4@15 3877 unsigned int v10; // eax@19
3927 int v8; // eax@15 3878 char *v11; // edi@19
3928 signed int v9; // esi@17 3879 int v12; // ST08_4@20
3929 unsigned int v10; // eax@19 3880 int v13; // eax@20
3930 char *v11; // edi@19 3881 char *v15; // ecx@20
3931 int v12; // ST08_4@20 3882 char **v16; // edi@22
3932 int v13; // eax@20 3883 int all_text_height; // ebx@22
3933 unsigned __int8 v14; // dl@20 3884 char **v18; // esi@22
3934 char *v15; // ecx@20 3885 int v19; // eax@23
3935 char **v16; // edi@22 3886 GUIWindow *v20; // ecx@24
3936 int all_text_height; // ebx@22 3887 int v21; // eax@24
3937 char **v18; // esi@22 3888 int v22; // edx@24
3938 int v19; // eax@23 3889 int v23; // ebx@24
3939 GUIWindow *v20; // ecx@24 3890 unsigned __int8 v24; // sf@24
3940 int v21; // eax@24 3891 GUIButton *pButton; // eax@26
3941 int v22; // edx@24 3892 unsigned int v28; // ecx@26
3942 int v23; // ebx@24 3893 int v29; // edx@26
3943 unsigned __int8 v24; // sf@24 3894 signed int v31; // esi@31
3944 GUIButton *control_button; // eax@26 3895 unsigned int v32; // eax@33
3945 GUIButton *v26; // esi@26 3896 int v33; // eax@34
3946 int v27; // eax@26 3897 int v35; // eax@35
3947 unsigned int v28; // ecx@26 3898 char *v36; // edx@36
3948 int v29; // edx@26 3899 GUIWindow *v37; // edi@42
3949 3900 signed int v38; // esi@42
3950 signed int v31; // esi@31 3901 unsigned int v39; // esi@44
3951 unsigned int v32; // eax@33 3902 int v40; // eax@44
3952 int v33; // eax@34 3903 unsigned int v41; // eax@45
3953 int v34; // ST08_4@35 3904 int v42; // eax@47
3954 int v35; // eax@35 3905 int v43; // ecx@52
3955 char *v36; // edx@36 3906 int v46; // eax@54
3956 GUIWindow *v37; // edi@42 3907 unsigned int v49; // ecx@56
3957 signed int v38; // esi@42 3908 int v51; // eax@56
3958 unsigned int v39; // esi@44 3909 int v53; // eax@60
3959 int v40; // eax@44 3910 int textureH; // eax@60
3960 unsigned int v41; // eax@45 3911 signed int textureW; // ebx@65
3961 int v42; // eax@47 3912 Texture *v56; // eax@67
3962 int v43; // ecx@52 3913 unsigned int pY_item; // edi@68
3963 GUIButton *v44; // eax@54 3914 Texture *v58; // ST1C_4@68
3964 GUIButton *v45; // esi@54 3915 int v59; // eax@68
3965 int v46; // eax@54 3916 int v60; // edi@69
3966 char *v47; // eax@56 3917 signed int v61; // ebx@73
3967 int v48; // eax@56 3918 Texture *v62; // eax@75
3968 unsigned int v49; // ecx@56 3919 int v63; // edi@76
3969 int v50; // edx@56 3920 Texture *v64; // ST1C_4@76
3970 int v51; // eax@56 3921 unsigned int v65; // ST18_4@76
3971 unsigned __int16 v52; // ax@56 3922 int v66; // eax@76
3972 int v53; // eax@60 3923 int v67; // edi@77
3973 int textureH; // eax@60 3924 signed int v68; // ecx@81
3974 signed int textureW; // ebx@65 3925 const char *pStatusText; // ecx@91
3975 Texture *v56; // eax@67 3926 void *v72; // eax@95
3976 unsigned int v57; // edi@68 3927 POINT *v73; // esi@97
3977 Texture *v58; // ST1C_4@68 3928 int v74; // ecx@97
3978 int v59; // eax@68 3929 int v75; // eax@98
3979 int v60; // edi@69 3930 int v76; // ecx@98
3980 signed int v61; // ebx@73 3931 ItemGen *selected_item; // ecx@99
3981 Texture *v62; // eax@75 3932 unsigned __int8 v78; // bl@104
3982 int v63; // edi@76 3933 int v80; // ebx@105
3983 Texture *v64; // ST1C_4@76 3934 char **v81; // esi@105
3984 unsigned int v65; // ST18_4@76 3935 int v82; // eax@106
3985 int v66; // eax@76 3936 int v86; // ebx@107
3986 int v67; // edi@77 3937 int pTextHeight; // eax@109
3987 signed int v68; // ecx@81 3938 unsigned int v90; // ecx@109
3988 SHORT v69; // bx@89 3939 int pNumString; // edx@109
3989 bool v70; // eax@89 3940 unsigned __int16 pTextColor; // ax@109
3990 const char *v71; // ecx@91 3941 signed int v93; // edx@114
3991 void *v72; // eax@95 3942 POINT *v94; // edi@120
3992 POINT *v73; // esi@97 3943 __int32 v95; // ecx@120
3993 int v74; // ecx@97 3944 void *v96; // ST14_4@122
3994 int v75; // eax@98 3945 unsigned __int8 v97; // bl@122
3995 int v76; // ecx@98 3946 ItemGen *v98; // ST10_4@122
3996 ItemGen *selected_item; // ecx@99 3947 int v99; // eax@122
3997 unsigned __int8 v78; // bl@104 3948 char *v100; // eax@122
3998 char **v79; // edi@105 3949 const char *v101; // ST18_4@122
3999 int v80; // ebx@105 3950 unsigned __int16 v102; // ST14_2@122
4000 char **v81; // esi@105 3951 int v103; // eax@122
4001 int v82; // eax@106 3952 signed int v104; // edi@123
4002 GUIWindow *v83; // ecx@107 3953 Texture *v105; // eax@125
4003 int v84; // eax@107 3954 int v106; // ebx@126
4004 int v85; // edx@107 3955 unsigned int v108; // ST18_4@126
4005 int v86; // ebx@107 3956 int v109; // eax@126
4006 GUIButton *v87; // eax@109 3957 int v110; // ebx@127
4007 GUIButton *v88; // esi@109 3958 GUIWindow *v111; // [sp-18h] [bp-11Ch]@36
4008 int v89; // eax@109 3959 unsigned int v112; // [sp-14h] [bp-118h]@13
4009 unsigned int v90; // ecx@109 3960 int v113; // [sp-14h] [bp-118h]@36
4010 int v91; // edx@109 3961 unsigned int v115; // [sp-10h] [bp-114h]@13
4011 unsigned __int16 v92; // ax@109 3962 ItemGen *v116; // [sp-10h] [bp-114h]@20
4012 signed int v93; // edx@114 3963 int v117; // [sp-10h] [bp-114h]@36
4013 POINT *v94; // edi@120 3964 unsigned __int16 v119; // [sp-Ch] [bp-110h]@13
4014 __int32 v95; // ecx@120 3965 char *v121; // [sp-8h] [bp-10Ch]@13
4015 void *v96; // ST14_4@122 3966 int v122; // [sp-8h] [bp-10Ch]@20
4016 unsigned __int8 v97; // bl@122 3967 unsigned int v123; // [sp-4h] [bp-108h]@13
4017 ItemGen *v98; // ST10_4@122 3968 __int64 *v124; // [sp-4h] [bp-108h]@20
4018 int v99; // eax@122 3969 int v125; // [sp-4h] [bp-108h]@68
4019 char *v100; // eax@122 3970 int v126; // [sp-4h] [bp-108h]@76
4020 const char *v101; // ST18_4@122 3971 int v127; // [sp-4h] [bp-108h]@126
4021 unsigned __int16 v102; // ST14_2@122 3972 POINT v128; // [sp+Ch] [bp-F8h]@8
4022 int v103; // eax@122 3973 POINT v129; // [sp+14h] [bp-F0h]@18
4023 signed int v104; // edi@123 3974 char v130; // [sp+1Ch] [bp-E8h]@120
4024 Texture *v105; // eax@125 3975 POINT a2; // [sp+24h] [bp-E0h]@8
4025 int v106; // ebx@126 3976 POINT v132; // [sp+2Ch] [bp-D8h]@120
4026 Texture *v107; // ST1C_4@126 3977 POINT v133; // [sp+34h] [bp-D0h]@17
4027 unsigned int v108; // ST18_4@126 3978 POINT v134; // [sp+3Ch] [bp-C8h]@97
4028 int v109; // eax@126 3979 POINT v135; // [sp+44h] [bp-C0h]@31
4029 int v110; // ebx@127 3980 POINT v136; // [sp+4Ch] [bp-B8h]@97
4030 GUIWindow *v111; // [sp-18h] [bp-11Ch]@36 3981 POINT v137; // [sp+54h] [bp-B0h]@17
4031 unsigned int v112; // [sp-14h] [bp-118h]@13 3982 POINT v138; // [sp+5Ch] [bp-A8h]@32
4032 int v113; // [sp-14h] [bp-118h]@36 3983 POINT v139; // [sp+64h] [bp-A0h]@17
4033 ItemGen *v114; // [sp-10h] [bp-114h]@12 3984 POINT v140; // [sp+6Ch] [bp-98h]@31
4034 unsigned int v115; // [sp-10h] [bp-114h]@13 3985 POINT v141; // [sp+74h] [bp-90h]@8
4035 ItemGen *v116; // [sp-10h] [bp-114h]@20 3986 POINT v142; // [sp+7Ch] [bp-88h]@31
4036 int v117; // [sp-10h] [bp-114h]@36 3987 POINT v143; // [sp+84h] [bp-80h]@9
4037 void *v118; // [sp-Ch] [bp-110h]@12 3988 GUIWindow dialog_window; // [sp+8Ch] [bp-78h]@1
4038 unsigned __int16 v119; // [sp-Ch] [bp-110h]@13 3989 int v146; // [sp+E4h] [bp-20h]@24
4039 void *v120; // [sp-Ch] [bp-110h]@20 3990 int pYellowColor; // [sp+E8h] [bp-1Ch]@1
4040 char *v121; // [sp-8h] [bp-10Ch]@13 3991 int pWhiteColor; // [sp+ECh] [bp-18h]@1
4041 int v122; // [sp-8h] [bp-10Ch]@20 3992 __int32 pItemCount; // [sp+F0h] [bp-14h]@8
4042 unsigned int v123; // [sp-4h] [bp-108h]@13 3993 int v152; // [sp+FCh] [bp-8h]@24
4043 __int64 *v124; // [sp-4h] [bp-108h]@20 3994 int v153; // [sp+100h] [bp-4h]@44
4044 int v125; // [sp-4h] [bp-108h]@68 3995 int th;
4045 int v126; // [sp-4h] [bp-108h]@76 3996 short text_color;
4046 int v127; // [sp-4h] [bp-108h]@126 3997 int pActiveButton;
4047 POINT v128; // [sp+Ch] [bp-F8h]@8 3998
4048 POINT v129; // [sp+14h] [bp-F0h]@18 3999 memcpy(&dialog_window, window_SpeakInHouse, sizeof(dialog_window));
4049 char v130; // [sp+1Ch] [bp-E8h]@120 4000 dialog_window.uFrameX = 483;
4050 POINT a2; // [sp+24h] [bp-E0h]@8 4001 dialog_window.uFrameWidth = 148;
4051 POINT v132; // [sp+2Ch] [bp-D8h]@120 4002 dialog_window.uFrameZ = 334;
4052 POINT v133; // [sp+34h] [bp-D0h]@17 4003 pWhiteColor = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu);
4053 POINT v134; // [sp+3Ch] [bp-C8h]@97 4004 pYellowColor = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xCDu, 0x23u);
4054 POINT v135; // [sp+44h] [bp-C0h]@31 4005 switch (dialog_menu_id)
4055 POINT v136; // [sp+4Ch] [bp-B8h]@97 4006 {
4056 POINT v137; // [sp+54h] [bp-B0h]@17
4057 POINT v138; // [sp+5Ch] [bp-A8h]@32
4058 POINT v139; // [sp+64h] [bp-A0h]@17
4059 POINT v140; // [sp+6Ch] [bp-98h]@31
4060 POINT v141; // [sp+74h] [bp-90h]@8
4061 POINT v142; // [sp+7Ch] [bp-88h]@31
4062 POINT v143; // [sp+84h] [bp-80h]@9
4063 GUIWindow dialog_window; // [sp+8Ch] [bp-78h]@1
4064 char *Str; // [sp+E0h] [bp-24h]@56
4065 int v146; // [sp+E4h] [bp-20h]@24
4066 int hilight_color; // [sp+E8h] [bp-1Ch]@1
4067 int m_text_color; // [sp+ECh] [bp-18h]@1
4068 __int32 v149; // [sp+F0h] [bp-14h]@8
4069 Player* _this; // [sp+F4h] [bp-10h]@1
4070 unsigned __int8 uPlayerID; // [sp+FBh] [bp-9h]@15
4071 int v152; // [sp+FCh] [bp-8h]@24
4072 int v153; // [sp+100h] [bp-4h]@44
4073 int th;
4074 short text_color;
4075
4076 v0 = pPlayers[uActiveCharacter];
4077 _this = pPlayers[uActiveCharacter];
4078 memcpy(&dialog_window, window_SpeakInHouse, sizeof(dialog_window));
4079 dialog_window.uFrameX = 483;
4080 dialog_window.uFrameWidth = 148;
4081 dialog_window.uFrameZ = 334;
4082 m_text_color = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu);
4083 hilight_color = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xCDu, 0x23u);
4084 switch (dialog_menu_id)
4085 {
4086 case HOUSE_DIALOGUE_MAIN: 4007 case HOUSE_DIALOGUE_MAIN:
4087 { 4008 {
4088 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) 4009 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
4089 return; 4010 return;
4090 pShopOptions[0] = pGlobalTXT_LocalizationStrings[134]; //"Buy Standard" 4011 pShopOptions[0] = pGlobalTXT_LocalizationStrings[134]; //"Buy Standard"
4091 pShopOptions[1] = pGlobalTXT_LocalizationStrings[152]; //"Buy Special" 4012 pShopOptions[1] = pGlobalTXT_LocalizationStrings[152]; //"Buy Special"
4092 pShopOptions[2] = pGlobalTXT_LocalizationStrings[159]; //"Display Inventory" 4013 pShopOptions[2] = pGlobalTXT_LocalizationStrings[159]; //"Display Inventory"
4093 pShopOptions[3] = pGlobalTXT_LocalizationStrings[160]; 4014 pShopOptions[3] = pGlobalTXT_LocalizationStrings[160];
4094 4015 all_text_height = 0;
4095 all_text_height = 0; 4016 for( int i = 0; i < 4; ++i )
4096 for(int i=0;i<4;++i) 4017 all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0);
4097 all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0); 4018 v146 = ( 174 - all_text_height ) / 4;
4098 v146 = (174 - all_text_height) / 4; 4019 v23 = ( 174 - 4 * ( 174 - all_text_height ) / 4 - all_text_height ) / 2 - ( 174 - all_text_height ) / 4 / 2 + 138;
4099 4020 pNumString = 0;
4100 v23 = (174 - 4 * (174 - all_text_height) / 4 - all_text_height) / 2 - (174 - all_text_height) / 4 / 2 + 138; 4021 if ( pDialogueWindow->pNumPresenceButton>=0 )
4101 int j=0; 4022 {
4102 if ( pDialogueWindow->pNumPresenceButton>=0 ) 4023 for (pActiveButton = pDialogueWindow->pStartingPosActiveItem; pActiveButton < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++pActiveButton)
4103 { 4024 {
4104 th = 2; 4025 pButton = pDialogueWindow->GetControl(pActiveButton);
4105 for (v152 = pDialogueWindow->pStartingPosActiveItem; v152 < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++v152) 4026 pButton->uY = v146 + v23;
4106 { 4027 pTextHeight = pFontArrus->CalcTextHeight(pShopOptions[pNumString], &dialog_window, 0, 0);
4107 control_button = pDialogueWindow->GetControl(v152); 4028 pButton->uHeight = pTextHeight;
4108 control_button->uY = v146 + v23; 4029 v23 = pButton->uY + pButton->uHeight - 1;
4109 v27 = pFontArrus->CalcTextHeight(pShopOptions[j], &dialog_window, 0, 0); 4030 pButton->uW = v23;
4110 control_button->uHeight = v27; 4031 pTextColor = pYellowColor;
4111 v23 = control_button->uY + control_button->uHeight - 1; 4032 if ( pDialogueWindow->pCurrentPosActiveItem != pActiveButton )
4112 control_button->uW = v23; 4033 pTextColor = pWhiteColor;
4113 text_color = hilight_color; 4034 dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pTextColor, pShopOptions[pNumString], 3);
4114 if ( pDialogueWindow->pCurrentPosActiveItem != th ) 4035 ++pNumString;
4115 text_color = m_text_color; 4036 }
4116 dialog_window.DrawTitleText(pFontArrus, 0, control_button->uY, text_color, pShopOptions[j], 3); 4037 }
4117 ++th; 4038 }
4118 ++j; 4039 break;
4119 }
4120 }
4121 }
4122 break;
4123 case HOUSE_DIALOGUE_SHOP_BUY_STANDARD: 4040 case HOUSE_DIALOGUE_SHOP_BUY_STANDARD:
4124 { 4041 {
4125 pRenderer->DrawTextureIndexed(8, 8, ShopTexture); 4042 pRenderer->DrawTextureIndexed(8, 8, ShopTexture);//
4126 textureW = 0; 4043 textureW = 0;
4127 v153 = 0; 4044 v153 = 0;
4128 for(int i=0; i<8; ++i) 4045 for ( int i = 0; i < 8; ++i )//
4129 { 4046 {
4130 if ( pParty->StandartItemsInShops[window_SpeakInHouse->par1C][i].uItemID) 4047 if ( pParty->StandartItemsInShops[window_SpeakInHouse->par1C][i].uItemID)
4131 { 4048 {
4132 textureW = ItemsInShopTexture[i]->uTextureWidth; 4049 textureW = ItemsInShopTexture[i]->uTextureWidth;
4133 textureH = ItemsInShopTexture[i]->uTextureHeight; 4050 textureH = ItemsInShopTexture[i]->uTextureHeight;
4134 if ( i >= 4 ) //low row 4051 if ( i >= 4 ) //low row
4135 { 4052 {
4136 v60 = 90 - (textureW/2); 4053 v60 = 90 - (textureW/2);
4137 pRenderer->DrawTextureTransparent(v60 + v153 - 420, 126, ItemsInShopTexture[i]); 4054 pRenderer->DrawTextureTransparent(v60 + v153 - 420, 126, ItemsInShopTexture[i]);
4138 v59 = v60 + v153 + 80220; 4055 v59 = v60 + v153 + 80220;
4139 } 4056 }
4140 else 4057 else
4141 { 4058 {
4142 v57 = 98 - textureH; 4059 pY_item = 98 - textureH;
4143 v152 = 86 - (textureW/2); 4060 v152 = 86 - (textureW/2);
4144 pRenderer->DrawTextureTransparent(v153 + v152, v57, ItemsInShopTexture[i]); 4061 pRenderer->DrawTextureTransparent(v152 + v153, pY_item, ItemsInShopTexture[i]);
4145 v59 = v153 + v152 + 640 * v57; 4062 v59 = v153 + v152 + 640 * pY_item;
4146 } 4063 }
4147 ZBuffer_DoFill(&pRenderer->pActiveZBuffer[v59], ItemsInShopTexture[i], i+1); 4064 ZBuffer_DoFill(&pRenderer->pActiveZBuffer[v59], ItemsInShopTexture[i], i + 1);
4148 } 4065 }
4149 v153 += 105; 4066 v153 += 105;
4150 4067 }
4151 } 4068 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
4152 4069 return;
4153 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) 4070 pItemCount = 0;
4154 return; 4071 for ( int i = 0; i < 8; ++i )
4155 4072 {
4156 v149 = 0; 4073 if ( pParty->StandartItemsInShops[window_SpeakInHouse->par1C][i].uItemID )
4157 for(int i=0; i<8; ++i) 4074 ++pItemCount;
4158 { 4075 }
4159 if ( pParty->StandartItemsInShops[window_SpeakInHouse->par1C][i].uItemID) 4076 if ( GetAsyncKeyState(17) == 0 || pPlayers[uActiveCharacter]->CanSteal() == 0 )
4160 ++v149; 4077 pStatusText = pGlobalTXT_LocalizationStrings[195]; //"Select the Item to Buy"
4161 4078 else
4162 } 4079 pStatusText = pGlobalTXT_LocalizationStrings[185];//"Steal item"
4163 4080 DrawTextAtStatusBar(pStatusText, 0);
4164 v69 = GetAsyncKeyState(17); 4081 if ( pItemCount != 0 )
4165 v70 = _this->CanSteal(); 4082 {
4166 //Str = (char *)v70; 4083 v73 = pMouse->GetCursorPos(&v136);
4167 if ( v69 == 0 || v70 == 0 ) 4084 v74 = pRenderer->pActiveZBuffer[v73->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v134)->y]] & 0xFFFF;
4168 { 4085 if ( !v74 )
4169 v71 = pGlobalTXT_LocalizationStrings[195]; //"Select the Item to Buy" 4086 return;
4170 } 4087 pItemCount = v74 - 1;
4088 selected_item = &pParty->StandartItemsInShops[window_SpeakInHouse->par1C][v74-1];
4089 if ( GetAsyncKeyState(17) == 0 || pPlayers[uActiveCharacter]->CanSteal() == 0)
4090 v15 = (char *)pMerchantsBuyPhrases[pPlayers[uActiveCharacter]->_490EEE(selected_item, 2, window_SpeakInHouse->par1C, 2)];
4171 else 4091 else
4172 { 4092 v15 = pGlobalTXT_LocalizationStrings[181]; //"Steal %24"
4173 v71 = pGlobalTXT_LocalizationStrings[185];//"Steal item" 4093 v36 = BuilDialogueString(v15, uActiveCharacter - 1, selected_item, (char *)window_SpeakInHouse->ptr_1C, 2, 0);
4174 } 4094 v115 = (174 - pFontArrus->CalcTextHeight(v36, &dialog_window, 0, 0)) / 2 + 138;
4175 DrawTextAtStatusBar(v71, 0); 4095 dialog_window.DrawTitleText(pFontArrus, 0, v115, pWhiteColor, v36, 3);
4176 if ( v149 != 0 )
4177 {
4178 v73 = pMouse->GetCursorPos(&v136);
4179 v74 = pRenderer->pActiveZBuffer[v73->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v134)->y]] & 0xFFFF;
4180 if ( !v74 )
4181 return;
4182 v149 = v74 - 1;
4183 selected_item = &pParty->StandartItemsInShops[window_SpeakInHouse->par1C][v74-1];
4184 if ( v69 ==0 || v70 == 0)
4185 {
4186 v120 = window_SpeakInHouse->ptr_1C;
4187 v15 = (char *)pMerchantsBuyPhrases[_this->_490EEE(selected_item, 2, window_SpeakInHouse->par1C, 2)];
4188 }
4189 else
4190 {
4191 v120 = window_SpeakInHouse->ptr_1C;
4192 v15 = pGlobalTXT_LocalizationStrings[181]; //"Steal %24"
4193 }
4194 v36 = BuilDialogueString(v15, uActiveCharacter - 1, selected_item, (char *)v120, 2, 0);
4195 v115 = (174 - pFontArrus->CalcTextHeight(v36, &dialog_window, 0, 0)) / 2 + 138;
4196 dialog_window.DrawTitleText(pFontArrus, 0, v115, m_text_color, v36, 3);
4197 return;
4198 }
4199 dialog_window.DrawCurrentTime( pParty->field_3C.field_50[window_SpeakInHouse->par1C]- pParty->uTimePlayed);
4200 return; 4096 return;
4201 } 4097 }
4202 break; 4098 dialog_window.DrawCurrentTime( pParty->field_3C.field_50[window_SpeakInHouse->par1C]- pParty->uTimePlayed);
4099 return;
4100 }
4101 break;
4102 case HOUSE_DIALOGUE_SHOP_BUY_SPECIAL:
4103 {
4104 pRenderer->DrawTextureIndexed(8, 8, ShopTexture);
4105 v11 = 0;
4106 v61 = 0;
4107 v153 = 0;
4108 do
4109 {
4110 if (pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][v61].uItemID)
4111 {
4112 v62 = ItemsInShopTexture[v61];
4113 if ( v61 >= 4 )
4114 {
4115 v67 = 90 - ((signed int)v62->uTextureWidth >> 1);
4116 pRenderer->DrawTextureTransparent(v153 + v67 - 420, 0x7Eu, ItemsInShopTexture[v61]);
4117 v66 = v153 + v67 + 80220;
4118 }
4119 else
4120 {
4121 v63 = 98 - v62->uTextureHeight;
4122 v64 = ItemsInShopTexture[v61];
4123 v65 = 98 - v62->uTextureHeight;
4124 v152 = 86 - ((signed int)v62->uTextureWidth >> 1);
4125 pRenderer->DrawTextureTransparent(v152 + v153, v65, v64);
4126 v66 = v152 + v153 + 640 * v63;
4127 }
4128 ZBuffer_DoFill(&pRenderer->pActiveZBuffer[v66], ItemsInShopTexture[v61], v61 + 1);
4129 }
4130 v153 += 105;
4131 ++v61;
4132 }
4133 while ( v61 < 8 );
4134 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
4135 return;
4136 v68 = 0;
4137 pItemCount = 0;
4138 do
4139 {
4140 // if ( (char *)pParty->field_C59C[9 * (v68 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] != v11 )
4141 if (pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][(signed int)v68].uItemID)
4142 ++pItemCount;
4143 ++v68;
4144 }
4145 while ( v68 < 6 );
4146 if ( GetAsyncKeyState(17) == 0 || pPlayers[uActiveCharacter]->CanSteal() == 0 )
4147 pStatusText = pGlobalTXT_LocalizationStrings[196]; //Select the Special Item to Buy"
4148 else
4149 pStatusText = pGlobalTXT_LocalizationStrings[185];
4150 DrawTextAtStatusBar(pStatusText, 0);
4151 if ( (char *)pItemCount != 0 )
4152 {
4153 v73 = pMouse->GetCursorPos(&v136);
4154 v74 = pRenderer->pActiveZBuffer[v73->x + pSRZBufferLineOffsets[pMouse->GetCursorPos((POINT *)&v134)->y]] & 0xFFFF;
4155 if ( !v74 )
4156 return;
4157 pItemCount = v74 - 1;
4158 if ( dialog_menu_id == 2 )
4159 selected_item = &pParty->StandartItemsInShops[window_SpeakInHouse->par1C][v74-1];
4160 else
4161 selected_item = &pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][v74-1];//(ItemGen *)&pParty->field_C59C[v76 + 724];
4162 if ( GetAsyncKeyState(17) == 0 || pPlayers[uActiveCharacter]->CanSteal() == 0 )
4163 v15 = (char *)pMerchantsBuyPhrases[pPlayers[uActiveCharacter]->_490EEE(selected_item, 2, window_SpeakInHouse->par1C, 2)];
4164 else
4165 v15 = pGlobalTXT_LocalizationStrings[181]; //"Steal %24"
4166 v36 = BuilDialogueString(v15, uActiveCharacter - 1, selected_item, (char *)window_SpeakInHouse->ptr_1C, 2, 0);
4167 v115 = (174 - pFontArrus->CalcTextHeight(v36, &dialog_window, 0, 0)) / 2 + 138;
4168 dialog_window.DrawTitleText(pFontArrus, 0, v115, pWhiteColor, v36, 3);
4169 return;
4170 }
4171 dialog_window.DrawCurrentTime( pParty->field_3C.field_50[window_SpeakInHouse->par1C]- pParty->uTimePlayed);
4172 return;
4173 }
4174 break;
4175 case HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT:
4176 {
4177 draw_leather();
4178 CharacterUI_InventoryTab_Draw(uActiveCharacter, 1);
4179 pShopOptions[0] = pGlobalTXT_LocalizationStrings[200]; //"Sell"
4180 pShopOptions[1] = pGlobalTXT_LocalizationStrings[113]; //"Identify"
4181 pShopOptions[2] = pGlobalTXT_LocalizationStrings[179]; //"Repair"
4182 all_text_height = 0;
4183 for ( int i = 0; i < 3; ++i )
4184 all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0);
4185 v152 = (174 - all_text_height) / 3;
4186 v86 = (3 * (58 - v152) - all_text_height) / 2 - v152 / 2 + 138;
4187 v24 = -pDialogueWindow->pNumPresenceButton < 0;
4188 pActiveButton = pDialogueWindow->pStartingPosActiveItem;
4189 if ( v24 ^ pDialogueWindow->pStartingPosActiveItem > pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton )
4190 {
4191 pNumString = 0;
4192 do
4193 {
4194 pButton = pDialogueWindow->GetControl((unsigned int)pActiveButton);
4195 pButton->uY = v152 + v86;
4196 pTextHeight = pFontArrus->CalcTextHeight(pShopOptions[pNumString], &dialog_window, 0, 0);
4197 v90 = pButton->uY;
4198 pButton->uHeight = pTextHeight;
4199 v86 = v90 + pTextHeight - 1;
4200 pButton->uW = v86;
4201 pTextColor = pYellowColor;
4202 if ( pDialogueWindow->pCurrentPosActiveItem != pActiveButton )
4203 pTextColor = pWhiteColor;
4204 dialog_window.DrawTitleText(pFontArrus, 0, v90, pTextColor, pShopOptions[pNumString], 3);
4205 ++pNumString;
4206 ++pActiveButton;
4207 }
4208 while ( (signed int)pActiveButton < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem );
4209 }
4210 return;
4211 }
4212 break;
4203 case HOUSE_DIALOGUE_SHOP_SELL: 4213 case HOUSE_DIALOGUE_SHOP_SELL:
4204 { 4214 {
4205 draw_leather(); 4215 draw_leather();
4206 CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); 4216 CharacterUI_InventoryTab_Draw(uActiveCharacter, 1);
4207 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[199], 0);//"Select the Item to Sell" 4217 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[199], 0);//"Select the Item to Sell"
4208 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win()) 4218 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win())
4209 return; 4219 return;
4210 4220 if((v9 = pMouse->GetCursorPos(&v139)->x - 14, pItemCount = (v9 >> 5) + 14 * ((pMouse->GetCursorPos(&v133)->y - 17) >> 5),
4211 if((v9 = pMouse->GetCursorPos(&v139)->x - 14, v149 = (v9 >> 5) + 14 * ((pMouse->GetCursorPos(&v133)->y - 17) >> 5),
4212 pMouse->GetCursorPos(&v137)->x <= 13) || pMouse->GetCursorPos(&v129)->x >= 462 4221 pMouse->GetCursorPos(&v137)->x <= 13) || pMouse->GetCursorPos(&v129)->x >= 462
4213 || (v10 = v0->GetItemIDAtInventoryIndex((int *)&v149), v11 = 0, !v10) ) 4222 || (v10 = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&pItemCount), v11 = 0, !v10) )
4214 return; 4223 return;
4215 4224 v116 = (ItemGen *)&pPlayers[uActiveCharacter]->pInventoryItems[v10-1];
4216 v116 = (ItemGen *)&v0->pInventoryItems[v10-1]; 4225 v13 = pPlayers[uActiveCharacter]->_490EEE(v116, 2, window_SpeakInHouse->par1C, 3);
4217 v13 = v0->_490EEE(v116, 2, window_SpeakInHouse->par1C, 3); 4226 v15 = (char *)pMerchantsSellPhrases[pPlayers[uActiveCharacter]->_490EEE(v116, 2, window_SpeakInHouse->par1C, 3)];
4218 v15 = (char *)pMerchantsSellPhrases[v0->_490EEE(v116, 2, window_SpeakInHouse->par1C, 3)];
4219 v36 = BuilDialogueString(v15, uActiveCharacter - 1, v116, (char *) window_SpeakInHouse->par1C, 3, 0); 4227 v36 = BuilDialogueString(v15, uActiveCharacter - 1, v116, (char *) window_SpeakInHouse->par1C, 3, 0);
4220 v115 = (174 - pFontArrus->CalcTextHeight(v36, &dialog_window, 0, 0)) / 2 + 138; 4228 v115 = (174 - pFontArrus->CalcTextHeight(v36, &dialog_window, 0, 0)) / 2 + 138;
4221 dialog_window.DrawTitleText(pFontArrus, 0, v115, m_text_color, v36, 3); 4229 dialog_window.DrawTitleText(pFontArrus, 0, v115, pWhiteColor, v36, 3);
4222 return; 4230 return;
4223 } 4231 }
4224 break; 4232 break;
4225 case HOUSE_DIALOGUE_SHOP_IDENTIFY: 4233 case HOUSE_DIALOGUE_SHOP_IDENTIFY:
4226 { 4234 {
4227 draw_leather(); 4235 draw_leather();
4228 CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); 4236 CharacterUI_InventoryTab_Draw(uActiveCharacter, 1);
4229 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[197], 0); //"Select the Item to Identify" 4237 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[197], 0); //"Select the Item to Identify"
4230 if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) 4238 if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
4239 {
4240 v1 = pMouse->GetCursorPos(&a2)->x - 14;
4241 pItemCount = (v1 >> 5) + 14 * ((pMouse->GetCursorPos(&v128)->y - 17) >> 5);
4242 if ( pMouse->GetCursorPos(&v141)->x > 13 )
4243 {
4244 if ( pMouse->GetCursorPos(&v143)->x < 462 )
4245 {
4246 v2 = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&pItemCount);
4247 if ( v2 )
4231 { 4248 {
4232 v1 = pMouse->GetCursorPos(&a2)->x - 14; 4249 v3 = (ItemGen *)&pPlayers[uActiveCharacter]->pInventoryItems[v2-1];
4233 v149 = (v1 >> 5) + 14 * ((pMouse->GetCursorPos(&v128)->y - 17) >> 5); 4250 if (v3->Identified())
4234 if ( pMouse->GetCursorPos(&v141)->x > 13 ) 4251 v5 = "%24";
4235 { 4252 else
4236 if ( pMouse->GetCursorPos(&v143)->x < 462 ) 4253 {
4237 { 4254 v8 = pPlayers[uActiveCharacter]->_490EEE(v3, 2, (int)window_SpeakInHouse->ptr_1C, 4);
4238 v2 = v0->GetItemIDAtInventoryIndex((int *)&v149); 4255 v5 = (char *)pMerchantsIdentifyPhrases[v8];
4239 if ( v2 ) 4256 }
4240 { 4257 v6 = BuilDialogueString(v5, uActiveCharacter - 1, v3, (char *)window_SpeakInHouse->ptr_1C, 4, 0);
4241 v3 = (ItemGen *)&v0->pInventoryItems[v2-1]; 4258 v115 = (174 - pFontArrus->CalcTextHeight(v6, &dialog_window, 0, 0)) / 2 + 138;
4242 if (v3->Identified()) 4259 dialog_window.DrawTitleText(pFontArrus, 0, v115, pWhiteColor, v6, 3);
4243 { 4260 return;
4244 v118 = window_SpeakInHouse->ptr_1C;
4245 v4 = uActiveCharacter - 1;
4246 v5 = "%24";
4247 v114 = v3;
4248 }
4249 else
4250 {
4251 v118 = window_SpeakInHouse->ptr_1C;
4252 v114 = v3;
4253 v7 = (int)window_SpeakInHouse->ptr_1C;
4254 uPlayerID = uActiveCharacter - 1;
4255 v8 = v0->_490EEE(v3, 2, v7, 4);
4256 v4 = uPlayerID;
4257 v5 = (char *)pMerchantsIdentifyPhrases[v8];
4258 }
4259 v6 = BuilDialogueString(v5, v4, v114, (char *)v118, 4, 0);
4260 v115 = (174 - pFontArrus->CalcTextHeight(v6, &dialog_window, 0, 0)) / 2 + 138;
4261 dialog_window.DrawTitleText(pFontArrus, 0, v115, m_text_color, v6, 3);
4262 return;
4263 }
4264 }
4265 }
4266 } 4261 }
4267 } 4262 }
4268 break; 4263 }
4264 }
4265 }
4266 break;
4269 case HOUSE_DIALOGUE_SHOP_REPAIR: 4267 case HOUSE_DIALOGUE_SHOP_REPAIR:
4270 { 4268 {
4271 draw_leather(); 4269 draw_leather();
4272 CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); 4270 CharacterUI_InventoryTab_Draw(uActiveCharacter, 1);
4273 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[198], 0); 4271 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[198], 0);
4274 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win()) 4272 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win())
4275 return; 4273 return;
4276 4274 if( (v31 = pMouse->GetCursorPos(&v135)->x - 14,
4277 if( (v31 = pMouse->GetCursorPos(&v135)->x - 14, 4275 pItemCount = (v31 >> 5) + 14 * ((pMouse->GetCursorPos(&v142)->y - 17) >> 5),
4278 v149 = (v31 >> 5) + 14 * ((pMouse->GetCursorPos(&v142)->y - 17) >> 5),
4279 pMouse->GetCursorPos(&v140)->x <= 13) 4276 pMouse->GetCursorPos(&v140)->x <= 13)
4280 || pMouse->GetCursorPos(&v138)->x >= 462 4277 || pMouse->GetCursorPos(&v138)->x >= 462
4281 || (v32 = v0->GetItemIDAtInventoryIndex((int *)&v149), v11 = 0, !v32) 4278 || (v32 = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&pItemCount), v11 = 0, !v32)
4282 || (v33 = 9 * v32, !(v0->field_1F5[4 * v33 + 15] & 2)) ) 4279 || (v33 = 9 * v32, !(pPlayers[uActiveCharacter]->field_1F5[4 * v33 + 15] & 2)) )
4283 return;
4284
4285
4286 v120 = window_SpeakInHouse->ptr_1C;
4287 v116 = (ItemGen *)&v0->spellbook.pDarkSpellbook.bIsSpellAvailable[4 * v33 + 5];
4288 v34 = (int)window_SpeakInHouse->ptr_1C;
4289 uPlayerID = uActiveCharacter - 1;
4290 v35 = v0->_490EEE((ItemGen *)&v0->spellbook.pDarkSpellbook.bIsSpellAvailable[4 * v33 + 5], 2, v34, 5);
4291 v14 = uPlayerID;
4292 v15 = (char *)pMerchantsRepairPhrases[v35];
4293 v36 = BuilDialogueString(v15, v14, v116, (char *)v120, 5, 0);
4294 v115 = (174 - pFontArrus->CalcTextHeight(v36, &dialog_window, 0, 0)) / 2 + 138;
4295 dialog_window.DrawTitleText(pFontArrus, 0, v115, m_text_color, v36, 3);
4296 return; 4280 return;
4297 } 4281 v116 = &pPlayers[uActiveCharacter]->pInventoryItems[v33 - 1];
4298 break; 4282 v35 = pPlayers[uActiveCharacter]->_490EEE(&pPlayers[uActiveCharacter]->pInventoryItems[v33 - 1], 2, (int)window_SpeakInHouse->ptr_1C, 5);
4299 case HOUSE_DIALOGUE_SHOP_6: //buy standart 4283 v15 = (char *)pMerchantsRepairPhrases[v35];
4300 { 4284 v36 = BuilDialogueString(v15, uActiveCharacter - 1, v116, (char *)window_SpeakInHouse->ptr_1C, 5, 0);
4301 pRenderer->DrawTextureIndexed(8u, 8u, ShopTexture); 4285 v115 = (174 - pFontArrus->CalcTextHeight(v36, &dialog_window, 0, 0)) / 2 + 138;
4302 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[195], 0); //"Select the Item to Buy" 4286 dialog_window.DrawTitleText(pFontArrus, 0, v115, pWhiteColor, v36, 3);
4303 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) 4287 return;
4304 return; 4288 }
4305 v149 = 0; 4289 break;
4306 for(int i=0;i<6;++i) 4290 case HOUSE_DIALOGUE_SHOP_6: //buy standart ???
4307 if (pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][i].uItemID) 4291 {
4308 ++v149; 4292 pRenderer->DrawTextureIndexed(8u, 8u, ShopTexture);
4309 4293 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[195], 0); //"Select the Item to Buy"
4310 4294 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
4311 if ( v149 ) 4295 return;
4296 pItemCount = 0;
4297 for( int i = 0; i < 6 ; ++i )
4298 if (pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][i].uItemID)
4299 ++pItemCount;
4300 if ( pItemCount )
4301 {
4302 v94 = pMouse->GetCursorPos(&v132);
4303 pItemCount = pRenderer->pActiveZBuffer[v94->x + pSRZBufferLineOffsets[pMouse->GetCursorPos((POINT *)&v130)->y]];
4304 v95 = pItemCount;
4305 if ( pItemCount && pItemCount != -65536 )
4306 {
4307 --pItemCount;
4308 v97 = uActiveCharacter - 1;
4309 v99 = pPlayers[uActiveCharacter]->_490EEE(&pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][v95-1], 2, window_SpeakInHouse->par1C, 2);
4310 v100 = BuilDialogueString((char *)pMerchantsBuyPhrases[v99], uActiveCharacter - 1, v98, (char *)window_SpeakInHouse->par1C, 2, 0);
4311 v103 = pFontArrus->CalcTextHeight(v100, &dialog_window, 0, 0);
4312 dialog_window.DrawTitleText(pFontArrus, 0, (174 - v103) / 2 + 138, pWhiteColor, v100, 3);
4313 }
4314 v104 = 0;
4315 v153 = 0;
4316 do
4317 {
4318 //if ( pParty->field_C59C[9 * (v104 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] )
4319 if (pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][v104].uItemID)
4320 {
4321 v105 = ItemsInShopTexture[v104];
4322 if ( v104 >= 4 )
4312 { 4323 {
4313 v94 = pMouse->GetCursorPos(&v132); 4324 v110 = 90 - ((signed int)v105->uTextureWidth >> 1);
4314 v149 = pRenderer->pActiveZBuffer[v94->x + pSRZBufferLineOffsets[pMouse->GetCursorPos((POINT *)&v130)->y]]; 4325 pRenderer->DrawTextureTransparent(v153 + v110 - 420, 0x7Eu, ItemsInShopTexture[v104]);
4315 v95 = v149; 4326 v127 = v104 + 1;
4316 if ( v149 && v149 != -65536 ) 4327 v109 = v153 + v110 + 80220;
4317 {
4318 --v149;
4319
4320 v97 = uActiveCharacter - 1;
4321
4322 v99 = _this->_490EEE(
4323 &pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][v95-1], 2, window_SpeakInHouse->par1C, 2);
4324 v100 = BuilDialogueString((char *)pMerchantsBuyPhrases[v99], uActiveCharacter - 1, v98, (char *)window_SpeakInHouse->par1C, 2, 0);
4325 v103 = pFontArrus->CalcTextHeight(v100, &dialog_window, 0, 0);
4326 dialog_window.DrawTitleText(pFontArrus, 0, (174 - v103) / 2 + 138, m_text_color, v100, 3);
4327 }
4328 v104 = 0;
4329 v153 = 0;
4330 do
4331 {
4332 //if ( pParty->field_C59C[9 * (v104 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] )
4333 if (pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][v104].uItemID)
4334 {
4335 v105 = ItemsInShopTexture[v104];
4336 if ( v104 >= 4 )
4337 {
4338 v110 = 90 - ((signed int)v105->uTextureWidth >> 1);
4339 pRenderer->DrawTextureTransparent(v153 + v110 - 420, 0x7Eu, ItemsInShopTexture[v104]);
4340 v127 = v104 + 1;
4341 v109 = v153 + v110 + 80220;
4342 }
4343 else
4344 {
4345 v106 = 98 - v105->uTextureHeight;
4346 v107 = ItemsInShopTexture[v104];
4347 v108 = 98 - v105->uTextureHeight;
4348 v152 = 86 - ((signed int)v105->uTextureWidth >> 1);
4349 pRenderer->DrawTextureTransparent(v152 + v153, v108, v107);
4350 v127 = v104 + 1;
4351 v109 = v152 + v153 + 640 * v106;
4352 }
4353 ZBuffer_DoFill(&pRenderer->pActiveZBuffer[v109], ItemsInShopTexture[v104], v127);
4354 }
4355 v153 += 105;
4356 ++v104;
4357 }
4358 while ( v104 < 8 );
4359 return;
4360 } 4328 }
4361 dialog_window.DrawCurrentTime(pParty->field_3C.field_50[window_SpeakInHouse->par1C]- pParty->uTimePlayed); 4329 else
4330 {
4331 v106 = 98 - v105->uTextureHeight;
4332 v108 = 98 - v105->uTextureHeight;
4333 v152 = 86 - ((signed int)v105->uTextureWidth >> 1);
4334 pRenderer->DrawTextureTransparent(v152 + v153, v108, ItemsInShopTexture[v104]);
4335 v127 = v104 + 1;
4336 v109 = v152 + v153 + 640 * v106;
4337 }
4338 ZBuffer_DoFill(&pRenderer->pActiveZBuffer[v109], ItemsInShopTexture[v104], v127);
4339 }
4340 v153 += 105;
4341 ++v104;
4342 }
4343 while ( v104 < 8 );
4362 return; 4344 return;
4363 } 4345 }
4364 break; 4346 dialog_window.DrawCurrentTime(pParty->field_3C.field_50[window_SpeakInHouse->par1C]- pParty->uTimePlayed);
4365 case HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT: 4347 return;
4366 { 4348 }
4367 draw_leather(); 4349 break;
4368 CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); 4350 case HOUSE_DIALOGUE_LEARN_SKILLS:
4369 v79 = pShopOptions; 4351 {
4370 pShopOptions[0] = pGlobalTXT_LocalizationStrings[200]; //"Sell" 4352 if (!sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
4371 pShopOptions[1] = pGlobalTXT_LocalizationStrings[113]; //"Identify" 4353 return;
4372 pShopOptions[2] = pGlobalTXT_LocalizationStrings[179]; //"Repair" 4354 v152 = 0;
4373 4355 v37 = pDialogueWindow;
4374 all_text_height = 0; 4356 //v38 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (unsigned int)ptr_507BC0->ptr_1C] * 500.0);
4375 for(int i=0;i<3;++i) 4357 v38 = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0);
4376 all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0); 4358 pActiveButton = v38 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100;
4377 v83 = pDialogueWindow; 4359 if ( (signed int)pActiveButton < v38 / 3 )
4378 v152 = (174 - all_text_height) / 3; 4360 pActiveButton = v38 / 3;
4379 v84 = pDialogueWindow->pStartingPosActiveItem; 4361 v39 = v37->pStartingPosActiveItem;
4380 v85 = v84 + pDialogueWindow->pNumPresenceButton; 4362 v40 = v37->pNumPresenceButton;
4381 v86 = (3 * (58 - v152) - all_text_height) / 2 - v152 / 2 + 138; 4363 v153 = 0;
4382 v24 = -pDialogueWindow->pNumPresenceButton < 0; 4364 if ( (signed int)v39 < (signed int)(v39 + v40) )
4383 _this = (Player *)pDialogueWindow->pStartingPosActiveItem; 4365 {
4384 if ( v24 ^ __OFSUB__(v84, v85) ) 4366 do
4385 { 4367 {
4368 v41 = v37->GetControl(v39)->msg_param - 36;
4369 if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][v41] && !pPlayers[uActiveCharacter]->pActiveSkills[v41] )
4370 {
4371 v42 = pFontArrus->CalcTextHeight(pSkillNames[v41], &dialog_window, 0, 0);
4372 v152 += v42;
4373 ++v153;
4374 }
4375 ++v39;
4376 }
4377 while ( (signed int)v39 < v37->pNumPresenceButton + v37->pStartingPosActiveItem );
4378 if ( v153 )
4379 {
4380 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], pActiveButton);
4381 dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3);
4382 pActiveButton = (149 - v152) / v153;
4383 if ( (149 - v152) / v153 > 32 )
4384 pActiveButton = 32;
4385 v43 = (149 - v153 * (signed int)pActiveButton - v152) / 2 - (signed int)pActiveButton / 2 + 162;
4386 v152 = v37->pStartingPosActiveItem;
4387 v146 = v43;
4388 if ( v152 < v152 + v37->pNumPresenceButton )
4389 {
4386 v153 = 2; 4390 v153 = 2;
4387 do 4391 do
4388 { 4392 {
4389 v87 = v83->GetControl((unsigned int)_this); 4393 pButton = v37->GetControl(v152);
4390 v88 = v87; 4394 v46 = pButton->msg_param - 36;
4391 v87->uY = v152 + v86; 4395 if ( !byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][v46] || pPlayers[uActiveCharacter]->pActiveSkills[v46] )
4392 v89 = pFontArrus->CalcTextHeight(*v79, &dialog_window, 0, 0); 4396 {
4393 v90 = v88->uY; 4397 pButton->uW = 0;
4394 v91 = v153; 4398 pButton->uHeight = 0;
4395 v88->uHeight = v89; 4399 pButton->uY = 0;
4396 v86 = v90 + v89 - 1; 4400 }
4397 v88->uW = v86; 4401 else
4398 v92 = hilight_color; 4402 {
4399 if ( pDialogueWindow->pCurrentPosActiveItem != v91 ) 4403 pButton->uY = (unsigned int)((char *)pActiveButton + v146);
4400 v92 = m_text_color; 4404 pTextHeight = pFontArrus->CalcTextHeight(pSkillNames[v46], &dialog_window, 0, 0);
4401 dialog_window.DrawTitleText(pFontArrus, 0, v90, v92, *v79, 3u); 4405 v49 = pButton->uY;
4402 v83 = pDialogueWindow; 4406 pButton->uHeight = pTextHeight;
4403 ++v153; 4407 v51 = v49 + pTextHeight - 1;
4404 ++v79; 4408 pButton->uW = v51;
4405 _this = (Player *)((char *)_this + 1); 4409 v146 = v51;
4406 } 4410 pTextColor = pYellowColor;
4407 while ( (signed int)_this < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem ); 4411 if ( pDialogueWindow->pCurrentPosActiveItem != v153 )
4412 pTextColor = pWhiteColor;
4413 dialog_window.DrawTitleText(pFontArrus, 0, v49, pTextColor, pSkillNames[v46], 3);
4414 }
4415 v53 = v37->pStartingPosActiveItem;
4416 ++v152;
4417 textureH = v37->pNumPresenceButton + v53;
4418 ++v153;
4408 } 4419 }
4409 return; 4420 while ( v152 < textureH );
4410 } 4421 }
4411 break; 4422 return;
4412 case HOUSE_DIALOGUE_SHOP_BUY_SPECIAL: 4423 }
4413 { 4424 }
4414 pRenderer->DrawTextureIndexed(8, 8, ShopTexture); 4425 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]); //"Seek knowledge elsewhere %s the %s"
4415 v11 = 0; 4426 strcat(pTmpBuf, "\n \n");
4416 v61 = 0; 4427 strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]); //"I can offer you nothing further."
4417 v153 = 0; 4428 v115 = (174 - pFontArrus->CalcTextHeight(pTmpBuf, &dialog_window, 0, 0)) / 2 + 138;
4418 do 4429 dialog_window.DrawTitleText(pFontArrus, 0, v115, pYellowColor, pTmpBuf, 3);
4419 { 4430 return;
4420 if (pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][v61].uItemID) 4431 }
4421 { 4432 break;
4422 v62 = ItemsInShopTexture[v61]; 4433 }
4423 if ( v61 >= 4 ) 4434 }
4424 {
4425 v67 = 90 - ((signed int)v62->uTextureWidth >> 1);
4426 pRenderer->DrawTextureTransparent(v153 + v67 - 420, 0x7Eu, ItemsInShopTexture[v61]);
4427 v66 = v153 + v67 + 80220;
4428 }
4429 else
4430 {
4431 v63 = 98 - v62->uTextureHeight;
4432 v64 = ItemsInShopTexture[v61];
4433 v65 = 98 - v62->uTextureHeight;
4434 v152 = 86 - ((signed int)v62->uTextureWidth >> 1);
4435 pRenderer->DrawTextureTransparent(v152 + v153, v65, v64);
4436 v66 = v152 + v153 + 640 * v63;
4437 }
4438 ZBuffer_DoFill(&pRenderer->pActiveZBuffer[v66], ItemsInShopTexture[v61], v61 + 1);
4439 }
4440 v153 += 105;
4441 ++v61;
4442 }
4443 while ( v61 < 8 );
4444
4445 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
4446 return;
4447 v68 = 0;
4448 v149 = 0;
4449
4450 do
4451 {
4452 // if ( (char *)pParty->field_C59C[9 * (v68 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] != v11 )
4453 if (pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][(signed int)v68].uItemID)
4454 ++v149;
4455 ++v68;
4456 }
4457 while ( v68 < 6 );
4458
4459 v69 = GetAsyncKeyState(17);
4460 v70 = _this->CanSteal();
4461 Str = (char *)v70;
4462 if ( v69 == 0 || (char *)v70 == 0 )
4463 {
4464 v71 = pGlobalTXT_LocalizationStrings[196]; //Select the Special Item to Buy"
4465 }
4466 else
4467 {
4468 v71 = pGlobalTXT_LocalizationStrings[185];
4469 }
4470 DrawTextAtStatusBar(v71, 0);
4471 if ( (char *)v149 != 0 )
4472 {
4473 v73 = pMouse->GetCursorPos(&v136);
4474 v74 = pRenderer->pActiveZBuffer[v73->x + pSRZBufferLineOffsets[pMouse->GetCursorPos((POINT *)&v134)->y]] & 0xFFFF;
4475 if ( !v74 )
4476 return;
4477 v149 = v74 - 1;
4478
4479 if ( dialog_menu_id == 2 )
4480 selected_item = &pParty->StandartItemsInShops[window_SpeakInHouse->par1C][v74-1];
4481 else
4482 selected_item = &pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][v74-1];//(ItemGen *)&pParty->field_C59C[v76 + 724];
4483 if ( v69 == 0 || Str == 0 )
4484 {
4485 v120 = window_SpeakInHouse->ptr_1C;
4486 v15 = (char *)pMerchantsBuyPhrases[_this->_490EEE(selected_item, 2, window_SpeakInHouse->par1C, 2)];
4487 }
4488 else
4489 {
4490 v120 = window_SpeakInHouse->ptr_1C;
4491 v15 = pGlobalTXT_LocalizationStrings[181]; //"Steal %24"
4492 }
4493 v36 = BuilDialogueString(v15, uActiveCharacter - 1, selected_item, (char *)v120, 2, 0);
4494 v115 = (174 - pFontArrus->CalcTextHeight(v36, &dialog_window, 0, 0)) / 2 + 138;
4495 dialog_window.DrawTitleText(pFontArrus, 0, v115, m_text_color, v36, 3);
4496 return;
4497 }
4498 dialog_window.DrawCurrentTime( pParty->field_3C.field_50[window_SpeakInHouse->par1C]- pParty->uTimePlayed);
4499 return;
4500 }
4501 break;
4502 case HOUSE_DIALOGUE_LEARN_SKILLS:
4503 {
4504 if (!sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
4505 return;
4506 v152 = 0;
4507 v37 = pDialogueWindow;
4508 //v38 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (unsigned int)ptr_507BC0->ptr_1C] * 500.0);
4509 v38 = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0);
4510 _this = (Player *)(v38 * (100 - v0->GetMerchant()) / 100);
4511 if ( (signed int)_this < v38 / 3 )
4512 _this = (Player *)(v38 / 3);
4513 v39 = v37->pStartingPosActiveItem;
4514 v40 = v37->pNumPresenceButton;
4515 v153 = 0;
4516 if ( (signed int)v39 < (signed int)(v39 + v40) )
4517 {
4518 do
4519 {
4520 v41 = v37->GetControl(v39)->msg_param - 36;
4521 if ( byte_4ED970_skill_learn_ability_by_class_table[v0->classType][v41] && !v0->pActiveSkills[v41] )
4522 {
4523 v42 = pFontArrus->CalcTextHeight(pSkillNames[v41], &dialog_window, 0, 0);
4524 v152 += v42;
4525 ++v153;
4526 }
4527 ++v39;
4528 }
4529 while ( (signed int)v39 < v37->pNumPresenceButton + v37->pStartingPosActiveItem );
4530 if ( v153 )
4531 {
4532 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], _this);
4533 dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u);
4534 _this = (Player *)((149 - v152) / v153);
4535 if ( (149 - v152) / v153 > 32 )
4536 _this = (Player *)32;
4537 v43 = (149 - v153 * (signed int)_this - v152) / 2 - (signed int)_this / 2 + 162;
4538 v152 = v37->pStartingPosActiveItem;
4539 v146 = v43;
4540 if ( v152 < v152 + v37->pNumPresenceButton )
4541 {
4542 v153 = 2;
4543 do
4544 {
4545 v44 = v37->GetControl(v152);
4546 v45 = v44;
4547 v46 = v44->msg_param - 36;
4548 if ( !byte_4ED970_skill_learn_ability_by_class_table[v0->classType][v46] || v0->pActiveSkills[v46] )
4549 {
4550 v45->uW = 0;
4551 v45->uHeight = 0;
4552 v45->uY = 0;
4553 }
4554 else
4555 {
4556 v47 = pSkillNames[v46];
4557 v45->uY = (unsigned int)((char *)_this + v146);
4558 Str = v47;
4559 v48 = pFontArrus->CalcTextHeight(v47, &dialog_window, 0, 0);
4560 v49 = v45->uY;
4561 v50 = v153;
4562 v45->uHeight = v48;
4563 v51 = v49 + v48 - 1;
4564 v45->uW = v51;
4565 v146 = v51;
4566 v52 = hilight_color;
4567 if ( pDialogueWindow->pCurrentPosActiveItem != v50 )
4568 v52 = m_text_color;
4569 dialog_window.DrawTitleText(pFontArrus, 0, v49, v52, Str, 3u);
4570 }
4571 v53 = v37->pStartingPosActiveItem;
4572 ++v152;
4573 textureH = v37->pNumPresenceButton + v53;
4574 ++v153;
4575 }
4576 while ( v152 < textureH );
4577 }
4578 return;
4579 }
4580 }
4581 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], v0->pName, pClassNames[v0->classType]); //"Seek knowledge elsewhere %s the %s"
4582 strcat(pTmpBuf, "\n \n");
4583 strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]); //"I can offer you nothing further."
4584 v115 = (174 - pFontArrus->CalcTextHeight(pTmpBuf, &dialog_window, 0, 0)) / 2 + 138;
4585 dialog_window.DrawTitleText(pFontArrus, 0, v115, hilight_color, pTmpBuf, 3);
4586 return;
4587 }
4588 break;
4589 }
4590 }
4591
4592
4593 4435
4594 //----- (004B5D7C) -------------------------------------------------------- 4436 //----- (004B5D7C) --------------------------------------------------------
4595 void GuildDialog() 4437 void GuildDialog()
4596 { 4438 {
4597 signed int base_teach_price; // ebx@1 4439 signed int base_teach_price; // ebx@1
4970 v1 = pPlayers[uActiveCharacter]; 4812 v1 = pPlayers[uActiveCharacter];
4971 //v2 = pPlayers[uActiveCharacter]->_4B807C(p2DEvents_minus1__20[13 * (unsigned int)v0->ptr_1C]); 4813 //v2 = pPlayers[uActiveCharacter]->_4B807C(p2DEvents_minus1__20[13 * (unsigned int)v0->ptr_1C]);
4972 v2 = pPlayers[uActiveCharacter]->_4B807C(p2DEvents[(unsigned int)v0->ptr_1C - 1].fPriceMultiplier); 4814 v2 = pPlayers[uActiveCharacter]->_4B807C(p2DEvents[(unsigned int)v0->ptr_1C - 1].fPriceMultiplier);
4973 HIDWORD(v60) = v2; 4815 HIDWORD(v60) = v2;
4974 if ( dialog_menu_id != HOUSE_DIALOGUE_MAIN ) 4816 if ( dialog_menu_id != HOUSE_DIALOGUE_MAIN )
4975 { 4817 {
4976 if ( dialog_menu_id != HOUSE_DIALOGUE_TEMPLE_HEAL ) 4818 if ( dialog_menu_id != HOUSE_DIALOGUE_TEMPLE_HEAL )
4819 {
4820 if ( dialog_menu_id != HOUSE_DIALOGUE_TEMPLE_DONATE )
4821 {
4822 if ( dialog_menu_id == HOUSE_DIALOGUE_LEARN_SKILLS )
4823 {
4824 if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
4977 { 4825 {
4978 if ( dialog_menu_id != HOUSE_DIALOGUE_TEMPLE_DONATE ) 4826 v4 = pDialogueWindow;
4827 v61 = pDialogueWindow;
4828 v5 = window_SpeakInHouse->ptr_1C;
4829 v66 = 0;
4830 //v65 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (signed int)v5] * 500.0);
4831 v65 = (signed __int64)(p2DEvents[(signed int)v5 - 1].flt_24 * 500.0);
4832 v6 = v1->GetMerchant();
4833 v64 = (signed int)(v65 * (100 - v6)) / 100;
4834 if ( v64 < (signed int)v65 / 3 )
4835 v64 = (signed int)v65 / 3;
4836 v7 = v4->pStartingPosActiveItem;
4837 v8 = v7 + v4->pNumPresenceButton;
4838 v65 = 0;
4839 v62 = v7;
4840 if ( (signed int)v7 >= v8 )
4841 goto LABEL_78;
4842 do
4843 {
4844 v9 = v4->GetControl(v62)->msg_param - 36;
4845 if ( byte_4ED970_skill_learn_ability_by_class_table[v1->classType][v9] && !v1->pActiveSkills[v9] )
4979 { 4846 {
4980 4847 v10 = pFontArrus->CalcTextHeight(pSkillNames[v9], &v57, 0, 0);
4981 if ( dialog_menu_id == HOUSE_DIALOGUE_LEARN_SKILLS ) 4848 v66 = (DDM_DLV_Header *)((char *)v66 + v10);
4849 ++v65;
4850 }
4851 v11 = v4->pStartingPosActiveItem;
4852 ++v62;
4853 }
4854 while ( (signed int)v62 < v4->pNumPresenceButton + v11 );
4855 if ( v65 )
4856 {
4857 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], v64);
4858 v57.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u);
4859 v64 = (149 - (signed int)v66) / (signed int)v65;
4860 if ( v64 > 32 )
4861 v64 = 32;
4862 v65 = (signed int)(149 - v65 * v64 - (int)v66) / 2 - v64 / 2 + 162;
4863 v12 = v61;
4864 result = v61->pStartingPosActiveItem;
4865 v13 = result + v61->pNumPresenceButton;
4866 v62 = v61->pStartingPosActiveItem;
4867 if ( result < v13 )
4868 {
4869 v66 = (DDM_DLV_Header *)2;
4870 while ( 1 )
4871 {
4872 v14 = v12->GetControl(v62);
4873 v15 = v14;
4874 v16 = v14->msg_param - 36;
4875 if ( !byte_4ED970_skill_learn_ability_by_class_table[v1->classType][v16] || v1->pActiveSkills[v16] )
4982 { 4876 {
4983 if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) 4877 v15->uW = 0;
4984 { 4878 v15->uHeight = 0;
4985 v4 = pDialogueWindow; 4879 v15->uY = 0;
4986 v61 = pDialogueWindow; 4880 }
4987 v5 = window_SpeakInHouse->ptr_1C; 4881 else
4988 v66 = 0; 4882 {
4989 //v65 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (signed int)v5] * 500.0); 4883 v17 = pSkillNames[v16];
4990 v65 = (signed __int64)(p2DEvents[(signed int)v5 - 1].flt_24 * 500.0); 4884 v15->uY = v64 + v65;
4991 v6 = v1->GetMerchant(); 4885 HIDWORD(v60) = (uint32)v17;
4992 v64 = (signed int)(v65 * (100 - v6)) / 100; 4886 v18 = pFontArrus->CalcTextHeight(v17, &v57, 0, 0);
4993 if ( v64 < (signed int)v65 / 3 ) 4887 v19 = v15->uY;
4994 v64 = (signed int)v65 / 3; 4888 v15->uHeight = v18;
4995 v7 = v4->pStartingPosActiveItem; 4889 v20 = v19 + v18 - 1;
4996 v8 = v7 + v4->pNumPresenceButton; 4890 v15->uW = v20;
4997 v65 = 0; 4891 v65 = v20;
4998 v62 = v7; 4892 v21 = WORD2(v59);
4999 if ( (signed int)v7 >= v8 ) 4893 if ( (DDM_DLV_Header *)pDialogueWindow->pCurrentPosActiveItem != v66 )
5000 goto LABEL_78; 4894 v21 = WORD2(v58);
5001 do 4895 v57.DrawTitleText(pFontArrus, 0, v19, v21, (const char *)HIDWORD(v60), 3u);
5002 { 4896 }
5003 v9 = v4->GetControl(v62)->msg_param - 36; 4897 result = (int)v61;
5004 if ( byte_4ED970_skill_learn_ability_by_class_table[v1->classType][v9] && !v1->pActiveSkills[v9] ) 4898 ++v62;
5005 { 4899 v66 = (DDM_DLV_Header *)((char *)v66 + 1);
5006 v10 = pFontArrus->CalcTextHeight(pSkillNames[v9], &v57, 0, 0); 4900 if ( (signed int)v62 >= v61->pNumPresenceButton + v61->pStartingPosActiveItem )
5007 v66 = (DDM_DLV_Header *)((char *)v66 + v10); 4901 break;
5008 ++v65; 4902 v12 = v61;
5009 } 4903 }
5010 v11 = v4->pStartingPosActiveItem; 4904 }
5011 ++v62; 4905 }
5012 } 4906 else
5013 while ( (signed int)v62 < v4->pNumPresenceButton + v11 ); 4907 {
5014 if ( v65 )
5015 {
5016 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], v64);
5017 v57.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u);
5018 v64 = (149 - (signed int)v66) / (signed int)v65;
5019 if ( v64 > 32 )
5020 v64 = 32;
5021 v65 = (signed int)(149 - v65 * v64 - (int)v66) / 2 - v64 / 2 + 162;
5022 v12 = v61;
5023 result = v61->pStartingPosActiveItem;
5024 v13 = result + v61->pNumPresenceButton;
5025 v62 = v61->pStartingPosActiveItem;
5026 if ( result < v13 )
5027 {
5028 v66 = (DDM_DLV_Header *)2;
5029 while ( 1 )
5030 {
5031 v14 = v12->GetControl(v62);
5032 v15 = v14;
5033 v16 = v14->msg_param - 36;
5034 if ( !byte_4ED970_skill_learn_ability_by_class_table[v1->classType][v16] || v1->pActiveSkills[v16] )
5035 {
5036 v15->uW = 0;
5037 v15->uHeight = 0;
5038 v15->uY = 0;
5039 }
5040 else
5041 {
5042 v17 = pSkillNames[v16];
5043 v15->uY = v64 + v65;
5044 HIDWORD(v60) = (uint32)v17;
5045 v18 = pFontArrus->CalcTextHeight(v17, &v57, 0, 0);
5046 v19 = v15->uY;
5047 v15->uHeight = v18;
5048 v20 = v19 + v18 - 1;
5049 v15->uW = v20;
5050 v65 = v20;
5051 v21 = WORD2(v59);
5052 if ( (DDM_DLV_Header *)pDialogueWindow->pCurrentPosActiveItem != v66 )
5053 v21 = WORD2(v58);
5054 v57.DrawTitleText(pFontArrus, 0, v19, v21, (const char *)HIDWORD(v60), 3u);
5055 }
5056 result = (int)v61;
5057 ++v62;
5058 v66 = (DDM_DLV_Header *)((char *)v66 + 1);
5059 if ( (signed int)v62 >= v61->pNumPresenceButton + v61->pStartingPosActiveItem )
5060 break;
5061 v12 = v61;
5062 }
5063 }
5064 }
5065 else
5066 {
5067 LABEL_78: 4908 LABEL_78:
5068 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], v1->pName, pClassNames[v1->classType]); 4909 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], v1->pName, pClassNames[v1->classType]);
5069 strcat(pTmpBuf, "\n \n"); 4910 strcat(pTmpBuf, "\n \n");
5070 strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]); 4911 strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]);
5071 v22 = WORD2(v59); 4912 v22 = WORD2(v59);
5072 v23 = pFontArrus->CalcTextHeight(pTmpBuf, &v57, 0, 0); 4913 v23 = pFontArrus->CalcTextHeight(pTmpBuf, &v57, 0, 0);
5073 v57.DrawTitleText(pFontArrus, 0, (174 - v23) / 2 + 138, v22, pTmpBuf, 3u); 4914 v57.DrawTitleText(pFontArrus, 0, (174 - v23) / 2 + 138, v22, pTmpBuf, 3u);
5074 } 4915 }
5075 } 4916 }
5076 } 4917 }
5077 return; 4918 return;
5078 } 4919 }
5079 4920 // DONATION
5080 // DONATION 4921 //v24 = p2DEvents_minus1__20[13 * (unsigned int)ptr_507BC0->ptr_1C];
5081 //v24 = p2DEvents_minus1__20[13 * (unsigned int)ptr_507BC0->ptr_1C]; 4922 v24 = p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier;
5082 v24 = p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier; 4923 v25 = 0;
5083 v25 = 0; 4924 if ( pParty->uNumGold >= (unsigned int)(signed __int64)v24 )
5084 if ( pParty->uNumGold >= (unsigned int)(signed __int64)v24 ) 4925 {
5085 {
5086 Party::TakeGold((signed __int64)v24); 4926 Party::TakeGold((signed __int64)v24);
5087 v26 = &pOutdoor->ddm; 4927 v26 = &pOutdoor->ddm;
5088 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) 4928 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor )
5089 v26 = &pIndoor->dlv; 4929 v26 = &pIndoor->dlv;
5090 v27 = v26->uReputation; 4930 v27 = v26->uReputation;
5133 } 4973 }
5134 } 4974 }
5135 ++byte_F8B1EF[uActiveCharacter]; 4975 ++byte_F8B1EF[uActiveCharacter];
5136 v1->PlaySound(SPEECH_83, 0); 4976 v1->PlaySound(SPEECH_83, 0);
5137 ShowStatusBarString(pGlobalTXT_LocalizationStrings[527], 2u); // "Thank You!" 4977 ShowStatusBarString(pGlobalTXT_LocalizationStrings[527], 2u); // "Thank You!"
5138 goto LABEL_46; 4978 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, v25);
5139 } 4979 return;
5140 goto LABEL_55; 4980 }
5141 } 4981 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u);
4982 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful);
4983 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, v25);
4984 return;
4985 }
5142 if ( !v1->_4B6FF9() ) 4986 if ( !v1->_4B6FF9() )
5143 return; 4987 return;
5144 v25 = 0; 4988 v25 = 0;
5145 if ( pParty->uNumGold < v2 ) 4989 if ( pParty->uNumGold < v2 )
5146 { 4990 {
5147 LABEL_55: 4991 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u);
5148 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u); 4992 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful);
5149 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful); 4993 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, v25);
5150 goto LABEL_46; 4994 return;
5151 } 4995 }
5152 Party::TakeGold(v2); 4996 Party::TakeGold(v2);
5153 v35 = LODWORD(v1->pConditions[17]); 4997 v35 = LODWORD(v1->pConditions[17]);
5154 v59 = v1->pConditions[14]; 4998 v59 = v1->pConditions[14];
5155 v58 = v1->pConditions[15]; 4999 v58 = v1->pConditions[15];
5156 v60 = v1->pConditions[16]; 5000 v60 = v1->pConditions[16];
5167 v38 = v1->field_1924; 5011 v38 = v1->field_1924;
5168 v1->uFace = v37; 5012 v1->uFace = v37;
5169 v1->uVoiceID = v38; 5013 v1->uVoiceID = v38;
5170 ReloadPlayerPortraits(uActiveCharacter - 1, (char)v37); 5014 ReloadPlayerPortraits(uActiveCharacter - 1, (char)v37);
5171 } 5015 }
5172 goto LABEL_63; 5016 pAudioPlayer->PlaySound((SoundID)(SOUND_GoldReceived|0x2), -1, 0, -1, 0, 0, 0, 0);
5017 v1->PlaySound(SPEECH_82, 0);
5018 pOtherOverlayList->_4418B1(20, uActiveCharacter + 99, 0, 65536);
5019 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, v25);
5020 return;
5173 } 5021 }
5174 v39 = v61; 5022 v39 = v61;
5175 if ( (unsigned int)v61 | v35 ) 5023 if ( (unsigned int)v61 | v35 )
5176 { 5024 {
5177 LODWORD(v1->pConditions[17]) = v35; 5025 LODWORD(v1->pConditions[17]) = v35;
5178 } 5026 }
5179 else 5027 else
5180 { 5028 {
5181 if ( !v60 && !v58 && !v59 ) 5029 if ( !v60 && !v58 && !v59 )
5182 goto LABEL_63; 5030 {
5031 pAudioPlayer->PlaySound((SoundID)(SOUND_GoldReceived|0x2), -1, 0, -1, 0, 0, 0, 0);
5032 v1->PlaySound(SPEECH_82, 0);
5033 pOtherOverlayList->_4418B1(20, uActiveCharacter + 99, 0, 65536);
5034 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, v25);
5035 return;
5036 }
5183 v1->field_1928 = v1->uFace; 5037 v1->field_1928 = v1->uFace;
5184 v1->field_1924 = v1->uVoiceID; 5038 v1->field_1924 = v1->uVoiceID;
5185 v1->SetCondition(0x11u, 1); 5039 v1->SetCondition(0x11u, 1);
5186 v1->uVoiceID = (v1->GetSexByVoice() != 0) + 23; 5040 v1->uVoiceID = (v1->GetSexByVoice() != 0) + 23;
5187 v40 = (v1->GetSexByVoice() != 0) + 23; 5041 v40 = (v1->GetSexByVoice() != 0) + 23;
5189 ReloadPlayerPortraits(uActiveCharacter - 1, (char)v40); 5043 ReloadPlayerPortraits(uActiveCharacter - 1, (char)v40);
5190 LODWORD(v1->pConditions[17]) = LODWORD(pParty->uTimePlayed); 5044 LODWORD(v1->pConditions[17]) = LODWORD(pParty->uTimePlayed);
5191 v39 = (GUIWindow *)HIDWORD(pParty->uTimePlayed); 5045 v39 = (GUIWindow *)HIDWORD(pParty->uTimePlayed);
5192 } 5046 }
5193 HIDWORD(v1->pConditions[17]) = (int)v39; 5047 HIDWORD(v1->pConditions[17]) = (int)v39;
5194 LABEL_63:
5195 pAudioPlayer->PlaySound((SoundID)(SOUND_GoldReceived|0x2), -1, 0, -1, 0, 0, 0, 0); 5048 pAudioPlayer->PlaySound((SoundID)(SOUND_GoldReceived|0x2), -1, 0, -1, 0, 0, 0, 0);
5196 v1->PlaySound(SPEECH_82, 0); 5049 v1->PlaySound(SPEECH_82, 0);
5197 pOtherOverlayList->_4418B1(20, uActiveCharacter + 99, 0, 65536); 5050 pOtherOverlayList->_4418B1(20, uActiveCharacter + 99, 0, 65536);
5198 LABEL_46:
5199 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, v25); 5051 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, v25);
5200 return ; // void func 5052 return; // void func
5201 } 5053 }
5202 v63 = 1; 5054 v63 = 1;
5203 v41 = pDialogueWindow->GetControl(pDialogueWindow->pStartingPosActiveItem); 5055 v41 = pDialogueWindow->GetControl(pDialogueWindow->pStartingPosActiveItem);
5204 strcpy(a1, ""); 5056 strcpy(a1, "");
5205 v41->uHeight = 0; 5057 v41->uHeight = 0;
5634 } 5486 }
5635 } 5487 }
5636 } 5488 }
5637 } 5489 }
5638 5490
5639
5640
5641
5642
5643
5644
5645
5646
5647 //----- (004B4FCF) -------------------------------------------------------- 5491 //----- (004B4FCF) --------------------------------------------------------
5648 void MagicShopDialog() 5492 void MagicShopDialog()
5649 { 5493 {
5650 Player *v0; // ebx@1
5651 int result; // eax@6 5494 int result; // eax@6
5652 signed int v2; // esi@8 5495 signed int v2; // esi@8
5653 unsigned int v3; // ebx@10 5496 unsigned int v3; // ebx@10
5654 char *v4; // eax@11 5497 char *v4; // eax@11
5655 char *v5; // eax@12 5498 char *v5; // eax@12
5771 unsigned __int8 uPlayerID; // [sp+F3h] [bp-5h]@14 5614 unsigned __int8 uPlayerID; // [sp+F3h] [bp-5h]@14
5772 int v152; // [sp+F4h] [bp-4h]@23 5615 int v152; // [sp+F4h] [bp-4h]@23
5773 int v122; 5616 int v122;
5774 int v114; 5617 int v114;
5775 5618
5776 v0 = pPlayers[uActiveCharacter];
5777 _this = pPlayers[uActiveCharacter]; 5619 _this = pPlayers[uActiveCharacter];
5778 memcpy(&dialog_window, window_SpeakInHouse, sizeof(dialog_window)); 5620 memcpy(&dialog_window, window_SpeakInHouse, sizeof(dialog_window));
5779 dialog_window.uFrameX = 483; 5621 dialog_window.uFrameX = 483;
5780 dialog_window.uFrameWidth = 148; 5622 dialog_window.uFrameWidth = 148;
5781 dialog_window.uFrameZ = 334; 5623 dialog_window.uFrameZ = 334;
5782 m_text_color = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); 5624 m_text_color = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu);
5783 hilight_color = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xCDu, 0x23u); 5625 hilight_color = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xCDu, 0x23u);
5626 if ( dialog_menu_id == HOUSE_DIALOGUE_MAIN)
5627 {
5628 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
5629 return;
5630 pShopOptions[0] = pGlobalTXT_LocalizationStrings[134]; //"Buy Standard"
5631 pShopOptions[1] = pGlobalTXT_LocalizationStrings[152]; //"Buy Special"
5632 pShopOptions[2] = pGlobalTXT_LocalizationStrings[159]; //"Display Inventory"
5633 pShopOptions[3] = pGlobalTXT_LocalizationStrings[160];
5634 all_text_height = 0;
5635 for ( int i = 0; i < 4; ++i )
5636 all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0);
5637 v146 = (174 - all_text_height) / 4;
5638 v23 = (174 - 4 * (174 - all_text_height) / 4 - all_text_height) / 2 - (174 - all_text_height) / 4 / 2 + 138;
5639 int j = 0;
5640 if ( pDialogueWindow->pNumPresenceButton>=0 )
5641 {
5642 int th = 2;
5643 for (v152 = pDialogueWindow->pStartingPosActiveItem; v152 < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++v152)
5644 {
5645 control_button = pDialogueWindow->GetControl(v152);
5646 control_button->uY = v146 + v23;
5647 v27 = pFontArrus->CalcTextHeight(pShopOptions[j], &dialog_window, 0, 0);
5648 control_button->uHeight = v27;
5649 v23 = control_button->uY + control_button->uHeight - 1;
5650 control_button->uW = v23;
5651 text_color = hilight_color;
5652 if ( pDialogueWindow->pCurrentPosActiveItem != th )
5653 text_color = m_text_color;
5654 dialog_window.DrawTitleText(pFontArrus, 0, control_button->uY, text_color, pShopOptions[j], 3);
5655 ++th;
5656 ++j;
5657 }
5658 }
5659 return;
5660 }
5784 if ( dialog_menu_id > HOUSE_DIALOGUE_SHOP_REPAIR ) 5661 if ( dialog_menu_id > HOUSE_DIALOGUE_SHOP_REPAIR )
5785 { 5662 {
5786 if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT ) 5663 if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT )
5787 { 5664 {
5788 draw_leather(); 5665 draw_leather();
5854 v119 = (const char **)(v33 / 3); 5731 v119 = (const char **)(v33 / 3);
5855 v34 = v31->pStartingPosActiveItem; 5732 v34 = v31->pStartingPosActiveItem;
5856 v35 = v34 + v31->pNumPresenceButton; 5733 v35 = v34 + v31->pNumPresenceButton;
5857 v122 = 0; 5734 v122 = 0;
5858 if ( (signed int)v34 >= v35 ) 5735 if ( (signed int)v34 >= v35 )
5859 goto LABEL_140; 5736 {
5737 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], _this->pName, pClassNames[_this->classType]);//
5738 // "Seek knowledge elsewhere %s the %s"
5739 strcat(pTmpBuf, "\n \n");
5740 strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]);// "I can offer you nothing further."
5741 v6 = (174 - pFontArrus->CalcTextHeight(pTmpBuf, &dialog_window, 0, 0)) / 2 + 138;
5742 dialog_window.DrawTitleText(pFontArrus, v3, v6, hilight_color, pTmpBuf, 3);
5743 return;
5744 }
5860 do 5745 do
5861 { 5746 {
5862 v36 = v31->GetControl(v34)->msg_param - 36; 5747 v36 = v31->GetControl(v34)->msg_param - 36;
5863 if ( byte_4ED970_skill_learn_ability_by_class_table[_this->classType][v36] && !_this->pActiveSkills[v36] ) 5748 if ( byte_4ED970_skill_learn_ability_by_class_table[_this->classType][v36] && !_this->pActiveSkills[v36] )
5864 { 5749 {
5869 ++v34; 5754 ++v34;
5870 } 5755 }
5871 while ( (signed int)v34 < v31->pNumPresenceButton + v31->pStartingPosActiveItem ); 5756 while ( (signed int)v34 < v31->pNumPresenceButton + v31->pStartingPosActiveItem );
5872 if ( !v122 ) 5757 if ( !v122 )
5873 { 5758 {
5874 LABEL_140:
5875 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], _this->pName, pClassNames[_this->classType]);// 5759 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], _this->pName, pClassNames[_this->classType]);//
5876 // "Seek knowledge elsewhere %s the %s" 5760 // "Seek knowledge elsewhere %s the %s"
5877 strcat(pTmpBuf, "\n \n"); 5761 strcat(pTmpBuf, "\n \n");
5878 strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]);// "I can offer you nothing further." 5762 strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]);// "I can offer you nothing further."
5879 v30 = pTmpBuf; 5763 v6 = (174 - pFontArrus->CalcTextHeight(pTmpBuf, &dialog_window, 0, 0)) / 2 + 138;
5880 v97 = 3; 5764 dialog_window.DrawTitleText(pFontArrus, v3, v6, hilight_color, pTmpBuf, 3);
5881 v95 = pTmpBuf; 5765 return;
5882 v92 = hilight_color;
5883 v91 = 0;
5884 v89 = 0;
5885 v88 = &dialog_window;
5886 goto LABEL_61;
5887 } 5766 }
5888 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], v119);// "Skill Cost: %lu" 5767 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], v119);// "Skill Cost: %lu"
5889 dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u); 5768 dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u);
5890 v119 = (const char **)((149 - v118) / v122); 5769 v119 = (const char **)((149 - v118) / v122);
5891 if ( (149 - v118) / v122 > 32 ) 5770 if ( (149 - v118) / v122 > 32 )
5949 || (v27 = pMouse->GetCursorPos(&v110)->x - 14, 5828 || (v27 = pMouse->GetCursorPos(&v110)->x - 14,
5950 v117 = (v27 >> 5) + 14 * ((pMouse->GetCursorPos(&v108)->y - 17) >> 5), 5829 v117 = (v27 >> 5) + 14 * ((pMouse->GetCursorPos(&v108)->y - 17) >> 5),
5951 result = (int)pMouse->GetCursorPos(&v106), 5830 result = (int)pMouse->GetCursorPos(&v106),
5952 *(int *)result <= 13) 5831 *(int *)result <= 13)
5953 || (result = (int)pMouse->GetCursorPos(&v104), *(int *)result >= 462) 5832 || (result = (int)pMouse->GetCursorPos(&v104), *(int *)result >= 462)
5954 || (result = v0->GetItemIDAtInventoryIndex((int *)&v117), v3 = 0, !result) 5833 || (result = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v117), v3 = 0, !result)
5955 || (result *= 9, !(_this->field_1F5[4 * result + 15] & 2)) ) 5834 || (result *= 9, !(_this->field_1F5[4 * result + 15] & 2)) )
5956 return; 5835 return;
5957 v96 = 0; 5836 v96 = 0;
5958 v94 = 5; 5837 v94 = 5;
5959 v93 = window_SpeakInHouse->ptr_1C; 5838 v93 = window_SpeakInHouse->ptr_1C;
5961 v28 = (int)window_SpeakInHouse->ptr_1C; 5840 v28 = (int)window_SpeakInHouse->ptr_1C;
5962 uPlayerID = uActiveCharacter - 1; 5841 uPlayerID = uActiveCharacter - 1;
5963 v29 = _this->_490EEE((ItemGen *)&_this->spellbook.pDarkSpellbook.bIsSpellAvailable[4 * result + 5], 3, v28, 5); 5842 v29 = _this->_490EEE((ItemGen *)&_this->spellbook.pDarkSpellbook.bIsSpellAvailable[4 * result + 5], 3, v28, 5);
5964 v9 = uPlayerID; 5843 v9 = uPlayerID;
5965 v10 = (char *)pMerchantsRepairPhrases[v29]; 5844 v10 = (char *)pMerchantsRepairPhrases[v29];
5966 goto LABEL_35; 5845 v30 = BuilDialogueString(v10, v9, v90, (char *)v93, v94, v96);
5967 } 5846 v6 = (174 - pFontArrus->CalcTextHeight(v30, &dialog_window, v3, v3)) / 2 + 138;
5968 if ( dialog_menu_id == HOUSE_DIALOGUE_MAIN) 5847 dialog_window.DrawTitleText(pFontArrus, v3, v6, m_text_color, v30, 3);
5969 {
5970 /* result = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win();
5971 if ( result )
5972 {
5973 pShopOptions[0] = pGlobalTXT_LocalizationStrings[134];// "Buy Standard"
5974 pShopOptions[1] = pGlobalTXT_LocalizationStrings[152];// "Buy Special"
5975 pShopOptions[2] = pGlobalTXT_LocalizationStrings[159];// "Display Inventory"
5976 v14 = 0;
5977 pShopOptions[3] = pGlobalTXT_LocalizationStrings[160];// "Learn Skills"
5978 v15 = pShopOptions;
5979 do
5980 {
5981 v16 = pFontArrus->CalcTextHeight(*v15, &dialogue_window, 0, 0);
5982 ++v15;
5983 v14 += v16;
5984 }
5985 while ( (signed int)v15 < (signed int)&unk_F8B1C8 );
5986 v17 = pDialogueWindow;
5987 v114 = (174 - v14) / 4;
5988 result = pDialogueWindow->pStartingPosActiveItem;
5989 v18 = result + pDialogueWindow->pNumPresenceButton;
5990 v19 = (174 - 4 * (174 - v14) / 4 - v14) / 2 - (174 - v14) / 4 / 2 + 138;
5991 v20 = -pDialogueWindow->pNumPresenceButton < 0;
5992 v122 = pDialogueWindow->pStartingPosActiveItem;
5993 if ( v20 ^ __OFSUB__(result, v18) )
5994 {
5995 v119 = (const char **)2;
5996 _this = (Player *)pShopOptions;
5997 do
5998 {
5999 v21 = v17->GetControl(v122);
6000 v22 = (const char **)_this;
6001 v21->uY = v114 + v19;
6002 v23 = pFontArrus->CalcTextHeight(*v22, &dialogue_window, 0, 0);
6003 v24 = v21->uY;
6004 v25 = v119;
6005 v21->uHeight = v23;
6006 v19 = v24 + v23 - 1;
6007 v21->uW = v19;
6008 v26 = color2;
6009 if ( (const char **)pDialogueWindow->pCurrentPosActiveItem != v25 )
6010 v26 = m_text_color;
6011 dialogue_window.DrawTitleText(pFontArrus, 0, v24, v26, (const char *)LODWORD(_this->pConditions[0]), 3u);
6012 v17 = pDialogueWindow;
6013 v119 = (const char **)((char *)v119 + 1);
6014 _this = (Player *)((char *)_this + 4);
6015 ++v122;
6016 result = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem;
6017 }
6018 while ( v122 < result );
6019 }
6020 }*/
6021 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
6022 return;
6023 pShopOptions[0] = pGlobalTXT_LocalizationStrings[134]; //"Buy Standard"
6024 pShopOptions[1] = pGlobalTXT_LocalizationStrings[152]; //"Buy Special"
6025 pShopOptions[2] = pGlobalTXT_LocalizationStrings[159]; //"Display Inventory"
6026 pShopOptions[3] = pGlobalTXT_LocalizationStrings[160];
6027
6028 all_text_height = 0;
6029 for(int i=0;i<4;++i)
6030 all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0);
6031 v146 = (174 - all_text_height) / 4;
6032
6033 v23 = (174 - 4 * (174 - all_text_height) / 4 - all_text_height) / 2 - (174 - all_text_height) / 4 / 2 + 138;
6034 int j=0;
6035 if ( pDialogueWindow->pNumPresenceButton>=0 )
6036 {
6037 int th = 2;
6038 for (v152 = pDialogueWindow->pStartingPosActiveItem; v152 < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++v152)
6039 {
6040 control_button = pDialogueWindow->GetControl(v152);
6041 control_button->uY = v146 + v23;
6042 v27 = pFontArrus->CalcTextHeight(pShopOptions[j], &dialog_window, 0, 0);
6043 control_button->uHeight = v27;
6044 v23 = control_button->uY + control_button->uHeight - 1;
6045 control_button->uW = v23;
6046 text_color = hilight_color;
6047 if ( pDialogueWindow->pCurrentPosActiveItem != th )
6048 text_color = m_text_color;
6049 dialog_window.DrawTitleText(pFontArrus, 0, control_button->uY, text_color, pShopOptions[j], 3);
6050 ++th;
6051 ++j;
6052 }
6053 }
6054
6055
6056 return; 5848 return;
6057 } 5849 }
6058 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD) 5850 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD)
6059 { 5851 {
6060 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_SELL) 5852 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_SELL)
6074 if ( *(int *)result > 13 ) 5866 if ( *(int *)result > 13 )
6075 { 5867 {
6076 result = (int)pMouse->GetCursorPos(&v103); 5868 result = (int)pMouse->GetCursorPos(&v103);
6077 if ( *(int *)result < 462 ) 5869 if ( *(int *)result < 462 )
6078 { 5870 {
6079 result = v0->GetItemIDAtInventoryIndex((int *)&v117); 5871 result = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v117);
6080 v3 = 0; 5872 v3 = 0;
6081 if ( result ) 5873 if ( result )
6082 { 5874 {
6083 v96 = 0; 5875 v96 = 0;
6084 v94 = 4; 5876 v94 = 4;
6085 v4 = (char *)&_this->pInventoryItems[result-1]; 5877 v4 = (char *)&_this->pInventoryItems[result-1];
6086 if ( v4[20] & 1 ) 5878 if ( v4[20] & 1 )
6087 { 5879 {
6088 v5 = BuilDialogueString("%24", uActiveCharacter - 1, (ItemGen *)v4, (char *)window_SpeakInHouse->ptr_1C, 4, 0); 5880 v5 = BuilDialogueString("%24", uActiveCharacter - 1, (ItemGen *)v4, (char *)window_SpeakInHouse->ptr_1C, 4, 0);
6089 v97 = 3;
6090 v95 = v5;
6091 v92 = m_text_color;
6092 v6 = (212 - pFontArrus->CalcTextHeight(v5, &dialog_window, 0, 0)) / 2 + 101; 5881 v6 = (212 - pFontArrus->CalcTextHeight(v5, &dialog_window, 0, 0)) / 2 + 101;
6093 5882 dialog_window.DrawTitleText(pFontArrus, v3, v6, m_text_color, v5, 3);
6094 dialog_window.DrawTitleText(pFontArrus, v3, v6, v92, v95, v97); 5883 return;
6095 return;
6096 } 5884 }
6097 v93 = window_SpeakInHouse->ptr_1C; 5885 v93 = window_SpeakInHouse->ptr_1C;
6098 v90 = (ItemGen *)v4; 5886 v90 = (ItemGen *)v4;
6099 v7 = (int)window_SpeakInHouse->ptr_1C; 5887 v7 = (int)window_SpeakInHouse->ptr_1C;
6100 uPlayerID = uActiveCharacter - 1; 5888 uPlayerID = uActiveCharacter - 1;
6101 v8 = ((Player *)_this)->_490EEE((ItemGen *)v4, 3, v7, 4); 5889 v8 = ((Player *)_this)->_490EEE((ItemGen *)v4, 3, v7, 4);
6102 v9 = uPlayerID; 5890 v9 = uPlayerID;
6103 v10 = (char *)pMerchantsIdentifyPhrases[v8]; 5891 v10 = (char *)pMerchantsIdentifyPhrases[v8];
6104 goto LABEL_35; 5892 v30 = BuilDialogueString(v10, v9, v90, (char *)v93, v94, v96);
5893 v6 = (174 - pFontArrus->CalcTextHeight(v30, &dialog_window, v3, v3)) / 2 + 138;
5894 dialog_window.DrawTitleText(pFontArrus, v3, v6, m_text_color, v30, 3);
5895 return;
6105 } 5896 }
6106 } 5897 }
6107 } 5898 }
6108 } 5899 }
6109 } 5900 }
6117 || (v11 = pMouse->GetCursorPos(&v107)->x - 14, 5908 || (v11 = pMouse->GetCursorPos(&v107)->x - 14,
6118 v117 = (v11 >> 5) + 14 * ((pMouse->GetCursorPos(&v99)->y - 17) >> 5), 5909 v117 = (v11 >> 5) + 14 * ((pMouse->GetCursorPos(&v99)->y - 17) >> 5),
6119 result = (int)pMouse->GetCursorPos(&v105), 5910 result = (int)pMouse->GetCursorPos(&v105),
6120 *(int *)result <= 13) 5911 *(int *)result <= 13)
6121 || (result = (int)pMouse->GetCursorPos(&v101), *(int *)result >= 462) 5912 || (result = (int)pMouse->GetCursorPos(&v101), *(int *)result >= 462)
6122 || (result = v0->GetItemIDAtInventoryIndex((int *)&v117), v3 = 0, !result) ) 5913 || (result = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v117), v3 = 0, !result) )
6123 return; 5914 return;
6124 v96 = 0; 5915 v96 = 0;
6125 v94 = 3; 5916 v94 = 3;
6126 v93 = window_SpeakInHouse->ptr_1C; 5917 v93 = window_SpeakInHouse->ptr_1C;
6127 v90 = (ItemGen *)&_this->pInventoryItems[result-1]; 5918 v90 = (ItemGen *)&_this->pInventoryItems[result-1];
6128 v12 = (int)window_SpeakInHouse->ptr_1C; 5919 v12 = (int)window_SpeakInHouse->ptr_1C;
6129 uPlayerID = uActiveCharacter - 1; 5920 uPlayerID = uActiveCharacter - 1;
6130 v13 = _this->_490EEE(v90, 3, v12, 3); 5921 v13 = _this->_490EEE(v90, 3, v12, 3);
6131 v9 = uPlayerID; 5922 v9 = uPlayerID;
6132 v10 = (char *)pMerchantsSellPhrases[v13]; 5923 v10 = (char *)pMerchantsSellPhrases[v13];
6133 LABEL_35:
6134 v30 = BuilDialogueString(v10, v9, v90, (char *)v93, v94, v96); 5924 v30 = BuilDialogueString(v10, v9, v90, (char *)v93, v94, v96);
6135 v97 = 3; 5925 v6 = (174 - pFontArrus->CalcTextHeight(v30, &dialog_window, v3, v3)) / 2 + 138;
6136 v95 = v30; 5926 dialog_window.DrawTitleText(pFontArrus, v3, v6, m_text_color, v30, 3);
6137 v92 = m_text_color;
6138 v91 = v3;
6139 v89 = v3;
6140 v88 = &dialog_window;
6141 LABEL_61:
6142 v6 = (174 - pFontArrus->CalcTextHeight(v30, v88, v89, v91)) / 2 + 138;
6143 dialog_window.DrawTitleText(pFontArrus, v3, v6, v92, v95, v97);
6144 return; 5927 return;
6145 } 5928 }
6146 } 5929 }
6147 pRenderer->DrawTextureIndexed(8u, 8u, ShopTexture); 5930 pRenderer->DrawTextureIndexed(8u, 8u, ShopTexture);
6148 v3 = 0; 5931 v3 = 0;
6280 } 6063 }
6281 result = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); 6064 result = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win();
6282 if ( result ) 6065 if ( result )
6283 { 6066 {
6284 v66 = 0; 6067 v66 = 0;
6285 v117 = 0;\ 6068 v117 = 0;
6286 if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_BUY_STANDARD) 6069 if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_BUY_STANDARD)
6287 { 6070 {
6288 do 6071 do
6289 { 6072 {
6290 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v66].uItemID) //9 * (v66 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] ) 6073 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v66].uItemID) //9 * (v66 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] )
6353 uPlayerID = uActiveCharacter - 1; 6136 uPlayerID = uActiveCharacter - 1;
6354 v75 = _this->_490EEE(v74, 3, v72, 2); 6137 v75 = _this->_490EEE(v74, 3, v72, 2);
6355 v9 = uPlayerID; 6138 v9 = uPlayerID;
6356 v10 = (char *)pMerchantsBuyPhrases[v75]; 6139 v10 = (char *)pMerchantsBuyPhrases[v75];
6357 } 6140 }
6358 goto LABEL_35; 6141 v30 = BuilDialogueString(v10, v9, v90, (char *)v93, v94, v96);
6142 v6 = (174 - pFontArrus->CalcTextHeight(v30, &dialog_window, v3, v3)) / 2 + 138;
6143 dialog_window.DrawTitleText(pFontArrus, v3, v6, m_text_color, v30, 3);
6144 return;
6359 } 6145 }
6360 } 6146 }
6361 return; 6147 return;
6362 } 6148 }