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