Mercurial > mm7
annotate UI/UIShops.cpp @ 1739:1776d4f033a7
WeaponShop cleared
author | Ritor1 |
---|---|
date | Fri, 27 Sep 2013 15:19:32 +0600 |
parents | f44b6e02e81c |
children | 4b0e19d91505 |
rev | line source |
---|---|
1300 | 1 #include "..\Items.h" |
2 #include "..\GUIWindow.h" | |
3 #include "..\mm7_data.h" | |
4 #include "..\texts.h" | |
5 #include "UIHouses.h" | |
6 #include "..\GUIFont.h" | |
7 #include "..\Render.h" | |
8 #include "..\Party.h" | |
9 #include "..\Texture.h" | |
10 #include "..\Mouse.h" | |
11 #include "..\Events2D.h" | |
12 #include "..\AudioPlayer.h" | |
13 #include "..\MapInfo.h" | |
14 #include "..\Viewport.h" | |
15 | |
16 //----- (004B910F) -------------------------------------------------------- | |
1458 | 17 void WeaponShopDialog() |
1300 | 18 { |
1739 | 19 int phrases_id; // eax@16 |
1300 | 20 int v19; // edi@25 |
21 GUIButton *pButton; // esi@27 | |
22 unsigned int pColorText; // ax@27 | |
23 signed int v32; // esi@41 | |
1739 | 24 const char *pText; // ecx@84 |
1300 | 25 int all_text_height; // esi@96 |
1739 | 26 ItemGen *item; |
27 int pItemID; | |
28 POINT mouse; // [sp+64h] [bp-94h]@8 | |
1300 | 29 GUIWindow dialog_window; // [sp+7Ch] [bp-7Ch]@1 |
30 __int32 v103; // [sp+D4h] [bp-24h]@25 | |
1739 | 31 int pPrice; // [sp+ECh] [bp-Ch]@26 |
32 unsigned int v109; | |
1300 | 33 int pNumString; |
1739 | 34 int item_X; |
1300 | 35 |
36 memcpy(&dialog_window, window_SpeakInHouse, sizeof(dialog_window)); | |
37 dialog_window.uFrameX = 483; | |
38 dialog_window.uFrameWidth = 148; | |
39 dialog_window.uFrameZ = 334; | |
40 | |
41 switch(dialog_menu_id) | |
42 { | |
43 case HOUSE_DIALOGUE_MAIN: | |
44 { | |
1739 | 45 if ( HouseUI_CheckIfPlayerCanInteract() ) |
1300 | 46 { |
47 pShopOptions[0] = pGlobalTXT_LocalizationStrings[134]; | |
48 pShopOptions[1] = pGlobalTXT_LocalizationStrings[152]; | |
49 pShopOptions[2] = pGlobalTXT_LocalizationStrings[159]; | |
50 pShopOptions[3] = pGlobalTXT_LocalizationStrings[160]; | |
51 all_text_height = 0; | |
1739 | 52 for ( int i = 0; i < 4; ++i ) |
1300 | 53 all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0); |
54 v103 = (174 - all_text_height) / 4; | |
55 v19 = (174 - 4 * (174 - all_text_height) / 4 - all_text_height) / 2 - (174 - all_text_height) / 4 / 2 + 138; | |
1739 | 56 pNumString = 0; |
57 for ( uint i = pDialogueWindow->pStartingPosActiveItem; i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) | |
58 { | |
59 pButton = pDialogueWindow->GetControl(i); | |
60 pButton->uY = v103 + v19; | |
61 pButton->uHeight = pFontArrus->CalcTextHeight((const char *)pShopOptions[pNumString], &dialog_window, 0, 0); | |
62 v19 = pButton->uY + pFontArrus->CalcTextHeight((const char *)pShopOptions[pNumString], &dialog_window, 0, 0) - 1; | |
63 pButton->uW = v19; | |
64 pColorText = TargetColor(0xE1u, 0xCDu, 0x23u); | |
65 if ( pDialogueWindow->pCurrentPosActiveItem != i ) | |
66 pColorText = TargetColor(0xFFu, 0xFFu, 0xFFu); | |
67 dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, (const char *)pShopOptions[pNumString], 3); | |
68 ++pNumString; | |
69 } | |
70 } | |
71 break; | |
72 } | |
73 case HOUSE_DIALOGUE_SHOP_BUY_STANDARD: | |
74 { | |
75 pRenderer->DrawTextureIndexed(8, 8, ShopTexture); | |
76 item_X = 0; | |
77 for ( uint i = 0; i < 6; ++i ) | |
78 { | |
79 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].uItemID) | |
1300 | 80 { |
1739 | 81 pRenderer->DrawTextureTransparent((60 - ((signed int)ItemsInShopTexture[i]->uTextureWidth / 2)) + item_X, weapons_Ypos[i] + 30, ItemsInShopTexture[i]); |
82 ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[(60 - ((signed int)ItemsInShopTexture[i]->uTextureWidth / 2)) + item_X + 640 * (weapons_Ypos[i] + 30)], ItemsInShopTexture[i], i + 1); | |
83 } | |
84 item_X += 70; | |
85 } | |
86 if ( HouseUI_CheckIfPlayerCanInteract() ) | |
87 { | |
88 uint item_num = 0; | |
89 for ( uint i = 0; i < 6; ++i ) | |
90 { | |
91 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].uItemID) | |
92 ++item_num; | |
93 } | |
94 if ( GetAsyncKeyState(17) && pPlayers[uActiveCharacter]->CanSteal() ) | |
95 pText = pGlobalTXT_LocalizationStrings[185];//Украсть предмет | |
96 else | |
97 { | |
98 pText = pGlobalTXT_LocalizationStrings[195];//Выберите предмет для покупки | |
99 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD) | |
100 pText = pGlobalTXT_LocalizationStrings[196];//Выберите особый предмет для покупки | |
101 } | |
102 DrawTextAtStatusBar(pText, 0); | |
103 if ( item_num ) | |
104 { | |
105 pMouse->GetCursorPos(&mouse); | |
106 if ( pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF ) | |
1300 | 107 { |
1739 | 108 item = &pParty->StandartItemsInShops[(int)window_SpeakInHouse->ptr_1C][(pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF) - 1]; |
109 if ( !GetAsyncKeyState(17) || !pPlayers[uActiveCharacter]->CanSteal() ) | |
110 { | |
111 pText = BuildDialogueString((char *)pMerchantsBuyPhrases[pPlayers[uActiveCharacter]->SelectPhrasesTransaction(item, BuildingType_WeaponShop, (int)window_SpeakInHouse->ptr_1C, 2)], | |
112 uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 2, 0); | |
113 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, TargetColor(0xFFu, 0xFFu, 0xFFu), pText, 3); | |
114 } | |
115 else | |
116 { | |
117 pText = BuildDialogueString(pGlobalTXT_LocalizationStrings[181], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 2, 0); | |
118 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, TargetColor(0xFFu, 0xFFu, 0xFFu), pText, 3); | |
119 } | |
1300 | 120 } |
121 } | |
1739 | 122 else |
123 dialog_window.DrawCurrentTime( pParty->field_3C.Shops_next_generation_time[(unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed);//Приходите через 7 дней | |
1300 | 124 } |
125 break; | |
126 } | |
127 | |
1739 | 128 case HOUSE_DIALOGUE_SHOP_BUY_SPECIAL: |
1300 | 129 { |
130 pRenderer->DrawTextureIndexed(8, 8, ShopTexture); | |
1739 | 131 item_X = 0; |
132 for ( uint i = 0; i < 6; ++i ) | |
1300 | 133 { |
1739 | 134 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].uItemID) |
1300 | 135 { |
1739 | 136 pRenderer->DrawTextureTransparent((60 - ((signed int)ItemsInShopTexture[i]->uTextureWidth / 2)) + item_X, weapons_Ypos[i] + 30, ItemsInShopTexture[i]); |
137 ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[(60 - ((signed int)ItemsInShopTexture[i]->uTextureWidth / 2)) + item_X + 640 * (weapons_Ypos[i] + 30)], ItemsInShopTexture[i], i + 1); | |
1300 | 138 } |
1739 | 139 item_X += 70; |
1300 | 140 } |
1739 | 141 if ( HouseUI_CheckIfPlayerCanInteract() ) |
1300 | 142 { |
1739 | 143 uint item_num = 0; |
144 for ( uint i = 0; i < 6; ++i ) | |
1300 | 145 { |
1739 | 146 if ( pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].uItemID ) |
147 ++item_num; | |
1300 | 148 } |
1739 | 149 if ( GetAsyncKeyState(17) && pPlayers[uActiveCharacter]->CanSteal() ) |
150 pText = pGlobalTXT_LocalizationStrings[185]; | |
1300 | 151 else |
152 { | |
1739 | 153 pText = pGlobalTXT_LocalizationStrings[195]; |
1300 | 154 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD) |
1739 | 155 pText = pGlobalTXT_LocalizationStrings[196]; |
1300 | 156 } |
1739 | 157 DrawTextAtStatusBar(pText, 0); |
158 if ( item_num ) | |
1300 | 159 { |
1739 | 160 pMouse->GetCursorPos(&mouse); |
161 if ( pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF ) | |
1300 | 162 { |
1739 | 163 item = &pParty->SpecialItemsInShops[(int)window_SpeakInHouse->ptr_1C][(pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF) - 1]; |
164 if ( !GetAsyncKeyState(17) || !pPlayers[uActiveCharacter]->CanSteal() ) | |
1300 | 165 { |
1739 | 166 pText = BuildDialogueString((char *)pMerchantsBuyPhrases[pPlayers[uActiveCharacter]->SelectPhrasesTransaction(item, BuildingType_WeaponShop, (int)window_SpeakInHouse->ptr_1C, 2)], |
167 uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 2, 0); | |
168 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, TargetColor(0xFFu, 0xFFu, 0xFFu), pText, 3); | |
1300 | 169 } |
170 else | |
171 { | |
1739 | 172 pText = BuildDialogueString(pGlobalTXT_LocalizationStrings[181], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 2, 0); |
173 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, TargetColor(0xFFu, 0xFFu, 0xFFu), pText, 3); | |
1300 | 174 } |
175 } | |
176 } | |
177 else | |
1739 | 178 dialog_window.DrawCurrentTime( pParty->field_3C.Shops_next_generation_time[(unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed); |
1300 | 179 } |
180 break; | |
181 } | |
182 | |
183 case HOUSE_DIALOGUE_SHOP_SELL: | |
184 { | |
185 draw_leather(); | |
186 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); | |
187 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[199], 0); | |
1393 | 188 if ( !HouseUI_CheckIfPlayerCanInteract() ) |
1300 | 189 return; |
1739 | 190 pMouse->GetCursorPos(&mouse); |
191 v109 = ((mouse.x + 14) >> 5) + 14 * ((mouse.y - 17) >> 5); | |
192 if( mouse.x <= 13 || mouse.x >= 462 ) | |
1300 | 193 return; |
1739 | 194 pItemID = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v109); |
195 if ( !pItemID ) | |
196 return; | |
197 item = &pPlayers[uActiveCharacter]->pInventoryItemList[pItemID - 1]; | |
198 phrases_id = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(item, BuildingType_WeaponShop, (int)window_SpeakInHouse->ptr_1C, 3); | |
199 pText = BuildDialogueString((char *)pMerchantsSellPhrases[phrases_id], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 3, 0); | |
200 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, TargetColor(0xFFu, 0xFFu, 0xFFu), pText, 3); | |
1300 | 201 break; |
202 } | |
203 case HOUSE_DIALOGUE_SHOP_IDENTIFY: | |
204 { | |
205 draw_leather(); | |
206 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); | |
207 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[197], 0); | |
1393 | 208 if ( !HouseUI_CheckIfPlayerCanInteract() ) |
1300 | 209 return; |
1739 | 210 pMouse->GetCursorPos(&mouse); |
211 v109 = ((mouse.x - 14) >> 5) + 14 * ((mouse.y - 17) >> 5); | |
212 if( mouse.x <= 13 || mouse.x >= 462 ) | |
213 return; | |
214 pItemID = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v109); | |
215 if ( !pItemID ) | |
1300 | 216 return; |
1739 | 217 item = &pPlayers[uActiveCharacter]->pInventoryItemList[pItemID - 1]; |
218 if (!item->IsIdentified()) | |
1300 | 219 { |
1739 | 220 phrases_id = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(item, BuildingType_WeaponShop, (int)window_SpeakInHouse->ptr_1C, 4); |
221 pText = BuildDialogueString((char *)pMerchantsIdentifyPhrases[phrases_id], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 4, 0); | |
222 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, TargetColor(0xFFu, 0xFFu, 0xFFu), pText, 3); | |
1300 | 223 } |
224 else | |
225 { | |
1739 | 226 pText = BuildDialogueString("%24", uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 4, 0); |
227 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, TargetColor(0xFFu, 0xFFu, 0xFFu), pText, 3); | |
1300 | 228 } |
229 break; | |
230 } | |
231 | |
232 case HOUSE_DIALOGUE_SHOP_REPAIR: | |
233 { | |
234 draw_leather(); | |
235 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); | |
236 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[198], 0); | |
1393 | 237 if ( !HouseUI_CheckIfPlayerCanInteract()) |
1739 | 238 return; |
239 pMouse->GetCursorPos(&mouse); | |
240 v109 = ((mouse.x - 14) >> 5) + 14 * (mouse.y - 17) >> 5; | |
241 if( ( mouse.x <= 13) || mouse.x >= 462 ) | |
242 return; | |
243 pItemID = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v109); | |
244 if ( !pItemID || (!(pPlayers[uActiveCharacter]->pOwnItems[pItemID - 1].uAttributes & 2)) ) | |
245 return; | |
246 item = &pPlayers[uActiveCharacter]->pInventoryItemList[pItemID - 1]; | |
247 phrases_id = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(item, BuildingType_ArmorShop, (int)window_SpeakInHouse->ptr_1C, 5); | |
248 pText = BuildDialogueString((char *)pMerchantsRepairPhrases[phrases_id], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 5, 0); | |
249 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, TargetColor(0xFFu, 0xFFu, 0xFFu), pText, 3); | |
1300 | 250 return; |
251 } | |
252 break; | |
253 | |
254 case HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT: | |
255 { | |
256 draw_leather(); | |
257 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); | |
258 pShopOptions[0] = pGlobalTXT_LocalizationStrings[200];//sell | |
259 pShopOptions[1] = pGlobalTXT_LocalizationStrings[113];//identify | |
260 pShopOptions[2] = pGlobalTXT_LocalizationStrings[179];//repair | |
261 all_text_height = 0; | |
262 for ( int i = 0; i < 3; ++i ) | |
263 all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0); | |
264 v103 = (174 - all_text_height) / 3; | |
1739 | 265 v19 = (3 * (58 - (signed int)v103) - all_text_height) / 2 - ((174 - all_text_height) / 3) / 2 + 138; |
266 pNumString = 0; | |
267 for ( uint i = pDialogueWindow->pStartingPosActiveItem; i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) | |
1300 | 268 { |
1739 | 269 pButton = pDialogueWindow->GetControl(i); |
270 pButton->uY = v103 + v19; | |
271 pButton->uHeight = pFontArrus->CalcTextHeight((const char *)pShopOptions[pNumString], &dialog_window, 0, 0); | |
272 v19 = pButton->uY + pFontArrus->CalcTextHeight((const char *)pShopOptions[pNumString], &dialog_window, 0, 0) - 1; | |
273 pButton->uW = v19; | |
274 pColorText = TargetColor(0xE1u, 0xCDu, 0x23u); | |
275 if ( pDialogueWindow->pCurrentPosActiveItem != i ) | |
276 pColorText = TargetColor(0xFFu, 0xFFu, 0xFFu); | |
277 dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, (const char *)pShopOptions[pNumString], 3); | |
278 ++pNumString; | |
1300 | 279 } |
280 break; | |
281 } | |
282 | |
283 case HOUSE_DIALOGUE_LEARN_SKILLS: | |
284 { | |
1393 | 285 if (!HouseUI_CheckIfPlayerCanInteract()) |
1300 | 286 return; |
1739 | 287 uint item_num = 0; |
1300 | 288 all_text_height = 0; |
289 v32 = (signed __int64)(p2DEvents[(signed int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0); | |
1739 | 290 pPrice = v32 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; |
291 if ( pPrice < v32 / 3 ) | |
292 pPrice = v32 / 3; | |
293 for ( uint i = pDialogueWindow->pStartingPosActiveItem; | |
294 i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) | |
1300 | 295 { |
1739 | 296 if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][pDialogueWindow->GetControl(i)->msg_param - 36] |
297 && !pPlayers[uActiveCharacter]->pActiveSkills[pDialogueWindow->GetControl(i)->msg_param - 36] ) | |
1300 | 298 { |
1739 | 299 all_text_height += pFontArrus->CalcTextHeight(pSkillNames[pDialogueWindow->GetControl(i)->msg_param - 36], &dialog_window, 0, 0); |
300 item_num++; | |
1300 | 301 } |
302 } | |
1739 | 303 if ( item_num ) |
1300 | 304 { |
1739 | 305 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[401], pPrice);//Стоимость навыка: %lu |
306 dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3); | |
307 v103 = (149 - all_text_height) / item_num; | |
308 if ( (149 - all_text_height) / item_num > 32 ) | |
309 v103 = 32; | |
310 v19 = (149 - item_num * v103 - all_text_height) / 2 - v103 / 2 + 162; | |
311 for ( uint i = pDialogueWindow->pStartingPosActiveItem; | |
312 i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) | |
1300 | 313 { |
1739 | 314 pButton = pDialogueWindow->GetControl(i); |
315 if ( !byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][pButton->msg_param - 36] || pPlayers[uActiveCharacter]->pActiveSkills[pButton->msg_param - 36] ) | |
1300 | 316 { |
317 pButton->uW = 0; | |
318 pButton->uHeight = 0; | |
319 pButton->uY = 0; | |
320 } | |
321 else | |
322 { | |
1739 | 323 pButton->uY = v103 + v19; |
324 pButton->uHeight = pFontArrus->CalcTextHeight(pSkillNames[pButton->msg_param - 36], &dialog_window, 0, 0); | |
325 v19 = pButton->uY + pFontArrus->CalcTextHeight(pSkillNames[pButton->msg_param - 36], &dialog_window, 0, 0) - 1; | |
326 pButton->uW = v19; | |
327 pColorText = TargetColor(0xE1u, 0xCDu, 0x23u); | |
328 if ( pDialogueWindow->pCurrentPosActiveItem != i ) | |
329 pColorText = TargetColor(0xFFu, 0xFFu, 0xFFu); | |
330 dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, pSkillNames[pButton->msg_param - 36], 3); | |
1300 | 331 } |
332 } | |
1739 | 333 break; |
1300 | 334 } |
1739 | 335 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]); |
336 strcat(pTmpBuf.data(), "\n \n"); | |
337 strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]);//Больше ничего не могу предложить. | |
338 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 0, 0)) / 2 + 138, TargetColor(0xE1u, 0xCDu, 0x23u), pTmpBuf.data(), 3); | |
339 return; | |
1300 | 340 } |
341 default: | |
342 { | |
1739 | 343 __debugbreak(); |
1300 | 344 break; |
345 } | |
346 } | |
347 } | |
348 | |
349 //----- (004BA928) -------------------------------------------------------- | |
1458 | 350 void ArmorShopDialog() |
1300 | 351 { |
352 signed int v1; // esi@8 | |
353 unsigned int v2; // eax@10 | |
354 ItemGen *v3; // eax@11 | |
355 char *v5; // ecx@12 | |
356 char *v6; // eax@13 | |
357 int v8; // eax@15 | |
358 signed int v9; // esi@17 | |
359 unsigned int v10; // eax@19 | |
360 char *v11; // edi@19 | |
361 int v12; // ST08_4@20 | |
362 int v13; // eax@20 | |
363 char *v15; // ecx@20 | |
364 char **v16; // edi@22 | |
365 int all_text_height; // ebx@22 | |
366 char **v18; // esi@22 | |
367 int v19; // eax@23 | |
368 GUIWindow *v20; // ecx@24 | |
369 int v21; // eax@24 | |
370 int v22; // edx@24 | |
371 int v23; // ebx@24 | |
372 unsigned __int8 v24; // sf@24 | |
373 GUIButton *pButton; // eax@26 | |
374 unsigned int v28; // ecx@26 | |
375 int v29; // edx@26 | |
376 signed int v31; // esi@31 | |
377 unsigned int v32; // eax@33 | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1411
diff
changeset
|
378 //int v33; // eax@34 |
1300 | 379 int v35; // eax@35 |
380 char *v36; // edx@36 | |
381 signed int v38; // esi@42 | |
382 unsigned int v39; // esi@44 | |
383 int v40; // eax@44 | |
384 unsigned int v41; // eax@45 | |
385 int v42; // eax@47 | |
386 int v43; // ecx@52 | |
387 int v46; // eax@54 | |
388 unsigned int v49; // ecx@56 | |
389 int v51; // eax@56 | |
390 int v53; // eax@60 | |
391 int textureH; // eax@60 | |
392 signed int textureW; // ebx@65 | |
393 Texture *v56; // eax@67 | |
394 unsigned int pY_item; // edi@68 | |
395 Texture *v58; // ST1C_4@68 | |
396 int v59; // eax@68 | |
397 int v60; // edi@69 | |
398 signed int v61; // ebx@73 | |
399 Texture *v62; // eax@75 | |
400 int v63; // edi@76 | |
401 Texture *v64; // ST1C_4@76 | |
402 unsigned int v65; // ST18_4@76 | |
403 int v66; // eax@76 | |
404 int v67; // edi@77 | |
405 signed int v68; // ecx@81 | |
406 const char *pStatusText; // ecx@91 | |
407 void *v72; // eax@95 | |
408 POINT *v73; // esi@97 | |
409 int v74; // ecx@97 | |
410 int v75; // eax@98 | |
411 int v76; // ecx@98 | |
412 ItemGen *selected_item; // ecx@99 | |
413 unsigned __int8 v78; // bl@104 | |
414 int v80; // ebx@105 | |
415 char **v81; // esi@105 | |
416 int v82; // eax@106 | |
417 int v86; // ebx@107 | |
418 int pTextHeight; // eax@109 | |
419 unsigned int v90; // ecx@109 | |
420 int pNumString; // edx@109 | |
421 unsigned __int16 pTextColor; // ax@109 | |
422 signed int v93; // edx@114 | |
423 POINT *v94; // edi@120 | |
424 __int32 v95; // ecx@120 | |
425 void *v96; // ST14_4@122 | |
426 unsigned __int8 v97; // bl@122 | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1411
diff
changeset
|
427 //ItemGen *v98; // ST10_4@122 |
1300 | 428 int v99; // eax@122 |
429 char *v100; // eax@122 | |
430 const char *v101; // ST18_4@122 | |
431 unsigned __int16 v102; // ST14_2@122 | |
432 int v103; // eax@122 | |
433 signed int v104; // edi@123 | |
434 Texture *v105; // eax@125 | |
435 int v106; // ebx@126 | |
436 unsigned int v108; // ST18_4@126 | |
437 int v109; // eax@126 | |
438 int v110; // ebx@127 | |
439 GUIWindow *v111; // [sp-18h] [bp-11Ch]@36 | |
440 unsigned int v112; // [sp-14h] [bp-118h]@13 | |
441 int v113; // [sp-14h] [bp-118h]@36 | |
442 unsigned int v115; // [sp-10h] [bp-114h]@13 | |
443 ItemGen *v116; // [sp-10h] [bp-114h]@20 | |
444 int v117; // [sp-10h] [bp-114h]@36 | |
445 unsigned __int16 v119; // [sp-Ch] [bp-110h]@13 | |
446 char *v121; // [sp-8h] [bp-10Ch]@13 | |
447 int v122; // [sp-8h] [bp-10Ch]@20 | |
448 unsigned int v123; // [sp-4h] [bp-108h]@13 | |
449 __int64 *v124; // [sp-4h] [bp-108h]@20 | |
450 int v125; // [sp-4h] [bp-108h]@68 | |
451 int v126; // [sp-4h] [bp-108h]@76 | |
452 int v127; // [sp-4h] [bp-108h]@126 | |
453 POINT v128; // [sp+Ch] [bp-F8h]@8 | |
454 POINT v129; // [sp+14h] [bp-F0h]@18 | |
455 char v130; // [sp+1Ch] [bp-E8h]@120 | |
456 POINT a2; // [sp+24h] [bp-E0h]@8 | |
457 POINT v132; // [sp+2Ch] [bp-D8h]@120 | |
458 POINT v133; // [sp+34h] [bp-D0h]@17 | |
459 POINT v134; // [sp+3Ch] [bp-C8h]@97 | |
460 POINT v135; // [sp+44h] [bp-C0h]@31 | |
461 POINT v136; // [sp+4Ch] [bp-B8h]@97 | |
462 POINT v137; // [sp+54h] [bp-B0h]@17 | |
463 POINT v138; // [sp+5Ch] [bp-A8h]@32 | |
464 POINT v139; // [sp+64h] [bp-A0h]@17 | |
465 POINT v140; // [sp+6Ch] [bp-98h]@31 | |
466 POINT v141; // [sp+74h] [bp-90h]@8 | |
467 POINT v142; // [sp+7Ch] [bp-88h]@31 | |
468 POINT v143; // [sp+84h] [bp-80h]@9 | |
469 GUIWindow dialog_window; // [sp+8Ch] [bp-78h]@1 | |
470 int v146; // [sp+E4h] [bp-20h]@24 | |
471 int pYellowColor; // [sp+E8h] [bp-1Ch]@1 | |
472 int pWhiteColor; // [sp+ECh] [bp-18h]@1 | |
473 __int32 pItemCount; // [sp+F0h] [bp-14h]@8 | |
474 int v152; // [sp+FCh] [bp-8h]@24 | |
475 int v153; // [sp+100h] [bp-4h]@44 | |
476 int th; | |
477 short text_color; | |
478 int pActiveButton; | |
479 | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1411
diff
changeset
|
480 //__debugbreak(); // uishops.cpp(952): warning C4700: uninitialized local variable 'v33' used |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1411
diff
changeset
|
481 //__debugbreak(); // uishops.cpp(981): warning C4700: uninitialized local variable 'v98' used |
1300 | 482 memcpy(&dialog_window, window_SpeakInHouse, sizeof(dialog_window)); |
483 dialog_window.uFrameX = 483; | |
484 dialog_window.uFrameWidth = 148; | |
485 dialog_window.uFrameZ = 334; | |
486 pWhiteColor = TargetColor(0xFFu, 0xFFu, 0xFFu); | |
487 pYellowColor = TargetColor(0xE1u, 0xCDu, 0x23u); | |
488 switch (dialog_menu_id) | |
489 { | |
490 case HOUSE_DIALOGUE_MAIN: | |
491 { | |
1393 | 492 if ( !HouseUI_CheckIfPlayerCanInteract() ) |
1300 | 493 return; |
494 pShopOptions[0] = pGlobalTXT_LocalizationStrings[134]; //"Buy Standard" | |
495 pShopOptions[1] = pGlobalTXT_LocalizationStrings[152]; //"Buy Special" | |
496 pShopOptions[2] = pGlobalTXT_LocalizationStrings[159]; //"Display Inventory" | |
497 pShopOptions[3] = pGlobalTXT_LocalizationStrings[160]; | |
498 all_text_height = 0; | |
499 for( int i = 0; i < 4; ++i ) | |
500 all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0); | |
501 v146 = ( 174 - all_text_height ) / 4; | |
502 v23 = ( 174 - 4 * ( 174 - all_text_height ) / 4 - all_text_height ) / 2 - ( 174 - all_text_height ) / 4 / 2 + 138; | |
503 pNumString = 0; | |
504 if ( pDialogueWindow->pNumPresenceButton>=0 ) | |
505 { | |
506 for (pActiveButton = pDialogueWindow->pStartingPosActiveItem; pActiveButton < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++pActiveButton) | |
507 { | |
508 pButton = pDialogueWindow->GetControl(pActiveButton); | |
509 pButton->uY = v146 + v23; | |
510 pTextHeight = pFontArrus->CalcTextHeight(pShopOptions[pNumString], &dialog_window, 0, 0); | |
511 pButton->uHeight = pTextHeight; | |
512 v23 = pButton->uY + pButton->uHeight - 1; | |
513 pButton->uW = v23; | |
514 pTextColor = pYellowColor; | |
515 if ( pDialogueWindow->pCurrentPosActiveItem != pActiveButton ) | |
516 pTextColor = pWhiteColor; | |
517 dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pTextColor, pShopOptions[pNumString], 3); | |
518 ++pNumString; | |
519 } | |
520 } | |
521 } | |
522 break; | |
523 case HOUSE_DIALOGUE_SHOP_BUY_STANDARD: | |
524 { | |
525 pRenderer->DrawTextureIndexed(8, 8, ShopTexture);// подложка | |
526 textureW = 0; | |
527 v153 = 0; | |
528 for ( int i = 0; i < 8; ++i )// разместить вещи | |
529 { | |
530 if ( pParty->StandartItemsInShops[window_SpeakInHouse->par1C][i].uItemID) | |
531 { | |
532 textureW = ItemsInShopTexture[i]->uTextureWidth; | |
533 textureH = ItemsInShopTexture[i]->uTextureHeight; | |
534 if ( i >= 4 ) //low row | |
535 { | |
536 v60 = 90 - (textureW/2); | |
537 pRenderer->DrawTextureTransparent(v60 + v153 - 420, 126, ItemsInShopTexture[i]); | |
538 v59 = v60 + v153 + 80220; | |
539 } | |
540 else | |
541 { | |
542 pY_item = 98 - textureH; | |
543 v152 = 86 - (textureW/2); | |
544 pRenderer->DrawTextureTransparent(v152 + v153, pY_item, ItemsInShopTexture[i]); | |
545 v59 = v153 + v152 + 640 * pY_item; | |
546 } | |
547 ZBuffer_DoFill(&pRenderer->pActiveZBuffer[v59], ItemsInShopTexture[i], i + 1); | |
548 } | |
549 v153 += 105; | |
550 } | |
1393 | 551 if ( !HouseUI_CheckIfPlayerCanInteract() ) |
1300 | 552 return; |
553 pItemCount = 0; | |
554 for ( int i = 0; i < 8; ++i ) | |
555 { | |
556 if ( pParty->StandartItemsInShops[window_SpeakInHouse->par1C][i].uItemID ) | |
557 ++pItemCount; | |
558 } | |
559 if ( GetAsyncKeyState(17) == 0 || pPlayers[uActiveCharacter]->CanSteal() == 0 ) | |
560 pStatusText = pGlobalTXT_LocalizationStrings[195]; //"Select the Item to Buy" | |
561 else | |
562 pStatusText = pGlobalTXT_LocalizationStrings[185];//"Steal item" | |
563 DrawTextAtStatusBar(pStatusText, 0); | |
564 if ( pItemCount != 0 ) | |
565 { | |
566 v73 = pMouse->GetCursorPos(&v136); | |
567 v74 = pRenderer->pActiveZBuffer[v73->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v134)->y]] & 0xFFFF; | |
568 if ( !v74 ) | |
569 return; | |
570 pItemCount = v74 - 1; | |
571 selected_item = &pParty->StandartItemsInShops[window_SpeakInHouse->par1C][v74-1]; | |
572 if ( GetAsyncKeyState(17) == 0 || pPlayers[uActiveCharacter]->CanSteal() == 0) | |
1411 | 573 v15 = (char *)pMerchantsBuyPhrases[pPlayers[uActiveCharacter]->SelectPhrasesTransaction(selected_item, BuildingType_ArmorShop, window_SpeakInHouse->par1C, 2)]; |
1300 | 574 else |
575 v15 = pGlobalTXT_LocalizationStrings[181]; //"Steal %24" | |
1410
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1409
diff
changeset
|
576 v36 = BuildDialogueString(v15, uActiveCharacter - 1, selected_item, (char *)window_SpeakInHouse->ptr_1C, 2, 0); |
1300 | 577 v115 = (174 - pFontArrus->CalcTextHeight(v36, &dialog_window, 0, 0)) / 2 + 138; |
578 dialog_window.DrawTitleText(pFontArrus, 0, v115, pWhiteColor, v36, 3); | |
579 return; | |
580 } | |
1529 | 581 dialog_window.DrawCurrentTime( pParty->field_3C.Shops_next_generation_time[window_SpeakInHouse->par1C]- pParty->uTimePlayed); |
1300 | 582 return; |
583 } | |
584 break; | |
585 case HOUSE_DIALOGUE_SHOP_BUY_SPECIAL: | |
586 { | |
587 pRenderer->DrawTextureIndexed(8, 8, ShopTexture); | |
588 v11 = 0; | |
589 v61 = 0; | |
590 v153 = 0; | |
591 do | |
592 { | |
593 if (pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][v61].uItemID) | |
594 { | |
595 v62 = ItemsInShopTexture[v61]; | |
596 if ( v61 >= 4 ) | |
597 { | |
598 v67 = 90 - ((signed int)v62->uTextureWidth >> 1); | |
599 pRenderer->DrawTextureTransparent(v153 + v67 - 420, 0x7Eu, ItemsInShopTexture[v61]); | |
600 v66 = v153 + v67 + 80220; | |
601 } | |
602 else | |
603 { | |
604 v63 = 98 - v62->uTextureHeight; | |
605 v64 = ItemsInShopTexture[v61]; | |
606 v65 = 98 - v62->uTextureHeight; | |
607 v152 = 86 - ((signed int)v62->uTextureWidth >> 1); | |
608 pRenderer->DrawTextureTransparent(v152 + v153, v65, v64); | |
609 v66 = v152 + v153 + 640 * v63; | |
610 } | |
611 ZBuffer_DoFill(&pRenderer->pActiveZBuffer[v66], ItemsInShopTexture[v61], v61 + 1); | |
612 } | |
613 v153 += 105; | |
614 ++v61; | |
615 } | |
616 while ( v61 < 8 ); | |
1393 | 617 if ( !HouseUI_CheckIfPlayerCanInteract() ) |
1300 | 618 return; |
619 v68 = 0; | |
620 pItemCount = 0; | |
621 do | |
622 { | |
623 if (pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][(signed int)v68].uItemID) | |
624 ++pItemCount; | |
625 ++v68; | |
626 } | |
627 while ( v68 < 6 ); | |
628 if ( GetAsyncKeyState(17) == 0 || pPlayers[uActiveCharacter]->CanSteal() == 0 ) | |
629 pStatusText = pGlobalTXT_LocalizationStrings[196]; //Select the Special Item to Buy" | |
630 else | |
631 pStatusText = pGlobalTXT_LocalizationStrings[185]; | |
632 DrawTextAtStatusBar(pStatusText, 0); | |
633 if ( (char *)pItemCount != 0 ) | |
634 { | |
635 v73 = pMouse->GetCursorPos(&v136); | |
636 v74 = pRenderer->pActiveZBuffer[v73->x + pSRZBufferLineOffsets[pMouse->GetCursorPos((POINT *)&v134)->y]] & 0xFFFF; | |
637 if ( !v74 ) | |
638 return; | |
639 pItemCount = v74 - 1; | |
640 if ( dialog_menu_id == 2 ) | |
641 selected_item = &pParty->StandartItemsInShops[window_SpeakInHouse->par1C][v74 - 1]; | |
642 else | |
643 selected_item = &pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][v74 - 1]; | |
644 if ( GetAsyncKeyState(17) == 0 || pPlayers[uActiveCharacter]->CanSteal() == 0 ) | |
1411 | 645 v15 = (char *)pMerchantsBuyPhrases[pPlayers[uActiveCharacter]->SelectPhrasesTransaction(selected_item, BuildingType_ArmorShop, window_SpeakInHouse->par1C, 2)]; |
1300 | 646 else |
647 v15 = pGlobalTXT_LocalizationStrings[181]; //"Steal %24" | |
1410
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1409
diff
changeset
|
648 v36 = BuildDialogueString(v15, uActiveCharacter - 1, selected_item, (char *)window_SpeakInHouse->ptr_1C, 2, 0); |
1300 | 649 v115 = (174 - pFontArrus->CalcTextHeight(v36, &dialog_window, 0, 0)) / 2 + 138; |
650 dialog_window.DrawTitleText(pFontArrus, 0, v115, pWhiteColor, v36, 3); | |
651 return; | |
652 } | |
1529 | 653 dialog_window.DrawCurrentTime( pParty->field_3C.Shops_next_generation_time[window_SpeakInHouse->par1C]- pParty->uTimePlayed); |
1300 | 654 return; |
655 } | |
656 break; | |
657 case HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT: | |
658 { | |
659 draw_leather(); | |
660 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); | |
661 pShopOptions[0] = pGlobalTXT_LocalizationStrings[200]; //"Sell" | |
662 pShopOptions[1] = pGlobalTXT_LocalizationStrings[113]; //"Identify" | |
663 pShopOptions[2] = pGlobalTXT_LocalizationStrings[179]; //"Repair" | |
664 all_text_height = 0; | |
665 for ( int i = 0; i < 3; ++i ) | |
666 all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0); | |
667 v152 = (174 - all_text_height) / 3; | |
668 v86 = (3 * (58 - v152) - all_text_height) / 2 - v152 / 2 + 138; | |
669 v24 = -pDialogueWindow->pNumPresenceButton < 0; | |
670 pActiveButton = pDialogueWindow->pStartingPosActiveItem; | |
671 if ( v24 ^ (pDialogueWindow->pStartingPosActiveItem > pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton) ) | |
672 { | |
673 pNumString = 0; | |
674 do | |
675 { | |
676 pButton = pDialogueWindow->GetControl((unsigned int)pActiveButton); | |
677 pButton->uY = v152 + v86; | |
678 pTextHeight = pFontArrus->CalcTextHeight(pShopOptions[pNumString], &dialog_window, 0, 0); | |
679 v90 = pButton->uY; | |
680 pButton->uHeight = pTextHeight; | |
681 v86 = v90 + pTextHeight - 1; | |
682 pButton->uW = v86; | |
683 pTextColor = pYellowColor; | |
684 if ( pDialogueWindow->pCurrentPosActiveItem != pActiveButton ) | |
685 pTextColor = pWhiteColor; | |
686 dialog_window.DrawTitleText(pFontArrus, 0, v90, pTextColor, pShopOptions[pNumString], 3); | |
687 ++pNumString; | |
688 ++pActiveButton; | |
689 } | |
690 while ( (signed int)pActiveButton < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem ); | |
691 } | |
692 return; | |
693 } | |
694 break; | |
695 case HOUSE_DIALOGUE_SHOP_SELL: | |
696 { | |
697 draw_leather(); | |
698 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); | |
699 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[199], 0);//"Select the Item to Sell" | |
1393 | 700 if ( !HouseUI_CheckIfPlayerCanInteract()) |
1300 | 701 return; |
702 if((v9 = pMouse->GetCursorPos(&v139)->x - 14, pItemCount = (v9 >> 5) + 14 * ((pMouse->GetCursorPos(&v133)->y - 17) >> 5), | |
703 pMouse->GetCursorPos(&v137)->x <= 13) || pMouse->GetCursorPos(&v129)->x >= 462 | |
704 || (v10 = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&pItemCount), v11 = 0, !v10) ) | |
705 return; | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1300
diff
changeset
|
706 v116 = (ItemGen *)&pPlayers[uActiveCharacter]->pInventoryItemList[v10 - 1]; |
1411 | 707 v13 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(v116, BuildingType_ArmorShop, window_SpeakInHouse->par1C, 3); |
708 v15 = (char *)pMerchantsSellPhrases[pPlayers[uActiveCharacter]->SelectPhrasesTransaction(v116, BuildingType_ArmorShop, window_SpeakInHouse->par1C, 3)]; | |
1410
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1409
diff
changeset
|
709 v36 = BuildDialogueString(v15, uActiveCharacter - 1, v116, (char *) window_SpeakInHouse->par1C, 3, 0); |
1300 | 710 v115 = (174 - pFontArrus->CalcTextHeight(v36, &dialog_window, 0, 0)) / 2 + 138; |
711 dialog_window.DrawTitleText(pFontArrus, 0, v115, pWhiteColor, v36, 3); | |
712 return; | |
713 } | |
714 break; | |
715 case HOUSE_DIALOGUE_SHOP_IDENTIFY: | |
716 { | |
717 draw_leather(); | |
718 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); | |
719 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[197], 0); //"Select the Item to Identify" | |
1393 | 720 if ( HouseUI_CheckIfPlayerCanInteract() ) |
1300 | 721 { |
722 v1 = pMouse->GetCursorPos(&a2)->x - 14; | |
723 pItemCount = (v1 >> 5) + 14 * ((pMouse->GetCursorPos(&v128)->y - 17) >> 5); | |
724 if ( pMouse->GetCursorPos(&v141)->x > 13 ) | |
725 { | |
726 if ( pMouse->GetCursorPos(&v143)->x < 462 ) | |
727 { | |
728 v2 = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&pItemCount); | |
729 if ( v2 ) | |
730 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1300
diff
changeset
|
731 v3 = (ItemGen *)&pPlayers[uActiveCharacter]->pInventoryItemList[v2-1]; |
1567
9f8b3e904e14
Player::ReceiveDamage, very small edits; prepended "Is" to item functions returning bool values (broken, indetified, stolen)
Grumpy7
parents:
1529
diff
changeset
|
732 if (v3->IsIdentified()) |
1300 | 733 v5 = "%24"; |
734 else | |
735 { | |
1411 | 736 v8 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(v3, BuildingType_ArmorShop, (int)window_SpeakInHouse->ptr_1C, 4); |
1300 | 737 v5 = (char *)pMerchantsIdentifyPhrases[v8]; |
738 } | |
1410
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1409
diff
changeset
|
739 v6 = BuildDialogueString(v5, uActiveCharacter - 1, v3, (char *)window_SpeakInHouse->ptr_1C, 4, 0); |
1300 | 740 v115 = (174 - pFontArrus->CalcTextHeight(v6, &dialog_window, 0, 0)) / 2 + 138; |
741 dialog_window.DrawTitleText(pFontArrus, 0, v115, pWhiteColor, v6, 3); | |
742 return; | |
743 } | |
744 } | |
745 } | |
746 } | |
747 } | |
748 break; | |
749 case HOUSE_DIALOGUE_SHOP_REPAIR: | |
750 { | |
751 draw_leather(); | |
752 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); | |
753 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[198], 0); | |
1393 | 754 if ( !HouseUI_CheckIfPlayerCanInteract()) |
1300 | 755 return; |
756 if( (v31 = pMouse->GetCursorPos(&v135)->x - 14, | |
757 pItemCount = (v31 >> 5) + 14 * ((pMouse->GetCursorPos(&v142)->y - 17) >> 5), | |
758 pMouse->GetCursorPos(&v140)->x <= 13) | |
759 || pMouse->GetCursorPos(&v138)->x >= 462 | |
760 || (v32 = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&pItemCount), v11 = 0, !v32) | |
761 || (!(pPlayers[uActiveCharacter]->pOwnItems[v32-1].uAttributes& 2)) ) | |
762 return; | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1411
diff
changeset
|
763 //__debugbreak(); // warning C4700: uninitialized local variable 'v33' used |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1411
diff
changeset
|
764 v116 = &pPlayers[uActiveCharacter]->pInventoryItemList[v32 - 1]; |
1411 | 765 v35 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(&pPlayers[uActiveCharacter]->pInventoryItemList[v32 - 1], BuildingType_ArmorShop, window_SpeakInHouse->par1C, 5); |
1300 | 766 v15 = (char *)pMerchantsRepairPhrases[v35]; |
1410
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1409
diff
changeset
|
767 v36 = BuildDialogueString(v15, uActiveCharacter - 1, v116, (char *)window_SpeakInHouse->ptr_1C, 5, 0); |
1300 | 768 v115 = (174 - pFontArrus->CalcTextHeight(v36, &dialog_window, 0, 0)) / 2 + 138; |
769 dialog_window.DrawTitleText(pFontArrus, 0, v115, pWhiteColor, v36, 3); | |
770 return; | |
771 } | |
772 break; | |
773 case HOUSE_DIALOGUE_SHOP_6: //buy standart ??? | |
774 { | |
775 pRenderer->DrawTextureIndexed(8u, 8u, ShopTexture); | |
776 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[195], 0); //"Select the Item to Buy" | |
1393 | 777 if ( !HouseUI_CheckIfPlayerCanInteract() ) |
1300 | 778 return; |
779 pItemCount = 0; | |
780 for( int i = 0; i < 6 ; ++i ) | |
781 if (pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][i].uItemID) | |
782 ++pItemCount; | |
783 if ( pItemCount ) | |
784 { | |
785 v94 = pMouse->GetCursorPos(&v132); | |
786 pItemCount = pRenderer->pActiveZBuffer[v94->x + pSRZBufferLineOffsets[pMouse->GetCursorPos((POINT *)&v130)->y]]; | |
787 v95 = pItemCount; | |
788 if ( pItemCount && pItemCount != -65536 ) | |
789 { | |
790 --pItemCount; | |
791 v97 = uActiveCharacter - 1; | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1411
diff
changeset
|
792 //__debugbreak(); // warning C4700: uninitialized local variable 'v98' used |
1411 | 793 v99 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(&pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][v95-1], BuildingType_ArmorShop, window_SpeakInHouse->par1C, 2); |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1411
diff
changeset
|
794 v100 = BuildDialogueString((char *)pMerchantsBuyPhrases[v99], uActiveCharacter - 1, &pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][v95-1], (char *)window_SpeakInHouse->par1C, 2, 0); |
1300 | 795 v103 = pFontArrus->CalcTextHeight(v100, &dialog_window, 0, 0); |
796 dialog_window.DrawTitleText(pFontArrus, 0, (174 - v103) / 2 + 138, pWhiteColor, v100, 3); | |
797 } | |
798 v104 = 0; | |
799 v153 = 0; | |
800 do | |
801 { | |
802 //if ( pParty->field_C59C[9 * (v104 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] ) | |
803 if (pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][v104].uItemID) | |
804 { | |
805 v105 = ItemsInShopTexture[v104]; | |
806 if ( v104 >= 4 ) | |
807 { | |
808 v110 = 90 - ((signed int)v105->uTextureWidth >> 1); | |
809 pRenderer->DrawTextureTransparent(v153 + v110 - 420, 0x7Eu, ItemsInShopTexture[v104]); | |
810 v127 = v104 + 1; | |
811 v109 = v153 + v110 + 80220; | |
812 } | |
813 else | |
814 { | |
815 v106 = 98 - v105->uTextureHeight; | |
816 v108 = 98 - v105->uTextureHeight; | |
817 v152 = 86 - ((signed int)v105->uTextureWidth >> 1); | |
818 pRenderer->DrawTextureTransparent(v152 + v153, v108, ItemsInShopTexture[v104]); | |
819 v127 = v104 + 1; | |
820 v109 = v152 + v153 + 640 * v106; | |
821 } | |
822 ZBuffer_DoFill(&pRenderer->pActiveZBuffer[v109], ItemsInShopTexture[v104], v127); | |
823 } | |
824 v153 += 105; | |
825 ++v104; | |
826 } | |
827 while ( v104 < 8 ); | |
828 return; | |
829 } | |
1529 | 830 dialog_window.DrawCurrentTime(pParty->field_3C.Shops_next_generation_time[window_SpeakInHouse->par1C]- pParty->uTimePlayed); |
1300 | 831 return; |
832 } | |
833 break; | |
834 case HOUSE_DIALOGUE_LEARN_SKILLS: | |
835 { | |
1393 | 836 if (!HouseUI_CheckIfPlayerCanInteract() ) |
1300 | 837 return; |
838 v152 = 0; | |
839 v38 = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0); | |
840 pActiveButton = v38 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; | |
841 if ( (signed int)pActiveButton < v38 / 3 ) | |
842 pActiveButton = v38 / 3; | |
843 v39 = pDialogueWindow->pStartingPosActiveItem; | |
844 v40 = pDialogueWindow->pNumPresenceButton; | |
845 v153 = 0; | |
846 if ( (signed int)v39 < (signed int)(v39 + v40) ) | |
847 { | |
848 do | |
849 { | |
850 v41 = pDialogueWindow->GetControl(v39)->msg_param - 36; | |
851 if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][v41] && !pPlayers[uActiveCharacter]->pActiveSkills[v41] ) | |
852 { | |
853 v42 = pFontArrus->CalcTextHeight(pSkillNames[v41], &dialog_window, 0, 0); | |
854 v152 += v42; | |
855 ++v153; | |
856 } | |
857 ++v39; | |
858 } | |
859 while ( (signed int)v39 < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem ); | |
860 if ( v153 ) | |
861 { | |
862 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[401], pActiveButton); | |
863 dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3); | |
864 pActiveButton = (149 - v152) / v153; | |
865 if ( (149 - v152) / v153 > 32 ) | |
866 pActiveButton = 32; | |
867 v43 = (149 - v153 * (signed int)pActiveButton - v152) / 2 - (signed int)pActiveButton / 2 + 162; | |
868 v152 = pDialogueWindow->pStartingPosActiveItem; | |
869 v146 = v43; | |
870 if ( v152 < v152 + pDialogueWindow->pNumPresenceButton ) | |
871 { | |
872 v153 = 2; | |
873 do | |
874 { | |
875 pButton = pDialogueWindow->GetControl(v152); | |
876 v46 = pButton->msg_param - 36; | |
877 if ( !byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][v46] || pPlayers[uActiveCharacter]->pActiveSkills[v46] ) | |
878 { | |
879 pButton->uW = 0; | |
880 pButton->uHeight = 0; | |
881 pButton->uY = 0; | |
882 } | |
883 else | |
884 { | |
885 pButton->uY = (unsigned int)((char *)pActiveButton + v146); | |
886 pTextHeight = pFontArrus->CalcTextHeight(pSkillNames[v46], &dialog_window, 0, 0); | |
887 v49 = pButton->uY; | |
888 pButton->uHeight = pTextHeight; | |
889 v51 = v49 + pTextHeight - 1; | |
890 pButton->uW = v51; | |
891 v146 = v51; | |
892 pTextColor = pYellowColor; | |
893 if ( pDialogueWindow->pCurrentPosActiveItem != v153 ) | |
894 pTextColor = pWhiteColor; | |
895 dialog_window.DrawTitleText(pFontArrus, 0, v49, pTextColor, pSkillNames[v46], 3); | |
896 } | |
897 v53 = pDialogueWindow->pStartingPosActiveItem; | |
898 ++v152; | |
899 textureH = pDialogueWindow->pNumPresenceButton + v53; | |
900 ++v153; | |
901 } | |
902 while ( v152 < textureH ); | |
903 } | |
904 return; | |
905 } | |
906 } | |
907 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]); //"Seek knowledge elsewhere %s the %s" | |
908 strcat(pTmpBuf.data(), "\n \n"); | |
909 strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]); //"I can offer you nothing further." | |
910 v115 = (174 - pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 0, 0)) / 2 + 138; | |
911 dialog_window.DrawTitleText(pFontArrus, 0, v115, pYellowColor, pTmpBuf.data(), 3); | |
912 return; | |
913 } | |
914 break; | |
915 } | |
916 } | |
917 //----- (004B9CC6) -------------------------------------------------------- | |
1458 | 918 void AlchemistDialog() |
1300 | 919 { |
920 int v0; | |
921 int pNumActiveItem; // eax@7 | |
922 signed int v5; // esi@9 | |
923 unsigned int v6; // esi@11 | |
924 int v7; // eax@11 | |
925 unsigned int v8; // eax@12 | |
926 int v9; // eax@14 | |
927 int v10; // ecx@19 | |
928 int v13; // eax@21 | |
929 char *v14; // eax@23 | |
930 int v15; // eax@23 | |
931 unsigned int v16; // ecx@23 | |
932 int v17; // edx@23 | |
933 int v18; // eax@23 | |
934 int v20; // eax@27 | |
935 char *v21; // edx@29 | |
936 int v22; // esi@30 | |
937 char **v23; // edi@30 | |
938 int v24; // eax@31 | |
939 int v26; // edx@32 | |
940 int v27; // edi@32 | |
941 unsigned __int8 v28; // sf@32 | |
942 const char **v30; // eax@34 | |
943 int v31; // eax@34 | |
944 unsigned int v32; // ecx@34 | |
945 int v34; // eax@34 | |
946 signed int v36; // esi@39 | |
947 ItemGen *v37; // eax@42 | |
948 char *v38; // ecx@43 | |
949 unsigned __int8 v39; // dl@44 | |
950 int v40; // eax@46 | |
951 int v41; // ST08_4@47 | |
952 int v42; // eax@47 | |
953 signed int v43; // esi@49 | |
954 int v44; // ST08_4@52 | |
955 int v45; // eax@52 | |
956 Texture *v46; // ecx@55 | |
957 unsigned int v47; // edi@55 | |
958 unsigned int v48; // esi@57 | |
959 int v49; // edx@61 | |
960 Texture *v50; // ecx@67 | |
961 unsigned int v51; // edi@67 | |
962 unsigned int v52; // esi@69 | |
963 int v53; // edx@73 | |
964 Texture *v54; // ecx@79 | |
965 unsigned int v55; // edi@79 | |
966 unsigned int v56; // esi@81 | |
967 int v57; // edx@85 | |
968 Texture *v58; // ecx@91 | |
969 unsigned int v59; // edi@91 | |
970 unsigned int v60; // esi@93 | |
971 int v61; // edx@97 | |
972 signed int v62; // ecx@102 | |
973 SHORT v63; // di@110 | |
974 bool v64; // eax@110 | |
975 const char *v65; // ecx@112 | |
976 POINT *v66; // esi@117 | |
977 int v67; // ecx@118 | |
978 int v68; // eax@118 | |
979 int v69; // ecx@118 | |
980 ItemGen *v70; // esi@118 | |
981 int v71; // eax@123 | |
982 int all_text_height; // edi@125 | |
983 char **v73; // esi@125 | |
984 int v74; // eax@126 | |
985 int pItemNum; | |
986 int v76; // edx@127 | |
987 int v77; // edi@127 | |
988 GUIButton *pButton; // esi@129 | |
989 const char **v79; // eax@129 | |
990 int pTextHeight; // eax@129 | |
991 unsigned int v81; // ecx@129 | |
992 unsigned int pColorText; // ax@129 | |
993 int v85; // [sp-14h] [bp-ECh]@29 | |
994 int v86; // [sp-10h] [bp-E8h]@29 | |
995 ItemGen *v87; // [sp-10h] [bp-E8h]@43 | |
996 unsigned __int16 v88; // [sp-Ch] [bp-E4h]@29 | |
997 void *v89; // [sp-Ch] [bp-E4h]@43 | |
998 char *v90; // [sp-8h] [bp-E0h]@29 | |
999 int v91; // [sp-8h] [bp-E0h]@42 | |
1000 unsigned int v92; // [sp-4h] [bp-DCh]@29 | |
1001 __int64 *v93; // [sp-4h] [bp-DCh]@42 | |
1002 POINT v94; // [sp+Ch] [bp-CCh]@39 | |
1003 POINT v95; // [sp+14h] [bp-C4h]@49 | |
1004 POINT v96; // [sp+1Ch] [bp-BCh]@117 | |
1005 POINT v97; // [sp+24h] [bp-B4h]@40 | |
1006 POINT v98; // [sp+2Ch] [bp-ACh]@117 | |
1007 POINT v99; // [sp+34h] [bp-A4h]@49 | |
1008 POINT v100; // [sp+3Ch] [bp-9Ch]@50 | |
1009 POINT v101; // [sp+44h] [bp-94h]@39 | |
1010 POINT v102; // [sp+4Ch] [bp-8Ch]@49 | |
1011 POINT a2; // [sp+54h] [bp-84h]@39 | |
1012 GUIWindow dialog_window; // [sp+5Ch] [bp-7Ch]@1 | |
1013 int v105; // [sp+B0h] [bp-28h]@19 | |
1014 int pColorYellow; // [sp+B4h] [bp-24h]@1 | |
1015 int Str; // [sp+B8h] [bp-20h]@23 | |
1016 int pColorWhite; // [sp+BCh] [bp-1Ch]@1 | |
1017 __int32 v109; // [sp+C0h] [bp-18h]@39 | |
1018 Player *pPlayer; // [sp+C4h] [bp-14h]@1 | |
1019 int pNumString; // [sp+C8h] [bp-10h]@9 | |
1020 unsigned int v112; // [sp+CCh] [bp-Ch]@9 | |
1021 unsigned __int8 v113; // [sp+D3h] [bp-5h]@47 | |
1022 int v114; // [sp+D4h] [bp-4h]@11 | |
1023 | |
1024 pPlayer = pPlayers[uActiveCharacter]; | |
1025 memcpy(&dialog_window, window_SpeakInHouse, sizeof(dialog_window)); | |
1026 dialog_window.uFrameX = 483; | |
1027 dialog_window.uFrameWidth = 148; | |
1028 dialog_window.uFrameZ = 334; | |
1029 pColorWhite = TargetColor(0xFFu, 0xFFu, 0xFFu); | |
1030 pColorYellow = TargetColor(0xE1u, 0xCDu, 0x23u); | |
1031 switch(dialog_menu_id) | |
1032 { | |
1033 case HOUSE_DIALOGUE_MAIN: | |
1034 { | |
1393 | 1035 if ( HouseUI_CheckIfPlayerCanInteract() ) |
1300 | 1036 { |
1037 pShopOptions[0] = pGlobalTXT_LocalizationStrings[134]; | |
1038 pShopOptions[1] = pGlobalTXT_LocalizationStrings[152]; | |
1039 pShopOptions[2] = pGlobalTXT_LocalizationStrings[159]; | |
1040 pShopOptions[3] = pGlobalTXT_LocalizationStrings[160]; | |
1041 all_text_height = 0; | |
1042 for (int i = 0; i < 4; ++i)//while ( (signed int)v15 < (signed int)&unk_F8B1C8 ); | |
1043 all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0); | |
1044 Str = (174 - all_text_height) / 4; | |
1045 pNumActiveItem = pDialogueWindow->pStartingPosActiveItem; | |
1046 v76 = pNumActiveItem + pDialogueWindow->pNumPresenceButton; | |
1047 v77 = (174 - 4 * (174 - all_text_height) / 4 - all_text_height) / 2 - (174 - all_text_height) / 4 / 2 + 138; | |
1048 v28 = -pDialogueWindow->pNumPresenceButton < 0; | |
1049 if ( v28 ^ (pNumActiveItem > v76) ) | |
1050 { | |
1051 pItemNum = 2; | |
1052 pNumString = 0; | |
1053 do | |
1054 { | |
1055 pButton = pDialogueWindow->GetControl(pItemNum); | |
1056 pButton->uY = Str + v77; | |
1057 pTextHeight = pFontArrus->CalcTextHeight((const char *)pShopOptions[pNumString], &dialog_window, 0, 0); | |
1058 pButton->uHeight = pTextHeight; | |
1059 v77 = pButton->uY + pTextHeight - 1; | |
1060 pButton->uW = v77; | |
1061 pColorText = pColorYellow; | |
1062 if ( pDialogueWindow->pCurrentPosActiveItem != pItemNum ) | |
1063 pColorText = pColorWhite; | |
1064 dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, (const char *)pShopOptions[pNumString], 3); | |
1065 ++pItemNum; | |
1066 ++pNumString; | |
1067 pNumActiveItem = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; | |
1068 } | |
1069 while ( pItemNum < pNumActiveItem ); | |
1070 } | |
1071 } | |
1072 return; | |
1073 } | |
1074 case HOUSE_DIALOGUE_SHOP_BUY_STANDARD: | |
1075 { | |
1076 pRenderer->DrawTextureIndexed(8, 8, ShopTexture); | |
1077 v114 = 0; | |
1078 do | |
1079 { | |
1080 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v114].uItemID) | |
1081 { | |
1082 v46 = ItemsInShopTexture[v114]; | |
1083 v47 = 152 - v46->uTextureHeight; | |
1084 if ( (signed int)v47 < 1 ) | |
1085 v47 = 0; | |
1086 v48 = 75 * v114 - v46->uTextureWidth / 2 + 40; | |
1087 if ( v114 ) | |
1088 { | |
1089 if ( v114 == 5 ) | |
1090 { | |
1091 v49 = ItemsInShopTexture[5]->uTextureWidth; | |
1092 if ( (signed int)v48 > 457 - v49 ) | |
1093 v48 = 457 - v49; | |
1094 } | |
1095 } | |
1096 else if ( (signed int)v48 < 18 ) | |
1097 v48 = 18; | |
1098 pRenderer->DrawTextureTransparent(v48, v47, v46); | |
1458 | 1099 ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[v48 + 640 * v47], ItemsInShopTexture[v114], v114 + 1); |
1300 | 1100 } |
1101 ++v114; | |
1102 } | |
1103 while ( v114 < 6 ); | |
1104 v114 = 0; | |
1105 do | |
1106 { | |
1107 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v114 + 6].uItemID) | |
1108 { | |
1109 v50 = ItemsInShopTexture[v114 + 6]; | |
1110 v51 = 308 - v50->uTextureHeight; | |
1111 if ( (signed int)v51 < 1 ) | |
1112 v51 = 0; | |
1113 v52 = 75 * v114 - v50->uTextureWidth / 2 + 40; | |
1114 if ( v114 ) | |
1115 { | |
1116 if ( v114 == 5 ) | |
1117 { | |
1118 v53 = ItemsInShopTexture[11]->uTextureWidth; | |
1119 if ( (signed int)v52 > 457 - v53 ) | |
1120 v52 = 457 - v53; | |
1121 } | |
1122 } | |
1123 else | |
1124 { | |
1125 if ( (signed int)v52 < 18 ) | |
1126 v52 = 18; | |
1127 } | |
1128 pRenderer->DrawTextureTransparent(v52, v51, v50); | |
1458 | 1129 ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[v52 + 640 * v51], ItemsInShopTexture[v114 + 6], v114 + 7); |
1300 | 1130 } |
1131 ++v114; | |
1132 } | |
1133 while ( v114 < 6 ); | |
1393 | 1134 if ( HouseUI_CheckIfPlayerCanInteract() ) |
1300 | 1135 { |
1136 v62 = 0; | |
1137 v109 = 0; | |
1138 do | |
1139 { | |
1140 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v62].uItemID) | |
1141 ++v109; | |
1142 ++v62; | |
1143 } | |
1144 while ( v62 < 12 ); | |
1145 v63 = GetAsyncKeyState(17); | |
1146 v64 = pPlayer->CanSteal(); | |
1147 Str = v64; | |
1148 if ( v63 && v64 ) | |
1149 { | |
1150 v65 = pGlobalTXT_LocalizationStrings[185]; | |
1151 } | |
1152 else if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_BUY_STANDARD) | |
1153 { | |
1154 v65 = pGlobalTXT_LocalizationStrings[195]; | |
1155 } | |
1156 else | |
1157 { | |
1158 v65 = pGlobalTXT_LocalizationStrings[196]; | |
1159 } | |
1160 DrawTextAtStatusBar(v65, 0); | |
1161 if ( !v109 ) | |
1162 { | |
1529 | 1163 dialog_window.DrawCurrentTime( pParty->field_3C.Shops_next_generation_time[ (unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed); |
1300 | 1164 return; |
1165 } | |
1729
f44b6e02e81c
pop-up window in character(paperdill) window, alchemy
Ritor1
parents:
1683
diff
changeset
|
1166 pMouse->GetCursorPos(&v98); |
f44b6e02e81c
pop-up window in character(paperdill) window, alchemy
Ritor1
parents:
1683
diff
changeset
|
1167 pNumActiveItem = v98.x + pSRZBufferLineOffsets[v98.y]; |
1300 | 1168 if ( pRenderer->pActiveZBuffer[pNumActiveItem] & 0xFFFF ) |
1169 { | |
1170 v67 = (pRenderer->pActiveZBuffer[pNumActiveItem] & 0xFFFF) - 1; | |
1171 v70 = (ItemGen *)&pParty->StandartItemsInShops[(int)window_SpeakInHouse->ptr_1C][v67]; | |
1172 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD) | |
1173 v70 = &pParty->SpecialItemsInShops[(int)window_SpeakInHouse->ptr_1C][v67];//v70 = (ItemGen *)&pParty->field_C59C[v69 + 724]; | |
1174 if ( !v63 || !Str ) | |
1175 { | |
1411 | 1176 v71 = pPlayer->SelectPhrasesTransaction(v70, BuildingType_AlchemistShop, (int)window_SpeakInHouse->ptr_1C, 2); |
1300 | 1177 v38 = (char *)pMerchantsBuyPhrases[v71]; |
1178 } | |
1179 else | |
1180 { | |
1181 v38 = pGlobalTXT_LocalizationStrings[181]; | |
1182 } | |
1410
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1409
diff
changeset
|
1183 v21 = BuildDialogueString(v38, uActiveCharacter - 1, v70, (char *)window_SpeakInHouse->ptr_1C, 2, 0); |
1300 | 1184 v40 = pFontArrus->CalcTextHeight(v21, &dialog_window, 0, 0); |
1185 dialog_window.DrawTitleText(pFontArrus, 0, (174 - v40) / 2 + 138, pColorWhite, v21, 3); | |
1186 return ; | |
1187 } | |
1188 } | |
1189 return; | |
1190 } | |
1191 case HOUSE_DIALOGUE_SHOP_SELL: | |
1192 { | |
1193 draw_leather(); | |
1194 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); | |
1195 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[199], 0); | |
1393 | 1196 if ( !HouseUI_CheckIfPlayerCanInteract() ) |
1300 | 1197 return; |
1198 if ((v43 = pMouse->GetCursorPos(&v99)->x - 14, v109 = (v43 >> 5) + 14 * ((pMouse->GetCursorPos(&v95)->y - 17) >> 5), | |
1199 pMouse->GetCursorPos(&v102)->x <= 13) || pMouse->GetCursorPos(&v100)->x >= 462 | |
1200 || (pNumActiveItem = pPlayer->GetItemIDAtInventoryIndex((int *)&v109), !pNumActiveItem) ) | |
1201 return; | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1300
diff
changeset
|
1202 v87 = (ItemGen *)&pPlayer->pInventoryItemList[pNumActiveItem - 1]; |
1411 | 1203 v45 = pPlayer->SelectPhrasesTransaction(v87, BuildingType_AlchemistShop, (int)window_SpeakInHouse->ptr_1C, 3); |
1410
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1409
diff
changeset
|
1204 v21 = BuildDialogueString((char *)pMerchantsSellPhrases[v45], uActiveCharacter - 1, v87, (char *)window_SpeakInHouse->ptr_1C, 3, 0); |
1300 | 1205 pTextHeight = pFontArrus->CalcTextHeight(v21, &dialog_window, 0, 0); |
1206 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, pColorWhite, v21, 3); | |
1207 return; | |
1208 } | |
1209 case HOUSE_DIALOGUE_SHOP_IDENTIFY: | |
1210 { | |
1211 draw_leather(); | |
1212 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); | |
1213 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[197], 0); | |
1393 | 1214 if ( HouseUI_CheckIfPlayerCanInteract() ) |
1300 | 1215 return; |
1216 if ((v36 = pMouse->GetCursorPos(&a2)->x - 14, v109 = (v36 >> 5) + 14 * ((pMouse->GetCursorPos(&v94)->y - 17) >> 5), | |
1217 pMouse->GetCursorPos(&v101)->x <= 13) || pMouse->GetCursorPos(&v97)->x >= 462 | |
1218 || (pNumActiveItem = pPlayer->GetItemIDAtInventoryIndex((int *)&v109), !pNumActiveItem) ) | |
1219 return; | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1300
diff
changeset
|
1220 v37 = (ItemGen *)&pPlayer->pInventoryItemList[pNumActiveItem - 1]; |
1567
9f8b3e904e14
Player::ReceiveDamage, very small edits; prepended "Is" to item functions returning bool values (broken, indetified, stolen)
Grumpy7
parents:
1529
diff
changeset
|
1221 if (!v37->IsIdentified()) |
1300 | 1222 { |
1411 | 1223 v42 = pPlayer->SelectPhrasesTransaction(v37, BuildingType_AlchemistShop, (int)window_SpeakInHouse->ptr_1C, 4); |
1300 | 1224 v38 = (char *)pMerchantsIdentifyPhrases[v42]; |
1225 } | |
1226 else | |
1227 { | |
1228 v38 = "%24"; | |
1229 } | |
1410
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1409
diff
changeset
|
1230 v21 = BuildDialogueString(v38, uActiveCharacter - 1, v37, (char *)window_SpeakInHouse->ptr_1C, 4, 0); |
1300 | 1231 v40 = pFontArrus->CalcTextHeight(v21, &dialog_window, 0, 0); |
1232 dialog_window.DrawTitleText(pFontArrus, 0, (174 - v40) / 2 + 138, pColorWhite, v21, 3); | |
1233 return; | |
1234 } | |
1235 case HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT: | |
1236 { | |
1237 draw_leather(); | |
1238 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); | |
1239 pShopOptions[0] = pGlobalTXT_LocalizationStrings[200]; | |
1240 pShopOptions[1] = pGlobalTXT_LocalizationStrings[113]; | |
1241 all_text_height = 0; | |
1242 for ( int i = 0; i < 2; ++i ) | |
1243 all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0); | |
1244 Str = (174 - all_text_height) / 2; | |
1245 pNumActiveItem = pDialogueWindow->pStartingPosActiveItem; | |
1246 v26 = pNumActiveItem + pDialogueWindow->pNumPresenceButton; | |
1247 v27 = (2 * (87 - (174 - all_text_height) / 2) - all_text_height) / 2 - (174 - all_text_height) / 2 / 2 + 138; | |
1248 v28 = -pDialogueWindow->pNumPresenceButton < 0; | |
1249 if ( v28 ^ (pNumActiveItem > v26) ) | |
1250 { | |
1251 pItemNum = 2; | |
1252 pNumString = 0; | |
1253 do | |
1254 { | |
1255 pButton = pDialogueWindow->GetControl(pItemNum); | |
1256 pButton->uY = Str + v27; | |
1257 pTextHeight = pFontArrus->CalcTextHeight((const char *)pShopOptions[pNumString], &dialog_window, 0, 0); | |
1258 pButton->uHeight = pTextHeight; | |
1259 v27 = pButton->uY + pTextHeight - 1; | |
1260 pButton->uW = v27; | |
1261 pColorText = pColorYellow; | |
1262 if ( pDialogueWindow->pCurrentPosActiveItem != pItemNum ) | |
1263 pColorText = pColorWhite; | |
1264 dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, (const char *)pShopOptions[pNumString], 3); | |
1265 ++pItemNum; | |
1266 ++pNumString; | |
1267 pNumActiveItem = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; | |
1268 } | |
1269 while ( pItemNum < pNumActiveItem ); | |
1270 } | |
1271 return; | |
1272 } | |
1273 case HOUSE_DIALOGUE_SHOP_BUY_SPECIAL: | |
1274 { | |
1275 pRenderer->DrawTextureIndexed(8, 8, ShopTexture); | |
1276 v114 = 0; | |
1277 do | |
1278 { | |
1279 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v114].uItemID) | |
1280 { | |
1281 v54 = ItemsInShopTexture[v114]; | |
1282 v55 = 152 - v54->uTextureHeight; | |
1283 if ( (signed int)v55 < 1 ) | |
1284 v55 = 0; | |
1285 v56 = 75 * v114 - v54->uTextureWidth / 2 + 40; | |
1286 if ( v114 ) | |
1287 { | |
1288 if ( v114 == 5 ) | |
1289 { | |
1290 v57 = ItemsInShopTexture[5]->uTextureWidth; | |
1291 if ( (signed int)v56 > 457 - v57 ) | |
1292 v56 = 457 - v57; | |
1293 } | |
1294 } | |
1295 else | |
1296 { | |
1297 if ( (signed int)v56 < 18 ) | |
1298 v56 = 18; | |
1299 } | |
1300 pRenderer->DrawTextureTransparent(v56, v55, v54); | |
1458 | 1301 ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[v56 + 640 * v55], ItemsInShopTexture[v114], v114 + 1); |
1300 | 1302 } |
1303 ++v114; | |
1304 } | |
1305 while ( v114 < 6 ); | |
1306 v114 = 0; | |
1307 do | |
1308 { | |
1309 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][(signed int)v114 + 6].uItemID) //not itemid | |
1310 { | |
1311 v58 = ItemsInShopTexture[v114 + 6]; | |
1312 v59 = 308 - v58->uTextureHeight; | |
1313 if ( (signed int)v59 < 1 ) | |
1314 v59 = 0; | |
1315 v60 = 75 * v114 - v58->uTextureWidth / 2 + 40; | |
1316 if ( v114 ) | |
1317 { | |
1318 if ( v114 == 5 ) | |
1319 { | |
1320 v61 = ItemsInShopTexture[11]->uTextureWidth; | |
1321 if ( (signed int)v60 > 457 - v61 ) | |
1322 v60 = 457 - v61; | |
1323 } | |
1324 } | |
1325 else | |
1326 { | |
1327 if ( (signed int)v60 < 18 ) | |
1328 v60 = 18; | |
1329 } | |
1330 pRenderer->DrawTextureTransparent(v60, v59, v58); | |
1458 | 1331 ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[v60 + 640 * v59], ItemsInShopTexture[v114 + 6], v114 + 7); |
1300 | 1332 } |
1333 ++v114; | |
1334 } | |
1335 while ( v114 < 6 ); | |
1393 | 1336 if ( HouseUI_CheckIfPlayerCanInteract() ) |
1300 | 1337 { |
1338 v62 = 0; | |
1339 v109 = 0; | |
1340 do | |
1341 { | |
1342 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v62].uItemID) | |
1343 ++v109; | |
1344 ++v62; | |
1345 } | |
1346 while ( v62 < 12 ); | |
1347 v63 = GetAsyncKeyState(17); | |
1348 v64 = pPlayer->CanSteal(); | |
1349 Str = v64; | |
1350 if ( v63 && v64 ) | |
1351 { | |
1352 v65 = pGlobalTXT_LocalizationStrings[185]; | |
1353 } | |
1354 else | |
1355 { | |
1356 v65 = pGlobalTXT_LocalizationStrings[195]; | |
1357 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD) | |
1358 v65 = pGlobalTXT_LocalizationStrings[196]; | |
1359 } | |
1360 DrawTextAtStatusBar(v65, 0); | |
1361 if ( !v109 ) | |
1362 { | |
1529 | 1363 dialog_window.DrawCurrentTime( pParty->field_3C.Shops_next_generation_time[ (unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed); |
1300 | 1364 return; |
1365 } | |
1366 v66 = pMouse->GetCursorPos(&v98); | |
1367 pNumActiveItem = v66->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v96)->y]; | |
1368 if ( pRenderer->pActiveZBuffer[pNumActiveItem] & 0xFFFF ) | |
1369 { | |
1370 v67 = (pRenderer->pActiveZBuffer[pNumActiveItem] & 0xFFFF) - 1; | |
1371 v109 = v67; | |
1372 v68 = (int)window_SpeakInHouse->ptr_1C; | |
1373 // v69 = 9 * (v67 + 12 * v68); | |
1374 v70 = (ItemGen *)&pParty->StandartItemsInShops[v68][v67]; | |
1375 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD) | |
1376 v70 = &pParty->SpecialItemsInShops[(int)v68][v67];//v70 = (ItemGen *)&pParty->field_C59C[v69 + 724]; | |
1377 if ( !v63 || !Str ) | |
1378 { | |
1411 | 1379 v71 = pPlayer->SelectPhrasesTransaction(v70, BuildingType_AlchemistShop, v68, 2); |
1300 | 1380 v38 = (char *)pMerchantsBuyPhrases[v71]; |
1381 } | |
1382 else | |
1383 { | |
1384 v38 = pGlobalTXT_LocalizationStrings[181]; | |
1385 } | |
1410
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1409
diff
changeset
|
1386 v21 = BuildDialogueString(v38, uActiveCharacter - 1, v70, (char *)window_SpeakInHouse->ptr_1C, 2, 0); |
1300 | 1387 v40 = pFontArrus->CalcTextHeight(v21, &dialog_window, 0, 0); |
1388 dialog_window.DrawTitleText(pFontArrus, 0, (174 - v40) / 2 + 138, pColorWhite, v21, 3); | |
1389 return; | |
1390 } | |
1391 } | |
1392 return; | |
1393 } | |
1394 case HOUSE_DIALOGUE_LEARN_SKILLS: | |
1395 { | |
1393 | 1396 if (!HouseUI_CheckIfPlayerCanInteract()) |
1300 | 1397 return; |
1398 all_text_height = 0; | |
1399 v5 = (signed __int64)(p2DEvents[(signed int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0); | |
1400 pItemNum = v5 * (100 - pPlayer->GetMerchant()) / 100; | |
1401 if ( pItemNum < v5 / 3 ) | |
1402 pItemNum = v5 / 3; | |
1403 pNumActiveItem = pDialogueWindow->pStartingPosActiveItem; | |
1404 v114 = 0; | |
1405 if ( pNumActiveItem >= pNumActiveItem + pDialogueWindow->pNumPresenceButton ) | |
1406 { | |
1407 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayer->pName, pClassNames[pPlayer->classType]); | |
1408 strcat(pTmpBuf.data(), "\n \n"); | |
1409 strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]); | |
1410 v40 = pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 0, 0); | |
1411 dialog_window.DrawTitleText(pFontArrus, 0, (174 - v40) / 2 + 138, pColorYellow, pTmpBuf.data(), 3); | |
1412 return; | |
1413 } | |
1414 do | |
1415 { | |
1416 v8 = pDialogueWindow->GetControl(pNumActiveItem)->msg_param - 36; | |
1417 if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayer->classType][v8] && !pPlayer->pActiveSkills[v8] ) | |
1418 { | |
1419 all_text_height = pFontArrus->CalcTextHeight(pSkillNames[v8], &dialog_window, 0, 0); | |
1420 ++v114; | |
1421 } | |
1422 ++pNumActiveItem; | |
1423 } | |
1424 while ( pNumActiveItem < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem ); | |
1425 if ( !v114 ) | |
1426 { | |
1427 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayer->pName, pClassNames[pPlayer->classType]); | |
1428 strcat(pTmpBuf.data(), "\n \n"); | |
1429 strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]); | |
1430 v40 = pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 0, 0); | |
1431 dialog_window.DrawTitleText(pFontArrus, 0, (174 - v40) / 2 + 138, pColorYellow, pTmpBuf.data(), 3); | |
1432 return; | |
1433 } | |
1434 if ( v114 ) | |
1435 { | |
1436 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[401], pItemNum); | |
1437 dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3); | |
1438 v18 = (149 - all_text_height) / v114; | |
1439 if ( (149 - all_text_height) / v114 > 32 ) | |
1440 v18 = 32; | |
1441 pNumActiveItem = pDialogueWindow->pStartingPosActiveItem; | |
1442 v105 = (149 - v114 * v18 - all_text_height) / 2 - v18 / 2 + 162; | |
1443 if ( pNumActiveItem < pNumActiveItem + pDialogueWindow->pNumPresenceButton ) | |
1444 { | |
1445 pItemNum = 2; | |
1446 do | |
1447 { | |
1448 pButton = pDialogueWindow->GetControl(pItemNum); | |
1449 v13 = pButton->msg_param - 36; | |
1450 if ( !byte_4ED970_skill_learn_ability_by_class_table[pPlayer->classType][v13] || pPlayer->pActiveSkills[v13] ) | |
1451 { | |
1452 pButton->uW = 0; | |
1453 pButton->uHeight = 0; | |
1454 pButton->uY = 0; | |
1455 } | |
1456 else | |
1457 { | |
1458 pButton->uY = v18 + v105; | |
1459 pTextHeight = pFontArrus->CalcTextHeight(pSkillNames[v13], &dialog_window, 0, 0); | |
1460 pButton->uHeight = pTextHeight; | |
1461 v105 = pButton->uY + pTextHeight - 1; | |
1462 pButton->uW = v105; | |
1463 pColorText = pColorYellow; | |
1464 if ( pDialogueWindow->pCurrentPosActiveItem != pItemNum ) | |
1465 pColorText = pColorWhite; | |
1466 dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, pSkillNames[v13], 3); | |
1467 } | |
1468 pNumActiveItem = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; | |
1469 pItemNum++; | |
1470 } | |
1471 while ( pItemNum < pNumActiveItem ); | |
1472 } | |
1473 return; | |
1474 } | |
1475 } | |
1476 default: | |
1477 { | |
1478 return;// (POINT *)dialog_menu_id - 96; | |
1479 } | |
1480 } | |
1481 } | |
1482 //----- (004B4FCF) -------------------------------------------------------- | |
1483 void MagicShopDialog() | |
1484 { | |
1485 int result; // eax@6 | |
1486 signed int v2; // esi@8 | |
1487 unsigned int v3; // ebx@10 | |
1488 char *v4; // eax@11 | |
1489 char *v5; // eax@12 | |
1490 unsigned int v6; // eax@12 | |
1491 int v7; // ST08_4@14 | |
1492 int v8; // eax@14 | |
1493 unsigned __int8 v9; // dl@14 | |
1494 char *v10; // ecx@14 | |
1495 signed int v11; // esi@16 | |
1496 int v12; // ST08_4@19 | |
1497 int v13; // eax@19 | |
1498 int all_text_height; // edi@21 | |
1499 char **v15; // esi@21 | |
1500 int v16; // eax@22 | |
1501 int v18; // edx@23 | |
1502 int v19; // edi@23 | |
1503 unsigned __int8 v20; // sf@23 | |
1504 GUIButton *control_button; // esi@25 | |
1505 const char **v22; // eax@25 | |
1506 int v23; // eax@25 | |
1507 unsigned int v24; // ecx@25 | |
1508 const char **v25; // edx@25 | |
1509 unsigned __int16 text_color; // ax@25 | |
1510 signed int pTextHeight; // esi@30 | |
1511 int v28; // ST08_4@34 | |
1512 int v29; // eax@34 | |
1513 char *v30; // edx@35 | |
1514 void *v32; // eax@40 | |
1515 signed int v33; // esi@40 | |
1516 unsigned int v34; // esi@42 | |
1517 int v35; // eax@42 | |
1518 unsigned int v36; // eax@43 | |
1519 int v37; // eax@45 | |
1520 int v38; // ecx@50 | |
1521 int v41; // eax@52 | |
1522 char *v42; // eax@54 | |
1523 int v43; // eax@54 | |
1524 unsigned int v44; // ecx@54 | |
1525 int v45; // edx@54 | |
1526 int v46; // eax@54 | |
1527 unsigned __int16 v47; // ax@54 | |
1528 int v48; // eax@58 | |
1529 signed int v49; // esi@62 | |
1530 Texture *v50; // ecx@64 | |
1531 unsigned int v51; // edi@64 | |
1532 unsigned int v52; // esi@66 | |
1533 int v53; // edx@70 | |
1534 Texture *v54; // ecx@76 | |
1535 unsigned int v55; // edi@76 | |
1536 unsigned int v56; // esi@76 | |
1537 int v57; // edx@80 | |
1538 unsigned int v59; // edi@86 | |
1539 unsigned int v60; // esi@88 | |
1540 int v61; // edx@92 | |
1541 unsigned int v63; // edi@98 | |
1542 unsigned int v64; // esi@100 | |
1543 int v65; // edx@104 | |
1544 signed int v66; // ecx@109 | |
1545 SHORT v67; // di@117 | |
1546 bool v68; // eax@117 | |
1547 const char *v69; // ecx@119 | |
1548 POINT *v70; // esi@124 | |
1549 int v71; // ecx@125 | |
1550 int v73; // ecx@125 | |
1551 int v75; // eax@130 | |
1552 int v78; // eax@132 | |
1553 int v80; // edx@133 | |
1554 int v81; // edi@133 | |
1555 const char **v83; // eax@135 | |
1556 int v84; // eax@135 | |
1557 unsigned int v85; // ecx@135 | |
1558 int v86; // edx@135 | |
1559 int v89; // [sp-14h] [bp-10Ch]@35 | |
1560 int v91; // [sp-10h] [bp-108h]@35 | |
1561 unsigned __int16 v92; // [sp-Ch] [bp-104h]@12 | |
1562 void *v93; // [sp-Ch] [bp-104h]@14 | |
1563 int v94; // [sp-8h] [bp-100h]@11 | |
1564 char *v95; // [sp-8h] [bp-100h]@12 | |
1565 __int64 *v96; // [sp-4h] [bp-FCh]@11 | |
1566 unsigned int v97; // [sp-4h] [bp-FCh]@12 | |
1567 POINT v98; // [sp+Ch] [bp-ECh]@8 | |
1568 POINT v99; // [sp+14h] [bp-E4h]@16 | |
1569 POINT v100; // [sp+1Ch] [bp-DCh]@124 | |
1570 POINT v101; // [sp+24h] [bp-D4h]@17 | |
1571 POINT v102; // [sp+2Ch] [bp-CCh]@124 | |
1572 POINT v103; // [sp+34h] [bp-C4h]@9 | |
1573 POINT v104; // [sp+3Ch] [bp-BCh]@31 | |
1574 POINT v105; // [sp+44h] [bp-B4h]@16 | |
1575 POINT v106; // [sp+4Ch] [bp-ACh]@30 | |
1576 POINT v107; // [sp+54h] [bp-A4h]@16 | |
1577 POINT v108; // [sp+5Ch] [bp-9Ch]@30 | |
1578 POINT a2; // [sp+64h] [bp-94h]@8 | |
1579 POINT v110; // [sp+6Ch] [bp-8Ch]@30 | |
1580 POINT v111; // [sp+74h] [bp-84h]@8 | |
1581 GUIWindow dialog_window; // [sp+7Ch] [bp-7Ch]@1 | |
1582 char *Str; // [sp+D0h] [bp-28h]@54 | |
1583 int v146; // [sp+D4h] [bp-24h]@23 | |
1584 unsigned int pYellowColor; // [sp+D8h] [bp-20h]@1 | |
1585 unsigned int pWhiteColor; // [sp+DCh] [bp-1Ch]@1 | |
1586 __int32 v117; // [sp+E0h] [bp-18h]@8 | |
1587 int v118; // [sp+E4h] [bp-14h]@40 | |
1588 const char **v119; // [sp+E8h] [bp-10h]@24 | |
1589 int _this; // [sp+ECh] [bp-Ch]@1 | |
1590 unsigned __int8 uPlayerID; // [sp+F3h] [bp-5h]@14 | |
1591 int v152; // [sp+F4h] [bp-4h]@23 | |
1592 int v122; | |
1593 int v114; | |
1594 int pSrtingNum; | |
1595 int pActiveItemNum; | |
1596 ItemGen *item; | |
1597 | |
1598 memcpy(&dialog_window, window_SpeakInHouse, sizeof(dialog_window)); | |
1599 dialog_window.uFrameX = 483; | |
1600 dialog_window.uFrameWidth = 148; | |
1601 dialog_window.uFrameZ = 334; | |
1602 pWhiteColor = TargetColor(255, 255, 255); | |
1603 pYellowColor = TargetColor(225, 205, 35); | |
1604 if ( dialog_menu_id == HOUSE_DIALOGUE_MAIN) | |
1605 { | |
1393 | 1606 if ( !HouseUI_CheckIfPlayerCanInteract() ) |
1300 | 1607 return; |
1608 pShopOptions[0] = pGlobalTXT_LocalizationStrings[134]; //"Buy Standard" | |
1609 pShopOptions[1] = pGlobalTXT_LocalizationStrings[152]; //"Buy Special" | |
1610 pShopOptions[2] = pGlobalTXT_LocalizationStrings[159]; //"Display Inventory" | |
1611 pShopOptions[3] = pGlobalTXT_LocalizationStrings[160]; | |
1612 all_text_height = 0; | |
1613 for ( int i = 0; i < 4; ++i ) | |
1614 all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0); | |
1615 v146 = (174 - all_text_height) / 4; | |
1616 v23 = (174 - 4 * (174 - all_text_height) / 4 - all_text_height) / 2 - (174 - all_text_height) / 4 / 2 + 138; | |
1617 int j = 0; | |
1618 if ( pDialogueWindow->pNumPresenceButton>=0 ) | |
1619 { | |
1620 int th = 2; | |
1621 for (v152 = pDialogueWindow->pStartingPosActiveItem; v152 < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++v152) | |
1622 { | |
1623 control_button = pDialogueWindow->GetControl(v152); | |
1624 control_button->uY = v146 + v23; | |
1625 pTextHeight = pFontArrus->CalcTextHeight(pShopOptions[j], &dialog_window, 0, 0); | |
1626 control_button->uHeight = pTextHeight; | |
1627 v23 = control_button->uY + control_button->uHeight - 1; | |
1628 control_button->uW = v23; | |
1629 text_color = pYellowColor; | |
1630 if ( pDialogueWindow->pCurrentPosActiveItem != th ) | |
1631 text_color = pWhiteColor; | |
1632 dialog_window.DrawTitleText(pFontArrus, 0, control_button->uY, text_color, pShopOptions[j], 3); | |
1633 ++th; | |
1634 ++j; | |
1635 } | |
1636 } | |
1637 return; | |
1638 } | |
1639 if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_BUY_STANDARD) | |
1640 { | |
1641 pRenderer->DrawTextureIndexed(8, 8, ShopTexture); | |
1642 v3 = 0; | |
1643 v49 = 0; | |
1644 v122 = 0; | |
1645 do | |
1646 { | |
1647 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v49].uItemID) | |
1648 { | |
1649 v50 = ItemsInShopTexture[v49]; | |
1650 v51 = 152 - v50->uTextureHeight; | |
1651 if ( (signed int)v51 < 1 ) | |
1652 v51 = 0; | |
1653 v52 = 75 * v49 - v50->uTextureWidth / 2 + 40; | |
1654 if ( v122 ) | |
1655 { | |
1656 if ( v122 == 5 ) | |
1657 { | |
1658 v53 = ItemsInShopTexture[5]->uTextureWidth; | |
1659 if ( (signed int)v52 > 457 - v53 ) | |
1660 v52 = 457 - v53; | |
1661 } | |
1662 } | |
1663 else | |
1664 { | |
1665 if ( (signed int)v52 < 18 ) | |
1666 v52 = 18; | |
1667 } | |
1668 pRenderer->DrawTextureTransparent(v52, v51, v50); | |
1458 | 1669 ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[v52 + 640 * v51], ItemsInShopTexture[v122], v122 + 1); |
1300 | 1670 v49 = v122; |
1671 } | |
1672 ++v49; | |
1673 v122 = v49; | |
1674 } | |
1675 while ( v49 < 6 ); | |
1676 v122 = 0; | |
1677 do | |
1678 { | |
1679 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v122 + 6].uItemID) | |
1680 { | |
1681 v54 = ItemsInShopTexture[v122 + 6]; | |
1682 v55 = 306 - v54->uTextureHeight; | |
1683 v56 = 75 * v122 - v54->uTextureWidth / 2 + 40; | |
1684 if ( v122 ) | |
1685 { | |
1686 if ( v122 == 5 ) | |
1687 { | |
1688 v57 = ItemsInShopTexture[11]->uTextureWidth; | |
1689 if ( (signed int)v56 > 457 - v57 ) | |
1690 v56 = 457 - v57; | |
1691 } | |
1692 } | |
1693 else | |
1694 { | |
1695 if ( (signed int)v56 < 18 ) | |
1696 v56 = 18; | |
1697 } | |
1698 pRenderer->DrawTextureTransparent(v56, v55, v54); | |
1458 | 1699 ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[v56 + 640 * v55], ItemsInShopTexture[v122 + 6], v122 + 7); |
1300 | 1700 } |
1701 ++v122; | |
1702 } | |
1703 while ( v122 < 6 ); | |
1393 | 1704 if ( HouseUI_CheckIfPlayerCanInteract() ) |
1300 | 1705 { |
1706 v66 = 0; | |
1707 v117 = 0; | |
1708 if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_BUY_STANDARD) | |
1709 { | |
1710 do | |
1711 { | |
1712 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v66].uItemID) //9 * (v66 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] ) | |
1713 ++v117; | |
1714 ++v66; | |
1715 } | |
1716 while ( v66 < 12 ); | |
1717 } | |
1718 else | |
1719 { | |
1720 do | |
1721 { | |
1722 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v66].uItemID) | |
1723 ++v117; | |
1724 ++v66; | |
1725 } | |
1726 while ( v66 < 12 ); | |
1727 } | |
1728 v67 = GetAsyncKeyState(VK_CONTROL); | |
1729 v68 = pPlayers[uActiveCharacter]->CanSteal(); | |
1730 Str = (char *)v68; | |
1731 if ( v67 && v68 ) | |
1732 { | |
1733 v69 = pGlobalTXT_LocalizationStrings[185];// "Steal item" | |
1734 } | |
1735 else | |
1736 { | |
1737 v69 = pGlobalTXT_LocalizationStrings[195];// "Select the Item to Buy" | |
1738 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD) | |
1739 v69 = pGlobalTXT_LocalizationStrings[196];// "Select the Special Item to Buy" | |
1740 } | |
1741 DrawTextAtStatusBar(v69, 0); | |
1742 if ( !v117 ) | |
1743 { | |
1529 | 1744 dialog_window.DrawCurrentTime( pParty->field_3C.Shops_next_generation_time[(unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed); |
1300 | 1745 return; |
1746 } | |
1747 v70 = pMouse->GetCursorPos(&v102); | |
1748 result = v70->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v100)->y]; | |
1749 if ( pRenderer->pActiveZBuffer[result] & 0xFFFF ) | |
1750 { | |
1751 v71 = (pRenderer->pActiveZBuffer[result] & 0xFFFF) - 1; | |
1752 item = &pParty->StandartItemsInShops[(int)window_SpeakInHouse->ptr_1C][v71]; | |
1753 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD) | |
1754 item = &pParty->SpecialItemsInShops[(int)window_SpeakInHouse->ptr_1C][v71]; | |
1755 if ( v67 && Str ) | |
1756 v10 = pGlobalTXT_LocalizationStrings[181];// "Steal %24" | |
1757 else | |
1758 { | |
1411 | 1759 v75 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(item, BuildingType_MagicShop, (int)window_SpeakInHouse->ptr_1C, 2); |
1300 | 1760 v10 = (char *)pMerchantsBuyPhrases[v75]; |
1761 } | |
1410
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1409
diff
changeset
|
1762 v30 = BuildDialogueString(v10, uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 2, 0); |
1300 | 1763 v6 = (174 - pFontArrus->CalcTextHeight(v30, &dialog_window, v3, v3)) / 2 + 138; |
1764 dialog_window.DrawTitleText(pFontArrus, v3, v6, pWhiteColor, v30, 3); | |
1765 return; | |
1766 } | |
1767 } | |
1768 return; | |
1769 } | |
1770 if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_BUY_SPECIAL) | |
1771 { | |
1772 pRenderer->DrawTextureIndexed(8, 8, ShopTexture); | |
1773 v3 = 0; | |
1774 v49 = 0; | |
1775 v122 = 0; | |
1776 do | |
1777 { | |
1778 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v49].uItemID) | |
1779 { | |
1780 v59 = 152 - ItemsInShopTexture[v49]->uTextureHeight; | |
1781 if ( (signed int)v59 < 1 ) | |
1782 v59 = 0; | |
1783 v60 = 75 * v49 - ItemsInShopTexture[v49]->uTextureWidth / 2 + 40; | |
1784 if ( v122 ) | |
1785 { | |
1786 if ( v122 == 5 ) | |
1787 { | |
1788 v61 = ItemsInShopTexture[5]->uTextureWidth; | |
1789 if ( (signed int)v60 > 457 - v61 ) | |
1790 v60 = 457 - v61; | |
1791 } | |
1792 } | |
1793 else | |
1794 { | |
1795 if ( (signed int)v60 < 18 ) | |
1796 v60 = 18; | |
1797 } | |
1798 pRenderer->DrawTextureTransparent(v60, v59, ItemsInShopTexture[v49]); | |
1458 | 1799 ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[v60 + 640 * v59], ItemsInShopTexture[v122], v122 + 1); |
1300 | 1800 v49 = v122; |
1801 } | |
1802 ++v49; | |
1803 v122 = v49; | |
1804 } | |
1805 while ( v49 < 6 ); | |
1806 v122 = 0; | |
1807 do | |
1808 { | |
1809 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v122 + 6].uItemID) | |
1810 { | |
1811 v63 = 306 - ItemsInShopTexture[v122 + 6]->uTextureHeight; | |
1812 if ( (signed int)v63 < 1 ) | |
1813 v63 = 0; | |
1814 v64 = 75 * v122 - ItemsInShopTexture[v122 + 6]->uTextureWidth / 2 + 40; | |
1815 if ( v122 ) | |
1816 { | |
1817 if ( v122 == 5 ) | |
1818 { | |
1819 v65 = ItemsInShopTexture[11]->uTextureWidth; | |
1820 if ( (signed int)v64 > 457 - v65 ) | |
1821 v64 = 457 - v65; | |
1822 } | |
1823 } | |
1824 else | |
1825 { | |
1826 if ( (signed int)v64 < 18 ) | |
1827 v64 = 18; | |
1828 } | |
1829 pRenderer->DrawTextureTransparent(v64, v63, ItemsInShopTexture[v122 + 6]); | |
1458 | 1830 ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[v64 + 640 * v63], ItemsInShopTexture[v122 + 6], v122 + 7); |
1300 | 1831 } |
1832 ++v122; | |
1833 } | |
1834 while ( v122 < 6 ); | |
1393 | 1835 if ( HouseUI_CheckIfPlayerCanInteract() ) |
1300 | 1836 { |
1837 v66 = 0; | |
1838 v117 = 0; | |
1839 if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_BUY_STANDARD) | |
1840 { | |
1841 do | |
1842 { | |
1843 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v66].uItemID) //9 * (v66 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] ) | |
1844 ++v117; | |
1845 ++v66; | |
1846 } | |
1847 while ( v66 < 12 ); | |
1848 } | |
1849 else | |
1850 { | |
1851 do | |
1852 { | |
1853 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v66].uItemID) | |
1854 ++v117; | |
1855 ++v66; | |
1856 } | |
1857 while ( v66 < 12 ); | |
1858 } | |
1859 v67 = GetAsyncKeyState(VK_CONTROL); | |
1860 v68 = pPlayers[uActiveCharacter]->CanSteal(); | |
1861 Str = (char *)v68; | |
1862 if ( v67 && v68 ) | |
1863 { | |
1864 v69 = pGlobalTXT_LocalizationStrings[185];// "Steal item" | |
1865 } | |
1866 else | |
1867 { | |
1868 v69 = pGlobalTXT_LocalizationStrings[195];// "Select the Item to Buy" | |
1869 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD) | |
1870 v69 = pGlobalTXT_LocalizationStrings[196];// "Select the Special Item to Buy" | |
1871 } | |
1872 DrawTextAtStatusBar(v69, 0); | |
1873 if ( !v117 ) | |
1874 { | |
1529 | 1875 dialog_window.DrawCurrentTime( pParty->field_3C.Shops_next_generation_time[(unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed); |
1300 | 1876 return; |
1877 } | |
1878 v70 = pMouse->GetCursorPos(&v102); | |
1466 | 1879 result = v70->x + pSRZBufferLineOffsets[v70->y]; |
1300 | 1880 if ( pRenderer->pActiveZBuffer[result] & 0xFFFF ) |
1881 { | |
1882 v71 = (pRenderer->pActiveZBuffer[result] & 0xFFFF) - 1; | |
1883 item = &pParty->StandartItemsInShops[(int)window_SpeakInHouse->ptr_1C][v71]; | |
1884 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD) | |
1885 item = &pParty->SpecialItemsInShops[(int)window_SpeakInHouse->ptr_1C][v71]; | |
1886 if ( v67 && Str ) | |
1887 v10 = pGlobalTXT_LocalizationStrings[181];// "Steal %24" | |
1888 else | |
1889 { | |
1411 | 1890 v75 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(item, BuildingType_MagicShop, (int)window_SpeakInHouse->ptr_1C, 2); |
1300 | 1891 v10 = (char *)pMerchantsBuyPhrases[v75]; |
1892 } | |
1410
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1409
diff
changeset
|
1893 v30 = BuildDialogueString(v10, uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 2, 0); |
1300 | 1894 v6 = (174 - pFontArrus->CalcTextHeight(v30, &dialog_window, v3, v3)) / 2 + 138; |
1895 dialog_window.DrawTitleText(pFontArrus, v3, v6, pWhiteColor, v30, 3); | |
1896 return; | |
1897 } | |
1898 } | |
1899 return; | |
1900 } | |
1901 if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT ) | |
1902 { | |
1903 draw_leather(); | |
1904 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); | |
1905 pShopOptions[0] = pGlobalTXT_LocalizationStrings[200];// "Sell" | |
1906 pShopOptions[1] = pGlobalTXT_LocalizationStrings[113];// "Identify" | |
1907 pShopOptions[2] = pGlobalTXT_LocalizationStrings[179];// "Repair" | |
1908 all_text_height = 0; | |
1909 for ( uint i = 0; i < 3; ++i ) | |
1910 all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0); | |
1911 _this = ((174 - all_text_height) / 3); | |
1912 v81 = (3 * (58 - (signed int)_this) - all_text_height) / 2 - (174 - all_text_height) / 3 / 2 + 138; | |
1913 v20 = -pDialogueWindow->pNumPresenceButton < 0; | |
1914 v118 = pDialogueWindow->pStartingPosActiveItem; | |
1915 if ( v20 ^ (pDialogueWindow->pStartingPosActiveItem > pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton) ) | |
1916 { | |
1917 v122 = 2; | |
1918 pSrtingNum = 0; | |
1919 do | |
1920 { | |
1921 control_button = pDialogueWindow->GetControl(v118); | |
1922 control_button->uY = (unsigned int)((char *)_this + v81); | |
1923 pTextHeight = pFontArrus->CalcTextHeight(pShopOptions[pSrtingNum], &dialog_window, 0, 0); | |
1924 v85 = control_button->uY; | |
1925 control_button->uHeight = pTextHeight; | |
1926 v81 = pTextHeight + v85 - 1; | |
1927 control_button->uW = v81; | |
1928 text_color = pYellowColor; | |
1929 if ( pDialogueWindow->pCurrentPosActiveItem != v122 ) | |
1930 text_color = pWhiteColor; | |
1931 dialog_window.DrawTitleText(pFontArrus, 0, v85, text_color, pShopOptions[pSrtingNum], 3); | |
1932 ++v122; | |
1933 ++pSrtingNum; | |
1934 ++v118; | |
1935 } | |
1936 while ( v118 < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem ); | |
1937 } | |
1938 return; | |
1939 } | |
1940 if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_SELL) | |
1941 { | |
1942 draw_leather(); | |
1943 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); | |
1944 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[199], 0);// "Select the Item to Sell" | |
1393 | 1945 if ( !HouseUI_CheckIfPlayerCanInteract() |
1300 | 1946 || (v11 = pMouse->GetCursorPos(&v107)->x - 14, |
1947 v117 = (v11 >> 5) + 14 * ((pMouse->GetCursorPos(&v99)->y - 17) >> 5), | |
1948 result = (int)pMouse->GetCursorPos(&v105), | |
1949 *(int *)result <= 13) | |
1950 || (result = (int)pMouse->GetCursorPos(&v101), *(int *)result >= 462) | |
1951 || (result = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v117), v3 = 0, !result) ) | |
1952 return; | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1300
diff
changeset
|
1953 item = &pPlayers[uActiveCharacter]->pInventoryItemList[result - 1]; |
1411 | 1954 v13 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(item, BuildingType_MagicShop, (int)window_SpeakInHouse->ptr_1C, 3); |
1410
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1409
diff
changeset
|
1955 v30 = BuildDialogueString((char *)pMerchantsSellPhrases[v13], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 3, 0); |
1300 | 1956 v6 = (174 - pFontArrus->CalcTextHeight(v30, &dialog_window, v3, v3)) / 2 + 138; |
1957 dialog_window.DrawTitleText(pFontArrus, v3, v6, pWhiteColor, v30, 3); | |
1958 return; | |
1959 } | |
1960 if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_IDENTIFY) | |
1961 { | |
1962 draw_leather(); | |
1963 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); | |
1964 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[197], 0);// "Select the Item to Identify" | |
1393 | 1965 if ( HouseUI_CheckIfPlayerCanInteract() ) |
1300 | 1966 { |
1967 v2 = pMouse->GetCursorPos(&a2)->x - 14; | |
1968 v117 = (v2 >> 5) + 14 * ((pMouse->GetCursorPos(&v98)->y - 17) >> 5); | |
1969 result = (int)pMouse->GetCursorPos(&v111); | |
1970 if ( *(int *)result > 13 ) | |
1971 { | |
1972 result = (int)pMouse->GetCursorPos(&v103); | |
1973 if ( *(int *)result < 462 ) | |
1974 { | |
1975 result = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v117); | |
1976 if ( result ) | |
1977 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1300
diff
changeset
|
1978 item = &pPlayers[uActiveCharacter]->pInventoryItemList[result-1]; |
1300 | 1979 if ( item->uAttributes & 1 ) |
1980 { | |
1410
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1409
diff
changeset
|
1981 v5 = BuildDialogueString("%24", uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 4, 0); |
1300 | 1982 v6 = (212 - pFontArrus->CalcTextHeight(v5, &dialog_window, 0, 0)) / 2 + 101; |
1983 dialog_window.DrawTitleText(pFontArrus, 0, v6, pWhiteColor, v5, 3); | |
1984 return; | |
1985 } | |
1411 | 1986 v8 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(item, BuildingType_MagicShop, (int)window_SpeakInHouse->ptr_1C, 4); |
1410
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1409
diff
changeset
|
1987 v30 = BuildDialogueString((char *)pMerchantsIdentifyPhrases[v8], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 4, 0); |
1300 | 1988 v6 = (174 - pFontArrus->CalcTextHeight(v30, &dialog_window, 0, 0)) / 2 + 138; |
1989 dialog_window.DrawTitleText(pFontArrus, 0, v6, pWhiteColor, v30, 3); | |
1990 return; | |
1991 } | |
1992 } | |
1993 } | |
1994 } | |
1995 return; | |
1996 } | |
1997 if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_REPAIR) | |
1998 { | |
1999 draw_leather(); | |
2000 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); | |
2001 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[198], 0);// "Select the Item to Repair" | |
1393 | 2002 if ( !HouseUI_CheckIfPlayerCanInteract() |
1300 | 2003 || (pTextHeight = pMouse->GetCursorPos(&v110)->x - 14, |
2004 v117 = (pTextHeight >> 5) + 14 * ((pMouse->GetCursorPos(&v108)->y - 17) >> 5), | |
2005 result = (int)pMouse->GetCursorPos(&v106), | |
2006 *(int *)result <= 13) | |
2007 || (result = (int)pMouse->GetCursorPos(&v104), *(int *)result >= 462) | |
2008 || (result = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v117), v3 = 0, !result) | |
2009 // || (result *= 9, !(pPlayers[uActiveCharacter]->field_1F5[4 * result + 15] & 2)) ) | |
2010 || (!(pPlayers[uActiveCharacter]->pOwnItems[result-1].uAttributes& 2)) ) | |
2011 return; | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1300
diff
changeset
|
2012 item = &pPlayers[uActiveCharacter]->pInventoryItemList[result - 1]; |
1411 | 2013 v29 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(&pPlayers[uActiveCharacter]->pInventoryItemList[result - 1], BuildingType_MagicShop, (int)window_SpeakInHouse->ptr_1C, 5); |
1410
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1409
diff
changeset
|
2014 v30 = BuildDialogueString((char *)pMerchantsRepairPhrases[v29], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 5, 0); |
1300 | 2015 v6 = (174 - pFontArrus->CalcTextHeight(v30, &dialog_window, v3, v3)) / 2 + 138; |
2016 dialog_window.DrawTitleText(pFontArrus, v3, v6, pWhiteColor, v30, 3); | |
2017 return; | |
2018 } | |
2019 if ( dialog_menu_id == HOUSE_DIALOGUE_LEARN_SKILLS ) | |
2020 { | |
1393 | 2021 if ( HouseUI_CheckIfPlayerCanInteract() ) |
1300 | 2022 { |
2023 v3 = 0; | |
2024 all_text_height = 0; | |
2025 v33 = (signed __int64)(p2DEvents[(signed int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0); | |
2026 v119 = (const char **)(v33 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100); | |
2027 if ( (signed int)v119 < v33 / 3 ) | |
2028 v119 = (const char **)(v33 / 3); | |
2029 pActiveItemNum = pDialogueWindow->pStartingPosActiveItem; | |
2030 v122 = 0; | |
2031 if ( (signed int)pDialogueWindow->pStartingPosActiveItem >= pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton ) | |
2032 { | |
2033 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]);// | |
2034 // "Seek knowledge elsewhere %s the %s" | |
2035 strcat(pTmpBuf.data(), "\n \n"); | |
2036 strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]);// "I can offer you nothing further." | |
2037 v6 = (174 - pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 0, 0)) / 2 + 138; | |
2038 dialog_window.DrawTitleText(pFontArrus, v3, v6, pYellowColor, pTmpBuf.data(), 3); | |
2039 return; | |
2040 } | |
2041 do | |
2042 { | |
2043 v36 = pDialogueWindow->GetControl(pActiveItemNum)->msg_param - 36; | |
2044 if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][v36] && !pPlayers[uActiveCharacter]->pActiveSkills[v36] ) | |
2045 { | |
2046 all_text_height += pFontArrus->CalcTextHeight(pSkillNames[v36], &dialog_window, 0, 0); | |
2047 ++v122; | |
2048 } | |
2049 ++pActiveItemNum; | |
2050 } | |
2051 while ( pActiveItemNum < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem ); | |
2052 if ( !v122 ) | |
2053 { | |
2054 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]);// | |
2055 // "Seek knowledge elsewhere %s the %s" | |
2056 strcat(pTmpBuf.data(), "\n \n"); | |
2057 strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]);// "I can offer you nothing further." | |
2058 v6 = (174 - pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 0, 0)) / 2 + 138; | |
2059 dialog_window.DrawTitleText(pFontArrus, v3, v6, pYellowColor, pTmpBuf.data(), 3); | |
2060 return; | |
2061 } | |
2062 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[401], v119);// "Skill Cost: %lu" | |
2063 dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3u); | |
2064 v119 = (const char **)((149 - all_text_height) / v122); | |
2065 if ( (149 - all_text_height) / v122 > 32 ) | |
2066 v119 = (const char **)32; | |
2067 v38 = (149 - v122 * (signed int)v119 - all_text_height) / 2 - (signed int)v119 / 2 + 162; | |
2068 v118 = 2; | |
2069 if ( pDialogueWindow->pStartingPosActiveItem < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton ) | |
2070 { | |
2071 v122 = 2; | |
2072 do | |
2073 { | |
2074 control_button = pDialogueWindow->GetControl(v122); | |
2075 v41 = control_button->msg_param - 36; | |
2076 if ( !byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][v41] || pPlayers[uActiveCharacter]->pActiveSkills[v41] ) | |
2077 { | |
2078 control_button->uW = 0; | |
2079 control_button->uHeight = 0; | |
2080 control_button->uY = 0; | |
2081 } | |
2082 else | |
2083 { | |
2084 control_button->uY = (unsigned int)((char *)v119 + v38); | |
2085 pTextHeight = pFontArrus->CalcTextHeight(pSkillNames[v41], &dialog_window, 0, 0); | |
2086 v44 = control_button->uY; | |
2087 control_button->uHeight = pTextHeight; | |
2088 v38 = v44 + pTextHeight - 1; | |
2089 control_button->uW = v38; | |
2090 text_color = pYellowColor; | |
2091 if ( pDialogueWindow->pCurrentPosActiveItem != v122 ) | |
2092 text_color = pWhiteColor; | |
2093 dialog_window.DrawTitleText(pFontArrus, 0, v44, text_color, pSkillNames[v41], 3); | |
2094 } | |
2095 ++v122; | |
2096 } | |
2097 while ( v122 < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem ); | |
2098 } | |
2099 } | |
2100 return; | |
2101 } | |
2102 return; | |
2103 } | |
2104 //----- (004BDB56) -------------------------------------------------------- | |
1458 | 2105 void UIShop_Buy_Identify_Repair() |
1300 | 2106 { |
2107 int v8; // eax@15 | |
2108 unsigned int pItemID; // esi@20 | |
2109 ItemGen *item; // esi@21 | |
2110 unsigned int v15; // eax@33 | |
2111 POINT *pCursorPos; // esi@37 | |
2112 int v18; // ecx@37 | |
2113 float pPriceMultiplier; // ST1C_4@38 | |
2114 int taken_item; // eax@40 | |
2115 ItemGen *bought_item; // esi@51 | |
2116 int party_reputation; // eax@55 | |
2117 int v39; // eax@63 | |
2118 int v42; // esi@74 | |
2119 signed int v43; // ebx@74 | |
2120 unsigned __int16 *pSkill; // esi@77 | |
2121 int v55; // [sp+0h] [bp-B4h]@26 | |
2122 POINT cursor; // [sp+40h] [bp-74h]@37 | |
2123 int a6; // [sp+98h] [bp-1Ch]@57 | |
2124 int a3; // [sp+9Ch] [bp-18h]@53 | |
2125 unsigned int uNumSeconds; // [sp+A4h] [bp-10h]@53 | |
2126 unsigned int v79; // [sp+A8h] [bp-Ch]@9 | |
2127 int uPriceItemService; // [sp+ACh] [bp-8h]@12 | |
2128 | |
2129 if ( pCurrentScreen == SCREEN_E ) | |
2130 { | |
1683 | 2131 pPlayers[uActiveCharacter]->OnInventoryLeftClick(); |
1300 | 2132 return; |
2133 } | |
1393 | 2134 if ( !HouseUI_CheckIfPlayerCanInteract() ) |
1300 | 2135 { |
2136 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); | |
2137 return; | |
2138 } | |
2139 | |
2140 switch(dialog_menu_id) | |
2141 { | |
2142 case HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT: | |
2143 { | |
2144 pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 103; | |
1683 | 2145 pPlayers[uActiveCharacter]->OnInventoryLeftClick(); |
1300 | 2146 break; |
2147 } | |
2148 case HOUSE_DIALOGUE_GUILD_BUY_BOOKS: | |
2149 { | |
2150 pCursorPos = pMouse->GetCursorPos(&cursor); | |
2151 v18 = pRenderer->pActiveZBuffer[pCursorPos->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&cursor)->y]] & 0xFFFF; | |
2152 if ( !v18 ) | |
2153 return; | |
2154 bought_item = (ItemGen *)(&pParty->pPlayers[1].uExpressionTimeLength + 18 * (v18 + 12 * (int)window_SpeakInHouse->ptr_1C)); | |
2155 pPriceMultiplier = p2DEvents[(signed int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier; | |
2156 uPriceItemService = pPlayers[uActiveCharacter]->GetBuyingPrice(bought_item->GetValue(), pPriceMultiplier); | |
2157 GetAsyncKeyState(VK_CONTROL); | |
2158 if ( pParty->uNumGold < uPriceItemService ) | |
2159 { | |
2160 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)2); | |
2161 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2); | |
2162 return; | |
2163 } | |
2164 taken_item = pPlayers[uActiveCharacter]->AddItem(-1, bought_item->uItemID); | |
2165 if ( taken_item ) | |
2166 { | |
2167 bought_item->SetIdentified(); | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1300
diff
changeset
|
2168 memcpy(&pPlayers[uActiveCharacter]->pInventoryItemList[taken_item - 1], bought_item, 0x24u); |
1300 | 2169 dword_F8B1E4 = 1; |
2170 Party::TakeGold(uPriceItemService); | |
2171 viewparams->bRedrawGameUI = 1; | |
2172 bought_item->Reset(); | |
2173 pRenderer->ClearZBuffer(0, 479); | |
2174 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)SPEECH_75, 0); | |
2175 return; | |
2176 } | |
2177 pPlayers[uActiveCharacter]->PlaySound(SPEECH_NoRoom, 0); | |
2178 ShowStatusBarString(pGlobalTXT_LocalizationStrings[563], 5); // "Pack is Full!" | |
2179 break; | |
2180 } | |
2181 case HOUSE_DIALOGUE_SHOP_SELL: | |
2182 { | |
2183 v79 = ((pMouse->GetCursorPos(&cursor)->x - 14) >> 5) + 14 * ((pMouse->GetCursorPos(&cursor)->y - 17) >> 5); | |
2184 if ( pMouse->GetCursorPos(&cursor)->x <= 13 | |
2185 || pMouse->GetCursorPos(&cursor)->x >= 462 | |
2186 || (v15 = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v79), !v15) ) | |
2187 return; | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1300
diff
changeset
|
2188 if ( MerchandiseTest(&pPlayers[uActiveCharacter]->pInventoryItemList[v15 - 1], (int)window_SpeakInHouse->ptr_1C) ) |
1300 | 2189 { |
2190 dword_F8B1E4 = 1; | |
2191 pPlayers[uActiveCharacter]->SalesProcess(v79, v15 - 1, (int)window_SpeakInHouse->ptr_1C); | |
2192 viewparams->bRedrawGameUI = 1; | |
2193 pRenderer->ClearZBuffer(0, 479); | |
2194 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)77, 0); | |
2195 return; | |
2196 } | |
2197 pPlayers[uActiveCharacter]->PlaySound(SPEECH_79, 0); | |
2198 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); | |
2199 break; | |
2200 } | |
2201 case HOUSE_DIALOGUE_SHOP_IDENTIFY: | |
2202 { | |
2203 pMouse->GetCursorPos(&cursor); | |
2204 v79 = ((cursor.x - 14) >> 5) + 14 * ((cursor.y - 17) >> 5); | |
2205 if (cursor.x > 13 && cursor.x < 462) | |
2206 { | |
2207 pItemID = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v79); | |
2208 if ( pItemID ) | |
2209 { | |
2210 uPriceItemService = pPlayers[uActiveCharacter]->GetPriceIdentification(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier); | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1300
diff
changeset
|
2211 item = &pPlayers[uActiveCharacter]->pInventoryItemList[pItemID - 1]; |
1300 | 2212 if ( !(item->uAttributes & 1) ) |
2213 { | |
2214 if ( MerchandiseTest(item, (int)window_SpeakInHouse->ptr_1C) ) | |
2215 { | |
2216 if ( pParty->uNumGold >= uPriceItemService ) | |
2217 { | |
2218 dword_F8B1E4 = 1; | |
2219 Party::TakeGold(uPriceItemService); | |
2220 item->uAttributes |= 1; | |
2221 pPlayers[uActiveCharacter]->PlaySound(SPEECH_73, 0); | |
2222 ShowStatusBarString(pGlobalTXT_LocalizationStrings[569], 2); | |
2223 return; | |
2224 } | |
2225 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)2); | |
2226 return; | |
2227 } | |
2228 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); | |
2229 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)79, 0); | |
2230 return; | |
2231 } | |
2232 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)76, 0); | |
2233 return; | |
2234 } | |
2235 } | |
2236 break; | |
2237 } | |
2238 case HOUSE_DIALOGUE_SHOP_REPAIR: | |
2239 { | |
2240 v79 = ((pMouse->GetCursorPos(&cursor)->x - 14) >> 5) + 14 * ((pMouse->GetCursorPos(&cursor)->y - 17) >> 5); | |
2241 if ( pMouse->GetCursorPos(&cursor)->x > 13 ) | |
2242 { | |
2243 if ( pMouse->GetCursorPos(&cursor)->x < 462 ) | |
2244 { | |
2245 pItemID = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v79); | |
2246 if ( pItemID ) | |
2247 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1300
diff
changeset
|
2248 item = &pPlayers[uActiveCharacter]->pInventoryItemList[pItemID - 1]; |
1300 | 2249 pPriceMultiplier = p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier; |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1300
diff
changeset
|
2250 auto _v = (ItemGen *)&pPlayers[uActiveCharacter]->pInventoryItemList[pItemID - 1]; |
1300 | 2251 uPriceItemService = pPlayers[uActiveCharacter]->GetPriceRepair(_v->GetValue(), pPriceMultiplier); |
2252 if ( item->uAttributes & 2 ) | |
2253 { | |
2254 if ( MerchandiseTest(item, (int)window_SpeakInHouse->ptr_1C) ) | |
2255 { | |
2256 if ( pParty->uNumGold >= uPriceItemService ) | |
2257 { | |
2258 dword_F8B1E4 = 1; | |
2259 Party::TakeGold(uPriceItemService); | |
2260 v8 = item->uAttributes; | |
2261 LOBYTE(v8) = v8 & 0xFD; | |
2262 item->uAttributes = v8 | 1; | |
2263 pPlayers[uActiveCharacter]->PlaySound(SPEECH_74, 0); | |
2264 ShowStatusBarString(pGlobalTXT_LocalizationStrings[570], 2); | |
2265 return; | |
2266 } | |
2267 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)2); | |
2268 return; | |
2269 } | |
2270 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); | |
2271 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)79, 0); | |
2272 return; | |
2273 } | |
2274 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)76, 0); | |
2275 return; | |
2276 } | |
2277 } | |
2278 } | |
2279 break; | |
2280 } | |
2281 case HOUSE_DIALOGUE_SHOP_BUY_STANDARD: | |
2282 case HOUSE_DIALOGUE_SHOP_BUY_SPECIAL: | |
2283 { | |
2284 pCursorPos = pMouse->GetCursorPos(&cursor); | |
2285 v18 = pRenderer->pActiveZBuffer[pCursorPos->x + pSRZBufferLineOffsets[pCursorPos->y]] & 0xFFFF; | |
2286 if ( !v18 ) | |
2287 return; | |
2288 if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_BUY_STANDARD) | |
2289 bought_item = (ItemGen *)&pParty->StandartItemsInShops[(int)window_SpeakInHouse->ptr_1C][v18 - 1]; | |
2290 else | |
2291 bought_item = &pParty->SpecialItemsInShops[(int)window_SpeakInHouse->ptr_1C][v18 - 1];//(ItemGen *)&pParty->field_C59C[v31 + 724]; | |
2292 uPriceItemService = pPlayers[uActiveCharacter]->GetBuyingPrice(bought_item->GetValue(), p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier); | |
2293 uNumSeconds = 0; | |
2294 a3 = 0; | |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1466
diff
changeset
|
2295 if ( pMapStats->GetMapInfo(pCurrentMapName) ) |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1466
diff
changeset
|
2296 a3 = pMapStats->pInfos[pMapStats->GetMapInfo(pCurrentMapName)]._steal_perm; |
1300 | 2297 party_reputation = GetPartyReputation(); |
2298 if (pPlayers[uActiveCharacter]->CanSteal()) | |
2299 { | |
2300 if ( GetAsyncKeyState(VK_CONTROL) ) | |
2301 { | |
2302 uNumSeconds = pPlayers[uActiveCharacter]->StealFromShop(bought_item, a3, party_reputation, 0, &a6); | |
2303 if ( !uNumSeconds ) | |
2304 { | |
2305 sub_4B1447_party_fine((int)window_SpeakInHouse->ptr_1C, 0, a6); | |
2306 return; | |
2307 } | |
2308 } | |
2309 } | |
2310 if ( pParty->uNumGold < uPriceItemService ) | |
2311 { | |
2312 if ( uNumSeconds != 2 ) | |
2313 { | |
2314 if ( uNumSeconds != 1 ) | |
2315 { | |
2316 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)2); | |
2317 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);// "You don't have enough gold" | |
2318 return; | |
2319 } | |
2320 } | |
2321 } | |
2322 v39 = pPlayers[uActiveCharacter]->AddItem(-1, bought_item->uItemID); | |
2323 if ( v39 ) | |
2324 { | |
2325 bought_item->SetIdentified(); | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1300
diff
changeset
|
2326 memcpy(&pPlayers[uActiveCharacter]->pInventoryItemList[v39 - 1], bought_item, sizeof(ItemGen)); |
1300 | 2327 if ( pPlayers[uActiveCharacter]->CanSteal() ) |
2328 { | |
2329 if ( GetAsyncKeyState(VK_CONTROL) ) | |
2330 { | |
2331 if ( uNumSeconds == 1 || uNumSeconds == 2 ) | |
2332 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1300
diff
changeset
|
2333 pPlayers[uActiveCharacter]->pInventoryItemList[v39 - 1].SetStolen(); |
1300 | 2334 sub_4B1447_party_fine((int)window_SpeakInHouse->ptr_1C, uNumSeconds, a6); |
2335 viewparams->bRedrawGameUI = 1; | |
2336 bought_item->Reset(); | |
2337 pRenderer->ClearZBuffer(0, 479); | |
2338 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)SPEECH_75, 0); | |
2339 return; | |
2340 } | |
2341 } | |
2342 } | |
2343 dword_F8B1E4 = 1; | |
2344 Party::TakeGold(uPriceItemService); | |
2345 viewparams->bRedrawGameUI = 1; | |
2346 bought_item->Reset(); | |
2347 pRenderer->ClearZBuffer(0, 479); | |
2348 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)SPEECH_75, 0); | |
2349 return; | |
2350 } | |
2351 pPlayers[uActiveCharacter]->PlaySound(SPEECH_NoRoom, 0); | |
2352 ShowStatusBarString(pGlobalTXT_LocalizationStrings[563], 2); // "Pack is Full!" | |
2353 break; | |
2354 } | |
2355 default:// if click video screen in shop | |
2356 { | |
2357 __debugbreak(); // please do record these dialogue ids to the HOUSE_DIALOGUE_MENU enum | |
2358 if( dialog_menu_id >= 36 && dialog_menu_id <= 72 ) | |
2359 { | |
2360 v42 = dialog_menu_id - 36; | |
2361 //v43 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (unsigned int)ptr_507BC0->ptr_1C] * 500.0); | |
2362 v43 = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0); | |
2363 uPriceItemService = v43 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; | |
2364 if ( uPriceItemService < v43 / 3 ) | |
2365 uPriceItemService = v43 / 3; | |
2366 if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][v42] ) | |
2367 { | |
2368 pSkill = &pPlayers[uActiveCharacter]->pActiveSkills[v42]; | |
2369 if ( !*pSkill ) | |
2370 { | |
2371 if ( pParty->uNumGold < uPriceItemService ) | |
2372 { | |
2373 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);// "You don't have enough gold" | |
1411 | 2374 if ( in_current_building_type == BuildingType_Training ) |
1300 | 2375 v55 = 4; |
2376 else | |
2377 v55 = 2; | |
2378 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)v55); | |
2379 return; | |
2380 } | |
2381 Party::TakeGold(uPriceItemService); | |
2382 dword_F8B1E4 = 1; | |
2383 *pSkill = 1; | |
2384 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)78, 0); | |
2385 return; | |
2386 } | |
2387 } | |
2388 } | |
2389 break; | |
2390 } | |
2391 } | |
2392 } | |
2393 //----- (004B1A2D) -------------------------------------------------------- | |
1458 | 2394 void ShowPopupShopItem() |
1300 | 2395 { |
2396 POINT *v1; // esi@5 | |
2397 unsigned int v2; // eax@5 | |
2398 int v3; // ecx@5 | |
2399 POINT *v4; // esi@12 | |
2400 int v5; // eax@12 | |
2401 unsigned int v6; // eax@13 | |
2402 ItemGen *v7; // ecx@13 | |
2403 signed int v8; // esi@17 | |
2404 unsigned int v9; // eax@19 | |
2405 POINT v10; // [sp+8h] [bp-44h]@12 | |
2406 POINT v11; // [sp+10h] [bp-3Ch]@12 | |
2407 POINT v12; // [sp+18h] [bp-34h]@18 | |
2408 POINT v13; // [sp+20h] [bp-2Ch]@17 | |
2409 POINT v14; // [sp+28h] [bp-24h]@17 | |
2410 POINT v15; // [sp+30h] [bp-1Ch]@17 | |
2411 POINT v16; // [sp+38h] [bp-14h]@5 | |
2412 POINT a2; // [sp+40h] [bp-Ch]@5 | |
2413 | |
2414 if ( in_current_building_type <= 0 ) | |
2415 return; | |
1411 | 2416 if ( in_current_building_type <= BuildingType_AlchemistShop ) |
1300 | 2417 { |
2418 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD) | |
2419 { | |
2420 if ( dialog_menu_id <= HOUSE_DIALOGUE_SHOP_BUY_STANDARD) | |
2421 return; | |
2422 if ( dialog_menu_id <= HOUSE_DIALOGUE_SHOP_REPAIR || dialog_menu_id == HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT ) | |
2423 { | |
2424 v8 = pMouse->GetCursorPos(&v15)->x - 14; | |
2425 v5 = (v8 >> 5) + 14 * ((pMouse->GetCursorPos(&v14)->y - 17) >> 5); | |
2426 if ( pMouse->GetCursorPos(&v13)->x <= 13 | |
2427 || pMouse->GetCursorPos(&v12)->x >= 462 | |
2428 || (v9 = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex(&v5)) == 0 ) | |
2429 return; | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1300
diff
changeset
|
2430 GameUI_DrawItemInfo(&pPlayers[uActiveCharacter]->pInventoryItemList[v9 - 1]); |
1300 | 2431 return; |
2432 } | |
2433 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_SPECIAL ) | |
2434 return; | |
2435 } | |
2436 v4 = pMouse->GetCursorPos(&v11); | |
2437 v5 = pRenderer->pActiveZBuffer[v4->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v10)->y]] & 0xFFFF; | |
2438 if ( !v5 ) | |
2439 return; | |
2440 v6 = 9 * (v5 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C); | |
2441 v7 = (ItemGen *)((char *)&pParty->pPickedItem + 4 * v6 + 4); | |
2442 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD) | |
2443 v7 = &pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v5 - 1]; | |
2444 GameUI_DrawItemInfo(v7); | |
2445 return; | |
2446 } | |
1411 | 2447 if ( in_current_building_type <= BuildingType_16 && dialog_menu_id == HOUSE_DIALOGUE_GUILD_BUY_BOOKS ) |
1300 | 2448 { |
2449 v1 = pMouse->GetCursorPos(&a2); | |
2450 v2 = v1->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v16)->y]; | |
2451 v3 = pRenderer->pActiveZBuffer[v2] & 0xFFFF; | |
2452 v5 = pRenderer->pActiveZBuffer[v2] & 0xFFFF; | |
2453 if ( v5 ) | |
2454 sub_4B1523((int *)&pParty->pPlayers[1].uExpressionTimeLength + 9 * (v3 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)); | |
2455 } | |
2456 } | |
2457 //----- (004B1D27) -------------------------------------------------------- | |
1458 | 2458 void GetHouseGoodbyeSpeech() |
1300 | 2459 { |
2460 signed int v2; // edi@10 | |
2461 signed int v5; // edi@20 | |
2462 int v7[4]; // [sp+Ch] [bp-10h]@12 | |
2463 | |
2464 if ( in_current_building_type > 0 ) | |
2465 { | |
1411 | 2466 if ( in_current_building_type > BuildingType_MagicShop ) |
1300 | 2467 { |
1411 | 2468 if ( in_current_building_type == BuildingType_Bank ) |
1300 | 2469 { |
2470 if ( !dword_F8B1E4 ) | |
2471 return; | |
2472 } | |
2473 else | |
2474 { | |
1411 | 2475 if ( in_current_building_type != BuildingType_Temple ) |
1300 | 2476 return; |
2477 } | |
1407 | 2478 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_Greeting_2); |
1300 | 2479 return; |
2480 } | |
1407 | 2481 if ( (signed __int64)pParty->field_3C._shop_ban_times[(unsigned int)window_SpeakInHouse->ptr_1C]<= (signed __int64)pParty->uTimePlayed ) |
1300 | 2482 { |
1407 | 2483 if ( pParty->uNumGold <= 10000 ) |
1300 | 2484 { |
2485 if ( !dword_F8B1E4 ) | |
2486 return; | |
1407 | 2487 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_Goodbye); |
1300 | 2488 return; |
2489 } | |
1407 | 2490 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)(dword_F8B1E4 + 3)); |
1300 | 2491 if ( !dword_F8B1E4 && !qword_A750D8 ) |
2492 { | |
2493 v5 = 0; | |
1407 | 2494 for ( uint i = 1; i <= 4; ++i ) |
1300 | 2495 { |
1407 | 2496 if ( pPlayers[i]->CanAct() ) |
2497 v7[v5++] = i; | |
1300 | 2498 } |
2499 if ( v5 ) | |
2500 { | |
2501 qword_A750D8 = 256i64; | |
1406 | 2502 PlayerSpeechID = SPEECH_80; |
1407 | 2503 uSpeakingCharacter = v7[rand() % v5]; |
1300 | 2504 return; |
2505 } | |
2506 } | |
2507 } | |
2508 else | |
2509 { | |
2510 if ( !qword_A750D8 ) | |
2511 { | |
2512 v2 = 0; | |
1407 | 2513 for ( uint i = 1; i <= 4; ++i ) |
1300 | 2514 { |
1407 | 2515 if ( pPlayers[i]->CanAct() ) |
2516 v7[v2++] = i; | |
1300 | 2517 } |
2518 if ( v2 ) | |
2519 { | |
2520 qword_A750D8 = 256i64; | |
1406 | 2521 PlayerSpeechID = SPEECH_80; |
1407 | 2522 uSpeakingCharacter = v7[rand() % v2]; |
1300 | 2523 return; |
2524 } | |
2525 } | |
2526 } | |
2527 } | |
2528 } |