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