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