620
|
1 #include "UIHouses.h"
|
|
2
|
629
|
3 #include "Party.h"
|
|
4 #include "Player.h"
|
|
5 #include "texts.h"
|
|
6 #include "Events.h"
|
|
7 #include "Arcomage.h"
|
|
8 #include "LOD.h"
|
|
9 #include "Mouse.h"
|
|
10 #include "GUIWindow.h"
|
|
11 #include "GUIButton.h"
|
|
12 #include "GUIFont.h"
|
|
13 #include "Events2D.h"
|
|
14 #include "Overlays.h"
|
|
15 #include "Render.h"
|
|
16 #include "Indoor.h"
|
|
17 #include "Outdoor.h"
|
|
18 #include "AudioPlayer.h"
|
|
19 #include "VideoPlayer.h"
|
|
20 #include "Monsters.h"
|
|
21 #include "Viewport.h"
|
|
22 #include "Keyboard.h"
|
|
23 #include "NPC.h"
|
|
24
|
|
25 #include "mm7_data.h"
|
|
26
|
|
27
|
|
28 int uHouse_ExitPic; // weak
|
|
29
|
|
30 int dword_591080; // weak
|
|
31
|
|
32 const stru159 pAnimatedRooms[196] = //0x4E5F70
|
|
33 {
|
|
34 {"", 0x4, 0x1F4, 0, 0, 0},
|
|
35 {"Human Armor01", 0x20, 0x2C0, 2, 58, 0},
|
|
36 {"Necromancer Armor01", 0x20, 0x2D7, 2, 70, 0 },
|
|
37 {"Dwarven Armor01", 0x20, 0x2EE, 2, 5, 0 },
|
|
38 {"Wizard Armor", 0x20, 0x3BD, 2, 19, 0 },
|
|
39 {"Warlock Armor", 0x20, 0x2D6, 2, 35, 0 },
|
|
40 {"Elf Armor", 0x20, 0x2BC, 2, 79, 0 },
|
|
41 {"Human Alchemisht01", 0xE, 0x2BE, 4, 95, 0 },
|
|
42 {"Necromancer Alchemist01", 0xE, 0x2D6, 4, 69, 0 },
|
|
43 {"Dwarven Achemist01", 0xE, 0x387, 4, 4, 0 },
|
|
44 {"Wizard Alchemist", 0xE, 0x232, 4, 25, 0 },
|
|
45 {"Warlock Alchemist", 0xE, 0x2BE, 4, 42, 0 },
|
|
46 {"Elf Alchemist", 0xE, 0x38A, 4, 84, 0 },
|
|
47 {"Human Bank01", 0x6, 0x384, 22, 52, 0 },
|
|
48 {"Necromancer Bank01", 0x6, 0x2D8, 22, 71, 0 },
|
|
49 {"Dwarven Bank", 0x6, 0x2F3, 22, 6, 0 },
|
|
50 {"Wizard Bank", 0x6, 0x3BA, 22, 20, 0 },
|
|
51 {"Warlock Bank", 0x6, 0x39F, 22, 36, 0 },
|
|
52 {"Elf Bank", 0x6, 0x2BC, 22, 71, 0 },
|
|
53 {"Boat01", 0xF, 0x4C, 28, 53, 3 },
|
|
54 {"Boat01d", 0xF, 0x4C, 28, 53, 3 },
|
|
55 {"Human Magic Shop01", 0xA, 0x2C8, 3, 54, 0 },
|
|
56 {"Necromancer Magic Shop01", 0xE, 0x2DC, 3, 66, 0 },
|
|
57 {"Dwarven Magic Shop01", 0x2A, 0x2EF, 3, 91, 0 },
|
|
58 {"Wizard Magic Shop", 0x1E, 0x2DF, 3, 15, 0 },
|
|
59 {"Warlock Magic Shop", 0x7, 0x3B9, 3, 15, 0 },
|
|
60 {"Elf Magic Shop", 0x24, 0x2CC, 3, 82, 0 },
|
|
61 {"Human Stables01", 0x21, 0x31, 27, 48, 3 },
|
|
62 {"Necromancer Stables", 0x21, 0x2DD, 27, 67, 3 },
|
|
63 {"", 0x21, 0x2F0, 27, 91, 3 },
|
|
64 {"Wizard Stables", 0x21, 0x3BA, 27, 16, 3 },
|
|
65 {"Warlock Stables", 0x21, 0x181, 27, 77, 3 },
|
|
66 {"Elf Stables", 0x21, 0x195, 27, 77, 3 },
|
|
67 {"Human Tavern01", 0xD, 0x2C2, 21, 49, 0 },
|
|
68 {"Necromancer Tavern01", 0xD, 0x3B0, 21, 57, 0 },
|
|
69 {"Dwarven Tavern01", 0xD, 0x2FE, 21, 94, 0 },
|
|
70 {"Wizard Tavern", 0xD, 0x3BB, 21, 17, 0 },
|
|
71 {"Warlock Tavern", 0xD, 0x3A8, 21, 33, 0 },
|
|
72 {"Elf Tavern", 0xD, 0x2CD, 21, 78, 0 },
|
|
73 {"Human Temple01", 0x24, 0x2DB, 23, 50, 3 },
|
|
74 {"Necromancer Temple", 0x24, 0x2DF, 23, 60, 3 },
|
|
75 {"Dwarven Temple01", 0x24, 0x2F1, 23, 86, 3 },
|
|
76 {"Wizard Temple", 0x24, 0x2E0, 23, 10, 3 },
|
|
77 {"Warlock Temple", 0x24, 0x3A4, 23, 27, 3 },
|
|
78 {"Elf Temple", 0x24, 0x2CE, 23, 72, 3 },
|
|
79 {"Human Town Hall", 0x10, 0x39C, 17, 14, 0 },
|
|
80 {"Necromancer Town Hall01", 0x10, 0x3A4, 17, 61, 0 },
|
|
81 {"Dwarven Town Hall", 0x10, 0x2DB, 17, 88, 0 },
|
|
82 {"Wizard Town Hall", 0x10, 0x3BD, 17, 11, 0 },
|
|
83 {"Warlock Town Hall", 0x10, 0x2DB, 17, 28, 0 },
|
|
84 {"Elf Town Hall", 0x10, 0x27A, 17, 73, 0 },
|
|
85 {"Human Training Ground01", 0x18, 0x2C7, 30, 44, 0 },
|
|
86 {"Necromancer Training Ground", 0x18, 0x3AD, 30, 62, 0 },
|
|
87 {"Dwarven Training Ground", 0x18, 0x2F2, 30, 89, 0 },
|
|
88 {"Wizard Training Ground", 0x18, 0x3A3, 30, 12, 0 },
|
|
89 {"Warlock Training Ground", 0x18, 0x3A6, 30, 29, 0 },
|
|
90 {"Elf Training Ground", 0x18, 0x19F, 30, 74, 0 },
|
|
91 {"Human Weapon Smith01", 0x16, 0x2C1, 1, 45, 4 },
|
|
92 {"Necromancer Weapon Smith01", 0x16, 0x2D9, 1, 63, 4 },
|
|
93 {"Dwarven Weapon Smith01", 0x16, 0x2EE, 1, 82, 4 },
|
|
94 {"Wizard Weapon Smith", 0x16, 0x2D5, 1, 13, 4 },
|
|
95 {"Warlock Weapon Smith", 0x16, 0x2D7, 1, 23, 4 },
|
|
96 {"Elf Weapon Smith", 0x16, 0x2CA, 1, 75, 4 },
|
|
97 {"Air Guild", 0x1D, 0xA4, 6, 1, 3 },
|
|
98 {"Body Guild", 0x19, 0x3BF, 11, 2, 0 },
|
|
99 {"DarkGuild", 0x19, 0x2D1, 13, 3, 0 },
|
|
100 {"EarthGuild", 0x19, 0x2CB, 8, 83, 0 },
|
|
101 {"Fire Guild", 0x1C, 0x2BF, 5, 56, 0 },
|
|
102 {"Light Guild", 0x1C, 0x2D5, 12, 46, 0 },
|
|
103 {"Mind Guild", 0x1C, 0xE5, 10, 40, 0 },
|
|
104 {"Spirit Guild", 0x1C, 0x2D2, 9, 41, 0 },
|
|
105 {"Water Guild", 0x1B, 0x2D3, 7, 24, 0 },
|
|
106 {"Lord And Judge Out01", 1, 0, 29, 39, 0 },
|
|
107 {"Human Poor House 1", 8, 0, 29, 0, 0 },
|
|
108 {"Human Poor House 2", 8, 0, 29, 0, 0 },
|
|
109 {"Human Poor House 3", 8, 0, 29, 0, 0 },
|
|
110 {"Human Medium House 1", 8, 0, 29, 0, 0 },
|
|
111 {"Human Medium House 2", 8, 0, 29, 0, 0 },
|
|
112 {"Human Medium House 3", 8, 0, 29, 0, 0 },
|
|
113 {"Human Rich House 1", 8, 0, 29, 0, 0 },
|
|
114 {"Human Rich House 2", 8, 0, 29, 0, 0 },
|
|
115 {"Human Rich House 3", 8, 0, 29, 0, 0 },
|
|
116 {"Elven Poor House 1", 8, 0, 29, 0, 0 },
|
|
117 {"Elven Poor House 2", 8, 0, 29, 0, 0 },
|
|
118 {"Elven Poor House 3", 8, 0, 29, 0, 0 },
|
|
119 {"Elven Medium House 1", 8, 0, 29, 0, 0 },
|
|
120 {"Elven Medium House 2", 8, 0, 29, 0, 0 },
|
|
121 {"Elven Medium House 3", 8, 0, 29, 0, 0 },
|
|
122 {"Elven Rich House 1", 8, 0, 29, 0, 0 },
|
|
123 {"Elven Rich House 2", 8, 0, 29, 0, 0 },
|
|
124 {"Elven Rich House 3", 8, 0, 29, 0, 0 },
|
|
125 {"Dwarven Poor House 1", 8, 0, 29, 0, 0 },
|
|
126 {"Dwarven Poor House 2", 8, 0, 29, 0, 0 },
|
|
127 {"Dwarven Poor House 3", 8, 0, 29, 0, 0 },
|
|
128 {"Dwarven Medium House 1", 8, 0, 29, 0, 0 },
|
|
129 {"Dwarven Medium house 2", 8, 0, 29, 0, 0 },
|
|
130 {"Dwarven Medium House 3", 8, 0, 29, 0, 0 },
|
|
131 {"Dwarven Rich House 1", 8, 0, 29, 0, 0 },
|
|
132 {"Dwarven Rich House 2", 8, 0, 29, 0, 0 },
|
|
133 {"Dwarven Rich House 3", 8, 0, 29, 0, 0 },
|
|
134 {"Wizard Poor House 1", 8, 0, 29, 0, 0 },
|
|
135 {"Wizard Poor House 2", 8, 0, 29, 0, 0 },
|
|
136 {"Wizard Poor House 3", 8, 0, 29, 0, 0 },
|
|
137 {"Wizard Medium House 1", 8, 0, 29, 0, 0 },
|
|
138 {"Wizard Medium House 2", 8, 0, 29, 0, 0 },
|
|
139 {"Wizard Mdeium House 3", 8, 0, 29, 0, 0 },
|
|
140 {"Wizard Rich House 1", 8, 0, 29, 0, 0 },
|
|
141 {"Wizard Rich House 2", 8, 0, 29, 0, 0 },
|
|
142 {"Wizard Rich House 3", 8, 0, 29, 0, 0 },
|
|
143 {"Necromancer Poor House 1", 8, 0, 29, 0, 0 },
|
|
144 {"Necromancer Poor House 2", 8, 0, 29, 0, 0 },
|
|
145 {"Necromancer Poor House 3", 8, 0, 29, 0, 0 },
|
|
146 {"Necromancer Medium House 1", 8, 0, 29, 0, 0 },
|
|
147 {"Necromancer Medium House 2", 8, 0, 29, 0, 0 },
|
|
148 {"Necromancer Mdeium House 3", 8, 0, 29, 0, 0 },
|
|
149 {"Necromancer Rich House 1", 8, 0, 29, 0, 0 },
|
|
150 {"Necromancer Rich House 2", 8, 0, 29, 0, 0 },
|
|
151 {"Necromancer Rich House 3", 8, 0, 29, 0, 0 },
|
|
152 {"Warlock Poor House 1", 8, 0, 29, 0, 0 },
|
|
153 {"Warlock Poor House 2", 8, 0, 29, 0, 0 },
|
|
154 {"Warlock Poor House 3", 8, 0, 29, 0, 0 },
|
|
155 {"Warlock Medium House 1", 8, 0, 29, 0, 0 },
|
|
156 {"Warlock Medium House 2", 8, 0, 29, 0, 0 },
|
|
157 {"Warlock Mdeium House 3", 8, 0, 29, 0, 0 },
|
|
158 {"Warlock Rich House 1", 8, 0, 29, 0, 0 },
|
|
159 {"Warlock Rich House 2", 8, 0, 29, 0, 0 },
|
|
160 {"Warlock Rich House 3", 8, 0, 29, 0, 0 },
|
|
161 {"Out01 Temple of the Moon", 0x24, 0, 25, 0, 0 },
|
|
162 {"Out01 Dragon Cave", 0x24, 0, 25, 0, 0 },
|
|
163 {"Out02 Castle Harmondy", 0x24, 0, 25, 0, 0 },
|
|
164 {"Out02 White Cliff Cave", 0x24, 0, 25, 0, 0 },
|
|
165 {"Out03 Erathian Sewer", 0x24, 0, 25, 0, 0 },
|
|
166 {"Out03 Fort Riverstride", 0x24, 0, 25, 0, 0 },
|
|
167 {"Out03 Castle Gryphonheart", 0x24, 0, 25, 0, 0 },
|
|
168 {"Out04 Elf Castle", 0x24, 0, 25, 0, 0 },
|
|
169 {"Out04 Tularean Caves", 0x24, 0, 25, 0, 0 },
|
|
170 {"Out04 Clanker's Laboratory", 0x24, 0, 25, 0, 0 },
|
|
171 {"Out05 Hall of the Pit", 0x24, 0, 25, 0, 0 },
|
|
172 {"Out05 Watchtower 6", 0x24, 0, 25, 0, 0 },
|
|
173 {"Out06 School of Sorcery", 0x24, 0, 25, 0, 0 },
|
|
174 {"Out06 Red Dwarf Mines", 0x24, 0, 25, 0, 0 },
|
|
175 {"Out07 Castle Lambert", 0x24, 0, 25, 0, 0 },
|
|
176 {"Out07 Walls of Mist", 0x24, 0, 25, 0, 0 },
|
|
177 {"Out07 Temple of the Light", 0x24, 0, 25, 0, 0 },
|
|
178 {"Out08 Evil Entrance", 0x24, 0, 25, 0, 0 },
|
|
179 {"Out08 Breeding Zone", 0x24, 0, 25, 0, 0 },
|
|
180 {"Out08 Temple of the Dark", 0x24, 0, 25, 0, 0 },
|
|
181 {"Out09 Grand Temple of the Moon", 0x24, 0, 25, 0, 0 },
|
|
182 {"Out09 Grand Tempple of the Sun", 0x24, 0, 25, 0, 0 },
|
|
183 {"Out10 Thunderfist Mountain", 0x24, 0, 25, 0, 0 },
|
|
184 {"Out10 The Maze", 0x24, 0, 25, 0, 0 },
|
|
185 {"Out10 Connecting Tunnel Cave #1", 0x24, 0, 25, 0, 0 },
|
|
186 {"", 0x24, 0, 25, 0, 0 },
|
|
187 {"", 0x24, 0, 25, 0, 0 },
|
|
188 {"Out11 Stone City", 0x24, 0, 25, 0, 0 },
|
|
189 {"", 0x24, 0, 25, 0, 0 },
|
|
190 {"Out12 Colony Zod", 0x24, 0, 25, 0, 0 },
|
|
191 {"Out12 Connecting Tunnel Cave #1", 0x24, 0, 25, 0, 0 },
|
|
192 {"", 0x24, 0, 25, 0, 0 },
|
|
193 {"", 0x24, 0, 25, 0, 0 },
|
|
194 {"Out13 Mercenary Guild", 0x24, 0, 25, 0, 0 },
|
|
195 {"Out13 Tidewater Caverns", 0x24, 0, 25, 0, 0 },
|
|
196 {"Out13 Wine Cellar", 0x24, 0, 25, 0, 0 },
|
|
197 {"Out14 Titan's Stronghold", 0x24, 0, 25, 0, 0 },
|
|
198 {"Out14 Temple Of Baa", 0x24, 0, 25, 0, 0 },
|
|
199 {"Out14 Hall under the Hill", 0x24, 0, 25, 0, 0 },
|
|
200 {"Out15 The Linclon", 0x24, 0, 25, 0, 0 },
|
|
201 {"Jail", 0x24, 0, 31, 0, 0 },
|
|
202 {"Harmondale Throne Room", 0x24, 0, 29, 0, 0 },
|
|
203 {"Gryphonheart Throne Room", 0x24, 0, 20, 0, 0 },
|
|
204 {"Elf Castle Throne Room", 0x24, 0, 20, 0, 0 },
|
|
205 {"Wizard Castle Throne Room", 0x24, 0, 20, 0, 0 },
|
|
206 {"Necromancer Casstle Trone Room", 0x24, 0, 20, 0, 0 },
|
|
207 {"Master Thief", 0x24, 0, 29, 0, 0 },
|
|
208 {"Dwarven King", 0x24, 0, 20, 0, 0 },
|
|
209 {"Arms Master", 0x24, 0, 29, 0, 0 },
|
|
210 {"Warlock", 0x24, 0, 29, 0, 0 },
|
|
211 {"Lord Markam", 0x24, 0, 20, 0, 0 },
|
|
212 {"Arbiter Neutral Town", 0x24, 0, 29, 0, 0 },
|
|
213 {"Arbiter Good Town", 0x24, 0, 29, 0, 0 },
|
|
214 {"Arbiter Evil Town", 0x24, 0, 29, 0, 0 },
|
|
215 {"Necromancer Throne Room Empty", 0x24, 0, 20, 0, 0 },
|
|
216 {"", 0x24, 0, 29, 0, 0 },
|
|
217 {"", 0x24, 0, 29, 0, 0 },
|
|
218 {"", 0x24, 0, 29, 0, 0 },
|
|
219 {"", 0x24, 0, 29, 0, 0 },
|
|
220 {"Boat01", 0xF, 0, 29, 53, 3 },
|
|
221 {"", 0x24, 0, 28, 0, 0 },
|
|
222 {"", 0x24, 0, 28, 0, 0 },
|
|
223 {"", 0x24, 0, 28, 0, 0 },
|
|
224 {"", 0x24, 0, 29, 0, 0 },
|
|
225 {"Arbiter Room Neutral", 0x24, 0, 29, 0, 0 },
|
|
226 {"Out02 Castle Harmondy Abandoned", 0x24, 0, 25, 0, 0 },
|
|
227 {"Human Temple02", 0x24, 0x3AB, 23, 27, 0 },
|
|
228 {"Player Castle Good", 0x24, 0, 25, 0, 0 },
|
|
229 {"Player Castle Bad", 0x24, 0, 25, 0, 0}
|
|
230 };
|
|
231
|
|
232
|
|
233
|
|
234
|
|
235 //----- (0044606A) --------------------------------------------------------
|
|
236 void PrepareHouse(HOUSE_ID house)
|
|
237 {
|
|
238 //unsigned int v1; // ebx@1
|
|
239 //signed int v2; // esi@1
|
|
240 //int uExitPic; // edi@1
|
|
241 __int16 uExitMapID; // ax@2
|
|
242 //int result; // eax@5
|
|
243 //unsigned int *v6; // ecx@8
|
|
244 int v7; // ebx@11
|
|
245 //int v8; // esi@16
|
|
246 //unsigned int v9; // eax@16
|
|
247 //unsigned int v10; // eax@19
|
|
248 //int v11; // ecx@19
|
|
249 //char pContainer[36]; // [sp+Ch] [bp-54h]@16
|
|
250 int v13; // [sp+30h] [bp-30h]@11
|
|
251 int Dst[6]; // [sp+34h] [bp-2Ch]@1
|
|
252 //unsigned int v15; // [sp+4Ch] [bp-14h]@1
|
|
253 int uAnimationID; // [sp+50h] [bp-10h]@1
|
|
254 //unsigned int *v17; // [sp+54h] [bp-Ch]@3
|
|
255 //unsigned int v18; // [sp+58h] [bp-8h]@1
|
|
256 //int v19; // [sp+5Ch] [bp-4h]@7
|
|
257
|
|
258 //v15 = uHouseID;
|
|
259 //v1 = 52 * uHouseID;
|
|
260 //uAnimationID = p2DEvents_minus1___02[26 * uHouseID];
|
|
261 uAnimationID = p2DEvents[house - 1].uAnimationID;
|
|
262 //v18 = 52 * uHouseID;
|
|
263 memset(Dst, 0, 0x18u);
|
|
264 //uExitPic = *(__int16 *)((char *)p2DEvents_minus1_::2C + v1);
|
|
265 //uExitPic = p2DEvents[uHouseID - 1].uExitPicID;
|
|
266 uNumDialogueNPCPortraits = 0;
|
|
267 uHouse_ExitPic = p2DEvents[house - 1].uExitPicID;
|
|
268 if ( uHouse_ExitPic )
|
|
269 {
|
|
270 //uExitMapID = *(__int16 *)((char *)p2DEvents_minus1_::30 + v1);
|
|
271 uExitMapID = p2DEvents[house - 1]._quest_related;
|
|
272 if ( uExitMapID > 0 )
|
|
273 {
|
|
274 //v17 = (unsigned int *)(uExitMapID - 1);
|
|
275 if(_449B57_test_bit(pParty->_quest_bits,uExitMapID))
|
|
276 // if ( !((unsigned __int8)(0x80u >> (uExitMapID - 1) % 8) & pParty->_quest_bits[(uExitMapID - 1) >> 3]) )
|
|
277 {
|
|
278 //uExitPic = 0;
|
|
279 uHouse_ExitPic = 0;
|
|
280 }
|
|
281 }
|
|
282 }
|
|
283
|
|
284 dword_591080 = pAnimatedRooms[uAnimationID].field_8;
|
|
285 //result = dword_591080;
|
|
286
|
|
287 //v2 = 0;
|
|
288 uNumDialogueNPCPortraits = 0;
|
|
289 if ( dword_591080 )
|
|
290 {
|
|
291 //v2 = 1;
|
|
292 Dst[0] = dword_591080;
|
|
293 uNumDialogueNPCPortraits = 1;
|
|
294 }
|
|
295
|
|
296 //v19 = 1;
|
|
297 for (uint i = 0; i < pNPCStats->uNumNewNPCs; ++i)
|
|
298 {
|
|
299 auto npc = pNPCStats->pNewNPCData + i;
|
|
300 //v6 = &pNPCStats->pNewNPCData[1].uFlags;
|
|
301 //v17 = &pNPCStats->pNewNPCData[1].uFlags;
|
|
302 //do
|
|
303 //{
|
|
304 if (npc->Location2D == house )
|
|
305 {
|
|
306 if (~npc->uFlags & 0x80)
|
|
307 //if ( !(*(char *)v6 & 0x80) )
|
|
308 {
|
|
309 v7 = uNumDialogueNPCPortraits++ - dword_591080 ? 1 : 0;
|
|
310 HouseNPCData[v7] = npc;
|
|
311 //v6 = v17;
|
|
312 //*(&v13 + v2) = *(v17 - 1);
|
|
313 Dst[uNumDialogueNPCPortraits - 1] = npc->uPortraitID;
|
|
314 //v1 = v18;
|
|
315 if ((npc->uFlags & 3) != 2)
|
|
316 ++npc->uFlags;
|
|
317 }
|
|
318 }
|
|
319 //++v19;
|
|
320 //v6 += 19;
|
|
321 //v17 = v6;
|
|
322 //}
|
|
323 //while ( v19 < (signed int)pNPCStats->uNumNewNPCs );
|
|
324 }
|
|
325 //uNumDialogueNPCPortraits = v2;
|
|
326
|
|
327 //v19 = 0;
|
|
328 for (uint i = 0; i < uNumDialogueNPCPortraits; ++i)
|
|
329 //if ( v2 > 0 )
|
|
330 {
|
|
331 //do
|
|
332 //{
|
|
333 //v8 = v19;
|
|
334 char icon_name[128];
|
|
335 sprintfex(icon_name, "npc%03u", Dst[i]);
|
|
336 //v9 = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
|
|
337 //++v19;
|
|
338 pDialogueNPCPortraits[i] = pIcons_LOD->LoadTexturePtr(icon_name, TEXTURE_16BIT_PALETTE);
|
|
339 //result = v19;
|
|
340 //}
|
|
341 //while ( v19 < uNumDialogueNPCPortraits );
|
|
342 //uExitPic = uHouse_ExitPic;
|
|
343 }
|
|
344
|
|
345 if (uHouse_ExitPic)
|
|
346 {
|
|
347 //v10 = pIcons_LOD->LoadTexture(pHouse_ExitPictures[uHouse_ExitPic], TEXTURE_16BIT_PALETTE);
|
|
348 //v11 = uNumDialogueNPCPortraits++;
|
|
349 pDialogueNPCPortraits[uNumDialogueNPCPortraits++] = pIcons_LOD->LoadTexturePtr(pHouse_ExitPictures[uHouse_ExitPic], TEXTURE_16BIT_PALETTE);
|
|
350 //result = *(__int16 *)((char *)p2DEvents_minus1_::2E + v1);
|
|
351 //result = p2DEvents[house - 1].uExitMapID;
|
|
352 uHouse_ExitPic = p2DEvents[house - 1].uExitMapID;
|
|
353 }
|
|
354 //return result;
|
|
355 }
|
|
356
|
|
357
|
|
358 //----- (0044622E) --------------------------------------------------------
|
|
359 bool EnterHouse(enum HOUSE_ID uHouseID)
|
|
360 {
|
|
361 //enum HOUSE_ID v1; // edi@1
|
|
362 //int v2; // edi@5
|
|
363 signed int uOpenTime; // eax@5
|
|
364 signed int uCloseTime; // esi@5
|
|
365 unsigned int v5; // esi@5
|
|
366 int v6; // edx@5
|
|
367 signed int am_pm_flag_open; // ecx@10
|
|
368 signed int am_pm_flag_close; // eax@10
|
|
369 int v9; // esi@10
|
|
370 //unsigned int v10; // esi@16
|
|
371 int v11; // ecx@17
|
|
372 unsigned int v12; // kr00_4@25
|
|
373 //Player *v13; // esi@25
|
|
374 int v14; // eax@25
|
|
375 //Player *v15; // esi@27
|
|
376 //signed int v16; // eax@32
|
|
377 unsigned int v17; // eax@37
|
|
378 signed int v18; // edi@37
|
|
379 signed int v19; // edi@41
|
|
380 //unsigned int v20; // ecx@41
|
|
381 //const char *v22; // [sp-4h] [bp-40h]@33
|
|
382 char pContainer[40]; // [sp+Ch] [bp-30h]@32
|
|
383 unsigned int v24; // [sp+34h] [bp-8h]@5
|
|
384 //enum HOUSE_ID v25; // [sp+38h] [bp-4h]@1
|
|
385
|
|
386 //v1 = uHouseID;
|
|
387 //v25 = uHouseID;
|
|
388 GameUI_StatusBar_TimedString[0] = 0;
|
|
389 pStatusBarString[0] = 0;
|
|
390 ShowStatusBarString("", 2u);
|
|
391 if ( pMessageQueue_50CBD0->uNumMessages )
|
|
392 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
|
|
393 viewparams->bRedrawGameUI = 1;
|
|
394 uDialogueType = 0;
|
|
395 pKeyActionMap->_459ED1(3);
|
|
396 pKeyActionMap->ResetKeys();
|
|
397 if (uHouseID == HOUSE_600 || uHouseID == HOUSE_601)
|
|
398 {
|
|
399 GameOverMenu(0);
|
|
400 return 0;
|
|
401 }
|
|
402 uOpenTime = p2DEvents[uHouseID - 1].uOpenTime;
|
|
403 uCloseTime = p2DEvents[uHouseID - 1].uCloseTime;
|
|
404 ptr_F8B1E8 = 0;
|
|
405 dword_F8B1E4 = 0;
|
|
406 dword_F8B1F4 = 0;
|
|
407 memset(byte_F8B1F0, 0, 4);
|
|
408 memset(byte_F8B148, 0, 16);
|
|
409 pRenderer->ClearZBuffer(0, 479);
|
|
410
|
|
411 if (((uCloseTime - 1 <= uOpenTime)&&((pParty->uCurrentHour <uOpenTime)&&(pParty->uCurrentHour >(uCloseTime - 1))))||
|
|
412 ((uCloseTime - 1 > uOpenTime)&&((pParty->uCurrentHour < uOpenTime)||(pParty->uCurrentHour > (uCloseTime - 1)))))
|
|
413
|
|
414 {
|
|
415 am_pm_flag_open = 0;
|
|
416 am_pm_flag_close = 0;
|
|
417 if (uOpenTime > 12 )
|
|
418 {
|
|
419 uOpenTime -= 12;
|
|
420 am_pm_flag_open = 1;
|
|
421 }
|
|
422 if ( uCloseTime > 12 )
|
|
423 {
|
|
424 uCloseTime -= 12;
|
|
425 am_pm_flag_close = 1;
|
|
426 }
|
|
427 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[414], uOpenTime, aAMPMNames[am_pm_flag_open],
|
|
428 uCloseTime, aAMPMNames[am_pm_flag_close]); //"This place is open from %d%s to %d%s"
|
|
429 ShowStatusBarString(pTmpBuf, 2u);
|
|
430 if ( uActiveCharacter )
|
|
431 pPlayers[uActiveCharacter]->PlaySound(SPEECH_3, 0);
|
|
432 return 0;
|
|
433 }
|
|
434 else
|
|
435 {
|
|
436 //v10 = uHouseID;
|
|
437 if ( (signed int)uHouseID < 53 ) //entering shops and guilds
|
|
438 {
|
|
439 if ( !(pParty->field_3C._shop_ban_times[uHouseID])
|
|
440 || (pParty->field_3C._shop_ban_times[uHouseID] <= pParty->uTimePlayed) )
|
|
441 {
|
|
442 pParty->field_3C._shop_ban_times[uHouseID] = 0;
|
|
443 }
|
|
444 else
|
|
445 {
|
|
446 ShowStatusBarString(pGlobalTXT_LocalizationStrings[191], 2u);// "You've been banned from this shop!"
|
|
447 return 0;
|
|
448 }
|
|
449 }
|
|
450 if ( !start_event_seq_number )
|
|
451 pAudioPlayer->StopChannels(-1, -1);
|
|
452
|
|
453 uCurrentHouse_Animation = p2DEvents[uHouseID - 1].uAnimationID;
|
|
454 in_current_building_type = pAnimatedRooms[uCurrentHouse_Animation].uBuildingType;
|
|
455 if ( in_current_building_type == BildingType_Throne_Room && pParty->uFine ) // going 2 jail
|
|
456 {
|
|
457 uCurrentHouse_Animation = (signed __int16)p2DEvents[186].uAnimationID;
|
|
458 uHouseID = HOUSE_JAIL;
|
|
459 pParty->uTimePlayed = pParty->uTimePlayed+ 0x7620000;
|
|
460 in_current_building_type = pAnimatedRooms[p2DEvents[HOUSE_LORD_AND_JUDGE].uAnimationID].uBuildingType;
|
|
461 ++pParty->uNumPrisonTerms;
|
|
462 pParty->uFine = 0;
|
|
463 for (uint i = 0; i < 4; ++i)
|
|
464 {
|
|
465 pParty->pPlayers[i].uTimeToRecovery = 0;
|
|
466 pParty->pPlayers[i].uNumDivineInterventionCastsThisDay = 0;
|
|
467 pParty->pPlayers[i].SetVariable(VAR_Award, 87);
|
|
468 }
|
|
469 }
|
|
470 ++pIcons_LOD->uTexturePacksCount;
|
|
471 if ( !pIcons_LOD->uNumPrevLoadedFiles )
|
|
472 pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles;
|
|
473 switch (pParty->alignment)
|
|
474 {
|
|
475 case PartyAlignment_Good: sprintf(pContainer, "evt%02d-b", const_2()); break;
|
|
476 case PartyAlignment_Neutral: sprintf(pContainer, "evt%02d", const_2()); break;
|
|
477 case PartyAlignment_Evil: sprintf(pContainer, "evt%02d-c", const_2()); break;
|
|
478 default: assert(false);
|
|
479 }
|
|
480
|
|
481 v17 = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
|
|
482 pDialogueNPCCount = 0;
|
|
483 pTexture_Dialogue_Background = &pIcons_LOD->pTextures[v17];
|
|
484 uTextureID_507B04 = uTextureID_right_panel;
|
|
485 PrepareHouse(uHouseID);
|
|
486 v18 = 1;
|
|
487 uTextureID_507B04 = uTextureID_right_panel;
|
|
488 if ( uNumDialogueNPCPortraits == 1 )
|
|
489 pDialogueNPCCount = 1;
|
|
490 pVideoPlayer->_4BF28F(pAnimatedRooms[uCurrentHouse_Animation].video_name, 1u);
|
|
491 dword_5C35D4 = 1;
|
|
492 if ( (signed int)uHouseID < 139 || (signed int)uHouseID > 172 )
|
|
493 {
|
|
494 if ( (signed int)uHouseID >= 54 && (signed int)uHouseID <= 73 && !sub_4B68EA(uHouseID - 54) )
|
|
495 {
|
|
496 return 1;
|
|
497 }
|
|
498 }
|
|
499 else
|
|
500 { //guilds
|
|
501 v19 = guild_mambership_flags[uHouseID-139]; //guilds flags
|
|
502 //v20 = uHouseID;
|
|
503 //if ( !((unsigned __int8)(0x80u >> v19 % 8) & pPlayers[uActiveCharacter]->_guilds_member_bits[v19 /8]) )
|
|
504 if(_449B57_test_bit((unsigned char*)pPlayers[uActiveCharacter]->_guilds_member_bits,v19))
|
|
505 {
|
|
506 HousePlaySomeSound(uHouseID, 3);
|
|
507 return 1;
|
|
508 }
|
|
509 }
|
|
510 HousePlaySomeSound(uHouseID, 1);
|
|
511 dword_5C35D4 = 1;
|
|
512 return 1;
|
|
513 }
|
|
514 }
|
|
515
|
|
516 //----- (004B1E92) --------------------------------------------------------
|
|
517 void __fastcall HousePlaySomeSound(unsigned int uHouseID, int a2)
|
|
518 {
|
|
519 //if ( BYTE1(pAnimatedRooms[p2DEvents_minus1___02[26 * uHouseID]].field_C) )
|
|
520 if ( pAnimatedRooms[p2DEvents[uHouseID - 1].uAnimationID].uRoomSoundId )
|
|
521 pAudioPlayer->PlaySound(
|
|
522 //(SoundID)(a2 + 100 * (BYTE1(pAnimatedRooms[p2DEvents_minus1___02[26 * uHouseID]].field_C) + 300)),
|
|
523 (SoundID)(a2 + 100 * (pAnimatedRooms[p2DEvents[uHouseID - 1].uAnimationID].uRoomSoundId) + 300),
|
|
524 806, 0, -1, 0, 0, 0, 0);
|
|
525 }
|
|
526
|
|
527 //----- (004B4F4F) --------------------------------------------------------
|
|
528 char *__cdecl JailDialog()
|
|
529 {
|
|
530 const char *v0; // esi@1
|
|
531 const char *v1; // ST10_4@1
|
|
532 unsigned __int16 v2; // ST0C_2@1
|
|
533 int v3; // eax@1
|
|
534 GUIWindow v5; // [sp+8h] [bp-54h]@1
|
|
535
|
|
536 memcpy(&v5, window_SpeakInHouse, sizeof(v5));
|
|
537 v0 = pGlobalTXT_LocalizationStrings[672];
|
|
538 v1 = pGlobalTXT_LocalizationStrings[672];
|
|
539 v5.uFrameX = 483;
|
|
540 v5.uFrameWidth = 148;
|
|
541 v5.uFrameZ = 334;
|
|
542 v2 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu);
|
|
543 v3 = pFontArrus->CalcTextHeight(v0, &v5, 0, 0);
|
|
544 return v5.DrawTitleText(pFontArrus, 0, (310 - v3) / 2 + 18, v2, v1, 3u);
|
|
545 }
|
|
546
|
|
547
|
|
548
|
|
549 //----- (004B68EA) --------------------------------------------------------
|
|
550 bool __fastcall sub_4B68EA(int a1)
|
|
551 {
|
|
552 signed int v1; // edi@1
|
|
553 int *v2; // esi@1
|
|
554 int v3; // ecx@2
|
|
555
|
|
556 v1 = 0;
|
|
557 v2 = &dword_4F0E10[a1];
|
|
558 while ( 1 )
|
|
559 {
|
|
560 v3 = 8 * *((char *)v2 + v1);
|
|
561 if ( *(&byte_4F09B1[pParty->uDaysPlayed % 7] + v3 * 4) )
|
|
562 {
|
|
563 if ( !dword_4F09CC[v3] || (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, LOWORD(dword_4F09CC[v3])) )
|
|
564 break;
|
|
565 }
|
|
566 ++v1;
|
|
567 if ( v1 >= 4 )
|
|
568 return 0;
|
|
569 }
|
|
570 return 1;
|
|
571 }
|
|
572
|
|
573
|
|
574
|
|
575 //----- (004B7911) --------------------------------------------------------
|
|
576 void __cdecl TownHallDialog()
|
|
577 {
|
|
578 GUIWindow *v0; // eax@4
|
|
579 int v1; // eax@10
|
|
580 int v2; // esi@10
|
|
581 GUIFont *v3; // ST20_4@20
|
|
582 int v4; // eax@20
|
|
583 MonsterInfo *v5; // edi@21
|
|
584 unsigned int v6; // ST20_4@21
|
|
585 char *v7; // ST1C_4@21
|
|
586 unsigned int v8; // eax@21
|
|
587 int v9; // esi@21
|
|
588 char *v10; // eax@23
|
|
589 signed int v11; // ebx@24
|
|
590 signed int i; // esi@26
|
|
591 int v13; // eax@27
|
|
592 GUIWindow *v14; // ecx@28
|
|
593 __int64 v15; // qax@28
|
|
594 signed int v16; // ebx@28
|
|
595 int v17; // ebx@28
|
|
596 unsigned __int8 v18; // sf@28
|
|
597 char **v19; // edi@29
|
|
598 GUIButton *v20; // eax@30
|
|
599 GUIButton *v21; // esi@30
|
|
600 int v22; // eax@30
|
|
601 unsigned int v23; // ecx@30
|
|
602 unsigned __int16 v24; // ax@30
|
|
603 GUIWindow a1; // [sp+Ch] [bp-110h]@21
|
|
604 GUIWindow w; // [sp+60h] [bp-BCh]@21
|
|
605 GUIWindow _this; // [sp+B4h] [bp-68h]@1
|
|
606 int v28; // [sp+108h] [bp-14h]@1
|
|
607 int v29; // [sp+10Ch] [bp-10h]@28
|
|
608 int v30; // [sp+110h] [bp-Ch]@1
|
|
609 int v31; // [sp+114h] [bp-8h]@29
|
|
610 GUIFont *pOutString; // [sp+118h] [bp-4h]@21
|
|
611
|
|
612 memcpy(&_this, window_SpeakInHouse, sizeof(_this));
|
|
613 _this.uFrameX = 483;
|
|
614 _this.uFrameWidth = 148;
|
|
615 _this.uFrameZ = 334;
|
|
616 v28 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu);
|
|
617 v30 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu);
|
|
618 sprintf(pTmpBuf, "%s: %d", pGlobalTXT_LocalizationStrings[605], pParty->uFine);
|
|
619 _this.DrawTitleText(pFontArrus, 0, 0x104u, v30, pTmpBuf, 3u);
|
|
620 switch(dialog_menu_id)
|
|
621 {
|
|
622 case 1:
|
|
623 {
|
|
624 v11 = 1;
|
|
625 pOutString = 0;
|
|
626 pShopOptions[0] = pGlobalTXT_LocalizationStrings[604];
|
|
627 if ( pParty->uFine )
|
|
628 {
|
|
629 pShopOptions[1] = pGlobalTXT_LocalizationStrings[603];
|
|
630 v11 = 2;
|
|
631 }
|
|
632 for ( i = 0; i < v11; ++i )
|
|
633 {
|
|
634 v13 = pFontArrus->CalcTextHeight(pShopOptions[i], &_this, 0, 0);
|
|
635 pOutString = (GUIFont *)((char *)pOutString + v13);
|
|
636 }
|
|
637 v29 = (100 - (signed int)pOutString) / v11;
|
|
638 v14 = pDialogueWindow;
|
|
639 v15 = 80 - v11 * (100 - (signed int)pOutString) / v11 - (signed int)pOutString;
|
|
640 v16 = v15 - HIDWORD(v15);
|
|
641 LODWORD(v15) = pDialogueWindow->pStartingPosActiveItem;
|
|
642 HIDWORD(v15) = v15 + pDialogueWindow->pNumPresenceButton;
|
|
643 v17 = (v16 >> 1) - v29 / 2 + 158;
|
|
644 v18 = -pDialogueWindow->pNumPresenceButton < 0;
|
|
645 pOutString = (GUIFont *)pDialogueWindow->pStartingPosActiveItem;
|
|
646 if ( v18 ^ __OFSUB__((int)v15, HIDWORD(v15)) )
|
|
647 {
|
|
648 v31 = 2;
|
|
649 v19 = pShopOptions;
|
|
650 do
|
|
651 {
|
|
652 v20 = v14->GetControl((unsigned int)pOutString);
|
|
653 v21 = v20;
|
|
654 v20->uY = v29 + v17;
|
|
655 v22 = pFontArrus->CalcTextHeight(*v19, &_this, 0, 0);
|
|
656 v23 = v21->uY;
|
|
657 v21->uHeight = v22;
|
|
658 v17 = v23 + v22 - 1;
|
|
659 v21->uW = v17;
|
|
660 v24 = v30;
|
|
661 if ( pDialogueWindow->pCurrentPosActiveItem != v31 )
|
|
662 v24 = v28;
|
|
663 _this.DrawTitleText(pFontArrus, 0, v23, v24, *v19, 3u);
|
|
664 v14 = pDialogueWindow;
|
|
665 ++v31;
|
|
666 ++v19;
|
|
667 pOutString = (GUIFont *)((char *)pOutString + 1);
|
|
668 }
|
|
669 while ( (signed int)pOutString < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem );
|
|
670 }
|
|
671 break;
|
|
672 }
|
|
673 case 99:
|
|
674 {
|
|
675 v5 = &pMonsterStats->pInfos[word_F8B1A0];
|
|
676 v6 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu);
|
|
677 v7 = v5->pName;
|
|
678 v8 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu);
|
|
679 sprintf(pTmpBuf, &byte_4F0F98, v8, v7, v6);
|
|
680 sprintf(pTmpBuf2, dword_F8B1A4, pTmpBuf, 100 * v5->uLevel);
|
|
681 ptr_F8B1E8 = pTmpBuf2;
|
|
682 memcpy(&a1, pDialogueWindow, sizeof(a1));
|
|
683 w.uFrameWidth = 458;
|
|
684 w.uFrameZ = 457;
|
|
685 pOutString = pFontArrus;
|
|
686 v9 = pFontArrus->CalcTextHeight(pTmpBuf2, &w, 13, 0) + 7;
|
|
687 if ( 352 - v9 < 8 )
|
|
688 {
|
|
689 pOutString = pFontCreate;
|
|
690 v9 = pFontCreate->CalcTextHeight(ptr_F8B1E8, &w, 13, 0) + 7;
|
|
691 }
|
|
692
|
|
693 auto pTex = (uTextureID_Leather != -1 ? &pIcons_LOD->pTextures[uTextureID_Leather] : 0);
|
|
694 pRenderer->_4A6A68(8u, 352 - v9, pTex, (pTex ? pTex->uTextureHeight : 26) - v9);
|
|
695 pRenderer->DrawTextureIndexed(8u, 347 - v9, pTexture_591428);
|
|
696 v10 = FitTextInAWindow(ptr_F8B1E8, pOutString, &w, 0xDu, 0);
|
|
697 a1.DrawText(pOutString, 13, 354 - v9, 0, v10, 0, 0, 0);
|
|
698 break;
|
|
699 }
|
|
700 case 100:
|
|
701 {
|
|
702 v0 = window_SpeakInHouse;
|
|
703 if ( window_SpeakInHouse->field_40 == 1 )
|
|
704 {
|
|
705 sprintf(pTmpBuf, "%s\n%s", pGlobalTXT_LocalizationStrings[606], pGlobalTXT_LocalizationStrings[112]);
|
|
706 _this.DrawTitleText(pFontArrus, 0, 0x92u, v30, pTmpBuf, 3u);
|
|
707 _this.DrawTitleText(pFontArrus, 0, 0xBAu, v28, (const char *)pKeyActionMap->pPressedKeysBuffer, 3u);
|
|
708 v3 = pFontArrus;
|
|
709 v4 = pFontArrus->GetLineWidth((const char *)pKeyActionMap->pPressedKeysBuffer);
|
|
710 _this.DrawFlashingInputCursor(v4 / 2 + 80, 185, v3);
|
|
711 return;
|
|
712 }
|
|
713 if ( window_SpeakInHouse->field_40 == 2 )
|
|
714 {
|
|
715 v1 = atoi((const char *)pKeyActionMap->pPressedKeysBuffer);
|
|
716 v2 = v1;
|
|
717 if ( v1 <= 0 )
|
|
718 {
|
|
719 //LABEL_8:
|
|
720 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
|
|
721 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
|
|
722 {
|
|
723 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113;
|
|
724 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1;
|
|
725 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
|
|
726 ++pMessageQueue_50CBD0->uNumMessages;
|
|
727 }*/
|
|
728 return;
|
|
729 }
|
|
730 if ( v1 > pParty->uNumGold )
|
|
731 {
|
|
732 HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 2);
|
|
733 v2 = pParty->uNumGold;
|
|
734 }
|
|
735 if ( v2 > pParty->uFine )
|
|
736 v2 = pParty->uFine;
|
|
737 Party::TakeGold(v2);
|
|
738 pParty->uFine -= v2;
|
|
739 if ( pParty->uFine < 0 )
|
|
740 pParty->uFine = 0;
|
|
741 if ( uActiveCharacter )
|
|
742 pPlayers[uActiveCharacter]->PlaySound(SPEECH_81, 0);
|
|
743 v0 = window_SpeakInHouse;
|
|
744 }
|
|
745 if ( window_SpeakInHouse->field_40 == 3 )
|
|
746 {
|
|
747 v0->field_40 = 0;
|
|
748 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
|
|
749 }
|
|
750 break;
|
|
751 }
|
|
752 default:
|
|
753 {
|
|
754 break;
|
|
755 }
|
|
756 }
|
|
757 return;
|
|
758 }
|
|
759 // F8B19C: using guessed type int dword_F8B19C;
|
|
760 // F8B1A0: using guessed type __int16 word_F8B1A0;
|
|
761
|
|
762 //----- (004B7D7E) --------------------------------------------------------
|
|
763 void __cdecl BankDialog()
|
|
764 {
|
|
765 GUIWindow *v0; // eax@4
|
|
766 int v1; // ecx@5
|
|
767 int v2; // eax@6
|
|
768 unsigned int v3; // esi@6
|
|
769 GUIFont *v4; // ST10_4@12
|
|
770 int v5; // eax@12
|
|
771 int v6; // eax@19
|
|
772 unsigned int v7; // esi@19
|
|
773 unsigned __int16 v8; // ax@27
|
|
774 unsigned __int16 v9; // ax@29
|
|
775 char *v10; // [sp-8h] [bp-70h]@11
|
|
776 char *v11; // [sp-4h] [bp-6Ch]@11
|
|
777 GUIWindow _this; // [sp+Ch] [bp-5Ch]@1
|
|
778 __int16 v13[2]; // [sp+60h] [bp-8h]@1
|
|
779 __int16 v14[2]; // [sp+64h] [bp-4h]@1
|
|
780
|
|
781 memcpy(&_this, window_SpeakInHouse, sizeof(_this));
|
|
782 _this.uFrameX = 483;
|
|
783 _this.uFrameWidth = 148;
|
|
784 _this.uFrameZ = 334;
|
|
785 *(int *)v13 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu);
|
|
786 *(int *)v14 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu);
|
|
787 sprintf(pTmpBuf, "%s: %d", pGlobalTXT_LocalizationStrings[25], pParty->uNumGoldInBank);
|
|
788 _this.DrawTitleText(pFontArrus, 0, 0xDCu, v14[0], pTmpBuf, 3u);
|
|
789 switch(dialog_menu_id)
|
|
790 {
|
|
791 case 1:
|
|
792 {
|
|
793 v8 = v14[0];
|
|
794 if ( pDialogueWindow->pCurrentPosActiveItem != 2 )
|
|
795 v8 = v13[0];
|
|
796 _this.DrawTitleText(pFontArrus, 0, 0x92u, v8, pGlobalTXT_LocalizationStrings[60], 3u);
|
|
797 v9 = v14[0];
|
|
798 if ( pDialogueWindow->pCurrentPosActiveItem != 3 )
|
|
799 v9 = v13[0];
|
|
800 _this.DrawTitleText(pFontArrus, 0, 0xB0u, v9, pGlobalTXT_LocalizationStrings[244], 3u);
|
|
801 break;
|
|
802 }
|
|
803 case 7:
|
|
804 {
|
|
805 v0 = window_SpeakInHouse;
|
|
806 if ( window_SpeakInHouse->field_40 != 1 )
|
|
807 {
|
|
808 v1 = window_SpeakInHouse->field_40 - 2;
|
|
809 if ( window_SpeakInHouse->field_40 == 2 )
|
|
810 {
|
|
811 v6 = atoi((const char *)pKeyActionMap->pPressedKeysBuffer);
|
|
812 v7 = v6;
|
|
813 if ( !v6 )
|
|
814 {
|
|
815 //LABEL_17:
|
|
816 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
|
|
817 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
|
|
818 {
|
|
819 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113;
|
|
820 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1;
|
|
821 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
|
|
822 ++pMessageQueue_50CBD0->uNumMessages;
|
|
823 }*/
|
|
824 return;
|
|
825 }
|
|
826 if ( v6 > pParty->uNumGold )
|
|
827 {
|
|
828 HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 2);
|
|
829 v7 = pParty->uNumGold;
|
|
830 }
|
|
831 if ( v7 )
|
|
832 {
|
|
833 Party::TakeGold(v7);
|
|
834 pParty->uNumGoldInBank += v7;
|
|
835 if ( uActiveCharacter )
|
|
836 pPlayers[uActiveCharacter]->PlaySound(SPEECH_81, 0);
|
|
837 }
|
|
838 v0 = window_SpeakInHouse;
|
|
839 v0->field_40 = 0;
|
|
840 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
|
|
841 return;
|
|
842 }
|
|
843 if ( v1 != 1 )
|
|
844 return;
|
|
845 v0->field_40 = 0;
|
|
846 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
|
|
847 return;
|
|
848 }
|
|
849 v11 = pGlobalTXT_LocalizationStrings[112];
|
|
850 v10 = pGlobalTXT_LocalizationStrings[60];
|
|
851 sprintf(pTmpBuf, "%s\n%s", v10, v11);
|
|
852 _this.DrawTitleText(pFontArrus, 0, 0x92u, v14[0], pTmpBuf, 3u);
|
|
853 _this.DrawTitleText(pFontArrus, 0, 0xBAu, v13[0], (const char *)pKeyActionMap->pPressedKeysBuffer, 3u);
|
|
854 v4 = pFontArrus;
|
|
855 v5 = pFontArrus->GetLineWidth((const char *)pKeyActionMap->pPressedKeysBuffer);
|
|
856 _this.DrawFlashingInputCursor(v5 / 2 + 80, 185, v4);
|
|
857 break;
|
|
858 }
|
|
859
|
|
860 case 8:
|
|
861 {
|
|
862 v0 = window_SpeakInHouse;
|
|
863 if ( window_SpeakInHouse->field_40 != 1 )
|
|
864 {
|
|
865 v1 = window_SpeakInHouse->field_40 - 2;
|
|
866 if ( window_SpeakInHouse->field_40 == 2 )
|
|
867 {
|
|
868 window_SpeakInHouse->field_40 = 0;
|
|
869 v2 = atoi((const char *)pKeyActionMap->pPressedKeysBuffer);
|
|
870 v3 = v2;
|
|
871 if ( v2 )
|
|
872 {
|
|
873 if ( v2 > pParty->uNumGoldInBank )
|
|
874 {
|
|
875 HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 2);
|
|
876 v3 = pParty->uNumGoldInBank;
|
|
877 }
|
|
878 if ( v3 )
|
|
879 {
|
|
880 Party::SetGold(pParty->uNumGold + v3);
|
|
881 pParty->uNumGoldInBank -= v3;
|
|
882 }
|
|
883 }
|
|
884 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
|
|
885 return;
|
|
886 }
|
|
887 if ( v1 != 1 )
|
|
888 return;
|
|
889 v0->field_40 = 0;
|
|
890 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
|
|
891 return;
|
|
892 }
|
|
893 v11 = pGlobalTXT_LocalizationStrings[112];
|
|
894 v10 = pGlobalTXT_LocalizationStrings[244];
|
|
895 sprintf(pTmpBuf, "%s\n%s", v10, v11);
|
|
896 _this.DrawTitleText(pFontArrus, 0, 0x92u, v14[0], pTmpBuf, 3u);
|
|
897 _this.DrawTitleText(pFontArrus, 0, 0xBAu, v13[0], (const char *)pKeyActionMap->pPressedKeysBuffer, 3u);
|
|
898 v4 = pFontArrus;
|
|
899 v5 = pFontArrus->GetLineWidth((const char *)pKeyActionMap->pPressedKeysBuffer);
|
|
900 _this.DrawFlashingInputCursor(v5 / 2 + 80, 185, v4);
|
|
901 return;
|
|
902 break;
|
|
903 }
|
|
904
|
|
905 default:
|
|
906 {
|
|
907 break;
|
|
908 }
|
|
909 }
|
|
910 }
|
|
911 // F8B19C: using guessed type int dword_F8B19C;
|
|
912
|
|
913 //----- (004B8285) --------------------------------------------------------
|
|
914 void __cdecl TavernDialog()
|
|
915 {
|
644
|
916 int v0;
|
|
917 int pItemNum;
|
629
|
918 double v2; // st7@1
|
|
919 signed int v3; // ebx@1
|
|
920 int v4; // ecx@1
|
|
921 int v5; // esi@3
|
|
922 signed int v6; // edi@5
|
|
923 int v7; // ecx@5
|
644
|
924 int pNumString; // edi@16
|
629
|
925 signed int v9; // esi@16
|
644
|
926 unsigned int pNumActiveItem; // esi@18
|
629
|
927 int v11; // eax@18
|
|
928 unsigned int v12; // eax@19
|
|
929 int v13; // eax@21
|
|
930 int v14; // ecx@26
|
644
|
931 //GUIButton *v15; // eax@28
|
|
932 //GUIButton *v16; // esi@28
|
629
|
933 int v17; // eax@28
|
|
934 char *v18; // eax@30
|
|
935 int v19; // eax@30
|
|
936 unsigned int v20; // ecx@30
|
|
937 int v21; // edx@30
|
|
938 int v22; // eax@30
|
|
939 unsigned __int16 v23; // ax@30
|
|
940 int v24; // eax@34
|
|
941 int v25; // eax@34
|
|
942 char *v26; // esi@36
|
|
943 int v27; // edi@46
|
644
|
944 unsigned int pColorText; // eax@57
|
629
|
945 signed int v31; // eax@59
|
644
|
946 //GUIWindow *v33; // edi@64
|
629
|
947 int v34; // eax@64
|
|
948 int v35; // ecx@64
|
|
949 int v36; // esi@64
|
|
950 char v37; // sf@64
|
644
|
951 GUIButton *pButton; // eax@65
|
629
|
952 int v39; // edx@69
|
|
953 int v40; // ecx@69
|
|
954 int v41; // ecx@69
|
|
955 int v42; // ecx@70
|
|
956 unsigned int v43; // edx@70
|
|
957 int v44; // edx@71
|
|
958 int v45; // ecx@71
|
|
959 int v46; // ecx@72
|
|
960 int v47; // eax@74
|
|
961 signed int v48; // edi@77
|
|
962 signed int i; // esi@79
|
|
963 int v50; // eax@80
|
644
|
964 //GUIWindow *v51; // ecx@81
|
629
|
965 _QWORD v52; // qax@81
|
|
966 signed int v53; // edi@81
|
|
967 int v54; // edi@81
|
644
|
968 //GUIButton *v55; // esi@83
|
629
|
969 const char **v56; // eax@83
|
|
970 int v57; // eax@83
|
|
971 unsigned int v58; // ecx@83
|
644
|
972 //Player *v59; // edx@83
|
629
|
973 unsigned __int16 v60; // ax@83
|
|
974 int v61; // eax@99
|
|
975 char *v63; // eax@99
|
|
976 GUIFont *v64; // edx@99
|
|
977 GUIFont *v65; // edi@100
|
|
978 unsigned int v66; // [sp-10h] [bp-284h]@75
|
|
979 unsigned __int16 v67; // [sp-Ch] [bp-280h]@75
|
|
980 int v68; // [sp-Ch] [bp-280h]@99
|
|
981 char *v69; // [sp-8h] [bp-27Ch]@75
|
|
982 int v70; // [sp-8h] [bp-27Ch]@99
|
|
983 unsigned int v71; // [sp-4h] [bp-278h]@75
|
|
984 const char *v72; // [sp-4h] [bp-278h]@93
|
|
985 unsigned int v73; // [sp-4h] [bp-278h]@99
|
|
986 char Dest[100]; // [sp+Ch] [bp-268h]@55
|
|
987 char v75[100]; // [sp+70h] [bp-204h]@59
|
|
988 char a1[100]; // [sp+D4h] [bp-1A0h]@57
|
|
989 char v77[100]; // [sp+138h] [bp-13Ch]@59
|
644
|
990 //GUIWindow v78; // [sp+19Ch] [bp-D8h]@99
|
|
991 GUIWindow dialog_window; // [sp+1F0h] [bp-84h]@1
|
629
|
992 char *Str[2]; // [sp+244h] [bp-30h]@30
|
644
|
993 unsigned int pColorWhite; // [sp+24Ch] [bp-28h]@1
|
629
|
994 unsigned __int8 v82; // [sp+253h] [bp-21h]@59
|
|
995 int v83; // [sp+254h] [bp-20h]@1
|
644
|
996 int pColorYellow; // [sp+258h] [bp-1Ch]@1
|
|
997 Player *pPlayer; // [sp+25Ch] [bp-18h]@1
|
|
998 int all_text_height; // [sp+260h] [bp-14h]@18
|
629
|
999 unsigned __int8 v87; // [sp+266h] [bp-Eh]@59
|
|
1000 unsigned __int8 v88; // [sp+267h] [bp-Dh]@57
|
|
1001 int v89; // [sp+268h] [bp-Ch]@1
|
644
|
1002 unsigned int pTextHeight; // [sp+26Fh] [bp-5h]@55
|
|
1003 int v91; // [sp+270h] [bp-4h]@3
|
|
1004 GUIFont *pOutString;
|
629
|
1005
|
644
|
1006 pPlayer = pPlayers[uActiveCharacter];
|
|
1007 memcpy(&dialog_window, window_SpeakInHouse, sizeof(dialog_window));
|
|
1008 dialog_window.uFrameX = 483;
|
|
1009 dialog_window.uFrameWidth = 148;
|
|
1010 dialog_window.uFrameZ = 334;
|
|
1011 pColorWhite = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu);
|
|
1012 pColorYellow = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu);
|
|
1013 v2 = p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier;
|
629
|
1014 *(float *)&v83 = v2;
|
|
1015 *(float *)&v89 = v2 * v2;
|
|
1016 v3 = (signed __int64)(*(float *)&v89 * 0.1);
|
662
|
1017 pItemNum = v3 * (100 - pPlayer->GetMerchant()) / 100;
|
|
1018 if ( pItemNum < v3 / 3 )
|
|
1019 pItemNum = v3 / 3;
|
629
|
1020 v5 = 1;
|
662
|
1021 pOutString = (GUIFont *)pItemNum;
|
|
1022 if ( pItemNum <= 0 )
|
629
|
1023 pOutString = (GUIFont *)1;
|
|
1024 v6 = (signed __int64)(*(float *)&v89 * *(float *)&v83 * 0.0099999998);
|
644
|
1025 v7 = v6 * (100 - pPlayer->GetMerchant()) / 100;
|
629
|
1026 if ( v7 < v6 / 3 )
|
662
|
1027 v7 = v6 / 3;
|
629
|
1028 v83 = v7;
|
|
1029 if ( v7 <= 0 )
|
|
1030 {
|
|
1031 v7 = 1;
|
|
1032 v83 = 1;
|
|
1033 }
|
|
1034 switch(dialog_menu_id)
|
|
1035 {
|
644
|
1036 case DIALOG_SHOP_MAIN:
|
|
1037 {
|
|
1038 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
|
629
|
1039 return;
|
648
|
1040
|
690
|
1041 sprintf(Dest, "\f%05d", pDialogueWindow->pCurrentPosActiveItem == 2 ? pColorYellow : pColorWhite);
|
648
|
1042 sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[178], pOutString); // Rent room for %d gold
|
644
|
1043 strcat(Dest, pTmpBuf2);
|
|
1044 pTextHeight = pFontArrus->CalcTextHeight(Dest, &dialog_window, 0, 0);
|
|
1045 strcat(Dest, "\n \n");
|
648
|
1046
|
690
|
1047 sprintf(a1, "\f%05d", pDialogueWindow->pCurrentPosActiveItem == 3 ? pColorYellow : pColorWhite);
|
648
|
1048 sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[86], // Buy food for %d days for %d gold
|
|
1049 (unsigned int)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier,
|
644
|
1050 v83);
|
|
1051 strcat(a1, pTmpBuf2);
|
|
1052 v88 = pFontArrus->CalcTextHeight(a1, &dialog_window, 0, 0);
|
|
1053 strcat(a1, "\n \n");
|
648
|
1054
|
690
|
1055 sprintf(v77, "\f%05d", pDialogueWindow->pCurrentPosActiveItem == 4 ? pColorYellow : pColorWhite);
|
648
|
1056 strcat(v77, pGlobalTXT_LocalizationStrings[160]); // Learn Skills
|
644
|
1057 v82 = pFontArrus->CalcTextHeight(v77, &dialog_window, 0, 0);
|
|
1058 strcat(v77, "\n \n");
|
|
1059 v75[0] = 0;
|
|
1060 pTextHeight = 0;
|
690
|
1061 if ( (signed int)window_SpeakInHouse->par1C >= 108 && (signed int)window_SpeakInHouse->par1C <= 120 )
|
644
|
1062 {
|
690
|
1063 sprintf(v75, "\f%05d", pDialogueWindow->pCurrentPosActiveItem == 5 ? pColorYellow : pColorWhite);
|
648
|
1064 strcat(v75, pGlobalTXT_LocalizationStrings[611]); // Play Arcomage
|
644
|
1065 pTextHeight = pFontArrus->CalcTextHeight(v75, &dialog_window, 0, 0);
|
|
1066 }
|
662
|
1067 pNumActiveItem = pDialogueWindow->pStartingPosActiveItem;
|
644
|
1068 v36 = LOBYTE(pFontArrus->uFontHeight) - 3;
|
|
1069 v37 = -pDialogueWindow->pNumPresenceButton < 0;
|
662
|
1070 if ( !(v37 ^ pNumActiveItem < pNumActiveItem + pDialogueWindow->pNumPresenceButton) )
|
644
|
1071 {
|
648
|
1072 sprintf(pTmpBuf, "%s%s%s%s", Dest, a1, v77, v75);
|
644
|
1073 dialog_window.DrawTitleText(pFontArrus, 0, 146, 0, pTmpBuf, 3);
|
|
1074 return;
|
|
1075 }
|
|
1076 while ( 1 )
|
|
1077 {
|
662
|
1078 pButton = pDialogueWindow->GetControl(pNumActiveItem);
|
644
|
1079 if ( pButton->uControlParam == 15 )
|
629
|
1080 {
|
644
|
1081 v46 = pTextHeight;
|
|
1082 pButton->uHeight = pTextHeight;
|
|
1083 pButton->uY = 146;
|
|
1084 v41 = v46 + 145;
|
|
1085 pButton->uW = v41;
|
629
|
1086 }
|
644
|
1087 else if ( pButton->uControlParam == 16 )
|
|
1088 {
|
|
1089 v44 = v88;
|
|
1090 v45 = pTextHeight + v36 + 146;
|
|
1091 pButton->uHeight = v88;
|
|
1092 pButton->uY = v45;
|
|
1093 v41 = v45 + v44 - 1;
|
|
1094 pButton->uW = v41;
|
|
1095 }
|
|
1096 else if ( pButton->uControlParam == 96 )
|
629
|
1097 {
|
644
|
1098 v42 = pTextHeight + v88 + 2 * v36 + 146;
|
|
1099 v43 = v82;
|
|
1100 pButton->uY = v42;
|
|
1101 pButton->uHeight = v43;
|
|
1102 v41 = v43 + v42 - 1;
|
|
1103 pButton->uW = v41;
|
|
1104 }
|
|
1105 else if ( pButton->uControlParam == 101 )
|
|
1106 {
|
|
1107 v39 = pTextHeight + 3 * v36 + pTextHeight + v88 + 146;
|
|
1108 v40 = v87;
|
|
1109 pButton->uHeight = pTextHeight;
|
|
1110 pButton->uY = v39;
|
|
1111 v41 = v39 + v40 - 1;
|
|
1112 pButton->uW = v41;
|
|
1113 }
|
662
|
1114 pNumActiveItem++;
|
|
1115 if ( pNumActiveItem >= pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem )
|
644
|
1116 {
|
|
1117 sprintf(pTmpBuf, "%s%s%s%s", &Dest, &a1, &v77, &v75);
|
|
1118 dialog_window.DrawTitleText(pFontArrus, 0, 146, 0, pTmpBuf, 3);
|
629
|
1119 return;
|
|
1120 }
|
644
|
1121 }
|
|
1122 break;
|
|
1123 }
|
|
1124 case DIALOG_SHOP_ARCOMAGE_102:
|
|
1125 {
|
|
1126 __debugbreak;
|
|
1127 pOutString = pFontArrus;
|
|
1128 strcpy(pTmpBuf, pNPCTopics[354].pText);
|
|
1129 dialog_window.uFrameWidth = 460;
|
|
1130 dialog_window.uFrameZ = 452;
|
|
1131 pTextHeight = pFontArrus->CalcTextHeight(pTmpBuf, &dialog_window, 12, 0) + 7;
|
|
1132 if ( 352 - pTextHeight < 8 )
|
|
1133 {
|
|
1134 pOutString = pFontCreate;
|
|
1135 pTextHeight = pFontCreate->CalcTextHeight(pTmpBuf, &dialog_window, 12, 0) + 7;
|
|
1136 }
|
|
1137 auto pTex = (uTextureID_Leather != -1 ? &pIcons_LOD->pTextures[uTextureID_Leather] : 0);
|
|
1138 pRenderer->_4A6A68(8, 352 - pTextHeight, pTex, (pTex ? pTex->uTextureHeight : 26) - pTextHeight);
|
|
1139 pRenderer->DrawTextureIndexed(8, 347 - pTextHeight, pTexture_591428);
|
|
1140 v63 = FitTextInAWindow(pTmpBuf, pOutString, &dialog_window, 0xCu, 0);
|
|
1141 window_SpeakInHouse->DrawText(pOutString, 12, 354 - pTextHeight, 0, v63, 0, 0, 0);
|
|
1142 break;
|
|
1143 }
|
|
1144 case DIALOG_SHOP_ARCOMAGE_103:
|
|
1145 {
|
|
1146 __debugbreak;
|
|
1147 strcpy(pTmpBuf, pNPCTopics[(uint)window_SpeakInHouse->ptr_1C + 247].pText);
|
|
1148 dialog_window.uFrameWidth = 460;
|
|
1149 dialog_window.uFrameZ = 452;
|
|
1150 v61 = pFontArrus->CalcTextHeight(pTmpBuf, &dialog_window, 12, 0);
|
|
1151 pTextHeight = v61 + 7;
|
|
1152 auto pTex = (uTextureID_Leather != -1 ? &pIcons_LOD->pTextures[uTextureID_Leather] : nullptr);
|
|
1153 pRenderer->_4A6A68(8, 352 - (v61 + 7), pTex, (pTex ? pTex->uTextureHeight : 26) - (v61 + 7));
|
|
1154 pRenderer->DrawTextureIndexed(8, 347 - pTextHeight, pTexture_591428);
|
|
1155 v63 = FitTextInAWindow(pTmpBuf, pFontArrus, &dialog_window, 0xCu, 0);
|
|
1156 window_SpeakInHouse->DrawText(pFontArrus, 12, 354 - pTextHeight, 0, v63, 0, 0, 0);
|
|
1157 break;
|
|
1158 }
|
|
1159 case DIALOG_SHOP_ARCOMAGE_RESULT:
|
|
1160 {
|
|
1161 if ( pArcomageGame->bGameInProgress == 1 )
|
|
1162 return;
|
|
1163 if ( pArcomageGame->uGameResult )
|
|
1164 {
|
|
1165 if ( pArcomageGame->uGameResult == 1 )
|
|
1166 v72 = pGlobalTXT_LocalizationStrings[640];// You won!
|
|
1167 else
|
|
1168 v72 = pGlobalTXT_LocalizationStrings[641];// You lost!
|
|
1169 }
|
|
1170 else
|
|
1171 {
|
|
1172 v72 = pGlobalTXT_LocalizationStrings[639];// A tie!
|
|
1173 }
|
|
1174 strcpy(pTmpBuf, v72);
|
|
1175 v66 = (174 - pFontArrus->CalcTextHeight(pTmpBuf, &dialog_window, 0, 0)) / 2 + 138;
|
|
1176 dialog_window.DrawTitleText(pFontArrus, 0, v66, pColorYellow, pTmpBuf, 3);
|
|
1177 break;
|
|
1178 }
|
|
1179 case DIALOG_SHOP_REST:
|
|
1180 {
|
|
1181 if ( pParty->uNumGold >= (unsigned int)pOutString )
|
|
1182 {
|
|
1183 Party::TakeGold((unsigned int)pOutString);
|
|
1184 v27 = (int)window_SpeakInHouse->ptr_1C;
|
|
1185 HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 2);
|
|
1186 dialog_menu_id = 0;
|
|
1187 sub_4BD8B5();
|
|
1188 sub_4B1D27();
|
|
1189 pVideoPlayer->Unload();
|
|
1190 window_SpeakInHouse->Release();
|
|
1191 window_SpeakInHouse = 0;
|
|
1192 if ( pMessageQueue_50CBD0->uNumMessages )
|
|
1193 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
|
|
1194 pMessageQueue_50CBD0->pMessages[0].eType = UIMSG_OpenRestUI;
|
|
1195 pMessageQueue_50CBD0->pMessages[0].param = v27;
|
|
1196 pMessageQueue_50CBD0->pMessages[0].field_8 = 1;
|
|
1197 ++pMessageQueue_50CBD0->uNumMessages;
|
|
1198 return;
|
|
1199 }
|
|
1200 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);
|
|
1201 HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 4);
|
|
1202 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, v5, 0);
|
|
1203 break;
|
|
1204 }
|
|
1205 case DIALOG_SHOP_SKILLS:
|
|
1206 {
|
|
1207 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
|
|
1208 return;
|
|
1209 v0 = 0;
|
|
1210 v9 = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0);
|
|
1211 pItemNum = v9 * (100 - pPlayer->GetMerchant()) / 100;
|
|
1212 if ( pItemNum < v9 / 3 )
|
|
1213 pItemNum = v9 / 3;
|
|
1214 pNumActiveItem = pDialogueWindow->pStartingPosActiveItem;
|
|
1215 all_text_height = 0;
|
|
1216 if ( pNumActiveItem < pNumActiveItem + pDialogueWindow->pNumPresenceButton )
|
|
1217 {
|
|
1218 do
|
629
|
1219 {
|
644
|
1220 v12 = pDialogueWindow->GetControl(pNumActiveItem)->uControlParam - 36;
|
|
1221 if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayer->classType][v12] && !pPlayer->pActiveSkills[v12] )
|
|
1222 {
|
|
1223 all_text_height = pFontArrus->CalcTextHeight(pSkillNames[v12], &dialog_window, 0, 0);
|
|
1224 v0++;
|
|
1225 }
|
|
1226 ++pNumActiveItem;
|
|
1227 }
|
|
1228 while ( pNumActiveItem < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton );
|
|
1229 if ( v0 )
|
|
1230 {
|
|
1231 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], pItemNum);
|
|
1232 dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3);
|
|
1233 v91 = (149 - all_text_height) / v0;
|
|
1234 if ( (149 - all_text_height) / v0 > 32 )
|
|
1235 v91 = 32;
|
|
1236 v14 = (149 - v0 * v91 - all_text_height) / 2 - v91 / 2 + 162;
|
|
1237 pNumActiveItem = pDialogueWindow->pStartingPosActiveItem;
|
|
1238 if ( pNumActiveItem < pNumActiveItem + pDialogueWindow->pNumPresenceButton )
|
|
1239 {
|
|
1240 pItemNum = 2;
|
|
1241 do
|
|
1242 {
|
|
1243 pButton = pDialogueWindow->GetControl(pItemNum);
|
|
1244 v17 = pButton->uControlParam - 36;
|
|
1245 if ( !byte_4ED970_skill_learn_ability_by_class_table[pPlayer->classType][v17] || pPlayer->pActiveSkills[v17] )
|
|
1246 {
|
|
1247 pButton->uW = 0;
|
|
1248 pButton->uHeight = 0;
|
|
1249 pButton->uY = 0;
|
|
1250 }
|
|
1251 else
|
|
1252 {
|
|
1253 pButton->uY = v91 + v14;
|
|
1254 pTextHeight = pFontArrus->CalcTextHeight(pSkillNames[v17], &dialog_window, 0, 0);
|
|
1255 pButton->uHeight = pTextHeight;
|
|
1256 v14 = pTextHeight + pButton->uY - 1;
|
|
1257 pButton->uW = v14;
|
|
1258 pColorText = pColorYellow;
|
|
1259 if ( pDialogueWindow->pCurrentPosActiveItem != pItemNum )
|
|
1260 pColorText = pColorWhite;
|
|
1261 dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, pSkillNames[v17], 3);
|
|
1262 }
|
|
1263 pNumActiveItem = pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton;
|
|
1264 pItemNum++;
|
|
1265 }
|
|
1266 while ( pItemNum < pNumActiveItem );
|
|
1267 }
|
629
|
1268 return;
|
|
1269 }
|
644
|
1270 }
|
|
1271 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], pPlayer->pName, pClassNames[pPlayer->classType]);
|
|
1272 strcat(pTmpBuf, "\n \n");
|
|
1273 strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]);
|
|
1274 pTextHeight = (174 - pFontArrus->CalcTextHeight(pTmpBuf, &dialog_window, 0, 0)) / 2 + 138;
|
|
1275 dialog_window.DrawTitleText(pFontArrus, 0, pTextHeight, pColorYellow, pTmpBuf, 3);
|
|
1276 return;
|
|
1277 }
|
|
1278 case DIALOG_SHOP_BYE_FOOD:
|
|
1279 {
|
|
1280 *(_QWORD *)Str = pParty->uNumFoodRations;
|
|
1281 //if ( (double)pParty->uNumFoodRations >= p2DEvents_minus1__20[13 * (unsigned int)ptr_507BC0->ptr_1C] )
|
|
1282 if ( (double)pParty->uNumFoodRations >= p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier )
|
|
1283 {
|
|
1284 ShowStatusBarString(pGlobalTXT_LocalizationStrings[140], 2);
|
|
1285 if ( uActiveCharacter )
|
|
1286 pPlayers[uActiveCharacter]->PlaySound(SPEECH_67, 0);
|
629
|
1287 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, v5, 0);
|
644
|
1288 return;
|
|
1289 }
|
|
1290 if ( pParty->uNumGold >= v7 )
|
|
1291 {
|
|
1292 Party::TakeGold(v7);
|
|
1293 //pParty->uNumFoodRations = (signed __int64)p2DEvents_minus1__20[13 * (unsigned int)ptr_507BC0->ptr_1C];
|
|
1294 pParty->uNumFoodRations = (signed __int64)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier;
|
|
1295 HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 3);
|
|
1296 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
|
|
1297 return;
|
|
1298 }
|
646
|
1299 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);
|
644
|
1300 HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 4);
|
|
1301 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, v5, 0);
|
|
1302 break;
|
|
1303 }
|
|
1304 case DIALOG_SHOP_ARCOMAGE_MAIN:
|
|
1305 {
|
|
1306 if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
|
|
1307 {
|
|
1308 v48 = 2;
|
|
1309 pShopOptions[0] = pGlobalTXT_LocalizationStrings[620];
|
|
1310 pShopOptions[1] = pGlobalTXT_LocalizationStrings[622];
|
|
1311 pOutString = 0;
|
|
1312 if ( pParty->HasItem(0x28Bu) )
|
|
1313 {
|
|
1314 pShopOptions[2] = pGlobalTXT_LocalizationStrings[621];
|
|
1315 v48 = 3;
|
|
1316 }
|
|
1317 for ( i = 0; i < v48; ++i )
|
|
1318 all_text_height = pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0);
|
|
1319 all_text_height = (174 - all_text_height) / v48;
|
|
1320 pNumActiveItem = pDialogueWindow->pStartingPosActiveItem;
|
|
1321 v54 = (174 - v48 * (174 - all_text_height) / v48 - all_text_height) / 2 - (174 - all_text_height) / v48 / 2 + 138;
|
|
1322 v37 = -pDialogueWindow->pNumPresenceButton < 0;
|
|
1323 if ( v37 ^ pNumActiveItem < pNumActiveItem + pDialogueWindow->pNumPresenceButton )
|
|
1324 {
|
|
1325 pItemNum = 2;
|
|
1326 pNumString = 0;
|
|
1327 do
|
|
1328 {
|
|
1329 pButton = pDialogueWindow->GetControl(pItemNum);
|
|
1330 pButton->uY = all_text_height + v54;
|
|
1331 pTextHeight = pFontArrus->CalcTextHeight((const char *)pShopOptions[pNumString], &dialog_window, 0, 0);
|
|
1332 pButton->uHeight = pTextHeight;
|
|
1333 v54 = pButton->uY + pTextHeight - 1;
|
|
1334 pButton->uW = v54;
|
|
1335 pColorText = pColorYellow;
|
|
1336 if ( pDialogueWindow->pCurrentPosActiveItem != pItemNum )
|
|
1337 pColorText = pColorWhite;
|
|
1338 dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, *(const char **)&pOutString->cFirstChar, 3);
|
|
1339 pItemNum++;
|
|
1340 pNumActiveItem = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem;
|
|
1341 }
|
|
1342 while ( pItemNum < pNumActiveItem );
|
|
1343 }
|
|
1344 }
|
|
1345 break;
|
|
1346 }
|
|
1347 default:
|
|
1348 {
|
|
1349 break;
|
|
1350 }
|
629
|
1351 }
|
|
1352 }
|
|
1353
|
|
1354
|
|
1355 //----- (004B910F) --------------------------------------------------------
|
|
1356 void __cdecl WeaponShopDialog()
|
|
1357 {
|
634
|
1358 int v0; // ebx@1
|
629
|
1359 int pNumActiveItem; // eax@6
|
|
1360 signed int v2; // esi@8
|
|
1361 ItemGen *v4; // eax@11
|
|
1362 char *v5; // ecx@12
|
|
1363 unsigned __int8 v6; // dl@13
|
|
1364 char *v7; // edx@14
|
|
1365 int v9; // ST08_4@16
|
|
1366 int v10; // eax@16
|
|
1367 signed int v11; // esi@18
|
|
1368 int v12; // ST08_4@21
|
|
1369 int v13; // eax@21
|
|
1370 int v14; // edi@23
|
|
1371 char **v15; // esi@23
|
|
1372 int v16; // eax@24
|
644
|
1373 //int v18; // edx@25
|
629
|
1374 int v19; // edi@25
|
|
1375 unsigned __int8 v20; // sf@25
|
|
1376 GUIButton *pButton; // esi@27
|
|
1377 int pNewItem; // eax@27
|
|
1378 unsigned int v24; // ecx@27
|
|
1379 int v25; // edx@27
|
644
|
1380 unsigned int pColorText; // ax@27
|
629
|
1381 signed int v27; // esi@32
|
|
1382 int v28; // ST08_4@36
|
|
1383 int v29; // eax@36
|
|
1384 signed int v32; // esi@41
|
|
1385 unsigned int v33; // esi@43
|
|
1386 int v34; // eax@43
|
|
1387 unsigned int v35; // eax@44
|
|
1388 int v36; // eax@46
|
|
1389 __int32 v37; // ecx@51
|
|
1390 int v40; // eax@53
|
|
1391 char *v41; // eax@55
|
|
1392 unsigned int v43; // ecx@55
|
|
1393 const char **v44; // edx@55
|
|
1394 int v45; // eax@55
|
|
1395 int v47; // eax@59
|
|
1396 const char **v48; // eax@63
|
|
1397 unsigned int v49; // esi@65
|
|
1398 Texture *v50; // eax@65
|
|
1399 int v51; // edi@65
|
|
1400 int v52; // esi@70
|
|
1401 Texture *v53; // ST1C_4@70
|
|
1402 int v54; // edi@70
|
|
1403 signed int v55; // ecx@73
|
|
1404 SHORT v56; // di@82
|
|
1405 bool v57; // eax@82
|
|
1406 const char *v58; // ecx@84
|
|
1407 POINT *v59; // esi@89
|
|
1408 LONG v60; // ecx@90
|
|
1409 int v61; // eax@90
|
|
1410 int v62; // ecx@90
|
|
1411 ItemGen *v63; // esi@90
|
|
1412 int v64; // eax@95
|
|
1413 int all_text_height; // esi@96
|
|
1414 char **v66; // edi@96
|
|
1415 int v67; // eax@97
|
|
1416 int v69; // edx@98
|
|
1417 int v70; // edi@98
|
634
|
1418 int v71;
|
629
|
1419 const char **v72; // eax@100
|
|
1420 int pTextHeight; // eax@100
|
|
1421 unsigned int v74; // ecx@100
|
|
1422 int v78; // [sp-14h] [bp-10Ch]@14
|
|
1423 ItemGen *v79; // [sp-10h] [bp-108h]@12
|
|
1424 int v80; // [sp-10h] [bp-108h]@14
|
|
1425 void *v81; // [sp-Ch] [bp-104h]@12
|
|
1426 unsigned __int16 v82; // [sp-Ch] [bp-104h]@14
|
|
1427 int v83; // [sp-8h] [bp-100h]@11
|
|
1428 char *v84; // [sp-8h] [bp-100h]@14
|
|
1429 __int64 *v85; // [sp-4h] [bp-FCh]@11
|
|
1430 unsigned int v86; // [sp-4h] [bp-FCh]@14
|
|
1431 POINT v87; // [sp+Ch] [bp-ECh]@8
|
|
1432 POINT v88; // [sp+14h] [bp-E4h]@18
|
|
1433 POINT v89; // [sp+1Ch] [bp-DCh]@89
|
|
1434 POINT v90; // [sp+24h] [bp-D4h]@19
|
|
1435 POINT v91; // [sp+2Ch] [bp-CCh]@89
|
|
1436 POINT v92; // [sp+34h] [bp-C4h]@9
|
|
1437 POINT v93; // [sp+3Ch] [bp-BCh]@33
|
|
1438 POINT v94; // [sp+44h] [bp-B4h]@18
|
|
1439 POINT v95; // [sp+4Ch] [bp-ACh]@32
|
|
1440 POINT v96; // [sp+54h] [bp-A4h]@18
|
|
1441 POINT v97; // [sp+5Ch] [bp-9Ch]@32
|
|
1442 POINT a2; // [sp+64h] [bp-94h]@8
|
|
1443 POINT v99; // [sp+6Ch] [bp-8Ch]@32
|
|
1444 POINT v100; // [sp+74h] [bp-84h]@8
|
|
1445 GUIWindow dialog_window; // [sp+7Ch] [bp-7Ch]@1
|
|
1446 char *Str; // [sp+D0h] [bp-28h]@55
|
|
1447 __int32 v103; // [sp+D4h] [bp-24h]@25
|
644
|
1448 int pColorYellow; // [sp+D8h] [bp-20h]@1
|
629
|
1449 int pColorWhite; // [sp+DCh] [bp-1Ch]@1
|
|
1450 POINT v106; // [sp+E0h] [bp-18h]@8
|
|
1451 Player *pPlayer; // [sp+E8h] [bp-10h]@1
|
|
1452 int pItemNum; // [sp+ECh] [bp-Ch]@26
|
|
1453 const char **v109; // [sp+F0h] [bp-8h]@26
|
|
1454 unsigned __int8 v110; // [sp+F7h] [bp-1h]@16
|
|
1455 int pNumString;
|
|
1456
|
|
1457 pPlayer = pPlayers[uActiveCharacter];
|
|
1458 memcpy(&dialog_window, window_SpeakInHouse, sizeof(dialog_window));
|
|
1459 dialog_window.uFrameX = 483;
|
|
1460 dialog_window.uFrameWidth = 148;
|
|
1461 dialog_window.uFrameZ = 334;
|
|
1462 pColorWhite = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu);
|
644
|
1463 pColorYellow = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xCDu, 0x23u);
|
629
|
1464 switch(dialog_menu_id)
|
|
1465 {
|
|
1466 case DIALOG_SHOP_MAIN:
|
|
1467 {
|
|
1468 pNumActiveItem = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win();
|
|
1469 if ( pNumActiveItem )
|
|
1470 {
|
|
1471 pShopOptions[0] = pGlobalTXT_LocalizationStrings[134];
|
|
1472 pShopOptions[1] = pGlobalTXT_LocalizationStrings[152];
|
|
1473 pShopOptions[2] = pGlobalTXT_LocalizationStrings[159];
|
|
1474 pShopOptions[3] = pGlobalTXT_LocalizationStrings[160];
|
|
1475 all_text_height = 0;
|
|
1476 for (int i = 0; i < 4; ++i)//while ( (signed int)v15 < (signed int)&unk_F8B1C8 );
|
|
1477 all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0);
|
|
1478 v103 = (174 - all_text_height) / 4;
|
|
1479 pNumActiveItem = pDialogueWindow->pStartingPosActiveItem;
|
|
1480 v19 = (174 - 4 * (174 - all_text_height) / 4 - all_text_height) / 2 - (174 - all_text_height) / 4 / 2 + 138;
|
|
1481 v20 = -pDialogueWindow->pNumPresenceButton < 0;
|
644
|
1482 if ( v20 ^ pNumActiveItem > pNumActiveItem + pDialogueWindow->pNumPresenceButton )
|
629
|
1483 {
|
|
1484 pItemNum = 2;
|
|
1485 pNumString = 0;
|
|
1486 do
|
|
1487 {
|
|
1488 pButton = pDialogueWindow->GetControl(pItemNum);
|
|
1489 pButton->uY = v103 + v19;
|
|
1490 pTextHeight = pFontArrus->CalcTextHeight((const char *)pShopOptions[pNumString], &dialog_window, 0, 0);
|
|
1491 pButton->uHeight = pTextHeight;
|
|
1492 v19 = pButton->uY + pTextHeight - 1;
|
|
1493 pButton->uW = v19;
|
644
|
1494 pColorText = pColorYellow;
|
629
|
1495 if ( pDialogueWindow->pCurrentPosActiveItem != pItemNum )
|
644
|
1496 pColorText = pColorWhite;
|
|
1497 dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, (const char *)pShopOptions[pNumString], 3);
|
629
|
1498 ++pItemNum;
|
|
1499 ++pNumString;
|
|
1500 pNumActiveItem = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem;
|
|
1501 }
|
|
1502 while ( pItemNum < pNumActiveItem );
|
|
1503 }
|
|
1504 }
|
|
1505 break;
|
|
1506 }
|
|
1507 case DIALOG_SHOP_BUY_STANDART:
|
|
1508 {
|
|
1509 pRenderer->DrawTextureIndexed(8, 8, ShopTexture);
|
|
1510 v48 = 0;
|
|
1511 pItemNum = 0;
|
|
1512 v109 = 0;
|
|
1513 do
|
|
1514 {
|
|
1515 // if ( pParty->field_777C[9 * (int)&v48[3 * (unsigned int)window_SpeakInHouse->ptr_1C]] )
|
668
|
1516 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][(int)v48].uItemID)
|
629
|
1517 {
|
|
1518 v49 = word_F8B158[(signed int)v48];
|
|
1519 v50 = ItemsInShopTexture[(signed int)v48];
|
|
1520 v49 += 30;
|
|
1521 v51 = 60 - ((signed int)v50->uTextureWidth >> 1);
|
|
1522 pRenderer->DrawTextureTransparent(v51 + pItemNum, v49, v50);
|
|
1523 sub_40F92A(&pRenderer->pActiveZBuffer[v51 + pItemNum + 640 * v49], ItemsInShopTexture[(signed int)v109], (int)((char *)v109 + 1));
|
|
1524 v48 = v109;
|
|
1525 }
|
|
1526 pItemNum += 70;
|
|
1527 v48 = (const char **)((char *)v48 + 1);
|
|
1528 v109 = v48;
|
|
1529 }
|
|
1530 while ( (signed int)v48 < 6 );
|
|
1531 pNumActiveItem = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win();
|
|
1532 if ( pNumActiveItem )
|
|
1533 {
|
|
1534 v55 = 0;
|
|
1535 v106.x = 0;
|
|
1536 v106.x = 0;
|
|
1537 do
|
|
1538 {
|
|
1539 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v55].uItemID);//9 * (v55 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] )
|
|
1540 ++v106.x;
|
|
1541 ++v55;
|
|
1542 }
|
|
1543 while ( v55 < 6 );
|
|
1544 v56 = GetAsyncKeyState(17);
|
|
1545 v57 = pPlayer->CanSteal();
|
|
1546 Str = (char *)v57;
|
|
1547 if ( v56 && v57 )
|
|
1548 {
|
|
1549 v58 = pGlobalTXT_LocalizationStrings[185];
|
|
1550 }
|
|
1551 else
|
|
1552 {
|
|
1553 v58 = pGlobalTXT_LocalizationStrings[195];
|
|
1554 if ( dialog_menu_id != 2 )
|
|
1555 v58 = pGlobalTXT_LocalizationStrings[196];
|
|
1556 }
|
|
1557 DrawTextAtStatusBar(v58, 0);
|
|
1558 if ( v106.x )
|
|
1559 {
|
|
1560 v59 = pMouse->GetCursorPos(&v91);
|
|
1561 pNumActiveItem = v59->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v89)->y];
|
|
1562 if ( pRenderer->pActiveZBuffer[pNumActiveItem] & 0xFFFF )
|
|
1563 {
|
|
1564 v60 = (pRenderer->pActiveZBuffer[pNumActiveItem] & 0xFFFF) - 1;
|
|
1565 v106.x = v60;
|
|
1566 v61 = (int)window_SpeakInHouse->ptr_1C;
|
|
1567 // v62 = 9 * (v60 + 12 * v61);
|
|
1568 v63 = (ItemGen *)&pParty->StandartItemsInShops[(int)v61][v60];
|
|
1569 if ( dialog_menu_id != 2 )
|
|
1570 v63 = &pParty->SpecialItemsInShops[(int)v61][v60];//v63 = (ItemGen *)&pParty->field_C59C[v62 + 724];
|
|
1571 if ( !v56 || !Str )
|
|
1572 {
|
|
1573 v64 = pPlayer->_490EEE(v63, 1, v61, 2);
|
|
1574 v7 = BuilDialogueString((char *)pMerchantsBuyPhrases[v64], uActiveCharacter - 1, v63, (char *)window_SpeakInHouse->ptr_1C, 2, 0);
|
634
|
1575 pTextHeight = pFontArrus->CalcTextHeight(v7, &dialog_window, 0, 0);
|
|
1576 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, pColorWhite, v7, 3);
|
629
|
1577 }
|
|
1578 else
|
|
1579 {
|
|
1580 v7 = BuilDialogueString(pGlobalTXT_LocalizationStrings[181], uActiveCharacter - 1, v63, (char *)window_SpeakInHouse->ptr_1C, 2, 0);
|
634
|
1581 pTextHeight = pFontArrus->CalcTextHeight(v7, &dialog_window, 0, 0);
|
|
1582 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, pColorWhite, v7, 3);
|
629
|
1583 }
|
|
1584 }
|
|
1585 }
|
|
1586 else
|
|
1587 {
|
|
1588 dialog_window.DrawCurrentTime( pParty->field_3C.field_50[(unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed);
|
|
1589 pNumActiveItem = 0; //added
|
|
1590 }
|
|
1591 }
|
|
1592 break;
|
|
1593 }
|
|
1594 case DIALOG_SHOP_SELL:
|
|
1595 {
|
|
1596 draw_leather();
|
|
1597 CharacterUI_InventoryTab_Draw(uActiveCharacter, 1);
|
|
1598 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[199], 0);
|
|
1599 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
|
|
1600 return;
|
|
1601 if((v11 = pMouse->GetCursorPos(&v96)->x - 14, v106.x = (v11 >> 5) + 14 * ((pMouse->GetCursorPos(&v88)->y - 17) >> 5),
|
|
1602 pMouse->GetCursorPos(&v94)->x <= 13) || pMouse->GetCursorPos(&v90)->x >= 462
|
634
|
1603 || (pNumActiveItem = pPlayer->GetItemIDAtInventoryIndex((int *)&v106.x), !pNumActiveItem) )
|
629
|
1604 return;
|
|
1605 v79 = (ItemGen *)&pPlayer->pInventoryItems[pNumActiveItem - 1];
|
|
1606 v13 = pPlayer->_490EEE(v79, 1, (int)window_SpeakInHouse->ptr_1C, 3);
|
|
1607 v7 = BuilDialogueString((char *)pMerchantsSellPhrases[v13], uActiveCharacter - 1, v79, (char *)window_SpeakInHouse->ptr_1C, 3, 0);
|
634
|
1608 pTextHeight = pFontArrus->CalcTextHeight(v7, &dialog_window, 0, 0);
|
|
1609 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, pColorWhite, v7, 3);
|
629
|
1610 break;
|
|
1611 }
|
|
1612 case DIALOG_SHOP_IDENTIFY:
|
|
1613 {
|
|
1614 draw_leather();
|
|
1615 CharacterUI_InventoryTab_Draw(uActiveCharacter, 1);
|
|
1616 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[197], 0);
|
|
1617 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
|
|
1618 return;
|
|
1619 if((v2 = pMouse->GetCursorPos(&a2)->x - 14, v106.x = (v2 >> 5) + 14 * ((pMouse->GetCursorPos(&v87)->y - 17) >> 5),
|
|
1620 pMouse->GetCursorPos(&v100)->x <= 13) || pMouse->GetCursorPos(&v92)->x >= 462
|
634
|
1621 || (pNumActiveItem = pPlayer->GetItemIDAtInventoryIndex((int *)&v106.x), !pNumActiveItem) )
|
629
|
1622 return;
|
|
1623 v4 = (ItemGen *)&pPlayer->pInventoryItems[pNumActiveItem - 1];
|
|
1624 if (!v4->Identified())
|
|
1625 {
|
|
1626 v10 = pPlayer->_490EEE(v4, 1, (int)window_SpeakInHouse->ptr_1C, 4);
|
|
1627 v7 = BuilDialogueString((char *)pMerchantsIdentifyPhrases[v10], uActiveCharacter - 1, v4, (char *)window_SpeakInHouse->ptr_1C, 4, 0);
|
634
|
1628 pTextHeight = pFontArrus->CalcTextHeight(v7, &dialog_window, 0, 0);
|
|
1629 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, pColorWhite, v7, 3);
|
629
|
1630 }
|
634
|
1631 else
|
|
1632 {
|
|
1633 v7 = BuilDialogueString("%24", uActiveCharacter - 1, v4, (char *)window_SpeakInHouse->ptr_1C, 4, 0);
|
|
1634 pTextHeight = pFontArrus->CalcTextHeight(v7, &dialog_window, 0, 0);
|
|
1635 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, pColorWhite, v7, 3);
|
|
1636 }
|
629
|
1637 break;
|
|
1638 }
|
|
1639 case DIALOG_SHOP_REPAIR:
|
|
1640 {
|
|
1641 draw_leather();
|
|
1642 CharacterUI_InventoryTab_Draw(uActiveCharacter, 1);
|
|
1643 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[198], 0);
|
|
1644 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win())
|
|
1645 return;
|
|
1646 if( (v2 = pMouse->GetCursorPos(&a2)->x - 14, v106.x = (v2 >> 5) + 14 * ((pMouse->GetCursorPos(&v87)->y - 17) >> 5),
|
|
1647 pMouse->GetCursorPos(&v100)->x <= 13) || pMouse->GetCursorPos(&v92)->x >= 462
|
634
|
1648 || (pNumActiveItem = pPlayer->GetItemIDAtInventoryIndex((int *)&v106.x), !pNumActiveItem)
|
629
|
1649 || (pNumActiveItem = 9 * pNumActiveItem, !(pPlayer->field_1F5[4 * pNumActiveItem + 15] & 2)) )
|
|
1650 return;
|
|
1651 v4 = (ItemGen *)&pPlayer->pInventoryItems[pNumActiveItem - 1];
|
|
1652 v10 = pPlayer->_490EEE(v4, 2, (int)window_SpeakInHouse->ptr_1C, 5);
|
|
1653 v7 = BuilDialogueString((char *)pMerchantsRepairPhrases[v10], uActiveCharacter - 1, v4, (char *)window_SpeakInHouse->ptr_1C, 5, 0);
|
|
1654 pTextHeight = (174 - pFontArrus->CalcTextHeight(v7, &dialog_window, 0, 0)) / 2 + 138;
|
|
1655 dialog_window.DrawTitleText(pFontArrus, 0, pTextHeight, pColorWhite, v7, 3);
|
|
1656 return;
|
|
1657 }
|
|
1658 break;
|
|
1659 case DIALOG_SHOP_DISPLAY_EQUIPMENT:
|
|
1660 {
|
|
1661 draw_leather();
|
|
1662 CharacterUI_InventoryTab_Draw(uActiveCharacter, 1);
|
|
1663 pShopOptions[0] = pGlobalTXT_LocalizationStrings[200];//sell
|
|
1664 pShopOptions[1] = pGlobalTXT_LocalizationStrings[113];//identify
|
|
1665 pShopOptions[2] = pGlobalTXT_LocalizationStrings[179];//repair
|
|
1666 all_text_height = 0;
|
|
1667 for ( int i = 0; i < 3; ++i )
|
|
1668 all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0);
|
|
1669 v103 = (174 - all_text_height) / 3;
|
|
1670 pNumActiveItem = pDialogueWindow->pStartingPosActiveItem;
|
|
1671 v70 = (3 * (58 - (signed int)v103) - all_text_height) / 2 - ((174 - all_text_height) / 3) / 2 + 138;
|
|
1672 v20 = -pDialogueWindow->pNumPresenceButton < 0;
|
644
|
1673 if ( v20 ^ pNumActiveItem > pNumActiveItem + pDialogueWindow->pNumPresenceButton )
|
629
|
1674 {
|
|
1675 pItemNum = 2;
|
|
1676 pNumString = 0;
|
|
1677 do
|
|
1678 {
|
|
1679 pButton = pDialogueWindow->GetControl(pItemNum);
|
|
1680 pButton->uY = v103 + v70;
|
|
1681 pTextHeight = pFontArrus->CalcTextHeight((const char *)pShopOptions[pNumString], &dialog_window, 0, 0);
|
|
1682 pButton->uHeight = pTextHeight;
|
|
1683 v70 = pButton->uY + pTextHeight - 1;
|
|
1684 pButton->uW = v70;
|
644
|
1685 pColorText = pColorYellow;
|
629
|
1686 if ( pDialogueWindow->pCurrentPosActiveItem != pItemNum )
|
644
|
1687 pColorText = pColorWhite;
|
|
1688 dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, (const char *)pShopOptions[pNumString], 3);
|
629
|
1689 ++pItemNum;
|
|
1690 ++pNumString;
|
|
1691 pNumActiveItem = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem;
|
|
1692 }
|
|
1693 while ( pItemNum < pNumActiveItem );
|
|
1694 }
|
|
1695 break;
|
|
1696 }
|
|
1697 case DIALOG_SHOP_BUY_SPECIAL:
|
|
1698 {
|
|
1699 pRenderer->DrawTextureIndexed(8, 8, ShopTexture);
|
|
1700 v109 = 0;
|
|
1701 pItemNum = 0;
|
|
1702 do
|
|
1703 {
|
|
1704 // if ( pParty->field_C59C[9 * (int)&v109[3 * (unsigned int)window_SpeakInHouse->ptr_1C] + 724] )
|
|
1705 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][(signed int)v109].uItemID)
|
|
1706 {
|
|
1707 v52 = word_F8B158[(signed int)v109] + 30;
|
|
1708 v53 = ItemsInShopTexture[(signed int)v109];
|
|
1709 v54 = 60 - ((signed int)v53->uTextureWidth >> 1);
|
|
1710 pRenderer->DrawTextureTransparent(v54 + pItemNum, word_F8B158[(signed int)v109] + 30, v53);
|
|
1711 sub_40F92A(&pRenderer->pActiveZBuffer[v54 + pItemNum + 640 * v52], ItemsInShopTexture[(signed int)v109], (int)((char *)v109 + 1));
|
|
1712 }
|
|
1713 v109 = (const char **)((char *)v109 + 1);
|
|
1714 pItemNum += 70;
|
|
1715 }
|
|
1716 while ( (signed int)v109 < 6 );
|
|
1717 pNumActiveItem = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win();
|
|
1718 if ( pNumActiveItem )
|
|
1719 {
|
|
1720 v55 = 0;
|
|
1721 v106.x = 0;
|
|
1722 do
|
|
1723 {
|
|
1724 // if ( pParty->field_C59C[9 * (v55 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] )
|
|
1725 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v55].uItemID)
|
|
1726 ++v106.x;
|
|
1727 ++v55;
|
|
1728 }
|
|
1729 while ( v55 < 6 );
|
|
1730 v56 = GetAsyncKeyState(17);
|
|
1731 v57 = pPlayer->CanSteal();
|
|
1732 Str = (char *)v57;
|
|
1733 if ( v56 && v57 )
|
|
1734 {
|
|
1735 v58 = pGlobalTXT_LocalizationStrings[185];
|
|
1736 }
|
|
1737 else
|
|
1738 {
|
|
1739 v58 = pGlobalTXT_LocalizationStrings[195];
|
|
1740 if ( dialog_menu_id != 2 )
|
|
1741 v58 = pGlobalTXT_LocalizationStrings[196];
|
|
1742 }
|
|
1743 DrawTextAtStatusBar(v58, 0);
|
|
1744 if ( v106.x )
|
|
1745 {
|
|
1746 v59 = pMouse->GetCursorPos(&v91);
|
|
1747 pNumActiveItem = v59->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v89)->y];
|
|
1748 if ( pRenderer->pActiveZBuffer[pNumActiveItem] & 0xFFFF )
|
|
1749 {
|
|
1750 v60 = (pRenderer->pActiveZBuffer[pNumActiveItem] & 0xFFFF) - 1;
|
|
1751 v106.x = v60;
|
|
1752 v61 = (int)window_SpeakInHouse->ptr_1C;
|
|
1753 // v62 = 9 * (v60 + 12 * v61);
|
|
1754 v63 = (ItemGen *)&pParty->StandartItemsInShops[(int)v61][v60];
|
|
1755 if ( dialog_menu_id != 2 )
|
|
1756 v63 = &pParty->SpecialItemsInShops[(int)v61][v60];//v63 = (ItemGen *)&pParty->field_C59C[v62 + 724];
|
|
1757 if ( !v56 || !Str )
|
|
1758 {
|
|
1759 v64 = pPlayer->_490EEE(v63, 1, v61, 2);
|
|
1760 v7 = BuilDialogueString((char *)pMerchantsBuyPhrases[v64], uActiveCharacter - 1, v63, (char *)window_SpeakInHouse->ptr_1C, 2, 0);
|
634
|
1761 pTextHeight = pFontArrus->CalcTextHeight(v7, &dialog_window, 0, 0);
|
|
1762 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, pColorWhite, v7, 3);
|
629
|
1763 }
|
|
1764 else
|
|
1765 {
|
|
1766 v7 = BuilDialogueString(pGlobalTXT_LocalizationStrings[181], uActiveCharacter - 1, v63, (char *)window_SpeakInHouse->ptr_1C, 2, 0);
|
634
|
1767 pTextHeight = pFontArrus->CalcTextHeight(v7, &dialog_window, 0, 0);
|
|
1768 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, pColorWhite, v7, 3);
|
629
|
1769 }
|
|
1770 }
|
|
1771 }
|
|
1772 else
|
|
1773 {
|
|
1774 dialog_window.DrawCurrentTime( pParty->field_3C.field_50[(unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed);
|
|
1775 pNumActiveItem = 0; //added
|
|
1776 }
|
|
1777 }
|
|
1778 break;
|
|
1779 }
|
|
1780 case DIALOG_SHOP_SKILLS:
|
|
1781 {
|
634
|
1782 if (!sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win())
|
|
1783 return;
|
|
1784 v0 = 0;
|
|
1785 all_text_height = 0;
|
|
1786 //v32 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (signed int)v31] * 500.0);
|
|
1787 v32 = (signed __int64)(p2DEvents[(signed int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0);
|
|
1788 pItemNum = v32 * (100 - pPlayer->GetMerchant()) / 100;
|
|
1789 if ( pItemNum < v32 / 3 )
|
|
1790 pItemNum = v32 / 3;
|
|
1791 pNumActiveItem = pDialogueWindow->pStartingPosActiveItem;
|
|
1792 if ( pNumActiveItem >= pNumActiveItem + pDialogueWindow->pNumPresenceButton )
|
|
1793 {
|
|
1794 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], pPlayer->pName, pClassNames[pPlayer->classType]);
|
|
1795 strcat(pTmpBuf, "\n \n");
|
|
1796 strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]);
|
|
1797 pTextHeight = pFontArrus->CalcTextHeight(pTmpBuf, &dialog_window, 0, 0);
|
644
|
1798 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, pColorYellow, pTmpBuf, 3);
|
634
|
1799 return;
|
|
1800 }
|
|
1801 do
|
629
|
1802 {
|
634
|
1803 v35 = pDialogueWindow->GetControl(pNumActiveItem)->uControlParam - 36;
|
|
1804 if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayer->classType][v35] && !pPlayer->pActiveSkills[v35] )
|
629
|
1805 {
|
634
|
1806 all_text_height += pFontArrus->CalcTextHeight(pSkillNames[v35], &dialog_window, 0, 0);
|
|
1807 v0++;
|
629
|
1808 }
|
634
|
1809 ++pNumActiveItem;
|
|
1810 }
|
|
1811 while ( pNumActiveItem < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem );
|
|
1812 if ( !v0 )
|
|
1813 {
|
|
1814 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], pPlayer->pName, pClassNames[pPlayer->classType]);
|
|
1815 strcat(pTmpBuf, "\n \n");
|
|
1816 strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]);
|
|
1817 pTextHeight = pFontArrus->CalcTextHeight(pTmpBuf, &dialog_window, 0, 0);
|
644
|
1818 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, pColorYellow, pTmpBuf, 3);
|
634
|
1819 return;
|
|
1820 }
|
|
1821 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], pItemNum);
|
|
1822 dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3);
|
|
1823 v103 = (149 - all_text_height) / v0;
|
|
1824 if ( (149 - all_text_height) / v0 > 32 )
|
|
1825 v103 = 32;
|
|
1826 pNumActiveItem = pDialogueWindow->pStartingPosActiveItem;
|
|
1827 v37 = (149 - v0 * v103 - all_text_height) / 2 - v103 / 2 + 162;
|
|
1828 if ( pNumActiveItem < pNumActiveItem + pDialogueWindow->pNumPresenceButton )
|
|
1829 {
|
|
1830 pItemNum = 2;
|
629
|
1831 do
|
|
1832 {
|
634
|
1833 pButton = pDialogueWindow->GetControl(pItemNum);
|
|
1834 v40 = pButton->uControlParam - 36;
|
|
1835 if ( !byte_4ED970_skill_learn_ability_by_class_table[pPlayer->classType][v40] || pPlayer->pActiveSkills[v40] )
|
629
|
1836 {
|
634
|
1837 pButton->uW = 0;
|
|
1838 pButton->uHeight = 0;
|
|
1839 pButton->uY = 0;
|
629
|
1840 }
|
634
|
1841 else
|
|
1842 {
|
|
1843 pButton->uY = v103 + v37;
|
|
1844 pTextHeight = pFontArrus->CalcTextHeight(pSkillNames[v40], &dialog_window, 0, 0);
|
|
1845 pButton->uHeight = pTextHeight;
|
|
1846 v37 = pButton->uY + pTextHeight - 1;
|
|
1847 pButton->uW = v37;
|
644
|
1848 pColorText = pColorYellow;
|
634
|
1849 if ( pDialogueWindow->pCurrentPosActiveItem != pItemNum )
|
644
|
1850 pColorText = pColorWhite;
|
|
1851 dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, pSkillNames[v40], 3);
|
634
|
1852 }
|
|
1853 pNumActiveItem = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem;
|
|
1854 pItemNum++;
|
629
|
1855 }
|
634
|
1856 while ( pItemNum < pNumActiveItem );
|
629
|
1857 }
|
|
1858 break;
|
|
1859 }
|
|
1860 default:
|
|
1861 {
|
|
1862 if( dialog_menu_id > 5 )
|
|
1863 pNumActiveItem = dialog_menu_id - 96;
|
|
1864 else
|
|
1865 pNumActiveItem = dialog_menu_id - 4;
|
|
1866 break;
|
|
1867 }
|
|
1868 }
|
|
1869 }
|
|
1870
|
|
1871
|
|
1872
|
|
1873 //----- (004B9CC6) --------------------------------------------------------
|
|
1874 void __cdecl AlchemistDialog()
|
|
1875 {
|
634
|
1876 int v0;
|
|
1877 int pNumActiveItem; // eax@7
|
629
|
1878 signed int v5; // esi@9
|
|
1879 unsigned int v6; // esi@11
|
|
1880 int v7; // eax@11
|
|
1881 unsigned int v8; // eax@12
|
|
1882 int v9; // eax@14
|
|
1883 int v10; // ecx@19
|
|
1884 int v13; // eax@21
|
|
1885 char *v14; // eax@23
|
|
1886 int v15; // eax@23
|
|
1887 unsigned int v16; // ecx@23
|
|
1888 int v17; // edx@23
|
|
1889 int v18; // eax@23
|
|
1890 int v20; // eax@27
|
|
1891 char *v21; // edx@29
|
|
1892 int v22; // esi@30
|
|
1893 char **v23; // edi@30
|
|
1894 int v24; // eax@31
|
|
1895 int v26; // edx@32
|
|
1896 int v27; // edi@32
|
|
1897 unsigned __int8 v28; // sf@32
|
|
1898 const char **v30; // eax@34
|
|
1899 int v31; // eax@34
|
|
1900 unsigned int v32; // ecx@34
|
|
1901 int v34; // eax@34
|
|
1902 signed int v36; // esi@39
|
|
1903 ItemGen *v37; // eax@42
|
|
1904 char *v38; // ecx@43
|
|
1905 unsigned __int8 v39; // dl@44
|
|
1906 int v40; // eax@46
|
|
1907 int v41; // ST08_4@47
|
|
1908 int v42; // eax@47
|
|
1909 signed int v43; // esi@49
|
|
1910 int v44; // ST08_4@52
|
|
1911 int v45; // eax@52
|
|
1912 Texture *v46; // ecx@55
|
|
1913 unsigned int v47; // edi@55
|
|
1914 unsigned int v48; // esi@57
|
|
1915 int v49; // edx@61
|
|
1916 Texture *v50; // ecx@67
|
|
1917 unsigned int v51; // edi@67
|
|
1918 unsigned int v52; // esi@69
|
|
1919 int v53; // edx@73
|
|
1920 Texture *v54; // ecx@79
|
|
1921 unsigned int v55; // edi@79
|
|
1922 unsigned int v56; // esi@81
|
|
1923 int v57; // edx@85
|
|
1924 Texture *v58; // ecx@91
|
|
1925 unsigned int v59; // edi@91
|
|
1926 unsigned int v60; // esi@93
|
|
1927 int v61; // edx@97
|
|
1928 signed int v62; // ecx@102
|
|
1929 SHORT v63; // di@110
|
|
1930 bool v64; // eax@110
|
|
1931 const char *v65; // ecx@112
|
|
1932 POINT *v66; // esi@117
|
|
1933 int v67; // ecx@118
|
|
1934 int v68; // eax@118
|
|
1935 int v69; // ecx@118
|
|
1936 ItemGen *v70; // esi@118
|
|
1937 int v71; // eax@123
|
634
|
1938 int all_text_height; // edi@125
|
629
|
1939 char **v73; // esi@125
|
|
1940 int v74; // eax@126
|
634
|
1941 int pItemNum;
|
629
|
1942 int v76; // edx@127
|
|
1943 int v77; // edi@127
|
634
|
1944 GUIButton *pButton; // esi@129
|
629
|
1945 const char **v79; // eax@129
|
634
|
1946 int pTextHeight; // eax@129
|
629
|
1947 unsigned int v81; // ecx@129
|
644
|
1948 unsigned int pColorText; // ax@129
|
629
|
1949 int v85; // [sp-14h] [bp-ECh]@29
|
|
1950 int v86; // [sp-10h] [bp-E8h]@29
|
|
1951 ItemGen *v87; // [sp-10h] [bp-E8h]@43
|
|
1952 unsigned __int16 v88; // [sp-Ch] [bp-E4h]@29
|
|
1953 void *v89; // [sp-Ch] [bp-E4h]@43
|
|
1954 char *v90; // [sp-8h] [bp-E0h]@29
|
|
1955 int v91; // [sp-8h] [bp-E0h]@42
|
|
1956 unsigned int v92; // [sp-4h] [bp-DCh]@29
|
|
1957 __int64 *v93; // [sp-4h] [bp-DCh]@42
|
|
1958 POINT v94; // [sp+Ch] [bp-CCh]@39
|
|
1959 POINT v95; // [sp+14h] [bp-C4h]@49
|
|
1960 POINT v96; // [sp+1Ch] [bp-BCh]@117
|
|
1961 POINT v97; // [sp+24h] [bp-B4h]@40
|
|
1962 POINT v98; // [sp+2Ch] [bp-ACh]@117
|
|
1963 POINT v99; // [sp+34h] [bp-A4h]@49
|
|
1964 POINT v100; // [sp+3Ch] [bp-9Ch]@50
|
|
1965 POINT v101; // [sp+44h] [bp-94h]@39
|
|
1966 POINT v102; // [sp+4Ch] [bp-8Ch]@49
|
|
1967 POINT a2; // [sp+54h] [bp-84h]@39
|
634
|
1968 GUIWindow dialog_window; // [sp+5Ch] [bp-7Ch]@1
|
629
|
1969 int v105; // [sp+B0h] [bp-28h]@19
|
644
|
1970 int pColorYellow; // [sp+B4h] [bp-24h]@1
|
634
|
1971 int Str; // [sp+B8h] [bp-20h]@23
|
|
1972 int pColorWhite; // [sp+BCh] [bp-1Ch]@1
|
629
|
1973 __int32 v109; // [sp+C0h] [bp-18h]@39
|
634
|
1974 Player *pPlayer; // [sp+C4h] [bp-14h]@1
|
|
1975 int pNumString; // [sp+C8h] [bp-10h]@9
|
629
|
1976 unsigned int v112; // [sp+CCh] [bp-Ch]@9
|
|
1977 unsigned __int8 v113; // [sp+D3h] [bp-5h]@47
|
|
1978 int v114; // [sp+D4h] [bp-4h]@11
|
|
1979
|
634
|
1980 pPlayer = pPlayers[uActiveCharacter];
|
|
1981 memcpy(&dialog_window, window_SpeakInHouse, sizeof(dialog_window));
|
|
1982 dialog_window.uFrameX = 483;
|
|
1983 dialog_window.uFrameWidth = 148;
|
|
1984 dialog_window.uFrameZ = 334;
|
|
1985 pColorWhite = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu);
|
644
|
1986 pColorYellow = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xCDu, 0x23u);
|
629
|
1987 switch(dialog_menu_id)
|
|
1988 {
|
634
|
1989 case DIALOG_SHOP_MAIN:
|
|
1990 {
|
|
1991 if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
|
|
1992 {
|
|
1993 pShopOptions[0] = pGlobalTXT_LocalizationStrings[134];
|
|
1994 pShopOptions[1] = pGlobalTXT_LocalizationStrings[152];
|
|
1995 pShopOptions[2] = pGlobalTXT_LocalizationStrings[159];
|
|
1996 pShopOptions[3] = pGlobalTXT_LocalizationStrings[160];
|
|
1997 all_text_height = 0;
|
|
1998 for (int i = 0; i < 4; ++i)//while ( (signed int)v15 < (signed int)&unk_F8B1C8 );
|
|
1999 all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0);
|
|
2000 Str = (174 - all_text_height) / 4;
|
|
2001 pNumActiveItem = pDialogueWindow->pStartingPosActiveItem;
|
|
2002 v76 = pNumActiveItem + pDialogueWindow->pNumPresenceButton;
|
|
2003 v77 = (174 - 4 * (174 - all_text_height) / 4 - all_text_height) / 2 - (174 - all_text_height) / 4 / 2 + 138;
|
|
2004 v28 = -pDialogueWindow->pNumPresenceButton < 0;
|
|
2005 if ( v28 ^ pNumActiveItem > v76 )
|
|
2006 {
|
|
2007 pItemNum = 2;
|
|
2008 pNumString = 0;
|
|
2009 do
|
|
2010 {
|
|
2011 pButton = pDialogueWindow->GetControl(pItemNum);
|
|
2012 pButton->uY = Str + v77;
|
|
2013 pTextHeight = pFontArrus->CalcTextHeight((const char *)pShopOptions[pNumString], &dialog_window, 0, 0);
|
|
2014 pButton->uHeight = pTextHeight;
|
|
2015 v77 = pButton->uY + pTextHeight - 1;
|
|
2016 pButton->uW = v77;
|
644
|
2017 pColorText = pColorYellow;
|
634
|
2018 if ( pDialogueWindow->pCurrentPosActiveItem != pItemNum )
|
644
|
2019 pColorText = pColorWhite;
|
|
2020 dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, (const char *)pShopOptions[pNumString], 3);
|
634
|
2021 ++pItemNum;
|
|
2022 ++pNumString;
|
|
2023 pNumActiveItem = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem;
|
|
2024 }
|
|
2025 while ( pItemNum < pNumActiveItem );
|
|
2026 }
|
|
2027 }
|
|
2028 return;
|
|
2029 }
|
|
2030 case DIALOG_SHOP_BUY_STANDART:
|
|
2031 {
|
|
2032 pRenderer->DrawTextureIndexed(8, 8, ShopTexture);
|
|
2033 v114 = 0;
|
|
2034 do
|
|
2035 {
|
|
2036 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v114].uItemID);
|
629
|
2037 {
|
634
|
2038 v46 = ItemsInShopTexture[v114];
|
|
2039 v47 = 152 - v46->uTextureHeight;
|
|
2040 if ( (signed int)v47 < 1 )
|
|
2041 v47 = 0;
|
|
2042 v48 = 75 * v114 - v46->uTextureWidth / 2 + 40;
|
|
2043 if ( v114 )
|
|
2044 {
|
|
2045 if ( v114 == 5 )
|
|
2046 {
|
|
2047 v49 = ItemsInShopTexture[5]->uTextureWidth;
|
|
2048 if ( (signed int)v48 > 457 - v49 )
|
|
2049 v48 = 457 - v49;
|
|
2050 }
|
|
2051 }
|
|
2052 else if ( (signed int)v48 < 18 )
|
|
2053 v48 = 18;
|
|
2054 pRenderer->DrawTextureTransparent(v48, v47, v46);
|
|
2055 sub_40F92A(&pRenderer->pActiveZBuffer[v48 + 640 * v47], ItemsInShopTexture[v114], v114 + 1);
|
629
|
2056 }
|
634
|
2057 ++v114;
|
|
2058 }
|
|
2059 while ( v114 < 6 );
|
|
2060 v114 = 0;
|
|
2061 do
|
|
2062 {
|
|
2063 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v114+1].uItemID);
|
|
2064 {
|
|
2065 v50 = ItemsInShopTexture[v114 + 6];
|
|
2066 v51 = 308 - v50->uTextureHeight;
|
|
2067 if ( (signed int)v51 < 1 )
|
|
2068 v51 = 0;
|
|
2069 v52 = 75 * v114 - v50->uTextureWidth / 2 + 40;
|
|
2070 if ( v114 )
|
|
2071 {
|
|
2072 if ( v114 == 5 )
|
|
2073 {
|
|
2074 v53 = ItemsInShopTexture[11]->uTextureWidth;
|
|
2075 if ( (signed int)v52 > 457 - v53 )
|
|
2076 v52 = 457 - v53;
|
|
2077 }
|
|
2078 }
|
|
2079 else
|
|
2080 {
|
|
2081 if ( (signed int)v52 < 18 )
|
|
2082 v52 = 18;
|
|
2083 }
|
|
2084 pRenderer->DrawTextureTransparent(v52, v51, v50);
|
|
2085 sub_40F92A(&pRenderer->pActiveZBuffer[v52 + 640 * v51], ItemsInShopTexture[v114 + 6], v114 + 7);
|
|
2086 }
|
|
2087 ++v114;
|
|
2088 }
|
|
2089 while ( v114 < 6 );
|
|
2090 if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
|
|
2091 {
|
|
2092 v62 = 0;
|
|
2093 v109 = 0;
|
629
|
2094 do
|
|
2095 {
|
634
|
2096 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v62].uItemID);
|
|
2097 ++v109;
|
|
2098 ++v62;
|
|
2099 }
|
|
2100 while ( v62 < 12 );
|
|
2101 v63 = GetAsyncKeyState(17);
|
|
2102 v64 = pPlayer->CanSteal();
|
|
2103 Str = v64;
|
|
2104 if ( v63 && v64 )
|
|
2105 {
|
|
2106 v65 = pGlobalTXT_LocalizationStrings[185];
|
|
2107 }
|
|
2108 else if ( dialog_menu_id == 2 )
|
|
2109 {
|
|
2110 v65 = pGlobalTXT_LocalizationStrings[195];
|
|
2111 }
|
|
2112 else
|
|
2113 {
|
|
2114 v65 = pGlobalTXT_LocalizationStrings[196];
|
|
2115 }
|
|
2116 DrawTextAtStatusBar(v65, 0);
|
|
2117 if ( !v109 )
|
|
2118 {
|
|
2119 dialog_window.DrawCurrentTime( pParty->field_3C.field_50[ (unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed);
|
|
2120 return;
|
|
2121 }
|
|
2122 v66 = pMouse->GetCursorPos(&v98);
|
|
2123 pNumActiveItem = v66->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v96)->y];
|
|
2124 if ( pRenderer->pActiveZBuffer[pNumActiveItem] & 0xFFFF )
|
|
2125 {
|
|
2126 v67 = (pRenderer->pActiveZBuffer[pNumActiveItem] & 0xFFFF) - 1;
|
|
2127 v70 = (ItemGen *)&pParty->StandartItemsInShops[(int)window_SpeakInHouse->ptr_1C][v67];
|
|
2128 if ( dialog_menu_id != 2 )
|
|
2129 v70 = &pParty->SpecialItemsInShops[(int)window_SpeakInHouse->ptr_1C][v67];//v70 = (ItemGen *)&pParty->field_C59C[v69 + 724];
|
|
2130 if ( !v63 || !Str )
|
|
2131 {
|
|
2132 v71 = pPlayer->_490EEE(v70, 4, (int)window_SpeakInHouse->ptr_1C, 2);
|
|
2133 v38 = (char *)pMerchantsBuyPhrases[v71];
|
|
2134 }
|
|
2135 else
|
|
2136 {
|
|
2137 v38 = pGlobalTXT_LocalizationStrings[181];
|
|
2138 }
|
|
2139 v21 = BuilDialogueString(v38, uActiveCharacter - 1, v70, (char *)window_SpeakInHouse->ptr_1C, 2, 0);
|
|
2140 v40 = pFontArrus->CalcTextHeight(v21, &dialog_window, 0, 0);
|
|
2141 dialog_window.DrawTitleText(pFontArrus, 0, (174 - v40) / 2 + 138, pColorWhite, v21, 3);
|
|
2142 return ;
|
|
2143 }
|
|
2144 }
|
|
2145 return;
|
|
2146 }
|
|
2147 case DIALOG_SHOP_SELL:
|
|
2148 {
|
|
2149 draw_leather();
|
|
2150 CharacterUI_InventoryTab_Draw(uActiveCharacter, 1);
|
|
2151 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[199], 0);
|
|
2152 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
|
|
2153 return;
|
|
2154 if ((v43 = pMouse->GetCursorPos(&v99)->x - 14, v109 = (v43 >> 5) + 14 * ((pMouse->GetCursorPos(&v95)->y - 17) >> 5),
|
|
2155 pMouse->GetCursorPos(&v102)->x <= 13) || pMouse->GetCursorPos(&v100)->x >= 462
|
|
2156 || (pNumActiveItem = pPlayer->GetItemIDAtInventoryIndex((int *)&v109), !pNumActiveItem) )
|
|
2157 return;
|
|
2158 v87 = (ItemGen *)&pPlayer->pInventoryItems[pNumActiveItem - 1];
|
|
2159 v45 = pPlayer->_490EEE(v87, 4, (int)window_SpeakInHouse->ptr_1C, 3);
|
|
2160 v21 = BuilDialogueString((char *)pMerchantsSellPhrases[v45], uActiveCharacter - 1, v87, (char *)window_SpeakInHouse->ptr_1C, 3, 0);
|
|
2161 pTextHeight = pFontArrus->CalcTextHeight(v21, &dialog_window, 0, 0);
|
|
2162 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, pColorWhite, v21, 3);
|
|
2163 return;
|
|
2164 }
|
|
2165 case DIALOG_SHOP_IDENTIFY:
|
|
2166 {
|
|
2167 draw_leather();
|
|
2168 CharacterUI_InventoryTab_Draw(uActiveCharacter, 1);
|
|
2169 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[197], 0);
|
|
2170 if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
|
|
2171 return;
|
|
2172 if ((v36 = pMouse->GetCursorPos(&a2)->x - 14, v109 = (v36 >> 5) + 14 * ((pMouse->GetCursorPos(&v94)->y - 17) >> 5),
|
|
2173 pMouse->GetCursorPos(&v101)->x <= 13) || pMouse->GetCursorPos(&v97)->x >= 462
|
|
2174 || (pNumActiveItem = pPlayer->GetItemIDAtInventoryIndex((int *)&v109), !pNumActiveItem) )
|
|
2175 return;
|
|
2176 v37 = (ItemGen *)&pPlayer->pInventoryItems[pNumActiveItem - 1];
|
|
2177 if (!v37->Identified())
|
|
2178 {
|
|
2179 v42 = pPlayer->_490EEE(v37, 4, (int)window_SpeakInHouse->ptr_1C, 4);
|
|
2180 v38 = (char *)pMerchantsIdentifyPhrases[v42];
|
|
2181 }
|
|
2182 else
|
|
2183 {
|
|
2184 v38 = "%24";
|
|
2185 }
|
|
2186 v21 = BuilDialogueString(v38, uActiveCharacter - 1, v37, (char *)window_SpeakInHouse->ptr_1C, 4, 0);
|
|
2187 v40 = pFontArrus->CalcTextHeight(v21, &dialog_window, 0, 0);
|
|
2188 dialog_window.DrawTitleText(pFontArrus, 0, (174 - v40) / 2 + 138, pColorWhite, v21, 3);
|
|
2189 return;
|
|
2190 }
|
|
2191 case DIALOG_SHOP_DISPLAY_EQUIPMENT:
|
|
2192 {
|
|
2193 draw_leather();
|
|
2194 CharacterUI_InventoryTab_Draw(uActiveCharacter, 1);
|
|
2195 pShopOptions[0] = pGlobalTXT_LocalizationStrings[200];
|
|
2196 pShopOptions[1] = pGlobalTXT_LocalizationStrings[113];
|
|
2197 all_text_height = 0;
|
|
2198 for ( int i = 0; i < 2; ++i )
|
|
2199 all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0);
|
|
2200 Str = (174 - all_text_height) / 2;
|
|
2201 pNumActiveItem = pDialogueWindow->pStartingPosActiveItem;
|
|
2202 v26 = pNumActiveItem + pDialogueWindow->pNumPresenceButton;
|
|
2203 v27 = (2 * (87 - (174 - all_text_height) / 2) - all_text_height) / 2 - (174 - all_text_height) / 2 / 2 + 138;
|
|
2204 v28 = -pDialogueWindow->pNumPresenceButton < 0;
|
|
2205 if ( v28 ^ pNumActiveItem > v26 )
|
|
2206 {
|
|
2207 pItemNum = 2;
|
|
2208 pNumString = 0;
|
|
2209 do
|
|
2210 {
|
|
2211 pButton = pDialogueWindow->GetControl(pItemNum);
|
|
2212 pButton->uY = Str + v27;
|
|
2213 pTextHeight = pFontArrus->CalcTextHeight((const char *)pShopOptions[pNumString], &dialog_window, 0, 0);
|
|
2214 pButton->uHeight = pTextHeight;
|
|
2215 v27 = pButton->uY + pTextHeight - 1;
|
|
2216 pButton->uW = v27;
|
644
|
2217 pColorText = pColorYellow;
|
634
|
2218 if ( pDialogueWindow->pCurrentPosActiveItem != pItemNum )
|
644
|
2219 pColorText = pColorWhite;
|
|
2220 dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, (const char *)pShopOptions[pNumString], 3);
|
634
|
2221 ++pItemNum;
|
|
2222 ++pNumString;
|
|
2223 pNumActiveItem = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem;
|
629
|
2224 }
|
634
|
2225 while ( pItemNum < pNumActiveItem );
|
|
2226 }
|
|
2227 return;
|
|
2228 }
|
|
2229 case DIALOG_SHOP_BUY_SPECIAL:
|
|
2230 {
|
|
2231 pRenderer->DrawTextureIndexed(8, 8, ShopTexture);
|
|
2232 v114 = 0;
|
|
2233 do
|
|
2234 {
|
|
2235 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v114].uItemID)
|
|
2236 {
|
|
2237 v54 = ItemsInShopTexture[v114];
|
|
2238 v55 = 152 - v54->uTextureHeight;
|
|
2239 if ( (signed int)v55 < 1 )
|
|
2240 v55 = 0;
|
|
2241 v56 = 75 * v114 - v54->uTextureWidth / 2 + 40;
|
|
2242 if ( v114 )
|
|
2243 {
|
|
2244 if ( v114 == 5 )
|
|
2245 {
|
|
2246 v57 = ItemsInShopTexture[5]->uTextureWidth;
|
|
2247 if ( (signed int)v56 > 457 - v57 )
|
|
2248 v56 = 457 - v57;
|
|
2249 }
|
|
2250 }
|
|
2251 else
|
|
2252 {
|
|
2253 if ( (signed int)v56 < 18 )
|
|
2254 v56 = 18;
|
|
2255 }
|
|
2256 pRenderer->DrawTextureTransparent(v56, v55, v54);
|
|
2257 sub_40F92A(&pRenderer->pActiveZBuffer[v56 + 640 * v55], ItemsInShopTexture[v114], v114 + 1);
|
|
2258 }
|
|
2259 ++v114;
|
|
2260 }
|
|
2261 while ( v114 < 6 );
|
|
2262 v114 = 0;
|
|
2263 do
|
|
2264 {
|
|
2265 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][(signed int)v114].uItemID) //not itemid
|
|
2266 {
|
|
2267 v58 = ItemsInShopTexture[v114 + 6];
|
|
2268 v59 = 308 - v58->uTextureHeight;
|
|
2269 if ( (signed int)v59 < 1 )
|
|
2270 v59 = 0;
|
|
2271 v60 = 75 * v114 - v58->uTextureWidth / 2 + 40;
|
|
2272 if ( v114 )
|
|
2273 {
|
|
2274 if ( v114 == 5 )
|
|
2275 {
|
|
2276 v61 = ItemsInShopTexture[11]->uTextureWidth;
|
|
2277 if ( (signed int)v60 > 457 - v61 )
|
|
2278 v60 = 457 - v61;
|
|
2279 }
|
|
2280 }
|
|
2281 else
|
|
2282 {
|
|
2283 if ( (signed int)v60 < 18 )
|
|
2284 v60 = 18;
|
|
2285 }
|
|
2286 pRenderer->DrawTextureTransparent(v60, v59, v58);
|
|
2287 sub_40F92A(&pRenderer->pActiveZBuffer[v60 + 640 * v59], ItemsInShopTexture[v114 + 6], v114 + 7);
|
|
2288 }
|
|
2289 ++v114;
|
|
2290 }
|
|
2291 while ( v114 < 6 );
|
|
2292 if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
|
|
2293 {
|
|
2294 v62 = 0;
|
|
2295 v109 = 0;
|
|
2296 do
|
|
2297 {
|
|
2298 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v62].uItemID)
|
|
2299 ++v109;
|
|
2300 ++v62;
|
|
2301 }
|
|
2302 while ( v62 < 12 );
|
|
2303 v63 = GetAsyncKeyState(17);
|
|
2304 v64 = pPlayer->CanSteal();
|
|
2305 Str = v64;
|
|
2306 if ( v63 && v64 )
|
|
2307 {
|
|
2308 v65 = pGlobalTXT_LocalizationStrings[185];
|
|
2309 }
|
|
2310 else
|
629
|
2311 {
|
634
|
2312 v65 = pGlobalTXT_LocalizationStrings[195];
|
|
2313 if ( dialog_menu_id != 2 )
|
|
2314 v65 = pGlobalTXT_LocalizationStrings[196];
|
|
2315 }
|
|
2316 DrawTextAtStatusBar(v65, 0);
|
|
2317 if ( !v109 )
|
|
2318 {
|
|
2319 dialog_window.DrawCurrentTime( pParty->field_3C.field_50[ (unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed);
|
|
2320 return;
|
|
2321 }
|
|
2322 v66 = pMouse->GetCursorPos(&v98);
|
|
2323 pNumActiveItem = v66->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v96)->y];
|
|
2324 if ( pRenderer->pActiveZBuffer[pNumActiveItem] & 0xFFFF )
|
|
2325 {
|
|
2326 v67 = (pRenderer->pActiveZBuffer[pNumActiveItem] & 0xFFFF) - 1;
|
|
2327 v109 = v67;
|
|
2328 v68 = (int)window_SpeakInHouse->ptr_1C;
|
|
2329 // v69 = 9 * (v67 + 12 * v68);
|
|
2330 v70 = (ItemGen *)&pParty->StandartItemsInShops[v68][v67];
|
|
2331 if ( dialog_menu_id != 2 )
|
|
2332 v70 = &pParty->SpecialItemsInShops[(int)v68][v67];//v70 = (ItemGen *)&pParty->field_C59C[v69 + 724];
|
|
2333 if ( !v63 || !Str )
|
|
2334 {
|
|
2335 v71 = pPlayer->_490EEE(v70, 4, v68, 2);
|
|
2336 v38 = (char *)pMerchantsBuyPhrases[v71];
|
|
2337 }
|
|
2338 else
|
|
2339 {
|
|
2340 v38 = pGlobalTXT_LocalizationStrings[181];
|
|
2341 }
|
|
2342 v21 = BuilDialogueString(v38, uActiveCharacter - 1, v70, (char *)window_SpeakInHouse->ptr_1C, 2, 0);
|
|
2343 v40 = pFontArrus->CalcTextHeight(v21, &dialog_window, 0, 0);
|
|
2344 dialog_window.DrawTitleText(pFontArrus, 0, (174 - v40) / 2 + 138, pColorWhite, v21, 3);
|
|
2345 return;
|
|
2346 }
|
|
2347 }
|
|
2348 return;
|
|
2349 }
|
|
2350 case DIALOG_SHOP_SKILLS:
|
|
2351 {
|
|
2352 if (!sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win())
|
|
2353 return;
|
|
2354 all_text_height = 0;
|
|
2355 v5 = (signed __int64)(p2DEvents[(signed int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0);
|
|
2356 pItemNum = v5 * (100 - pPlayer->GetMerchant()) / 100;
|
|
2357 if ( pItemNum < v5 / 3 )
|
|
2358 pItemNum = v5 / 3;
|
|
2359 pNumActiveItem = pDialogueWindow->pStartingPosActiveItem;
|
|
2360 v114 = 0;
|
|
2361 if ( pNumActiveItem >= pNumActiveItem + pDialogueWindow->pNumPresenceButton )
|
|
2362 {
|
|
2363 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], pPlayer->pName, pClassNames[pPlayer->classType]);
|
|
2364 strcat(pTmpBuf, "\n \n");
|
|
2365 strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]);
|
|
2366 v40 = pFontArrus->CalcTextHeight(pTmpBuf, &dialog_window, 0, 0);
|
644
|
2367 dialog_window.DrawTitleText(pFontArrus, 0, (174 - v40) / 2 + 138, pColorYellow, pTmpBuf, 3);
|
634
|
2368 return;
|
|
2369 }
|
|
2370 do
|
|
2371 {
|
|
2372 v8 = pDialogueWindow->GetControl(pNumActiveItem)->uControlParam - 36;
|
|
2373 if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayer->classType][v8] && !pPlayer->pActiveSkills[v8] )
|
|
2374 {
|
|
2375 all_text_height = pFontArrus->CalcTextHeight(pSkillNames[v8], &dialog_window, 0, 0);
|
|
2376 ++v114;
|
|
2377 }
|
|
2378 ++pNumActiveItem;
|
|
2379 }
|
|
2380 while ( pNumActiveItem < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem );
|
|
2381 if ( !v114 )
|
|
2382 {
|
|
2383 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], pPlayer->pName, pClassNames[pPlayer->classType]);
|
|
2384 strcat(pTmpBuf, "\n \n");
|
|
2385 strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]);
|
|
2386 v40 = pFontArrus->CalcTextHeight(pTmpBuf, &dialog_window, 0, 0);
|
644
|
2387 dialog_window.DrawTitleText(pFontArrus, 0, (174 - v40) / 2 + 138, pColorYellow, pTmpBuf, 3);
|
634
|
2388 return;
|
|
2389 }
|
|
2390 if ( v114 )
|
|
2391 {
|
|
2392 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], pItemNum);
|
|
2393 dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3);
|
|
2394 v18 = (149 - all_text_height) / v114;
|
|
2395 if ( (149 - all_text_height) / v114 > 32 )
|
|
2396 v18 = 32;
|
|
2397 pNumActiveItem = pDialogueWindow->pStartingPosActiveItem;
|
|
2398 v105 = (149 - v114 * v18 - all_text_height) / 2 - v18 / 2 + 162;
|
|
2399 if ( pNumActiveItem < pNumActiveItem + pDialogueWindow->pNumPresenceButton )
|
|
2400 {
|
|
2401 pItemNum = 2;
|
629
|
2402 do
|
|
2403 {
|
634
|
2404 pButton = pDialogueWindow->GetControl(pItemNum);
|
|
2405 v13 = pButton->uControlParam - 36;
|
|
2406 if ( !byte_4ED970_skill_learn_ability_by_class_table[pPlayer->classType][v13] || pPlayer->pActiveSkills[v13] )
|
|
2407 {
|
|
2408 pButton->uW = 0;
|
|
2409 pButton->uHeight = 0;
|
|
2410 pButton->uY = 0;
|
|
2411 }
|
|
2412 else
|
|
2413 {
|
|
2414 pButton->uY = v18 + v105;
|
|
2415 pTextHeight = pFontArrus->CalcTextHeight(pSkillNames[v13], &dialog_window, 0, 0);
|
|
2416 pButton->uHeight = pTextHeight;
|
|
2417 v105 = pButton->uY + pTextHeight - 1;
|
|
2418 pButton->uW = v105;
|
644
|
2419 pColorText = pColorYellow;
|
634
|
2420 if ( pDialogueWindow->pCurrentPosActiveItem != pItemNum )
|
644
|
2421 pColorText = pColorWhite;
|
|
2422 dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, pSkillNames[v13], 3);
|
634
|
2423 }
|
|
2424 pNumActiveItem = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem;
|
|
2425 pItemNum++;
|
629
|
2426 }
|
634
|
2427 while ( pItemNum < pNumActiveItem );
|
629
|
2428 }
|
|
2429 return;
|
634
|
2430 }
|
|
2431 }
|
|
2432 default:
|
|
2433 {
|
|
2434 return;// (POINT *)dialog_menu_id - 96;
|
|
2435 }
|
629
|
2436 }
|
|
2437 }
|
|
2438
|
|
2439 //----- (004BA928) --------------------------------------------------------
|
|
2440 void __cdecl ArmorShopDialog()
|
|
2441 {
|
|
2442 Player *v0; // ebx@1
|
|
2443 signed int v1; // esi@8
|
|
2444 unsigned int v2; // eax@10
|
|
2445 ItemGen *v3; // eax@11
|
|
2446 unsigned __int8 v4; // dl@12
|
|
2447 char *v5; // ecx@12
|
|
2448 char *v6; // eax@13
|
|
2449 int v7; // ST08_4@15
|
|
2450 int v8; // eax@15
|
|
2451 signed int v9; // esi@17
|
|
2452 unsigned int v10; // eax@19
|
|
2453 char *v11; // edi@19
|
|
2454 int v12; // ST08_4@20
|
|
2455 int v13; // eax@20
|
|
2456 unsigned __int8 v14; // dl@20
|
|
2457 char *v15; // ecx@20
|
|
2458 char **v16; // edi@22
|
|
2459 int all_text_height; // ebx@22
|
|
2460 char **v18; // esi@22
|
|
2461 int v19; // eax@23
|
|
2462 GUIWindow *v20; // ecx@24
|
|
2463 int v21; // eax@24
|
|
2464 int v22; // edx@24
|
|
2465 int v23; // ebx@24
|
|
2466 unsigned __int8 v24; // sf@24
|
|
2467 GUIButton *control_button; // eax@26
|
|
2468 GUIButton *v26; // esi@26
|
|
2469 int v27; // eax@26
|
|
2470 unsigned int v28; // ecx@26
|
|
2471 int v29; // edx@26
|
|
2472
|
|
2473 signed int v31; // esi@31
|
|
2474 unsigned int v32; // eax@33
|
|
2475 int v33; // eax@34
|
|
2476 int v34; // ST08_4@35
|
|
2477 int v35; // eax@35
|
|
2478 char *v36; // edx@36
|
|
2479 GUIWindow *v37; // edi@42
|
|
2480 signed int v38; // esi@42
|
|
2481 unsigned int v39; // esi@44
|
|
2482 int v40; // eax@44
|
|
2483 unsigned int v41; // eax@45
|
|
2484 int v42; // eax@47
|
|
2485 int v43; // ecx@52
|
|
2486 GUIButton *v44; // eax@54
|
|
2487 GUIButton *v45; // esi@54
|
|
2488 int v46; // eax@54
|
|
2489 char *v47; // eax@56
|
|
2490 int v48; // eax@56
|
|
2491 unsigned int v49; // ecx@56
|
|
2492 int v50; // edx@56
|
|
2493 int v51; // eax@56
|
|
2494 unsigned __int16 v52; // ax@56
|
|
2495 int v53; // eax@60
|
|
2496 int textureH; // eax@60
|
|
2497 signed int textureW; // ebx@65
|
|
2498 Texture *v56; // eax@67
|
|
2499 unsigned int v57; // edi@68
|
|
2500 Texture *v58; // ST1C_4@68
|
|
2501 int v59; // eax@68
|
|
2502 int v60; // edi@69
|
|
2503 signed int v61; // ebx@73
|
|
2504 Texture *v62; // eax@75
|
|
2505 int v63; // edi@76
|
|
2506 Texture *v64; // ST1C_4@76
|
|
2507 unsigned int v65; // ST18_4@76
|
|
2508 int v66; // eax@76
|
|
2509 int v67; // edi@77
|
|
2510 signed int v68; // ecx@81
|
|
2511 SHORT v69; // bx@89
|
|
2512 bool v70; // eax@89
|
|
2513 const char *v71; // ecx@91
|
|
2514 void *v72; // eax@95
|
|
2515 POINT *v73; // esi@97
|
|
2516 int v74; // ecx@97
|
|
2517 int v75; // eax@98
|
|
2518 int v76; // ecx@98
|
|
2519 ItemGen *selected_item; // ecx@99
|
|
2520 unsigned __int8 v78; // bl@104
|
|
2521 char **v79; // edi@105
|
|
2522 int v80; // ebx@105
|
|
2523 char **v81; // esi@105
|
|
2524 int v82; // eax@106
|
|
2525 GUIWindow *v83; // ecx@107
|
|
2526 int v84; // eax@107
|
|
2527 int v85; // edx@107
|
|
2528 int v86; // ebx@107
|
|
2529 GUIButton *v87; // eax@109
|
|
2530 GUIButton *v88; // esi@109
|
|
2531 int v89; // eax@109
|
|
2532 unsigned int v90; // ecx@109
|
|
2533 int v91; // edx@109
|
|
2534 unsigned __int16 v92; // ax@109
|
|
2535 signed int v93; // edx@114
|
|
2536 POINT *v94; // edi@120
|
|
2537 __int32 v95; // ecx@120
|
|
2538 void *v96; // ST14_4@122
|
|
2539 unsigned __int8 v97; // bl@122
|
|
2540 ItemGen *v98; // ST10_4@122
|
|
2541 int v99; // eax@122
|
|
2542 char *v100; // eax@122
|
|
2543 const char *v101; // ST18_4@122
|
|
2544 unsigned __int16 v102; // ST14_2@122
|
|
2545 int v103; // eax@122
|
|
2546 signed int v104; // edi@123
|
|
2547 Texture *v105; // eax@125
|
|
2548 int v106; // ebx@126
|
|
2549 Texture *v107; // ST1C_4@126
|
|
2550 unsigned int v108; // ST18_4@126
|
|
2551 int v109; // eax@126
|
|
2552 int v110; // ebx@127
|
|
2553 GUIWindow *v111; // [sp-18h] [bp-11Ch]@36
|
|
2554 unsigned int v112; // [sp-14h] [bp-118h]@13
|
|
2555 int v113; // [sp-14h] [bp-118h]@36
|
|
2556 ItemGen *v114; // [sp-10h] [bp-114h]@12
|
|
2557 unsigned int v115; // [sp-10h] [bp-114h]@13
|
|
2558 ItemGen *v116; // [sp-10h] [bp-114h]@20
|
|
2559 int v117; // [sp-10h] [bp-114h]@36
|
|
2560 void *v118; // [sp-Ch] [bp-110h]@12
|
|
2561 unsigned __int16 v119; // [sp-Ch] [bp-110h]@13
|
|
2562 void *v120; // [sp-Ch] [bp-110h]@20
|
|
2563 char *v121; // [sp-8h] [bp-10Ch]@13
|
|
2564 int v122; // [sp-8h] [bp-10Ch]@20
|
|
2565 unsigned int v123; // [sp-4h] [bp-108h]@13
|
|
2566 __int64 *v124; // [sp-4h] [bp-108h]@20
|
|
2567 int v125; // [sp-4h] [bp-108h]@68
|
|
2568 int v126; // [sp-4h] [bp-108h]@76
|
|
2569 int v127; // [sp-4h] [bp-108h]@126
|
|
2570 POINT v128; // [sp+Ch] [bp-F8h]@8
|
|
2571 POINT v129; // [sp+14h] [bp-F0h]@18
|
|
2572 char v130; // [sp+1Ch] [bp-E8h]@120
|
|
2573 POINT a2; // [sp+24h] [bp-E0h]@8
|
|
2574 POINT v132; // [sp+2Ch] [bp-D8h]@120
|
|
2575 POINT v133; // [sp+34h] [bp-D0h]@17
|
|
2576 POINT v134; // [sp+3Ch] [bp-C8h]@97
|
|
2577 POINT v135; // [sp+44h] [bp-C0h]@31
|
|
2578 POINT v136; // [sp+4Ch] [bp-B8h]@97
|
|
2579 POINT v137; // [sp+54h] [bp-B0h]@17
|
|
2580 POINT v138; // [sp+5Ch] [bp-A8h]@32
|
|
2581 POINT v139; // [sp+64h] [bp-A0h]@17
|
|
2582 POINT v140; // [sp+6Ch] [bp-98h]@31
|
|
2583 POINT v141; // [sp+74h] [bp-90h]@8
|
|
2584 POINT v142; // [sp+7Ch] [bp-88h]@31
|
|
2585 POINT v143; // [sp+84h] [bp-80h]@9
|
|
2586 GUIWindow dialog_window; // [sp+8Ch] [bp-78h]@1
|
|
2587 char *Str; // [sp+E0h] [bp-24h]@56
|
|
2588 int v146; // [sp+E4h] [bp-20h]@24
|
|
2589 int hilight_color; // [sp+E8h] [bp-1Ch]@1
|
|
2590 int m_text_color; // [sp+ECh] [bp-18h]@1
|
|
2591 __int32 v149; // [sp+F0h] [bp-14h]@8
|
|
2592 Player* _this; // [sp+F4h] [bp-10h]@1
|
|
2593 unsigned __int8 uPlayerID; // [sp+FBh] [bp-9h]@15
|
|
2594 int v152; // [sp+FCh] [bp-8h]@24
|
|
2595 int v153; // [sp+100h] [bp-4h]@44
|
|
2596 int th;
|
|
2597 short text_color;
|
|
2598
|
|
2599 v0 = pPlayers[uActiveCharacter];
|
|
2600 _this = pPlayers[uActiveCharacter];
|
|
2601 memcpy(&dialog_window, window_SpeakInHouse, sizeof(dialog_window));
|
|
2602 dialog_window.uFrameX = 483;
|
|
2603 dialog_window.uFrameWidth = 148;
|
|
2604 dialog_window.uFrameZ = 334;
|
|
2605 m_text_color = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu);
|
|
2606 hilight_color = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xCDu, 0x23u);
|
|
2607 switch (dialog_menu_id)
|
|
2608 {
|
|
2609 case DIALOG_SHOP_MAIN:
|
|
2610 {
|
|
2611 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
|
|
2612 return;
|
|
2613 pShopOptions[0] = pGlobalTXT_LocalizationStrings[134]; //"Buy Standard"
|
|
2614 pShopOptions[1] = pGlobalTXT_LocalizationStrings[152]; //"Buy Special"
|
|
2615 pShopOptions[2] = pGlobalTXT_LocalizationStrings[159]; //"Display Inventory"
|
|
2616 pShopOptions[3] = pGlobalTXT_LocalizationStrings[160];
|
|
2617
|
|
2618 all_text_height = 0;
|
|
2619 for(int i=0;i<4;++i)
|
|
2620 all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0);
|
|
2621 v146 = (174 - all_text_height) / 4;
|
|
2622
|
|
2623 v23 = (174 - 4 * (174 - all_text_height) / 4 - all_text_height) / 2 - (174 - all_text_height) / 4 / 2 + 138;
|
|
2624 int j=0;
|
|
2625 if ( pDialogueWindow->pNumPresenceButton>=0 )
|
|
2626 {
|
|
2627 th = 2;
|
|
2628 for (v152 = pDialogueWindow->pStartingPosActiveItem; v152 < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++v152)
|
|
2629 {
|
|
2630 control_button = pDialogueWindow->GetControl(v152);
|
|
2631 control_button->uY = v146 + v23;
|
|
2632 v27 = pFontArrus->CalcTextHeight(pShopOptions[j], &dialog_window, 0, 0);
|
|
2633 control_button->uHeight = v27;
|
|
2634 v23 = control_button->uY + control_button->uHeight - 1;
|
|
2635 control_button->uW = v23;
|
|
2636 text_color = hilight_color;
|
|
2637 if ( pDialogueWindow->pCurrentPosActiveItem != th )
|
|
2638 text_color = m_text_color;
|
|
2639 dialog_window.DrawTitleText(pFontArrus, 0, control_button->uY, text_color, pShopOptions[j], 3);
|
|
2640 ++th;
|
|
2641 ++j;
|
|
2642 }
|
|
2643 }
|
|
2644 }
|
|
2645 break;
|
|
2646 case DIALOG_SHOP_BUY_STANDART:
|
|
2647 {
|
|
2648 pRenderer->DrawTextureIndexed(8, 8, ShopTexture);
|
|
2649 textureW = 0;
|
|
2650 v153 = 0;
|
|
2651 for(int i=0; i<8; ++i)
|
|
2652 {
|
|
2653 if ( pParty->StandartItemsInShops[window_SpeakInHouse->par1C][i].uItemID);
|
|
2654 {
|
|
2655 textureW = ItemsInShopTexture[i]->uTextureWidth;
|
|
2656 textureH = ItemsInShopTexture[i]->uTextureHeight;
|
|
2657 if ( i >= 4 ) //low row
|
|
2658 {
|
|
2659 v60 = 90 - (textureW/2);
|
|
2660 pRenderer->DrawTextureTransparent(v60 + v153 - 420, 126, ItemsInShopTexture[i]);
|
|
2661 v59 = v60 + v153 + 80220;
|
|
2662 }
|
|
2663 else
|
|
2664 {
|
|
2665 v57 = 98 - textureH;
|
|
2666 v152 = 86 - (textureW/2);
|
|
2667 pRenderer->DrawTextureTransparent(v153 + v152, v57, ItemsInShopTexture[i]);
|
|
2668 v59 = v153 + v152 + 640 * v57;
|
|
2669 }
|
|
2670 ZBuffer_DoFill(&pRenderer->pActiveZBuffer[v59], ItemsInShopTexture[i], i+1);
|
|
2671 }
|
|
2672 v153 += 105;
|
|
2673
|
|
2674 }
|
|
2675
|
|
2676 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
|
|
2677 return;
|
|
2678
|
|
2679 v149 = 0;
|
|
2680 for(int i=0; i<8; ++i)
|
|
2681 {
|
|
2682 if ( pParty->StandartItemsInShops[window_SpeakInHouse->par1C][i].uItemID);
|
|
2683 ++v149;
|
|
2684
|
|
2685 }
|
|
2686
|
|
2687 v69 = GetAsyncKeyState(17);
|
|
2688 v70 = _this->CanSteal();
|
|
2689 //Str = (char *)v70;
|
|
2690 if ( v69 == 0 || v70 == 0 )
|
|
2691 {
|
|
2692 v71 = pGlobalTXT_LocalizationStrings[195]; //"Select the Item to Buy"
|
|
2693 }
|
|
2694 else
|
|
2695 {
|
|
2696 v71 = pGlobalTXT_LocalizationStrings[185];//"Steal item"
|
|
2697 }
|
|
2698 DrawTextAtStatusBar(v71, 0);
|
|
2699 if ( v149 != 0 )
|
|
2700 {
|
|
2701 v73 = pMouse->GetCursorPos(&v136);
|
|
2702 v74 = pRenderer->pActiveZBuffer[v73->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v134)->y]] & 0xFFFF;
|
|
2703 if ( !v74 )
|
|
2704 return;
|
|
2705 v149 = v74 - 1;
|
|
2706 selected_item = &pParty->StandartItemsInShops[window_SpeakInHouse->par1C][v74-1];
|
|
2707 if ( v69 ==0 || v70 == 0)
|
|
2708 {
|
|
2709 v120 = window_SpeakInHouse->ptr_1C;
|
|
2710 v15 = (char *)pMerchantsBuyPhrases[_this->_490EEE(selected_item, 2, window_SpeakInHouse->par1C, 2)];
|
|
2711 }
|
|
2712 else
|
|
2713 {
|
|
2714 v120 = window_SpeakInHouse->ptr_1C;
|
|
2715 v15 = pGlobalTXT_LocalizationStrings[181]; //"Steal %24"
|
|
2716 }
|
|
2717 v36 = BuilDialogueString(v15, uActiveCharacter - 1, selected_item, (char *)v120, 2, 0);
|
|
2718 v115 = (174 - pFontArrus->CalcTextHeight(v36, &dialog_window, 0, 0)) / 2 + 138;
|
|
2719 dialog_window.DrawTitleText(pFontArrus, 0, v115, m_text_color, v36, 3);
|
|
2720 return;
|
|
2721 }
|
|
2722 dialog_window.DrawCurrentTime( pParty->field_3C.field_50[window_SpeakInHouse->par1C]- pParty->uTimePlayed);
|
|
2723 return;
|
|
2724 }
|
|
2725 break;
|
|
2726 case DIALOG_SHOP_SELL:
|
|
2727 {
|
|
2728 draw_leather();
|
|
2729 CharacterUI_InventoryTab_Draw(uActiveCharacter, 1);
|
|
2730 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[199], 0);//"Select the Item to Sell"
|
|
2731 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win())
|
|
2732 return;
|
|
2733
|
|
2734 if((v9 = pMouse->GetCursorPos(&v139)->x - 14, v149 = (v9 >> 5) + 14 * ((pMouse->GetCursorPos(&v133)->y - 17) >> 5),
|
|
2735 pMouse->GetCursorPos(&v137)->x <= 13) || pMouse->GetCursorPos(&v129)->x >= 462
|
|
2736 || (v10 = v0->GetItemIDAtInventoryIndex((int *)&v149), v11 = 0, !v10) )
|
|
2737 return;
|
|
2738
|
|
2739 v116 = (ItemGen *)&v0->pInventoryItems[v10-1];
|
|
2740 v13 = v0->_490EEE(v116, 2, window_SpeakInHouse->par1C, 3);
|
|
2741 v15 = (char *)pMerchantsSellPhrases[v0->_490EEE(v116, 2, window_SpeakInHouse->par1C, 3)];
|
|
2742 v36 = BuilDialogueString(v15, uActiveCharacter - 1, v116, (char *) window_SpeakInHouse->par1C, 3, 0);
|
|
2743 v115 = (174 - pFontArrus->CalcTextHeight(v36, &dialog_window, 0, 0)) / 2 + 138;
|
|
2744 dialog_window.DrawTitleText(pFontArrus, 0, v115, m_text_color, v36, 3);
|
|
2745 return;
|
|
2746 }
|
|
2747 break;
|
|
2748 case DIALOG_SHOP_IDENTIFY:
|
|
2749 {
|
|
2750 draw_leather();
|
|
2751 CharacterUI_InventoryTab_Draw(uActiveCharacter, 1);
|
|
2752 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[197], 0); //"Select the Item to Identify"
|
|
2753 if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
|
|
2754 {
|
|
2755 v1 = pMouse->GetCursorPos(&a2)->x - 14;
|
|
2756 v149 = (v1 >> 5) + 14 * ((pMouse->GetCursorPos(&v128)->y - 17) >> 5);
|
|
2757 if ( pMouse->GetCursorPos(&v141)->x > 13 )
|
|
2758 {
|
|
2759 if ( pMouse->GetCursorPos(&v143)->x < 462 )
|
|
2760 {
|
|
2761 v2 = v0->GetItemIDAtInventoryIndex((int *)&v149);
|
|
2762 if ( v2 )
|
|
2763 {
|
|
2764 v3 = (ItemGen *)&v0->pInventoryItems[v2-1];
|
|
2765 if (v3->Identified())
|
|
2766 {
|
|
2767 v118 = window_SpeakInHouse->ptr_1C;
|
|
2768 v4 = uActiveCharacter - 1;
|
|
2769 v5 = "%24";
|
|
2770 v114 = v3;
|
|
2771 }
|
|
2772 else
|
|
2773 {
|
|
2774 v118 = window_SpeakInHouse->ptr_1C;
|
|
2775 v114 = v3;
|
|
2776 v7 = (int)window_SpeakInHouse->ptr_1C;
|
|
2777 uPlayerID = uActiveCharacter - 1;
|
|
2778 v8 = v0->_490EEE(v3, 2, v7, 4);
|
|
2779 v4 = uPlayerID;
|
|
2780 v5 = (char *)pMerchantsIdentifyPhrases[v8];
|
|
2781 }
|
|
2782 v6 = BuilDialogueString(v5, v4, v114, (char *)v118, 4, 0);
|
|
2783 v115 = (174 - pFontArrus->CalcTextHeight(v6, &dialog_window, 0, 0)) / 2 + 138;
|
|
2784 dialog_window.DrawTitleText(pFontArrus, 0, v115, m_text_color, v6, 3);
|
|
2785 return;
|
|
2786 }
|
|
2787 }
|
|
2788 }
|
|
2789 }
|
|
2790 }
|
|
2791 break;
|
|
2792 case DIALOG_SHOP_REPAIR:
|
|
2793 {
|
|
2794 draw_leather();
|
|
2795 CharacterUI_InventoryTab_Draw(uActiveCharacter, 1);
|
|
2796 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[198], 0);
|
|
2797 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win())
|
|
2798 return;
|
|
2799
|
|
2800 if( (v31 = pMouse->GetCursorPos(&v135)->x - 14,
|
|
2801 v149 = (v31 >> 5) + 14 * ((pMouse->GetCursorPos(&v142)->y - 17) >> 5),
|
|
2802 pMouse->GetCursorPos(&v140)->x <= 13)
|
|
2803 || pMouse->GetCursorPos(&v138)->x >= 462
|
|
2804 || (v32 = v0->GetItemIDAtInventoryIndex((int *)&v149), v11 = 0, !v32)
|
|
2805 || (v33 = 9 * v32, !(v0->field_1F5[4 * v33 + 15] & 2)) )
|
|
2806 return;
|
|
2807
|
|
2808
|
|
2809 v120 = window_SpeakInHouse->ptr_1C;
|
|
2810 v116 = (ItemGen *)&v0->spellbook.pDarkSpellbook.bIsSpellAvailable[4 * v33 + 5];
|
|
2811 v34 = (int)window_SpeakInHouse->ptr_1C;
|
|
2812 uPlayerID = uActiveCharacter - 1;
|
|
2813 v35 = v0->_490EEE((ItemGen *)&v0->spellbook.pDarkSpellbook.bIsSpellAvailable[4 * v33 + 5], 2, v34, 5);
|
|
2814 v14 = uPlayerID;
|
|
2815 v15 = (char *)pMerchantsRepairPhrases[v35];
|
|
2816 v36 = BuilDialogueString(v15, v14, v116, (char *)v120, 5, 0);
|
|
2817 v115 = (174 - pFontArrus->CalcTextHeight(v36, &dialog_window, 0, 0)) / 2 + 138;
|
|
2818 dialog_window.DrawTitleText(pFontArrus, 0, v115, m_text_color, v36, 3);
|
|
2819 return;
|
|
2820 }
|
|
2821 break;
|
|
2822 case 6: //buy standart
|
|
2823 {
|
|
2824 pRenderer->DrawTextureIndexed(8u, 8u, ShopTexture);
|
|
2825 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[195], 0); //"Select the Item to Buy"
|
|
2826 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
|
|
2827 return;
|
|
2828 v149 = 0;
|
|
2829 for(int i=0;i<6;++i)
|
|
2830 if (pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][i].uItemID)
|
|
2831 ++v149;
|
|
2832
|
|
2833
|
|
2834 if ( v149 )
|
|
2835 {
|
|
2836 v94 = pMouse->GetCursorPos(&v132);
|
|
2837 v149 = pRenderer->pActiveZBuffer[v94->x + pSRZBufferLineOffsets[pMouse->GetCursorPos((POINT *)&v130)->y]];
|
|
2838 v95 = v149;
|
|
2839 if ( v149 && v149 != -65536 )
|
|
2840 {
|
|
2841 --v149;
|
|
2842
|
|
2843 v97 = uActiveCharacter - 1;
|
|
2844
|
|
2845 v99 = _this->_490EEE(
|
|
2846 &pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][v95-1], 2, window_SpeakInHouse->par1C, 2);
|
|
2847 v100 = BuilDialogueString((char *)pMerchantsBuyPhrases[v99], uActiveCharacter - 1, v98, (char *)window_SpeakInHouse->par1C, 2, 0);
|
|
2848 v103 = pFontArrus->CalcTextHeight(v100, &dialog_window, 0, 0);
|
|
2849 dialog_window.DrawTitleText(pFontArrus, 0, (174 - v103) / 2 + 138, m_text_color, v100, 3);
|
|
2850 }
|
|
2851 v104 = 0;
|
|
2852 v153 = 0;
|
|
2853 do
|
|
2854 {
|
|
2855 //if ( pParty->field_C59C[9 * (v104 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] )
|
|
2856 if (pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][v104].uItemID)
|
|
2857 {
|
|
2858 v105 = ItemsInShopTexture[v104];
|
|
2859 if ( v104 >= 4 )
|
|
2860 {
|
|
2861 v110 = 90 - ((signed int)v105->uTextureWidth >> 1);
|
|
2862 pRenderer->DrawTextureTransparent(v153 + v110 - 420, 0x7Eu, ItemsInShopTexture[v104]);
|
|
2863 v127 = v104 + 1;
|
|
2864 v109 = v153 + v110 + 80220;
|
|
2865 }
|
|
2866 else
|
|
2867 {
|
|
2868 v106 = 98 - v105->uTextureHeight;
|
|
2869 v107 = ItemsInShopTexture[v104];
|
|
2870 v108 = 98 - v105->uTextureHeight;
|
|
2871 v152 = 86 - ((signed int)v105->uTextureWidth >> 1);
|
|
2872 pRenderer->DrawTextureTransparent(v152 + v153, v108, v107);
|
|
2873 v127 = v104 + 1;
|
|
2874 v109 = v152 + v153 + 640 * v106;
|
|
2875 }
|
|
2876 ZBuffer_DoFill(&pRenderer->pActiveZBuffer[v109], ItemsInShopTexture[v104], v127);
|
|
2877 }
|
|
2878 v153 += 105;
|
|
2879 ++v104;
|
|
2880 }
|
|
2881 while ( v104 < 8 );
|
|
2882 return;
|
|
2883 }
|
|
2884 dialog_window.DrawCurrentTime(pParty->field_3C.field_50[window_SpeakInHouse->par1C]- pParty->uTimePlayed);
|
|
2885 return;
|
|
2886 }
|
|
2887 break;
|
|
2888 case DIALOG_SHOP_DISPLAY_EQUIPMENT:
|
|
2889 {
|
|
2890 draw_leather();
|
|
2891 CharacterUI_InventoryTab_Draw(uActiveCharacter, 1);
|
|
2892 v79 = pShopOptions;
|
|
2893 pShopOptions[0] = pGlobalTXT_LocalizationStrings[200]; //"Sell"
|
|
2894 pShopOptions[1] = pGlobalTXT_LocalizationStrings[113]; //"Identify"
|
|
2895 pShopOptions[2] = pGlobalTXT_LocalizationStrings[179]; //"Repair"
|
|
2896
|
|
2897 all_text_height = 0;
|
|
2898 for(int i=0;i<3;++i)
|
|
2899 all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0);
|
|
2900 v83 = pDialogueWindow;
|
|
2901 v152 = (174 - all_text_height) / 3;
|
|
2902 v84 = pDialogueWindow->pStartingPosActiveItem;
|
|
2903 v85 = v84 + pDialogueWindow->pNumPresenceButton;
|
|
2904 v86 = (3 * (58 - v152) - all_text_height) / 2 - v152 / 2 + 138;
|
|
2905 v24 = -pDialogueWindow->pNumPresenceButton < 0;
|
|
2906 _this = (Player *)pDialogueWindow->pStartingPosActiveItem;
|
|
2907 if ( v24 ^ __OFSUB__(v84, v85) )
|
|
2908 {
|
|
2909 v153 = 2;
|
|
2910 do
|
|
2911 {
|
|
2912 v87 = v83->GetControl((unsigned int)_this);
|
|
2913 v88 = v87;
|
|
2914 v87->uY = v152 + v86;
|
|
2915 v89 = pFontArrus->CalcTextHeight(*v79, &dialog_window, 0, 0);
|
|
2916 v90 = v88->uY;
|
|
2917 v91 = v153;
|
|
2918 v88->uHeight = v89;
|
|
2919 v86 = v90 + v89 - 1;
|
|
2920 v88->uW = v86;
|
|
2921 v92 = hilight_color;
|
|
2922 if ( pDialogueWindow->pCurrentPosActiveItem != v91 )
|
|
2923 v92 = m_text_color;
|
|
2924 dialog_window.DrawTitleText(pFontArrus, 0, v90, v92, *v79, 3u);
|
|
2925 v83 = pDialogueWindow;
|
|
2926 ++v153;
|
|
2927 ++v79;
|
|
2928 _this = (Player *)((char *)_this + 1);
|
|
2929 }
|
|
2930 while ( (signed int)_this < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem );
|
|
2931 }
|
|
2932 return;
|
|
2933 }
|
|
2934 break;
|
|
2935 case DIALOG_SHOP_BUY_SPECIAL:
|
|
2936 {
|
|
2937 pRenderer->DrawTextureIndexed(8, 8, ShopTexture);
|
|
2938 v11 = 0;
|
|
2939 v61 = 0;
|
|
2940 v153 = 0;
|
|
2941 do
|
|
2942 {
|
|
2943 if (pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][v61].uItemID)
|
|
2944 {
|
|
2945 v62 = ItemsInShopTexture[v61];
|
|
2946 if ( v61 >= 4 )
|
|
2947 {
|
|
2948 v67 = 90 - ((signed int)v62->uTextureWidth >> 1);
|
|
2949 pRenderer->DrawTextureTransparent(v153 + v67 - 420, 0x7Eu, ItemsInShopTexture[v61]);
|
|
2950 v66 = v153 + v67 + 80220;
|
|
2951 }
|
|
2952 else
|
|
2953 {
|
|
2954 v63 = 98 - v62->uTextureHeight;
|
|
2955 v64 = ItemsInShopTexture[v61];
|
|
2956 v65 = 98 - v62->uTextureHeight;
|
|
2957 v152 = 86 - ((signed int)v62->uTextureWidth >> 1);
|
|
2958 pRenderer->DrawTextureTransparent(v152 + v153, v65, v64);
|
|
2959 v66 = v152 + v153 + 640 * v63;
|
|
2960 }
|
|
2961 ZBuffer_DoFill(&pRenderer->pActiveZBuffer[v66], ItemsInShopTexture[v61], v61 + 1);
|
|
2962 }
|
|
2963 v153 += 105;
|
|
2964 ++v61;
|
|
2965 }
|
|
2966 while ( v61 < 8 );
|
|
2967
|
|
2968 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
|
|
2969 return;
|
|
2970 v68 = 0;
|
|
2971 v149 = 0;
|
|
2972
|
|
2973 do
|
|
2974 {
|
|
2975 // if ( (char *)pParty->field_C59C[9 * (v68 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] != v11 )
|
|
2976 if (pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][(signed int)v68].uItemID)
|
|
2977 ++v149;
|
|
2978 ++v68;
|
|
2979 }
|
|
2980 while ( v68 < 6 );
|
|
2981
|
|
2982 v69 = GetAsyncKeyState(17);
|
|
2983 v70 = _this->CanSteal();
|
|
2984 Str = (char *)v70;
|
|
2985 if ( v69 == 0 || (char *)v70 == 0 )
|
|
2986 {
|
|
2987 v71 = pGlobalTXT_LocalizationStrings[196]; //Select the Special Item to Buy"
|
|
2988 }
|
|
2989 else
|
|
2990 {
|
|
2991 v71 = pGlobalTXT_LocalizationStrings[185];
|
|
2992 }
|
|
2993 DrawTextAtStatusBar(v71, 0);
|
|
2994 if ( (char *)v149 != 0 )
|
|
2995 {
|
|
2996 v73 = pMouse->GetCursorPos(&v136);
|
|
2997 v74 = pRenderer->pActiveZBuffer[v73->x + pSRZBufferLineOffsets[pMouse->GetCursorPos((POINT *)&v134)->y]] & 0xFFFF;
|
|
2998 if ( !v74 )
|
|
2999 return;
|
|
3000 v149 = v74 - 1;
|
|
3001
|
|
3002 if ( dialog_menu_id == 2 )
|
|
3003 selected_item = &pParty->StandartItemsInShops[window_SpeakInHouse->par1C][v74-1];
|
|
3004 else
|
|
3005 selected_item = &pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][v74-1];//(ItemGen *)&pParty->field_C59C[v76 + 724];
|
|
3006 if ( v69 == 0 || Str == 0 )
|
|
3007 {
|
|
3008 v120 = window_SpeakInHouse->ptr_1C;
|
|
3009 v15 = (char *)pMerchantsBuyPhrases[_this->_490EEE(selected_item, 2, window_SpeakInHouse->par1C, 2)];
|
|
3010 }
|
|
3011 else
|
|
3012 {
|
|
3013 v120 = window_SpeakInHouse->ptr_1C;
|
|
3014 v15 = pGlobalTXT_LocalizationStrings[181]; //"Steal %24"
|
|
3015 }
|
|
3016 v36 = BuilDialogueString(v15, uActiveCharacter - 1, selected_item, (char *)v120, 2, 0);
|
|
3017 v115 = (174 - pFontArrus->CalcTextHeight(v36, &dialog_window, 0, 0)) / 2 + 138;
|
|
3018 dialog_window.DrawTitleText(pFontArrus, 0, v115, m_text_color, v36, 3);
|
|
3019 return;
|
|
3020 }
|
|
3021 dialog_window.DrawCurrentTime( pParty->field_3C.field_50[window_SpeakInHouse->par1C]- pParty->uTimePlayed);
|
|
3022 return;
|
|
3023 }
|
|
3024 break;
|
|
3025 case DIALOG_SHOP_SKILLS:
|
|
3026 {
|
|
3027 if (!sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
|
|
3028 return;
|
|
3029 v152 = 0;
|
|
3030 v37 = pDialogueWindow;
|
|
3031 //v38 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (unsigned int)ptr_507BC0->ptr_1C] * 500.0);
|
|
3032 v38 = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0);
|
|
3033 _this = (Player *)(v38 * (100 - v0->GetMerchant()) / 100);
|
|
3034 if ( (signed int)_this < v38 / 3 )
|
|
3035 _this = (Player *)(v38 / 3);
|
|
3036 v39 = v37->pStartingPosActiveItem;
|
|
3037 v40 = v37->pNumPresenceButton;
|
|
3038 v153 = 0;
|
|
3039 if ( (signed int)v39 < (signed int)(v39 + v40) )
|
|
3040 {
|
|
3041 do
|
|
3042 {
|
|
3043 v41 = v37->GetControl(v39)->uControlParam - 36;
|
|
3044 if ( byte_4ED970_skill_learn_ability_by_class_table[v0->classType][v41] && !v0->pActiveSkills[v41] )
|
|
3045 {
|
|
3046 v42 = pFontArrus->CalcTextHeight(pSkillNames[v41], &dialog_window, 0, 0);
|
|
3047 v152 += v42;
|
|
3048 ++v153;
|
|
3049 }
|
|
3050 ++v39;
|
|
3051 }
|
|
3052 while ( (signed int)v39 < v37->pNumPresenceButton + v37->pStartingPosActiveItem );
|
|
3053 if ( v153 )
|
|
3054 {
|
|
3055 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], _this);
|
|
3056 dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u);
|
|
3057 _this = (Player *)((149 - v152) / v153);
|
|
3058 if ( (149 - v152) / v153 > 32 )
|
|
3059 _this = (Player *)32;
|
|
3060 v43 = (149 - v153 * (signed int)_this - v152) / 2 - (signed int)_this / 2 + 162;
|
|
3061 v152 = v37->pStartingPosActiveItem;
|
|
3062 v146 = v43;
|
|
3063 if ( v152 < v152 + v37->pNumPresenceButton )
|
|
3064 {
|
|
3065 v153 = 2;
|
|
3066 do
|
|
3067 {
|
|
3068 v44 = v37->GetControl(v152);
|
|
3069 v45 = v44;
|
|
3070 v46 = v44->uControlParam - 36;
|
|
3071 if ( !byte_4ED970_skill_learn_ability_by_class_table[v0->classType][v46] || v0->pActiveSkills[v46] )
|
|
3072 {
|
|
3073 v45->uW = 0;
|
|
3074 v45->uHeight = 0;
|
|
3075 v45->uY = 0;
|
|
3076 }
|
|
3077 else
|
|
3078 {
|
|
3079 v47 = pSkillNames[v46];
|
|
3080 v45->uY = (unsigned int)((char *)_this + v146);
|
|
3081 Str = v47;
|
|
3082 v48 = pFontArrus->CalcTextHeight(v47, &dialog_window, 0, 0);
|
|
3083 v49 = v45->uY;
|
|
3084 v50 = v153;
|
|
3085 v45->uHeight = v48;
|
|
3086 v51 = v49 + v48 - 1;
|
|
3087 v45->uW = v51;
|
|
3088 v146 = v51;
|
|
3089 v52 = hilight_color;
|
|
3090 if ( pDialogueWindow->pCurrentPosActiveItem != v50 )
|
|
3091 v52 = m_text_color;
|
|
3092 dialog_window.DrawTitleText(pFontArrus, 0, v49, v52, Str, 3u);
|
|
3093 }
|
|
3094 v53 = v37->pStartingPosActiveItem;
|
|
3095 ++v152;
|
|
3096 textureH = v37->pNumPresenceButton + v53;
|
|
3097 ++v153;
|
|
3098 }
|
|
3099 while ( v152 < textureH );
|
|
3100 }
|
|
3101 return;
|
|
3102 }
|
|
3103 }
|
|
3104 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], v0->pName, pClassNames[v0->classType]); //"Seek knowledge elsewhere %s the %s"
|
|
3105 strcat(pTmpBuf, "\n \n");
|
|
3106 strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]); //"I can offer you nothing further."
|
|
3107 v115 = (174 - pFontArrus->CalcTextHeight(pTmpBuf, &dialog_window, 0, 0)) / 2 + 138;
|
|
3108 dialog_window.DrawTitleText(pFontArrus, 0, v115, hilight_color, pTmpBuf, 3);
|
|
3109 return;
|
|
3110 }
|
|
3111 break;
|
|
3112 }
|
|
3113 }
|
|
3114
|
|
3115
|
|
3116
|
|
3117 //----- (004B5D7C) --------------------------------------------------------
|
|
3118 void GuildDialog()
|
|
3119 {
|
|
3120 GUIWindow *v0; // ebx@1
|
|
3121 Player *currPlayer; // edi@1
|
|
3122 signed int base_teach_price; // ebx@1
|
|
3123 int v3; // edi@6
|
|
3124 int result; // eax@11
|
|
3125 unsigned int v5; // ebx@13
|
|
3126 int v6; // esi@13
|
|
3127 signed int v7; // esi@17
|
|
3128 int v8; // esi@22
|
|
3129 signed int v9; // ecx@22
|
|
3130 char *v10; // eax@22
|
|
3131 const char *statusbar_string; // ecx@26
|
|
3132 POINT *v12; // esi@30
|
|
3133 int v13; // ecx@30
|
|
3134 void *v14; // ST1C_4@31
|
|
3135 ItemGen *v15; // ST18_4@31
|
|
3136 int v16; // ST10_4@31
|
|
3137 int v17; // eax@31
|
|
3138 char *v18; // edx@31
|
|
3139 int v19; // eax@32
|
|
3140 GUIWindow *v20; // edi@35
|
|
3141 int v21; // esi@35
|
|
3142 int v22; // eax@35
|
|
3143 unsigned int v23; // eax@36
|
|
3144 int v24; // eax@39
|
|
3145 int v25; // eax@40
|
|
3146 int v26; // ecx@47
|
|
3147 GUIButton *v27; // eax@49
|
|
3148 GUIButton *v28; // esi@49
|
|
3149 unsigned int v29; // eax@49
|
|
3150 char *v30; // eax@52
|
|
3151 int v31; // eax@55
|
|
3152 unsigned int v32; // ecx@55
|
|
3153 int v33; // eax@55
|
|
3154 unsigned __int16 v34; // ax@55
|
|
3155 int v35; // eax@58
|
|
3156 const char *v36; // ST20_4@61
|
|
3157 unsigned __int16 v37; // ST1C_2@61
|
|
3158 int v38; // eax@61
|
|
3159 GUIWindow *v39; // [sp-18h] [bp-304h]@31
|
|
3160 int v40; // [sp-14h] [bp-300h]@31
|
|
3161 int v41; // [sp-10h] [bp-2FCh]@31
|
|
3162 unsigned __int16 v42; // [sp-Ch] [bp-2F8h]@31
|
|
3163 char *v43; // [sp-8h] [bp-2F4h]@31
|
|
3164 unsigned int v44; // [sp-4h] [bp-2F0h]@31
|
|
3165 char Dest[100]; // [sp+Ch] [bp-2E0h]@3
|
|
3166 char v46[100]; // [sp+70h] [bp-27Ch]@3
|
|
3167 char v47[100]; // [sp+D4h] [bp-218h]@3
|
|
3168 char v48[100]; // [sp+138h] [bp-1B4h]@3
|
|
3169 char v49[100]; // [sp+19Ch] [bp-150h]@3
|
|
3170 POINT v50; // [sp+264h] [bp-88h]@30
|
|
3171 POINT v51; // [sp+26Ch] [bp-80h]@30
|
|
3172 GUIWindow working_window; // [sp+274h] [bp-78h]@1
|
|
3173 signed int v53; // [sp+27Ch] [bp-70h]@1
|
|
3174 signed int v54; // [sp+284h] [bp-68h]@1
|
|
3175 int v55; // [sp+2C8h] [bp-24h]@47
|
|
3176 int main_text_color; // [sp+2CCh] [bp-20h]@1
|
|
3177 int hi_text_color; // [sp+2D0h] [bp-1Ch]@1
|
|
3178 Player *v58; // [sp+2D4h] [bp-18h]@1
|
|
3179 unsigned __int8 uPlayerID; // [sp+2DBh] [bp-11h]@31
|
|
3180 char *Str; // [sp+2DCh] [bp-10h]@35
|
|
3181 int v61; // [sp+2E0h] [bp-Ch]@35
|
|
3182 unsigned int v62; // [sp+2E4h] [bp-8h]@13
|
|
3183 int v63; // [sp+2E8h] [bp-4h]@1
|
|
3184
|
|
3185 v0 = window_SpeakInHouse;
|
|
3186 memcpy(&working_window, window_SpeakInHouse, sizeof(GUIWindow));
|
|
3187 v58 = pPlayers[uActiveCharacter];
|
|
3188 currPlayer = v58;
|
|
3189 working_window.uFrameX = 483;
|
|
3190 working_window.uFrameWidth = 148;
|
|
3191 working_window.uFrameZ = 334;
|
|
3192 main_text_color = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu);
|
|
3193 hi_text_color = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu);
|
|
3194 //v2 = (signed __int64)(p2DEvents_minus1__20[13 * (unsigned int)v0->ptr_1C] * 500.0);
|
|
3195 base_teach_price = (signed __int64)(p2DEvents[(unsigned int)v0->ptr_1C - 1].fPriceMultiplier * 500.0);
|
|
3196 v63 = base_teach_price * (100 - currPlayer->GetMerchant()) / 100;
|
|
3197 if ( v63 < base_teach_price / 3 )
|
|
3198 v63 = base_teach_price / 3;
|
|
3199 strcpy(Dest, "");
|
|
3200 strcpy(v46, "");
|
|
3201 strcpy(v47, "");
|
|
3202 strcpy(v48, "");
|
|
3203 strcpy(v49, "");
|
|
3204 if ( dialog_menu_id != 1 )
|
|
3205 {
|
|
3206 if ( dialog_menu_id != 18 ) //buy skill
|
|
3207 {
|
|
3208 if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
|
|
3209 {
|
|
3210 //v3 = (int)(&currPlayer->uIntelligence + dword_F8B19C); //test skill
|
|
3211 if ( v58->pActiveSkills[dialog_menu_id-36] )
|
|
3212 {
|
|
3213 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[403], pClassNames[dialog_menu_id - 16]); //"You already know the %s skill"
|
|
3214 ShowStatusBarString(pTmpBuf, 2u);
|
|
3215 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0);
|
|
3216 }
|
|
3217 else
|
|
3218 {
|
|
3219 if ( pParty->uNumGold < v63 )
|
|
3220 {
|
|
3221 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u); //"You don't have enough gold"
|
|
3222 HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 2);
|
|
3223 }
|
|
3224 else
|
|
3225 {
|
|
3226 Party::TakeGold(v63);
|
|
3227 v58->pActiveSkills[dialog_menu_id-36] = 1;
|
|
3228 }
|
|
3229 }
|
|
3230 }
|
|
3231 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
|
|
3232 return;
|
|
3233 }
|
|
3234 pRenderer->DrawTextureIndexed(8u, 8u, ShopTexture);
|
|
3235 v5 = 0;
|
|
3236 v6 = 0;
|
|
3237 v62 = 0;
|
|
3238 v63 = 32;
|
|
3239 do
|
|
3240 {
|
|
3241 if (pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C-139][v6].uItemID)
|
|
3242 // if ( *(&pParty->pPlayers[1].pInstalledBeacons[0].field_18 + 9 * (v6 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)) )
|
|
3243
|
|
3244 {
|
|
3245 pRenderer->DrawTextureTransparent(v63, 0x5Au, ItemsInShopTexture[v6]);
|
|
3246 ZBuffer_DoFill((int *)((char *)pRenderer->pActiveZBuffer + v62 + 230528), ItemsInShopTexture[v6], v6 + 1);
|
|
3247 currPlayer = v58;
|
|
3248 }
|
|
3249 v63 += 70;
|
|
3250 v62 += 280;
|
|
3251 ++v6;
|
|
3252 }
|
|
3253 while ( v63 < 452 );
|
|
3254
|
|
3255 v62 = 1680;
|
|
3256 v7 = 6;
|
|
3257 v63 = 32;
|
|
3258 do
|
|
3259 {
|
|
3260 if (pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C-139][v7].uItemID)
|
|
3261 // if ( *(&pParty->pPlayers[1].pInstalledBeacons[0].field_18 + 9 * (v7 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)) )
|
|
3262 {
|
|
3263 pRenderer->DrawTextureTransparent(v63, 0xFAu, ItemsInShopTexture[v7]);
|
|
3264 ZBuffer_DoFill((int *)((char *)pRenderer->pActiveZBuffer + v62 + 638448), ItemsInShopTexture[v7], v7 + 1);
|
|
3265 currPlayer = v58;
|
|
3266 }
|
|
3267 v63 += 70;
|
|
3268 v62 += 280;
|
|
3269 ++v7;
|
|
3270 }
|
|
3271 while ( v63 < 452 );
|
|
3272
|
|
3273 if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
|
|
3274 {
|
|
3275 v8 = 0;
|
|
3276 v9 = 12;
|
|
3277 // v10 = (char *)(&pParty->pPlayers[1].pInstalledBeacons[0].field_18 + 108 * (unsigned int)window_SpeakInHouse->ptr_1C);
|
|
3278 // v10 =
|
|
3279 do
|
|
3280 {
|
|
3281 if (pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C-139][v9].uItemID )
|
|
3282 ++v8;
|
|
3283 // v10 += 36;
|
|
3284 --v9;
|
|
3285 }
|
|
3286 while ( v9 );
|
|
3287
|
|
3288 GetAsyncKeyState(17);
|
|
3289 statusbar_string = pGlobalTXT_LocalizationStrings[195]; //"Select the Item to Buy"
|
|
3290 if ( dialog_menu_id != 2 )
|
|
3291 statusbar_string = pGlobalTXT_LocalizationStrings[196]; //"Select the Special Item to Buy"
|
|
3292 DrawTextAtStatusBar(statusbar_string, 0);
|
|
3293 if ( !v8 )
|
|
3294 {
|
|
3295 working_window.DrawCurrentTime(
|
|
3296 __PAIR__(
|
|
3297 *(int *)&stru_AA1058[3].pSounds[8 * (unsigned int)window_SpeakInHouse->ptr_1C + 44472],
|
|
3298 *(int *)&stru_AA1058[3].pSounds[8 * (unsigned int)window_SpeakInHouse->ptr_1C + 44468])
|
|
3299 - pParty->uTimePlayed);
|
|
3300 return;
|
|
3301 }
|
|
3302 v12 = pMouse->GetCursorPos(&v51);
|
|
3303 result = v12->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v50)->y];
|
|
3304 v13 = pRenderer->pActiveZBuffer[result] & 0xFFFF;
|
|
3305 if ( pRenderer->pActiveZBuffer[result] & 0xFFFF )
|
|
3306 {
|
|
3307 v14 = window_SpeakInHouse->ptr_1C;
|
|
3308 v15 = (ItemGen *)(&pParty->pPlayers[1].uExpressionTimeLength + 18 * (v13 + 12 * (int)v14));
|
|
3309 v16 = (int)window_SpeakInHouse->ptr_1C;
|
|
3310 uPlayerID = uActiveCharacter - 1;
|
|
3311 v17 = currPlayer->_490EEE( (ItemGen *)&pParty->pPlayers[1].uExpressionTimeLength + v13 + 12 * (int)v14, 3, v16, 2);
|
|
3312 v18 = BuilDialogueString((char *)pMerchantsBuyPhrases[v17], uPlayerID, v15, (char *)v14, 2, 0);
|
|
3313 v19 = pFontArrus->CalcTextHeight(v18, &working_window, 0, 0);
|
|
3314 working_window.DrawTitleText(pFontArrus, 0, (174 - v19) / 2 + 138, main_text_color, v18, 3);
|
|
3315 return;
|
|
3316 }
|
|
3317 }
|
|
3318 return;
|
|
3319 }
|
|
3320 if ( !(unsigned __int16)_449B57_test_bit(
|
|
3321 (unsigned __int8 *)currPlayer->_guilds_member_bits,
|
|
3322 guild_mambership_flags[(unsigned int)window_SpeakInHouse->ptr_1C-139]) )
|
|
3323 { //you must me member
|
|
3324 v38 = pFontArrus->CalcTextHeight(pNPCTopics[121].pText, &working_window, 0, 0);
|
|
3325 working_window.DrawTitleText(pFontArrus, 0, (212 - v38) / 2 + 101, hi_text_color, pNPCTopics[121].pText, 3u);
|
|
3326 pDialogueWindow->pNumPresenceButton = 0;
|
|
3327 return;
|
|
3328 }
|
|
3329
|
|
3330 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
|
|
3331 return;
|
|
3332 v20 = pDialogueWindow;
|
|
3333 v5 = 0;
|
|
3334 v62 = 0;
|
|
3335 Str = 0;
|
|
3336 v21 = pDialogueWindow->pStartingPosActiveItem;
|
|
3337 v22 = v21 + pDialogueWindow->pNumPresenceButton;
|
|
3338 v61 = 0;
|
|
3339 if ( pDialogueWindow->pStartingPosActiveItem >= pDialogueWindow->pStartingPosActiveItem+pDialogueWindow->pNumPresenceButton )
|
|
3340 {
|
|
3341 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]); // "Seek knowledge elsewhere %s the %s"
|
|
3342 strcat(pTmpBuf, "\n \n");
|
|
3343 strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]); //"I can offer you nothing further."
|
|
3344 v19 = pFontArrus->CalcTextHeight(pTmpBuf, &working_window, 0, 0);
|
|
3345 working_window.DrawTitleText(pFontArrus, v5, (174 - v19) / 2 + 138, hi_text_color, pTmpBuf, 3);
|
|
3346 return;
|
|
3347 }
|
|
3348 do
|
|
3349 {
|
|
3350 v23 = v20->GetControl(v21)->uControlParam;
|
|
3351 if ( v23 == 18 )
|
|
3352 {
|
|
3353 v25 = pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[400], &working_window, 0, 0); //"Buy Spells"
|
|
3354 v62 += v25;
|
|
3355 ++v61;
|
|
3356 }
|
|
3357 else
|
|
3358 {
|
|
3359
|
|
3360 if((byte_4ED970_skill_learn_ability_by_class_table[v58->classType][v23-36])&&(v58->pActiveSkills[v23-36]))
|
|
3361 // or
|
|
3362 //byte_4ED970_skill_learn_ability_by_class_table[v58->uClass - 1][v23 + 1]
|
|
3363 {
|
|
3364 v24 = pFontArrus->CalcTextHeight(pClassNames[v23 - 16], &working_window, 0, 0);
|
|
3365 v62 += v24;
|
|
3366 ++v61;
|
|
3367 ++Str;
|
|
3368 }
|
|
3369 }
|
|
3370 ++v21;
|
|
3371 }
|
|
3372 while ( v21 < v20->pNumPresenceButton + v20->pStartingPosActiveItem );
|
|
3373 if ( !v61 )
|
|
3374 {
|
|
3375 LABEL_64:
|
|
3376 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], v58->pName, pClassNames[v58->classType]); // "Seek knowledge elsewhere %s the %s"
|
|
3377 strcat(pTmpBuf, "\n \n");
|
|
3378 strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]); //"I can offer you nothing further."
|
|
3379 v19 = pFontArrus->CalcTextHeight(pTmpBuf, &working_window, 0, 0);
|
|
3380 working_window.DrawTitleText(pFontArrus, v5, (174 - v19) / 2 + 138, hi_text_color, pTmpBuf, 3);
|
|
3381 return;
|
|
3382 }
|
|
3383 if ( Str )
|
|
3384 {
|
|
3385 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], v63); //"Skill Cost: %lu"
|
|
3386 working_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u);
|
|
3387 }
|
|
3388 v63 = (signed int)(149 - v62) / v61;
|
|
3389 if ( v63 > 32 )
|
|
3390 v63 = 32;
|
|
3391 v26 = (signed int)(149 - v61 * v63 - v62) / 2 - v63 / 2 + 162;
|
|
3392 v62 = v20->pStartingPosActiveItem;
|
|
3393 v55 = v26;
|
|
3394 if (v20->pStartingPosActiveItem < v20->pStartingPosActiveItem + v20->pNumPresenceButton )
|
|
3395 {
|
|
3396 v61 = 2;
|
|
3397 while ( 1 )
|
|
3398 {
|
|
3399 v27 = v20->GetControl(v62);
|
|
3400 v28 = v27;
|
|
3401 v29 = v27->uControlParam;
|
|
3402 if ( v29 == 18 )
|
|
3403 break;
|
|
3404
|
|
3405 // __debugbreak();
|
|
3406 //pSkillAvailabilityPerClass[8 + v58->uClass][4 + v23]
|
|
3407 // or
|
|
3408 if ((byte_4ED970_skill_learn_ability_by_class_table[v58->classType][v29 - 36])&&(v58->pActiveSkills[v29-36]))
|
|
3409 // or
|
|
3410 //byte_4ED970_skill_learn_ability_by_class_table[v58->uClass - 1][v23 + 1]
|
|
3411
|
|
3412 {
|
|
3413 v30 = pClassNames[v29 -16];
|
|
3414 LABEL_55:
|
|
3415 Str = v30;
|
|
3416 v28->uY = v63 + v55;
|
|
3417 v31 = pFontArrus->CalcTextHeight(v30, &working_window, 0, 0);
|
|
3418 v32 = v28->uY;
|
|
3419 v28->uHeight = v31;
|
|
3420 v33 = v32 + v31 - 1;
|
|
3421 v28->uW = v33;
|
|
3422 v55 = v33;
|
|
3423 v34 = hi_text_color;
|
|
3424 if ( pDialogueWindow->pCurrentPosActiveItem != v61 )
|
|
3425 v34 = main_text_color;
|
|
3426 working_window.DrawTitleText(pFontArrus, 0, v32, v34, Str, 3u);
|
|
3427 v35 = v20->pStartingPosActiveItem;
|
|
3428 ++v62;
|
|
3429 ++v61;
|
|
3430 if ( (signed int)v62 >=v20->pNumPresenceButton +v20->pStartingPosActiveItem )
|
|
3431 return;
|
|
3432 }
|
|
3433 v28->uW = 0;
|
|
3434 v28->uHeight = 0;
|
|
3435 v28->uY = 0;
|
|
3436 LABEL_58:
|
|
3437 v35 = v20->pStartingPosActiveItem;
|
|
3438 ++v62;
|
|
3439 ++v61;
|
|
3440 if ( (signed int)v62 >=v20->pNumPresenceButton +v20->pStartingPosActiveItem )
|
|
3441 return;
|
|
3442 }
|
|
3443 v30 = pGlobalTXT_LocalizationStrings[400]; //"Buy Spells"
|
|
3444 goto LABEL_55;
|
|
3445 }
|
|
3446 return;
|
|
3447 }
|
|
3448
|
|
3449
|
|
3450
|
|
3451 //----- (004B705E) --------------------------------------------------------
|
|
3452 void TempleDialog()
|
|
3453 {
|
|
3454 GUIWindow *v0; // ebx@1
|
|
3455 Player *v1; // esi@1
|
|
3456 int v2; // edi@1
|
|
3457 int result; // eax@4
|
|
3458 GUIWindow *v4; // edi@6
|
|
3459 void *v5; // eax@6
|
|
3460 int v6; // eax@6
|
|
3461 unsigned int v7; // eax@8
|
|
3462 int v8; // ecx@8
|
|
3463 unsigned int v9; // eax@9
|
|
3464 int v10; // eax@11
|
|
3465 int v11; // eax@12
|
|
3466 GUIWindow *v12; // ecx@16
|
|
3467 int v13; // edx@16
|
|
3468 GUIButton *v14; // eax@19
|
|
3469 GUIButton *v15; // edi@19
|
|
3470 int v16; // eax@19
|
|
3471 const char *v17; // eax@21
|
|
3472 int v18; // eax@21
|
|
3473 unsigned int v19; // ecx@21
|
|
3474 int v20; // eax@21
|
|
3475 unsigned __int16 v21; // ax@21
|
|
3476 unsigned __int16 v22; // ST14_2@27
|
|
3477 int v23; // eax@27
|
|
3478 double v24; // st7@28
|
|
3479 unsigned int v25; // ebx@28
|
|
3480 DDM_DLV_Header *v26; // edi@29
|
|
3481 int v27; // eax@31
|
|
3482 int v28; // eax@32
|
|
3483 //unsigned int v29; // ecx@34
|
|
3484 unsigned int v30; // edx@36
|
|
3485 unsigned int v31; // edx@38
|
|
3486 unsigned int v32; // edx@40
|
|
3487 unsigned int v33; // edx@42
|
|
3488 unsigned int v34; // edx@44
|
|
3489 int v35; // edi@50
|
|
3490 signed int v36; // eax@50
|
|
3491 unsigned __int8 v37; // al@54
|
|
3492 int v38; // ecx@54
|
|
3493 GUIWindow *v39; // eax@56
|
|
3494 unsigned __int8 v40; // al@61
|
|
3495 GUIButton *v41; // edi@64
|
|
3496 int v42; // esi@66
|
|
3497 GUIWindow *v43; // ecx@66
|
|
3498 int v44; // edi@66
|
|
3499 int v45; // eax@68
|
|
3500 signed int v46; // edi@69
|
|
3501 int v47; // edi@71
|
|
3502 GUIButton *v48; // eax@73
|
|
3503 const char *v49; // edx@73
|
|
3504 GUIButton *v50; // esi@73
|
|
3505 int v51; // eax@73
|
|
3506 unsigned int v52; // ecx@73
|
|
3507 unsigned __int16 v53; // ax@73
|
|
3508 char a1[300]; // [sp+10h] [bp-1B4h]@64
|
|
3509 GUIWindow v57; // [sp+13Ch] [bp-88h]@1
|
|
3510 __int64 v58; // [sp+190h] [bp-34h]@1
|
|
3511 __int64 v59; // [sp+198h] [bp-2Ch]@1
|
|
3512 __int64 v60; // [sp+1A0h] [bp-24h]@1
|
|
3513 GUIWindow *v61; // [sp+1ACh] [bp-18h]@6
|
|
3514 unsigned int v62; // [sp+1B0h] [bp-14h]@8
|
|
3515 unsigned __int8 v63; // [sp+1B7h] [bp-Dh]@64
|
|
3516 int v64; // [sp+1B8h] [bp-Ch]@6
|
|
3517 unsigned int v65; // [sp+1BCh] [bp-8h]@6
|
|
3518 DDM_DLV_Header *v66; // [sp+1C0h] [bp-4h]@6
|
|
3519
|
|
3520 v0 = window_SpeakInHouse;
|
|
3521 memcpy(&v57, window_SpeakInHouse, sizeof(v57));
|
|
3522 v57.uFrameX = 483;
|
|
3523 v57.uFrameWidth = 148;
|
|
3524 v57.uFrameZ = 334;
|
|
3525 HIDWORD(v58) = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu);
|
|
3526 HIDWORD(v59) = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu);
|
|
3527 v1 = pPlayers[uActiveCharacter];
|
|
3528 //v2 = pPlayers[uActiveCharacter]->_4B807C(p2DEvents_minus1__20[13 * (unsigned int)v0->ptr_1C]);
|
|
3529 v2 = pPlayers[uActiveCharacter]->_4B807C(p2DEvents[(unsigned int)v0->ptr_1C - 1].fPriceMultiplier);
|
|
3530 HIDWORD(v60) = v2;
|
|
3531 if ( dialog_menu_id != 1 )
|
|
3532 {
|
|
3533 if ( dialog_menu_id != 10 )
|
|
3534 {
|
|
3535 if ( dialog_menu_id != 11 )
|
|
3536 {
|
|
3537
|
|
3538 if ( dialog_menu_id == 96 )
|
|
3539 {
|
|
3540 if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
|
|
3541 {
|
|
3542 v4 = pDialogueWindow;
|
|
3543 v61 = pDialogueWindow;
|
|
3544 v5 = window_SpeakInHouse->ptr_1C;
|
|
3545 v66 = 0;
|
|
3546 //v65 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (signed int)v5] * 500.0);
|
|
3547 v65 = (signed __int64)(p2DEvents[(signed int)v5 - 1].flt_24 * 500.0);
|
|
3548 v6 = v1->GetMerchant();
|
|
3549 v64 = (signed int)(v65 * (100 - v6)) / 100;
|
|
3550 if ( v64 < (signed int)v65 / 3 )
|
|
3551 v64 = (signed int)v65 / 3;
|
|
3552 v7 = v4->pStartingPosActiveItem;
|
|
3553 v8 = v7 + v4->pNumPresenceButton;
|
|
3554 v65 = 0;
|
|
3555 v62 = v7;
|
|
3556 if ( (signed int)v7 >= v8 )
|
|
3557 goto LABEL_78;
|
|
3558 do
|
|
3559 {
|
|
3560 v9 = v4->GetControl(v62)->uControlParam - 36;
|
|
3561 if ( byte_4ED970_skill_learn_ability_by_class_table[v1->classType][v9] && !v1->pActiveSkills[v9] )
|
|
3562 {
|
|
3563 v10 = pFontArrus->CalcTextHeight(pSkillNames[v9], &v57, 0, 0);
|
|
3564 v66 = (DDM_DLV_Header *)((char *)v66 + v10);
|
|
3565 ++v65;
|
|
3566 }
|
|
3567 v11 = v4->pStartingPosActiveItem;
|
|
3568 ++v62;
|
|
3569 }
|
|
3570 while ( (signed int)v62 < v4->pNumPresenceButton + v11 );
|
|
3571 if ( v65 )
|
|
3572 {
|
|
3573 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], v64);
|
|
3574 v57.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u);
|
|
3575 v64 = (149 - (signed int)v66) / (signed int)v65;
|
|
3576 if ( v64 > 32 )
|
|
3577 v64 = 32;
|
|
3578 v65 = (signed int)(149 - v65 * v64 - (int)v66) / 2 - v64 / 2 + 162;
|
|
3579 v12 = v61;
|
|
3580 result = v61->pStartingPosActiveItem;
|
|
3581 v13 = result + v61->pNumPresenceButton;
|
|
3582 v62 = v61->pStartingPosActiveItem;
|
|
3583 if ( result < v13 )
|
|
3584 {
|
|
3585 v66 = (DDM_DLV_Header *)2;
|
|
3586 while ( 1 )
|
|
3587 {
|
|
3588 v14 = v12->GetControl(v62);
|
|
3589 v15 = v14;
|
|
3590 v16 = v14->uControlParam - 36;
|
|
3591 if ( !byte_4ED970_skill_learn_ability_by_class_table[v1->classType][v16] || v1->pActiveSkills[v16] )
|
|
3592 {
|
|
3593 v15->uW = 0;
|
|
3594 v15->uHeight = 0;
|
|
3595 v15->uY = 0;
|
|
3596 }
|
|
3597 else
|
|
3598 {
|
|
3599 v17 = pSkillNames[v16];
|
|
3600 v15->uY = v64 + v65;
|
|
3601 HIDWORD(v60) = (uint32)v17;
|
|
3602 v18 = pFontArrus->CalcTextHeight(v17, &v57, 0, 0);
|
|
3603 v19 = v15->uY;
|
|
3604 v15->uHeight = v18;
|
|
3605 v20 = v19 + v18 - 1;
|
|
3606 v15->uW = v20;
|
|
3607 v65 = v20;
|
|
3608 v21 = WORD2(v59);
|
|
3609 if ( (DDM_DLV_Header *)pDialogueWindow->pCurrentPosActiveItem != v66 )
|
|
3610 v21 = WORD2(v58);
|
|
3611 v57.DrawTitleText(pFontArrus, 0, v19, v21, (const char *)HIDWORD(v60), 3u);
|
|
3612 }
|
|
3613 result = (int)v61;
|
|
3614 ++v62;
|
|
3615 v66 = (DDM_DLV_Header *)((char *)v66 + 1);
|
|
3616 if ( (signed int)v62 >= v61->pNumPresenceButton + v61->pStartingPosActiveItem )
|
|
3617 break;
|
|
3618 v12 = v61;
|
|
3619 }
|
|
3620 }
|
|
3621 }
|
|
3622 else
|
|
3623 {
|
|
3624 LABEL_78:
|
|
3625 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], v1->pName, pClassNames[v1->classType]);
|
|
3626 strcat(pTmpBuf, "\n \n");
|
|
3627 strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]);
|
|
3628 v22 = WORD2(v59);
|
|
3629 v23 = pFontArrus->CalcTextHeight(pTmpBuf, &v57, 0, 0);
|
|
3630 result = (int)v57.DrawTitleText(pFontArrus, 0, (174 - v23) / 2 + 138, v22, pTmpBuf, 3u);
|
|
3631 }
|
|
3632 }
|
|
3633 }
|
|
3634 return;
|
|
3635 }
|
|
3636
|
|
3637 // DONATION
|
|
3638 //v24 = p2DEvents_minus1__20[13 * (unsigned int)ptr_507BC0->ptr_1C];
|
|
3639 v24 = p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier;
|
|
3640 v25 = 0;
|
|
3641 if ( pParty->uNumGold >= (unsigned int)(signed __int64)v24 )
|
|
3642 {
|
|
3643 Party::TakeGold((signed __int64)v24);
|
|
3644 v26 = &pOutdoor->ddm;
|
|
3645 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor )
|
|
3646 v26 = &pIndoor->dlv;
|
|
3647 v27 = v26->uReputation;
|
|
3648 v66 = v26;
|
|
3649 if ( v27 > -5 )
|
|
3650 {
|
|
3651 v28 = v27 - 1;
|
|
3652 v26->uReputation = v28;
|
|
3653 if ( v28 < -5 )
|
|
3654 v26->uReputation = -5;
|
|
3655 }
|
|
3656 if ( (unsigned __int8)byte_F8B1EF[uActiveCharacter] == pParty->uDaysPlayed % 7 )
|
|
3657 {
|
|
3658 if ( v26->uReputation <= -5 )
|
|
3659 {
|
|
3660 v30 = pParty->uDaysPlayed % 7 + 1;
|
|
3661 LOBYTE(v30) = v30 | 0x80;
|
|
3662 _42777D_CastSpell_UseWand_ShootArrow(SPELL_AIR_WIZARD_EYE, uActiveCharacter - 1, v30, 48, 0);
|
|
3663 }
|
|
3664 if ( v26->uReputation <= -10 )
|
|
3665 {
|
|
3666 v31 = pParty->uDaysPlayed % 7 + 1;
|
|
3667 LOBYTE(v31) = v31 | 0x80;
|
|
3668 _42777D_CastSpell_UseWand_ShootArrow(SPELL_SPIRIT_PRESERVATION, uActiveCharacter - 1, v31, 48, 0);
|
|
3669 v26 = v66;
|
|
3670 }
|
|
3671 if ( v26->uReputation <= -15 )
|
|
3672 {
|
|
3673 v32 = pParty->uDaysPlayed % 7 + 1;
|
|
3674 LOBYTE(v32) = v32 | 0x80;
|
|
3675 _42777D_CastSpell_UseWand_ShootArrow(SPELL_BODY_PROTECTION_FROM_MAGIC, uActiveCharacter - 1, v32, 48, 0);
|
|
3676 v26 = v66;
|
|
3677 }
|
|
3678 if ( v26->uReputation <= -20 )
|
|
3679 {
|
|
3680 v33 = pParty->uDaysPlayed % 7 + 1;
|
|
3681 LOBYTE(v33) = v33 | 0x80;
|
|
3682 _42777D_CastSpell_UseWand_ShootArrow(SPELL_LIGHT_HOUR_OF_POWER, uActiveCharacter - 1, v33, 48, 0);
|
|
3683 v26 = v66;
|
|
3684 }
|
|
3685 if ( v26->uReputation <= -25 )
|
|
3686 {
|
|
3687 v34 = pParty->uDaysPlayed % 7 + 1;
|
|
3688 LOBYTE(v34) = v34 | 0x80;
|
|
3689 _42777D_CastSpell_UseWand_ShootArrow(SPELL_LIGHT_DAY_OF_PROTECTION, uActiveCharacter - 1, v34, 48, 0);
|
|
3690 }
|
|
3691 }
|
|
3692 ++byte_F8B1EF[uActiveCharacter];
|
|
3693 v1->PlaySound(SPEECH_83, 0);
|
|
3694 ShowStatusBarString(pGlobalTXT_LocalizationStrings[527], 2u); // "Thank You!"
|
|
3695 goto LABEL_46;
|
|
3696 }
|
|
3697 goto LABEL_55;
|
|
3698 }
|
|
3699 if ( !v1->_4B6FF9() )
|
|
3700 return;
|
|
3701 v25 = 0;
|
|
3702 if ( pParty->uNumGold < v2 )
|
|
3703 {
|
|
3704 LABEL_55:
|
|
3705 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u);
|
|
3706 HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 2);
|
|
3707 goto LABEL_46;
|
|
3708 }
|
|
3709 Party::TakeGold(v2);
|
|
3710 v35 = LODWORD(v1->pConditions[17]);
|
|
3711 v59 = v1->pConditions[14];
|
|
3712 v58 = v1->pConditions[15];
|
|
3713 v60 = v1->pConditions[16];
|
|
3714 v61 = (GUIWindow *)HIDWORD(v1->pConditions[17]);
|
|
3715 memset(v1, 0, 0xA0u);
|
|
3716 v1->sHealth = v1->GetMaxHealth();
|
|
3717 v1->sMana = v1->GetMaxMana();
|
|
3718 v36 = (signed int)window_SpeakInHouse->ptr_1C;
|
|
3719 if ( v36 != 78 && (v36 <= 80 || v36 > 82) )
|
|
3720 {
|
|
3721 if ( (unsigned int)v61 | v35 )
|
|
3722 {
|
|
3723 v37 = LOBYTE(v1->field_1928);
|
|
3724 v38 = v1->field_1924;
|
|
3725 v1->uFace = v37;
|
|
3726 v1->uVoiceID = v38;
|
|
3727 ReloadPlayerPortraits(uActiveCharacter - 1, (char)v37);
|
|
3728 }
|
|
3729 goto LABEL_63;
|
|
3730 }
|
|
3731 v39 = v61;
|
|
3732 if ( (unsigned int)v61 | v35 )
|
|
3733 {
|
|
3734 LODWORD(v1->pConditions[17]) = v35;
|
|
3735 }
|
|
3736 else
|
|
3737 {
|
|
3738 if ( !v60 && !v58 && !v59 )
|
|
3739 goto LABEL_63;
|
|
3740 v1->field_1928 = v1->uFace;
|
|
3741 v1->field_1924 = v1->uVoiceID;
|
|
3742 v1->SetCondition(0x11u, 1);
|
|
3743 v1->uVoiceID = (v1->GetSexByVoice() != 0) + 23;
|
|
3744 v40 = (v1->GetSexByVoice() != 0) + 23;
|
|
3745 v1->uFace = v40;
|
|
3746 ReloadPlayerPortraits(uActiveCharacter - 1, (char)v40);
|
|
3747 LODWORD(v1->pConditions[17]) = LODWORD(pParty->uTimePlayed);
|
|
3748 v39 = (GUIWindow *)HIDWORD(pParty->uTimePlayed);
|
|
3749 }
|
|
3750 HIDWORD(v1->pConditions[17]) = (int)v39;
|
|
3751 LABEL_63:
|
|
3752 pAudioPlayer->PlaySound((SoundID)(SOUND_GoldReceived|0x2), -1, 0, -1, 0, 0, 0, 0);
|
|
3753 v1->PlaySound(SPEECH_82, 0);
|
|
3754 pOtherOverlayList->_4418B1(20, uActiveCharacter + 99, 0, 65536);
|
|
3755 LABEL_46:
|
|
3756 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, v25);
|
|
3757 return ; // void func
|
|
3758 }
|
|
3759 v63 = 1;
|
|
3760 v41 = pDialogueWindow->GetControl(pDialogueWindow->pStartingPosActiveItem);
|
|
3761 strcpy(a1, "");
|
|
3762 v41->uHeight = 0;
|
|
3763 v41->uY = 0;
|
|
3764 if ( v1->_4B6FF9() )
|
|
3765 {
|
|
3766 sprintf(a1, "%s %d %s", pGlobalTXT_LocalizationStrings[104], HIDWORD(v60), pGlobalTXT_LocalizationStrings[97]);
|
|
3767 v63 = 0;
|
|
3768 }
|
|
3769 strcpy(&a1[100], pGlobalTXT_LocalizationStrings[68]);
|
|
3770 strcpy(&a1[200], pGlobalTXT_LocalizationStrings[160]);
|
|
3771 v42 = v63;
|
|
3772 v43 = pDialogueWindow;
|
|
3773 v44 = v63;
|
|
3774 v66 = 0;
|
|
3775 if ( v63 < pDialogueWindow->pNumPresenceButton )
|
|
3776 {
|
|
3777 v61 = (GUIWindow *)&a1[100 * v63];
|
|
3778 do
|
|
3779 {
|
|
3780 v45 = pFontArrus->CalcTextHeight((const char *)v61, &v57, 0, 0);
|
|
3781 v66 = (DDM_DLV_Header *)((char *)v66 + v45);
|
|
3782 v43 = pDialogueWindow;
|
|
3783 v61 = (GUIWindow *)((char *)v61 + 100);
|
|
3784 ++v44;
|
|
3785 }
|
|
3786 while ( v44 < pDialogueWindow->pNumPresenceButton );
|
|
3787 }
|
|
3788 v46 = v43->pNumPresenceButton - v42;
|
|
3789 v64 = (174 - (signed int)v66) / v46;
|
|
3790 if ( v64 > 32 )
|
|
3791 v64 = 32;
|
|
3792 v47 = (174 - v64 * v46 - (signed int)v66) / 2 - v64 / 2 + 138;
|
|
3793 v65 = v42 + v43->pStartingPosActiveItem;
|
|
3794 if ( v42 + v43->pStartingPosActiveItem < v43->pStartingPosActiveItem + v43->pNumPresenceButton )
|
|
3795 {
|
|
3796 v61 = (GUIWindow *)(v42 + 2);
|
|
3797 v66 = (DDM_DLV_Header *)&a1[100 * v42];
|
|
3798 do
|
|
3799 {
|
|
3800 v48 = v43->GetControl(v65);
|
|
3801 v49 = (const char *)v66;
|
|
3802 v50 = v48;
|
|
3803 v48->uY = v64 + v47;
|
|
3804 v51 = pFontArrus->CalcTextHeight(v49, &v57, 0, 0);
|
|
3805 v52 = v50->uY;
|
|
3806 v50->uHeight = v51;
|
|
3807 v47 = v52 + v51 - 1;
|
|
3808 v50->uW = v47;
|
|
3809 v53 = WORD2(v59);
|
|
3810 if ( (GUIWindow *)pDialogueWindow->pCurrentPosActiveItem != v61 )
|
|
3811 v53 = WORD2(v58);
|
|
3812 v57.DrawTitleText(pFontArrus, 0, v52, v53, (const char *)v66, 3u);
|
|
3813 v43 = pDialogueWindow;
|
|
3814 v66 = (DDM_DLV_Header *)((char *)v66 + 100);
|
|
3815 v61 = (GUIWindow *)((char *)v61 + 1);
|
|
3816 ++v65;
|
|
3817 }
|
|
3818 while ( (signed int)v65 < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem );
|
|
3819 }
|
|
3820 return;
|
|
3821 }
|
|
3822
|
|
3823 //----- (004B4710) --------------------------------------------------------
|
|
3824 int __cdecl TrainingDialog()
|
|
3825 {
|
|
3826 Player *v0; // ebx@1
|
|
3827 int color2; // eax@1
|
651
|
3828 //unsigned int v2; // ecx@1
|
|
3829 //int v3; // eax@1
|
|
3830 //signed int v4; // edx@1
|
|
3831 unsigned __int64 v5; // edi@3
|
|
3832 //unsigned int v6; // esi@3
|
|
3833 //void *v7; // ecx@3
|
629
|
3834 int v8; // edx@4
|
|
3835 double v9; // st7@6
|
|
3836 signed int v10; // esi@6
|
|
3837 int v11; // ecx@6
|
|
3838 int result; // eax@9
|
|
3839 GUIWindow *v13; // edi@14
|
|
3840 signed int v14; // esi@14
|
|
3841 unsigned int v15; // esi@16
|
|
3842 int v16; // eax@16
|
|
3843 unsigned int v17; // eax@17
|
|
3844 int v18; // eax@19
|
|
3845 int v19; // ecx@24
|
|
3846 GUIButton *v20; // eax@26
|
|
3847 GUIButton *v21; // esi@26
|
|
3848 int v22; // eax@26
|
|
3849 const char *v23; // eax@28
|
|
3850 int v24; // eax@28
|
|
3851 unsigned int v25; // ecx@28
|
|
3852 int v26; // eax@28
|
|
3853 unsigned __int16 v27; // ax@28
|
|
3854 int v28; // eax@32
|
|
3855 unsigned __int16 v29; // ST14_2@34
|
|
3856 int v30; // eax@34
|
|
3857 const char *v31; // ST18_4@36
|
|
3858 unsigned __int16 v32; // ST14_2@36
|
|
3859 int v33; // eax@36
|
|
3860 int v34; // eax@37
|
|
3861 unsigned int v35; // edi@38
|
|
3862 unsigned int v36; // eax@38
|
|
3863 int v37; // ecx@41
|
|
3864 char *v38; // eax@41
|
|
3865 int *v39; // eax@45
|
|
3866 unsigned int v40; // eax@46
|
|
3867 void *v41; // ecx@46
|
|
3868 unsigned int v42; // eax@46
|
|
3869 GUIWindow *v43; // ecx@59
|
|
3870 int v44; // edx@59
|
|
3871 char **v45; // esi@60
|
|
3872 int v46; // eax@62
|
|
3873 int v47; // eax@68
|
|
3874 int v48; // edx@69
|
|
3875 int v49; // ebx@69
|
|
3876 unsigned __int8 v50; // sf@69
|
|
3877 char **v51; // edi@70
|
|
3878 GUIButton *v52; // eax@71
|
|
3879 GUIButton *v53; // esi@71
|
|
3880 int v54; // eax@71
|
|
3881 unsigned int v55; // ecx@71
|
|
3882 int v56; // eax@71
|
|
3883 unsigned __int16 v57; // ax@71
|
|
3884 unsigned __int16 v58; // [sp-Ch] [bp-90h]@38
|
|
3885 const char *v59; // [sp-Ch] [bp-90h]@63
|
|
3886 char *v60; // [sp-8h] [bp-8Ch]@38
|
|
3887 char *v61; // [sp-8h] [bp-8Ch]@63
|
|
3888 unsigned int v62; // [sp-4h] [bp-88h]@38
|
|
3889 int v63; // [sp-4h] [bp-88h]@52
|
|
3890 char *v64; // [sp-4h] [bp-88h]@63
|
|
3891 GUIWindow v65; // [sp+Ch] [bp-78h]@1
|
651
|
3892 //__int64 v66; // [sp+60h] [bp-24h]@3
|
629
|
3893 unsigned int white; // [sp+68h] [bp-1Ch]@1
|
|
3894 int v68; // [sp+6Ch] [bp-18h]@3
|
|
3895 int v69; // [sp+70h] [bp-14h]@6
|
651
|
3896 //unsigned int i; // [sp+74h] [bp-10h]@1
|
|
3897 //int v71; // [sp+78h] [bp-Ch]@1
|
629
|
3898 int v72; // [sp+7Ch] [bp-8h]@16
|
|
3899 int v73; // [sp+80h] [bp-4h]@14
|
|
3900
|
|
3901 v0 = pPlayers[uActiveCharacter];
|
|
3902 memcpy(&v65, window_SpeakInHouse, sizeof(v65));
|
|
3903 v65.uFrameX = 483;
|
|
3904 v65.uFrameWidth = 148;
|
|
3905 v65.uFrameZ = 334;
|
|
3906 white = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu);
|
|
3907 color2 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xCDu, 0x23u);
|
651
|
3908 //v71 = color2;
|
|
3909 //v2 = v0->uLevel;
|
|
3910 //v3 = 0;
|
|
3911 //v4 = 0;
|
|
3912 //for ( i = v2; v4 < (signed int)v2; ++v4 )
|
|
3913 // v3 += v4 + 1;
|
|
3914 //v5 = 1000 * v3;
|
|
3915 v5 = 1000ui64 * v0->uLevel * (v0->uLevel + 1) / 2; // E n = n(n + 1) / 2
|
|
3916 //v6 = HIDWORD(v0->uExperience);
|
|
3917 //v7 = window_SpeakInHouse->ptr_1C;
|
|
3918 v68 = pMaxLevelPerTrainingHallType[(unsigned int)window_SpeakInHouse->ptr_1C - 89];
|
|
3919 //v66 = 1000 * v3;
|
|
3920 if (v0->uExperience >= v5)
|
629
|
3921 {
|
|
3922 v8 = v0->classType % 4 + 1;
|
|
3923 if ( v8 == 4 )
|
|
3924 v8 = 3;
|
651
|
3925 v9 = (double)v0->uLevel;
|
|
3926 //i = 0;
|
629
|
3927 v69 = v8;
|
|
3928 //v10 = (signed __int64)(v9 * p2DEvents_minus1__20[13 * (signed int)v7] * (double)v8);
|
651
|
3929 v10 = (signed __int64)(v9 * p2DEvents[(signed int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier * (double)v8);
|
629
|
3930 v11 = v10 * (100 - v0->GetMerchant()) / 100;
|
|
3931 if ( v11 < v10 / 3 )
|
|
3932 v11 = v10 / 3;
|
651
|
3933 //i = v11;
|
629
|
3934 }
|
|
3935 result = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win();
|
|
3936 if ( result )
|
|
3937 {
|
|
3938 if ( dialog_menu_id != 1 )
|
|
3939 {
|
|
3940 if ( dialog_menu_id != 17 )
|
|
3941 {
|
|
3942 result = dialog_menu_id - 96;
|
|
3943 if ( dialog_menu_id == 96 )
|
|
3944 {
|
|
3945 result = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win();
|
|
3946 if ( result )
|
|
3947 {
|
651
|
3948 //i = 0;
|
|
3949 int _v0 = 0;
|
629
|
3950 v13 = pDialogueWindow;
|
|
3951 //v14 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (unsigned int)ptr_507BC0->ptr_1C] * 500.0);
|
|
3952 v14 = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0);
|
|
3953 v73 = v14 * (100 - v0->GetMerchant()) / 100;
|
|
3954 if ( v73 < v14 / 3 )
|
|
3955 v73 = v14 / 3;
|
|
3956 v15 = v13->pStartingPosActiveItem;
|
|
3957 v16 = v13->pNumPresenceButton;
|
|
3958 v72 = 0;
|
|
3959 if ( (signed int)v15 >= (signed int)(v15 + v16) )
|
|
3960 goto LABEL_76;
|
|
3961 do
|
|
3962 {
|
|
3963 v17 = v13->GetControl(v15)->uControlParam - 36;
|
|
3964 if ( byte_4ED970_skill_learn_ability_by_class_table[v0->classType][v17] && !v0->pActiveSkills[v17] )
|
|
3965 {
|
|
3966 v18 = pFontArrus->CalcTextHeight(pSkillNames[v17], &v65, 0, 0);
|
651
|
3967 _v0 += v18;
|
629
|
3968 ++v72;
|
|
3969 }
|
|
3970 ++v15;
|
|
3971 }
|
|
3972 while ( (signed int)v15 < v13->pNumPresenceButton + v13->pStartingPosActiveItem );
|
|
3973 if ( v72 )
|
|
3974 {
|
|
3975 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], v73);// "Skill Cost: %lu"
|
|
3976 v65.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u);
|
651
|
3977 v73 = (signed int)(149 - _v0) / v72;
|
629
|
3978 if ( v73 > 32 )
|
|
3979 v73 = 32;
|
|
3980 result = v13->pStartingPosActiveItem;
|
651
|
3981 v19 = (signed int)(149 - v72 * v73 - _v0) / 2 - v73 / 2 + 162;
|
|
3982 int _v1 = result;
|
629
|
3983 v68 = v19;
|
|
3984 if ( result < result + v13->pNumPresenceButton )
|
|
3985 {
|
|
3986 v72 = 2;
|
|
3987 do
|
|
3988 {
|
651
|
3989 v20 = v13->GetControl(_v1);
|
629
|
3990 v21 = v20;
|
|
3991 v22 = v20->uControlParam - 36;
|
|
3992 if ( !byte_4ED970_skill_learn_ability_by_class_table[v0->classType][v22] || v0->pActiveSkills[v22] )
|
|
3993 {
|
|
3994 v21->uW = 0;
|
|
3995 v21->uHeight = 0;
|
|
3996 v21->uY = 0;
|
|
3997 }
|
|
3998 else
|
|
3999 {
|
|
4000 v23 = pSkillNames[v22];
|
|
4001 v21->uY = v73 + v68;
|
651
|
4002 //HIDWORD(v66) = (int)v23;
|
629
|
4003 v24 = pFontArrus->CalcTextHeight(v23, &v65, 0, 0);
|
|
4004 v25 = v21->uY;
|
|
4005 v21->uHeight = v24;
|
|
4006 v26 = v25 + v24 - 1;
|
|
4007 v21->uW = v26;
|
|
4008 v68 = v26;
|
651
|
4009 v27 = color2;
|
629
|
4010 if ( pDialogueWindow->pCurrentPosActiveItem != v72 )
|
|
4011 v27 = white;
|
651
|
4012 v65.DrawTitleText(pFontArrus, 0, v25, v27, v23, 3u);
|
629
|
4013 }
|
|
4014 v28 = v13->pStartingPosActiveItem;
|
651
|
4015 ++_v1;
|
629
|
4016 result = v13->pNumPresenceButton + v28;
|
|
4017 ++v72;
|
|
4018 }
|
651
|
4019 while ( (signed int)_v1 < result );
|
629
|
4020 }
|
|
4021 }
|
|
4022 else
|
|
4023 {
|
|
4024 LABEL_76:
|
|
4025 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], v0->pName, pClassNames[v0->classType]);//
|
|
4026 // "Seek knowledge elsewhere %s the %s"
|
|
4027 strcat(pTmpBuf, "\n \n");
|
|
4028 strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]);// "I can offer you nothing further."
|
651
|
4029 v29 = color2;
|
629
|
4030 v30 = pFontArrus->CalcTextHeight(pTmpBuf, &v65, 0, 0);
|
|
4031 result = (int)v65.DrawTitleText(pFontArrus, 0, (174 - v30) / 2 + 138, v29, pTmpBuf, 3u);
|
|
4032 }
|
|
4033 }
|
|
4034 }
|
|
4035 return result;
|
|
4036 }
|
|
4037 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
|
|
4038 {
|
|
4039 v31 = pNPCTopics[122].pText;
|
651
|
4040 v32 = color2;
|
629
|
4041 v33 = pFontArrus->CalcTextHeight(pNPCTopics[122].pText, &v65, 0, 0);
|
|
4042 v65.DrawTitleText(pFontArrus, 0, (212 - v33) / 2 + 101, v32, v31, 3u);
|
|
4043 result = (int)pDialogueWindow;
|
|
4044 pDialogueWindow->pNumPresenceButton = 0;
|
|
4045 return result;
|
|
4046 }
|
|
4047 v34 = v0->uLevel;
|
|
4048 if ( v34 < v68 )
|
|
4049 {
|
651
|
4050 if ( (signed __int64)v0->uExperience >= v5 )
|
629
|
4051 {
|
651
|
4052 if ( pParty->uNumGold >= v11)
|
629
|
4053 {
|
651
|
4054 Party::TakeGold(v11);
|
629
|
4055 HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 2);
|
|
4056 ++v0->uLevel;
|
|
4057 v0->uSkillPoints += v0->uLevel / 10 + 5;
|
|
4058 v0->sHealth = v0->GetMaxHealth();
|
|
4059 v0->sMana = v0->GetMaxMana();
|
|
4060 v37 = 0;
|
|
4061 v38 = byte_F8B148;
|
|
4062 do
|
|
4063 {
|
|
4064 if ( *(int *)v38 > v37 )
|
|
4065 v37 = *(int *)v38;
|
|
4066 v38 += 4;
|
|
4067 }
|
|
4068 while ( (signed int)v38 < (signed int)word_F8B158 );
|
|
4069 v39 = &dword_F8B144 + uActiveCharacter;
|
|
4070 ++*v39;
|
|
4071 if ( *v39 > v37 )
|
|
4072 {
|
|
4073 v40 = sub_494820(pParty->uCurrentHour);
|
|
4074 v41 = window_SpeakInHouse->ptr_1C;
|
|
4075 v42 = 60 * (v40 + 4) - pParty->uCurrentMinute;
|
|
4076 if ( v41 == (void *)94 || v41 == (void *)95 )
|
|
4077 v42 += 720;
|
|
4078 RestAndHeal((signed int)(v42 + 10080));
|
|
4079 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor )
|
|
4080 pOutdoor->SetFog();
|
|
4081 }
|
|
4082 v0->PlaySound(SPEECH_87, 0);
|
651
|
4083 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[430], v0->pName, v0->uLevel, v0->uLevel / 10 + 5);//
|
629
|
4084 // "%s is now Level %lu and has earned %lu Skill Points!"
|
|
4085 ShowStatusBarString(pTmpBuf, 2u);
|
|
4086 goto LABEL_56;
|
|
4087 }
|
|
4088 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u);// "You don't have enough gold"
|
|
4089 v63 = 4;
|
|
4090 LABEL_55:
|
|
4091 HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, v63);
|
|
4092 LABEL_56:
|
|
4093 /*result = pMessageQueue_50CBD0->uNumMessages;
|
|
4094 if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
|
|
4095 {
|
|
4096 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113;
|
|
4097 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1;
|
|
4098 result = 3 * pMessageQueue_50CBD0->uNumMessages + 3;
|
|
4099 *(&pMessageQueue_50CBD0->uNumMessages + result) = 0;
|
|
4100 ++pMessageQueue_50CBD0->uNumMessages;
|
|
4101 }
|
|
4102 return result;*/
|
|
4103 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
|
|
4104 return 1; // void function actually
|
|
4105 }
|
651
|
4106 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[538], (unsigned int)(v5 - v0->uExperience), v34 + 1);//
|
629
|
4107 // "You need %d more experience to train to level %d"
|
|
4108 v35 = 0;
|
|
4109 v62 = 3;
|
|
4110 v60 = pTmpBuf;
|
651
|
4111 v58 = color2;
|
629
|
4112 v36 = (212 - pFontArrus->CalcTextHeight(pTmpBuf, &v65, 0, 0)) / 2 + 88;
|
|
4113 }
|
|
4114 else
|
|
4115 {
|
|
4116 sprintf(pTmpBuf, "%s\n \n%s", pGlobalTXT_LocalizationStrings[536], pGlobalTXT_LocalizationStrings[529]);//
|
|
4117 // ""With your skills, you should be working here as a teacher.""
|
|
4118 // ""Sorry, but we are unable to train you.""
|
|
4119 v35 = 0;
|
|
4120 v62 = 3;
|
|
4121 v60 = pTmpBuf;
|
651
|
4122 v58 = color2;
|
629
|
4123 v36 = (212 - pFontArrus->CalcTextHeight(pTmpBuf, &v65, 0, 0)) / 2 + 101;
|
|
4124 }
|
|
4125 v65.DrawTitleText(pFontArrus, v35, v36, v58, v60, v62);
|
|
4126 v63 = 3;
|
|
4127 goto LABEL_55;
|
|
4128 }
|
|
4129 result = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win();
|
|
4130 if ( result )
|
|
4131 {
|
|
4132 v43 = pDialogueWindow;
|
|
4133 v72 = 0;
|
|
4134 pShopOptions[0] = pTmpBuf;
|
|
4135 pShopOptions[1] = pGlobalTXT_LocalizationStrings[160];// "Learn Skills"
|
|
4136 v44 = pDialogueWindow->pNumPresenceButton;
|
|
4137 v73 = pDialogueWindow->pStartingPosActiveItem;
|
|
4138 if ( v73 < v73 + v44 )
|
|
4139 {
|
|
4140 v45 = pShopOptions;
|
|
4141 do
|
|
4142 {
|
|
4143 if ( v43->GetControl(v73)->uControlParam == 17 )
|
|
4144 {
|
|
4145 v46 = v0->uLevel;
|
|
4146 if ( v46 < v68 )
|
|
4147 {
|
651
|
4148 if ( (signed __int64)v0->uExperience < v5 )
|
629
|
4149 {
|
|
4150 v64 = (char *)(v46 + 1);
|
|
4151 v61 = (char *)(v5 - LODWORD(v0->uExperience));
|
|
4152 v59 = pGlobalTXT_LocalizationStrings[538];// "You need %d more experience to train to level %d"
|
|
4153 }
|
|
4154 else
|
|
4155 {
|
651
|
4156 v64 = (char *)v11;
|
629
|
4157 v61 = (char *)(v46 + 1);
|
|
4158 v59 = pGlobalTXT_LocalizationStrings[537];// "Train to level %d for %d gold"
|
|
4159 }
|
|
4160 }
|
|
4161 else
|
|
4162 {
|
|
4163 v64 = pGlobalTXT_LocalizationStrings[529];// ""Sorry, but we are unable to train you.""
|
|
4164 v61 = pGlobalTXT_LocalizationStrings[536];// ""With your skills, you should be working here as a teacher.""
|
|
4165 v59 = "%s\n \n%s";
|
|
4166 }
|
651
|
4167 sprintfex(*v45, v59, v61, v64);
|
629
|
4168 }
|
|
4169 v47 = pFontArrus->CalcTextHeight(*v45, &v65, 0, 0);
|
|
4170 v43 = pDialogueWindow;
|
|
4171 v72 += v47;
|
|
4172 ++v45;
|
|
4173 ++v73;
|
|
4174 }
|
|
4175 while ( v73 < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem );
|
|
4176 }
|
651
|
4177 //HIDWORD(v66) = (174 - v72) / 2;
|
629
|
4178 result = v43->pStartingPosActiveItem;
|
|
4179 v48 = result + v43->pNumPresenceButton;
|
|
4180 v49 = (2 * (87 - (174 - v72) / 2) - v72) / 2 - (174 - v72) / 2 / 2 + 138;
|
|
4181 v50 = -v43->pNumPresenceButton < 0;
|
|
4182 v73 = v43->pStartingPosActiveItem;
|
|
4183 if ( v50 ^ __OFSUB__(result, v48) )
|
|
4184 {
|
651
|
4185 int _v3 = 2;
|
629
|
4186 v51 = pShopOptions;
|
|
4187 do
|
|
4188 {
|
|
4189 v52 = v43->GetControl(v73);
|
|
4190 v53 = v52;
|
651
|
4191 v52->uY = (174 - v72) / 2 + v49;
|
629
|
4192 v54 = pFontArrus->CalcTextHeight(*v51, &v65, 0, 0);
|
|
4193 v55 = v53->uY;
|
|
4194 v53->uHeight = v54;
|
|
4195 v56 = v54 + v55 - 1;
|
|
4196 v53->uW = v56;
|
|
4197 v49 = v56;
|
651
|
4198 v57 = color2;
|
|
4199 if ( pDialogueWindow->pCurrentPosActiveItem != _v3 )
|
629
|
4200 v57 = white;
|
|
4201 v65.DrawTitleText(pFontArrus, 0, v55, v57, *v51, 3u);
|
|
4202 v43 = pDialogueWindow;
|
651
|
4203 ++_v3;
|
629
|
4204 ++v51;
|
|
4205 ++v73;
|
|
4206 result = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem;
|
|
4207 }
|
|
4208 while ( v73 < result );
|
|
4209 }
|
|
4210 }
|
|
4211 }
|
|
4212 return result;
|
|
4213 }
|
|
4214
|
|
4215
|
|
4216
|
|
4217
|
|
4218
|
|
4219
|
|
4220
|
|
4221
|
|
4222
|
|
4223 //----- (004B4FCF) --------------------------------------------------------
|
|
4224 void MagicShopDialog()
|
|
4225 {
|
|
4226 Player *v0; // ebx@1
|
|
4227 int result; // eax@6
|
|
4228 signed int v2; // esi@8
|
|
4229 unsigned int v3; // ebx@10
|
|
4230 char *v4; // eax@11
|
|
4231 char *v5; // eax@12
|
|
4232 unsigned int v6; // eax@12
|
|
4233 int v7; // ST08_4@14
|
|
4234 int v8; // eax@14
|
|
4235 unsigned __int8 v9; // dl@14
|
|
4236 char *v10; // ecx@14
|
|
4237 signed int v11; // esi@16
|
|
4238 int v12; // ST08_4@19
|
|
4239 int v13; // eax@19
|
|
4240 int all_text_height; // edi@21
|
|
4241 char **v15; // esi@21
|
|
4242 int v16; // eax@22
|
|
4243 GUIWindow *v17; // ecx@23
|
|
4244 int v18; // edx@23
|
|
4245 int v19; // edi@23
|
|
4246 unsigned __int8 v20; // sf@23
|
|
4247 GUIButton *control_button; // esi@25
|
|
4248 const char **v22; // eax@25
|
|
4249 int v23; // eax@25
|
|
4250 unsigned int v24; // ecx@25
|
|
4251 const char **v25; // edx@25
|
|
4252 unsigned __int16 text_color; // ax@25
|
|
4253 signed int v27; // esi@30
|
|
4254 int v28; // ST08_4@34
|
|
4255 int v29; // eax@34
|
|
4256 char *v30; // edx@35
|
|
4257 GUIWindow *v31; // edi@40
|
|
4258 void *v32; // eax@40
|
|
4259 signed int v33; // esi@40
|
|
4260 unsigned int v34; // esi@42
|
|
4261 int v35; // eax@42
|
|
4262 unsigned int v36; // eax@43
|
|
4263 int v37; // eax@45
|
|
4264 int v38; // ecx@50
|
|
4265 GUIButton *v39; // eax@52
|
|
4266 GUIButton *v40; // esi@52
|
|
4267 int v41; // eax@52
|
|
4268 char *v42; // eax@54
|
|
4269 int v43; // eax@54
|
|
4270 unsigned int v44; // ecx@54
|
|
4271 int v45; // edx@54
|
|
4272 int v46; // eax@54
|
|
4273 unsigned __int16 v47; // ax@54
|
|
4274 int v48; // eax@58
|
|
4275 signed int v49; // esi@62
|
|
4276 Texture *v50; // ecx@64
|
|
4277 unsigned int v51; // edi@64
|
|
4278 unsigned int v52; // esi@66
|
|
4279 int v53; // edx@70
|
|
4280 Texture *v54; // ecx@76
|
|
4281 unsigned int v55; // edi@76
|
|
4282 unsigned int v56; // esi@76
|
|
4283 int v57; // edx@80
|
|
4284 Texture *v58; // ecx@86
|
|
4285 unsigned int v59; // edi@86
|
|
4286 unsigned int v60; // esi@88
|
|
4287 int v61; // edx@92
|
|
4288 Texture *v62; // ecx@98
|
|
4289 unsigned int v63; // edi@98
|
|
4290 unsigned int v64; // esi@100
|
|
4291 int v65; // edx@104
|
|
4292 signed int v66; // ecx@109
|
|
4293 SHORT v67; // di@117
|
|
4294 bool v68; // eax@117
|
|
4295 const char *v69; // ecx@119
|
|
4296 POINT *v70; // esi@124
|
|
4297 int v71; // ecx@125
|
|
4298 int v72; // eax@125
|
|
4299 int v73; // ecx@125
|
|
4300 ItemGen *v74; // esi@125
|
|
4301 int v75; // eax@130
|
|
4302 int v76; // esi@131
|
|
4303 char **v77; // edi@131
|
|
4304 int v78; // eax@132
|
|
4305 GUIWindow *v79; // ecx@133
|
|
4306 int v80; // edx@133
|
|
4307 int v81; // edi@133
|
|
4308 GUIButton *v82; // esi@135
|
|
4309 const char **v83; // eax@135
|
|
4310 int v84; // eax@135
|
|
4311 unsigned int v85; // ecx@135
|
|
4312 int v86; // edx@135
|
|
4313 unsigned __int16 v87; // ax@135
|
|
4314 GUIWindow *v88; // [sp-18h] [bp-110h]@35
|
|
4315 int v89; // [sp-14h] [bp-10Ch]@35
|
|
4316 ItemGen *v90; // [sp-10h] [bp-108h]@14
|
|
4317 int v91; // [sp-10h] [bp-108h]@35
|
|
4318 unsigned __int16 v92; // [sp-Ch] [bp-104h]@12
|
|
4319 void *v93; // [sp-Ch] [bp-104h]@14
|
|
4320 int v94; // [sp-8h] [bp-100h]@11
|
|
4321 char *v95; // [sp-8h] [bp-100h]@12
|
|
4322 __int64 *v96; // [sp-4h] [bp-FCh]@11
|
|
4323 unsigned int v97; // [sp-4h] [bp-FCh]@12
|
|
4324 POINT v98; // [sp+Ch] [bp-ECh]@8
|
|
4325 POINT v99; // [sp+14h] [bp-E4h]@16
|
|
4326 POINT v100; // [sp+1Ch] [bp-DCh]@124
|
|
4327 POINT v101; // [sp+24h] [bp-D4h]@17
|
|
4328 POINT v102; // [sp+2Ch] [bp-CCh]@124
|
|
4329 POINT v103; // [sp+34h] [bp-C4h]@9
|
|
4330 POINT v104; // [sp+3Ch] [bp-BCh]@31
|
|
4331 POINT v105; // [sp+44h] [bp-B4h]@16
|
|
4332 POINT v106; // [sp+4Ch] [bp-ACh]@30
|
|
4333 POINT v107; // [sp+54h] [bp-A4h]@16
|
|
4334 POINT v108; // [sp+5Ch] [bp-9Ch]@30
|
|
4335 POINT a2; // [sp+64h] [bp-94h]@8
|
|
4336 POINT v110; // [sp+6Ch] [bp-8Ch]@30
|
|
4337 POINT v111; // [sp+74h] [bp-84h]@8
|
|
4338 GUIWindow dialog_window; // [sp+7Ch] [bp-7Ch]@1
|
|
4339 char *Str; // [sp+D0h] [bp-28h]@54
|
|
4340 int v146; // [sp+D4h] [bp-24h]@23
|
|
4341 unsigned int hilight_color; // [sp+D8h] [bp-20h]@1
|
|
4342 unsigned int m_text_color; // [sp+DCh] [bp-1Ch]@1
|
|
4343 __int32 v117; // [sp+E0h] [bp-18h]@8
|
|
4344 int v118; // [sp+E4h] [bp-14h]@40
|
|
4345 const char **v119; // [sp+E8h] [bp-10h]@24
|
|
4346 Player *_this; // [sp+ECh] [bp-Ch]@1
|
|
4347 unsigned __int8 uPlayerID; // [sp+F3h] [bp-5h]@14
|
|
4348 int v152; // [sp+F4h] [bp-4h]@23
|
|
4349 int v122;
|
|
4350 int v114;
|
|
4351
|
|
4352 v0 = pPlayers[uActiveCharacter];
|
|
4353 _this = pPlayers[uActiveCharacter];
|
|
4354 memcpy(&dialog_window, window_SpeakInHouse, sizeof(dialog_window));
|
|
4355 dialog_window.uFrameX = 483;
|
|
4356 dialog_window.uFrameWidth = 148;
|
|
4357 dialog_window.uFrameZ = 334;
|
|
4358 m_text_color = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu);
|
|
4359 hilight_color = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xCDu, 0x23u);
|
|
4360 if ( dialog_menu_id > 5 )
|
|
4361 {
|
|
4362 if ( dialog_menu_id == 94 )
|
|
4363 {
|
|
4364 draw_leather();
|
|
4365 CharacterUI_InventoryTab_Draw(uActiveCharacter, 1);
|
|
4366 pShopOptions[0] = pGlobalTXT_LocalizationStrings[200];// "Sell"
|
|
4367 pShopOptions[1] = pGlobalTXT_LocalizationStrings[113];// "Identify"
|
|
4368 pShopOptions[2] = pGlobalTXT_LocalizationStrings[179];// "Repair"
|
|
4369 v76 = 0;
|
|
4370 v77 = pShopOptions;
|
|
4371 do
|
|
4372 {
|
|
4373 v78 = pFontArrus->CalcTextHeight(*v77, &dialog_window, 0, 0);
|
|
4374 ++v77;
|
|
4375 v76 += v78;
|
|
4376 }
|
|
4377 while ( (signed int)v77 < (signed int)&pShopOptions[3] );
|
|
4378 v79 = pDialogueWindow;
|
|
4379 _this = (Player *)((174 - v76) / 3);
|
|
4380 result = pDialogueWindow->pStartingPosActiveItem;
|
|
4381 v80 = result + pDialogueWindow->pNumPresenceButton;
|
|
4382 v81 = (3 * (58 - (signed int)_this) - v76) / 2 - (174 - v76) / 3 / 2 + 138;
|
|
4383 v20 = -pDialogueWindow->pNumPresenceButton < 0;
|
|
4384 v118 = pDialogueWindow->pStartingPosActiveItem;
|
|
4385 if ( v20 ^ __OFSUB__(result, v80) )
|
|
4386 {
|
|
4387 v122 = 2;
|
|
4388 v119 = (const char **)pShopOptions;
|
|
4389 do
|
|
4390 {
|
|
4391 v82 = v79->GetControl(v118);
|
|
4392 v83 = v119;
|
|
4393 v82->uY = (unsigned int)((char *)_this + v81);
|
|
4394 v84 = pFontArrus->CalcTextHeight(*v83, &dialog_window, 0, 0);
|
|
4395 v85 = v82->uY;
|
|
4396 v86 = v122;
|
|
4397 v82->uHeight = v84;
|
|
4398 v81 = v84 + v85 - 1;
|
|
4399 v82->uW = v81;
|
|
4400 v87 = hilight_color;
|
|
4401 if ( pDialogueWindow->pCurrentPosActiveItem != v86 )
|
|
4402 v87 = m_text_color;
|
|
4403 dialog_window.DrawTitleText(pFontArrus, 0, v85, v87, *v119, 3u);
|
|
4404 v79 = pDialogueWindow;
|
|
4405 ++v122;
|
|
4406 ++v119;
|
|
4407 ++v118;
|
|
4408 result = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem;
|
|
4409 }
|
|
4410 while ( v118 < result );
|
|
4411 }
|
|
4412 return;
|
|
4413 }
|
|
4414 if ( dialog_menu_id != 95 )
|
|
4415 {
|
|
4416 result = dialog_menu_id - 96;
|
|
4417 if ( dialog_menu_id == 96 )
|
|
4418 {
|
|
4419 result = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win();
|
|
4420 if ( result )
|
|
4421 {
|
|
4422 v31 = pDialogueWindow;
|
|
4423 v3 = 0;
|
|
4424 v32 = window_SpeakInHouse->ptr_1C;
|
|
4425 v118 = 0;
|
|
4426 //v33 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (signed int)v32] * 500.0);
|
|
4427 v33 = (signed __int64)(p2DEvents[(signed int)v32 - 1].flt_24 * 500.0);
|
|
4428 v119 = (const char **)(v33 * (100 - _this->GetMerchant()) / 100);
|
|
4429 if ( (signed int)v119 < v33 / 3 )
|
|
4430 v119 = (const char **)(v33 / 3);
|
|
4431 v34 = v31->pStartingPosActiveItem;
|
|
4432 v35 = v34 + v31->pNumPresenceButton;
|
|
4433 v122 = 0;
|
|
4434 if ( (signed int)v34 >= v35 )
|
|
4435 goto LABEL_140;
|
|
4436 do
|
|
4437 {
|
|
4438 v36 = v31->GetControl(v34)->uControlParam - 36;
|
|
4439 if ( byte_4ED970_skill_learn_ability_by_class_table[_this->classType][v36] && !_this->pActiveSkills[v36] )
|
|
4440 {
|
|
4441 v37 = pFontArrus->CalcTextHeight(pSkillNames[v36], &dialog_window, 0, 0);
|
|
4442 v118 += v37;
|
|
4443 ++v122;
|
|
4444 }
|
|
4445 ++v34;
|
|
4446 }
|
|
4447 while ( (signed int)v34 < v31->pNumPresenceButton + v31->pStartingPosActiveItem );
|
|
4448 if ( !v122 )
|
|
4449 {
|
|
4450 LABEL_140:
|
|
4451 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], _this->pName, pClassNames[_this->classType]);//
|
|
4452 // "Seek knowledge elsewhere %s the %s"
|
|
4453 strcat(pTmpBuf, "\n \n");
|
|
4454 strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]);// "I can offer you nothing further."
|
|
4455 v30 = pTmpBuf;
|
|
4456 v97 = 3;
|
|
4457 v95 = pTmpBuf;
|
|
4458 v92 = hilight_color;
|
|
4459 v91 = 0;
|
|
4460 v89 = 0;
|
|
4461 v88 = &dialog_window;
|
|
4462 goto LABEL_61;
|
|
4463 }
|
|
4464 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], v119);// "Skill Cost: %lu"
|
|
4465 dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u);
|
|
4466 v119 = (const char **)((149 - v118) / v122);
|
|
4467 if ( (149 - v118) / v122 > 32 )
|
|
4468 v119 = (const char **)32;
|
|
4469 result = v31->pStartingPosActiveItem;
|
|
4470 v38 = (149 - v122 * (signed int)v119 - v118) / 2 - (signed int)v119 / 2 + 162;
|
|
4471 v118 = result;
|
|
4472 v114 = v38;
|
|
4473 if ( result < result + v31->pNumPresenceButton )
|
|
4474 {
|
|
4475 v122 = 2;
|
|
4476 do
|
|
4477 {
|
|
4478 v39 = v31->GetControl(v118);
|
|
4479 v40 = v39;
|
|
4480 v41 = v39->uControlParam - 36;
|
|
4481 if ( !byte_4ED970_skill_learn_ability_by_class_table[_this->classType][v41] || _this->pActiveSkills[v41] )
|
|
4482 {
|
|
4483 v40->uW = 0;
|
|
4484 v40->uHeight = 0;
|
|
4485 v40->uY = 0;
|
|
4486 }
|
|
4487 else
|
|
4488 {
|
|
4489 v42 = pSkillNames[v41];
|
|
4490 v40->uY = (unsigned int)((char *)v119 + v114);
|
|
4491 Str = v42;
|
|
4492 v43 = pFontArrus->CalcTextHeight(v42, &dialog_window, 0, 0);
|
|
4493 v44 = v40->uY;
|
|
4494 v45 = v122;
|
|
4495 v40->uHeight = v43;
|
|
4496 v46 = v44 + v43 - 1;
|
|
4497 v40->uW = v46;
|
|
4498 v114 = v46;
|
|
4499 v47 = hilight_color;
|
|
4500 if ( pDialogueWindow->pCurrentPosActiveItem != v45 )
|
|
4501 v47 = m_text_color;
|
|
4502 dialog_window.DrawTitleText(pFontArrus, 0, v44, v47, Str, 3u);
|
|
4503 }
|
|
4504 v48 = v31->pStartingPosActiveItem;
|
|
4505 ++v118;
|
|
4506 result = v31->pNumPresenceButton + v48;
|
|
4507 ++v122;
|
|
4508 }
|
|
4509 while ( v118 < result );
|
|
4510 }
|
|
4511 }
|
|
4512 }
|
|
4513 return;
|
|
4514 }
|
|
4515 }
|
|
4516 else
|
|
4517 {
|
|
4518 if ( dialog_menu_id == 5 )
|
|
4519 {
|
|
4520 draw_leather();
|
|
4521 CharacterUI_InventoryTab_Draw(uActiveCharacter, 1);
|
|
4522 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[198], 0);// "Select the Item to Repair"
|
|
4523 result = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win();
|
|
4524 if ( !result
|
|
4525 || (v27 = pMouse->GetCursorPos(&v110)->x - 14,
|
|
4526 v117 = (v27 >> 5) + 14 * ((pMouse->GetCursorPos(&v108)->y - 17) >> 5),
|
|
4527 result = (int)pMouse->GetCursorPos(&v106),
|
|
4528 *(int *)result <= 13)
|
|
4529 || (result = (int)pMouse->GetCursorPos(&v104), *(int *)result >= 462)
|
|
4530 || (result = v0->GetItemIDAtInventoryIndex((int *)&v117), v3 = 0, !result)
|
|
4531 || (result *= 9, !(_this->field_1F5[4 * result + 15] & 2)) )
|
|
4532 return;
|
|
4533 v96 = 0;
|
|
4534 v94 = 5;
|
|
4535 v93 = window_SpeakInHouse->ptr_1C;
|
|
4536 v90 = (ItemGen *)&_this->spellbook.pDarkSpellbook.bIsSpellAvailable[4 * result + 5];
|
|
4537 v28 = (int)window_SpeakInHouse->ptr_1C;
|
|
4538 uPlayerID = uActiveCharacter - 1;
|
|
4539 v29 = _this->_490EEE((ItemGen *)&_this->spellbook.pDarkSpellbook.bIsSpellAvailable[4 * result + 5], 3, v28, 5);
|
|
4540 v9 = uPlayerID;
|
|
4541 v10 = (char *)pMerchantsRepairPhrases[v29];
|
|
4542 goto LABEL_35;
|
|
4543 }
|
|
4544 if ( dialog_menu_id == 1 )
|
|
4545 {
|
|
4546 /* result = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win();
|
|
4547 if ( result )
|
|
4548 {
|
|
4549 pShopOptions[0] = pGlobalTXT_LocalizationStrings[134];// "Buy Standard"
|
|
4550 pShopOptions[1] = pGlobalTXT_LocalizationStrings[152];// "Buy Special"
|
|
4551 pShopOptions[2] = pGlobalTXT_LocalizationStrings[159];// "Display Inventory"
|
|
4552 v14 = 0;
|
|
4553 pShopOptions[3] = pGlobalTXT_LocalizationStrings[160];// "Learn Skills"
|
|
4554 v15 = pShopOptions;
|
|
4555 do
|
|
4556 {
|
|
4557 v16 = pFontArrus->CalcTextHeight(*v15, &dialogue_window, 0, 0);
|
|
4558 ++v15;
|
|
4559 v14 += v16;
|
|
4560 }
|
|
4561 while ( (signed int)v15 < (signed int)&unk_F8B1C8 );
|
|
4562 v17 = pDialogueWindow;
|
|
4563 v114 = (174 - v14) / 4;
|
|
4564 result = pDialogueWindow->pStartingPosActiveItem;
|
|
4565 v18 = result + pDialogueWindow->pNumPresenceButton;
|
|
4566 v19 = (174 - 4 * (174 - v14) / 4 - v14) / 2 - (174 - v14) / 4 / 2 + 138;
|
|
4567 v20 = -pDialogueWindow->pNumPresenceButton < 0;
|
|
4568 v122 = pDialogueWindow->pStartingPosActiveItem;
|
|
4569 if ( v20 ^ __OFSUB__(result, v18) )
|
|
4570 {
|
|
4571 v119 = (const char **)2;
|
|
4572 _this = (Player *)pShopOptions;
|
|
4573 do
|
|
4574 {
|
|
4575 v21 = v17->GetControl(v122);
|
|
4576 v22 = (const char **)_this;
|
|
4577 v21->uY = v114 + v19;
|
|
4578 v23 = pFontArrus->CalcTextHeight(*v22, &dialogue_window, 0, 0);
|
|
4579 v24 = v21->uY;
|
|
4580 v25 = v119;
|
|
4581 v21->uHeight = v23;
|
|
4582 v19 = v24 + v23 - 1;
|
|
4583 v21->uW = v19;
|
|
4584 v26 = color2;
|
|
4585 if ( (const char **)pDialogueWindow->pCurrentPosActiveItem != v25 )
|
|
4586 v26 = m_text_color;
|
|
4587 dialogue_window.DrawTitleText(pFontArrus, 0, v24, v26, (const char *)LODWORD(_this->pConditions[0]), 3u);
|
|
4588 v17 = pDialogueWindow;
|
|
4589 v119 = (const char **)((char *)v119 + 1);
|
|
4590 _this = (Player *)((char *)_this + 4);
|
|
4591 ++v122;
|
|
4592 result = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem;
|
|
4593 }
|
|
4594 while ( v122 < result );
|
|
4595 }
|
|
4596 }*/
|
|
4597 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
|
|
4598 return;
|
|
4599 pShopOptions[0] = pGlobalTXT_LocalizationStrings[134]; //"Buy Standard"
|
|
4600 pShopOptions[1] = pGlobalTXT_LocalizationStrings[152]; //"Buy Special"
|
|
4601 pShopOptions[2] = pGlobalTXT_LocalizationStrings[159]; //"Display Inventory"
|
|
4602 pShopOptions[3] = pGlobalTXT_LocalizationStrings[160];
|
|
4603
|
|
4604 all_text_height = 0;
|
|
4605 for(int i=0;i<4;++i)
|
|
4606 all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0);
|
|
4607 v146 = (174 - all_text_height) / 4;
|
|
4608
|
|
4609 v23 = (174 - 4 * (174 - all_text_height) / 4 - all_text_height) / 2 - (174 - all_text_height) / 4 / 2 + 138;
|
|
4610 int j=0;
|
|
4611 if ( pDialogueWindow->pNumPresenceButton>=0 )
|
|
4612 {
|
|
4613 int th = 2;
|
|
4614 for (v152 = pDialogueWindow->pStartingPosActiveItem; v152 < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++v152)
|
|
4615 {
|
|
4616 control_button = pDialogueWindow->GetControl(v152);
|
|
4617 control_button->uY = v146 + v23;
|
|
4618 v27 = pFontArrus->CalcTextHeight(pShopOptions[j], &dialog_window, 0, 0);
|
|
4619 control_button->uHeight = v27;
|
|
4620 v23 = control_button->uY + control_button->uHeight - 1;
|
|
4621 control_button->uW = v23;
|
|
4622 text_color = hilight_color;
|
|
4623 if ( pDialogueWindow->pCurrentPosActiveItem != th )
|
|
4624 text_color = m_text_color;
|
|
4625 dialog_window.DrawTitleText(pFontArrus, 0, control_button->uY, text_color, pShopOptions[j], 3);
|
|
4626 ++th;
|
|
4627 ++j;
|
|
4628 }
|
|
4629 }
|
|
4630
|
|
4631
|
|
4632 return;
|
|
4633 }
|
|
4634 if ( dialog_menu_id != 2 )
|
|
4635 {
|
|
4636 if ( dialog_menu_id != 3 )
|
|
4637 {
|
|
4638 result = dialog_menu_id - 4;
|
|
4639 if ( dialog_menu_id == 4 )
|
|
4640 {
|
|
4641 draw_leather();
|
|
4642 CharacterUI_InventoryTab_Draw(uActiveCharacter, 1);
|
|
4643 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[197], 0);// "Select the Item to Identify"
|
|
4644 result = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win();
|
|
4645 if ( result )
|
|
4646 {
|
|
4647 v2 = pMouse->GetCursorPos(&a2)->x - 14;
|
|
4648 v117 = (v2 >> 5) + 14 * ((pMouse->GetCursorPos(&v98)->y - 17) >> 5);
|
|
4649 result = (int)pMouse->GetCursorPos(&v111);
|
|
4650 if ( *(int *)result > 13 )
|
|
4651 {
|
|
4652 result = (int)pMouse->GetCursorPos(&v103);
|
|
4653 if ( *(int *)result < 462 )
|
|
4654 {
|
|
4655 result = v0->GetItemIDAtInventoryIndex((int *)&v117);
|
|
4656 v3 = 0;
|
|
4657 if ( result )
|
|
4658 {
|
|
4659 v96 = 0;
|
|
4660 v94 = 4;
|
|
4661 v4 = (char *)&_this->pInventoryItems[result-1];
|
|
4662 if ( v4[20] & 1 )
|
|
4663 {
|
|
4664 v5 = BuilDialogueString("%24", uActiveCharacter - 1, (ItemGen *)v4, (char *)window_SpeakInHouse->ptr_1C, 4, 0);
|
|
4665 v97 = 3;
|
|
4666 v95 = v5;
|
|
4667 v92 = m_text_color;
|
|
4668 v6 = (212 - pFontArrus->CalcTextHeight(v5, &dialog_window, 0, 0)) / 2 + 101;
|
|
4669
|
|
4670 dialog_window.DrawTitleText(pFontArrus, v3, v6, v92, v95, v97);
|
|
4671 return;
|
|
4672 }
|
|
4673 v93 = window_SpeakInHouse->ptr_1C;
|
|
4674 v90 = (ItemGen *)v4;
|
|
4675 v7 = (int)window_SpeakInHouse->ptr_1C;
|
|
4676 uPlayerID = uActiveCharacter - 1;
|
|
4677 v8 = ((Player *)_this)->_490EEE((ItemGen *)v4, 3, v7, 4);
|
|
4678 v9 = uPlayerID;
|
|
4679 v10 = (char *)pMerchantsIdentifyPhrases[v8];
|
|
4680 goto LABEL_35;
|
|
4681 }
|
|
4682 }
|
|
4683 }
|
|
4684 }
|
|
4685 }
|
|
4686 return;
|
|
4687 }
|
|
4688 draw_leather();
|
|
4689 CharacterUI_InventoryTab_Draw(uActiveCharacter, 1);
|
|
4690 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[199], 0);// "Select the Item to Sell"
|
|
4691 result = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win();
|
|
4692 if ( !result
|
|
4693 || (v11 = pMouse->GetCursorPos(&v107)->x - 14,
|
|
4694 v117 = (v11 >> 5) + 14 * ((pMouse->GetCursorPos(&v99)->y - 17) >> 5),
|
|
4695 result = (int)pMouse->GetCursorPos(&v105),
|
|
4696 *(int *)result <= 13)
|
|
4697 || (result = (int)pMouse->GetCursorPos(&v101), *(int *)result >= 462)
|
|
4698 || (result = v0->GetItemIDAtInventoryIndex((int *)&v117), v3 = 0, !result) )
|
|
4699 return;
|
|
4700 v96 = 0;
|
|
4701 v94 = 3;
|
|
4702 v93 = window_SpeakInHouse->ptr_1C;
|
|
4703 v90 = (ItemGen *)&_this->pInventoryItems[result-1];
|
|
4704 v12 = (int)window_SpeakInHouse->ptr_1C;
|
|
4705 uPlayerID = uActiveCharacter - 1;
|
|
4706 v13 = _this->_490EEE(v90, 3, v12, 3);
|
|
4707 v9 = uPlayerID;
|
|
4708 v10 = (char *)pMerchantsSellPhrases[v13];
|
|
4709 LABEL_35:
|
|
4710 v30 = BuilDialogueString(v10, v9, v90, (char *)v93, v94, v96);
|
|
4711 v97 = 3;
|
|
4712 v95 = v30;
|
|
4713 v92 = m_text_color;
|
|
4714 v91 = v3;
|
|
4715 v89 = v3;
|
|
4716 v88 = &dialog_window;
|
|
4717 LABEL_61:
|
|
4718 v6 = (174 - pFontArrus->CalcTextHeight(v30, v88, v89, v91)) / 2 + 138;
|
|
4719 dialog_window.DrawTitleText(pFontArrus, v3, v6, v92, v95, v97);
|
|
4720 return;
|
|
4721 }
|
|
4722 }
|
|
4723 pRenderer->DrawTextureIndexed(8u, 8u, ShopTexture);
|
|
4724 v3 = 0;
|
|
4725 v49 = 0;
|
|
4726 v122 = 0;
|
|
4727 if ( dialog_menu_id == 2 )
|
|
4728 {
|
|
4729 do
|
|
4730 {
|
|
4731 // if ( pParty->field_777C[9 * (v49 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] )
|
|
4732 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v49].uItemID);
|
|
4733 {
|
|
4734 v50 = ItemsInShopTexture[v49];
|
|
4735 v51 = 152 - v50->uTextureHeight;
|
|
4736 if ( (signed int)v51 < 1 )
|
|
4737 v51 = 0;
|
|
4738 v52 = 75 * v49 - v50->uTextureWidth / 2 + 40;
|
|
4739 if ( v122 )
|
|
4740 {
|
|
4741 if ( v122 == 5 )
|
|
4742 {
|
|
4743 v53 = ItemsInShopTexture[5]->uTextureWidth;
|
|
4744 if ( (signed int)v52 > 457 - v53 )
|
|
4745 v52 = 457 - v53;
|
|
4746 }
|
|
4747 }
|
|
4748 else
|
|
4749 {
|
|
4750 if ( (signed int)v52 < 18 )
|
|
4751 v52 = 18;
|
|
4752 }
|
|
4753 pRenderer->DrawTextureTransparent(v52, v51, v50);
|
|
4754 sub_40F92A(&pRenderer->pActiveZBuffer[v52 + 640 * v51], ItemsInShopTexture[v122], v122 + 1);
|
|
4755 v49 = v122;
|
|
4756 }
|
|
4757 ++v49;
|
|
4758 v122 = v49;
|
|
4759 }
|
|
4760 while ( v49 < 6 );
|
|
4761 v122 = 0;
|
|
4762 do
|
|
4763 {
|
|
4764 //if ( pParty->field_777C[9 * (v122 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 54] )
|
|
4765 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v122+1].uItemID);
|
|
4766 {
|
|
4767 v54 = ItemsInShopTexture[v122 + 6];
|
|
4768 v55 = 306 - v54->uTextureHeight;
|
|
4769 v56 = 75 * v122 - v54->uTextureWidth / 2 + 40;
|
|
4770 if ( v122 )
|
|
4771 {
|
|
4772 if ( v122 == 5 )
|
|
4773 {
|
|
4774 v57 = ItemsInShopTexture[11]->uTextureWidth;
|
|
4775 if ( (signed int)v56 > 457 - v57 )
|
|
4776 v56 = 457 - v57;
|
|
4777 }
|
|
4778 }
|
|
4779 else
|
|
4780 {
|
|
4781 if ( (signed int)v56 < 18 )
|
|
4782 v56 = 18;
|
|
4783 }
|
|
4784 pRenderer->DrawTextureTransparent(v56, v55, v54);
|
|
4785 sub_40F92A(&pRenderer->pActiveZBuffer[v56 + 640 * v55], ItemsInShopTexture[v122 + 6], v122 + 7);
|
|
4786 }
|
|
4787 ++v122;
|
|
4788 }
|
|
4789 while ( v122 < 6 );
|
|
4790 }
|
|
4791 else
|
|
4792 {
|
|
4793 do
|
|
4794 {
|
|
4795 // if ( pParty->field_C59C[9 * (v49 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] )
|
|
4796 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v49].uItemID)
|
|
4797 {
|
|
4798 v58 = ItemsInShopTexture[v49];
|
|
4799 v59 = 152 - v58->uTextureHeight;
|
|
4800 if ( (signed int)v59 < 1 )
|
|
4801 v59 = 0;
|
|
4802 v60 = 75 * v49 - v58->uTextureWidth / 2 + 40;
|
|
4803 if ( v122 )
|
|
4804 {
|
|
4805 if ( v122 == 5 )
|
|
4806 {
|
|
4807 v61 = ItemsInShopTexture[5]->uTextureWidth;
|
|
4808 if ( (signed int)v60 > 457 - v61 )
|
|
4809 v60 = 457 - v61;
|
|
4810 }
|
|
4811 }
|
|
4812 else
|
|
4813 {
|
|
4814 if ( (signed int)v60 < 18 )
|
|
4815 v60 = 18;
|
|
4816 }
|
|
4817 pRenderer->DrawTextureTransparent(v60, v59, v58);
|
|
4818 sub_40F92A(&pRenderer->pActiveZBuffer[v60 + 640 * v59], ItemsInShopTexture[v122], v122 + 1);
|
|
4819 v49 = v122;
|
|
4820 }
|
|
4821 ++v49;
|
|
4822 v122 = v49;
|
|
4823 }
|
|
4824 while ( v49 < 6 );
|
|
4825 v122 = 0;
|
|
4826 do
|
|
4827 {
|
|
4828 //if ( pParty->Spell_Item[(unsigned int)window_SpeakInHouse->ptr_1C][v49] + 778] ) //weak
|
|
4829 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v49].uAttributes)
|
|
4830 {
|
|
4831 v62 = ItemsInShopTexture[v122 + 6];
|
|
4832 v63 = 306 - v62->uTextureHeight;
|
|
4833 if ( (signed int)v63 < 1 )
|
|
4834 v63 = 0;
|
|
4835 v64 = 75 * v122 - v62->uTextureWidth / 2 + 40;
|
|
4836 if ( v122 )
|
|
4837 {
|
|
4838 if ( v122 == 5 )
|
|
4839 {
|
|
4840 v65 = ItemsInShopTexture[11]->uTextureWidth;
|
|
4841 if ( (signed int)v64 > 457 - v65 )
|
|
4842 v64 = 457 - v65;
|
|
4843 }
|
|
4844 }
|
|
4845 else
|
|
4846 {
|
|
4847 if ( (signed int)v64 < 18 )
|
|
4848 v64 = 18;
|
|
4849 }
|
|
4850 pRenderer->DrawTextureTransparent(v64, v63, v62);
|
|
4851 sub_40F92A(&pRenderer->pActiveZBuffer[v64 + 640 * v63], ItemsInShopTexture[v122 + 6], v122 + 7);
|
|
4852 }
|
|
4853 ++v122;
|
|
4854 }
|
|
4855 while ( v122 < 6 );
|
|
4856 }
|
|
4857 result = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win();
|
|
4858 if ( result )
|
|
4859 {
|
|
4860 v66 = 0;
|
|
4861 v117 = 0;
|
|
4862 if ( dialog_menu_id == 2 )
|
|
4863 {
|
|
4864 do
|
|
4865 {
|
|
4866 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v66].uItemID); //9 * (v66 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] )
|
|
4867 ++v117;
|
|
4868 ++v66;
|
|
4869 }
|
|
4870 while ( v66 < 12 );
|
|
4871 }
|
|
4872 else
|
|
4873 {
|
|
4874 do
|
|
4875 {
|
|
4876 //if ( pParty->field_C59C[9 * (v66 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] )
|
|
4877 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v66].uItemID)
|
|
4878 ++v117;
|
|
4879 ++v66;
|
|
4880 }
|
|
4881 while ( v66 < 12 );
|
|
4882 }
|
|
4883 v67 = GetAsyncKeyState(VK_CONTROL);
|
|
4884 v68 = _this->CanSteal();
|
|
4885 Str = (char *)v68;
|
|
4886 if ( v67 && v68 )
|
|
4887 {
|
|
4888 v69 = pGlobalTXT_LocalizationStrings[185];// "Steal item"
|
|
4889 }
|
|
4890 else
|
|
4891 {
|
|
4892 v69 = pGlobalTXT_LocalizationStrings[195];// "Select the Item to Buy"
|
|
4893 if ( dialog_menu_id != 2 )
|
|
4894 v69 = pGlobalTXT_LocalizationStrings[196];// "Select the Special Item to Buy"
|
|
4895 }
|
|
4896 DrawTextAtStatusBar(v69, 0);
|
|
4897 if ( !v117 )
|
|
4898 {
|
|
4899 dialog_window.DrawCurrentTime( pParty->field_3C.field_50[(unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed);
|
|
4900 return;
|
|
4901 }
|
|
4902 v70 = pMouse->GetCursorPos(&v102);
|
|
4903 result = v70->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v100)->y];
|
|
4904 if ( pRenderer->pActiveZBuffer[result] & 0xFFFF )
|
|
4905 {
|
|
4906 v71 = (pRenderer->pActiveZBuffer[result] & 0xFFFF) - 1;
|
|
4907 v117 = v71;
|
|
4908 v72 = (int)window_SpeakInHouse->ptr_1C;
|
|
4909 // v73 = 9 * (v71 + 12 * v72);
|
|
4910 v74 = (ItemGen *)&pParty->StandartItemsInShops[v72][v71];
|
|
4911 if ( dialog_menu_id != 2 )
|
|
4912 // v74 = (ItemGen *)&pParty->field_C59C[v73 + 724];
|
|
4913 v74 =&pParty->SpecialItemsInShops[v72][v71];
|
|
4914 if ( v67 && Str )
|
|
4915 {
|
|
4916 v10 = pGlobalTXT_LocalizationStrings[181];// "Steal %24"
|
|
4917 v96 = 0;
|
|
4918 v94 = 2;
|
|
4919 v93 = window_SpeakInHouse->ptr_1C;
|
|
4920 v90 = v74;
|
|
4921 v9 = uActiveCharacter - 1;
|
|
4922 }
|
|
4923 else
|
|
4924 {
|
|
4925 v96 = 0;
|
|
4926 v94 = 2;
|
|
4927 v93 = window_SpeakInHouse->ptr_1C;
|
|
4928 v90 = v74;
|
|
4929 uPlayerID = uActiveCharacter - 1;
|
|
4930 v75 = _this->_490EEE(v74, 3, v72, 2);
|
|
4931 v9 = uPlayerID;
|
|
4932 v10 = (char *)pMerchantsBuyPhrases[v75];
|
|
4933 }
|
|
4934 goto LABEL_35;
|
|
4935 }
|
|
4936 }
|
|
4937 return;
|
|
4938 }
|