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