annotate UI/UIShops.cpp @ 1748:19684d4bbe9a

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