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