annotate GUI/UI/UIShops.cpp @ 2553:48708da03b7f

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