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);
|
644
|
1017 v4 = v3 * (100 - pPlayer->GetMerchant()) / 100;
|
629
|
1018 if ( v4 < v3 / 3 )
|
|
1019 v4 = v3 / 3;
|
|
1020 v5 = 1;
|
|
1021 pOutString = (GUIFont *)v4;
|
|
1022 if ( v4 <= 0 )
|
|
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 )
|
|
1027 v7 = v6 / 3;
|
|
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
|
|
1041 sprintf(Dest, "\xC" "%05d", pDialogueWindow->pCurrentPosActiveItem == 2 ? pColorYellow : pColorWhite);
|
|
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
|
|
1047 sprintf(a1, "\xC" "%05d", pDialogueWindow->pCurrentPosActiveItem == 3 ? pColorYellow : pColorWhite);
|
|
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
|
|
1055 sprintf(v77, "\xC" "%05d", pDialogueWindow->pCurrentPosActiveItem == 4 ? pColorYellow : pColorWhite);
|
|
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;
|
|
1061 v31 = (signed int)window_SpeakInHouse->ptr_1C;
|
|
1062 if ( v31 >= 108 && v31 <= 120 )
|
|
1063 {
|
648
|
1064 sprintf(v75, "\xC" "%05d", pDialogueWindow->pCurrentPosActiveItem == 5 ? pColorYellow : pColorWhite);
|
|
1065 strcat(v75, pGlobalTXT_LocalizationStrings[611]); // Play Arcomage
|
644
|
1066 pTextHeight = pFontArrus->CalcTextHeight(v75, &dialog_window, 0, 0);
|
|
1067 }
|
|
1068 v34 = pDialogueWindow->pStartingPosActiveItem;
|
|
1069 v35 = v34 + pDialogueWindow->pNumPresenceButton;
|
|
1070 v36 = LOBYTE(pFontArrus->uFontHeight) - 3;
|
|
1071 v37 = -pDialogueWindow->pNumPresenceButton < 0;
|
|
1072 pOutString = (GUIFont *)pDialogueWindow->pStartingPosActiveItem;
|
|
1073 if ( !(v37 ^ v34 < v35) )
|
|
1074 {
|
648
|
1075 sprintf(pTmpBuf, "%s%s%s%s", Dest, a1, v77, v75);
|
644
|
1076 dialog_window.DrawTitleText(pFontArrus, 0, 146, 0, pTmpBuf, 3);
|
|
1077 return;
|
|
1078 }
|
|
1079 while ( 1 )
|
|
1080 {
|
|
1081 pButton = pDialogueWindow->GetControl((unsigned int)pOutString);
|
|
1082 if ( pButton->uControlParam == 15 )
|
629
|
1083 {
|
644
|
1084 v46 = pTextHeight;
|
|
1085 pButton->uHeight = pTextHeight;
|
|
1086 pButton->uY = 146;
|
|
1087 v41 = v46 + 145;
|
|
1088 pButton->uW = v41;
|
629
|
1089 }
|
644
|
1090 else if ( pButton->uControlParam == 16 )
|
|
1091 {
|
|
1092 v44 = v88;
|
|
1093 v45 = pTextHeight + v36 + 146;
|
|
1094 pButton->uHeight = v88;
|
|
1095 pButton->uY = v45;
|
|
1096 v41 = v45 + v44 - 1;
|
|
1097 pButton->uW = v41;
|
|
1098 }
|
|
1099 else if ( pButton->uControlParam == 96 )
|
629
|
1100 {
|
644
|
1101 v42 = pTextHeight + v88 + 2 * v36 + 146;
|
|
1102 v43 = v82;
|
|
1103 pButton->uY = v42;
|
|
1104 pButton->uHeight = v43;
|
|
1105 v41 = v43 + v42 - 1;
|
|
1106 pButton->uW = v41;
|
|
1107 }
|
|
1108 else if ( pButton->uControlParam == 101 )
|
|
1109 {
|
|
1110 v39 = pTextHeight + 3 * v36 + pTextHeight + v88 + 146;
|
|
1111 v40 = v87;
|
|
1112 pButton->uHeight = pTextHeight;
|
|
1113 pButton->uY = v39;
|
|
1114 v41 = v39 + v40 - 1;
|
|
1115 pButton->uW = v41;
|
|
1116 }
|
|
1117 pOutString = (GUIFont *)((char *)pOutString + 1);
|
|
1118 if ( (signed int)pOutString >= pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem )
|
|
1119 {
|
|
1120 sprintf(pTmpBuf, "%s%s%s%s", &Dest, &a1, &v77, &v75);
|
|
1121 dialog_window.DrawTitleText(pFontArrus, 0, 146, 0, pTmpBuf, 3);
|
629
|
1122 return;
|
|
1123 }
|
644
|
1124 }
|
|
1125 break;
|
|
1126 }
|
|
1127 case DIALOG_SHOP_ARCOMAGE_102:
|
|
1128 {
|
|
1129 __debugbreak;
|
|
1130 pOutString = pFontArrus;
|
|
1131 strcpy(pTmpBuf, pNPCTopics[354].pText);
|
|
1132 dialog_window.uFrameWidth = 460;
|
|
1133 dialog_window.uFrameZ = 452;
|
|
1134 pTextHeight = pFontArrus->CalcTextHeight(pTmpBuf, &dialog_window, 12, 0) + 7;
|
|
1135 if ( 352 - pTextHeight < 8 )
|
|
1136 {
|
|
1137 pOutString = pFontCreate;
|
|
1138 pTextHeight = pFontCreate->CalcTextHeight(pTmpBuf, &dialog_window, 12, 0) + 7;
|
|
1139 }
|
|
1140 auto pTex = (uTextureID_Leather != -1 ? &pIcons_LOD->pTextures[uTextureID_Leather] : 0);
|
|
1141 pRenderer->_4A6A68(8, 352 - pTextHeight, pTex, (pTex ? pTex->uTextureHeight : 26) - pTextHeight);
|
|
1142 pRenderer->DrawTextureIndexed(8, 347 - pTextHeight, pTexture_591428);
|
|
1143 v63 = FitTextInAWindow(pTmpBuf, pOutString, &dialog_window, 0xCu, 0);
|
|
1144 window_SpeakInHouse->DrawText(pOutString, 12, 354 - pTextHeight, 0, v63, 0, 0, 0);
|
|
1145 break;
|
|
1146 }
|
|
1147 case DIALOG_SHOP_ARCOMAGE_103:
|
|
1148 {
|
|
1149 __debugbreak;
|
|
1150 strcpy(pTmpBuf, pNPCTopics[(uint)window_SpeakInHouse->ptr_1C + 247].pText);
|
|
1151 dialog_window.uFrameWidth = 460;
|
|
1152 dialog_window.uFrameZ = 452;
|
|
1153 v61 = pFontArrus->CalcTextHeight(pTmpBuf, &dialog_window, 12, 0);
|
|
1154 pTextHeight = v61 + 7;
|
|
1155 auto pTex = (uTextureID_Leather != -1 ? &pIcons_LOD->pTextures[uTextureID_Leather] : nullptr);
|
|
1156 pRenderer->_4A6A68(8, 352 - (v61 + 7), pTex, (pTex ? pTex->uTextureHeight : 26) - (v61 + 7));
|
|
1157 pRenderer->DrawTextureIndexed(8, 347 - pTextHeight, pTexture_591428);
|
|
1158 v63 = FitTextInAWindow(pTmpBuf, pFontArrus, &dialog_window, 0xCu, 0);
|
|
1159 window_SpeakInHouse->DrawText(pFontArrus, 12, 354 - pTextHeight, 0, v63, 0, 0, 0);
|
|
1160 break;
|
|
1161 }
|
|
1162 case DIALOG_SHOP_ARCOMAGE_RESULT:
|
|
1163 {
|
|
1164 if ( pArcomageGame->bGameInProgress == 1 )
|
|
1165 return;
|
|
1166 if ( pArcomageGame->uGameResult )
|
|
1167 {
|
|
1168 if ( pArcomageGame->uGameResult == 1 )
|
|
1169 v72 = pGlobalTXT_LocalizationStrings[640];// You won!
|
|
1170 else
|
|
1171 v72 = pGlobalTXT_LocalizationStrings[641];// You lost!
|
|
1172 }
|
|
1173 else
|
|
1174 {
|
|
1175 v72 = pGlobalTXT_LocalizationStrings[639];// A tie!
|
|
1176 }
|
|
1177 strcpy(pTmpBuf, v72);
|
|
1178 v66 = (174 - pFontArrus->CalcTextHeight(pTmpBuf, &dialog_window, 0, 0)) / 2 + 138;
|
|
1179 dialog_window.DrawTitleText(pFontArrus, 0, v66, pColorYellow, pTmpBuf, 3);
|
|
1180 break;
|
|
1181 }
|
|
1182 case DIALOG_SHOP_REST:
|
|
1183 {
|
|
1184 if ( pParty->uNumGold >= (unsigned int)pOutString )
|
|
1185 {
|
|
1186 Party::TakeGold((unsigned int)pOutString);
|
|
1187 v27 = (int)window_SpeakInHouse->ptr_1C;
|
|
1188 HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 2);
|
|
1189 dialog_menu_id = 0;
|
|
1190 sub_4BD8B5();
|
|
1191 sub_4B1D27();
|
|
1192 pVideoPlayer->Unload();
|
|
1193 window_SpeakInHouse->Release();
|
|
1194 window_SpeakInHouse = 0;
|
|
1195 if ( pMessageQueue_50CBD0->uNumMessages )
|
|
1196 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
|
|
1197 pMessageQueue_50CBD0->pMessages[0].eType = UIMSG_OpenRestUI;
|
|
1198 pMessageQueue_50CBD0->pMessages[0].param = v27;
|
|
1199 pMessageQueue_50CBD0->pMessages[0].field_8 = 1;
|
|
1200 ++pMessageQueue_50CBD0->uNumMessages;
|
|
1201 return;
|
|
1202 }
|
|
1203 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);
|
|
1204 HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 4);
|
|
1205 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, v5, 0);
|
|
1206 break;
|
|
1207 }
|
|
1208 case DIALOG_SHOP_SKILLS:
|
|
1209 {
|
|
1210 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
|
|
1211 return;
|
|
1212 v0 = 0;
|
|
1213 v9 = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0);
|
|
1214 pItemNum = v9 * (100 - pPlayer->GetMerchant()) / 100;
|
|
1215 if ( pItemNum < v9 / 3 )
|
|
1216 pItemNum = v9 / 3;
|
|
1217 pNumActiveItem = pDialogueWindow->pStartingPosActiveItem;
|
|
1218 all_text_height = 0;
|
|
1219 if ( pNumActiveItem < pNumActiveItem + pDialogueWindow->pNumPresenceButton )
|
|
1220 {
|
|
1221 do
|
629
|
1222 {
|
644
|
1223 v12 = pDialogueWindow->GetControl(pNumActiveItem)->uControlParam - 36;
|
|
1224 if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayer->classType][v12] && !pPlayer->pActiveSkills[v12] )
|
|
1225 {
|
|
1226 all_text_height = pFontArrus->CalcTextHeight(pSkillNames[v12], &dialog_window, 0, 0);
|
|
1227 v0++;
|
|
1228 }
|
|
1229 ++pNumActiveItem;
|
|
1230 }
|
|
1231 while ( pNumActiveItem < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton );
|
|
1232 if ( v0 )
|
|
1233 {
|
|
1234 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], pItemNum);
|
|
1235 dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3);
|
|
1236 v91 = (149 - all_text_height) / v0;
|
|
1237 if ( (149 - all_text_height) / v0 > 32 )
|
|
1238 v91 = 32;
|
|
1239 v14 = (149 - v0 * v91 - all_text_height) / 2 - v91 / 2 + 162;
|
|
1240 pNumActiveItem = pDialogueWindow->pStartingPosActiveItem;
|
|
1241 if ( pNumActiveItem < pNumActiveItem + pDialogueWindow->pNumPresenceButton )
|
|
1242 {
|
|
1243 pItemNum = 2;
|
|
1244 do
|
|
1245 {
|
|
1246 pButton = pDialogueWindow->GetControl(pItemNum);
|
|
1247 v17 = pButton->uControlParam - 36;
|
|
1248 if ( !byte_4ED970_skill_learn_ability_by_class_table[pPlayer->classType][v17] || pPlayer->pActiveSkills[v17] )
|
|
1249 {
|
|
1250 pButton->uW = 0;
|
|
1251 pButton->uHeight = 0;
|
|
1252 pButton->uY = 0;
|
|
1253 }
|
|
1254 else
|
|
1255 {
|
|
1256 pButton->uY = v91 + v14;
|
|
1257 pTextHeight = pFontArrus->CalcTextHeight(pSkillNames[v17], &dialog_window, 0, 0);
|
|
1258 pButton->uHeight = pTextHeight;
|
|
1259 v14 = pTextHeight + pButton->uY - 1;
|
|
1260 pButton->uW = v14;
|
|
1261 pColorText = pColorYellow;
|
|
1262 if ( pDialogueWindow->pCurrentPosActiveItem != pItemNum )
|
|
1263 pColorText = pColorWhite;
|
|
1264 dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, pSkillNames[v17], 3);
|
|
1265 }
|
|
1266 pNumActiveItem = pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton;
|
|
1267 pItemNum++;
|
|
1268 }
|
|
1269 while ( pItemNum < pNumActiveItem );
|
|
1270 }
|
629
|
1271 return;
|
|
1272 }
|
644
|
1273 }
|
|
1274 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], pPlayer->pName, pClassNames[pPlayer->classType]);
|
|
1275 strcat(pTmpBuf, "\n \n");
|
|
1276 strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]);
|
|
1277 pTextHeight = (174 - pFontArrus->CalcTextHeight(pTmpBuf, &dialog_window, 0, 0)) / 2 + 138;
|
|
1278 dialog_window.DrawTitleText(pFontArrus, 0, pTextHeight, pColorYellow, pTmpBuf, 3);
|
|
1279 return;
|
|
1280 }
|
|
1281 case DIALOG_SHOP_BYE_FOOD:
|
|
1282 {
|
|
1283 *(_QWORD *)Str = pParty->uNumFoodRations;
|
|
1284 //if ( (double)pParty->uNumFoodRations >= p2DEvents_minus1__20[13 * (unsigned int)ptr_507BC0->ptr_1C] )
|
|
1285 if ( (double)pParty->uNumFoodRations >= p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier )
|
|
1286 {
|
|
1287 ShowStatusBarString(pGlobalTXT_LocalizationStrings[140], 2);
|
|
1288 if ( uActiveCharacter )
|
|
1289 pPlayers[uActiveCharacter]->PlaySound(SPEECH_67, 0);
|
629
|
1290 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, v5, 0);
|
644
|
1291 return;
|
|
1292 }
|
|
1293 if ( pParty->uNumGold >= v7 )
|
|
1294 {
|
|
1295 Party::TakeGold(v7);
|
|
1296 //pParty->uNumFoodRations = (signed __int64)p2DEvents_minus1__20[13 * (unsigned int)ptr_507BC0->ptr_1C];
|
|
1297 pParty->uNumFoodRations = (signed __int64)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier;
|
|
1298 HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 3);
|
|
1299 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
|
|
1300 return;
|
|
1301 }
|
646
|
1302 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);
|
644
|
1303 HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 4);
|
|
1304 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, v5, 0);
|
|
1305 break;
|
|
1306 }
|
|
1307 case DIALOG_SHOP_ARCOMAGE_MAIN:
|
|
1308 {
|
|
1309 if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
|
|
1310 {
|
|
1311 v48 = 2;
|
|
1312 pShopOptions[0] = pGlobalTXT_LocalizationStrings[620];
|
|
1313 pShopOptions[1] = pGlobalTXT_LocalizationStrings[622];
|
|
1314 pOutString = 0;
|
|
1315 if ( pParty->HasItem(0x28Bu) )
|
|
1316 {
|
|
1317 pShopOptions[2] = pGlobalTXT_LocalizationStrings[621];
|
|
1318 v48 = 3;
|
|
1319 }
|
|
1320 for ( i = 0; i < v48; ++i )
|
|
1321 all_text_height = pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0);
|
|
1322 all_text_height = (174 - all_text_height) / v48;
|
|
1323 pNumActiveItem = pDialogueWindow->pStartingPosActiveItem;
|
|
1324 v54 = (174 - v48 * (174 - all_text_height) / v48 - all_text_height) / 2 - (174 - all_text_height) / v48 / 2 + 138;
|
|
1325 v37 = -pDialogueWindow->pNumPresenceButton < 0;
|
|
1326 if ( v37 ^ pNumActiveItem < pNumActiveItem + pDialogueWindow->pNumPresenceButton )
|
|
1327 {
|
|
1328 pItemNum = 2;
|
|
1329 pNumString = 0;
|
|
1330 do
|
|
1331 {
|
|
1332 pButton = pDialogueWindow->GetControl(pItemNum);
|
|
1333 pButton->uY = all_text_height + v54;
|
|
1334 pTextHeight = pFontArrus->CalcTextHeight((const char *)pShopOptions[pNumString], &dialog_window, 0, 0);
|
|
1335 pButton->uHeight = pTextHeight;
|
|
1336 v54 = pButton->uY + pTextHeight - 1;
|
|
1337 pButton->uW = v54;
|
|
1338 pColorText = pColorYellow;
|
|
1339 if ( pDialogueWindow->pCurrentPosActiveItem != pItemNum )
|
|
1340 pColorText = pColorWhite;
|
|
1341 dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, *(const char **)&pOutString->cFirstChar, 3);
|
|
1342 pItemNum++;
|
|
1343 pNumActiveItem = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem;
|
|
1344 }
|
|
1345 while ( pItemNum < pNumActiveItem );
|
|
1346 }
|
|
1347 }
|
|
1348 break;
|
|
1349 }
|
|
1350 default:
|
|
1351 {
|
|
1352 break;
|
|
1353 }
|
629
|
1354 }
|
|
1355 }
|
|
1356
|
|
1357
|
|
1358 //----- (004B910F) --------------------------------------------------------
|
|
1359 void __cdecl WeaponShopDialog()
|
|
1360 {
|
634
|
1361 int v0; // ebx@1
|
629
|
1362 int pNumActiveItem; // eax@6
|
|
1363 signed int v2; // esi@8
|
|
1364 ItemGen *v4; // eax@11
|
|
1365 char *v5; // ecx@12
|
|
1366 unsigned __int8 v6; // dl@13
|
|
1367 char *v7; // edx@14
|
|
1368 int v9; // ST08_4@16
|
|
1369 int v10; // eax@16
|
|
1370 signed int v11; // esi@18
|
|
1371 int v12; // ST08_4@21
|
|
1372 int v13; // eax@21
|
|
1373 int v14; // edi@23
|
|
1374 char **v15; // esi@23
|
|
1375 int v16; // eax@24
|
644
|
1376 //int v18; // edx@25
|
629
|
1377 int v19; // edi@25
|
|
1378 unsigned __int8 v20; // sf@25
|
|
1379 GUIButton *pButton; // esi@27
|
|
1380 int pNewItem; // eax@27
|
|
1381 unsigned int v24; // ecx@27
|
|
1382 int v25; // edx@27
|
644
|
1383 unsigned int pColorText; // ax@27
|
629
|
1384 signed int v27; // esi@32
|
|
1385 int v28; // ST08_4@36
|
|
1386 int v29; // eax@36
|
|
1387 signed int v32; // esi@41
|
|
1388 unsigned int v33; // esi@43
|
|
1389 int v34; // eax@43
|
|
1390 unsigned int v35; // eax@44
|
|
1391 int v36; // eax@46
|
|
1392 __int32 v37; // ecx@51
|
|
1393 int v40; // eax@53
|
|
1394 char *v41; // eax@55
|
|
1395 unsigned int v43; // ecx@55
|
|
1396 const char **v44; // edx@55
|
|
1397 int v45; // eax@55
|
|
1398 int v47; // eax@59
|
|
1399 const char **v48; // eax@63
|
|
1400 unsigned int v49; // esi@65
|
|
1401 Texture *v50; // eax@65
|
|
1402 int v51; // edi@65
|
|
1403 int v52; // esi@70
|
|
1404 Texture *v53; // ST1C_4@70
|
|
1405 int v54; // edi@70
|
|
1406 signed int v55; // ecx@73
|
|
1407 SHORT v56; // di@82
|
|
1408 bool v57; // eax@82
|
|
1409 const char *v58; // ecx@84
|
|
1410 POINT *v59; // esi@89
|
|
1411 LONG v60; // ecx@90
|
|
1412 int v61; // eax@90
|
|
1413 int v62; // ecx@90
|
|
1414 ItemGen *v63; // esi@90
|
|
1415 int v64; // eax@95
|
|
1416 int all_text_height; // esi@96
|
|
1417 char **v66; // edi@96
|
|
1418 int v67; // eax@97
|
|
1419 int v69; // edx@98
|
|
1420 int v70; // edi@98
|
634
|
1421 int v71;
|
629
|
1422 const char **v72; // eax@100
|
|
1423 int pTextHeight; // eax@100
|
|
1424 unsigned int v74; // ecx@100
|
|
1425 int v78; // [sp-14h] [bp-10Ch]@14
|
|
1426 ItemGen *v79; // [sp-10h] [bp-108h]@12
|
|
1427 int v80; // [sp-10h] [bp-108h]@14
|
|
1428 void *v81; // [sp-Ch] [bp-104h]@12
|
|
1429 unsigned __int16 v82; // [sp-Ch] [bp-104h]@14
|
|
1430 int v83; // [sp-8h] [bp-100h]@11
|
|
1431 char *v84; // [sp-8h] [bp-100h]@14
|
|
1432 __int64 *v85; // [sp-4h] [bp-FCh]@11
|
|
1433 unsigned int v86; // [sp-4h] [bp-FCh]@14
|
|
1434 POINT v87; // [sp+Ch] [bp-ECh]@8
|
|
1435 POINT v88; // [sp+14h] [bp-E4h]@18
|
|
1436 POINT v89; // [sp+1Ch] [bp-DCh]@89
|
|
1437 POINT v90; // [sp+24h] [bp-D4h]@19
|
|
1438 POINT v91; // [sp+2Ch] [bp-CCh]@89
|
|
1439 POINT v92; // [sp+34h] [bp-C4h]@9
|
|
1440 POINT v93; // [sp+3Ch] [bp-BCh]@33
|
|
1441 POINT v94; // [sp+44h] [bp-B4h]@18
|
|
1442 POINT v95; // [sp+4Ch] [bp-ACh]@32
|
|
1443 POINT v96; // [sp+54h] [bp-A4h]@18
|
|
1444 POINT v97; // [sp+5Ch] [bp-9Ch]@32
|
|
1445 POINT a2; // [sp+64h] [bp-94h]@8
|
|
1446 POINT v99; // [sp+6Ch] [bp-8Ch]@32
|
|
1447 POINT v100; // [sp+74h] [bp-84h]@8
|
|
1448 GUIWindow dialog_window; // [sp+7Ch] [bp-7Ch]@1
|
|
1449 char *Str; // [sp+D0h] [bp-28h]@55
|
|
1450 __int32 v103; // [sp+D4h] [bp-24h]@25
|
644
|
1451 int pColorYellow; // [sp+D8h] [bp-20h]@1
|
629
|
1452 int pColorWhite; // [sp+DCh] [bp-1Ch]@1
|
|
1453 POINT v106; // [sp+E0h] [bp-18h]@8
|
|
1454 Player *pPlayer; // [sp+E8h] [bp-10h]@1
|
|
1455 int pItemNum; // [sp+ECh] [bp-Ch]@26
|
|
1456 const char **v109; // [sp+F0h] [bp-8h]@26
|
|
1457 unsigned __int8 v110; // [sp+F7h] [bp-1h]@16
|
|
1458 int pNumString;
|
|
1459
|
|
1460 pPlayer = pPlayers[uActiveCharacter];
|
|
1461 memcpy(&dialog_window, window_SpeakInHouse, sizeof(dialog_window));
|
|
1462 dialog_window.uFrameX = 483;
|
|
1463 dialog_window.uFrameWidth = 148;
|
|
1464 dialog_window.uFrameZ = 334;
|
|
1465 pColorWhite = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu);
|
644
|
1466 pColorYellow = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xCDu, 0x23u);
|
629
|
1467 switch(dialog_menu_id)
|
|
1468 {
|
|
1469 case DIALOG_SHOP_MAIN:
|
|
1470 {
|
|
1471 pNumActiveItem = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win();
|
|
1472 if ( pNumActiveItem )
|
|
1473 {
|
|
1474 pShopOptions[0] = pGlobalTXT_LocalizationStrings[134];
|
|
1475 pShopOptions[1] = pGlobalTXT_LocalizationStrings[152];
|
|
1476 pShopOptions[2] = pGlobalTXT_LocalizationStrings[159];
|
|
1477 pShopOptions[3] = pGlobalTXT_LocalizationStrings[160];
|
|
1478 all_text_height = 0;
|
|
1479 for (int i = 0; i < 4; ++i)//while ( (signed int)v15 < (signed int)&unk_F8B1C8 );
|
|
1480 all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0);
|
|
1481 v103 = (174 - all_text_height) / 4;
|
|
1482 pNumActiveItem = pDialogueWindow->pStartingPosActiveItem;
|
|
1483 v19 = (174 - 4 * (174 - all_text_height) / 4 - all_text_height) / 2 - (174 - all_text_height) / 4 / 2 + 138;
|
|
1484 v20 = -pDialogueWindow->pNumPresenceButton < 0;
|
644
|
1485 if ( v20 ^ pNumActiveItem > pNumActiveItem + pDialogueWindow->pNumPresenceButton )
|
629
|
1486 {
|
|
1487 pItemNum = 2;
|
|
1488 pNumString = 0;
|
|
1489 do
|
|
1490 {
|
|
1491 pButton = pDialogueWindow->GetControl(pItemNum);
|
|
1492 pButton->uY = v103 + v19;
|
|
1493 pTextHeight = pFontArrus->CalcTextHeight((const char *)pShopOptions[pNumString], &dialog_window, 0, 0);
|
|
1494 pButton->uHeight = pTextHeight;
|
|
1495 v19 = pButton->uY + pTextHeight - 1;
|
|
1496 pButton->uW = v19;
|
644
|
1497 pColorText = pColorYellow;
|
629
|
1498 if ( pDialogueWindow->pCurrentPosActiveItem != pItemNum )
|
644
|
1499 pColorText = pColorWhite;
|
|
1500 dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, (const char *)pShopOptions[pNumString], 3);
|
629
|
1501 ++pItemNum;
|
|
1502 ++pNumString;
|
|
1503 pNumActiveItem = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem;
|
|
1504 }
|
|
1505 while ( pItemNum < pNumActiveItem );
|
|
1506 }
|
|
1507 }
|
|
1508 break;
|
|
1509 }
|
|
1510 case DIALOG_SHOP_BUY_STANDART:
|
|
1511 {
|
|
1512 pRenderer->DrawTextureIndexed(8, 8, ShopTexture);
|
|
1513 v48 = 0;
|
|
1514 pItemNum = 0;
|
|
1515 v109 = 0;
|
|
1516 do
|
|
1517 {
|
|
1518 // if ( pParty->field_777C[9 * (int)&v48[3 * (unsigned int)window_SpeakInHouse->ptr_1C]] )
|
|
1519 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][(int)v48].uItemID);
|
|
1520 {
|
|
1521 v49 = word_F8B158[(signed int)v48];
|
|
1522 v50 = ItemsInShopTexture[(signed int)v48];
|
|
1523 v49 += 30;
|
|
1524 v51 = 60 - ((signed int)v50->uTextureWidth >> 1);
|
|
1525 pRenderer->DrawTextureTransparent(v51 + pItemNum, v49, v50);
|
|
1526 sub_40F92A(&pRenderer->pActiveZBuffer[v51 + pItemNum + 640 * v49], ItemsInShopTexture[(signed int)v109], (int)((char *)v109 + 1));
|
|
1527 v48 = v109;
|
|
1528 }
|
|
1529 pItemNum += 70;
|
|
1530 v48 = (const char **)((char *)v48 + 1);
|
|
1531 v109 = v48;
|
|
1532 }
|
|
1533 while ( (signed int)v48 < 6 );
|
|
1534 pNumActiveItem = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win();
|
|
1535 if ( pNumActiveItem )
|
|
1536 {
|
|
1537 v55 = 0;
|
|
1538 v106.x = 0;
|
|
1539 v106.x = 0;
|
|
1540 do
|
|
1541 {
|
|
1542 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v55].uItemID);//9 * (v55 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] )
|
|
1543 ++v106.x;
|
|
1544 ++v55;
|
|
1545 }
|
|
1546 while ( v55 < 6 );
|
|
1547 v56 = GetAsyncKeyState(17);
|
|
1548 v57 = pPlayer->CanSteal();
|
|
1549 Str = (char *)v57;
|
|
1550 if ( v56 && v57 )
|
|
1551 {
|
|
1552 v58 = pGlobalTXT_LocalizationStrings[185];
|
|
1553 }
|
|
1554 else
|
|
1555 {
|
|
1556 v58 = pGlobalTXT_LocalizationStrings[195];
|
|
1557 if ( dialog_menu_id != 2 )
|
|
1558 v58 = pGlobalTXT_LocalizationStrings[196];
|
|
1559 }
|
|
1560 DrawTextAtStatusBar(v58, 0);
|
|
1561 if ( v106.x )
|
|
1562 {
|
|
1563 v59 = pMouse->GetCursorPos(&v91);
|
|
1564 pNumActiveItem = v59->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v89)->y];
|
|
1565 if ( pRenderer->pActiveZBuffer[pNumActiveItem] & 0xFFFF )
|
|
1566 {
|
|
1567 v60 = (pRenderer->pActiveZBuffer[pNumActiveItem] & 0xFFFF) - 1;
|
|
1568 v106.x = v60;
|
|
1569 v61 = (int)window_SpeakInHouse->ptr_1C;
|
|
1570 // v62 = 9 * (v60 + 12 * v61);
|
|
1571 v63 = (ItemGen *)&pParty->StandartItemsInShops[(int)v61][v60];
|
|
1572 if ( dialog_menu_id != 2 )
|
|
1573 v63 = &pParty->SpecialItemsInShops[(int)v61][v60];//v63 = (ItemGen *)&pParty->field_C59C[v62 + 724];
|
|
1574 if ( !v56 || !Str )
|
|
1575 {
|
|
1576 v64 = pPlayer->_490EEE(v63, 1, v61, 2);
|
|
1577 v7 = BuilDialogueString((char *)pMerchantsBuyPhrases[v64], uActiveCharacter - 1, v63, (char *)window_SpeakInHouse->ptr_1C, 2, 0);
|
634
|
1578 pTextHeight = pFontArrus->CalcTextHeight(v7, &dialog_window, 0, 0);
|
|
1579 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, pColorWhite, v7, 3);
|
629
|
1580 }
|
|
1581 else
|
|
1582 {
|
|
1583 v7 = BuilDialogueString(pGlobalTXT_LocalizationStrings[181], uActiveCharacter - 1, v63, (char *)window_SpeakInHouse->ptr_1C, 2, 0);
|
634
|
1584 pTextHeight = pFontArrus->CalcTextHeight(v7, &dialog_window, 0, 0);
|
|
1585 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, pColorWhite, v7, 3);
|
629
|
1586 }
|
|
1587 }
|
|
1588 }
|
|
1589 else
|
|
1590 {
|
|
1591 dialog_window.DrawCurrentTime( pParty->field_3C.field_50[(unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed);
|
|
1592 pNumActiveItem = 0; //added
|
|
1593 }
|
|
1594 }
|
|
1595 break;
|
|
1596 }
|
|
1597 case DIALOG_SHOP_SELL:
|
|
1598 {
|
|
1599 draw_leather();
|
|
1600 CharacterUI_InventoryTab_Draw(uActiveCharacter, 1);
|
|
1601 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[199], 0);
|
|
1602 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
|
|
1603 return;
|
|
1604 if((v11 = pMouse->GetCursorPos(&v96)->x - 14, v106.x = (v11 >> 5) + 14 * ((pMouse->GetCursorPos(&v88)->y - 17) >> 5),
|
|
1605 pMouse->GetCursorPos(&v94)->x <= 13) || pMouse->GetCursorPos(&v90)->x >= 462
|
634
|
1606 || (pNumActiveItem = pPlayer->GetItemIDAtInventoryIndex((int *)&v106.x), !pNumActiveItem) )
|
629
|
1607 return;
|
|
1608 v79 = (ItemGen *)&pPlayer->pInventoryItems[pNumActiveItem - 1];
|
|
1609 v13 = pPlayer->_490EEE(v79, 1, (int)window_SpeakInHouse->ptr_1C, 3);
|
|
1610 v7 = BuilDialogueString((char *)pMerchantsSellPhrases[v13], uActiveCharacter - 1, v79, (char *)window_SpeakInHouse->ptr_1C, 3, 0);
|
634
|
1611 pTextHeight = pFontArrus->CalcTextHeight(v7, &dialog_window, 0, 0);
|
|
1612 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, pColorWhite, v7, 3);
|
629
|
1613 break;
|
|
1614 }
|
|
1615 case DIALOG_SHOP_IDENTIFY:
|
|
1616 {
|
|
1617 draw_leather();
|
|
1618 CharacterUI_InventoryTab_Draw(uActiveCharacter, 1);
|
|
1619 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[197], 0);
|
|
1620 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
|
|
1621 return;
|
|
1622 if((v2 = pMouse->GetCursorPos(&a2)->x - 14, v106.x = (v2 >> 5) + 14 * ((pMouse->GetCursorPos(&v87)->y - 17) >> 5),
|
|
1623 pMouse->GetCursorPos(&v100)->x <= 13) || pMouse->GetCursorPos(&v92)->x >= 462
|
634
|
1624 || (pNumActiveItem = pPlayer->GetItemIDAtInventoryIndex((int *)&v106.x), !pNumActiveItem) )
|
629
|
1625 return;
|
|
1626 v4 = (ItemGen *)&pPlayer->pInventoryItems[pNumActiveItem - 1];
|
|
1627 if (!v4->Identified())
|
|
1628 {
|
|
1629 v10 = pPlayer->_490EEE(v4, 1, (int)window_SpeakInHouse->ptr_1C, 4);
|
|
1630 v7 = BuilDialogueString((char *)pMerchantsIdentifyPhrases[v10], uActiveCharacter - 1, v4, (char *)window_SpeakInHouse->ptr_1C, 4, 0);
|
634
|
1631 pTextHeight = pFontArrus->CalcTextHeight(v7, &dialog_window, 0, 0);
|
|
1632 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, pColorWhite, v7, 3);
|
629
|
1633 }
|
634
|
1634 else
|
|
1635 {
|
|
1636 v7 = BuilDialogueString("%24", uActiveCharacter - 1, v4, (char *)window_SpeakInHouse->ptr_1C, 4, 0);
|
|
1637 pTextHeight = pFontArrus->CalcTextHeight(v7, &dialog_window, 0, 0);
|
|
1638 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, pColorWhite, v7, 3);
|
|
1639 }
|
629
|
1640 break;
|
|
1641 }
|
|
1642 case DIALOG_SHOP_REPAIR:
|
|
1643 {
|
|
1644 draw_leather();
|
|
1645 CharacterUI_InventoryTab_Draw(uActiveCharacter, 1);
|
|
1646 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[198], 0);
|
|
1647 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win())
|
|
1648 return;
|
|
1649 if( (v2 = pMouse->GetCursorPos(&a2)->x - 14, v106.x = (v2 >> 5) + 14 * ((pMouse->GetCursorPos(&v87)->y - 17) >> 5),
|
|
1650 pMouse->GetCursorPos(&v100)->x <= 13) || pMouse->GetCursorPos(&v92)->x >= 462
|
634
|
1651 || (pNumActiveItem = pPlayer->GetItemIDAtInventoryIndex((int *)&v106.x), !pNumActiveItem)
|
629
|
1652 || (pNumActiveItem = 9 * pNumActiveItem, !(pPlayer->field_1F5[4 * pNumActiveItem + 15] & 2)) )
|
|
1653 return;
|
|
1654 v4 = (ItemGen *)&pPlayer->pInventoryItems[pNumActiveItem - 1];
|
|
1655 v10 = pPlayer->_490EEE(v4, 2, (int)window_SpeakInHouse->ptr_1C, 5);
|
|
1656 v7 = BuilDialogueString((char *)pMerchantsRepairPhrases[v10], uActiveCharacter - 1, v4, (char *)window_SpeakInHouse->ptr_1C, 5, 0);
|
|
1657 pTextHeight = (174 - pFontArrus->CalcTextHeight(v7, &dialog_window, 0, 0)) / 2 + 138;
|
|
1658 dialog_window.DrawTitleText(pFontArrus, 0, pTextHeight, pColorWhite, v7, 3);
|
|
1659 return;
|
|
1660 }
|
|
1661 break;
|
|
1662 case DIALOG_SHOP_DISPLAY_EQUIPMENT:
|
|
1663 {
|
|
1664 draw_leather();
|
|
1665 CharacterUI_InventoryTab_Draw(uActiveCharacter, 1);
|
|
1666 pShopOptions[0] = pGlobalTXT_LocalizationStrings[200];//sell
|
|
1667 pShopOptions[1] = pGlobalTXT_LocalizationStrings[113];//identify
|
|
1668 pShopOptions[2] = pGlobalTXT_LocalizationStrings[179];//repair
|
|
1669 all_text_height = 0;
|
|
1670 for ( int i = 0; i < 3; ++i )
|
|
1671 all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0);
|
|
1672 v103 = (174 - all_text_height) / 3;
|
|
1673 pNumActiveItem = pDialogueWindow->pStartingPosActiveItem;
|
|
1674 v70 = (3 * (58 - (signed int)v103) - all_text_height) / 2 - ((174 - all_text_height) / 3) / 2 + 138;
|
|
1675 v20 = -pDialogueWindow->pNumPresenceButton < 0;
|
644
|
1676 if ( v20 ^ pNumActiveItem > pNumActiveItem + pDialogueWindow->pNumPresenceButton )
|
629
|
1677 {
|
|
1678 pItemNum = 2;
|
|
1679 pNumString = 0;
|
|
1680 do
|
|
1681 {
|
|
1682 pButton = pDialogueWindow->GetControl(pItemNum);
|
|
1683 pButton->uY = v103 + v70;
|
|
1684 pTextHeight = pFontArrus->CalcTextHeight((const char *)pShopOptions[pNumString], &dialog_window, 0, 0);
|
|
1685 pButton->uHeight = pTextHeight;
|
|
1686 v70 = pButton->uY + pTextHeight - 1;
|
|
1687 pButton->uW = v70;
|
644
|
1688 pColorText = pColorYellow;
|
629
|
1689 if ( pDialogueWindow->pCurrentPosActiveItem != pItemNum )
|
644
|
1690 pColorText = pColorWhite;
|
|
1691 dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, (const char *)pShopOptions[pNumString], 3);
|
629
|
1692 ++pItemNum;
|
|
1693 ++pNumString;
|
|
1694 pNumActiveItem = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem;
|
|
1695 }
|
|
1696 while ( pItemNum < pNumActiveItem );
|
|
1697 }
|
|
1698 break;
|
|
1699 }
|
|
1700 case DIALOG_SHOP_BUY_SPECIAL:
|
|
1701 {
|
|
1702 pRenderer->DrawTextureIndexed(8, 8, ShopTexture);
|
|
1703 v109 = 0;
|
|
1704 pItemNum = 0;
|
|
1705 do
|
|
1706 {
|
|
1707 // if ( pParty->field_C59C[9 * (int)&v109[3 * (unsigned int)window_SpeakInHouse->ptr_1C] + 724] )
|
|
1708 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][(signed int)v109].uItemID)
|
|
1709 {
|
|
1710 v52 = word_F8B158[(signed int)v109] + 30;
|
|
1711 v53 = ItemsInShopTexture[(signed int)v109];
|
|
1712 v54 = 60 - ((signed int)v53->uTextureWidth >> 1);
|
|
1713 pRenderer->DrawTextureTransparent(v54 + pItemNum, word_F8B158[(signed int)v109] + 30, v53);
|
|
1714 sub_40F92A(&pRenderer->pActiveZBuffer[v54 + pItemNum + 640 * v52], ItemsInShopTexture[(signed int)v109], (int)((char *)v109 + 1));
|
|
1715 }
|
|
1716 v109 = (const char **)((char *)v109 + 1);
|
|
1717 pItemNum += 70;
|
|
1718 }
|
|
1719 while ( (signed int)v109 < 6 );
|
|
1720 pNumActiveItem = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win();
|
|
1721 if ( pNumActiveItem )
|
|
1722 {
|
|
1723 v55 = 0;
|
|
1724 v106.x = 0;
|
|
1725 do
|
|
1726 {
|
|
1727 // if ( pParty->field_C59C[9 * (v55 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] )
|
|
1728 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v55].uItemID)
|
|
1729 ++v106.x;
|
|
1730 ++v55;
|
|
1731 }
|
|
1732 while ( v55 < 6 );
|
|
1733 v56 = GetAsyncKeyState(17);
|
|
1734 v57 = pPlayer->CanSteal();
|
|
1735 Str = (char *)v57;
|
|
1736 if ( v56 && v57 )
|
|
1737 {
|
|
1738 v58 = pGlobalTXT_LocalizationStrings[185];
|
|
1739 }
|
|
1740 else
|
|
1741 {
|
|
1742 v58 = pGlobalTXT_LocalizationStrings[195];
|
|
1743 if ( dialog_menu_id != 2 )
|
|
1744 v58 = pGlobalTXT_LocalizationStrings[196];
|
|
1745 }
|
|
1746 DrawTextAtStatusBar(v58, 0);
|
|
1747 if ( v106.x )
|
|
1748 {
|
|
1749 v59 = pMouse->GetCursorPos(&v91);
|
|
1750 pNumActiveItem = v59->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v89)->y];
|
|
1751 if ( pRenderer->pActiveZBuffer[pNumActiveItem] & 0xFFFF )
|
|
1752 {
|
|
1753 v60 = (pRenderer->pActiveZBuffer[pNumActiveItem] & 0xFFFF) - 1;
|
|
1754 v106.x = v60;
|
|
1755 v61 = (int)window_SpeakInHouse->ptr_1C;
|
|
1756 // v62 = 9 * (v60 + 12 * v61);
|
|
1757 v63 = (ItemGen *)&pParty->StandartItemsInShops[(int)v61][v60];
|
|
1758 if ( dialog_menu_id != 2 )
|
|
1759 v63 = &pParty->SpecialItemsInShops[(int)v61][v60];//v63 = (ItemGen *)&pParty->field_C59C[v62 + 724];
|
|
1760 if ( !v56 || !Str )
|
|
1761 {
|
|
1762 v64 = pPlayer->_490EEE(v63, 1, v61, 2);
|
|
1763 v7 = BuilDialogueString((char *)pMerchantsBuyPhrases[v64], uActiveCharacter - 1, v63, (char *)window_SpeakInHouse->ptr_1C, 2, 0);
|
634
|
1764 pTextHeight = pFontArrus->CalcTextHeight(v7, &dialog_window, 0, 0);
|
|
1765 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, pColorWhite, v7, 3);
|
629
|
1766 }
|
|
1767 else
|
|
1768 {
|
|
1769 v7 = BuilDialogueString(pGlobalTXT_LocalizationStrings[181], uActiveCharacter - 1, v63, (char *)window_SpeakInHouse->ptr_1C, 2, 0);
|
634
|
1770 pTextHeight = pFontArrus->CalcTextHeight(v7, &dialog_window, 0, 0);
|
|
1771 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, pColorWhite, v7, 3);
|
629
|
1772 }
|
|
1773 }
|
|
1774 }
|
|
1775 else
|
|
1776 {
|
|
1777 dialog_window.DrawCurrentTime( pParty->field_3C.field_50[(unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed);
|
|
1778 pNumActiveItem = 0; //added
|
|
1779 }
|
|
1780 }
|
|
1781 break;
|
|
1782 }
|
|
1783 case DIALOG_SHOP_SKILLS:
|
|
1784 {
|
634
|
1785 if (!sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win())
|
|
1786 return;
|
|
1787 v0 = 0;
|
|
1788 all_text_height = 0;
|
|
1789 //v32 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (signed int)v31] * 500.0);
|
|
1790 v32 = (signed __int64)(p2DEvents[(signed int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0);
|
|
1791 pItemNum = v32 * (100 - pPlayer->GetMerchant()) / 100;
|
|
1792 if ( pItemNum < v32 / 3 )
|
|
1793 pItemNum = v32 / 3;
|
|
1794 pNumActiveItem = pDialogueWindow->pStartingPosActiveItem;
|
|
1795 if ( pNumActiveItem >= pNumActiveItem + pDialogueWindow->pNumPresenceButton )
|
|
1796 {
|
|
1797 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], pPlayer->pName, pClassNames[pPlayer->classType]);
|
|
1798 strcat(pTmpBuf, "\n \n");
|
|
1799 strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]);
|
|
1800 pTextHeight = pFontArrus->CalcTextHeight(pTmpBuf, &dialog_window, 0, 0);
|
644
|
1801 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, pColorYellow, pTmpBuf, 3);
|
634
|
1802 return;
|
|
1803 }
|
|
1804 do
|
629
|
1805 {
|
634
|
1806 v35 = pDialogueWindow->GetControl(pNumActiveItem)->uControlParam - 36;
|
|
1807 if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayer->classType][v35] && !pPlayer->pActiveSkills[v35] )
|
629
|
1808 {
|
634
|
1809 all_text_height += pFontArrus->CalcTextHeight(pSkillNames[v35], &dialog_window, 0, 0);
|
|
1810 v0++;
|
629
|
1811 }
|
634
|
1812 ++pNumActiveItem;
|
|
1813 }
|
|
1814 while ( pNumActiveItem < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem );
|
|
1815 if ( !v0 )
|
|
1816 {
|
|
1817 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], pPlayer->pName, pClassNames[pPlayer->classType]);
|
|
1818 strcat(pTmpBuf, "\n \n");
|
|
1819 strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]);
|
|
1820 pTextHeight = pFontArrus->CalcTextHeight(pTmpBuf, &dialog_window, 0, 0);
|
644
|
1821 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, pColorYellow, pTmpBuf, 3);
|
634
|
1822 return;
|
|
1823 }
|
|
1824 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], pItemNum);
|
|
1825 dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3);
|
|
1826 v103 = (149 - all_text_height) / v0;
|
|
1827 if ( (149 - all_text_height) / v0 > 32 )
|
|
1828 v103 = 32;
|
|
1829 pNumActiveItem = pDialogueWindow->pStartingPosActiveItem;
|
|
1830 v37 = (149 - v0 * v103 - all_text_height) / 2 - v103 / 2 + 162;
|
|
1831 if ( pNumActiveItem < pNumActiveItem + pDialogueWindow->pNumPresenceButton )
|
|
1832 {
|
|
1833 pItemNum = 2;
|
629
|
1834 do
|
|
1835 {
|
634
|
1836 pButton = pDialogueWindow->GetControl(pItemNum);
|
|
1837 v40 = pButton->uControlParam - 36;
|
|
1838 if ( !byte_4ED970_skill_learn_ability_by_class_table[pPlayer->classType][v40] || pPlayer->pActiveSkills[v40] )
|
629
|
1839 {
|
634
|
1840 pButton->uW = 0;
|
|
1841 pButton->uHeight = 0;
|
|
1842 pButton->uY = 0;
|
629
|
1843 }
|
634
|
1844 else
|
|
1845 {
|
|
1846 pButton->uY = v103 + v37;
|
|
1847 pTextHeight = pFontArrus->CalcTextHeight(pSkillNames[v40], &dialog_window, 0, 0);
|
|
1848 pButton->uHeight = pTextHeight;
|
|
1849 v37 = pButton->uY + pTextHeight - 1;
|
|
1850 pButton->uW = v37;
|
644
|
1851 pColorText = pColorYellow;
|
634
|
1852 if ( pDialogueWindow->pCurrentPosActiveItem != pItemNum )
|
644
|
1853 pColorText = pColorWhite;
|
|
1854 dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, pSkillNames[v40], 3);
|
634
|
1855 }
|
|
1856 pNumActiveItem = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem;
|
|
1857 pItemNum++;
|
629
|
1858 }
|
634
|
1859 while ( pItemNum < pNumActiveItem );
|
629
|
1860 }
|
|
1861 break;
|
|
1862 }
|
|
1863 default:
|
|
1864 {
|
|
1865 if( dialog_menu_id > 5 )
|
|
1866 pNumActiveItem = dialog_menu_id - 96;
|
|
1867 else
|
|
1868 pNumActiveItem = dialog_menu_id - 4;
|
|
1869 break;
|
|
1870 }
|
|
1871 }
|
|
1872 }
|
|
1873
|
|
1874
|
|
1875
|
|
1876 //----- (004B9CC6) --------------------------------------------------------
|
|
1877 void __cdecl AlchemistDialog()
|
|
1878 {
|
634
|
1879 int v0;
|
|
1880 int pNumActiveItem; // eax@7
|
629
|
1881 signed int v5; // esi@9
|
|
1882 unsigned int v6; // esi@11
|
|
1883 int v7; // eax@11
|
|
1884 unsigned int v8; // eax@12
|
|
1885 int v9; // eax@14
|
|
1886 int v10; // ecx@19
|
|
1887 int v13; // eax@21
|
|
1888 char *v14; // eax@23
|
|
1889 int v15; // eax@23
|
|
1890 unsigned int v16; // ecx@23
|
|
1891 int v17; // edx@23
|
|
1892 int v18; // eax@23
|
|
1893 int v20; // eax@27
|
|
1894 char *v21; // edx@29
|
|
1895 int v22; // esi@30
|
|
1896 char **v23; // edi@30
|
|
1897 int v24; // eax@31
|
|
1898 int v26; // edx@32
|
|
1899 int v27; // edi@32
|
|
1900 unsigned __int8 v28; // sf@32
|
|
1901 const char **v30; // eax@34
|
|
1902 int v31; // eax@34
|
|
1903 unsigned int v32; // ecx@34
|
|
1904 int v34; // eax@34
|
|
1905 signed int v36; // esi@39
|
|
1906 ItemGen *v37; // eax@42
|
|
1907 char *v38; // ecx@43
|
|
1908 unsigned __int8 v39; // dl@44
|
|
1909 int v40; // eax@46
|
|
1910 int v41; // ST08_4@47
|
|
1911 int v42; // eax@47
|
|
1912 signed int v43; // esi@49
|
|
1913 int v44; // ST08_4@52
|
|
1914 int v45; // eax@52
|
|
1915 Texture *v46; // ecx@55
|
|
1916 unsigned int v47; // edi@55
|
|
1917 unsigned int v48; // esi@57
|
|
1918 int v49; // edx@61
|
|
1919 Texture *v50; // ecx@67
|
|
1920 unsigned int v51; // edi@67
|
|
1921 unsigned int v52; // esi@69
|
|
1922 int v53; // edx@73
|
|
1923 Texture *v54; // ecx@79
|
|
1924 unsigned int v55; // edi@79
|
|
1925 unsigned int v56; // esi@81
|
|
1926 int v57; // edx@85
|
|
1927 Texture *v58; // ecx@91
|
|
1928 unsigned int v59; // edi@91
|
|
1929 unsigned int v60; // esi@93
|
|
1930 int v61; // edx@97
|
|
1931 signed int v62; // ecx@102
|
|
1932 SHORT v63; // di@110
|
|
1933 bool v64; // eax@110
|
|
1934 const char *v65; // ecx@112
|
|
1935 POINT *v66; // esi@117
|
|
1936 int v67; // ecx@118
|
|
1937 int v68; // eax@118
|
|
1938 int v69; // ecx@118
|
|
1939 ItemGen *v70; // esi@118
|
|
1940 int v71; // eax@123
|
634
|
1941 int all_text_height; // edi@125
|
629
|
1942 char **v73; // esi@125
|
|
1943 int v74; // eax@126
|
634
|
1944 int pItemNum;
|
629
|
1945 int v76; // edx@127
|
|
1946 int v77; // edi@127
|
634
|
1947 GUIButton *pButton; // esi@129
|
629
|
1948 const char **v79; // eax@129
|
634
|
1949 int pTextHeight; // eax@129
|
629
|
1950 unsigned int v81; // ecx@129
|
644
|
1951 unsigned int pColorText; // ax@129
|
629
|
1952 int v85; // [sp-14h] [bp-ECh]@29
|
|
1953 int v86; // [sp-10h] [bp-E8h]@29
|
|
1954 ItemGen *v87; // [sp-10h] [bp-E8h]@43
|
|
1955 unsigned __int16 v88; // [sp-Ch] [bp-E4h]@29
|
|
1956 void *v89; // [sp-Ch] [bp-E4h]@43
|
|
1957 char *v90; // [sp-8h] [bp-E0h]@29
|
|
1958 int v91; // [sp-8h] [bp-E0h]@42
|
|
1959 unsigned int v92; // [sp-4h] [bp-DCh]@29
|
|
1960 __int64 *v93; // [sp-4h] [bp-DCh]@42
|
|
1961 POINT v94; // [sp+Ch] [bp-CCh]@39
|
|
1962 POINT v95; // [sp+14h] [bp-C4h]@49
|
|
1963 POINT v96; // [sp+1Ch] [bp-BCh]@117
|
|
1964 POINT v97; // [sp+24h] [bp-B4h]@40
|
|
1965 POINT v98; // [sp+2Ch] [bp-ACh]@117
|
|
1966 POINT v99; // [sp+34h] [bp-A4h]@49
|
|
1967 POINT v100; // [sp+3Ch] [bp-9Ch]@50
|
|
1968 POINT v101; // [sp+44h] [bp-94h]@39
|
|
1969 POINT v102; // [sp+4Ch] [bp-8Ch]@49
|
|
1970 POINT a2; // [sp+54h] [bp-84h]@39
|
634
|
1971 GUIWindow dialog_window; // [sp+5Ch] [bp-7Ch]@1
|
629
|
1972 int v105; // [sp+B0h] [bp-28h]@19
|
644
|
1973 int pColorYellow; // [sp+B4h] [bp-24h]@1
|
634
|
1974 int Str; // [sp+B8h] [bp-20h]@23
|
|
1975 int pColorWhite; // [sp+BCh] [bp-1Ch]@1
|
629
|
1976 __int32 v109; // [sp+C0h] [bp-18h]@39
|
634
|
1977 Player *pPlayer; // [sp+C4h] [bp-14h]@1
|
|
1978 int pNumString; // [sp+C8h] [bp-10h]@9
|
629
|
1979 unsigned int v112; // [sp+CCh] [bp-Ch]@9
|
|
1980 unsigned __int8 v113; // [sp+D3h] [bp-5h]@47
|
|
1981 int v114; // [sp+D4h] [bp-4h]@11
|
|
1982
|
634
|
1983 pPlayer = pPlayers[uActiveCharacter];
|
|
1984 memcpy(&dialog_window, window_SpeakInHouse, sizeof(dialog_window));
|
|
1985 dialog_window.uFrameX = 483;
|
|
1986 dialog_window.uFrameWidth = 148;
|
|
1987 dialog_window.uFrameZ = 334;
|
|
1988 pColorWhite = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu);
|
644
|
1989 pColorYellow = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xCDu, 0x23u);
|
629
|
1990 switch(dialog_menu_id)
|
|
1991 {
|
634
|
1992 case DIALOG_SHOP_MAIN:
|
|
1993 {
|
|
1994 if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
|
|
1995 {
|
|
1996 pShopOptions[0] = pGlobalTXT_LocalizationStrings[134];
|
|
1997 pShopOptions[1] = pGlobalTXT_LocalizationStrings[152];
|
|
1998 pShopOptions[2] = pGlobalTXT_LocalizationStrings[159];
|
|
1999 pShopOptions[3] = pGlobalTXT_LocalizationStrings[160];
|
|
2000 all_text_height = 0;
|
|
2001 for (int i = 0; i < 4; ++i)//while ( (signed int)v15 < (signed int)&unk_F8B1C8 );
|
|
2002 all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0);
|
|
2003 Str = (174 - all_text_height) / 4;
|
|
2004 pNumActiveItem = pDialogueWindow->pStartingPosActiveItem;
|
|
2005 v76 = pNumActiveItem + pDialogueWindow->pNumPresenceButton;
|
|
2006 v77 = (174 - 4 * (174 - all_text_height) / 4 - all_text_height) / 2 - (174 - all_text_height) / 4 / 2 + 138;
|
|
2007 v28 = -pDialogueWindow->pNumPresenceButton < 0;
|
|
2008 if ( v28 ^ pNumActiveItem > v76 )
|
|
2009 {
|
|
2010 pItemNum = 2;
|
|
2011 pNumString = 0;
|
|
2012 do
|
|
2013 {
|
|
2014 pButton = pDialogueWindow->GetControl(pItemNum);
|
|
2015 pButton->uY = Str + v77;
|
|
2016 pTextHeight = pFontArrus->CalcTextHeight((const char *)pShopOptions[pNumString], &dialog_window, 0, 0);
|
|
2017 pButton->uHeight = pTextHeight;
|
|
2018 v77 = pButton->uY + pTextHeight - 1;
|
|
2019 pButton->uW = v77;
|
644
|
2020 pColorText = pColorYellow;
|
634
|
2021 if ( pDialogueWindow->pCurrentPosActiveItem != pItemNum )
|
644
|
2022 pColorText = pColorWhite;
|
|
2023 dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, (const char *)pShopOptions[pNumString], 3);
|
634
|
2024 ++pItemNum;
|
|
2025 ++pNumString;
|
|
2026 pNumActiveItem = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem;
|
|
2027 }
|
|
2028 while ( pItemNum < pNumActiveItem );
|
|
2029 }
|
|
2030 }
|
|
2031 return;
|
|
2032 }
|
|
2033 case DIALOG_SHOP_BUY_STANDART:
|
|
2034 {
|
|
2035 pRenderer->DrawTextureIndexed(8, 8, ShopTexture);
|
|
2036 v114 = 0;
|
|
2037 do
|
|
2038 {
|
|
2039 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v114].uItemID);
|
629
|
2040 {
|
634
|
2041 v46 = ItemsInShopTexture[v114];
|
|
2042 v47 = 152 - v46->uTextureHeight;
|
|
2043 if ( (signed int)v47 < 1 )
|
|
2044 v47 = 0;
|
|
2045 v48 = 75 * v114 - v46->uTextureWidth / 2 + 40;
|
|
2046 if ( v114 )
|
|
2047 {
|
|
2048 if ( v114 == 5 )
|
|
2049 {
|
|
2050 v49 = ItemsInShopTexture[5]->uTextureWidth;
|
|
2051 if ( (signed int)v48 > 457 - v49 )
|
|
2052 v48 = 457 - v49;
|
|
2053 }
|
|
2054 }
|
|
2055 else if ( (signed int)v48 < 18 )
|
|
2056 v48 = 18;
|
|
2057 pRenderer->DrawTextureTransparent(v48, v47, v46);
|
|
2058 sub_40F92A(&pRenderer->pActiveZBuffer[v48 + 640 * v47], ItemsInShopTexture[v114], v114 + 1);
|
629
|
2059 }
|
634
|
2060 ++v114;
|
|
2061 }
|
|
2062 while ( v114 < 6 );
|
|
2063 v114 = 0;
|
|
2064 do
|
|
2065 {
|
|
2066 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v114+1].uItemID);
|
|
2067 {
|
|
2068 v50 = ItemsInShopTexture[v114 + 6];
|
|
2069 v51 = 308 - v50->uTextureHeight;
|
|
2070 if ( (signed int)v51 < 1 )
|
|
2071 v51 = 0;
|
|
2072 v52 = 75 * v114 - v50->uTextureWidth / 2 + 40;
|
|
2073 if ( v114 )
|
|
2074 {
|
|
2075 if ( v114 == 5 )
|
|
2076 {
|
|
2077 v53 = ItemsInShopTexture[11]->uTextureWidth;
|
|
2078 if ( (signed int)v52 > 457 - v53 )
|
|
2079 v52 = 457 - v53;
|
|
2080 }
|
|
2081 }
|
|
2082 else
|
|
2083 {
|
|
2084 if ( (signed int)v52 < 18 )
|
|
2085 v52 = 18;
|
|
2086 }
|
|
2087 pRenderer->DrawTextureTransparent(v52, v51, v50);
|
|
2088 sub_40F92A(&pRenderer->pActiveZBuffer[v52 + 640 * v51], ItemsInShopTexture[v114 + 6], v114 + 7);
|
|
2089 }
|
|
2090 ++v114;
|
|
2091 }
|
|
2092 while ( v114 < 6 );
|
|
2093 if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
|
|
2094 {
|
|
2095 v62 = 0;
|
|
2096 v109 = 0;
|
629
|
2097 do
|
|
2098 {
|
634
|
2099 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v62].uItemID);
|
|
2100 ++v109;
|
|
2101 ++v62;
|
|
2102 }
|
|
2103 while ( v62 < 12 );
|
|
2104 v63 = GetAsyncKeyState(17);
|
|
2105 v64 = pPlayer->CanSteal();
|
|
2106 Str = v64;
|
|
2107 if ( v63 && v64 )
|
|
2108 {
|
|
2109 v65 = pGlobalTXT_LocalizationStrings[185];
|
|
2110 }
|
|
2111 else if ( dialog_menu_id == 2 )
|
|
2112 {
|
|
2113 v65 = pGlobalTXT_LocalizationStrings[195];
|
|
2114 }
|
|
2115 else
|
|
2116 {
|
|
2117 v65 = pGlobalTXT_LocalizationStrings[196];
|
|
2118 }
|
|
2119 DrawTextAtStatusBar(v65, 0);
|
|
2120 if ( !v109 )
|
|
2121 {
|
|
2122 dialog_window.DrawCurrentTime( pParty->field_3C.field_50[ (unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed);
|
|
2123 return;
|
|
2124 }
|
|
2125 v66 = pMouse->GetCursorPos(&v98);
|
|
2126 pNumActiveItem = v66->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v96)->y];
|
|
2127 if ( pRenderer->pActiveZBuffer[pNumActiveItem] & 0xFFFF )
|
|
2128 {
|
|
2129 v67 = (pRenderer->pActiveZBuffer[pNumActiveItem] & 0xFFFF) - 1;
|
|
2130 v70 = (ItemGen *)&pParty->StandartItemsInShops[(int)window_SpeakInHouse->ptr_1C][v67];
|
|
2131 if ( dialog_menu_id != 2 )
|
|
2132 v70 = &pParty->SpecialItemsInShops[(int)window_SpeakInHouse->ptr_1C][v67];//v70 = (ItemGen *)&pParty->field_C59C[v69 + 724];
|
|
2133 if ( !v63 || !Str )
|
|
2134 {
|
|
2135 v71 = pPlayer->_490EEE(v70, 4, (int)window_SpeakInHouse->ptr_1C, 2);
|
|
2136 v38 = (char *)pMerchantsBuyPhrases[v71];
|
|
2137 }
|
|
2138 else
|
|
2139 {
|
|
2140 v38 = pGlobalTXT_LocalizationStrings[181];
|
|
2141 }
|
|
2142 v21 = BuilDialogueString(v38, uActiveCharacter - 1, v70, (char *)window_SpeakInHouse->ptr_1C, 2, 0);
|
|
2143 v40 = pFontArrus->CalcTextHeight(v21, &dialog_window, 0, 0);
|
|
2144 dialog_window.DrawTitleText(pFontArrus, 0, (174 - v40) / 2 + 138, pColorWhite, v21, 3);
|
|
2145 return ;
|
|
2146 }
|
|
2147 }
|
|
2148 return;
|
|
2149 }
|
|
2150 case DIALOG_SHOP_SELL:
|
|
2151 {
|
|
2152 draw_leather();
|
|
2153 CharacterUI_InventoryTab_Draw(uActiveCharacter, 1);
|
|
2154 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[199], 0);
|
|
2155 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
|
|
2156 return;
|
|
2157 if ((v43 = pMouse->GetCursorPos(&v99)->x - 14, v109 = (v43 >> 5) + 14 * ((pMouse->GetCursorPos(&v95)->y - 17) >> 5),
|
|
2158 pMouse->GetCursorPos(&v102)->x <= 13) || pMouse->GetCursorPos(&v100)->x >= 462
|
|
2159 || (pNumActiveItem = pPlayer->GetItemIDAtInventoryIndex((int *)&v109), !pNumActiveItem) )
|
|
2160 return;
|
|
2161 v87 = (ItemGen *)&pPlayer->pInventoryItems[pNumActiveItem - 1];
|
|
2162 v45 = pPlayer->_490EEE(v87, 4, (int)window_SpeakInHouse->ptr_1C, 3);
|
|
2163 v21 = BuilDialogueString((char *)pMerchantsSellPhrases[v45], uActiveCharacter - 1, v87, (char *)window_SpeakInHouse->ptr_1C, 3, 0);
|
|
2164 pTextHeight = pFontArrus->CalcTextHeight(v21, &dialog_window, 0, 0);
|
|
2165 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, pColorWhite, v21, 3);
|
|
2166 return;
|
|
2167 }
|
|
2168 case DIALOG_SHOP_IDENTIFY:
|
|
2169 {
|
|
2170 draw_leather();
|
|
2171 CharacterUI_InventoryTab_Draw(uActiveCharacter, 1);
|
|
2172 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[197], 0);
|
|
2173 if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
|
|
2174 return;
|
|
2175 if ((v36 = pMouse->GetCursorPos(&a2)->x - 14, v109 = (v36 >> 5) + 14 * ((pMouse->GetCursorPos(&v94)->y - 17) >> 5),
|
|
2176 pMouse->GetCursorPos(&v101)->x <= 13) || pMouse->GetCursorPos(&v97)->x >= 462
|
|
2177 || (pNumActiveItem = pPlayer->GetItemIDAtInventoryIndex((int *)&v109), !pNumActiveItem) )
|
|
2178 return;
|
|
2179 v37 = (ItemGen *)&pPlayer->pInventoryItems[pNumActiveItem - 1];
|
|
2180 if (!v37->Identified())
|
|
2181 {
|
|
2182 v42 = pPlayer->_490EEE(v37, 4, (int)window_SpeakInHouse->ptr_1C, 4);
|
|
2183 v38 = (char *)pMerchantsIdentifyPhrases[v42];
|
|
2184 }
|
|
2185 else
|
|
2186 {
|
|
2187 v38 = "%24";
|
|
2188 }
|
|
2189 v21 = BuilDialogueString(v38, uActiveCharacter - 1, v37, (char *)window_SpeakInHouse->ptr_1C, 4, 0);
|
|
2190 v40 = pFontArrus->CalcTextHeight(v21, &dialog_window, 0, 0);
|
|
2191 dialog_window.DrawTitleText(pFontArrus, 0, (174 - v40) / 2 + 138, pColorWhite, v21, 3);
|
|
2192 return;
|
|
2193 }
|
|
2194 case DIALOG_SHOP_DISPLAY_EQUIPMENT:
|
|
2195 {
|
|
2196 draw_leather();
|
|
2197 CharacterUI_InventoryTab_Draw(uActiveCharacter, 1);
|
|
2198 pShopOptions[0] = pGlobalTXT_LocalizationStrings[200];
|
|
2199 pShopOptions[1] = pGlobalTXT_LocalizationStrings[113];
|
|
2200 all_text_height = 0;
|
|
2201 for ( int i = 0; i < 2; ++i )
|
|
2202 all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0);
|
|
2203 Str = (174 - all_text_height) / 2;
|
|
2204 pNumActiveItem = pDialogueWindow->pStartingPosActiveItem;
|
|
2205 v26 = pNumActiveItem + pDialogueWindow->pNumPresenceButton;
|
|
2206 v27 = (2 * (87 - (174 - all_text_height) / 2) - all_text_height) / 2 - (174 - all_text_height) / 2 / 2 + 138;
|
|
2207 v28 = -pDialogueWindow->pNumPresenceButton < 0;
|
|
2208 if ( v28 ^ pNumActiveItem > v26 )
|
|
2209 {
|
|
2210 pItemNum = 2;
|
|
2211 pNumString = 0;
|
|
2212 do
|
|
2213 {
|
|
2214 pButton = pDialogueWindow->GetControl(pItemNum);
|
|
2215 pButton->uY = Str + v27;
|
|
2216 pTextHeight = pFontArrus->CalcTextHeight((const char *)pShopOptions[pNumString], &dialog_window, 0, 0);
|
|
2217 pButton->uHeight = pTextHeight;
|
|
2218 v27 = pButton->uY + pTextHeight - 1;
|
|
2219 pButton->uW = v27;
|
644
|
2220 pColorText = pColorYellow;
|
634
|
2221 if ( pDialogueWindow->pCurrentPosActiveItem != pItemNum )
|
644
|
2222 pColorText = pColorWhite;
|
|
2223 dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, (const char *)pShopOptions[pNumString], 3);
|
634
|
2224 ++pItemNum;
|
|
2225 ++pNumString;
|
|
2226 pNumActiveItem = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem;
|
629
|
2227 }
|
634
|
2228 while ( pItemNum < pNumActiveItem );
|
|
2229 }
|
|
2230 return;
|
|
2231 }
|
|
2232 case DIALOG_SHOP_BUY_SPECIAL:
|
|
2233 {
|
|
2234 pRenderer->DrawTextureIndexed(8, 8, ShopTexture);
|
|
2235 v114 = 0;
|
|
2236 do
|
|
2237 {
|
|
2238 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v114].uItemID)
|
|
2239 {
|
|
2240 v54 = ItemsInShopTexture[v114];
|
|
2241 v55 = 152 - v54->uTextureHeight;
|
|
2242 if ( (signed int)v55 < 1 )
|
|
2243 v55 = 0;
|
|
2244 v56 = 75 * v114 - v54->uTextureWidth / 2 + 40;
|
|
2245 if ( v114 )
|
|
2246 {
|
|
2247 if ( v114 == 5 )
|
|
2248 {
|
|
2249 v57 = ItemsInShopTexture[5]->uTextureWidth;
|
|
2250 if ( (signed int)v56 > 457 - v57 )
|
|
2251 v56 = 457 - v57;
|
|
2252 }
|
|
2253 }
|
|
2254 else
|
|
2255 {
|
|
2256 if ( (signed int)v56 < 18 )
|
|
2257 v56 = 18;
|
|
2258 }
|
|
2259 pRenderer->DrawTextureTransparent(v56, v55, v54);
|
|
2260 sub_40F92A(&pRenderer->pActiveZBuffer[v56 + 640 * v55], ItemsInShopTexture[v114], v114 + 1);
|
|
2261 }
|
|
2262 ++v114;
|
|
2263 }
|
|
2264 while ( v114 < 6 );
|
|
2265 v114 = 0;
|
|
2266 do
|
|
2267 {
|
|
2268 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][(signed int)v114].uItemID) //not itemid
|
|
2269 {
|
|
2270 v58 = ItemsInShopTexture[v114 + 6];
|
|
2271 v59 = 308 - v58->uTextureHeight;
|
|
2272 if ( (signed int)v59 < 1 )
|
|
2273 v59 = 0;
|
|
2274 v60 = 75 * v114 - v58->uTextureWidth / 2 + 40;
|
|
2275 if ( v114 )
|
|
2276 {
|
|
2277 if ( v114 == 5 )
|
|
2278 {
|
|
2279 v61 = ItemsInShopTexture[11]->uTextureWidth;
|
|
2280 if ( (signed int)v60 > 457 - v61 )
|
|
2281 v60 = 457 - v61;
|
|
2282 }
|
|
2283 }
|
|
2284 else
|
|
2285 {
|
|
2286 if ( (signed int)v60 < 18 )
|
|
2287 v60 = 18;
|
|
2288 }
|
|
2289 pRenderer->DrawTextureTransparent(v60, v59, v58);
|
|
2290 sub_40F92A(&pRenderer->pActiveZBuffer[v60 + 640 * v59], ItemsInShopTexture[v114 + 6], v114 + 7);
|
|
2291 }
|
|
2292 ++v114;
|
|
2293 }
|
|
2294 while ( v114 < 6 );
|
|
2295 if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
|
|
2296 {
|
|
2297 v62 = 0;
|
|
2298 v109 = 0;
|
|
2299 do
|
|
2300 {
|
|
2301 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v62].uItemID)
|
|
2302 ++v109;
|
|
2303 ++v62;
|
|
2304 }
|
|
2305 while ( v62 < 12 );
|
|
2306 v63 = GetAsyncKeyState(17);
|
|
2307 v64 = pPlayer->CanSteal();
|
|
2308 Str = v64;
|
|
2309 if ( v63 && v64 )
|
|
2310 {
|
|
2311 v65 = pGlobalTXT_LocalizationStrings[185];
|
|
2312 }
|
|
2313 else
|
629
|
2314 {
|
634
|
2315 v65 = pGlobalTXT_LocalizationStrings[195];
|
|
2316 if ( dialog_menu_id != 2 )
|
|
2317 v65 = pGlobalTXT_LocalizationStrings[196];
|
|
2318 }
|
|
2319 DrawTextAtStatusBar(v65, 0);
|
|
2320 if ( !v109 )
|
|
2321 {
|
|
2322 dialog_window.DrawCurrentTime( pParty->field_3C.field_50[ (unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed);
|
|
2323 return;
|
|
2324 }
|
|
2325 v66 = pMouse->GetCursorPos(&v98);
|
|
2326 pNumActiveItem = v66->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v96)->y];
|
|
2327 if ( pRenderer->pActiveZBuffer[pNumActiveItem] & 0xFFFF )
|
|
2328 {
|
|
2329 v67 = (pRenderer->pActiveZBuffer[pNumActiveItem] & 0xFFFF) - 1;
|
|
2330 v109 = v67;
|
|
2331 v68 = (int)window_SpeakInHouse->ptr_1C;
|
|
2332 // v69 = 9 * (v67 + 12 * v68);
|
|
2333 v70 = (ItemGen *)&pParty->StandartItemsInShops[v68][v67];
|
|
2334 if ( dialog_menu_id != 2 )
|
|
2335 v70 = &pParty->SpecialItemsInShops[(int)v68][v67];//v70 = (ItemGen *)&pParty->field_C59C[v69 + 724];
|
|
2336 if ( !v63 || !Str )
|
|
2337 {
|
|
2338 v71 = pPlayer->_490EEE(v70, 4, v68, 2);
|
|
2339 v38 = (char *)pMerchantsBuyPhrases[v71];
|
|
2340 }
|
|
2341 else
|
|
2342 {
|
|
2343 v38 = pGlobalTXT_LocalizationStrings[181];
|
|
2344 }
|
|
2345 v21 = BuilDialogueString(v38, uActiveCharacter - 1, v70, (char *)window_SpeakInHouse->ptr_1C, 2, 0);
|
|
2346 v40 = pFontArrus->CalcTextHeight(v21, &dialog_window, 0, 0);
|
|
2347 dialog_window.DrawTitleText(pFontArrus, 0, (174 - v40) / 2 + 138, pColorWhite, v21, 3);
|
|
2348 return;
|
|
2349 }
|
|
2350 }
|
|
2351 return;
|
|
2352 }
|
|
2353 case DIALOG_SHOP_SKILLS:
|
|
2354 {
|
|
2355 if (!sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win())
|
|
2356 return;
|
|
2357 all_text_height = 0;
|
|
2358 v5 = (signed __int64)(p2DEvents[(signed int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0);
|
|
2359 pItemNum = v5 * (100 - pPlayer->GetMerchant()) / 100;
|
|
2360 if ( pItemNum < v5 / 3 )
|
|
2361 pItemNum = v5 / 3;
|
|
2362 pNumActiveItem = pDialogueWindow->pStartingPosActiveItem;
|
|
2363 v114 = 0;
|
|
2364 if ( pNumActiveItem >= pNumActiveItem + pDialogueWindow->pNumPresenceButton )
|
|
2365 {
|
|
2366 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], pPlayer->pName, pClassNames[pPlayer->classType]);
|
|
2367 strcat(pTmpBuf, "\n \n");
|
|
2368 strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]);
|
|
2369 v40 = pFontArrus->CalcTextHeight(pTmpBuf, &dialog_window, 0, 0);
|
644
|
2370 dialog_window.DrawTitleText(pFontArrus, 0, (174 - v40) / 2 + 138, pColorYellow, pTmpBuf, 3);
|
634
|
2371 return;
|
|
2372 }
|
|
2373 do
|
|
2374 {
|
|
2375 v8 = pDialogueWindow->GetControl(pNumActiveItem)->uControlParam - 36;
|
|
2376 if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayer->classType][v8] && !pPlayer->pActiveSkills[v8] )
|
|
2377 {
|
|
2378 all_text_height = pFontArrus->CalcTextHeight(pSkillNames[v8], &dialog_window, 0, 0);
|
|
2379 ++v114;
|
|
2380 }
|
|
2381 ++pNumActiveItem;
|
|
2382 }
|
|
2383 while ( pNumActiveItem < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem );
|
|
2384 if ( !v114 )
|
|
2385 {
|
|
2386 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], pPlayer->pName, pClassNames[pPlayer->classType]);
|
|
2387 strcat(pTmpBuf, "\n \n");
|
|
2388 strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]);
|
|
2389 v40 = pFontArrus->CalcTextHeight(pTmpBuf, &dialog_window, 0, 0);
|
644
|
2390 dialog_window.DrawTitleText(pFontArrus, 0, (174 - v40) / 2 + 138, pColorYellow, pTmpBuf, 3);
|
634
|
2391 return;
|
|
2392 }
|
|
2393 if ( v114 )
|
|
2394 {
|
|
2395 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], pItemNum);
|
|
2396 dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3);
|
|
2397 v18 = (149 - all_text_height) / v114;
|
|
2398 if ( (149 - all_text_height) / v114 > 32 )
|
|
2399 v18 = 32;
|
|
2400 pNumActiveItem = pDialogueWindow->pStartingPosActiveItem;
|
|
2401 v105 = (149 - v114 * v18 - all_text_height) / 2 - v18 / 2 + 162;
|
|
2402 if ( pNumActiveItem < pNumActiveItem + pDialogueWindow->pNumPresenceButton )
|
|
2403 {
|
|
2404 pItemNum = 2;
|
629
|
2405 do
|
|
2406 {
|
634
|
2407 pButton = pDialogueWindow->GetControl(pItemNum);
|
|
2408 v13 = pButton->uControlParam - 36;
|
|
2409 if ( !byte_4ED970_skill_learn_ability_by_class_table[pPlayer->classType][v13] || pPlayer->pActiveSkills[v13] )
|
|
2410 {
|
|
2411 pButton->uW = 0;
|
|
2412 pButton->uHeight = 0;
|
|
2413 pButton->uY = 0;
|
|
2414 }
|
|
2415 else
|
|
2416 {
|
|
2417 pButton->uY = v18 + v105;
|
|
2418 pTextHeight = pFontArrus->CalcTextHeight(pSkillNames[v13], &dialog_window, 0, 0);
|
|
2419 pButton->uHeight = pTextHeight;
|
|
2420 v105 = pButton->uY + pTextHeight - 1;
|
|
2421 pButton->uW = v105;
|
644
|
2422 pColorText = pColorYellow;
|
634
|
2423 if ( pDialogueWindow->pCurrentPosActiveItem != pItemNum )
|
644
|
2424 pColorText = pColorWhite;
|
|
2425 dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, pSkillNames[v13], 3);
|
634
|
2426 }
|
|
2427 pNumActiveItem = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem;
|
|
2428 pItemNum++;
|
629
|
2429 }
|
634
|
2430 while ( pItemNum < pNumActiveItem );
|
629
|
2431 }
|
|
2432 return;
|
634
|
2433 }
|
|
2434 }
|
|
2435 default:
|
|
2436 {
|
|
2437 return;// (POINT *)dialog_menu_id - 96;
|
|
2438 }
|
629
|
2439 }
|
|
2440 }
|
|
2441
|
|
2442
|
|
2443 //----- (004BA928) --------------------------------------------------------
|
|
2444 void __cdecl ArmorShopDialog()
|
|
2445 {
|
|
2446 Player *v0; // ebx@1
|
|
2447 signed int v1; // esi@8
|
|
2448 unsigned int v2; // eax@10
|
|
2449 ItemGen *v3; // eax@11
|
|
2450 unsigned __int8 v4; // dl@12
|
|
2451 char *v5; // ecx@12
|
|
2452 char *v6; // eax@13
|
|
2453 int v7; // ST08_4@15
|
|
2454 int v8; // eax@15
|
|
2455 signed int v9; // esi@17
|
|
2456 unsigned int v10; // eax@19
|
|
2457 char *v11; // edi@19
|
|
2458 int v12; // ST08_4@20
|
|
2459 int v13; // eax@20
|
|
2460 unsigned __int8 v14; // dl@20
|
|
2461 char *v15; // ecx@20
|
|
2462 char **v16; // edi@22
|
|
2463 int all_text_height; // ebx@22
|
|
2464 char **v18; // esi@22
|
|
2465 int v19; // eax@23
|
|
2466 GUIWindow *v20; // ecx@24
|
|
2467 int v21; // eax@24
|
|
2468 int v22; // edx@24
|
|
2469 int v23; // ebx@24
|
|
2470 unsigned __int8 v24; // sf@24
|
|
2471 GUIButton *control_button; // eax@26
|
|
2472 GUIButton *v26; // esi@26
|
|
2473 int v27; // eax@26
|
|
2474 unsigned int v28; // ecx@26
|
|
2475 int v29; // edx@26
|
|
2476
|
|
2477 signed int v31; // esi@31
|
|
2478 unsigned int v32; // eax@33
|
|
2479 int v33; // eax@34
|
|
2480 int v34; // ST08_4@35
|
|
2481 int v35; // eax@35
|
|
2482 char *v36; // edx@36
|
|
2483 GUIWindow *v37; // edi@42
|
|
2484 signed int v38; // esi@42
|
|
2485 unsigned int v39; // esi@44
|
|
2486 int v40; // eax@44
|
|
2487 unsigned int v41; // eax@45
|
|
2488 int v42; // eax@47
|
|
2489 int v43; // ecx@52
|
|
2490 GUIButton *v44; // eax@54
|
|
2491 GUIButton *v45; // esi@54
|
|
2492 int v46; // eax@54
|
|
2493 char *v47; // eax@56
|
|
2494 int v48; // eax@56
|
|
2495 unsigned int v49; // ecx@56
|
|
2496 int v50; // edx@56
|
|
2497 int v51; // eax@56
|
|
2498 unsigned __int16 v52; // ax@56
|
|
2499 int v53; // eax@60
|
|
2500 int textureH; // eax@60
|
|
2501 signed int textureW; // ebx@65
|
|
2502 Texture *v56; // eax@67
|
|
2503 unsigned int v57; // edi@68
|
|
2504 Texture *v58; // ST1C_4@68
|
|
2505 int v59; // eax@68
|
|
2506 int v60; // edi@69
|
|
2507 signed int v61; // ebx@73
|
|
2508 Texture *v62; // eax@75
|
|
2509 int v63; // edi@76
|
|
2510 Texture *v64; // ST1C_4@76
|
|
2511 unsigned int v65; // ST18_4@76
|
|
2512 int v66; // eax@76
|
|
2513 int v67; // edi@77
|
|
2514 signed int v68; // ecx@81
|
|
2515 SHORT v69; // bx@89
|
|
2516 bool v70; // eax@89
|
|
2517 const char *v71; // ecx@91
|
|
2518 void *v72; // eax@95
|
|
2519 POINT *v73; // esi@97
|
|
2520 int v74; // ecx@97
|
|
2521 int v75; // eax@98
|
|
2522 int v76; // ecx@98
|
|
2523 ItemGen *selected_item; // ecx@99
|
|
2524 unsigned __int8 v78; // bl@104
|
|
2525 char **v79; // edi@105
|
|
2526 int v80; // ebx@105
|
|
2527 char **v81; // esi@105
|
|
2528 int v82; // eax@106
|
|
2529 GUIWindow *v83; // ecx@107
|
|
2530 int v84; // eax@107
|
|
2531 int v85; // edx@107
|
|
2532 int v86; // ebx@107
|
|
2533 GUIButton *v87; // eax@109
|
|
2534 GUIButton *v88; // esi@109
|
|
2535 int v89; // eax@109
|
|
2536 unsigned int v90; // ecx@109
|
|
2537 int v91; // edx@109
|
|
2538 unsigned __int16 v92; // ax@109
|
|
2539 signed int v93; // edx@114
|
|
2540 POINT *v94; // edi@120
|
|
2541 __int32 v95; // ecx@120
|
|
2542 void *v96; // ST14_4@122
|
|
2543 unsigned __int8 v97; // bl@122
|
|
2544 ItemGen *v98; // ST10_4@122
|
|
2545 int v99; // eax@122
|
|
2546 char *v100; // eax@122
|
|
2547 const char *v101; // ST18_4@122
|
|
2548 unsigned __int16 v102; // ST14_2@122
|
|
2549 int v103; // eax@122
|
|
2550 signed int v104; // edi@123
|
|
2551 Texture *v105; // eax@125
|
|
2552 int v106; // ebx@126
|
|
2553 Texture *v107; // ST1C_4@126
|
|
2554 unsigned int v108; // ST18_4@126
|
|
2555 int v109; // eax@126
|
|
2556 int v110; // ebx@127
|
|
2557 GUIWindow *v111; // [sp-18h] [bp-11Ch]@36
|
|
2558 unsigned int v112; // [sp-14h] [bp-118h]@13
|
|
2559 int v113; // [sp-14h] [bp-118h]@36
|
|
2560 ItemGen *v114; // [sp-10h] [bp-114h]@12
|
|
2561 unsigned int v115; // [sp-10h] [bp-114h]@13
|
|
2562 ItemGen *v116; // [sp-10h] [bp-114h]@20
|
|
2563 int v117; // [sp-10h] [bp-114h]@36
|
|
2564 void *v118; // [sp-Ch] [bp-110h]@12
|
|
2565 unsigned __int16 v119; // [sp-Ch] [bp-110h]@13
|
|
2566 void *v120; // [sp-Ch] [bp-110h]@20
|
|
2567 char *v121; // [sp-8h] [bp-10Ch]@13
|
|
2568 int v122; // [sp-8h] [bp-10Ch]@20
|
|
2569 unsigned int v123; // [sp-4h] [bp-108h]@13
|
|
2570 __int64 *v124; // [sp-4h] [bp-108h]@20
|
|
2571 int v125; // [sp-4h] [bp-108h]@68
|
|
2572 int v126; // [sp-4h] [bp-108h]@76
|
|
2573 int v127; // [sp-4h] [bp-108h]@126
|
|
2574 POINT v128; // [sp+Ch] [bp-F8h]@8
|
|
2575 POINT v129; // [sp+14h] [bp-F0h]@18
|
|
2576 char v130; // [sp+1Ch] [bp-E8h]@120
|
|
2577 POINT a2; // [sp+24h] [bp-E0h]@8
|
|
2578 POINT v132; // [sp+2Ch] [bp-D8h]@120
|
|
2579 POINT v133; // [sp+34h] [bp-D0h]@17
|
|
2580 POINT v134; // [sp+3Ch] [bp-C8h]@97
|
|
2581 POINT v135; // [sp+44h] [bp-C0h]@31
|
|
2582 POINT v136; // [sp+4Ch] [bp-B8h]@97
|
|
2583 POINT v137; // [sp+54h] [bp-B0h]@17
|
|
2584 POINT v138; // [sp+5Ch] [bp-A8h]@32
|
|
2585 POINT v139; // [sp+64h] [bp-A0h]@17
|
|
2586 POINT v140; // [sp+6Ch] [bp-98h]@31
|
|
2587 POINT v141; // [sp+74h] [bp-90h]@8
|
|
2588 POINT v142; // [sp+7Ch] [bp-88h]@31
|
|
2589 POINT v143; // [sp+84h] [bp-80h]@9
|
|
2590 GUIWindow dialog_window; // [sp+8Ch] [bp-78h]@1
|
|
2591 char *Str; // [sp+E0h] [bp-24h]@56
|
|
2592 int v146; // [sp+E4h] [bp-20h]@24
|
|
2593 int hilight_color; // [sp+E8h] [bp-1Ch]@1
|
|
2594 int m_text_color; // [sp+ECh] [bp-18h]@1
|
|
2595 __int32 v149; // [sp+F0h] [bp-14h]@8
|
|
2596 Player* _this; // [sp+F4h] [bp-10h]@1
|
|
2597 unsigned __int8 uPlayerID; // [sp+FBh] [bp-9h]@15
|
|
2598 int v152; // [sp+FCh] [bp-8h]@24
|
|
2599 int v153; // [sp+100h] [bp-4h]@44
|
|
2600 int th;
|
|
2601 short text_color;
|
|
2602
|
|
2603 v0 = pPlayers[uActiveCharacter];
|
|
2604 _this = pPlayers[uActiveCharacter];
|
|
2605 memcpy(&dialog_window, window_SpeakInHouse, sizeof(dialog_window));
|
|
2606 dialog_window.uFrameX = 483;
|
|
2607 dialog_window.uFrameWidth = 148;
|
|
2608 dialog_window.uFrameZ = 334;
|
|
2609 m_text_color = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu);
|
|
2610 hilight_color = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xCDu, 0x23u);
|
|
2611 switch (dialog_menu_id)
|
|
2612 {
|
|
2613 case DIALOG_SHOP_MAIN:
|
|
2614 {
|
|
2615 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
|
|
2616 return;
|
|
2617 pShopOptions[0] = pGlobalTXT_LocalizationStrings[134]; //"Buy Standard"
|
|
2618 pShopOptions[1] = pGlobalTXT_LocalizationStrings[152]; //"Buy Special"
|
|
2619 pShopOptions[2] = pGlobalTXT_LocalizationStrings[159]; //"Display Inventory"
|
|
2620 pShopOptions[3] = pGlobalTXT_LocalizationStrings[160];
|
|
2621
|
|
2622 all_text_height = 0;
|
|
2623 for(int i=0;i<4;++i)
|
|
2624 all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0);
|
|
2625 v146 = (174 - all_text_height) / 4;
|
|
2626
|
|
2627 v23 = (174 - 4 * (174 - all_text_height) / 4 - all_text_height) / 2 - (174 - all_text_height) / 4 / 2 + 138;
|
|
2628 int j=0;
|
|
2629 if ( pDialogueWindow->pNumPresenceButton>=0 )
|
|
2630 {
|
|
2631 th = 2;
|
|
2632 for (v152 = pDialogueWindow->pStartingPosActiveItem; v152 < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++v152)
|
|
2633 {
|
|
2634 control_button = pDialogueWindow->GetControl(v152);
|
|
2635 control_button->uY = v146 + v23;
|
|
2636 v27 = pFontArrus->CalcTextHeight(pShopOptions[j], &dialog_window, 0, 0);
|
|
2637 control_button->uHeight = v27;
|
|
2638 v23 = control_button->uY + control_button->uHeight - 1;
|
|
2639 control_button->uW = v23;
|
|
2640 text_color = hilight_color;
|
|
2641 if ( pDialogueWindow->pCurrentPosActiveItem != th )
|
|
2642 text_color = m_text_color;
|
|
2643 dialog_window.DrawTitleText(pFontArrus, 0, control_button->uY, text_color, pShopOptions[j], 3);
|
|
2644 ++th;
|
|
2645 ++j;
|
|
2646 }
|
|
2647 }
|
|
2648 }
|
|
2649 break;
|
|
2650 case DIALOG_SHOP_BUY_STANDART:
|
|
2651 {
|
|
2652 pRenderer->DrawTextureIndexed(8, 8, ShopTexture);
|
|
2653 textureW = 0;
|
|
2654 v153 = 0;
|
|
2655 for(int i=0; i<8; ++i)
|
|
2656 {
|
|
2657 if ( pParty->StandartItemsInShops[window_SpeakInHouse->par1C][i].uItemID);
|
|
2658 {
|
|
2659 textureW = ItemsInShopTexture[i]->uTextureWidth;
|
|
2660 textureH = ItemsInShopTexture[i]->uTextureHeight;
|
|
2661 if ( i >= 4 ) //low row
|
|
2662 {
|
|
2663 v60 = 90 - (textureW/2);
|
|
2664 pRenderer->DrawTextureTransparent(v60 + v153 - 420, 126, ItemsInShopTexture[i]);
|
|
2665 v59 = v60 + v153 + 80220;
|
|
2666 }
|
|
2667 else
|
|
2668 {
|
|
2669 v57 = 98 - textureH;
|
|
2670 v152 = 86 - (textureW/2);
|
|
2671 pRenderer->DrawTextureTransparent(v153 + v152, v57, ItemsInShopTexture[i]);
|
|
2672 v59 = v153 + v152 + 640 * v57;
|
|
2673 }
|
|
2674 ZBuffer_DoFill(&pRenderer->pActiveZBuffer[v59], ItemsInShopTexture[i], i+1);
|
|
2675 }
|
|
2676 v153 += 105;
|
|
2677
|
|
2678 }
|
|
2679
|
|
2680 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
|
|
2681 return;
|
|
2682
|
|
2683 v149 = 0;
|
|
2684 for(int i=0; i<8; ++i)
|
|
2685 {
|
|
2686 if ( pParty->StandartItemsInShops[window_SpeakInHouse->par1C][i].uItemID);
|
|
2687 ++v149;
|
|
2688
|
|
2689 }
|
|
2690
|
|
2691 v69 = GetAsyncKeyState(17);
|
|
2692 v70 = _this->CanSteal();
|
|
2693 //Str = (char *)v70;
|
|
2694 if ( v69 == 0 || v70 == 0 )
|
|
2695 {
|
|
2696 v71 = pGlobalTXT_LocalizationStrings[195]; //"Select the Item to Buy"
|
|
2697 }
|
|
2698 else
|
|
2699 {
|
|
2700 v71 = pGlobalTXT_LocalizationStrings[185];//"Steal item"
|
|
2701 }
|
|
2702 DrawTextAtStatusBar(v71, 0);
|
|
2703 if ( v149 != 0 )
|
|
2704 {
|
|
2705 v73 = pMouse->GetCursorPos(&v136);
|
|
2706 v74 = pRenderer->pActiveZBuffer[v73->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v134)->y]] & 0xFFFF;
|
|
2707 if ( !v74 )
|
|
2708 return;
|
|
2709 v149 = v74 - 1;
|
|
2710 selected_item = &pParty->StandartItemsInShops[window_SpeakInHouse->par1C][v74-1];
|
|
2711 if ( v69 ==0 || v70 == 0)
|
|
2712 {
|
|
2713 v120 = window_SpeakInHouse->ptr_1C;
|
|
2714 v15 = (char *)pMerchantsBuyPhrases[_this->_490EEE(selected_item, 2, window_SpeakInHouse->par1C, 2)];
|
|
2715 }
|
|
2716 else
|
|
2717 {
|
|
2718 v120 = window_SpeakInHouse->ptr_1C;
|
|
2719 v15 = pGlobalTXT_LocalizationStrings[181]; //"Steal %24"
|
|
2720 }
|
|
2721 v36 = BuilDialogueString(v15, uActiveCharacter - 1, selected_item, (char *)v120, 2, 0);
|
|
2722 v115 = (174 - pFontArrus->CalcTextHeight(v36, &dialog_window, 0, 0)) / 2 + 138;
|
|
2723 dialog_window.DrawTitleText(pFontArrus, 0, v115, m_text_color, v36, 3);
|
|
2724 return;
|
|
2725 }
|
|
2726 dialog_window.DrawCurrentTime( pParty->field_3C.field_50[window_SpeakInHouse->par1C]- pParty->uTimePlayed);
|
|
2727 return;
|
|
2728 }
|
|
2729 break;
|
|
2730 case DIALOG_SHOP_SELL:
|
|
2731 {
|
|
2732 draw_leather();
|
|
2733 CharacterUI_InventoryTab_Draw(uActiveCharacter, 1);
|
|
2734 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[199], 0);//"Select the Item to Sell"
|
|
2735 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win())
|
|
2736 return;
|
|
2737
|
|
2738 if((v9 = pMouse->GetCursorPos(&v139)->x - 14, v149 = (v9 >> 5) + 14 * ((pMouse->GetCursorPos(&v133)->y - 17) >> 5),
|
|
2739 pMouse->GetCursorPos(&v137)->x <= 13) || pMouse->GetCursorPos(&v129)->x >= 462
|
|
2740 || (v10 = v0->GetItemIDAtInventoryIndex((int *)&v149), v11 = 0, !v10) )
|
|
2741 return;
|
|
2742
|
|
2743 v116 = (ItemGen *)&v0->pInventoryItems[v10-1];
|
|
2744 v13 = v0->_490EEE(v116, 2, window_SpeakInHouse->par1C, 3);
|
|
2745 v15 = (char *)pMerchantsSellPhrases[v0->_490EEE(v116, 2, window_SpeakInHouse->par1C, 3)];
|
|
2746 v36 = BuilDialogueString(v15, uActiveCharacter - 1, v116, (char *) window_SpeakInHouse->par1C, 3, 0);
|
|
2747 v115 = (174 - pFontArrus->CalcTextHeight(v36, &dialog_window, 0, 0)) / 2 + 138;
|
|
2748 dialog_window.DrawTitleText(pFontArrus, 0, v115, m_text_color, v36, 3);
|
|
2749 return;
|
|
2750 }
|
|
2751 break;
|
|
2752 case DIALOG_SHOP_IDENTIFY:
|
|
2753 {
|
|
2754 draw_leather();
|
|
2755 CharacterUI_InventoryTab_Draw(uActiveCharacter, 1);
|
|
2756 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[197], 0); //"Select the Item to Identify"
|
|
2757 if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
|
|
2758 {
|
|
2759 v1 = pMouse->GetCursorPos(&a2)->x - 14;
|
|
2760 v149 = (v1 >> 5) + 14 * ((pMouse->GetCursorPos(&v128)->y - 17) >> 5);
|
|
2761 if ( pMouse->GetCursorPos(&v141)->x > 13 )
|
|
2762 {
|
|
2763 if ( pMouse->GetCursorPos(&v143)->x < 462 )
|
|
2764 {
|
|
2765 v2 = v0->GetItemIDAtInventoryIndex((int *)&v149);
|
|
2766 if ( v2 )
|
|
2767 {
|
|
2768 v3 = (ItemGen *)&v0->pInventoryItems[v2-1];
|
|
2769 if (v3->Identified())
|
|
2770 {
|
|
2771 v118 = window_SpeakInHouse->ptr_1C;
|
|
2772 v4 = uActiveCharacter - 1;
|
|
2773 v5 = "%24";
|
|
2774 v114 = v3;
|
|
2775 }
|
|
2776 else
|
|
2777 {
|
|
2778 v118 = window_SpeakInHouse->ptr_1C;
|
|
2779 v114 = v3;
|
|
2780 v7 = (int)window_SpeakInHouse->ptr_1C;
|
|
2781 uPlayerID = uActiveCharacter - 1;
|
|
2782 v8 = v0->_490EEE(v3, 2, v7, 4);
|
|
2783 v4 = uPlayerID;
|
|
2784 v5 = (char *)pMerchantsIdentifyPhrases[v8];
|
|
2785 }
|
|
2786 v6 = BuilDialogueString(v5, v4, v114, (char *)v118, 4, 0);
|
|
2787 v115 = (174 - pFontArrus->CalcTextHeight(v6, &dialog_window, 0, 0)) / 2 + 138;
|
|
2788 dialog_window.DrawTitleText(pFontArrus, 0, v115, m_text_color, v6, 3);
|
|
2789 return;
|
|
2790 }
|
|
2791 }
|
|
2792 }
|
|
2793 }
|
|
2794 }
|
|
2795 break;
|
|
2796 case DIALOG_SHOP_REPAIR:
|
|
2797 {
|
|
2798 draw_leather();
|
|
2799 CharacterUI_InventoryTab_Draw(uActiveCharacter, 1);
|
|
2800 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[198], 0);
|
|
2801 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win())
|
|
2802 return;
|
|
2803
|
|
2804 if( (v31 = pMouse->GetCursorPos(&v135)->x - 14,
|
|
2805 v149 = (v31 >> 5) + 14 * ((pMouse->GetCursorPos(&v142)->y - 17) >> 5),
|
|
2806 pMouse->GetCursorPos(&v140)->x <= 13)
|
|
2807 || pMouse->GetCursorPos(&v138)->x >= 462
|
|
2808 || (v32 = v0->GetItemIDAtInventoryIndex((int *)&v149), v11 = 0, !v32)
|
|
2809 || (v33 = 9 * v32, !(v0->field_1F5[4 * v33 + 15] & 2)) )
|
|
2810 return;
|
|
2811
|
|
2812
|
|
2813 v120 = window_SpeakInHouse->ptr_1C;
|
|
2814 v116 = (ItemGen *)&v0->spellbook.pDarkSpellbook.bIsSpellAvailable[4 * v33 + 5];
|
|
2815 v34 = (int)window_SpeakInHouse->ptr_1C;
|
|
2816 uPlayerID = uActiveCharacter - 1;
|
|
2817 v35 = v0->_490EEE((ItemGen *)&v0->spellbook.pDarkSpellbook.bIsSpellAvailable[4 * v33 + 5], 2, v34, 5);
|
|
2818 v14 = uPlayerID;
|
|
2819 v15 = (char *)pMerchantsRepairPhrases[v35];
|
|
2820 v36 = BuilDialogueString(v15, v14, v116, (char *)v120, 5, 0);
|
|
2821 v115 = (174 - pFontArrus->CalcTextHeight(v36, &dialog_window, 0, 0)) / 2 + 138;
|
|
2822 dialog_window.DrawTitleText(pFontArrus, 0, v115, m_text_color, v36, 3);
|
|
2823 return;
|
|
2824 }
|
|
2825 break;
|
|
2826 case 6: //buy standart
|
|
2827 {
|
|
2828 pRenderer->DrawTextureIndexed(8u, 8u, ShopTexture);
|
|
2829 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[195], 0); //"Select the Item to Buy"
|
|
2830 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
|
|
2831 return;
|
|
2832 v149 = 0;
|
|
2833 for(int i=0;i<6;++i)
|
|
2834 if (pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][i].uItemID)
|
|
2835 ++v149;
|
|
2836
|
|
2837
|
|
2838 if ( v149 )
|
|
2839 {
|
|
2840 v94 = pMouse->GetCursorPos(&v132);
|
|
2841 v149 = pRenderer->pActiveZBuffer[v94->x + pSRZBufferLineOffsets[pMouse->GetCursorPos((POINT *)&v130)->y]];
|
|
2842 v95 = v149;
|
|
2843 if ( v149 && v149 != -65536 )
|
|
2844 {
|
|
2845 --v149;
|
|
2846
|
|
2847 v97 = uActiveCharacter - 1;
|
|
2848
|
|
2849 v99 = _this->_490EEE(
|
|
2850 &pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][v95-1], 2, window_SpeakInHouse->par1C, 2);
|
|
2851 v100 = BuilDialogueString((char *)pMerchantsBuyPhrases[v99], uActiveCharacter - 1, v98, (char *)window_SpeakInHouse->par1C, 2, 0);
|
|
2852 v103 = pFontArrus->CalcTextHeight(v100, &dialog_window, 0, 0);
|
|
2853 dialog_window.DrawTitleText(pFontArrus, 0, (174 - v103) / 2 + 138, m_text_color, v100, 3);
|
|
2854 }
|
|
2855 v104 = 0;
|
|
2856 v153 = 0;
|
|
2857 do
|
|
2858 {
|
|
2859 //if ( pParty->field_C59C[9 * (v104 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] )
|
|
2860 if (pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][v104].uItemID)
|
|
2861 {
|
|
2862 v105 = ItemsInShopTexture[v104];
|
|
2863 if ( v104 >= 4 )
|
|
2864 {
|
|
2865 v110 = 90 - ((signed int)v105->uTextureWidth >> 1);
|
|
2866 pRenderer->DrawTextureTransparent(v153 + v110 - 420, 0x7Eu, ItemsInShopTexture[v104]);
|
|
2867 v127 = v104 + 1;
|
|
2868 v109 = v153 + v110 + 80220;
|
|
2869 }
|
|
2870 else
|
|
2871 {
|
|
2872 v106 = 98 - v105->uTextureHeight;
|
|
2873 v107 = ItemsInShopTexture[v104];
|
|
2874 v108 = 98 - v105->uTextureHeight;
|
|
2875 v152 = 86 - ((signed int)v105->uTextureWidth >> 1);
|
|
2876 pRenderer->DrawTextureTransparent(v152 + v153, v108, v107);
|
|
2877 v127 = v104 + 1;
|
|
2878 v109 = v152 + v153 + 640 * v106;
|
|
2879 }
|
|
2880 ZBuffer_DoFill(&pRenderer->pActiveZBuffer[v109], ItemsInShopTexture[v104], v127);
|
|
2881 }
|
|
2882 v153 += 105;
|
|
2883 ++v104;
|
|
2884 }
|
|
2885 while ( v104 < 8 );
|
|
2886 return;
|
|
2887 }
|
|
2888 dialog_window.DrawCurrentTime(pParty->field_3C.field_50[window_SpeakInHouse->par1C]- pParty->uTimePlayed);
|
|
2889 return;
|
|
2890 }
|
|
2891 break;
|
|
2892 case DIALOG_SHOP_DISPLAY_EQUIPMENT:
|
|
2893 {
|
|
2894 draw_leather();
|
|
2895 CharacterUI_InventoryTab_Draw(uActiveCharacter, 1);
|
|
2896 v79 = pShopOptions;
|
|
2897 pShopOptions[0] = pGlobalTXT_LocalizationStrings[200]; //"Sell"
|
|
2898 pShopOptions[1] = pGlobalTXT_LocalizationStrings[113]; //"Identify"
|
|
2899 pShopOptions[2] = pGlobalTXT_LocalizationStrings[179]; //"Repair"
|
|
2900
|
|
2901 all_text_height = 0;
|
|
2902 for(int i=0;i<3;++i)
|
|
2903 all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0);
|
|
2904 v83 = pDialogueWindow;
|
|
2905 v152 = (174 - all_text_height) / 3;
|
|
2906 v84 = pDialogueWindow->pStartingPosActiveItem;
|
|
2907 v85 = v84 + pDialogueWindow->pNumPresenceButton;
|
|
2908 v86 = (3 * (58 - v152) - all_text_height) / 2 - v152 / 2 + 138;
|
|
2909 v24 = -pDialogueWindow->pNumPresenceButton < 0;
|
|
2910 _this = (Player *)pDialogueWindow->pStartingPosActiveItem;
|
|
2911 if ( v24 ^ __OFSUB__(v84, v85) )
|
|
2912 {
|
|
2913 v153 = 2;
|
|
2914 do
|
|
2915 {
|
|
2916 v87 = v83->GetControl((unsigned int)_this);
|
|
2917 v88 = v87;
|
|
2918 v87->uY = v152 + v86;
|
|
2919 v89 = pFontArrus->CalcTextHeight(*v79, &dialog_window, 0, 0);
|
|
2920 v90 = v88->uY;
|
|
2921 v91 = v153;
|
|
2922 v88->uHeight = v89;
|
|
2923 v86 = v90 + v89 - 1;
|
|
2924 v88->uW = v86;
|
|
2925 v92 = hilight_color;
|
|
2926 if ( pDialogueWindow->pCurrentPosActiveItem != v91 )
|
|
2927 v92 = m_text_color;
|
|
2928 dialog_window.DrawTitleText(pFontArrus, 0, v90, v92, *v79, 3u);
|
|
2929 v83 = pDialogueWindow;
|
|
2930 ++v153;
|
|
2931 ++v79;
|
|
2932 _this = (Player *)((char *)_this + 1);
|
|
2933 }
|
|
2934 while ( (signed int)_this < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem );
|
|
2935 }
|
|
2936 return;
|
|
2937 }
|
|
2938 break;
|
|
2939 case DIALOG_SHOP_BUY_SPECIAL:
|
|
2940 {
|
|
2941 pRenderer->DrawTextureIndexed(8, 8, ShopTexture);
|
|
2942 v11 = 0;
|
|
2943 v61 = 0;
|
|
2944 v153 = 0;
|
|
2945 do
|
|
2946 {
|
|
2947 if (pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][v61].uItemID)
|
|
2948 {
|
|
2949 v62 = ItemsInShopTexture[v61];
|
|
2950 if ( v61 >= 4 )
|
|
2951 {
|
|
2952 v67 = 90 - ((signed int)v62->uTextureWidth >> 1);
|
|
2953 pRenderer->DrawTextureTransparent(v153 + v67 - 420, 0x7Eu, ItemsInShopTexture[v61]);
|
|
2954 v66 = v153 + v67 + 80220;
|
|
2955 }
|
|
2956 else
|
|
2957 {
|
|
2958 v63 = 98 - v62->uTextureHeight;
|
|
2959 v64 = ItemsInShopTexture[v61];
|
|
2960 v65 = 98 - v62->uTextureHeight;
|
|
2961 v152 = 86 - ((signed int)v62->uTextureWidth >> 1);
|
|
2962 pRenderer->DrawTextureTransparent(v152 + v153, v65, v64);
|
|
2963 v66 = v152 + v153 + 640 * v63;
|
|
2964 }
|
|
2965 ZBuffer_DoFill(&pRenderer->pActiveZBuffer[v66], ItemsInShopTexture[v61], v61 + 1);
|
|
2966 }
|
|
2967 v153 += 105;
|
|
2968 ++v61;
|
|
2969 }
|
|
2970 while ( v61 < 8 );
|
|
2971
|
|
2972 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
|
|
2973 return;
|
|
2974 v68 = 0;
|
|
2975 v149 = 0;
|
|
2976
|
|
2977 do
|
|
2978 {
|
|
2979 // if ( (char *)pParty->field_C59C[9 * (v68 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] != v11 )
|
|
2980 if (pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][(signed int)v68].uItemID)
|
|
2981 ++v149;
|
|
2982 ++v68;
|
|
2983 }
|
|
2984 while ( v68 < 6 );
|
|
2985
|
|
2986 v69 = GetAsyncKeyState(17);
|
|
2987 v70 = _this->CanSteal();
|
|
2988 Str = (char *)v70;
|
|
2989 if ( v69 == 0 || (char *)v70 == 0 )
|
|
2990 {
|
|
2991 v71 = pGlobalTXT_LocalizationStrings[196]; //Select the Special Item to Buy"
|
|
2992 }
|
|
2993 else
|
|
2994 {
|
|
2995 v71 = pGlobalTXT_LocalizationStrings[185];
|
|
2996 }
|
|
2997 DrawTextAtStatusBar(v71, 0);
|
|
2998 if ( (char *)v149 != 0 )
|
|
2999 {
|
|
3000 v73 = pMouse->GetCursorPos(&v136);
|
|
3001 v74 = pRenderer->pActiveZBuffer[v73->x + pSRZBufferLineOffsets[pMouse->GetCursorPos((POINT *)&v134)->y]] & 0xFFFF;
|
|
3002 if ( !v74 )
|
|
3003 return;
|
|
3004 v149 = v74 - 1;
|
|
3005
|
|
3006 if ( dialog_menu_id == 2 )
|
|
3007 selected_item = &pParty->StandartItemsInShops[window_SpeakInHouse->par1C][v74-1];
|
|
3008 else
|
|
3009 selected_item = &pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][v74-1];//(ItemGen *)&pParty->field_C59C[v76 + 724];
|
|
3010 if ( v69 == 0 || Str == 0 )
|
|
3011 {
|
|
3012 v120 = window_SpeakInHouse->ptr_1C;
|
|
3013 v15 = (char *)pMerchantsBuyPhrases[_this->_490EEE(selected_item, 2, window_SpeakInHouse->par1C, 2)];
|
|
3014 }
|
|
3015 else
|
|
3016 {
|
|
3017 v120 = window_SpeakInHouse->ptr_1C;
|
|
3018 v15 = pGlobalTXT_LocalizationStrings[181]; //"Steal %24"
|
|
3019 }
|
|
3020 v36 = BuilDialogueString(v15, uActiveCharacter - 1, selected_item, (char *)v120, 2, 0);
|
|
3021 v115 = (174 - pFontArrus->CalcTextHeight(v36, &dialog_window, 0, 0)) / 2 + 138;
|
|
3022 dialog_window.DrawTitleText(pFontArrus, 0, v115, m_text_color, v36, 3);
|
|
3023 return;
|
|
3024 }
|
|
3025 dialog_window.DrawCurrentTime( pParty->field_3C.field_50[window_SpeakInHouse->par1C]- pParty->uTimePlayed);
|
|
3026 return;
|
|
3027 }
|
|
3028 break;
|
|
3029 case DIALOG_SHOP_SKILLS:
|
|
3030 {
|
|
3031 if (!sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
|
|
3032 return;
|
|
3033 v152 = 0;
|
|
3034 v37 = pDialogueWindow;
|
|
3035 //v38 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (unsigned int)ptr_507BC0->ptr_1C] * 500.0);
|
|
3036 v38 = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0);
|
|
3037 _this = (Player *)(v38 * (100 - v0->GetMerchant()) / 100);
|
|
3038 if ( (signed int)_this < v38 / 3 )
|
|
3039 _this = (Player *)(v38 / 3);
|
|
3040 v39 = v37->pStartingPosActiveItem;
|
|
3041 v40 = v37->pNumPresenceButton;
|
|
3042 v153 = 0;
|
|
3043 if ( (signed int)v39 < (signed int)(v39 + v40) )
|
|
3044 {
|
|
3045 do
|
|
3046 {
|
|
3047 v41 = v37->GetControl(v39)->uControlParam - 36;
|
|
3048 if ( byte_4ED970_skill_learn_ability_by_class_table[v0->classType][v41] && !v0->pActiveSkills[v41] )
|
|
3049 {
|
|
3050 v42 = pFontArrus->CalcTextHeight(pSkillNames[v41], &dialog_window, 0, 0);
|
|
3051 v152 += v42;
|
|
3052 ++v153;
|
|
3053 }
|
|
3054 ++v39;
|
|
3055 }
|
|
3056 while ( (signed int)v39 < v37->pNumPresenceButton + v37->pStartingPosActiveItem );
|
|
3057 if ( v153 )
|
|
3058 {
|
|
3059 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], _this);
|
|
3060 dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u);
|
|
3061 _this = (Player *)((149 - v152) / v153);
|
|
3062 if ( (149 - v152) / v153 > 32 )
|
|
3063 _this = (Player *)32;
|
|
3064 v43 = (149 - v153 * (signed int)_this - v152) / 2 - (signed int)_this / 2 + 162;
|
|
3065 v152 = v37->pStartingPosActiveItem;
|
|
3066 v146 = v43;
|
|
3067 if ( v152 < v152 + v37->pNumPresenceButton )
|
|
3068 {
|
|
3069 v153 = 2;
|
|
3070 do
|
|
3071 {
|
|
3072 v44 = v37->GetControl(v152);
|
|
3073 v45 = v44;
|
|
3074 v46 = v44->uControlParam - 36;
|
|
3075 if ( !byte_4ED970_skill_learn_ability_by_class_table[v0->classType][v46] || v0->pActiveSkills[v46] )
|
|
3076 {
|
|
3077 v45->uW = 0;
|
|
3078 v45->uHeight = 0;
|
|
3079 v45->uY = 0;
|
|
3080 }
|
|
3081 else
|
|
3082 {
|
|
3083 v47 = pSkillNames[v46];
|
|
3084 v45->uY = (unsigned int)((char *)_this + v146);
|
|
3085 Str = v47;
|
|
3086 v48 = pFontArrus->CalcTextHeight(v47, &dialog_window, 0, 0);
|
|
3087 v49 = v45->uY;
|
|
3088 v50 = v153;
|
|
3089 v45->uHeight = v48;
|
|
3090 v51 = v49 + v48 - 1;
|
|
3091 v45->uW = v51;
|
|
3092 v146 = v51;
|
|
3093 v52 = hilight_color;
|
|
3094 if ( pDialogueWindow->pCurrentPosActiveItem != v50 )
|
|
3095 v52 = m_text_color;
|
|
3096 dialog_window.DrawTitleText(pFontArrus, 0, v49, v52, Str, 3u);
|
|
3097 }
|
|
3098 v53 = v37->pStartingPosActiveItem;
|
|
3099 ++v152;
|
|
3100 textureH = v37->pNumPresenceButton + v53;
|
|
3101 ++v153;
|
|
3102 }
|
|
3103 while ( v152 < textureH );
|
|
3104 }
|
|
3105 return;
|
|
3106 }
|
|
3107 }
|
|
3108 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], v0->pName, pClassNames[v0->classType]); //"Seek knowledge elsewhere %s the %s"
|
|
3109 strcat(pTmpBuf, "\n \n");
|
|
3110 strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]); //"I can offer you nothing further."
|
|
3111 v115 = (174 - pFontArrus->CalcTextHeight(pTmpBuf, &dialog_window, 0, 0)) / 2 + 138;
|
|
3112 dialog_window.DrawTitleText(pFontArrus, 0, v115, hilight_color, pTmpBuf, 3);
|
|
3113 return;
|
|
3114 }
|
|
3115 break;
|
|
3116 }
|
|
3117 }
|
|
3118
|
|
3119
|
|
3120
|
|
3121 //----- (004B5D7C) --------------------------------------------------------
|
|
3122 void GuildDialog()
|
|
3123 {
|
|
3124 GUIWindow *v0; // ebx@1
|
|
3125 Player *currPlayer; // edi@1
|
|
3126 signed int base_teach_price; // ebx@1
|
|
3127 int v3; // edi@6
|
|
3128 int result; // eax@11
|
|
3129 unsigned int v5; // ebx@13
|
|
3130 int v6; // esi@13
|
|
3131 signed int v7; // esi@17
|
|
3132 int v8; // esi@22
|
|
3133 signed int v9; // ecx@22
|
|
3134 char *v10; // eax@22
|
|
3135 const char *statusbar_string; // ecx@26
|
|
3136 POINT *v12; // esi@30
|
|
3137 int v13; // ecx@30
|
|
3138 void *v14; // ST1C_4@31
|
|
3139 ItemGen *v15; // ST18_4@31
|
|
3140 int v16; // ST10_4@31
|
|
3141 int v17; // eax@31
|
|
3142 char *v18; // edx@31
|
|
3143 int v19; // eax@32
|
|
3144 GUIWindow *v20; // edi@35
|
|
3145 int v21; // esi@35
|
|
3146 int v22; // eax@35
|
|
3147 unsigned int v23; // eax@36
|
|
3148 int v24; // eax@39
|
|
3149 int v25; // eax@40
|
|
3150 int v26; // ecx@47
|
|
3151 GUIButton *v27; // eax@49
|
|
3152 GUIButton *v28; // esi@49
|
|
3153 unsigned int v29; // eax@49
|
|
3154 char *v30; // eax@52
|
|
3155 int v31; // eax@55
|
|
3156 unsigned int v32; // ecx@55
|
|
3157 int v33; // eax@55
|
|
3158 unsigned __int16 v34; // ax@55
|
|
3159 int v35; // eax@58
|
|
3160 const char *v36; // ST20_4@61
|
|
3161 unsigned __int16 v37; // ST1C_2@61
|
|
3162 int v38; // eax@61
|
|
3163 GUIWindow *v39; // [sp-18h] [bp-304h]@31
|
|
3164 int v40; // [sp-14h] [bp-300h]@31
|
|
3165 int v41; // [sp-10h] [bp-2FCh]@31
|
|
3166 unsigned __int16 v42; // [sp-Ch] [bp-2F8h]@31
|
|
3167 char *v43; // [sp-8h] [bp-2F4h]@31
|
|
3168 unsigned int v44; // [sp-4h] [bp-2F0h]@31
|
|
3169 char Dest[100]; // [sp+Ch] [bp-2E0h]@3
|
|
3170 char v46[100]; // [sp+70h] [bp-27Ch]@3
|
|
3171 char v47[100]; // [sp+D4h] [bp-218h]@3
|
|
3172 char v48[100]; // [sp+138h] [bp-1B4h]@3
|
|
3173 char v49[100]; // [sp+19Ch] [bp-150h]@3
|
|
3174 POINT v50; // [sp+264h] [bp-88h]@30
|
|
3175 POINT v51; // [sp+26Ch] [bp-80h]@30
|
|
3176 GUIWindow working_window; // [sp+274h] [bp-78h]@1
|
|
3177 signed int v53; // [sp+27Ch] [bp-70h]@1
|
|
3178 signed int v54; // [sp+284h] [bp-68h]@1
|
|
3179 int v55; // [sp+2C8h] [bp-24h]@47
|
|
3180 int main_text_color; // [sp+2CCh] [bp-20h]@1
|
|
3181 int hi_text_color; // [sp+2D0h] [bp-1Ch]@1
|
|
3182 Player *v58; // [sp+2D4h] [bp-18h]@1
|
|
3183 unsigned __int8 uPlayerID; // [sp+2DBh] [bp-11h]@31
|
|
3184 char *Str; // [sp+2DCh] [bp-10h]@35
|
|
3185 int v61; // [sp+2E0h] [bp-Ch]@35
|
|
3186 unsigned int v62; // [sp+2E4h] [bp-8h]@13
|
|
3187 int v63; // [sp+2E8h] [bp-4h]@1
|
|
3188
|
|
3189 v0 = window_SpeakInHouse;
|
|
3190 memcpy(&working_window, window_SpeakInHouse, sizeof(GUIWindow));
|
|
3191 v58 = pPlayers[uActiveCharacter];
|
|
3192 currPlayer = v58;
|
|
3193 working_window.uFrameX = 483;
|
|
3194 working_window.uFrameWidth = 148;
|
|
3195 working_window.uFrameZ = 334;
|
|
3196 main_text_color = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu);
|
|
3197 hi_text_color = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu);
|
|
3198 //v2 = (signed __int64)(p2DEvents_minus1__20[13 * (unsigned int)v0->ptr_1C] * 500.0);
|
|
3199 base_teach_price = (signed __int64)(p2DEvents[(unsigned int)v0->ptr_1C - 1].fPriceMultiplier * 500.0);
|
|
3200 v63 = base_teach_price * (100 - currPlayer->GetMerchant()) / 100;
|
|
3201 if ( v63 < base_teach_price / 3 )
|
|
3202 v63 = base_teach_price / 3;
|
|
3203 strcpy(Dest, "");
|
|
3204 strcpy(v46, "");
|
|
3205 strcpy(v47, "");
|
|
3206 strcpy(v48, "");
|
|
3207 strcpy(v49, "");
|
|
3208 if ( dialog_menu_id != 1 )
|
|
3209 {
|
|
3210 if ( dialog_menu_id != 18 ) //buy skill
|
|
3211 {
|
|
3212 if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
|
|
3213 {
|
|
3214 //v3 = (int)(&currPlayer->uIntelligence + dword_F8B19C); //test skill
|
|
3215 if ( v58->pActiveSkills[dialog_menu_id-36] )
|
|
3216 {
|
|
3217 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[403], pClassNames[dialog_menu_id - 16]); //"You already know the %s skill"
|
|
3218 ShowStatusBarString(pTmpBuf, 2u);
|
|
3219 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0);
|
|
3220 }
|
|
3221 else
|
|
3222 {
|
|
3223 if ( pParty->uNumGold < v63 )
|
|
3224 {
|
|
3225 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u); //"You don't have enough gold"
|
|
3226 HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 2);
|
|
3227 }
|
|
3228 else
|
|
3229 {
|
|
3230 Party::TakeGold(v63);
|
|
3231 v58->pActiveSkills[dialog_menu_id-36] = 1;
|
|
3232 }
|
|
3233 }
|
|
3234 }
|
|
3235 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
|
|
3236 return;
|
|
3237 }
|
|
3238 pRenderer->DrawTextureIndexed(8u, 8u, ShopTexture);
|
|
3239 v5 = 0;
|
|
3240 v6 = 0;
|
|
3241 v62 = 0;
|
|
3242 v63 = 32;
|
|
3243 do
|
|
3244 {
|
|
3245 if (pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C-139][v6].uItemID)
|
|
3246 // if ( *(&pParty->pPlayers[1].pInstalledBeacons[0].field_18 + 9 * (v6 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)) )
|
|
3247
|
|
3248 {
|
|
3249 pRenderer->DrawTextureTransparent(v63, 0x5Au, ItemsInShopTexture[v6]);
|
|
3250 ZBuffer_DoFill((int *)((char *)pRenderer->pActiveZBuffer + v62 + 230528), ItemsInShopTexture[v6], v6 + 1);
|
|
3251 currPlayer = v58;
|
|
3252 }
|
|
3253 v63 += 70;
|
|
3254 v62 += 280;
|
|
3255 ++v6;
|
|
3256 }
|
|
3257 while ( v63 < 452 );
|
|
3258
|
|
3259 v62 = 1680;
|
|
3260 v7 = 6;
|
|
3261 v63 = 32;
|
|
3262 do
|
|
3263 {
|
|
3264 if (pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C-139][v7].uItemID)
|
|
3265 // if ( *(&pParty->pPlayers[1].pInstalledBeacons[0].field_18 + 9 * (v7 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)) )
|
|
3266 {
|
|
3267 pRenderer->DrawTextureTransparent(v63, 0xFAu, ItemsInShopTexture[v7]);
|
|
3268 ZBuffer_DoFill((int *)((char *)pRenderer->pActiveZBuffer + v62 + 638448), ItemsInShopTexture[v7], v7 + 1);
|
|
3269 currPlayer = v58;
|
|
3270 }
|
|
3271 v63 += 70;
|
|
3272 v62 += 280;
|
|
3273 ++v7;
|
|
3274 }
|
|
3275 while ( v63 < 452 );
|
|
3276
|
|
3277 if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
|
|
3278 {
|
|
3279 v8 = 0;
|
|
3280 v9 = 12;
|
|
3281 // v10 = (char *)(&pParty->pPlayers[1].pInstalledBeacons[0].field_18 + 108 * (unsigned int)window_SpeakInHouse->ptr_1C);
|
|
3282 // v10 =
|
|
3283 do
|
|
3284 {
|
|
3285 if (pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C-139][v9].uItemID )
|
|
3286 ++v8;
|
|
3287 // v10 += 36;
|
|
3288 --v9;
|
|
3289 }
|
|
3290 while ( v9 );
|
|
3291
|
|
3292 GetAsyncKeyState(17);
|
|
3293 statusbar_string = pGlobalTXT_LocalizationStrings[195]; //"Select the Item to Buy"
|
|
3294 if ( dialog_menu_id != 2 )
|
|
3295 statusbar_string = pGlobalTXT_LocalizationStrings[196]; //"Select the Special Item to Buy"
|
|
3296 DrawTextAtStatusBar(statusbar_string, 0);
|
|
3297 if ( !v8 )
|
|
3298 {
|
|
3299 working_window.DrawCurrentTime(
|
|
3300 __PAIR__(
|
|
3301 *(int *)&stru_AA1058[3].pSounds[8 * (unsigned int)window_SpeakInHouse->ptr_1C + 44472],
|
|
3302 *(int *)&stru_AA1058[3].pSounds[8 * (unsigned int)window_SpeakInHouse->ptr_1C + 44468])
|
|
3303 - pParty->uTimePlayed);
|
|
3304 return;
|
|
3305 }
|
|
3306 v12 = pMouse->GetCursorPos(&v51);
|
|
3307 result = v12->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v50)->y];
|
|
3308 v13 = pRenderer->pActiveZBuffer[result] & 0xFFFF;
|
|
3309 if ( pRenderer->pActiveZBuffer[result] & 0xFFFF )
|
|
3310 {
|
|
3311 v14 = window_SpeakInHouse->ptr_1C;
|
|
3312 v15 = (ItemGen *)(&pParty->pPlayers[1].uExpressionTimeLength + 18 * (v13 + 12 * (int)v14));
|
|
3313 v16 = (int)window_SpeakInHouse->ptr_1C;
|
|
3314 uPlayerID = uActiveCharacter - 1;
|
|
3315 v17 = currPlayer->_490EEE( (ItemGen *)&pParty->pPlayers[1].uExpressionTimeLength + v13 + 12 * (int)v14, 3, v16, 2);
|
|
3316 v18 = BuilDialogueString((char *)pMerchantsBuyPhrases[v17], uPlayerID, v15, (char *)v14, 2, 0);
|
|
3317 v19 = pFontArrus->CalcTextHeight(v18, &working_window, 0, 0);
|
|
3318 working_window.DrawTitleText(pFontArrus, 0, (174 - v19) / 2 + 138, main_text_color, v18, 3);
|
|
3319 return;
|
|
3320 }
|
|
3321 }
|
|
3322 return;
|
|
3323 }
|
|
3324 if ( !(unsigned __int16)_449B57_test_bit(
|
|
3325 (unsigned __int8 *)currPlayer->_guilds_member_bits,
|
|
3326 guild_mambership_flags[(unsigned int)window_SpeakInHouse->ptr_1C-139]) )
|
|
3327 { //you must me member
|
|
3328 v38 = pFontArrus->CalcTextHeight(pNPCTopics[121].pText, &working_window, 0, 0);
|
|
3329 working_window.DrawTitleText(pFontArrus, 0, (212 - v38) / 2 + 101, hi_text_color, pNPCTopics[121].pText, 3u);
|
|
3330 pDialogueWindow->pNumPresenceButton = 0;
|
|
3331 return;
|
|
3332 }
|
|
3333
|
|
3334 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
|
|
3335 return;
|
|
3336 v20 = pDialogueWindow;
|
|
3337 v5 = 0;
|
|
3338 v62 = 0;
|
|
3339 Str = 0;
|
|
3340 v21 = pDialogueWindow->pStartingPosActiveItem;
|
|
3341 v22 = v21 + pDialogueWindow->pNumPresenceButton;
|
|
3342 v61 = 0;
|
|
3343 if ( pDialogueWindow->pStartingPosActiveItem >= pDialogueWindow->pStartingPosActiveItem+pDialogueWindow->pNumPresenceButton )
|
|
3344 {
|
|
3345 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]); // "Seek knowledge elsewhere %s the %s"
|
|
3346 strcat(pTmpBuf, "\n \n");
|
|
3347 strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]); //"I can offer you nothing further."
|
|
3348 v19 = pFontArrus->CalcTextHeight(pTmpBuf, &working_window, 0, 0);
|
|
3349 working_window.DrawTitleText(pFontArrus, v5, (174 - v19) / 2 + 138, hi_text_color, pTmpBuf, 3);
|
|
3350 return;
|
|
3351 }
|
|
3352 do
|
|
3353 {
|
|
3354 v23 = v20->GetControl(v21)->uControlParam;
|
|
3355 if ( v23 == 18 )
|
|
3356 {
|
|
3357 v25 = pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[400], &working_window, 0, 0); //"Buy Spells"
|
|
3358 v62 += v25;
|
|
3359 ++v61;
|
|
3360 }
|
|
3361 else
|
|
3362 {
|
|
3363
|
|
3364 if((byte_4ED970_skill_learn_ability_by_class_table[v58->classType][v23-36])&&(v58->pActiveSkills[v23-36]))
|
|
3365 // or
|
|
3366 //byte_4ED970_skill_learn_ability_by_class_table[v58->uClass - 1][v23 + 1]
|
|
3367 {
|
|
3368 v24 = pFontArrus->CalcTextHeight(pClassNames[v23 - 16], &working_window, 0, 0);
|
|
3369 v62 += v24;
|
|
3370 ++v61;
|
|
3371 ++Str;
|
|
3372 }
|
|
3373 }
|
|
3374 ++v21;
|
|
3375 }
|
|
3376 while ( v21 < v20->pNumPresenceButton + v20->pStartingPosActiveItem );
|
|
3377 if ( !v61 )
|
|
3378 {
|
|
3379 LABEL_64:
|
|
3380 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], v58->pName, pClassNames[v58->classType]); // "Seek knowledge elsewhere %s the %s"
|
|
3381 strcat(pTmpBuf, "\n \n");
|
|
3382 strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]); //"I can offer you nothing further."
|
|
3383 v19 = pFontArrus->CalcTextHeight(pTmpBuf, &working_window, 0, 0);
|
|
3384 working_window.DrawTitleText(pFontArrus, v5, (174 - v19) / 2 + 138, hi_text_color, pTmpBuf, 3);
|
|
3385 return;
|
|
3386 }
|
|
3387 if ( Str )
|
|
3388 {
|
|
3389 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], v63); //"Skill Cost: %lu"
|
|
3390 working_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u);
|
|
3391 }
|
|
3392 v63 = (signed int)(149 - v62) / v61;
|
|
3393 if ( v63 > 32 )
|
|
3394 v63 = 32;
|
|
3395 v26 = (signed int)(149 - v61 * v63 - v62) / 2 - v63 / 2 + 162;
|
|
3396 v62 = v20->pStartingPosActiveItem;
|
|
3397 v55 = v26;
|
|
3398 if (v20->pStartingPosActiveItem < v20->pStartingPosActiveItem + v20->pNumPresenceButton )
|
|
3399 {
|
|
3400 v61 = 2;
|
|
3401 while ( 1 )
|
|
3402 {
|
|
3403 v27 = v20->GetControl(v62);
|
|
3404 v28 = v27;
|
|
3405 v29 = v27->uControlParam;
|
|
3406 if ( v29 == 18 )
|
|
3407 break;
|
|
3408
|
|
3409 // __debugbreak();
|
|
3410 //pSkillAvailabilityPerClass[8 + v58->uClass][4 + v23]
|
|
3411 // or
|
|
3412 if ((byte_4ED970_skill_learn_ability_by_class_table[v58->classType][v29 - 36])&&(v58->pActiveSkills[v29-36]))
|
|
3413 // or
|
|
3414 //byte_4ED970_skill_learn_ability_by_class_table[v58->uClass - 1][v23 + 1]
|
|
3415
|
|
3416 {
|
|
3417 v30 = pClassNames[v29 -16];
|
|
3418 LABEL_55:
|
|
3419 Str = v30;
|
|
3420 v28->uY = v63 + v55;
|
|
3421 v31 = pFontArrus->CalcTextHeight(v30, &working_window, 0, 0);
|
|
3422 v32 = v28->uY;
|
|
3423 v28->uHeight = v31;
|
|
3424 v33 = v32 + v31 - 1;
|
|
3425 v28->uW = v33;
|
|
3426 v55 = v33;
|
|
3427 v34 = hi_text_color;
|
|
3428 if ( pDialogueWindow->pCurrentPosActiveItem != v61 )
|
|
3429 v34 = main_text_color;
|
|
3430 working_window.DrawTitleText(pFontArrus, 0, v32, v34, Str, 3u);
|
|
3431 v35 = v20->pStartingPosActiveItem;
|
|
3432 ++v62;
|
|
3433 ++v61;
|
|
3434 if ( (signed int)v62 >=v20->pNumPresenceButton +v20->pStartingPosActiveItem )
|
|
3435 return;
|
|
3436 }
|
|
3437 v28->uW = 0;
|
|
3438 v28->uHeight = 0;
|
|
3439 v28->uY = 0;
|
|
3440 LABEL_58:
|
|
3441 v35 = v20->pStartingPosActiveItem;
|
|
3442 ++v62;
|
|
3443 ++v61;
|
|
3444 if ( (signed int)v62 >=v20->pNumPresenceButton +v20->pStartingPosActiveItem )
|
|
3445 return;
|
|
3446 }
|
|
3447 v30 = pGlobalTXT_LocalizationStrings[400]; //"Buy Spells"
|
|
3448 goto LABEL_55;
|
|
3449 }
|
|
3450 return;
|
|
3451 }
|
|
3452
|
|
3453
|
|
3454
|
|
3455 //----- (004B705E) --------------------------------------------------------
|
|
3456 void TempleDialog()
|
|
3457 {
|
|
3458 GUIWindow *v0; // ebx@1
|
|
3459 Player *v1; // esi@1
|
|
3460 int v2; // edi@1
|
|
3461 int result; // eax@4
|
|
3462 GUIWindow *v4; // edi@6
|
|
3463 void *v5; // eax@6
|
|
3464 int v6; // eax@6
|
|
3465 unsigned int v7; // eax@8
|
|
3466 int v8; // ecx@8
|
|
3467 unsigned int v9; // eax@9
|
|
3468 int v10; // eax@11
|
|
3469 int v11; // eax@12
|
|
3470 GUIWindow *v12; // ecx@16
|
|
3471 int v13; // edx@16
|
|
3472 GUIButton *v14; // eax@19
|
|
3473 GUIButton *v15; // edi@19
|
|
3474 int v16; // eax@19
|
|
3475 const char *v17; // eax@21
|
|
3476 int v18; // eax@21
|
|
3477 unsigned int v19; // ecx@21
|
|
3478 int v20; // eax@21
|
|
3479 unsigned __int16 v21; // ax@21
|
|
3480 unsigned __int16 v22; // ST14_2@27
|
|
3481 int v23; // eax@27
|
|
3482 double v24; // st7@28
|
|
3483 unsigned int v25; // ebx@28
|
|
3484 DDM_DLV_Header *v26; // edi@29
|
|
3485 int v27; // eax@31
|
|
3486 int v28; // eax@32
|
|
3487 //unsigned int v29; // ecx@34
|
|
3488 unsigned int v30; // edx@36
|
|
3489 unsigned int v31; // edx@38
|
|
3490 unsigned int v32; // edx@40
|
|
3491 unsigned int v33; // edx@42
|
|
3492 unsigned int v34; // edx@44
|
|
3493 int v35; // edi@50
|
|
3494 signed int v36; // eax@50
|
|
3495 unsigned __int8 v37; // al@54
|
|
3496 int v38; // ecx@54
|
|
3497 GUIWindow *v39; // eax@56
|
|
3498 unsigned __int8 v40; // al@61
|
|
3499 GUIButton *v41; // edi@64
|
|
3500 int v42; // esi@66
|
|
3501 GUIWindow *v43; // ecx@66
|
|
3502 int v44; // edi@66
|
|
3503 int v45; // eax@68
|
|
3504 signed int v46; // edi@69
|
|
3505 int v47; // edi@71
|
|
3506 GUIButton *v48; // eax@73
|
|
3507 const char *v49; // edx@73
|
|
3508 GUIButton *v50; // esi@73
|
|
3509 int v51; // eax@73
|
|
3510 unsigned int v52; // ecx@73
|
|
3511 unsigned __int16 v53; // ax@73
|
|
3512 char a1[300]; // [sp+10h] [bp-1B4h]@64
|
|
3513 GUIWindow v57; // [sp+13Ch] [bp-88h]@1
|
|
3514 __int64 v58; // [sp+190h] [bp-34h]@1
|
|
3515 __int64 v59; // [sp+198h] [bp-2Ch]@1
|
|
3516 __int64 v60; // [sp+1A0h] [bp-24h]@1
|
|
3517 GUIWindow *v61; // [sp+1ACh] [bp-18h]@6
|
|
3518 unsigned int v62; // [sp+1B0h] [bp-14h]@8
|
|
3519 unsigned __int8 v63; // [sp+1B7h] [bp-Dh]@64
|
|
3520 int v64; // [sp+1B8h] [bp-Ch]@6
|
|
3521 unsigned int v65; // [sp+1BCh] [bp-8h]@6
|
|
3522 DDM_DLV_Header *v66; // [sp+1C0h] [bp-4h]@6
|
|
3523
|
|
3524 v0 = window_SpeakInHouse;
|
|
3525 memcpy(&v57, window_SpeakInHouse, sizeof(v57));
|
|
3526 v57.uFrameX = 483;
|
|
3527 v57.uFrameWidth = 148;
|
|
3528 v57.uFrameZ = 334;
|
|
3529 HIDWORD(v58) = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu);
|
|
3530 HIDWORD(v59) = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu);
|
|
3531 v1 = pPlayers[uActiveCharacter];
|
|
3532 //v2 = pPlayers[uActiveCharacter]->_4B807C(p2DEvents_minus1__20[13 * (unsigned int)v0->ptr_1C]);
|
|
3533 v2 = pPlayers[uActiveCharacter]->_4B807C(p2DEvents[(unsigned int)v0->ptr_1C - 1].fPriceMultiplier);
|
|
3534 HIDWORD(v60) = v2;
|
|
3535 if ( dialog_menu_id != 1 )
|
|
3536 {
|
|
3537 if ( dialog_menu_id != 10 )
|
|
3538 {
|
|
3539 if ( dialog_menu_id != 11 )
|
|
3540 {
|
|
3541
|
|
3542 if ( dialog_menu_id == 96 )
|
|
3543 {
|
|
3544 if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
|
|
3545 {
|
|
3546 v4 = pDialogueWindow;
|
|
3547 v61 = pDialogueWindow;
|
|
3548 v5 = window_SpeakInHouse->ptr_1C;
|
|
3549 v66 = 0;
|
|
3550 //v65 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (signed int)v5] * 500.0);
|
|
3551 v65 = (signed __int64)(p2DEvents[(signed int)v5 - 1].flt_24 * 500.0);
|
|
3552 v6 = v1->GetMerchant();
|
|
3553 v64 = (signed int)(v65 * (100 - v6)) / 100;
|
|
3554 if ( v64 < (signed int)v65 / 3 )
|
|
3555 v64 = (signed int)v65 / 3;
|
|
3556 v7 = v4->pStartingPosActiveItem;
|
|
3557 v8 = v7 + v4->pNumPresenceButton;
|
|
3558 v65 = 0;
|
|
3559 v62 = v7;
|
|
3560 if ( (signed int)v7 >= v8 )
|
|
3561 goto LABEL_78;
|
|
3562 do
|
|
3563 {
|
|
3564 v9 = v4->GetControl(v62)->uControlParam - 36;
|
|
3565 if ( byte_4ED970_skill_learn_ability_by_class_table[v1->classType][v9] && !v1->pActiveSkills[v9] )
|
|
3566 {
|
|
3567 v10 = pFontArrus->CalcTextHeight(pSkillNames[v9], &v57, 0, 0);
|
|
3568 v66 = (DDM_DLV_Header *)((char *)v66 + v10);
|
|
3569 ++v65;
|
|
3570 }
|
|
3571 v11 = v4->pStartingPosActiveItem;
|
|
3572 ++v62;
|
|
3573 }
|
|
3574 while ( (signed int)v62 < v4->pNumPresenceButton + v11 );
|
|
3575 if ( v65 )
|
|
3576 {
|
|
3577 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], v64);
|
|
3578 v57.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u);
|
|
3579 v64 = (149 - (signed int)v66) / (signed int)v65;
|
|
3580 if ( v64 > 32 )
|
|
3581 v64 = 32;
|
|
3582 v65 = (signed int)(149 - v65 * v64 - (int)v66) / 2 - v64 / 2 + 162;
|
|
3583 v12 = v61;
|
|
3584 result = v61->pStartingPosActiveItem;
|
|
3585 v13 = result + v61->pNumPresenceButton;
|
|
3586 v62 = v61->pStartingPosActiveItem;
|
|
3587 if ( result < v13 )
|
|
3588 {
|
|
3589 v66 = (DDM_DLV_Header *)2;
|
|
3590 while ( 1 )
|
|
3591 {
|
|
3592 v14 = v12->GetControl(v62);
|
|
3593 v15 = v14;
|
|
3594 v16 = v14->uControlParam - 36;
|
|
3595 if ( !byte_4ED970_skill_learn_ability_by_class_table[v1->classType][v16] || v1->pActiveSkills[v16] )
|
|
3596 {
|
|
3597 v15->uW = 0;
|
|
3598 v15->uHeight = 0;
|
|
3599 v15->uY = 0;
|
|
3600 }
|
|
3601 else
|
|
3602 {
|
|
3603 v17 = pSkillNames[v16];
|
|
3604 v15->uY = v64 + v65;
|
|
3605 HIDWORD(v60) = (uint32)v17;
|
|
3606 v18 = pFontArrus->CalcTextHeight(v17, &v57, 0, 0);
|
|
3607 v19 = v15->uY;
|
|
3608 v15->uHeight = v18;
|
|
3609 v20 = v19 + v18 - 1;
|
|
3610 v15->uW = v20;
|
|
3611 v65 = v20;
|
|
3612 v21 = WORD2(v59);
|
|
3613 if ( (DDM_DLV_Header *)pDialogueWindow->pCurrentPosActiveItem != v66 )
|
|
3614 v21 = WORD2(v58);
|
|
3615 v57.DrawTitleText(pFontArrus, 0, v19, v21, (const char *)HIDWORD(v60), 3u);
|
|
3616 }
|
|
3617 result = (int)v61;
|
|
3618 ++v62;
|
|
3619 v66 = (DDM_DLV_Header *)((char *)v66 + 1);
|
|
3620 if ( (signed int)v62 >= v61->pNumPresenceButton + v61->pStartingPosActiveItem )
|
|
3621 break;
|
|
3622 v12 = v61;
|
|
3623 }
|
|
3624 }
|
|
3625 }
|
|
3626 else
|
|
3627 {
|
|
3628 LABEL_78:
|
|
3629 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], v1->pName, pClassNames[v1->classType]);
|
|
3630 strcat(pTmpBuf, "\n \n");
|
|
3631 strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]);
|
|
3632 v22 = WORD2(v59);
|
|
3633 v23 = pFontArrus->CalcTextHeight(pTmpBuf, &v57, 0, 0);
|
|
3634 result = (int)v57.DrawTitleText(pFontArrus, 0, (174 - v23) / 2 + 138, v22, pTmpBuf, 3u);
|
|
3635 }
|
|
3636 }
|
|
3637 }
|
|
3638 return;
|
|
3639 }
|
|
3640
|
|
3641 // DONATION
|
|
3642 //v24 = p2DEvents_minus1__20[13 * (unsigned int)ptr_507BC0->ptr_1C];
|
|
3643 v24 = p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier;
|
|
3644 v25 = 0;
|
|
3645 if ( pParty->uNumGold >= (unsigned int)(signed __int64)v24 )
|
|
3646 {
|
|
3647 Party::TakeGold((signed __int64)v24);
|
|
3648 v26 = &pOutdoor->ddm;
|
|
3649 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor )
|
|
3650 v26 = &pIndoor->dlv;
|
|
3651 v27 = v26->uReputation;
|
|
3652 v66 = v26;
|
|
3653 if ( v27 > -5 )
|
|
3654 {
|
|
3655 v28 = v27 - 1;
|
|
3656 v26->uReputation = v28;
|
|
3657 if ( v28 < -5 )
|
|
3658 v26->uReputation = -5;
|
|
3659 }
|
|
3660 if ( (unsigned __int8)byte_F8B1EF[uActiveCharacter] == pParty->uDaysPlayed % 7 )
|
|
3661 {
|
|
3662 if ( v26->uReputation <= -5 )
|
|
3663 {
|
|
3664 v30 = pParty->uDaysPlayed % 7 + 1;
|
|
3665 LOBYTE(v30) = v30 | 0x80;
|
|
3666 _42777D_CastSpell_UseWand_ShootArrow(SPELL_AIR_WIZARD_EYE, uActiveCharacter - 1, v30, 48, 0);
|
|
3667 }
|
|
3668 if ( v26->uReputation <= -10 )
|
|
3669 {
|
|
3670 v31 = pParty->uDaysPlayed % 7 + 1;
|
|
3671 LOBYTE(v31) = v31 | 0x80;
|
|
3672 _42777D_CastSpell_UseWand_ShootArrow(SPELL_SPIRIT_PRESERVATION, uActiveCharacter - 1, v31, 48, 0);
|
|
3673 v26 = v66;
|
|
3674 }
|
|
3675 if ( v26->uReputation <= -15 )
|
|
3676 {
|
|
3677 v32 = pParty->uDaysPlayed % 7 + 1;
|
|
3678 LOBYTE(v32) = v32 | 0x80;
|
|
3679 _42777D_CastSpell_UseWand_ShootArrow(SPELL_BODY_PROTECTION_FROM_MAGIC, uActiveCharacter - 1, v32, 48, 0);
|
|
3680 v26 = v66;
|
|
3681 }
|
|
3682 if ( v26->uReputation <= -20 )
|
|
3683 {
|
|
3684 v33 = pParty->uDaysPlayed % 7 + 1;
|
|
3685 LOBYTE(v33) = v33 | 0x80;
|
|
3686 _42777D_CastSpell_UseWand_ShootArrow(SPELL_LIGHT_HOUR_OF_POWER, uActiveCharacter - 1, v33, 48, 0);
|
|
3687 v26 = v66;
|
|
3688 }
|
|
3689 if ( v26->uReputation <= -25 )
|
|
3690 {
|
|
3691 v34 = pParty->uDaysPlayed % 7 + 1;
|
|
3692 LOBYTE(v34) = v34 | 0x80;
|
|
3693 _42777D_CastSpell_UseWand_ShootArrow(SPELL_LIGHT_DAY_OF_PROTECTION, uActiveCharacter - 1, v34, 48, 0);
|
|
3694 }
|
|
3695 }
|
|
3696 ++byte_F8B1EF[uActiveCharacter];
|
|
3697 v1->PlaySound(SPEECH_83, 0);
|
|
3698 ShowStatusBarString(pGlobalTXT_LocalizationStrings[527], 2u); // "Thank You!"
|
|
3699 goto LABEL_46;
|
|
3700 }
|
|
3701 goto LABEL_55;
|
|
3702 }
|
|
3703 if ( !v1->_4B6FF9() )
|
|
3704 return;
|
|
3705 v25 = 0;
|
|
3706 if ( pParty->uNumGold < v2 )
|
|
3707 {
|
|
3708 LABEL_55:
|
|
3709 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u);
|
|
3710 HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 2);
|
|
3711 goto LABEL_46;
|
|
3712 }
|
|
3713 Party::TakeGold(v2);
|
|
3714 v35 = LODWORD(v1->pConditions[17]);
|
|
3715 v59 = v1->pConditions[14];
|
|
3716 v58 = v1->pConditions[15];
|
|
3717 v60 = v1->pConditions[16];
|
|
3718 v61 = (GUIWindow *)HIDWORD(v1->pConditions[17]);
|
|
3719 memset(v1, 0, 0xA0u);
|
|
3720 v1->sHealth = v1->GetMaxHealth();
|
|
3721 v1->sMana = v1->GetMaxMana();
|
|
3722 v36 = (signed int)window_SpeakInHouse->ptr_1C;
|
|
3723 if ( v36 != 78 && (v36 <= 80 || v36 > 82) )
|
|
3724 {
|
|
3725 if ( (unsigned int)v61 | v35 )
|
|
3726 {
|
|
3727 v37 = LOBYTE(v1->field_1928);
|
|
3728 v38 = v1->field_1924;
|
|
3729 v1->uFace = v37;
|
|
3730 v1->uVoiceID = v38;
|
|
3731 ReloadPlayerPortraits(uActiveCharacter - 1, (char)v37);
|
|
3732 }
|
|
3733 goto LABEL_63;
|
|
3734 }
|
|
3735 v39 = v61;
|
|
3736 if ( (unsigned int)v61 | v35 )
|
|
3737 {
|
|
3738 LODWORD(v1->pConditions[17]) = v35;
|
|
3739 }
|
|
3740 else
|
|
3741 {
|
|
3742 if ( !v60 && !v58 && !v59 )
|
|
3743 goto LABEL_63;
|
|
3744 v1->field_1928 = v1->uFace;
|
|
3745 v1->field_1924 = v1->uVoiceID;
|
|
3746 v1->SetCondition(0x11u, 1);
|
|
3747 v1->uVoiceID = (v1->GetSexByVoice() != 0) + 23;
|
|
3748 v40 = (v1->GetSexByVoice() != 0) + 23;
|
|
3749 v1->uFace = v40;
|
|
3750 ReloadPlayerPortraits(uActiveCharacter - 1, (char)v40);
|
|
3751 LODWORD(v1->pConditions[17]) = LODWORD(pParty->uTimePlayed);
|
|
3752 v39 = (GUIWindow *)HIDWORD(pParty->uTimePlayed);
|
|
3753 }
|
|
3754 HIDWORD(v1->pConditions[17]) = (int)v39;
|
|
3755 LABEL_63:
|
|
3756 pAudioPlayer->PlaySound((SoundID)(SOUND_GoldReceived|0x2), -1, 0, -1, 0, 0, 0, 0);
|
|
3757 v1->PlaySound(SPEECH_82, 0);
|
|
3758 pOtherOverlayList->_4418B1(20, uActiveCharacter + 99, 0, 65536);
|
|
3759 LABEL_46:
|
|
3760 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, v25);
|
|
3761 return ; // void func
|
|
3762 }
|
|
3763 v63 = 1;
|
|
3764 v41 = pDialogueWindow->GetControl(pDialogueWindow->pStartingPosActiveItem);
|
|
3765 strcpy(a1, "");
|
|
3766 v41->uHeight = 0;
|
|
3767 v41->uY = 0;
|
|
3768 if ( v1->_4B6FF9() )
|
|
3769 {
|
|
3770 sprintf(a1, "%s %d %s", pGlobalTXT_LocalizationStrings[104], HIDWORD(v60), pGlobalTXT_LocalizationStrings[97]);
|
|
3771 v63 = 0;
|
|
3772 }
|
|
3773 strcpy(&a1[100], pGlobalTXT_LocalizationStrings[68]);
|
|
3774 strcpy(&a1[200], pGlobalTXT_LocalizationStrings[160]);
|
|
3775 v42 = v63;
|
|
3776 v43 = pDialogueWindow;
|
|
3777 v44 = v63;
|
|
3778 v66 = 0;
|
|
3779 if ( v63 < pDialogueWindow->pNumPresenceButton )
|
|
3780 {
|
|
3781 v61 = (GUIWindow *)&a1[100 * v63];
|
|
3782 do
|
|
3783 {
|
|
3784 v45 = pFontArrus->CalcTextHeight((const char *)v61, &v57, 0, 0);
|
|
3785 v66 = (DDM_DLV_Header *)((char *)v66 + v45);
|
|
3786 v43 = pDialogueWindow;
|
|
3787 v61 = (GUIWindow *)((char *)v61 + 100);
|
|
3788 ++v44;
|
|
3789 }
|
|
3790 while ( v44 < pDialogueWindow->pNumPresenceButton );
|
|
3791 }
|
|
3792 v46 = v43->pNumPresenceButton - v42;
|
|
3793 v64 = (174 - (signed int)v66) / v46;
|
|
3794 if ( v64 > 32 )
|
|
3795 v64 = 32;
|
|
3796 v47 = (174 - v64 * v46 - (signed int)v66) / 2 - v64 / 2 + 138;
|
|
3797 v65 = v42 + v43->pStartingPosActiveItem;
|
|
3798 if ( v42 + v43->pStartingPosActiveItem < v43->pStartingPosActiveItem + v43->pNumPresenceButton )
|
|
3799 {
|
|
3800 v61 = (GUIWindow *)(v42 + 2);
|
|
3801 v66 = (DDM_DLV_Header *)&a1[100 * v42];
|
|
3802 do
|
|
3803 {
|
|
3804 v48 = v43->GetControl(v65);
|
|
3805 v49 = (const char *)v66;
|
|
3806 v50 = v48;
|
|
3807 v48->uY = v64 + v47;
|
|
3808 v51 = pFontArrus->CalcTextHeight(v49, &v57, 0, 0);
|
|
3809 v52 = v50->uY;
|
|
3810 v50->uHeight = v51;
|
|
3811 v47 = v52 + v51 - 1;
|
|
3812 v50->uW = v47;
|
|
3813 v53 = WORD2(v59);
|
|
3814 if ( (GUIWindow *)pDialogueWindow->pCurrentPosActiveItem != v61 )
|
|
3815 v53 = WORD2(v58);
|
|
3816 v57.DrawTitleText(pFontArrus, 0, v52, v53, (const char *)v66, 3u);
|
|
3817 v43 = pDialogueWindow;
|
|
3818 v66 = (DDM_DLV_Header *)((char *)v66 + 100);
|
|
3819 v61 = (GUIWindow *)((char *)v61 + 1);
|
|
3820 ++v65;
|
|
3821 }
|
|
3822 while ( (signed int)v65 < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem );
|
|
3823 }
|
|
3824 return;
|
|
3825 }
|
|
3826
|
|
3827 //----- (004B4710) --------------------------------------------------------
|
|
3828 int __cdecl TrainingDialog()
|
|
3829 {
|
|
3830 Player *v0; // ebx@1
|
|
3831 int color2; // eax@1
|
651
|
3832 //unsigned int v2; // ecx@1
|
|
3833 //int v3; // eax@1
|
|
3834 //signed int v4; // edx@1
|
|
3835 unsigned __int64 v5; // edi@3
|
|
3836 //unsigned int v6; // esi@3
|
|
3837 //void *v7; // ecx@3
|
629
|
3838 int v8; // edx@4
|
|
3839 double v9; // st7@6
|
|
3840 signed int v10; // esi@6
|
|
3841 int v11; // ecx@6
|
|
3842 int result; // eax@9
|
|
3843 GUIWindow *v13; // edi@14
|
|
3844 signed int v14; // esi@14
|
|
3845 unsigned int v15; // esi@16
|
|
3846 int v16; // eax@16
|
|
3847 unsigned int v17; // eax@17
|
|
3848 int v18; // eax@19
|
|
3849 int v19; // ecx@24
|
|
3850 GUIButton *v20; // eax@26
|
|
3851 GUIButton *v21; // esi@26
|
|
3852 int v22; // eax@26
|
|
3853 const char *v23; // eax@28
|
|
3854 int v24; // eax@28
|
|
3855 unsigned int v25; // ecx@28
|
|
3856 int v26; // eax@28
|
|
3857 unsigned __int16 v27; // ax@28
|
|
3858 int v28; // eax@32
|
|
3859 unsigned __int16 v29; // ST14_2@34
|
|
3860 int v30; // eax@34
|
|
3861 const char *v31; // ST18_4@36
|
|
3862 unsigned __int16 v32; // ST14_2@36
|
|
3863 int v33; // eax@36
|
|
3864 int v34; // eax@37
|
|
3865 unsigned int v35; // edi@38
|
|
3866 unsigned int v36; // eax@38
|
|
3867 int v37; // ecx@41
|
|
3868 char *v38; // eax@41
|
|
3869 int *v39; // eax@45
|
|
3870 unsigned int v40; // eax@46
|
|
3871 void *v41; // ecx@46
|
|
3872 unsigned int v42; // eax@46
|
|
3873 GUIWindow *v43; // ecx@59
|
|
3874 int v44; // edx@59
|
|
3875 char **v45; // esi@60
|
|
3876 int v46; // eax@62
|
|
3877 int v47; // eax@68
|
|
3878 int v48; // edx@69
|
|
3879 int v49; // ebx@69
|
|
3880 unsigned __int8 v50; // sf@69
|
|
3881 char **v51; // edi@70
|
|
3882 GUIButton *v52; // eax@71
|
|
3883 GUIButton *v53; // esi@71
|
|
3884 int v54; // eax@71
|
|
3885 unsigned int v55; // ecx@71
|
|
3886 int v56; // eax@71
|
|
3887 unsigned __int16 v57; // ax@71
|
|
3888 unsigned __int16 v58; // [sp-Ch] [bp-90h]@38
|
|
3889 const char *v59; // [sp-Ch] [bp-90h]@63
|
|
3890 char *v60; // [sp-8h] [bp-8Ch]@38
|
|
3891 char *v61; // [sp-8h] [bp-8Ch]@63
|
|
3892 unsigned int v62; // [sp-4h] [bp-88h]@38
|
|
3893 int v63; // [sp-4h] [bp-88h]@52
|
|
3894 char *v64; // [sp-4h] [bp-88h]@63
|
|
3895 GUIWindow v65; // [sp+Ch] [bp-78h]@1
|
651
|
3896 //__int64 v66; // [sp+60h] [bp-24h]@3
|
629
|
3897 unsigned int white; // [sp+68h] [bp-1Ch]@1
|
|
3898 int v68; // [sp+6Ch] [bp-18h]@3
|
|
3899 int v69; // [sp+70h] [bp-14h]@6
|
651
|
3900 //unsigned int i; // [sp+74h] [bp-10h]@1
|
|
3901 //int v71; // [sp+78h] [bp-Ch]@1
|
629
|
3902 int v72; // [sp+7Ch] [bp-8h]@16
|
|
3903 int v73; // [sp+80h] [bp-4h]@14
|
|
3904
|
|
3905 v0 = pPlayers[uActiveCharacter];
|
|
3906 memcpy(&v65, window_SpeakInHouse, sizeof(v65));
|
|
3907 v65.uFrameX = 483;
|
|
3908 v65.uFrameWidth = 148;
|
|
3909 v65.uFrameZ = 334;
|
|
3910 white = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu);
|
|
3911 color2 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xCDu, 0x23u);
|
651
|
3912 //v71 = color2;
|
|
3913 //v2 = v0->uLevel;
|
|
3914 //v3 = 0;
|
|
3915 //v4 = 0;
|
|
3916 //for ( i = v2; v4 < (signed int)v2; ++v4 )
|
|
3917 // v3 += v4 + 1;
|
|
3918 //v5 = 1000 * v3;
|
|
3919 v5 = 1000ui64 * v0->uLevel * (v0->uLevel + 1) / 2; // E n = n(n + 1) / 2
|
|
3920 //v6 = HIDWORD(v0->uExperience);
|
|
3921 //v7 = window_SpeakInHouse->ptr_1C;
|
|
3922 v68 = pMaxLevelPerTrainingHallType[(unsigned int)window_SpeakInHouse->ptr_1C - 89];
|
|
3923 //v66 = 1000 * v3;
|
|
3924 if (v0->uExperience >= v5)
|
629
|
3925 {
|
|
3926 v8 = v0->classType % 4 + 1;
|
|
3927 if ( v8 == 4 )
|
|
3928 v8 = 3;
|
651
|
3929 v9 = (double)v0->uLevel;
|
|
3930 //i = 0;
|
629
|
3931 v69 = v8;
|
|
3932 //v10 = (signed __int64)(v9 * p2DEvents_minus1__20[13 * (signed int)v7] * (double)v8);
|
651
|
3933 v10 = (signed __int64)(v9 * p2DEvents[(signed int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier * (double)v8);
|
629
|
3934 v11 = v10 * (100 - v0->GetMerchant()) / 100;
|
|
3935 if ( v11 < v10 / 3 )
|
|
3936 v11 = v10 / 3;
|
651
|
3937 //i = v11;
|
629
|
3938 }
|
|
3939 result = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win();
|
|
3940 if ( result )
|
|
3941 {
|
|
3942 if ( dialog_menu_id != 1 )
|
|
3943 {
|
|
3944 if ( dialog_menu_id != 17 )
|
|
3945 {
|
|
3946 result = dialog_menu_id - 96;
|
|
3947 if ( dialog_menu_id == 96 )
|
|
3948 {
|
|
3949 result = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win();
|
|
3950 if ( result )
|
|
3951 {
|
651
|
3952 //i = 0;
|
|
3953 int _v0 = 0;
|
629
|
3954 v13 = pDialogueWindow;
|
|
3955 //v14 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (unsigned int)ptr_507BC0->ptr_1C] * 500.0);
|
|
3956 v14 = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0);
|
|
3957 v73 = v14 * (100 - v0->GetMerchant()) / 100;
|
|
3958 if ( v73 < v14 / 3 )
|
|
3959 v73 = v14 / 3;
|
|
3960 v15 = v13->pStartingPosActiveItem;
|
|
3961 v16 = v13->pNumPresenceButton;
|
|
3962 v72 = 0;
|
|
3963 if ( (signed int)v15 >= (signed int)(v15 + v16) )
|
|
3964 goto LABEL_76;
|
|
3965 do
|
|
3966 {
|
|
3967 v17 = v13->GetControl(v15)->uControlParam - 36;
|
|
3968 if ( byte_4ED970_skill_learn_ability_by_class_table[v0->classType][v17] && !v0->pActiveSkills[v17] )
|
|
3969 {
|
|
3970 v18 = pFontArrus->CalcTextHeight(pSkillNames[v17], &v65, 0, 0);
|
651
|
3971 _v0 += v18;
|
629
|
3972 ++v72;
|
|
3973 }
|
|
3974 ++v15;
|
|
3975 }
|
|
3976 while ( (signed int)v15 < v13->pNumPresenceButton + v13->pStartingPosActiveItem );
|
|
3977 if ( v72 )
|
|
3978 {
|
|
3979 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], v73);// "Skill Cost: %lu"
|
|
3980 v65.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u);
|
651
|
3981 v73 = (signed int)(149 - _v0) / v72;
|
629
|
3982 if ( v73 > 32 )
|
|
3983 v73 = 32;
|
|
3984 result = v13->pStartingPosActiveItem;
|
651
|
3985 v19 = (signed int)(149 - v72 * v73 - _v0) / 2 - v73 / 2 + 162;
|
|
3986 int _v1 = result;
|
629
|
3987 v68 = v19;
|
|
3988 if ( result < result + v13->pNumPresenceButton )
|
|
3989 {
|
|
3990 v72 = 2;
|
|
3991 do
|
|
3992 {
|
651
|
3993 v20 = v13->GetControl(_v1);
|
629
|
3994 v21 = v20;
|
|
3995 v22 = v20->uControlParam - 36;
|
|
3996 if ( !byte_4ED970_skill_learn_ability_by_class_table[v0->classType][v22] || v0->pActiveSkills[v22] )
|
|
3997 {
|
|
3998 v21->uW = 0;
|
|
3999 v21->uHeight = 0;
|
|
4000 v21->uY = 0;
|
|
4001 }
|
|
4002 else
|
|
4003 {
|
|
4004 v23 = pSkillNames[v22];
|
|
4005 v21->uY = v73 + v68;
|
651
|
4006 //HIDWORD(v66) = (int)v23;
|
629
|
4007 v24 = pFontArrus->CalcTextHeight(v23, &v65, 0, 0);
|
|
4008 v25 = v21->uY;
|
|
4009 v21->uHeight = v24;
|
|
4010 v26 = v25 + v24 - 1;
|
|
4011 v21->uW = v26;
|
|
4012 v68 = v26;
|
651
|
4013 v27 = color2;
|
629
|
4014 if ( pDialogueWindow->pCurrentPosActiveItem != v72 )
|
|
4015 v27 = white;
|
651
|
4016 v65.DrawTitleText(pFontArrus, 0, v25, v27, v23, 3u);
|
629
|
4017 }
|
|
4018 v28 = v13->pStartingPosActiveItem;
|
651
|
4019 ++_v1;
|
629
|
4020 result = v13->pNumPresenceButton + v28;
|
|
4021 ++v72;
|
|
4022 }
|
651
|
4023 while ( (signed int)_v1 < result );
|
629
|
4024 }
|
|
4025 }
|
|
4026 else
|
|
4027 {
|
|
4028 LABEL_76:
|
|
4029 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], v0->pName, pClassNames[v0->classType]);//
|
|
4030 // "Seek knowledge elsewhere %s the %s"
|
|
4031 strcat(pTmpBuf, "\n \n");
|
|
4032 strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]);// "I can offer you nothing further."
|
651
|
4033 v29 = color2;
|
629
|
4034 v30 = pFontArrus->CalcTextHeight(pTmpBuf, &v65, 0, 0);
|
|
4035 result = (int)v65.DrawTitleText(pFontArrus, 0, (174 - v30) / 2 + 138, v29, pTmpBuf, 3u);
|
|
4036 }
|
|
4037 }
|
|
4038 }
|
|
4039 return result;
|
|
4040 }
|
|
4041 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
|
|
4042 {
|
|
4043 v31 = pNPCTopics[122].pText;
|
651
|
4044 v32 = color2;
|
629
|
4045 v33 = pFontArrus->CalcTextHeight(pNPCTopics[122].pText, &v65, 0, 0);
|
|
4046 v65.DrawTitleText(pFontArrus, 0, (212 - v33) / 2 + 101, v32, v31, 3u);
|
|
4047 result = (int)pDialogueWindow;
|
|
4048 pDialogueWindow->pNumPresenceButton = 0;
|
|
4049 return result;
|
|
4050 }
|
|
4051 v34 = v0->uLevel;
|
|
4052 if ( v34 < v68 )
|
|
4053 {
|
651
|
4054 if ( (signed __int64)v0->uExperience >= v5 )
|
629
|
4055 {
|
651
|
4056 if ( pParty->uNumGold >= v11)
|
629
|
4057 {
|
651
|
4058 Party::TakeGold(v11);
|
629
|
4059 HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 2);
|
|
4060 ++v0->uLevel;
|
|
4061 v0->uSkillPoints += v0->uLevel / 10 + 5;
|
|
4062 v0->sHealth = v0->GetMaxHealth();
|
|
4063 v0->sMana = v0->GetMaxMana();
|
|
4064 v37 = 0;
|
|
4065 v38 = byte_F8B148;
|
|
4066 do
|
|
4067 {
|
|
4068 if ( *(int *)v38 > v37 )
|
|
4069 v37 = *(int *)v38;
|
|
4070 v38 += 4;
|
|
4071 }
|
|
4072 while ( (signed int)v38 < (signed int)word_F8B158 );
|
|
4073 v39 = &dword_F8B144 + uActiveCharacter;
|
|
4074 ++*v39;
|
|
4075 if ( *v39 > v37 )
|
|
4076 {
|
|
4077 v40 = sub_494820(pParty->uCurrentHour);
|
|
4078 v41 = window_SpeakInHouse->ptr_1C;
|
|
4079 v42 = 60 * (v40 + 4) - pParty->uCurrentMinute;
|
|
4080 if ( v41 == (void *)94 || v41 == (void *)95 )
|
|
4081 v42 += 720;
|
|
4082 RestAndHeal((signed int)(v42 + 10080));
|
|
4083 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor )
|
|
4084 pOutdoor->SetFog();
|
|
4085 }
|
|
4086 v0->PlaySound(SPEECH_87, 0);
|
651
|
4087 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[430], v0->pName, v0->uLevel, v0->uLevel / 10 + 5);//
|
629
|
4088 // "%s is now Level %lu and has earned %lu Skill Points!"
|
|
4089 ShowStatusBarString(pTmpBuf, 2u);
|
|
4090 goto LABEL_56;
|
|
4091 }
|
|
4092 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u);// "You don't have enough gold"
|
|
4093 v63 = 4;
|
|
4094 LABEL_55:
|
|
4095 HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, v63);
|
|
4096 LABEL_56:
|
|
4097 /*result = pMessageQueue_50CBD0->uNumMessages;
|
|
4098 if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
|
|
4099 {
|
|
4100 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113;
|
|
4101 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1;
|
|
4102 result = 3 * pMessageQueue_50CBD0->uNumMessages + 3;
|
|
4103 *(&pMessageQueue_50CBD0->uNumMessages + result) = 0;
|
|
4104 ++pMessageQueue_50CBD0->uNumMessages;
|
|
4105 }
|
|
4106 return result;*/
|
|
4107 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
|
|
4108 return 1; // void function actually
|
|
4109 }
|
651
|
4110 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[538], (unsigned int)(v5 - v0->uExperience), v34 + 1);//
|
629
|
4111 // "You need %d more experience to train to level %d"
|
|
4112 v35 = 0;
|
|
4113 v62 = 3;
|
|
4114 v60 = pTmpBuf;
|
651
|
4115 v58 = color2;
|
629
|
4116 v36 = (212 - pFontArrus->CalcTextHeight(pTmpBuf, &v65, 0, 0)) / 2 + 88;
|
|
4117 }
|
|
4118 else
|
|
4119 {
|
|
4120 sprintf(pTmpBuf, "%s\n \n%s", pGlobalTXT_LocalizationStrings[536], pGlobalTXT_LocalizationStrings[529]);//
|
|
4121 // ""With your skills, you should be working here as a teacher.""
|
|
4122 // ""Sorry, but we are unable to train you.""
|
|
4123 v35 = 0;
|
|
4124 v62 = 3;
|
|
4125 v60 = pTmpBuf;
|
651
|
4126 v58 = color2;
|
629
|
4127 v36 = (212 - pFontArrus->CalcTextHeight(pTmpBuf, &v65, 0, 0)) / 2 + 101;
|
|
4128 }
|
|
4129 v65.DrawTitleText(pFontArrus, v35, v36, v58, v60, v62);
|
|
4130 v63 = 3;
|
|
4131 goto LABEL_55;
|
|
4132 }
|
|
4133 result = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win();
|
|
4134 if ( result )
|
|
4135 {
|
|
4136 v43 = pDialogueWindow;
|
|
4137 v72 = 0;
|
|
4138 pShopOptions[0] = pTmpBuf;
|
|
4139 pShopOptions[1] = pGlobalTXT_LocalizationStrings[160];// "Learn Skills"
|
|
4140 v44 = pDialogueWindow->pNumPresenceButton;
|
|
4141 v73 = pDialogueWindow->pStartingPosActiveItem;
|
|
4142 if ( v73 < v73 + v44 )
|
|
4143 {
|
|
4144 v45 = pShopOptions;
|
|
4145 do
|
|
4146 {
|
|
4147 if ( v43->GetControl(v73)->uControlParam == 17 )
|
|
4148 {
|
|
4149 v46 = v0->uLevel;
|
|
4150 if ( v46 < v68 )
|
|
4151 {
|
651
|
4152 if ( (signed __int64)v0->uExperience < v5 )
|
629
|
4153 {
|
|
4154 v64 = (char *)(v46 + 1);
|
|
4155 v61 = (char *)(v5 - LODWORD(v0->uExperience));
|
|
4156 v59 = pGlobalTXT_LocalizationStrings[538];// "You need %d more experience to train to level %d"
|
|
4157 }
|
|
4158 else
|
|
4159 {
|
651
|
4160 v64 = (char *)v11;
|
629
|
4161 v61 = (char *)(v46 + 1);
|
|
4162 v59 = pGlobalTXT_LocalizationStrings[537];// "Train to level %d for %d gold"
|
|
4163 }
|
|
4164 }
|
|
4165 else
|
|
4166 {
|
|
4167 v64 = pGlobalTXT_LocalizationStrings[529];// ""Sorry, but we are unable to train you.""
|
|
4168 v61 = pGlobalTXT_LocalizationStrings[536];// ""With your skills, you should be working here as a teacher.""
|
|
4169 v59 = "%s\n \n%s";
|
|
4170 }
|
651
|
4171 sprintfex(*v45, v59, v61, v64);
|
629
|
4172 }
|
|
4173 v47 = pFontArrus->CalcTextHeight(*v45, &v65, 0, 0);
|
|
4174 v43 = pDialogueWindow;
|
|
4175 v72 += v47;
|
|
4176 ++v45;
|
|
4177 ++v73;
|
|
4178 }
|
|
4179 while ( v73 < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem );
|
|
4180 }
|
651
|
4181 //HIDWORD(v66) = (174 - v72) / 2;
|
629
|
4182 result = v43->pStartingPosActiveItem;
|
|
4183 v48 = result + v43->pNumPresenceButton;
|
|
4184 v49 = (2 * (87 - (174 - v72) / 2) - v72) / 2 - (174 - v72) / 2 / 2 + 138;
|
|
4185 v50 = -v43->pNumPresenceButton < 0;
|
|
4186 v73 = v43->pStartingPosActiveItem;
|
|
4187 if ( v50 ^ __OFSUB__(result, v48) )
|
|
4188 {
|
651
|
4189 int _v3 = 2;
|
629
|
4190 v51 = pShopOptions;
|
|
4191 do
|
|
4192 {
|
|
4193 v52 = v43->GetControl(v73);
|
|
4194 v53 = v52;
|
651
|
4195 v52->uY = (174 - v72) / 2 + v49;
|
629
|
4196 v54 = pFontArrus->CalcTextHeight(*v51, &v65, 0, 0);
|
|
4197 v55 = v53->uY;
|
|
4198 v53->uHeight = v54;
|
|
4199 v56 = v54 + v55 - 1;
|
|
4200 v53->uW = v56;
|
|
4201 v49 = v56;
|
651
|
4202 v57 = color2;
|
|
4203 if ( pDialogueWindow->pCurrentPosActiveItem != _v3 )
|
629
|
4204 v57 = white;
|
|
4205 v65.DrawTitleText(pFontArrus, 0, v55, v57, *v51, 3u);
|
|
4206 v43 = pDialogueWindow;
|
651
|
4207 ++_v3;
|
629
|
4208 ++v51;
|
|
4209 ++v73;
|
|
4210 result = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem;
|
|
4211 }
|
|
4212 while ( v73 < result );
|
|
4213 }
|
|
4214 }
|
|
4215 }
|
|
4216 return result;
|
|
4217 }
|
|
4218
|
|
4219
|
|
4220
|
|
4221
|
|
4222
|
|
4223
|
|
4224
|
|
4225
|
|
4226
|
|
4227 //----- (004B4FCF) --------------------------------------------------------
|
|
4228 void MagicShopDialog()
|
|
4229 {
|
|
4230 Player *v0; // ebx@1
|
|
4231 int result; // eax@6
|
|
4232 signed int v2; // esi@8
|
|
4233 unsigned int v3; // ebx@10
|
|
4234 char *v4; // eax@11
|
|
4235 char *v5; // eax@12
|
|
4236 unsigned int v6; // eax@12
|
|
4237 int v7; // ST08_4@14
|
|
4238 int v8; // eax@14
|
|
4239 unsigned __int8 v9; // dl@14
|
|
4240 char *v10; // ecx@14
|
|
4241 signed int v11; // esi@16
|
|
4242 int v12; // ST08_4@19
|
|
4243 int v13; // eax@19
|
|
4244 int all_text_height; // edi@21
|
|
4245 char **v15; // esi@21
|
|
4246 int v16; // eax@22
|
|
4247 GUIWindow *v17; // ecx@23
|
|
4248 int v18; // edx@23
|
|
4249 int v19; // edi@23
|
|
4250 unsigned __int8 v20; // sf@23
|
|
4251 GUIButton *control_button; // esi@25
|
|
4252 const char **v22; // eax@25
|
|
4253 int v23; // eax@25
|
|
4254 unsigned int v24; // ecx@25
|
|
4255 const char **v25; // edx@25
|
|
4256 unsigned __int16 text_color; // ax@25
|
|
4257 signed int v27; // esi@30
|
|
4258 int v28; // ST08_4@34
|
|
4259 int v29; // eax@34
|
|
4260 char *v30; // edx@35
|
|
4261 GUIWindow *v31; // edi@40
|
|
4262 void *v32; // eax@40
|
|
4263 signed int v33; // esi@40
|
|
4264 unsigned int v34; // esi@42
|
|
4265 int v35; // eax@42
|
|
4266 unsigned int v36; // eax@43
|
|
4267 int v37; // eax@45
|
|
4268 int v38; // ecx@50
|
|
4269 GUIButton *v39; // eax@52
|
|
4270 GUIButton *v40; // esi@52
|
|
4271 int v41; // eax@52
|
|
4272 char *v42; // eax@54
|
|
4273 int v43; // eax@54
|
|
4274 unsigned int v44; // ecx@54
|
|
4275 int v45; // edx@54
|
|
4276 int v46; // eax@54
|
|
4277 unsigned __int16 v47; // ax@54
|
|
4278 int v48; // eax@58
|
|
4279 signed int v49; // esi@62
|
|
4280 Texture *v50; // ecx@64
|
|
4281 unsigned int v51; // edi@64
|
|
4282 unsigned int v52; // esi@66
|
|
4283 int v53; // edx@70
|
|
4284 Texture *v54; // ecx@76
|
|
4285 unsigned int v55; // edi@76
|
|
4286 unsigned int v56; // esi@76
|
|
4287 int v57; // edx@80
|
|
4288 Texture *v58; // ecx@86
|
|
4289 unsigned int v59; // edi@86
|
|
4290 unsigned int v60; // esi@88
|
|
4291 int v61; // edx@92
|
|
4292 Texture *v62; // ecx@98
|
|
4293 unsigned int v63; // edi@98
|
|
4294 unsigned int v64; // esi@100
|
|
4295 int v65; // edx@104
|
|
4296 signed int v66; // ecx@109
|
|
4297 SHORT v67; // di@117
|
|
4298 bool v68; // eax@117
|
|
4299 const char *v69; // ecx@119
|
|
4300 POINT *v70; // esi@124
|
|
4301 int v71; // ecx@125
|
|
4302 int v72; // eax@125
|
|
4303 int v73; // ecx@125
|
|
4304 ItemGen *v74; // esi@125
|
|
4305 int v75; // eax@130
|
|
4306 int v76; // esi@131
|
|
4307 char **v77; // edi@131
|
|
4308 int v78; // eax@132
|
|
4309 GUIWindow *v79; // ecx@133
|
|
4310 int v80; // edx@133
|
|
4311 int v81; // edi@133
|
|
4312 GUIButton *v82; // esi@135
|
|
4313 const char **v83; // eax@135
|
|
4314 int v84; // eax@135
|
|
4315 unsigned int v85; // ecx@135
|
|
4316 int v86; // edx@135
|
|
4317 unsigned __int16 v87; // ax@135
|
|
4318 GUIWindow *v88; // [sp-18h] [bp-110h]@35
|
|
4319 int v89; // [sp-14h] [bp-10Ch]@35
|
|
4320 ItemGen *v90; // [sp-10h] [bp-108h]@14
|
|
4321 int v91; // [sp-10h] [bp-108h]@35
|
|
4322 unsigned __int16 v92; // [sp-Ch] [bp-104h]@12
|
|
4323 void *v93; // [sp-Ch] [bp-104h]@14
|
|
4324 int v94; // [sp-8h] [bp-100h]@11
|
|
4325 char *v95; // [sp-8h] [bp-100h]@12
|
|
4326 __int64 *v96; // [sp-4h] [bp-FCh]@11
|
|
4327 unsigned int v97; // [sp-4h] [bp-FCh]@12
|
|
4328 POINT v98; // [sp+Ch] [bp-ECh]@8
|
|
4329 POINT v99; // [sp+14h] [bp-E4h]@16
|
|
4330 POINT v100; // [sp+1Ch] [bp-DCh]@124
|
|
4331 POINT v101; // [sp+24h] [bp-D4h]@17
|
|
4332 POINT v102; // [sp+2Ch] [bp-CCh]@124
|
|
4333 POINT v103; // [sp+34h] [bp-C4h]@9
|
|
4334 POINT v104; // [sp+3Ch] [bp-BCh]@31
|
|
4335 POINT v105; // [sp+44h] [bp-B4h]@16
|
|
4336 POINT v106; // [sp+4Ch] [bp-ACh]@30
|
|
4337 POINT v107; // [sp+54h] [bp-A4h]@16
|
|
4338 POINT v108; // [sp+5Ch] [bp-9Ch]@30
|
|
4339 POINT a2; // [sp+64h] [bp-94h]@8
|
|
4340 POINT v110; // [sp+6Ch] [bp-8Ch]@30
|
|
4341 POINT v111; // [sp+74h] [bp-84h]@8
|
|
4342 GUIWindow dialog_window; // [sp+7Ch] [bp-7Ch]@1
|
|
4343 char *Str; // [sp+D0h] [bp-28h]@54
|
|
4344 int v146; // [sp+D4h] [bp-24h]@23
|
|
4345 unsigned int hilight_color; // [sp+D8h] [bp-20h]@1
|
|
4346 unsigned int m_text_color; // [sp+DCh] [bp-1Ch]@1
|
|
4347 __int32 v117; // [sp+E0h] [bp-18h]@8
|
|
4348 int v118; // [sp+E4h] [bp-14h]@40
|
|
4349 const char **v119; // [sp+E8h] [bp-10h]@24
|
|
4350 Player *_this; // [sp+ECh] [bp-Ch]@1
|
|
4351 unsigned __int8 uPlayerID; // [sp+F3h] [bp-5h]@14
|
|
4352 int v152; // [sp+F4h] [bp-4h]@23
|
|
4353 int v122;
|
|
4354 int v114;
|
|
4355
|
|
4356 v0 = pPlayers[uActiveCharacter];
|
|
4357 _this = pPlayers[uActiveCharacter];
|
|
4358 memcpy(&dialog_window, window_SpeakInHouse, sizeof(dialog_window));
|
|
4359 dialog_window.uFrameX = 483;
|
|
4360 dialog_window.uFrameWidth = 148;
|
|
4361 dialog_window.uFrameZ = 334;
|
|
4362 m_text_color = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu);
|
|
4363 hilight_color = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xCDu, 0x23u);
|
|
4364 if ( dialog_menu_id > 5 )
|
|
4365 {
|
|
4366 if ( dialog_menu_id == 94 )
|
|
4367 {
|
|
4368 draw_leather();
|
|
4369 CharacterUI_InventoryTab_Draw(uActiveCharacter, 1);
|
|
4370 pShopOptions[0] = pGlobalTXT_LocalizationStrings[200];// "Sell"
|
|
4371 pShopOptions[1] = pGlobalTXT_LocalizationStrings[113];// "Identify"
|
|
4372 pShopOptions[2] = pGlobalTXT_LocalizationStrings[179];// "Repair"
|
|
4373 v76 = 0;
|
|
4374 v77 = pShopOptions;
|
|
4375 do
|
|
4376 {
|
|
4377 v78 = pFontArrus->CalcTextHeight(*v77, &dialog_window, 0, 0);
|
|
4378 ++v77;
|
|
4379 v76 += v78;
|
|
4380 }
|
|
4381 while ( (signed int)v77 < (signed int)&pShopOptions[3] );
|
|
4382 v79 = pDialogueWindow;
|
|
4383 _this = (Player *)((174 - v76) / 3);
|
|
4384 result = pDialogueWindow->pStartingPosActiveItem;
|
|
4385 v80 = result + pDialogueWindow->pNumPresenceButton;
|
|
4386 v81 = (3 * (58 - (signed int)_this) - v76) / 2 - (174 - v76) / 3 / 2 + 138;
|
|
4387 v20 = -pDialogueWindow->pNumPresenceButton < 0;
|
|
4388 v118 = pDialogueWindow->pStartingPosActiveItem;
|
|
4389 if ( v20 ^ __OFSUB__(result, v80) )
|
|
4390 {
|
|
4391 v122 = 2;
|
|
4392 v119 = (const char **)pShopOptions;
|
|
4393 do
|
|
4394 {
|
|
4395 v82 = v79->GetControl(v118);
|
|
4396 v83 = v119;
|
|
4397 v82->uY = (unsigned int)((char *)_this + v81);
|
|
4398 v84 = pFontArrus->CalcTextHeight(*v83, &dialog_window, 0, 0);
|
|
4399 v85 = v82->uY;
|
|
4400 v86 = v122;
|
|
4401 v82->uHeight = v84;
|
|
4402 v81 = v84 + v85 - 1;
|
|
4403 v82->uW = v81;
|
|
4404 v87 = hilight_color;
|
|
4405 if ( pDialogueWindow->pCurrentPosActiveItem != v86 )
|
|
4406 v87 = m_text_color;
|
|
4407 dialog_window.DrawTitleText(pFontArrus, 0, v85, v87, *v119, 3u);
|
|
4408 v79 = pDialogueWindow;
|
|
4409 ++v122;
|
|
4410 ++v119;
|
|
4411 ++v118;
|
|
4412 result = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem;
|
|
4413 }
|
|
4414 while ( v118 < result );
|
|
4415 }
|
|
4416 return;
|
|
4417 }
|
|
4418 if ( dialog_menu_id != 95 )
|
|
4419 {
|
|
4420 result = dialog_menu_id - 96;
|
|
4421 if ( dialog_menu_id == 96 )
|
|
4422 {
|
|
4423 result = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win();
|
|
4424 if ( result )
|
|
4425 {
|
|
4426 v31 = pDialogueWindow;
|
|
4427 v3 = 0;
|
|
4428 v32 = window_SpeakInHouse->ptr_1C;
|
|
4429 v118 = 0;
|
|
4430 //v33 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (signed int)v32] * 500.0);
|
|
4431 v33 = (signed __int64)(p2DEvents[(signed int)v32 - 1].flt_24 * 500.0);
|
|
4432 v119 = (const char **)(v33 * (100 - _this->GetMerchant()) / 100);
|
|
4433 if ( (signed int)v119 < v33 / 3 )
|
|
4434 v119 = (const char **)(v33 / 3);
|
|
4435 v34 = v31->pStartingPosActiveItem;
|
|
4436 v35 = v34 + v31->pNumPresenceButton;
|
|
4437 v122 = 0;
|
|
4438 if ( (signed int)v34 >= v35 )
|
|
4439 goto LABEL_140;
|
|
4440 do
|
|
4441 {
|
|
4442 v36 = v31->GetControl(v34)->uControlParam - 36;
|
|
4443 if ( byte_4ED970_skill_learn_ability_by_class_table[_this->classType][v36] && !_this->pActiveSkills[v36] )
|
|
4444 {
|
|
4445 v37 = pFontArrus->CalcTextHeight(pSkillNames[v36], &dialog_window, 0, 0);
|
|
4446 v118 += v37;
|
|
4447 ++v122;
|
|
4448 }
|
|
4449 ++v34;
|
|
4450 }
|
|
4451 while ( (signed int)v34 < v31->pNumPresenceButton + v31->pStartingPosActiveItem );
|
|
4452 if ( !v122 )
|
|
4453 {
|
|
4454 LABEL_140:
|
|
4455 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], _this->pName, pClassNames[_this->classType]);//
|
|
4456 // "Seek knowledge elsewhere %s the %s"
|
|
4457 strcat(pTmpBuf, "\n \n");
|
|
4458 strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]);// "I can offer you nothing further."
|
|
4459 v30 = pTmpBuf;
|
|
4460 v97 = 3;
|
|
4461 v95 = pTmpBuf;
|
|
4462 v92 = hilight_color;
|
|
4463 v91 = 0;
|
|
4464 v89 = 0;
|
|
4465 v88 = &dialog_window;
|
|
4466 goto LABEL_61;
|
|
4467 }
|
|
4468 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], v119);// "Skill Cost: %lu"
|
|
4469 dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u);
|
|
4470 v119 = (const char **)((149 - v118) / v122);
|
|
4471 if ( (149 - v118) / v122 > 32 )
|
|
4472 v119 = (const char **)32;
|
|
4473 result = v31->pStartingPosActiveItem;
|
|
4474 v38 = (149 - v122 * (signed int)v119 - v118) / 2 - (signed int)v119 / 2 + 162;
|
|
4475 v118 = result;
|
|
4476 v114 = v38;
|
|
4477 if ( result < result + v31->pNumPresenceButton )
|
|
4478 {
|
|
4479 v122 = 2;
|
|
4480 do
|
|
4481 {
|
|
4482 v39 = v31->GetControl(v118);
|
|
4483 v40 = v39;
|
|
4484 v41 = v39->uControlParam - 36;
|
|
4485 if ( !byte_4ED970_skill_learn_ability_by_class_table[_this->classType][v41] || _this->pActiveSkills[v41] )
|
|
4486 {
|
|
4487 v40->uW = 0;
|
|
4488 v40->uHeight = 0;
|
|
4489 v40->uY = 0;
|
|
4490 }
|
|
4491 else
|
|
4492 {
|
|
4493 v42 = pSkillNames[v41];
|
|
4494 v40->uY = (unsigned int)((char *)v119 + v114);
|
|
4495 Str = v42;
|
|
4496 v43 = pFontArrus->CalcTextHeight(v42, &dialog_window, 0, 0);
|
|
4497 v44 = v40->uY;
|
|
4498 v45 = v122;
|
|
4499 v40->uHeight = v43;
|
|
4500 v46 = v44 + v43 - 1;
|
|
4501 v40->uW = v46;
|
|
4502 v114 = v46;
|
|
4503 v47 = hilight_color;
|
|
4504 if ( pDialogueWindow->pCurrentPosActiveItem != v45 )
|
|
4505 v47 = m_text_color;
|
|
4506 dialog_window.DrawTitleText(pFontArrus, 0, v44, v47, Str, 3u);
|
|
4507 }
|
|
4508 v48 = v31->pStartingPosActiveItem;
|
|
4509 ++v118;
|
|
4510 result = v31->pNumPresenceButton + v48;
|
|
4511 ++v122;
|
|
4512 }
|
|
4513 while ( v118 < result );
|
|
4514 }
|
|
4515 }
|
|
4516 }
|
|
4517 return;
|
|
4518 }
|
|
4519 }
|
|
4520 else
|
|
4521 {
|
|
4522 if ( dialog_menu_id == 5 )
|
|
4523 {
|
|
4524 draw_leather();
|
|
4525 CharacterUI_InventoryTab_Draw(uActiveCharacter, 1);
|
|
4526 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[198], 0);// "Select the Item to Repair"
|
|
4527 result = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win();
|
|
4528 if ( !result
|
|
4529 || (v27 = pMouse->GetCursorPos(&v110)->x - 14,
|
|
4530 v117 = (v27 >> 5) + 14 * ((pMouse->GetCursorPos(&v108)->y - 17) >> 5),
|
|
4531 result = (int)pMouse->GetCursorPos(&v106),
|
|
4532 *(int *)result <= 13)
|
|
4533 || (result = (int)pMouse->GetCursorPos(&v104), *(int *)result >= 462)
|
|
4534 || (result = v0->GetItemIDAtInventoryIndex((int *)&v117), v3 = 0, !result)
|
|
4535 || (result *= 9, !(_this->field_1F5[4 * result + 15] & 2)) )
|
|
4536 return;
|
|
4537 v96 = 0;
|
|
4538 v94 = 5;
|
|
4539 v93 = window_SpeakInHouse->ptr_1C;
|
|
4540 v90 = (ItemGen *)&_this->spellbook.pDarkSpellbook.bIsSpellAvailable[4 * result + 5];
|
|
4541 v28 = (int)window_SpeakInHouse->ptr_1C;
|
|
4542 uPlayerID = uActiveCharacter - 1;
|
|
4543 v29 = _this->_490EEE((ItemGen *)&_this->spellbook.pDarkSpellbook.bIsSpellAvailable[4 * result + 5], 3, v28, 5);
|
|
4544 v9 = uPlayerID;
|
|
4545 v10 = (char *)pMerchantsRepairPhrases[v29];
|
|
4546 goto LABEL_35;
|
|
4547 }
|
|
4548 if ( dialog_menu_id == 1 )
|
|
4549 {
|
|
4550 /* result = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win();
|
|
4551 if ( result )
|
|
4552 {
|
|
4553 pShopOptions[0] = pGlobalTXT_LocalizationStrings[134];// "Buy Standard"
|
|
4554 pShopOptions[1] = pGlobalTXT_LocalizationStrings[152];// "Buy Special"
|
|
4555 pShopOptions[2] = pGlobalTXT_LocalizationStrings[159];// "Display Inventory"
|
|
4556 v14 = 0;
|
|
4557 pShopOptions[3] = pGlobalTXT_LocalizationStrings[160];// "Learn Skills"
|
|
4558 v15 = pShopOptions;
|
|
4559 do
|
|
4560 {
|
|
4561 v16 = pFontArrus->CalcTextHeight(*v15, &dialogue_window, 0, 0);
|
|
4562 ++v15;
|
|
4563 v14 += v16;
|
|
4564 }
|
|
4565 while ( (signed int)v15 < (signed int)&unk_F8B1C8 );
|
|
4566 v17 = pDialogueWindow;
|
|
4567 v114 = (174 - v14) / 4;
|
|
4568 result = pDialogueWindow->pStartingPosActiveItem;
|
|
4569 v18 = result + pDialogueWindow->pNumPresenceButton;
|
|
4570 v19 = (174 - 4 * (174 - v14) / 4 - v14) / 2 - (174 - v14) / 4 / 2 + 138;
|
|
4571 v20 = -pDialogueWindow->pNumPresenceButton < 0;
|
|
4572 v122 = pDialogueWindow->pStartingPosActiveItem;
|
|
4573 if ( v20 ^ __OFSUB__(result, v18) )
|
|
4574 {
|
|
4575 v119 = (const char **)2;
|
|
4576 _this = (Player *)pShopOptions;
|
|
4577 do
|
|
4578 {
|
|
4579 v21 = v17->GetControl(v122);
|
|
4580 v22 = (const char **)_this;
|
|
4581 v21->uY = v114 + v19;
|
|
4582 v23 = pFontArrus->CalcTextHeight(*v22, &dialogue_window, 0, 0);
|
|
4583 v24 = v21->uY;
|
|
4584 v25 = v119;
|
|
4585 v21->uHeight = v23;
|
|
4586 v19 = v24 + v23 - 1;
|
|
4587 v21->uW = v19;
|
|
4588 v26 = color2;
|
|
4589 if ( (const char **)pDialogueWindow->pCurrentPosActiveItem != v25 )
|
|
4590 v26 = m_text_color;
|
|
4591 dialogue_window.DrawTitleText(pFontArrus, 0, v24, v26, (const char *)LODWORD(_this->pConditions[0]), 3u);
|
|
4592 v17 = pDialogueWindow;
|
|
4593 v119 = (const char **)((char *)v119 + 1);
|
|
4594 _this = (Player *)((char *)_this + 4);
|
|
4595 ++v122;
|
|
4596 result = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem;
|
|
4597 }
|
|
4598 while ( v122 < result );
|
|
4599 }
|
|
4600 }*/
|
|
4601 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
|
|
4602 return;
|
|
4603 pShopOptions[0] = pGlobalTXT_LocalizationStrings[134]; //"Buy Standard"
|
|
4604 pShopOptions[1] = pGlobalTXT_LocalizationStrings[152]; //"Buy Special"
|
|
4605 pShopOptions[2] = pGlobalTXT_LocalizationStrings[159]; //"Display Inventory"
|
|
4606 pShopOptions[3] = pGlobalTXT_LocalizationStrings[160];
|
|
4607
|
|
4608 all_text_height = 0;
|
|
4609 for(int i=0;i<4;++i)
|
|
4610 all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0);
|
|
4611 v146 = (174 - all_text_height) / 4;
|
|
4612
|
|
4613 v23 = (174 - 4 * (174 - all_text_height) / 4 - all_text_height) / 2 - (174 - all_text_height) / 4 / 2 + 138;
|
|
4614 int j=0;
|
|
4615 if ( pDialogueWindow->pNumPresenceButton>=0 )
|
|
4616 {
|
|
4617 int th = 2;
|
|
4618 for (v152 = pDialogueWindow->pStartingPosActiveItem; v152 < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++v152)
|
|
4619 {
|
|
4620 control_button = pDialogueWindow->GetControl(v152);
|
|
4621 control_button->uY = v146 + v23;
|
|
4622 v27 = pFontArrus->CalcTextHeight(pShopOptions[j], &dialog_window, 0, 0);
|
|
4623 control_button->uHeight = v27;
|
|
4624 v23 = control_button->uY + control_button->uHeight - 1;
|
|
4625 control_button->uW = v23;
|
|
4626 text_color = hilight_color;
|
|
4627 if ( pDialogueWindow->pCurrentPosActiveItem != th )
|
|
4628 text_color = m_text_color;
|
|
4629 dialog_window.DrawTitleText(pFontArrus, 0, control_button->uY, text_color, pShopOptions[j], 3);
|
|
4630 ++th;
|
|
4631 ++j;
|
|
4632 }
|
|
4633 }
|
|
4634
|
|
4635
|
|
4636 return;
|
|
4637 }
|
|
4638 if ( dialog_menu_id != 2 )
|
|
4639 {
|
|
4640 if ( dialog_menu_id != 3 )
|
|
4641 {
|
|
4642 result = dialog_menu_id - 4;
|
|
4643 if ( dialog_menu_id == 4 )
|
|
4644 {
|
|
4645 draw_leather();
|
|
4646 CharacterUI_InventoryTab_Draw(uActiveCharacter, 1);
|
|
4647 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[197], 0);// "Select the Item to Identify"
|
|
4648 result = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win();
|
|
4649 if ( result )
|
|
4650 {
|
|
4651 v2 = pMouse->GetCursorPos(&a2)->x - 14;
|
|
4652 v117 = (v2 >> 5) + 14 * ((pMouse->GetCursorPos(&v98)->y - 17) >> 5);
|
|
4653 result = (int)pMouse->GetCursorPos(&v111);
|
|
4654 if ( *(int *)result > 13 )
|
|
4655 {
|
|
4656 result = (int)pMouse->GetCursorPos(&v103);
|
|
4657 if ( *(int *)result < 462 )
|
|
4658 {
|
|
4659 result = v0->GetItemIDAtInventoryIndex((int *)&v117);
|
|
4660 v3 = 0;
|
|
4661 if ( result )
|
|
4662 {
|
|
4663 v96 = 0;
|
|
4664 v94 = 4;
|
|
4665 v4 = (char *)&_this->pInventoryItems[result-1];
|
|
4666 if ( v4[20] & 1 )
|
|
4667 {
|
|
4668 v5 = BuilDialogueString("%24", uActiveCharacter - 1, (ItemGen *)v4, (char *)window_SpeakInHouse->ptr_1C, 4, 0);
|
|
4669 v97 = 3;
|
|
4670 v95 = v5;
|
|
4671 v92 = m_text_color;
|
|
4672 v6 = (212 - pFontArrus->CalcTextHeight(v5, &dialog_window, 0, 0)) / 2 + 101;
|
|
4673
|
|
4674 dialog_window.DrawTitleText(pFontArrus, v3, v6, v92, v95, v97);
|
|
4675 return;
|
|
4676 }
|
|
4677 v93 = window_SpeakInHouse->ptr_1C;
|
|
4678 v90 = (ItemGen *)v4;
|
|
4679 v7 = (int)window_SpeakInHouse->ptr_1C;
|
|
4680 uPlayerID = uActiveCharacter - 1;
|
|
4681 v8 = ((Player *)_this)->_490EEE((ItemGen *)v4, 3, v7, 4);
|
|
4682 v9 = uPlayerID;
|
|
4683 v10 = (char *)pMerchantsIdentifyPhrases[v8];
|
|
4684 goto LABEL_35;
|
|
4685 }
|
|
4686 }
|
|
4687 }
|
|
4688 }
|
|
4689 }
|
|
4690 return;
|
|
4691 }
|
|
4692 draw_leather();
|
|
4693 CharacterUI_InventoryTab_Draw(uActiveCharacter, 1);
|
|
4694 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[199], 0);// "Select the Item to Sell"
|
|
4695 result = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win();
|
|
4696 if ( !result
|
|
4697 || (v11 = pMouse->GetCursorPos(&v107)->x - 14,
|
|
4698 v117 = (v11 >> 5) + 14 * ((pMouse->GetCursorPos(&v99)->y - 17) >> 5),
|
|
4699 result = (int)pMouse->GetCursorPos(&v105),
|
|
4700 *(int *)result <= 13)
|
|
4701 || (result = (int)pMouse->GetCursorPos(&v101), *(int *)result >= 462)
|
|
4702 || (result = v0->GetItemIDAtInventoryIndex((int *)&v117), v3 = 0, !result) )
|
|
4703 return;
|
|
4704 v96 = 0;
|
|
4705 v94 = 3;
|
|
4706 v93 = window_SpeakInHouse->ptr_1C;
|
|
4707 v90 = (ItemGen *)&_this->pInventoryItems[result-1];
|
|
4708 v12 = (int)window_SpeakInHouse->ptr_1C;
|
|
4709 uPlayerID = uActiveCharacter - 1;
|
|
4710 v13 = _this->_490EEE(v90, 3, v12, 3);
|
|
4711 v9 = uPlayerID;
|
|
4712 v10 = (char *)pMerchantsSellPhrases[v13];
|
|
4713 LABEL_35:
|
|
4714 v30 = BuilDialogueString(v10, v9, v90, (char *)v93, v94, v96);
|
|
4715 v97 = 3;
|
|
4716 v95 = v30;
|
|
4717 v92 = m_text_color;
|
|
4718 v91 = v3;
|
|
4719 v89 = v3;
|
|
4720 v88 = &dialog_window;
|
|
4721 LABEL_61:
|
|
4722 v6 = (174 - pFontArrus->CalcTextHeight(v30, v88, v89, v91)) / 2 + 138;
|
|
4723 dialog_window.DrawTitleText(pFontArrus, v3, v6, v92, v95, v97);
|
|
4724 return;
|
|
4725 }
|
|
4726 }
|
|
4727 pRenderer->DrawTextureIndexed(8u, 8u, ShopTexture);
|
|
4728 v3 = 0;
|
|
4729 v49 = 0;
|
|
4730 v122 = 0;
|
|
4731 if ( dialog_menu_id == 2 )
|
|
4732 {
|
|
4733 do
|
|
4734 {
|
|
4735 // if ( pParty->field_777C[9 * (v49 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] )
|
|
4736 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v49].uItemID);
|
|
4737 {
|
|
4738 v50 = ItemsInShopTexture[v49];
|
|
4739 v51 = 152 - v50->uTextureHeight;
|
|
4740 if ( (signed int)v51 < 1 )
|
|
4741 v51 = 0;
|
|
4742 v52 = 75 * v49 - v50->uTextureWidth / 2 + 40;
|
|
4743 if ( v122 )
|
|
4744 {
|
|
4745 if ( v122 == 5 )
|
|
4746 {
|
|
4747 v53 = ItemsInShopTexture[5]->uTextureWidth;
|
|
4748 if ( (signed int)v52 > 457 - v53 )
|
|
4749 v52 = 457 - v53;
|
|
4750 }
|
|
4751 }
|
|
4752 else
|
|
4753 {
|
|
4754 if ( (signed int)v52 < 18 )
|
|
4755 v52 = 18;
|
|
4756 }
|
|
4757 pRenderer->DrawTextureTransparent(v52, v51, v50);
|
|
4758 sub_40F92A(&pRenderer->pActiveZBuffer[v52 + 640 * v51], ItemsInShopTexture[v122], v122 + 1);
|
|
4759 v49 = v122;
|
|
4760 }
|
|
4761 ++v49;
|
|
4762 v122 = v49;
|
|
4763 }
|
|
4764 while ( v49 < 6 );
|
|
4765 v122 = 0;
|
|
4766 do
|
|
4767 {
|
|
4768 //if ( pParty->field_777C[9 * (v122 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 54] )
|
|
4769 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v122+1].uItemID);
|
|
4770 {
|
|
4771 v54 = ItemsInShopTexture[v122 + 6];
|
|
4772 v55 = 306 - v54->uTextureHeight;
|
|
4773 v56 = 75 * v122 - v54->uTextureWidth / 2 + 40;
|
|
4774 if ( v122 )
|
|
4775 {
|
|
4776 if ( v122 == 5 )
|
|
4777 {
|
|
4778 v57 = ItemsInShopTexture[11]->uTextureWidth;
|
|
4779 if ( (signed int)v56 > 457 - v57 )
|
|
4780 v56 = 457 - v57;
|
|
4781 }
|
|
4782 }
|
|
4783 else
|
|
4784 {
|
|
4785 if ( (signed int)v56 < 18 )
|
|
4786 v56 = 18;
|
|
4787 }
|
|
4788 pRenderer->DrawTextureTransparent(v56, v55, v54);
|
|
4789 sub_40F92A(&pRenderer->pActiveZBuffer[v56 + 640 * v55], ItemsInShopTexture[v122 + 6], v122 + 7);
|
|
4790 }
|
|
4791 ++v122;
|
|
4792 }
|
|
4793 while ( v122 < 6 );
|
|
4794 }
|
|
4795 else
|
|
4796 {
|
|
4797 do
|
|
4798 {
|
|
4799 // if ( pParty->field_C59C[9 * (v49 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] )
|
|
4800 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v49].uItemID)
|
|
4801 {
|
|
4802 v58 = ItemsInShopTexture[v49];
|
|
4803 v59 = 152 - v58->uTextureHeight;
|
|
4804 if ( (signed int)v59 < 1 )
|
|
4805 v59 = 0;
|
|
4806 v60 = 75 * v49 - v58->uTextureWidth / 2 + 40;
|
|
4807 if ( v122 )
|
|
4808 {
|
|
4809 if ( v122 == 5 )
|
|
4810 {
|
|
4811 v61 = ItemsInShopTexture[5]->uTextureWidth;
|
|
4812 if ( (signed int)v60 > 457 - v61 )
|
|
4813 v60 = 457 - v61;
|
|
4814 }
|
|
4815 }
|
|
4816 else
|
|
4817 {
|
|
4818 if ( (signed int)v60 < 18 )
|
|
4819 v60 = 18;
|
|
4820 }
|
|
4821 pRenderer->DrawTextureTransparent(v60, v59, v58);
|
|
4822 sub_40F92A(&pRenderer->pActiveZBuffer[v60 + 640 * v59], ItemsInShopTexture[v122], v122 + 1);
|
|
4823 v49 = v122;
|
|
4824 }
|
|
4825 ++v49;
|
|
4826 v122 = v49;
|
|
4827 }
|
|
4828 while ( v49 < 6 );
|
|
4829 v122 = 0;
|
|
4830 do
|
|
4831 {
|
|
4832 //if ( pParty->Spell_Item[(unsigned int)window_SpeakInHouse->ptr_1C][v49] + 778] ) //weak
|
|
4833 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v49].uAttributes)
|
|
4834 {
|
|
4835 v62 = ItemsInShopTexture[v122 + 6];
|
|
4836 v63 = 306 - v62->uTextureHeight;
|
|
4837 if ( (signed int)v63 < 1 )
|
|
4838 v63 = 0;
|
|
4839 v64 = 75 * v122 - v62->uTextureWidth / 2 + 40;
|
|
4840 if ( v122 )
|
|
4841 {
|
|
4842 if ( v122 == 5 )
|
|
4843 {
|
|
4844 v65 = ItemsInShopTexture[11]->uTextureWidth;
|
|
4845 if ( (signed int)v64 > 457 - v65 )
|
|
4846 v64 = 457 - v65;
|
|
4847 }
|
|
4848 }
|
|
4849 else
|
|
4850 {
|
|
4851 if ( (signed int)v64 < 18 )
|
|
4852 v64 = 18;
|
|
4853 }
|
|
4854 pRenderer->DrawTextureTransparent(v64, v63, v62);
|
|
4855 sub_40F92A(&pRenderer->pActiveZBuffer[v64 + 640 * v63], ItemsInShopTexture[v122 + 6], v122 + 7);
|
|
4856 }
|
|
4857 ++v122;
|
|
4858 }
|
|
4859 while ( v122 < 6 );
|
|
4860 }
|
|
4861 result = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win();
|
|
4862 if ( result )
|
|
4863 {
|
|
4864 v66 = 0;
|
|
4865 v117 = 0;
|
|
4866 if ( dialog_menu_id == 2 )
|
|
4867 {
|
|
4868 do
|
|
4869 {
|
|
4870 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v66].uItemID); //9 * (v66 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] )
|
|
4871 ++v117;
|
|
4872 ++v66;
|
|
4873 }
|
|
4874 while ( v66 < 12 );
|
|
4875 }
|
|
4876 else
|
|
4877 {
|
|
4878 do
|
|
4879 {
|
|
4880 //if ( pParty->field_C59C[9 * (v66 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] )
|
|
4881 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v66].uItemID)
|
|
4882 ++v117;
|
|
4883 ++v66;
|
|
4884 }
|
|
4885 while ( v66 < 12 );
|
|
4886 }
|
|
4887 v67 = GetAsyncKeyState(VK_CONTROL);
|
|
4888 v68 = _this->CanSteal();
|
|
4889 Str = (char *)v68;
|
|
4890 if ( v67 && v68 )
|
|
4891 {
|
|
4892 v69 = pGlobalTXT_LocalizationStrings[185];// "Steal item"
|
|
4893 }
|
|
4894 else
|
|
4895 {
|
|
4896 v69 = pGlobalTXT_LocalizationStrings[195];// "Select the Item to Buy"
|
|
4897 if ( dialog_menu_id != 2 )
|
|
4898 v69 = pGlobalTXT_LocalizationStrings[196];// "Select the Special Item to Buy"
|
|
4899 }
|
|
4900 DrawTextAtStatusBar(v69, 0);
|
|
4901 if ( !v117 )
|
|
4902 {
|
|
4903 dialog_window.DrawCurrentTime( pParty->field_3C.field_50[(unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed);
|
|
4904 return;
|
|
4905 }
|
|
4906 v70 = pMouse->GetCursorPos(&v102);
|
|
4907 result = v70->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v100)->y];
|
|
4908 if ( pRenderer->pActiveZBuffer[result] & 0xFFFF )
|
|
4909 {
|
|
4910 v71 = (pRenderer->pActiveZBuffer[result] & 0xFFFF) - 1;
|
|
4911 v117 = v71;
|
|
4912 v72 = (int)window_SpeakInHouse->ptr_1C;
|
|
4913 // v73 = 9 * (v71 + 12 * v72);
|
|
4914 v74 = (ItemGen *)&pParty->StandartItemsInShops[v72][v71];
|
|
4915 if ( dialog_menu_id != 2 )
|
|
4916 // v74 = (ItemGen *)&pParty->field_C59C[v73 + 724];
|
|
4917 v74 =&pParty->SpecialItemsInShops[v72][v71];
|
|
4918 if ( v67 && Str )
|
|
4919 {
|
|
4920 v10 = pGlobalTXT_LocalizationStrings[181];// "Steal %24"
|
|
4921 v96 = 0;
|
|
4922 v94 = 2;
|
|
4923 v93 = window_SpeakInHouse->ptr_1C;
|
|
4924 v90 = v74;
|
|
4925 v9 = uActiveCharacter - 1;
|
|
4926 }
|
|
4927 else
|
|
4928 {
|
|
4929 v96 = 0;
|
|
4930 v94 = 2;
|
|
4931 v93 = window_SpeakInHouse->ptr_1C;
|
|
4932 v90 = v74;
|
|
4933 uPlayerID = uActiveCharacter - 1;
|
|
4934 v75 = _this->_490EEE(v74, 3, v72, 2);
|
|
4935 v9 = uPlayerID;
|
|
4936 v10 = (char *)pMerchantsBuyPhrases[v75];
|
|
4937 }
|
|
4938 goto LABEL_35;
|
|
4939 }
|
|
4940 }
|
|
4941 return;
|
|
4942 }
|