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