Mercurial > mm7
annotate UI/UIShops.cpp @ 2470:94cf712fc780
for_refactoring
author | Ritor1 |
---|---|
date | Mon, 18 Aug 2014 18:28:53 +0600 |
parents | 104fdbea0386 |
children | 7b076fe64f23 |
rev | line source |
---|---|
2415 | 1 #define _CRTDBG_MAP_ALLOC |
2 #include <stdlib.h> | |
3 #include <crtdbg.h> | |
4 | |
2253
aff7a7b072b7
adding _CRT_SECURE_NO_WARNINGS to get rid of a few hundrer annoying warnings + adding count parameter to swprintf
Grumpy7
parents:
2250
diff
changeset
|
5 #define _CRT_SECURE_NO_WARNINGS |
2350
7c10dfb6d802
Finishing moving all known UI functions to their appropriate headers
Grumpy7
parents:
2336
diff
changeset
|
6 #include "UIShops.h" |
1300 | 7 #include "..\Items.h" |
8 #include "..\GUIWindow.h" | |
9 #include "..\mm7_data.h" | |
10 #include "..\texts.h" | |
11 #include "UIHouses.h" | |
12 #include "..\GUIFont.h" | |
13 #include "..\Render.h" | |
14 #include "..\Party.h" | |
15 #include "..\Texture.h" | |
16 #include "..\Mouse.h" | |
17 #include "..\Events2D.h" | |
18 #include "..\AudioPlayer.h" | |
19 #include "..\MapInfo.h" | |
20 #include "..\Viewport.h" | |
2463 | 21 #include "..\Outdoor.h" |
22 #include "..\Indoor.h" | |
23 | |
24 | |
1300 | 25 |
26 //----- (004B910F) -------------------------------------------------------- | |
1458 | 27 void WeaponShopDialog() |
1300 | 28 { |
1739 | 29 int phrases_id; // eax@16 |
1300 | 30 int v19; // edi@25 |
31 GUIButton *pButton; // esi@27 | |
32 unsigned int pColorText; // ax@27 | |
33 signed int v32; // esi@41 | |
1739 | 34 const char *pText; // ecx@84 |
1300 | 35 int all_text_height; // esi@96 |
1739 | 36 ItemGen *item; |
37 int pItemID; | |
38 POINT mouse; // [sp+64h] [bp-94h]@8 | |
1300 | 39 GUIWindow dialog_window; // [sp+7Ch] [bp-7Ch]@1 |
40 __int32 v103; // [sp+D4h] [bp-24h]@25 | |
1739 | 41 int pPrice; // [sp+ECh] [bp-Ch]@26 |
42 unsigned int v109; | |
1300 | 43 int pNumString; |
1739 | 44 int item_X; |
1300 | 45 |
46 memcpy(&dialog_window, window_SpeakInHouse, sizeof(dialog_window)); | |
47 dialog_window.uFrameX = 483; | |
48 dialog_window.uFrameWidth = 148; | |
49 dialog_window.uFrameZ = 334; | |
50 | |
51 switch(dialog_menu_id) | |
52 { | |
53 case HOUSE_DIALOGUE_MAIN: | |
54 { | |
1739 | 55 if ( HouseUI_CheckIfPlayerCanInteract() ) |
1300 | 56 { |
1843
2e6d3cd052e0
some char* cast removal + adding const_casts where appropriate
Grumpy7
parents:
1838
diff
changeset
|
57 pShopOptions[0] = const_cast<char *>(pGlobalTXT_LocalizationStrings[134]); |
2e6d3cd052e0
some char* cast removal + adding const_casts where appropriate
Grumpy7
parents:
1838
diff
changeset
|
58 pShopOptions[1] = const_cast<char *>(pGlobalTXT_LocalizationStrings[152]); |
2e6d3cd052e0
some char* cast removal + adding const_casts where appropriate
Grumpy7
parents:
1838
diff
changeset
|
59 pShopOptions[2] = const_cast<char *>(pGlobalTXT_LocalizationStrings[159]); |
2e6d3cd052e0
some char* cast removal + adding const_casts where appropriate
Grumpy7
parents:
1838
diff
changeset
|
60 pShopOptions[3] = const_cast<char *>(pGlobalTXT_LocalizationStrings[160]); |
1300 | 61 all_text_height = 0; |
1739 | 62 for ( int i = 0; i < 4; ++i ) |
1300 | 63 all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0); |
64 v103 = (174 - all_text_height) / 4; | |
65 v19 = (174 - 4 * (174 - all_text_height) / 4 - all_text_height) / 2 - (174 - all_text_height) / 4 / 2 + 138; | |
1739 | 66 pNumString = 0; |
1741 | 67 for ( int i = pDialogueWindow->pStartingPosActiveItem; i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) |
1739 | 68 { |
69 pButton = pDialogueWindow->GetControl(i); | |
70 pButton->uY = v103 + v19; | |
2389 | 71 pButton->uHeight = pFontArrus->CalcTextHeight(pShopOptions[pNumString], &dialog_window, 0, 0); |
72 v19 = pButton->uY + pFontArrus->CalcTextHeight(pShopOptions[pNumString], &dialog_window, 0, 0) - 1; | |
1739 | 73 pButton->uW = v19; |
2069 | 74 pColorText = Color16(0xE1u, 0xCDu, 0x23u); |
1739 | 75 if ( pDialogueWindow->pCurrentPosActiveItem != i ) |
2069 | 76 pColorText = Color16(0xFFu, 0xFFu, 0xFFu); |
2389 | 77 dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, pShopOptions[pNumString], 3); |
1739 | 78 ++pNumString; |
79 } | |
80 } | |
81 break; | |
82 } | |
83 case HOUSE_DIALOGUE_SHOP_BUY_STANDARD: | |
84 { | |
85 pRenderer->DrawTextureIndexed(8, 8, ShopTexture); | |
86 item_X = 0; | |
87 for ( uint i = 0; i < 6; ++i ) | |
88 { | |
89 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].uItemID) | |
1300 | 90 { |
1739 | 91 pRenderer->DrawTextureTransparent((60 - ((signed int)ItemsInShopTexture[i]->uTextureWidth / 2)) + item_X, weapons_Ypos[i] + 30, ItemsInShopTexture[i]); |
2215
e9625ad08541
fog fix and change 640,480 - window->GetWidth(), window->GetHeight()
Ritor1
parents:
2182
diff
changeset
|
92 ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[(60 - ((signed int)ItemsInShopTexture[i]->uTextureWidth / 2)) + item_X + window->GetWidth() * (weapons_Ypos[i] + 30)], ItemsInShopTexture[i], i + 1); |
1739 | 93 } |
94 item_X += 70; | |
95 } | |
96 if ( HouseUI_CheckIfPlayerCanInteract() ) | |
97 { | |
98 uint item_num = 0; | |
99 for ( uint i = 0; i < 6; ++i ) | |
100 { | |
101 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].uItemID) | |
102 ++item_num; | |
103 } | |
2460 | 104 if ( GetAsyncKeyState(VK_CONTROL) && pPlayers[uActiveCharacter]->CanSteal() ) |
1739 | 105 pText = pGlobalTXT_LocalizationStrings[185];//Украсть предмет |
106 else | |
107 pText = pGlobalTXT_LocalizationStrings[195];//Выберите предмет для покупки | |
108 DrawTextAtStatusBar(pText, 0); | |
109 if ( item_num ) | |
110 { | |
111 pMouse->GetCursorPos(&mouse); | |
112 if ( pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF ) | |
1300 | 113 { |
1739 | 114 item = &pParty->StandartItemsInShops[(int)window_SpeakInHouse->ptr_1C][(pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF) - 1]; |
2460 | 115 if ( !GetAsyncKeyState(VK_CONTROL) || !pPlayers[uActiveCharacter]->CanSteal() ) |
1739 | 116 { |
1843
2e6d3cd052e0
some char* cast removal + adding const_casts where appropriate
Grumpy7
parents:
1838
diff
changeset
|
117 pText = BuildDialogueString(pMerchantsBuyPhrases[pPlayers[uActiveCharacter]->SelectPhrasesTransaction(item, BuildingType_WeaponShop, (int)window_SpeakInHouse->ptr_1C, 2)], |
1739 | 118 uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 2, 0); |
2069 | 119 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, Color16(0xFFu, 0xFFu, 0xFFu), pText, 3); |
1739 | 120 } |
121 else | |
122 { | |
123 pText = BuildDialogueString(pGlobalTXT_LocalizationStrings[181], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 2, 0); | |
2069 | 124 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, Color16(0xFFu, 0xFFu, 0xFFu), pText, 3); |
1739 | 125 } |
1300 | 126 } |
127 } | |
1739 | 128 else |
1758
24e756a50073
DrawBuff_remaind_time_string and DrawShops_next_generation_time_string fix and cleared
Ritor1
parents:
1754
diff
changeset
|
129 dialog_window.DrawShops_next_generation_time_string(pParty->PartyTimes.Shops_next_generation_time[(unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed);//Приходите через 7 дней |
1300 | 130 } |
131 break; | |
132 } | |
133 | |
1739 | 134 case HOUSE_DIALOGUE_SHOP_BUY_SPECIAL: |
1300 | 135 { |
136 pRenderer->DrawTextureIndexed(8, 8, ShopTexture); | |
1739 | 137 item_X = 0; |
138 for ( uint i = 0; i < 6; ++i ) | |
1300 | 139 { |
1739 | 140 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].uItemID) |
1300 | 141 { |
1739 | 142 pRenderer->DrawTextureTransparent((60 - ((signed int)ItemsInShopTexture[i]->uTextureWidth / 2)) + item_X, weapons_Ypos[i] + 30, ItemsInShopTexture[i]); |
2215
e9625ad08541
fog fix and change 640,480 - window->GetWidth(), window->GetHeight()
Ritor1
parents:
2182
diff
changeset
|
143 ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[(60 - ((signed int)ItemsInShopTexture[i]->uTextureWidth / 2)) + item_X + window->GetWidth() * (weapons_Ypos[i] + 30)], ItemsInShopTexture[i], i + 1); |
1300 | 144 } |
1739 | 145 item_X += 70; |
1300 | 146 } |
1739 | 147 if ( HouseUI_CheckIfPlayerCanInteract() ) |
1300 | 148 { |
1739 | 149 uint item_num = 0; |
150 for ( uint i = 0; i < 6; ++i ) | |
1300 | 151 { |
1739 | 152 if ( pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].uItemID ) |
153 ++item_num; | |
1300 | 154 } |
2460 | 155 if ( GetAsyncKeyState(VK_CONTROL) && pPlayers[uActiveCharacter]->CanSteal() ) |
1739 | 156 pText = pGlobalTXT_LocalizationStrings[185]; |
1300 | 157 else |
1739 | 158 pText = pGlobalTXT_LocalizationStrings[196]; |
159 DrawTextAtStatusBar(pText, 0); | |
160 if ( item_num ) | |
1300 | 161 { |
1739 | 162 pMouse->GetCursorPos(&mouse); |
163 if ( pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF ) | |
1300 | 164 { |
1739 | 165 item = &pParty->SpecialItemsInShops[(int)window_SpeakInHouse->ptr_1C][(pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF) - 1]; |
2460 | 166 if ( !GetAsyncKeyState(VK_CONTROL) || !pPlayers[uActiveCharacter]->CanSteal() ) |
1300 | 167 { |
1843
2e6d3cd052e0
some char* cast removal + adding const_casts where appropriate
Grumpy7
parents:
1838
diff
changeset
|
168 pText = BuildDialogueString(pMerchantsBuyPhrases[pPlayers[uActiveCharacter]->SelectPhrasesTransaction(item, BuildingType_WeaponShop, (int)window_SpeakInHouse->ptr_1C, 2)], |
1739 | 169 uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 2, 0); |
2069 | 170 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, Color16(0xFFu, 0xFFu, 0xFFu), pText, 3); |
1300 | 171 } |
172 else | |
173 { | |
1739 | 174 pText = BuildDialogueString(pGlobalTXT_LocalizationStrings[181], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 2, 0); |
2069 | 175 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, Color16(0xFFu, 0xFFu, 0xFFu), pText, 3); |
1300 | 176 } |
177 } | |
178 } | |
179 else | |
1758
24e756a50073
DrawBuff_remaind_time_string and DrawShops_next_generation_time_string fix and cleared
Ritor1
parents:
1754
diff
changeset
|
180 dialog_window.DrawShops_next_generation_time_string(pParty->PartyTimes.Shops_next_generation_time[(unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed); |
1300 | 181 } |
182 break; | |
183 } | |
184 | |
185 case HOUSE_DIALOGUE_SHOP_SELL: | |
186 { | |
187 draw_leather(); | |
188 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); | |
189 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[199], 0); | |
1393 | 190 if ( !HouseUI_CheckIfPlayerCanInteract() ) |
1300 | 191 return; |
1739 | 192 pMouse->GetCursorPos(&mouse); |
193 v109 = ((mouse.x + 14) >> 5) + 14 * ((mouse.y - 17) >> 5); | |
194 if( mouse.x <= 13 || mouse.x >= 462 ) | |
1300 | 195 return; |
1739 | 196 pItemID = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v109); |
197 if ( !pItemID ) | |
198 return; | |
199 item = &pPlayers[uActiveCharacter]->pInventoryItemList[pItemID - 1]; | |
200 phrases_id = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(item, BuildingType_WeaponShop, (int)window_SpeakInHouse->ptr_1C, 3); | |
1843
2e6d3cd052e0
some char* cast removal + adding const_casts where appropriate
Grumpy7
parents:
1838
diff
changeset
|
201 pText = BuildDialogueString(pMerchantsSellPhrases[phrases_id], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 3, 0); |
2069 | 202 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, Color16(0xFFu, 0xFFu, 0xFFu), pText, 3); |
1300 | 203 break; |
204 } | |
205 case HOUSE_DIALOGUE_SHOP_IDENTIFY: | |
206 { | |
207 draw_leather(); | |
208 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); | |
209 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[197], 0); | |
1393 | 210 if ( !HouseUI_CheckIfPlayerCanInteract() ) |
1300 | 211 return; |
1739 | 212 pMouse->GetCursorPos(&mouse); |
213 v109 = ((mouse.x - 14) >> 5) + 14 * ((mouse.y - 17) >> 5); | |
214 if( mouse.x <= 13 || mouse.x >= 462 ) | |
215 return; | |
216 pItemID = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v109); | |
217 if ( !pItemID ) | |
1300 | 218 return; |
1739 | 219 item = &pPlayers[uActiveCharacter]->pInventoryItemList[pItemID - 1]; |
220 if (!item->IsIdentified()) | |
1300 | 221 { |
1739 | 222 phrases_id = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(item, BuildingType_WeaponShop, (int)window_SpeakInHouse->ptr_1C, 4); |
1843
2e6d3cd052e0
some char* cast removal + adding const_casts where appropriate
Grumpy7
parents:
1838
diff
changeset
|
223 pText = BuildDialogueString(pMerchantsIdentifyPhrases[phrases_id], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 4, 0); |
2069 | 224 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, Color16(0xFFu, 0xFFu, 0xFFu), pText, 3); |
1300 | 225 } |
226 else | |
227 { | |
1739 | 228 pText = BuildDialogueString("%24", uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 4, 0); |
2069 | 229 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, Color16(0xFFu, 0xFFu, 0xFFu), pText, 3); |
1300 | 230 } |
231 break; | |
232 } | |
233 | |
234 case HOUSE_DIALOGUE_SHOP_REPAIR: | |
235 { | |
236 draw_leather(); | |
237 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); | |
238 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[198], 0); | |
1393 | 239 if ( !HouseUI_CheckIfPlayerCanInteract()) |
1739 | 240 return; |
241 pMouse->GetCursorPos(&mouse); | |
242 v109 = ((mouse.x - 14) >> 5) + 14 * (mouse.y - 17) >> 5; | |
243 if( ( mouse.x <= 13) || mouse.x >= 462 ) | |
244 return; | |
245 pItemID = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v109); | |
246 if ( !pItemID || (!(pPlayers[uActiveCharacter]->pOwnItems[pItemID - 1].uAttributes & 2)) ) | |
247 return; | |
248 item = &pPlayers[uActiveCharacter]->pInventoryItemList[pItemID - 1]; | |
249 phrases_id = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(item, BuildingType_ArmorShop, (int)window_SpeakInHouse->ptr_1C, 5); | |
1843
2e6d3cd052e0
some char* cast removal + adding const_casts where appropriate
Grumpy7
parents:
1838
diff
changeset
|
250 pText = BuildDialogueString(pMerchantsRepairPhrases[phrases_id], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 5, 0); |
2069 | 251 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, Color16(0xFFu, 0xFFu, 0xFFu), pText, 3); |
1300 | 252 return; |
253 } | |
254 break; | |
255 | |
256 case HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT: | |
257 { | |
258 draw_leather(); | |
259 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); | |
1843
2e6d3cd052e0
some char* cast removal + adding const_casts where appropriate
Grumpy7
parents:
1838
diff
changeset
|
260 pShopOptions[0] = const_cast<char *>(pGlobalTXT_LocalizationStrings[200]);//sell |
2e6d3cd052e0
some char* cast removal + adding const_casts where appropriate
Grumpy7
parents:
1838
diff
changeset
|
261 pShopOptions[1] = const_cast<char *>(pGlobalTXT_LocalizationStrings[113]);//identify |
2e6d3cd052e0
some char* cast removal + adding const_casts where appropriate
Grumpy7
parents:
1838
diff
changeset
|
262 pShopOptions[2] = const_cast<char *>(pGlobalTXT_LocalizationStrings[179]);//repair |
1300 | 263 all_text_height = 0; |
264 for ( int i = 0; i < 3; ++i ) | |
265 all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0); | |
266 v103 = (174 - all_text_height) / 3; | |
1739 | 267 v19 = (3 * (58 - (signed int)v103) - all_text_height) / 2 - ((174 - all_text_height) / 3) / 2 + 138; |
268 pNumString = 0; | |
1741 | 269 for ( int i = pDialogueWindow->pStartingPosActiveItem; i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) |
1300 | 270 { |
1739 | 271 pButton = pDialogueWindow->GetControl(i); |
272 pButton->uY = v103 + v19; | |
2389 | 273 pButton->uHeight = pFontArrus->CalcTextHeight(pShopOptions[pNumString], &dialog_window, 0, 0); |
274 v19 = pButton->uY + pFontArrus->CalcTextHeight(pShopOptions[pNumString], &dialog_window, 0, 0) - 1; | |
1739 | 275 pButton->uW = v19; |
2069 | 276 pColorText = Color16(0xE1u, 0xCDu, 0x23u); |
1739 | 277 if ( pDialogueWindow->pCurrentPosActiveItem != i ) |
2069 | 278 pColorText = Color16(0xFFu, 0xFFu, 0xFFu); |
2389 | 279 dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, pShopOptions[pNumString], 3); |
1739 | 280 ++pNumString; |
1300 | 281 } |
282 break; | |
283 } | |
284 | |
285 case HOUSE_DIALOGUE_LEARN_SKILLS: | |
286 { | |
1393 | 287 if (!HouseUI_CheckIfPlayerCanInteract()) |
1300 | 288 return; |
1739 | 289 uint item_num = 0; |
1300 | 290 all_text_height = 0; |
291 v32 = (signed __int64)(p2DEvents[(signed int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0); | |
1739 | 292 pPrice = v32 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; |
293 if ( pPrice < v32 / 3 ) | |
294 pPrice = v32 / 3; | |
1741 | 295 for ( int i = pDialogueWindow->pStartingPosActiveItem; |
1739 | 296 i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) |
1300 | 297 { |
1739 | 298 if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][pDialogueWindow->GetControl(i)->msg_param - 36] |
299 && !pPlayers[uActiveCharacter]->pActiveSkills[pDialogueWindow->GetControl(i)->msg_param - 36] ) | |
1300 | 300 { |
1739 | 301 all_text_height += pFontArrus->CalcTextHeight(pSkillNames[pDialogueWindow->GetControl(i)->msg_param - 36], &dialog_window, 0, 0); |
302 item_num++; | |
1300 | 303 } |
304 } | |
1739 | 305 if ( item_num ) |
1300 | 306 { |
1739 | 307 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[401], pPrice);//Стоимость навыка: %lu |
308 dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3); | |
309 v103 = (149 - all_text_height) / item_num; | |
310 if ( (149 - all_text_height) / item_num > 32 ) | |
311 v103 = 32; | |
312 v19 = (149 - item_num * v103 - all_text_height) / 2 - v103 / 2 + 162; | |
313 for ( uint i = pDialogueWindow->pStartingPosActiveItem; | |
314 i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) | |
1300 | 315 { |
1739 | 316 pButton = pDialogueWindow->GetControl(i); |
317 if ( !byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][pButton->msg_param - 36] || pPlayers[uActiveCharacter]->pActiveSkills[pButton->msg_param - 36] ) | |
1300 | 318 { |
319 pButton->uW = 0; | |
320 pButton->uHeight = 0; | |
321 pButton->uY = 0; | |
322 } | |
323 else | |
324 { | |
1739 | 325 pButton->uY = v103 + v19; |
326 pButton->uHeight = pFontArrus->CalcTextHeight(pSkillNames[pButton->msg_param - 36], &dialog_window, 0, 0); | |
327 v19 = pButton->uY + pFontArrus->CalcTextHeight(pSkillNames[pButton->msg_param - 36], &dialog_window, 0, 0) - 1; | |
328 pButton->uW = v19; | |
2069 | 329 pColorText = Color16(0xE1u, 0xCDu, 0x23u); |
1739 | 330 if ( pDialogueWindow->pCurrentPosActiveItem != i ) |
2069 | 331 pColorText = Color16(0xFFu, 0xFFu, 0xFFu); |
1739 | 332 dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, pSkillNames[pButton->msg_param - 36], 3); |
1300 | 333 } |
334 } | |
1739 | 335 break; |
1300 | 336 } |
1739 | 337 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]); |
338 strcat(pTmpBuf.data(), "\n \n"); | |
339 strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]);//Больше ничего не могу предложить. | |
2069 | 340 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 0, 0)) / 2 + 138, Color16(0xE1u, 0xCDu, 0x23u), pTmpBuf.data(), 3); |
1739 | 341 return; |
1300 | 342 } |
343 default: | |
344 { | |
1739 | 345 __debugbreak(); |
1300 | 346 break; |
347 } | |
348 } | |
349 } | |
350 | |
351 //----- (004BA928) -------------------------------------------------------- | |
1458 | 352 void ArmorShopDialog() |
1300 | 353 { |
1746 | 354 int phrases_id; // eax@20 |
1300 | 355 int all_text_height; // ebx@22 |
1746 | 356 int v146; // [sp+E4h] [bp-20h]@24 |
1300 | 357 int v23; // ebx@24 |
358 GUIButton *pButton; // eax@26 | |
359 signed int v38; // esi@42 | |
360 int v59; // eax@68 | |
1741 | 361 const char *pText; // ecx@91 |
1300 | 362 ItemGen *selected_item; // ecx@99 |
363 int pNumString; // edx@109 | |
364 unsigned __int16 pTextColor; // ax@109 | |
1741 | 365 POINT mouse; // [sp+4Ch] [bp-B8h]@97 |
1300 | 366 GUIWindow dialog_window; // [sp+8Ch] [bp-78h]@1 |
367 __int32 pItemCount; // [sp+F0h] [bp-14h]@8 | |
1741 | 368 int item_x; // [sp+100h] [bp-4h]@44 |
1746 | 369 int pPrice; |
370 unsigned int v153; | |
1300 | 371 |
372 memcpy(&dialog_window, window_SpeakInHouse, sizeof(dialog_window)); | |
373 dialog_window.uFrameX = 483; | |
374 dialog_window.uFrameWidth = 148; | |
375 dialog_window.uFrameZ = 334; | |
376 switch (dialog_menu_id) | |
377 { | |
378 case HOUSE_DIALOGUE_MAIN: | |
379 { | |
1393 | 380 if ( !HouseUI_CheckIfPlayerCanInteract() ) |
1300 | 381 return; |
1843
2e6d3cd052e0
some char* cast removal + adding const_casts where appropriate
Grumpy7
parents:
1838
diff
changeset
|
382 pShopOptions[0] = const_cast<char *>(pGlobalTXT_LocalizationStrings[134]); //"Buy Standard" |
2e6d3cd052e0
some char* cast removal + adding const_casts where appropriate
Grumpy7
parents:
1838
diff
changeset
|
383 pShopOptions[1] = const_cast<char *>(pGlobalTXT_LocalizationStrings[152]); //"Buy Special" |
2e6d3cd052e0
some char* cast removal + adding const_casts where appropriate
Grumpy7
parents:
1838
diff
changeset
|
384 pShopOptions[2] = const_cast<char *>(pGlobalTXT_LocalizationStrings[159]); //"Display Inventory" |
2e6d3cd052e0
some char* cast removal + adding const_casts where appropriate
Grumpy7
parents:
1838
diff
changeset
|
385 pShopOptions[3] = const_cast<char *>(pGlobalTXT_LocalizationStrings[160]); |
1300 | 386 all_text_height = 0; |
387 for( int i = 0; i < 4; ++i ) | |
388 all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0); | |
389 v146 = ( 174 - all_text_height ) / 4; | |
390 v23 = ( 174 - 4 * ( 174 - all_text_height ) / 4 - all_text_height ) / 2 - ( 174 - all_text_height ) / 4 / 2 + 138; | |
391 pNumString = 0; | |
1741 | 392 for (int i = pDialogueWindow->pStartingPosActiveItem; |
393 i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i) | |
1300 | 394 { |
1741 | 395 pButton = pDialogueWindow->GetControl(i); |
396 pButton->uY = v146 + v23; | |
397 pButton->uHeight = pFontArrus->CalcTextHeight(pShopOptions[pNumString], &dialog_window, 0, 0); | |
398 v23 = pButton->uY + pFontArrus->CalcTextHeight(pShopOptions[pNumString], &dialog_window, 0, 0) - 1; | |
399 pButton->uW = v23; | |
2069 | 400 pTextColor = Color16(0xE1u, 0xCDu, 0x23u); |
1741 | 401 if ( pDialogueWindow->pCurrentPosActiveItem != i ) |
2069 | 402 pTextColor = Color16(0xFFu, 0xFFu, 0xFFu); |
1741 | 403 dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pTextColor, pShopOptions[pNumString], 3); |
404 ++pNumString; | |
1300 | 405 } |
406 } | |
407 break; | |
1741 | 408 |
1300 | 409 case HOUSE_DIALOGUE_SHOP_BUY_STANDARD: |
410 { | |
411 pRenderer->DrawTextureIndexed(8, 8, ShopTexture);// подложка | |
1741 | 412 item_x = 0; |
1300 | 413 for ( int i = 0; i < 8; ++i )// разместить вещи |
414 { | |
415 if ( pParty->StandartItemsInShops[window_SpeakInHouse->par1C][i].uItemID) | |
416 { | |
417 if ( i >= 4 ) //low row | |
418 { | |
1741 | 419 pRenderer->DrawTextureTransparent((90 - (ItemsInShopTexture[i]->uTextureWidth / 2)) + item_x - 420, 126, ItemsInShopTexture[i]); |
420 v59 = (90 - (ItemsInShopTexture[i]->uTextureWidth / 2)) + item_x + 80220; | |
1300 | 421 } |
422 else | |
423 { | |
1741 | 424 pRenderer->DrawTextureTransparent(( 86 - (ItemsInShopTexture[i]->uTextureWidth / 2)) + item_x, 98 - ItemsInShopTexture[i]->uTextureHeight, ItemsInShopTexture[i]); |
2215
e9625ad08541
fog fix and change 640,480 - window->GetWidth(), window->GetHeight()
Ritor1
parents:
2182
diff
changeset
|
425 v59 = item_x + (86 - (ItemsInShopTexture[i]->uTextureWidth / 2)) + window->GetWidth() * (98 - ItemsInShopTexture[i]->uTextureHeight); |
1300 | 426 } |
427 ZBuffer_DoFill(&pRenderer->pActiveZBuffer[v59], ItemsInShopTexture[i], i + 1); | |
428 } | |
1741 | 429 item_x += 105; |
1300 | 430 } |
1393 | 431 if ( !HouseUI_CheckIfPlayerCanInteract() ) |
1300 | 432 return; |
433 pItemCount = 0; | |
434 for ( int i = 0; i < 8; ++i ) | |
435 { | |
436 if ( pParty->StandartItemsInShops[window_SpeakInHouse->par1C][i].uItemID ) | |
437 ++pItemCount; | |
438 } | |
2460 | 439 if ( GetAsyncKeyState(VK_CONTROL) == 0 || pPlayers[uActiveCharacter]->CanSteal() == 0 ) |
1741 | 440 pText = pGlobalTXT_LocalizationStrings[195]; //"Select the Item to Buy" |
1300 | 441 else |
1741 | 442 pText = pGlobalTXT_LocalizationStrings[185];//"Steal item" |
443 DrawTextAtStatusBar(pText, 0); | |
444 if ( pItemCount ) | |
1300 | 445 { |
1741 | 446 pMouse->GetCursorPos(&mouse); |
447 if ( !(pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF) ) | |
1300 | 448 return; |
1741 | 449 selected_item = &pParty->StandartItemsInShops[window_SpeakInHouse->par1C][(pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF) - 1]; |
2460 | 450 if ( !GetAsyncKeyState(VK_CONTROL) || !pPlayers[uActiveCharacter]->CanSteal()) |
1741 | 451 { |
1843
2e6d3cd052e0
some char* cast removal + adding const_casts where appropriate
Grumpy7
parents:
1838
diff
changeset
|
452 pText = BuildDialogueString(pMerchantsBuyPhrases[pPlayers[uActiveCharacter]->SelectPhrasesTransaction(selected_item, BuildingType_ArmorShop, window_SpeakInHouse->par1C, 2)], |
1741 | 453 uActiveCharacter - 1, selected_item, (char *)window_SpeakInHouse->ptr_1C, 2, 0); |
2069 | 454 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, Color16(0xFFu, 0xFFu, 0xFFu), pText, 3); |
1741 | 455 } |
1300 | 456 else |
1741 | 457 { |
458 pText = BuildDialogueString(pGlobalTXT_LocalizationStrings[181], uActiveCharacter - 1, selected_item, (char *)window_SpeakInHouse->ptr_1C, 2, 0); //"Steal %24" | |
2069 | 459 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, Color16(0xFFu, 0xFFu, 0xFFu), pText, 3); |
1741 | 460 } |
1300 | 461 return; |
462 } | |
1758
24e756a50073
DrawBuff_remaind_time_string and DrawShops_next_generation_time_string fix and cleared
Ritor1
parents:
1754
diff
changeset
|
463 dialog_window.DrawShops_next_generation_time_string(pParty->PartyTimes.Shops_next_generation_time[window_SpeakInHouse->par1C]- pParty->uTimePlayed); |
1300 | 464 return; |
465 } | |
466 break; | |
1741 | 467 |
1300 | 468 case HOUSE_DIALOGUE_SHOP_BUY_SPECIAL: |
469 { | |
470 pRenderer->DrawTextureIndexed(8, 8, ShopTexture); | |
1741 | 471 item_x = 0; |
472 for ( int i = 0; i < 8; ++i ) | |
1300 | 473 { |
1741 | 474 if ( pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][i].uItemID ) |
1300 | 475 { |
1741 | 476 if ( i >= 4 ) |
1300 | 477 { |
1741 | 478 pRenderer->DrawTextureTransparent(item_x + (90 - ((signed int)ItemsInShopTexture[i]->uTextureWidth / 2)) - 420, 126, ItemsInShopTexture[i]); |
1746 | 479 v59 = item_x + (90 - ((signed int)ItemsInShopTexture[i]->uTextureWidth / 2)) + 80220; |
1300 | 480 } |
481 else | |
482 { | |
1741 | 483 pRenderer->DrawTextureTransparent(86 - ((signed int)ItemsInShopTexture[i]->uTextureWidth / 2) + item_x, 98 - ItemsInShopTexture[i]->uTextureHeight, ItemsInShopTexture[i]); |
2215
e9625ad08541
fog fix and change 640,480 - window->GetWidth(), window->GetHeight()
Ritor1
parents:
2182
diff
changeset
|
484 v59 = (86 - ((signed int)ItemsInShopTexture[i]->uTextureWidth / 2)) + item_x + window->GetWidth() * (98 - ItemsInShopTexture[i]->uTextureHeight); |
1300 | 485 } |
1746 | 486 ZBuffer_DoFill(&pRenderer->pActiveZBuffer[v59], ItemsInShopTexture[i], i + 1); |
1300 | 487 } |
1741 | 488 item_x += 105; |
1300 | 489 } |
1393 | 490 if ( !HouseUI_CheckIfPlayerCanInteract() ) |
1300 | 491 return; |
492 pItemCount = 0; | |
1746 | 493 for ( uint i = 0; i < 6; ++i ) |
1300 | 494 { |
1746 | 495 if (pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][i].uItemID) |
496 ++pItemCount; | |
1300 | 497 } |
2460 | 498 if ( !GetAsyncKeyState(VK_CONTROL) || !pPlayers[uActiveCharacter]->CanSteal() ) |
1741 | 499 pText = pGlobalTXT_LocalizationStrings[196]; //Select the Special Item to Buy" |
1300 | 500 else |
1741 | 501 pText = pGlobalTXT_LocalizationStrings[185]; |
502 DrawTextAtStatusBar(pText, 0); | |
1746 | 503 if ( pItemCount ) |
1300 | 504 { |
1741 | 505 pMouse->GetCursorPos(&mouse); |
506 if ( !(pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF) ) | |
1300 | 507 return; |
1741 | 508 pItemCount = (pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF) - 1; |
1300 | 509 if ( dialog_menu_id == 2 ) |
1741 | 510 selected_item = &pParty->StandartItemsInShops[window_SpeakInHouse->par1C][(pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF) - 1]; |
1300 | 511 else |
1741 | 512 selected_item = &pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][(pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF) - 1]; |
2460 | 513 if ( !GetAsyncKeyState(VK_CONTROL) || !pPlayers[uActiveCharacter]->CanSteal() ) |
1746 | 514 { |
1843
2e6d3cd052e0
some char* cast removal + adding const_casts where appropriate
Grumpy7
parents:
1838
diff
changeset
|
515 pText = BuildDialogueString(pMerchantsBuyPhrases[pPlayers[uActiveCharacter]->SelectPhrasesTransaction(selected_item, BuildingType_ArmorShop, window_SpeakInHouse->par1C, 2)], |
1746 | 516 uActiveCharacter - 1, selected_item, (char *)window_SpeakInHouse->ptr_1C, 2, 0); |
2069 | 517 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, Color16(0xFFu, 0xFFu, 0xFFu), pText, 3); |
1746 | 518 } |
1300 | 519 else |
1746 | 520 { |
521 pText = BuildDialogueString(pGlobalTXT_LocalizationStrings[181], uActiveCharacter - 1, selected_item, (char *)window_SpeakInHouse->ptr_1C, 2, 0);//"Steal %24" | |
2069 | 522 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, Color16(0xFFu, 0xFFu, 0xFFu), pText, 3); |
1746 | 523 } |
1300 | 524 return; |
525 } | |
1758
24e756a50073
DrawBuff_remaind_time_string and DrawShops_next_generation_time_string fix and cleared
Ritor1
parents:
1754
diff
changeset
|
526 dialog_window.DrawShops_next_generation_time_string(pParty->PartyTimes.Shops_next_generation_time[window_SpeakInHouse->par1C]- pParty->uTimePlayed); |
1300 | 527 return; |
528 } | |
529 break; | |
1746 | 530 |
1300 | 531 case HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT: |
532 { | |
533 draw_leather(); | |
534 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); | |
1843
2e6d3cd052e0
some char* cast removal + adding const_casts where appropriate
Grumpy7
parents:
1838
diff
changeset
|
535 pShopOptions[0] = const_cast<char *>(pGlobalTXT_LocalizationStrings[200]); //"Sell" |
2e6d3cd052e0
some char* cast removal + adding const_casts where appropriate
Grumpy7
parents:
1838
diff
changeset
|
536 pShopOptions[1] = const_cast<char *>(pGlobalTXT_LocalizationStrings[113]); //"Identify" |
2e6d3cd052e0
some char* cast removal + adding const_casts where appropriate
Grumpy7
parents:
1838
diff
changeset
|
537 pShopOptions[2] = const_cast<char *>(pGlobalTXT_LocalizationStrings[179]); //"Repair" |
1300 | 538 all_text_height = 0; |
539 for ( int i = 0; i < 3; ++i ) | |
540 all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0); | |
1746 | 541 v146 = (174 - all_text_height) / 3; |
542 v23 = (3 * (58 - v146) - all_text_height) / 2 - v146 / 2 + 138; | |
543 pNumString = 0; | |
544 for ( int i = pDialogueWindow->pStartingPosActiveItem; | |
545 i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) | |
1300 | 546 { |
1746 | 547 pButton = pDialogueWindow->GetControl(i); |
548 pButton->uY = v146 + v23; | |
549 pButton->uHeight = pFontArrus->CalcTextHeight(pShopOptions[pNumString], &dialog_window, 0, 0); | |
550 v23 = pButton->uY + pFontArrus->CalcTextHeight(pShopOptions[pNumString], &dialog_window, 0, 0) - 1; | |
551 pButton->uW = v23; | |
2069 | 552 pTextColor = Color16(0xE1u, 0xCDu, 0x23u); |
1746 | 553 if ( pDialogueWindow->pCurrentPosActiveItem != i ) |
2069 | 554 pTextColor = Color16(0xFFu, 0xFFu, 0xFFu); |
1746 | 555 dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pTextColor, pShopOptions[pNumString], 3); |
556 ++pNumString; | |
1300 | 557 } |
558 return; | |
559 } | |
560 break; | |
1746 | 561 |
1300 | 562 case HOUSE_DIALOGUE_SHOP_SELL: |
563 { | |
564 draw_leather(); | |
565 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); | |
566 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[199], 0);//"Select the Item to Sell" | |
1393 | 567 if ( !HouseUI_CheckIfPlayerCanInteract()) |
1300 | 568 return; |
1746 | 569 pMouse->GetCursorPos(&mouse); |
570 v153 = ((mouse.x - 14) >> 5) + 14 * ((mouse.y - 17) >> 5); | |
571 if ( mouse.x <= 13 || mouse.x >= 462 ) | |
572 return; | |
573 if ( !pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v153) ) | |
1300 | 574 return; |
1746 | 575 selected_item = &pPlayers[uActiveCharacter]->pInventoryItemList[pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v153) - 1]; |
1843
2e6d3cd052e0
some char* cast removal + adding const_casts where appropriate
Grumpy7
parents:
1838
diff
changeset
|
576 pText = BuildDialogueString(pMerchantsSellPhrases[pPlayers[uActiveCharacter]->SelectPhrasesTransaction(selected_item, BuildingType_ArmorShop, window_SpeakInHouse->par1C, 3)], |
1746 | 577 uActiveCharacter - 1, selected_item, (char *) window_SpeakInHouse->par1C, 3, 0); |
2069 | 578 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, Color16(0xFFu, 0xFFu, 0xFFu), pText, 3); |
1300 | 579 return; |
580 } | |
581 break; | |
582 case HOUSE_DIALOGUE_SHOP_IDENTIFY: | |
583 { | |
584 draw_leather(); | |
585 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); | |
586 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[197], 0); //"Select the Item to Identify" | |
1393 | 587 if ( HouseUI_CheckIfPlayerCanInteract() ) |
1300 | 588 { |
1746 | 589 pMouse->GetCursorPos(&mouse); |
590 v153 = ((mouse.x - 14) >> 5) + 14 * ((mouse.y - 17) >> 5); | |
591 if ( mouse.x > 13 && mouse.x < 462 ) | |
1300 | 592 { |
1746 | 593 if ( pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v153) ) |
1300 | 594 { |
1746 | 595 selected_item = &pPlayers[uActiveCharacter]->pInventoryItemList[pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v153)-1]; |
596 if (selected_item->IsIdentified()) | |
597 pText = BuildDialogueString("%24", uActiveCharacter - 1, selected_item, (char *)window_SpeakInHouse->ptr_1C, 4, 0); | |
598 else | |
1843
2e6d3cd052e0
some char* cast removal + adding const_casts where appropriate
Grumpy7
parents:
1838
diff
changeset
|
599 pText = BuildDialogueString(pMerchantsIdentifyPhrases[pPlayers[uActiveCharacter]->SelectPhrasesTransaction(selected_item, BuildingType_ArmorShop, |
1746 | 600 (int)window_SpeakInHouse->ptr_1C, 4)], uActiveCharacter - 1, selected_item, (char *)window_SpeakInHouse->ptr_1C, 4, 0); |
2069 | 601 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, Color16(0xFFu, 0xFFu, 0xFFu), pText, 3); |
1746 | 602 return; |
1300 | 603 } |
604 } | |
605 } | |
606 } | |
607 break; | |
608 case HOUSE_DIALOGUE_SHOP_REPAIR: | |
609 { | |
610 draw_leather(); | |
611 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); | |
612 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[198], 0); | |
1393 | 613 if ( !HouseUI_CheckIfPlayerCanInteract()) |
1300 | 614 return; |
1746 | 615 pMouse->GetCursorPos(&mouse); |
616 v153 = ((mouse.x -14) >> 5) + 14 * ((mouse.y - 17) >> 5); | |
617 if( mouse.x <= 13 || mouse.x >= 462 ) | |
1300 | 618 return; |
1746 | 619 if ( !pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v153) |
620 || (!(pPlayers[uActiveCharacter]->pOwnItems[pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v153) - 1].uAttributes& 2)) ) | |
621 return; | |
622 selected_item = &pPlayers[uActiveCharacter]->pInventoryItemList[pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v153) - 1]; | |
623 phrases_id = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(&pPlayers[uActiveCharacter]->pInventoryItemList[pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v153) - 1], | |
624 BuildingType_ArmorShop, window_SpeakInHouse->par1C, 5); | |
1843
2e6d3cd052e0
some char* cast removal + adding const_casts where appropriate
Grumpy7
parents:
1838
diff
changeset
|
625 pText = BuildDialogueString(pMerchantsRepairPhrases[phrases_id], uActiveCharacter - 1, selected_item, (char *)window_SpeakInHouse->ptr_1C, 5, 0); |
2069 | 626 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, Color16(0xFFu, 0xFFu, 0xFFu), pText, 3); |
1300 | 627 return; |
628 } | |
629 break; | |
1746 | 630 |
1300 | 631 case HOUSE_DIALOGUE_LEARN_SKILLS: |
632 { | |
1393 | 633 if (!HouseUI_CheckIfPlayerCanInteract() ) |
1300 | 634 return; |
1746 | 635 uint item_num = 0; |
1300 | 636 v38 = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0); |
1746 | 637 pPrice = v38 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; |
638 if ( (signed int)pPrice < v38 / 3 ) | |
639 pPrice = v38 / 3; | |
640 all_text_height = 0; | |
641 for ( int i = pDialogueWindow->pStartingPosActiveItem; | |
642 i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) | |
1300 | 643 { |
1746 | 644 if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][pDialogueWindow->GetControl(i)->msg_param - 36] |
645 && !pPlayers[uActiveCharacter]->pActiveSkills[pDialogueWindow->GetControl(i)->msg_param - 36] ) | |
1300 | 646 { |
1746 | 647 all_text_height += pFontArrus->CalcTextHeight(pSkillNames[pDialogueWindow->GetControl(i)->msg_param - 36], &dialog_window, 0, 0); |
648 item_num ++; | |
1300 | 649 } |
1746 | 650 } |
651 if ( item_num ) | |
652 { | |
653 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[401], pPrice); | |
654 dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3); | |
655 v146 = (149 - all_text_height) / item_num; | |
656 if ( (149 - all_text_height) / item_num > 32 ) | |
657 v146 = 32; | |
658 v23 = (149 - v146 * item_num - all_text_height) / 2 - v146 / 2 + 162; | |
659 for ( int i = pDialogueWindow->pStartingPosActiveItem; | |
660 i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) | |
1300 | 661 { |
1746 | 662 pButton = pDialogueWindow->GetControl(i); |
663 if ( !byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][pButton->msg_param - 36] | |
664 || pPlayers[uActiveCharacter]->pActiveSkills[pButton->msg_param - 36] ) | |
1300 | 665 { |
1746 | 666 pButton->uW = 0; |
667 pButton->uHeight = 0; | |
668 pButton->uY = 0; | |
1300 | 669 } |
1746 | 670 else |
671 { | |
672 pButton->uY = v146 + v23; | |
673 pButton->uHeight = pFontArrus->CalcTextHeight(pSkillNames[pButton->msg_param - 36], &dialog_window, 0, 0); | |
674 v23 = pButton->uY + pFontArrus->CalcTextHeight(pSkillNames[pButton->msg_param - 36], &dialog_window, 0, 0) - 1; | |
675 pButton->uW = v23; | |
2069 | 676 pTextColor = Color16(0xE1u, 0xCDu, 0x23u); |
1746 | 677 if ( pDialogueWindow->pCurrentPosActiveItem != i ) |
2069 | 678 pTextColor = Color16(0xFFu, 0xFFu, 0xFFu); |
1746 | 679 dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pTextColor, pSkillNames[pButton->msg_param - 36], 3); |
680 } | |
1300 | 681 } |
1746 | 682 return; |
1300 | 683 } |
684 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]); //"Seek knowledge elsewhere %s the %s" | |
685 strcat(pTmpBuf.data(), "\n \n"); | |
686 strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]); //"I can offer you nothing further." | |
2069 | 687 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 0, 0)) / 2 + 138, Color16(0xE1u, 0xCDu, 0x23u), pTmpBuf.data(), 3); |
1300 | 688 return; |
689 } | |
690 break; | |
1746 | 691 default: |
692 __debugbreak(); | |
1300 | 693 } |
694 } | |
695 //----- (004B9CC6) -------------------------------------------------------- | |
1458 | 696 void AlchemistDialog() |
1300 | 697 { |
1746 | 698 int index; // eax@7 |
1300 | 699 signed int v5; // esi@9 |
700 int v18; // eax@23 | |
1838 | 701 const char *pText; // edx@29 |
1752 | 702 unsigned int product_height_1row; // edi@55 |
703 unsigned int product_width_1row; // esi@57 | |
704 unsigned int product_height_2row; // edi@67 | |
705 unsigned int product_width_2row; // esi@69 | |
1746 | 706 ItemGen *item; // esi@118 |
1300 | 707 int v71; // eax@123 |
708 int all_text_height; // edi@125 | |
709 GUIButton *pButton; // esi@129 | |
710 unsigned int pColorText; // ax@129 | |
1746 | 711 POINT mouse; // [sp+2Ch] [bp-ACh]@117 |
1300 | 712 GUIWindow dialog_window; // [sp+5Ch] [bp-7Ch]@1 |
713 int v105; // [sp+B0h] [bp-28h]@19 | |
714 int pNumString; // [sp+C8h] [bp-10h]@9 | |
1746 | 715 int item_num; // [sp+D4h] [bp-4h]@11 |
716 int pPrice; | |
1300 | 717 |
718 memcpy(&dialog_window, window_SpeakInHouse, sizeof(dialog_window)); | |
719 dialog_window.uFrameX = 483; | |
720 dialog_window.uFrameWidth = 148; | |
721 dialog_window.uFrameZ = 334; | |
722 switch(dialog_menu_id) | |
723 { | |
724 case HOUSE_DIALOGUE_MAIN: | |
725 { | |
1393 | 726 if ( HouseUI_CheckIfPlayerCanInteract() ) |
1300 | 727 { |
1843
2e6d3cd052e0
some char* cast removal + adding const_casts where appropriate
Grumpy7
parents:
1838
diff
changeset
|
728 pShopOptions[0] = const_cast<char *>(pGlobalTXT_LocalizationStrings[134]); |
2e6d3cd052e0
some char* cast removal + adding const_casts where appropriate
Grumpy7
parents:
1838
diff
changeset
|
729 pShopOptions[1] = const_cast<char *>(pGlobalTXT_LocalizationStrings[152]); |
2e6d3cd052e0
some char* cast removal + adding const_casts where appropriate
Grumpy7
parents:
1838
diff
changeset
|
730 pShopOptions[2] = const_cast<char *>(pGlobalTXT_LocalizationStrings[159]); |
2e6d3cd052e0
some char* cast removal + adding const_casts where appropriate
Grumpy7
parents:
1838
diff
changeset
|
731 pShopOptions[3] = const_cast<char *>(pGlobalTXT_LocalizationStrings[160]); |
1300 | 732 all_text_height = 0; |
1746 | 733 for ( int i = 0; i < 4; ++i ) |
1300 | 734 all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0); |
1746 | 735 v18 = (174 - all_text_height) / 4; |
736 v105 = (174 - 4 * (174 - all_text_height) / 4 - all_text_height) / 2 - (174 - all_text_height) / 4 / 2 + 138; | |
737 pNumString = 0; | |
738 for ( int i = pDialogueWindow->pStartingPosActiveItem; | |
739 i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) | |
1300 | 740 { |
1746 | 741 pButton = pDialogueWindow->GetControl(i); |
742 pButton->uY = v18 + v105; | |
2389 | 743 pButton->uHeight = pFontArrus->CalcTextHeight(pShopOptions[pNumString], &dialog_window, 0, 0); |
744 v105 = pButton->uY + pFontArrus->CalcTextHeight(pShopOptions[pNumString], &dialog_window, 0, 0) - 1; | |
1746 | 745 pButton->uW = v105; |
2069 | 746 pColorText = Color16(0xE1u, 0xCDu, 0x23u); |
1746 | 747 if ( pDialogueWindow->pCurrentPosActiveItem != i ) |
2069 | 748 pColorText = Color16(0xFFu, 0xFFu, 0xFFu); |
2389 | 749 dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, pShopOptions[pNumString], 3); |
1746 | 750 ++pNumString; |
1300 | 751 } |
752 } | |
753 return; | |
754 } | |
1746 | 755 |
1300 | 756 case HOUSE_DIALOGUE_SHOP_BUY_STANDARD: |
757 { | |
758 pRenderer->DrawTextureIndexed(8, 8, ShopTexture); | |
1746 | 759 for ( uint i = 0; i < 6; ++i ) |
1300 | 760 { |
1746 | 761 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].uItemID ) |
1300 | 762 { |
1752 | 763 product_height_1row = 152 - ItemsInShopTexture[i]->uTextureHeight; |
764 if ( (signed int)product_height_1row < 1 ) | |
765 product_height_1row = 0; | |
766 product_width_1row = 75 * i - ItemsInShopTexture[i]->uTextureWidth / 2 + 40; | |
1746 | 767 if ( i ) |
1300 | 768 { |
1746 | 769 if ( i == 5 ) |
1300 | 770 { |
1752 | 771 if ( (signed int)product_width_1row > 457 - ItemsInShopTexture[5]->uTextureWidth ) |
772 product_width_1row = 457 - ItemsInShopTexture[5]->uTextureWidth; | |
1300 | 773 } |
774 } | |
1752 | 775 else if ( (signed int)product_width_1row < 18 ) |
776 product_width_1row = 18; | |
777 pRenderer->DrawTextureTransparent(product_width_1row, product_height_1row, ItemsInShopTexture[i]); | |
2215
e9625ad08541
fog fix and change 640,480 - window->GetWidth(), window->GetHeight()
Ritor1
parents:
2182
diff
changeset
|
778 ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[product_width_1row + window->GetWidth() * product_height_1row], ItemsInShopTexture[i], i + 1); |
1300 | 779 } |
780 } | |
1746 | 781 for ( uint i = 0; i < 6; ++i ) |
1300 | 782 { |
1746 | 783 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i + 6].uItemID ) |
1300 | 784 { |
1752 | 785 product_height_2row = 308 - ItemsInShopTexture[i + 6]->uTextureHeight; |
786 if ( (signed int)product_height_2row < 1 ) | |
787 product_height_2row = 0; | |
788 product_width_2row = 75 * i - ItemsInShopTexture[i + 6]->uTextureWidth / 2 + 40; | |
1746 | 789 if ( i ) |
1300 | 790 { |
1746 | 791 if ( i == 5 ) |
1300 | 792 { |
1752 | 793 if ( (signed int)product_width_2row > 457 - ItemsInShopTexture[11]->uTextureWidth ) |
794 product_width_2row = 457 - ItemsInShopTexture[11]->uTextureWidth; | |
1300 | 795 } |
796 } | |
797 else | |
798 { | |
1752 | 799 if ( (signed int)product_width_2row < 18 ) |
800 product_width_2row = 18; | |
1300 | 801 } |
1752 | 802 pRenderer->DrawTextureTransparent(product_width_2row, product_height_2row, ItemsInShopTexture[i + 6]); |
2215
e9625ad08541
fog fix and change 640,480 - window->GetWidth(), window->GetHeight()
Ritor1
parents:
2182
diff
changeset
|
803 ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[product_width_2row + window->GetWidth() * product_height_2row], ItemsInShopTexture[i + 6], i + 7); |
1300 | 804 } |
805 } | |
1393 | 806 if ( HouseUI_CheckIfPlayerCanInteract() ) |
1300 | 807 { |
1746 | 808 item_num = 0; |
809 for ( uint i = 0; i < 12; ++i ) | |
1300 | 810 { |
1746 | 811 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].uItemID) |
812 ++item_num; | |
1300 | 813 } |
2460 | 814 if ( GetAsyncKeyState(VK_CONTROL) && pPlayers[uActiveCharacter]->CanSteal() ) |
1746 | 815 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[185], 0); |
1300 | 816 else |
1746 | 817 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[195], 0); |
818 if ( !item_num ) | |
1300 | 819 { |
1758
24e756a50073
DrawBuff_remaind_time_string and DrawShops_next_generation_time_string fix and cleared
Ritor1
parents:
1754
diff
changeset
|
820 dialog_window.DrawShops_next_generation_time_string(pParty->PartyTimes.Shops_next_generation_time[ (unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed); |
1300 | 821 return; |
822 } | |
1746 | 823 pMouse->GetCursorPos(&mouse); |
824 if ( pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF ) | |
1300 | 825 { |
1746 | 826 item = &pParty->StandartItemsInShops[(int)window_SpeakInHouse->ptr_1C][(pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF) - 1]; |
2460 | 827 if ( !GetAsyncKeyState(VK_CONTROL) || !pPlayers[uActiveCharacter]->CanSteal() ) |
1300 | 828 { |
1746 | 829 v71 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(item, BuildingType_AlchemistShop, (int)window_SpeakInHouse->ptr_1C, 2); |
1843
2e6d3cd052e0
some char* cast removal + adding const_casts where appropriate
Grumpy7
parents:
1838
diff
changeset
|
830 pText = BuildDialogueString(pMerchantsBuyPhrases[v71], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 2, 0); |
1300 | 831 } |
832 else | |
1746 | 833 pText = BuildDialogueString(pGlobalTXT_LocalizationStrings[181], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 2, 0); |
2069 | 834 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, Color16(0xFFu, 0xFFu, 0xFFu), pText, 3); |
1300 | 835 return ; |
836 } | |
837 } | |
838 return; | |
839 } | |
1746 | 840 |
841 case HOUSE_DIALOGUE_SHOP_BUY_SPECIAL: | |
842 { | |
843 pRenderer->DrawTextureIndexed(8, 8, ShopTexture); | |
844 for ( uint i = 0; i < 6; ++i ) | |
845 { | |
846 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].uItemID) | |
847 { | |
1752 | 848 product_height_1row = 152 - ItemsInShopTexture[i]->uTextureHeight; |
849 if ( (signed int)product_height_1row < 1 ) | |
850 product_height_1row = 0; | |
851 product_width_1row = 75 * i - ItemsInShopTexture[i]->uTextureWidth / 2 + 40; | |
1746 | 852 if ( i ) |
853 { | |
854 if ( i == 5 ) | |
855 { | |
1752 | 856 if ( (signed int)product_width_1row > 457 - ItemsInShopTexture[5]->uTextureWidth ) |
857 product_width_1row = 457 - ItemsInShopTexture[5]->uTextureWidth; | |
1746 | 858 } |
859 } | |
860 else | |
861 { | |
1752 | 862 if ( (signed int)product_width_1row < 18 ) |
863 product_width_1row = 18; | |
1746 | 864 } |
1752 | 865 pRenderer->DrawTextureTransparent(product_width_1row, product_height_1row, ItemsInShopTexture[i]); |
2215
e9625ad08541
fog fix and change 640,480 - window->GetWidth(), window->GetHeight()
Ritor1
parents:
2182
diff
changeset
|
866 ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[product_width_1row + window->GetWidth() * product_height_1row], ItemsInShopTexture[i], i + 1); |
1746 | 867 } |
868 } | |
869 for ( uint i = 0; i < 6; ++i ) | |
870 { | |
871 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][(signed int)i + 6].uItemID) //not itemid | |
872 { | |
1752 | 873 product_height_2row = 308 - ItemsInShopTexture[i + 6]->uTextureHeight; |
874 if ( (signed int)product_height_2row < 1 ) | |
875 product_height_2row = 0; | |
876 product_width_2row = 75 * i - ItemsInShopTexture[i + 6]->uTextureWidth / 2 + 40; | |
1746 | 877 if ( i ) |
878 { | |
879 if ( i == 5 ) | |
880 { | |
1752 | 881 if ( (signed int)product_width_2row > 457 - ItemsInShopTexture[11]->uTextureWidth ) |
882 product_width_2row = 457 - ItemsInShopTexture[11]->uTextureWidth; | |
1746 | 883 } |
884 } | |
885 else | |
886 { | |
1752 | 887 if ( (signed int)product_width_2row < 18 ) |
888 product_width_2row = 18; | |
1746 | 889 } |
1752 | 890 pRenderer->DrawTextureTransparent(product_width_2row, product_height_2row, ItemsInShopTexture[i + 6]); |
2215
e9625ad08541
fog fix and change 640,480 - window->GetWidth(), window->GetHeight()
Ritor1
parents:
2182
diff
changeset
|
891 ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[product_width_2row + window->GetWidth() * product_height_2row], ItemsInShopTexture[i + 6], i + 7); |
1746 | 892 } |
893 } | |
894 if ( HouseUI_CheckIfPlayerCanInteract() ) | |
895 { | |
896 item_num = 0; | |
897 for ( uint i = 0; i < 12; ++i ) | |
898 { | |
899 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].uItemID) | |
900 ++item_num; | |
901 } | |
2460 | 902 if ( GetAsyncKeyState(VK_CONTROL) && pPlayers[uActiveCharacter]->CanSteal() ) |
1746 | 903 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[185], 0); |
904 else | |
905 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[196], 0); | |
906 if ( !item_num ) | |
907 { | |
1758
24e756a50073
DrawBuff_remaind_time_string and DrawShops_next_generation_time_string fix and cleared
Ritor1
parents:
1754
diff
changeset
|
908 dialog_window.DrawShops_next_generation_time_string(pParty->PartyTimes.Shops_next_generation_time[ (unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed); |
1746 | 909 return; |
910 } | |
911 pMouse->GetCursorPos(&mouse); | |
912 if ( pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF ) | |
913 { | |
914 item = &pParty->SpecialItemsInShops[(int)window_SpeakInHouse->ptr_1C][(pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF) - 1]; | |
2460 | 915 if ( !GetAsyncKeyState(VK_CONTROL) || !pPlayers[uActiveCharacter]->CanSteal() ) |
1746 | 916 { |
917 v71 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(item, BuildingType_AlchemistShop, (int)window_SpeakInHouse->ptr_1C, 2); | |
1843
2e6d3cd052e0
some char* cast removal + adding const_casts where appropriate
Grumpy7
parents:
1838
diff
changeset
|
918 pText = BuildDialogueString(pMerchantsBuyPhrases[v71], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 2, 0); |
1746 | 919 } |
920 else | |
921 pText = BuildDialogueString(pGlobalTXT_LocalizationStrings[181], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 2, 0); | |
2069 | 922 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, Color16(0xFFu, 0xFFu, 0xFFu), pText, 3); |
1746 | 923 return; |
924 } | |
925 } | |
926 return; | |
927 } | |
928 | |
1300 | 929 case HOUSE_DIALOGUE_SHOP_SELL: |
930 { | |
931 draw_leather(); | |
932 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); | |
933 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[199], 0); | |
1393 | 934 if ( !HouseUI_CheckIfPlayerCanInteract() ) |
1300 | 935 return; |
1746 | 936 pMouse->GetCursorPos(&mouse); |
937 index = ((mouse.x - 14) >> 5) + 14 * ((mouse.y - 17) >> 5); | |
938 if ( mouse.x <= 13 || mouse.x >= 462 ) | |
939 return; | |
940 if ( !pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&index) ) | |
1300 | 941 return; |
1746 | 942 v71 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(&pPlayers[uActiveCharacter]->pInventoryItemList[pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&index) - 1], |
943 BuildingType_AlchemistShop, (int)window_SpeakInHouse->ptr_1C, 3); | |
1843
2e6d3cd052e0
some char* cast removal + adding const_casts where appropriate
Grumpy7
parents:
1838
diff
changeset
|
944 pText = BuildDialogueString(pMerchantsSellPhrases[v71], uActiveCharacter - 1, &pPlayers[uActiveCharacter]->pInventoryItemList[pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&index) - 1], |
1746 | 945 (char *)window_SpeakInHouse->ptr_1C, 3, 0); |
2069 | 946 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, Color16(0xFFu, 0xFFu, 0xFFu), pText, 3); |
1300 | 947 return; |
948 } | |
1746 | 949 |
1300 | 950 case HOUSE_DIALOGUE_SHOP_IDENTIFY: |
951 { | |
952 draw_leather(); | |
953 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); | |
954 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[197], 0); | |
1393 | 955 if ( HouseUI_CheckIfPlayerCanInteract() ) |
1300 | 956 return; |
1746 | 957 pMouse->GetCursorPos(&mouse); |
958 index = ((mouse.x - 14) >> 5) + 14 * ((mouse.y - 17) >> 5); | |
959 if ( mouse.x <= 13 || mouse.x >= 462 ) | |
960 return; | |
961 if ( !pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&index) ) | |
1300 | 962 return; |
1746 | 963 item = &pPlayers[uActiveCharacter]->pInventoryItemList[pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&index) - 1]; |
964 if (!item->IsIdentified()) | |
1300 | 965 { |
1746 | 966 v71 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(item, BuildingType_AlchemistShop, (int)window_SpeakInHouse->ptr_1C, 4); |
967 pText = BuildDialogueString(pMerchantsIdentifyPhrases[v71], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 4, 0); | |
1300 | 968 } |
969 else | |
1746 | 970 pText = BuildDialogueString("%24", uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 4, 0); |
2069 | 971 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, Color16(0xFFu, 0xFFu, 0xFFu), pText, 3); |
1300 | 972 return; |
973 } | |
1746 | 974 |
1300 | 975 case HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT: |
976 { | |
977 draw_leather(); | |
978 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); | |
1843
2e6d3cd052e0
some char* cast removal + adding const_casts where appropriate
Grumpy7
parents:
1838
diff
changeset
|
979 pShopOptions[0] = const_cast<char *>(pGlobalTXT_LocalizationStrings[200]); |
2e6d3cd052e0
some char* cast removal + adding const_casts where appropriate
Grumpy7
parents:
1838
diff
changeset
|
980 pShopOptions[1] = const_cast<char *>(pGlobalTXT_LocalizationStrings[113]); |
1300 | 981 all_text_height = 0; |
982 for ( int i = 0; i < 2; ++i ) | |
983 all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0); | |
1746 | 984 v18 = (174 - all_text_height) / 2; |
985 v105 = (2 * (87 - (174 - all_text_height) / 2) - all_text_height) / 2 - (174 - all_text_height) / 2 / 2 + 138; | |
986 pNumString = 0; | |
987 for ( int i = pDialogueWindow->pStartingPosActiveItem; | |
988 i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) | |
1300 | 989 { |
1746 | 990 pButton = pDialogueWindow->GetControl(i); |
991 pButton->uY = v18 + v105; | |
2389 | 992 pButton->uHeight = pFontArrus->CalcTextHeight(pShopOptions[pNumString], &dialog_window, 0, 0); |
993 v105 = pButton->uY + pFontArrus->CalcTextHeight(pShopOptions[pNumString], &dialog_window, 0, 0) - 1; | |
1746 | 994 pButton->uW = v105; |
2069 | 995 pColorText = Color16(0xE1u, 0xCDu, 0x23u); |
1746 | 996 if ( pDialogueWindow->pCurrentPosActiveItem != i ) |
2069 | 997 pColorText = Color16(0xFFu, 0xFFu, 0xFFu); |
2389 | 998 dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, pShopOptions[pNumString], 3); |
1746 | 999 ++pNumString; |
1300 | 1000 } |
1001 return; | |
1002 } | |
1746 | 1003 |
1300 | 1004 case HOUSE_DIALOGUE_LEARN_SKILLS: |
1005 { | |
1393 | 1006 if (!HouseUI_CheckIfPlayerCanInteract()) |
1300 | 1007 return; |
1008 all_text_height = 0; | |
1009 v5 = (signed __int64)(p2DEvents[(signed int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0); | |
1746 | 1010 pPrice = v5 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; |
1011 if ( pPrice < v5 / 3 ) | |
1012 pPrice = v5 / 3; | |
1013 item_num = 0; | |
1014 for ( int i = pDialogueWindow->pStartingPosActiveItem; | |
1015 i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) | |
1300 | 1016 { |
1746 | 1017 pButton = pDialogueWindow->GetControl(i); |
1018 if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][pButton->msg_param - 36] | |
1019 && !pPlayers[uActiveCharacter]->pActiveSkills[pButton->msg_param - 36] ) | |
1020 { | |
1021 all_text_height = pFontArrus->CalcTextHeight(pSkillNames[pButton->msg_param - 36], &dialog_window, 0, 0); | |
1022 ++item_num; | |
1023 } | |
1024 } | |
1025 if ( !item_num ) | |
1026 { | |
1027 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]); | |
1300 | 1028 strcat(pTmpBuf.data(), "\n \n"); |
1029 strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]); | |
2069 | 1030 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 0, 0)) / 2 + 138, Color16(0xE1u, 0xCDu, 0x23u), pTmpBuf.data(), 3); |
1300 | 1031 return; |
1032 } | |
1746 | 1033 if ( item_num ) |
1300 | 1034 { |
1746 | 1035 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[401], pPrice); |
1300 | 1036 dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3); |
1746 | 1037 v18 = (149 - all_text_height) / item_num; |
1038 if ( (149 - all_text_height) / item_num > 32 ) | |
1300 | 1039 v18 = 32; |
1746 | 1040 v105 = (149 - item_num * v18 - all_text_height) / 2 - v18 / 2 + 162; |
1041 for ( int i = pDialogueWindow->pStartingPosActiveItem; | |
1042 i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; i++ ) | |
1300 | 1043 { |
1746 | 1044 pButton = pDialogueWindow->GetControl(i); |
1045 if ( !byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][pButton->msg_param - 36] | |
1046 || pPlayers[uActiveCharacter]->pActiveSkills[pButton->msg_param - 36] ) | |
1300 | 1047 { |
1746 | 1048 pButton->uW = 0; |
1049 pButton->uHeight = 0; | |
1050 pButton->uY = 0; | |
1300 | 1051 } |
1746 | 1052 else |
1053 { | |
1054 pButton->uY = v18 + v105; | |
1055 pButton->uHeight = pFontArrus->CalcTextHeight(pSkillNames[pButton->msg_param - 36], &dialog_window, 0, 0); | |
1056 v105 = pButton->uY + pFontArrus->CalcTextHeight(pSkillNames[pButton->msg_param - 36], &dialog_window, 0, 0) - 1; | |
1057 pButton->uW = v105; | |
2069 | 1058 pColorText = Color16(0xE1u, 0xCDu, 0x23u); |
1746 | 1059 if ( pDialogueWindow->pCurrentPosActiveItem != i ) |
2069 | 1060 pColorText = Color16(0xFFu, 0xFFu, 0xFFu); |
1746 | 1061 dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, pSkillNames[pButton->msg_param - 36], 3); |
1062 } | |
1300 | 1063 } |
1064 return; | |
1065 } | |
1066 } | |
1067 default: | |
1746 | 1068 __debugbreak(); |
1300 | 1069 } |
1070 } | |
1746 | 1071 |
1300 | 1072 //----- (004B4FCF) -------------------------------------------------------- |
1073 void MagicShopDialog() | |
1074 { | |
1075 int all_text_height; // edi@21 | |
1076 GUIButton *control_button; // esi@25 | |
1077 int v23; // eax@25 | |
1078 unsigned __int16 text_color; // ax@25 | |
1079 char *v30; // edx@35 | |
1080 signed int v33; // esi@40 | |
1752 | 1081 unsigned int product_height_1row; // edi@64 |
1082 unsigned int product_width_1row; // esi@66 | |
1083 unsigned int product_height_2row; // edi@76 | |
1084 unsigned int product_width_2row; // esi@76 | |
1300 | 1085 int v75; // eax@130 |
1752 | 1086 POINT mouse; // [sp+6Ch] [bp-8Ch]@30 |
1300 | 1087 GUIWindow dialog_window; // [sp+7Ch] [bp-7Ch]@1 |
1752 | 1088 int item_num; // [sp+E0h] [bp-18h]@8 |
1089 int v117; // [sp+E4h] [bp-14h]@40 | |
1090 int pPrice; // [sp+E8h] [bp-10h]@24 | |
1091 int one_string; // [sp+ECh] [bp-Ch]@1 | |
1300 | 1092 int pSrtingNum; |
1093 ItemGen *item; | |
1094 | |
1095 memcpy(&dialog_window, window_SpeakInHouse, sizeof(dialog_window)); | |
1096 dialog_window.uFrameX = 483; | |
1097 dialog_window.uFrameWidth = 148; | |
1098 dialog_window.uFrameZ = 334; | |
1099 if ( dialog_menu_id == HOUSE_DIALOGUE_MAIN) | |
1100 { | |
1393 | 1101 if ( !HouseUI_CheckIfPlayerCanInteract() ) |
1300 | 1102 return; |
1843
2e6d3cd052e0
some char* cast removal + adding const_casts where appropriate
Grumpy7
parents:
1838
diff
changeset
|
1103 pShopOptions[0] = const_cast<char *>(pGlobalTXT_LocalizationStrings[134]); //"Buy Standard" |
2e6d3cd052e0
some char* cast removal + adding const_casts where appropriate
Grumpy7
parents:
1838
diff
changeset
|
1104 pShopOptions[1] = const_cast<char *>(pGlobalTXT_LocalizationStrings[152]); //"Buy Special" |
2e6d3cd052e0
some char* cast removal + adding const_casts where appropriate
Grumpy7
parents:
1838
diff
changeset
|
1105 pShopOptions[2] = const_cast<char *>(pGlobalTXT_LocalizationStrings[159]); //"Display Inventory" |
2e6d3cd052e0
some char* cast removal + adding const_casts where appropriate
Grumpy7
parents:
1838
diff
changeset
|
1106 pShopOptions[3] = const_cast<char *>(pGlobalTXT_LocalizationStrings[160]); |
1300 | 1107 all_text_height = 0; |
1108 for ( int i = 0; i < 4; ++i ) | |
1109 all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0); | |
1752 | 1110 one_string = (174 - all_text_height) / 4; |
1111 v23 = (174 - 4 * one_string - all_text_height) / 2 - one_string / 2 + 138; | |
1112 int pNumString = 0; | |
1113 for (int i = pDialogueWindow->pStartingPosActiveItem; | |
1114 i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i) | |
1300 | 1115 { |
1752 | 1116 control_button = pDialogueWindow->GetControl(i); |
1117 control_button->uY = one_string + v23; | |
1118 control_button->uHeight = pFontArrus->CalcTextHeight(pShopOptions[pNumString], &dialog_window, 0, 0); | |
1119 v23 = control_button->uY + control_button->uHeight - 1; | |
1120 control_button->uW = v23; | |
2069 | 1121 text_color = Color16(225, 205, 35); |
1752 | 1122 if ( pDialogueWindow->pCurrentPosActiveItem != i ) |
2069 | 1123 text_color = Color16(255, 255, 255); |
1752 | 1124 dialog_window.DrawTitleText(pFontArrus, 0, control_button->uY, text_color, pShopOptions[pNumString], 3); |
1125 ++pNumString; | |
1300 | 1126 } |
1127 return; | |
1128 } | |
1752 | 1129 |
1300 | 1130 if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_BUY_STANDARD) |
1131 { | |
1132 pRenderer->DrawTextureIndexed(8, 8, ShopTexture); | |
1752 | 1133 for ( uint i = 0; i < 6; ++i ) |
1300 | 1134 { |
1752 | 1135 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].uItemID) |
1300 | 1136 { |
1752 | 1137 product_height_1row = 152 - ItemsInShopTexture[i]->uTextureHeight; |
1138 if ( (signed int)product_height_1row < 1 ) | |
1139 product_height_1row = 0; | |
1140 product_width_1row = 75 * i - ItemsInShopTexture[i]->uTextureWidth / 2 + 40; | |
1141 if ( i ) | |
1300 | 1142 { |
1752 | 1143 if ( i == 5 ) |
1300 | 1144 { |
1752 | 1145 if ( (signed int)product_width_1row > 457 - ItemsInShopTexture[5]->uTextureWidth ) |
1146 product_width_1row = 457 - ItemsInShopTexture[5]->uTextureWidth; | |
1300 | 1147 } |
1148 } | |
1149 else | |
1150 { | |
1752 | 1151 if ( (signed int)product_width_1row < 18 ) |
1152 product_width_1row = 18; | |
1300 | 1153 } |
1752 | 1154 pRenderer->DrawTextureTransparent(product_width_1row, product_height_1row, ItemsInShopTexture[i]); |
2215
e9625ad08541
fog fix and change 640,480 - window->GetWidth(), window->GetHeight()
Ritor1
parents:
2182
diff
changeset
|
1155 ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[product_width_1row + window->GetWidth() * product_height_1row], ItemsInShopTexture[i], i + 1); |
1300 | 1156 } |
1157 } | |
1752 | 1158 for ( uint i = 0; i < 6; ++i ) |
1300 | 1159 { |
1752 | 1160 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i + 6].uItemID) |
1300 | 1161 { |
1752 | 1162 product_height_2row = 306 - ItemsInShopTexture[i + 6]->uTextureHeight; |
1163 product_width_2row = 75 * i - ItemsInShopTexture[i + 6]->uTextureWidth / 2 + 40; | |
1164 if ( i ) | |
1300 | 1165 { |
1752 | 1166 if ( i == 5 ) |
1300 | 1167 { |
1752 | 1168 if ( (signed int)product_width_2row > 457 - ItemsInShopTexture[11]->uTextureWidth ) |
1169 product_width_2row = 457 - ItemsInShopTexture[11]->uTextureWidth; | |
1300 | 1170 } |
1171 } | |
1172 else | |
1173 { | |
1752 | 1174 if ( (signed int)product_width_2row < 18 ) |
1175 product_width_2row = 18; | |
1300 | 1176 } |
1752 | 1177 pRenderer->DrawTextureTransparent(product_width_2row, product_height_2row, ItemsInShopTexture[i + 6]); |
2215
e9625ad08541
fog fix and change 640,480 - window->GetWidth(), window->GetHeight()
Ritor1
parents:
2182
diff
changeset
|
1178 ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[product_width_2row + window->GetWidth() * product_height_2row], ItemsInShopTexture[i + 6], i + 7); |
1300 | 1179 } |
1180 } | |
1393 | 1181 if ( HouseUI_CheckIfPlayerCanInteract() ) |
1300 | 1182 { |
1752 | 1183 item_num = 0; |
1184 for ( uint i = 0; i < 12; ++i ) | |
1300 | 1185 { |
1752 | 1186 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].uItemID ) |
1187 ++item_num; | |
1300 | 1188 } |
1752 | 1189 if ( GetAsyncKeyState(VK_CONTROL) && pPlayers[uActiveCharacter]->CanSteal() ) |
1190 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[185], 0);// "Steal item" | |
1300 | 1191 else |
1752 | 1192 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[195], 0);// "Select the Item to Buy" |
1193 if ( !item_num ) | |
1300 | 1194 { |
1758
24e756a50073
DrawBuff_remaind_time_string and DrawShops_next_generation_time_string fix and cleared
Ritor1
parents:
1754
diff
changeset
|
1195 dialog_window.DrawShops_next_generation_time_string(pParty->PartyTimes.Shops_next_generation_time[(unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed); |
1300 | 1196 return; |
1197 } | |
1752 | 1198 pMouse->GetCursorPos(&mouse); |
1199 if ( pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF ) | |
1300 | 1200 { |
1752 | 1201 item = &pParty->StandartItemsInShops[(int)window_SpeakInHouse->ptr_1C][(pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF) - 1]; |
1202 if ( GetAsyncKeyState(VK_CONTROL) && pPlayers[uActiveCharacter]->CanSteal() ) | |
1203 v30 = BuildDialogueString(pGlobalTXT_LocalizationStrings[181], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 2, 0);// "Steal %24" | |
1300 | 1204 else |
1205 { | |
1411 | 1206 v75 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(item, BuildingType_MagicShop, (int)window_SpeakInHouse->ptr_1C, 2); |
1843
2e6d3cd052e0
some char* cast removal + adding const_casts where appropriate
Grumpy7
parents:
1838
diff
changeset
|
1207 v30 = BuildDialogueString(pMerchantsBuyPhrases[v75], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 2, 0); |
1300 | 1208 } |
2069 | 1209 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(v30, &dialog_window, 0, 0)) / 2 + 138, Color16(255, 255, 255), v30, 3); |
1300 | 1210 return; |
1211 } | |
1212 } | |
1213 return; | |
1214 } | |
1752 | 1215 |
1300 | 1216 if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_BUY_SPECIAL) |
1217 { | |
1218 pRenderer->DrawTextureIndexed(8, 8, ShopTexture); | |
1752 | 1219 for ( uint i = 0; i < 6; ++i ) |
1300 | 1220 { |
1752 | 1221 if ( pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].uItemID ) |
1300 | 1222 { |
1752 | 1223 product_height_1row = 152 - ItemsInShopTexture[i]->uTextureHeight; |
1224 if ( (signed int)product_height_1row < 1 ) | |
1225 product_height_1row = 0; | |
1226 product_width_1row = 75 * i - ItemsInShopTexture[i]->uTextureWidth / 2 + 40; | |
1227 if ( i ) | |
1300 | 1228 { |
1752 | 1229 if ( i == 5 ) |
1300 | 1230 { |
1752 | 1231 if ( (signed int)product_width_1row > 457 - ItemsInShopTexture[5]->uTextureWidth ) |
1232 product_width_1row = 457 - ItemsInShopTexture[5]->uTextureWidth; | |
1300 | 1233 } |
1234 } | |
1235 else | |
1236 { | |
1752 | 1237 if ( (signed int)product_width_1row < 18 ) |
1238 product_width_1row = 18; | |
1300 | 1239 } |
1752 | 1240 pRenderer->DrawTextureTransparent(product_width_1row, product_height_1row, ItemsInShopTexture[i]); |
2215
e9625ad08541
fog fix and change 640,480 - window->GetWidth(), window->GetHeight()
Ritor1
parents:
2182
diff
changeset
|
1241 ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[product_width_1row + window->GetWidth() * product_height_1row], ItemsInShopTexture[i], i + 1); |
1300 | 1242 } |
1243 } | |
1752 | 1244 for ( uint i = 0; i < 6; ++i ) |
1245 { | |
1246 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i + 6].uItemID) | |
1247 { | |
1248 product_height_2row = 306 - ItemsInShopTexture[i + 6]->uTextureHeight; | |
1249 if ( (signed int)product_height_2row < 1 ) | |
1250 product_height_2row = 0; | |
1251 product_width_2row = 75 * i - ItemsInShopTexture[i + 6]->uTextureWidth / 2 + 40; | |
1252 if ( i ) | |
1253 { | |
1254 if ( i == 5 ) | |
1255 { | |
1256 if ( (signed int)product_width_2row > 457 - ItemsInShopTexture[11]->uTextureWidth ) | |
1257 product_width_2row = 457 - ItemsInShopTexture[11]->uTextureWidth; | |
1258 } | |
1259 } | |
1260 else | |
1261 { | |
1262 if ( (signed int)product_width_2row < 18 ) | |
1263 product_width_2row = 18; | |
1264 } | |
1265 pRenderer->DrawTextureTransparent(product_width_2row, product_height_2row, ItemsInShopTexture[i + 6]); | |
2215
e9625ad08541
fog fix and change 640,480 - window->GetWidth(), window->GetHeight()
Ritor1
parents:
2182
diff
changeset
|
1266 ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[product_width_2row + window->GetWidth() * product_height_2row], ItemsInShopTexture[i + 6], i + 7); |
1752 | 1267 } |
1268 } | |
1393 | 1269 if ( HouseUI_CheckIfPlayerCanInteract() ) |
1300 | 1270 { |
1752 | 1271 item_num = 0; |
1272 for ( uint i = 0; i < 12; ++i ) | |
1300 | 1273 { |
1752 | 1274 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].uItemID) |
1275 ++item_num; | |
1300 | 1276 } |
1752 | 1277 if ( GetAsyncKeyState(VK_CONTROL) && pPlayers[uActiveCharacter]->CanSteal() ) |
1278 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[185], 0);// "Steal item" | |
1300 | 1279 else |
1752 | 1280 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[196], 0);// "Select the Special Item to Buy" |
1281 if ( !item_num ) | |
1300 | 1282 { |
1758
24e756a50073
DrawBuff_remaind_time_string and DrawShops_next_generation_time_string fix and cleared
Ritor1
parents:
1754
diff
changeset
|
1283 dialog_window.DrawShops_next_generation_time_string( pParty->PartyTimes.Shops_next_generation_time[(unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed); |
1300 | 1284 return; |
1285 } | |
1752 | 1286 pMouse->GetCursorPos(&mouse); |
1287 if ( pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF ) | |
1300 | 1288 { |
1752 | 1289 item = &pParty->SpecialItemsInShops[(int)window_SpeakInHouse->ptr_1C][(pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF) - 1]; |
1290 if ( GetAsyncKeyState(VK_CONTROL) && pPlayers[uActiveCharacter]->CanSteal() ) | |
1291 v30 = BuildDialogueString(pGlobalTXT_LocalizationStrings[181], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 2, 0);// "Steal %24" | |
1300 | 1292 else |
1293 { | |
1411 | 1294 v75 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(item, BuildingType_MagicShop, (int)window_SpeakInHouse->ptr_1C, 2); |
1843
2e6d3cd052e0
some char* cast removal + adding const_casts where appropriate
Grumpy7
parents:
1838
diff
changeset
|
1295 v30 = BuildDialogueString(pMerchantsBuyPhrases[v75], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 2, 0); |
1300 | 1296 } |
2069 | 1297 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(v30, &dialog_window, 0, 0)) / 2 + 138, Color16(255, 255, 255), v30, 3); |
1300 | 1298 return; |
1299 } | |
1300 } | |
1301 return; | |
1302 } | |
1752 | 1303 |
1300 | 1304 if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT ) |
1305 { | |
1306 draw_leather(); | |
1307 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); | |
1843
2e6d3cd052e0
some char* cast removal + adding const_casts where appropriate
Grumpy7
parents:
1838
diff
changeset
|
1308 pShopOptions[0] = const_cast<char *>(pGlobalTXT_LocalizationStrings[200]);// "Sell" |
2e6d3cd052e0
some char* cast removal + adding const_casts where appropriate
Grumpy7
parents:
1838
diff
changeset
|
1309 pShopOptions[1] = const_cast<char *>(pGlobalTXT_LocalizationStrings[113]);// "Identify" |
2e6d3cd052e0
some char* cast removal + adding const_casts where appropriate
Grumpy7
parents:
1838
diff
changeset
|
1310 pShopOptions[2] = const_cast<char *>(pGlobalTXT_LocalizationStrings[179]);// "Repair" |
1300 | 1311 all_text_height = 0; |
1312 for ( uint i = 0; i < 3; ++i ) | |
1313 all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0); | |
1752 | 1314 one_string = ((174 - all_text_height) / 3); |
1315 v23 = (3 * (58 - (signed int)one_string) - all_text_height) / 2 - (174 - all_text_height) / 3 / 2 + 138; | |
1316 pSrtingNum = 0; | |
1317 for ( int i = pDialogueWindow->pStartingPosActiveItem; | |
1318 i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) | |
1300 | 1319 { |
1752 | 1320 control_button = pDialogueWindow->GetControl(i); |
1321 control_button->uY = one_string + v23; | |
1322 control_button->uHeight = pFontArrus->CalcTextHeight(pShopOptions[pSrtingNum], &dialog_window, 0, 0); | |
1323 v23 = control_button->uHeight + control_button->uY - 1; | |
1324 control_button->uW = v23; | |
2069 | 1325 text_color = Color16(225, 205, 35); |
1752 | 1326 if ( pDialogueWindow->pCurrentPosActiveItem != i ) |
2069 | 1327 text_color = Color16(255, 255, 255); |
1752 | 1328 dialog_window.DrawTitleText(pFontArrus, 0, control_button->uY, text_color, pShopOptions[pSrtingNum], 3); |
1329 ++pSrtingNum; | |
1300 | 1330 } |
1331 return; | |
1332 } | |
1752 | 1333 |
1300 | 1334 if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_SELL) |
1335 { | |
1336 draw_leather(); | |
1337 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); | |
1338 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[199], 0);// "Select the Item to Sell" | |
1752 | 1339 if ( !HouseUI_CheckIfPlayerCanInteract() ) |
1340 return; | |
1341 pMouse->GetCursorPos(&mouse); | |
1342 v117 = ((mouse.x - 14) >> 5) + 14 * ((mouse.y - 17) >> 5); | |
1343 if ( mouse.x <= 13 || mouse.x >= 462 ) | |
1300 | 1344 return; |
1752 | 1345 if ( !pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v117) ) |
1346 return; | |
1347 item = &pPlayers[uActiveCharacter]->pInventoryItemList[pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v117) - 1]; | |
1348 v75 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(item, BuildingType_MagicShop, (int)window_SpeakInHouse->ptr_1C, 3); | |
1843
2e6d3cd052e0
some char* cast removal + adding const_casts where appropriate
Grumpy7
parents:
1838
diff
changeset
|
1349 v30 = BuildDialogueString(pMerchantsSellPhrases[v75], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 3, 0); |
2069 | 1350 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(v30, &dialog_window, 0, 0)) / 2 + 138, Color16(255, 255, 255), v30, 3); |
1300 | 1351 return; |
1352 } | |
1752 | 1353 |
1300 | 1354 if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_IDENTIFY) |
1355 { | |
1356 draw_leather(); | |
1357 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); | |
1358 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[197], 0);// "Select the Item to Identify" | |
1393 | 1359 if ( HouseUI_CheckIfPlayerCanInteract() ) |
1300 | 1360 { |
1752 | 1361 pMouse->GetCursorPos(&mouse); |
1362 v117 = ((mouse.x -14) >> 5) + 14 * ((mouse.y - 17) >> 5); | |
1363 if ( mouse.x > 13 && mouse.x < 462 ) | |
1300 | 1364 { |
1752 | 1365 if ( pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v117) ) |
1300 | 1366 { |
1752 | 1367 item = &pPlayers[uActiveCharacter]->pInventoryItemList[pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v117) - 1]; |
2092 | 1368 if ( item->uAttributes & ITEM_IDENTIFIED ) |
1300 | 1369 { |
1752 | 1370 dialog_window.DrawTitleText(pFontArrus, 0, (212 - pFontArrus->CalcTextHeight(BuildDialogueString("%24", uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 4, 0), &dialog_window, 0, 0)) / 2 + 101, |
2069 | 1371 Color16(255, 255, 255), BuildDialogueString("%24", uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 4, 0), 3); |
1300 | 1372 return; |
1373 } | |
1752 | 1374 v75 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(item, BuildingType_MagicShop, (int)window_SpeakInHouse->ptr_1C, 4); |
1843
2e6d3cd052e0
some char* cast removal + adding const_casts where appropriate
Grumpy7
parents:
1838
diff
changeset
|
1375 v30 = BuildDialogueString(pMerchantsIdentifyPhrases[v75], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 4, 0); |
2069 | 1376 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(v30, &dialog_window, 0, 0)) / 2 + 138, Color16(255, 255, 255), v30, 3); |
1752 | 1377 return; |
1300 | 1378 } |
1379 } | |
1380 } | |
1381 return; | |
1382 } | |
1752 | 1383 |
1300 | 1384 if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_REPAIR) |
1385 { | |
1386 draw_leather(); | |
1387 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); | |
1388 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[198], 0);// "Select the Item to Repair" | |
1752 | 1389 if ( !HouseUI_CheckIfPlayerCanInteract() ) |
1390 return; | |
1391 pMouse->GetCursorPos(&mouse); | |
1392 v117 = ((mouse.x - 14) >> 5) + 14 * ((mouse.y - 17) >> 5); | |
1393 if ( mouse.x <= 13 || mouse.x >= 462 ) | |
1300 | 1394 return; |
1752 | 1395 if ( !pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v117) |
1396 || !(pPlayers[uActiveCharacter]->pOwnItems[pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v117)-1].uAttributes& 2) ) | |
1397 return; | |
1398 item = &pPlayers[uActiveCharacter]->pInventoryItemList[pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v117) - 1]; | |
1399 v75 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(&pPlayers[uActiveCharacter]->pInventoryItemList[pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v117) - 1], | |
1400 BuildingType_MagicShop, (int)window_SpeakInHouse->ptr_1C, 5); | |
1843
2e6d3cd052e0
some char* cast removal + adding const_casts where appropriate
Grumpy7
parents:
1838
diff
changeset
|
1401 v30 = BuildDialogueString(pMerchantsRepairPhrases[v75], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 5, 0); |
2069 | 1402 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(v30, &dialog_window, 0, 0)) / 2 + 138, Color16(255, 255, 255), v30, 3); |
1300 | 1403 return; |
1404 } | |
1752 | 1405 |
1300 | 1406 if ( dialog_menu_id == HOUSE_DIALOGUE_LEARN_SKILLS ) |
1407 { | |
1393 | 1408 if ( HouseUI_CheckIfPlayerCanInteract() ) |
1300 | 1409 { |
1410 all_text_height = 0; | |
1411 v33 = (signed __int64)(p2DEvents[(signed int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0); | |
1752 | 1412 pPrice = v33 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; |
1413 if ( pPrice < v33 / 3 ) | |
1414 pPrice = v33 / 3; | |
1415 item_num = 0; | |
1416 for ( int i = pDialogueWindow->pStartingPosActiveItem; | |
1417 i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) | |
1418 { | |
1419 if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][pDialogueWindow->GetControl(i)->msg_param - 36] | |
1420 && !pPlayers[uActiveCharacter]->pActiveSkills[pDialogueWindow->GetControl(i)->msg_param - 36] ) | |
1421 { | |
1422 all_text_height += pFontArrus->CalcTextHeight(pSkillNames[pDialogueWindow->GetControl(i)->msg_param - 36], &dialog_window, 0, 0); | |
1423 ++item_num; | |
1424 } | |
1425 } | |
1426 if ( !item_num ) | |
1300 | 1427 { |
1428 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]);// | |
1429 // "Seek knowledge elsewhere %s the %s" | |
1430 strcat(pTmpBuf.data(), "\n \n"); | |
1431 strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]);// "I can offer you nothing further." | |
2069 | 1432 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 0, 0)) / 2 + 138, Color16(225, 205, 35), pTmpBuf.data(), 3); |
1300 | 1433 return; |
1434 } | |
1752 | 1435 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[401], pPrice);// "Skill Cost: %lu" |
1436 dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3); | |
1437 one_string = (149 - all_text_height) / item_num; | |
1438 if ( one_string > 32 ) | |
1439 one_string = 32; | |
1440 v23 = (149 - item_num * one_string - all_text_height) / 2 - one_string / 2 + 162; | |
1441 for ( int i = pDialogueWindow->pStartingPosActiveItem; | |
1442 i < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton; ++i) | |
1300 | 1443 { |
1752 | 1444 control_button = pDialogueWindow->GetControl(i); |
1445 if ( !byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][control_button->msg_param - 36] | |
1446 || pPlayers[uActiveCharacter]->pActiveSkills[control_button->msg_param - 36] ) | |
1300 | 1447 { |
1752 | 1448 control_button->uW = 0; |
1449 control_button->uHeight = 0; | |
1450 control_button->uY = 0; | |
1300 | 1451 } |
1752 | 1452 else |
1453 { | |
1454 control_button->uY = one_string + v23; | |
1455 control_button->uHeight = pFontArrus->CalcTextHeight(pSkillNames[control_button->msg_param - 36], &dialog_window, 0, 0); | |
1456 v23 = control_button->uY + control_button->uHeight - 1; | |
1457 control_button->uW = v23; | |
2069 | 1458 text_color = Color16(225, 205, 35); |
1752 | 1459 if ( pDialogueWindow->pCurrentPosActiveItem != i ) |
2069 | 1460 text_color = Color16(255, 255, 255); |
1752 | 1461 dialog_window.DrawTitleText(pFontArrus, 0, control_button->uY, text_color, pSkillNames[control_button->msg_param - 36], 3); |
1462 } | |
1300 | 1463 } |
1464 } | |
1465 return; | |
1466 } | |
1467 return; | |
1468 } | |
1469 //----- (004BDB56) -------------------------------------------------------- | |
1458 | 1470 void UIShop_Buy_Identify_Repair() |
1300 | 1471 { |
1472 int v8; // eax@15 | |
1473 unsigned int pItemID; // esi@20 | |
1474 ItemGen *item; // esi@21 | |
1475 unsigned int v15; // eax@33 | |
1476 POINT *pCursorPos; // esi@37 | |
1477 int v18; // ecx@37 | |
1478 float pPriceMultiplier; // ST1C_4@38 | |
1479 int taken_item; // eax@40 | |
1480 ItemGen *bought_item; // esi@51 | |
1481 int party_reputation; // eax@55 | |
1482 int v39; // eax@63 | |
1483 int v42; // esi@74 | |
1484 signed int v43; // ebx@74 | |
1485 unsigned __int16 *pSkill; // esi@77 | |
1486 int v55; // [sp+0h] [bp-B4h]@26 | |
1487 POINT cursor; // [sp+40h] [bp-74h]@37 | |
1488 int a6; // [sp+98h] [bp-1Ch]@57 | |
1489 int a3; // [sp+9Ch] [bp-18h]@53 | |
1490 unsigned int uNumSeconds; // [sp+A4h] [bp-10h]@53 | |
1491 unsigned int v79; // [sp+A8h] [bp-Ch]@9 | |
1492 int uPriceItemService; // [sp+ACh] [bp-8h]@12 | |
1493 | |
1494 if ( pCurrentScreen == SCREEN_E ) | |
1495 { | |
1683 | 1496 pPlayers[uActiveCharacter]->OnInventoryLeftClick(); |
1300 | 1497 return; |
1498 } | |
1393 | 1499 if ( !HouseUI_CheckIfPlayerCanInteract() ) |
1300 | 1500 { |
1754 | 1501 pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0); |
1300 | 1502 return; |
1503 } | |
1504 | |
1505 switch(dialog_menu_id) | |
1506 { | |
1507 case HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT: | |
1508 { | |
1509 pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 103; | |
1683 | 1510 pPlayers[uActiveCharacter]->OnInventoryLeftClick(); |
1300 | 1511 break; |
1512 } | |
1513 case HOUSE_DIALOGUE_GUILD_BUY_BOOKS: | |
1514 { | |
1754 | 1515 pMouse->GetCursorPos(&cursor); |
1516 v18 = pRenderer->pActiveZBuffer[cursor.x + pSRZBufferLineOffsets[cursor.y]] & 0xFFFF; | |
1300 | 1517 if ( !v18 ) |
1518 return; | |
1519 bought_item = (ItemGen *)(&pParty->pPlayers[1].uExpressionTimeLength + 18 * (v18 + 12 * (int)window_SpeakInHouse->ptr_1C)); | |
1520 pPriceMultiplier = p2DEvents[(signed int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier; | |
1521 uPriceItemService = pPlayers[uActiveCharacter]->GetBuyingPrice(bought_item->GetValue(), pPriceMultiplier); | |
1522 GetAsyncKeyState(VK_CONTROL); | |
1523 if ( pParty->uNumGold < uPriceItemService ) | |
1524 { | |
1525 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)2); | |
1526 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2); | |
1527 return; | |
1528 } | |
1529 taken_item = pPlayers[uActiveCharacter]->AddItem(-1, bought_item->uItemID); | |
1530 if ( taken_item ) | |
1531 { | |
1532 bought_item->SetIdentified(); | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1300
diff
changeset
|
1533 memcpy(&pPlayers[uActiveCharacter]->pInventoryItemList[taken_item - 1], bought_item, 0x24u); |
1300 | 1534 dword_F8B1E4 = 1; |
1535 Party::TakeGold(uPriceItemService); | |
1536 viewparams->bRedrawGameUI = 1; | |
1537 bought_item->Reset(); | |
1538 pRenderer->ClearZBuffer(0, 479); | |
1539 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)SPEECH_75, 0); | |
1540 return; | |
1541 } | |
1542 pPlayers[uActiveCharacter]->PlaySound(SPEECH_NoRoom, 0); | |
1543 ShowStatusBarString(pGlobalTXT_LocalizationStrings[563], 5); // "Pack is Full!" | |
1544 break; | |
1545 } | |
1546 case HOUSE_DIALOGUE_SHOP_SELL: | |
1547 { | |
1548 v79 = ((pMouse->GetCursorPos(&cursor)->x - 14) >> 5) + 14 * ((pMouse->GetCursorPos(&cursor)->y - 17) >> 5); | |
1549 if ( pMouse->GetCursorPos(&cursor)->x <= 13 | |
1550 || pMouse->GetCursorPos(&cursor)->x >= 462 | |
1551 || (v15 = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v79), !v15) ) | |
1552 return; | |
2250 | 1553 if ( pPlayers[uActiveCharacter]->pInventoryItemList[v15 - 1].MerchandiseTest((int)window_SpeakInHouse->ptr_1C) ) |
1300 | 1554 { |
1555 dword_F8B1E4 = 1; | |
1556 pPlayers[uActiveCharacter]->SalesProcess(v79, v15 - 1, (int)window_SpeakInHouse->ptr_1C); | |
1557 viewparams->bRedrawGameUI = 1; | |
1558 pRenderer->ClearZBuffer(0, 479); | |
1559 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)77, 0); | |
1560 return; | |
1561 } | |
1562 pPlayers[uActiveCharacter]->PlaySound(SPEECH_79, 0); | |
1754 | 1563 pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0); |
1300 | 1564 break; |
1565 } | |
1566 case HOUSE_DIALOGUE_SHOP_IDENTIFY: | |
1567 { | |
1568 pMouse->GetCursorPos(&cursor); | |
1569 v79 = ((cursor.x - 14) >> 5) + 14 * ((cursor.y - 17) >> 5); | |
1570 if (cursor.x > 13 && cursor.x < 462) | |
1571 { | |
1572 pItemID = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v79); | |
1573 if ( pItemID ) | |
1574 { | |
1575 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
|
1576 item = &pPlayers[uActiveCharacter]->pInventoryItemList[pItemID - 1]; |
2092 | 1577 if ( !(item->uAttributes & ITEM_IDENTIFIED) ) |
1300 | 1578 { |
2250 | 1579 if ( item->MerchandiseTest((int)window_SpeakInHouse->ptr_1C) ) |
1300 | 1580 { |
1581 if ( pParty->uNumGold >= uPriceItemService ) | |
1582 { | |
1583 dword_F8B1E4 = 1; | |
1584 Party::TakeGold(uPriceItemService); | |
2092 | 1585 item->uAttributes |= ITEM_IDENTIFIED; |
1300 | 1586 pPlayers[uActiveCharacter]->PlaySound(SPEECH_73, 0); |
1587 ShowStatusBarString(pGlobalTXT_LocalizationStrings[569], 2); | |
1588 return; | |
1589 } | |
1590 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)2); | |
1591 return; | |
1592 } | |
1754 | 1593 pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0); |
1300 | 1594 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)79, 0); |
1595 return; | |
1596 } | |
1597 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)76, 0); | |
1598 return; | |
1599 } | |
1600 } | |
1601 break; | |
1602 } | |
1603 case HOUSE_DIALOGUE_SHOP_REPAIR: | |
1604 { | |
1605 v79 = ((pMouse->GetCursorPos(&cursor)->x - 14) >> 5) + 14 * ((pMouse->GetCursorPos(&cursor)->y - 17) >> 5); | |
1606 if ( pMouse->GetCursorPos(&cursor)->x > 13 ) | |
1607 { | |
1608 if ( pMouse->GetCursorPos(&cursor)->x < 462 ) | |
1609 { | |
1610 pItemID = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v79); | |
1611 if ( pItemID ) | |
1612 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1300
diff
changeset
|
1613 item = &pPlayers[uActiveCharacter]->pInventoryItemList[pItemID - 1]; |
1300 | 1614 pPriceMultiplier = p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier; |
1980 | 1615 ItemGen* _v = &pPlayers[uActiveCharacter]->pInventoryItemList[pItemID - 1]; |
1300 | 1616 uPriceItemService = pPlayers[uActiveCharacter]->GetPriceRepair(_v->GetValue(), pPriceMultiplier); |
2092 | 1617 if ( item->uAttributes & ITEM_BROKEN ) |
1300 | 1618 { |
2250 | 1619 if ( item->MerchandiseTest((int)window_SpeakInHouse->ptr_1C) ) |
1300 | 1620 { |
1621 if ( pParty->uNumGold >= uPriceItemService ) | |
1622 { | |
1623 dword_F8B1E4 = 1; | |
1624 Party::TakeGold(uPriceItemService); | |
1625 v8 = item->uAttributes; | |
1626 LOBYTE(v8) = v8 & 0xFD; | |
1627 item->uAttributes = v8 | 1; | |
1628 pPlayers[uActiveCharacter]->PlaySound(SPEECH_74, 0); | |
1629 ShowStatusBarString(pGlobalTXT_LocalizationStrings[570], 2); | |
1630 return; | |
1631 } | |
1632 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)2); | |
1633 return; | |
1634 } | |
1754 | 1635 pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0); |
1300 | 1636 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)79, 0); |
1637 return; | |
1638 } | |
1639 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)76, 0); | |
1640 return; | |
1641 } | |
1642 } | |
1643 } | |
1644 break; | |
1645 } | |
1646 case HOUSE_DIALOGUE_SHOP_BUY_STANDARD: | |
1647 case HOUSE_DIALOGUE_SHOP_BUY_SPECIAL: | |
1648 { | |
1649 pCursorPos = pMouse->GetCursorPos(&cursor); | |
1650 v18 = pRenderer->pActiveZBuffer[pCursorPos->x + pSRZBufferLineOffsets[pCursorPos->y]] & 0xFFFF; | |
1651 if ( !v18 ) | |
1652 return; | |
1653 if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_BUY_STANDARD) | |
1654 bought_item = (ItemGen *)&pParty->StandartItemsInShops[(int)window_SpeakInHouse->ptr_1C][v18 - 1]; | |
1655 else | |
1754 | 1656 bought_item = &pParty->SpecialItemsInShops[(int)window_SpeakInHouse->ptr_1C][v18 - 1]; |
1300 | 1657 uPriceItemService = pPlayers[uActiveCharacter]->GetBuyingPrice(bought_item->GetValue(), p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier); |
1658 uNumSeconds = 0; | |
1659 a3 = 0; | |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1466
diff
changeset
|
1660 if ( pMapStats->GetMapInfo(pCurrentMapName) ) |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1466
diff
changeset
|
1661 a3 = pMapStats->pInfos[pMapStats->GetMapInfo(pCurrentMapName)]._steal_perm; |
1827
0c75c3e7e436
cleaned up part of party.cpp, renamed byte_AE3368 to playerAlreadyPicked + 3 vars after it, moved them to party.cpp, some player.cpp bugfixes
Grumpy7
parents:
1758
diff
changeset
|
1662 party_reputation = pParty->GetPartyReputation(); |
2246 | 1663 if (pPlayers[uActiveCharacter]->CanSteal() && GetAsyncKeyState(VK_CONTROL)) |
1664 { | |
1300 | 1665 uNumSeconds = pPlayers[uActiveCharacter]->StealFromShop(bought_item, a3, party_reputation, 0, &a6); |
1666 if ( !uNumSeconds ) | |
1667 { | |
1668 sub_4B1447_party_fine((int)window_SpeakInHouse->ptr_1C, 0, a6); | |
1669 return; | |
1670 } | |
1671 } | |
2248 | 1672 else if (pParty->uNumGold < uPriceItemService) |
1673 { | |
1674 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)2); | |
1675 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);// "You don't have enough gold" | |
1676 return; | |
1677 } | |
1300 | 1678 v39 = pPlayers[uActiveCharacter]->AddItem(-1, bought_item->uItemID); |
1679 if ( v39 ) | |
1680 { | |
1681 bought_item->SetIdentified(); | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1300
diff
changeset
|
1682 memcpy(&pPlayers[uActiveCharacter]->pInventoryItemList[v39 - 1], bought_item, sizeof(ItemGen)); |
2246 | 1683 if (uNumSeconds != 0) |
1300 | 1684 { |
2246 | 1685 pPlayers[uActiveCharacter]->pInventoryItemList[v39 - 1].SetStolen(); |
1686 sub_4B1447_party_fine((int)window_SpeakInHouse->ptr_1C, uNumSeconds, a6); | |
1300 | 1687 } |
2246 | 1688 else |
1689 { | |
1690 dword_F8B1E4 = 1; | |
1691 Party::TakeGold(uPriceItemService); | |
1692 } | |
1300 | 1693 viewparams->bRedrawGameUI = 1; |
1694 bought_item->Reset(); | |
1695 pRenderer->ClearZBuffer(0, 479); | |
1696 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)SPEECH_75, 0); | |
1697 return; | |
1698 } | |
2246 | 1699 else |
1700 { | |
1701 pPlayers[uActiveCharacter]->PlaySound(SPEECH_NoRoom, 0); | |
1702 ShowStatusBarString(pGlobalTXT_LocalizationStrings[563], 2); // "Pack is Full!" | |
1703 return; | |
1704 } | |
1300 | 1705 break; |
1706 } | |
1707 default:// if click video screen in shop | |
1708 { | |
1709 __debugbreak(); // please do record these dialogue ids to the HOUSE_DIALOGUE_MENU enum | |
1710 if( dialog_menu_id >= 36 && dialog_menu_id <= 72 ) | |
1711 { | |
1712 v42 = dialog_menu_id - 36; | |
1713 //v43 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (unsigned int)ptr_507BC0->ptr_1C] * 500.0); | |
1714 v43 = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0); | |
1715 uPriceItemService = v43 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; | |
1716 if ( uPriceItemService < v43 / 3 ) | |
1717 uPriceItemService = v43 / 3; | |
1718 if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][v42] ) | |
1719 { | |
1720 pSkill = &pPlayers[uActiveCharacter]->pActiveSkills[v42]; | |
1721 if ( !*pSkill ) | |
1722 { | |
1723 if ( pParty->uNumGold < uPriceItemService ) | |
1724 { | |
1725 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);// "You don't have enough gold" | |
1411 | 1726 if ( in_current_building_type == BuildingType_Training ) |
1300 | 1727 v55 = 4; |
1728 else | |
1729 v55 = 2; | |
1730 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)v55); | |
1731 return; | |
1732 } | |
1733 Party::TakeGold(uPriceItemService); | |
1734 dword_F8B1E4 = 1; | |
1735 *pSkill = 1; | |
1736 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)78, 0); | |
1737 return; | |
1738 } | |
1739 } | |
1740 } | |
1741 break; | |
1742 } | |
1743 } | |
1744 } | |
1745 //----- (004B1A2D) -------------------------------------------------------- | |
1458 | 1746 void ShowPopupShopItem() |
1300 | 1747 { |
1748 int v3; // ecx@5 | |
2334 | 1749 // unsigned int v6; // eax@13 |
1300 | 1750 ItemGen *v7; // ecx@13 |
1754 | 1751 POINT cursor; // [sp+30h] [bp-1Ch]@17 |
1300 | 1752 |
1753 if ( in_current_building_type <= 0 ) | |
1754 return; | |
1754 | 1755 if ( dialog_menu_id < HOUSE_DIALOGUE_SHOP_BUY_STANDARD) |
1756 return; | |
1411 | 1757 if ( in_current_building_type <= BuildingType_AlchemistShop ) |
1300 | 1758 { |
1754 | 1759 if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_BUY_STANDARD || dialog_menu_id == HOUSE_DIALOGUE_SHOP_BUY_SPECIAL ) |
1300 | 1760 { |
1754 | 1761 pMouse->GetCursorPos(&cursor); |
1762 v3 = pRenderer->pActiveZBuffer[cursor.x + pSRZBufferLineOffsets[cursor.y]] & 0xFFFF; | |
1763 if ( !v3 ) | |
1300 | 1764 return; |
1754 | 1765 v7 = &pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v3 - 1]; |
1766 if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_BUY_SPECIAL) | |
1767 v7 = &pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v3 - 1]; | |
1768 GameUI_DrawItemInfo(v7); | |
1769 return; | |
1300 | 1770 } |
1754 | 1771 |
1772 if ( dialog_menu_id >= HOUSE_DIALOGUE_SHOP_SELL && dialog_menu_id <= HOUSE_DIALOGUE_SHOP_REPAIR | |
1773 || dialog_menu_id == HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT ) | |
1774 { | |
1775 pMouse->GetCursorPos(&cursor); | |
1776 v3 = ((cursor.x - 14) >> 5) + 14 * ((cursor.y - 17) >> 5); | |
1777 if ( cursor.x <= 13 || cursor.x >= 462 | |
1778 || !pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex(&v3) ) | |
1779 return; | |
1780 GameUI_DrawItemInfo(&pPlayers[uActiveCharacter]->pInventoryItemList[pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex(&v3) - 1]); | |
1300 | 1781 return; |
1754 | 1782 } |
1300 | 1783 } |
1411 | 1784 if ( in_current_building_type <= BuildingType_16 && dialog_menu_id == HOUSE_DIALOGUE_GUILD_BUY_BOOKS ) |
1300 | 1785 { |
1754 | 1786 pMouse->GetCursorPos(&cursor); |
1787 v3 = pRenderer->pActiveZBuffer[cursor.x + pSRZBufferLineOffsets[cursor.y]] & 0xFFFF; | |
1788 if ( v3 ) | |
2231
8673f3aedfb9
sub_4B1523 to sub_4B1523_showSpellbookInfo, changed input type, some vars renamed
Grumpy7
parents:
2215
diff
changeset
|
1789 { |
8673f3aedfb9
sub_4B1523 to sub_4B1523_showSpellbookInfo, changed input type, some vars renamed
Grumpy7
parents:
2215
diff
changeset
|
1790 unsigned int guildId = (unsigned int)window_SpeakInHouse->ptr_1C - 139; |
8673f3aedfb9
sub_4B1523 to sub_4B1523_showSpellbookInfo, changed input type, some vars renamed
Grumpy7
parents:
2215
diff
changeset
|
1791 sub_4B1523_showSpellbookInfo(pParty->SpellBooksInGuilds[guildId][v3].uItemID); |
8673f3aedfb9
sub_4B1523 to sub_4B1523_showSpellbookInfo, changed input type, some vars renamed
Grumpy7
parents:
2215
diff
changeset
|
1792 } |
1300 | 1793 } |
1794 } | |
2233 | 1795 |
1796 //----- (004B1523) -------------------------------------------------------- | |
1797 void sub_4B1523_showSpellbookInfo(int spellItemId) | |
1798 { | |
1799 int spellId; // esi@1 | |
1800 int spellLevel; // edx@1 | |
1801 unsigned int v3; // eax@2 | |
1802 int v4; // eax@4 | |
1803 LONG v5; // ecx@4 | |
1804 int v6; // eax@10 | |
1805 char *v7; // ST44_4@12 | |
1806 unsigned __int16 v8; // ax@12 | |
1807 GUIWindow a1; // [sp+Ch] [bp-68h]@4 | |
1808 unsigned int spellSchool; // [sp+60h] [bp-14h]@1 | |
1809 POINT a2; // [sp+64h] [bp-10h]@1 | |
1810 int v13; // [sp+6Ch] [bp-8h]@4 | |
1811 int v14; // [sp+70h] [bp-4h]@4 | |
1812 | |
1813 spellId = spellItemId - 399; | |
1814 spellLevel = (spellItemId - 400) % 11 + 1; | |
1815 spellSchool = 4 * (spellItemId - 400) / 11; | |
1816 // sprintf(pTmpBuf.data(), "%s%03d", spellbook_texture_filename_suffices[v11 / 4], v2); not used | |
1817 if ( pMouse->GetCursorPos(&a2)->y <= 320 ) | |
1818 v3 = pMouse->GetCursorPos(&a2)->y + 30; | |
1819 else | |
1820 v3 = 30; | |
2369
bddcaf5d5db2
removing non-nullptr conditions before frees, chaning 0 and NULL assignmnets to pointers to nullptr assignments
Grumpy7
parents:
2350
diff
changeset
|
1821 a1.Hint = nullptr; |
2233 | 1822 a1.uFrameY = v3; |
1823 a1.uFrameWidth = 328; | |
1824 a1.uFrameHeight = 68; | |
1825 a1.uFrameX = 90; | |
1826 a1.uFrameZ = 417; | |
1827 a1.uFrameW = v3 + 67; | |
1828 a2.y = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[431]); | |
1829 v14 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[433]); | |
1830 v13 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[432]); | |
1831 v4 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[96]); | |
1832 v5 = a2.y; | |
1833 if ( v14 > a2.y ) | |
1834 v5 = v14; | |
1835 if ( v13 > v5 ) | |
1836 v5 = v13; | |
1837 if ( v4 > v5 ) | |
1838 v5 = v4; | |
1839 sprintf(pTmpBuf2.data(), "%s\n\n%s\t%03d:\t%03d%s\t000\n%s\t%03d:\t%03d%s\t000\n%s\t%03d:\t%03d%s\t000\n%s\t%03d:\t%03d%s", | |
1840 pSpellStats->pInfos[spellId].pDescription, pGlobalTXT_LocalizationStrings[431], // "Normal" | |
1841 v5 + 3, v5 + 10, pSpellStats->pInfos[spellId].pBasicSkillDesc, pGlobalTXT_LocalizationStrings[433], // "Expert" | |
1842 v5 + 3, v5 + 10, pSpellStats->pInfos[spellId].pExpertSkillDesc, pGlobalTXT_LocalizationStrings[432], // "Master" | |
1843 v5 + 3, v5 + 10, pSpellStats->pInfos[spellId].pMasterSkillDesc, pGlobalTXT_LocalizationStrings[96], // "Grand" | |
1844 v5 + 3, v5 + 10, pSpellStats->pInfos[spellId].pGrandmasterSkillDesc); | |
1845 v6 = pFontSmallnum->CalcTextHeight(pTmpBuf2.data(), &a1, 0, 0); | |
1846 a1.uFrameHeight += v6; | |
1847 if ( (signed int)a1.uFrameHeight < 150 ) | |
1848 a1.uFrameHeight = 150; | |
1849 a1.uFrameWidth = game_viewport_width; | |
1850 a1.DrawMessageBox(0); | |
1851 a1.uFrameWidth -= 12; | |
1852 a1.uFrameHeight -= 12; | |
1853 v7 = pSpellStats->pInfos[spellId].pName; | |
1854 a1.uFrameZ = a1.uFrameX + a1.uFrameWidth - 1; | |
1855 a1.uFrameW = a1.uFrameHeight + a1.uFrameY - 1; | |
1856 v8 = Color16(0xFFu, 0xFFu, 0x9Bu); | |
1857 a1.DrawTitleText(pFontArrus, 0x78u, 0xCu, v8, v7, 3u); | |
1858 a1.DrawText(pFontSmallnum, 120, 44, 0, pTmpBuf2.data(), 0, 0, 0); | |
1859 a1.uFrameZ = a1.uFrameX + 107; | |
1860 a1.uFrameWidth = 108; | |
1861 a1.DrawTitleText(pFontComic, 0xCu, 0x4Bu, 0, pSkillNames[spellSchool / 4 + 12], 3u); | |
1862 sprintfex(pTmpBuf.data(), "%s\n%d", pGlobalTXT_LocalizationStrings[522], *(&pSpellDatas[0].uNormalLevelMana + 10 * spellId)); | |
1863 a1.DrawTitleText(pFontComic, 0xCu, a1.uFrameHeight - LOBYTE(pFontComic->uFontHeight) - 16, 0, pTmpBuf.data(), 3); | |
1864 } | |
1300 | 1865 //----- (004B1D27) -------------------------------------------------------- |
1458 | 1866 void GetHouseGoodbyeSpeech() |
1300 | 1867 { |
1868 signed int v2; // edi@10 | |
1869 signed int v5; // edi@20 | |
1870 int v7[4]; // [sp+Ch] [bp-10h]@12 | |
1871 | |
1872 if ( in_current_building_type > 0 ) | |
1873 { | |
1411 | 1874 if ( in_current_building_type > BuildingType_MagicShop ) |
1300 | 1875 { |
1411 | 1876 if ( in_current_building_type == BuildingType_Bank ) |
1300 | 1877 { |
1878 if ( !dword_F8B1E4 ) | |
1879 return; | |
1880 } | |
1881 else | |
1882 { | |
1411 | 1883 if ( in_current_building_type != BuildingType_Temple ) |
1300 | 1884 return; |
1885 } | |
1407 | 1886 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_Greeting_2); |
1300 | 1887 return; |
1888 } | |
1749 | 1889 if ( (signed __int64)pParty->PartyTimes._shop_ban_times[(unsigned int)window_SpeakInHouse->ptr_1C]<= (signed __int64)pParty->uTimePlayed ) |
1300 | 1890 { |
1407 | 1891 if ( pParty->uNumGold <= 10000 ) |
1300 | 1892 { |
1893 if ( !dword_F8B1E4 ) | |
1894 return; | |
1407 | 1895 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_Goodbye); |
1300 | 1896 return; |
1897 } | |
1407 | 1898 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)(dword_F8B1E4 + 3)); |
2182 | 1899 if ( !dword_F8B1E4 && !_A750D8_player_speech_timer ) |
1300 | 1900 { |
1901 v5 = 0; | |
1407 | 1902 for ( uint i = 1; i <= 4; ++i ) |
1300 | 1903 { |
1407 | 1904 if ( pPlayers[i]->CanAct() ) |
1905 v7[v5++] = i; | |
1300 | 1906 } |
1907 if ( v5 ) | |
1908 { | |
2182 | 1909 _A750D8_player_speech_timer = 256i64; |
1406 | 1910 PlayerSpeechID = SPEECH_80; |
1407 | 1911 uSpeakingCharacter = v7[rand() % v5]; |
1300 | 1912 return; |
1913 } | |
1914 } | |
1915 } | |
1916 else | |
1917 { | |
2182 | 1918 if ( !_A750D8_player_speech_timer ) |
1300 | 1919 { |
1920 v2 = 0; | |
1407 | 1921 for ( uint i = 1; i <= 4; ++i ) |
1300 | 1922 { |
1407 | 1923 if ( pPlayers[i]->CanAct() ) |
1924 v7[v2++] = i; | |
1300 | 1925 } |
1926 if ( v2 ) | |
1927 { | |
2182 | 1928 _A750D8_player_speech_timer = 256i64; |
1406 | 1929 PlayerSpeechID = SPEECH_80; |
1407 | 1930 uSpeakingCharacter = v7[rand() % v2]; |
1300 | 1931 return; |
1932 } | |
1933 } | |
1934 } | |
1935 } | |
2463 | 1936 } |
1937 | |
1938 //----- (004B1447) -------------------------------------------------------- | |
1939 void sub_4B1447_party_fine(int shopId, int stealingResult, int fineToAdd) | |
1940 { | |
1941 signed int v3; // esi@1 | |
1942 DDM_DLV_Header *v7; // eax@14 | |
1943 | |
1944 if (stealingResult == 0 || stealingResult == 1) | |
1945 { | |
1946 if (pParty->uFine < 4000000) | |
1947 { | |
1948 if (fineToAdd + pParty->uFine < 0) | |
1949 pParty->uFine = 0; | |
1950 else if (fineToAdd + pParty->uFine > 4000000) | |
1951 pParty->uFine = 4000000; | |
1952 else | |
1953 pParty->uFine += fineToAdd; | |
1954 } | |
1955 if (pParty->uFine) | |
1956 { | |
1957 for (uint i = 1; i <= 4; ++i) | |
1958 { | |
1959 if (!_449B57_test_bit(pPlayers[i]->_achieved_awards_bits, 1)) | |
1960 _449B7E_toggle_bit(pPlayers[i]->_achieved_awards_bits, 1, 1); | |
1961 } | |
1962 } | |
1963 if (stealingResult == 1) | |
1964 v3 = 2; | |
1965 else | |
1966 v3 = 1; | |
1967 } | |
1968 else | |
1969 v3 = 2; | |
1970 pParty->PartyTimes._shop_ban_times[shopId] = pParty->uTimePlayed + 368640; | |
1971 pParty->InTheShopFlags[shopId] = 1; | |
1972 v7 = &pOutdoor->ddm; | |
1973 if (uCurrentlyLoadedLevelType != LEVEL_Outdoor) | |
1974 v7 = &pIndoor->dlv; | |
1975 v7->uReputation += v3; | |
1976 if (v7->uReputation > 10000) | |
1977 v7->uReputation = 10000; | |
1978 } |