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