comparison UI/UIShops.cpp @ 1752:07c7f446a929

MagicShop cleared
author Ritor1
date Mon, 30 Sep 2013 11:41:36 +0600
parents f305a00a6d98
children 999bf8c99514
comparison
equal deleted inserted replaced
1751:b6212ecbc140 1752:07c7f446a929
687 { 687 {
688 int index; // eax@7 688 int index; // eax@7
689 signed int v5; // esi@9 689 signed int v5; // esi@9
690 int v18; // eax@23 690 int v18; // eax@23
691 char *pText; // edx@29 691 char *pText; // edx@29
692 unsigned int v47; // edi@55 692 unsigned int product_height_1row; // edi@55
693 unsigned int v48; // esi@57 693 unsigned int product_width_1row; // esi@57
694 unsigned int v51; // edi@67 694 unsigned int product_height_2row; // edi@67
695 unsigned int v52; // esi@69 695 unsigned int product_width_2row; // esi@69
696 ItemGen *item; // esi@118 696 ItemGen *item; // esi@118
697 int v71; // eax@123 697 int v71; // eax@123
698 int all_text_height; // edi@125 698 int all_text_height; // edi@125
699 GUIButton *pButton; // esi@129 699 GUIButton *pButton; // esi@129
700 unsigned int pColorText; // ax@129 700 unsigned int pColorText; // ax@129
748 pRenderer->DrawTextureIndexed(8, 8, ShopTexture); 748 pRenderer->DrawTextureIndexed(8, 8, ShopTexture);
749 for ( uint i = 0; i < 6; ++i ) 749 for ( uint i = 0; i < 6; ++i )
750 { 750 {
751 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].uItemID ) 751 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].uItemID )
752 { 752 {
753 v47 = 152 - ItemsInShopTexture[i]->uTextureHeight; 753 product_height_1row = 152 - ItemsInShopTexture[i]->uTextureHeight;
754 if ( (signed int)v47 < 1 ) 754 if ( (signed int)product_height_1row < 1 )
755 v47 = 0; 755 product_height_1row = 0;
756 v48 = 75 * i - ItemsInShopTexture[i]->uTextureWidth / 2 + 40; 756 product_width_1row = 75 * i - ItemsInShopTexture[i]->uTextureWidth / 2 + 40;
757 if ( i ) 757 if ( i )
758 { 758 {
759 if ( i == 5 ) 759 if ( i == 5 )
760 { 760 {
761 if ( (signed int)v48 > 457 - ItemsInShopTexture[5]->uTextureWidth ) 761 if ( (signed int)product_width_1row > 457 - ItemsInShopTexture[5]->uTextureWidth )
762 v48 = 457 - ItemsInShopTexture[5]->uTextureWidth; 762 product_width_1row = 457 - ItemsInShopTexture[5]->uTextureWidth;
763 } 763 }
764 } 764 }
765 else if ( (signed int)v48 < 18 ) 765 else if ( (signed int)product_width_1row < 18 )
766 v48 = 18; 766 product_width_1row = 18;
767 pRenderer->DrawTextureTransparent(v48, v47, ItemsInShopTexture[i]); 767 pRenderer->DrawTextureTransparent(product_width_1row, product_height_1row, ItemsInShopTexture[i]);
768 ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[v48 + 640 * v47], ItemsInShopTexture[i], i + 1); 768 ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[product_width_1row + 640 * product_height_1row], ItemsInShopTexture[i], i + 1);
769 } 769 }
770 } 770 }
771 for ( uint i = 0; i < 6; ++i ) 771 for ( uint i = 0; i < 6; ++i )
772 { 772 {
773 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i + 6].uItemID ) 773 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i + 6].uItemID )
774 { 774 {
775 v51 = 308 - ItemsInShopTexture[i + 6]->uTextureHeight; 775 product_height_2row = 308 - ItemsInShopTexture[i + 6]->uTextureHeight;
776 if ( (signed int)v51 < 1 ) 776 if ( (signed int)product_height_2row < 1 )
777 v51 = 0; 777 product_height_2row = 0;
778 v52 = 75 * i - ItemsInShopTexture[i + 6]->uTextureWidth / 2 + 40; 778 product_width_2row = 75 * i - ItemsInShopTexture[i + 6]->uTextureWidth / 2 + 40;
779 if ( i ) 779 if ( i )
780 { 780 {
781 if ( i == 5 ) 781 if ( i == 5 )
782 { 782 {
783 if ( (signed int)v52 > 457 - ItemsInShopTexture[11]->uTextureWidth ) 783 if ( (signed int)product_width_2row > 457 - ItemsInShopTexture[11]->uTextureWidth )
784 v52 = 457 - ItemsInShopTexture[11]->uTextureWidth; 784 product_width_2row = 457 - ItemsInShopTexture[11]->uTextureWidth;
785 } 785 }
786 } 786 }
787 else 787 else
788 { 788 {
789 if ( (signed int)v52 < 18 ) 789 if ( (signed int)product_width_2row < 18 )
790 v52 = 18; 790 product_width_2row = 18;
791 } 791 }
792 pRenderer->DrawTextureTransparent(v52, v51, ItemsInShopTexture[i + 6]); 792 pRenderer->DrawTextureTransparent(product_width_2row, product_height_2row, ItemsInShopTexture[i + 6]);
793 ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[v52 + 640 * v51], ItemsInShopTexture[i + 6], i + 7); 793 ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[product_width_2row + 640 * product_height_2row], ItemsInShopTexture[i + 6], i + 7);
794 } 794 }
795 } 795 }
796 if ( HouseUI_CheckIfPlayerCanInteract() ) 796 if ( HouseUI_CheckIfPlayerCanInteract() )
797 { 797 {
798 item_num = 0; 798 item_num = 0;
833 pRenderer->DrawTextureIndexed(8, 8, ShopTexture); 833 pRenderer->DrawTextureIndexed(8, 8, ShopTexture);
834 for ( uint i = 0; i < 6; ++i ) 834 for ( uint i = 0; i < 6; ++i )
835 { 835 {
836 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].uItemID) 836 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].uItemID)
837 { 837 {
838 v47 = 152 - ItemsInShopTexture[i]->uTextureHeight; 838 product_height_1row = 152 - ItemsInShopTexture[i]->uTextureHeight;
839 if ( (signed int)v47 < 1 ) 839 if ( (signed int)product_height_1row < 1 )
840 v47 = 0; 840 product_height_1row = 0;
841 v48 = 75 * i - ItemsInShopTexture[i]->uTextureWidth / 2 + 40; 841 product_width_1row = 75 * i - ItemsInShopTexture[i]->uTextureWidth / 2 + 40;
842 if ( i ) 842 if ( i )
843 { 843 {
844 if ( i == 5 ) 844 if ( i == 5 )
845 { 845 {
846 if ( (signed int)v48 > 457 - ItemsInShopTexture[5]->uTextureWidth ) 846 if ( (signed int)product_width_1row > 457 - ItemsInShopTexture[5]->uTextureWidth )
847 v48 = 457 - ItemsInShopTexture[5]->uTextureWidth; 847 product_width_1row = 457 - ItemsInShopTexture[5]->uTextureWidth;
848 } 848 }
849 } 849 }
850 else 850 else
851 { 851 {
852 if ( (signed int)v48 < 18 ) 852 if ( (signed int)product_width_1row < 18 )
853 v48 = 18; 853 product_width_1row = 18;
854 } 854 }
855 pRenderer->DrawTextureTransparent(v48, v47, ItemsInShopTexture[i]); 855 pRenderer->DrawTextureTransparent(product_width_1row, product_height_1row, ItemsInShopTexture[i]);
856 ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[v48 + 640 * v47], ItemsInShopTexture[i], i + 1); 856 ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[product_width_1row + 640 * product_height_1row], ItemsInShopTexture[i], i + 1);
857 } 857 }
858 } 858 }
859 for ( uint i = 0; i < 6; ++i ) 859 for ( uint i = 0; i < 6; ++i )
860 { 860 {
861 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][(signed int)i + 6].uItemID) //not itemid 861 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][(signed int)i + 6].uItemID) //not itemid
862 { 862 {
863 v51 = 308 - ItemsInShopTexture[i + 6]->uTextureHeight; 863 product_height_2row = 308 - ItemsInShopTexture[i + 6]->uTextureHeight;
864 if ( (signed int)v51 < 1 ) 864 if ( (signed int)product_height_2row < 1 )
865 v51 = 0; 865 product_height_2row = 0;
866 v52 = 75 * i - ItemsInShopTexture[i + 6]->uTextureWidth / 2 + 40; 866 product_width_2row = 75 * i - ItemsInShopTexture[i + 6]->uTextureWidth / 2 + 40;
867 if ( i ) 867 if ( i )
868 { 868 {
869 if ( i == 5 ) 869 if ( i == 5 )
870 { 870 {
871 if ( (signed int)v52 > 457 - ItemsInShopTexture[11]->uTextureWidth ) 871 if ( (signed int)product_width_2row > 457 - ItemsInShopTexture[11]->uTextureWidth )
872 v52 = 457 - ItemsInShopTexture[11]->uTextureWidth; 872 product_width_2row = 457 - ItemsInShopTexture[11]->uTextureWidth;
873 } 873 }
874 } 874 }
875 else 875 else
876 { 876 {
877 if ( (signed int)v52 < 18 ) 877 if ( (signed int)product_width_2row < 18 )
878 v52 = 18; 878 product_width_2row = 18;
879 } 879 }
880 pRenderer->DrawTextureTransparent(v52, v51, ItemsInShopTexture[i + 6]); 880 pRenderer->DrawTextureTransparent(product_width_2row, product_height_2row, ItemsInShopTexture[i + 6]);
881 ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[v52 + 640 * v51], ItemsInShopTexture[i + 6], i + 7); 881 ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[product_width_2row + 640 * product_height_2row], ItemsInShopTexture[i + 6], i + 7);
882 } 882 }
883 } 883 }
884 if ( HouseUI_CheckIfPlayerCanInteract() ) 884 if ( HouseUI_CheckIfPlayerCanInteract() )
885 { 885 {
886 item_num = 0; 886 item_num = 0;
1060 } 1060 }
1061 1061
1062 //----- (004B4FCF) -------------------------------------------------------- 1062 //----- (004B4FCF) --------------------------------------------------------
1063 void MagicShopDialog() 1063 void MagicShopDialog()
1064 { 1064 {
1065 int result; // eax@6
1066 signed int v2; // esi@8
1067 unsigned int v3; // ebx@10
1068 char *v4; // eax@11
1069 char *v5; // eax@12
1070 unsigned int v6; // eax@12
1071 int v7; // ST08_4@14
1072 int v8; // eax@14
1073 unsigned __int8 v9; // dl@14
1074 char *v10; // ecx@14
1075 signed int v11; // esi@16
1076 int v12; // ST08_4@19
1077 int v13; // eax@19
1078 int all_text_height; // edi@21 1065 int all_text_height; // edi@21
1079 char **v15; // esi@21
1080 int v16; // eax@22
1081 int v18; // edx@23
1082 int v19; // edi@23
1083 unsigned __int8 v20; // sf@23
1084 GUIButton *control_button; // esi@25 1066 GUIButton *control_button; // esi@25
1085 const char **v22; // eax@25
1086 int v23; // eax@25 1067 int v23; // eax@25
1087 unsigned int v24; // ecx@25
1088 const char **v25; // edx@25
1089 unsigned __int16 text_color; // ax@25 1068 unsigned __int16 text_color; // ax@25
1090 signed int pTextHeight; // esi@30
1091 int v28; // ST08_4@34
1092 int v29; // eax@34
1093 char *v30; // edx@35 1069 char *v30; // edx@35
1094 void *v32; // eax@40
1095 signed int v33; // esi@40 1070 signed int v33; // esi@40
1096 unsigned int v34; // esi@42 1071 unsigned int product_height_1row; // edi@64
1097 int v35; // eax@42 1072 unsigned int product_width_1row; // esi@66
1098 unsigned int v36; // eax@43 1073 unsigned int product_height_2row; // edi@76
1099 int v37; // eax@45 1074 unsigned int product_width_2row; // esi@76
1100 int v38; // ecx@50
1101 int v41; // eax@52
1102 char *v42; // eax@54
1103 int v43; // eax@54
1104 unsigned int v44; // ecx@54
1105 int v45; // edx@54
1106 int v46; // eax@54
1107 unsigned __int16 v47; // ax@54
1108 int v48; // eax@58
1109 signed int v49; // esi@62
1110 Texture *v50; // ecx@64
1111 unsigned int v51; // edi@64
1112 unsigned int v52; // esi@66
1113 int v53; // edx@70
1114 Texture *v54; // ecx@76
1115 unsigned int v55; // edi@76
1116 unsigned int v56; // esi@76
1117 int v57; // edx@80
1118 unsigned int v59; // edi@86
1119 unsigned int v60; // esi@88
1120 int v61; // edx@92
1121 unsigned int v63; // edi@98
1122 unsigned int v64; // esi@100
1123 int v65; // edx@104
1124 signed int v66; // ecx@109
1125 SHORT v67; // di@117
1126 bool v68; // eax@117
1127 const char *v69; // ecx@119
1128 POINT *v70; // esi@124
1129 int v71; // ecx@125
1130 int v73; // ecx@125
1131 int v75; // eax@130 1075 int v75; // eax@130
1132 int v78; // eax@132 1076 POINT mouse; // [sp+6Ch] [bp-8Ch]@30
1133 int v80; // edx@133
1134 int v81; // edi@133
1135 const char **v83; // eax@135
1136 int v84; // eax@135
1137 unsigned int v85; // ecx@135
1138 int v86; // edx@135
1139 int v89; // [sp-14h] [bp-10Ch]@35
1140 int v91; // [sp-10h] [bp-108h]@35
1141 unsigned __int16 v92; // [sp-Ch] [bp-104h]@12
1142 void *v93; // [sp-Ch] [bp-104h]@14
1143 int v94; // [sp-8h] [bp-100h]@11
1144 char *v95; // [sp-8h] [bp-100h]@12
1145 __int64 *v96; // [sp-4h] [bp-FCh]@11
1146 unsigned int v97; // [sp-4h] [bp-FCh]@12
1147 POINT v98; // [sp+Ch] [bp-ECh]@8
1148 POINT v99; // [sp+14h] [bp-E4h]@16
1149 POINT v100; // [sp+1Ch] [bp-DCh]@124
1150 POINT v101; // [sp+24h] [bp-D4h]@17
1151 POINT v102; // [sp+2Ch] [bp-CCh]@124
1152 POINT v103; // [sp+34h] [bp-C4h]@9
1153 POINT v104; // [sp+3Ch] [bp-BCh]@31
1154 POINT v105; // [sp+44h] [bp-B4h]@16
1155 POINT v106; // [sp+4Ch] [bp-ACh]@30
1156 POINT v107; // [sp+54h] [bp-A4h]@16
1157 POINT v108; // [sp+5Ch] [bp-9Ch]@30
1158 POINT a2; // [sp+64h] [bp-94h]@8
1159 POINT v110; // [sp+6Ch] [bp-8Ch]@30
1160 POINT v111; // [sp+74h] [bp-84h]@8
1161 GUIWindow dialog_window; // [sp+7Ch] [bp-7Ch]@1 1077 GUIWindow dialog_window; // [sp+7Ch] [bp-7Ch]@1
1162 char *Str; // [sp+D0h] [bp-28h]@54 1078 int item_num; // [sp+E0h] [bp-18h]@8
1163 int v146; // [sp+D4h] [bp-24h]@23 1079 int v117; // [sp+E4h] [bp-14h]@40
1164 unsigned int pYellowColor; // [sp+D8h] [bp-20h]@1 1080 int pPrice; // [sp+E8h] [bp-10h]@24
1165 unsigned int pWhiteColor; // [sp+DCh] [bp-1Ch]@1 1081 int one_string; // [sp+ECh] [bp-Ch]@1
1166 __int32 v117; // [sp+E0h] [bp-18h]@8
1167 int v118; // [sp+E4h] [bp-14h]@40
1168 const char **v119; // [sp+E8h] [bp-10h]@24
1169 int _this; // [sp+ECh] [bp-Ch]@1
1170 unsigned __int8 uPlayerID; // [sp+F3h] [bp-5h]@14
1171 int v152; // [sp+F4h] [bp-4h]@23
1172 int v122;
1173 int v114;
1174 int pSrtingNum; 1082 int pSrtingNum;
1175 int pActiveItemNum;
1176 ItemGen *item; 1083 ItemGen *item;
1177 1084
1178 memcpy(&dialog_window, window_SpeakInHouse, sizeof(dialog_window)); 1085 memcpy(&dialog_window, window_SpeakInHouse, sizeof(dialog_window));
1179 dialog_window.uFrameX = 483; 1086 dialog_window.uFrameX = 483;
1180 dialog_window.uFrameWidth = 148; 1087 dialog_window.uFrameWidth = 148;
1181 dialog_window.uFrameZ = 334; 1088 dialog_window.uFrameZ = 334;
1182 pWhiteColor = TargetColor(255, 255, 255);
1183 pYellowColor = TargetColor(225, 205, 35);
1184 if ( dialog_menu_id == HOUSE_DIALOGUE_MAIN) 1089 if ( dialog_menu_id == HOUSE_DIALOGUE_MAIN)
1185 { 1090 {
1186 if ( !HouseUI_CheckIfPlayerCanInteract() ) 1091 if ( !HouseUI_CheckIfPlayerCanInteract() )
1187 return; 1092 return;
1188 pShopOptions[0] = pGlobalTXT_LocalizationStrings[134]; //"Buy Standard" 1093 pShopOptions[0] = pGlobalTXT_LocalizationStrings[134]; //"Buy Standard"
1190 pShopOptions[2] = pGlobalTXT_LocalizationStrings[159]; //"Display Inventory" 1095 pShopOptions[2] = pGlobalTXT_LocalizationStrings[159]; //"Display Inventory"
1191 pShopOptions[3] = pGlobalTXT_LocalizationStrings[160]; 1096 pShopOptions[3] = pGlobalTXT_LocalizationStrings[160];
1192 all_text_height = 0; 1097 all_text_height = 0;
1193 for ( int i = 0; i < 4; ++i ) 1098 for ( int i = 0; i < 4; ++i )
1194 all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0); 1099 all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0);
1195 v146 = (174 - all_text_height) / 4; 1100 one_string = (174 - all_text_height) / 4;
1196 v23 = (174 - 4 * (174 - all_text_height) / 4 - all_text_height) / 2 - (174 - all_text_height) / 4 / 2 + 138; 1101 v23 = (174 - 4 * one_string - all_text_height) / 2 - one_string / 2 + 138;
1197 int j = 0; 1102 int pNumString = 0;
1198 if ( pDialogueWindow->pNumPresenceButton>=0 ) 1103 for (int i = pDialogueWindow->pStartingPosActiveItem;
1199 { 1104 i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i)
1200 int th = 2; 1105 {
1201 for (v152 = pDialogueWindow->pStartingPosActiveItem; v152 < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++v152) 1106 control_button = pDialogueWindow->GetControl(i);
1202 { 1107 control_button->uY = one_string + v23;
1203 control_button = pDialogueWindow->GetControl(v152); 1108 control_button->uHeight = pFontArrus->CalcTextHeight(pShopOptions[pNumString], &dialog_window, 0, 0);
1204 control_button->uY = v146 + v23; 1109 v23 = control_button->uY + control_button->uHeight - 1;
1205 pTextHeight = pFontArrus->CalcTextHeight(pShopOptions[j], &dialog_window, 0, 0); 1110 control_button->uW = v23;
1206 control_button->uHeight = pTextHeight; 1111 text_color = TargetColor(225, 205, 35);
1207 v23 = control_button->uY + control_button->uHeight - 1; 1112 if ( pDialogueWindow->pCurrentPosActiveItem != i )
1208 control_button->uW = v23; 1113 text_color = TargetColor(255, 255, 255);
1209 text_color = pYellowColor; 1114 dialog_window.DrawTitleText(pFontArrus, 0, control_button->uY, text_color, pShopOptions[pNumString], 3);
1210 if ( pDialogueWindow->pCurrentPosActiveItem != th ) 1115 ++pNumString;
1211 text_color = pWhiteColor;
1212 dialog_window.DrawTitleText(pFontArrus, 0, control_button->uY, text_color, pShopOptions[j], 3);
1213 ++th;
1214 ++j;
1215 }
1216 } 1116 }
1217 return; 1117 return;
1218 } 1118 }
1119
1219 if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_BUY_STANDARD) 1120 if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_BUY_STANDARD)
1220 { 1121 {
1221 pRenderer->DrawTextureIndexed(8, 8, ShopTexture); 1122 pRenderer->DrawTextureIndexed(8, 8, ShopTexture);
1222 v3 = 0; 1123 for ( uint i = 0; i < 6; ++i )
1223 v49 = 0; 1124 {
1224 v122 = 0; 1125 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].uItemID)
1225 do 1126 {
1226 { 1127 product_height_1row = 152 - ItemsInShopTexture[i]->uTextureHeight;
1227 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v49].uItemID) 1128 if ( (signed int)product_height_1row < 1 )
1228 { 1129 product_height_1row = 0;
1229 v50 = ItemsInShopTexture[v49]; 1130 product_width_1row = 75 * i - ItemsInShopTexture[i]->uTextureWidth / 2 + 40;
1230 v51 = 152 - v50->uTextureHeight; 1131 if ( i )
1231 if ( (signed int)v51 < 1 ) 1132 {
1232 v51 = 0; 1133 if ( i == 5 )
1233 v52 = 75 * v49 - v50->uTextureWidth / 2 + 40; 1134 {
1234 if ( v122 ) 1135 if ( (signed int)product_width_1row > 457 - ItemsInShopTexture[5]->uTextureWidth )
1235 { 1136 product_width_1row = 457 - ItemsInShopTexture[5]->uTextureWidth;
1236 if ( v122 == 5 )
1237 {
1238 v53 = ItemsInShopTexture[5]->uTextureWidth;
1239 if ( (signed int)v52 > 457 - v53 )
1240 v52 = 457 - v53;
1241 } 1137 }
1242 } 1138 }
1243 else 1139 else
1244 { 1140 {
1245 if ( (signed int)v52 < 18 ) 1141 if ( (signed int)product_width_1row < 18 )
1246 v52 = 18; 1142 product_width_1row = 18;
1247 } 1143 }
1248 pRenderer->DrawTextureTransparent(v52, v51, v50); 1144 pRenderer->DrawTextureTransparent(product_width_1row, product_height_1row, ItemsInShopTexture[i]);
1249 ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[v52 + 640 * v51], ItemsInShopTexture[v122], v122 + 1); 1145 ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[product_width_1row + 640 * product_height_1row], ItemsInShopTexture[i], i + 1);
1250 v49 = v122; 1146 }
1251 } 1147 }
1252 ++v49; 1148 for ( uint i = 0; i < 6; ++i )
1253 v122 = v49; 1149 {
1254 } 1150 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i + 6].uItemID)
1255 while ( v49 < 6 ); 1151 {
1256 v122 = 0; 1152 product_height_2row = 306 - ItemsInShopTexture[i + 6]->uTextureHeight;
1257 do 1153 product_width_2row = 75 * i - ItemsInShopTexture[i + 6]->uTextureWidth / 2 + 40;
1258 { 1154 if ( i )
1259 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v122 + 6].uItemID) 1155 {
1260 { 1156 if ( i == 5 )
1261 v54 = ItemsInShopTexture[v122 + 6]; 1157 {
1262 v55 = 306 - v54->uTextureHeight; 1158 if ( (signed int)product_width_2row > 457 - ItemsInShopTexture[11]->uTextureWidth )
1263 v56 = 75 * v122 - v54->uTextureWidth / 2 + 40; 1159 product_width_2row = 457 - ItemsInShopTexture[11]->uTextureWidth;
1264 if ( v122 )
1265 {
1266 if ( v122 == 5 )
1267 {
1268 v57 = ItemsInShopTexture[11]->uTextureWidth;
1269 if ( (signed int)v56 > 457 - v57 )
1270 v56 = 457 - v57;
1271 } 1160 }
1272 } 1161 }
1273 else 1162 else
1274 { 1163 {
1275 if ( (signed int)v56 < 18 ) 1164 if ( (signed int)product_width_2row < 18 )
1276 v56 = 18; 1165 product_width_2row = 18;
1277 } 1166 }
1278 pRenderer->DrawTextureTransparent(v56, v55, v54); 1167 pRenderer->DrawTextureTransparent(product_width_2row, product_height_2row, ItemsInShopTexture[i + 6]);
1279 ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[v56 + 640 * v55], ItemsInShopTexture[v122 + 6], v122 + 7); 1168 ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[product_width_2row + 640 * product_height_2row], ItemsInShopTexture[i + 6], i + 7);
1280 } 1169 }
1281 ++v122; 1170 }
1282 }
1283 while ( v122 < 6 );
1284 if ( HouseUI_CheckIfPlayerCanInteract() ) 1171 if ( HouseUI_CheckIfPlayerCanInteract() )
1285 { 1172 {
1286 v66 = 0; 1173 item_num = 0;
1287 v117 = 0; 1174 for ( uint i = 0; i < 12; ++i )
1288 if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_BUY_STANDARD) 1175 {
1289 { 1176 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].uItemID )
1290 do 1177 ++item_num;
1291 { 1178 }
1292 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v66].uItemID) //9 * (v66 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] ) 1179 if ( GetAsyncKeyState(VK_CONTROL) && pPlayers[uActiveCharacter]->CanSteal() )
1293 ++v117; 1180 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[185], 0);// "Steal item"
1294 ++v66;
1295 }
1296 while ( v66 < 12 );
1297 }
1298 else 1181 else
1299 { 1182 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[195], 0);// "Select the Item to Buy"
1300 do 1183 if ( !item_num )
1301 {
1302 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v66].uItemID)
1303 ++v117;
1304 ++v66;
1305 }
1306 while ( v66 < 12 );
1307 }
1308 v67 = GetAsyncKeyState(VK_CONTROL);
1309 v68 = pPlayers[uActiveCharacter]->CanSteal();
1310 Str = (char *)v68;
1311 if ( v67 && v68 )
1312 {
1313 v69 = pGlobalTXT_LocalizationStrings[185];// "Steal item"
1314 }
1315 else
1316 {
1317 v69 = pGlobalTXT_LocalizationStrings[195];// "Select the Item to Buy"
1318 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD)
1319 v69 = pGlobalTXT_LocalizationStrings[196];// "Select the Special Item to Buy"
1320 }
1321 DrawTextAtStatusBar(v69, 0);
1322 if ( !v117 )
1323 { 1184 {
1324 dialog_window.DrawCurrentTime( pParty->field_3C.Shops_next_generation_time[(unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed); 1185 dialog_window.DrawCurrentTime( pParty->field_3C.Shops_next_generation_time[(unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed);
1325 return; 1186 return;
1326 } 1187 }
1327 v70 = pMouse->GetCursorPos(&v102); 1188 pMouse->GetCursorPos(&mouse);
1328 result = v70->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v100)->y]; 1189 if ( pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF )
1329 if ( pRenderer->pActiveZBuffer[result] & 0xFFFF ) 1190 {
1330 { 1191 item = &pParty->StandartItemsInShops[(int)window_SpeakInHouse->ptr_1C][(pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF) - 1];
1331 v71 = (pRenderer->pActiveZBuffer[result] & 0xFFFF) - 1; 1192 if ( GetAsyncKeyState(VK_CONTROL) && pPlayers[uActiveCharacter]->CanSteal() )
1332 item = &pParty->StandartItemsInShops[(int)window_SpeakInHouse->ptr_1C][v71]; 1193 v30 = BuildDialogueString(pGlobalTXT_LocalizationStrings[181], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 2, 0);// "Steal %24"
1333 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD)
1334 item = &pParty->SpecialItemsInShops[(int)window_SpeakInHouse->ptr_1C][v71];
1335 if ( v67 && Str )
1336 v10 = pGlobalTXT_LocalizationStrings[181];// "Steal %24"
1337 else 1194 else
1338 { 1195 {
1339 v75 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(item, BuildingType_MagicShop, (int)window_SpeakInHouse->ptr_1C, 2); 1196 v75 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(item, BuildingType_MagicShop, (int)window_SpeakInHouse->ptr_1C, 2);
1340 v10 = (char *)pMerchantsBuyPhrases[v75]; 1197 v30 = BuildDialogueString((char *)pMerchantsBuyPhrases[v75], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 2, 0);
1341 } 1198 }
1342 v30 = BuildDialogueString(v10, uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 2, 0); 1199 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(v30, &dialog_window, 0, 0)) / 2 + 138, TargetColor(255, 255, 255), v30, 3);
1343 v6 = (174 - pFontArrus->CalcTextHeight(v30, &dialog_window, v3, v3)) / 2 + 138;
1344 dialog_window.DrawTitleText(pFontArrus, v3, v6, pWhiteColor, v30, 3);
1345 return; 1200 return;
1346 } 1201 }
1347 } 1202 }
1348 return; 1203 return;
1349 } 1204 }
1205
1350 if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_BUY_SPECIAL) 1206 if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_BUY_SPECIAL)
1351 { 1207 {
1352 pRenderer->DrawTextureIndexed(8, 8, ShopTexture); 1208 pRenderer->DrawTextureIndexed(8, 8, ShopTexture);
1353 v3 = 0; 1209 for ( uint i = 0; i < 6; ++i )
1354 v49 = 0; 1210 {
1355 v122 = 0; 1211 if ( pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].uItemID )
1356 do 1212 {
1357 { 1213 product_height_1row = 152 - ItemsInShopTexture[i]->uTextureHeight;
1358 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v49].uItemID) 1214 if ( (signed int)product_height_1row < 1 )
1359 { 1215 product_height_1row = 0;
1360 v59 = 152 - ItemsInShopTexture[v49]->uTextureHeight; 1216 product_width_1row = 75 * i - ItemsInShopTexture[i]->uTextureWidth / 2 + 40;
1361 if ( (signed int)v59 < 1 ) 1217 if ( i )
1362 v59 = 0; 1218 {
1363 v60 = 75 * v49 - ItemsInShopTexture[v49]->uTextureWidth / 2 + 40; 1219 if ( i == 5 )
1364 if ( v122 ) 1220 {
1365 { 1221 if ( (signed int)product_width_1row > 457 - ItemsInShopTexture[5]->uTextureWidth )
1366 if ( v122 == 5 ) 1222 product_width_1row = 457 - ItemsInShopTexture[5]->uTextureWidth;
1367 {
1368 v61 = ItemsInShopTexture[5]->uTextureWidth;
1369 if ( (signed int)v60 > 457 - v61 )
1370 v60 = 457 - v61;
1371 } 1223 }
1372 } 1224 }
1373 else 1225 else
1374 { 1226 {
1375 if ( (signed int)v60 < 18 ) 1227 if ( (signed int)product_width_1row < 18 )
1376 v60 = 18; 1228 product_width_1row = 18;
1377 } 1229 }
1378 pRenderer->DrawTextureTransparent(v60, v59, ItemsInShopTexture[v49]); 1230 pRenderer->DrawTextureTransparent(product_width_1row, product_height_1row, ItemsInShopTexture[i]);
1379 ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[v60 + 640 * v59], ItemsInShopTexture[v122], v122 + 1); 1231 ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[product_width_1row + 640 * product_height_1row], ItemsInShopTexture[i], i + 1);
1380 v49 = v122; 1232 }
1381 } 1233 }
1382 ++v49; 1234 for ( uint i = 0; i < 6; ++i )
1383 v122 = v49; 1235 {
1384 } 1236 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i + 6].uItemID)
1385 while ( v49 < 6 ); 1237 {
1386 v122 = 0; 1238 product_height_2row = 306 - ItemsInShopTexture[i + 6]->uTextureHeight;
1387 do 1239 if ( (signed int)product_height_2row < 1 )
1388 { 1240 product_height_2row = 0;
1389 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v122 + 6].uItemID) 1241 product_width_2row = 75 * i - ItemsInShopTexture[i + 6]->uTextureWidth / 2 + 40;
1390 { 1242 if ( i )
1391 v63 = 306 - ItemsInShopTexture[v122 + 6]->uTextureHeight; 1243 {
1392 if ( (signed int)v63 < 1 ) 1244 if ( i == 5 )
1393 v63 = 0; 1245 {
1394 v64 = 75 * v122 - ItemsInShopTexture[v122 + 6]->uTextureWidth / 2 + 40; 1246 if ( (signed int)product_width_2row > 457 - ItemsInShopTexture[11]->uTextureWidth )
1395 if ( v122 ) 1247 product_width_2row = 457 - ItemsInShopTexture[11]->uTextureWidth;
1396 {
1397 if ( v122 == 5 )
1398 {
1399 v65 = ItemsInShopTexture[11]->uTextureWidth;
1400 if ( (signed int)v64 > 457 - v65 )
1401 v64 = 457 - v65;
1402 } 1248 }
1403 } 1249 }
1404 else 1250 else
1405 { 1251 {
1406 if ( (signed int)v64 < 18 ) 1252 if ( (signed int)product_width_2row < 18 )
1407 v64 = 18; 1253 product_width_2row = 18;
1408 } 1254 }
1409 pRenderer->DrawTextureTransparent(v64, v63, ItemsInShopTexture[v122 + 6]); 1255 pRenderer->DrawTextureTransparent(product_width_2row, product_height_2row, ItemsInShopTexture[i + 6]);
1410 ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[v64 + 640 * v63], ItemsInShopTexture[v122 + 6], v122 + 7); 1256 ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[product_width_2row + 640 * product_height_2row], ItemsInShopTexture[i + 6], i + 7);
1411 } 1257 }
1412 ++v122; 1258 }
1413 }
1414 while ( v122 < 6 );
1415 if ( HouseUI_CheckIfPlayerCanInteract() ) 1259 if ( HouseUI_CheckIfPlayerCanInteract() )
1416 { 1260 {
1417 v66 = 0; 1261 item_num = 0;
1418 v117 = 0; 1262 for ( uint i = 0; i < 12; ++i )
1419 if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_BUY_STANDARD) 1263 {
1420 { 1264 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].uItemID)
1421 do 1265 ++item_num;
1422 { 1266 }
1423 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v66].uItemID) //9 * (v66 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] ) 1267 if ( GetAsyncKeyState(VK_CONTROL) && pPlayers[uActiveCharacter]->CanSteal() )
1424 ++v117; 1268 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[185], 0);// "Steal item"
1425 ++v66;
1426 }
1427 while ( v66 < 12 );
1428 }
1429 else 1269 else
1430 { 1270 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[196], 0);// "Select the Special Item to Buy"
1431 do 1271 if ( !item_num )
1432 {
1433 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v66].uItemID)
1434 ++v117;
1435 ++v66;
1436 }
1437 while ( v66 < 12 );
1438 }
1439 v67 = GetAsyncKeyState(VK_CONTROL);
1440 v68 = pPlayers[uActiveCharacter]->CanSteal();
1441 Str = (char *)v68;
1442 if ( v67 && v68 )
1443 {
1444 v69 = pGlobalTXT_LocalizationStrings[185];// "Steal item"
1445 }
1446 else
1447 {
1448 v69 = pGlobalTXT_LocalizationStrings[195];// "Select the Item to Buy"
1449 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD)
1450 v69 = pGlobalTXT_LocalizationStrings[196];// "Select the Special Item to Buy"
1451 }
1452 DrawTextAtStatusBar(v69, 0);
1453 if ( !v117 )
1454 { 1272 {
1455 dialog_window.DrawCurrentTime( pParty->field_3C.Shops_next_generation_time[(unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed); 1273 dialog_window.DrawCurrentTime( pParty->field_3C.Shops_next_generation_time[(unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed);
1456 return; 1274 return;
1457 } 1275 }
1458 v70 = pMouse->GetCursorPos(&v102); 1276 pMouse->GetCursorPos(&mouse);
1459 result = v70->x + pSRZBufferLineOffsets[v70->y]; 1277 if ( pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF )
1460 if ( pRenderer->pActiveZBuffer[result] & 0xFFFF ) 1278 {
1461 { 1279 item = &pParty->SpecialItemsInShops[(int)window_SpeakInHouse->ptr_1C][(pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF) - 1];
1462 v71 = (pRenderer->pActiveZBuffer[result] & 0xFFFF) - 1; 1280 if ( GetAsyncKeyState(VK_CONTROL) && pPlayers[uActiveCharacter]->CanSteal() )
1463 item = &pParty->StandartItemsInShops[(int)window_SpeakInHouse->ptr_1C][v71]; 1281 v30 = BuildDialogueString(pGlobalTXT_LocalizationStrings[181], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 2, 0);// "Steal %24"
1464 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD)
1465 item = &pParty->SpecialItemsInShops[(int)window_SpeakInHouse->ptr_1C][v71];
1466 if ( v67 && Str )
1467 v10 = pGlobalTXT_LocalizationStrings[181];// "Steal %24"
1468 else 1282 else
1469 { 1283 {
1470 v75 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(item, BuildingType_MagicShop, (int)window_SpeakInHouse->ptr_1C, 2); 1284 v75 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(item, BuildingType_MagicShop, (int)window_SpeakInHouse->ptr_1C, 2);
1471 v10 = (char *)pMerchantsBuyPhrases[v75]; 1285 v30 = BuildDialogueString((char *)pMerchantsBuyPhrases[v75], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 2, 0);
1472 } 1286 }
1473 v30 = BuildDialogueString(v10, uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 2, 0); 1287 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(v30, &dialog_window, 0, 0)) / 2 + 138, TargetColor(255, 255, 255), v30, 3);
1474 v6 = (174 - pFontArrus->CalcTextHeight(v30, &dialog_window, v3, v3)) / 2 + 138;
1475 dialog_window.DrawTitleText(pFontArrus, v3, v6, pWhiteColor, v30, 3);
1476 return; 1288 return;
1477 } 1289 }
1478 } 1290 }
1479 return; 1291 return;
1480 } 1292 }
1293
1481 if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT ) 1294 if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT )
1482 { 1295 {
1483 draw_leather(); 1296 draw_leather();
1484 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); 1297 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true);
1485 pShopOptions[0] = pGlobalTXT_LocalizationStrings[200];// "Sell" 1298 pShopOptions[0] = pGlobalTXT_LocalizationStrings[200];// "Sell"
1486 pShopOptions[1] = pGlobalTXT_LocalizationStrings[113];// "Identify" 1299 pShopOptions[1] = pGlobalTXT_LocalizationStrings[113];// "Identify"
1487 pShopOptions[2] = pGlobalTXT_LocalizationStrings[179];// "Repair" 1300 pShopOptions[2] = pGlobalTXT_LocalizationStrings[179];// "Repair"
1488 all_text_height = 0; 1301 all_text_height = 0;
1489 for ( uint i = 0; i < 3; ++i ) 1302 for ( uint i = 0; i < 3; ++i )
1490 all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0); 1303 all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0);
1491 _this = ((174 - all_text_height) / 3); 1304 one_string = ((174 - all_text_height) / 3);
1492 v81 = (3 * (58 - (signed int)_this) - all_text_height) / 2 - (174 - all_text_height) / 3 / 2 + 138; 1305 v23 = (3 * (58 - (signed int)one_string) - all_text_height) / 2 - (174 - all_text_height) / 3 / 2 + 138;
1493 v20 = -pDialogueWindow->pNumPresenceButton < 0; 1306 pSrtingNum = 0;
1494 v118 = pDialogueWindow->pStartingPosActiveItem; 1307 for ( int i = pDialogueWindow->pStartingPosActiveItem;
1495 if ( v20 ^ (pDialogueWindow->pStartingPosActiveItem > pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton) ) 1308 i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i )
1496 { 1309 {
1497 v122 = 2; 1310 control_button = pDialogueWindow->GetControl(i);
1498 pSrtingNum = 0; 1311 control_button->uY = one_string + v23;
1499 do 1312 control_button->uHeight = pFontArrus->CalcTextHeight(pShopOptions[pSrtingNum], &dialog_window, 0, 0);
1500 { 1313 v23 = control_button->uHeight + control_button->uY - 1;
1501 control_button = pDialogueWindow->GetControl(v118); 1314 control_button->uW = v23;
1502 control_button->uY = (unsigned int)((char *)_this + v81); 1315 text_color = TargetColor(225, 205, 35);
1503 pTextHeight = pFontArrus->CalcTextHeight(pShopOptions[pSrtingNum], &dialog_window, 0, 0); 1316 if ( pDialogueWindow->pCurrentPosActiveItem != i )
1504 v85 = control_button->uY; 1317 text_color = TargetColor(255, 255, 255);
1505 control_button->uHeight = pTextHeight; 1318 dialog_window.DrawTitleText(pFontArrus, 0, control_button->uY, text_color, pShopOptions[pSrtingNum], 3);
1506 v81 = pTextHeight + v85 - 1; 1319 ++pSrtingNum;
1507 control_button->uW = v81;
1508 text_color = pYellowColor;
1509 if ( pDialogueWindow->pCurrentPosActiveItem != v122 )
1510 text_color = pWhiteColor;
1511 dialog_window.DrawTitleText(pFontArrus, 0, v85, text_color, pShopOptions[pSrtingNum], 3);
1512 ++v122;
1513 ++pSrtingNum;
1514 ++v118;
1515 }
1516 while ( v118 < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem );
1517 } 1320 }
1518 return; 1321 return;
1519 } 1322 }
1323
1520 if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_SELL) 1324 if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_SELL)
1521 { 1325 {
1522 draw_leather(); 1326 draw_leather();
1523 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); 1327 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true);
1524 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[199], 0);// "Select the Item to Sell" 1328 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[199], 0);// "Select the Item to Sell"
1525 if ( !HouseUI_CheckIfPlayerCanInteract() 1329 if ( !HouseUI_CheckIfPlayerCanInteract() )
1526 || (v11 = pMouse->GetCursorPos(&v107)->x - 14, 1330 return;
1527 v117 = (v11 >> 5) + 14 * ((pMouse->GetCursorPos(&v99)->y - 17) >> 5), 1331 pMouse->GetCursorPos(&mouse);
1528 result = (int)pMouse->GetCursorPos(&v105), 1332 v117 = ((mouse.x - 14) >> 5) + 14 * ((mouse.y - 17) >> 5);
1529 *(int *)result <= 13) 1333 if ( mouse.x <= 13 || mouse.x >= 462 )
1530 || (result = (int)pMouse->GetCursorPos(&v101), *(int *)result >= 462) 1334 return;
1531 || (result = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v117), v3 = 0, !result) ) 1335 if ( !pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v117) )
1532 return; 1336 return;
1533 item = &pPlayers[uActiveCharacter]->pInventoryItemList[result - 1]; 1337 item = &pPlayers[uActiveCharacter]->pInventoryItemList[pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v117) - 1];
1534 v13 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(item, BuildingType_MagicShop, (int)window_SpeakInHouse->ptr_1C, 3); 1338 v75 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(item, BuildingType_MagicShop, (int)window_SpeakInHouse->ptr_1C, 3);
1535 v30 = BuildDialogueString((char *)pMerchantsSellPhrases[v13], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 3, 0); 1339 v30 = BuildDialogueString((char *)pMerchantsSellPhrases[v75], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 3, 0);
1536 v6 = (174 - pFontArrus->CalcTextHeight(v30, &dialog_window, v3, v3)) / 2 + 138; 1340 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(v30, &dialog_window, 0, 0)) / 2 + 138, TargetColor(255, 255, 255), v30, 3);
1537 dialog_window.DrawTitleText(pFontArrus, v3, v6, pWhiteColor, v30, 3);
1538 return; 1341 return;
1539 } 1342 }
1343
1540 if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_IDENTIFY) 1344 if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_IDENTIFY)
1541 { 1345 {
1542 draw_leather(); 1346 draw_leather();
1543 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); 1347 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true);
1544 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[197], 0);// "Select the Item to Identify" 1348 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[197], 0);// "Select the Item to Identify"
1545 if ( HouseUI_CheckIfPlayerCanInteract() ) 1349 if ( HouseUI_CheckIfPlayerCanInteract() )
1546 { 1350 {
1547 v2 = pMouse->GetCursorPos(&a2)->x - 14; 1351 pMouse->GetCursorPos(&mouse);
1548 v117 = (v2 >> 5) + 14 * ((pMouse->GetCursorPos(&v98)->y - 17) >> 5); 1352 v117 = ((mouse.x -14) >> 5) + 14 * ((mouse.y - 17) >> 5);
1549 result = (int)pMouse->GetCursorPos(&v111); 1353 if ( mouse.x > 13 && mouse.x < 462 )
1550 if ( *(int *)result > 13 ) 1354 {
1551 { 1355 if ( pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v117) )
1552 result = (int)pMouse->GetCursorPos(&v103); 1356 {
1553 if ( *(int *)result < 462 ) 1357 item = &pPlayers[uActiveCharacter]->pInventoryItemList[pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v117) - 1];
1554 { 1358 if ( item->uAttributes & 1 )
1555 result = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v117); 1359 {
1556 if ( result ) 1360 dialog_window.DrawTitleText(pFontArrus, 0, (212 - pFontArrus->CalcTextHeight(BuildDialogueString("%24", uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 4, 0), &dialog_window, 0, 0)) / 2 + 101,
1557 { 1361 TargetColor(255, 255, 255), BuildDialogueString("%24", uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 4, 0), 3);
1558 item = &pPlayers[uActiveCharacter]->pInventoryItemList[result-1];
1559 if ( item->uAttributes & 1 )
1560 {
1561 v5 = BuildDialogueString("%24", uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 4, 0);
1562 v6 = (212 - pFontArrus->CalcTextHeight(v5, &dialog_window, 0, 0)) / 2 + 101;
1563 dialog_window.DrawTitleText(pFontArrus, 0, v6, pWhiteColor, v5, 3);
1564 return;
1565 }
1566 v8 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(item, BuildingType_MagicShop, (int)window_SpeakInHouse->ptr_1C, 4);
1567 v30 = BuildDialogueString((char *)pMerchantsIdentifyPhrases[v8], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 4, 0);
1568 v6 = (174 - pFontArrus->CalcTextHeight(v30, &dialog_window, 0, 0)) / 2 + 138;
1569 dialog_window.DrawTitleText(pFontArrus, 0, v6, pWhiteColor, v30, 3);
1570 return; 1362 return;
1571 } 1363 }
1364 v75 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(item, BuildingType_MagicShop, (int)window_SpeakInHouse->ptr_1C, 4);
1365 v30 = BuildDialogueString((char *)pMerchantsIdentifyPhrases[v75], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 4, 0);
1366 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(v30, &dialog_window, 0, 0)) / 2 + 138, TargetColor(255, 255, 255), v30, 3);
1367 return;
1572 } 1368 }
1573 } 1369 }
1574 } 1370 }
1575 return; 1371 return;
1576 } 1372 }
1373
1577 if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_REPAIR) 1374 if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_REPAIR)
1578 { 1375 {
1579 draw_leather(); 1376 draw_leather();
1580 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); 1377 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true);
1581 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[198], 0);// "Select the Item to Repair" 1378 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[198], 0);// "Select the Item to Repair"
1582 if ( !HouseUI_CheckIfPlayerCanInteract() 1379 if ( !HouseUI_CheckIfPlayerCanInteract() )
1583 || (pTextHeight = pMouse->GetCursorPos(&v110)->x - 14, 1380 return;
1584 v117 = (pTextHeight >> 5) + 14 * ((pMouse->GetCursorPos(&v108)->y - 17) >> 5), 1381 pMouse->GetCursorPos(&mouse);
1585 result = (int)pMouse->GetCursorPos(&v106), 1382 v117 = ((mouse.x - 14) >> 5) + 14 * ((mouse.y - 17) >> 5);
1586 *(int *)result <= 13) 1383 if ( mouse.x <= 13 || mouse.x >= 462 )
1587 || (result = (int)pMouse->GetCursorPos(&v104), *(int *)result >= 462) 1384 return;
1588 || (result = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v117), v3 = 0, !result) 1385 if ( !pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v117)
1589 // || (result *= 9, !(pPlayers[uActiveCharacter]->field_1F5[4 * result + 15] & 2)) ) 1386 || !(pPlayers[uActiveCharacter]->pOwnItems[pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v117)-1].uAttributes& 2) )
1590 || (!(pPlayers[uActiveCharacter]->pOwnItems[result-1].uAttributes& 2)) ) 1387 return;
1591 return; 1388 item = &pPlayers[uActiveCharacter]->pInventoryItemList[pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v117) - 1];
1592 item = &pPlayers[uActiveCharacter]->pInventoryItemList[result - 1]; 1389 v75 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(&pPlayers[uActiveCharacter]->pInventoryItemList[pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v117) - 1],
1593 v29 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(&pPlayers[uActiveCharacter]->pInventoryItemList[result - 1], BuildingType_MagicShop, (int)window_SpeakInHouse->ptr_1C, 5); 1390 BuildingType_MagicShop, (int)window_SpeakInHouse->ptr_1C, 5);
1594 v30 = BuildDialogueString((char *)pMerchantsRepairPhrases[v29], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 5, 0); 1391 v30 = BuildDialogueString((char *)pMerchantsRepairPhrases[v75], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 5, 0);
1595 v6 = (174 - pFontArrus->CalcTextHeight(v30, &dialog_window, v3, v3)) / 2 + 138; 1392 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(v30, &dialog_window, 0, 0)) / 2 + 138, TargetColor(255, 255, 255), v30, 3);
1596 dialog_window.DrawTitleText(pFontArrus, v3, v6, pWhiteColor, v30, 3);
1597 return; 1393 return;
1598 } 1394 }
1395
1599 if ( dialog_menu_id == HOUSE_DIALOGUE_LEARN_SKILLS ) 1396 if ( dialog_menu_id == HOUSE_DIALOGUE_LEARN_SKILLS )
1600 { 1397 {
1601 if ( HouseUI_CheckIfPlayerCanInteract() ) 1398 if ( HouseUI_CheckIfPlayerCanInteract() )
1602 { 1399 {
1603 v3 = 0;
1604 all_text_height = 0; 1400 all_text_height = 0;
1605 v33 = (signed __int64)(p2DEvents[(signed int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0); 1401 v33 = (signed __int64)(p2DEvents[(signed int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0);
1606 v119 = (const char **)(v33 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100); 1402 pPrice = v33 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100;
1607 if ( (signed int)v119 < v33 / 3 ) 1403 if ( pPrice < v33 / 3 )
1608 v119 = (const char **)(v33 / 3); 1404 pPrice = v33 / 3;
1609 pActiveItemNum = pDialogueWindow->pStartingPosActiveItem; 1405 item_num = 0;
1610 v122 = 0; 1406 for ( int i = pDialogueWindow->pStartingPosActiveItem;
1611 if ( (signed int)pDialogueWindow->pStartingPosActiveItem >= pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton ) 1407 i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i )
1408 {
1409 if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][pDialogueWindow->GetControl(i)->msg_param - 36]
1410 && !pPlayers[uActiveCharacter]->pActiveSkills[pDialogueWindow->GetControl(i)->msg_param - 36] )
1411 {
1412 all_text_height += pFontArrus->CalcTextHeight(pSkillNames[pDialogueWindow->GetControl(i)->msg_param - 36], &dialog_window, 0, 0);
1413 ++item_num;
1414 }
1415 }
1416 if ( !item_num )
1612 { 1417 {
1613 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]);// 1418 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]);//
1614 // "Seek knowledge elsewhere %s the %s" 1419 // "Seek knowledge elsewhere %s the %s"
1615 strcat(pTmpBuf.data(), "\n \n"); 1420 strcat(pTmpBuf.data(), "\n \n");
1616 strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]);// "I can offer you nothing further." 1421 strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]);// "I can offer you nothing further."
1617 v6 = (174 - pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 0, 0)) / 2 + 138; 1422 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 0, 0)) / 2 + 138, TargetColor(225, 205, 35), pTmpBuf.data(), 3);
1618 dialog_window.DrawTitleText(pFontArrus, v3, v6, pYellowColor, pTmpBuf.data(), 3); 1423 return;
1619 return; 1424 }
1620 } 1425 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[401], pPrice);// "Skill Cost: %lu"
1621 do 1426 dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3);
1622 { 1427 one_string = (149 - all_text_height) / item_num;
1623 v36 = pDialogueWindow->GetControl(pActiveItemNum)->msg_param - 36; 1428 if ( one_string > 32 )
1624 if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][v36] && !pPlayers[uActiveCharacter]->pActiveSkills[v36] ) 1429 one_string = 32;
1625 { 1430 v23 = (149 - item_num * one_string - all_text_height) / 2 - one_string / 2 + 162;
1626 all_text_height += pFontArrus->CalcTextHeight(pSkillNames[v36], &dialog_window, 0, 0); 1431 for ( int i = pDialogueWindow->pStartingPosActiveItem;
1627 ++v122; 1432 i < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton; ++i)
1628 } 1433 {
1629 ++pActiveItemNum; 1434 control_button = pDialogueWindow->GetControl(i);
1630 } 1435 if ( !byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][control_button->msg_param - 36]
1631 while ( pActiveItemNum < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem ); 1436 || pPlayers[uActiveCharacter]->pActiveSkills[control_button->msg_param - 36] )
1632 if ( !v122 ) 1437 {
1633 { 1438 control_button->uW = 0;
1634 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]);// 1439 control_button->uHeight = 0;
1635 // "Seek knowledge elsewhere %s the %s" 1440 control_button->uY = 0;
1636 strcat(pTmpBuf.data(), "\n \n"); 1441 }
1637 strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]);// "I can offer you nothing further." 1442 else
1638 v6 = (174 - pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 0, 0)) / 2 + 138; 1443 {
1639 dialog_window.DrawTitleText(pFontArrus, v3, v6, pYellowColor, pTmpBuf.data(), 3); 1444 control_button->uY = one_string + v23;
1640 return; 1445 control_button->uHeight = pFontArrus->CalcTextHeight(pSkillNames[control_button->msg_param - 36], &dialog_window, 0, 0);
1641 } 1446 v23 = control_button->uY + control_button->uHeight - 1;
1642 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[401], v119);// "Skill Cost: %lu" 1447 control_button->uW = v23;
1643 dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3u); 1448 text_color = TargetColor(225, 205, 35);
1644 v119 = (const char **)((149 - all_text_height) / v122); 1449 if ( pDialogueWindow->pCurrentPosActiveItem != i )
1645 if ( (149 - all_text_height) / v122 > 32 ) 1450 text_color = TargetColor(255, 255, 255);
1646 v119 = (const char **)32; 1451 dialog_window.DrawTitleText(pFontArrus, 0, control_button->uY, text_color, pSkillNames[control_button->msg_param - 36], 3);
1647 v38 = (149 - v122 * (signed int)v119 - all_text_height) / 2 - (signed int)v119 / 2 + 162; 1452 }
1648 v118 = 2;
1649 if ( pDialogueWindow->pStartingPosActiveItem < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton )
1650 {
1651 v122 = 2;
1652 do
1653 {
1654 control_button = pDialogueWindow->GetControl(v122);
1655 v41 = control_button->msg_param - 36;
1656 if ( !byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][v41] || pPlayers[uActiveCharacter]->pActiveSkills[v41] )
1657 {
1658 control_button->uW = 0;
1659 control_button->uHeight = 0;
1660 control_button->uY = 0;
1661 }
1662 else
1663 {
1664 control_button->uY = (unsigned int)((char *)v119 + v38);
1665 pTextHeight = pFontArrus->CalcTextHeight(pSkillNames[v41], &dialog_window, 0, 0);
1666 v44 = control_button->uY;
1667 control_button->uHeight = pTextHeight;
1668 v38 = v44 + pTextHeight - 1;
1669 control_button->uW = v38;
1670 text_color = pYellowColor;
1671 if ( pDialogueWindow->pCurrentPosActiveItem != v122 )
1672 text_color = pWhiteColor;
1673 dialog_window.DrawTitleText(pFontArrus, 0, v44, text_color, pSkillNames[v41], 3);
1674 }
1675 ++v122;
1676 }
1677 while ( v122 < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem );
1678 } 1453 }
1679 } 1454 }
1680 return; 1455 return;
1681 } 1456 }
1682 return; 1457 return;