Mercurial > mm7
comparison UI/UIShops.cpp @ 1748:19684d4bbe9a
Merge
author | Grumpy7 |
---|---|
date | Mon, 30 Sep 2013 05:59:06 +0200 |
parents | cecb080929c4 f305a00a6d98 |
children | 42a1874a2171 |
comparison
equal
deleted
inserted
replaced
1747:cecb080929c4 | 1748:19684d4bbe9a |
---|---|
14 #include "..\Viewport.h" | 14 #include "..\Viewport.h" |
15 | 15 |
16 //----- (004B910F) -------------------------------------------------------- | 16 //----- (004B910F) -------------------------------------------------------- |
17 void WeaponShopDialog() | 17 void WeaponShopDialog() |
18 { | 18 { |
19 int v0; // ebx@1 | 19 int phrases_id; // eax@16 |
20 int pNumActiveItem; // eax@6 | |
21 signed int v2; // esi@8 | |
22 ItemGen *v4; // eax@11 | |
23 char *v5; // ecx@12 | |
24 unsigned __int8 v6; // dl@13 | |
25 char *v7; // edx@14 | |
26 int v9; // ST08_4@16 | |
27 int v10; // eax@16 | |
28 signed int v11; // esi@18 | |
29 int v12; // ST08_4@21 | |
30 int v13; // eax@21 | |
31 int v14; // edi@23 | |
32 char **v15; // esi@23 | |
33 int v16; // eax@24 | |
34 //int v18; // edx@25 | |
35 int v19; // edi@25 | 20 int v19; // edi@25 |
36 unsigned __int8 v20; // sf@25 | |
37 GUIButton *pButton; // esi@27 | 21 GUIButton *pButton; // esi@27 |
38 int pNewItem; // eax@27 | |
39 unsigned int v24; // ecx@27 | |
40 int v25; // edx@27 | |
41 unsigned int pColorText; // ax@27 | 22 unsigned int pColorText; // ax@27 |
42 signed int v27; // esi@32 | |
43 int v28; // ST08_4@36 | |
44 int v29; // eax@36 | |
45 signed int v32; // esi@41 | 23 signed int v32; // esi@41 |
46 unsigned int v33; // esi@43 | 24 const char *pText; // ecx@84 |
47 int v34; // eax@43 | |
48 unsigned int v35; // eax@44 | |
49 int v36; // eax@46 | |
50 __int32 v37; // ecx@51 | |
51 int v40; // eax@53 | |
52 char *v41; // eax@55 | |
53 unsigned int v43; // ecx@55 | |
54 const char **v44; // edx@55 | |
55 int v45; // eax@55 | |
56 int v47; // eax@59 | |
57 const char **v48; // eax@63 | |
58 unsigned int v49; // esi@65 | |
59 Texture *v50; // eax@65 | |
60 int v51; // edi@65 | |
61 int v52; // esi@70 | |
62 Texture *v53; // ST1C_4@70 | |
63 int v54; // edi@70 | |
64 signed int v55; // ecx@73 | |
65 SHORT v56; // di@82 | |
66 bool v57; // eax@82 | |
67 const char *v58; // ecx@84 | |
68 POINT *v59; // esi@89 | |
69 LONG v60; // ecx@90 | |
70 int v61; // eax@90 | |
71 int v62; // ecx@90 | |
72 ItemGen *pItemInShop; // esi@90 | |
73 //int v64; // eax@95 | |
74 int all_text_height; // esi@96 | 25 int all_text_height; // esi@96 |
75 char **v66; // edi@96 | 26 ItemGen *item; |
76 int v67; // eax@97 | 27 int pItemID; |
77 int v69; // edx@98 | 28 POINT mouse; // [sp+64h] [bp-94h]@8 |
78 int v70; // edi@98 | |
79 int v71; | |
80 const char **v72; // eax@100 | |
81 int pTextHeight; // eax@100 | |
82 unsigned int v74; // ecx@100 | |
83 int v78; // [sp-14h] [bp-10Ch]@14 | |
84 ItemGen *v79; // [sp-10h] [bp-108h]@12 | |
85 int v80; // [sp-10h] [bp-108h]@14 | |
86 void *v81; // [sp-Ch] [bp-104h]@12 | |
87 unsigned __int16 v82; // [sp-Ch] [bp-104h]@14 | |
88 int v83; // [sp-8h] [bp-100h]@11 | |
89 char *v84; // [sp-8h] [bp-100h]@14 | |
90 __int64 *v85; // [sp-4h] [bp-FCh]@11 | |
91 unsigned int v86; // [sp-4h] [bp-FCh]@14 | |
92 POINT v87; // [sp+Ch] [bp-ECh]@8 | |
93 POINT v88; // [sp+14h] [bp-E4h]@18 | |
94 POINT v89; // [sp+1Ch] [bp-DCh]@89 | |
95 POINT v90; // [sp+24h] [bp-D4h]@19 | |
96 POINT v91; // [sp+2Ch] [bp-CCh]@89 | |
97 POINT v92; // [sp+34h] [bp-C4h]@9 | |
98 POINT v93; // [sp+3Ch] [bp-BCh]@33 | |
99 POINT v94; // [sp+44h] [bp-B4h]@18 | |
100 POINT v95; // [sp+4Ch] [bp-ACh]@32 | |
101 POINT v96; // [sp+54h] [bp-A4h]@18 | |
102 POINT v97; // [sp+5Ch] [bp-9Ch]@32 | |
103 POINT a2; // [sp+64h] [bp-94h]@8 | |
104 POINT v99; // [sp+6Ch] [bp-8Ch]@32 | |
105 POINT v100; // [sp+74h] [bp-84h]@8 | |
106 GUIWindow dialog_window; // [sp+7Ch] [bp-7Ch]@1 | 29 GUIWindow dialog_window; // [sp+7Ch] [bp-7Ch]@1 |
107 char *Str; // [sp+D0h] [bp-28h]@55 | |
108 __int32 v103; // [sp+D4h] [bp-24h]@25 | 30 __int32 v103; // [sp+D4h] [bp-24h]@25 |
109 int pColorYellow; // [sp+D8h] [bp-20h]@1 | 31 int pPrice; // [sp+ECh] [bp-Ch]@26 |
110 int pColorWhite; // [sp+DCh] [bp-1Ch]@1 | 32 unsigned int v109; |
111 POINT v106; // [sp+E0h] [bp-18h]@8 | |
112 Player *pPlayer; // [sp+E8h] [bp-10h]@1 | |
113 int pItemNum; // [sp+ECh] [bp-Ch]@26 | |
114 const char **v109; // [sp+F0h] [bp-8h]@26 | |
115 unsigned __int8 v110; // [sp+F7h] [bp-1h]@16 | |
116 int pNumString; | 33 int pNumString; |
117 | 34 int item_X; |
118 pPlayer = pPlayers[uActiveCharacter]; | 35 |
119 memcpy(&dialog_window, window_SpeakInHouse, sizeof(dialog_window)); | 36 memcpy(&dialog_window, window_SpeakInHouse, sizeof(dialog_window)); |
120 dialog_window.uFrameX = 483; | 37 dialog_window.uFrameX = 483; |
121 dialog_window.uFrameWidth = 148; | 38 dialog_window.uFrameWidth = 148; |
122 dialog_window.uFrameZ = 334; | 39 dialog_window.uFrameZ = 334; |
123 pColorWhite = TargetColor(0xFFu, 0xFFu, 0xFFu); | |
124 pColorYellow = TargetColor(0xE1u, 0xCDu, 0x23u); | |
125 | 40 |
126 switch(dialog_menu_id) | 41 switch(dialog_menu_id) |
127 { | 42 { |
128 case HOUSE_DIALOGUE_MAIN: | 43 case HOUSE_DIALOGUE_MAIN: |
129 { | 44 { |
130 pNumActiveItem = HouseUI_CheckIfPlayerCanInteract(); | 45 if ( HouseUI_CheckIfPlayerCanInteract() ) |
131 if ( pNumActiveItem ) | |
132 { | 46 { |
133 pShopOptions[0] = pGlobalTXT_LocalizationStrings[134]; | 47 pShopOptions[0] = pGlobalTXT_LocalizationStrings[134]; |
134 pShopOptions[1] = pGlobalTXT_LocalizationStrings[152]; | 48 pShopOptions[1] = pGlobalTXT_LocalizationStrings[152]; |
135 pShopOptions[2] = pGlobalTXT_LocalizationStrings[159]; | 49 pShopOptions[2] = pGlobalTXT_LocalizationStrings[159]; |
136 pShopOptions[3] = pGlobalTXT_LocalizationStrings[160]; | 50 pShopOptions[3] = pGlobalTXT_LocalizationStrings[160]; |
137 all_text_height = 0; | 51 all_text_height = 0; |
138 for (int i = 0; i < 4; ++i)//while ( (signed int)v15 < (signed int)&unk_F8B1C8 ); | 52 for ( int i = 0; i < 4; ++i ) |
139 all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0); | 53 all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0); |
140 v103 = (174 - all_text_height) / 4; | 54 v103 = (174 - all_text_height) / 4; |
141 pNumActiveItem = pDialogueWindow->pStartingPosActiveItem; | |
142 v19 = (174 - 4 * (174 - all_text_height) / 4 - all_text_height) / 2 - (174 - all_text_height) / 4 / 2 + 138; | 55 v19 = (174 - 4 * (174 - all_text_height) / 4 - all_text_height) / 2 - (174 - all_text_height) / 4 / 2 + 138; |
143 v20 = -pDialogueWindow->pNumPresenceButton < 0; | 56 pNumString = 0; |
144 if ( v20 ^ (pNumActiveItem > pNumActiveItem + pDialogueWindow->pNumPresenceButton )) | 57 for ( int i = pDialogueWindow->pStartingPosActiveItem; i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) |
145 { | 58 { |
146 pItemNum = 2; | 59 pButton = pDialogueWindow->GetControl(i); |
147 pNumString = 0; | 60 pButton->uY = v103 + v19; |
148 do | 61 pButton->uHeight = pFontArrus->CalcTextHeight((const char *)pShopOptions[pNumString], &dialog_window, 0, 0); |
149 { | 62 v19 = pButton->uY + pFontArrus->CalcTextHeight((const char *)pShopOptions[pNumString], &dialog_window, 0, 0) - 1; |
150 pButton = pDialogueWindow->GetControl(pItemNum); | 63 pButton->uW = v19; |
151 pButton->uY = v103 + v19; | 64 pColorText = TargetColor(0xE1u, 0xCDu, 0x23u); |
152 pTextHeight = pFontArrus->CalcTextHeight((const char *)pShopOptions[pNumString], &dialog_window, 0, 0); | 65 if ( pDialogueWindow->pCurrentPosActiveItem != i ) |
153 pButton->uHeight = pTextHeight; | 66 pColorText = TargetColor(0xFFu, 0xFFu, 0xFFu); |
154 v19 = pButton->uY + pTextHeight - 1; | 67 dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, (const char *)pShopOptions[pNumString], 3); |
155 pButton->uW = v19; | 68 ++pNumString; |
156 pColorText = pColorYellow; | |
157 if ( pDialogueWindow->pCurrentPosActiveItem != pItemNum ) | |
158 pColorText = pColorWhite; | |
159 dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, (const char *)pShopOptions[pNumString], 3); | |
160 ++pItemNum; | |
161 ++pNumString; | |
162 pNumActiveItem = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; | |
163 } | |
164 while ( pItemNum < pNumActiveItem ); | |
165 } | 69 } |
166 } | 70 } |
167 break; | 71 break; |
168 } | 72 } |
169 | |
170 case HOUSE_DIALOGUE_SHOP_BUY_STANDARD: | 73 case HOUSE_DIALOGUE_SHOP_BUY_STANDARD: |
171 { | 74 { |
172 pRenderer->DrawTextureIndexed(8, 8, ShopTexture); | 75 pRenderer->DrawTextureIndexed(8, 8, ShopTexture); |
173 v48 = 0; | 76 item_X = 0; |
174 pItemNum = 0; | 77 for ( uint i = 0; i < 6; ++i ) |
175 v109 = 0; | 78 { |
176 do | 79 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].uItemID) |
177 { | 80 { |
178 // if ( pParty->field_777C[9 * (int)&v48[3 * (unsigned int)window_SpeakInHouse->ptr_1C]] ) | 81 pRenderer->DrawTextureTransparent((60 - ((signed int)ItemsInShopTexture[i]->uTextureWidth / 2)) + item_X, weapons_Ypos[i] + 30, ItemsInShopTexture[i]); |
179 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][(int)v48].uItemID) | 82 ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[(60 - ((signed int)ItemsInShopTexture[i]->uTextureWidth / 2)) + item_X + 640 * (weapons_Ypos[i] + 30)], ItemsInShopTexture[i], i + 1); |
180 { | 83 } |
181 v49 = word_F8B158[(signed int)v48]; | 84 item_X += 70; |
182 v50 = ItemsInShopTexture[(signed int)v48]; | 85 } |
183 v49 += 30; | 86 if ( HouseUI_CheckIfPlayerCanInteract() ) |
184 v51 = 60 - ((signed int)v50->uTextureWidth >> 1); | 87 { |
185 pRenderer->DrawTextureTransparent(v51 + pItemNum, v49, v50); | 88 uint item_num = 0; |
186 ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[v51 + pItemNum + 640 * v49], ItemsInShopTexture[(signed int)v109], (int)((char *)v109 + 1)); | 89 for ( uint i = 0; i < 6; ++i ) |
187 v48 = v109; | 90 { |
188 } | 91 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].uItemID) |
189 pItemNum += 70; | 92 ++item_num; |
190 v48 = (const char **)((char *)v48 + 1); | 93 } |
191 v109 = v48; | 94 if ( GetAsyncKeyState(17) && pPlayers[uActiveCharacter]->CanSteal() ) |
192 } | 95 pText = pGlobalTXT_LocalizationStrings[185];//Украсть предмет |
193 while ( (signed int)v48 < 6 ); | |
194 pNumActiveItem = HouseUI_CheckIfPlayerCanInteract(); | |
195 if ( pNumActiveItem ) | |
196 { | |
197 v55 = 0; | |
198 v106.x = 0; | |
199 v106.x = 0; | |
200 do | |
201 { | |
202 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v55].uItemID)//9 * (v55 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] ) | |
203 ++v106.x; | |
204 ++v55; | |
205 } | |
206 while ( v55 < 6 ); | |
207 v56 = GetAsyncKeyState(17); | |
208 v57 = pPlayer->CanSteal(); | |
209 Str = (char *)v57; | |
210 if ( v56 && v57 ) | |
211 { | |
212 v58 = pGlobalTXT_LocalizationStrings[185]; | |
213 } | |
214 else | 96 else |
215 { | 97 pText = pGlobalTXT_LocalizationStrings[195];//Выберите предмет для покупки |
216 v58 = pGlobalTXT_LocalizationStrings[195]; | 98 DrawTextAtStatusBar(pText, 0); |
217 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD) | 99 if ( item_num ) |
218 v58 = pGlobalTXT_LocalizationStrings[196]; | 100 { |
219 } | 101 pMouse->GetCursorPos(&mouse); |
220 DrawTextAtStatusBar(v58, 0); | 102 if ( pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF ) |
221 if ( v106.x ) | 103 { |
222 { | 104 item = &pParty->StandartItemsInShops[(int)window_SpeakInHouse->ptr_1C][(pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF) - 1]; |
223 v59 = pMouse->GetCursorPos(&v91); | 105 if ( !GetAsyncKeyState(17) || !pPlayers[uActiveCharacter]->CanSteal() ) |
224 pNumActiveItem = v59->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v89)->y]; | |
225 if ( pRenderer->pActiveZBuffer[pNumActiveItem] & 0xFFFF ) | |
226 { | |
227 v60 = (pRenderer->pActiveZBuffer[pNumActiveItem] & 0xFFFF) - 1; | |
228 v106.x = v60; | |
229 v61 = (int)window_SpeakInHouse->ptr_1C;//maybe ptr_1C - BuildID_2Events | |
230 // v62 = 9 * (v60 + 12 * v61); | |
231 pItemInShop = (ItemGen *)&pParty->StandartItemsInShops[(int)v61][v60]; | |
232 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD) | |
233 pItemInShop = &pParty->SpecialItemsInShops[(int)v61][v60]; | |
234 if ( !v56 || !Str ) | |
235 { | 106 { |
236 v7 = BuildDialogueString((char *)pMerchantsBuyPhrases[pPlayer->SelectPhrasesTransaction(pItemInShop, BuildingType_WeaponShop, v61, 2)], | 107 pText = BuildDialogueString((char *)pMerchantsBuyPhrases[pPlayers[uActiveCharacter]->SelectPhrasesTransaction(item, BuildingType_WeaponShop, (int)window_SpeakInHouse->ptr_1C, 2)], |
237 uActiveCharacter - 1, pItemInShop, (char *)window_SpeakInHouse->ptr_1C, 2, 0); | 108 uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 2, 0); |
238 pTextHeight = pFontArrus->CalcTextHeight(v7, &dialog_window, 0, 0); | 109 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, TargetColor(0xFFu, 0xFFu, 0xFFu), pText, 3); |
239 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, pColorWhite, v7, 3); | |
240 } | 110 } |
241 else | 111 else |
242 { | 112 { |
243 v7 = BuildDialogueString(pGlobalTXT_LocalizationStrings[181], uActiveCharacter - 1, pItemInShop, (char *)window_SpeakInHouse->ptr_1C, 2, 0); | 113 pText = BuildDialogueString(pGlobalTXT_LocalizationStrings[181], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 2, 0); |
244 pTextHeight = pFontArrus->CalcTextHeight(v7, &dialog_window, 0, 0); | 114 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, TargetColor(0xFFu, 0xFFu, 0xFFu), pText, 3); |
245 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, pColorWhite, v7, 3); | |
246 } | 115 } |
247 } | 116 } |
248 } | 117 } |
249 else | 118 else |
250 { | 119 dialog_window.DrawCurrentTime( pParty->field_3C.Shops_next_generation_time[(unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed);//Приходите через 7 дней |
251 dialog_window.DrawCurrentTime( pParty->PartyTimes.Shops_next_generation_time[(unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed);//Приходите через 7 дней | 120 } |
252 pNumActiveItem = 0; //added | 121 break; |
253 } | 122 } |
123 | |
124 case HOUSE_DIALOGUE_SHOP_BUY_SPECIAL: | |
125 { | |
126 pRenderer->DrawTextureIndexed(8, 8, ShopTexture); | |
127 item_X = 0; | |
128 for ( uint i = 0; i < 6; ++i ) | |
129 { | |
130 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].uItemID) | |
131 { | |
132 pRenderer->DrawTextureTransparent((60 - ((signed int)ItemsInShopTexture[i]->uTextureWidth / 2)) + item_X, weapons_Ypos[i] + 30, ItemsInShopTexture[i]); | |
133 ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[(60 - ((signed int)ItemsInShopTexture[i]->uTextureWidth / 2)) + item_X + 640 * (weapons_Ypos[i] + 30)], ItemsInShopTexture[i], i + 1); | |
134 } | |
135 item_X += 70; | |
136 } | |
137 if ( HouseUI_CheckIfPlayerCanInteract() ) | |
138 { | |
139 uint item_num = 0; | |
140 for ( uint i = 0; i < 6; ++i ) | |
141 { | |
142 if ( pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].uItemID ) | |
143 ++item_num; | |
144 } | |
145 if ( GetAsyncKeyState(17) && pPlayers[uActiveCharacter]->CanSteal() ) | |
146 pText = pGlobalTXT_LocalizationStrings[185]; | |
147 else | |
148 pText = pGlobalTXT_LocalizationStrings[196]; | |
149 DrawTextAtStatusBar(pText, 0); | |
150 if ( item_num ) | |
151 { | |
152 pMouse->GetCursorPos(&mouse); | |
153 if ( pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF ) | |
154 { | |
155 item = &pParty->SpecialItemsInShops[(int)window_SpeakInHouse->ptr_1C][(pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF) - 1]; | |
156 if ( !GetAsyncKeyState(17) || !pPlayers[uActiveCharacter]->CanSteal() ) | |
157 { | |
158 pText = BuildDialogueString((char *)pMerchantsBuyPhrases[pPlayers[uActiveCharacter]->SelectPhrasesTransaction(item, BuildingType_WeaponShop, (int)window_SpeakInHouse->ptr_1C, 2)], | |
159 uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 2, 0); | |
160 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, TargetColor(0xFFu, 0xFFu, 0xFFu), pText, 3); | |
161 } | |
162 else | |
163 { | |
164 pText = BuildDialogueString(pGlobalTXT_LocalizationStrings[181], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 2, 0); | |
165 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, TargetColor(0xFFu, 0xFFu, 0xFFu), pText, 3); | |
166 } | |
167 } | |
168 } | |
169 else | |
170 dialog_window.DrawCurrentTime( pParty->field_3C.Shops_next_generation_time[(unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed); | |
254 } | 171 } |
255 break; | 172 break; |
256 } | 173 } |
257 | 174 |
258 case HOUSE_DIALOGUE_SHOP_SELL: | 175 case HOUSE_DIALOGUE_SHOP_SELL: |
260 draw_leather(); | 177 draw_leather(); |
261 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); | 178 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); |
262 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[199], 0); | 179 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[199], 0); |
263 if ( !HouseUI_CheckIfPlayerCanInteract() ) | 180 if ( !HouseUI_CheckIfPlayerCanInteract() ) |
264 return; | 181 return; |
265 if((v11 = pMouse->GetCursorPos(&v96)->x - 14, v106.x = (v11 >> 5) + 14 * ((pMouse->GetCursorPos(&v88)->y - 17) >> 5), | 182 pMouse->GetCursorPos(&mouse); |
266 pMouse->GetCursorPos(&v94)->x <= 13) || pMouse->GetCursorPos(&v90)->x >= 462 | 183 v109 = ((mouse.x + 14) >> 5) + 14 * ((mouse.y - 17) >> 5); |
267 || (pNumActiveItem = pPlayer->GetItemIDAtInventoryIndex((int *)&v106.x), !pNumActiveItem) ) | 184 if( mouse.x <= 13 || mouse.x >= 462 ) |
268 return; | 185 return; |
269 v79 = (ItemGen *)&pPlayer->pInventoryItemList[pNumActiveItem - 1]; | 186 pItemID = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v109); |
270 v13 = pPlayer->SelectPhrasesTransaction(v79, BuildingType_WeaponShop, (int)window_SpeakInHouse->ptr_1C, 3); | 187 if ( !pItemID ) |
271 v7 = BuildDialogueString((char *)pMerchantsSellPhrases[v13], uActiveCharacter - 1, v79, (char *)window_SpeakInHouse->ptr_1C, 3, 0); | 188 return; |
272 pTextHeight = pFontArrus->CalcTextHeight(v7, &dialog_window, 0, 0); | 189 item = &pPlayers[uActiveCharacter]->pInventoryItemList[pItemID - 1]; |
273 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, pColorWhite, v7, 3); | 190 phrases_id = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(item, BuildingType_WeaponShop, (int)window_SpeakInHouse->ptr_1C, 3); |
191 pText = BuildDialogueString((char *)pMerchantsSellPhrases[phrases_id], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 3, 0); | |
192 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, TargetColor(0xFFu, 0xFFu, 0xFFu), pText, 3); | |
274 break; | 193 break; |
275 } | 194 } |
276 | |
277 case HOUSE_DIALOGUE_SHOP_IDENTIFY: | 195 case HOUSE_DIALOGUE_SHOP_IDENTIFY: |
278 { | 196 { |
279 draw_leather(); | 197 draw_leather(); |
280 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); | 198 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); |
281 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[197], 0); | 199 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[197], 0); |
282 if ( !HouseUI_CheckIfPlayerCanInteract() ) | 200 if ( !HouseUI_CheckIfPlayerCanInteract() ) |
283 return; | 201 return; |
284 if((v2 = pMouse->GetCursorPos(&a2)->x - 14, v106.x = (v2 >> 5) + 14 * ((pMouse->GetCursorPos(&v87)->y - 17) >> 5), | 202 pMouse->GetCursorPos(&mouse); |
285 pMouse->GetCursorPos(&v100)->x <= 13) || pMouse->GetCursorPos(&v92)->x >= 462 | 203 v109 = ((mouse.x - 14) >> 5) + 14 * ((mouse.y - 17) >> 5); |
286 || (pNumActiveItem = pPlayer->GetItemIDAtInventoryIndex((int *)&v106.x), !pNumActiveItem) ) | 204 if( mouse.x <= 13 || mouse.x >= 462 ) |
287 return; | 205 return; |
288 v4 = (ItemGen *)&pPlayer->pInventoryItemList[pNumActiveItem - 1]; | 206 pItemID = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v109); |
289 if (!v4->IsIdentified()) | 207 if ( !pItemID ) |
290 { | 208 return; |
291 v10 = pPlayer->SelectPhrasesTransaction(v4, BuildingType_WeaponShop, (int)window_SpeakInHouse->ptr_1C, 4); | 209 item = &pPlayers[uActiveCharacter]->pInventoryItemList[pItemID - 1]; |
292 v7 = BuildDialogueString((char *)pMerchantsIdentifyPhrases[v10], uActiveCharacter - 1, v4, (char *)window_SpeakInHouse->ptr_1C, 4, 0); | 210 if (!item->IsIdentified()) |
293 pTextHeight = pFontArrus->CalcTextHeight(v7, &dialog_window, 0, 0); | 211 { |
294 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, pColorWhite, v7, 3); | 212 phrases_id = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(item, BuildingType_WeaponShop, (int)window_SpeakInHouse->ptr_1C, 4); |
213 pText = BuildDialogueString((char *)pMerchantsIdentifyPhrases[phrases_id], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 4, 0); | |
214 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, TargetColor(0xFFu, 0xFFu, 0xFFu), pText, 3); | |
295 } | 215 } |
296 else | 216 else |
297 { | 217 { |
298 v7 = BuildDialogueString("%24", uActiveCharacter - 1, v4, (char *)window_SpeakInHouse->ptr_1C, 4, 0); | 218 pText = BuildDialogueString("%24", uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 4, 0); |
299 pTextHeight = pFontArrus->CalcTextHeight(v7, &dialog_window, 0, 0); | 219 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, TargetColor(0xFFu, 0xFFu, 0xFFu), pText, 3); |
300 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, pColorWhite, v7, 3); | |
301 } | 220 } |
302 break; | 221 break; |
303 } | 222 } |
304 | 223 |
305 case HOUSE_DIALOGUE_SHOP_REPAIR: | 224 case HOUSE_DIALOGUE_SHOP_REPAIR: |
306 { | 225 { |
307 draw_leather(); | 226 draw_leather(); |
308 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); | 227 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); |
309 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[198], 0); | 228 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[198], 0); |
310 if ( !HouseUI_CheckIfPlayerCanInteract()) | 229 if ( !HouseUI_CheckIfPlayerCanInteract()) |
311 return; | 230 return; |
312 if( (v2 = pMouse->GetCursorPos(&a2)->x - 14, v106.x = (v2 >> 5) + 14 * ((pMouse->GetCursorPos(&v87)->y - 17) >> 5), | 231 pMouse->GetCursorPos(&mouse); |
313 pMouse->GetCursorPos(&v100)->x <= 13) || pMouse->GetCursorPos(&v92)->x >= 462 | 232 v109 = ((mouse.x - 14) >> 5) + 14 * (mouse.y - 17) >> 5; |
314 || (pNumActiveItem = pPlayer->GetItemIDAtInventoryIndex((int *)&v106.x), !pNumActiveItem) | 233 if( ( mouse.x <= 13) || mouse.x >= 462 ) |
315 || (!(pPlayer->pOwnItems[pNumActiveItem-1].uAttributes& 2)) ) | 234 return; |
316 return; | 235 pItemID = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v109); |
317 v4 = (ItemGen *)&pPlayer->pInventoryItemList[pNumActiveItem - 1]; | 236 if ( !pItemID || (!(pPlayers[uActiveCharacter]->pOwnItems[pItemID - 1].uAttributes & 2)) ) |
318 v10 = pPlayer->SelectPhrasesTransaction(v4, BuildingType_ArmorShop, (int)window_SpeakInHouse->ptr_1C, 5); | 237 return; |
319 v7 = BuildDialogueString((char *)pMerchantsRepairPhrases[v10], uActiveCharacter - 1, v4, (char *)window_SpeakInHouse->ptr_1C, 5, 0); | 238 item = &pPlayers[uActiveCharacter]->pInventoryItemList[pItemID - 1]; |
320 pTextHeight = (174 - pFontArrus->CalcTextHeight(v7, &dialog_window, 0, 0)) / 2 + 138; | 239 phrases_id = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(item, BuildingType_ArmorShop, (int)window_SpeakInHouse->ptr_1C, 5); |
321 dialog_window.DrawTitleText(pFontArrus, 0, pTextHeight, pColorWhite, v7, 3); | 240 pText = BuildDialogueString((char *)pMerchantsRepairPhrases[phrases_id], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 5, 0); |
241 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, TargetColor(0xFFu, 0xFFu, 0xFFu), pText, 3); | |
322 return; | 242 return; |
323 } | 243 } |
324 break; | 244 break; |
325 | 245 |
326 case HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT: | 246 case HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT: |
332 pShopOptions[2] = pGlobalTXT_LocalizationStrings[179];//repair | 252 pShopOptions[2] = pGlobalTXT_LocalizationStrings[179];//repair |
333 all_text_height = 0; | 253 all_text_height = 0; |
334 for ( int i = 0; i < 3; ++i ) | 254 for ( int i = 0; i < 3; ++i ) |
335 all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0); | 255 all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0); |
336 v103 = (174 - all_text_height) / 3; | 256 v103 = (174 - all_text_height) / 3; |
337 pNumActiveItem = pDialogueWindow->pStartingPosActiveItem; | 257 v19 = (3 * (58 - (signed int)v103) - all_text_height) / 2 - ((174 - all_text_height) / 3) / 2 + 138; |
338 v70 = (3 * (58 - (signed int)v103) - all_text_height) / 2 - ((174 - all_text_height) / 3) / 2 + 138; | 258 pNumString = 0; |
339 v20 = -pDialogueWindow->pNumPresenceButton < 0; | 259 for ( int i = pDialogueWindow->pStartingPosActiveItem; i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) |
340 if ( v20 ^ (pNumActiveItem > pNumActiveItem + pDialogueWindow->pNumPresenceButton )) | 260 { |
341 { | 261 pButton = pDialogueWindow->GetControl(i); |
342 pItemNum = 2; | 262 pButton->uY = v103 + v19; |
343 pNumString = 0; | 263 pButton->uHeight = pFontArrus->CalcTextHeight((const char *)pShopOptions[pNumString], &dialog_window, 0, 0); |
344 do | 264 v19 = pButton->uY + pFontArrus->CalcTextHeight((const char *)pShopOptions[pNumString], &dialog_window, 0, 0) - 1; |
345 { | 265 pButton->uW = v19; |
346 pButton = pDialogueWindow->GetControl(pItemNum); | 266 pColorText = TargetColor(0xE1u, 0xCDu, 0x23u); |
347 pButton->uY = v103 + v70; | 267 if ( pDialogueWindow->pCurrentPosActiveItem != i ) |
348 pTextHeight = pFontArrus->CalcTextHeight((const char *)pShopOptions[pNumString], &dialog_window, 0, 0); | 268 pColorText = TargetColor(0xFFu, 0xFFu, 0xFFu); |
349 pButton->uHeight = pTextHeight; | 269 dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, (const char *)pShopOptions[pNumString], 3); |
350 v70 = pButton->uY + pTextHeight - 1; | 270 ++pNumString; |
351 pButton->uW = v70; | 271 } |
352 pColorText = pColorYellow; | |
353 if ( pDialogueWindow->pCurrentPosActiveItem != pItemNum ) | |
354 pColorText = pColorWhite; | |
355 dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, (const char *)pShopOptions[pNumString], 3); | |
356 ++pItemNum; | |
357 ++pNumString; | |
358 pNumActiveItem = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; | |
359 } | |
360 while ( pItemNum < pNumActiveItem ); | |
361 } | |
362 break; | 272 break; |
363 } | 273 } |
364 | 274 |
365 case HOUSE_DIALOGUE_SHOP_BUY_SPECIAL: | |
366 { | |
367 pRenderer->DrawTextureIndexed(8, 8, ShopTexture); | |
368 v109 = 0; | |
369 pItemNum = 0; | |
370 do | |
371 { | |
372 // if ( pParty->field_C59C[9 * (int)&v109[3 * (unsigned int)window_SpeakInHouse->ptr_1C] + 724] ) | |
373 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][(signed int)v109].uItemID) | |
374 { | |
375 v52 = word_F8B158[(signed int)v109] + 30; | |
376 v53 = ItemsInShopTexture[(signed int)v109]; | |
377 v54 = 60 - ((signed int)v53->uTextureWidth >> 1); | |
378 pRenderer->DrawTextureTransparent(v54 + pItemNum, word_F8B158[(signed int)v109] + 30, v53); | |
379 ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[v54 + pItemNum + 640 * v52], ItemsInShopTexture[(signed int)v109], (int)((char *)v109 + 1)); | |
380 } | |
381 v109 = (const char **)((char *)v109 + 1); | |
382 pItemNum += 70; | |
383 } | |
384 while ( (signed int)v109 < 6 ); | |
385 pNumActiveItem = HouseUI_CheckIfPlayerCanInteract(); | |
386 if ( pNumActiveItem ) | |
387 { | |
388 v55 = 0; | |
389 v106.x = 0; | |
390 do | |
391 { | |
392 // if ( pParty->field_C59C[9 * (v55 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] ) | |
393 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v55].uItemID) | |
394 ++v106.x; | |
395 ++v55; | |
396 } | |
397 while ( v55 < 6 ); | |
398 v56 = GetAsyncKeyState(17); | |
399 v57 = pPlayer->CanSteal(); | |
400 Str = (char *)v57; | |
401 if ( v56 && v57 ) | |
402 { | |
403 v58 = pGlobalTXT_LocalizationStrings[185]; | |
404 } | |
405 else | |
406 { | |
407 v58 = pGlobalTXT_LocalizationStrings[195]; | |
408 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD) | |
409 v58 = pGlobalTXT_LocalizationStrings[196]; | |
410 } | |
411 DrawTextAtStatusBar(v58, 0); | |
412 if ( v106.x ) | |
413 { | |
414 v59 = pMouse->GetCursorPos(&v91); | |
415 pNumActiveItem = v59->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v89)->y]; | |
416 if ( pRenderer->pActiveZBuffer[pNumActiveItem] & 0xFFFF ) | |
417 { | |
418 v60 = (pRenderer->pActiveZBuffer[pNumActiveItem] & 0xFFFF) - 1; | |
419 v106.x = v60; | |
420 v61 = (int)window_SpeakInHouse->ptr_1C; | |
421 // v62 = 9 * (v60 + 12 * v61); | |
422 pItemInShop = (ItemGen *)&pParty->StandartItemsInShops[(int)v61][v60]; | |
423 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD) | |
424 pItemInShop = &pParty->SpecialItemsInShops[(int)v61][v60];//v63 = (ItemGen *)&pParty->field_C59C[v62 + 724]; | |
425 if ( !v56 || !Str ) | |
426 { | |
427 v7 = BuildDialogueString((char *)pMerchantsBuyPhrases[pPlayer->SelectPhrasesTransaction(pItemInShop, BuildingType_WeaponShop, v61, 2)], | |
428 uActiveCharacter - 1, pItemInShop, (char *)window_SpeakInHouse->ptr_1C, 2, 0); | |
429 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(v7, &dialog_window, 0, 0)) / 2 + 138, pColorWhite, v7, 3); | |
430 } | |
431 else | |
432 { | |
433 v7 = BuildDialogueString(pGlobalTXT_LocalizationStrings[181], uActiveCharacter - 1, pItemInShop, (char *)window_SpeakInHouse->ptr_1C, 2, 0); | |
434 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(v7, &dialog_window, 0, 0)) / 2 + 138, pColorWhite, v7, 3); | |
435 } | |
436 } | |
437 } | |
438 else | |
439 { | |
440 dialog_window.DrawCurrentTime( pParty->PartyTimes.Shops_next_generation_time[(unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed); | |
441 pNumActiveItem = 0; //added | |
442 } | |
443 } | |
444 break; | |
445 } | |
446 | |
447 case HOUSE_DIALOGUE_LEARN_SKILLS: | 275 case HOUSE_DIALOGUE_LEARN_SKILLS: |
448 { | 276 { |
449 if (!HouseUI_CheckIfPlayerCanInteract()) | 277 if (!HouseUI_CheckIfPlayerCanInteract()) |
450 return; | 278 return; |
451 v0 = 0; | 279 uint item_num = 0; |
452 all_text_height = 0; | 280 all_text_height = 0; |
453 //v32 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (signed int)v31] * 500.0); | |
454 v32 = (signed __int64)(p2DEvents[(signed int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0); | 281 v32 = (signed __int64)(p2DEvents[(signed int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0); |
455 pItemNum = v32 * (100 - pPlayer->GetMerchant()) / 100; | 282 pPrice = v32 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; |
456 if ( pItemNum < v32 / 3 ) | 283 if ( pPrice < v32 / 3 ) |
457 pItemNum = v32 / 3; | 284 pPrice = v32 / 3; |
458 pNumActiveItem = pDialogueWindow->pStartingPosActiveItem; | 285 for ( int i = pDialogueWindow->pStartingPosActiveItem; |
459 if ( pNumActiveItem >= pNumActiveItem + pDialogueWindow->pNumPresenceButton ) | 286 i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) |
460 { | 287 { |
461 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayer->pName, pClassNames[pPlayer->classType]); | 288 if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][pDialogueWindow->GetControl(i)->msg_param - 36] |
462 strcat(pTmpBuf.data(), "\n \n"); | 289 && !pPlayers[uActiveCharacter]->pActiveSkills[pDialogueWindow->GetControl(i)->msg_param - 36] ) |
463 strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]); | 290 { |
464 pTextHeight = pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 0, 0); | 291 all_text_height += pFontArrus->CalcTextHeight(pSkillNames[pDialogueWindow->GetControl(i)->msg_param - 36], &dialog_window, 0, 0); |
465 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, pColorYellow, pTmpBuf.data(), 3); | 292 item_num++; |
466 return; | 293 } |
467 } | 294 } |
468 do | 295 if ( item_num ) |
469 { | 296 { |
470 v35 = pDialogueWindow->GetControl(pNumActiveItem)->msg_param - 36; | 297 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[401], pPrice);//Стоимость навыка: %lu |
471 if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayer->classType][v35] && !pPlayer->pActiveSkills[v35] ) | 298 dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3); |
472 { | 299 v103 = (149 - all_text_height) / item_num; |
473 all_text_height += pFontArrus->CalcTextHeight(pSkillNames[v35], &dialog_window, 0, 0); | 300 if ( (149 - all_text_height) / item_num > 32 ) |
474 v0++; | 301 v103 = 32; |
475 } | 302 v19 = (149 - item_num * v103 - all_text_height) / 2 - v103 / 2 + 162; |
476 ++pNumActiveItem; | 303 for ( uint i = pDialogueWindow->pStartingPosActiveItem; |
477 } | 304 i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) |
478 while ( pNumActiveItem < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem ); | 305 { |
479 if ( !v0 ) | 306 pButton = pDialogueWindow->GetControl(i); |
480 { | 307 if ( !byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][pButton->msg_param - 36] || pPlayers[uActiveCharacter]->pActiveSkills[pButton->msg_param - 36] ) |
481 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayer->pName, pClassNames[pPlayer->classType]); | |
482 strcat(pTmpBuf.data(), "\n \n"); | |
483 strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]); | |
484 pTextHeight = pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 0, 0); | |
485 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, pColorYellow, pTmpBuf.data(), 3); | |
486 return; | |
487 } | |
488 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[401], pItemNum); | |
489 dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3); | |
490 v103 = (149 - all_text_height) / v0; | |
491 if ( (149 - all_text_height) / v0 > 32 ) | |
492 v103 = 32; | |
493 pNumActiveItem = pDialogueWindow->pStartingPosActiveItem; | |
494 v37 = (149 - v0 * v103 - all_text_height) / 2 - v103 / 2 + 162; | |
495 if ( pNumActiveItem < pNumActiveItem + pDialogueWindow->pNumPresenceButton ) | |
496 { | |
497 pItemNum = 2; | |
498 do | |
499 { | |
500 pButton = pDialogueWindow->GetControl(pItemNum); | |
501 v40 = pButton->msg_param - 36; | |
502 if ( !byte_4ED970_skill_learn_ability_by_class_table[pPlayer->classType][v40] || pPlayer->pActiveSkills[v40] ) | |
503 { | 308 { |
504 pButton->uW = 0; | 309 pButton->uW = 0; |
505 pButton->uHeight = 0; | 310 pButton->uHeight = 0; |
506 pButton->uY = 0; | 311 pButton->uY = 0; |
507 } | 312 } |
508 else | 313 else |
509 { | 314 { |
510 pButton->uY = v103 + v37; | 315 pButton->uY = v103 + v19; |
511 pTextHeight = pFontArrus->CalcTextHeight(pSkillNames[v40], &dialog_window, 0, 0); | 316 pButton->uHeight = pFontArrus->CalcTextHeight(pSkillNames[pButton->msg_param - 36], &dialog_window, 0, 0); |
512 pButton->uHeight = pTextHeight; | 317 v19 = pButton->uY + pFontArrus->CalcTextHeight(pSkillNames[pButton->msg_param - 36], &dialog_window, 0, 0) - 1; |
513 v37 = pButton->uY + pTextHeight - 1; | 318 pButton->uW = v19; |
514 pButton->uW = v37; | 319 pColorText = TargetColor(0xE1u, 0xCDu, 0x23u); |
515 pColorText = pColorYellow; | 320 if ( pDialogueWindow->pCurrentPosActiveItem != i ) |
516 if ( pDialogueWindow->pCurrentPosActiveItem != pItemNum ) | 321 pColorText = TargetColor(0xFFu, 0xFFu, 0xFFu); |
517 pColorText = pColorWhite; | 322 dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, pSkillNames[pButton->msg_param - 36], 3); |
518 dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, pSkillNames[v40], 3); | 323 } |
519 } | 324 } |
520 pNumActiveItem = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; | 325 break; |
521 pItemNum++; | 326 } |
522 } | 327 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]); |
523 while ( pItemNum < pNumActiveItem ); | 328 strcat(pTmpBuf.data(), "\n \n"); |
524 } | 329 strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]);//Больше ничего не могу предложить. |
525 break; | 330 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 0, 0)) / 2 + 138, TargetColor(0xE1u, 0xCDu, 0x23u), pTmpBuf.data(), 3); |
331 return; | |
526 } | 332 } |
527 default: | 333 default: |
528 { | 334 { |
529 if( dialog_menu_id > HOUSE_DIALOGUE_SHOP_REPAIR) | 335 __debugbreak(); |
530 pNumActiveItem = dialog_menu_id - 96; | |
531 else | |
532 pNumActiveItem = dialog_menu_id - 4; | |
533 break; | 336 break; |
534 } | 337 } |
535 } | 338 } |
536 } | 339 } |
537 | 340 |
538 //----- (004BA928) -------------------------------------------------------- | 341 //----- (004BA928) -------------------------------------------------------- |
539 void ArmorShopDialog() | 342 void ArmorShopDialog() |
540 { | 343 { |
541 signed int v1; // esi@8 | 344 int phrases_id; // eax@20 |
542 unsigned int v2; // eax@10 | |
543 ItemGen *v3; // eax@11 | |
544 char *v5; // ecx@12 | |
545 char *v6; // eax@13 | |
546 int v8; // eax@15 | |
547 signed int v9; // esi@17 | |
548 unsigned int v10; // eax@19 | |
549 char *v11; // edi@19 | |
550 int v12; // ST08_4@20 | |
551 int v13; // eax@20 | |
552 char *v15; // ecx@20 | |
553 char **v16; // edi@22 | |
554 int all_text_height; // ebx@22 | 345 int all_text_height; // ebx@22 |
555 char **v18; // esi@22 | 346 int v146; // [sp+E4h] [bp-20h]@24 |
556 int v19; // eax@23 | |
557 GUIWindow *v20; // ecx@24 | |
558 int v21; // eax@24 | |
559 int v22; // edx@24 | |
560 int v23; // ebx@24 | 347 int v23; // ebx@24 |
561 unsigned __int8 v24; // sf@24 | |
562 GUIButton *pButton; // eax@26 | 348 GUIButton *pButton; // eax@26 |
563 unsigned int v28; // ecx@26 | |
564 int v29; // edx@26 | |
565 signed int v31; // esi@31 | |
566 unsigned int v32; // eax@33 | |
567 //int v33; // eax@34 | |
568 int v35; // eax@35 | |
569 char *v36; // edx@36 | |
570 signed int v38; // esi@42 | 349 signed int v38; // esi@42 |
571 unsigned int v39; // esi@44 | |
572 int v40; // eax@44 | |
573 unsigned int v41; // eax@45 | |
574 int v42; // eax@47 | |
575 int v43; // ecx@52 | |
576 int v46; // eax@54 | |
577 unsigned int v49; // ecx@56 | |
578 int v51; // eax@56 | |
579 int v53; // eax@60 | |
580 int textureH; // eax@60 | |
581 signed int textureW; // ebx@65 | |
582 Texture *v56; // eax@67 | |
583 unsigned int pY_item; // edi@68 | |
584 Texture *v58; // ST1C_4@68 | |
585 int v59; // eax@68 | 350 int v59; // eax@68 |
586 int v60; // edi@69 | 351 const char *pText; // ecx@91 |
587 signed int v61; // ebx@73 | |
588 Texture *v62; // eax@75 | |
589 int v63; // edi@76 | |
590 Texture *v64; // ST1C_4@76 | |
591 unsigned int v65; // ST18_4@76 | |
592 int v66; // eax@76 | |
593 int v67; // edi@77 | |
594 signed int v68; // ecx@81 | |
595 const char *pStatusText; // ecx@91 | |
596 void *v72; // eax@95 | |
597 POINT *v73; // esi@97 | |
598 int v74; // ecx@97 | |
599 int v75; // eax@98 | |
600 int v76; // ecx@98 | |
601 ItemGen *selected_item; // ecx@99 | 352 ItemGen *selected_item; // ecx@99 |
602 unsigned __int8 v78; // bl@104 | |
603 int v80; // ebx@105 | |
604 char **v81; // esi@105 | |
605 int v82; // eax@106 | |
606 int v86; // ebx@107 | |
607 int pTextHeight; // eax@109 | |
608 unsigned int v90; // ecx@109 | |
609 int pNumString; // edx@109 | 353 int pNumString; // edx@109 |
610 unsigned __int16 pTextColor; // ax@109 | 354 unsigned __int16 pTextColor; // ax@109 |
611 signed int v93; // edx@114 | 355 POINT mouse; // [sp+4Ch] [bp-B8h]@97 |
612 POINT *v94; // edi@120 | |
613 __int32 v95; // ecx@120 | |
614 void *v96; // ST14_4@122 | |
615 unsigned __int8 v97; // bl@122 | |
616 //ItemGen *v98; // ST10_4@122 | |
617 int v99; // eax@122 | |
618 char *v100; // eax@122 | |
619 const char *v101; // ST18_4@122 | |
620 unsigned __int16 v102; // ST14_2@122 | |
621 int v103; // eax@122 | |
622 signed int v104; // edi@123 | |
623 Texture *v105; // eax@125 | |
624 int v106; // ebx@126 | |
625 unsigned int v108; // ST18_4@126 | |
626 int v109; // eax@126 | |
627 int v110; // ebx@127 | |
628 GUIWindow *v111; // [sp-18h] [bp-11Ch]@36 | |
629 unsigned int v112; // [sp-14h] [bp-118h]@13 | |
630 int v113; // [sp-14h] [bp-118h]@36 | |
631 unsigned int v115; // [sp-10h] [bp-114h]@13 | |
632 ItemGen *v116; // [sp-10h] [bp-114h]@20 | |
633 int v117; // [sp-10h] [bp-114h]@36 | |
634 unsigned __int16 v119; // [sp-Ch] [bp-110h]@13 | |
635 char *v121; // [sp-8h] [bp-10Ch]@13 | |
636 int v122; // [sp-8h] [bp-10Ch]@20 | |
637 unsigned int v123; // [sp-4h] [bp-108h]@13 | |
638 __int64 *v124; // [sp-4h] [bp-108h]@20 | |
639 int v125; // [sp-4h] [bp-108h]@68 | |
640 int v126; // [sp-4h] [bp-108h]@76 | |
641 int v127; // [sp-4h] [bp-108h]@126 | |
642 POINT v128; // [sp+Ch] [bp-F8h]@8 | |
643 POINT v129; // [sp+14h] [bp-F0h]@18 | |
644 char v130; // [sp+1Ch] [bp-E8h]@120 | |
645 POINT a2; // [sp+24h] [bp-E0h]@8 | |
646 POINT v132; // [sp+2Ch] [bp-D8h]@120 | |
647 POINT v133; // [sp+34h] [bp-D0h]@17 | |
648 POINT v134; // [sp+3Ch] [bp-C8h]@97 | |
649 POINT v135; // [sp+44h] [bp-C0h]@31 | |
650 POINT v136; // [sp+4Ch] [bp-B8h]@97 | |
651 POINT v137; // [sp+54h] [bp-B0h]@17 | |
652 POINT v138; // [sp+5Ch] [bp-A8h]@32 | |
653 POINT v139; // [sp+64h] [bp-A0h]@17 | |
654 POINT v140; // [sp+6Ch] [bp-98h]@31 | |
655 POINT v141; // [sp+74h] [bp-90h]@8 | |
656 POINT v142; // [sp+7Ch] [bp-88h]@31 | |
657 POINT v143; // [sp+84h] [bp-80h]@9 | |
658 GUIWindow dialog_window; // [sp+8Ch] [bp-78h]@1 | 356 GUIWindow dialog_window; // [sp+8Ch] [bp-78h]@1 |
659 int v146; // [sp+E4h] [bp-20h]@24 | |
660 int pYellowColor; // [sp+E8h] [bp-1Ch]@1 | |
661 int pWhiteColor; // [sp+ECh] [bp-18h]@1 | |
662 __int32 pItemCount; // [sp+F0h] [bp-14h]@8 | 357 __int32 pItemCount; // [sp+F0h] [bp-14h]@8 |
663 int v152; // [sp+FCh] [bp-8h]@24 | 358 int item_x; // [sp+100h] [bp-4h]@44 |
664 int v153; // [sp+100h] [bp-4h]@44 | 359 int pPrice; |
665 int th; | 360 unsigned int v153; |
666 short text_color; | 361 |
667 int pActiveButton; | |
668 | |
669 //__debugbreak(); // uishops.cpp(952): warning C4700: uninitialized local variable 'v33' used | |
670 //__debugbreak(); // uishops.cpp(981): warning C4700: uninitialized local variable 'v98' used | |
671 memcpy(&dialog_window, window_SpeakInHouse, sizeof(dialog_window)); | 362 memcpy(&dialog_window, window_SpeakInHouse, sizeof(dialog_window)); |
672 dialog_window.uFrameX = 483; | 363 dialog_window.uFrameX = 483; |
673 dialog_window.uFrameWidth = 148; | 364 dialog_window.uFrameWidth = 148; |
674 dialog_window.uFrameZ = 334; | 365 dialog_window.uFrameZ = 334; |
675 pWhiteColor = TargetColor(0xFFu, 0xFFu, 0xFFu); | |
676 pYellowColor = TargetColor(0xE1u, 0xCDu, 0x23u); | |
677 switch (dialog_menu_id) | 366 switch (dialog_menu_id) |
678 { | 367 { |
679 case HOUSE_DIALOGUE_MAIN: | 368 case HOUSE_DIALOGUE_MAIN: |
680 { | 369 { |
681 if ( !HouseUI_CheckIfPlayerCanInteract() ) | 370 if ( !HouseUI_CheckIfPlayerCanInteract() ) |
688 for( int i = 0; i < 4; ++i ) | 377 for( int i = 0; i < 4; ++i ) |
689 all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0); | 378 all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0); |
690 v146 = ( 174 - all_text_height ) / 4; | 379 v146 = ( 174 - all_text_height ) / 4; |
691 v23 = ( 174 - 4 * ( 174 - all_text_height ) / 4 - all_text_height ) / 2 - ( 174 - all_text_height ) / 4 / 2 + 138; | 380 v23 = ( 174 - 4 * ( 174 - all_text_height ) / 4 - all_text_height ) / 2 - ( 174 - all_text_height ) / 4 / 2 + 138; |
692 pNumString = 0; | 381 pNumString = 0; |
693 if ( pDialogueWindow->pNumPresenceButton>=0 ) | 382 for (int i = pDialogueWindow->pStartingPosActiveItem; |
694 { | 383 i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i) |
695 for (pActiveButton = pDialogueWindow->pStartingPosActiveItem; pActiveButton < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++pActiveButton) | 384 { |
696 { | 385 pButton = pDialogueWindow->GetControl(i); |
697 pButton = pDialogueWindow->GetControl(pActiveButton); | 386 pButton->uY = v146 + v23; |
698 pButton->uY = v146 + v23; | 387 pButton->uHeight = pFontArrus->CalcTextHeight(pShopOptions[pNumString], &dialog_window, 0, 0); |
699 pTextHeight = pFontArrus->CalcTextHeight(pShopOptions[pNumString], &dialog_window, 0, 0); | 388 v23 = pButton->uY + pFontArrus->CalcTextHeight(pShopOptions[pNumString], &dialog_window, 0, 0) - 1; |
700 pButton->uHeight = pTextHeight; | 389 pButton->uW = v23; |
701 v23 = pButton->uY + pButton->uHeight - 1; | 390 pTextColor = TargetColor(0xE1u, 0xCDu, 0x23u); |
702 pButton->uW = v23; | 391 if ( pDialogueWindow->pCurrentPosActiveItem != i ) |
703 pTextColor = pYellowColor; | 392 pTextColor = TargetColor(0xFFu, 0xFFu, 0xFFu); |
704 if ( pDialogueWindow->pCurrentPosActiveItem != pActiveButton ) | 393 dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pTextColor, pShopOptions[pNumString], 3); |
705 pTextColor = pWhiteColor; | 394 ++pNumString; |
706 dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pTextColor, pShopOptions[pNumString], 3); | |
707 ++pNumString; | |
708 } | |
709 } | 395 } |
710 } | 396 } |
711 break; | 397 break; |
398 | |
712 case HOUSE_DIALOGUE_SHOP_BUY_STANDARD: | 399 case HOUSE_DIALOGUE_SHOP_BUY_STANDARD: |
713 { | 400 { |
714 pRenderer->DrawTextureIndexed(8, 8, ShopTexture);// подложка | 401 pRenderer->DrawTextureIndexed(8, 8, ShopTexture);// подложка |
715 textureW = 0; | 402 item_x = 0; |
716 v153 = 0; | |
717 for ( int i = 0; i < 8; ++i )// разместить вещи | 403 for ( int i = 0; i < 8; ++i )// разместить вещи |
718 { | 404 { |
719 if ( pParty->StandartItemsInShops[window_SpeakInHouse->par1C][i].uItemID) | 405 if ( pParty->StandartItemsInShops[window_SpeakInHouse->par1C][i].uItemID) |
720 { | 406 { |
721 textureW = ItemsInShopTexture[i]->uTextureWidth; | |
722 textureH = ItemsInShopTexture[i]->uTextureHeight; | |
723 if ( i >= 4 ) //low row | 407 if ( i >= 4 ) //low row |
724 { | 408 { |
725 v60 = 90 - (textureW/2); | 409 pRenderer->DrawTextureTransparent((90 - (ItemsInShopTexture[i]->uTextureWidth / 2)) + item_x - 420, 126, ItemsInShopTexture[i]); |
726 pRenderer->DrawTextureTransparent(v60 + v153 - 420, 126, ItemsInShopTexture[i]); | 410 v59 = (90 - (ItemsInShopTexture[i]->uTextureWidth / 2)) + item_x + 80220; |
727 v59 = v60 + v153 + 80220; | |
728 } | 411 } |
729 else | 412 else |
730 { | 413 { |
731 pY_item = 98 - textureH; | 414 pRenderer->DrawTextureTransparent(( 86 - (ItemsInShopTexture[i]->uTextureWidth / 2)) + item_x, 98 - ItemsInShopTexture[i]->uTextureHeight, ItemsInShopTexture[i]); |
732 v152 = 86 - (textureW/2); | 415 v59 = item_x + (86 - (ItemsInShopTexture[i]->uTextureWidth / 2)) + 640 * (98 - ItemsInShopTexture[i]->uTextureHeight); |
733 pRenderer->DrawTextureTransparent(v152 + v153, pY_item, ItemsInShopTexture[i]); | |
734 v59 = v153 + v152 + 640 * pY_item; | |
735 } | 416 } |
736 ZBuffer_DoFill(&pRenderer->pActiveZBuffer[v59], ItemsInShopTexture[i], i + 1); | 417 ZBuffer_DoFill(&pRenderer->pActiveZBuffer[v59], ItemsInShopTexture[i], i + 1); |
737 } | 418 } |
738 v153 += 105; | 419 item_x += 105; |
739 } | 420 } |
740 if ( !HouseUI_CheckIfPlayerCanInteract() ) | 421 if ( !HouseUI_CheckIfPlayerCanInteract() ) |
741 return; | 422 return; |
742 pItemCount = 0; | 423 pItemCount = 0; |
743 for ( int i = 0; i < 8; ++i ) | 424 for ( int i = 0; i < 8; ++i ) |
744 { | 425 { |
745 if ( pParty->StandartItemsInShops[window_SpeakInHouse->par1C][i].uItemID ) | 426 if ( pParty->StandartItemsInShops[window_SpeakInHouse->par1C][i].uItemID ) |
746 ++pItemCount; | 427 ++pItemCount; |
747 } | 428 } |
748 if ( GetAsyncKeyState(17) == 0 || pPlayers[uActiveCharacter]->CanSteal() == 0 ) | 429 if ( GetAsyncKeyState(17) == 0 || pPlayers[uActiveCharacter]->CanSteal() == 0 ) |
749 pStatusText = pGlobalTXT_LocalizationStrings[195]; //"Select the Item to Buy" | 430 pText = pGlobalTXT_LocalizationStrings[195]; //"Select the Item to Buy" |
750 else | 431 else |
751 pStatusText = pGlobalTXT_LocalizationStrings[185];//"Steal item" | 432 pText = pGlobalTXT_LocalizationStrings[185];//"Steal item" |
752 DrawTextAtStatusBar(pStatusText, 0); | 433 DrawTextAtStatusBar(pText, 0); |
753 if ( pItemCount != 0 ) | 434 if ( pItemCount ) |
754 { | 435 { |
755 v73 = pMouse->GetCursorPos(&v136); | 436 pMouse->GetCursorPos(&mouse); |
756 v74 = pRenderer->pActiveZBuffer[v73->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v134)->y]] & 0xFFFF; | 437 if ( !(pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF) ) |
757 if ( !v74 ) | |
758 return; | 438 return; |
759 pItemCount = v74 - 1; | 439 selected_item = &pParty->StandartItemsInShops[window_SpeakInHouse->par1C][(pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF) - 1]; |
760 selected_item = &pParty->StandartItemsInShops[window_SpeakInHouse->par1C][v74-1]; | 440 if ( !GetAsyncKeyState(17) || !pPlayers[uActiveCharacter]->CanSteal()) |
761 if ( GetAsyncKeyState(17) == 0 || pPlayers[uActiveCharacter]->CanSteal() == 0) | 441 { |
762 v15 = (char *)pMerchantsBuyPhrases[pPlayers[uActiveCharacter]->SelectPhrasesTransaction(selected_item, BuildingType_ArmorShop, window_SpeakInHouse->par1C, 2)]; | 442 pText = BuildDialogueString((char *)pMerchantsBuyPhrases[pPlayers[uActiveCharacter]->SelectPhrasesTransaction(selected_item, BuildingType_ArmorShop, window_SpeakInHouse->par1C, 2)], |
443 uActiveCharacter - 1, selected_item, (char *)window_SpeakInHouse->ptr_1C, 2, 0); | |
444 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, TargetColor(0xFFu, 0xFFu, 0xFFu), pText, 3); | |
445 } | |
763 else | 446 else |
764 v15 = pGlobalTXT_LocalizationStrings[181]; //"Steal %24" | 447 { |
765 v36 = BuildDialogueString(v15, uActiveCharacter - 1, selected_item, (char *)window_SpeakInHouse->ptr_1C, 2, 0); | 448 pText = BuildDialogueString(pGlobalTXT_LocalizationStrings[181], uActiveCharacter - 1, selected_item, (char *)window_SpeakInHouse->ptr_1C, 2, 0); //"Steal %24" |
766 v115 = (174 - pFontArrus->CalcTextHeight(v36, &dialog_window, 0, 0)) / 2 + 138; | 449 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, TargetColor(0xFFu, 0xFFu, 0xFFu), pText, 3); |
767 dialog_window.DrawTitleText(pFontArrus, 0, v115, pWhiteColor, v36, 3); | 450 } |
768 return; | 451 return; |
769 } | 452 } |
770 dialog_window.DrawCurrentTime( pParty->PartyTimes.Shops_next_generation_time[window_SpeakInHouse->par1C]- pParty->uTimePlayed); | 453 dialog_window.DrawCurrentTime( pParty->field_3C.Shops_next_generation_time[window_SpeakInHouse->par1C]- pParty->uTimePlayed); |
771 return; | 454 return; |
772 } | 455 } |
773 break; | 456 break; |
457 | |
774 case HOUSE_DIALOGUE_SHOP_BUY_SPECIAL: | 458 case HOUSE_DIALOGUE_SHOP_BUY_SPECIAL: |
775 { | 459 { |
776 pRenderer->DrawTextureIndexed(8, 8, ShopTexture); | 460 pRenderer->DrawTextureIndexed(8, 8, ShopTexture); |
777 v11 = 0; | 461 item_x = 0; |
778 v61 = 0; | 462 for ( int i = 0; i < 8; ++i ) |
779 v153 = 0; | 463 { |
780 do | 464 if ( pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][i].uItemID ) |
781 { | 465 { |
782 if (pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][v61].uItemID) | 466 if ( i >= 4 ) |
783 { | 467 { |
784 v62 = ItemsInShopTexture[v61]; | 468 pRenderer->DrawTextureTransparent(item_x + (90 - ((signed int)ItemsInShopTexture[i]->uTextureWidth / 2)) - 420, 126, ItemsInShopTexture[i]); |
785 if ( v61 >= 4 ) | 469 v59 = item_x + (90 - ((signed int)ItemsInShopTexture[i]->uTextureWidth / 2)) + 80220; |
786 { | |
787 v67 = 90 - ((signed int)v62->uTextureWidth >> 1); | |
788 pRenderer->DrawTextureTransparent(v153 + v67 - 420, 0x7Eu, ItemsInShopTexture[v61]); | |
789 v66 = v153 + v67 + 80220; | |
790 } | 470 } |
791 else | 471 else |
792 { | 472 { |
793 v63 = 98 - v62->uTextureHeight; | 473 pRenderer->DrawTextureTransparent(86 - ((signed int)ItemsInShopTexture[i]->uTextureWidth / 2) + item_x, 98 - ItemsInShopTexture[i]->uTextureHeight, ItemsInShopTexture[i]); |
794 v64 = ItemsInShopTexture[v61]; | 474 v59 = (86 - ((signed int)ItemsInShopTexture[i]->uTextureWidth / 2)) + item_x + 640 * (98 - ItemsInShopTexture[i]->uTextureHeight); |
795 v65 = 98 - v62->uTextureHeight; | 475 } |
796 v152 = 86 - ((signed int)v62->uTextureWidth >> 1); | 476 ZBuffer_DoFill(&pRenderer->pActiveZBuffer[v59], ItemsInShopTexture[i], i + 1); |
797 pRenderer->DrawTextureTransparent(v152 + v153, v65, v64); | 477 } |
798 v66 = v152 + v153 + 640 * v63; | 478 item_x += 105; |
799 } | 479 } |
800 ZBuffer_DoFill(&pRenderer->pActiveZBuffer[v66], ItemsInShopTexture[v61], v61 + 1); | |
801 } | |
802 v153 += 105; | |
803 ++v61; | |
804 } | |
805 while ( v61 < 8 ); | |
806 if ( !HouseUI_CheckIfPlayerCanInteract() ) | 480 if ( !HouseUI_CheckIfPlayerCanInteract() ) |
807 return; | 481 return; |
808 v68 = 0; | |
809 pItemCount = 0; | 482 pItemCount = 0; |
810 do | 483 for ( uint i = 0; i < 6; ++i ) |
811 { | 484 { |
812 if (pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][(signed int)v68].uItemID) | 485 if (pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][i].uItemID) |
813 ++pItemCount; | 486 ++pItemCount; |
814 ++v68; | 487 } |
815 } | 488 if ( !GetAsyncKeyState(17) || !pPlayers[uActiveCharacter]->CanSteal() ) |
816 while ( v68 < 6 ); | 489 pText = pGlobalTXT_LocalizationStrings[196]; //Select the Special Item to Buy" |
817 if ( GetAsyncKeyState(17) == 0 || pPlayers[uActiveCharacter]->CanSteal() == 0 ) | |
818 pStatusText = pGlobalTXT_LocalizationStrings[196]; //Select the Special Item to Buy" | |
819 else | 490 else |
820 pStatusText = pGlobalTXT_LocalizationStrings[185]; | 491 pText = pGlobalTXT_LocalizationStrings[185]; |
821 DrawTextAtStatusBar(pStatusText, 0); | 492 DrawTextAtStatusBar(pText, 0); |
822 if ( (char *)pItemCount != 0 ) | 493 if ( pItemCount ) |
823 { | 494 { |
824 v73 = pMouse->GetCursorPos(&v136); | 495 pMouse->GetCursorPos(&mouse); |
825 v74 = pRenderer->pActiveZBuffer[v73->x + pSRZBufferLineOffsets[pMouse->GetCursorPos((POINT *)&v134)->y]] & 0xFFFF; | 496 if ( !(pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF) ) |
826 if ( !v74 ) | |
827 return; | 497 return; |
828 pItemCount = v74 - 1; | 498 pItemCount = (pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF) - 1; |
829 if ( dialog_menu_id == 2 ) | 499 if ( dialog_menu_id == 2 ) |
830 selected_item = &pParty->StandartItemsInShops[window_SpeakInHouse->par1C][v74 - 1]; | 500 selected_item = &pParty->StandartItemsInShops[window_SpeakInHouse->par1C][(pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF) - 1]; |
831 else | 501 else |
832 selected_item = &pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][v74 - 1]; | 502 selected_item = &pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][(pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF) - 1]; |
833 if ( GetAsyncKeyState(17) == 0 || pPlayers[uActiveCharacter]->CanSteal() == 0 ) | 503 if ( !GetAsyncKeyState(17) || !pPlayers[uActiveCharacter]->CanSteal() ) |
834 v15 = (char *)pMerchantsBuyPhrases[pPlayers[uActiveCharacter]->SelectPhrasesTransaction(selected_item, BuildingType_ArmorShop, window_SpeakInHouse->par1C, 2)]; | 504 { |
505 pText = BuildDialogueString((char *)pMerchantsBuyPhrases[pPlayers[uActiveCharacter]->SelectPhrasesTransaction(selected_item, BuildingType_ArmorShop, window_SpeakInHouse->par1C, 2)], | |
506 uActiveCharacter - 1, selected_item, (char *)window_SpeakInHouse->ptr_1C, 2, 0); | |
507 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, TargetColor(0xFFu, 0xFFu, 0xFFu), pText, 3); | |
508 } | |
835 else | 509 else |
836 v15 = pGlobalTXT_LocalizationStrings[181]; //"Steal %24" | 510 { |
837 v36 = BuildDialogueString(v15, uActiveCharacter - 1, selected_item, (char *)window_SpeakInHouse->ptr_1C, 2, 0); | 511 pText = BuildDialogueString(pGlobalTXT_LocalizationStrings[181], uActiveCharacter - 1, selected_item, (char *)window_SpeakInHouse->ptr_1C, 2, 0);//"Steal %24" |
838 v115 = (174 - pFontArrus->CalcTextHeight(v36, &dialog_window, 0, 0)) / 2 + 138; | 512 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, TargetColor(0xFFu, 0xFFu, 0xFFu), pText, 3); |
839 dialog_window.DrawTitleText(pFontArrus, 0, v115, pWhiteColor, v36, 3); | 513 } |
840 return; | 514 return; |
841 } | 515 } |
842 dialog_window.DrawCurrentTime( pParty->PartyTimes.Shops_next_generation_time[window_SpeakInHouse->par1C]- pParty->uTimePlayed); | 516 dialog_window.DrawCurrentTime( pParty->field_3C.Shops_next_generation_time[window_SpeakInHouse->par1C]- pParty->uTimePlayed); |
843 return; | 517 return; |
844 } | 518 } |
845 break; | 519 break; |
520 | |
846 case HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT: | 521 case HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT: |
847 { | 522 { |
848 draw_leather(); | 523 draw_leather(); |
849 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); | 524 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); |
850 pShopOptions[0] = pGlobalTXT_LocalizationStrings[200]; //"Sell" | 525 pShopOptions[0] = pGlobalTXT_LocalizationStrings[200]; //"Sell" |
851 pShopOptions[1] = pGlobalTXT_LocalizationStrings[113]; //"Identify" | 526 pShopOptions[1] = pGlobalTXT_LocalizationStrings[113]; //"Identify" |
852 pShopOptions[2] = pGlobalTXT_LocalizationStrings[179]; //"Repair" | 527 pShopOptions[2] = pGlobalTXT_LocalizationStrings[179]; //"Repair" |
853 all_text_height = 0; | 528 all_text_height = 0; |
854 for ( int i = 0; i < 3; ++i ) | 529 for ( int i = 0; i < 3; ++i ) |
855 all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0); | 530 all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0); |
856 v152 = (174 - all_text_height) / 3; | 531 v146 = (174 - all_text_height) / 3; |
857 v86 = (3 * (58 - v152) - all_text_height) / 2 - v152 / 2 + 138; | 532 v23 = (3 * (58 - v146) - all_text_height) / 2 - v146 / 2 + 138; |
858 v24 = -pDialogueWindow->pNumPresenceButton < 0; | 533 pNumString = 0; |
859 pActiveButton = pDialogueWindow->pStartingPosActiveItem; | 534 for ( int i = pDialogueWindow->pStartingPosActiveItem; |
860 if ( v24 ^ (pDialogueWindow->pStartingPosActiveItem > pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton) ) | 535 i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) |
861 { | 536 { |
862 pNumString = 0; | 537 pButton = pDialogueWindow->GetControl(i); |
863 do | 538 pButton->uY = v146 + v23; |
864 { | 539 pButton->uHeight = pFontArrus->CalcTextHeight(pShopOptions[pNumString], &dialog_window, 0, 0); |
865 pButton = pDialogueWindow->GetControl((unsigned int)pActiveButton); | 540 v23 = pButton->uY + pFontArrus->CalcTextHeight(pShopOptions[pNumString], &dialog_window, 0, 0) - 1; |
866 pButton->uY = v152 + v86; | 541 pButton->uW = v23; |
867 pTextHeight = pFontArrus->CalcTextHeight(pShopOptions[pNumString], &dialog_window, 0, 0); | 542 pTextColor = TargetColor(0xE1u, 0xCDu, 0x23u); |
868 v90 = pButton->uY; | 543 if ( pDialogueWindow->pCurrentPosActiveItem != i ) |
869 pButton->uHeight = pTextHeight; | 544 pTextColor = TargetColor(0xFFu, 0xFFu, 0xFFu); |
870 v86 = v90 + pTextHeight - 1; | 545 dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pTextColor, pShopOptions[pNumString], 3); |
871 pButton->uW = v86; | 546 ++pNumString; |
872 pTextColor = pYellowColor; | |
873 if ( pDialogueWindow->pCurrentPosActiveItem != pActiveButton ) | |
874 pTextColor = pWhiteColor; | |
875 dialog_window.DrawTitleText(pFontArrus, 0, v90, pTextColor, pShopOptions[pNumString], 3); | |
876 ++pNumString; | |
877 ++pActiveButton; | |
878 } | |
879 while ( (signed int)pActiveButton < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem ); | |
880 } | 547 } |
881 return; | 548 return; |
882 } | 549 } |
883 break; | 550 break; |
551 | |
884 case HOUSE_DIALOGUE_SHOP_SELL: | 552 case HOUSE_DIALOGUE_SHOP_SELL: |
885 { | 553 { |
886 draw_leather(); | 554 draw_leather(); |
887 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); | 555 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); |
888 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[199], 0);//"Select the Item to Sell" | 556 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[199], 0);//"Select the Item to Sell" |
889 if ( !HouseUI_CheckIfPlayerCanInteract()) | 557 if ( !HouseUI_CheckIfPlayerCanInteract()) |
890 return; | 558 return; |
891 if((v9 = pMouse->GetCursorPos(&v139)->x - 14, pItemCount = (v9 >> 5) + 14 * ((pMouse->GetCursorPos(&v133)->y - 17) >> 5), | 559 pMouse->GetCursorPos(&mouse); |
892 pMouse->GetCursorPos(&v137)->x <= 13) || pMouse->GetCursorPos(&v129)->x >= 462 | 560 v153 = ((mouse.x - 14) >> 5) + 14 * ((mouse.y - 17) >> 5); |
893 || (v10 = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&pItemCount), v11 = 0, !v10) ) | 561 if ( mouse.x <= 13 || mouse.x >= 462 ) |
562 return; | |
563 if ( !pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v153) ) | |
894 return; | 564 return; |
895 v116 = (ItemGen *)&pPlayers[uActiveCharacter]->pInventoryItemList[v10 - 1]; | 565 selected_item = &pPlayers[uActiveCharacter]->pInventoryItemList[pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v153) - 1]; |
896 v13 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(v116, BuildingType_ArmorShop, window_SpeakInHouse->par1C, 3); | 566 pText = BuildDialogueString((char *)pMerchantsSellPhrases[pPlayers[uActiveCharacter]->SelectPhrasesTransaction(selected_item, BuildingType_ArmorShop, window_SpeakInHouse->par1C, 3)], |
897 v15 = (char *)pMerchantsSellPhrases[pPlayers[uActiveCharacter]->SelectPhrasesTransaction(v116, BuildingType_ArmorShop, window_SpeakInHouse->par1C, 3)]; | 567 uActiveCharacter - 1, selected_item, (char *) window_SpeakInHouse->par1C, 3, 0); |
898 v36 = BuildDialogueString(v15, uActiveCharacter - 1, v116, (char *) window_SpeakInHouse->par1C, 3, 0); | 568 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, TargetColor(0xFFu, 0xFFu, 0xFFu), pText, 3); |
899 v115 = (174 - pFontArrus->CalcTextHeight(v36, &dialog_window, 0, 0)) / 2 + 138; | |
900 dialog_window.DrawTitleText(pFontArrus, 0, v115, pWhiteColor, v36, 3); | |
901 return; | 569 return; |
902 } | 570 } |
903 break; | 571 break; |
904 case HOUSE_DIALOGUE_SHOP_IDENTIFY: | 572 case HOUSE_DIALOGUE_SHOP_IDENTIFY: |
905 { | 573 { |
906 draw_leather(); | 574 draw_leather(); |
907 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); | 575 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); |
908 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[197], 0); //"Select the Item to Identify" | 576 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[197], 0); //"Select the Item to Identify" |
909 if ( HouseUI_CheckIfPlayerCanInteract() ) | 577 if ( HouseUI_CheckIfPlayerCanInteract() ) |
910 { | 578 { |
911 v1 = pMouse->GetCursorPos(&a2)->x - 14; | 579 pMouse->GetCursorPos(&mouse); |
912 pItemCount = (v1 >> 5) + 14 * ((pMouse->GetCursorPos(&v128)->y - 17) >> 5); | 580 v153 = ((mouse.x - 14) >> 5) + 14 * ((mouse.y - 17) >> 5); |
913 if ( pMouse->GetCursorPos(&v141)->x > 13 ) | 581 if ( mouse.x > 13 && mouse.x < 462 ) |
914 { | 582 { |
915 if ( pMouse->GetCursorPos(&v143)->x < 462 ) | 583 if ( pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v153) ) |
916 { | 584 { |
917 v2 = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&pItemCount); | 585 selected_item = &pPlayers[uActiveCharacter]->pInventoryItemList[pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v153)-1]; |
918 if ( v2 ) | 586 if (selected_item->IsIdentified()) |
919 { | 587 pText = BuildDialogueString("%24", uActiveCharacter - 1, selected_item, (char *)window_SpeakInHouse->ptr_1C, 4, 0); |
920 v3 = (ItemGen *)&pPlayers[uActiveCharacter]->pInventoryItemList[v2-1]; | 588 else |
921 if (v3->IsIdentified()) | 589 pText = BuildDialogueString((char *)pMerchantsIdentifyPhrases[pPlayers[uActiveCharacter]->SelectPhrasesTransaction(selected_item, BuildingType_ArmorShop, |
922 v5 = "%24"; | 590 (int)window_SpeakInHouse->ptr_1C, 4)], uActiveCharacter - 1, selected_item, (char *)window_SpeakInHouse->ptr_1C, 4, 0); |
923 else | 591 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, TargetColor(0xFFu, 0xFFu, 0xFFu), pText, 3); |
924 { | 592 return; |
925 v8 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(v3, BuildingType_ArmorShop, (int)window_SpeakInHouse->ptr_1C, 4); | |
926 v5 = (char *)pMerchantsIdentifyPhrases[v8]; | |
927 } | |
928 v6 = BuildDialogueString(v5, uActiveCharacter - 1, v3, (char *)window_SpeakInHouse->ptr_1C, 4, 0); | |
929 v115 = (174 - pFontArrus->CalcTextHeight(v6, &dialog_window, 0, 0)) / 2 + 138; | |
930 dialog_window.DrawTitleText(pFontArrus, 0, v115, pWhiteColor, v6, 3); | |
931 return; | |
932 } | |
933 } | 593 } |
934 } | 594 } |
935 } | 595 } |
936 } | 596 } |
937 break; | 597 break; |
940 draw_leather(); | 600 draw_leather(); |
941 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); | 601 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); |
942 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[198], 0); | 602 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[198], 0); |
943 if ( !HouseUI_CheckIfPlayerCanInteract()) | 603 if ( !HouseUI_CheckIfPlayerCanInteract()) |
944 return; | 604 return; |
945 if( (v31 = pMouse->GetCursorPos(&v135)->x - 14, | 605 pMouse->GetCursorPos(&mouse); |
946 pItemCount = (v31 >> 5) + 14 * ((pMouse->GetCursorPos(&v142)->y - 17) >> 5), | 606 v153 = ((mouse.x -14) >> 5) + 14 * ((mouse.y - 17) >> 5); |
947 pMouse->GetCursorPos(&v140)->x <= 13) | 607 if( mouse.x <= 13 || mouse.x >= 462 ) |
948 || pMouse->GetCursorPos(&v138)->x >= 462 | 608 return; |
949 || (v32 = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&pItemCount), v11 = 0, !v32) | 609 if ( !pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v153) |
950 || (!(pPlayers[uActiveCharacter]->pOwnItems[v32-1].uAttributes& 2)) ) | 610 || (!(pPlayers[uActiveCharacter]->pOwnItems[pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v153) - 1].uAttributes& 2)) ) |
951 return; | 611 return; |
952 //__debugbreak(); // warning C4700: uninitialized local variable 'v33' used | 612 selected_item = &pPlayers[uActiveCharacter]->pInventoryItemList[pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v153) - 1]; |
953 v116 = &pPlayers[uActiveCharacter]->pInventoryItemList[v32 - 1]; | 613 phrases_id = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(&pPlayers[uActiveCharacter]->pInventoryItemList[pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v153) - 1], |
954 v35 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(&pPlayers[uActiveCharacter]->pInventoryItemList[v32 - 1], BuildingType_ArmorShop, window_SpeakInHouse->par1C, 5); | 614 BuildingType_ArmorShop, window_SpeakInHouse->par1C, 5); |
955 v15 = (char *)pMerchantsRepairPhrases[v35]; | 615 pText = BuildDialogueString((char *)pMerchantsRepairPhrases[phrases_id], uActiveCharacter - 1, selected_item, (char *)window_SpeakInHouse->ptr_1C, 5, 0); |
956 v36 = BuildDialogueString(v15, uActiveCharacter - 1, v116, (char *)window_SpeakInHouse->ptr_1C, 5, 0); | 616 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, TargetColor(0xFFu, 0xFFu, 0xFFu), pText, 3); |
957 v115 = (174 - pFontArrus->CalcTextHeight(v36, &dialog_window, 0, 0)) / 2 + 138; | |
958 dialog_window.DrawTitleText(pFontArrus, 0, v115, pWhiteColor, v36, 3); | |
959 return; | 617 return; |
960 } | 618 } |
961 break; | 619 break; |
962 case HOUSE_DIALOGUE_SHOP_6: //buy standart ??? | 620 |
963 { | |
964 pRenderer->DrawTextureIndexed(8u, 8u, ShopTexture); | |
965 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[195], 0); //"Select the Item to Buy" | |
966 if ( !HouseUI_CheckIfPlayerCanInteract() ) | |
967 return; | |
968 pItemCount = 0; | |
969 for( int i = 0; i < 6 ; ++i ) | |
970 if (pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][i].uItemID) | |
971 ++pItemCount; | |
972 if ( pItemCount ) | |
973 { | |
974 v94 = pMouse->GetCursorPos(&v132); | |
975 pItemCount = pRenderer->pActiveZBuffer[v94->x + pSRZBufferLineOffsets[pMouse->GetCursorPos((POINT *)&v130)->y]]; | |
976 v95 = pItemCount; | |
977 if ( pItemCount && pItemCount != -65536 ) | |
978 { | |
979 --pItemCount; | |
980 v97 = uActiveCharacter - 1; | |
981 //__debugbreak(); // warning C4700: uninitialized local variable 'v98' used | |
982 v99 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(&pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][v95-1], BuildingType_ArmorShop, window_SpeakInHouse->par1C, 2); | |
983 v100 = BuildDialogueString((char *)pMerchantsBuyPhrases[v99], uActiveCharacter - 1, &pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][v95-1], (char *)window_SpeakInHouse->par1C, 2, 0); | |
984 v103 = pFontArrus->CalcTextHeight(v100, &dialog_window, 0, 0); | |
985 dialog_window.DrawTitleText(pFontArrus, 0, (174 - v103) / 2 + 138, pWhiteColor, v100, 3); | |
986 } | |
987 v104 = 0; | |
988 v153 = 0; | |
989 do | |
990 { | |
991 //if ( pParty->field_C59C[9 * (v104 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] ) | |
992 if (pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][v104].uItemID) | |
993 { | |
994 v105 = ItemsInShopTexture[v104]; | |
995 if ( v104 >= 4 ) | |
996 { | |
997 v110 = 90 - ((signed int)v105->uTextureWidth >> 1); | |
998 pRenderer->DrawTextureTransparent(v153 + v110 - 420, 0x7Eu, ItemsInShopTexture[v104]); | |
999 v127 = v104 + 1; | |
1000 v109 = v153 + v110 + 80220; | |
1001 } | |
1002 else | |
1003 { | |
1004 v106 = 98 - v105->uTextureHeight; | |
1005 v108 = 98 - v105->uTextureHeight; | |
1006 v152 = 86 - ((signed int)v105->uTextureWidth >> 1); | |
1007 pRenderer->DrawTextureTransparent(v152 + v153, v108, ItemsInShopTexture[v104]); | |
1008 v127 = v104 + 1; | |
1009 v109 = v152 + v153 + 640 * v106; | |
1010 } | |
1011 ZBuffer_DoFill(&pRenderer->pActiveZBuffer[v109], ItemsInShopTexture[v104], v127); | |
1012 } | |
1013 v153 += 105; | |
1014 ++v104; | |
1015 } | |
1016 while ( v104 < 8 ); | |
1017 return; | |
1018 } | |
1019 dialog_window.DrawCurrentTime(pParty->PartyTimes.Shops_next_generation_time[window_SpeakInHouse->par1C]- pParty->uTimePlayed); | |
1020 return; | |
1021 } | |
1022 break; | |
1023 case HOUSE_DIALOGUE_LEARN_SKILLS: | 621 case HOUSE_DIALOGUE_LEARN_SKILLS: |
1024 { | 622 { |
1025 if (!HouseUI_CheckIfPlayerCanInteract() ) | 623 if (!HouseUI_CheckIfPlayerCanInteract() ) |
1026 return; | 624 return; |
1027 v152 = 0; | 625 uint item_num = 0; |
1028 v38 = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0); | 626 v38 = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0); |
1029 pActiveButton = v38 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; | 627 pPrice = v38 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; |
1030 if ( (signed int)pActiveButton < v38 / 3 ) | 628 if ( (signed int)pPrice < v38 / 3 ) |
1031 pActiveButton = v38 / 3; | 629 pPrice = v38 / 3; |
1032 v39 = pDialogueWindow->pStartingPosActiveItem; | 630 all_text_height = 0; |
1033 v40 = pDialogueWindow->pNumPresenceButton; | 631 for ( int i = pDialogueWindow->pStartingPosActiveItem; |
1034 v153 = 0; | 632 i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) |
1035 if ( (signed int)v39 < (signed int)(v39 + v40) ) | 633 { |
1036 { | 634 if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][pDialogueWindow->GetControl(i)->msg_param - 36] |
1037 do | 635 && !pPlayers[uActiveCharacter]->pActiveSkills[pDialogueWindow->GetControl(i)->msg_param - 36] ) |
1038 { | 636 { |
1039 v41 = pDialogueWindow->GetControl(v39)->msg_param - 36; | 637 all_text_height += pFontArrus->CalcTextHeight(pSkillNames[pDialogueWindow->GetControl(i)->msg_param - 36], &dialog_window, 0, 0); |
1040 if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][v41] && !pPlayers[uActiveCharacter]->pActiveSkills[v41] ) | 638 item_num ++; |
1041 { | 639 } |
1042 v42 = pFontArrus->CalcTextHeight(pSkillNames[v41], &dialog_window, 0, 0); | 640 } |
1043 v152 += v42; | 641 if ( item_num ) |
1044 ++v153; | 642 { |
1045 } | 643 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[401], pPrice); |
1046 ++v39; | 644 dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3); |
1047 } | 645 v146 = (149 - all_text_height) / item_num; |
1048 while ( (signed int)v39 < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem ); | 646 if ( (149 - all_text_height) / item_num > 32 ) |
1049 if ( v153 ) | 647 v146 = 32; |
1050 { | 648 v23 = (149 - v146 * item_num - all_text_height) / 2 - v146 / 2 + 162; |
1051 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[401], pActiveButton); | 649 for ( int i = pDialogueWindow->pStartingPosActiveItem; |
1052 dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3); | 650 i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) |
1053 pActiveButton = (149 - v152) / v153; | 651 { |
1054 if ( (149 - v152) / v153 > 32 ) | 652 pButton = pDialogueWindow->GetControl(i); |
1055 pActiveButton = 32; | 653 if ( !byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][pButton->msg_param - 36] |
1056 v43 = (149 - v153 * (signed int)pActiveButton - v152) / 2 - (signed int)pActiveButton / 2 + 162; | 654 || pPlayers[uActiveCharacter]->pActiveSkills[pButton->msg_param - 36] ) |
1057 v152 = pDialogueWindow->pStartingPosActiveItem; | 655 { |
1058 v146 = v43; | 656 pButton->uW = 0; |
1059 if ( v152 < v152 + pDialogueWindow->pNumPresenceButton ) | 657 pButton->uHeight = 0; |
1060 { | 658 pButton->uY = 0; |
1061 v153 = 2; | 659 } |
1062 do | 660 else |
1063 { | 661 { |
1064 pButton = pDialogueWindow->GetControl(v152); | 662 pButton->uY = v146 + v23; |
1065 v46 = pButton->msg_param - 36; | 663 pButton->uHeight = pFontArrus->CalcTextHeight(pSkillNames[pButton->msg_param - 36], &dialog_window, 0, 0); |
1066 if ( !byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][v46] || pPlayers[uActiveCharacter]->pActiveSkills[v46] ) | 664 v23 = pButton->uY + pFontArrus->CalcTextHeight(pSkillNames[pButton->msg_param - 36], &dialog_window, 0, 0) - 1; |
1067 { | 665 pButton->uW = v23; |
1068 pButton->uW = 0; | 666 pTextColor = TargetColor(0xE1u, 0xCDu, 0x23u); |
1069 pButton->uHeight = 0; | 667 if ( pDialogueWindow->pCurrentPosActiveItem != i ) |
1070 pButton->uY = 0; | 668 pTextColor = TargetColor(0xFFu, 0xFFu, 0xFFu); |
1071 } | 669 dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pTextColor, pSkillNames[pButton->msg_param - 36], 3); |
1072 else | 670 } |
1073 { | 671 } |
1074 pButton->uY = (unsigned int)((char *)pActiveButton + v146); | 672 return; |
1075 pTextHeight = pFontArrus->CalcTextHeight(pSkillNames[v46], &dialog_window, 0, 0); | |
1076 v49 = pButton->uY; | |
1077 pButton->uHeight = pTextHeight; | |
1078 v51 = v49 + pTextHeight - 1; | |
1079 pButton->uW = v51; | |
1080 v146 = v51; | |
1081 pTextColor = pYellowColor; | |
1082 if ( pDialogueWindow->pCurrentPosActiveItem != v153 ) | |
1083 pTextColor = pWhiteColor; | |
1084 dialog_window.DrawTitleText(pFontArrus, 0, v49, pTextColor, pSkillNames[v46], 3); | |
1085 } | |
1086 v53 = pDialogueWindow->pStartingPosActiveItem; | |
1087 ++v152; | |
1088 textureH = pDialogueWindow->pNumPresenceButton + v53; | |
1089 ++v153; | |
1090 } | |
1091 while ( v152 < textureH ); | |
1092 } | |
1093 return; | |
1094 } | |
1095 } | 673 } |
1096 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]); //"Seek knowledge elsewhere %s the %s" | 674 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]); //"Seek knowledge elsewhere %s the %s" |
1097 strcat(pTmpBuf.data(), "\n \n"); | 675 strcat(pTmpBuf.data(), "\n \n"); |
1098 strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]); //"I can offer you nothing further." | 676 strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]); //"I can offer you nothing further." |
1099 v115 = (174 - pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 0, 0)) / 2 + 138; | 677 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 0, 0)) / 2 + 138, TargetColor(0xE1u, 0xCDu, 0x23u), pTmpBuf.data(), 3); |
1100 dialog_window.DrawTitleText(pFontArrus, 0, v115, pYellowColor, pTmpBuf.data(), 3); | |
1101 return; | 678 return; |
1102 } | 679 } |
1103 break; | 680 break; |
681 default: | |
682 __debugbreak(); | |
1104 } | 683 } |
1105 } | 684 } |
1106 //----- (004B9CC6) -------------------------------------------------------- | 685 //----- (004B9CC6) -------------------------------------------------------- |
1107 void AlchemistDialog() | 686 void AlchemistDialog() |
1108 { | 687 { |
1109 int v0; | 688 int index; // eax@7 |
1110 int pNumActiveItem; // eax@7 | |
1111 signed int v5; // esi@9 | 689 signed int v5; // esi@9 |
1112 unsigned int v6; // esi@11 | |
1113 int v7; // eax@11 | |
1114 unsigned int v8; // eax@12 | |
1115 int v9; // eax@14 | |
1116 int v10; // ecx@19 | |
1117 int v13; // eax@21 | |
1118 char *v14; // eax@23 | |
1119 int v15; // eax@23 | |
1120 unsigned int v16; // ecx@23 | |
1121 int v17; // edx@23 | |
1122 int v18; // eax@23 | 690 int v18; // eax@23 |
1123 int v20; // eax@27 | 691 char *pText; // edx@29 |
1124 char *v21; // edx@29 | |
1125 int v22; // esi@30 | |
1126 char **v23; // edi@30 | |
1127 int v24; // eax@31 | |
1128 int v26; // edx@32 | |
1129 int v27; // edi@32 | |
1130 unsigned __int8 v28; // sf@32 | |
1131 const char **v30; // eax@34 | |
1132 int v31; // eax@34 | |
1133 unsigned int v32; // ecx@34 | |
1134 int v34; // eax@34 | |
1135 signed int v36; // esi@39 | |
1136 ItemGen *v37; // eax@42 | |
1137 char *v38; // ecx@43 | |
1138 unsigned __int8 v39; // dl@44 | |
1139 int v40; // eax@46 | |
1140 int v41; // ST08_4@47 | |
1141 int v42; // eax@47 | |
1142 signed int v43; // esi@49 | |
1143 int v44; // ST08_4@52 | |
1144 int v45; // eax@52 | |
1145 Texture *v46; // ecx@55 | |
1146 unsigned int v47; // edi@55 | 692 unsigned int v47; // edi@55 |
1147 unsigned int v48; // esi@57 | 693 unsigned int v48; // esi@57 |
1148 int v49; // edx@61 | |
1149 Texture *v50; // ecx@67 | |
1150 unsigned int v51; // edi@67 | 694 unsigned int v51; // edi@67 |
1151 unsigned int v52; // esi@69 | 695 unsigned int v52; // esi@69 |
1152 int v53; // edx@73 | 696 ItemGen *item; // esi@118 |
1153 Texture *v54; // ecx@79 | |
1154 unsigned int v55; // edi@79 | |
1155 unsigned int v56; // esi@81 | |
1156 int v57; // edx@85 | |
1157 Texture *v58; // ecx@91 | |
1158 unsigned int v59; // edi@91 | |
1159 unsigned int v60; // esi@93 | |
1160 int v61; // edx@97 | |
1161 signed int v62; // ecx@102 | |
1162 SHORT v63; // di@110 | |
1163 bool v64; // eax@110 | |
1164 const char *v65; // ecx@112 | |
1165 POINT *v66; // esi@117 | |
1166 int v67; // ecx@118 | |
1167 int v68; // eax@118 | |
1168 int v69; // ecx@118 | |
1169 ItemGen *v70; // esi@118 | |
1170 int v71; // eax@123 | 697 int v71; // eax@123 |
1171 int all_text_height; // edi@125 | 698 int all_text_height; // edi@125 |
1172 char **v73; // esi@125 | |
1173 int v74; // eax@126 | |
1174 int pItemNum; | |
1175 int v76; // edx@127 | |
1176 int v77; // edi@127 | |
1177 GUIButton *pButton; // esi@129 | 699 GUIButton *pButton; // esi@129 |
1178 const char **v79; // eax@129 | |
1179 int pTextHeight; // eax@129 | |
1180 unsigned int v81; // ecx@129 | |
1181 unsigned int pColorText; // ax@129 | 700 unsigned int pColorText; // ax@129 |
1182 int v85; // [sp-14h] [bp-ECh]@29 | 701 POINT mouse; // [sp+2Ch] [bp-ACh]@117 |
1183 int v86; // [sp-10h] [bp-E8h]@29 | |
1184 ItemGen *v87; // [sp-10h] [bp-E8h]@43 | |
1185 unsigned __int16 v88; // [sp-Ch] [bp-E4h]@29 | |
1186 void *v89; // [sp-Ch] [bp-E4h]@43 | |
1187 char *v90; // [sp-8h] [bp-E0h]@29 | |
1188 int v91; // [sp-8h] [bp-E0h]@42 | |
1189 unsigned int v92; // [sp-4h] [bp-DCh]@29 | |
1190 __int64 *v93; // [sp-4h] [bp-DCh]@42 | |
1191 POINT v94; // [sp+Ch] [bp-CCh]@39 | |
1192 POINT v95; // [sp+14h] [bp-C4h]@49 | |
1193 POINT v96; // [sp+1Ch] [bp-BCh]@117 | |
1194 POINT v97; // [sp+24h] [bp-B4h]@40 | |
1195 POINT v98; // [sp+2Ch] [bp-ACh]@117 | |
1196 POINT v99; // [sp+34h] [bp-A4h]@49 | |
1197 POINT v100; // [sp+3Ch] [bp-9Ch]@50 | |
1198 POINT v101; // [sp+44h] [bp-94h]@39 | |
1199 POINT v102; // [sp+4Ch] [bp-8Ch]@49 | |
1200 POINT a2; // [sp+54h] [bp-84h]@39 | |
1201 GUIWindow dialog_window; // [sp+5Ch] [bp-7Ch]@1 | 702 GUIWindow dialog_window; // [sp+5Ch] [bp-7Ch]@1 |
1202 int v105; // [sp+B0h] [bp-28h]@19 | 703 int v105; // [sp+B0h] [bp-28h]@19 |
1203 int pColorYellow; // [sp+B4h] [bp-24h]@1 | |
1204 int Str; // [sp+B8h] [bp-20h]@23 | |
1205 int pColorWhite; // [sp+BCh] [bp-1Ch]@1 | |
1206 __int32 v109; // [sp+C0h] [bp-18h]@39 | |
1207 Player *pPlayer; // [sp+C4h] [bp-14h]@1 | |
1208 int pNumString; // [sp+C8h] [bp-10h]@9 | 704 int pNumString; // [sp+C8h] [bp-10h]@9 |
1209 unsigned int v112; // [sp+CCh] [bp-Ch]@9 | 705 int item_num; // [sp+D4h] [bp-4h]@11 |
1210 unsigned __int8 v113; // [sp+D3h] [bp-5h]@47 | 706 int pPrice; |
1211 int v114; // [sp+D4h] [bp-4h]@11 | 707 |
1212 | |
1213 pPlayer = pPlayers[uActiveCharacter]; | |
1214 memcpy(&dialog_window, window_SpeakInHouse, sizeof(dialog_window)); | 708 memcpy(&dialog_window, window_SpeakInHouse, sizeof(dialog_window)); |
1215 dialog_window.uFrameX = 483; | 709 dialog_window.uFrameX = 483; |
1216 dialog_window.uFrameWidth = 148; | 710 dialog_window.uFrameWidth = 148; |
1217 dialog_window.uFrameZ = 334; | 711 dialog_window.uFrameZ = 334; |
1218 pColorWhite = TargetColor(0xFFu, 0xFFu, 0xFFu); | |
1219 pColorYellow = TargetColor(0xE1u, 0xCDu, 0x23u); | |
1220 switch(dialog_menu_id) | 712 switch(dialog_menu_id) |
1221 { | 713 { |
1222 case HOUSE_DIALOGUE_MAIN: | 714 case HOUSE_DIALOGUE_MAIN: |
1223 { | 715 { |
1224 if ( HouseUI_CheckIfPlayerCanInteract() ) | 716 if ( HouseUI_CheckIfPlayerCanInteract() ) |
1226 pShopOptions[0] = pGlobalTXT_LocalizationStrings[134]; | 718 pShopOptions[0] = pGlobalTXT_LocalizationStrings[134]; |
1227 pShopOptions[1] = pGlobalTXT_LocalizationStrings[152]; | 719 pShopOptions[1] = pGlobalTXT_LocalizationStrings[152]; |
1228 pShopOptions[2] = pGlobalTXT_LocalizationStrings[159]; | 720 pShopOptions[2] = pGlobalTXT_LocalizationStrings[159]; |
1229 pShopOptions[3] = pGlobalTXT_LocalizationStrings[160]; | 721 pShopOptions[3] = pGlobalTXT_LocalizationStrings[160]; |
1230 all_text_height = 0; | 722 all_text_height = 0; |
1231 for (int i = 0; i < 4; ++i)//while ( (signed int)v15 < (signed int)&unk_F8B1C8 ); | 723 for ( int i = 0; i < 4; ++i ) |
1232 all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0); | 724 all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0); |
1233 Str = (174 - all_text_height) / 4; | 725 v18 = (174 - all_text_height) / 4; |
1234 pNumActiveItem = pDialogueWindow->pStartingPosActiveItem; | 726 v105 = (174 - 4 * (174 - all_text_height) / 4 - all_text_height) / 2 - (174 - all_text_height) / 4 / 2 + 138; |
1235 v76 = pNumActiveItem + pDialogueWindow->pNumPresenceButton; | 727 pNumString = 0; |
1236 v77 = (174 - 4 * (174 - all_text_height) / 4 - all_text_height) / 2 - (174 - all_text_height) / 4 / 2 + 138; | 728 for ( int i = pDialogueWindow->pStartingPosActiveItem; |
1237 v28 = -pDialogueWindow->pNumPresenceButton < 0; | 729 i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) |
1238 if ( v28 ^ (pNumActiveItem > v76) ) | 730 { |
1239 { | 731 pButton = pDialogueWindow->GetControl(i); |
1240 pItemNum = 2; | 732 pButton->uY = v18 + v105; |
1241 pNumString = 0; | 733 pButton->uHeight = pFontArrus->CalcTextHeight((const char *)pShopOptions[pNumString], &dialog_window, 0, 0); |
1242 do | 734 v105 = pButton->uY + pFontArrus->CalcTextHeight((const char *)pShopOptions[pNumString], &dialog_window, 0, 0) - 1; |
1243 { | 735 pButton->uW = v105; |
1244 pButton = pDialogueWindow->GetControl(pItemNum); | 736 pColorText = TargetColor(0xE1u, 0xCDu, 0x23u); |
1245 pButton->uY = Str + v77; | 737 if ( pDialogueWindow->pCurrentPosActiveItem != i ) |
1246 pTextHeight = pFontArrus->CalcTextHeight((const char *)pShopOptions[pNumString], &dialog_window, 0, 0); | 738 pColorText = TargetColor(0xFFu, 0xFFu, 0xFFu); |
1247 pButton->uHeight = pTextHeight; | 739 dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, (const char *)pShopOptions[pNumString], 3); |
1248 v77 = pButton->uY + pTextHeight - 1; | 740 ++pNumString; |
1249 pButton->uW = v77; | |
1250 pColorText = pColorYellow; | |
1251 if ( pDialogueWindow->pCurrentPosActiveItem != pItemNum ) | |
1252 pColorText = pColorWhite; | |
1253 dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, (const char *)pShopOptions[pNumString], 3); | |
1254 ++pItemNum; | |
1255 ++pNumString; | |
1256 pNumActiveItem = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; | |
1257 } | |
1258 while ( pItemNum < pNumActiveItem ); | |
1259 } | 741 } |
1260 } | 742 } |
1261 return; | 743 return; |
1262 } | 744 } |
745 | |
1263 case HOUSE_DIALOGUE_SHOP_BUY_STANDARD: | 746 case HOUSE_DIALOGUE_SHOP_BUY_STANDARD: |
1264 { | 747 { |
1265 pRenderer->DrawTextureIndexed(8, 8, ShopTexture); | 748 pRenderer->DrawTextureIndexed(8, 8, ShopTexture); |
1266 v114 = 0; | 749 for ( uint i = 0; i < 6; ++i ) |
1267 do | 750 { |
1268 { | 751 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].uItemID ) |
1269 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v114].uItemID) | 752 { |
1270 { | 753 v47 = 152 - ItemsInShopTexture[i]->uTextureHeight; |
1271 v46 = ItemsInShopTexture[v114]; | |
1272 v47 = 152 - v46->uTextureHeight; | |
1273 if ( (signed int)v47 < 1 ) | 754 if ( (signed int)v47 < 1 ) |
1274 v47 = 0; | 755 v47 = 0; |
1275 v48 = 75 * v114 - v46->uTextureWidth / 2 + 40; | 756 v48 = 75 * i - ItemsInShopTexture[i]->uTextureWidth / 2 + 40; |
1276 if ( v114 ) | 757 if ( i ) |
1277 { | 758 { |
1278 if ( v114 == 5 ) | 759 if ( i == 5 ) |
1279 { | 760 { |
1280 v49 = ItemsInShopTexture[5]->uTextureWidth; | 761 if ( (signed int)v48 > 457 - ItemsInShopTexture[5]->uTextureWidth ) |
1281 if ( (signed int)v48 > 457 - v49 ) | 762 v48 = 457 - ItemsInShopTexture[5]->uTextureWidth; |
1282 v48 = 457 - v49; | |
1283 } | 763 } |
1284 } | 764 } |
1285 else if ( (signed int)v48 < 18 ) | 765 else if ( (signed int)v48 < 18 ) |
1286 v48 = 18; | 766 v48 = 18; |
1287 pRenderer->DrawTextureTransparent(v48, v47, v46); | 767 pRenderer->DrawTextureTransparent(v48, v47, ItemsInShopTexture[i]); |
1288 ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[v48 + 640 * v47], ItemsInShopTexture[v114], v114 + 1); | 768 ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[v48 + 640 * v47], ItemsInShopTexture[i], i + 1); |
1289 } | 769 } |
1290 ++v114; | 770 } |
1291 } | 771 for ( uint i = 0; i < 6; ++i ) |
1292 while ( v114 < 6 ); | 772 { |
1293 v114 = 0; | 773 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i + 6].uItemID ) |
1294 do | 774 { |
1295 { | 775 v51 = 308 - ItemsInShopTexture[i + 6]->uTextureHeight; |
1296 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v114 + 6].uItemID) | |
1297 { | |
1298 v50 = ItemsInShopTexture[v114 + 6]; | |
1299 v51 = 308 - v50->uTextureHeight; | |
1300 if ( (signed int)v51 < 1 ) | 776 if ( (signed int)v51 < 1 ) |
1301 v51 = 0; | 777 v51 = 0; |
1302 v52 = 75 * v114 - v50->uTextureWidth / 2 + 40; | 778 v52 = 75 * i - ItemsInShopTexture[i + 6]->uTextureWidth / 2 + 40; |
1303 if ( v114 ) | 779 if ( i ) |
1304 { | 780 { |
1305 if ( v114 == 5 ) | 781 if ( i == 5 ) |
1306 { | 782 { |
1307 v53 = ItemsInShopTexture[11]->uTextureWidth; | 783 if ( (signed int)v52 > 457 - ItemsInShopTexture[11]->uTextureWidth ) |
1308 if ( (signed int)v52 > 457 - v53 ) | 784 v52 = 457 - ItemsInShopTexture[11]->uTextureWidth; |
1309 v52 = 457 - v53; | |
1310 } | 785 } |
1311 } | 786 } |
1312 else | 787 else |
1313 { | 788 { |
1314 if ( (signed int)v52 < 18 ) | 789 if ( (signed int)v52 < 18 ) |
1315 v52 = 18; | 790 v52 = 18; |
1316 } | 791 } |
1317 pRenderer->DrawTextureTransparent(v52, v51, v50); | 792 pRenderer->DrawTextureTransparent(v52, v51, ItemsInShopTexture[i + 6]); |
1318 ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[v52 + 640 * v51], ItemsInShopTexture[v114 + 6], v114 + 7); | 793 ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[v52 + 640 * v51], ItemsInShopTexture[i + 6], i + 7); |
1319 } | 794 } |
1320 ++v114; | 795 } |
1321 } | |
1322 while ( v114 < 6 ); | |
1323 if ( HouseUI_CheckIfPlayerCanInteract() ) | 796 if ( HouseUI_CheckIfPlayerCanInteract() ) |
1324 { | 797 { |
1325 v62 = 0; | 798 item_num = 0; |
1326 v109 = 0; | 799 for ( uint i = 0; i < 12; ++i ) |
1327 do | 800 { |
1328 { | 801 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].uItemID) |
1329 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v62].uItemID) | 802 ++item_num; |
1330 ++v109; | 803 } |
1331 ++v62; | 804 if ( GetAsyncKeyState(17) && pPlayers[uActiveCharacter]->CanSteal() ) |
1332 } | 805 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[185], 0); |
1333 while ( v62 < 12 ); | |
1334 v63 = GetAsyncKeyState(17); | |
1335 v64 = pPlayer->CanSteal(); | |
1336 Str = v64; | |
1337 if ( v63 && v64 ) | |
1338 { | |
1339 v65 = pGlobalTXT_LocalizationStrings[185]; | |
1340 } | |
1341 else if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_BUY_STANDARD) | |
1342 { | |
1343 v65 = pGlobalTXT_LocalizationStrings[195]; | |
1344 } | |
1345 else | 806 else |
1346 { | 807 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[195], 0); |
1347 v65 = pGlobalTXT_LocalizationStrings[196]; | 808 if ( !item_num ) |
1348 } | 809 { |
1349 DrawTextAtStatusBar(v65, 0); | 810 dialog_window.DrawCurrentTime( pParty->field_3C.Shops_next_generation_time[ (unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed); |
1350 if ( !v109 ) | |
1351 { | |
1352 dialog_window.DrawCurrentTime( pParty->PartyTimes.Shops_next_generation_time[ (unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed); | |
1353 return; | 811 return; |
1354 } | 812 } |
1355 pMouse->GetCursorPos(&v98); | 813 pMouse->GetCursorPos(&mouse); |
1356 pNumActiveItem = v98.x + pSRZBufferLineOffsets[v98.y]; | 814 if ( pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF ) |
1357 if ( pRenderer->pActiveZBuffer[pNumActiveItem] & 0xFFFF ) | 815 { |
1358 { | 816 item = &pParty->StandartItemsInShops[(int)window_SpeakInHouse->ptr_1C][(pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF) - 1]; |
1359 v67 = (pRenderer->pActiveZBuffer[pNumActiveItem] & 0xFFFF) - 1; | 817 if ( !GetAsyncKeyState(17) || !pPlayers[uActiveCharacter]->CanSteal() ) |
1360 v70 = (ItemGen *)&pParty->StandartItemsInShops[(int)window_SpeakInHouse->ptr_1C][v67]; | 818 { |
1361 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD) | 819 v71 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(item, BuildingType_AlchemistShop, (int)window_SpeakInHouse->ptr_1C, 2); |
1362 v70 = &pParty->SpecialItemsInShops[(int)window_SpeakInHouse->ptr_1C][v67];//v70 = (ItemGen *)&pParty->field_C59C[v69 + 724]; | 820 pText = BuildDialogueString((char *)pMerchantsBuyPhrases[v71], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 2, 0); |
1363 if ( !v63 || !Str ) | |
1364 { | |
1365 v71 = pPlayer->SelectPhrasesTransaction(v70, BuildingType_AlchemistShop, (int)window_SpeakInHouse->ptr_1C, 2); | |
1366 v38 = (char *)pMerchantsBuyPhrases[v71]; | |
1367 } | 821 } |
1368 else | 822 else |
1369 { | 823 pText = BuildDialogueString(pGlobalTXT_LocalizationStrings[181], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 2, 0); |
1370 v38 = pGlobalTXT_LocalizationStrings[181]; | 824 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, TargetColor(0xFFu, 0xFFu, 0xFFu), pText, 3); |
1371 } | |
1372 v21 = BuildDialogueString(v38, uActiveCharacter - 1, v70, (char *)window_SpeakInHouse->ptr_1C, 2, 0); | |
1373 v40 = pFontArrus->CalcTextHeight(v21, &dialog_window, 0, 0); | |
1374 dialog_window.DrawTitleText(pFontArrus, 0, (174 - v40) / 2 + 138, pColorWhite, v21, 3); | |
1375 return ; | 825 return ; |
1376 } | 826 } |
1377 } | 827 } |
1378 return; | 828 return; |
1379 } | 829 } |
830 | |
831 case HOUSE_DIALOGUE_SHOP_BUY_SPECIAL: | |
832 { | |
833 pRenderer->DrawTextureIndexed(8, 8, ShopTexture); | |
834 for ( uint i = 0; i < 6; ++i ) | |
835 { | |
836 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].uItemID) | |
837 { | |
838 v47 = 152 - ItemsInShopTexture[i]->uTextureHeight; | |
839 if ( (signed int)v47 < 1 ) | |
840 v47 = 0; | |
841 v48 = 75 * i - ItemsInShopTexture[i]->uTextureWidth / 2 + 40; | |
842 if ( i ) | |
843 { | |
844 if ( i == 5 ) | |
845 { | |
846 if ( (signed int)v48 > 457 - ItemsInShopTexture[5]->uTextureWidth ) | |
847 v48 = 457 - ItemsInShopTexture[5]->uTextureWidth; | |
848 } | |
849 } | |
850 else | |
851 { | |
852 if ( (signed int)v48 < 18 ) | |
853 v48 = 18; | |
854 } | |
855 pRenderer->DrawTextureTransparent(v48, v47, ItemsInShopTexture[i]); | |
856 ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[v48 + 640 * v47], ItemsInShopTexture[i], i + 1); | |
857 } | |
858 } | |
859 for ( uint i = 0; i < 6; ++i ) | |
860 { | |
861 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][(signed int)i + 6].uItemID) //not itemid | |
862 { | |
863 v51 = 308 - ItemsInShopTexture[i + 6]->uTextureHeight; | |
864 if ( (signed int)v51 < 1 ) | |
865 v51 = 0; | |
866 v52 = 75 * i - ItemsInShopTexture[i + 6]->uTextureWidth / 2 + 40; | |
867 if ( i ) | |
868 { | |
869 if ( i == 5 ) | |
870 { | |
871 if ( (signed int)v52 > 457 - ItemsInShopTexture[11]->uTextureWidth ) | |
872 v52 = 457 - ItemsInShopTexture[11]->uTextureWidth; | |
873 } | |
874 } | |
875 else | |
876 { | |
877 if ( (signed int)v52 < 18 ) | |
878 v52 = 18; | |
879 } | |
880 pRenderer->DrawTextureTransparent(v52, v51, ItemsInShopTexture[i + 6]); | |
881 ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[v52 + 640 * v51], ItemsInShopTexture[i + 6], i + 7); | |
882 } | |
883 } | |
884 if ( HouseUI_CheckIfPlayerCanInteract() ) | |
885 { | |
886 item_num = 0; | |
887 for ( uint i = 0; i < 12; ++i ) | |
888 { | |
889 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].uItemID) | |
890 ++item_num; | |
891 } | |
892 if ( GetAsyncKeyState(17) && pPlayers[uActiveCharacter]->CanSteal() ) | |
893 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[185], 0); | |
894 else | |
895 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[196], 0); | |
896 if ( !item_num ) | |
897 { | |
898 dialog_window.DrawCurrentTime( pParty->field_3C.Shops_next_generation_time[ (unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed); | |
899 return; | |
900 } | |
901 pMouse->GetCursorPos(&mouse); | |
902 if ( pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF ) | |
903 { | |
904 item = &pParty->SpecialItemsInShops[(int)window_SpeakInHouse->ptr_1C][(pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF) - 1]; | |
905 if ( !GetAsyncKeyState(17) || !pPlayers[uActiveCharacter]->CanSteal() ) | |
906 { | |
907 v71 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(item, BuildingType_AlchemistShop, (int)window_SpeakInHouse->ptr_1C, 2); | |
908 pText = BuildDialogueString((char *)pMerchantsBuyPhrases[v71], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 2, 0); | |
909 } | |
910 else | |
911 pText = BuildDialogueString(pGlobalTXT_LocalizationStrings[181], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 2, 0); | |
912 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, TargetColor(0xFFu, 0xFFu, 0xFFu), pText, 3); | |
913 return; | |
914 } | |
915 } | |
916 return; | |
917 } | |
918 | |
1380 case HOUSE_DIALOGUE_SHOP_SELL: | 919 case HOUSE_DIALOGUE_SHOP_SELL: |
1381 { | 920 { |
1382 draw_leather(); | 921 draw_leather(); |
1383 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); | 922 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); |
1384 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[199], 0); | 923 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[199], 0); |
1385 if ( !HouseUI_CheckIfPlayerCanInteract() ) | 924 if ( !HouseUI_CheckIfPlayerCanInteract() ) |
1386 return; | 925 return; |
1387 if ((v43 = pMouse->GetCursorPos(&v99)->x - 14, v109 = (v43 >> 5) + 14 * ((pMouse->GetCursorPos(&v95)->y - 17) >> 5), | 926 pMouse->GetCursorPos(&mouse); |
1388 pMouse->GetCursorPos(&v102)->x <= 13) || pMouse->GetCursorPos(&v100)->x >= 462 | 927 index = ((mouse.x - 14) >> 5) + 14 * ((mouse.y - 17) >> 5); |
1389 || (pNumActiveItem = pPlayer->GetItemIDAtInventoryIndex((int *)&v109), !pNumActiveItem) ) | 928 if ( mouse.x <= 13 || mouse.x >= 462 ) |
929 return; | |
930 if ( !pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&index) ) | |
1390 return; | 931 return; |
1391 v87 = (ItemGen *)&pPlayer->pInventoryItemList[pNumActiveItem - 1]; | 932 v71 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(&pPlayers[uActiveCharacter]->pInventoryItemList[pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&index) - 1], |
1392 v45 = pPlayer->SelectPhrasesTransaction(v87, BuildingType_AlchemistShop, (int)window_SpeakInHouse->ptr_1C, 3); | 933 BuildingType_AlchemistShop, (int)window_SpeakInHouse->ptr_1C, 3); |
1393 v21 = BuildDialogueString((char *)pMerchantsSellPhrases[v45], uActiveCharacter - 1, v87, (char *)window_SpeakInHouse->ptr_1C, 3, 0); | 934 pText = BuildDialogueString((char *)pMerchantsSellPhrases[v71], uActiveCharacter - 1, &pPlayers[uActiveCharacter]->pInventoryItemList[pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&index) - 1], |
1394 pTextHeight = pFontArrus->CalcTextHeight(v21, &dialog_window, 0, 0); | 935 (char *)window_SpeakInHouse->ptr_1C, 3, 0); |
1395 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, pColorWhite, v21, 3); | 936 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, TargetColor(0xFFu, 0xFFu, 0xFFu), pText, 3); |
1396 return; | 937 return; |
1397 } | 938 } |
939 | |
1398 case HOUSE_DIALOGUE_SHOP_IDENTIFY: | 940 case HOUSE_DIALOGUE_SHOP_IDENTIFY: |
1399 { | 941 { |
1400 draw_leather(); | 942 draw_leather(); |
1401 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); | 943 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); |
1402 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[197], 0); | 944 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[197], 0); |
1403 if ( HouseUI_CheckIfPlayerCanInteract() ) | 945 if ( HouseUI_CheckIfPlayerCanInteract() ) |
1404 return; | 946 return; |
1405 if ((v36 = pMouse->GetCursorPos(&a2)->x - 14, v109 = (v36 >> 5) + 14 * ((pMouse->GetCursorPos(&v94)->y - 17) >> 5), | 947 pMouse->GetCursorPos(&mouse); |
1406 pMouse->GetCursorPos(&v101)->x <= 13) || pMouse->GetCursorPos(&v97)->x >= 462 | 948 index = ((mouse.x - 14) >> 5) + 14 * ((mouse.y - 17) >> 5); |
1407 || (pNumActiveItem = pPlayer->GetItemIDAtInventoryIndex((int *)&v109), !pNumActiveItem) ) | 949 if ( mouse.x <= 13 || mouse.x >= 462 ) |
1408 return; | 950 return; |
1409 v37 = (ItemGen *)&pPlayer->pInventoryItemList[pNumActiveItem - 1]; | 951 if ( !pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&index) ) |
1410 if (!v37->IsIdentified()) | 952 return; |
1411 { | 953 item = &pPlayers[uActiveCharacter]->pInventoryItemList[pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&index) - 1]; |
1412 v42 = pPlayer->SelectPhrasesTransaction(v37, BuildingType_AlchemistShop, (int)window_SpeakInHouse->ptr_1C, 4); | 954 if (!item->IsIdentified()) |
1413 v38 = (char *)pMerchantsIdentifyPhrases[v42]; | 955 { |
956 v71 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(item, BuildingType_AlchemistShop, (int)window_SpeakInHouse->ptr_1C, 4); | |
957 pText = BuildDialogueString(pMerchantsIdentifyPhrases[v71], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 4, 0); | |
1414 } | 958 } |
1415 else | 959 else |
1416 { | 960 pText = BuildDialogueString("%24", uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 4, 0); |
1417 v38 = "%24"; | 961 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, TargetColor(0xFFu, 0xFFu, 0xFFu), pText, 3); |
1418 } | |
1419 v21 = BuildDialogueString(v38, uActiveCharacter - 1, v37, (char *)window_SpeakInHouse->ptr_1C, 4, 0); | |
1420 v40 = pFontArrus->CalcTextHeight(v21, &dialog_window, 0, 0); | |
1421 dialog_window.DrawTitleText(pFontArrus, 0, (174 - v40) / 2 + 138, pColorWhite, v21, 3); | |
1422 return; | 962 return; |
1423 } | 963 } |
964 | |
1424 case HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT: | 965 case HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT: |
1425 { | 966 { |
1426 draw_leather(); | 967 draw_leather(); |
1427 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); | 968 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); |
1428 pShopOptions[0] = pGlobalTXT_LocalizationStrings[200]; | 969 pShopOptions[0] = pGlobalTXT_LocalizationStrings[200]; |
1429 pShopOptions[1] = pGlobalTXT_LocalizationStrings[113]; | 970 pShopOptions[1] = pGlobalTXT_LocalizationStrings[113]; |
1430 all_text_height = 0; | 971 all_text_height = 0; |
1431 for ( int i = 0; i < 2; ++i ) | 972 for ( int i = 0; i < 2; ++i ) |
1432 all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0); | 973 all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0); |
1433 Str = (174 - all_text_height) / 2; | 974 v18 = (174 - all_text_height) / 2; |
1434 pNumActiveItem = pDialogueWindow->pStartingPosActiveItem; | 975 v105 = (2 * (87 - (174 - all_text_height) / 2) - all_text_height) / 2 - (174 - all_text_height) / 2 / 2 + 138; |
1435 v26 = pNumActiveItem + pDialogueWindow->pNumPresenceButton; | 976 pNumString = 0; |
1436 v27 = (2 * (87 - (174 - all_text_height) / 2) - all_text_height) / 2 - (174 - all_text_height) / 2 / 2 + 138; | 977 for ( int i = pDialogueWindow->pStartingPosActiveItem; |
1437 v28 = -pDialogueWindow->pNumPresenceButton < 0; | 978 i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) |
1438 if ( v28 ^ (pNumActiveItem > v26) ) | 979 { |
1439 { | 980 pButton = pDialogueWindow->GetControl(i); |
1440 pItemNum = 2; | 981 pButton->uY = v18 + v105; |
1441 pNumString = 0; | 982 pButton->uHeight = pFontArrus->CalcTextHeight((const char *)pShopOptions[pNumString], &dialog_window, 0, 0); |
1442 do | 983 v105 = pButton->uY + pFontArrus->CalcTextHeight((const char *)pShopOptions[pNumString], &dialog_window, 0, 0) - 1; |
1443 { | 984 pButton->uW = v105; |
1444 pButton = pDialogueWindow->GetControl(pItemNum); | 985 pColorText = TargetColor(0xE1u, 0xCDu, 0x23u); |
1445 pButton->uY = Str + v27; | 986 if ( pDialogueWindow->pCurrentPosActiveItem != i ) |
1446 pTextHeight = pFontArrus->CalcTextHeight((const char *)pShopOptions[pNumString], &dialog_window, 0, 0); | 987 pColorText = TargetColor(0xFFu, 0xFFu, 0xFFu); |
1447 pButton->uHeight = pTextHeight; | 988 dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, (const char *)pShopOptions[pNumString], 3); |
1448 v27 = pButton->uY + pTextHeight - 1; | 989 ++pNumString; |
1449 pButton->uW = v27; | |
1450 pColorText = pColorYellow; | |
1451 if ( pDialogueWindow->pCurrentPosActiveItem != pItemNum ) | |
1452 pColorText = pColorWhite; | |
1453 dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, (const char *)pShopOptions[pNumString], 3); | |
1454 ++pItemNum; | |
1455 ++pNumString; | |
1456 pNumActiveItem = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; | |
1457 } | |
1458 while ( pItemNum < pNumActiveItem ); | |
1459 } | 990 } |
1460 return; | 991 return; |
1461 } | 992 } |
1462 case HOUSE_DIALOGUE_SHOP_BUY_SPECIAL: | 993 |
1463 { | |
1464 pRenderer->DrawTextureIndexed(8, 8, ShopTexture); | |
1465 v114 = 0; | |
1466 do | |
1467 { | |
1468 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v114].uItemID) | |
1469 { | |
1470 v54 = ItemsInShopTexture[v114]; | |
1471 v55 = 152 - v54->uTextureHeight; | |
1472 if ( (signed int)v55 < 1 ) | |
1473 v55 = 0; | |
1474 v56 = 75 * v114 - v54->uTextureWidth / 2 + 40; | |
1475 if ( v114 ) | |
1476 { | |
1477 if ( v114 == 5 ) | |
1478 { | |
1479 v57 = ItemsInShopTexture[5]->uTextureWidth; | |
1480 if ( (signed int)v56 > 457 - v57 ) | |
1481 v56 = 457 - v57; | |
1482 } | |
1483 } | |
1484 else | |
1485 { | |
1486 if ( (signed int)v56 < 18 ) | |
1487 v56 = 18; | |
1488 } | |
1489 pRenderer->DrawTextureTransparent(v56, v55, v54); | |
1490 ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[v56 + 640 * v55], ItemsInShopTexture[v114], v114 + 1); | |
1491 } | |
1492 ++v114; | |
1493 } | |
1494 while ( v114 < 6 ); | |
1495 v114 = 0; | |
1496 do | |
1497 { | |
1498 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][(signed int)v114 + 6].uItemID) //not itemid | |
1499 { | |
1500 v58 = ItemsInShopTexture[v114 + 6]; | |
1501 v59 = 308 - v58->uTextureHeight; | |
1502 if ( (signed int)v59 < 1 ) | |
1503 v59 = 0; | |
1504 v60 = 75 * v114 - v58->uTextureWidth / 2 + 40; | |
1505 if ( v114 ) | |
1506 { | |
1507 if ( v114 == 5 ) | |
1508 { | |
1509 v61 = ItemsInShopTexture[11]->uTextureWidth; | |
1510 if ( (signed int)v60 > 457 - v61 ) | |
1511 v60 = 457 - v61; | |
1512 } | |
1513 } | |
1514 else | |
1515 { | |
1516 if ( (signed int)v60 < 18 ) | |
1517 v60 = 18; | |
1518 } | |
1519 pRenderer->DrawTextureTransparent(v60, v59, v58); | |
1520 ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[v60 + 640 * v59], ItemsInShopTexture[v114 + 6], v114 + 7); | |
1521 } | |
1522 ++v114; | |
1523 } | |
1524 while ( v114 < 6 ); | |
1525 if ( HouseUI_CheckIfPlayerCanInteract() ) | |
1526 { | |
1527 v62 = 0; | |
1528 v109 = 0; | |
1529 do | |
1530 { | |
1531 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v62].uItemID) | |
1532 ++v109; | |
1533 ++v62; | |
1534 } | |
1535 while ( v62 < 12 ); | |
1536 v63 = GetAsyncKeyState(17); | |
1537 v64 = pPlayer->CanSteal(); | |
1538 Str = v64; | |
1539 if ( v63 && v64 ) | |
1540 { | |
1541 v65 = pGlobalTXT_LocalizationStrings[185]; | |
1542 } | |
1543 else | |
1544 { | |
1545 v65 = pGlobalTXT_LocalizationStrings[195]; | |
1546 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD) | |
1547 v65 = pGlobalTXT_LocalizationStrings[196]; | |
1548 } | |
1549 DrawTextAtStatusBar(v65, 0); | |
1550 if ( !v109 ) | |
1551 { | |
1552 dialog_window.DrawCurrentTime( pParty->PartyTimes.Shops_next_generation_time[ (unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed); | |
1553 return; | |
1554 } | |
1555 v66 = pMouse->GetCursorPos(&v98); | |
1556 pNumActiveItem = v66->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v96)->y]; | |
1557 if ( pRenderer->pActiveZBuffer[pNumActiveItem] & 0xFFFF ) | |
1558 { | |
1559 v67 = (pRenderer->pActiveZBuffer[pNumActiveItem] & 0xFFFF) - 1; | |
1560 v109 = v67; | |
1561 v68 = (int)window_SpeakInHouse->ptr_1C; | |
1562 // v69 = 9 * (v67 + 12 * v68); | |
1563 v70 = (ItemGen *)&pParty->StandartItemsInShops[v68][v67]; | |
1564 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD) | |
1565 v70 = &pParty->SpecialItemsInShops[(int)v68][v67];//v70 = (ItemGen *)&pParty->field_C59C[v69 + 724]; | |
1566 if ( !v63 || !Str ) | |
1567 { | |
1568 v71 = pPlayer->SelectPhrasesTransaction(v70, BuildingType_AlchemistShop, v68, 2); | |
1569 v38 = (char *)pMerchantsBuyPhrases[v71]; | |
1570 } | |
1571 else | |
1572 { | |
1573 v38 = pGlobalTXT_LocalizationStrings[181]; | |
1574 } | |
1575 v21 = BuildDialogueString(v38, uActiveCharacter - 1, v70, (char *)window_SpeakInHouse->ptr_1C, 2, 0); | |
1576 v40 = pFontArrus->CalcTextHeight(v21, &dialog_window, 0, 0); | |
1577 dialog_window.DrawTitleText(pFontArrus, 0, (174 - v40) / 2 + 138, pColorWhite, v21, 3); | |
1578 return; | |
1579 } | |
1580 } | |
1581 return; | |
1582 } | |
1583 case HOUSE_DIALOGUE_LEARN_SKILLS: | 994 case HOUSE_DIALOGUE_LEARN_SKILLS: |
1584 { | 995 { |
1585 if (!HouseUI_CheckIfPlayerCanInteract()) | 996 if (!HouseUI_CheckIfPlayerCanInteract()) |
1586 return; | 997 return; |
1587 all_text_height = 0; | 998 all_text_height = 0; |
1588 v5 = (signed __int64)(p2DEvents[(signed int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0); | 999 v5 = (signed __int64)(p2DEvents[(signed int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0); |
1589 pItemNum = v5 * (100 - pPlayer->GetMerchant()) / 100; | 1000 pPrice = v5 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; |
1590 if ( pItemNum < v5 / 3 ) | 1001 if ( pPrice < v5 / 3 ) |
1591 pItemNum = v5 / 3; | 1002 pPrice = v5 / 3; |
1592 pNumActiveItem = pDialogueWindow->pStartingPosActiveItem; | 1003 item_num = 0; |
1593 v114 = 0; | 1004 for ( int i = pDialogueWindow->pStartingPosActiveItem; |
1594 if ( pNumActiveItem >= pNumActiveItem + pDialogueWindow->pNumPresenceButton ) | 1005 i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) |
1595 { | 1006 { |
1596 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayer->pName, pClassNames[pPlayer->classType]); | 1007 pButton = pDialogueWindow->GetControl(i); |
1008 if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][pButton->msg_param - 36] | |
1009 && !pPlayers[uActiveCharacter]->pActiveSkills[pButton->msg_param - 36] ) | |
1010 { | |
1011 all_text_height = pFontArrus->CalcTextHeight(pSkillNames[pButton->msg_param - 36], &dialog_window, 0, 0); | |
1012 ++item_num; | |
1013 } | |
1014 } | |
1015 if ( !item_num ) | |
1016 { | |
1017 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]); | |
1597 strcat(pTmpBuf.data(), "\n \n"); | 1018 strcat(pTmpBuf.data(), "\n \n"); |
1598 strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]); | 1019 strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]); |
1599 v40 = pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 0, 0); | 1020 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 0, 0)) / 2 + 138, TargetColor(0xE1u, 0xCDu, 0x23u), pTmpBuf.data(), 3); |
1600 dialog_window.DrawTitleText(pFontArrus, 0, (174 - v40) / 2 + 138, pColorYellow, pTmpBuf.data(), 3); | 1021 return; |
1601 return; | 1022 } |
1602 } | 1023 if ( item_num ) |
1603 do | 1024 { |
1604 { | 1025 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[401], pPrice); |
1605 v8 = pDialogueWindow->GetControl(pNumActiveItem)->msg_param - 36; | |
1606 if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayer->classType][v8] && !pPlayer->pActiveSkills[v8] ) | |
1607 { | |
1608 all_text_height = pFontArrus->CalcTextHeight(pSkillNames[v8], &dialog_window, 0, 0); | |
1609 ++v114; | |
1610 } | |
1611 ++pNumActiveItem; | |
1612 } | |
1613 while ( pNumActiveItem < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem ); | |
1614 if ( !v114 ) | |
1615 { | |
1616 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayer->pName, pClassNames[pPlayer->classType]); | |
1617 strcat(pTmpBuf.data(), "\n \n"); | |
1618 strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]); | |
1619 v40 = pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 0, 0); | |
1620 dialog_window.DrawTitleText(pFontArrus, 0, (174 - v40) / 2 + 138, pColorYellow, pTmpBuf.data(), 3); | |
1621 return; | |
1622 } | |
1623 if ( v114 ) | |
1624 { | |
1625 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[401], pItemNum); | |
1626 dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3); | 1026 dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3); |
1627 v18 = (149 - all_text_height) / v114; | 1027 v18 = (149 - all_text_height) / item_num; |
1628 if ( (149 - all_text_height) / v114 > 32 ) | 1028 if ( (149 - all_text_height) / item_num > 32 ) |
1629 v18 = 32; | 1029 v18 = 32; |
1630 pNumActiveItem = pDialogueWindow->pStartingPosActiveItem; | 1030 v105 = (149 - item_num * v18 - all_text_height) / 2 - v18 / 2 + 162; |
1631 v105 = (149 - v114 * v18 - all_text_height) / 2 - v18 / 2 + 162; | 1031 for ( int i = pDialogueWindow->pStartingPosActiveItem; |
1632 if ( pNumActiveItem < pNumActiveItem + pDialogueWindow->pNumPresenceButton ) | 1032 i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; i++ ) |
1633 { | 1033 { |
1634 pItemNum = 2; | 1034 pButton = pDialogueWindow->GetControl(i); |
1635 do | 1035 if ( !byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][pButton->msg_param - 36] |
1636 { | 1036 || pPlayers[uActiveCharacter]->pActiveSkills[pButton->msg_param - 36] ) |
1637 pButton = pDialogueWindow->GetControl(pItemNum); | 1037 { |
1638 v13 = pButton->msg_param - 36; | 1038 pButton->uW = 0; |
1639 if ( !byte_4ED970_skill_learn_ability_by_class_table[pPlayer->classType][v13] || pPlayer->pActiveSkills[v13] ) | 1039 pButton->uHeight = 0; |
1640 { | 1040 pButton->uY = 0; |
1641 pButton->uW = 0; | 1041 } |
1642 pButton->uHeight = 0; | 1042 else |
1643 pButton->uY = 0; | 1043 { |
1644 } | 1044 pButton->uY = v18 + v105; |
1645 else | 1045 pButton->uHeight = pFontArrus->CalcTextHeight(pSkillNames[pButton->msg_param - 36], &dialog_window, 0, 0); |
1646 { | 1046 v105 = pButton->uY + pFontArrus->CalcTextHeight(pSkillNames[pButton->msg_param - 36], &dialog_window, 0, 0) - 1; |
1647 pButton->uY = v18 + v105; | 1047 pButton->uW = v105; |
1648 pTextHeight = pFontArrus->CalcTextHeight(pSkillNames[v13], &dialog_window, 0, 0); | 1048 pColorText = TargetColor(0xE1u, 0xCDu, 0x23u); |
1649 pButton->uHeight = pTextHeight; | 1049 if ( pDialogueWindow->pCurrentPosActiveItem != i ) |
1650 v105 = pButton->uY + pTextHeight - 1; | 1050 pColorText = TargetColor(0xFFu, 0xFFu, 0xFFu); |
1651 pButton->uW = v105; | 1051 dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, pSkillNames[pButton->msg_param - 36], 3); |
1652 pColorText = pColorYellow; | 1052 } |
1653 if ( pDialogueWindow->pCurrentPosActiveItem != pItemNum ) | |
1654 pColorText = pColorWhite; | |
1655 dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, pSkillNames[v13], 3); | |
1656 } | |
1657 pNumActiveItem = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; | |
1658 pItemNum++; | |
1659 } | |
1660 while ( pItemNum < pNumActiveItem ); | |
1661 } | 1053 } |
1662 return; | 1054 return; |
1663 } | 1055 } |
1664 } | 1056 } |
1665 default: | 1057 default: |
1666 { | 1058 __debugbreak(); |
1667 return;// (POINT *)dialog_menu_id - 96; | |
1668 } | |
1669 } | 1059 } |
1670 } | 1060 } |
1061 | |
1671 //----- (004B4FCF) -------------------------------------------------------- | 1062 //----- (004B4FCF) -------------------------------------------------------- |
1672 void MagicShopDialog() | 1063 void MagicShopDialog() |
1673 { | 1064 { |
1674 int result; // eax@6 | 1065 int result; // eax@6 |
1675 signed int v2; // esi@8 | 1066 signed int v2; // esi@8 |
1928 v69 = pGlobalTXT_LocalizationStrings[196];// "Select the Special Item to Buy" | 1319 v69 = pGlobalTXT_LocalizationStrings[196];// "Select the Special Item to Buy" |
1929 } | 1320 } |
1930 DrawTextAtStatusBar(v69, 0); | 1321 DrawTextAtStatusBar(v69, 0); |
1931 if ( !v117 ) | 1322 if ( !v117 ) |
1932 { | 1323 { |
1933 dialog_window.DrawCurrentTime( pParty->PartyTimes.Shops_next_generation_time[(unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed); | 1324 dialog_window.DrawCurrentTime( pParty->field_3C.Shops_next_generation_time[(unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed); |
1934 return; | 1325 return; |
1935 } | 1326 } |
1936 v70 = pMouse->GetCursorPos(&v102); | 1327 v70 = pMouse->GetCursorPos(&v102); |
1937 result = v70->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v100)->y]; | 1328 result = v70->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v100)->y]; |
1938 if ( pRenderer->pActiveZBuffer[result] & 0xFFFF ) | 1329 if ( pRenderer->pActiveZBuffer[result] & 0xFFFF ) |
2059 v69 = pGlobalTXT_LocalizationStrings[196];// "Select the Special Item to Buy" | 1450 v69 = pGlobalTXT_LocalizationStrings[196];// "Select the Special Item to Buy" |
2060 } | 1451 } |
2061 DrawTextAtStatusBar(v69, 0); | 1452 DrawTextAtStatusBar(v69, 0); |
2062 if ( !v117 ) | 1453 if ( !v117 ) |
2063 { | 1454 { |
2064 dialog_window.DrawCurrentTime( pParty->PartyTimes.Shops_next_generation_time[(unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed); | 1455 dialog_window.DrawCurrentTime( pParty->field_3C.Shops_next_generation_time[(unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed); |
2065 return; | 1456 return; |
2066 } | 1457 } |
2067 v70 = pMouse->GetCursorPos(&v102); | 1458 v70 = pMouse->GetCursorPos(&v102); |
2068 result = v70->x + pSRZBufferLineOffsets[v70->y]; | 1459 result = v70->x + pSRZBufferLineOffsets[v70->y]; |
2069 if ( pRenderer->pActiveZBuffer[result] & 0xFFFF ) | 1460 if ( pRenderer->pActiveZBuffer[result] & 0xFFFF ) |
2665 return; | 2056 return; |
2666 } | 2057 } |
2667 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_Greeting_2); | 2058 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_Greeting_2); |
2668 return; | 2059 return; |
2669 } | 2060 } |
2670 if ( (signed __int64)pParty->PartyTimes._shop_ban_times[(unsigned int)window_SpeakInHouse->ptr_1C]<= (signed __int64)pParty->uTimePlayed ) | 2061 if ( (signed __int64)pParty->field_3C._shop_ban_times[(unsigned int)window_SpeakInHouse->ptr_1C]<= (signed __int64)pParty->uTimePlayed ) |
2671 { | 2062 { |
2672 if ( pParty->uNumGold <= 10000 ) | 2063 if ( pParty->uNumGold <= 10000 ) |
2673 { | 2064 { |
2674 if ( !dword_F8B1E4 ) | 2065 if ( !dword_F8B1E4 ) |
2675 return; | 2066 return; |