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