annotate UI/UIShops.cpp @ 2463:0f17a30149ec

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