annotate GUI/UI/UIShops.cpp @ 2502:a77c34acdbc9

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