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"
|
775
|
24 #include "IndoorCamera.h"
|
|
25 #include "MapInfo.h"
|
777
|
26 #include "Log.h"
|
629
|
27
|
727
|
28 #include "MM7.h"
|
629
|
29 #include "mm7_data.h"
|
|
30
|
|
31
|
|
32 int uHouse_ExitPic; // weak
|
|
33
|
|
34 int dword_591080; // weak
|
|
35
|
747
|
36 int in_current_building_type; // 00F8B198
|
|
37 HOUSE_DIALOGUE_MENU dialog_menu_id; // 00F8B19C
|
|
38
|
775
|
39
|
|
40 #pragma pack(push, 1)
|
|
41 struct stru365_travel_info
|
|
42 {
|
|
43 unsigned char uMapInfoID;
|
|
44 unsigned char pSchedule[7];
|
776
|
45 unsigned int uTravelTime;
|
777
|
46 int arrival_x;
|
|
47 int arrival_y;
|
|
48 int arrival_z;
|
|
49 int arrival_rot_y;
|
775
|
50 unsigned int uQuestBit; // quest bit required to set for this travel option to be enabled; otherwise 0
|
|
51 };
|
|
52 #pragma pack(pop)
|
777
|
53 stru365_travel_info transport_schedule[35] = // 004F09B0
|
775
|
54 {
|
778
|
55 {MAP_STEADWICK, {1, 0, 1, 0, 1, 0, 0}, 2, -18048, 4636, 833, 1536, 0},
|
|
56 {MAP_PIERPONT, {0, 1, 0, 1, 0, 1, 0}, 2, -2527, -6773, 1153, 896, 0},
|
|
57 {MAP_TATALIA, {1, 0, 1, 0, 1, 0, 0}, 2, 4730, -10580, 320, 1024, 0},
|
|
58 {MAP_HARMONDALE, {0, 1, 0, 1, 0, 1, 0}, 2, -5692, 11137, 1, 1024, 0},
|
|
59 {MAP_DEYJA, {1, 0, 0, 1, 0, 0, 0}, 3, 7227, -16007, 2625, 640, 0},
|
|
60 {MAP_BRAKADA_DESERT, {0, 0, 1, 0, 0, 1, 0}, 3, 8923, 17191, 1, 512, 0},
|
|
61 {MAP_AVLEE, {1, 0, 1, 0, 1, 0, 0}, 3, 17059, 12331, 512, 1152, 0},
|
|
62 {MAP_DEYJA, {0, 1, 0, 0, 1, 0, 1}, 2, 7227, -16007, 2625, 640, 0},
|
|
63 {MAP_HARMONDALE, {0, 1, 0, 1, 0, 1, 0}, 2, -5692, 11137, 1, 1024, 0},
|
|
64 {MAP_STEADWICK, {1, 0, 1, 0, 1, 0, 0}, 3, -18048, 4636, 833, 1536, 0},
|
|
65 {MAP_PIERPONT, {0, 1, 0, 1, 0, 1, 0}, 2, -2527, -6773, 1153, 896, 0},
|
|
66 {MAP_STEADWICK, {1, 0, 1, 0, 1, 0, 1}, 3, -18048, 4636, 833, 1536, 0},
|
|
67 {MAP_HARMONDALE, {0, 1, 0, 0, 0, 1, 0}, 5, -5692, 11137, 1, 1024, 0},
|
|
68 {MAP_STEADWICK, {0, 1, 0, 1, 0, 1, 0}, 2, -18048, 4636, 833, 1536, 0},
|
|
69 {MAP_PIERPONT, {0, 1, 0, 1, 0, 1, 0}, 3, -2527, -16007, 1153, 896, 0},
|
|
70 {MAP_DEYJA, {0, 0, 1, 0, 0, 0, 1}, 5, 7227, -16007, 2625, 640, 0},
|
|
71 {MAP_TATALIA, {0, 1, 0, 1, 0, 1, 0}, 2, -2183, -6941, 97, 0, 0},
|
|
72 {MAP_AVLEE, {1, 0, 0, 0, 1, 0, 0}, 4, 7913, 9476, 193, 0, 0},
|
|
73 {MAP_EVENMORN_ISLE, {0, 0, 0, 0, 0, 0, 1}, 7, 15616, 6390, 193, 1536, PARTY_QUEST_EVENMORN_MAP_FOUND},
|
|
74 {MAP_BRAKADA_DESERT, {0, 0, 1, 0, 0, 0, 0}, 6, 19171, -19722, 193, 1024, 0},
|
|
75 {MAP_AVLEE, {0, 1, 0, 1, 0, 1, 0}, 3, 7913, 9476, 193, 0, 0},
|
|
76 {MAP_BRAKADA_DESERT, {1, 0, 1, 0, 0, 0, 0}, 6, 19171, -19722, 193, 1024, 0},
|
|
77 {MAP_TATALIA, {1, 0, 1, 0, 1, 0, 0}, 4, -2183, -6941, 97, 0, 0},
|
|
78 {MAP_PIERPONT, {0, 0, 0, 0, 0, 1, 0}, 6, -709, -14087, 193, 1024, 0},
|
|
79 {MAP_STEADWICK, {0, 0, 0, 0, 0, 0, 1}, 6, -10471, 13497, 193, 1536, 0},
|
|
80 {MAP_EVENMORN_ISLE, {0, 1, 0, 1, 0, 0, 0}, 1, 15616, 6390, 193, 1536, PARTY_QUEST_EVENMORN_MAP_FOUND},
|
|
81 {MAP_BRAKADA_DESERT, {0, 1, 0, 1, 0, 0, 0}, 1, 19171, -19722, 193, 1024, 0},
|
|
82 {MAP_STEADWICK, {0, 1, 0, 1, 0, 1, 0}, 2, -10471, 13497, 193, 1536, 0},
|
|
83 {MAP_BRAKADA_DESERT, {1, 0, 1, 0, 0, 0, 0}, 4, 19171, -19722, 193, 1024, 0},
|
|
84 {MAP_EVENMORN_ISLE, {0, 0, 0, 0, 0, 0, 1}, 5, 15616, 6390, 193, 1536, PARTY_QUEST_EVENMORN_MAP_FOUND},
|
|
85 {MAP_AVLEE, {0, 0, 0, 0, 1, 0, 0}, 5, 7913, 9476, 193, 0, 0},
|
|
86 {MAP_STEADWICK, {0, 1, 0, 0, 0, 1, 0}, 4, -10471, 13497, 193, 1536, 0},
|
|
87 {MAP_PIERPONT, {1, 0, 1, 0, 1, 0, 0}, 3, -709, -14087, 193, 1024, 0},
|
|
88 {MAP_TATALIA, {0, 0, 0, 1, 0, 0, 0}, 5, -2183, -6941, 97, 0, 0},
|
|
89 {MAP_ARENA, {0, 0, 0, 0, 0, 0, 1}, 4, 3844, 2906, 193, 512, 0}
|
775
|
90 };
|
|
91
|
777
|
92 unsigned char transport_routes[20][4] =
|
|
93 {
|
|
94 { 0, 1, 1, 34}, // HOUSE_STABLES_HARMONDALE
|
|
95 { 2, 3, 4, 5}, // HOUSE_STABLES_STEADWICK
|
|
96 { 6, 7, 8, 8}, // HOUSE_STABLES_56
|
|
97 { 9, 10, 10, 10}, // HOUSE_STABLES_57
|
|
98 { 11, 11, 12, 12}, // HOUSE_STABLES_58
|
|
99 { 13, 13, 13, 13}, // HOUSE_STABLES_59
|
|
100 { 14, 14, 15, 15}, // HOUSE_STABLES_60
|
|
101 {255, 255, 255, 255}, // HOUSE_STABLES_61
|
|
102 {255, 255, 255, 255}, // HOUSE_STABLES_62
|
|
103 {255, 255, 255, 255}, // HOUSE_BOATS_63
|
|
104 { 16, 17, 18, 19}, // HOUSE_BOATS_64
|
|
105 { 18, 20, 21, 21}, // HOUSE_BOATS_65
|
|
106 { 22, 23, 24, 25}, // HOUSE_BOATS_66
|
|
107 { 22, 22, 23, 23}, // HOUSE_BOATS_67
|
|
108 {255, 255, 255, 255}, // HOUSE_BOATS_68
|
|
109 { 27, 28, 29, 30}, // HOUSE_BOATS_69
|
|
110 { 31, 32, 33, 33}, // HOUSE_BOATS_70
|
|
111 { 24, 24, 24, 24}, // HOUSE_BOATS_71
|
|
112 {255, 255, 255, 255}, // HOUSE_BOATS_72
|
|
113 {255, 255, 255, 255} // HOUSE_BOATS_73
|
|
114 };
|
|
115
|
|
116
|
|
117
|
|
118
|
|
119
|
629
|
120 const stru159 pAnimatedRooms[196] = //0x4E5F70
|
778
|
121 {
|
629
|
122 {"", 0x4, 0x1F4, 0, 0, 0},
|
|
123 {"Human Armor01", 0x20, 0x2C0, 2, 58, 0},
|
|
124 {"Necromancer Armor01", 0x20, 0x2D7, 2, 70, 0 },
|
|
125 {"Dwarven Armor01", 0x20, 0x2EE, 2, 5, 0 },
|
|
126 {"Wizard Armor", 0x20, 0x3BD, 2, 19, 0 },
|
|
127 {"Warlock Armor", 0x20, 0x2D6, 2, 35, 0 },
|
|
128 {"Elf Armor", 0x20, 0x2BC, 2, 79, 0 },
|
|
129 {"Human Alchemisht01", 0xE, 0x2BE, 4, 95, 0 },
|
|
130 {"Necromancer Alchemist01", 0xE, 0x2D6, 4, 69, 0 },
|
|
131 {"Dwarven Achemist01", 0xE, 0x387, 4, 4, 0 },
|
|
132 {"Wizard Alchemist", 0xE, 0x232, 4, 25, 0 },
|
|
133 {"Warlock Alchemist", 0xE, 0x2BE, 4, 42, 0 },
|
|
134 {"Elf Alchemist", 0xE, 0x38A, 4, 84, 0 },
|
|
135 {"Human Bank01", 0x6, 0x384, 22, 52, 0 },
|
|
136 {"Necromancer Bank01", 0x6, 0x2D8, 22, 71, 0 },
|
|
137 {"Dwarven Bank", 0x6, 0x2F3, 22, 6, 0 },
|
|
138 {"Wizard Bank", 0x6, 0x3BA, 22, 20, 0 },
|
|
139 {"Warlock Bank", 0x6, 0x39F, 22, 36, 0 },
|
|
140 {"Elf Bank", 0x6, 0x2BC, 22, 71, 0 },
|
|
141 {"Boat01", 0xF, 0x4C, 28, 53, 3 },
|
|
142 {"Boat01d", 0xF, 0x4C, 28, 53, 3 },
|
|
143 {"Human Magic Shop01", 0xA, 0x2C8, 3, 54, 0 },
|
|
144 {"Necromancer Magic Shop01", 0xE, 0x2DC, 3, 66, 0 },
|
|
145 {"Dwarven Magic Shop01", 0x2A, 0x2EF, 3, 91, 0 },
|
|
146 {"Wizard Magic Shop", 0x1E, 0x2DF, 3, 15, 0 },
|
|
147 {"Warlock Magic Shop", 0x7, 0x3B9, 3, 15, 0 },
|
|
148 {"Elf Magic Shop", 0x24, 0x2CC, 3, 82, 0 },
|
|
149 {"Human Stables01", 0x21, 0x31, 27, 48, 3 },
|
|
150 {"Necromancer Stables", 0x21, 0x2DD, 27, 67, 3 },
|
|
151 {"", 0x21, 0x2F0, 27, 91, 3 },
|
|
152 {"Wizard Stables", 0x21, 0x3BA, 27, 16, 3 },
|
|
153 {"Warlock Stables", 0x21, 0x181, 27, 77, 3 },
|
|
154 {"Elf Stables", 0x21, 0x195, 27, 77, 3 },
|
|
155 {"Human Tavern01", 0xD, 0x2C2, 21, 49, 0 },
|
|
156 {"Necromancer Tavern01", 0xD, 0x3B0, 21, 57, 0 },
|
|
157 {"Dwarven Tavern01", 0xD, 0x2FE, 21, 94, 0 },
|
|
158 {"Wizard Tavern", 0xD, 0x3BB, 21, 17, 0 },
|
|
159 {"Warlock Tavern", 0xD, 0x3A8, 21, 33, 0 },
|
|
160 {"Elf Tavern", 0xD, 0x2CD, 21, 78, 0 },
|
|
161 {"Human Temple01", 0x24, 0x2DB, 23, 50, 3 },
|
|
162 {"Necromancer Temple", 0x24, 0x2DF, 23, 60, 3 },
|
|
163 {"Dwarven Temple01", 0x24, 0x2F1, 23, 86, 3 },
|
|
164 {"Wizard Temple", 0x24, 0x2E0, 23, 10, 3 },
|
|
165 {"Warlock Temple", 0x24, 0x3A4, 23, 27, 3 },
|
|
166 {"Elf Temple", 0x24, 0x2CE, 23, 72, 3 },
|
|
167 {"Human Town Hall", 0x10, 0x39C, 17, 14, 0 },
|
|
168 {"Necromancer Town Hall01", 0x10, 0x3A4, 17, 61, 0 },
|
|
169 {"Dwarven Town Hall", 0x10, 0x2DB, 17, 88, 0 },
|
|
170 {"Wizard Town Hall", 0x10, 0x3BD, 17, 11, 0 },
|
|
171 {"Warlock Town Hall", 0x10, 0x2DB, 17, 28, 0 },
|
|
172 {"Elf Town Hall", 0x10, 0x27A, 17, 73, 0 },
|
|
173 {"Human Training Ground01", 0x18, 0x2C7, 30, 44, 0 },
|
|
174 {"Necromancer Training Ground", 0x18, 0x3AD, 30, 62, 0 },
|
|
175 {"Dwarven Training Ground", 0x18, 0x2F2, 30, 89, 0 },
|
|
176 {"Wizard Training Ground", 0x18, 0x3A3, 30, 12, 0 },
|
|
177 {"Warlock Training Ground", 0x18, 0x3A6, 30, 29, 0 },
|
|
178 {"Elf Training Ground", 0x18, 0x19F, 30, 74, 0 },
|
|
179 {"Human Weapon Smith01", 0x16, 0x2C1, 1, 45, 4 },
|
|
180 {"Necromancer Weapon Smith01", 0x16, 0x2D9, 1, 63, 4 },
|
|
181 {"Dwarven Weapon Smith01", 0x16, 0x2EE, 1, 82, 4 },
|
|
182 {"Wizard Weapon Smith", 0x16, 0x2D5, 1, 13, 4 },
|
|
183 {"Warlock Weapon Smith", 0x16, 0x2D7, 1, 23, 4 },
|
|
184 {"Elf Weapon Smith", 0x16, 0x2CA, 1, 75, 4 },
|
|
185 {"Air Guild", 0x1D, 0xA4, 6, 1, 3 },
|
|
186 {"Body Guild", 0x19, 0x3BF, 11, 2, 0 },
|
|
187 {"DarkGuild", 0x19, 0x2D1, 13, 3, 0 },
|
|
188 {"EarthGuild", 0x19, 0x2CB, 8, 83, 0 },
|
|
189 {"Fire Guild", 0x1C, 0x2BF, 5, 56, 0 },
|
|
190 {"Light Guild", 0x1C, 0x2D5, 12, 46, 0 },
|
|
191 {"Mind Guild", 0x1C, 0xE5, 10, 40, 0 },
|
|
192 {"Spirit Guild", 0x1C, 0x2D2, 9, 41, 0 },
|
|
193 {"Water Guild", 0x1B, 0x2D3, 7, 24, 0 },
|
|
194 {"Lord And Judge Out01", 1, 0, 29, 39, 0 },
|
|
195 {"Human Poor House 1", 8, 0, 29, 0, 0 },
|
|
196 {"Human Poor House 2", 8, 0, 29, 0, 0 },
|
|
197 {"Human Poor House 3", 8, 0, 29, 0, 0 },
|
|
198 {"Human Medium House 1", 8, 0, 29, 0, 0 },
|
|
199 {"Human Medium House 2", 8, 0, 29, 0, 0 },
|
|
200 {"Human Medium House 3", 8, 0, 29, 0, 0 },
|
|
201 {"Human Rich House 1", 8, 0, 29, 0, 0 },
|
|
202 {"Human Rich House 2", 8, 0, 29, 0, 0 },
|
|
203 {"Human Rich House 3", 8, 0, 29, 0, 0 },
|
|
204 {"Elven Poor House 1", 8, 0, 29, 0, 0 },
|
|
205 {"Elven Poor House 2", 8, 0, 29, 0, 0 },
|
|
206 {"Elven Poor House 3", 8, 0, 29, 0, 0 },
|
|
207 {"Elven Medium House 1", 8, 0, 29, 0, 0 },
|
|
208 {"Elven Medium House 2", 8, 0, 29, 0, 0 },
|
|
209 {"Elven Medium House 3", 8, 0, 29, 0, 0 },
|
|
210 {"Elven Rich House 1", 8, 0, 29, 0, 0 },
|
|
211 {"Elven Rich House 2", 8, 0, 29, 0, 0 },
|
|
212 {"Elven Rich House 3", 8, 0, 29, 0, 0 },
|
|
213 {"Dwarven Poor House 1", 8, 0, 29, 0, 0 },
|
|
214 {"Dwarven Poor House 2", 8, 0, 29, 0, 0 },
|
|
215 {"Dwarven Poor House 3", 8, 0, 29, 0, 0 },
|
|
216 {"Dwarven Medium House 1", 8, 0, 29, 0, 0 },
|
|
217 {"Dwarven Medium house 2", 8, 0, 29, 0, 0 },
|
|
218 {"Dwarven Medium House 3", 8, 0, 29, 0, 0 },
|
|
219 {"Dwarven Rich House 1", 8, 0, 29, 0, 0 },
|
|
220 {"Dwarven Rich House 2", 8, 0, 29, 0, 0 },
|
|
221 {"Dwarven Rich House 3", 8, 0, 29, 0, 0 },
|
|
222 {"Wizard Poor House 1", 8, 0, 29, 0, 0 },
|
|
223 {"Wizard Poor House 2", 8, 0, 29, 0, 0 },
|
|
224 {"Wizard Poor House 3", 8, 0, 29, 0, 0 },
|
|
225 {"Wizard Medium House 1", 8, 0, 29, 0, 0 },
|
|
226 {"Wizard Medium House 2", 8, 0, 29, 0, 0 },
|
|
227 {"Wizard Mdeium House 3", 8, 0, 29, 0, 0 },
|
|
228 {"Wizard Rich House 1", 8, 0, 29, 0, 0 },
|
|
229 {"Wizard Rich House 2", 8, 0, 29, 0, 0 },
|
|
230 {"Wizard Rich House 3", 8, 0, 29, 0, 0 },
|
|
231 {"Necromancer Poor House 1", 8, 0, 29, 0, 0 },
|
|
232 {"Necromancer Poor House 2", 8, 0, 29, 0, 0 },
|
|
233 {"Necromancer Poor House 3", 8, 0, 29, 0, 0 },
|
|
234 {"Necromancer Medium House 1", 8, 0, 29, 0, 0 },
|
|
235 {"Necromancer Medium House 2", 8, 0, 29, 0, 0 },
|
|
236 {"Necromancer Mdeium House 3", 8, 0, 29, 0, 0 },
|
|
237 {"Necromancer Rich House 1", 8, 0, 29, 0, 0 },
|
|
238 {"Necromancer Rich House 2", 8, 0, 29, 0, 0 },
|
|
239 {"Necromancer Rich House 3", 8, 0, 29, 0, 0 },
|
|
240 {"Warlock Poor House 1", 8, 0, 29, 0, 0 },
|
|
241 {"Warlock Poor House 2", 8, 0, 29, 0, 0 },
|
|
242 {"Warlock Poor House 3", 8, 0, 29, 0, 0 },
|
|
243 {"Warlock Medium House 1", 8, 0, 29, 0, 0 },
|
|
244 {"Warlock Medium House 2", 8, 0, 29, 0, 0 },
|
|
245 {"Warlock Mdeium House 3", 8, 0, 29, 0, 0 },
|
|
246 {"Warlock Rich House 1", 8, 0, 29, 0, 0 },
|
|
247 {"Warlock Rich House 2", 8, 0, 29, 0, 0 },
|
|
248 {"Warlock Rich House 3", 8, 0, 29, 0, 0 },
|
|
249 {"Out01 Temple of the Moon", 0x24, 0, 25, 0, 0 },
|
|
250 {"Out01 Dragon Cave", 0x24, 0, 25, 0, 0 },
|
|
251 {"Out02 Castle Harmondy", 0x24, 0, 25, 0, 0 },
|
|
252 {"Out02 White Cliff Cave", 0x24, 0, 25, 0, 0 },
|
|
253 {"Out03 Erathian Sewer", 0x24, 0, 25, 0, 0 },
|
|
254 {"Out03 Fort Riverstride", 0x24, 0, 25, 0, 0 },
|
|
255 {"Out03 Castle Gryphonheart", 0x24, 0, 25, 0, 0 },
|
|
256 {"Out04 Elf Castle", 0x24, 0, 25, 0, 0 },
|
|
257 {"Out04 Tularean Caves", 0x24, 0, 25, 0, 0 },
|
|
258 {"Out04 Clanker's Laboratory", 0x24, 0, 25, 0, 0 },
|
|
259 {"Out05 Hall of the Pit", 0x24, 0, 25, 0, 0 },
|
|
260 {"Out05 Watchtower 6", 0x24, 0, 25, 0, 0 },
|
|
261 {"Out06 School of Sorcery", 0x24, 0, 25, 0, 0 },
|
|
262 {"Out06 Red Dwarf Mines", 0x24, 0, 25, 0, 0 },
|
|
263 {"Out07 Castle Lambert", 0x24, 0, 25, 0, 0 },
|
|
264 {"Out07 Walls of Mist", 0x24, 0, 25, 0, 0 },
|
|
265 {"Out07 Temple of the Light", 0x24, 0, 25, 0, 0 },
|
|
266 {"Out08 Evil Entrance", 0x24, 0, 25, 0, 0 },
|
|
267 {"Out08 Breeding Zone", 0x24, 0, 25, 0, 0 },
|
|
268 {"Out08 Temple of the Dark", 0x24, 0, 25, 0, 0 },
|
|
269 {"Out09 Grand Temple of the Moon", 0x24, 0, 25, 0, 0 },
|
|
270 {"Out09 Grand Tempple of the Sun", 0x24, 0, 25, 0, 0 },
|
|
271 {"Out10 Thunderfist Mountain", 0x24, 0, 25, 0, 0 },
|
|
272 {"Out10 The Maze", 0x24, 0, 25, 0, 0 },
|
|
273 {"Out10 Connecting Tunnel Cave #1", 0x24, 0, 25, 0, 0 },
|
|
274 {"", 0x24, 0, 25, 0, 0 },
|
|
275 {"", 0x24, 0, 25, 0, 0 },
|
|
276 {"Out11 Stone City", 0x24, 0, 25, 0, 0 },
|
|
277 {"", 0x24, 0, 25, 0, 0 },
|
|
278 {"Out12 Colony Zod", 0x24, 0, 25, 0, 0 },
|
|
279 {"Out12 Connecting Tunnel Cave #1", 0x24, 0, 25, 0, 0 },
|
|
280 {"", 0x24, 0, 25, 0, 0 },
|
|
281 {"", 0x24, 0, 25, 0, 0 },
|
|
282 {"Out13 Mercenary Guild", 0x24, 0, 25, 0, 0 },
|
|
283 {"Out13 Tidewater Caverns", 0x24, 0, 25, 0, 0 },
|
|
284 {"Out13 Wine Cellar", 0x24, 0, 25, 0, 0 },
|
|
285 {"Out14 Titan's Stronghold", 0x24, 0, 25, 0, 0 },
|
|
286 {"Out14 Temple Of Baa", 0x24, 0, 25, 0, 0 },
|
|
287 {"Out14 Hall under the Hill", 0x24, 0, 25, 0, 0 },
|
|
288 {"Out15 The Linclon", 0x24, 0, 25, 0, 0 },
|
|
289 {"Jail", 0x24, 0, 31, 0, 0 },
|
|
290 {"Harmondale Throne Room", 0x24, 0, 29, 0, 0 },
|
|
291 {"Gryphonheart Throne Room", 0x24, 0, 20, 0, 0 },
|
|
292 {"Elf Castle Throne Room", 0x24, 0, 20, 0, 0 },
|
|
293 {"Wizard Castle Throne Room", 0x24, 0, 20, 0, 0 },
|
|
294 {"Necromancer Casstle Trone Room", 0x24, 0, 20, 0, 0 },
|
|
295 {"Master Thief", 0x24, 0, 29, 0, 0 },
|
|
296 {"Dwarven King", 0x24, 0, 20, 0, 0 },
|
|
297 {"Arms Master", 0x24, 0, 29, 0, 0 },
|
|
298 {"Warlock", 0x24, 0, 29, 0, 0 },
|
|
299 {"Lord Markam", 0x24, 0, 20, 0, 0 },
|
|
300 {"Arbiter Neutral Town", 0x24, 0, 29, 0, 0 },
|
|
301 {"Arbiter Good Town", 0x24, 0, 29, 0, 0 },
|
|
302 {"Arbiter Evil Town", 0x24, 0, 29, 0, 0 },
|
|
303 {"Necromancer Throne Room Empty", 0x24, 0, 20, 0, 0 },
|
|
304 {"", 0x24, 0, 29, 0, 0 },
|
|
305 {"", 0x24, 0, 29, 0, 0 },
|
|
306 {"", 0x24, 0, 29, 0, 0 },
|
|
307 {"", 0x24, 0, 29, 0, 0 },
|
|
308 {"Boat01", 0xF, 0, 29, 53, 3 },
|
|
309 {"", 0x24, 0, 28, 0, 0 },
|
|
310 {"", 0x24, 0, 28, 0, 0 },
|
|
311 {"", 0x24, 0, 28, 0, 0 },
|
|
312 {"", 0x24, 0, 29, 0, 0 },
|
|
313 {"Arbiter Room Neutral", 0x24, 0, 29, 0, 0 },
|
|
314 {"Out02 Castle Harmondy Abandoned", 0x24, 0, 25, 0, 0 },
|
|
315 {"Human Temple02", 0x24, 0x3AB, 23, 27, 0 },
|
|
316 {"Player Castle Good", 0x24, 0, 25, 0, 0 },
|
|
317 {"Player Castle Bad", 0x24, 0, 25, 0, 0}
|
778
|
318 };
|
629
|
319
|
|
320
|
|
321
|
|
322 //----- (0044606A) --------------------------------------------------------
|
|
323 void PrepareHouse(HOUSE_ID house)
|
|
324 {
|
|
325 //unsigned int v1; // ebx@1
|
|
326 //signed int v2; // esi@1
|
|
327 //int uExitPic; // edi@1
|
|
328 __int16 uExitMapID; // ax@2
|
|
329 //int result; // eax@5
|
|
330 //unsigned int *v6; // ecx@8
|
|
331 int v7; // ebx@11
|
|
332 //int v8; // esi@16
|
|
333 //unsigned int v9; // eax@16
|
|
334 //unsigned int v10; // eax@19
|
|
335 //int v11; // ecx@19
|
|
336 //char pContainer[36]; // [sp+Ch] [bp-54h]@16
|
|
337 int v13; // [sp+30h] [bp-30h]@11
|
|
338 int Dst[6]; // [sp+34h] [bp-2Ch]@1
|
|
339 //unsigned int v15; // [sp+4Ch] [bp-14h]@1
|
|
340 int uAnimationID; // [sp+50h] [bp-10h]@1
|
|
341 //unsigned int *v17; // [sp+54h] [bp-Ch]@3
|
|
342 //unsigned int v18; // [sp+58h] [bp-8h]@1
|
|
343 //int v19; // [sp+5Ch] [bp-4h]@7
|
|
344
|
|
345 //v15 = uHouseID;
|
|
346 //v1 = 52 * uHouseID;
|
|
347 //uAnimationID = p2DEvents_minus1___02[26 * uHouseID];
|
|
348 uAnimationID = p2DEvents[house - 1].uAnimationID;
|
|
349 //v18 = 52 * uHouseID;
|
|
350 memset(Dst, 0, 0x18u);
|
|
351 //uExitPic = *(__int16 *)((char *)p2DEvents_minus1_::2C + v1);
|
|
352 //uExitPic = p2DEvents[uHouseID - 1].uExitPicID;
|
|
353 uNumDialogueNPCPortraits = 0;
|
|
354 uHouse_ExitPic = p2DEvents[house - 1].uExitPicID;
|
|
355 if ( uHouse_ExitPic )
|
|
356 {
|
|
357 //uExitMapID = *(__int16 *)((char *)p2DEvents_minus1_::30 + v1);
|
|
358 uExitMapID = p2DEvents[house - 1]._quest_related;
|
|
359 if ( uExitMapID > 0 )
|
|
360 {
|
|
361 //v17 = (unsigned int *)(uExitMapID - 1);
|
|
362 if(_449B57_test_bit(pParty->_quest_bits,uExitMapID))
|
|
363 // if ( !((unsigned __int8)(0x80u >> (uExitMapID - 1) % 8) & pParty->_quest_bits[(uExitMapID - 1) >> 3]) )
|
|
364 {
|
|
365 //uExitPic = 0;
|
|
366 uHouse_ExitPic = 0;
|
|
367 }
|
|
368 }
|
|
369 }
|
|
370
|
|
371 dword_591080 = pAnimatedRooms[uAnimationID].field_8;
|
|
372 //result = dword_591080;
|
|
373
|
|
374 //v2 = 0;
|
|
375 uNumDialogueNPCPortraits = 0;
|
|
376 if ( dword_591080 )
|
|
377 {
|
|
378 //v2 = 1;
|
|
379 Dst[0] = dword_591080;
|
|
380 uNumDialogueNPCPortraits = 1;
|
|
381 }
|
|
382
|
|
383 //v19 = 1;
|
|
384 for (uint i = 0; i < pNPCStats->uNumNewNPCs; ++i)
|
|
385 {
|
|
386 auto npc = pNPCStats->pNewNPCData + i;
|
|
387 //v6 = &pNPCStats->pNewNPCData[1].uFlags;
|
|
388 //v17 = &pNPCStats->pNewNPCData[1].uFlags;
|
|
389 //do
|
|
390 //{
|
|
391 if (npc->Location2D == house )
|
|
392 {
|
|
393 if (~npc->uFlags & 0x80)
|
|
394 //if ( !(*(char *)v6 & 0x80) )
|
|
395 {
|
|
396 v7 = uNumDialogueNPCPortraits++ - dword_591080 ? 1 : 0;
|
|
397 HouseNPCData[v7] = npc;
|
|
398 //v6 = v17;
|
|
399 //*(&v13 + v2) = *(v17 - 1);
|
|
400 Dst[uNumDialogueNPCPortraits - 1] = npc->uPortraitID;
|
|
401 //v1 = v18;
|
|
402 if ((npc->uFlags & 3) != 2)
|
|
403 ++npc->uFlags;
|
|
404 }
|
|
405 }
|
|
406 //++v19;
|
|
407 //v6 += 19;
|
|
408 //v17 = v6;
|
|
409 //}
|
|
410 //while ( v19 < (signed int)pNPCStats->uNumNewNPCs );
|
|
411 }
|
|
412 //uNumDialogueNPCPortraits = v2;
|
|
413
|
|
414 //v19 = 0;
|
|
415 for (uint i = 0; i < uNumDialogueNPCPortraits; ++i)
|
|
416 //if ( v2 > 0 )
|
|
417 {
|
|
418 //do
|
|
419 //{
|
|
420 //v8 = v19;
|
|
421 char icon_name[128];
|
|
422 sprintfex(icon_name, "npc%03u", Dst[i]);
|
|
423 //v9 = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
|
|
424 //++v19;
|
|
425 pDialogueNPCPortraits[i] = pIcons_LOD->LoadTexturePtr(icon_name, TEXTURE_16BIT_PALETTE);
|
|
426 //result = v19;
|
|
427 //}
|
|
428 //while ( v19 < uNumDialogueNPCPortraits );
|
|
429 //uExitPic = uHouse_ExitPic;
|
|
430 }
|
|
431
|
|
432 if (uHouse_ExitPic)
|
|
433 {
|
|
434 //v10 = pIcons_LOD->LoadTexture(pHouse_ExitPictures[uHouse_ExitPic], TEXTURE_16BIT_PALETTE);
|
|
435 //v11 = uNumDialogueNPCPortraits++;
|
|
436 pDialogueNPCPortraits[uNumDialogueNPCPortraits++] = pIcons_LOD->LoadTexturePtr(pHouse_ExitPictures[uHouse_ExitPic], TEXTURE_16BIT_PALETTE);
|
|
437 //result = *(__int16 *)((char *)p2DEvents_minus1_::2E + v1);
|
|
438 //result = p2DEvents[house - 1].uExitMapID;
|
|
439 uHouse_ExitPic = p2DEvents[house - 1].uExitMapID;
|
|
440 }
|
|
441 //return result;
|
|
442 }
|
|
443
|
|
444
|
|
445 //----- (0044622E) --------------------------------------------------------
|
735
|
446 bool EnterHouse(enum HOUSE_ID uHouseID)
|
|
447 {
|
629
|
448 //enum HOUSE_ID v1; // edi@1
|
|
449 //int v2; // edi@5
|
|
450 signed int uOpenTime; // eax@5
|
|
451 signed int uCloseTime; // esi@5
|
|
452 unsigned int v5; // esi@5
|
|
453 int v6; // edx@5
|
|
454 signed int am_pm_flag_open; // ecx@10
|
|
455 signed int am_pm_flag_close; // eax@10
|
|
456 int v9; // esi@10
|
|
457 //unsigned int v10; // esi@16
|
|
458 int v11; // ecx@17
|
|
459 unsigned int v12; // kr00_4@25
|
|
460 //Player *v13; // esi@25
|
|
461 int v14; // eax@25
|
|
462 //Player *v15; // esi@27
|
|
463 //signed int v16; // eax@32
|
|
464 unsigned int v17; // eax@37
|
|
465 signed int v18; // edi@37
|
|
466 signed int v19; // edi@41
|
|
467 //unsigned int v20; // ecx@41
|
|
468 //const char *v22; // [sp-4h] [bp-40h]@33
|
|
469 char pContainer[40]; // [sp+Ch] [bp-30h]@32
|
|
470 unsigned int v24; // [sp+34h] [bp-8h]@5
|
|
471 //enum HOUSE_ID v25; // [sp+38h] [bp-4h]@1
|
|
472
|
|
473 //v1 = uHouseID;
|
|
474 //v25 = uHouseID;
|
|
475 GameUI_StatusBar_TimedString[0] = 0;
|
|
476 pStatusBarString[0] = 0;
|
|
477 ShowStatusBarString("", 2u);
|
|
478 if ( pMessageQueue_50CBD0->uNumMessages )
|
|
479 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
|
|
480 viewparams->bRedrawGameUI = 1;
|
|
481 uDialogueType = 0;
|
|
482 pKeyActionMap->_459ED1(3);
|
|
483 pKeyActionMap->ResetKeys();
|
|
484 if (uHouseID == HOUSE_600 || uHouseID == HOUSE_601)
|
|
485 {
|
|
486 GameOverMenu(0);
|
|
487 return 0;
|
|
488 }
|
|
489 uOpenTime = p2DEvents[uHouseID - 1].uOpenTime;
|
|
490 uCloseTime = p2DEvents[uHouseID - 1].uCloseTime;
|
|
491 ptr_F8B1E8 = 0;
|
|
492 dword_F8B1E4 = 0;
|
|
493 dword_F8B1F4 = 0;
|
|
494 memset(byte_F8B1F0, 0, 4);
|
758
|
495 memset(player_levels, 0, 16);
|
629
|
496 pRenderer->ClearZBuffer(0, 479);
|
|
497
|
|
498 if (((uCloseTime - 1 <= uOpenTime)&&((pParty->uCurrentHour <uOpenTime)&&(pParty->uCurrentHour >(uCloseTime - 1))))||
|
|
499 ((uCloseTime - 1 > uOpenTime)&&((pParty->uCurrentHour < uOpenTime)||(pParty->uCurrentHour > (uCloseTime - 1)))))
|
|
500
|
|
501 {
|
|
502 am_pm_flag_open = 0;
|
|
503 am_pm_flag_close = 0;
|
|
504 if (uOpenTime > 12 )
|
|
505 {
|
|
506 uOpenTime -= 12;
|
|
507 am_pm_flag_open = 1;
|
|
508 }
|
|
509 if ( uCloseTime > 12 )
|
|
510 {
|
|
511 uCloseTime -= 12;
|
|
512 am_pm_flag_close = 1;
|
|
513 }
|
|
514 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[414], uOpenTime, aAMPMNames[am_pm_flag_open],
|
|
515 uCloseTime, aAMPMNames[am_pm_flag_close]); //"This place is open from %d%s to %d%s"
|
|
516 ShowStatusBarString(pTmpBuf, 2u);
|
|
517 if ( uActiveCharacter )
|
|
518 pPlayers[uActiveCharacter]->PlaySound(SPEECH_3, 0);
|
|
519 return 0;
|
|
520 }
|
|
521 else
|
|
522 {
|
|
523 //v10 = uHouseID;
|
|
524 if ( (signed int)uHouseID < 53 ) //entering shops and guilds
|
|
525 {
|
|
526 if ( !(pParty->field_3C._shop_ban_times[uHouseID])
|
|
527 || (pParty->field_3C._shop_ban_times[uHouseID] <= pParty->uTimePlayed) )
|
|
528 {
|
|
529 pParty->field_3C._shop_ban_times[uHouseID] = 0;
|
|
530 }
|
|
531 else
|
|
532 {
|
|
533 ShowStatusBarString(pGlobalTXT_LocalizationStrings[191], 2u);// "You've been banned from this shop!"
|
|
534 return 0;
|
|
535 }
|
|
536 }
|
|
537 if ( !start_event_seq_number )
|
|
538 pAudioPlayer->StopChannels(-1, -1);
|
|
539
|
|
540 uCurrentHouse_Animation = p2DEvents[uHouseID - 1].uAnimationID;
|
|
541 in_current_building_type = pAnimatedRooms[uCurrentHouse_Animation].uBuildingType;
|
|
542 if ( in_current_building_type == BildingType_Throne_Room && pParty->uFine ) // going 2 jail
|
|
543 {
|
|
544 uCurrentHouse_Animation = (signed __int16)p2DEvents[186].uAnimationID;
|
|
545 uHouseID = HOUSE_JAIL;
|
727
|
546 pParty->uTimePlayed = pParty->uTimePlayed + 0x7620000;
|
|
547 in_current_building_type = pAnimatedRooms[p2DEvents[HOUSE_LORD_AND_JUDGE_EMERALD_ISLE].uAnimationID].uBuildingType;
|
629
|
548 ++pParty->uNumPrisonTerms;
|
|
549 pParty->uFine = 0;
|
|
550 for (uint i = 0; i < 4; ++i)
|
|
551 {
|
|
552 pParty->pPlayers[i].uTimeToRecovery = 0;
|
|
553 pParty->pPlayers[i].uNumDivineInterventionCastsThisDay = 0;
|
|
554 pParty->pPlayers[i].SetVariable(VAR_Award, 87);
|
|
555 }
|
|
556 }
|
|
557 ++pIcons_LOD->uTexturePacksCount;
|
|
558 if ( !pIcons_LOD->uNumPrevLoadedFiles )
|
|
559 pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles;
|
|
560 switch (pParty->alignment)
|
|
561 {
|
|
562 case PartyAlignment_Good: sprintf(pContainer, "evt%02d-b", const_2()); break;
|
|
563 case PartyAlignment_Neutral: sprintf(pContainer, "evt%02d", const_2()); break;
|
|
564 case PartyAlignment_Evil: sprintf(pContainer, "evt%02d-c", const_2()); break;
|
|
565 default: assert(false);
|
|
566 }
|
|
567
|
|
568 v17 = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
|
|
569 pDialogueNPCCount = 0;
|
|
570 pTexture_Dialogue_Background = &pIcons_LOD->pTextures[v17];
|
|
571 uTextureID_507B04 = uTextureID_right_panel;
|
|
572 PrepareHouse(uHouseID);
|
|
573 v18 = 1;
|
|
574 uTextureID_507B04 = uTextureID_right_panel;
|
|
575 if ( uNumDialogueNPCPortraits == 1 )
|
|
576 pDialogueNPCCount = 1;
|
|
577 pVideoPlayer->_4BF28F(pAnimatedRooms[uCurrentHouse_Animation].video_name, 1u);
|
|
578 dword_5C35D4 = 1;
|
|
579 if ( (signed int)uHouseID < 139 || (signed int)uHouseID > 172 )
|
727
|
580 {
|
|
581 if ( (signed int)uHouseID >= HOUSE_STABLES_HARMONDALE && (signed int)uHouseID <= 73 && !IsTravelAvailable(uHouseID - HOUSE_STABLES_HARMONDALE) )
|
|
582 {
|
|
583 return 1;
|
|
584 }
|
|
585 }
|
629
|
586 else
|
735
|
587 { //guilds
|
|
588 v19 = guild_mambership_flags[uHouseID - HOUSE_FIRE_GUILD_INITIATE_EMERALD_ISLE]; //guilds flags
|
629
|
589 //v20 = uHouseID;
|
|
590 //if ( !((unsigned __int8)(0x80u >> v19 % 8) & pPlayers[uActiveCharacter]->_guilds_member_bits[v19 /8]) )
|
735
|
591 if(_449B57_test_bit(pPlayers[uActiveCharacter]->_guilds_member_bits,v19))
|
|
592 {
|
|
593 PlayHouseSound(uHouseID, HouseSound_Greeting_2);
|
629
|
594 return 1;
|
735
|
595 }
|
|
596 }
|
|
597 PlayHouseSound(uHouseID, HouseSound_Greeting);
|
629
|
598 dword_5C35D4 = 1;
|
|
599 return 1;
|
|
600 }
|
|
601 }
|
|
602
|
|
603 //----- (004B1E92) --------------------------------------------------------
|
735
|
604 void PlayHouseSound(unsigned int uHouseID, HouseSoundID sound)
|
|
605 {
|
629
|
606 //if ( BYTE1(pAnimatedRooms[p2DEvents_minus1___02[26 * uHouseID]].field_C) )
|
|
607 if ( pAnimatedRooms[p2DEvents[uHouseID - 1].uAnimationID].uRoomSoundId )
|
|
608 pAudioPlayer->PlaySound(
|
|
609 //(SoundID)(a2 + 100 * (BYTE1(pAnimatedRooms[p2DEvents_minus1___02[26 * uHouseID]].field_C) + 300)),
|
735
|
610 (SoundID)(sound + 100 * (pAnimatedRooms[p2DEvents[uHouseID - 1].uAnimationID].uRoomSoundId + 300)),
|
629
|
611 806, 0, -1, 0, 0, 0, 0);
|
735
|
612 }
|
629
|
613
|
762
|
614 //----- (004B4F4F) --------------------------------------------------------
|
|
615 void JailDialog()
|
629
|
616 {
|
|
617 const char *v0; // esi@1
|
|
618 const char *v1; // ST10_4@1
|
|
619 unsigned __int16 v2; // ST0C_2@1
|
|
620 int v3; // eax@1
|
|
621 GUIWindow v5; // [sp+8h] [bp-54h]@1
|
|
622
|
|
623 memcpy(&v5, window_SpeakInHouse, sizeof(v5));
|
|
624 v0 = pGlobalTXT_LocalizationStrings[672];
|
|
625 v1 = pGlobalTXT_LocalizationStrings[672];
|
|
626 v5.uFrameX = 483;
|
|
627 v5.uFrameWidth = 148;
|
|
628 v5.uFrameZ = 334;
|
|
629 v2 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu);
|
|
630 v3 = pFontArrus->CalcTextHeight(v0, &v5, 0, 0);
|
762
|
631 v5.DrawTitleText(pFontArrus, 0, (310 - v3) / 2 + 18, v2, v1, 3u);
|
629
|
632 }
|
|
633
|
|
634
|
|
635
|
775
|
636
|
|
637 //----- (004BCACC) --------------------------------------------------------
|
|
638 void __fastcall OnSelectShopDialogueOption(signed int uMessageParam)
|
|
639 {
|
|
640 //unsigned int v1; // edi@1
|
|
641 //signed int v2; // ebx@1
|
|
642 //signed int v3; // ecx@2
|
|
643 int v4; // eax@5
|
|
644 signed int v5; // esi@5
|
|
645 //Player *v6; // ecx@5
|
|
646 //signed int v7; // edx@5
|
|
647 GUIWindow *v8; // esi@10
|
|
648 unsigned int v9; // eax@12
|
|
649 int v10; // esi@31
|
|
650 int v11; // edi@31
|
|
651 int v12; // esi@32
|
|
652 __int16 v13; // bp@32
|
|
653 int v14; // edx@32
|
|
654 GUIWindow *v15; // eax@32
|
|
655 int v16; // eax@32
|
|
656 int v17; // eax@33
|
|
657 int v18; // eax@34
|
|
658 int v19; // eax@35
|
|
659 __int16 v20; // ax@37
|
|
660 __int16 v21; // ax@76
|
|
661 __int16 v22; // ax@107
|
|
662 __int16 v23; // ax@132
|
|
663 __int16 v24; // ax@163
|
|
664 int v25; // esi@190
|
|
665 __int16 v26; // ax@190
|
|
666 char v27; // zf@190
|
|
667 Player *v28; // edi@192
|
|
668 int v29; // eax@204
|
|
669 void *v30; // esi@208
|
|
670 unsigned __int64 v31; // qax@208
|
|
671 signed int v32; // edi@209
|
|
672 int v33; // eax@210
|
|
673 unsigned int v34; // eax@211
|
|
674 Player *v35; // edi@227
|
|
675 signed int v36; // esi@227
|
|
676 int v37; // ecx@227
|
|
677 int v38; // esi@230
|
|
678 int v39; // edx@235
|
|
679 int v40; // edi@243
|
|
680 unsigned __int64 v41; // qax@243
|
|
681 void *v42; // eax@244
|
|
682 signed int v43; // edi@244
|
|
683 int v44; // edx@244
|
|
684 int v45; // eax@246
|
|
685 unsigned int v46; // eax@247
|
|
686 void *v47; // eax@250
|
|
687 signed int v48; // edi@250
|
|
688 int v49; // eax@252
|
|
689 int v50; // eax@256
|
|
690 unsigned int v51; // eax@257
|
|
691 void *v52; // eax@260
|
|
692 signed int v53; // edi@260
|
|
693 int v54; // eax@262
|
|
694 //signed int v55; // [sp+10h] [bp-10h]@1
|
|
695 int v56; // [sp+14h] [bp-Ch]@31
|
|
696
|
|
697 //v1 = 0;
|
|
698 //v2 = a1;
|
|
699 //v55 = a1;
|
|
700 if ( !pDialogueWindow->pNumPresenceButton )
|
|
701 return;
|
|
702 pRenderer->ClearZBuffer(0, 479);
|
|
703 //v3 = dword_F8B198;
|
|
704 if ( dialog_menu_id != HOUSE_DIALOGUE_MAIN)
|
|
705 {
|
|
706 v8 = window_SpeakInHouse;
|
|
707 }
|
|
708 //else
|
|
709 if (dialog_menu_id == HOUSE_DIALOGUE_MAIN)
|
|
710 {
|
|
711 if ( in_current_building_type == BildingType_Training )
|
|
712 {
|
777
|
713 if ( uMessageParam == HOUSE_DIALOGUE_TRAININGHALL_TRAIN )
|
775
|
714 {
|
|
715 v4 = 0;
|
|
716 v5 = 0;
|
|
717 //v6 = pPlayers[uActiveCharacter];
|
|
718 //v7 = pPlayers[uActiveCharacter]->uLevel;
|
|
719 if ( pPlayers[uActiveCharacter]->uLevel > 0 )
|
|
720 {
|
|
721 do
|
|
722 v4 += v5++ + 1;
|
|
723 while ( v5 < pPlayers[uActiveCharacter]->uLevel );
|
|
724 }
|
|
725 if (pPlayers[uActiveCharacter]->uLevel < pMaxLevelPerTrainingHallType[(unsigned int)window_SpeakInHouse->ptr_1C - 89] &&
|
|
726 (signed __int64)pPlayers[uActiveCharacter]->uExperience < 1000 * v4)
|
|
727 return;
|
|
728 }
|
|
729 pDialogueWindow->Release();
|
|
730 pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x159u, WINDOW_MainMenu, 0, 0);
|
|
731 pBtn_ExitCancel = pDialogueWindow->CreateButton(526, 445, 75, 33, 1, 0, 0x71u, 0, 0, pGlobalTXT_LocalizationStrings[74],// "End Conversation"
|
|
732 pIcons_LOD->GetTexture(uTextureID_BUTTDESC2), 0);
|
|
733 pDialogueWindow->CreateButton(8u, 8u, 0x1C2u, 0x140u, 1, 0, 0x51u, 0, 0, "", nullptr);
|
|
734 // LABEL_10:
|
|
735 //v3 = dword_F8B198;
|
|
736 v8 = window_SpeakInHouse;
|
|
737 }
|
|
738 //else
|
|
739 if ( in_current_building_type != BildingType_Training )
|
|
740 {
|
|
741 v8 = window_SpeakInHouse;
|
|
742 if ((in_current_building_type == BildingType_Stables || in_current_building_type == BildingType_Boats) &&
|
777
|
743 transport_schedule[transport_routes[(unsigned int)window_SpeakInHouse->ptr_1C - HOUSE_STABLES_HARMONDALE][uMessageParam - HOUSE_DIALOGUE_TRANSPORT_SCHEDULE_1]].pSchedule[pParty->uDaysPlayed % 7]
|
775
|
744 || in_current_building_type != BildingType_Temple || uMessageParam != BildingType_MindGuild )
|
|
745 {
|
|
746 //LABEL_9:
|
|
747 pDialogueWindow->Release();
|
|
748 pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x159u, WINDOW_MainMenu, 0, 0);
|
|
749 pBtn_ExitCancel = pDialogueWindow->CreateButton(526, 445, 75, 33, 1, 0, 0x71u, 0, 0, pGlobalTXT_LocalizationStrings[74],// "End Conversation"
|
|
750 pIcons_LOD->GetTexture(uTextureID_BUTTDESC2), 0);
|
|
751 pDialogueWindow->CreateButton(8u, 8u, 0x1C2u, 0x140u, 1, 0, 0x51u, 0, 0, "", nullptr);
|
|
752 // LABEL_10:
|
|
753 //v3 = dword_F8B198;
|
|
754 v8 = window_SpeakInHouse;
|
|
755 }
|
|
756 else if (uActiveCharacter)
|
|
757 {
|
|
758 if ( !pPlayers[uActiveCharacter]->_4B6FF9() )
|
|
759 return;
|
|
760 v8 = window_SpeakInHouse;
|
|
761 }
|
|
762 }
|
|
763 //LABEL_11:
|
|
764 dialog_menu_id = (HOUSE_DIALOGUE_MENU)uMessageParam;
|
|
765 if ( in_current_building_type < BildingType_19 )
|
|
766 {
|
|
767 v9 = pIcons_LOD->LoadTexture(off_4F03B8[in_current_building_type], TEXTURE_16BIT_PALETTE);
|
|
768 //v3 = dword_F8B198;
|
|
769 ShopTexture = &pIcons_LOD->pTextures[v9];
|
|
770 //LABEL_13:
|
|
771 v8 = window_SpeakInHouse;
|
|
772 }
|
|
773 }
|
|
774
|
|
775 //NEW
|
|
776 switch(in_current_building_type)
|
|
777 {
|
|
778 case 5:
|
|
779 case 6:
|
|
780 case 7:
|
|
781 case 8:
|
|
782 case 9:
|
|
783 case 10:
|
|
784 case 11:
|
|
785 case 12:
|
|
786 case 13:
|
|
787 case 14:
|
|
788 case 15:
|
|
789 case 16:
|
|
790 {
|
|
791 if ( (signed __int64)__PAIR__(
|
|
792 *(int *)&stru_AA1058[3].pSounds[8 * (unsigned int)v8->ptr_1C + 44472],
|
|
793 *(int *)&stru_AA1058[3].pSounds[8 * (unsigned int)v8->ptr_1C + 44468]) >= (signed __int64)pParty->uTimePlayed )
|
|
794 {
|
|
795 v32 = 0;
|
|
796 do
|
|
797 {
|
|
798 //v33 = *(&pParty->pPlayers[1].pInstalledBeacons[0].field_18 + 9 * (v32 + 12 * (unsigned int)v8->ptr_1C));
|
|
799 v33 = pParty->SpellBooksInGuilds[v8->par1C-139][v32].uItemID;
|
|
800 if ( v33 )
|
|
801 {
|
|
802 v34 = pIcons_LOD->LoadTexture(pItemsTable->pItems[v33].pIconName, TEXTURE_16BIT_PALETTE);
|
|
803 v8 = window_SpeakInHouse;
|
|
804 ItemsInShopTexture[v32] = &pIcons_LOD->pTextures[v34];
|
|
805 }
|
|
806 ++v32;
|
|
807 }
|
|
808 while ( v32 < 12 );
|
|
809 }
|
|
810 else
|
|
811 {
|
|
812 SpellBookGenerator();
|
|
813 v30 = window_SpeakInHouse->ptr_1C;
|
|
814 v31 = pParty->uTimePlayed
|
|
815 + (signed __int64)((double)(0xA8C000
|
|
816 //* (signed int)p2DEvents_minus1[26 * (unsigned int)ptr_507BC0->ptr_1C])
|
|
817 * (signed int)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].field_1C)
|
|
818 * 0.033333335);
|
|
819 *(int *)&stru_AA1058[3].pSounds[8 * (int)v30 + 44468] = v31;
|
|
820 *(int *)&stru_AA1058[3].pSounds[8 * (int)v30 + 44472] = HIDWORD(v31);
|
|
821 }
|
|
822 return;
|
|
823 break;
|
|
824 }
|
|
825 case 17:
|
|
826 {
|
|
827 if ( uMessageParam == 99 )
|
|
828 {
|
|
829 v10 = (int)((char *)v8->ptr_1C - 102);
|
|
830 v56 = v10;
|
|
831 v11 = 8 * v10 + 11325428;
|
|
832 if ( (signed __int64)__PAIR__(pParty->field_3C.field_0[2 * v10 + 1], pParty->field_3C.field_0[2 * v10]) >= (signed __int64)pParty->uTimePlayed )
|
|
833 {
|
|
834 v13 = 0;
|
|
835 }
|
|
836 else
|
|
837 {
|
|
838 v12 = v10;
|
|
839 v13 = 0;
|
|
840 pParty->field_75A[v12] = 0;
|
|
841 *(_QWORD *)v11 = (signed __int64)((double)(309657600 * (pParty->uCurrentMonth + 12i64 * pParty->uCurrentYear - 14015)) * 0.033333335);
|
|
842 v14 = rand() % 258;
|
|
843 v15 = window_SpeakInHouse;
|
|
844 pParty->field_750[v12] = v14 + 1;
|
|
845 v16 = (int)((char *)v15->ptr_1C - 102);
|
|
846 if ( v16 )
|
|
847 {
|
|
848 v17 = v16 - 1;
|
|
849 if ( v17 )
|
|
850 {
|
|
851 v18 = v17 - 1;
|
|
852 if ( v18 )
|
|
853 {
|
|
854 v19 = v18 - 1;
|
|
855 if ( v19 )
|
|
856 {
|
|
857 if ( v19 == 1 )
|
|
858 {
|
|
859 while ( 1 )
|
|
860 {
|
|
861 v20 = pParty->field_750[v12];
|
|
862 if ( (unsigned __int16)v20 < 0x73u || (unsigned __int16)v20 > 0x84u )
|
|
863 {
|
|
864 if ( ((unsigned __int16)v20 < 0xE8u || (unsigned __int16)v20 > 0xF9u)
|
|
865 && ((unsigned __int16)v20 < 0x85u || (unsigned __int16)v20 > 0x96u)
|
|
866 && ((unsigned __int16)v20 < 0x97u || (unsigned __int16)v20 > 0xBAu)
|
|
867 && ((unsigned __int16)v20 < 0xBEu || (unsigned __int16)v20 > 0xC0u)
|
|
868 && ((unsigned __int16)v20 < 0xC4u || (unsigned __int16)v20 > 0xC6u)
|
|
869 && ((unsigned __int16)v20 < 0x2Bu || (unsigned __int16)v20 > 0x2Du)
|
|
870 && ((unsigned __int16)v20 < 0x6Du || (unsigned __int16)v20 > 0x6Fu)
|
|
871 && ((unsigned __int16)v20 < 0x46u || (unsigned __int16)v20 > 0x48u)
|
|
872 && ((unsigned __int16)v20 < 0x100u || (unsigned __int16)v20 > 0x102u)
|
|
873 && ((unsigned __int16)v20 < 0xD9u || (unsigned __int16)v20 > 0xDBu)
|
|
874 && ((unsigned __int16)v20 < 0xC7u || (unsigned __int16)v20 > 0xC9u)
|
|
875 && ((unsigned __int16)v20 < 0xE5u || (unsigned __int16)v20 > 0xE7u)
|
|
876 && ((unsigned __int16)v20 < 0xDFu || (unsigned __int16)v20 > 0xE1u)
|
|
877 && ((unsigned __int16)v20 < 0x5Bu || (unsigned __int16)v20 > 0x5Du)
|
|
878 && ((unsigned __int16)v20 < 0x49u || (unsigned __int16)v20 > 0x4Bu)
|
|
879 && ((unsigned __int16)v20 < 0xFDu || (unsigned __int16)v20 > 0xFFu)
|
|
880 && ((unsigned __int16)v20 < 0x61u || (unsigned __int16)v20 > 0x63u)
|
|
881 && ((unsigned __int16)v20 < 0x10u || (unsigned __int16)v20 > 0x12u) )
|
|
882 break;
|
|
883 }
|
|
884 pParty->field_750[v12] = rand() % 258 + 1;
|
|
885 }
|
|
886 }
|
|
887 }
|
|
888 else
|
|
889 {
|
|
890 while ( 1 )
|
|
891 {
|
|
892 v21 = pParty->field_750[v12];
|
|
893 if ( (unsigned __int16)v21 < 0x73u || (unsigned __int16)v21 > 0x84u )
|
|
894 {
|
|
895 if ( ((unsigned __int16)v21 < 0xE8u || (unsigned __int16)v21 > 0xF9u)
|
|
896 && ((unsigned __int16)v21 < 0x85u || (unsigned __int16)v21 > 0x96u)
|
|
897 && ((unsigned __int16)v21 < 0x97u || (unsigned __int16)v21 > 0xBAu)
|
|
898 && ((unsigned __int16)v21 < 0xBEu || (unsigned __int16)v21 > 0xC0u)
|
|
899 && ((unsigned __int16)v21 < 0xC4u || (unsigned __int16)v21 > 0xC6u)
|
|
900 && ((unsigned __int16)v21 < 0x2Bu || (unsigned __int16)v21 > 0x2Du)
|
|
901 && ((unsigned __int16)v21 < 0x5Eu || (unsigned __int16)v21 > 0x60u)
|
|
902 && ((unsigned __int16)v21 < 0x43u || (unsigned __int16)v21 > 0x45u)
|
|
903 && ((unsigned __int16)v21 < 0x4Fu || (unsigned __int16)v21 > 0x51u)
|
|
904 && ((unsigned __int16)v21 < 0xC1u || (unsigned __int16)v21 > 0xC3u)
|
|
905 && ((unsigned __int16)v21 < 0x13u || (unsigned __int16)v21 > 0x15u)
|
|
906 && ((unsigned __int16)v21 < 0xFDu || (unsigned __int16)v21 > 0xFFu)
|
|
907 && ((unsigned __int16)v21 < 0x61u || (unsigned __int16)v21 > 0x63u)
|
|
908 && ((unsigned __int16)v21 < 0x6Au || (unsigned __int16)v21 > 0x6Cu) )
|
|
909 break;
|
|
910 }
|
|
911 pParty->field_750[v12] = rand() % 258 + 1;
|
|
912 }
|
|
913 }
|
|
914 }
|
|
915 else
|
|
916 {
|
|
917 while ( 1 )
|
|
918 {
|
|
919 v22 = pParty->field_750[v12];
|
|
920 if ( (unsigned __int16)v22 < 0x73u || (unsigned __int16)v22 > 0x84u )
|
|
921 {
|
|
922 if ( ((unsigned __int16)v22 < 0xE8u || (unsigned __int16)v22 > 0xF9u)
|
|
923 && ((unsigned __int16)v22 < 0x85u || (unsigned __int16)v22 > 0x96u)
|
|
924 && ((unsigned __int16)v22 < 0x97u || (unsigned __int16)v22 > 0xBAu)
|
|
925 && ((unsigned __int16)v22 < 0xBEu || (unsigned __int16)v22 > 0xC0u)
|
|
926 && ((unsigned __int16)v22 < 0xC4u || (unsigned __int16)v22 > 0xC6u)
|
|
927 && ((unsigned __int16)v22 < 0x2Bu || (unsigned __int16)v22 > 0x2Du)
|
|
928 && ((unsigned __int16)v22 < 0x31u || (unsigned __int16)v22 > 0x33u)
|
|
929 && ((unsigned __int16)v22 < 0x34u || (unsigned __int16)v22 > 0x36u)
|
|
930 && ((unsigned __int16)v22 < 0xFDu || (unsigned __int16)v22 > 0xFFu)
|
|
931 && ((unsigned __int16)v22 < 0x61u || (unsigned __int16)v22 > 0x63u)
|
|
932 && ((unsigned __int16)v22 < 0x1Cu || (unsigned __int16)v22 > 0x1Eu) )
|
|
933 break;
|
|
934 }
|
|
935 pParty->field_750[v12] = rand() % 258 + 1;
|
|
936 }
|
|
937 }
|
|
938 }
|
|
939 else
|
|
940 {
|
|
941 while ( 1 )
|
|
942 {
|
|
943 v23 = pParty->field_750[v12];
|
|
944 if ( (unsigned __int16)v23 < 0x73u || (unsigned __int16)v23 > 0x84u )
|
|
945 {
|
|
946 if ( ((unsigned __int16)v23 < 0xE8u || (unsigned __int16)v23 > 0xF9u)
|
|
947 && ((unsigned __int16)v23 < 0x85u || (unsigned __int16)v23 > 0x96u)
|
|
948 && ((unsigned __int16)v23 < 0x97u || (unsigned __int16)v23 > 0xBAu)
|
|
949 && ((unsigned __int16)v23 < 0xBEu || (unsigned __int16)v23 > 0xC0u)
|
|
950 && ((unsigned __int16)v23 < 0xC4u || (unsigned __int16)v23 > 0xC6u)
|
|
951 && ((unsigned __int16)v23 < 0x2Bu || (unsigned __int16)v23 > 0x2Du)
|
|
952 && ((unsigned __int16)v23 < 0x52u || (unsigned __int16)v23 > 0x54u)
|
|
953 && ((unsigned __int16)v23 < 4u || (unsigned __int16)v23 > 6u)
|
|
954 && ((unsigned __int16)v23 < 0x37u || (unsigned __int16)v23 > 0x39u)
|
|
955 && ((unsigned __int16)v23 < 0x3Au || (unsigned __int16)v23 > 0x3Cu)
|
|
956 && ((unsigned __int16)v23 < 0x3Du || (unsigned __int16)v23 > 0x3Fu)
|
|
957 && ((unsigned __int16)v23 < 0xFDu || (unsigned __int16)v23 > 0xFFu)
|
|
958 && ((unsigned __int16)v23 < 0x61u || (unsigned __int16)v23 > 0x63u)
|
|
959 && ((unsigned __int16)v23 < 0xCDu || (unsigned __int16)v23 > 0xCFu) )
|
|
960 break;
|
|
961 }
|
|
962 pParty->field_750[v12] = rand() % 258 + 1;
|
|
963 }
|
|
964 }
|
|
965 }
|
|
966 else
|
|
967 {
|
|
968 while ( 1 )
|
|
969 {
|
|
970 v24 = pParty->field_750[v12];
|
|
971 if ( (unsigned __int16)v24 < 0x73u || (unsigned __int16)v24 > 0x84u )
|
|
972 {
|
|
973 if ( ((unsigned __int16)v24 < 0xEBu || (unsigned __int16)v24 > 0xFCu)
|
|
974 && ((unsigned __int16)v24 < 0x85u || (unsigned __int16)v24 > 0x96u)
|
|
975 && ((unsigned __int16)v24 < 0x97u || (unsigned __int16)v24 > 0xBAu)
|
|
976 && ((unsigned __int16)v24 < 0xBEu || (unsigned __int16)v24 > 0xC0u)
|
|
977 && ((unsigned __int16)v24 < 0xC4u || (unsigned __int16)v24 > 0xC6u)
|
|
978 && ((unsigned __int16)v24 < 0x2Bu || (unsigned __int16)v24 > 0x2Du)
|
|
979 && ((unsigned __int16)v24 < 0xCDu || (unsigned __int16)v24 > 0xCFu)
|
|
980 && ((unsigned __int16)v24 < 0x5Eu || (unsigned __int16)v24 > 0x60u)
|
|
981 && ((unsigned __int16)v24 < 0xFDu || (unsigned __int16)v24 > 0xFFu)
|
|
982 && ((unsigned __int16)v24 < 0x6Du || (unsigned __int16)v24 > 0x6Fu)
|
|
983 && ((unsigned __int16)v24 < 0x61u || (unsigned __int16)v24 > 0x63u) )
|
|
984 break;
|
|
985 }
|
|
986 pParty->field_750[v12] = rand() % 258 + 1;
|
|
987 }
|
|
988 }
|
|
989 v10 = v56;
|
|
990 }
|
|
991 v25 = v10;
|
|
992 v26 = pParty->field_750[v25];
|
|
993 v27 = pParty->field_75A[v25] == v13;
|
|
994 word_F8B1A0 = pParty->field_750[v25];
|
|
995 if ( v27 )
|
|
996 {
|
|
997 //v1 = 0;
|
|
998 v27 = v26 == v13;
|
|
999 v29 = (int)pNPCTopics[351].pText;
|
|
1000 if ( v27 )
|
|
1001 v29 = (int)pNPCTopics[353].pText;
|
|
1002 dword_F8B1A4 = (char *)v29;
|
|
1003 }
|
|
1004 else
|
|
1005 {
|
|
1006 if ( v26 != v13 )
|
|
1007 {
|
|
1008 party_finds_gold(100 * pMonsterStats->pInfos[(unsigned __int16)v26].uLevel, 0);
|
|
1009 v28 = pParty->pPlayers;
|
|
1010 do
|
|
1011 {
|
|
1012 v28->SetVariable(VAR_Award, 86);
|
|
1013 ++v28;
|
|
1014 }
|
|
1015 while ( (signed int)v28 < (signed int)pParty->pHirelings );
|
|
1016 pParty->uNumBountiesCollected += 100 * pMonsterStats->pInfos[pParty->field_750[v25]].uLevel;
|
|
1017 pParty->field_750[v25] = v13;
|
|
1018 pParty->field_75A[v25] = v13;
|
|
1019 }
|
|
1020 //v1 = 0;
|
|
1021 dword_F8B1A4 = pNPCTopics[352].pText;
|
|
1022 }
|
|
1023 }
|
|
1024 else if ( uMessageParam == 100 )
|
|
1025 {
|
|
1026 pKeyActionMap->EnterText(1, 10, v8);
|
|
1027 }
|
|
1028 break;
|
|
1029 }
|
|
1030 case 22:
|
|
1031 {
|
|
1032 if ( dialog_menu_id >= 7 && dialog_menu_id <= 8 )
|
|
1033 pKeyActionMap->EnterText(1, 10, v8);
|
|
1034 return;
|
|
1035 break;
|
|
1036 }
|
|
1037 case 1:
|
|
1038 case 2:
|
|
1039 case 3:
|
|
1040 case 4:
|
|
1041 case 21:
|
|
1042 case 23:
|
|
1043 case 30:
|
|
1044 {
|
|
1045 break;
|
|
1046 }
|
|
1047 default:
|
|
1048 {
|
|
1049 return;
|
|
1050 break;
|
|
1051 }
|
|
1052 }
|
|
1053
|
|
1054 /*
|
|
1055 if ( in_current_building_type > BildingType_Tavern )
|
|
1056 {
|
|
1057 if ( in_current_building_type == BildingType_Bank )
|
|
1058 {
|
|
1059 if ( dialog_menu_id >= 7 && dialog_menu_id <= 8 )
|
|
1060 pKeyActionMap->EnterText(1, 10, v8);
|
|
1061 return;
|
|
1062 }
|
|
1063 if ( in_current_building_type != BildingType_Temple && in_current_building_type != BildingType_Training )
|
|
1064 return;
|
|
1065 }
|
|
1066 //else
|
|
1067 if ( in_current_building_type < BildingType_Tavern )
|
|
1068 {
|
|
1069 if (in_current_building_type <= 0)
|
|
1070 return;
|
|
1071 if ( in_current_building_type > BildingType_AlchemistShop )
|
|
1072 {
|
|
1073 if ( in_current_building_type <= BildingType_16 )
|
|
1074 {
|
|
1075 if ( (signed __int64)__PAIR__(
|
|
1076 *(int *)&stru_AA1058[3].pSounds[8 * (unsigned int)v8->ptr_1C + 44472],
|
|
1077 *(int *)&stru_AA1058[3].pSounds[8 * (unsigned int)v8->ptr_1C + 44468]) >= (signed __int64)pParty->uTimePlayed )
|
|
1078 {
|
|
1079 v32 = 0;
|
|
1080 do
|
|
1081 {
|
|
1082 //v33 = *(&pParty->pPlayers[1].pInstalledBeacons[0].field_18 + 9 * (v32 + 12 * (unsigned int)v8->ptr_1C));
|
|
1083 v33 = pParty->SpellBooksInGuilds[v8->par1C-139][v32].uItemID;
|
|
1084 if ( v33 )
|
|
1085 {
|
|
1086 v34 = pIcons_LOD->LoadTexture(pItemsTable->pItems[v33].pIconName, TEXTURE_16BIT_PALETTE);
|
|
1087 v8 = window_SpeakInHouse;
|
|
1088 ItemsInShopTexture[v32] = &pIcons_LOD->pTextures[v34];
|
|
1089 }
|
|
1090 ++v32;
|
|
1091 }
|
|
1092 while ( v32 < 12 );
|
|
1093 }
|
|
1094 else
|
|
1095 {
|
|
1096 SpellBookGenerator();
|
|
1097 v30 = window_SpeakInHouse->ptr_1C;
|
|
1098 v31 = pParty->uTimePlayed
|
|
1099 + (signed __int64)((double)(0xA8C000
|
|
1100 //* (signed int)p2DEvents_minus1[26 * (unsigned int)ptr_507BC0->ptr_1C])
|
|
1101 * (signed int)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].field_1C)
|
|
1102 * 0.033333335);
|
|
1103 *(int *)&stru_AA1058[3].pSounds[8 * (int)v30 + 44468] = v31;
|
|
1104 *(int *)&stru_AA1058[3].pSounds[8 * (int)v30 + 44472] = HIDWORD(v31);
|
|
1105 }
|
|
1106 return;
|
|
1107 }
|
|
1108 if ( in_current_building_type != BildingType_TownHall )
|
|
1109 return;
|
|
1110 if ( in_current_building_type == BildingType_TownHall )
|
|
1111 {
|
|
1112 if ( uMessageParam == 99 )
|
|
1113 {
|
|
1114 v10 = (int)((char *)v8->ptr_1C - 102);
|
|
1115 v56 = v10;
|
|
1116 v11 = 8 * v10 + 11325428;
|
|
1117 if ( (signed __int64)__PAIR__(pParty->field_3C.field_0[2 * v10 + 1], pParty->field_3C.field_0[2 * v10]) >= (signed __int64)pParty->uTimePlayed )
|
|
1118 {
|
|
1119 v13 = 0;
|
|
1120 }
|
|
1121 else
|
|
1122 {
|
|
1123 v12 = v10;
|
|
1124 v13 = 0;
|
|
1125 pParty->field_75A[v12] = 0;
|
|
1126 *(_QWORD *)v11 = (signed __int64)((double)(309657600 * (pParty->uCurrentMonth + 12i64 * pParty->uCurrentYear - 14015)) * 0.033333335);
|
|
1127 v14 = rand() % 258;
|
|
1128 v15 = window_SpeakInHouse;
|
|
1129 pParty->field_750[v12] = v14 + 1;
|
|
1130 v16 = (int)((char *)v15->ptr_1C - 102);
|
|
1131 if ( v16 )
|
|
1132 {
|
|
1133 v17 = v16 - 1;
|
|
1134 if ( v17 )
|
|
1135 {
|
|
1136 v18 = v17 - 1;
|
|
1137 if ( v18 )
|
|
1138 {
|
|
1139 v19 = v18 - 1;
|
|
1140 if ( v19 )
|
|
1141 {
|
|
1142 if ( v19 == 1 )
|
|
1143 {
|
|
1144 while ( 1 )
|
|
1145 {
|
|
1146 v20 = pParty->field_750[v12];
|
|
1147 if ( (unsigned __int16)v20 < 0x73u || (unsigned __int16)v20 > 0x84u )
|
|
1148 {
|
|
1149 if ( ((unsigned __int16)v20 < 0xE8u || (unsigned __int16)v20 > 0xF9u)
|
|
1150 && ((unsigned __int16)v20 < 0x85u || (unsigned __int16)v20 > 0x96u)
|
|
1151 && ((unsigned __int16)v20 < 0x97u || (unsigned __int16)v20 > 0xBAu)
|
|
1152 && ((unsigned __int16)v20 < 0xBEu || (unsigned __int16)v20 > 0xC0u)
|
|
1153 && ((unsigned __int16)v20 < 0xC4u || (unsigned __int16)v20 > 0xC6u)
|
|
1154 && ((unsigned __int16)v20 < 0x2Bu || (unsigned __int16)v20 > 0x2Du)
|
|
1155 && ((unsigned __int16)v20 < 0x6Du || (unsigned __int16)v20 > 0x6Fu)
|
|
1156 && ((unsigned __int16)v20 < 0x46u || (unsigned __int16)v20 > 0x48u)
|
|
1157 && ((unsigned __int16)v20 < 0x100u || (unsigned __int16)v20 > 0x102u)
|
|
1158 && ((unsigned __int16)v20 < 0xD9u || (unsigned __int16)v20 > 0xDBu)
|
|
1159 && ((unsigned __int16)v20 < 0xC7u || (unsigned __int16)v20 > 0xC9u)
|
|
1160 && ((unsigned __int16)v20 < 0xE5u || (unsigned __int16)v20 > 0xE7u)
|
|
1161 && ((unsigned __int16)v20 < 0xDFu || (unsigned __int16)v20 > 0xE1u)
|
|
1162 && ((unsigned __int16)v20 < 0x5Bu || (unsigned __int16)v20 > 0x5Du)
|
|
1163 && ((unsigned __int16)v20 < 0x49u || (unsigned __int16)v20 > 0x4Bu)
|
|
1164 && ((unsigned __int16)v20 < 0xFDu || (unsigned __int16)v20 > 0xFFu)
|
|
1165 && ((unsigned __int16)v20 < 0x61u || (unsigned __int16)v20 > 0x63u)
|
|
1166 && ((unsigned __int16)v20 < 0x10u || (unsigned __int16)v20 > 0x12u) )
|
|
1167 break;
|
|
1168 }
|
|
1169 pParty->field_750[v12] = rand() % 258 + 1;
|
|
1170 }
|
|
1171 }
|
|
1172 }
|
|
1173 else
|
|
1174 {
|
|
1175 while ( 1 )
|
|
1176 {
|
|
1177 v21 = pParty->field_750[v12];
|
|
1178 if ( (unsigned __int16)v21 < 0x73u || (unsigned __int16)v21 > 0x84u )
|
|
1179 {
|
|
1180 if ( ((unsigned __int16)v21 < 0xE8u || (unsigned __int16)v21 > 0xF9u)
|
|
1181 && ((unsigned __int16)v21 < 0x85u || (unsigned __int16)v21 > 0x96u)
|
|
1182 && ((unsigned __int16)v21 < 0x97u || (unsigned __int16)v21 > 0xBAu)
|
|
1183 && ((unsigned __int16)v21 < 0xBEu || (unsigned __int16)v21 > 0xC0u)
|
|
1184 && ((unsigned __int16)v21 < 0xC4u || (unsigned __int16)v21 > 0xC6u)
|
|
1185 && ((unsigned __int16)v21 < 0x2Bu || (unsigned __int16)v21 > 0x2Du)
|
|
1186 && ((unsigned __int16)v21 < 0x5Eu || (unsigned __int16)v21 > 0x60u)
|
|
1187 && ((unsigned __int16)v21 < 0x43u || (unsigned __int16)v21 > 0x45u)
|
|
1188 && ((unsigned __int16)v21 < 0x4Fu || (unsigned __int16)v21 > 0x51u)
|
|
1189 && ((unsigned __int16)v21 < 0xC1u || (unsigned __int16)v21 > 0xC3u)
|
|
1190 && ((unsigned __int16)v21 < 0x13u || (unsigned __int16)v21 > 0x15u)
|
|
1191 && ((unsigned __int16)v21 < 0xFDu || (unsigned __int16)v21 > 0xFFu)
|
|
1192 && ((unsigned __int16)v21 < 0x61u || (unsigned __int16)v21 > 0x63u)
|
|
1193 && ((unsigned __int16)v21 < 0x6Au || (unsigned __int16)v21 > 0x6Cu) )
|
|
1194 break;
|
|
1195 }
|
|
1196 pParty->field_750[v12] = rand() % 258 + 1;
|
|
1197 }
|
|
1198 }
|
|
1199 }
|
|
1200 else
|
|
1201 {
|
|
1202 while ( 1 )
|
|
1203 {
|
|
1204 v22 = pParty->field_750[v12];
|
|
1205 if ( (unsigned __int16)v22 < 0x73u || (unsigned __int16)v22 > 0x84u )
|
|
1206 {
|
|
1207 if ( ((unsigned __int16)v22 < 0xE8u || (unsigned __int16)v22 > 0xF9u)
|
|
1208 && ((unsigned __int16)v22 < 0x85u || (unsigned __int16)v22 > 0x96u)
|
|
1209 && ((unsigned __int16)v22 < 0x97u || (unsigned __int16)v22 > 0xBAu)
|
|
1210 && ((unsigned __int16)v22 < 0xBEu || (unsigned __int16)v22 > 0xC0u)
|
|
1211 && ((unsigned __int16)v22 < 0xC4u || (unsigned __int16)v22 > 0xC6u)
|
|
1212 && ((unsigned __int16)v22 < 0x2Bu || (unsigned __int16)v22 > 0x2Du)
|
|
1213 && ((unsigned __int16)v22 < 0x31u || (unsigned __int16)v22 > 0x33u)
|
|
1214 && ((unsigned __int16)v22 < 0x34u || (unsigned __int16)v22 > 0x36u)
|
|
1215 && ((unsigned __int16)v22 < 0xFDu || (unsigned __int16)v22 > 0xFFu)
|
|
1216 && ((unsigned __int16)v22 < 0x61u || (unsigned __int16)v22 > 0x63u)
|
|
1217 && ((unsigned __int16)v22 < 0x1Cu || (unsigned __int16)v22 > 0x1Eu) )
|
|
1218 break;
|
|
1219 }
|
|
1220 pParty->field_750[v12] = rand() % 258 + 1;
|
|
1221 }
|
|
1222 }
|
|
1223 }
|
|
1224 else
|
|
1225 {
|
|
1226 while ( 1 )
|
|
1227 {
|
|
1228 v23 = pParty->field_750[v12];
|
|
1229 if ( (unsigned __int16)v23 < 0x73u || (unsigned __int16)v23 > 0x84u )
|
|
1230 {
|
|
1231 if ( ((unsigned __int16)v23 < 0xE8u || (unsigned __int16)v23 > 0xF9u)
|
|
1232 && ((unsigned __int16)v23 < 0x85u || (unsigned __int16)v23 > 0x96u)
|
|
1233 && ((unsigned __int16)v23 < 0x97u || (unsigned __int16)v23 > 0xBAu)
|
|
1234 && ((unsigned __int16)v23 < 0xBEu || (unsigned __int16)v23 > 0xC0u)
|
|
1235 && ((unsigned __int16)v23 < 0xC4u || (unsigned __int16)v23 > 0xC6u)
|
|
1236 && ((unsigned __int16)v23 < 0x2Bu || (unsigned __int16)v23 > 0x2Du)
|
|
1237 && ((unsigned __int16)v23 < 0x52u || (unsigned __int16)v23 > 0x54u)
|
|
1238 && ((unsigned __int16)v23 < 4u || (unsigned __int16)v23 > 6u)
|
|
1239 && ((unsigned __int16)v23 < 0x37u || (unsigned __int16)v23 > 0x39u)
|
|
1240 && ((unsigned __int16)v23 < 0x3Au || (unsigned __int16)v23 > 0x3Cu)
|
|
1241 && ((unsigned __int16)v23 < 0x3Du || (unsigned __int16)v23 > 0x3Fu)
|
|
1242 && ((unsigned __int16)v23 < 0xFDu || (unsigned __int16)v23 > 0xFFu)
|
|
1243 && ((unsigned __int16)v23 < 0x61u || (unsigned __int16)v23 > 0x63u)
|
|
1244 && ((unsigned __int16)v23 < 0xCDu || (unsigned __int16)v23 > 0xCFu) )
|
|
1245 break;
|
|
1246 }
|
|
1247 pParty->field_750[v12] = rand() % 258 + 1;
|
|
1248 }
|
|
1249 }
|
|
1250 }
|
|
1251 else
|
|
1252 {
|
|
1253 while ( 1 )
|
|
1254 {
|
|
1255 v24 = pParty->field_750[v12];
|
|
1256 if ( (unsigned __int16)v24 < 0x73u || (unsigned __int16)v24 > 0x84u )
|
|
1257 {
|
|
1258 if ( ((unsigned __int16)v24 < 0xEBu || (unsigned __int16)v24 > 0xFCu)
|
|
1259 && ((unsigned __int16)v24 < 0x85u || (unsigned __int16)v24 > 0x96u)
|
|
1260 && ((unsigned __int16)v24 < 0x97u || (unsigned __int16)v24 > 0xBAu)
|
|
1261 && ((unsigned __int16)v24 < 0xBEu || (unsigned __int16)v24 > 0xC0u)
|
|
1262 && ((unsigned __int16)v24 < 0xC4u || (unsigned __int16)v24 > 0xC6u)
|
|
1263 && ((unsigned __int16)v24 < 0x2Bu || (unsigned __int16)v24 > 0x2Du)
|
|
1264 && ((unsigned __int16)v24 < 0xCDu || (unsigned __int16)v24 > 0xCFu)
|
|
1265 && ((unsigned __int16)v24 < 0x5Eu || (unsigned __int16)v24 > 0x60u)
|
|
1266 && ((unsigned __int16)v24 < 0xFDu || (unsigned __int16)v24 > 0xFFu)
|
|
1267 && ((unsigned __int16)v24 < 0x6Du || (unsigned __int16)v24 > 0x6Fu)
|
|
1268 && ((unsigned __int16)v24 < 0x61u || (unsigned __int16)v24 > 0x63u) )
|
|
1269 break;
|
|
1270 }
|
|
1271 pParty->field_750[v12] = rand() % 258 + 1;
|
|
1272 }
|
|
1273 }
|
|
1274 v10 = v56;
|
|
1275 }
|
|
1276 v25 = v10;
|
|
1277 v26 = pParty->field_750[v25];
|
|
1278 v27 = pParty->field_75A[v25] == v13;
|
|
1279 word_F8B1A0 = pParty->field_750[v25];
|
|
1280 if ( v27 )
|
|
1281 {
|
|
1282 //v1 = 0;
|
|
1283 v27 = v26 == v13;
|
|
1284 v29 = (int)pNPCTopics[351].pText;
|
|
1285 if ( v27 )
|
|
1286 v29 = (int)pNPCTopics[353].pText;
|
|
1287 dword_F8B1A4 = (char *)v29;
|
|
1288 }
|
|
1289 else
|
|
1290 {
|
|
1291 if ( v26 != v13 )
|
|
1292 {
|
|
1293 party_finds_gold(100 * pMonsterStats->pInfos[(unsigned __int16)v26].uLevel, 0);
|
|
1294 v28 = pParty->pPlayers;
|
|
1295 do
|
|
1296 {
|
|
1297 v28->SetVariable(VAR_Award, 86);
|
|
1298 ++v28;
|
|
1299 }
|
|
1300 while ( (signed int)v28 < (signed int)pParty->pHirelings );
|
|
1301 pParty->uNumBountiesCollected += 100 * pMonsterStats->pInfos[pParty->field_750[v25]].uLevel;
|
|
1302 pParty->field_750[v25] = v13;
|
|
1303 pParty->field_75A[v25] = v13;
|
|
1304 }
|
|
1305 //v1 = 0;
|
|
1306 dword_F8B1A4 = pNPCTopics[352].pText;
|
|
1307 }
|
|
1308 }
|
|
1309 else if ( uMessageParam == 100 )
|
|
1310 {
|
|
1311 pKeyActionMap->EnterText(1, 10, v8);
|
|
1312 }
|
|
1313 }
|
|
1314 }
|
|
1315 }
|
|
1316 */
|
|
1317
|
|
1318
|
|
1319 //LABEL_196:
|
|
1320 switch ( uMessageParam )
|
|
1321 {
|
|
1322 case 96:
|
|
1323 {
|
|
1324 pDialogueWindow->eWindowType = WINDOW_MainMenu;
|
|
1325 UI_CreateEndConversationButton();
|
|
1326 FillAviableSkillsToTeach(in_current_building_type);
|
|
1327 break;
|
|
1328 }
|
|
1329 case 101:
|
|
1330 {
|
|
1331 pDialogueWindow->eWindowType = WINDOW_MainMenu;
|
|
1332 UI_CreateEndConversationButton();
|
|
1333 sub_4B3A72(in_current_building_type);
|
|
1334 break;
|
|
1335 }
|
|
1336 case 102:
|
|
1337 case 103:
|
|
1338 {
|
|
1339 dialog_menu_id = (HOUSE_DIALOGUE_MENU)uMessageParam;
|
|
1340 break;
|
|
1341 }
|
|
1342 case 104:
|
|
1343 {
|
|
1344 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
|
|
1345 {
|
|
1346 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)29;
|
|
1347 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v1;
|
|
1348 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = v1;
|
|
1349 ++pMessageQueue_50CBD0->uNumMessages;
|
|
1350 }*/
|
|
1351 pMessageQueue_50CBD0->AddMessage(UIMSG_PlayArcomage, 0, 0);
|
|
1352 dialog_menu_id = HOUSE_DIALOGUE_TAVERN_ARCOMAGE_RESULT;
|
|
1353 break;
|
|
1354 }
|
|
1355 case 2:
|
|
1356 case 95:
|
|
1357 {
|
|
1358 if ( pParty->field_3C.field_50[(unsigned int)v8->ptr_1C] < (signed __int64)pParty->uTimePlayed )
|
|
1359 {
|
|
1360 GenerateStandartShopItems();
|
|
1361 GenerateSpecialShopItems();
|
|
1362 v8 = window_SpeakInHouse;
|
|
1363 v40 = window_SpeakInHouse->par1C;
|
|
1364 //v3 = dword_F8B198;
|
|
1365 v41 = pParty->uTimePlayed
|
|
1366 //+ (signed __int64)((double)(11059200 * (signed int)p2DEvents_minus1[26 * (unsigned int)ptr_507BC0->ptr_1C])
|
|
1367 + (signed __int64)((double)(11059200 * (signed int)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].field_1C)
|
|
1368 * 0.033333335);
|
|
1369 pParty->field_3C.field_50[v40] = v41;
|
|
1370 }
|
|
1371 v42 = v8->ptr_1C;
|
|
1372 v43 = 0;
|
|
1373 //v44 = p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C];
|
|
1374 v44 = p2DEvents[(unsigned int)v8->ptr_1C - 1].uType;
|
|
1375 if ( uMessageParam == 2 )
|
|
1376 {
|
|
1377 if ( uItemsAmountPerShopType[v44] )
|
|
1378 {
|
|
1379 do
|
|
1380 {
|
|
1381 v45 = pParty->StandartItemsInShops[(int)v42][v43].uItemID;
|
|
1382 if ( v45 )
|
|
1383 {
|
|
1384 v46 = pIcons_LOD->LoadTexture(pItemsTable->pItems[v45].pIconName, TEXTURE_16BIT_PALETTE);
|
|
1385 //v3 = dword_F8B198;
|
|
1386 v8 = window_SpeakInHouse;
|
|
1387 ItemsInShopTexture[v43] = &pIcons_LOD->pTextures[v46];
|
|
1388 }
|
|
1389 v42 = v8->ptr_1C;
|
|
1390 ++v43;
|
|
1391 }
|
|
1392 //while ( v43 < (unsigned __int8)_4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] );
|
|
1393 while ( v43 < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] );
|
|
1394 }
|
|
1395 if ( in_current_building_type == BildingType_WeaponShop )
|
|
1396 {
|
|
1397 v47 = v8->ptr_1C;
|
|
1398 v48 = 0;
|
|
1399 //if ( _4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] )
|
|
1400 if ( uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] )
|
|
1401 {
|
|
1402 do
|
|
1403 {
|
|
1404 // if ( pParty->field_777C[9 * (v48 + 12 * (int)v47)] )
|
|
1405 if ( pParty->StandartItemsInShops[(int)v47][v48].uItemID)
|
|
1406 {
|
|
1407 v49 = rand();
|
|
1408 v8 = window_SpeakInHouse;
|
|
1409 word_F8B158[v48] = v49 % (300 - ItemsInShopTexture[v48]->uTextureHeight);
|
|
1410 }
|
|
1411 v47 = v8->ptr_1C;
|
|
1412 ++v48;
|
|
1413 }
|
|
1414 //while ( v48 < (unsigned __int8)_4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] );
|
|
1415 while ( v48 < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] );
|
|
1416 }
|
|
1417 }
|
|
1418 }
|
|
1419 if ( uMessageParam == 95 )
|
|
1420 {
|
|
1421 if ( uItemsAmountPerShopType[v44] )
|
|
1422 {
|
|
1423 do
|
|
1424 {
|
|
1425 //v50 = pParty->field_C59C[9 * (v43 + 12 * (int)v42) + 724];
|
|
1426 v50=pParty->SpecialItemsInShops[(unsigned int)v42][(signed int)v43].uItemID;
|
|
1427 if ( v50 )
|
|
1428 {
|
|
1429 v51 = pIcons_LOD->LoadTexture(pItemsTable->pItems[v50].pIconName, TEXTURE_16BIT_PALETTE);
|
|
1430 //v3 = dword_F8B198;
|
|
1431 v8 = window_SpeakInHouse;
|
|
1432 ItemsInShopTexture[v43] = &pIcons_LOD->pTextures[v51];
|
|
1433 }
|
|
1434 v42 = v8->ptr_1C;
|
|
1435 ++v43;
|
|
1436 }
|
|
1437 //while ( v43 < (unsigned __int8)_4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] );
|
|
1438 while ( v43 < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] );
|
|
1439 }
|
|
1440 if ( in_current_building_type == BildingType_WeaponShop )
|
|
1441 {
|
|
1442 v52 = v8->ptr_1C;
|
|
1443 v53 = 0;
|
|
1444 //if ( _4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] )
|
|
1445 if ( uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] )
|
|
1446 {
|
|
1447 do
|
|
1448 {
|
|
1449 // if ( pParty->field_C59C[9 * (v53 + 12 * (int)v52) + 724] )
|
|
1450 if (pParty->SpecialItemsInShops[(unsigned int)v52][v53].uItemID)
|
|
1451 {
|
|
1452 v54 = rand();
|
|
1453 v8 = window_SpeakInHouse;
|
|
1454 word_F8B158[v53] = v54 % (300 - ItemsInShopTexture[v53]->uTextureHeight);
|
|
1455 }
|
|
1456 v52 = v8->ptr_1C;
|
|
1457 ++v53;
|
|
1458 }
|
|
1459 //while ( v53 < (unsigned __int8)_4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] );
|
|
1460 while ( v53 < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType ] );
|
|
1461 }
|
|
1462 }
|
|
1463 }
|
|
1464 break;
|
|
1465 }
|
|
1466 case 3:
|
|
1467 case 4:
|
|
1468 case 5:
|
|
1469 {
|
|
1470 dialog_menu_id = (HOUSE_DIALOGUE_MENU)uMessageParam;
|
|
1471 sub_421B2C_PlaceInInventory_or_DropPickedItem();
|
|
1472 break;
|
|
1473 }
|
|
1474 case 94:
|
|
1475 {
|
|
1476 pDialogueWindow->eWindowType = WINDOW_MainMenu;
|
|
1477 UI_CreateEndConversationButton();
|
|
1478 sub_4B3AD4(in_current_building_type);
|
|
1479 break;
|
|
1480 }
|
|
1481 default:
|
|
1482 {
|
|
1483 if( uMessageParam >= 36 && uMessageParam <= 72 )
|
|
1484 {
|
|
1485 v35 = pPlayers[uActiveCharacter];
|
|
1486 //v36 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (unsigned int)v8->ptr_1C] * 500.0);
|
|
1487 v36 = (signed __int64)(p2DEvents[(unsigned int)v8->ptr_1C - 1].flt_24 * 500.0);
|
|
1488 v37 = v36 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100;
|
|
1489 if ( v37 < v36 / 3 )
|
|
1490 v37 = v36 / 3;
|
|
1491
|
|
1492 __debugbreak();
|
|
1493 //pSkillAvailabilityPerClass[8 + v58->uClass][4 + v23]
|
|
1494 // or
|
|
1495 //byte_4ED970_skill_learn_ability_by_class_table[v58->uClass][v23 - 36]
|
|
1496 // or
|
|
1497 //byte_4ED970_skill_learn_ability_by_class_table[v58->uClass - 1][v23 + 1]
|
|
1498
|
|
1499 //if (false)
|
|
1500 if(byte_4ED970_skill_learn_ability_by_class_table[v35->classType][uMessageParam-36])
|
|
1501 //if ( *(&byte_4ED94C[37 * v35->uClass] + v55) )
|
|
1502 {
|
|
1503 v38 = (int)(&v35->uIntelligence + uMessageParam);
|
|
1504 if ( !*(short *)v38 )
|
|
1505 {
|
|
1506 if ( pParty->uNumGold < v37 )
|
|
1507 {
|
|
1508 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u);
|
|
1509 if ( in_current_building_type == BildingType_Training || in_current_building_type == BildingType_Tavern )
|
|
1510 v39 = 4;
|
|
1511 else
|
|
1512 v39 = 2;
|
|
1513 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)v39);
|
|
1514 }
|
|
1515 else
|
|
1516 {
|
|
1517 Party::TakeGold(v37);
|
|
1518 dword_F8B1E4 = 1;
|
|
1519 *(short *)v38 = 1;
|
|
1520 v35->PlaySound(SPEECH_78, 0);
|
|
1521 }
|
|
1522 }
|
|
1523 }
|
|
1524 }
|
|
1525 break;
|
|
1526 }
|
|
1527 }
|
|
1528 /*
|
|
1529 if ( uMessageParam != 95 && uMessageParam != 2 )
|
|
1530 {
|
|
1531 if ( uMessageParam == 3 )
|
|
1532 {
|
|
1533 dialog_menu_id = 3;
|
|
1534 }
|
|
1535 else
|
|
1536 {
|
|
1537 if ( uMessageParam == 4 )
|
|
1538 {
|
|
1539 dialog_menu_id = 4;
|
|
1540 }
|
|
1541 else
|
|
1542 {
|
|
1543 if ( uMessageParam != 5 )
|
|
1544 {
|
|
1545 if ( uMessageParam > 35 )
|
|
1546 {
|
|
1547 if ( uMessageParam <= 72 )
|
|
1548 {
|
|
1549 v35 = pPlayers[uActiveCharacter];
|
|
1550 //v36 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (unsigned int)v8->ptr_1C] * 500.0);
|
|
1551 v36 = (signed __int64)(p2DEvents[(unsigned int)v8->ptr_1C - 1].flt_24 * 500.0);
|
|
1552 v37 = v36 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100;
|
|
1553 if ( v37 < v36 / 3 )
|
|
1554 v37 = v36 / 3;
|
|
1555
|
|
1556 __debugbreak();
|
|
1557 //pSkillAvailabilityPerClass[8 + v58->uClass][4 + v23]
|
|
1558 // or
|
|
1559 //byte_4ED970_skill_learn_ability_by_class_table[v58->uClass][v23 - 36]
|
|
1560 // or
|
|
1561 //byte_4ED970_skill_learn_ability_by_class_table[v58->uClass - 1][v23 + 1]
|
|
1562
|
|
1563 if (false)
|
|
1564 //if ( *(&byte_4ED94C[37 * v35->uClass] + v55) )
|
|
1565 {
|
|
1566 v38 = (int)(&v35->uIntelligence + uMessageParam);
|
|
1567 if ( !*(short *)v38 )
|
|
1568 {
|
|
1569 if ( pParty->uNumGold < v37 )
|
|
1570 {
|
|
1571 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u);
|
|
1572 if ( in_current_building_type == BildingType_Training || in_current_building_type == BildingType_Tavern )
|
|
1573 v39 = 4;
|
|
1574 else
|
|
1575 v39 = 2;
|
|
1576 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, v39);
|
|
1577 }
|
|
1578 else
|
|
1579 {
|
|
1580 Party::TakeGold(v37);
|
|
1581 dword_F8B1E4 = 1;
|
|
1582 *(short *)v38 = 1;
|
|
1583 v35->PlaySound(SPEECH_78, 0);
|
|
1584 }
|
|
1585 }
|
|
1586 }
|
|
1587 }
|
|
1588 else
|
|
1589 {
|
|
1590 if ( uMessageParam == 94 )
|
|
1591 {
|
|
1592 pDialogueWindow->eWindowType = WINDOW_MainMenu;
|
|
1593 UI_CreateEndConversationButton();
|
|
1594 sub_4B3AD4(in_current_building_type);
|
|
1595 }
|
|
1596 }
|
|
1597 }
|
|
1598 return;
|
|
1599 }
|
|
1600 dialog_menu_id = 5;
|
|
1601 }
|
|
1602 }
|
|
1603 sub_421B2C_PlaceInInventory_or_DropPickedItem();
|
|
1604 return;
|
|
1605 }
|
|
1606 if ( pParty->field_3C.field_50[(unsigned int)v8->ptr_1C] < (signed __int64)pParty->uTimePlayed )
|
|
1607 {
|
|
1608 GenerateStandartShopItems();
|
|
1609 GenerateSpecialShopItems();
|
|
1610 v8 = window_SpeakInHouse;
|
|
1611 v40 = window_SpeakInHouse->par1C;
|
|
1612 //v3 = dword_F8B198;
|
|
1613 v41 = pParty->uTimePlayed
|
|
1614 //+ (signed __int64)((double)(11059200 * (signed int)p2DEvents_minus1[26 * (unsigned int)ptr_507BC0->ptr_1C])
|
|
1615 + (signed __int64)((double)(11059200 * (signed int)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].field_1C)
|
|
1616 * 0.033333335);
|
|
1617 pParty->field_3C.field_50[v40] = v41;
|
|
1618
|
|
1619 }
|
|
1620 v42 = v8->ptr_1C;
|
|
1621 v43 = 0;
|
|
1622 //v44 = p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C];
|
|
1623 v44 = p2DEvents[(unsigned int)v8->ptr_1C - 1].uType;
|
|
1624 if ( uMessageParam == 2 )
|
|
1625 {
|
|
1626 if ( uItemsAmountPerShopType[v44] )
|
|
1627 {
|
|
1628 do
|
|
1629 {
|
|
1630 v45 = pParty->StandartItemsInShops[(int)v42][v43].uItemID;
|
|
1631 if ( v45 )
|
|
1632 {
|
|
1633 v46 = pIcons_LOD->LoadTexture(pItemsTable->pItems[v45].pIconName, TEXTURE_16BIT_PALETTE);
|
|
1634 //v3 = dword_F8B198;
|
|
1635 v8 = window_SpeakInHouse;
|
|
1636 ItemsInShopTexture[v43] = &pIcons_LOD->pTextures[v46];
|
|
1637 }
|
|
1638 v42 = v8->ptr_1C;
|
|
1639 ++v43;
|
|
1640 }
|
|
1641 //while ( v43 < (unsigned __int8)_4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] );
|
|
1642 while ( v43 < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] );
|
|
1643 }
|
|
1644 if ( in_current_building_type == BildingType_WeaponShop )
|
|
1645 {
|
|
1646 v47 = v8->ptr_1C;
|
|
1647 v48 = 0;
|
|
1648 //if ( _4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] )
|
|
1649 if ( uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] )
|
|
1650 {
|
|
1651 do
|
|
1652 {
|
|
1653 // if ( pParty->field_777C[9 * (v48 + 12 * (int)v47)] )
|
|
1654 if ( pParty->StandartItemsInShops[(int)v47][v48].uItemID);
|
|
1655 {
|
|
1656 v49 = rand();
|
|
1657 v8 = window_SpeakInHouse;
|
|
1658 word_F8B158[v48] = v49 % (300 - ItemsInShopTexture[v48]->uTextureHeight);
|
|
1659 }
|
|
1660 v47 = v8->ptr_1C;
|
|
1661 ++v48;
|
|
1662 }
|
|
1663 //while ( v48 < (unsigned __int8)_4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] );
|
|
1664 while ( v48 < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] );
|
|
1665 }
|
|
1666 }
|
|
1667 }
|
|
1668 if ( uMessageParam == 95 )
|
|
1669 {
|
|
1670 if ( uItemsAmountPerShopType[v44] )
|
|
1671 {
|
|
1672 do
|
|
1673 {
|
|
1674 //v50 = pParty->field_C59C[9 * (v43 + 12 * (int)v42) + 724];
|
|
1675 v50=pParty->SpecialItemsInShops[(unsigned int)v42][(signed int)v43].uItemID;
|
|
1676 if ( v50 )
|
|
1677 {
|
|
1678 v51 = pIcons_LOD->LoadTexture(pItemsTable->pItems[v50].pIconName, TEXTURE_16BIT_PALETTE);
|
|
1679 //v3 = dword_F8B198;
|
|
1680 v8 = window_SpeakInHouse;
|
|
1681 ItemsInShopTexture[v43] = &pIcons_LOD->pTextures[v51];
|
|
1682 }
|
|
1683 v42 = v8->ptr_1C;
|
|
1684 ++v43;
|
|
1685 }
|
|
1686 //while ( v43 < (unsigned __int8)_4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] );
|
|
1687 while ( v43 < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] );
|
|
1688 }
|
|
1689 if ( in_current_building_type == BildingType_WeaponShop )
|
|
1690 {
|
|
1691 v52 = v8->ptr_1C;
|
|
1692 v53 = 0;
|
|
1693 //if ( _4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] )
|
|
1694 if ( uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] )
|
|
1695 {
|
|
1696 do
|
|
1697 {
|
|
1698 // if ( pParty->field_C59C[9 * (v53 + 12 * (int)v52) + 724] )
|
|
1699 if (pParty->SpecialItemsInShops[(unsigned int)v52][v53].uItemID)
|
|
1700 {
|
|
1701 v54 = rand();
|
|
1702 v8 = window_SpeakInHouse;
|
|
1703 word_F8B158[v53] = v54 % (300 - ItemsInShopTexture[v53]->uTextureHeight);
|
|
1704 }
|
|
1705 v52 = v8->ptr_1C;
|
|
1706 ++v53;
|
|
1707 }
|
|
1708 //while ( v53 < (unsigned __int8)_4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] );
|
|
1709 while ( v53 < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType ] );
|
|
1710 }
|
|
1711 }
|
|
1712 }
|
|
1713 */
|
|
1714 }
|
|
1715
|
|
1716
|
|
1717
|
|
1718 //----- (004B6943) --------------------------------------------------------
|
|
1719 void __cdecl TravelByTransport()
|
|
1720 {
|
|
1721 GUIWindow *v0; // ebx@1
|
|
1722 Player *v1; // esi@1
|
|
1723 signed int v2; // edi@1
|
|
1724 unsigned int v3; // eax@1
|
|
1725 signed int v4; // ebx@1
|
|
1726 stru365_travel_info *v5; // esi@7
|
777
|
1727 //int v6; // eax@9
|
|
1728 //int v7; // eax@9
|
|
1729 //int v8; // eax@12
|
|
1730 //int v9; // edi@12
|
|
1731 //int v10; // edx@12
|
775
|
1732 int v11; // ecx@12
|
|
1733 signed int v12; // esi@13
|
|
1734 signed int v13; // edi@14
|
|
1735 DWORD v14; // eax@26
|
|
1736 DWORD v15; // edi@26
|
|
1737 GUIWindow *v16; // ebx@36
|
|
1738 int v17; // esi@36
|
|
1739 int v18; // eax@36
|
|
1740 int v19; // ecx@36
|
|
1741 int v20; // esi@36
|
|
1742 int v21; // eax@36
|
|
1743 void *v22; // eax@39
|
|
1744 int v23; // esi@39
|
|
1745 GUIButton *v24; // ebx@39
|
|
1746 signed int v25; // eax@41
|
|
1747 //int v26; // esi@44
|
777
|
1748 //const char *v27; // eax@46
|
775
|
1749 char *v28; // eax@62
|
|
1750 int v29; // eax@62
|
|
1751 unsigned int v30; // ecx@62
|
|
1752 char *v31; // eax@63
|
|
1753 MapInfo v32; // [sp-3Ch] [bp-2CCh]@62
|
|
1754 /*int v33; // [sp-38h] [bp-2C8h]@62
|
|
1755 int v34; // [sp-34h] [bp-2C4h]@62
|
|
1756 int v35; // [sp-30h] [bp-2C0h]@62
|
|
1757 int v36; // [sp-2Ch] [bp-2BCh]@62
|
|
1758 int v37; // [sp-28h] [bp-2B8h]@62
|
|
1759 int v38; // [sp-24h] [bp-2B4h]@62
|
|
1760 int v39; // [sp-20h] [bp-2B0h]@62
|
|
1761 int v40; // [sp-1Ch] [bp-2ACh]@62
|
|
1762 int v41; // [sp-18h] [bp-2A8h]@62
|
|
1763 int v42; // [sp-14h] [bp-2A4h]@62
|
|
1764 char *v43; // [sp-10h] [bp-2A0h]@62
|
|
1765 char *v44; // [sp-Ch] [bp-29Ch]@62
|
|
1766 unsigned int v45; // [sp-8h] [bp-298h]@62
|
|
1767 char *v46; // [sp-4h] [bp-294h]@62
|
|
1768 const char *v47[5]; // [sp+0h] [bp-290h]@7*/
|
777
|
1769 char v48[5][100]; // [sp+14h] [bp-27Ch]@37
|
|
1770 //char v49[100]; // [sp+78h] [bp-218h]@68
|
|
1771 //char v50[100]; // [sp+DCh] [bp-1B4h]@68
|
|
1772 //char v51[100]; // [sp+140h] [bp-150h]@68
|
|
1773 //char Dest[100]; // [sp+1A4h] [bp-ECh]@36
|
775
|
1774 GUIWindow v53; // [sp+208h] [bp-88h]@1
|
|
1775 int v54; // [sp+25Ch] [bp-34h]@36
|
|
1776 int v55; // [sp+260h] [bp-30h]@36
|
777
|
1777 //unsigned int v56; // [sp+264h] [bp-2Ch]@1
|
|
1778 //int v57; // [sp+268h] [bp-28h]@1
|
775
|
1779 int v58; // [sp+26Ch] [bp-24h]@36
|
777
|
1780 //GUIWindow *v59; // [sp+270h] [bp-20h]@1
|
775
|
1781 unsigned int v60; // [sp+274h] [bp-1Ch]@36
|
|
1782 //Player *v61; // [sp+278h] [bp-18h]@1
|
|
1783 int v62; // [sp+27Ch] [bp-14h]@36
|
|
1784 int v63; // [sp+280h] [bp-10h]@14
|
|
1785 char *a1; // [sp+284h] [bp-Ch]@37
|
|
1786 unsigned int s1; // [sp+288h] [bp-8h]@1
|
|
1787 int v66; // [sp+28Ch] [bp-4h]@48
|
|
1788
|
|
1789 v0 = window_SpeakInHouse;
|
|
1790 memcpy(&v53, window_SpeakInHouse, sizeof(v53));
|
|
1791 v2 = 255;
|
|
1792 //v61 = pPlayers[uActiveCharacter];
|
|
1793 v1 = pPlayers[uActiveCharacter];
|
|
1794 v53.uFrameX = 483;
|
|
1795 v53.uFrameWidth = 148;
|
|
1796 v53.uFrameZ = 334;
|
777
|
1797 auto color_default = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(255, 255, 255);
|
|
1798 auto color_selected = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(255, 255, 155);
|
775
|
1799 v3 = 52 * (unsigned int)v0->ptr_1C;
|
|
1800 //v59 = (GUIWindow *)((((p2DEvents_minus1___00[v3 / 2] != 27) - 1) & 0xFFFFFFE7) + 50);
|
777
|
1801 //v59 = (GUIWindow *)((((p2DEvents[(unsigned int)v0->ptr_1C - 1].uType != BildingType_Stables) - 1) & 0xFFFFFFE7) + 50);
|
775
|
1802 //v4 = (signed __int64)((double)(signed int)v59 * p2DEvents_minus1__20[v3 / 4]);
|
777
|
1803
|
|
1804 v4 = p2DEvents[(unsigned int)v0->ptr_1C - 1].uType == BildingType_Stables ? 25 : 50;
|
|
1805 v4 *= p2DEvents[(unsigned int)v0->ptr_1C - 1].fPriceMultiplier;
|
|
1806
|
775
|
1807 s1 = v4 * (100 - v1->GetMerchant()) / 100;
|
|
1808 if ( (signed int)s1 < v4 / 3 )
|
|
1809 s1 = v4 / 3;
|
|
1810 if ( dialog_menu_id == HOUSE_DIALOGUE_MAIN)
|
|
1811 {
|
|
1812 if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
|
|
1813 {
|
|
1814 v16 = pDialogueWindow;
|
777
|
1815 v58 = 255;
|
775
|
1816 v62 = 0;
|
|
1817 v17 = LOBYTE(pFontArrus->uFontHeight) - 3;
|
777
|
1818 //v59 = pDialogueWindow;
|
775
|
1819 v54 = v17;
|
777
|
1820 strcpy(v48[4], "");
|
775
|
1821 sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[405], s1); // Price: %lu gold
|
|
1822 v18 = pFontArrus->CalcTextHeight(pTmpBuf2, &v53, 0, 0);
|
|
1823 v19 = v16->pNumPresenceButton;
|
|
1824 v20 = v18 + v17 + 146;
|
|
1825 v21 = v16->pStartingPosActiveItem;
|
|
1826 v63 = v20;
|
|
1827 v55 = v20;
|
|
1828 v60 = v21;
|
|
1829 if ( v21 >= v21 + v19 )
|
|
1830 goto LABEL_71;
|
|
1831 s1 = 2;
|
777
|
1832 a1 = (char *)v48;
|
775
|
1833 while ( 1 )
|
|
1834 {
|
|
1835 int v47 = v60;
|
|
1836 v22 = window_SpeakInHouse->ptr_1C;
|
777
|
1837 v23 = transport_routes[(unsigned int)v22 - HOUSE_STABLES_HARMONDALE][v62];
|
775
|
1838 //v23 = (unsigned __int8)*(&_4F0D38_TravelInfo[4 * (unsigned int)v22] + v62); // negindex. actual address is around + 0x36
|
|
1839 //v61 = (Player *)(unsigned __int8)*(&_4F0D38_TravelInfo[4 * (unsigned int)v22] + v62); // + 0x3F for sea travels, less for land
|
|
1840 v24 = v16->GetControl(v60);
|
777
|
1841
|
|
1842 if (v23 != v58)
|
775
|
1843 {
|
777
|
1844 if (v23 >= 25)
|
|
1845 Log::Warning(L"Transport UI: scedule overflow");
|
|
1846 if (s1 >= 6)
|
|
1847 v25 = true;
|
|
1848 else
|
|
1849 v25 = transport_schedule[v23].pSchedule[pParty->uDaysPlayed % 7];
|
|
1850 }
|
|
1851
|
|
1852 if (v23 != v58 && v25 && (!transport_schedule[v23].uQuestBit || _449B57_test_bit(pParty->_quest_bits, transport_schedule[v23].uQuestBit)) )
|
|
1853 {
|
|
1854 v58 = v23;
|
|
1855 if ( pDialogueWindow->pCurrentPosActiveItem == s1 )
|
|
1856 sprintf(a1, "\f%05d", color_selected);
|
|
1857 else
|
|
1858 sprintf(a1, "\f%05d", color_default);
|
|
1859
|
775
|
1860 //v32.uRedbookTrackID = v27;
|
777
|
1861 v66 = transport_schedule[v23].uTravelTime;
|
|
1862 if ( (unsigned int)window_SpeakInHouse->ptr_1C >= HOUSE_BOATS_63 )
|
775
|
1863 {
|
|
1864 if ( CheckHiredNPCSpeciality(Sailor) )
|
|
1865 v66 -= 2;
|
|
1866 if ( CheckHiredNPCSpeciality(Navigator) )
|
|
1867 v66 -= 3;
|
|
1868 if ( CheckHiredNPCSpeciality(Pirate) )
|
|
1869 v66 -= 2;
|
|
1870 }
|
|
1871 else
|
|
1872 {
|
|
1873 if ( CheckHiredNPCSpeciality(Horseman) )
|
|
1874 v66 -= 2;
|
|
1875 }
|
|
1876 if ( CheckHiredNPCSpeciality(Explorer) )
|
|
1877 --v66;
|
|
1878 if ( v66 < 1 )
|
|
1879 v66 = 1;
|
|
1880 if ( v23 != v2 )
|
|
1881 {
|
777
|
1882 memcpy(&v32, &pMapStats->pInfos[transport_schedule[v23].uMapInfoID], 0x44u);
|
775
|
1883 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[404], // Time - %d days, destination %s
|
777
|
1884 v66, v32.pName);
|
775
|
1885 strcat(a1, pTmpBuf);
|
|
1886 v28 = a1;
|
|
1887 a1 += 100;
|
|
1888 ++v62;
|
|
1889 ++s1;
|
|
1890 strcat(v28, "\n \n");
|
|
1891 v24->uY = v63;
|
|
1892 v29 = pFontArrus->CalcTextHeight(pTmpBuf, &v53, 0, 0);
|
|
1893 v30 = v24->uY;
|
|
1894 v24->uHeight = v29;
|
|
1895 v2 = 255;
|
|
1896 v24->uW = v30 + v29 - 1;
|
|
1897 v63 += v54 + v29;
|
|
1898 }
|
|
1899 }
|
|
1900 else
|
|
1901 {
|
|
1902 v31 = a1;
|
|
1903 ++v62;
|
|
1904 ++s1;
|
|
1905 a1 += 100;
|
|
1906 strcpy(v31, "");
|
|
1907 if ( v24 )
|
|
1908 {
|
|
1909 v24->uW = 0;
|
|
1910 v24->uHeight = 0;
|
|
1911 v24->uY = 0;
|
|
1912 }
|
|
1913 }
|
|
1914 ++v60;
|
777
|
1915 if ( (signed int)v60 >= v16->pNumPresenceButton + v16->pStartingPosActiveItem )
|
775
|
1916 break;
|
777
|
1917 //v16 = v59;
|
775
|
1918 }
|
|
1919 if ( v63 != v55 )
|
|
1920 {
|
|
1921 /*v47[1] = &Dest;
|
|
1922 v47[0] = &v51;
|
|
1923 v46 = &v50;
|
|
1924 v45 = (unsigned int)&v49;
|
|
1925 v44 = &v48;
|
|
1926 v43 = pTmpBuf2;*/
|
777
|
1927 sprintf(pTmpBuf, "%s\n \n%s%s%s%s%s", pTmpBuf2, v48[0], v48[1], v48[2], v48[3], v48[4]);
|
775
|
1928 v53.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u);
|
|
1929 }
|
|
1930 else
|
|
1931 {
|
|
1932 LABEL_71:
|
|
1933 v53.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[561], &v53, 0, 0)) / 2 + 138,
|
777
|
1934 color_default, pGlobalTXT_LocalizationStrings[561], 3);
|
775
|
1935 pAudioPlayer->StopChannels(-1, -1);
|
|
1936 }
|
|
1937 }
|
|
1938 }
|
|
1939 else
|
|
1940 {
|
777
|
1941 if ( dialog_menu_id >= HOUSE_DIALOGUE_TRANSPORT_SCHEDULE_1 && dialog_menu_id <= HOUSE_DIALOGUE_TRANSPORT_SCHEDULE_4 )
|
775
|
1942 {
|
|
1943 if ( pParty->uNumGold < s1 )
|
|
1944 {
|
|
1945 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u);
|
|
1946 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_Greeting_2);
|
|
1947 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
|
778
|
1948 return;
|
775
|
1949 }
|
778
|
1950
|
775
|
1951 Party::TakeGold(s1);
|
778
|
1952
|
777
|
1953 v5 = &transport_schedule[transport_routes[(unsigned int)window_SpeakInHouse->ptr_1C - HOUSE_STABLES_HARMONDALE][dialog_menu_id - HOUSE_DIALOGUE_TRANSPORT_SCHEDULE_1]];
|
775
|
1954 if ( v5->pSchedule[pParty->uDaysPlayed % 7] )
|
|
1955 {
|
|
1956 if ( _strcmpi(pCurrentMapName, pMapStats->pInfos[v5->uMapInfoID].pFilename) )
|
|
1957 {
|
|
1958 SaveGame(1, 0);
|
|
1959 strcpy(pCurrentMapName, pMapStats->pInfos[v5->uMapInfoID].pFilename);
|
777
|
1960
|
775
|
1961 dword_6BE364_game_settings_1 |= 1u;
|
|
1962 _5B65B8_npcdata_hiword_house_or_other = 0;
|
|
1963 dword_5B65BC = 0;
|
777
|
1964 _5B65B4_npcdata_loword_house_or_other = v5->arrival_rot_y;
|
775
|
1965 v11 = *((int *)v5 + 3);
|
|
1966 uGameState = 2;
|
|
1967 _5B65A8_npcdata_uflags_or_other = v11;
|
777
|
1968 _5B65AC_npcdata_fame_or_other = v5->arrival_y;
|
|
1969 _5B65B0_npcdata_rep_or_other = v5->arrival_z;
|
|
1970 dword_5B65C0 = v11 | v5->arrival_y | v5->arrival_z | v5->arrival_rot_y;
|
775
|
1971 }
|
|
1972 else
|
|
1973 {
|
|
1974 pIndoorCamera->sRotationY = 0;
|
|
1975 pParty->uFlags |= 2u;
|
777
|
1976 pParty->vPosition.x = v5->arrival_x;
|
|
1977 pParty->vPosition.y = v5->arrival_y;
|
|
1978 pParty->vPosition.z = v5->arrival_z;
|
775
|
1979 pParty->uFallStartY = pParty->vPosition.z;
|
777
|
1980 pParty->sRotationX = 0;
|
|
1981 pParty->sRotationY = v5->arrival_rot_y;
|
775
|
1982 }
|
|
1983 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful);
|
|
1984 v12 = v5->uTravelTime;
|
|
1985 int _v47;
|
|
1986 if ( (signed int)window_SpeakInHouse->ptr_1C >= 63 )
|
|
1987 {
|
|
1988 v63 = SPEECH_SetSail;
|
|
1989 v13 = 2500;
|
|
1990 if ( CheckHiredNPCSpeciality(Sailor) )
|
|
1991 v12 -= 2;
|
|
1992 if ( CheckHiredNPCSpeciality(Navigator) )
|
|
1993 v12 -= 3;
|
|
1994 //_v47 = 45;
|
|
1995 if ( CheckHiredNPCSpeciality(Pirate) )
|
|
1996 v12 -= 2;
|
|
1997 }
|
|
1998 else
|
|
1999 {
|
|
2000 v63 = SPEECH_CarriageReady;
|
|
2001 v13 = 1500;
|
|
2002 //_v47 = 35;
|
|
2003 if ( CheckHiredNPCSpeciality(Horseman) )
|
|
2004 v12 -= 2;
|
|
2005 }
|
|
2006 if ( CheckHiredNPCSpeciality(Explorer) )
|
|
2007 --v12;
|
|
2008 if ( v12 < 1 )
|
|
2009 v12 = 1;
|
|
2010 RestAndHeal(1440 * v12);
|
|
2011 v1->PlaySound((PlayerSpeech)v63, 0);
|
|
2012 v14 = GetTickCount();
|
|
2013 v15 = v14 + v13;
|
|
2014 if ( v15 < v14 )
|
|
2015 v15 = v14;
|
|
2016 while ( GetTickCount() < v15 )
|
|
2017 sqrt(3.1415926);
|
|
2018 while ( sub_4BD8B5() )
|
|
2019 ;
|
|
2020 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0);
|
778
|
2021 return;
|
775
|
2022 }
|
|
2023 else
|
|
2024 {
|
|
2025 dialog_menu_id = HOUSE_DIALOGUE_MAIN;
|
|
2026 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0);
|
|
2027 }
|
|
2028 }
|
|
2029 }
|
|
2030 }
|
|
2031
|
|
2032
|
|
2033
|
|
2034
|
|
2035
|
|
2036
|
629
|
2037 //----- (004B68EA) --------------------------------------------------------
|
727
|
2038 bool __fastcall IsTravelAvailable(int a1)
|
629
|
2039 {
|
727
|
2040 for (uint i = 0; i < 4; ++i)
|
629
|
2041 {
|
777
|
2042 uint route = transport_routes[a1][i];
|
|
2043 if (transport_schedule[route].pSchedule[pParty->uDaysPlayed % 7])
|
629
|
2044 {
|
777
|
2045 if (!transport_schedule[route].uQuestBit || _449B57_test_bit(pParty->_quest_bits, transport_schedule[route].uQuestBit))
|
727
|
2046 return true;
|
629
|
2047 }
|
|
2048 }
|
727
|
2049 return false;
|
629
|
2050 }
|
|
2051
|
|
2052
|
|
2053
|
|
2054 //----- (004B7911) --------------------------------------------------------
|
|
2055 void __cdecl TownHallDialog()
|
|
2056 {
|
|
2057 GUIWindow *v0; // eax@4
|
|
2058 int v1; // eax@10
|
|
2059 int v2; // esi@10
|
|
2060 GUIFont *v3; // ST20_4@20
|
|
2061 int v4; // eax@20
|
|
2062 MonsterInfo *v5; // edi@21
|
|
2063 unsigned int v6; // ST20_4@21
|
|
2064 char *v7; // ST1C_4@21
|
|
2065 unsigned int v8; // eax@21
|
|
2066 int v9; // esi@21
|
|
2067 char *v10; // eax@23
|
|
2068 signed int v11; // ebx@24
|
|
2069 signed int i; // esi@26
|
|
2070 int v13; // eax@27
|
|
2071 GUIWindow *v14; // ecx@28
|
|
2072 __int64 v15; // qax@28
|
|
2073 signed int v16; // ebx@28
|
|
2074 int v17; // ebx@28
|
|
2075 unsigned __int8 v18; // sf@28
|
|
2076 char **v19; // edi@29
|
|
2077 GUIButton *v20; // eax@30
|
|
2078 GUIButton *v21; // esi@30
|
|
2079 int v22; // eax@30
|
|
2080 unsigned int v23; // ecx@30
|
|
2081 unsigned __int16 v24; // ax@30
|
|
2082 GUIWindow a1; // [sp+Ch] [bp-110h]@21
|
|
2083 GUIWindow w; // [sp+60h] [bp-BCh]@21
|
|
2084 GUIWindow _this; // [sp+B4h] [bp-68h]@1
|
|
2085 int v28; // [sp+108h] [bp-14h]@1
|
|
2086 int v29; // [sp+10Ch] [bp-10h]@28
|
|
2087 int v30; // [sp+110h] [bp-Ch]@1
|
|
2088 int v31; // [sp+114h] [bp-8h]@29
|
|
2089 GUIFont *pOutString; // [sp+118h] [bp-4h]@21
|
|
2090
|
|
2091 memcpy(&_this, window_SpeakInHouse, sizeof(_this));
|
|
2092 _this.uFrameX = 483;
|
|
2093 _this.uFrameWidth = 148;
|
|
2094 _this.uFrameZ = 334;
|
|
2095 v28 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu);
|
|
2096 v30 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu);
|
|
2097 sprintf(pTmpBuf, "%s: %d", pGlobalTXT_LocalizationStrings[605], pParty->uFine);
|
|
2098 _this.DrawTitleText(pFontArrus, 0, 0x104u, v30, pTmpBuf, 3u);
|
|
2099 switch(dialog_menu_id)
|
|
2100 {
|
749
|
2101 case HOUSE_DIALOGUE_MAIN:
|
629
|
2102 {
|
|
2103 v11 = 1;
|
|
2104 pOutString = 0;
|
|
2105 pShopOptions[0] = pGlobalTXT_LocalizationStrings[604];
|
|
2106 if ( pParty->uFine )
|
|
2107 {
|
|
2108 pShopOptions[1] = pGlobalTXT_LocalizationStrings[603];
|
|
2109 v11 = 2;
|
|
2110 }
|
|
2111 for ( i = 0; i < v11; ++i )
|
|
2112 {
|
|
2113 v13 = pFontArrus->CalcTextHeight(pShopOptions[i], &_this, 0, 0);
|
|
2114 pOutString = (GUIFont *)((char *)pOutString + v13);
|
|
2115 }
|
|
2116 v29 = (100 - (signed int)pOutString) / v11;
|
|
2117 v14 = pDialogueWindow;
|
|
2118 v15 = 80 - v11 * (100 - (signed int)pOutString) / v11 - (signed int)pOutString;
|
|
2119 v16 = v15 - HIDWORD(v15);
|
|
2120 LODWORD(v15) = pDialogueWindow->pStartingPosActiveItem;
|
|
2121 HIDWORD(v15) = v15 + pDialogueWindow->pNumPresenceButton;
|
|
2122 v17 = (v16 >> 1) - v29 / 2 + 158;
|
|
2123 v18 = -pDialogueWindow->pNumPresenceButton < 0;
|
|
2124 pOutString = (GUIFont *)pDialogueWindow->pStartingPosActiveItem;
|
|
2125 if ( v18 ^ __OFSUB__((int)v15, HIDWORD(v15)) )
|
|
2126 {
|
|
2127 v31 = 2;
|
|
2128 v19 = pShopOptions;
|
|
2129 do
|
|
2130 {
|
|
2131 v20 = v14->GetControl((unsigned int)pOutString);
|
|
2132 v21 = v20;
|
|
2133 v20->uY = v29 + v17;
|
|
2134 v22 = pFontArrus->CalcTextHeight(*v19, &_this, 0, 0);
|
|
2135 v23 = v21->uY;
|
|
2136 v21->uHeight = v22;
|
|
2137 v17 = v23 + v22 - 1;
|
|
2138 v21->uW = v17;
|
|
2139 v24 = v30;
|
|
2140 if ( pDialogueWindow->pCurrentPosActiveItem != v31 )
|
|
2141 v24 = v28;
|
|
2142 _this.DrawTitleText(pFontArrus, 0, v23, v24, *v19, 3u);
|
|
2143 v14 = pDialogueWindow;
|
|
2144 ++v31;
|
|
2145 ++v19;
|
|
2146 pOutString = (GUIFont *)((char *)pOutString + 1);
|
|
2147 }
|
|
2148 while ( (signed int)pOutString < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem );
|
|
2149 }
|
|
2150 break;
|
|
2151 }
|
749
|
2152
|
|
2153 case HOUSE_DIALOGUE_TOWNHALL_99:
|
629
|
2154 {
|
|
2155 v5 = &pMonsterStats->pInfos[word_F8B1A0];
|
|
2156 v6 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu);
|
|
2157 v7 = v5->pName;
|
|
2158 v8 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu);
|
|
2159 sprintf(pTmpBuf, &byte_4F0F98, v8, v7, v6);
|
|
2160 sprintf(pTmpBuf2, dword_F8B1A4, pTmpBuf, 100 * v5->uLevel);
|
|
2161 ptr_F8B1E8 = pTmpBuf2;
|
|
2162 memcpy(&a1, pDialogueWindow, sizeof(a1));
|
|
2163 w.uFrameWidth = 458;
|
|
2164 w.uFrameZ = 457;
|
|
2165 pOutString = pFontArrus;
|
|
2166 v9 = pFontArrus->CalcTextHeight(pTmpBuf2, &w, 13, 0) + 7;
|
|
2167 if ( 352 - v9 < 8 )
|
|
2168 {
|
|
2169 pOutString = pFontCreate;
|
|
2170 v9 = pFontCreate->CalcTextHeight(ptr_F8B1E8, &w, 13, 0) + 7;
|
|
2171 }
|
|
2172
|
|
2173 auto pTex = (uTextureID_Leather != -1 ? &pIcons_LOD->pTextures[uTextureID_Leather] : 0);
|
|
2174 pRenderer->_4A6A68(8u, 352 - v9, pTex, (pTex ? pTex->uTextureHeight : 26) - v9);
|
|
2175 pRenderer->DrawTextureIndexed(8u, 347 - v9, pTexture_591428);
|
|
2176 v10 = FitTextInAWindow(ptr_F8B1E8, pOutString, &w, 0xDu, 0);
|
|
2177 a1.DrawText(pOutString, 13, 354 - v9, 0, v10, 0, 0, 0);
|
|
2178 break;
|
|
2179 }
|
749
|
2180 case HOUSE_DIALOGUE_TOWNHALL_100:
|
629
|
2181 {
|
|
2182 v0 = window_SpeakInHouse;
|
|
2183 if ( window_SpeakInHouse->field_40 == 1 )
|
|
2184 {
|
|
2185 sprintf(pTmpBuf, "%s\n%s", pGlobalTXT_LocalizationStrings[606], pGlobalTXT_LocalizationStrings[112]);
|
|
2186 _this.DrawTitleText(pFontArrus, 0, 0x92u, v30, pTmpBuf, 3u);
|
|
2187 _this.DrawTitleText(pFontArrus, 0, 0xBAu, v28, (const char *)pKeyActionMap->pPressedKeysBuffer, 3u);
|
|
2188 v3 = pFontArrus;
|
|
2189 v4 = pFontArrus->GetLineWidth((const char *)pKeyActionMap->pPressedKeysBuffer);
|
|
2190 _this.DrawFlashingInputCursor(v4 / 2 + 80, 185, v3);
|
|
2191 return;
|
|
2192 }
|
|
2193 if ( window_SpeakInHouse->field_40 == 2 )
|
|
2194 {
|
|
2195 v1 = atoi((const char *)pKeyActionMap->pPressedKeysBuffer);
|
|
2196 v2 = v1;
|
|
2197 if ( v1 <= 0 )
|
|
2198 {
|
|
2199 //LABEL_8:
|
|
2200 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
|
|
2201 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
|
|
2202 {
|
|
2203 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113;
|
|
2204 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1;
|
|
2205 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
|
|
2206 ++pMessageQueue_50CBD0->uNumMessages;
|
|
2207 }*/
|
|
2208 return;
|
|
2209 }
|
|
2210 if ( v1 > pParty->uNumGold )
|
|
2211 {
|
758
|
2212 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful);
|
629
|
2213 v2 = pParty->uNumGold;
|
|
2214 }
|
|
2215 if ( v2 > pParty->uFine )
|
|
2216 v2 = pParty->uFine;
|
|
2217 Party::TakeGold(v2);
|
|
2218 pParty->uFine -= v2;
|
|
2219 if ( pParty->uFine < 0 )
|
|
2220 pParty->uFine = 0;
|
|
2221 if ( uActiveCharacter )
|
|
2222 pPlayers[uActiveCharacter]->PlaySound(SPEECH_81, 0);
|
|
2223 v0 = window_SpeakInHouse;
|
|
2224 }
|
|
2225 if ( window_SpeakInHouse->field_40 == 3 )
|
|
2226 {
|
|
2227 v0->field_40 = 0;
|
|
2228 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
|
|
2229 }
|
|
2230 break;
|
|
2231 }
|
|
2232 default:
|
|
2233 {
|
|
2234 break;
|
|
2235 }
|
|
2236 }
|
|
2237 return;
|
|
2238 }
|
|
2239 // F8B19C: using guessed type int dword_F8B19C;
|
|
2240 // F8B1A0: using guessed type __int16 word_F8B1A0;
|
|
2241
|
|
2242 //----- (004B7D7E) --------------------------------------------------------
|
|
2243 void __cdecl BankDialog()
|
|
2244 {
|
|
2245 GUIWindow *v0; // eax@4
|
|
2246 int v1; // ecx@5
|
|
2247 int v2; // eax@6
|
|
2248 unsigned int v3; // esi@6
|
|
2249 GUIFont *v4; // ST10_4@12
|
|
2250 int v5; // eax@12
|
|
2251 int v6; // eax@19
|
|
2252 unsigned int v7; // esi@19
|
|
2253 unsigned __int16 v8; // ax@27
|
|
2254 unsigned __int16 v9; // ax@29
|
|
2255 char *v10; // [sp-8h] [bp-70h]@11
|
|
2256 char *v11; // [sp-4h] [bp-6Ch]@11
|
|
2257 GUIWindow _this; // [sp+Ch] [bp-5Ch]@1
|
|
2258 __int16 v13[2]; // [sp+60h] [bp-8h]@1
|
|
2259 __int16 v14[2]; // [sp+64h] [bp-4h]@1
|
|
2260
|
|
2261 memcpy(&_this, window_SpeakInHouse, sizeof(_this));
|
|
2262 _this.uFrameX = 483;
|
|
2263 _this.uFrameWidth = 148;
|
|
2264 _this.uFrameZ = 334;
|
|
2265 *(int *)v13 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu);
|
|
2266 *(int *)v14 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu);
|
|
2267 sprintf(pTmpBuf, "%s: %d", pGlobalTXT_LocalizationStrings[25], pParty->uNumGoldInBank);
|
|
2268 _this.DrawTitleText(pFontArrus, 0, 0xDCu, v14[0], pTmpBuf, 3u);
|
|
2269 switch(dialog_menu_id)
|
|
2270 {
|
749
|
2271 case HOUSE_DIALOGUE_MAIN:
|
629
|
2272 {
|
|
2273 v8 = v14[0];
|
|
2274 if ( pDialogueWindow->pCurrentPosActiveItem != 2 )
|
|
2275 v8 = v13[0];
|
|
2276 _this.DrawTitleText(pFontArrus, 0, 0x92u, v8, pGlobalTXT_LocalizationStrings[60], 3u);
|
|
2277 v9 = v14[0];
|
|
2278 if ( pDialogueWindow->pCurrentPosActiveItem != 3 )
|
|
2279 v9 = v13[0];
|
|
2280 _this.DrawTitleText(pFontArrus, 0, 0xB0u, v9, pGlobalTXT_LocalizationStrings[244], 3u);
|
|
2281 break;
|
|
2282 }
|
749
|
2283 case HOUSE_DIALOGUE_BANK_7:
|
629
|
2284 {
|
|
2285 v0 = window_SpeakInHouse;
|
|
2286 if ( window_SpeakInHouse->field_40 != 1 )
|
|
2287 {
|
|
2288 v1 = window_SpeakInHouse->field_40 - 2;
|
|
2289 if ( window_SpeakInHouse->field_40 == 2 )
|
|
2290 {
|
|
2291 v6 = atoi((const char *)pKeyActionMap->pPressedKeysBuffer);
|
|
2292 v7 = v6;
|
|
2293 if ( !v6 )
|
|
2294 {
|
|
2295 //LABEL_17:
|
|
2296 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
|
|
2297 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
|
|
2298 {
|
|
2299 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113;
|
|
2300 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1;
|
|
2301 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
|
|
2302 ++pMessageQueue_50CBD0->uNumMessages;
|
|
2303 }*/
|
|
2304 return;
|
|
2305 }
|
|
2306 if ( v6 > pParty->uNumGold )
|
|
2307 {
|
758
|
2308 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful);
|
629
|
2309 v7 = pParty->uNumGold;
|
|
2310 }
|
|
2311 if ( v7 )
|
|
2312 {
|
|
2313 Party::TakeGold(v7);
|
|
2314 pParty->uNumGoldInBank += v7;
|
|
2315 if ( uActiveCharacter )
|
|
2316 pPlayers[uActiveCharacter]->PlaySound(SPEECH_81, 0);
|
|
2317 }
|
|
2318 v0 = window_SpeakInHouse;
|
|
2319 v0->field_40 = 0;
|
|
2320 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
|
|
2321 return;
|
|
2322 }
|
|
2323 if ( v1 != 1 )
|
|
2324 return;
|
|
2325 v0->field_40 = 0;
|
|
2326 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
|
|
2327 return;
|
|
2328 }
|
|
2329 v11 = pGlobalTXT_LocalizationStrings[112];
|
|
2330 v10 = pGlobalTXT_LocalizationStrings[60];
|
|
2331 sprintf(pTmpBuf, "%s\n%s", v10, v11);
|
|
2332 _this.DrawTitleText(pFontArrus, 0, 0x92u, v14[0], pTmpBuf, 3u);
|
|
2333 _this.DrawTitleText(pFontArrus, 0, 0xBAu, v13[0], (const char *)pKeyActionMap->pPressedKeysBuffer, 3u);
|
|
2334 v4 = pFontArrus;
|
|
2335 v5 = pFontArrus->GetLineWidth((const char *)pKeyActionMap->pPressedKeysBuffer);
|
|
2336 _this.DrawFlashingInputCursor(v5 / 2 + 80, 185, v4);
|
|
2337 break;
|
|
2338 }
|
|
2339
|
749
|
2340 case HOUSE_DIALOGUE_BANK_8:
|
629
|
2341 {
|
|
2342 v0 = window_SpeakInHouse;
|
|
2343 if ( window_SpeakInHouse->field_40 != 1 )
|
|
2344 {
|
|
2345 v1 = window_SpeakInHouse->field_40 - 2;
|
|
2346 if ( window_SpeakInHouse->field_40 == 2 )
|
|
2347 {
|
|
2348 window_SpeakInHouse->field_40 = 0;
|
|
2349 v2 = atoi((const char *)pKeyActionMap->pPressedKeysBuffer);
|
|
2350 v3 = v2;
|
|
2351 if ( v2 )
|
|
2352 {
|
|
2353 if ( v2 > pParty->uNumGoldInBank )
|
|
2354 {
|
758
|
2355 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful);
|
629
|
2356 v3 = pParty->uNumGoldInBank;
|
|
2357 }
|
|
2358 if ( v3 )
|
|
2359 {
|
|
2360 Party::SetGold(pParty->uNumGold + v3);
|
|
2361 pParty->uNumGoldInBank -= v3;
|
|
2362 }
|
|
2363 }
|
|
2364 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
|
|
2365 return;
|
|
2366 }
|
|
2367 if ( v1 != 1 )
|
|
2368 return;
|
|
2369 v0->field_40 = 0;
|
|
2370 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
|
|
2371 return;
|
|
2372 }
|
|
2373 v11 = pGlobalTXT_LocalizationStrings[112];
|
|
2374 v10 = pGlobalTXT_LocalizationStrings[244];
|
|
2375 sprintf(pTmpBuf, "%s\n%s", v10, v11);
|
|
2376 _this.DrawTitleText(pFontArrus, 0, 0x92u, v14[0], pTmpBuf, 3u);
|
|
2377 _this.DrawTitleText(pFontArrus, 0, 0xBAu, v13[0], (const char *)pKeyActionMap->pPressedKeysBuffer, 3u);
|
|
2378 v4 = pFontArrus;
|
|
2379 v5 = pFontArrus->GetLineWidth((const char *)pKeyActionMap->pPressedKeysBuffer);
|
|
2380 _this.DrawFlashingInputCursor(v5 / 2 + 80, 185, v4);
|
|
2381 return;
|
|
2382 break;
|
|
2383 }
|
|
2384
|
|
2385 default:
|
|
2386 {
|
|
2387 break;
|
|
2388 }
|
|
2389 }
|
|
2390 }
|
|
2391 // F8B19C: using guessed type int dword_F8B19C;
|
|
2392
|
|
2393 //----- (004B8285) --------------------------------------------------------
|
|
2394 void __cdecl TavernDialog()
|
|
2395 {
|
644
|
2396 int v0;
|
|
2397 int pItemNum;
|
629
|
2398 double v2; // st7@1
|
|
2399 signed int v3; // ebx@1
|
|
2400 int v4; // ecx@1
|
|
2401 int v5; // esi@3
|
|
2402 signed int v6; // edi@5
|
|
2403 int v7; // ecx@5
|
644
|
2404 int pNumString; // edi@16
|
629
|
2405 signed int v9; // esi@16
|
644
|
2406 unsigned int pNumActiveItem; // esi@18
|
629
|
2407 int v11; // eax@18
|
|
2408 unsigned int v12; // eax@19
|
|
2409 int v13; // eax@21
|
|
2410 int v14; // ecx@26
|
644
|
2411 //GUIButton *v15; // eax@28
|
|
2412 //GUIButton *v16; // esi@28
|
629
|
2413 int v17; // eax@28
|
|
2414 char *v18; // eax@30
|
|
2415 int v19; // eax@30
|
|
2416 unsigned int v20; // ecx@30
|
|
2417 int v21; // edx@30
|
|
2418 int v22; // eax@30
|
|
2419 unsigned __int16 v23; // ax@30
|
|
2420 int v24; // eax@34
|
|
2421 int v25; // eax@34
|
|
2422 char *v26; // esi@36
|
|
2423 int v27; // edi@46
|
644
|
2424 unsigned int pColorText; // eax@57
|
629
|
2425 signed int v31; // eax@59
|
644
|
2426 //GUIWindow *v33; // edi@64
|
629
|
2427 int v34; // eax@64
|
|
2428 int v35; // ecx@64
|
|
2429 int v36; // esi@64
|
|
2430 char v37; // sf@64
|
644
|
2431 GUIButton *pButton; // eax@65
|
629
|
2432 int v39; // edx@69
|
|
2433 int v40; // ecx@69
|
|
2434 int v41; // ecx@69
|
|
2435 int v42; // ecx@70
|
|
2436 unsigned int v43; // edx@70
|
|
2437 int v44; // edx@71
|
|
2438 int v45; // ecx@71
|
|
2439 int v46; // ecx@72
|
|
2440 int v47; // eax@74
|
|
2441 signed int v48; // edi@77
|
|
2442 signed int i; // esi@79
|
|
2443 int v50; // eax@80
|
644
|
2444 //GUIWindow *v51; // ecx@81
|
629
|
2445 _QWORD v52; // qax@81
|
|
2446 signed int v53; // edi@81
|
|
2447 int v54; // edi@81
|
644
|
2448 //GUIButton *v55; // esi@83
|
629
|
2449 const char **v56; // eax@83
|
|
2450 int v57; // eax@83
|
|
2451 unsigned int v58; // ecx@83
|
644
|
2452 //Player *v59; // edx@83
|
629
|
2453 unsigned __int16 v60; // ax@83
|
|
2454 int v61; // eax@99
|
|
2455 char *v63; // eax@99
|
|
2456 GUIFont *v64; // edx@99
|
|
2457 GUIFont *v65; // edi@100
|
|
2458 unsigned int v66; // [sp-10h] [bp-284h]@75
|
|
2459 unsigned __int16 v67; // [sp-Ch] [bp-280h]@75
|
|
2460 int v68; // [sp-Ch] [bp-280h]@99
|
|
2461 char *v69; // [sp-8h] [bp-27Ch]@75
|
|
2462 int v70; // [sp-8h] [bp-27Ch]@99
|
|
2463 unsigned int v71; // [sp-4h] [bp-278h]@75
|
|
2464 const char *v72; // [sp-4h] [bp-278h]@93
|
|
2465 unsigned int v73; // [sp-4h] [bp-278h]@99
|
|
2466 char Dest[100]; // [sp+Ch] [bp-268h]@55
|
|
2467 char v75[100]; // [sp+70h] [bp-204h]@59
|
|
2468 char a1[100]; // [sp+D4h] [bp-1A0h]@57
|
|
2469 char v77[100]; // [sp+138h] [bp-13Ch]@59
|
644
|
2470 //GUIWindow v78; // [sp+19Ch] [bp-D8h]@99
|
|
2471 GUIWindow dialog_window; // [sp+1F0h] [bp-84h]@1
|
629
|
2472 char *Str[2]; // [sp+244h] [bp-30h]@30
|
644
|
2473 unsigned int pColorWhite; // [sp+24Ch] [bp-28h]@1
|
629
|
2474 unsigned __int8 v82; // [sp+253h] [bp-21h]@59
|
|
2475 int v83; // [sp+254h] [bp-20h]@1
|
644
|
2476 int pColorYellow; // [sp+258h] [bp-1Ch]@1
|
|
2477 Player *pPlayer; // [sp+25Ch] [bp-18h]@1
|
|
2478 int all_text_height; // [sp+260h] [bp-14h]@18
|
629
|
2479 unsigned __int8 v87; // [sp+266h] [bp-Eh]@59
|
|
2480 unsigned __int8 v88; // [sp+267h] [bp-Dh]@57
|
|
2481 int v89; // [sp+268h] [bp-Ch]@1
|
644
|
2482 unsigned int pTextHeight; // [sp+26Fh] [bp-5h]@55
|
|
2483 int v91; // [sp+270h] [bp-4h]@3
|
|
2484 GUIFont *pOutString;
|
629
|
2485
|
644
|
2486 pPlayer = pPlayers[uActiveCharacter];
|
|
2487 memcpy(&dialog_window, window_SpeakInHouse, sizeof(dialog_window));
|
|
2488 dialog_window.uFrameX = 483;
|
|
2489 dialog_window.uFrameWidth = 148;
|
|
2490 dialog_window.uFrameZ = 334;
|
|
2491 pColorWhite = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu);
|
|
2492 pColorYellow = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu);
|
|
2493 v2 = p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier;
|
629
|
2494 *(float *)&v83 = v2;
|
|
2495 *(float *)&v89 = v2 * v2;
|
|
2496 v3 = (signed __int64)(*(float *)&v89 * 0.1);
|
662
|
2497 pItemNum = v3 * (100 - pPlayer->GetMerchant()) / 100;
|
|
2498 if ( pItemNum < v3 / 3 )
|
|
2499 pItemNum = v3 / 3;
|
629
|
2500 v5 = 1;
|
662
|
2501 pOutString = (GUIFont *)pItemNum;
|
|
2502 if ( pItemNum <= 0 )
|
629
|
2503 pOutString = (GUIFont *)1;
|
|
2504 v6 = (signed __int64)(*(float *)&v89 * *(float *)&v83 * 0.0099999998);
|
644
|
2505 v7 = v6 * (100 - pPlayer->GetMerchant()) / 100;
|
629
|
2506 if ( v7 < v6 / 3 )
|
662
|
2507 v7 = v6 / 3;
|
629
|
2508 v83 = v7;
|
|
2509 if ( v7 <= 0 )
|
|
2510 {
|
|
2511 v7 = 1;
|
|
2512 v83 = 1;
|
|
2513 }
|
747
|
2514
|
629
|
2515 switch(dialog_menu_id)
|
|
2516 {
|
747
|
2517 case HOUSE_DIALOGUE_MAIN:
|
644
|
2518 {
|
|
2519 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
|
629
|
2520 return;
|
648
|
2521
|
690
|
2522 sprintf(Dest, "\f%05d", pDialogueWindow->pCurrentPosActiveItem == 2 ? pColorYellow : pColorWhite);
|
648
|
2523 sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[178], pOutString); // Rent room for %d gold
|
644
|
2524 strcat(Dest, pTmpBuf2);
|
|
2525 pTextHeight = pFontArrus->CalcTextHeight(Dest, &dialog_window, 0, 0);
|
|
2526 strcat(Dest, "\n \n");
|
648
|
2527
|
690
|
2528 sprintf(a1, "\f%05d", pDialogueWindow->pCurrentPosActiveItem == 3 ? pColorYellow : pColorWhite);
|
648
|
2529 sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[86], // Buy food for %d days for %d gold
|
|
2530 (unsigned int)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier,
|
644
|
2531 v83);
|
|
2532 strcat(a1, pTmpBuf2);
|
|
2533 v88 = pFontArrus->CalcTextHeight(a1, &dialog_window, 0, 0);
|
|
2534 strcat(a1, "\n \n");
|
648
|
2535
|
690
|
2536 sprintf(v77, "\f%05d", pDialogueWindow->pCurrentPosActiveItem == 4 ? pColorYellow : pColorWhite);
|
648
|
2537 strcat(v77, pGlobalTXT_LocalizationStrings[160]); // Learn Skills
|
644
|
2538 v82 = pFontArrus->CalcTextHeight(v77, &dialog_window, 0, 0);
|
|
2539 strcat(v77, "\n \n");
|
|
2540 v75[0] = 0;
|
|
2541 pTextHeight = 0;
|
690
|
2542 if ( (signed int)window_SpeakInHouse->par1C >= 108 && (signed int)window_SpeakInHouse->par1C <= 120 )
|
644
|
2543 {
|
690
|
2544 sprintf(v75, "\f%05d", pDialogueWindow->pCurrentPosActiveItem == 5 ? pColorYellow : pColorWhite);
|
648
|
2545 strcat(v75, pGlobalTXT_LocalizationStrings[611]); // Play Arcomage
|
644
|
2546 pTextHeight = pFontArrus->CalcTextHeight(v75, &dialog_window, 0, 0);
|
|
2547 }
|
662
|
2548 pNumActiveItem = pDialogueWindow->pStartingPosActiveItem;
|
644
|
2549 v36 = LOBYTE(pFontArrus->uFontHeight) - 3;
|
|
2550 v37 = -pDialogueWindow->pNumPresenceButton < 0;
|
662
|
2551 if ( !(v37 ^ pNumActiveItem < pNumActiveItem + pDialogueWindow->pNumPresenceButton) )
|
644
|
2552 {
|
648
|
2553 sprintf(pTmpBuf, "%s%s%s%s", Dest, a1, v77, v75);
|
644
|
2554 dialog_window.DrawTitleText(pFontArrus, 0, 146, 0, pTmpBuf, 3);
|
|
2555 return;
|
|
2556 }
|
|
2557 while ( 1 )
|
|
2558 {
|
662
|
2559 pButton = pDialogueWindow->GetControl(pNumActiveItem);
|
644
|
2560 if ( pButton->uControlParam == 15 )
|
629
|
2561 {
|
644
|
2562 v46 = pTextHeight;
|
|
2563 pButton->uHeight = pTextHeight;
|
|
2564 pButton->uY = 146;
|
|
2565 v41 = v46 + 145;
|
|
2566 pButton->uW = v41;
|
629
|
2567 }
|
644
|
2568 else if ( pButton->uControlParam == 16 )
|
|
2569 {
|
|
2570 v44 = v88;
|
|
2571 v45 = pTextHeight + v36 + 146;
|
|
2572 pButton->uHeight = v88;
|
|
2573 pButton->uY = v45;
|
|
2574 v41 = v45 + v44 - 1;
|
|
2575 pButton->uW = v41;
|
|
2576 }
|
|
2577 else if ( pButton->uControlParam == 96 )
|
629
|
2578 {
|
644
|
2579 v42 = pTextHeight + v88 + 2 * v36 + 146;
|
|
2580 v43 = v82;
|
|
2581 pButton->uY = v42;
|
|
2582 pButton->uHeight = v43;
|
|
2583 v41 = v43 + v42 - 1;
|
|
2584 pButton->uW = v41;
|
|
2585 }
|
|
2586 else if ( pButton->uControlParam == 101 )
|
|
2587 {
|
|
2588 v39 = pTextHeight + 3 * v36 + pTextHeight + v88 + 146;
|
|
2589 v40 = v87;
|
|
2590 pButton->uHeight = pTextHeight;
|
|
2591 pButton->uY = v39;
|
|
2592 v41 = v39 + v40 - 1;
|
|
2593 pButton->uW = v41;
|
|
2594 }
|
662
|
2595 pNumActiveItem++;
|
|
2596 if ( pNumActiveItem >= pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem )
|
644
|
2597 {
|
|
2598 sprintf(pTmpBuf, "%s%s%s%s", &Dest, &a1, &v77, &v75);
|
|
2599 dialog_window.DrawTitleText(pFontArrus, 0, 146, 0, pTmpBuf, 3);
|
629
|
2600 return;
|
|
2601 }
|
644
|
2602 }
|
|
2603 break;
|
|
2604 }
|
747
|
2605
|
|
2606 case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_102:
|
644
|
2607 {
|
747
|
2608 __debugbreak();
|
644
|
2609 pOutString = pFontArrus;
|
|
2610 strcpy(pTmpBuf, pNPCTopics[354].pText);
|
|
2611 dialog_window.uFrameWidth = 460;
|
|
2612 dialog_window.uFrameZ = 452;
|
|
2613 pTextHeight = pFontArrus->CalcTextHeight(pTmpBuf, &dialog_window, 12, 0) + 7;
|
|
2614 if ( 352 - pTextHeight < 8 )
|
|
2615 {
|
|
2616 pOutString = pFontCreate;
|
|
2617 pTextHeight = pFontCreate->CalcTextHeight(pTmpBuf, &dialog_window, 12, 0) + 7;
|
|
2618 }
|
|
2619 auto pTex = (uTextureID_Leather != -1 ? &pIcons_LOD->pTextures[uTextureID_Leather] : 0);
|
|
2620 pRenderer->_4A6A68(8, 352 - pTextHeight, pTex, (pTex ? pTex->uTextureHeight : 26) - pTextHeight);
|
|
2621 pRenderer->DrawTextureIndexed(8, 347 - pTextHeight, pTexture_591428);
|
|
2622 v63 = FitTextInAWindow(pTmpBuf, pOutString, &dialog_window, 0xCu, 0);
|
|
2623 window_SpeakInHouse->DrawText(pOutString, 12, 354 - pTextHeight, 0, v63, 0, 0, 0);
|
|
2624 break;
|
|
2625 }
|
747
|
2626 case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_103:
|
644
|
2627 {
|
747
|
2628 __debugbreak();
|
644
|
2629 strcpy(pTmpBuf, pNPCTopics[(uint)window_SpeakInHouse->ptr_1C + 247].pText);
|
|
2630 dialog_window.uFrameWidth = 460;
|
|
2631 dialog_window.uFrameZ = 452;
|
|
2632 v61 = pFontArrus->CalcTextHeight(pTmpBuf, &dialog_window, 12, 0);
|
|
2633 pTextHeight = v61 + 7;
|
|
2634 auto pTex = (uTextureID_Leather != -1 ? &pIcons_LOD->pTextures[uTextureID_Leather] : nullptr);
|
|
2635 pRenderer->_4A6A68(8, 352 - (v61 + 7), pTex, (pTex ? pTex->uTextureHeight : 26) - (v61 + 7));
|
|
2636 pRenderer->DrawTextureIndexed(8, 347 - pTextHeight, pTexture_591428);
|
|
2637 v63 = FitTextInAWindow(pTmpBuf, pFontArrus, &dialog_window, 0xCu, 0);
|
|
2638 window_SpeakInHouse->DrawText(pFontArrus, 12, 354 - pTextHeight, 0, v63, 0, 0, 0);
|
|
2639 break;
|
|
2640 }
|
747
|
2641 case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_RESULT:
|
644
|
2642 {
|
|
2643 if ( pArcomageGame->bGameInProgress == 1 )
|
|
2644 return;
|
|
2645 if ( pArcomageGame->uGameResult )
|
|
2646 {
|
|
2647 if ( pArcomageGame->uGameResult == 1 )
|
|
2648 v72 = pGlobalTXT_LocalizationStrings[640];// You won!
|
|
2649 else
|
|
2650 v72 = pGlobalTXT_LocalizationStrings[641];// You lost!
|
|
2651 }
|
|
2652 else
|
|
2653 {
|
|
2654 v72 = pGlobalTXT_LocalizationStrings[639];// A tie!
|
|
2655 }
|
|
2656 strcpy(pTmpBuf, v72);
|
|
2657 v66 = (174 - pFontArrus->CalcTextHeight(pTmpBuf, &dialog_window, 0, 0)) / 2 + 138;
|
|
2658 dialog_window.DrawTitleText(pFontArrus, 0, v66, pColorYellow, pTmpBuf, 3);
|
|
2659 break;
|
|
2660 }
|
747
|
2661
|
|
2662 case HOUSE_DIALOGUE_TAVERN_REST:
|
644
|
2663 {
|
|
2664 if ( pParty->uNumGold >= (unsigned int)pOutString )
|
|
2665 {
|
|
2666 Party::TakeGold((unsigned int)pOutString);
|
|
2667 v27 = (int)window_SpeakInHouse->ptr_1C;
|
758
|
2668 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful);
|
747
|
2669 dialog_menu_id = HOUSE_DIALOGUE_NULL;
|
644
|
2670 sub_4BD8B5();
|
|
2671 sub_4B1D27();
|
|
2672 pVideoPlayer->Unload();
|
|
2673 window_SpeakInHouse->Release();
|
|
2674 window_SpeakInHouse = 0;
|
|
2675 if ( pMessageQueue_50CBD0->uNumMessages )
|
|
2676 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
|
|
2677 pMessageQueue_50CBD0->pMessages[0].eType = UIMSG_OpenRestUI;
|
|
2678 pMessageQueue_50CBD0->pMessages[0].param = v27;
|
|
2679 pMessageQueue_50CBD0->pMessages[0].field_8 = 1;
|
|
2680 ++pMessageQueue_50CBD0->uNumMessages;
|
|
2681 return;
|
|
2682 }
|
|
2683 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);
|
736
|
2684 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_Goodbye);
|
644
|
2685 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, v5, 0);
|
|
2686 break;
|
|
2687 }
|
747
|
2688
|
|
2689 case HOUSE_DIALOGUE_LEARN_SKILLS:
|
644
|
2690 {
|
|
2691 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
|
|
2692 return;
|
|
2693 v0 = 0;
|
|
2694 v9 = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0);
|
|
2695 pItemNum = v9 * (100 - pPlayer->GetMerchant()) / 100;
|
|
2696 if ( pItemNum < v9 / 3 )
|
|
2697 pItemNum = v9 / 3;
|
|
2698 pNumActiveItem = pDialogueWindow->pStartingPosActiveItem;
|
|
2699 all_text_height = 0;
|
|
2700 if ( pNumActiveItem < pNumActiveItem + pDialogueWindow->pNumPresenceButton )
|
|
2701 {
|
|
2702 do
|
629
|
2703 {
|
644
|
2704 v12 = pDialogueWindow->GetControl(pNumActiveItem)->uControlParam - 36;
|
|
2705 if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayer->classType][v12] && !pPlayer->pActiveSkills[v12] )
|
|
2706 {
|
|
2707 all_text_height = pFontArrus->CalcTextHeight(pSkillNames[v12], &dialog_window, 0, 0);
|
|
2708 v0++;
|
|
2709 }
|
|
2710 ++pNumActiveItem;
|
|
2711 }
|
|
2712 while ( pNumActiveItem < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton );
|
|
2713 if ( v0 )
|
|
2714 {
|
|
2715 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], pItemNum);
|
|
2716 dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3);
|
|
2717 v91 = (149 - all_text_height) / v0;
|
|
2718 if ( (149 - all_text_height) / v0 > 32 )
|
|
2719 v91 = 32;
|
|
2720 v14 = (149 - v0 * v91 - all_text_height) / 2 - v91 / 2 + 162;
|
|
2721 pNumActiveItem = pDialogueWindow->pStartingPosActiveItem;
|
|
2722 if ( pNumActiveItem < pNumActiveItem + pDialogueWindow->pNumPresenceButton )
|
|
2723 {
|
|
2724 pItemNum = 2;
|
|
2725 do
|
|
2726 {
|
|
2727 pButton = pDialogueWindow->GetControl(pItemNum);
|
|
2728 v17 = pButton->uControlParam - 36;
|
|
2729 if ( !byte_4ED970_skill_learn_ability_by_class_table[pPlayer->classType][v17] || pPlayer->pActiveSkills[v17] )
|
|
2730 {
|
|
2731 pButton->uW = 0;
|
|
2732 pButton->uHeight = 0;
|
|
2733 pButton->uY = 0;
|
|
2734 }
|
|
2735 else
|
|
2736 {
|
|
2737 pButton->uY = v91 + v14;
|
|
2738 pTextHeight = pFontArrus->CalcTextHeight(pSkillNames[v17], &dialog_window, 0, 0);
|
|
2739 pButton->uHeight = pTextHeight;
|
|
2740 v14 = pTextHeight + pButton->uY - 1;
|
|
2741 pButton->uW = v14;
|
|
2742 pColorText = pColorYellow;
|
|
2743 if ( pDialogueWindow->pCurrentPosActiveItem != pItemNum )
|
|
2744 pColorText = pColorWhite;
|
|
2745 dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, pSkillNames[v17], 3);
|
|
2746 }
|
|
2747 pNumActiveItem = pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton;
|
|
2748 pItemNum++;
|
|
2749 }
|
|
2750 while ( pItemNum < pNumActiveItem );
|
|
2751 }
|
629
|
2752 return;
|
|
2753 }
|
644
|
2754 }
|
|
2755 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], pPlayer->pName, pClassNames[pPlayer->classType]);
|
|
2756 strcat(pTmpBuf, "\n \n");
|
|
2757 strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]);
|
|
2758 pTextHeight = (174 - pFontArrus->CalcTextHeight(pTmpBuf, &dialog_window, 0, 0)) / 2 + 138;
|
|
2759 dialog_window.DrawTitleText(pFontArrus, 0, pTextHeight, pColorYellow, pTmpBuf, 3);
|
|
2760 return;
|
|
2761 }
|
747
|
2762
|
|
2763 case HOUSE_DIALOGUE_TAVERN_BUY_FOOD:
|
644
|
2764 {
|
|
2765 *(_QWORD *)Str = pParty->uNumFoodRations;
|
|
2766 //if ( (double)pParty->uNumFoodRations >= p2DEvents_minus1__20[13 * (unsigned int)ptr_507BC0->ptr_1C] )
|
|
2767 if ( (double)pParty->uNumFoodRations >= p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier )
|
|
2768 {
|
|
2769 ShowStatusBarString(pGlobalTXT_LocalizationStrings[140], 2);
|
|
2770 if ( uActiveCharacter )
|
|
2771 pPlayers[uActiveCharacter]->PlaySound(SPEECH_67, 0);
|
629
|
2772 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, v5, 0);
|
644
|
2773 return;
|
|
2774 }
|
|
2775 if ( pParty->uNumGold >= v7 )
|
|
2776 {
|
|
2777 Party::TakeGold(v7);
|
|
2778 //pParty->uNumFoodRations = (signed __int64)p2DEvents_minus1__20[13 * (unsigned int)ptr_507BC0->ptr_1C];
|
|
2779 pParty->uNumFoodRations = (signed __int64)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier;
|
735
|
2780 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_Greeting_2);
|
644
|
2781 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
|
|
2782 return;
|
|
2783 }
|
735
|
2784 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2); // "You don't have enough gold"
|
736
|
2785 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_Goodbye);
|
644
|
2786 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, v5, 0);
|
|
2787 break;
|
|
2788 }
|
747
|
2789
|
|
2790 case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_MAIN:
|
644
|
2791 {
|
|
2792 if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
|
|
2793 {
|
|
2794 v48 = 2;
|
|
2795 pShopOptions[0] = pGlobalTXT_LocalizationStrings[620];
|
|
2796 pShopOptions[1] = pGlobalTXT_LocalizationStrings[622];
|
|
2797 pOutString = 0;
|
|
2798 if ( pParty->HasItem(0x28Bu) )
|
|
2799 {
|
|
2800 pShopOptions[2] = pGlobalTXT_LocalizationStrings[621];
|
|
2801 v48 = 3;
|
|
2802 }
|
|
2803 for ( i = 0; i < v48; ++i )
|
|
2804 all_text_height = pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0);
|
|
2805 all_text_height = (174 - all_text_height) / v48;
|
|
2806 pNumActiveItem = pDialogueWindow->pStartingPosActiveItem;
|
|
2807 v54 = (174 - v48 * (174 - all_text_height) / v48 - all_text_height) / 2 - (174 - all_text_height) / v48 / 2 + 138;
|
|
2808 v37 = -pDialogueWindow->pNumPresenceButton < 0;
|
|
2809 if ( v37 ^ pNumActiveItem < pNumActiveItem + pDialogueWindow->pNumPresenceButton )
|
|
2810 {
|
|
2811 pItemNum = 2;
|
|
2812 pNumString = 0;
|
|
2813 do
|
|
2814 {
|
|
2815 pButton = pDialogueWindow->GetControl(pItemNum);
|
|
2816 pButton->uY = all_text_height + v54;
|
|
2817 pTextHeight = pFontArrus->CalcTextHeight((const char *)pShopOptions[pNumString], &dialog_window, 0, 0);
|
|
2818 pButton->uHeight = pTextHeight;
|
|
2819 v54 = pButton->uY + pTextHeight - 1;
|
|
2820 pButton->uW = v54;
|
|
2821 pColorText = pColorYellow;
|
|
2822 if ( pDialogueWindow->pCurrentPosActiveItem != pItemNum )
|
|
2823 pColorText = pColorWhite;
|
|
2824 dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, *(const char **)&pOutString->cFirstChar, 3);
|
|
2825 pItemNum++;
|
|
2826 pNumActiveItem = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem;
|
|
2827 }
|
|
2828 while ( pItemNum < pNumActiveItem );
|
|
2829 }
|
|
2830 }
|
|
2831 break;
|
|
2832 }
|
|
2833 default:
|
|
2834 {
|
|
2835 break;
|
|
2836 }
|
629
|
2837 }
|
|
2838 }
|
|
2839
|
|
2840
|
|
2841 //----- (004B910F) --------------------------------------------------------
|
|
2842 void __cdecl WeaponShopDialog()
|
|
2843 {
|
634
|
2844 int v0; // ebx@1
|
629
|
2845 int pNumActiveItem; // eax@6
|
|
2846 signed int v2; // esi@8
|
|
2847 ItemGen *v4; // eax@11
|
|
2848 char *v5; // ecx@12
|
|
2849 unsigned __int8 v6; // dl@13
|
|
2850 char *v7; // edx@14
|
|
2851 int v9; // ST08_4@16
|
|
2852 int v10; // eax@16
|
|
2853 signed int v11; // esi@18
|
|
2854 int v12; // ST08_4@21
|
|
2855 int v13; // eax@21
|
|
2856 int v14; // edi@23
|
|
2857 char **v15; // esi@23
|
|
2858 int v16; // eax@24
|
644
|
2859 //int v18; // edx@25
|
629
|
2860 int v19; // edi@25
|
|
2861 unsigned __int8 v20; // sf@25
|
|
2862 GUIButton *pButton; // esi@27
|
|
2863 int pNewItem; // eax@27
|
|
2864 unsigned int v24; // ecx@27
|
|
2865 int v25; // edx@27
|
644
|
2866 unsigned int pColorText; // ax@27
|
629
|
2867 signed int v27; // esi@32
|
|
2868 int v28; // ST08_4@36
|
|
2869 int v29; // eax@36
|
|
2870 signed int v32; // esi@41
|
|
2871 unsigned int v33; // esi@43
|
|
2872 int v34; // eax@43
|
|
2873 unsigned int v35; // eax@44
|
|
2874 int v36; // eax@46
|
|
2875 __int32 v37; // ecx@51
|
|
2876 int v40; // eax@53
|
|
2877 char *v41; // eax@55
|
|
2878 unsigned int v43; // ecx@55
|
|
2879 const char **v44; // edx@55
|
|
2880 int v45; // eax@55
|
|
2881 int v47; // eax@59
|
|
2882 const char **v48; // eax@63
|
|
2883 unsigned int v49; // esi@65
|
|
2884 Texture *v50; // eax@65
|
|
2885 int v51; // edi@65
|
|
2886 int v52; // esi@70
|
|
2887 Texture *v53; // ST1C_4@70
|
|
2888 int v54; // edi@70
|
|
2889 signed int v55; // ecx@73
|
|
2890 SHORT v56; // di@82
|
|
2891 bool v57; // eax@82
|
|
2892 const char *v58; // ecx@84
|
|
2893 POINT *v59; // esi@89
|
|
2894 LONG v60; // ecx@90
|
|
2895 int v61; // eax@90
|
|
2896 int v62; // ecx@90
|
|
2897 ItemGen *v63; // esi@90
|
|
2898 int v64; // eax@95
|
|
2899 int all_text_height; // esi@96
|
|
2900 char **v66; // edi@96
|
|
2901 int v67; // eax@97
|
|
2902 int v69; // edx@98
|
|
2903 int v70; // edi@98
|
634
|
2904 int v71;
|
629
|
2905 const char **v72; // eax@100
|
|
2906 int pTextHeight; // eax@100
|
|
2907 unsigned int v74; // ecx@100
|
|
2908 int v78; // [sp-14h] [bp-10Ch]@14
|
|
2909 ItemGen *v79; // [sp-10h] [bp-108h]@12
|
|
2910 int v80; // [sp-10h] [bp-108h]@14
|
|
2911 void *v81; // [sp-Ch] [bp-104h]@12
|
|
2912 unsigned __int16 v82; // [sp-Ch] [bp-104h]@14
|
|
2913 int v83; // [sp-8h] [bp-100h]@11
|
|
2914 char *v84; // [sp-8h] [bp-100h]@14
|
|
2915 __int64 *v85; // [sp-4h] [bp-FCh]@11
|
|
2916 unsigned int v86; // [sp-4h] [bp-FCh]@14
|
|
2917 POINT v87; // [sp+Ch] [bp-ECh]@8
|
|
2918 POINT v88; // [sp+14h] [bp-E4h]@18
|
|
2919 POINT v89; // [sp+1Ch] [bp-DCh]@89
|
|
2920 POINT v90; // [sp+24h] [bp-D4h]@19
|
|
2921 POINT v91; // [sp+2Ch] [bp-CCh]@89
|
|
2922 POINT v92; // [sp+34h] [bp-C4h]@9
|
|
2923 POINT v93; // [sp+3Ch] [bp-BCh]@33
|
|
2924 POINT v94; // [sp+44h] [bp-B4h]@18
|
|
2925 POINT v95; // [sp+4Ch] [bp-ACh]@32
|
|
2926 POINT v96; // [sp+54h] [bp-A4h]@18
|
|
2927 POINT v97; // [sp+5Ch] [bp-9Ch]@32
|
|
2928 POINT a2; // [sp+64h] [bp-94h]@8
|
|
2929 POINT v99; // [sp+6Ch] [bp-8Ch]@32
|
|
2930 POINT v100; // [sp+74h] [bp-84h]@8
|
|
2931 GUIWindow dialog_window; // [sp+7Ch] [bp-7Ch]@1
|
|
2932 char *Str; // [sp+D0h] [bp-28h]@55
|
|
2933 __int32 v103; // [sp+D4h] [bp-24h]@25
|
644
|
2934 int pColorYellow; // [sp+D8h] [bp-20h]@1
|
629
|
2935 int pColorWhite; // [sp+DCh] [bp-1Ch]@1
|
|
2936 POINT v106; // [sp+E0h] [bp-18h]@8
|
|
2937 Player *pPlayer; // [sp+E8h] [bp-10h]@1
|
|
2938 int pItemNum; // [sp+ECh] [bp-Ch]@26
|
|
2939 const char **v109; // [sp+F0h] [bp-8h]@26
|
|
2940 unsigned __int8 v110; // [sp+F7h] [bp-1h]@16
|
|
2941 int pNumString;
|
|
2942
|
|
2943 pPlayer = pPlayers[uActiveCharacter];
|
|
2944 memcpy(&dialog_window, window_SpeakInHouse, sizeof(dialog_window));
|
|
2945 dialog_window.uFrameX = 483;
|
|
2946 dialog_window.uFrameWidth = 148;
|
|
2947 dialog_window.uFrameZ = 334;
|
|
2948 pColorWhite = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu);
|
644
|
2949 pColorYellow = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xCDu, 0x23u);
|
747
|
2950
|
629
|
2951 switch(dialog_menu_id)
|
|
2952 {
|
747
|
2953 case HOUSE_DIALOGUE_MAIN:
|
629
|
2954 {
|
|
2955 pNumActiveItem = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win();
|
|
2956 if ( pNumActiveItem )
|
|
2957 {
|
|
2958 pShopOptions[0] = pGlobalTXT_LocalizationStrings[134];
|
|
2959 pShopOptions[1] = pGlobalTXT_LocalizationStrings[152];
|
|
2960 pShopOptions[2] = pGlobalTXT_LocalizationStrings[159];
|
|
2961 pShopOptions[3] = pGlobalTXT_LocalizationStrings[160];
|
|
2962 all_text_height = 0;
|
|
2963 for (int i = 0; i < 4; ++i)//while ( (signed int)v15 < (signed int)&unk_F8B1C8 );
|
|
2964 all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0);
|
|
2965 v103 = (174 - all_text_height) / 4;
|
|
2966 pNumActiveItem = pDialogueWindow->pStartingPosActiveItem;
|
|
2967 v19 = (174 - 4 * (174 - all_text_height) / 4 - all_text_height) / 2 - (174 - all_text_height) / 4 / 2 + 138;
|
|
2968 v20 = -pDialogueWindow->pNumPresenceButton < 0;
|
644
|
2969 if ( v20 ^ pNumActiveItem > pNumActiveItem + pDialogueWindow->pNumPresenceButton )
|
629
|
2970 {
|
|
2971 pItemNum = 2;
|
|
2972 pNumString = 0;
|
|
2973 do
|
|
2974 {
|
|
2975 pButton = pDialogueWindow->GetControl(pItemNum);
|
|
2976 pButton->uY = v103 + v19;
|
|
2977 pTextHeight = pFontArrus->CalcTextHeight((const char *)pShopOptions[pNumString], &dialog_window, 0, 0);
|
|
2978 pButton->uHeight = pTextHeight;
|
|
2979 v19 = pButton->uY + pTextHeight - 1;
|
|
2980 pButton->uW = v19;
|
644
|
2981 pColorText = pColorYellow;
|
629
|
2982 if ( pDialogueWindow->pCurrentPosActiveItem != pItemNum )
|
644
|
2983 pColorText = pColorWhite;
|
|
2984 dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, (const char *)pShopOptions[pNumString], 3);
|
629
|
2985 ++pItemNum;
|
|
2986 ++pNumString;
|
|
2987 pNumActiveItem = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem;
|
|
2988 }
|
|
2989 while ( pItemNum < pNumActiveItem );
|
|
2990 }
|
|
2991 }
|
|
2992 break;
|
|
2993 }
|
747
|
2994
|
|
2995 case HOUSE_DIALOGUE_SHOP_BUY_STANDARD:
|
629
|
2996 {
|
|
2997 pRenderer->DrawTextureIndexed(8, 8, ShopTexture);
|
|
2998 v48 = 0;
|
|
2999 pItemNum = 0;
|
|
3000 v109 = 0;
|
|
3001 do
|
|
3002 {
|
|
3003 // if ( pParty->field_777C[9 * (int)&v48[3 * (unsigned int)window_SpeakInHouse->ptr_1C]] )
|
668
|
3004 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][(int)v48].uItemID)
|
629
|
3005 {
|
|
3006 v49 = word_F8B158[(signed int)v48];
|
|
3007 v50 = ItemsInShopTexture[(signed int)v48];
|
|
3008 v49 += 30;
|
|
3009 v51 = 60 - ((signed int)v50->uTextureWidth >> 1);
|
|
3010 pRenderer->DrawTextureTransparent(v51 + pItemNum, v49, v50);
|
|
3011 sub_40F92A(&pRenderer->pActiveZBuffer[v51 + pItemNum + 640 * v49], ItemsInShopTexture[(signed int)v109], (int)((char *)v109 + 1));
|
|
3012 v48 = v109;
|
|
3013 }
|
|
3014 pItemNum += 70;
|
|
3015 v48 = (const char **)((char *)v48 + 1);
|
|
3016 v109 = v48;
|
|
3017 }
|
|
3018 while ( (signed int)v48 < 6 );
|
|
3019 pNumActiveItem = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win();
|
|
3020 if ( pNumActiveItem )
|
|
3021 {
|
|
3022 v55 = 0;
|
|
3023 v106.x = 0;
|
|
3024 v106.x = 0;
|
|
3025 do
|
|
3026 {
|
757
|
3027 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v55].uItemID)//9 * (v55 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] )
|
629
|
3028 ++v106.x;
|
|
3029 ++v55;
|
|
3030 }
|
|
3031 while ( v55 < 6 );
|
|
3032 v56 = GetAsyncKeyState(17);
|
|
3033 v57 = pPlayer->CanSteal();
|
|
3034 Str = (char *)v57;
|
|
3035 if ( v56 && v57 )
|
|
3036 {
|
|
3037 v58 = pGlobalTXT_LocalizationStrings[185];
|
|
3038 }
|
|
3039 else
|
|
3040 {
|
|
3041 v58 = pGlobalTXT_LocalizationStrings[195];
|
749
|
3042 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD)
|
629
|
3043 v58 = pGlobalTXT_LocalizationStrings[196];
|
|
3044 }
|
|
3045 DrawTextAtStatusBar(v58, 0);
|
|
3046 if ( v106.x )
|
|
3047 {
|
|
3048 v59 = pMouse->GetCursorPos(&v91);
|
|
3049 pNumActiveItem = v59->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v89)->y];
|
|
3050 if ( pRenderer->pActiveZBuffer[pNumActiveItem] & 0xFFFF )
|
|
3051 {
|
|
3052 v60 = (pRenderer->pActiveZBuffer[pNumActiveItem] & 0xFFFF) - 1;
|
|
3053 v106.x = v60;
|
|
3054 v61 = (int)window_SpeakInHouse->ptr_1C;
|
|
3055 // v62 = 9 * (v60 + 12 * v61);
|
|
3056 v63 = (ItemGen *)&pParty->StandartItemsInShops[(int)v61][v60];
|
749
|
3057 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD)
|
629
|
3058 v63 = &pParty->SpecialItemsInShops[(int)v61][v60];//v63 = (ItemGen *)&pParty->field_C59C[v62 + 724];
|
|
3059 if ( !v56 || !Str )
|
|
3060 {
|
|
3061 v64 = pPlayer->_490EEE(v63, 1, v61, 2);
|
|
3062 v7 = BuilDialogueString((char *)pMerchantsBuyPhrases[v64], uActiveCharacter - 1, v63, (char *)window_SpeakInHouse->ptr_1C, 2, 0);
|
634
|
3063 pTextHeight = pFontArrus->CalcTextHeight(v7, &dialog_window, 0, 0);
|
|
3064 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, pColorWhite, v7, 3);
|
629
|
3065 }
|
|
3066 else
|
|
3067 {
|
|
3068 v7 = BuilDialogueString(pGlobalTXT_LocalizationStrings[181], uActiveCharacter - 1, v63, (char *)window_SpeakInHouse->ptr_1C, 2, 0);
|
634
|
3069 pTextHeight = pFontArrus->CalcTextHeight(v7, &dialog_window, 0, 0);
|
|
3070 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, pColorWhite, v7, 3);
|
629
|
3071 }
|
|
3072 }
|
|
3073 }
|
|
3074 else
|
|
3075 {
|
|
3076 dialog_window.DrawCurrentTime( pParty->field_3C.field_50[(unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed);
|
|
3077 pNumActiveItem = 0; //added
|
|
3078 }
|
|
3079 }
|
|
3080 break;
|
|
3081 }
|
747
|
3082
|
|
3083 case HOUSE_DIALOGUE_SHOP_SELL:
|
629
|
3084 {
|
|
3085 draw_leather();
|
|
3086 CharacterUI_InventoryTab_Draw(uActiveCharacter, 1);
|
|
3087 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[199], 0);
|
|
3088 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
|
|
3089 return;
|
|
3090 if((v11 = pMouse->GetCursorPos(&v96)->x - 14, v106.x = (v11 >> 5) + 14 * ((pMouse->GetCursorPos(&v88)->y - 17) >> 5),
|
|
3091 pMouse->GetCursorPos(&v94)->x <= 13) || pMouse->GetCursorPos(&v90)->x >= 462
|
634
|
3092 || (pNumActiveItem = pPlayer->GetItemIDAtInventoryIndex((int *)&v106.x), !pNumActiveItem) )
|
629
|
3093 return;
|
|
3094 v79 = (ItemGen *)&pPlayer->pInventoryItems[pNumActiveItem - 1];
|
|
3095 v13 = pPlayer->_490EEE(v79, 1, (int)window_SpeakInHouse->ptr_1C, 3);
|
|
3096 v7 = BuilDialogueString((char *)pMerchantsSellPhrases[v13], uActiveCharacter - 1, v79, (char *)window_SpeakInHouse->ptr_1C, 3, 0);
|
634
|
3097 pTextHeight = pFontArrus->CalcTextHeight(v7, &dialog_window, 0, 0);
|
|
3098 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, pColorWhite, v7, 3);
|
629
|
3099 break;
|
|
3100 }
|
747
|
3101
|
|
3102 case HOUSE_DIALOGUE_SHOP_IDENTIFY:
|
629
|
3103 {
|
|
3104 draw_leather();
|
|
3105 CharacterUI_InventoryTab_Draw(uActiveCharacter, 1);
|
|
3106 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[197], 0);
|
|
3107 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
|
|
3108 return;
|
|
3109 if((v2 = pMouse->GetCursorPos(&a2)->x - 14, v106.x = (v2 >> 5) + 14 * ((pMouse->GetCursorPos(&v87)->y - 17) >> 5),
|
|
3110 pMouse->GetCursorPos(&v100)->x <= 13) || pMouse->GetCursorPos(&v92)->x >= 462
|
634
|
3111 || (pNumActiveItem = pPlayer->GetItemIDAtInventoryIndex((int *)&v106.x), !pNumActiveItem) )
|
629
|
3112 return;
|
|
3113 v4 = (ItemGen *)&pPlayer->pInventoryItems[pNumActiveItem - 1];
|
|
3114 if (!v4->Identified())
|
|
3115 {
|
|
3116 v10 = pPlayer->_490EEE(v4, 1, (int)window_SpeakInHouse->ptr_1C, 4);
|
|
3117 v7 = BuilDialogueString((char *)pMerchantsIdentifyPhrases[v10], uActiveCharacter - 1, v4, (char *)window_SpeakInHouse->ptr_1C, 4, 0);
|
634
|
3118 pTextHeight = pFontArrus->CalcTextHeight(v7, &dialog_window, 0, 0);
|
|
3119 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, pColorWhite, v7, 3);
|
629
|
3120 }
|
634
|
3121 else
|
|
3122 {
|
|
3123 v7 = BuilDialogueString("%24", uActiveCharacter - 1, v4, (char *)window_SpeakInHouse->ptr_1C, 4, 0);
|
|
3124 pTextHeight = pFontArrus->CalcTextHeight(v7, &dialog_window, 0, 0);
|
|
3125 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, pColorWhite, v7, 3);
|
|
3126 }
|
629
|
3127 break;
|
|
3128 }
|
747
|
3129
|
|
3130 case HOUSE_DIALOGUE_SHOP_REPAIR:
|
629
|
3131 {
|
|
3132 draw_leather();
|
|
3133 CharacterUI_InventoryTab_Draw(uActiveCharacter, 1);
|
|
3134 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[198], 0);
|
|
3135 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win())
|
|
3136 return;
|
|
3137 if( (v2 = pMouse->GetCursorPos(&a2)->x - 14, v106.x = (v2 >> 5) + 14 * ((pMouse->GetCursorPos(&v87)->y - 17) >> 5),
|
|
3138 pMouse->GetCursorPos(&v100)->x <= 13) || pMouse->GetCursorPos(&v92)->x >= 462
|
634
|
3139 || (pNumActiveItem = pPlayer->GetItemIDAtInventoryIndex((int *)&v106.x), !pNumActiveItem)
|
629
|
3140 || (pNumActiveItem = 9 * pNumActiveItem, !(pPlayer->field_1F5[4 * pNumActiveItem + 15] & 2)) )
|
|
3141 return;
|
|
3142 v4 = (ItemGen *)&pPlayer->pInventoryItems[pNumActiveItem - 1];
|
|
3143 v10 = pPlayer->_490EEE(v4, 2, (int)window_SpeakInHouse->ptr_1C, 5);
|
|
3144 v7 = BuilDialogueString((char *)pMerchantsRepairPhrases[v10], uActiveCharacter - 1, v4, (char *)window_SpeakInHouse->ptr_1C, 5, 0);
|
|
3145 pTextHeight = (174 - pFontArrus->CalcTextHeight(v7, &dialog_window, 0, 0)) / 2 + 138;
|
|
3146 dialog_window.DrawTitleText(pFontArrus, 0, pTextHeight, pColorWhite, v7, 3);
|
|
3147 return;
|
|
3148 }
|
|
3149 break;
|
747
|
3150
|
|
3151 case HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT:
|
629
|
3152 {
|
|
3153 draw_leather();
|
|
3154 CharacterUI_InventoryTab_Draw(uActiveCharacter, 1);
|
|
3155 pShopOptions[0] = pGlobalTXT_LocalizationStrings[200];//sell
|
|
3156 pShopOptions[1] = pGlobalTXT_LocalizationStrings[113];//identify
|
|
3157 pShopOptions[2] = pGlobalTXT_LocalizationStrings[179];//repair
|
|
3158 all_text_height = 0;
|
|
3159 for ( int i = 0; i < 3; ++i )
|
|
3160 all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0);
|
|
3161 v103 = (174 - all_text_height) / 3;
|
|
3162 pNumActiveItem = pDialogueWindow->pStartingPosActiveItem;
|
|
3163 v70 = (3 * (58 - (signed int)v103) - all_text_height) / 2 - ((174 - all_text_height) / 3) / 2 + 138;
|
|
3164 v20 = -pDialogueWindow->pNumPresenceButton < 0;
|
644
|
3165 if ( v20 ^ pNumActiveItem > pNumActiveItem + pDialogueWindow->pNumPresenceButton )
|
629
|
3166 {
|
|
3167 pItemNum = 2;
|
|
3168 pNumString = 0;
|
|
3169 do
|
|
3170 {
|
|
3171 pButton = pDialogueWindow->GetControl(pItemNum);
|
|
3172 pButton->uY = v103 + v70;
|
|
3173 pTextHeight = pFontArrus->CalcTextHeight((const char *)pShopOptions[pNumString], &dialog_window, 0, 0);
|
|
3174 pButton->uHeight = pTextHeight;
|
|
3175 v70 = pButton->uY + pTextHeight - 1;
|
|
3176 pButton->uW = v70;
|
644
|
3177 pColorText = pColorYellow;
|
629
|
3178 if ( pDialogueWindow->pCurrentPosActiveItem != pItemNum )
|
644
|
3179 pColorText = pColorWhite;
|
|
3180 dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, (const char *)pShopOptions[pNumString], 3);
|
629
|
3181 ++pItemNum;
|
|
3182 ++pNumString;
|
|
3183 pNumActiveItem = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem;
|
|
3184 }
|
|
3185 while ( pItemNum < pNumActiveItem );
|
|
3186 }
|
|
3187 break;
|
|
3188 }
|
747
|
3189
|
|
3190 case HOUSE_DIALOGUE_SHOP_BUY_SPECIAL:
|
629
|
3191 {
|
|
3192 pRenderer->DrawTextureIndexed(8, 8, ShopTexture);
|
|
3193 v109 = 0;
|
|
3194 pItemNum = 0;
|
|
3195 do
|
|
3196 {
|
|
3197 // if ( pParty->field_C59C[9 * (int)&v109[3 * (unsigned int)window_SpeakInHouse->ptr_1C] + 724] )
|
|
3198 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][(signed int)v109].uItemID)
|
|
3199 {
|
|
3200 v52 = word_F8B158[(signed int)v109] + 30;
|
|
3201 v53 = ItemsInShopTexture[(signed int)v109];
|
|
3202 v54 = 60 - ((signed int)v53->uTextureWidth >> 1);
|
|
3203 pRenderer->DrawTextureTransparent(v54 + pItemNum, word_F8B158[(signed int)v109] + 30, v53);
|
|
3204 sub_40F92A(&pRenderer->pActiveZBuffer[v54 + pItemNum + 640 * v52], ItemsInShopTexture[(signed int)v109], (int)((char *)v109 + 1));
|
|
3205 }
|
|
3206 v109 = (const char **)((char *)v109 + 1);
|
|
3207 pItemNum += 70;
|
|
3208 }
|
|
3209 while ( (signed int)v109 < 6 );
|
|
3210 pNumActiveItem = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win();
|
|
3211 if ( pNumActiveItem )
|
|
3212 {
|
|
3213 v55 = 0;
|
|
3214 v106.x = 0;
|
|
3215 do
|
|
3216 {
|
|
3217 // if ( pParty->field_C59C[9 * (v55 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] )
|
|
3218 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v55].uItemID)
|
|
3219 ++v106.x;
|
|
3220 ++v55;
|
|
3221 }
|
|
3222 while ( v55 < 6 );
|
|
3223 v56 = GetAsyncKeyState(17);
|
|
3224 v57 = pPlayer->CanSteal();
|
|
3225 Str = (char *)v57;
|
|
3226 if ( v56 && v57 )
|
|
3227 {
|
|
3228 v58 = pGlobalTXT_LocalizationStrings[185];
|
|
3229 }
|
|
3230 else
|
|
3231 {
|
|
3232 v58 = pGlobalTXT_LocalizationStrings[195];
|
749
|
3233 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD)
|
629
|
3234 v58 = pGlobalTXT_LocalizationStrings[196];
|
|
3235 }
|
|
3236 DrawTextAtStatusBar(v58, 0);
|
|
3237 if ( v106.x )
|
|
3238 {
|
|
3239 v59 = pMouse->GetCursorPos(&v91);
|
|
3240 pNumActiveItem = v59->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v89)->y];
|
|
3241 if ( pRenderer->pActiveZBuffer[pNumActiveItem] & 0xFFFF )
|
|
3242 {
|
|
3243 v60 = (pRenderer->pActiveZBuffer[pNumActiveItem] & 0xFFFF) - 1;
|
|
3244 v106.x = v60;
|
|
3245 v61 = (int)window_SpeakInHouse->ptr_1C;
|
|
3246 // v62 = 9 * (v60 + 12 * v61);
|
|
3247 v63 = (ItemGen *)&pParty->StandartItemsInShops[(int)v61][v60];
|
749
|
3248 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD)
|
629
|
3249 v63 = &pParty->SpecialItemsInShops[(int)v61][v60];//v63 = (ItemGen *)&pParty->field_C59C[v62 + 724];
|
|
3250 if ( !v56 || !Str )
|
|
3251 {
|
|
3252 v64 = pPlayer->_490EEE(v63, 1, v61, 2);
|
|
3253 v7 = BuilDialogueString((char *)pMerchantsBuyPhrases[v64], uActiveCharacter - 1, v63, (char *)window_SpeakInHouse->ptr_1C, 2, 0);
|
634
|
3254 pTextHeight = pFontArrus->CalcTextHeight(v7, &dialog_window, 0, 0);
|
|
3255 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, pColorWhite, v7, 3);
|
629
|
3256 }
|
|
3257 else
|
|
3258 {
|
|
3259 v7 = BuilDialogueString(pGlobalTXT_LocalizationStrings[181], uActiveCharacter - 1, v63, (char *)window_SpeakInHouse->ptr_1C, 2, 0);
|
634
|
3260 pTextHeight = pFontArrus->CalcTextHeight(v7, &dialog_window, 0, 0);
|
|
3261 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, pColorWhite, v7, 3);
|
629
|
3262 }
|
|
3263 }
|
|
3264 }
|
|
3265 else
|
|
3266 {
|
|
3267 dialog_window.DrawCurrentTime( pParty->field_3C.field_50[(unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed);
|
|
3268 pNumActiveItem = 0; //added
|
|
3269 }
|
|
3270 }
|
|
3271 break;
|
|
3272 }
|
747
|
3273
|
|
3274 case HOUSE_DIALOGUE_LEARN_SKILLS:
|
629
|
3275 {
|
634
|
3276 if (!sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win())
|
|
3277 return;
|
|
3278 v0 = 0;
|
|
3279 all_text_height = 0;
|
|
3280 //v32 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (signed int)v31] * 500.0);
|
|
3281 v32 = (signed __int64)(p2DEvents[(signed int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0);
|
|
3282 pItemNum = v32 * (100 - pPlayer->GetMerchant()) / 100;
|
|
3283 if ( pItemNum < v32 / 3 )
|
|
3284 pItemNum = v32 / 3;
|
|
3285 pNumActiveItem = pDialogueWindow->pStartingPosActiveItem;
|
|
3286 if ( pNumActiveItem >= pNumActiveItem + pDialogueWindow->pNumPresenceButton )
|
|
3287 {
|
|
3288 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], pPlayer->pName, pClassNames[pPlayer->classType]);
|
|
3289 strcat(pTmpBuf, "\n \n");
|
|
3290 strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]);
|
|
3291 pTextHeight = pFontArrus->CalcTextHeight(pTmpBuf, &dialog_window, 0, 0);
|
644
|
3292 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, pColorYellow, pTmpBuf, 3);
|
634
|
3293 return;
|
|
3294 }
|
|
3295 do
|
629
|
3296 {
|
634
|
3297 v35 = pDialogueWindow->GetControl(pNumActiveItem)->uControlParam - 36;
|
|
3298 if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayer->classType][v35] && !pPlayer->pActiveSkills[v35] )
|
629
|
3299 {
|
634
|
3300 all_text_height += pFontArrus->CalcTextHeight(pSkillNames[v35], &dialog_window, 0, 0);
|
|
3301 v0++;
|
629
|
3302 }
|
634
|
3303 ++pNumActiveItem;
|
|
3304 }
|
|
3305 while ( pNumActiveItem < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem );
|
|
3306 if ( !v0 )
|
|
3307 {
|
|
3308 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], pPlayer->pName, pClassNames[pPlayer->classType]);
|
|
3309 strcat(pTmpBuf, "\n \n");
|
|
3310 strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]);
|
|
3311 pTextHeight = pFontArrus->CalcTextHeight(pTmpBuf, &dialog_window, 0, 0);
|
644
|
3312 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, pColorYellow, pTmpBuf, 3);
|
634
|
3313 return;
|
|
3314 }
|
|
3315 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], pItemNum);
|
|
3316 dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3);
|
|
3317 v103 = (149 - all_text_height) / v0;
|
|
3318 if ( (149 - all_text_height) / v0 > 32 )
|
|
3319 v103 = 32;
|
|
3320 pNumActiveItem = pDialogueWindow->pStartingPosActiveItem;
|
|
3321 v37 = (149 - v0 * v103 - all_text_height) / 2 - v103 / 2 + 162;
|
|
3322 if ( pNumActiveItem < pNumActiveItem + pDialogueWindow->pNumPresenceButton )
|
|
3323 {
|
|
3324 pItemNum = 2;
|
629
|
3325 do
|
|
3326 {
|
634
|
3327 pButton = pDialogueWindow->GetControl(pItemNum);
|
|
3328 v40 = pButton->uControlParam - 36;
|
|
3329 if ( !byte_4ED970_skill_learn_ability_by_class_table[pPlayer->classType][v40] || pPlayer->pActiveSkills[v40] )
|
629
|
3330 {
|
634
|
3331 pButton->uW = 0;
|
|
3332 pButton->uHeight = 0;
|
|
3333 pButton->uY = 0;
|
629
|
3334 }
|
634
|
3335 else
|
|
3336 {
|
|
3337 pButton->uY = v103 + v37;
|
|
3338 pTextHeight = pFontArrus->CalcTextHeight(pSkillNames[v40], &dialog_window, 0, 0);
|
|
3339 pButton->uHeight = pTextHeight;
|
|
3340 v37 = pButton->uY + pTextHeight - 1;
|
|
3341 pButton->uW = v37;
|
644
|
3342 pColorText = pColorYellow;
|
634
|
3343 if ( pDialogueWindow->pCurrentPosActiveItem != pItemNum )
|
644
|
3344 pColorText = pColorWhite;
|
|
3345 dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, pSkillNames[v40], 3);
|
634
|
3346 }
|
|
3347 pNumActiveItem = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem;
|
|
3348 pItemNum++;
|
629
|
3349 }
|
634
|
3350 while ( pItemNum < pNumActiveItem );
|
629
|
3351 }
|
|
3352 break;
|
|
3353 }
|
|
3354 default:
|
|
3355 {
|
749
|
3356 if( dialog_menu_id > HOUSE_DIALOGUE_SHOP_REPAIR)
|
629
|
3357 pNumActiveItem = dialog_menu_id - 96;
|
|
3358 else
|
|
3359 pNumActiveItem = dialog_menu_id - 4;
|
|
3360 break;
|
|
3361 }
|
|
3362 }
|
|
3363 }
|
|
3364
|
|
3365
|
|
3366
|
|
3367 //----- (004B9CC6) --------------------------------------------------------
|
|
3368 void __cdecl AlchemistDialog()
|
|
3369 {
|
634
|
3370 int v0;
|
|
3371 int pNumActiveItem; // eax@7
|
629
|
3372 signed int v5; // esi@9
|
|
3373 unsigned int v6; // esi@11
|
|
3374 int v7; // eax@11
|
|
3375 unsigned int v8; // eax@12
|
|
3376 int v9; // eax@14
|
|
3377 int v10; // ecx@19
|
|
3378 int v13; // eax@21
|
|
3379 char *v14; // eax@23
|
|
3380 int v15; // eax@23
|
|
3381 unsigned int v16; // ecx@23
|
|
3382 int v17; // edx@23
|
|
3383 int v18; // eax@23
|
|
3384 int v20; // eax@27
|
|
3385 char *v21; // edx@29
|
|
3386 int v22; // esi@30
|
|
3387 char **v23; // edi@30
|
|
3388 int v24; // eax@31
|
|
3389 int v26; // edx@32
|
|
3390 int v27; // edi@32
|
|
3391 unsigned __int8 v28; // sf@32
|
|
3392 const char **v30; // eax@34
|
|
3393 int v31; // eax@34
|
|
3394 unsigned int v32; // ecx@34
|
|
3395 int v34; // eax@34
|
|
3396 signed int v36; // esi@39
|
|
3397 ItemGen *v37; // eax@42
|
|
3398 char *v38; // ecx@43
|
|
3399 unsigned __int8 v39; // dl@44
|
|
3400 int v40; // eax@46
|
|
3401 int v41; // ST08_4@47
|
|
3402 int v42; // eax@47
|
|
3403 signed int v43; // esi@49
|
|
3404 int v44; // ST08_4@52
|
|
3405 int v45; // eax@52
|
|
3406 Texture *v46; // ecx@55
|
|
3407 unsigned int v47; // edi@55
|
|
3408 unsigned int v48; // esi@57
|
|
3409 int v49; // edx@61
|
|
3410 Texture *v50; // ecx@67
|
|
3411 unsigned int v51; // edi@67
|
|
3412 unsigned int v52; // esi@69
|
|
3413 int v53; // edx@73
|
|
3414 Texture *v54; // ecx@79
|
|
3415 unsigned int v55; // edi@79
|
|
3416 unsigned int v56; // esi@81
|
|
3417 int v57; // edx@85
|
|
3418 Texture *v58; // ecx@91
|
|
3419 unsigned int v59; // edi@91
|
|
3420 unsigned int v60; // esi@93
|
|
3421 int v61; // edx@97
|
|
3422 signed int v62; // ecx@102
|
|
3423 SHORT v63; // di@110
|
|
3424 bool v64; // eax@110
|
|
3425 const char *v65; // ecx@112
|
|
3426 POINT *v66; // esi@117
|
|
3427 int v67; // ecx@118
|
|
3428 int v68; // eax@118
|
|
3429 int v69; // ecx@118
|
|
3430 ItemGen *v70; // esi@118
|
|
3431 int v71; // eax@123
|
634
|
3432 int all_text_height; // edi@125
|
629
|
3433 char **v73; // esi@125
|
|
3434 int v74; // eax@126
|
634
|
3435 int pItemNum;
|
629
|
3436 int v76; // edx@127
|
|
3437 int v77; // edi@127
|
634
|
3438 GUIButton *pButton; // esi@129
|
629
|
3439 const char **v79; // eax@129
|
634
|
3440 int pTextHeight; // eax@129
|
629
|
3441 unsigned int v81; // ecx@129
|
644
|
3442 unsigned int pColorText; // ax@129
|
629
|
3443 int v85; // [sp-14h] [bp-ECh]@29
|
|
3444 int v86; // [sp-10h] [bp-E8h]@29
|
|
3445 ItemGen *v87; // [sp-10h] [bp-E8h]@43
|
|
3446 unsigned __int16 v88; // [sp-Ch] [bp-E4h]@29
|
|
3447 void *v89; // [sp-Ch] [bp-E4h]@43
|
|
3448 char *v90; // [sp-8h] [bp-E0h]@29
|
|
3449 int v91; // [sp-8h] [bp-E0h]@42
|
|
3450 unsigned int v92; // [sp-4h] [bp-DCh]@29
|
|
3451 __int64 *v93; // [sp-4h] [bp-DCh]@42
|
|
3452 POINT v94; // [sp+Ch] [bp-CCh]@39
|
|
3453 POINT v95; // [sp+14h] [bp-C4h]@49
|
|
3454 POINT v96; // [sp+1Ch] [bp-BCh]@117
|
|
3455 POINT v97; // [sp+24h] [bp-B4h]@40
|
|
3456 POINT v98; // [sp+2Ch] [bp-ACh]@117
|
|
3457 POINT v99; // [sp+34h] [bp-A4h]@49
|
|
3458 POINT v100; // [sp+3Ch] [bp-9Ch]@50
|
|
3459 POINT v101; // [sp+44h] [bp-94h]@39
|
|
3460 POINT v102; // [sp+4Ch] [bp-8Ch]@49
|
|
3461 POINT a2; // [sp+54h] [bp-84h]@39
|
634
|
3462 GUIWindow dialog_window; // [sp+5Ch] [bp-7Ch]@1
|
629
|
3463 int v105; // [sp+B0h] [bp-28h]@19
|
644
|
3464 int pColorYellow; // [sp+B4h] [bp-24h]@1
|
634
|
3465 int Str; // [sp+B8h] [bp-20h]@23
|
|
3466 int pColorWhite; // [sp+BCh] [bp-1Ch]@1
|
629
|
3467 __int32 v109; // [sp+C0h] [bp-18h]@39
|
634
|
3468 Player *pPlayer; // [sp+C4h] [bp-14h]@1
|
|
3469 int pNumString; // [sp+C8h] [bp-10h]@9
|
629
|
3470 unsigned int v112; // [sp+CCh] [bp-Ch]@9
|
|
3471 unsigned __int8 v113; // [sp+D3h] [bp-5h]@47
|
|
3472 int v114; // [sp+D4h] [bp-4h]@11
|
|
3473
|
634
|
3474 pPlayer = pPlayers[uActiveCharacter];
|
|
3475 memcpy(&dialog_window, window_SpeakInHouse, sizeof(dialog_window));
|
|
3476 dialog_window.uFrameX = 483;
|
|
3477 dialog_window.uFrameWidth = 148;
|
|
3478 dialog_window.uFrameZ = 334;
|
|
3479 pColorWhite = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu);
|
644
|
3480 pColorYellow = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xCDu, 0x23u);
|
629
|
3481 switch(dialog_menu_id)
|
|
3482 {
|
747
|
3483 case HOUSE_DIALOGUE_MAIN:
|
634
|
3484 {
|
|
3485 if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
|
|
3486 {
|
|
3487 pShopOptions[0] = pGlobalTXT_LocalizationStrings[134];
|
|
3488 pShopOptions[1] = pGlobalTXT_LocalizationStrings[152];
|
|
3489 pShopOptions[2] = pGlobalTXT_LocalizationStrings[159];
|
|
3490 pShopOptions[3] = pGlobalTXT_LocalizationStrings[160];
|
|
3491 all_text_height = 0;
|
|
3492 for (int i = 0; i < 4; ++i)//while ( (signed int)v15 < (signed int)&unk_F8B1C8 );
|
|
3493 all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0);
|
|
3494 Str = (174 - all_text_height) / 4;
|
|
3495 pNumActiveItem = pDialogueWindow->pStartingPosActiveItem;
|
|
3496 v76 = pNumActiveItem + pDialogueWindow->pNumPresenceButton;
|
|
3497 v77 = (174 - 4 * (174 - all_text_height) / 4 - all_text_height) / 2 - (174 - all_text_height) / 4 / 2 + 138;
|
|
3498 v28 = -pDialogueWindow->pNumPresenceButton < 0;
|
|
3499 if ( v28 ^ pNumActiveItem > v76 )
|
|
3500 {
|
|
3501 pItemNum = 2;
|
|
3502 pNumString = 0;
|
|
3503 do
|
|
3504 {
|
|
3505 pButton = pDialogueWindow->GetControl(pItemNum);
|
|
3506 pButton->uY = Str + v77;
|
|
3507 pTextHeight = pFontArrus->CalcTextHeight((const char *)pShopOptions[pNumString], &dialog_window, 0, 0);
|
|
3508 pButton->uHeight = pTextHeight;
|
|
3509 v77 = pButton->uY + pTextHeight - 1;
|
|
3510 pButton->uW = v77;
|
644
|
3511 pColorText = pColorYellow;
|
634
|
3512 if ( pDialogueWindow->pCurrentPosActiveItem != pItemNum )
|
644
|
3513 pColorText = pColorWhite;
|
|
3514 dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, (const char *)pShopOptions[pNumString], 3);
|
634
|
3515 ++pItemNum;
|
|
3516 ++pNumString;
|
|
3517 pNumActiveItem = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem;
|
|
3518 }
|
|
3519 while ( pItemNum < pNumActiveItem );
|
|
3520 }
|
|
3521 }
|
|
3522 return;
|
|
3523 }
|
747
|
3524 case HOUSE_DIALOGUE_SHOP_BUY_STANDARD:
|
634
|
3525 {
|
|
3526 pRenderer->DrawTextureIndexed(8, 8, ShopTexture);
|
|
3527 v114 = 0;
|
|
3528 do
|
|
3529 {
|
757
|
3530 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v114].uItemID)
|
629
|
3531 {
|
634
|
3532 v46 = ItemsInShopTexture[v114];
|
|
3533 v47 = 152 - v46->uTextureHeight;
|
|
3534 if ( (signed int)v47 < 1 )
|
|
3535 v47 = 0;
|
|
3536 v48 = 75 * v114 - v46->uTextureWidth / 2 + 40;
|
|
3537 if ( v114 )
|
|
3538 {
|
|
3539 if ( v114 == 5 )
|
|
3540 {
|
|
3541 v49 = ItemsInShopTexture[5]->uTextureWidth;
|
|
3542 if ( (signed int)v48 > 457 - v49 )
|
|
3543 v48 = 457 - v49;
|
|
3544 }
|
|
3545 }
|
|
3546 else if ( (signed int)v48 < 18 )
|
|
3547 v48 = 18;
|
|
3548 pRenderer->DrawTextureTransparent(v48, v47, v46);
|
|
3549 sub_40F92A(&pRenderer->pActiveZBuffer[v48 + 640 * v47], ItemsInShopTexture[v114], v114 + 1);
|
629
|
3550 }
|
634
|
3551 ++v114;
|
|
3552 }
|
|
3553 while ( v114 < 6 );
|
|
3554 v114 = 0;
|
|
3555 do
|
|
3556 {
|
757
|
3557 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v114+1].uItemID)
|
634
|
3558 {
|
|
3559 v50 = ItemsInShopTexture[v114 + 6];
|
|
3560 v51 = 308 - v50->uTextureHeight;
|
|
3561 if ( (signed int)v51 < 1 )
|
|
3562 v51 = 0;
|
|
3563 v52 = 75 * v114 - v50->uTextureWidth / 2 + 40;
|
|
3564 if ( v114 )
|
|
3565 {
|
|
3566 if ( v114 == 5 )
|
|
3567 {
|
|
3568 v53 = ItemsInShopTexture[11]->uTextureWidth;
|
|
3569 if ( (signed int)v52 > 457 - v53 )
|
|
3570 v52 = 457 - v53;
|
|
3571 }
|
|
3572 }
|
|
3573 else
|
|
3574 {
|
|
3575 if ( (signed int)v52 < 18 )
|
|
3576 v52 = 18;
|
|
3577 }
|
|
3578 pRenderer->DrawTextureTransparent(v52, v51, v50);
|
|
3579 sub_40F92A(&pRenderer->pActiveZBuffer[v52 + 640 * v51], ItemsInShopTexture[v114 + 6], v114 + 7);
|
|
3580 }
|
|
3581 ++v114;
|
|
3582 }
|
|
3583 while ( v114 < 6 );
|
|
3584 if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
|
|
3585 {
|
|
3586 v62 = 0;
|
|
3587 v109 = 0;
|
629
|
3588 do
|
|
3589 {
|
757
|
3590 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v62].uItemID)
|
634
|
3591 ++v109;
|
|
3592 ++v62;
|
|
3593 }
|
|
3594 while ( v62 < 12 );
|
|
3595 v63 = GetAsyncKeyState(17);
|
|
3596 v64 = pPlayer->CanSteal();
|
|
3597 Str = v64;
|
|
3598 if ( v63 && v64 )
|
|
3599 {
|
|
3600 v65 = pGlobalTXT_LocalizationStrings[185];
|
|
3601 }
|
749
|
3602 else if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_BUY_STANDARD)
|
634
|
3603 {
|
|
3604 v65 = pGlobalTXT_LocalizationStrings[195];
|
|
3605 }
|
|
3606 else
|
|
3607 {
|
|
3608 v65 = pGlobalTXT_LocalizationStrings[196];
|
|
3609 }
|
|
3610 DrawTextAtStatusBar(v65, 0);
|
|
3611 if ( !v109 )
|
|
3612 {
|
|
3613 dialog_window.DrawCurrentTime( pParty->field_3C.field_50[ (unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed);
|
|
3614 return;
|
|
3615 }
|
|
3616 v66 = pMouse->GetCursorPos(&v98);
|
|
3617 pNumActiveItem = v66->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v96)->y];
|
|
3618 if ( pRenderer->pActiveZBuffer[pNumActiveItem] & 0xFFFF )
|
|
3619 {
|
|
3620 v67 = (pRenderer->pActiveZBuffer[pNumActiveItem] & 0xFFFF) - 1;
|
|
3621 v70 = (ItemGen *)&pParty->StandartItemsInShops[(int)window_SpeakInHouse->ptr_1C][v67];
|
749
|
3622 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD)
|
634
|
3623 v70 = &pParty->SpecialItemsInShops[(int)window_SpeakInHouse->ptr_1C][v67];//v70 = (ItemGen *)&pParty->field_C59C[v69 + 724];
|
|
3624 if ( !v63 || !Str )
|
|
3625 {
|
|
3626 v71 = pPlayer->_490EEE(v70, 4, (int)window_SpeakInHouse->ptr_1C, 2);
|
|
3627 v38 = (char *)pMerchantsBuyPhrases[v71];
|
|
3628 }
|
|
3629 else
|
|
3630 {
|
|
3631 v38 = pGlobalTXT_LocalizationStrings[181];
|
|
3632 }
|
|
3633 v21 = BuilDialogueString(v38, uActiveCharacter - 1, v70, (char *)window_SpeakInHouse->ptr_1C, 2, 0);
|
|
3634 v40 = pFontArrus->CalcTextHeight(v21, &dialog_window, 0, 0);
|
|
3635 dialog_window.DrawTitleText(pFontArrus, 0, (174 - v40) / 2 + 138, pColorWhite, v21, 3);
|
|
3636 return ;
|
|
3637 }
|
|
3638 }
|
|
3639 return;
|
|
3640 }
|
747
|
3641 case HOUSE_DIALOGUE_SHOP_SELL:
|
634
|
3642 {
|
|
3643 draw_leather();
|
|
3644 CharacterUI_InventoryTab_Draw(uActiveCharacter, 1);
|
|
3645 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[199], 0);
|
|
3646 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
|
|
3647 return;
|
|
3648 if ((v43 = pMouse->GetCursorPos(&v99)->x - 14, v109 = (v43 >> 5) + 14 * ((pMouse->GetCursorPos(&v95)->y - 17) >> 5),
|
|
3649 pMouse->GetCursorPos(&v102)->x <= 13) || pMouse->GetCursorPos(&v100)->x >= 462
|
|
3650 || (pNumActiveItem = pPlayer->GetItemIDAtInventoryIndex((int *)&v109), !pNumActiveItem) )
|
|
3651 return;
|
|
3652 v87 = (ItemGen *)&pPlayer->pInventoryItems[pNumActiveItem - 1];
|
|
3653 v45 = pPlayer->_490EEE(v87, 4, (int)window_SpeakInHouse->ptr_1C, 3);
|
|
3654 v21 = BuilDialogueString((char *)pMerchantsSellPhrases[v45], uActiveCharacter - 1, v87, (char *)window_SpeakInHouse->ptr_1C, 3, 0);
|
|
3655 pTextHeight = pFontArrus->CalcTextHeight(v21, &dialog_window, 0, 0);
|
|
3656 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, pColorWhite, v21, 3);
|
|
3657 return;
|
|
3658 }
|
747
|
3659 case HOUSE_DIALOGUE_SHOP_IDENTIFY:
|
634
|
3660 {
|
|
3661 draw_leather();
|
|
3662 CharacterUI_InventoryTab_Draw(uActiveCharacter, 1);
|
|
3663 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[197], 0);
|
|
3664 if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
|
|
3665 return;
|
|
3666 if ((v36 = pMouse->GetCursorPos(&a2)->x - 14, v109 = (v36 >> 5) + 14 * ((pMouse->GetCursorPos(&v94)->y - 17) >> 5),
|
|
3667 pMouse->GetCursorPos(&v101)->x <= 13) || pMouse->GetCursorPos(&v97)->x >= 462
|
|
3668 || (pNumActiveItem = pPlayer->GetItemIDAtInventoryIndex((int *)&v109), !pNumActiveItem) )
|
|
3669 return;
|
|
3670 v37 = (ItemGen *)&pPlayer->pInventoryItems[pNumActiveItem - 1];
|
|
3671 if (!v37->Identified())
|
|
3672 {
|
|
3673 v42 = pPlayer->_490EEE(v37, 4, (int)window_SpeakInHouse->ptr_1C, 4);
|
|
3674 v38 = (char *)pMerchantsIdentifyPhrases[v42];
|
|
3675 }
|
|
3676 else
|
|
3677 {
|
|
3678 v38 = "%24";
|
|
3679 }
|
|
3680 v21 = BuilDialogueString(v38, uActiveCharacter - 1, v37, (char *)window_SpeakInHouse->ptr_1C, 4, 0);
|
|
3681 v40 = pFontArrus->CalcTextHeight(v21, &dialog_window, 0, 0);
|
|
3682 dialog_window.DrawTitleText(pFontArrus, 0, (174 - v40) / 2 + 138, pColorWhite, v21, 3);
|
|
3683 return;
|
|
3684 }
|
747
|
3685 case HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT:
|
634
|
3686 {
|
|
3687 draw_leather();
|
|
3688 CharacterUI_InventoryTab_Draw(uActiveCharacter, 1);
|
|
3689 pShopOptions[0] = pGlobalTXT_LocalizationStrings[200];
|
|
3690 pShopOptions[1] = pGlobalTXT_LocalizationStrings[113];
|
|
3691 all_text_height = 0;
|
|
3692 for ( int i = 0; i < 2; ++i )
|
|
3693 all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0);
|
|
3694 Str = (174 - all_text_height) / 2;
|
|
3695 pNumActiveItem = pDialogueWindow->pStartingPosActiveItem;
|
|
3696 v26 = pNumActiveItem + pDialogueWindow->pNumPresenceButton;
|
|
3697 v27 = (2 * (87 - (174 - all_text_height) / 2) - all_text_height) / 2 - (174 - all_text_height) / 2 / 2 + 138;
|
|
3698 v28 = -pDialogueWindow->pNumPresenceButton < 0;
|
|
3699 if ( v28 ^ pNumActiveItem > v26 )
|
|
3700 {
|
|
3701 pItemNum = 2;
|
|
3702 pNumString = 0;
|
|
3703 do
|
|
3704 {
|
|
3705 pButton = pDialogueWindow->GetControl(pItemNum);
|
|
3706 pButton->uY = Str + v27;
|
|
3707 pTextHeight = pFontArrus->CalcTextHeight((const char *)pShopOptions[pNumString], &dialog_window, 0, 0);
|
|
3708 pButton->uHeight = pTextHeight;
|
|
3709 v27 = pButton->uY + pTextHeight - 1;
|
|
3710 pButton->uW = v27;
|
644
|
3711 pColorText = pColorYellow;
|
634
|
3712 if ( pDialogueWindow->pCurrentPosActiveItem != pItemNum )
|
644
|
3713 pColorText = pColorWhite;
|
|
3714 dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, (const char *)pShopOptions[pNumString], 3);
|
634
|
3715 ++pItemNum;
|
|
3716 ++pNumString;
|
|
3717 pNumActiveItem = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem;
|
629
|
3718 }
|
634
|
3719 while ( pItemNum < pNumActiveItem );
|
|
3720 }
|
|
3721 return;
|
|
3722 }
|
747
|
3723 case HOUSE_DIALOGUE_SHOP_BUY_SPECIAL:
|
634
|
3724 {
|
|
3725 pRenderer->DrawTextureIndexed(8, 8, ShopTexture);
|
|
3726 v114 = 0;
|
|
3727 do
|
|
3728 {
|
|
3729 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v114].uItemID)
|
|
3730 {
|
|
3731 v54 = ItemsInShopTexture[v114];
|
|
3732 v55 = 152 - v54->uTextureHeight;
|
|
3733 if ( (signed int)v55 < 1 )
|
|
3734 v55 = 0;
|
|
3735 v56 = 75 * v114 - v54->uTextureWidth / 2 + 40;
|
|
3736 if ( v114 )
|
|
3737 {
|
|
3738 if ( v114 == 5 )
|
|
3739 {
|
|
3740 v57 = ItemsInShopTexture[5]->uTextureWidth;
|
|
3741 if ( (signed int)v56 > 457 - v57 )
|
|
3742 v56 = 457 - v57;
|
|
3743 }
|
|
3744 }
|
|
3745 else
|
|
3746 {
|
|
3747 if ( (signed int)v56 < 18 )
|
|
3748 v56 = 18;
|
|
3749 }
|
|
3750 pRenderer->DrawTextureTransparent(v56, v55, v54);
|
|
3751 sub_40F92A(&pRenderer->pActiveZBuffer[v56 + 640 * v55], ItemsInShopTexture[v114], v114 + 1);
|
|
3752 }
|
|
3753 ++v114;
|
|
3754 }
|
|
3755 while ( v114 < 6 );
|
|
3756 v114 = 0;
|
|
3757 do
|
|
3758 {
|
|
3759 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][(signed int)v114].uItemID) //not itemid
|
|
3760 {
|
|
3761 v58 = ItemsInShopTexture[v114 + 6];
|
|
3762 v59 = 308 - v58->uTextureHeight;
|
|
3763 if ( (signed int)v59 < 1 )
|
|
3764 v59 = 0;
|
|
3765 v60 = 75 * v114 - v58->uTextureWidth / 2 + 40;
|
|
3766 if ( v114 )
|
|
3767 {
|
|
3768 if ( v114 == 5 )
|
|
3769 {
|
|
3770 v61 = ItemsInShopTexture[11]->uTextureWidth;
|
|
3771 if ( (signed int)v60 > 457 - v61 )
|
|
3772 v60 = 457 - v61;
|
|
3773 }
|
|
3774 }
|
|
3775 else
|
|
3776 {
|
|
3777 if ( (signed int)v60 < 18 )
|
|
3778 v60 = 18;
|
|
3779 }
|
|
3780 pRenderer->DrawTextureTransparent(v60, v59, v58);
|
|
3781 sub_40F92A(&pRenderer->pActiveZBuffer[v60 + 640 * v59], ItemsInShopTexture[v114 + 6], v114 + 7);
|
|
3782 }
|
|
3783 ++v114;
|
|
3784 }
|
|
3785 while ( v114 < 6 );
|
|
3786 if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
|
|
3787 {
|
|
3788 v62 = 0;
|
|
3789 v109 = 0;
|
|
3790 do
|
|
3791 {
|
|
3792 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v62].uItemID)
|
|
3793 ++v109;
|
|
3794 ++v62;
|
|
3795 }
|
|
3796 while ( v62 < 12 );
|
|
3797 v63 = GetAsyncKeyState(17);
|
|
3798 v64 = pPlayer->CanSteal();
|
|
3799 Str = v64;
|
|
3800 if ( v63 && v64 )
|
|
3801 {
|
|
3802 v65 = pGlobalTXT_LocalizationStrings[185];
|
|
3803 }
|
|
3804 else
|
629
|
3805 {
|
634
|
3806 v65 = pGlobalTXT_LocalizationStrings[195];
|
749
|
3807 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD)
|
634
|
3808 v65 = pGlobalTXT_LocalizationStrings[196];
|
|
3809 }
|
|
3810 DrawTextAtStatusBar(v65, 0);
|
|
3811 if ( !v109 )
|
|
3812 {
|
|
3813 dialog_window.DrawCurrentTime( pParty->field_3C.field_50[ (unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed);
|
|
3814 return;
|
|
3815 }
|
|
3816 v66 = pMouse->GetCursorPos(&v98);
|
|
3817 pNumActiveItem = v66->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v96)->y];
|
|
3818 if ( pRenderer->pActiveZBuffer[pNumActiveItem] & 0xFFFF )
|
|
3819 {
|
|
3820 v67 = (pRenderer->pActiveZBuffer[pNumActiveItem] & 0xFFFF) - 1;
|
|
3821 v109 = v67;
|
|
3822 v68 = (int)window_SpeakInHouse->ptr_1C;
|
|
3823 // v69 = 9 * (v67 + 12 * v68);
|
|
3824 v70 = (ItemGen *)&pParty->StandartItemsInShops[v68][v67];
|
749
|
3825 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD)
|
634
|
3826 v70 = &pParty->SpecialItemsInShops[(int)v68][v67];//v70 = (ItemGen *)&pParty->field_C59C[v69 + 724];
|
|
3827 if ( !v63 || !Str )
|
|
3828 {
|
|
3829 v71 = pPlayer->_490EEE(v70, 4, v68, 2);
|
|
3830 v38 = (char *)pMerchantsBuyPhrases[v71];
|
|
3831 }
|
|
3832 else
|
|
3833 {
|
|
3834 v38 = pGlobalTXT_LocalizationStrings[181];
|
|
3835 }
|
|
3836 v21 = BuilDialogueString(v38, uActiveCharacter - 1, v70, (char *)window_SpeakInHouse->ptr_1C, 2, 0);
|
|
3837 v40 = pFontArrus->CalcTextHeight(v21, &dialog_window, 0, 0);
|
|
3838 dialog_window.DrawTitleText(pFontArrus, 0, (174 - v40) / 2 + 138, pColorWhite, v21, 3);
|
|
3839 return;
|
|
3840 }
|
|
3841 }
|
|
3842 return;
|
|
3843 }
|
747
|
3844 case HOUSE_DIALOGUE_LEARN_SKILLS:
|
634
|
3845 {
|
|
3846 if (!sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win())
|
|
3847 return;
|
|
3848 all_text_height = 0;
|
|
3849 v5 = (signed __int64)(p2DEvents[(signed int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0);
|
|
3850 pItemNum = v5 * (100 - pPlayer->GetMerchant()) / 100;
|
|
3851 if ( pItemNum < v5 / 3 )
|
|
3852 pItemNum = v5 / 3;
|
|
3853 pNumActiveItem = pDialogueWindow->pStartingPosActiveItem;
|
|
3854 v114 = 0;
|
|
3855 if ( pNumActiveItem >= pNumActiveItem + pDialogueWindow->pNumPresenceButton )
|
|
3856 {
|
|
3857 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], pPlayer->pName, pClassNames[pPlayer->classType]);
|
|
3858 strcat(pTmpBuf, "\n \n");
|
|
3859 strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]);
|
|
3860 v40 = pFontArrus->CalcTextHeight(pTmpBuf, &dialog_window, 0, 0);
|
644
|
3861 dialog_window.DrawTitleText(pFontArrus, 0, (174 - v40) / 2 + 138, pColorYellow, pTmpBuf, 3);
|
634
|
3862 return;
|
|
3863 }
|
|
3864 do
|
|
3865 {
|
|
3866 v8 = pDialogueWindow->GetControl(pNumActiveItem)->uControlParam - 36;
|
|
3867 if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayer->classType][v8] && !pPlayer->pActiveSkills[v8] )
|
|
3868 {
|
|
3869 all_text_height = pFontArrus->CalcTextHeight(pSkillNames[v8], &dialog_window, 0, 0);
|
|
3870 ++v114;
|
|
3871 }
|
|
3872 ++pNumActiveItem;
|
|
3873 }
|
|
3874 while ( pNumActiveItem < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem );
|
|
3875 if ( !v114 )
|
|
3876 {
|
|
3877 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], pPlayer->pName, pClassNames[pPlayer->classType]);
|
|
3878 strcat(pTmpBuf, "\n \n");
|
|
3879 strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]);
|
|
3880 v40 = pFontArrus->CalcTextHeight(pTmpBuf, &dialog_window, 0, 0);
|
644
|
3881 dialog_window.DrawTitleText(pFontArrus, 0, (174 - v40) / 2 + 138, pColorYellow, pTmpBuf, 3);
|
634
|
3882 return;
|
|
3883 }
|
|
3884 if ( v114 )
|
|
3885 {
|
|
3886 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], pItemNum);
|
|
3887 dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3);
|
|
3888 v18 = (149 - all_text_height) / v114;
|
|
3889 if ( (149 - all_text_height) / v114 > 32 )
|
|
3890 v18 = 32;
|
|
3891 pNumActiveItem = pDialogueWindow->pStartingPosActiveItem;
|
|
3892 v105 = (149 - v114 * v18 - all_text_height) / 2 - v18 / 2 + 162;
|
|
3893 if ( pNumActiveItem < pNumActiveItem + pDialogueWindow->pNumPresenceButton )
|
|
3894 {
|
|
3895 pItemNum = 2;
|
629
|
3896 do
|
|
3897 {
|
634
|
3898 pButton = pDialogueWindow->GetControl(pItemNum);
|
|
3899 v13 = pButton->uControlParam - 36;
|
|
3900 if ( !byte_4ED970_skill_learn_ability_by_class_table[pPlayer->classType][v13] || pPlayer->pActiveSkills[v13] )
|
|
3901 {
|
|
3902 pButton->uW = 0;
|
|
3903 pButton->uHeight = 0;
|
|
3904 pButton->uY = 0;
|
|
3905 }
|
|
3906 else
|
|
3907 {
|
|
3908 pButton->uY = v18 + v105;
|
|
3909 pTextHeight = pFontArrus->CalcTextHeight(pSkillNames[v13], &dialog_window, 0, 0);
|
|
3910 pButton->uHeight = pTextHeight;
|
|
3911 v105 = pButton->uY + pTextHeight - 1;
|
|
3912 pButton->uW = v105;
|
644
|
3913 pColorText = pColorYellow;
|
634
|
3914 if ( pDialogueWindow->pCurrentPosActiveItem != pItemNum )
|
644
|
3915 pColorText = pColorWhite;
|
|
3916 dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, pSkillNames[v13], 3);
|
634
|
3917 }
|
|
3918 pNumActiveItem = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem;
|
|
3919 pItemNum++;
|
629
|
3920 }
|
634
|
3921 while ( pItemNum < pNumActiveItem );
|
629
|
3922 }
|
|
3923 return;
|
634
|
3924 }
|
|
3925 }
|
|
3926 default:
|
|
3927 {
|
|
3928 return;// (POINT *)dialog_menu_id - 96;
|
|
3929 }
|
629
|
3930 }
|
|
3931 }
|
|
3932
|
|
3933 //----- (004BA928) --------------------------------------------------------
|
|
3934 void __cdecl ArmorShopDialog()
|
|
3935 {
|
|
3936 Player *v0; // ebx@1
|
|
3937 signed int v1; // esi@8
|
|
3938 unsigned int v2; // eax@10
|
|
3939 ItemGen *v3; // eax@11
|
|
3940 unsigned __int8 v4; // dl@12
|
|
3941 char *v5; // ecx@12
|
|
3942 char *v6; // eax@13
|
|
3943 int v7; // ST08_4@15
|
|
3944 int v8; // eax@15
|
|
3945 signed int v9; // esi@17
|
|
3946 unsigned int v10; // eax@19
|
|
3947 char *v11; // edi@19
|
|
3948 int v12; // ST08_4@20
|
|
3949 int v13; // eax@20
|
|
3950 unsigned __int8 v14; // dl@20
|
|
3951 char *v15; // ecx@20
|
|
3952 char **v16; // edi@22
|
|
3953 int all_text_height; // ebx@22
|
|
3954 char **v18; // esi@22
|
|
3955 int v19; // eax@23
|
|
3956 GUIWindow *v20; // ecx@24
|
|
3957 int v21; // eax@24
|
|
3958 int v22; // edx@24
|
|
3959 int v23; // ebx@24
|
|
3960 unsigned __int8 v24; // sf@24
|
|
3961 GUIButton *control_button; // eax@26
|
|
3962 GUIButton *v26; // esi@26
|
|
3963 int v27; // eax@26
|
|
3964 unsigned int v28; // ecx@26
|
|
3965 int v29; // edx@26
|
|
3966
|
|
3967 signed int v31; // esi@31
|
|
3968 unsigned int v32; // eax@33
|
|
3969 int v33; // eax@34
|
|
3970 int v34; // ST08_4@35
|
|
3971 int v35; // eax@35
|
|
3972 char *v36; // edx@36
|
|
3973 GUIWindow *v37; // edi@42
|
|
3974 signed int v38; // esi@42
|
|
3975 unsigned int v39; // esi@44
|
|
3976 int v40; // eax@44
|
|
3977 unsigned int v41; // eax@45
|
|
3978 int v42; // eax@47
|
|
3979 int v43; // ecx@52
|
|
3980 GUIButton *v44; // eax@54
|
|
3981 GUIButton *v45; // esi@54
|
|
3982 int v46; // eax@54
|
|
3983 char *v47; // eax@56
|
|
3984 int v48; // eax@56
|
|
3985 unsigned int v49; // ecx@56
|
|
3986 int v50; // edx@56
|
|
3987 int v51; // eax@56
|
|
3988 unsigned __int16 v52; // ax@56
|
|
3989 int v53; // eax@60
|
|
3990 int textureH; // eax@60
|
|
3991 signed int textureW; // ebx@65
|
|
3992 Texture *v56; // eax@67
|
|
3993 unsigned int v57; // edi@68
|
|
3994 Texture *v58; // ST1C_4@68
|
|
3995 int v59; // eax@68
|
|
3996 int v60; // edi@69
|
|
3997 signed int v61; // ebx@73
|
|
3998 Texture *v62; // eax@75
|
|
3999 int v63; // edi@76
|
|
4000 Texture *v64; // ST1C_4@76
|
|
4001 unsigned int v65; // ST18_4@76
|
|
4002 int v66; // eax@76
|
|
4003 int v67; // edi@77
|
|
4004 signed int v68; // ecx@81
|
|
4005 SHORT v69; // bx@89
|
|
4006 bool v70; // eax@89
|
|
4007 const char *v71; // ecx@91
|
|
4008 void *v72; // eax@95
|
|
4009 POINT *v73; // esi@97
|
|
4010 int v74; // ecx@97
|
|
4011 int v75; // eax@98
|
|
4012 int v76; // ecx@98
|
|
4013 ItemGen *selected_item; // ecx@99
|
|
4014 unsigned __int8 v78; // bl@104
|
|
4015 char **v79; // edi@105
|
|
4016 int v80; // ebx@105
|
|
4017 char **v81; // esi@105
|
|
4018 int v82; // eax@106
|
|
4019 GUIWindow *v83; // ecx@107
|
|
4020 int v84; // eax@107
|
|
4021 int v85; // edx@107
|
|
4022 int v86; // ebx@107
|
|
4023 GUIButton *v87; // eax@109
|
|
4024 GUIButton *v88; // esi@109
|
|
4025 int v89; // eax@109
|
|
4026 unsigned int v90; // ecx@109
|
|
4027 int v91; // edx@109
|
|
4028 unsigned __int16 v92; // ax@109
|
|
4029 signed int v93; // edx@114
|
|
4030 POINT *v94; // edi@120
|
|
4031 __int32 v95; // ecx@120
|
|
4032 void *v96; // ST14_4@122
|
|
4033 unsigned __int8 v97; // bl@122
|
|
4034 ItemGen *v98; // ST10_4@122
|
|
4035 int v99; // eax@122
|
|
4036 char *v100; // eax@122
|
|
4037 const char *v101; // ST18_4@122
|
|
4038 unsigned __int16 v102; // ST14_2@122
|
|
4039 int v103; // eax@122
|
|
4040 signed int v104; // edi@123
|
|
4041 Texture *v105; // eax@125
|
|
4042 int v106; // ebx@126
|
|
4043 Texture *v107; // ST1C_4@126
|
|
4044 unsigned int v108; // ST18_4@126
|
|
4045 int v109; // eax@126
|
|
4046 int v110; // ebx@127
|
|
4047 GUIWindow *v111; // [sp-18h] [bp-11Ch]@36
|
|
4048 unsigned int v112; // [sp-14h] [bp-118h]@13
|
|
4049 int v113; // [sp-14h] [bp-118h]@36
|
|
4050 ItemGen *v114; // [sp-10h] [bp-114h]@12
|
|
4051 unsigned int v115; // [sp-10h] [bp-114h]@13
|
|
4052 ItemGen *v116; // [sp-10h] [bp-114h]@20
|
|
4053 int v117; // [sp-10h] [bp-114h]@36
|
|
4054 void *v118; // [sp-Ch] [bp-110h]@12
|
|
4055 unsigned __int16 v119; // [sp-Ch] [bp-110h]@13
|
|
4056 void *v120; // [sp-Ch] [bp-110h]@20
|
|
4057 char *v121; // [sp-8h] [bp-10Ch]@13
|
|
4058 int v122; // [sp-8h] [bp-10Ch]@20
|
|
4059 unsigned int v123; // [sp-4h] [bp-108h]@13
|
|
4060 __int64 *v124; // [sp-4h] [bp-108h]@20
|
|
4061 int v125; // [sp-4h] [bp-108h]@68
|
|
4062 int v126; // [sp-4h] [bp-108h]@76
|
|
4063 int v127; // [sp-4h] [bp-108h]@126
|
|
4064 POINT v128; // [sp+Ch] [bp-F8h]@8
|
|
4065 POINT v129; // [sp+14h] [bp-F0h]@18
|
|
4066 char v130; // [sp+1Ch] [bp-E8h]@120
|
|
4067 POINT a2; // [sp+24h] [bp-E0h]@8
|
|
4068 POINT v132; // [sp+2Ch] [bp-D8h]@120
|
|
4069 POINT v133; // [sp+34h] [bp-D0h]@17
|
|
4070 POINT v134; // [sp+3Ch] [bp-C8h]@97
|
|
4071 POINT v135; // [sp+44h] [bp-C0h]@31
|
|
4072 POINT v136; // [sp+4Ch] [bp-B8h]@97
|
|
4073 POINT v137; // [sp+54h] [bp-B0h]@17
|
|
4074 POINT v138; // [sp+5Ch] [bp-A8h]@32
|
|
4075 POINT v139; // [sp+64h] [bp-A0h]@17
|
|
4076 POINT v140; // [sp+6Ch] [bp-98h]@31
|
|
4077 POINT v141; // [sp+74h] [bp-90h]@8
|
|
4078 POINT v142; // [sp+7Ch] [bp-88h]@31
|
|
4079 POINT v143; // [sp+84h] [bp-80h]@9
|
|
4080 GUIWindow dialog_window; // [sp+8Ch] [bp-78h]@1
|
|
4081 char *Str; // [sp+E0h] [bp-24h]@56
|
|
4082 int v146; // [sp+E4h] [bp-20h]@24
|
|
4083 int hilight_color; // [sp+E8h] [bp-1Ch]@1
|
|
4084 int m_text_color; // [sp+ECh] [bp-18h]@1
|
|
4085 __int32 v149; // [sp+F0h] [bp-14h]@8
|
|
4086 Player* _this; // [sp+F4h] [bp-10h]@1
|
|
4087 unsigned __int8 uPlayerID; // [sp+FBh] [bp-9h]@15
|
|
4088 int v152; // [sp+FCh] [bp-8h]@24
|
|
4089 int v153; // [sp+100h] [bp-4h]@44
|
|
4090 int th;
|
|
4091 short text_color;
|
|
4092
|
|
4093 v0 = pPlayers[uActiveCharacter];
|
|
4094 _this = pPlayers[uActiveCharacter];
|
|
4095 memcpy(&dialog_window, window_SpeakInHouse, sizeof(dialog_window));
|
|
4096 dialog_window.uFrameX = 483;
|
|
4097 dialog_window.uFrameWidth = 148;
|
|
4098 dialog_window.uFrameZ = 334;
|
|
4099 m_text_color = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu);
|
|
4100 hilight_color = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xCDu, 0x23u);
|
|
4101 switch (dialog_menu_id)
|
|
4102 {
|
747
|
4103 case HOUSE_DIALOGUE_MAIN:
|
629
|
4104 {
|
|
4105 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
|
|
4106 return;
|
|
4107 pShopOptions[0] = pGlobalTXT_LocalizationStrings[134]; //"Buy Standard"
|
|
4108 pShopOptions[1] = pGlobalTXT_LocalizationStrings[152]; //"Buy Special"
|
|
4109 pShopOptions[2] = pGlobalTXT_LocalizationStrings[159]; //"Display Inventory"
|
|
4110 pShopOptions[3] = pGlobalTXT_LocalizationStrings[160];
|
|
4111
|
|
4112 all_text_height = 0;
|
|
4113 for(int i=0;i<4;++i)
|
|
4114 all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0);
|
|
4115 v146 = (174 - all_text_height) / 4;
|
|
4116
|
|
4117 v23 = (174 - 4 * (174 - all_text_height) / 4 - all_text_height) / 2 - (174 - all_text_height) / 4 / 2 + 138;
|
|
4118 int j=0;
|
|
4119 if ( pDialogueWindow->pNumPresenceButton>=0 )
|
|
4120 {
|
|
4121 th = 2;
|
|
4122 for (v152 = pDialogueWindow->pStartingPosActiveItem; v152 < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++v152)
|
|
4123 {
|
|
4124 control_button = pDialogueWindow->GetControl(v152);
|
|
4125 control_button->uY = v146 + v23;
|
|
4126 v27 = pFontArrus->CalcTextHeight(pShopOptions[j], &dialog_window, 0, 0);
|
|
4127 control_button->uHeight = v27;
|
|
4128 v23 = control_button->uY + control_button->uHeight - 1;
|
|
4129 control_button->uW = v23;
|
|
4130 text_color = hilight_color;
|
|
4131 if ( pDialogueWindow->pCurrentPosActiveItem != th )
|
|
4132 text_color = m_text_color;
|
|
4133 dialog_window.DrawTitleText(pFontArrus, 0, control_button->uY, text_color, pShopOptions[j], 3);
|
|
4134 ++th;
|
|
4135 ++j;
|
|
4136 }
|
|
4137 }
|
|
4138 }
|
|
4139 break;
|
747
|
4140 case HOUSE_DIALOGUE_SHOP_BUY_STANDARD:
|
629
|
4141 {
|
|
4142 pRenderer->DrawTextureIndexed(8, 8, ShopTexture);
|
|
4143 textureW = 0;
|
|
4144 v153 = 0;
|
|
4145 for(int i=0; i<8; ++i)
|
|
4146 {
|
749
|
4147 if ( pParty->StandartItemsInShops[window_SpeakInHouse->par1C][i].uItemID)
|
629
|
4148 {
|
|
4149 textureW = ItemsInShopTexture[i]->uTextureWidth;
|
|
4150 textureH = ItemsInShopTexture[i]->uTextureHeight;
|
|
4151 if ( i >= 4 ) //low row
|
|
4152 {
|
|
4153 v60 = 90 - (textureW/2);
|
|
4154 pRenderer->DrawTextureTransparent(v60 + v153 - 420, 126, ItemsInShopTexture[i]);
|
|
4155 v59 = v60 + v153 + 80220;
|
|
4156 }
|
|
4157 else
|
|
4158 {
|
|
4159 v57 = 98 - textureH;
|
|
4160 v152 = 86 - (textureW/2);
|
|
4161 pRenderer->DrawTextureTransparent(v153 + v152, v57, ItemsInShopTexture[i]);
|
|
4162 v59 = v153 + v152 + 640 * v57;
|
|
4163 }
|
|
4164 ZBuffer_DoFill(&pRenderer->pActiveZBuffer[v59], ItemsInShopTexture[i], i+1);
|
|
4165 }
|
|
4166 v153 += 105;
|
|
4167
|
|
4168 }
|
|
4169
|
|
4170 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
|
|
4171 return;
|
|
4172
|
|
4173 v149 = 0;
|
|
4174 for(int i=0; i<8; ++i)
|
|
4175 {
|
757
|
4176 if ( pParty->StandartItemsInShops[window_SpeakInHouse->par1C][i].uItemID)
|
629
|
4177 ++v149;
|
|
4178
|
|
4179 }
|
|
4180
|
|
4181 v69 = GetAsyncKeyState(17);
|
|
4182 v70 = _this->CanSteal();
|
|
4183 //Str = (char *)v70;
|
|
4184 if ( v69 == 0 || v70 == 0 )
|
|
4185 {
|
|
4186 v71 = pGlobalTXT_LocalizationStrings[195]; //"Select the Item to Buy"
|
|
4187 }
|
|
4188 else
|
|
4189 {
|
|
4190 v71 = pGlobalTXT_LocalizationStrings[185];//"Steal item"
|
|
4191 }
|
|
4192 DrawTextAtStatusBar(v71, 0);
|
|
4193 if ( v149 != 0 )
|
|
4194 {
|
|
4195 v73 = pMouse->GetCursorPos(&v136);
|
|
4196 v74 = pRenderer->pActiveZBuffer[v73->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v134)->y]] & 0xFFFF;
|
|
4197 if ( !v74 )
|
|
4198 return;
|
|
4199 v149 = v74 - 1;
|
|
4200 selected_item = &pParty->StandartItemsInShops[window_SpeakInHouse->par1C][v74-1];
|
|
4201 if ( v69 ==0 || v70 == 0)
|
|
4202 {
|
|
4203 v120 = window_SpeakInHouse->ptr_1C;
|
|
4204 v15 = (char *)pMerchantsBuyPhrases[_this->_490EEE(selected_item, 2, window_SpeakInHouse->par1C, 2)];
|
|
4205 }
|
|
4206 else
|
|
4207 {
|
|
4208 v120 = window_SpeakInHouse->ptr_1C;
|
|
4209 v15 = pGlobalTXT_LocalizationStrings[181]; //"Steal %24"
|
|
4210 }
|
|
4211 v36 = BuilDialogueString(v15, uActiveCharacter - 1, selected_item, (char *)v120, 2, 0);
|
|
4212 v115 = (174 - pFontArrus->CalcTextHeight(v36, &dialog_window, 0, 0)) / 2 + 138;
|
|
4213 dialog_window.DrawTitleText(pFontArrus, 0, v115, m_text_color, v36, 3);
|
|
4214 return;
|
|
4215 }
|
|
4216 dialog_window.DrawCurrentTime( pParty->field_3C.field_50[window_SpeakInHouse->par1C]- pParty->uTimePlayed);
|
|
4217 return;
|
|
4218 }
|
|
4219 break;
|
747
|
4220 case HOUSE_DIALOGUE_SHOP_SELL:
|
629
|
4221 {
|
|
4222 draw_leather();
|
|
4223 CharacterUI_InventoryTab_Draw(uActiveCharacter, 1);
|
|
4224 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[199], 0);//"Select the Item to Sell"
|
|
4225 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win())
|
|
4226 return;
|
|
4227
|
|
4228 if((v9 = pMouse->GetCursorPos(&v139)->x - 14, v149 = (v9 >> 5) + 14 * ((pMouse->GetCursorPos(&v133)->y - 17) >> 5),
|
|
4229 pMouse->GetCursorPos(&v137)->x <= 13) || pMouse->GetCursorPos(&v129)->x >= 462
|
|
4230 || (v10 = v0->GetItemIDAtInventoryIndex((int *)&v149), v11 = 0, !v10) )
|
|
4231 return;
|
|
4232
|
|
4233 v116 = (ItemGen *)&v0->pInventoryItems[v10-1];
|
|
4234 v13 = v0->_490EEE(v116, 2, window_SpeakInHouse->par1C, 3);
|
|
4235 v15 = (char *)pMerchantsSellPhrases[v0->_490EEE(v116, 2, window_SpeakInHouse->par1C, 3)];
|
|
4236 v36 = BuilDialogueString(v15, uActiveCharacter - 1, v116, (char *) window_SpeakInHouse->par1C, 3, 0);
|
|
4237 v115 = (174 - pFontArrus->CalcTextHeight(v36, &dialog_window, 0, 0)) / 2 + 138;
|
|
4238 dialog_window.DrawTitleText(pFontArrus, 0, v115, m_text_color, v36, 3);
|
|
4239 return;
|
|
4240 }
|
|
4241 break;
|
747
|
4242 case HOUSE_DIALOGUE_SHOP_IDENTIFY:
|
629
|
4243 {
|
|
4244 draw_leather();
|
|
4245 CharacterUI_InventoryTab_Draw(uActiveCharacter, 1);
|
|
4246 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[197], 0); //"Select the Item to Identify"
|
|
4247 if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
|
|
4248 {
|
|
4249 v1 = pMouse->GetCursorPos(&a2)->x - 14;
|
|
4250 v149 = (v1 >> 5) + 14 * ((pMouse->GetCursorPos(&v128)->y - 17) >> 5);
|
|
4251 if ( pMouse->GetCursorPos(&v141)->x > 13 )
|
|
4252 {
|
|
4253 if ( pMouse->GetCursorPos(&v143)->x < 462 )
|
|
4254 {
|
|
4255 v2 = v0->GetItemIDAtInventoryIndex((int *)&v149);
|
|
4256 if ( v2 )
|
|
4257 {
|
|
4258 v3 = (ItemGen *)&v0->pInventoryItems[v2-1];
|
|
4259 if (v3->Identified())
|
|
4260 {
|
|
4261 v118 = window_SpeakInHouse->ptr_1C;
|
|
4262 v4 = uActiveCharacter - 1;
|
|
4263 v5 = "%24";
|
|
4264 v114 = v3;
|
|
4265 }
|
|
4266 else
|
|
4267 {
|
|
4268 v118 = window_SpeakInHouse->ptr_1C;
|
|
4269 v114 = v3;
|
|
4270 v7 = (int)window_SpeakInHouse->ptr_1C;
|
|
4271 uPlayerID = uActiveCharacter - 1;
|
|
4272 v8 = v0->_490EEE(v3, 2, v7, 4);
|
|
4273 v4 = uPlayerID;
|
|
4274 v5 = (char *)pMerchantsIdentifyPhrases[v8];
|
|
4275 }
|
|
4276 v6 = BuilDialogueString(v5, v4, v114, (char *)v118, 4, 0);
|
|
4277 v115 = (174 - pFontArrus->CalcTextHeight(v6, &dialog_window, 0, 0)) / 2 + 138;
|
|
4278 dialog_window.DrawTitleText(pFontArrus, 0, v115, m_text_color, v6, 3);
|
|
4279 return;
|
|
4280 }
|
|
4281 }
|
|
4282 }
|
|
4283 }
|
|
4284 }
|
|
4285 break;
|
747
|
4286 case HOUSE_DIALOGUE_SHOP_REPAIR:
|
629
|
4287 {
|
|
4288 draw_leather();
|
|
4289 CharacterUI_InventoryTab_Draw(uActiveCharacter, 1);
|
|
4290 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[198], 0);
|
|
4291 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win())
|
|
4292 return;
|
|
4293
|
|
4294 if( (v31 = pMouse->GetCursorPos(&v135)->x - 14,
|
|
4295 v149 = (v31 >> 5) + 14 * ((pMouse->GetCursorPos(&v142)->y - 17) >> 5),
|
|
4296 pMouse->GetCursorPos(&v140)->x <= 13)
|
|
4297 || pMouse->GetCursorPos(&v138)->x >= 462
|
|
4298 || (v32 = v0->GetItemIDAtInventoryIndex((int *)&v149), v11 = 0, !v32)
|
|
4299 || (v33 = 9 * v32, !(v0->field_1F5[4 * v33 + 15] & 2)) )
|
|
4300 return;
|
|
4301
|
|
4302
|
|
4303 v120 = window_SpeakInHouse->ptr_1C;
|
|
4304 v116 = (ItemGen *)&v0->spellbook.pDarkSpellbook.bIsSpellAvailable[4 * v33 + 5];
|
|
4305 v34 = (int)window_SpeakInHouse->ptr_1C;
|
|
4306 uPlayerID = uActiveCharacter - 1;
|
|
4307 v35 = v0->_490EEE((ItemGen *)&v0->spellbook.pDarkSpellbook.bIsSpellAvailable[4 * v33 + 5], 2, v34, 5);
|
|
4308 v14 = uPlayerID;
|
|
4309 v15 = (char *)pMerchantsRepairPhrases[v35];
|
|
4310 v36 = BuilDialogueString(v15, v14, v116, (char *)v120, 5, 0);
|
|
4311 v115 = (174 - pFontArrus->CalcTextHeight(v36, &dialog_window, 0, 0)) / 2 + 138;
|
|
4312 dialog_window.DrawTitleText(pFontArrus, 0, v115, m_text_color, v36, 3);
|
|
4313 return;
|
|
4314 }
|
|
4315 break;
|
749
|
4316 case HOUSE_DIALOGUE_SHOP_6: //buy standart
|
629
|
4317 {
|
|
4318 pRenderer->DrawTextureIndexed(8u, 8u, ShopTexture);
|
|
4319 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[195], 0); //"Select the Item to Buy"
|
|
4320 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
|
|
4321 return;
|
|
4322 v149 = 0;
|
|
4323 for(int i=0;i<6;++i)
|
|
4324 if (pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][i].uItemID)
|
|
4325 ++v149;
|
|
4326
|
|
4327
|
|
4328 if ( v149 )
|
|
4329 {
|
|
4330 v94 = pMouse->GetCursorPos(&v132);
|
|
4331 v149 = pRenderer->pActiveZBuffer[v94->x + pSRZBufferLineOffsets[pMouse->GetCursorPos((POINT *)&v130)->y]];
|
|
4332 v95 = v149;
|
|
4333 if ( v149 && v149 != -65536 )
|
|
4334 {
|
|
4335 --v149;
|
|
4336
|
|
4337 v97 = uActiveCharacter - 1;
|
|
4338
|
|
4339 v99 = _this->_490EEE(
|
|
4340 &pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][v95-1], 2, window_SpeakInHouse->par1C, 2);
|
|
4341 v100 = BuilDialogueString((char *)pMerchantsBuyPhrases[v99], uActiveCharacter - 1, v98, (char *)window_SpeakInHouse->par1C, 2, 0);
|
|
4342 v103 = pFontArrus->CalcTextHeight(v100, &dialog_window, 0, 0);
|
|
4343 dialog_window.DrawTitleText(pFontArrus, 0, (174 - v103) / 2 + 138, m_text_color, v100, 3);
|
|
4344 }
|
|
4345 v104 = 0;
|
|
4346 v153 = 0;
|
|
4347 do
|
|
4348 {
|
|
4349 //if ( pParty->field_C59C[9 * (v104 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] )
|
|
4350 if (pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][v104].uItemID)
|
|
4351 {
|
|
4352 v105 = ItemsInShopTexture[v104];
|
|
4353 if ( v104 >= 4 )
|
|
4354 {
|
|
4355 v110 = 90 - ((signed int)v105->uTextureWidth >> 1);
|
|
4356 pRenderer->DrawTextureTransparent(v153 + v110 - 420, 0x7Eu, ItemsInShopTexture[v104]);
|
|
4357 v127 = v104 + 1;
|
|
4358 v109 = v153 + v110 + 80220;
|
|
4359 }
|
|
4360 else
|
|
4361 {
|
|
4362 v106 = 98 - v105->uTextureHeight;
|
|
4363 v107 = ItemsInShopTexture[v104];
|
|
4364 v108 = 98 - v105->uTextureHeight;
|
|
4365 v152 = 86 - ((signed int)v105->uTextureWidth >> 1);
|
|
4366 pRenderer->DrawTextureTransparent(v152 + v153, v108, v107);
|
|
4367 v127 = v104 + 1;
|
|
4368 v109 = v152 + v153 + 640 * v106;
|
|
4369 }
|
|
4370 ZBuffer_DoFill(&pRenderer->pActiveZBuffer[v109], ItemsInShopTexture[v104], v127);
|
|
4371 }
|
|
4372 v153 += 105;
|
|
4373 ++v104;
|
|
4374 }
|
|
4375 while ( v104 < 8 );
|
|
4376 return;
|
|
4377 }
|
|
4378 dialog_window.DrawCurrentTime(pParty->field_3C.field_50[window_SpeakInHouse->par1C]- pParty->uTimePlayed);
|
|
4379 return;
|
|
4380 }
|
|
4381 break;
|
747
|
4382 case HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT:
|
629
|
4383 {
|
|
4384 draw_leather();
|
|
4385 CharacterUI_InventoryTab_Draw(uActiveCharacter, 1);
|
|
4386 v79 = pShopOptions;
|
|
4387 pShopOptions[0] = pGlobalTXT_LocalizationStrings[200]; //"Sell"
|
|
4388 pShopOptions[1] = pGlobalTXT_LocalizationStrings[113]; //"Identify"
|
|
4389 pShopOptions[2] = pGlobalTXT_LocalizationStrings[179]; //"Repair"
|
|
4390
|
|
4391 all_text_height = 0;
|
|
4392 for(int i=0;i<3;++i)
|
|
4393 all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0);
|
|
4394 v83 = pDialogueWindow;
|
|
4395 v152 = (174 - all_text_height) / 3;
|
|
4396 v84 = pDialogueWindow->pStartingPosActiveItem;
|
|
4397 v85 = v84 + pDialogueWindow->pNumPresenceButton;
|
|
4398 v86 = (3 * (58 - v152) - all_text_height) / 2 - v152 / 2 + 138;
|
|
4399 v24 = -pDialogueWindow->pNumPresenceButton < 0;
|
|
4400 _this = (Player *)pDialogueWindow->pStartingPosActiveItem;
|
|
4401 if ( v24 ^ __OFSUB__(v84, v85) )
|
|
4402 {
|
|
4403 v153 = 2;
|
|
4404 do
|
|
4405 {
|
|
4406 v87 = v83->GetControl((unsigned int)_this);
|
|
4407 v88 = v87;
|
|
4408 v87->uY = v152 + v86;
|
|
4409 v89 = pFontArrus->CalcTextHeight(*v79, &dialog_window, 0, 0);
|
|
4410 v90 = v88->uY;
|
|
4411 v91 = v153;
|
|
4412 v88->uHeight = v89;
|
|
4413 v86 = v90 + v89 - 1;
|
|
4414 v88->uW = v86;
|
|
4415 v92 = hilight_color;
|
|
4416 if ( pDialogueWindow->pCurrentPosActiveItem != v91 )
|
|
4417 v92 = m_text_color;
|
|
4418 dialog_window.DrawTitleText(pFontArrus, 0, v90, v92, *v79, 3u);
|
|
4419 v83 = pDialogueWindow;
|
|
4420 ++v153;
|
|
4421 ++v79;
|
|
4422 _this = (Player *)((char *)_this + 1);
|
|
4423 }
|
|
4424 while ( (signed int)_this < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem );
|
|
4425 }
|
|
4426 return;
|
|
4427 }
|
|
4428 break;
|
747
|
4429 case HOUSE_DIALOGUE_SHOP_BUY_SPECIAL:
|
629
|
4430 {
|
|
4431 pRenderer->DrawTextureIndexed(8, 8, ShopTexture);
|
|
4432 v11 = 0;
|
|
4433 v61 = 0;
|
|
4434 v153 = 0;
|
|
4435 do
|
|
4436 {
|
|
4437 if (pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][v61].uItemID)
|
|
4438 {
|
|
4439 v62 = ItemsInShopTexture[v61];
|
|
4440 if ( v61 >= 4 )
|
|
4441 {
|
|
4442 v67 = 90 - ((signed int)v62->uTextureWidth >> 1);
|
|
4443 pRenderer->DrawTextureTransparent(v153 + v67 - 420, 0x7Eu, ItemsInShopTexture[v61]);
|
|
4444 v66 = v153 + v67 + 80220;
|
|
4445 }
|
|
4446 else
|
|
4447 {
|
|
4448 v63 = 98 - v62->uTextureHeight;
|
|
4449 v64 = ItemsInShopTexture[v61];
|
|
4450 v65 = 98 - v62->uTextureHeight;
|
|
4451 v152 = 86 - ((signed int)v62->uTextureWidth >> 1);
|
|
4452 pRenderer->DrawTextureTransparent(v152 + v153, v65, v64);
|
|
4453 v66 = v152 + v153 + 640 * v63;
|
|
4454 }
|
|
4455 ZBuffer_DoFill(&pRenderer->pActiveZBuffer[v66], ItemsInShopTexture[v61], v61 + 1);
|
|
4456 }
|
|
4457 v153 += 105;
|
|
4458 ++v61;
|
|
4459 }
|
|
4460 while ( v61 < 8 );
|
|
4461
|
|
4462 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
|
|
4463 return;
|
|
4464 v68 = 0;
|
|
4465 v149 = 0;
|
|
4466
|
|
4467 do
|
|
4468 {
|
|
4469 // if ( (char *)pParty->field_C59C[9 * (v68 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] != v11 )
|
|
4470 if (pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][(signed int)v68].uItemID)
|
|
4471 ++v149;
|
|
4472 ++v68;
|
|
4473 }
|
|
4474 while ( v68 < 6 );
|
|
4475
|
|
4476 v69 = GetAsyncKeyState(17);
|
|
4477 v70 = _this->CanSteal();
|
|
4478 Str = (char *)v70;
|
|
4479 if ( v69 == 0 || (char *)v70 == 0 )
|
|
4480 {
|
|
4481 v71 = pGlobalTXT_LocalizationStrings[196]; //Select the Special Item to Buy"
|
|
4482 }
|
|
4483 else
|
|
4484 {
|
|
4485 v71 = pGlobalTXT_LocalizationStrings[185];
|
|
4486 }
|
|
4487 DrawTextAtStatusBar(v71, 0);
|
|
4488 if ( (char *)v149 != 0 )
|
|
4489 {
|
|
4490 v73 = pMouse->GetCursorPos(&v136);
|
|
4491 v74 = pRenderer->pActiveZBuffer[v73->x + pSRZBufferLineOffsets[pMouse->GetCursorPos((POINT *)&v134)->y]] & 0xFFFF;
|
|
4492 if ( !v74 )
|
|
4493 return;
|
|
4494 v149 = v74 - 1;
|
|
4495
|
|
4496 if ( dialog_menu_id == 2 )
|
|
4497 selected_item = &pParty->StandartItemsInShops[window_SpeakInHouse->par1C][v74-1];
|
|
4498 else
|
|
4499 selected_item = &pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][v74-1];//(ItemGen *)&pParty->field_C59C[v76 + 724];
|
|
4500 if ( v69 == 0 || Str == 0 )
|
|
4501 {
|
|
4502 v120 = window_SpeakInHouse->ptr_1C;
|
|
4503 v15 = (char *)pMerchantsBuyPhrases[_this->_490EEE(selected_item, 2, window_SpeakInHouse->par1C, 2)];
|
|
4504 }
|
|
4505 else
|
|
4506 {
|
|
4507 v120 = window_SpeakInHouse->ptr_1C;
|
|
4508 v15 = pGlobalTXT_LocalizationStrings[181]; //"Steal %24"
|
|
4509 }
|
|
4510 v36 = BuilDialogueString(v15, uActiveCharacter - 1, selected_item, (char *)v120, 2, 0);
|
|
4511 v115 = (174 - pFontArrus->CalcTextHeight(v36, &dialog_window, 0, 0)) / 2 + 138;
|
|
4512 dialog_window.DrawTitleText(pFontArrus, 0, v115, m_text_color, v36, 3);
|
|
4513 return;
|
|
4514 }
|
|
4515 dialog_window.DrawCurrentTime( pParty->field_3C.field_50[window_SpeakInHouse->par1C]- pParty->uTimePlayed);
|
|
4516 return;
|
|
4517 }
|
|
4518 break;
|
747
|
4519 case HOUSE_DIALOGUE_LEARN_SKILLS:
|
629
|
4520 {
|
|
4521 if (!sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
|
|
4522 return;
|
|
4523 v152 = 0;
|
|
4524 v37 = pDialogueWindow;
|
|
4525 //v38 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (unsigned int)ptr_507BC0->ptr_1C] * 500.0);
|
|
4526 v38 = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0);
|
|
4527 _this = (Player *)(v38 * (100 - v0->GetMerchant()) / 100);
|
|
4528 if ( (signed int)_this < v38 / 3 )
|
|
4529 _this = (Player *)(v38 / 3);
|
|
4530 v39 = v37->pStartingPosActiveItem;
|
|
4531 v40 = v37->pNumPresenceButton;
|
|
4532 v153 = 0;
|
|
4533 if ( (signed int)v39 < (signed int)(v39 + v40) )
|
|
4534 {
|
|
4535 do
|
|
4536 {
|
|
4537 v41 = v37->GetControl(v39)->uControlParam - 36;
|
|
4538 if ( byte_4ED970_skill_learn_ability_by_class_table[v0->classType][v41] && !v0->pActiveSkills[v41] )
|
|
4539 {
|
|
4540 v42 = pFontArrus->CalcTextHeight(pSkillNames[v41], &dialog_window, 0, 0);
|
|
4541 v152 += v42;
|
|
4542 ++v153;
|
|
4543 }
|
|
4544 ++v39;
|
|
4545 }
|
|
4546 while ( (signed int)v39 < v37->pNumPresenceButton + v37->pStartingPosActiveItem );
|
|
4547 if ( v153 )
|
|
4548 {
|
|
4549 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], _this);
|
|
4550 dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u);
|
|
4551 _this = (Player *)((149 - v152) / v153);
|
|
4552 if ( (149 - v152) / v153 > 32 )
|
|
4553 _this = (Player *)32;
|
|
4554 v43 = (149 - v153 * (signed int)_this - v152) / 2 - (signed int)_this / 2 + 162;
|
|
4555 v152 = v37->pStartingPosActiveItem;
|
|
4556 v146 = v43;
|
|
4557 if ( v152 < v152 + v37->pNumPresenceButton )
|
|
4558 {
|
|
4559 v153 = 2;
|
|
4560 do
|
|
4561 {
|
|
4562 v44 = v37->GetControl(v152);
|
|
4563 v45 = v44;
|
|
4564 v46 = v44->uControlParam - 36;
|
|
4565 if ( !byte_4ED970_skill_learn_ability_by_class_table[v0->classType][v46] || v0->pActiveSkills[v46] )
|
|
4566 {
|
|
4567 v45->uW = 0;
|
|
4568 v45->uHeight = 0;
|
|
4569 v45->uY = 0;
|
|
4570 }
|
|
4571 else
|
|
4572 {
|
|
4573 v47 = pSkillNames[v46];
|
|
4574 v45->uY = (unsigned int)((char *)_this + v146);
|
|
4575 Str = v47;
|
|
4576 v48 = pFontArrus->CalcTextHeight(v47, &dialog_window, 0, 0);
|
|
4577 v49 = v45->uY;
|
|
4578 v50 = v153;
|
|
4579 v45->uHeight = v48;
|
|
4580 v51 = v49 + v48 - 1;
|
|
4581 v45->uW = v51;
|
|
4582 v146 = v51;
|
|
4583 v52 = hilight_color;
|
|
4584 if ( pDialogueWindow->pCurrentPosActiveItem != v50 )
|
|
4585 v52 = m_text_color;
|
|
4586 dialog_window.DrawTitleText(pFontArrus, 0, v49, v52, Str, 3u);
|
|
4587 }
|
|
4588 v53 = v37->pStartingPosActiveItem;
|
|
4589 ++v152;
|
|
4590 textureH = v37->pNumPresenceButton + v53;
|
|
4591 ++v153;
|
|
4592 }
|
|
4593 while ( v152 < textureH );
|
|
4594 }
|
|
4595 return;
|
|
4596 }
|
|
4597 }
|
|
4598 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], v0->pName, pClassNames[v0->classType]); //"Seek knowledge elsewhere %s the %s"
|
|
4599 strcat(pTmpBuf, "\n \n");
|
|
4600 strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]); //"I can offer you nothing further."
|
|
4601 v115 = (174 - pFontArrus->CalcTextHeight(pTmpBuf, &dialog_window, 0, 0)) / 2 + 138;
|
|
4602 dialog_window.DrawTitleText(pFontArrus, 0, v115, hilight_color, pTmpBuf, 3);
|
|
4603 return;
|
|
4604 }
|
|
4605 break;
|
|
4606 }
|
|
4607 }
|
|
4608
|
|
4609
|
|
4610
|
|
4611 //----- (004B5D7C) --------------------------------------------------------
|
|
4612 void GuildDialog()
|
|
4613 {
|
|
4614 GUIWindow *v0; // ebx@1
|
|
4615 Player *currPlayer; // edi@1
|
|
4616 signed int base_teach_price; // ebx@1
|
|
4617 int v3; // edi@6
|
|
4618 int result; // eax@11
|
|
4619 unsigned int v5; // ebx@13
|
|
4620 int v6; // esi@13
|
|
4621 signed int v7; // esi@17
|
|
4622 int v8; // esi@22
|
|
4623 signed int v9; // ecx@22
|
|
4624 char *v10; // eax@22
|
|
4625 const char *statusbar_string; // ecx@26
|
|
4626 POINT *v12; // esi@30
|
|
4627 int v13; // ecx@30
|
|
4628 void *v14; // ST1C_4@31
|
|
4629 ItemGen *v15; // ST18_4@31
|
|
4630 int v16; // ST10_4@31
|
|
4631 int v17; // eax@31
|
|
4632 char *v18; // edx@31
|
|
4633 int v19; // eax@32
|
|
4634 GUIWindow *v20; // edi@35
|
|
4635 int v21; // esi@35
|
|
4636 int v22; // eax@35
|
|
4637 unsigned int v23; // eax@36
|
|
4638 int v24; // eax@39
|
|
4639 int v25; // eax@40
|
|
4640 int v26; // ecx@47
|
|
4641 GUIButton *v27; // eax@49
|
|
4642 GUIButton *v28; // esi@49
|
|
4643 unsigned int v29; // eax@49
|
|
4644 char *v30; // eax@52
|
|
4645 int v31; // eax@55
|
|
4646 unsigned int v32; // ecx@55
|
|
4647 int v33; // eax@55
|
|
4648 unsigned __int16 v34; // ax@55
|
|
4649 int v35; // eax@58
|
|
4650 const char *v36; // ST20_4@61
|
|
4651 unsigned __int16 v37; // ST1C_2@61
|
|
4652 int v38; // eax@61
|
|
4653 GUIWindow *v39; // [sp-18h] [bp-304h]@31
|
|
4654 int v40; // [sp-14h] [bp-300h]@31
|
|
4655 int v41; // [sp-10h] [bp-2FCh]@31
|
|
4656 unsigned __int16 v42; // [sp-Ch] [bp-2F8h]@31
|
|
4657 char *v43; // [sp-8h] [bp-2F4h]@31
|
|
4658 unsigned int v44; // [sp-4h] [bp-2F0h]@31
|
|
4659 char Dest[100]; // [sp+Ch] [bp-2E0h]@3
|
|
4660 char v46[100]; // [sp+70h] [bp-27Ch]@3
|
|
4661 char v47[100]; // [sp+D4h] [bp-218h]@3
|
|
4662 char v48[100]; // [sp+138h] [bp-1B4h]@3
|
|
4663 char v49[100]; // [sp+19Ch] [bp-150h]@3
|
|
4664 POINT v50; // [sp+264h] [bp-88h]@30
|
|
4665 POINT v51; // [sp+26Ch] [bp-80h]@30
|
|
4666 GUIWindow working_window; // [sp+274h] [bp-78h]@1
|
|
4667 signed int v53; // [sp+27Ch] [bp-70h]@1
|
|
4668 signed int v54; // [sp+284h] [bp-68h]@1
|
|
4669 int v55; // [sp+2C8h] [bp-24h]@47
|
|
4670 int main_text_color; // [sp+2CCh] [bp-20h]@1
|
|
4671 int hi_text_color; // [sp+2D0h] [bp-1Ch]@1
|
|
4672 Player *v58; // [sp+2D4h] [bp-18h]@1
|
|
4673 unsigned __int8 uPlayerID; // [sp+2DBh] [bp-11h]@31
|
|
4674 char *Str; // [sp+2DCh] [bp-10h]@35
|
|
4675 int v61; // [sp+2E0h] [bp-Ch]@35
|
|
4676 unsigned int v62; // [sp+2E4h] [bp-8h]@13
|
|
4677 int v63; // [sp+2E8h] [bp-4h]@1
|
|
4678
|
|
4679 v0 = window_SpeakInHouse;
|
|
4680 memcpy(&working_window, window_SpeakInHouse, sizeof(GUIWindow));
|
|
4681 v58 = pPlayers[uActiveCharacter];
|
|
4682 currPlayer = v58;
|
|
4683 working_window.uFrameX = 483;
|
|
4684 working_window.uFrameWidth = 148;
|
|
4685 working_window.uFrameZ = 334;
|
|
4686 main_text_color = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu);
|
|
4687 hi_text_color = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu);
|
|
4688 //v2 = (signed __int64)(p2DEvents_minus1__20[13 * (unsigned int)v0->ptr_1C] * 500.0);
|
|
4689 base_teach_price = (signed __int64)(p2DEvents[(unsigned int)v0->ptr_1C - 1].fPriceMultiplier * 500.0);
|
|
4690 v63 = base_teach_price * (100 - currPlayer->GetMerchant()) / 100;
|
|
4691 if ( v63 < base_teach_price / 3 )
|
|
4692 v63 = base_teach_price / 3;
|
|
4693 strcpy(Dest, "");
|
|
4694 strcpy(v46, "");
|
|
4695 strcpy(v47, "");
|
|
4696 strcpy(v48, "");
|
|
4697 strcpy(v49, "");
|
749
|
4698 if ( dialog_menu_id != HOUSE_DIALOGUE_MAIN )
|
629
|
4699 {
|
749
|
4700 if ( dialog_menu_id != HOUSE_DIALOGUE_GULD_BUY_BOOKS ) //buy skill
|
629
|
4701 {
|
|
4702 if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
|
|
4703 {
|
|
4704 //v3 = (int)(&currPlayer->uIntelligence + dword_F8B19C); //test skill
|
|
4705 if ( v58->pActiveSkills[dialog_menu_id-36] )
|
|
4706 {
|
|
4707 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[403], pClassNames[dialog_menu_id - 16]); //"You already know the %s skill"
|
|
4708 ShowStatusBarString(pTmpBuf, 2u);
|
|
4709 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0);
|
|
4710 }
|
|
4711 else
|
|
4712 {
|
|
4713 if ( pParty->uNumGold < v63 )
|
|
4714 {
|
|
4715 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u); //"You don't have enough gold"
|
758
|
4716 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful);
|
629
|
4717 }
|
|
4718 else
|
|
4719 {
|
|
4720 Party::TakeGold(v63);
|
|
4721 v58->pActiveSkills[dialog_menu_id-36] = 1;
|
|
4722 }
|
|
4723 }
|
|
4724 }
|
|
4725 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
|
|
4726 return;
|
|
4727 }
|
|
4728 pRenderer->DrawTextureIndexed(8u, 8u, ShopTexture);
|
|
4729 v5 = 0;
|
|
4730 v6 = 0;
|
|
4731 v62 = 0;
|
|
4732 v63 = 32;
|
|
4733 do
|
|
4734 {
|
|
4735 if (pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C-139][v6].uItemID)
|
|
4736 // if ( *(&pParty->pPlayers[1].pInstalledBeacons[0].field_18 + 9 * (v6 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)) )
|
|
4737
|
|
4738 {
|
|
4739 pRenderer->DrawTextureTransparent(v63, 0x5Au, ItemsInShopTexture[v6]);
|
|
4740 ZBuffer_DoFill((int *)((char *)pRenderer->pActiveZBuffer + v62 + 230528), ItemsInShopTexture[v6], v6 + 1);
|
|
4741 currPlayer = v58;
|
|
4742 }
|
|
4743 v63 += 70;
|
|
4744 v62 += 280;
|
|
4745 ++v6;
|
|
4746 }
|
|
4747 while ( v63 < 452 );
|
|
4748
|
|
4749 v62 = 1680;
|
|
4750 v7 = 6;
|
|
4751 v63 = 32;
|
|
4752 do
|
|
4753 {
|
|
4754 if (pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C-139][v7].uItemID)
|
|
4755 // if ( *(&pParty->pPlayers[1].pInstalledBeacons[0].field_18 + 9 * (v7 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)) )
|
|
4756 {
|
|
4757 pRenderer->DrawTextureTransparent(v63, 0xFAu, ItemsInShopTexture[v7]);
|
|
4758 ZBuffer_DoFill((int *)((char *)pRenderer->pActiveZBuffer + v62 + 638448), ItemsInShopTexture[v7], v7 + 1);
|
|
4759 currPlayer = v58;
|
|
4760 }
|
|
4761 v63 += 70;
|
|
4762 v62 += 280;
|
|
4763 ++v7;
|
|
4764 }
|
|
4765 while ( v63 < 452 );
|
|
4766
|
|
4767 if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
|
|
4768 {
|
|
4769 v8 = 0;
|
|
4770 v9 = 12;
|
|
4771 // v10 = (char *)(&pParty->pPlayers[1].pInstalledBeacons[0].field_18 + 108 * (unsigned int)window_SpeakInHouse->ptr_1C);
|
|
4772 // v10 =
|
|
4773 do
|
|
4774 {
|
|
4775 if (pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C-139][v9].uItemID )
|
|
4776 ++v8;
|
|
4777 // v10 += 36;
|
|
4778 --v9;
|
|
4779 }
|
|
4780 while ( v9 );
|
|
4781
|
|
4782 GetAsyncKeyState(17);
|
|
4783 statusbar_string = pGlobalTXT_LocalizationStrings[195]; //"Select the Item to Buy"
|
749
|
4784 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD)
|
629
|
4785 statusbar_string = pGlobalTXT_LocalizationStrings[196]; //"Select the Special Item to Buy"
|
|
4786 DrawTextAtStatusBar(statusbar_string, 0);
|
|
4787 if ( !v8 )
|
|
4788 {
|
|
4789 working_window.DrawCurrentTime(
|
|
4790 __PAIR__(
|
|
4791 *(int *)&stru_AA1058[3].pSounds[8 * (unsigned int)window_SpeakInHouse->ptr_1C + 44472],
|
|
4792 *(int *)&stru_AA1058[3].pSounds[8 * (unsigned int)window_SpeakInHouse->ptr_1C + 44468])
|
|
4793 - pParty->uTimePlayed);
|
|
4794 return;
|
|
4795 }
|
|
4796 v12 = pMouse->GetCursorPos(&v51);
|
|
4797 result = v12->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v50)->y];
|
|
4798 v13 = pRenderer->pActiveZBuffer[result] & 0xFFFF;
|
|
4799 if ( pRenderer->pActiveZBuffer[result] & 0xFFFF )
|
|
4800 {
|
|
4801 v14 = window_SpeakInHouse->ptr_1C;
|
|
4802 v15 = (ItemGen *)(&pParty->pPlayers[1].uExpressionTimeLength + 18 * (v13 + 12 * (int)v14));
|
|
4803 v16 = (int)window_SpeakInHouse->ptr_1C;
|
|
4804 uPlayerID = uActiveCharacter - 1;
|
|
4805 v17 = currPlayer->_490EEE( (ItemGen *)&pParty->pPlayers[1].uExpressionTimeLength + v13 + 12 * (int)v14, 3, v16, 2);
|
|
4806 v18 = BuilDialogueString((char *)pMerchantsBuyPhrases[v17], uPlayerID, v15, (char *)v14, 2, 0);
|
|
4807 v19 = pFontArrus->CalcTextHeight(v18, &working_window, 0, 0);
|
|
4808 working_window.DrawTitleText(pFontArrus, 0, (174 - v19) / 2 + 138, main_text_color, v18, 3);
|
|
4809 return;
|
|
4810 }
|
|
4811 }
|
|
4812 return;
|
|
4813 }
|
|
4814 if ( !(unsigned __int16)_449B57_test_bit(
|
|
4815 (unsigned __int8 *)currPlayer->_guilds_member_bits,
|
|
4816 guild_mambership_flags[(unsigned int)window_SpeakInHouse->ptr_1C-139]) )
|
|
4817 { //you must me member
|
|
4818 v38 = pFontArrus->CalcTextHeight(pNPCTopics[121].pText, &working_window, 0, 0);
|
|
4819 working_window.DrawTitleText(pFontArrus, 0, (212 - v38) / 2 + 101, hi_text_color, pNPCTopics[121].pText, 3u);
|
|
4820 pDialogueWindow->pNumPresenceButton = 0;
|
|
4821 return;
|
|
4822 }
|
|
4823
|
|
4824 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
|
|
4825 return;
|
|
4826 v20 = pDialogueWindow;
|
|
4827 v5 = 0;
|
|
4828 v62 = 0;
|
|
4829 Str = 0;
|
|
4830 v21 = pDialogueWindow->pStartingPosActiveItem;
|
|
4831 v22 = v21 + pDialogueWindow->pNumPresenceButton;
|
|
4832 v61 = 0;
|
|
4833 if ( pDialogueWindow->pStartingPosActiveItem >= pDialogueWindow->pStartingPosActiveItem+pDialogueWindow->pNumPresenceButton )
|
|
4834 {
|
|
4835 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]); // "Seek knowledge elsewhere %s the %s"
|
|
4836 strcat(pTmpBuf, "\n \n");
|
|
4837 strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]); //"I can offer you nothing further."
|
|
4838 v19 = pFontArrus->CalcTextHeight(pTmpBuf, &working_window, 0, 0);
|
|
4839 working_window.DrawTitleText(pFontArrus, v5, (174 - v19) / 2 + 138, hi_text_color, pTmpBuf, 3);
|
|
4840 return;
|
|
4841 }
|
|
4842 do
|
|
4843 {
|
|
4844 v23 = v20->GetControl(v21)->uControlParam;
|
|
4845 if ( v23 == 18 )
|
|
4846 {
|
|
4847 v25 = pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[400], &working_window, 0, 0); //"Buy Spells"
|
|
4848 v62 += v25;
|
|
4849 ++v61;
|
|
4850 }
|
|
4851 else
|
|
4852 {
|
|
4853
|
|
4854 if((byte_4ED970_skill_learn_ability_by_class_table[v58->classType][v23-36])&&(v58->pActiveSkills[v23-36]))
|
|
4855 // or
|
|
4856 //byte_4ED970_skill_learn_ability_by_class_table[v58->uClass - 1][v23 + 1]
|
|
4857 {
|
|
4858 v24 = pFontArrus->CalcTextHeight(pClassNames[v23 - 16], &working_window, 0, 0);
|
|
4859 v62 += v24;
|
|
4860 ++v61;
|
|
4861 ++Str;
|
|
4862 }
|
|
4863 }
|
|
4864 ++v21;
|
|
4865 }
|
|
4866 while ( v21 < v20->pNumPresenceButton + v20->pStartingPosActiveItem );
|
|
4867 if ( !v61 )
|
|
4868 {
|
|
4869 LABEL_64:
|
|
4870 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], v58->pName, pClassNames[v58->classType]); // "Seek knowledge elsewhere %s the %s"
|
|
4871 strcat(pTmpBuf, "\n \n");
|
|
4872 strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]); //"I can offer you nothing further."
|
|
4873 v19 = pFontArrus->CalcTextHeight(pTmpBuf, &working_window, 0, 0);
|
|
4874 working_window.DrawTitleText(pFontArrus, v5, (174 - v19) / 2 + 138, hi_text_color, pTmpBuf, 3);
|
|
4875 return;
|
|
4876 }
|
|
4877 if ( Str )
|
|
4878 {
|
|
4879 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], v63); //"Skill Cost: %lu"
|
|
4880 working_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u);
|
|
4881 }
|
|
4882 v63 = (signed int)(149 - v62) / v61;
|
|
4883 if ( v63 > 32 )
|
|
4884 v63 = 32;
|
|
4885 v26 = (signed int)(149 - v61 * v63 - v62) / 2 - v63 / 2 + 162;
|
|
4886 v62 = v20->pStartingPosActiveItem;
|
|
4887 v55 = v26;
|
|
4888 if (v20->pStartingPosActiveItem < v20->pStartingPosActiveItem + v20->pNumPresenceButton )
|
|
4889 {
|
|
4890 v61 = 2;
|
|
4891 while ( 1 )
|
|
4892 {
|
|
4893 v27 = v20->GetControl(v62);
|
|
4894 v28 = v27;
|
|
4895 v29 = v27->uControlParam;
|
|
4896 if ( v29 == 18 )
|
|
4897 break;
|
|
4898
|
|
4899 // __debugbreak();
|
|
4900 //pSkillAvailabilityPerClass[8 + v58->uClass][4 + v23]
|
|
4901 // or
|
|
4902 if ((byte_4ED970_skill_learn_ability_by_class_table[v58->classType][v29 - 36])&&(v58->pActiveSkills[v29-36]))
|
|
4903 // or
|
|
4904 //byte_4ED970_skill_learn_ability_by_class_table[v58->uClass - 1][v23 + 1]
|
|
4905
|
|
4906 {
|
|
4907 v30 = pClassNames[v29 -16];
|
|
4908 LABEL_55:
|
|
4909 Str = v30;
|
|
4910 v28->uY = v63 + v55;
|
|
4911 v31 = pFontArrus->CalcTextHeight(v30, &working_window, 0, 0);
|
|
4912 v32 = v28->uY;
|
|
4913 v28->uHeight = v31;
|
|
4914 v33 = v32 + v31 - 1;
|
|
4915 v28->uW = v33;
|
|
4916 v55 = v33;
|
|
4917 v34 = hi_text_color;
|
|
4918 if ( pDialogueWindow->pCurrentPosActiveItem != v61 )
|
|
4919 v34 = main_text_color;
|
|
4920 working_window.DrawTitleText(pFontArrus, 0, v32, v34, Str, 3u);
|
|
4921 v35 = v20->pStartingPosActiveItem;
|
|
4922 ++v62;
|
|
4923 ++v61;
|
|
4924 if ( (signed int)v62 >=v20->pNumPresenceButton +v20->pStartingPosActiveItem )
|
|
4925 return;
|
|
4926 }
|
|
4927 v28->uW = 0;
|
|
4928 v28->uHeight = 0;
|
|
4929 v28->uY = 0;
|
|
4930 LABEL_58:
|
|
4931 v35 = v20->pStartingPosActiveItem;
|
|
4932 ++v62;
|
|
4933 ++v61;
|
|
4934 if ( (signed int)v62 >=v20->pNumPresenceButton +v20->pStartingPosActiveItem )
|
|
4935 return;
|
|
4936 }
|
|
4937 v30 = pGlobalTXT_LocalizationStrings[400]; //"Buy Spells"
|
|
4938 goto LABEL_55;
|
|
4939 }
|
|
4940 return;
|
|
4941 }
|
|
4942
|
|
4943
|
|
4944
|
|
4945 //----- (004B705E) --------------------------------------------------------
|
|
4946 void TempleDialog()
|
|
4947 {
|
|
4948 GUIWindow *v0; // ebx@1
|
|
4949 Player *v1; // esi@1
|
|
4950 int v2; // edi@1
|
|
4951 int result; // eax@4
|
|
4952 GUIWindow *v4; // edi@6
|
|
4953 void *v5; // eax@6
|
|
4954 int v6; // eax@6
|
|
4955 unsigned int v7; // eax@8
|
|
4956 int v8; // ecx@8
|
|
4957 unsigned int v9; // eax@9
|
|
4958 int v10; // eax@11
|
|
4959 int v11; // eax@12
|
|
4960 GUIWindow *v12; // ecx@16
|
|
4961 int v13; // edx@16
|
|
4962 GUIButton *v14; // eax@19
|
|
4963 GUIButton *v15; // edi@19
|
|
4964 int v16; // eax@19
|
|
4965 const char *v17; // eax@21
|
|
4966 int v18; // eax@21
|
|
4967 unsigned int v19; // ecx@21
|
|
4968 int v20; // eax@21
|
|
4969 unsigned __int16 v21; // ax@21
|
|
4970 unsigned __int16 v22; // ST14_2@27
|
|
4971 int v23; // eax@27
|
|
4972 double v24; // st7@28
|
|
4973 unsigned int v25; // ebx@28
|
|
4974 DDM_DLV_Header *v26; // edi@29
|
|
4975 int v27; // eax@31
|
|
4976 int v28; // eax@32
|
|
4977 //unsigned int v29; // ecx@34
|
|
4978 unsigned int v30; // edx@36
|
|
4979 unsigned int v31; // edx@38
|
|
4980 unsigned int v32; // edx@40
|
|
4981 unsigned int v33; // edx@42
|
|
4982 unsigned int v34; // edx@44
|
|
4983 int v35; // edi@50
|
|
4984 signed int v36; // eax@50
|
|
4985 unsigned __int8 v37; // al@54
|
|
4986 int v38; // ecx@54
|
|
4987 GUIWindow *v39; // eax@56
|
|
4988 unsigned __int8 v40; // al@61
|
|
4989 GUIButton *v41; // edi@64
|
|
4990 int v42; // esi@66
|
|
4991 GUIWindow *v43; // ecx@66
|
|
4992 int v44; // edi@66
|
|
4993 int v45; // eax@68
|
|
4994 signed int v46; // edi@69
|
|
4995 int v47; // edi@71
|
|
4996 GUIButton *v48; // eax@73
|
|
4997 const char *v49; // edx@73
|
|
4998 GUIButton *v50; // esi@73
|
|
4999 int v51; // eax@73
|
|
5000 unsigned int v52; // ecx@73
|
|
5001 unsigned __int16 v53; // ax@73
|
|
5002 char a1[300]; // [sp+10h] [bp-1B4h]@64
|
|
5003 GUIWindow v57; // [sp+13Ch] [bp-88h]@1
|
|
5004 __int64 v58; // [sp+190h] [bp-34h]@1
|
|
5005 __int64 v59; // [sp+198h] [bp-2Ch]@1
|
|
5006 __int64 v60; // [sp+1A0h] [bp-24h]@1
|
|
5007 GUIWindow *v61; // [sp+1ACh] [bp-18h]@6
|
|
5008 unsigned int v62; // [sp+1B0h] [bp-14h]@8
|
|
5009 unsigned __int8 v63; // [sp+1B7h] [bp-Dh]@64
|
|
5010 int v64; // [sp+1B8h] [bp-Ch]@6
|
|
5011 unsigned int v65; // [sp+1BCh] [bp-8h]@6
|
|
5012 DDM_DLV_Header *v66; // [sp+1C0h] [bp-4h]@6
|
|
5013
|
|
5014 v0 = window_SpeakInHouse;
|
|
5015 memcpy(&v57, window_SpeakInHouse, sizeof(v57));
|
|
5016 v57.uFrameX = 483;
|
|
5017 v57.uFrameWidth = 148;
|
|
5018 v57.uFrameZ = 334;
|
|
5019 HIDWORD(v58) = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu);
|
|
5020 HIDWORD(v59) = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu);
|
|
5021 v1 = pPlayers[uActiveCharacter];
|
|
5022 //v2 = pPlayers[uActiveCharacter]->_4B807C(p2DEvents_minus1__20[13 * (unsigned int)v0->ptr_1C]);
|
|
5023 v2 = pPlayers[uActiveCharacter]->_4B807C(p2DEvents[(unsigned int)v0->ptr_1C - 1].fPriceMultiplier);
|
|
5024 HIDWORD(v60) = v2;
|
749
|
5025 if ( dialog_menu_id != HOUSE_DIALOGUE_MAIN )
|
629
|
5026 {
|
749
|
5027 if ( dialog_menu_id != HOUSE_DIALOGUE_TEMPLE_HEAL )
|
629
|
5028 {
|
749
|
5029 if ( dialog_menu_id != HOUSE_DIALOGUE_TEMPLE_DONATE )
|
629
|
5030 {
|
|
5031
|
749
|
5032 if ( dialog_menu_id == HOUSE_DIALOGUE_LEARN_SKILLS )
|
629
|
5033 {
|
|
5034 if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
|
|
5035 {
|
|
5036 v4 = pDialogueWindow;
|
|
5037 v61 = pDialogueWindow;
|
|
5038 v5 = window_SpeakInHouse->ptr_1C;
|
|
5039 v66 = 0;
|
|
5040 //v65 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (signed int)v5] * 500.0);
|
|
5041 v65 = (signed __int64)(p2DEvents[(signed int)v5 - 1].flt_24 * 500.0);
|
|
5042 v6 = v1->GetMerchant();
|
|
5043 v64 = (signed int)(v65 * (100 - v6)) / 100;
|
|
5044 if ( v64 < (signed int)v65 / 3 )
|
|
5045 v64 = (signed int)v65 / 3;
|
|
5046 v7 = v4->pStartingPosActiveItem;
|
|
5047 v8 = v7 + v4->pNumPresenceButton;
|
|
5048 v65 = 0;
|
|
5049 v62 = v7;
|
|
5050 if ( (signed int)v7 >= v8 )
|
|
5051 goto LABEL_78;
|
|
5052 do
|
|
5053 {
|
|
5054 v9 = v4->GetControl(v62)->uControlParam - 36;
|
|
5055 if ( byte_4ED970_skill_learn_ability_by_class_table[v1->classType][v9] && !v1->pActiveSkills[v9] )
|
|
5056 {
|
|
5057 v10 = pFontArrus->CalcTextHeight(pSkillNames[v9], &v57, 0, 0);
|
|
5058 v66 = (DDM_DLV_Header *)((char *)v66 + v10);
|
|
5059 ++v65;
|
|
5060 }
|
|
5061 v11 = v4->pStartingPosActiveItem;
|
|
5062 ++v62;
|
|
5063 }
|
|
5064 while ( (signed int)v62 < v4->pNumPresenceButton + v11 );
|
|
5065 if ( v65 )
|
|
5066 {
|
|
5067 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], v64);
|
|
5068 v57.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u);
|
|
5069 v64 = (149 - (signed int)v66) / (signed int)v65;
|
|
5070 if ( v64 > 32 )
|
|
5071 v64 = 32;
|
|
5072 v65 = (signed int)(149 - v65 * v64 - (int)v66) / 2 - v64 / 2 + 162;
|
|
5073 v12 = v61;
|
|
5074 result = v61->pStartingPosActiveItem;
|
|
5075 v13 = result + v61->pNumPresenceButton;
|
|
5076 v62 = v61->pStartingPosActiveItem;
|
|
5077 if ( result < v13 )
|
|
5078 {
|
|
5079 v66 = (DDM_DLV_Header *)2;
|
|
5080 while ( 1 )
|
|
5081 {
|
|
5082 v14 = v12->GetControl(v62);
|
|
5083 v15 = v14;
|
|
5084 v16 = v14->uControlParam - 36;
|
|
5085 if ( !byte_4ED970_skill_learn_ability_by_class_table[v1->classType][v16] || v1->pActiveSkills[v16] )
|
|
5086 {
|
|
5087 v15->uW = 0;
|
|
5088 v15->uHeight = 0;
|
|
5089 v15->uY = 0;
|
|
5090 }
|
|
5091 else
|
|
5092 {
|
|
5093 v17 = pSkillNames[v16];
|
|
5094 v15->uY = v64 + v65;
|
|
5095 HIDWORD(v60) = (uint32)v17;
|
|
5096 v18 = pFontArrus->CalcTextHeight(v17, &v57, 0, 0);
|
|
5097 v19 = v15->uY;
|
|
5098 v15->uHeight = v18;
|
|
5099 v20 = v19 + v18 - 1;
|
|
5100 v15->uW = v20;
|
|
5101 v65 = v20;
|
|
5102 v21 = WORD2(v59);
|
|
5103 if ( (DDM_DLV_Header *)pDialogueWindow->pCurrentPosActiveItem != v66 )
|
|
5104 v21 = WORD2(v58);
|
|
5105 v57.DrawTitleText(pFontArrus, 0, v19, v21, (const char *)HIDWORD(v60), 3u);
|
|
5106 }
|
|
5107 result = (int)v61;
|
|
5108 ++v62;
|
|
5109 v66 = (DDM_DLV_Header *)((char *)v66 + 1);
|
|
5110 if ( (signed int)v62 >= v61->pNumPresenceButton + v61->pStartingPosActiveItem )
|
|
5111 break;
|
|
5112 v12 = v61;
|
|
5113 }
|
|
5114 }
|
|
5115 }
|
|
5116 else
|
|
5117 {
|
|
5118 LABEL_78:
|
|
5119 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], v1->pName, pClassNames[v1->classType]);
|
|
5120 strcat(pTmpBuf, "\n \n");
|
|
5121 strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]);
|
|
5122 v22 = WORD2(v59);
|
|
5123 v23 = pFontArrus->CalcTextHeight(pTmpBuf, &v57, 0, 0);
|
762
|
5124 v57.DrawTitleText(pFontArrus, 0, (174 - v23) / 2 + 138, v22, pTmpBuf, 3u);
|
629
|
5125 }
|
|
5126 }
|
|
5127 }
|
|
5128 return;
|
|
5129 }
|
|
5130
|
|
5131 // DONATION
|
|
5132 //v24 = p2DEvents_minus1__20[13 * (unsigned int)ptr_507BC0->ptr_1C];
|
|
5133 v24 = p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier;
|
|
5134 v25 = 0;
|
|
5135 if ( pParty->uNumGold >= (unsigned int)(signed __int64)v24 )
|
|
5136 {
|
|
5137 Party::TakeGold((signed __int64)v24);
|
|
5138 v26 = &pOutdoor->ddm;
|
|
5139 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor )
|
|
5140 v26 = &pIndoor->dlv;
|
|
5141 v27 = v26->uReputation;
|
|
5142 v66 = v26;
|
|
5143 if ( v27 > -5 )
|
|
5144 {
|
|
5145 v28 = v27 - 1;
|
|
5146 v26->uReputation = v28;
|
|
5147 if ( v28 < -5 )
|
|
5148 v26->uReputation = -5;
|
|
5149 }
|
|
5150 if ( (unsigned __int8)byte_F8B1EF[uActiveCharacter] == pParty->uDaysPlayed % 7 )
|
|
5151 {
|
|
5152 if ( v26->uReputation <= -5 )
|
|
5153 {
|
|
5154 v30 = pParty->uDaysPlayed % 7 + 1;
|
|
5155 LOBYTE(v30) = v30 | 0x80;
|
|
5156 _42777D_CastSpell_UseWand_ShootArrow(SPELL_AIR_WIZARD_EYE, uActiveCharacter - 1, v30, 48, 0);
|
|
5157 }
|
|
5158 if ( v26->uReputation <= -10 )
|
|
5159 {
|
|
5160 v31 = pParty->uDaysPlayed % 7 + 1;
|
|
5161 LOBYTE(v31) = v31 | 0x80;
|
|
5162 _42777D_CastSpell_UseWand_ShootArrow(SPELL_SPIRIT_PRESERVATION, uActiveCharacter - 1, v31, 48, 0);
|
|
5163 v26 = v66;
|
|
5164 }
|
|
5165 if ( v26->uReputation <= -15 )
|
|
5166 {
|
|
5167 v32 = pParty->uDaysPlayed % 7 + 1;
|
|
5168 LOBYTE(v32) = v32 | 0x80;
|
|
5169 _42777D_CastSpell_UseWand_ShootArrow(SPELL_BODY_PROTECTION_FROM_MAGIC, uActiveCharacter - 1, v32, 48, 0);
|
|
5170 v26 = v66;
|
|
5171 }
|
|
5172 if ( v26->uReputation <= -20 )
|
|
5173 {
|
|
5174 v33 = pParty->uDaysPlayed % 7 + 1;
|
|
5175 LOBYTE(v33) = v33 | 0x80;
|
|
5176 _42777D_CastSpell_UseWand_ShootArrow(SPELL_LIGHT_HOUR_OF_POWER, uActiveCharacter - 1, v33, 48, 0);
|
|
5177 v26 = v66;
|
|
5178 }
|
|
5179 if ( v26->uReputation <= -25 )
|
|
5180 {
|
|
5181 v34 = pParty->uDaysPlayed % 7 + 1;
|
|
5182 LOBYTE(v34) = v34 | 0x80;
|
|
5183 _42777D_CastSpell_UseWand_ShootArrow(SPELL_LIGHT_DAY_OF_PROTECTION, uActiveCharacter - 1, v34, 48, 0);
|
|
5184 }
|
|
5185 }
|
|
5186 ++byte_F8B1EF[uActiveCharacter];
|
|
5187 v1->PlaySound(SPEECH_83, 0);
|
|
5188 ShowStatusBarString(pGlobalTXT_LocalizationStrings[527], 2u); // "Thank You!"
|
|
5189 goto LABEL_46;
|
|
5190 }
|
|
5191 goto LABEL_55;
|
|
5192 }
|
|
5193 if ( !v1->_4B6FF9() )
|
|
5194 return;
|
|
5195 v25 = 0;
|
|
5196 if ( pParty->uNumGold < v2 )
|
|
5197 {
|
|
5198 LABEL_55:
|
|
5199 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u);
|
758
|
5200 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful);
|
629
|
5201 goto LABEL_46;
|
|
5202 }
|
|
5203 Party::TakeGold(v2);
|
|
5204 v35 = LODWORD(v1->pConditions[17]);
|
|
5205 v59 = v1->pConditions[14];
|
|
5206 v58 = v1->pConditions[15];
|
|
5207 v60 = v1->pConditions[16];
|
|
5208 v61 = (GUIWindow *)HIDWORD(v1->pConditions[17]);
|
|
5209 memset(v1, 0, 0xA0u);
|
|
5210 v1->sHealth = v1->GetMaxHealth();
|
|
5211 v1->sMana = v1->GetMaxMana();
|
|
5212 v36 = (signed int)window_SpeakInHouse->ptr_1C;
|
|
5213 if ( v36 != 78 && (v36 <= 80 || v36 > 82) )
|
|
5214 {
|
|
5215 if ( (unsigned int)v61 | v35 )
|
|
5216 {
|
|
5217 v37 = LOBYTE(v1->field_1928);
|
|
5218 v38 = v1->field_1924;
|
|
5219 v1->uFace = v37;
|
|
5220 v1->uVoiceID = v38;
|
|
5221 ReloadPlayerPortraits(uActiveCharacter - 1, (char)v37);
|
|
5222 }
|
|
5223 goto LABEL_63;
|
|
5224 }
|
|
5225 v39 = v61;
|
|
5226 if ( (unsigned int)v61 | v35 )
|
|
5227 {
|
|
5228 LODWORD(v1->pConditions[17]) = v35;
|
|
5229 }
|
|
5230 else
|
|
5231 {
|
|
5232 if ( !v60 && !v58 && !v59 )
|
|
5233 goto LABEL_63;
|
|
5234 v1->field_1928 = v1->uFace;
|
|
5235 v1->field_1924 = v1->uVoiceID;
|
|
5236 v1->SetCondition(0x11u, 1);
|
|
5237 v1->uVoiceID = (v1->GetSexByVoice() != 0) + 23;
|
|
5238 v40 = (v1->GetSexByVoice() != 0) + 23;
|
|
5239 v1->uFace = v40;
|
|
5240 ReloadPlayerPortraits(uActiveCharacter - 1, (char)v40);
|
|
5241 LODWORD(v1->pConditions[17]) = LODWORD(pParty->uTimePlayed);
|
|
5242 v39 = (GUIWindow *)HIDWORD(pParty->uTimePlayed);
|
|
5243 }
|
|
5244 HIDWORD(v1->pConditions[17]) = (int)v39;
|
|
5245 LABEL_63:
|
|
5246 pAudioPlayer->PlaySound((SoundID)(SOUND_GoldReceived|0x2), -1, 0, -1, 0, 0, 0, 0);
|
|
5247 v1->PlaySound(SPEECH_82, 0);
|
|
5248 pOtherOverlayList->_4418B1(20, uActiveCharacter + 99, 0, 65536);
|
|
5249 LABEL_46:
|
|
5250 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, v25);
|
|
5251 return ; // void func
|
|
5252 }
|
|
5253 v63 = 1;
|
|
5254 v41 = pDialogueWindow->GetControl(pDialogueWindow->pStartingPosActiveItem);
|
|
5255 strcpy(a1, "");
|
|
5256 v41->uHeight = 0;
|
|
5257 v41->uY = 0;
|
|
5258 if ( v1->_4B6FF9() )
|
|
5259 {
|
|
5260 sprintf(a1, "%s %d %s", pGlobalTXT_LocalizationStrings[104], HIDWORD(v60), pGlobalTXT_LocalizationStrings[97]);
|
|
5261 v63 = 0;
|
|
5262 }
|
|
5263 strcpy(&a1[100], pGlobalTXT_LocalizationStrings[68]);
|
|
5264 strcpy(&a1[200], pGlobalTXT_LocalizationStrings[160]);
|
|
5265 v42 = v63;
|
|
5266 v43 = pDialogueWindow;
|
|
5267 v44 = v63;
|
|
5268 v66 = 0;
|
|
5269 if ( v63 < pDialogueWindow->pNumPresenceButton )
|
|
5270 {
|
|
5271 v61 = (GUIWindow *)&a1[100 * v63];
|
|
5272 do
|
|
5273 {
|
|
5274 v45 = pFontArrus->CalcTextHeight((const char *)v61, &v57, 0, 0);
|
|
5275 v66 = (DDM_DLV_Header *)((char *)v66 + v45);
|
|
5276 v43 = pDialogueWindow;
|
|
5277 v61 = (GUIWindow *)((char *)v61 + 100);
|
|
5278 ++v44;
|
|
5279 }
|
|
5280 while ( v44 < pDialogueWindow->pNumPresenceButton );
|
|
5281 }
|
|
5282 v46 = v43->pNumPresenceButton - v42;
|
|
5283 v64 = (174 - (signed int)v66) / v46;
|
|
5284 if ( v64 > 32 )
|
|
5285 v64 = 32;
|
|
5286 v47 = (174 - v64 * v46 - (signed int)v66) / 2 - v64 / 2 + 138;
|
|
5287 v65 = v42 + v43->pStartingPosActiveItem;
|
|
5288 if ( v42 + v43->pStartingPosActiveItem < v43->pStartingPosActiveItem + v43->pNumPresenceButton )
|
|
5289 {
|
|
5290 v61 = (GUIWindow *)(v42 + 2);
|
|
5291 v66 = (DDM_DLV_Header *)&a1[100 * v42];
|
|
5292 do
|
|
5293 {
|
|
5294 v48 = v43->GetControl(v65);
|
|
5295 v49 = (const char *)v66;
|
|
5296 v50 = v48;
|
|
5297 v48->uY = v64 + v47;
|
|
5298 v51 = pFontArrus->CalcTextHeight(v49, &v57, 0, 0);
|
|
5299 v52 = v50->uY;
|
|
5300 v50->uHeight = v51;
|
|
5301 v47 = v52 + v51 - 1;
|
|
5302 v50->uW = v47;
|
|
5303 v53 = WORD2(v59);
|
|
5304 if ( (GUIWindow *)pDialogueWindow->pCurrentPosActiveItem != v61 )
|
|
5305 v53 = WORD2(v58);
|
|
5306 v57.DrawTitleText(pFontArrus, 0, v52, v53, (const char *)v66, 3u);
|
|
5307 v43 = pDialogueWindow;
|
|
5308 v66 = (DDM_DLV_Header *)((char *)v66 + 100);
|
|
5309 v61 = (GUIWindow *)((char *)v61 + 1);
|
|
5310 ++v65;
|
|
5311 }
|
|
5312 while ( (signed int)v65 < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem );
|
|
5313 }
|
|
5314 return;
|
|
5315 }
|
|
5316
|
|
5317 //----- (004B4710) --------------------------------------------------------
|
758
|
5318 void TrainingDialog()
|
629
|
5319 {
|
717
|
5320 //Player *v0; // ebx@1
|
629
|
5321 int color2; // eax@1
|
651
|
5322 //unsigned int v2; // ecx@1
|
|
5323 //int v3; // eax@1
|
|
5324 //signed int v4; // edx@1
|
|
5325 unsigned __int64 v5; // edi@3
|
|
5326 //unsigned int v6; // esi@3
|
|
5327 //void *v7; // ecx@3
|
629
|
5328 int v8; // edx@4
|
|
5329 double v9; // st7@6
|
|
5330 signed int v10; // esi@6
|
|
5331 int v11; // ecx@6
|
758
|
5332 //int result; // eax@9
|
629
|
5333 GUIWindow *v13; // edi@14
|
|
5334 signed int v14; // esi@14
|
|
5335 unsigned int v15; // esi@16
|
|
5336 int v16; // eax@16
|
|
5337 unsigned int v17; // eax@17
|
|
5338 int v18; // eax@19
|
|
5339 int v19; // ecx@24
|
|
5340 GUIButton *v20; // eax@26
|
|
5341 GUIButton *v21; // esi@26
|
|
5342 int v22; // eax@26
|
|
5343 const char *v23; // eax@28
|
|
5344 int v24; // eax@28
|
|
5345 unsigned int v25; // ecx@28
|
|
5346 int v26; // eax@28
|
|
5347 unsigned __int16 v27; // ax@28
|
758
|
5348 //int v28; // eax@32
|
629
|
5349 unsigned __int16 v29; // ST14_2@34
|
|
5350 int v30; // eax@34
|
758
|
5351 //const char *v31; // ST18_4@36
|
|
5352 //unsigned __int16 v32; // ST14_2@36
|
629
|
5353 int v33; // eax@36
|
|
5354 int v34; // eax@37
|
|
5355 unsigned int v35; // edi@38
|
|
5356 unsigned int v36; // eax@38
|
758
|
5357 //int v37; // ecx@41
|
|
5358 //char *v38; // eax@41
|
|
5359 //int *v39; // eax@45
|
629
|
5360 unsigned int v40; // eax@46
|
758
|
5361 //void *v41; // ecx@46
|
629
|
5362 unsigned int v42; // eax@46
|
|
5363 GUIWindow *v43; // ecx@59
|
|
5364 int v44; // edx@59
|
|
5365 char **v45; // esi@60
|
758
|
5366 //int v46; // eax@62
|
629
|
5367 int v47; // eax@68
|
758
|
5368 //int v48; // edx@69
|
629
|
5369 int v49; // ebx@69
|
758
|
5370 //unsigned __int8 v50; // sf@69
|
629
|
5371 char **v51; // edi@70
|
|
5372 GUIButton *v52; // eax@71
|
|
5373 GUIButton *v53; // esi@71
|
|
5374 int v54; // eax@71
|
|
5375 unsigned int v55; // ecx@71
|
|
5376 int v56; // eax@71
|
|
5377 unsigned __int16 v57; // ax@71
|
|
5378 unsigned __int16 v58; // [sp-Ch] [bp-90h]@38
|
758
|
5379 //const char *v59; // [sp-Ch] [bp-90h]@63
|
629
|
5380 char *v60; // [sp-8h] [bp-8Ch]@38
|
758
|
5381 //char *v61; // [sp-8h] [bp-8Ch]@63
|
629
|
5382 unsigned int v62; // [sp-4h] [bp-88h]@38
|
|
5383 int v63; // [sp-4h] [bp-88h]@52
|
758
|
5384 //char *v64; // [sp-4h] [bp-88h]@63
|
629
|
5385 GUIWindow v65; // [sp+Ch] [bp-78h]@1
|
651
|
5386 //__int64 v66; // [sp+60h] [bp-24h]@3
|
629
|
5387 unsigned int white; // [sp+68h] [bp-1Ch]@1
|
|
5388 int v68; // [sp+6Ch] [bp-18h]@3
|
|
5389 int v69; // [sp+70h] [bp-14h]@6
|
651
|
5390 //unsigned int i; // [sp+74h] [bp-10h]@1
|
|
5391 //int v71; // [sp+78h] [bp-Ch]@1
|
629
|
5392 int v72; // [sp+7Ch] [bp-8h]@16
|
|
5393 int v73; // [sp+80h] [bp-4h]@14
|
|
5394
|
717
|
5395 //v0 = pPlayers[uActiveCharacter];
|
629
|
5396 memcpy(&v65, window_SpeakInHouse, sizeof(v65));
|
|
5397 v65.uFrameX = 483;
|
|
5398 v65.uFrameWidth = 148;
|
|
5399 v65.uFrameZ = 334;
|
758
|
5400 white = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(255, 255, 255);
|
629
|
5401 color2 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xCDu, 0x23u);
|
651
|
5402 //v71 = color2;
|
|
5403 //v2 = v0->uLevel;
|
|
5404 //v3 = 0;
|
|
5405 //v4 = 0;
|
|
5406 //for ( i = v2; v4 < (signed int)v2; ++v4 )
|
|
5407 // v3 += v4 + 1;
|
|
5408 //v5 = 1000 * v3;
|
717
|
5409 v5 = 1000ui64 * pPlayers[uActiveCharacter]->uLevel * (pPlayers[uActiveCharacter]->uLevel + 1) / 2; // E n = n(n + 1) / 2
|
651
|
5410 //v6 = HIDWORD(v0->uExperience);
|
|
5411 //v7 = window_SpeakInHouse->ptr_1C;
|
758
|
5412 v68 = pMaxLevelPerTrainingHallType[(unsigned int)window_SpeakInHouse->ptr_1C - HOUSE_TRAINING_HALL_EMERALD_ISLE];
|
651
|
5413 //v66 = 1000 * v3;
|
717
|
5414 if (pPlayers[uActiveCharacter]->uExperience >= v5)
|
629
|
5415 {
|
717
|
5416 v8 = pPlayers[uActiveCharacter]->classType % 4 + 1;
|
629
|
5417 if ( v8 == 4 )
|
|
5418 v8 = 3;
|
717
|
5419 v9 = (double)pPlayers[uActiveCharacter]->uLevel;
|
651
|
5420 //i = 0;
|
629
|
5421 v69 = v8;
|
|
5422 //v10 = (signed __int64)(v9 * p2DEvents_minus1__20[13 * (signed int)v7] * (double)v8);
|
651
|
5423 v10 = (signed __int64)(v9 * p2DEvents[(signed int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier * (double)v8);
|
717
|
5424 v11 = v10 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100;
|
629
|
5425 if ( v11 < v10 / 3 )
|
|
5426 v11 = v10 / 3;
|
651
|
5427 //i = v11;
|
629
|
5428 }
|
758
|
5429
|
|
5430 if (sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win())
|
629
|
5431 {
|
749
|
5432 if ( dialog_menu_id != HOUSE_DIALOGUE_MAIN )
|
629
|
5433 {
|
758
|
5434 if ( dialog_menu_id != HOUSE_DIALOGUE_TRAININGHALL_TRAIN )
|
629
|
5435 {
|
749
|
5436 if ( dialog_menu_id == HOUSE_DIALOGUE_LEARN_SKILLS )
|
629
|
5437 {
|
758
|
5438 if (sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win())
|
629
|
5439 {
|
651
|
5440 //i = 0;
|
|
5441 int _v0 = 0;
|
629
|
5442 v13 = pDialogueWindow;
|
|
5443 //v14 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (unsigned int)ptr_507BC0->ptr_1C] * 500.0);
|
|
5444 v14 = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0);
|
717
|
5445 v73 = v14 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100;
|
629
|
5446 if ( v73 < v14 / 3 )
|
|
5447 v73 = v14 / 3;
|
|
5448 v15 = v13->pStartingPosActiveItem;
|
|
5449 v16 = v13->pNumPresenceButton;
|
|
5450 v72 = 0;
|
|
5451 if ( (signed int)v15 >= (signed int)(v15 + v16) )
|
|
5452 goto LABEL_76;
|
|
5453 do
|
|
5454 {
|
|
5455 v17 = v13->GetControl(v15)->uControlParam - 36;
|
717
|
5456 if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][v17] && !pPlayers[uActiveCharacter]->pActiveSkills[v17] )
|
629
|
5457 {
|
|
5458 v18 = pFontArrus->CalcTextHeight(pSkillNames[v17], &v65, 0, 0);
|
651
|
5459 _v0 += v18;
|
629
|
5460 ++v72;
|
|
5461 }
|
|
5462 ++v15;
|
|
5463 }
|
|
5464 while ( (signed int)v15 < v13->pNumPresenceButton + v13->pStartingPosActiveItem );
|
|
5465 if ( v72 )
|
|
5466 {
|
|
5467 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], v73);// "Skill Cost: %lu"
|
|
5468 v65.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u);
|
651
|
5469 v73 = (signed int)(149 - _v0) / v72;
|
629
|
5470 if ( v73 > 32 )
|
|
5471 v73 = 32;
|
758
|
5472 //result = v13->pStartingPosActiveItem;
|
651
|
5473 v19 = (signed int)(149 - v72 * v73 - _v0) / 2 - v73 / 2 + 162;
|
758
|
5474 int _v1 = v13->pStartingPosActiveItem;
|
629
|
5475 v68 = v19;
|
758
|
5476 if (v13->pStartingPosActiveItem < v13->pStartingPosActiveItem + v13->pNumPresenceButton )
|
629
|
5477 {
|
|
5478 v72 = 2;
|
|
5479 do
|
|
5480 {
|
651
|
5481 v20 = v13->GetControl(_v1);
|
629
|
5482 v21 = v20;
|
|
5483 v22 = v20->uControlParam - 36;
|
717
|
5484 if ( !byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][v22] || pPlayers[uActiveCharacter]->pActiveSkills[v22] )
|
629
|
5485 {
|
|
5486 v21->uW = 0;
|
|
5487 v21->uHeight = 0;
|
|
5488 v21->uY = 0;
|
|
5489 }
|
|
5490 else
|
|
5491 {
|
|
5492 v23 = pSkillNames[v22];
|
|
5493 v21->uY = v73 + v68;
|
651
|
5494 //HIDWORD(v66) = (int)v23;
|
629
|
5495 v24 = pFontArrus->CalcTextHeight(v23, &v65, 0, 0);
|
|
5496 v25 = v21->uY;
|
|
5497 v21->uHeight = v24;
|
|
5498 v26 = v25 + v24 - 1;
|
|
5499 v21->uW = v26;
|
|
5500 v68 = v26;
|
651
|
5501 v27 = color2;
|
629
|
5502 if ( pDialogueWindow->pCurrentPosActiveItem != v72 )
|
|
5503 v27 = white;
|
651
|
5504 v65.DrawTitleText(pFontArrus, 0, v25, v27, v23, 3u);
|
629
|
5505 }
|
651
|
5506 ++_v1;
|
629
|
5507 ++v72;
|
|
5508 }
|
758
|
5509 while ( (signed int)_v1 < v13->pStartingPosActiveItem + v13->pNumPresenceButton );
|
629
|
5510 }
|
|
5511 }
|
|
5512 else
|
|
5513 {
|
|
5514 LABEL_76:
|
717
|
5515 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]);//
|
629
|
5516 // "Seek knowledge elsewhere %s the %s"
|
|
5517 strcat(pTmpBuf, "\n \n");
|
|
5518 strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]);// "I can offer you nothing further."
|
651
|
5519 v29 = color2;
|
629
|
5520 v30 = pFontArrus->CalcTextHeight(pTmpBuf, &v65, 0, 0);
|
762
|
5521 v65.DrawTitleText(pFontArrus, 0, (174 - v30) / 2 + 138, v29, pTmpBuf, 3u);
|
629
|
5522 }
|
|
5523 }
|
|
5524 }
|
758
|
5525 return;
|
629
|
5526 }
|
|
5527 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
|
|
5528 {
|
758
|
5529 //v31 = pNPCTopics[122].pText;
|
|
5530 //v32 = color2;
|
629
|
5531 v33 = pFontArrus->CalcTextHeight(pNPCTopics[122].pText, &v65, 0, 0);
|
758
|
5532 v65.DrawTitleText(pFontArrus, 0, (212 - v33) / 2 + 101, color2, pNPCTopics[122].pText, 3);
|
629
|
5533 pDialogueWindow->pNumPresenceButton = 0;
|
758
|
5534 return;
|
629
|
5535 }
|
717
|
5536 v34 = pPlayers[uActiveCharacter]->uLevel;
|
629
|
5537 if ( v34 < v68 )
|
|
5538 {
|
717
|
5539 if ( (signed __int64)pPlayers[uActiveCharacter]->uExperience >= v5 )
|
629
|
5540 {
|
651
|
5541 if ( pParty->uNumGold >= v11)
|
629
|
5542 {
|
651
|
5543 Party::TakeGold(v11);
|
758
|
5544 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful);
|
717
|
5545 ++pPlayers[uActiveCharacter]->uLevel;
|
|
5546 pPlayers[uActiveCharacter]->uSkillPoints += pPlayers[uActiveCharacter]->uLevel / 10 + 5;
|
|
5547 pPlayers[uActiveCharacter]->sHealth = pPlayers[uActiveCharacter]->GetMaxHealth();
|
|
5548 pPlayers[uActiveCharacter]->sMana = pPlayers[uActiveCharacter]->GetMaxMana();
|
758
|
5549
|
|
5550 uint max_level_in_party = player_levels[0];
|
|
5551 for (uint _it = 1; _it < 4; ++_it)
|
629
|
5552 {
|
758
|
5553 if (player_levels[_it] > max_level_in_party)
|
|
5554 max_level_in_party = player_levels[_it];
|
629
|
5555 }
|
758
|
5556
|
|
5557 ++player_levels[uActiveCharacter - 1];
|
|
5558 if (player_levels[uActiveCharacter - 1] > max_level_in_party) // if we reach new maximum party level
|
|
5559 // feature is broken thou, since this array is always zeroed in EnterHouse
|
629
|
5560 {
|
758
|
5561 v40 = _494820_training_time(pParty->uCurrentHour);
|
|
5562 //v41 = window_SpeakInHouse->ptr_1C;
|
629
|
5563 v42 = 60 * (v40 + 4) - pParty->uCurrentMinute;
|
758
|
5564 if ((unsigned int)window_SpeakInHouse->ptr_1C == HOUSE_TRAINING_HALL_94 ||
|
|
5565 (unsigned int)window_SpeakInHouse->ptr_1C == HOUSE_TRAINING_HALL_95)
|
629
|
5566 v42 += 720;
|
|
5567 RestAndHeal((signed int)(v42 + 10080));
|
|
5568 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor )
|
|
5569 pOutdoor->SetFog();
|
|
5570 }
|
717
|
5571 pPlayers[uActiveCharacter]->PlaySound(SPEECH_87, 0);
|
|
5572 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[430], pPlayers[uActiveCharacter]->pName, pPlayers[uActiveCharacter]->uLevel, pPlayers[uActiveCharacter]->uLevel / 10 + 5);//
|
629
|
5573 // "%s is now Level %lu and has earned %lu Skill Points!"
|
717
|
5574 ShowStatusBarString(pTmpBuf, 2);
|
|
5575 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
|
758
|
5576 return;
|
629
|
5577 }
|
717
|
5578 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);// "You don't have enough gold"
|
629
|
5579 v63 = 4;
|
|
5580 LABEL_55:
|
735
|
5581 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)v63);
|
717
|
5582 //LABEL_56:
|
629
|
5583 /*result = pMessageQueue_50CBD0->uNumMessages;
|
|
5584 if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
|
|
5585 {
|
|
5586 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113;
|
|
5587 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1;
|
|
5588 result = 3 * pMessageQueue_50CBD0->uNumMessages + 3;
|
|
5589 *(&pMessageQueue_50CBD0->uNumMessages + result) = 0;
|
|
5590 ++pMessageQueue_50CBD0->uNumMessages;
|
|
5591 }
|
|
5592 return result;*/
|
|
5593 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
|
758
|
5594 return;
|
629
|
5595 }
|
717
|
5596 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[538], (unsigned int)(v5 - pPlayers[uActiveCharacter]->uExperience), v34 + 1);//
|
629
|
5597 // "You need %d more experience to train to level %d"
|
|
5598 v35 = 0;
|
|
5599 v62 = 3;
|
|
5600 v60 = pTmpBuf;
|
651
|
5601 v58 = color2;
|
629
|
5602 v36 = (212 - pFontArrus->CalcTextHeight(pTmpBuf, &v65, 0, 0)) / 2 + 88;
|
|
5603 }
|
|
5604 else
|
|
5605 {
|
|
5606 sprintf(pTmpBuf, "%s\n \n%s", pGlobalTXT_LocalizationStrings[536], pGlobalTXT_LocalizationStrings[529]);//
|
|
5607 // ""With your skills, you should be working here as a teacher.""
|
|
5608 // ""Sorry, but we are unable to train you.""
|
|
5609 v35 = 0;
|
|
5610 v62 = 3;
|
|
5611 v60 = pTmpBuf;
|
651
|
5612 v58 = color2;
|
629
|
5613 v36 = (212 - pFontArrus->CalcTextHeight(pTmpBuf, &v65, 0, 0)) / 2 + 101;
|
|
5614 }
|
|
5615 v65.DrawTitleText(pFontArrus, v35, v36, v58, v60, v62);
|
|
5616 v63 = 3;
|
|
5617 goto LABEL_55;
|
|
5618 }
|
758
|
5619
|
|
5620 if (sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win())
|
629
|
5621 {
|
|
5622 v43 = pDialogueWindow;
|
|
5623 v72 = 0;
|
|
5624 pShopOptions[0] = pTmpBuf;
|
|
5625 pShopOptions[1] = pGlobalTXT_LocalizationStrings[160];// "Learn Skills"
|
|
5626 v44 = pDialogueWindow->pNumPresenceButton;
|
|
5627 v73 = pDialogueWindow->pStartingPosActiveItem;
|
|
5628 if ( v73 < v73 + v44 )
|
|
5629 {
|
|
5630 v45 = pShopOptions;
|
|
5631 do
|
|
5632 {
|
758
|
5633 if ( v43->GetControl(v73)->uControlParam == HOUSE_DIALOGUE_TRAININGHALL_TRAIN )
|
629
|
5634 {
|
758
|
5635 //v46 = pPlayers[uActiveCharacter]->uLevel;
|
|
5636 if (pPlayers[uActiveCharacter]->uLevel >= v68)
|
|
5637 sprintfex(*v45, "%s\n \n%s",
|
|
5638 pGlobalTXT_LocalizationStrings[536], pGlobalTXT_LocalizationStrings[529]); //"With your skills, you should be working here as a teacher." "Sorry, but we are unable to train you."
|
629
|
5639 else
|
|
5640 {
|
758
|
5641 if (pPlayers[uActiveCharacter]->uExperience < v5)
|
|
5642 sprintfex(*v45, pGlobalTXT_LocalizationStrings[538], // "You need %d more experience to train to level %d"
|
|
5643 (uint)(v5 - pPlayers[uActiveCharacter]->uExperience), pPlayers[uActiveCharacter]->uLevel + 1);
|
|
5644 else
|
|
5645 sprintfex(*v45, pGlobalTXT_LocalizationStrings[537], // "Train to level %d for %d gold"
|
|
5646 pPlayers[uActiveCharacter]->uLevel + 1, v11);
|
629
|
5647 }
|
|
5648 }
|
|
5649 v47 = pFontArrus->CalcTextHeight(*v45, &v65, 0, 0);
|
|
5650 v43 = pDialogueWindow;
|
|
5651 v72 += v47;
|
|
5652 ++v45;
|
|
5653 ++v73;
|
|
5654 }
|
|
5655 while ( v73 < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem );
|
|
5656 }
|
758
|
5657
|
629
|
5658 v49 = (2 * (87 - (174 - v72) / 2) - v72) / 2 - (174 - v72) / 2 / 2 + 138;
|
|
5659 v73 = v43->pStartingPosActiveItem;
|
758
|
5660 if (v43->pStartingPosActiveItem < v43->pStartingPosActiveItem + v43->pNumPresenceButton)
|
629
|
5661 {
|
651
|
5662 int _v3 = 2;
|
629
|
5663 v51 = pShopOptions;
|
|
5664 do
|
|
5665 {
|
|
5666 v52 = v43->GetControl(v73);
|
|
5667 v53 = v52;
|
651
|
5668 v52->uY = (174 - v72) / 2 + v49;
|
629
|
5669 v54 = pFontArrus->CalcTextHeight(*v51, &v65, 0, 0);
|
|
5670 v55 = v53->uY;
|
|
5671 v53->uHeight = v54;
|
|
5672 v56 = v54 + v55 - 1;
|
|
5673 v53->uW = v56;
|
|
5674 v49 = v56;
|
651
|
5675 v57 = color2;
|
|
5676 if ( pDialogueWindow->pCurrentPosActiveItem != _v3 )
|
629
|
5677 v57 = white;
|
|
5678 v65.DrawTitleText(pFontArrus, 0, v55, v57, *v51, 3u);
|
|
5679 v43 = pDialogueWindow;
|
651
|
5680 ++_v3;
|
629
|
5681 ++v51;
|
|
5682 ++v73;
|
|
5683 }
|
758
|
5684 while ( v73 < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton);
|
629
|
5685 }
|
|
5686 }
|
|
5687 }
|
|
5688 }
|
|
5689
|
|
5690
|
|
5691
|
|
5692
|
|
5693
|
|
5694
|
|
5695
|
|
5696
|
|
5697
|
|
5698 //----- (004B4FCF) --------------------------------------------------------
|
|
5699 void MagicShopDialog()
|
|
5700 {
|
|
5701 Player *v0; // ebx@1
|
|
5702 int result; // eax@6
|
|
5703 signed int v2; // esi@8
|
|
5704 unsigned int v3; // ebx@10
|
|
5705 char *v4; // eax@11
|
|
5706 char *v5; // eax@12
|
|
5707 unsigned int v6; // eax@12
|
|
5708 int v7; // ST08_4@14
|
|
5709 int v8; // eax@14
|
|
5710 unsigned __int8 v9; // dl@14
|
|
5711 char *v10; // ecx@14
|
|
5712 signed int v11; // esi@16
|
|
5713 int v12; // ST08_4@19
|
|
5714 int v13; // eax@19
|
|
5715 int all_text_height; // edi@21
|
|
5716 char **v15; // esi@21
|
|
5717 int v16; // eax@22
|
|
5718 GUIWindow *v17; // ecx@23
|
|
5719 int v18; // edx@23
|
|
5720 int v19; // edi@23
|
|
5721 unsigned __int8 v20; // sf@23
|
|
5722 GUIButton *control_button; // esi@25
|
|
5723 const char **v22; // eax@25
|
|
5724 int v23; // eax@25
|
|
5725 unsigned int v24; // ecx@25
|
|
5726 const char **v25; // edx@25
|
|
5727 unsigned __int16 text_color; // ax@25
|
|
5728 signed int v27; // esi@30
|
|
5729 int v28; // ST08_4@34
|
|
5730 int v29; // eax@34
|
|
5731 char *v30; // edx@35
|
|
5732 GUIWindow *v31; // edi@40
|
|
5733 void *v32; // eax@40
|
|
5734 signed int v33; // esi@40
|
|
5735 unsigned int v34; // esi@42
|
|
5736 int v35; // eax@42
|
|
5737 unsigned int v36; // eax@43
|
|
5738 int v37; // eax@45
|
|
5739 int v38; // ecx@50
|
|
5740 GUIButton *v39; // eax@52
|
|
5741 GUIButton *v40; // esi@52
|
|
5742 int v41; // eax@52
|
|
5743 char *v42; // eax@54
|
|
5744 int v43; // eax@54
|
|
5745 unsigned int v44; // ecx@54
|
|
5746 int v45; // edx@54
|
|
5747 int v46; // eax@54
|
|
5748 unsigned __int16 v47; // ax@54
|
|
5749 int v48; // eax@58
|
|
5750 signed int v49; // esi@62
|
|
5751 Texture *v50; // ecx@64
|
|
5752 unsigned int v51; // edi@64
|
|
5753 unsigned int v52; // esi@66
|
|
5754 int v53; // edx@70
|
|
5755 Texture *v54; // ecx@76
|
|
5756 unsigned int v55; // edi@76
|
|
5757 unsigned int v56; // esi@76
|
|
5758 int v57; // edx@80
|
|
5759 Texture *v58; // ecx@86
|
|
5760 unsigned int v59; // edi@86
|
|
5761 unsigned int v60; // esi@88
|
|
5762 int v61; // edx@92
|
|
5763 Texture *v62; // ecx@98
|
|
5764 unsigned int v63; // edi@98
|
|
5765 unsigned int v64; // esi@100
|
|
5766 int v65; // edx@104
|
|
5767 signed int v66; // ecx@109
|
|
5768 SHORT v67; // di@117
|
|
5769 bool v68; // eax@117
|
|
5770 const char *v69; // ecx@119
|
|
5771 POINT *v70; // esi@124
|
|
5772 int v71; // ecx@125
|
|
5773 int v72; // eax@125
|
|
5774 int v73; // ecx@125
|
|
5775 ItemGen *v74; // esi@125
|
|
5776 int v75; // eax@130
|
|
5777 int v76; // esi@131
|
|
5778 char **v77; // edi@131
|
|
5779 int v78; // eax@132
|
|
5780 GUIWindow *v79; // ecx@133
|
|
5781 int v80; // edx@133
|
|
5782 int v81; // edi@133
|
|
5783 GUIButton *v82; // esi@135
|
|
5784 const char **v83; // eax@135
|
|
5785 int v84; // eax@135
|
|
5786 unsigned int v85; // ecx@135
|
|
5787 int v86; // edx@135
|
|
5788 unsigned __int16 v87; // ax@135
|
|
5789 GUIWindow *v88; // [sp-18h] [bp-110h]@35
|
|
5790 int v89; // [sp-14h] [bp-10Ch]@35
|
|
5791 ItemGen *v90; // [sp-10h] [bp-108h]@14
|
|
5792 int v91; // [sp-10h] [bp-108h]@35
|
|
5793 unsigned __int16 v92; // [sp-Ch] [bp-104h]@12
|
|
5794 void *v93; // [sp-Ch] [bp-104h]@14
|
|
5795 int v94; // [sp-8h] [bp-100h]@11
|
|
5796 char *v95; // [sp-8h] [bp-100h]@12
|
|
5797 __int64 *v96; // [sp-4h] [bp-FCh]@11
|
|
5798 unsigned int v97; // [sp-4h] [bp-FCh]@12
|
|
5799 POINT v98; // [sp+Ch] [bp-ECh]@8
|
|
5800 POINT v99; // [sp+14h] [bp-E4h]@16
|
|
5801 POINT v100; // [sp+1Ch] [bp-DCh]@124
|
|
5802 POINT v101; // [sp+24h] [bp-D4h]@17
|
|
5803 POINT v102; // [sp+2Ch] [bp-CCh]@124
|
|
5804 POINT v103; // [sp+34h] [bp-C4h]@9
|
|
5805 POINT v104; // [sp+3Ch] [bp-BCh]@31
|
|
5806 POINT v105; // [sp+44h] [bp-B4h]@16
|
|
5807 POINT v106; // [sp+4Ch] [bp-ACh]@30
|
|
5808 POINT v107; // [sp+54h] [bp-A4h]@16
|
|
5809 POINT v108; // [sp+5Ch] [bp-9Ch]@30
|
|
5810 POINT a2; // [sp+64h] [bp-94h]@8
|
|
5811 POINT v110; // [sp+6Ch] [bp-8Ch]@30
|
|
5812 POINT v111; // [sp+74h] [bp-84h]@8
|
|
5813 GUIWindow dialog_window; // [sp+7Ch] [bp-7Ch]@1
|
|
5814 char *Str; // [sp+D0h] [bp-28h]@54
|
|
5815 int v146; // [sp+D4h] [bp-24h]@23
|
|
5816 unsigned int hilight_color; // [sp+D8h] [bp-20h]@1
|
|
5817 unsigned int m_text_color; // [sp+DCh] [bp-1Ch]@1
|
|
5818 __int32 v117; // [sp+E0h] [bp-18h]@8
|
|
5819 int v118; // [sp+E4h] [bp-14h]@40
|
|
5820 const char **v119; // [sp+E8h] [bp-10h]@24
|
|
5821 Player *_this; // [sp+ECh] [bp-Ch]@1
|
|
5822 unsigned __int8 uPlayerID; // [sp+F3h] [bp-5h]@14
|
|
5823 int v152; // [sp+F4h] [bp-4h]@23
|
|
5824 int v122;
|
|
5825 int v114;
|
|
5826
|
|
5827 v0 = pPlayers[uActiveCharacter];
|
|
5828 _this = pPlayers[uActiveCharacter];
|
|
5829 memcpy(&dialog_window, window_SpeakInHouse, sizeof(dialog_window));
|
|
5830 dialog_window.uFrameX = 483;
|
|
5831 dialog_window.uFrameWidth = 148;
|
|
5832 dialog_window.uFrameZ = 334;
|
|
5833 m_text_color = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu);
|
|
5834 hilight_color = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xCDu, 0x23u);
|
749
|
5835 if ( dialog_menu_id > HOUSE_DIALOGUE_SHOP_REPAIR )
|
629
|
5836 {
|
749
|
5837 if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT )
|
629
|
5838 {
|
|
5839 draw_leather();
|
|
5840 CharacterUI_InventoryTab_Draw(uActiveCharacter, 1);
|
|
5841 pShopOptions[0] = pGlobalTXT_LocalizationStrings[200];// "Sell"
|
|
5842 pShopOptions[1] = pGlobalTXT_LocalizationStrings[113];// "Identify"
|
|
5843 pShopOptions[2] = pGlobalTXT_LocalizationStrings[179];// "Repair"
|
|
5844 v76 = 0;
|
|
5845 v77 = pShopOptions;
|
|
5846 do
|
|
5847 {
|
|
5848 v78 = pFontArrus->CalcTextHeight(*v77, &dialog_window, 0, 0);
|
|
5849 ++v77;
|
|
5850 v76 += v78;
|
|
5851 }
|
|
5852 while ( (signed int)v77 < (signed int)&pShopOptions[3] );
|
|
5853 v79 = pDialogueWindow;
|
|
5854 _this = (Player *)((174 - v76) / 3);
|
|
5855 result = pDialogueWindow->pStartingPosActiveItem;
|
|
5856 v80 = result + pDialogueWindow->pNumPresenceButton;
|
|
5857 v81 = (3 * (58 - (signed int)_this) - v76) / 2 - (174 - v76) / 3 / 2 + 138;
|
|
5858 v20 = -pDialogueWindow->pNumPresenceButton < 0;
|
|
5859 v118 = pDialogueWindow->pStartingPosActiveItem;
|
|
5860 if ( v20 ^ __OFSUB__(result, v80) )
|
|
5861 {
|
|
5862 v122 = 2;
|
|
5863 v119 = (const char **)pShopOptions;
|
|
5864 do
|
|
5865 {
|
|
5866 v82 = v79->GetControl(v118);
|
|
5867 v83 = v119;
|
|
5868 v82->uY = (unsigned int)((char *)_this + v81);
|
|
5869 v84 = pFontArrus->CalcTextHeight(*v83, &dialog_window, 0, 0);
|
|
5870 v85 = v82->uY;
|
|
5871 v86 = v122;
|
|
5872 v82->uHeight = v84;
|
|
5873 v81 = v84 + v85 - 1;
|
|
5874 v82->uW = v81;
|
|
5875 v87 = hilight_color;
|
|
5876 if ( pDialogueWindow->pCurrentPosActiveItem != v86 )
|
|
5877 v87 = m_text_color;
|
|
5878 dialog_window.DrawTitleText(pFontArrus, 0, v85, v87, *v119, 3u);
|
|
5879 v79 = pDialogueWindow;
|
|
5880 ++v122;
|
|
5881 ++v119;
|
|
5882 ++v118;
|
|
5883 result = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem;
|
|
5884 }
|
|
5885 while ( v118 < result );
|
|
5886 }
|
|
5887 return;
|
|
5888 }
|
749
|
5889 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_SPECIAL )
|
629
|
5890 {
|
749
|
5891 result = dialog_menu_id - HOUSE_DIALOGUE_LEARN_SKILLS;
|
|
5892 if ( dialog_menu_id == HOUSE_DIALOGUE_LEARN_SKILLS )
|
629
|
5893 {
|
|
5894 result = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win();
|
|
5895 if ( result )
|
|
5896 {
|
|
5897 v31 = pDialogueWindow;
|
|
5898 v3 = 0;
|
|
5899 v32 = window_SpeakInHouse->ptr_1C;
|
|
5900 v118 = 0;
|
|
5901 //v33 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (signed int)v32] * 500.0);
|
|
5902 v33 = (signed __int64)(p2DEvents[(signed int)v32 - 1].flt_24 * 500.0);
|
|
5903 v119 = (const char **)(v33 * (100 - _this->GetMerchant()) / 100);
|
|
5904 if ( (signed int)v119 < v33 / 3 )
|
|
5905 v119 = (const char **)(v33 / 3);
|
|
5906 v34 = v31->pStartingPosActiveItem;
|
|
5907 v35 = v34 + v31->pNumPresenceButton;
|
|
5908 v122 = 0;
|
|
5909 if ( (signed int)v34 >= v35 )
|
|
5910 goto LABEL_140;
|
|
5911 do
|
|
5912 {
|
|
5913 v36 = v31->GetControl(v34)->uControlParam - 36;
|
|
5914 if ( byte_4ED970_skill_learn_ability_by_class_table[_this->classType][v36] && !_this->pActiveSkills[v36] )
|
|
5915 {
|
|
5916 v37 = pFontArrus->CalcTextHeight(pSkillNames[v36], &dialog_window, 0, 0);
|
|
5917 v118 += v37;
|
|
5918 ++v122;
|
|
5919 }
|
|
5920 ++v34;
|
|
5921 }
|
|
5922 while ( (signed int)v34 < v31->pNumPresenceButton + v31->pStartingPosActiveItem );
|
|
5923 if ( !v122 )
|
|
5924 {
|
|
5925 LABEL_140:
|
|
5926 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], _this->pName, pClassNames[_this->classType]);//
|
|
5927 // "Seek knowledge elsewhere %s the %s"
|
|
5928 strcat(pTmpBuf, "\n \n");
|
|
5929 strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]);// "I can offer you nothing further."
|
|
5930 v30 = pTmpBuf;
|
|
5931 v97 = 3;
|
|
5932 v95 = pTmpBuf;
|
|
5933 v92 = hilight_color;
|
|
5934 v91 = 0;
|
|
5935 v89 = 0;
|
|
5936 v88 = &dialog_window;
|
|
5937 goto LABEL_61;
|
|
5938 }
|
|
5939 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], v119);// "Skill Cost: %lu"
|
|
5940 dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u);
|
|
5941 v119 = (const char **)((149 - v118) / v122);
|
|
5942 if ( (149 - v118) / v122 > 32 )
|
|
5943 v119 = (const char **)32;
|
|
5944 result = v31->pStartingPosActiveItem;
|
|
5945 v38 = (149 - v122 * (signed int)v119 - v118) / 2 - (signed int)v119 / 2 + 162;
|
|
5946 v118 = result;
|
|
5947 v114 = v38;
|
|
5948 if ( result < result + v31->pNumPresenceButton )
|
|
5949 {
|
|
5950 v122 = 2;
|
|
5951 do
|
|
5952 {
|
|
5953 v39 = v31->GetControl(v118);
|
|
5954 v40 = v39;
|
|
5955 v41 = v39->uControlParam - 36;
|
|
5956 if ( !byte_4ED970_skill_learn_ability_by_class_table[_this->classType][v41] || _this->pActiveSkills[v41] )
|
|
5957 {
|
|
5958 v40->uW = 0;
|
|
5959 v40->uHeight = 0;
|
|
5960 v40->uY = 0;
|
|
5961 }
|
|
5962 else
|
|
5963 {
|
|
5964 v42 = pSkillNames[v41];
|
|
5965 v40->uY = (unsigned int)((char *)v119 + v114);
|
|
5966 Str = v42;
|
|
5967 v43 = pFontArrus->CalcTextHeight(v42, &dialog_window, 0, 0);
|
|
5968 v44 = v40->uY;
|
|
5969 v45 = v122;
|
|
5970 v40->uHeight = v43;
|
|
5971 v46 = v44 + v43 - 1;
|
|
5972 v40->uW = v46;
|
|
5973 v114 = v46;
|
|
5974 v47 = hilight_color;
|
|
5975 if ( pDialogueWindow->pCurrentPosActiveItem != v45 )
|
|
5976 v47 = m_text_color;
|
|
5977 dialog_window.DrawTitleText(pFontArrus, 0, v44, v47, Str, 3u);
|
|
5978 }
|
|
5979 v48 = v31->pStartingPosActiveItem;
|
|
5980 ++v118;
|
|
5981 result = v31->pNumPresenceButton + v48;
|
|
5982 ++v122;
|
|
5983 }
|
|
5984 while ( v118 < result );
|
|
5985 }
|
|
5986 }
|
|
5987 }
|
|
5988 return;
|
|
5989 }
|
|
5990 }
|
|
5991 else
|
|
5992 {
|
749
|
5993 if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_REPAIR)
|
629
|
5994 {
|
|
5995 draw_leather();
|
|
5996 CharacterUI_InventoryTab_Draw(uActiveCharacter, 1);
|
|
5997 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[198], 0);// "Select the Item to Repair"
|
|
5998 result = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win();
|
|
5999 if ( !result
|
|
6000 || (v27 = pMouse->GetCursorPos(&v110)->x - 14,
|
|
6001 v117 = (v27 >> 5) + 14 * ((pMouse->GetCursorPos(&v108)->y - 17) >> 5),
|
|
6002 result = (int)pMouse->GetCursorPos(&v106),
|
|
6003 *(int *)result <= 13)
|
|
6004 || (result = (int)pMouse->GetCursorPos(&v104), *(int *)result >= 462)
|
|
6005 || (result = v0->GetItemIDAtInventoryIndex((int *)&v117), v3 = 0, !result)
|
|
6006 || (result *= 9, !(_this->field_1F5[4 * result + 15] & 2)) )
|
|
6007 return;
|
|
6008 v96 = 0;
|
|
6009 v94 = 5;
|
|
6010 v93 = window_SpeakInHouse->ptr_1C;
|
|
6011 v90 = (ItemGen *)&_this->spellbook.pDarkSpellbook.bIsSpellAvailable[4 * result + 5];
|
|
6012 v28 = (int)window_SpeakInHouse->ptr_1C;
|
|
6013 uPlayerID = uActiveCharacter - 1;
|
|
6014 v29 = _this->_490EEE((ItemGen *)&_this->spellbook.pDarkSpellbook.bIsSpellAvailable[4 * result + 5], 3, v28, 5);
|
|
6015 v9 = uPlayerID;
|
|
6016 v10 = (char *)pMerchantsRepairPhrases[v29];
|
|
6017 goto LABEL_35;
|
|
6018 }
|
749
|
6019 if ( dialog_menu_id == HOUSE_DIALOGUE_MAIN)
|
629
|
6020 {
|
|
6021 /* result = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win();
|
|
6022 if ( result )
|
|
6023 {
|
|
6024 pShopOptions[0] = pGlobalTXT_LocalizationStrings[134];// "Buy Standard"
|
|
6025 pShopOptions[1] = pGlobalTXT_LocalizationStrings[152];// "Buy Special"
|
|
6026 pShopOptions[2] = pGlobalTXT_LocalizationStrings[159];// "Display Inventory"
|
|
6027 v14 = 0;
|
|
6028 pShopOptions[3] = pGlobalTXT_LocalizationStrings[160];// "Learn Skills"
|
|
6029 v15 = pShopOptions;
|
|
6030 do
|
|
6031 {
|
|
6032 v16 = pFontArrus->CalcTextHeight(*v15, &dialogue_window, 0, 0);
|
|
6033 ++v15;
|
|
6034 v14 += v16;
|
|
6035 }
|
|
6036 while ( (signed int)v15 < (signed int)&unk_F8B1C8 );
|
|
6037 v17 = pDialogueWindow;
|
|
6038 v114 = (174 - v14) / 4;
|
|
6039 result = pDialogueWindow->pStartingPosActiveItem;
|
|
6040 v18 = result + pDialogueWindow->pNumPresenceButton;
|
|
6041 v19 = (174 - 4 * (174 - v14) / 4 - v14) / 2 - (174 - v14) / 4 / 2 + 138;
|
|
6042 v20 = -pDialogueWindow->pNumPresenceButton < 0;
|
|
6043 v122 = pDialogueWindow->pStartingPosActiveItem;
|
|
6044 if ( v20 ^ __OFSUB__(result, v18) )
|
|
6045 {
|
|
6046 v119 = (const char **)2;
|
|
6047 _this = (Player *)pShopOptions;
|
|
6048 do
|
|
6049 {
|
|
6050 v21 = v17->GetControl(v122);
|
|
6051 v22 = (const char **)_this;
|
|
6052 v21->uY = v114 + v19;
|
|
6053 v23 = pFontArrus->CalcTextHeight(*v22, &dialogue_window, 0, 0);
|
|
6054 v24 = v21->uY;
|
|
6055 v25 = v119;
|
|
6056 v21->uHeight = v23;
|
|
6057 v19 = v24 + v23 - 1;
|
|
6058 v21->uW = v19;
|
|
6059 v26 = color2;
|
|
6060 if ( (const char **)pDialogueWindow->pCurrentPosActiveItem != v25 )
|
|
6061 v26 = m_text_color;
|
|
6062 dialogue_window.DrawTitleText(pFontArrus, 0, v24, v26, (const char *)LODWORD(_this->pConditions[0]), 3u);
|
|
6063 v17 = pDialogueWindow;
|
|
6064 v119 = (const char **)((char *)v119 + 1);
|
|
6065 _this = (Player *)((char *)_this + 4);
|
|
6066 ++v122;
|
|
6067 result = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem;
|
|
6068 }
|
|
6069 while ( v122 < result );
|
|
6070 }
|
|
6071 }*/
|
|
6072 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
|
|
6073 return;
|
|
6074 pShopOptions[0] = pGlobalTXT_LocalizationStrings[134]; //"Buy Standard"
|
|
6075 pShopOptions[1] = pGlobalTXT_LocalizationStrings[152]; //"Buy Special"
|
|
6076 pShopOptions[2] = pGlobalTXT_LocalizationStrings[159]; //"Display Inventory"
|
|
6077 pShopOptions[3] = pGlobalTXT_LocalizationStrings[160];
|
|
6078
|
|
6079 all_text_height = 0;
|
|
6080 for(int i=0;i<4;++i)
|
|
6081 all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0);
|
|
6082 v146 = (174 - all_text_height) / 4;
|
|
6083
|
|
6084 v23 = (174 - 4 * (174 - all_text_height) / 4 - all_text_height) / 2 - (174 - all_text_height) / 4 / 2 + 138;
|
|
6085 int j=0;
|
|
6086 if ( pDialogueWindow->pNumPresenceButton>=0 )
|
|
6087 {
|
|
6088 int th = 2;
|
|
6089 for (v152 = pDialogueWindow->pStartingPosActiveItem; v152 < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++v152)
|
|
6090 {
|
|
6091 control_button = pDialogueWindow->GetControl(v152);
|
|
6092 control_button->uY = v146 + v23;
|
|
6093 v27 = pFontArrus->CalcTextHeight(pShopOptions[j], &dialog_window, 0, 0);
|
|
6094 control_button->uHeight = v27;
|
|
6095 v23 = control_button->uY + control_button->uHeight - 1;
|
|
6096 control_button->uW = v23;
|
|
6097 text_color = hilight_color;
|
|
6098 if ( pDialogueWindow->pCurrentPosActiveItem != th )
|
|
6099 text_color = m_text_color;
|
|
6100 dialog_window.DrawTitleText(pFontArrus, 0, control_button->uY, text_color, pShopOptions[j], 3);
|
|
6101 ++th;
|
|
6102 ++j;
|
|
6103 }
|
|
6104 }
|
|
6105
|
|
6106
|
|
6107 return;
|
|
6108 }
|
749
|
6109 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD)
|
629
|
6110 {
|
749
|
6111 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_SELL)
|
629
|
6112 {
|
749
|
6113 result = dialog_menu_id - HOUSE_DIALOGUE_SHOP_IDENTIFY;
|
|
6114 if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_IDENTIFY)
|
629
|
6115 {
|
|
6116 draw_leather();
|
|
6117 CharacterUI_InventoryTab_Draw(uActiveCharacter, 1);
|
|
6118 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[197], 0);// "Select the Item to Identify"
|
|
6119 result = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win();
|
|
6120 if ( result )
|
|
6121 {
|
|
6122 v2 = pMouse->GetCursorPos(&a2)->x - 14;
|
|
6123 v117 = (v2 >> 5) + 14 * ((pMouse->GetCursorPos(&v98)->y - 17) >> 5);
|
|
6124 result = (int)pMouse->GetCursorPos(&v111);
|
|
6125 if ( *(int *)result > 13 )
|
|
6126 {
|
|
6127 result = (int)pMouse->GetCursorPos(&v103);
|
|
6128 if ( *(int *)result < 462 )
|
|
6129 {
|
|
6130 result = v0->GetItemIDAtInventoryIndex((int *)&v117);
|
|
6131 v3 = 0;
|
|
6132 if ( result )
|
|
6133 {
|
|
6134 v96 = 0;
|
|
6135 v94 = 4;
|
|
6136 v4 = (char *)&_this->pInventoryItems[result-1];
|
|
6137 if ( v4[20] & 1 )
|
|
6138 {
|
|
6139 v5 = BuilDialogueString("%24", uActiveCharacter - 1, (ItemGen *)v4, (char *)window_SpeakInHouse->ptr_1C, 4, 0);
|
|
6140 v97 = 3;
|
|
6141 v95 = v5;
|
|
6142 v92 = m_text_color;
|
|
6143 v6 = (212 - pFontArrus->CalcTextHeight(v5, &dialog_window, 0, 0)) / 2 + 101;
|
|
6144
|
|
6145 dialog_window.DrawTitleText(pFontArrus, v3, v6, v92, v95, v97);
|
|
6146 return;
|
|
6147 }
|
|
6148 v93 = window_SpeakInHouse->ptr_1C;
|
|
6149 v90 = (ItemGen *)v4;
|
|
6150 v7 = (int)window_SpeakInHouse->ptr_1C;
|
|
6151 uPlayerID = uActiveCharacter - 1;
|
|
6152 v8 = ((Player *)_this)->_490EEE((ItemGen *)v4, 3, v7, 4);
|
|
6153 v9 = uPlayerID;
|
|
6154 v10 = (char *)pMerchantsIdentifyPhrases[v8];
|
|
6155 goto LABEL_35;
|
|
6156 }
|
|
6157 }
|
|
6158 }
|
|
6159 }
|
|
6160 }
|
|
6161 return;
|
|
6162 }
|
|
6163 draw_leather();
|
|
6164 CharacterUI_InventoryTab_Draw(uActiveCharacter, 1);
|
|
6165 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[199], 0);// "Select the Item to Sell"
|
|
6166 result = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win();
|
|
6167 if ( !result
|
|
6168 || (v11 = pMouse->GetCursorPos(&v107)->x - 14,
|
|
6169 v117 = (v11 >> 5) + 14 * ((pMouse->GetCursorPos(&v99)->y - 17) >> 5),
|
|
6170 result = (int)pMouse->GetCursorPos(&v105),
|
|
6171 *(int *)result <= 13)
|
|
6172 || (result = (int)pMouse->GetCursorPos(&v101), *(int *)result >= 462)
|
|
6173 || (result = v0->GetItemIDAtInventoryIndex((int *)&v117), v3 = 0, !result) )
|
|
6174 return;
|
|
6175 v96 = 0;
|
|
6176 v94 = 3;
|
|
6177 v93 = window_SpeakInHouse->ptr_1C;
|
|
6178 v90 = (ItemGen *)&_this->pInventoryItems[result-1];
|
|
6179 v12 = (int)window_SpeakInHouse->ptr_1C;
|
|
6180 uPlayerID = uActiveCharacter - 1;
|
|
6181 v13 = _this->_490EEE(v90, 3, v12, 3);
|
|
6182 v9 = uPlayerID;
|
|
6183 v10 = (char *)pMerchantsSellPhrases[v13];
|
|
6184 LABEL_35:
|
|
6185 v30 = BuilDialogueString(v10, v9, v90, (char *)v93, v94, v96);
|
|
6186 v97 = 3;
|
|
6187 v95 = v30;
|
|
6188 v92 = m_text_color;
|
|
6189 v91 = v3;
|
|
6190 v89 = v3;
|
|
6191 v88 = &dialog_window;
|
|
6192 LABEL_61:
|
|
6193 v6 = (174 - pFontArrus->CalcTextHeight(v30, v88, v89, v91)) / 2 + 138;
|
|
6194 dialog_window.DrawTitleText(pFontArrus, v3, v6, v92, v95, v97);
|
|
6195 return;
|
|
6196 }
|
|
6197 }
|
|
6198 pRenderer->DrawTextureIndexed(8u, 8u, ShopTexture);
|
|
6199 v3 = 0;
|
|
6200 v49 = 0;
|
|
6201 v122 = 0;
|
749
|
6202 if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_BUY_STANDARD)
|
629
|
6203 {
|
|
6204 do
|
|
6205 {
|
|
6206 // if ( pParty->field_777C[9 * (v49 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] )
|
757
|
6207 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v49].uItemID)
|
629
|
6208 {
|
|
6209 v50 = ItemsInShopTexture[v49];
|
|
6210 v51 = 152 - v50->uTextureHeight;
|
|
6211 if ( (signed int)v51 < 1 )
|
|
6212 v51 = 0;
|
|
6213 v52 = 75 * v49 - v50->uTextureWidth / 2 + 40;
|
|
6214 if ( v122 )
|
|
6215 {
|
|
6216 if ( v122 == 5 )
|
|
6217 {
|
|
6218 v53 = ItemsInShopTexture[5]->uTextureWidth;
|
|
6219 if ( (signed int)v52 > 457 - v53 )
|
|
6220 v52 = 457 - v53;
|
|
6221 }
|
|
6222 }
|
|
6223 else
|
|
6224 {
|
|
6225 if ( (signed int)v52 < 18 )
|
|
6226 v52 = 18;
|
|
6227 }
|
|
6228 pRenderer->DrawTextureTransparent(v52, v51, v50);
|
|
6229 sub_40F92A(&pRenderer->pActiveZBuffer[v52 + 640 * v51], ItemsInShopTexture[v122], v122 + 1);
|
|
6230 v49 = v122;
|
|
6231 }
|
|
6232 ++v49;
|
|
6233 v122 = v49;
|
|
6234 }
|
|
6235 while ( v49 < 6 );
|
|
6236 v122 = 0;
|
|
6237 do
|
|
6238 {
|
|
6239 //if ( pParty->field_777C[9 * (v122 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 54] )
|
757
|
6240 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v122+1].uItemID)
|
629
|
6241 {
|
|
6242 v54 = ItemsInShopTexture[v122 + 6];
|
|
6243 v55 = 306 - v54->uTextureHeight;
|
|
6244 v56 = 75 * v122 - v54->uTextureWidth / 2 + 40;
|
|
6245 if ( v122 )
|
|
6246 {
|
|
6247 if ( v122 == 5 )
|
|
6248 {
|
|
6249 v57 = ItemsInShopTexture[11]->uTextureWidth;
|
|
6250 if ( (signed int)v56 > 457 - v57 )
|
|
6251 v56 = 457 - v57;
|
|
6252 }
|
|
6253 }
|
|
6254 else
|
|
6255 {
|
|
6256 if ( (signed int)v56 < 18 )
|
|
6257 v56 = 18;
|
|
6258 }
|
|
6259 pRenderer->DrawTextureTransparent(v56, v55, v54);
|
|
6260 sub_40F92A(&pRenderer->pActiveZBuffer[v56 + 640 * v55], ItemsInShopTexture[v122 + 6], v122 + 7);
|
|
6261 }
|
|
6262 ++v122;
|
|
6263 }
|
|
6264 while ( v122 < 6 );
|
|
6265 }
|
|
6266 else
|
|
6267 {
|
|
6268 do
|
|
6269 {
|
|
6270 // if ( pParty->field_C59C[9 * (v49 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] )
|
|
6271 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v49].uItemID)
|
|
6272 {
|
|
6273 v58 = ItemsInShopTexture[v49];
|
|
6274 v59 = 152 - v58->uTextureHeight;
|
|
6275 if ( (signed int)v59 < 1 )
|
|
6276 v59 = 0;
|
|
6277 v60 = 75 * v49 - v58->uTextureWidth / 2 + 40;
|
|
6278 if ( v122 )
|
|
6279 {
|
|
6280 if ( v122 == 5 )
|
|
6281 {
|
|
6282 v61 = ItemsInShopTexture[5]->uTextureWidth;
|
|
6283 if ( (signed int)v60 > 457 - v61 )
|
|
6284 v60 = 457 - v61;
|
|
6285 }
|
|
6286 }
|
|
6287 else
|
|
6288 {
|
|
6289 if ( (signed int)v60 < 18 )
|
|
6290 v60 = 18;
|
|
6291 }
|
|
6292 pRenderer->DrawTextureTransparent(v60, v59, v58);
|
|
6293 sub_40F92A(&pRenderer->pActiveZBuffer[v60 + 640 * v59], ItemsInShopTexture[v122], v122 + 1);
|
|
6294 v49 = v122;
|
|
6295 }
|
|
6296 ++v49;
|
|
6297 v122 = v49;
|
|
6298 }
|
|
6299 while ( v49 < 6 );
|
|
6300 v122 = 0;
|
|
6301 do
|
|
6302 {
|
|
6303 //if ( pParty->Spell_Item[(unsigned int)window_SpeakInHouse->ptr_1C][v49] + 778] ) //weak
|
|
6304 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v49].uAttributes)
|
|
6305 {
|
|
6306 v62 = ItemsInShopTexture[v122 + 6];
|
|
6307 v63 = 306 - v62->uTextureHeight;
|
|
6308 if ( (signed int)v63 < 1 )
|
|
6309 v63 = 0;
|
|
6310 v64 = 75 * v122 - v62->uTextureWidth / 2 + 40;
|
|
6311 if ( v122 )
|
|
6312 {
|
|
6313 if ( v122 == 5 )
|
|
6314 {
|
|
6315 v65 = ItemsInShopTexture[11]->uTextureWidth;
|
|
6316 if ( (signed int)v64 > 457 - v65 )
|
|
6317 v64 = 457 - v65;
|
|
6318 }
|
|
6319 }
|
|
6320 else
|
|
6321 {
|
|
6322 if ( (signed int)v64 < 18 )
|
|
6323 v64 = 18;
|
|
6324 }
|
|
6325 pRenderer->DrawTextureTransparent(v64, v63, v62);
|
|
6326 sub_40F92A(&pRenderer->pActiveZBuffer[v64 + 640 * v63], ItemsInShopTexture[v122 + 6], v122 + 7);
|
|
6327 }
|
|
6328 ++v122;
|
|
6329 }
|
|
6330 while ( v122 < 6 );
|
|
6331 }
|
|
6332 result = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win();
|
|
6333 if ( result )
|
|
6334 {
|
|
6335 v66 = 0;
|
757
|
6336 v117 = 0;\
|
749
|
6337 if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_BUY_STANDARD)
|
629
|
6338 {
|
|
6339 do
|
|
6340 {
|
757
|
6341 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v66].uItemID) //9 * (v66 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] )
|
629
|
6342 ++v117;
|
|
6343 ++v66;
|
|
6344 }
|
|
6345 while ( v66 < 12 );
|
|
6346 }
|
|
6347 else
|
|
6348 {
|
|
6349 do
|
|
6350 {
|
|
6351 //if ( pParty->field_C59C[9 * (v66 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] )
|
|
6352 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v66].uItemID)
|
|
6353 ++v117;
|
|
6354 ++v66;
|
|
6355 }
|
|
6356 while ( v66 < 12 );
|
|
6357 }
|
|
6358 v67 = GetAsyncKeyState(VK_CONTROL);
|
|
6359 v68 = _this->CanSteal();
|
|
6360 Str = (char *)v68;
|
|
6361 if ( v67 && v68 )
|
|
6362 {
|
|
6363 v69 = pGlobalTXT_LocalizationStrings[185];// "Steal item"
|
|
6364 }
|
|
6365 else
|
|
6366 {
|
|
6367 v69 = pGlobalTXT_LocalizationStrings[195];// "Select the Item to Buy"
|
749
|
6368 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD)
|
629
|
6369 v69 = pGlobalTXT_LocalizationStrings[196];// "Select the Special Item to Buy"
|
|
6370 }
|
|
6371 DrawTextAtStatusBar(v69, 0);
|
|
6372 if ( !v117 )
|
|
6373 {
|
|
6374 dialog_window.DrawCurrentTime( pParty->field_3C.field_50[(unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed);
|
|
6375 return;
|
|
6376 }
|
|
6377 v70 = pMouse->GetCursorPos(&v102);
|
|
6378 result = v70->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v100)->y];
|
|
6379 if ( pRenderer->pActiveZBuffer[result] & 0xFFFF )
|
|
6380 {
|
|
6381 v71 = (pRenderer->pActiveZBuffer[result] & 0xFFFF) - 1;
|
|
6382 v117 = v71;
|
|
6383 v72 = (int)window_SpeakInHouse->ptr_1C;
|
|
6384 // v73 = 9 * (v71 + 12 * v72);
|
|
6385 v74 = (ItemGen *)&pParty->StandartItemsInShops[v72][v71];
|
749
|
6386 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD)
|
629
|
6387 // v74 = (ItemGen *)&pParty->field_C59C[v73 + 724];
|
|
6388 v74 =&pParty->SpecialItemsInShops[v72][v71];
|
|
6389 if ( v67 && Str )
|
|
6390 {
|
|
6391 v10 = pGlobalTXT_LocalizationStrings[181];// "Steal %24"
|
|
6392 v96 = 0;
|
|
6393 v94 = 2;
|
|
6394 v93 = window_SpeakInHouse->ptr_1C;
|
|
6395 v90 = v74;
|
|
6396 v9 = uActiveCharacter - 1;
|
|
6397 }
|
|
6398 else
|
|
6399 {
|
|
6400 v96 = 0;
|
|
6401 v94 = 2;
|
|
6402 v93 = window_SpeakInHouse->ptr_1C;
|
|
6403 v90 = v74;
|
|
6404 uPlayerID = uActiveCharacter - 1;
|
|
6405 v75 = _this->_490EEE(v74, 3, v72, 2);
|
|
6406 v9 = uPlayerID;
|
|
6407 v10 = (char *)pMerchantsBuyPhrases[v75];
|
|
6408 }
|
|
6409 goto LABEL_35;
|
|
6410 }
|
|
6411 }
|
|
6412 return;
|
|
6413 }
|