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