1298
|
1 #ifdef _MSC_VER
|
|
2 #define _CRT_SECURE_NO_WARNINGS
|
|
3 #endif
|
|
4
|
1299
|
5 #include "..\Texture.h"
|
|
6 #include "..\mm7_data.h"
|
1298
|
7 #include "UIHouses.h"
|
1299
|
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"
|
1298
|
28
|
1299
|
29 #include "..\stru159.h"
|
1298
|
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
|
1393
|
317
|
|
318 //----- (004B1784) --------------------------------------------------------
|
|
319 bool __cdecl HouseUI_CheckIfPlayerCanInteract()
|
|
320 {
|
|
321 Player *pPlayer; // ebx@1
|
|
322 bool result; // eax@2
|
|
323 int v3; // eax@3
|
|
324 GUIWindow v4; // [sp+4h] [bp-54h]@3
|
|
325
|
|
326 pPlayer = pPlayers[uActiveCharacter];
|
|
327 if ( pPlayer->CanAct() )
|
|
328 {
|
|
329 pDialogueWindow->pNumPresenceButton = dword_F8B1E0;
|
|
330 result = 1;
|
|
331 }
|
|
332 else
|
|
333 {
|
|
334 pDialogueWindow->pNumPresenceButton = 0;
|
|
335 memcpy(&v4, pPrimaryWindow, sizeof(v4));
|
|
336 v4.uFrameX = 483;
|
|
337 v4.uFrameWidth = 148;
|
|
338 v4.uFrameZ = 334;
|
|
339 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[427], pPlayer->pName, pGlobalTXT_LocalizationStrings[562]);//
|
|
340 // "%s is in no condition to %s"
|
|
341 // "do anything"
|
|
342 v3 = pFontArrus->CalcTextHeight(pTmpBuf.data(), &v4, 0, 0);
|
|
343 v4.DrawTitleText(pFontArrus, 0, (212 - v3) / 2 + 101, ui_house_player_cant_interact_color, pTmpBuf.data(), 3u);
|
|
344 result = 0;
|
|
345 }
|
|
346 return result;
|
|
347 }
|
|
348
|
1298
|
349 //----- (0044622E) --------------------------------------------------------
|
|
350 bool EnterHouse(enum HOUSE_ID uHouseID)
|
|
351 {
|
|
352 //enum HOUSE_ID v1; // edi@1
|
|
353 //int v2; // edi@5
|
|
354 signed int uOpenTime; // eax@5
|
|
355 signed int uCloseTime; // esi@5
|
|
356 unsigned int v5; // esi@5
|
|
357 int v6; // edx@5
|
|
358 signed int am_pm_flag_open; // ecx@10
|
|
359 signed int am_pm_flag_close; // eax@10
|
|
360 int v9; // esi@10
|
|
361 //unsigned int v10; // esi@16
|
|
362 int v11; // ecx@17
|
|
363 unsigned int v12; // kr00_4@25
|
|
364 //Player *v13; // esi@25
|
|
365 int v14; // eax@25
|
|
366 //Player *v15; // esi@27
|
|
367 //signed int v16; // eax@32
|
|
368 unsigned int v17; // eax@37
|
|
369 signed int v18; // edi@37
|
|
370 signed int v19; // edi@41
|
|
371 //unsigned int v20; // ecx@41
|
|
372 //const char *v22; // [sp-4h] [bp-40h]@33
|
|
373 char pContainer[40]; // [sp+Ch] [bp-30h]@32
|
|
374 unsigned int v24; // [sp+34h] [bp-8h]@5
|
|
375 //enum HOUSE_ID v25; // [sp+38h] [bp-4h]@1
|
|
376
|
|
377 //v1 = uHouseID;
|
|
378 //v25 = uHouseID;
|
|
379 GameUI_Footer_TimedString[0] = 0;
|
|
380 pFooterString[0] = 0;
|
|
381 ShowStatusBarString("", 2u);
|
|
382 if ( pMessageQueue_50CBD0->uNumMessages )
|
|
383 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
|
|
384 viewparams->bRedrawGameUI = 1;
|
|
385 uDialogueType = 0;
|
|
386 pKeyActionMap->SetWindowInputStatus(3);
|
|
387 pKeyActionMap->ResetKeys();
|
|
388 if (uHouseID == HOUSE_600 || uHouseID == HOUSE_601)
|
|
389 {
|
|
390 GameOverMenu(0);
|
|
391 return 0;
|
|
392 }
|
|
393 uOpenTime = p2DEvents[uHouseID - 1].uOpenTime;
|
|
394 uCloseTime = p2DEvents[uHouseID - 1].uCloseTime;
|
|
395 current_npc_text = 0;
|
|
396 dword_F8B1E4 = 0;
|
|
397 dword_F8B1F4 = 0;
|
|
398 memset(byte_F8B1F0.data(), 0, 4);
|
|
399 memset(player_levels.data(), 0, 16);
|
|
400 pRenderer->ClearZBuffer(0, 479);
|
|
401
|
|
402 if (((uCloseTime - 1 <= uOpenTime)&&((pParty->uCurrentHour <uOpenTime)&&(pParty->uCurrentHour >(uCloseTime - 1))))||
|
|
403 ((uCloseTime - 1 > uOpenTime)&&((pParty->uCurrentHour < uOpenTime)||(pParty->uCurrentHour > (uCloseTime - 1)))))
|
|
404
|
|
405 {
|
|
406 am_pm_flag_open = 0;
|
|
407 am_pm_flag_close = 0;
|
|
408 if (uOpenTime > 12 )
|
|
409 {
|
|
410 uOpenTime -= 12;
|
|
411 am_pm_flag_open = 1;
|
|
412 }
|
|
413 if ( uCloseTime > 12 )
|
|
414 {
|
|
415 uCloseTime -= 12;
|
|
416 am_pm_flag_close = 1;
|
|
417 }
|
|
418 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[414], uOpenTime, aAMPMNames[am_pm_flag_open],
|
|
419 uCloseTime, aAMPMNames[am_pm_flag_close]); //"This place is open from %d%s to %d%s"
|
|
420 ShowStatusBarString(pTmpBuf.data(), 2u);
|
|
421 if ( uActiveCharacter )
|
|
422 pPlayers[uActiveCharacter]->PlaySound(SPEECH_3, 0);
|
|
423 return 0;
|
|
424 }
|
|
425 else
|
|
426 {
|
|
427 //v10 = uHouseID;
|
|
428 if ( (signed int)uHouseID < 53 ) //entering shops and guilds
|
|
429 {
|
|
430 if ( !(pParty->field_3C._shop_ban_times[uHouseID])
|
|
431 || (pParty->field_3C._shop_ban_times[uHouseID] <= pParty->uTimePlayed) )
|
|
432 {
|
|
433 pParty->field_3C._shop_ban_times[uHouseID] = 0;
|
|
434 }
|
|
435 else
|
|
436 {
|
|
437 ShowStatusBarString(pGlobalTXT_LocalizationStrings[191], 2u);// "You've been banned from this shop!"
|
|
438 return 0;
|
|
439 }
|
|
440 }
|
|
441 pAudioPlayer->StopChannels(-1, -1);
|
|
442
|
|
443 uCurrentHouse_Animation = p2DEvents[uHouseID - 1].uAnimationID;
|
|
444 in_current_building_type = pAnimatedRooms[uCurrentHouse_Animation].uBuildingType;
|
|
445 if ( in_current_building_type == BildingType_Throne_Room && pParty->uFine ) // going 2 jail
|
|
446 {
|
|
447 uCurrentHouse_Animation = (signed __int16)p2DEvents[186].uAnimationID;
|
|
448 uHouseID = HOUSE_JAIL;
|
|
449 pParty->uTimePlayed = pParty->uTimePlayed + 0x7620000;
|
|
450 in_current_building_type = pAnimatedRooms[p2DEvents[HOUSE_LORD_AND_JUDGE_EMERALD_ISLE].uAnimationID].uBuildingType;
|
|
451 ++pParty->uNumPrisonTerms;
|
|
452 pParty->uFine = 0;
|
|
453 for (uint i = 0; i < 4; ++i)
|
|
454 {
|
|
455 pParty->pPlayers[i].uTimeToRecovery = 0;
|
|
456 pParty->pPlayers[i].uNumDivineInterventionCastsThisDay = 0;
|
|
457 pParty->pPlayers[i].SetVariable(VAR_Award, 87);
|
|
458 }
|
|
459 }
|
|
460 ++pIcons_LOD->uTexturePacksCount;
|
|
461 if ( !pIcons_LOD->uNumPrevLoadedFiles )
|
|
462 pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles;
|
|
463 switch (pParty->alignment)
|
|
464 {
|
|
465 case PartyAlignment_Good: sprintf(pContainer, "evt%02d-b", const_2()); break;
|
|
466 case PartyAlignment_Neutral: sprintf(pContainer, "evt%02d", const_2()); break;
|
|
467 case PartyAlignment_Evil: sprintf(pContainer, "evt%02d-c", const_2()); break;
|
|
468 default: assert(false);
|
|
469 }
|
|
470
|
|
471 v17 = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
|
|
472 pDialogueNPCCount = 0;
|
|
473 pTexture_Dialogue_Background = &pIcons_LOD->pTextures[v17];
|
|
474 uTextureID_right_panel_loop = uTextureID_right_panel;
|
|
475 PrepareHouse(uHouseID);
|
|
476 v18 = 1;
|
|
477 uTextureID_right_panel_loop = uTextureID_right_panel;
|
|
478 if ( uNumDialogueNPCPortraits == 1 )
|
|
479 pDialogueNPCCount = 1;
|
|
480 pVideoPlayer->OpenHouseMovie(pAnimatedRooms[uCurrentHouse_Animation].video_name, 1u);
|
|
481 dword_5C35D4 = 1;
|
|
482 if ( (signed int)uHouseID < 139 || (signed int)uHouseID > 172 )
|
|
483 {
|
|
484 if ( (signed int)uHouseID >= HOUSE_STABLES_HARMONDALE && (signed int)uHouseID <= 73 && !IsTravelAvailable(uHouseID - HOUSE_STABLES_HARMONDALE) )
|
|
485 {
|
|
486 return 1;
|
|
487 }
|
|
488 }
|
|
489 else
|
|
490 { //guilds
|
|
491 v19 = guild_mambership_flags[uHouseID - HOUSE_FIRE_GUILD_INITIATE_EMERALD_ISLE]; //guilds flags
|
|
492 //v20 = uHouseID;
|
|
493 //if ( !((unsigned __int8)(0x80u >> v19 % 8) & pPlayers[uActiveCharacter]->_guilds_member_bits[v19 /8]) )
|
|
494 if(_449B57_test_bit(pPlayers[uActiveCharacter]->_guilds_member_bits,v19))
|
|
495 {
|
|
496 PlayHouseSound(uHouseID, HouseSound_Greeting_2);
|
|
497 return 1;
|
|
498 }
|
|
499 }
|
|
500 PlayHouseSound(uHouseID, HouseSound_Greeting);
|
|
501 dword_5C35D4 = 1;
|
|
502 return 1;
|
|
503 }
|
|
504 }
|
|
505
|
1300
|
506 //----- (0044606A) --------------------------------------------------------
|
|
507 void PrepareHouse(HOUSE_ID house)
|
|
508 {
|
|
509 //unsigned int v1; // ebx@1
|
|
510 //signed int v2; // esi@1
|
|
511 //int uExitPic; // edi@1
|
|
512 __int16 uExitMapID; // ax@2
|
|
513 //int result; // eax@5
|
|
514 //unsigned int *v6; // ecx@8
|
|
515 int v7; // ebx@11
|
|
516 //int v8; // esi@16
|
|
517 //unsigned int v9; // eax@16
|
|
518 //unsigned int v10; // eax@19
|
|
519 //int v11; // ecx@19
|
|
520 //char pContainer[36]; // [sp+Ch] [bp-54h]@16
|
|
521 int v13; // [sp+30h] [bp-30h]@11
|
|
522 int npc_id_arr[6]; // [sp+34h] [bp-2Ch]@1
|
|
523 //unsigned int v15; // [sp+4Ch] [bp-14h]@1
|
|
524 int uAnimationID; // [sp+50h] [bp-10h]@1
|
|
525 //unsigned int *v17; // [sp+54h] [bp-Ch]@3
|
|
526 //unsigned int v18; // [sp+58h] [bp-8h]@1
|
|
527 //int v19; // [sp+5Ch] [bp-4h]@7
|
|
528
|
|
529
|
|
530 uAnimationID = p2DEvents[house - 1].uAnimationID;
|
|
531 memset(npc_id_arr, 0, sizeof(npc_id_arr));
|
|
532 uNumDialogueNPCPortraits = 0;
|
|
533 uHouse_ExitPic = p2DEvents[house - 1].uExitPicID;
|
|
534 if ( uHouse_ExitPic )
|
|
535 {
|
|
536 uExitMapID = p2DEvents[house - 1]._quest_related;
|
|
537 if ( uExitMapID > 0 )
|
|
538 {
|
|
539 if(_449B57_test_bit(pParty->_quest_bits,uExitMapID))
|
|
540 {
|
|
541 uHouse_ExitPic = 0;
|
|
542 }
|
|
543 }
|
|
544 }
|
|
545
|
|
546 dword_591080 = pAnimatedRooms[uAnimationID].house_npc_id;
|
|
547 HouseNPCData[0]=0;
|
|
548 uNumDialogueNPCPortraits = 0;
|
|
549 if ( dword_591080 )
|
|
550 {
|
|
551
|
|
552 npc_id_arr[0] = dword_591080;
|
|
553 uNumDialogueNPCPortraits = 1;
|
|
554 }
|
|
555
|
|
556 for (uint i = 1; i < pNPCStats->uNumNewNPCs; ++i)
|
|
557 {
|
|
558 if (pNPCStats->pNewNPCData[i].Location2D == house )
|
|
559 {
|
|
560 if (!(pNPCStats->pNewNPCData[i].uFlags & 0x80))
|
|
561 {
|
1313
|
562 HouseNPCData[uNumDialogueNPCPortraits+1-((dword_591080 != 0) ? 1 : 0) ] = &pNPCStats->pNewNPCData[i];
|
1300
|
563 npc_id_arr[uNumDialogueNPCPortraits] = pNPCStats->pNewNPCData[i].uPortraitID;
|
|
564 ++uNumDialogueNPCPortraits;
|
|
565 if ((pNPCStats->pNewNPCData[i].uFlags & 3) != 2)
|
|
566 ++pNPCStats->pNewNPCData[i].uFlags;
|
|
567 }
|
|
568 }
|
|
569
|
|
570 }
|
|
571
|
|
572 for (uint i = 0; i < uNumDialogueNPCPortraits; ++i)
|
|
573 {
|
|
574
|
|
575 char icon_name[128];
|
|
576 sprintfex(icon_name, "npc%03u", npc_id_arr[i]);
|
|
577 pDialogueNPCPortraits[i] = pIcons_LOD->LoadTexturePtr(icon_name, TEXTURE_16BIT_PALETTE);
|
|
578 }
|
|
579
|
|
580 if (uHouse_ExitPic)
|
|
581 {
|
|
582 pDialogueNPCPortraits[uNumDialogueNPCPortraits] = pIcons_LOD->LoadTexturePtr(pHouse_ExitPictures[uHouse_ExitPic], TEXTURE_16BIT_PALETTE);
|
|
583 ++uNumDialogueNPCPortraits;
|
|
584 uHouse_ExitPic = p2DEvents[house - 1].uExitMapID;
|
|
585 }
|
|
586 }
|
1298
|
587 //----- (004B1E92) --------------------------------------------------------
|
|
588 void PlayHouseSound(unsigned int uHouseID, HouseSoundID sound)
|
|
589 {
|
1407
|
590 if ( pAnimatedRooms[p2DEvents[uHouseID].uAnimationID].uRoomSoundId )
|
|
591 pAudioPlayer->PlaySound((SoundID)(sound + 100 * (pAnimatedRooms[p2DEvents[uHouseID].uAnimationID].uRoomSoundId + 300)),
|
1298
|
592 806, 0, -1, 0, 0, 0, 0);
|
|
593 }
|
|
594
|
|
595 //----- (004BCACC) --------------------------------------------------------
|
|
596 void __fastcall OnSelectShopDialogueOption(signed int uMessageParam)
|
|
597 {
|
|
598 //unsigned int v1; // edi@1
|
|
599 //signed int v2; // ebx@1
|
|
600 //signed int v3; // ecx@2
|
|
601 int v4; // eax@5
|
|
602 signed int v5; // esi@5
|
|
603 //Player *v6; // ecx@5
|
|
604 //signed int v7; // edx@5
|
|
605 GUIWindow *v8; // esi@10
|
|
606 unsigned int v9; // eax@12
|
|
607 int v10; // esi@31
|
|
608 int v11; // edi@31
|
|
609 int v12; // esi@32
|
|
610 __int16 v13; // bp@32
|
|
611 int v14; // edx@32
|
|
612 GUIWindow *v15; // eax@32
|
|
613 int v16; // eax@32
|
|
614 int v17; // eax@33
|
|
615 int v18; // eax@34
|
|
616 int v19; // eax@35
|
|
617 __int16 v20; // ax@37
|
|
618 __int16 v21; // ax@76
|
|
619 __int16 v22; // ax@107
|
|
620 __int16 v23; // ax@132
|
|
621 __int16 v24; // ax@163
|
|
622 int v25; // esi@190
|
|
623 __int16 v26; // ax@190
|
|
624 char v27; // zf@190
|
|
625 Player *v28; // edi@192
|
|
626 int v29; // eax@204
|
|
627 void *v30; // esi@208
|
|
628 unsigned __int64 v31; // qax@208
|
|
629 signed int v32; // edi@209
|
|
630 int v33; // eax@210
|
|
631 unsigned int v34; // eax@211
|
|
632 //Player *v35; // edi@227
|
|
633 signed int v36; // esi@227
|
|
634 int v37; // ecx@227
|
|
635 int v38; // esi@230
|
|
636 int v39; // edx@235
|
|
637 int v40; // edi@243
|
|
638 unsigned __int64 v41; // qax@243
|
|
639 //void *v42; // eax@244
|
|
640 signed int v43; // edi@244
|
|
641 int v44; // edx@244
|
|
642 int v45; // eax@246
|
|
643 unsigned int v46; // eax@247
|
|
644 void *v47; // eax@250
|
|
645 signed int v48; // edi@250
|
|
646 int v49; // eax@252
|
|
647 int v50; // eax@256
|
|
648 unsigned int v51; // eax@257
|
|
649 void *v52; // eax@260
|
|
650 signed int v53; // edi@260
|
|
651 int v54; // eax@262
|
|
652 //signed int v55; // [sp+10h] [bp-10h]@1
|
|
653 int v56; // [sp+14h] [bp-Ch]@31
|
|
654
|
|
655 //v1 = 0;
|
|
656 //v2 = a1;
|
|
657 //v55 = a1;
|
|
658 if ( !pDialogueWindow->pNumPresenceButton )
|
|
659 return;
|
|
660 pRenderer->ClearZBuffer(0, 479);
|
|
661 //v3 = dword_F8B198;
|
|
662 if ( dialog_menu_id != HOUSE_DIALOGUE_MAIN)
|
|
663 v8 = window_SpeakInHouse;
|
|
664 //else
|
|
665 if (dialog_menu_id == HOUSE_DIALOGUE_MAIN)
|
|
666 {
|
|
667 if ( in_current_building_type == BildingType_Training )
|
|
668 {
|
|
669 if ( uMessageParam == HOUSE_DIALOGUE_TRAININGHALL_TRAIN )
|
|
670 {
|
|
671 v4 = 0;
|
|
672 v5 = 0;
|
|
673 //v6 = pPlayers[uActiveCharacter];
|
|
674 //v7 = pPlayers[uActiveCharacter]->uLevel;
|
|
675 if ( pPlayers[uActiveCharacter]->uLevel > 0 )
|
|
676 {
|
|
677 do
|
|
678 v4 += v5++ + 1;
|
|
679 while ( v5 < pPlayers[uActiveCharacter]->uLevel );
|
|
680 }
|
|
681 if (pPlayers[uActiveCharacter]->uLevel < pMaxLevelPerTrainingHallType[(unsigned int)window_SpeakInHouse->ptr_1C - 89] &&
|
|
682 (signed __int64)pPlayers[uActiveCharacter]->uExperience < 1000 * v4)
|
|
683 return;
|
|
684 }
|
|
685 pDialogueWindow->Release();
|
|
686 pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x159u, WINDOW_MainMenu, 0, 0);
|
|
687 pBtn_ExitCancel = pDialogueWindow->CreateButton(526, 445, 75, 33, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[74],// "End Conversation"
|
|
688 pIcons_LOD->GetTexture(uTextureID_BUTTDESC2), 0);
|
|
689 pDialogueWindow->CreateButton(8, 8, 0x1C2, 0x140, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", nullptr);
|
|
690 // LABEL_10:
|
|
691 //v3 = dword_F8B198;
|
|
692 v8 = window_SpeakInHouse;
|
|
693 }
|
|
694 //else
|
|
695 if ( in_current_building_type != BildingType_Training )
|
|
696 {
|
|
697 v8 = window_SpeakInHouse;
|
|
698 if ((in_current_building_type == BildingType_Stables || in_current_building_type == BildingType_Boats) &&
|
|
699 transport_schedule[transport_routes[(unsigned int)window_SpeakInHouse->ptr_1C - HOUSE_STABLES_HARMONDALE][uMessageParam - HOUSE_DIALOGUE_TRANSPORT_SCHEDULE_1]].pSchedule[pParty->uDaysPlayed % 7]
|
|
700 || in_current_building_type != BildingType_Temple || uMessageParam != BildingType_MindGuild )
|
|
701 {
|
|
702 //LABEL_9:
|
|
703 pDialogueWindow->Release();
|
|
704 pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x159u, WINDOW_MainMenu, 0, 0);
|
|
705 pBtn_ExitCancel = pDialogueWindow->CreateButton(526, 445, 75, 33, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[74],// "End Conversation"
|
|
706 pIcons_LOD->GetTexture(uTextureID_BUTTDESC2), 0);
|
|
707 pDialogueWindow->CreateButton(8u, 8u, 0x1C2u, 0x140u, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", nullptr);
|
|
708 // LABEL_10:
|
|
709 //v3 = dword_F8B198;
|
|
710 v8 = window_SpeakInHouse;
|
|
711 }
|
|
712 else if (uActiveCharacter)
|
|
713 {
|
|
714 if ( !pPlayers[uActiveCharacter]->IsPlayerHealableByTemple() )
|
|
715 return;
|
|
716 v8 = window_SpeakInHouse;
|
|
717 }
|
|
718 }
|
|
719 //LABEL_11:
|
|
720 dialog_menu_id = (HOUSE_DIALOGUE_MENU)uMessageParam;
|
|
721 if ( in_current_building_type < BildingType_19 )
|
|
722 {
|
|
723 v9 = pIcons_LOD->LoadTexture(off_4F03B8[in_current_building_type], TEXTURE_16BIT_PALETTE);
|
|
724 //v3 = dword_F8B198;
|
|
725 ShopTexture = &pIcons_LOD->pTextures[v9];
|
|
726 //LABEL_13:
|
|
727 v8 = window_SpeakInHouse;
|
|
728 }
|
|
729 }
|
|
730
|
|
731 //NEW
|
|
732 switch(in_current_building_type)
|
|
733 {
|
|
734 case BildingType_FireGuild:
|
|
735 case BildingType_AirGuild:
|
|
736 case BildingType_WaterGuild:
|
|
737 case BildingType_EarthGuild:
|
|
738 case BildingType_SpiritGuild:
|
|
739 case BildingType_MindGuild:
|
|
740 case BildingType_BodyGuild:
|
|
741 case BildingType_LightGuild:
|
|
742 case BildingType_DarkGuild:
|
|
743 case BildingType_14:
|
|
744 case BildingType_15:
|
|
745 case BildingType_16:
|
|
746 {
|
|
747 if ( *(int *)&stru_AA1058[3].pSounds[8 * (unsigned int)v8->ptr_1C + 44472] >= (signed __int64)pParty->uTimePlayed &&
|
|
748 *(int *)&stru_AA1058[3].pSounds[8 * (unsigned int)v8->ptr_1C + 44468] >= (signed __int64)pParty->uTimePlayed )
|
|
749 {
|
|
750 v32 = 0;
|
|
751 do
|
|
752 {
|
|
753 //v33 = *(&pParty->pPlayers[1].pInstalledBeacons[0].field_18 + 9 * (v32 + 12 * (unsigned int)v8->ptr_1C));
|
|
754 v33 = pParty->SpellBooksInGuilds[v8->par1C-139][v32].uItemID;
|
|
755 if ( v33 )
|
|
756 {
|
|
757 v34 = pIcons_LOD->LoadTexture(pItemsTable->pItems[v33].pIconName, TEXTURE_16BIT_PALETTE);
|
|
758 v8 = window_SpeakInHouse;
|
|
759 ItemsInShopTexture[v32] = &pIcons_LOD->pTextures[v34];
|
|
760 }
|
|
761 ++v32;
|
|
762 }
|
|
763 while ( v32 < 12 );
|
|
764 }
|
|
765 else
|
|
766 {
|
|
767 SpellBookGenerator();
|
|
768 v30 = window_SpeakInHouse->ptr_1C;
|
|
769 v31 = pParty->uTimePlayed + (signed __int64)((double)(0xA8C000
|
|
770 //* (signed int)p2DEvents_minus1[26 * (unsigned int)ptr_507BC0->ptr_1C])
|
|
771 * (signed int)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].field_1C) * 0.033333335);
|
|
772 *(int *)&stru_AA1058[3].pSounds[8 * (int)v30 + 44468] = v31;
|
|
773 *(int *)&stru_AA1058[3].pSounds[8 * (int)v30 + 44472] = HIDWORD(v31);
|
|
774 }
|
|
775 //return;
|
|
776 break;
|
|
777 }
|
|
778 case BildingType_TownHall:
|
|
779 {
|
|
780 if ( uMessageParam == 99 )
|
|
781 {
|
|
782 v10 = (int)((char *)v8->ptr_1C - 102);
|
|
783 v56 = v10;
|
|
784 v11 = 8 * v10 + 11325428;
|
|
785 if ( pParty->field_3C.field_0[2 * v10 + 1] >= (signed __int64)pParty->uTimePlayed
|
|
786 && pParty->field_3C.field_0[2 * v10] >= (signed __int64)pParty->uTimePlayed )
|
|
787 {
|
|
788 v13 = 0;
|
|
789 }
|
|
790 else
|
|
791 {
|
|
792 v12 = v10;
|
|
793 v13 = 0;
|
|
794 pParty->field_75A[v12] = 0;
|
|
795 *(_QWORD *)v11 = (signed __int64)((double)(309657600 * (pParty->uCurrentMonth + 12i64 * pParty->uCurrentYear - 14015)) * 0.033333335);
|
|
796 v14 = rand() % 258;
|
|
797 v15 = window_SpeakInHouse;
|
|
798 pParty->field_750[v12] = v14 + 1;
|
|
799 v16 = (int)((char *)v15->ptr_1C - 102);
|
|
800 if ( v16 )
|
|
801 {
|
|
802 v17 = v16 - 1;
|
|
803 if ( v17 )
|
|
804 {
|
|
805 v18 = v17 - 1;
|
|
806 if ( v18 )
|
|
807 {
|
|
808 v19 = v18 - 1;
|
|
809 if ( v19 )
|
|
810 {
|
|
811 if ( v19 == 1 )
|
|
812 {
|
|
813 while ( 1 )
|
|
814 {
|
|
815 v20 = pParty->field_750[v12];
|
|
816 if ( (unsigned __int16)v20 < 0x73u || (unsigned __int16)v20 > 0x84u )
|
|
817 {
|
|
818 if ( ((unsigned __int16)v20 < 0xE8u || (unsigned __int16)v20 > 0xF9u)
|
|
819 && ((unsigned __int16)v20 < 0x85u || (unsigned __int16)v20 > 0x96u)
|
|
820 && ((unsigned __int16)v20 < 0x97u || (unsigned __int16)v20 > 0xBAu)
|
|
821 && ((unsigned __int16)v20 < 0xBEu || (unsigned __int16)v20 > 0xC0u)
|
|
822 && ((unsigned __int16)v20 < 0xC4u || (unsigned __int16)v20 > 0xC6u)
|
|
823 && ((unsigned __int16)v20 < 0x2Bu || (unsigned __int16)v20 > 0x2Du)
|
|
824 && ((unsigned __int16)v20 < 0x6Du || (unsigned __int16)v20 > 0x6Fu)
|
|
825 && ((unsigned __int16)v20 < 0x46u || (unsigned __int16)v20 > 0x48u)
|
|
826 && ((unsigned __int16)v20 < 0x100u || (unsigned __int16)v20 > 0x102u)
|
|
827 && ((unsigned __int16)v20 < 0xD9u || (unsigned __int16)v20 > 0xDBu)
|
|
828 && ((unsigned __int16)v20 < 0xC7u || (unsigned __int16)v20 > 0xC9u)
|
|
829 && ((unsigned __int16)v20 < 0xE5u || (unsigned __int16)v20 > 0xE7u)
|
|
830 && ((unsigned __int16)v20 < 0xDFu || (unsigned __int16)v20 > 0xE1u)
|
|
831 && ((unsigned __int16)v20 < 0x5Bu || (unsigned __int16)v20 > 0x5Du)
|
|
832 && ((unsigned __int16)v20 < 0x49u || (unsigned __int16)v20 > 0x4Bu)
|
|
833 && ((unsigned __int16)v20 < 0xFDu || (unsigned __int16)v20 > 0xFFu)
|
|
834 && ((unsigned __int16)v20 < 0x61u || (unsigned __int16)v20 > 0x63u)
|
|
835 && ((unsigned __int16)v20 < 0x10u || (unsigned __int16)v20 > 0x12u) )
|
|
836 break;
|
|
837 }
|
|
838 pParty->field_750[v12] = rand() % 258 + 1;
|
|
839 }
|
|
840 }
|
|
841 }
|
|
842 else
|
|
843 {
|
|
844 while ( 1 )
|
|
845 {
|
|
846 v21 = pParty->field_750[v12];
|
|
847 if ( (unsigned __int16)v21 < 0x73u || (unsigned __int16)v21 > 0x84u )
|
|
848 {
|
|
849 if ( ((unsigned __int16)v21 < 0xE8u || (unsigned __int16)v21 > 0xF9u)
|
|
850 && ((unsigned __int16)v21 < 0x85u || (unsigned __int16)v21 > 0x96u)
|
|
851 && ((unsigned __int16)v21 < 0x97u || (unsigned __int16)v21 > 0xBAu)
|
|
852 && ((unsigned __int16)v21 < 0xBEu || (unsigned __int16)v21 > 0xC0u)
|
|
853 && ((unsigned __int16)v21 < 0xC4u || (unsigned __int16)v21 > 0xC6u)
|
|
854 && ((unsigned __int16)v21 < 0x2Bu || (unsigned __int16)v21 > 0x2Du)
|
|
855 && ((unsigned __int16)v21 < 0x5Eu || (unsigned __int16)v21 > 0x60u)
|
|
856 && ((unsigned __int16)v21 < 0x43u || (unsigned __int16)v21 > 0x45u)
|
|
857 && ((unsigned __int16)v21 < 0x4Fu || (unsigned __int16)v21 > 0x51u)
|
|
858 && ((unsigned __int16)v21 < 0xC1u || (unsigned __int16)v21 > 0xC3u)
|
|
859 && ((unsigned __int16)v21 < 0x13u || (unsigned __int16)v21 > 0x15u)
|
|
860 && ((unsigned __int16)v21 < 0xFDu || (unsigned __int16)v21 > 0xFFu)
|
|
861 && ((unsigned __int16)v21 < 0x61u || (unsigned __int16)v21 > 0x63u)
|
|
862 && ((unsigned __int16)v21 < 0x6Au || (unsigned __int16)v21 > 0x6Cu) )
|
|
863 break;
|
|
864 }
|
|
865 pParty->field_750[v12] = rand() % 258 + 1;
|
|
866 }
|
|
867 }
|
|
868 }
|
|
869 else
|
|
870 {
|
|
871 while ( 1 )
|
|
872 {
|
|
873 v22 = pParty->field_750[v12];
|
|
874 if ( (unsigned __int16)v22 < 0x73u || (unsigned __int16)v22 > 0x84u )
|
|
875 {
|
|
876 if ( ((unsigned __int16)v22 < 0xE8u || (unsigned __int16)v22 > 0xF9u)
|
|
877 && ((unsigned __int16)v22 < 0x85u || (unsigned __int16)v22 > 0x96u)
|
|
878 && ((unsigned __int16)v22 < 0x97u || (unsigned __int16)v22 > 0xBAu)
|
|
879 && ((unsigned __int16)v22 < 0xBEu || (unsigned __int16)v22 > 0xC0u)
|
|
880 && ((unsigned __int16)v22 < 0xC4u || (unsigned __int16)v22 > 0xC6u)
|
|
881 && ((unsigned __int16)v22 < 0x2Bu || (unsigned __int16)v22 > 0x2Du)
|
|
882 && ((unsigned __int16)v22 < 0x31u || (unsigned __int16)v22 > 0x33u)
|
|
883 && ((unsigned __int16)v22 < 0x34u || (unsigned __int16)v22 > 0x36u)
|
|
884 && ((unsigned __int16)v22 < 0xFDu || (unsigned __int16)v22 > 0xFFu)
|
|
885 && ((unsigned __int16)v22 < 0x61u || (unsigned __int16)v22 > 0x63u)
|
|
886 && ((unsigned __int16)v22 < 0x1Cu || (unsigned __int16)v22 > 0x1Eu) )
|
|
887 break;
|
|
888 }
|
|
889 pParty->field_750[v12] = rand() % 258 + 1;
|
|
890 }
|
|
891 }
|
|
892 }
|
|
893 else
|
|
894 {
|
|
895 while ( 1 )
|
|
896 {
|
|
897 v23 = pParty->field_750[v12];
|
|
898 if ( (unsigned __int16)v23 < 0x73u || (unsigned __int16)v23 > 0x84u )
|
|
899 {
|
|
900 if ( ((unsigned __int16)v23 < 0xE8u || (unsigned __int16)v23 > 0xF9u)
|
|
901 && ((unsigned __int16)v23 < 0x85u || (unsigned __int16)v23 > 0x96u)
|
|
902 && ((unsigned __int16)v23 < 0x97u || (unsigned __int16)v23 > 0xBAu)
|
|
903 && ((unsigned __int16)v23 < 0xBEu || (unsigned __int16)v23 > 0xC0u)
|
|
904 && ((unsigned __int16)v23 < 0xC4u || (unsigned __int16)v23 > 0xC6u)
|
|
905 && ((unsigned __int16)v23 < 0x2Bu || (unsigned __int16)v23 > 0x2Du)
|
|
906 && ((unsigned __int16)v23 < 0x52u || (unsigned __int16)v23 > 0x54u)
|
|
907 && ((unsigned __int16)v23 < 4u || (unsigned __int16)v23 > 6u)
|
|
908 && ((unsigned __int16)v23 < 0x37u || (unsigned __int16)v23 > 0x39u)
|
|
909 && ((unsigned __int16)v23 < 0x3Au || (unsigned __int16)v23 > 0x3Cu)
|
|
910 && ((unsigned __int16)v23 < 0x3Du || (unsigned __int16)v23 > 0x3Fu)
|
|
911 && ((unsigned __int16)v23 < 0xFDu || (unsigned __int16)v23 > 0xFFu)
|
|
912 && ((unsigned __int16)v23 < 0x61u || (unsigned __int16)v23 > 0x63u)
|
|
913 && ((unsigned __int16)v23 < 0xCDu || (unsigned __int16)v23 > 0xCFu) )
|
|
914 break;
|
|
915 }
|
|
916 pParty->field_750[v12] = rand() % 258 + 1;
|
|
917 }
|
|
918 }
|
|
919 }
|
|
920 else
|
|
921 {
|
|
922 while ( 1 )
|
|
923 {
|
|
924 v24 = pParty->field_750[v12];
|
|
925 if ( (unsigned __int16)v24 < 0x73u || (unsigned __int16)v24 > 0x84u )
|
|
926 {
|
|
927 if ( ((unsigned __int16)v24 < 0xEBu || (unsigned __int16)v24 > 0xFCu)
|
|
928 && ((unsigned __int16)v24 < 0x85u || (unsigned __int16)v24 > 0x96u)
|
|
929 && ((unsigned __int16)v24 < 0x97u || (unsigned __int16)v24 > 0xBAu)
|
|
930 && ((unsigned __int16)v24 < 0xBEu || (unsigned __int16)v24 > 0xC0u)
|
|
931 && ((unsigned __int16)v24 < 0xC4u || (unsigned __int16)v24 > 0xC6u)
|
|
932 && ((unsigned __int16)v24 < 0x2Bu || (unsigned __int16)v24 > 0x2Du)
|
|
933 && ((unsigned __int16)v24 < 0xCDu || (unsigned __int16)v24 > 0xCFu)
|
|
934 && ((unsigned __int16)v24 < 0x5Eu || (unsigned __int16)v24 > 0x60u)
|
|
935 && ((unsigned __int16)v24 < 0xFDu || (unsigned __int16)v24 > 0xFFu)
|
|
936 && ((unsigned __int16)v24 < 0x6Du || (unsigned __int16)v24 > 0x6Fu)
|
|
937 && ((unsigned __int16)v24 < 0x61u || (unsigned __int16)v24 > 0x63u) )
|
|
938 break;
|
|
939 }
|
|
940 pParty->field_750[v12] = rand() % 258 + 1;
|
|
941 }
|
|
942 }
|
|
943 v10 = v56;
|
|
944 }
|
|
945 v25 = v10;
|
|
946 v26 = pParty->field_750[v25];
|
|
947 v27 = pParty->field_75A[v25] == v13;
|
|
948 word_F8B1A0 = pParty->field_750[v25];
|
|
949 if ( v27 )
|
|
950 {
|
|
951 //v1 = 0;
|
|
952 v27 = v26 == v13;
|
|
953 v29 = (int)pNPCTopics[351].pText;
|
|
954 if ( v27 )
|
|
955 v29 = (int)pNPCTopics[353].pText;
|
|
956 dword_F8B1A4 = (char *)v29;
|
|
957 }
|
|
958 else
|
|
959 {
|
|
960 if ( v26 != v13 )
|
|
961 {
|
|
962 party_finds_gold(100 * pMonsterStats->pInfos[(unsigned __int16)v26].uLevel, 0);
|
|
963 v28 = pParty->pPlayers;
|
|
964 do
|
|
965 {
|
|
966 v28->SetVariable(VAR_Award, 86);
|
|
967 ++v28;
|
|
968 }
|
|
969 while ( (signed int)v28 < (signed int)pParty->pHirelings );
|
|
970 pParty->uNumBountiesCollected += 100 * pMonsterStats->pInfos[pParty->field_750[v25]].uLevel;
|
|
971 pParty->field_750[v25] = v13;
|
|
972 pParty->field_75A[v25] = v13;
|
|
973 }
|
|
974 //v1 = 0;
|
|
975 dword_F8B1A4 = pNPCTopics[352].pText;
|
|
976 }
|
|
977 }
|
|
978 else if ( uMessageParam == HOUSE_DIALOGUE_TOWNHALL_100 )
|
|
979 {
|
|
980 pKeyActionMap->EnterText(1, 10, v8);
|
|
981 }
|
|
982 break;
|
|
983 }
|
|
984 case BildingType_Bank:
|
|
985 {
|
|
986 if ( dialog_menu_id >= 7 && dialog_menu_id <= 8 )
|
|
987 pKeyActionMap->EnterText(1, 10, v8);
|
|
988 return;
|
|
989 break;
|
|
990 }
|
|
991 case BildingType_WeaponShop:
|
|
992 case BildingType_ArmorShop:
|
|
993 case BildingType_MagicShop:
|
|
994 case BildingType_AlchemistShop:
|
|
995 case BildingType_Tavern:
|
|
996 case BildingType_Temple:
|
|
997 case BildingType_Training:
|
|
998 {
|
|
999 break;
|
|
1000 }
|
|
1001 default:
|
|
1002 {
|
|
1003 return;
|
|
1004 break;
|
|
1005 }
|
|
1006 }
|
|
1007
|
|
1008 /*
|
|
1009 if ( in_current_building_type > BildingType_Tavern )
|
|
1010 {
|
|
1011 if ( in_current_building_type == BildingType_Bank )
|
|
1012 {
|
|
1013 if ( dialog_menu_id >= 7 && dialog_menu_id <= 8 )
|
|
1014 pKeyActionMap->EnterText(1, 10, v8);
|
|
1015 return;
|
|
1016 }
|
|
1017 if ( in_current_building_type != BildingType_Temple && in_current_building_type != BildingType_Training )
|
|
1018 return;
|
|
1019 }
|
|
1020 //else
|
|
1021 if ( in_current_building_type < BildingType_Tavern )
|
|
1022 {
|
|
1023 if (in_current_building_type <= 0)
|
|
1024 return;
|
|
1025 if ( in_current_building_type > BildingType_AlchemistShop )
|
|
1026 {
|
|
1027 if ( in_current_building_type <= BildingType_16 )
|
|
1028 {
|
|
1029 if ( (signed __int64)__PAIR__(
|
|
1030 *(int *)&stru_AA1058[3].pSounds[8 * (unsigned int)v8->ptr_1C + 44472],
|
|
1031 *(int *)&stru_AA1058[3].pSounds[8 * (unsigned int)v8->ptr_1C + 44468]) >= (signed __int64)pParty->uTimePlayed )
|
|
1032 {
|
|
1033 v32 = 0;
|
|
1034 do
|
|
1035 {
|
|
1036 //v33 = *(&pParty->pPlayers[1].pInstalledBeacons[0].field_18 + 9 * (v32 + 12 * (unsigned int)v8->ptr_1C));
|
|
1037 v33 = pParty->SpellBooksInGuilds[v8->par1C-139][v32].uItemID;
|
|
1038 if ( v33 )
|
|
1039 {
|
|
1040 v34 = pIcons_LOD->LoadTexture(pItemsTable->pItems[v33].pIconName, TEXTURE_16BIT_PALETTE);
|
|
1041 v8 = window_SpeakInHouse;
|
|
1042 ItemsInShopTexture[v32] = &pIcons_LOD->pTextures[v34];
|
|
1043 }
|
|
1044 ++v32;
|
|
1045 }
|
|
1046 while ( v32 < 12 );
|
|
1047 }
|
|
1048 else
|
|
1049 {
|
|
1050 SpellBookGenerator();
|
|
1051 v30 = window_SpeakInHouse->ptr_1C;
|
|
1052 v31 = pParty->uTimePlayed
|
|
1053 + (signed __int64)((double)(0xA8C000
|
|
1054 //* (signed int)p2DEvents_minus1[26 * (unsigned int)ptr_507BC0->ptr_1C])
|
|
1055 * (signed int)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].field_1C)
|
|
1056 * 0.033333335);
|
|
1057 *(int *)&stru_AA1058[3].pSounds[8 * (int)v30 + 44468] = v31;
|
|
1058 *(int *)&stru_AA1058[3].pSounds[8 * (int)v30 + 44472] = HIDWORD(v31);
|
|
1059 }
|
|
1060 return;
|
|
1061 }
|
|
1062 if ( in_current_building_type != BildingType_TownHall )
|
|
1063 return;
|
|
1064 if ( in_current_building_type == BildingType_TownHall )
|
|
1065 {
|
|
1066 if ( uMessageParam == 99 )
|
|
1067 {
|
|
1068 v10 = (int)((char *)v8->ptr_1C - 102);
|
|
1069 v56 = v10;
|
|
1070 v11 = 8 * v10 + 11325428;
|
|
1071 if ( (signed __int64)__PAIR__(pParty->field_3C.field_0[2 * v10 + 1], pParty->field_3C.field_0[2 * v10]) >= (signed __int64)pParty->uTimePlayed )
|
|
1072 {
|
|
1073 v13 = 0;
|
|
1074 }
|
|
1075 else
|
|
1076 {
|
|
1077 v12 = v10;
|
|
1078 v13 = 0;
|
|
1079 pParty->field_75A[v12] = 0;
|
|
1080 *(_QWORD *)v11 = (signed __int64)((double)(309657600 * (pParty->uCurrentMonth + 12i64 * pParty->uCurrentYear - 14015)) * 0.033333335);
|
|
1081 v14 = rand() % 258;
|
|
1082 v15 = window_SpeakInHouse;
|
|
1083 pParty->field_750[v12] = v14 + 1;
|
|
1084 v16 = (int)((char *)v15->ptr_1C - 102);
|
|
1085 if ( v16 )
|
|
1086 {
|
|
1087 v17 = v16 - 1;
|
|
1088 if ( v17 )
|
|
1089 {
|
|
1090 v18 = v17 - 1;
|
|
1091 if ( v18 )
|
|
1092 {
|
|
1093 v19 = v18 - 1;
|
|
1094 if ( v19 )
|
|
1095 {
|
|
1096 if ( v19 == 1 )
|
|
1097 {
|
|
1098 while ( 1 )
|
|
1099 {
|
|
1100 v20 = pParty->field_750[v12];
|
|
1101 if ( (unsigned __int16)v20 < 0x73u || (unsigned __int16)v20 > 0x84u )
|
|
1102 {
|
|
1103 if ( ((unsigned __int16)v20 < 0xE8u || (unsigned __int16)v20 > 0xF9u)
|
|
1104 && ((unsigned __int16)v20 < 0x85u || (unsigned __int16)v20 > 0x96u)
|
|
1105 && ((unsigned __int16)v20 < 0x97u || (unsigned __int16)v20 > 0xBAu)
|
|
1106 && ((unsigned __int16)v20 < 0xBEu || (unsigned __int16)v20 > 0xC0u)
|
|
1107 && ((unsigned __int16)v20 < 0xC4u || (unsigned __int16)v20 > 0xC6u)
|
|
1108 && ((unsigned __int16)v20 < 0x2Bu || (unsigned __int16)v20 > 0x2Du)
|
|
1109 && ((unsigned __int16)v20 < 0x6Du || (unsigned __int16)v20 > 0x6Fu)
|
|
1110 && ((unsigned __int16)v20 < 0x46u || (unsigned __int16)v20 > 0x48u)
|
|
1111 && ((unsigned __int16)v20 < 0x100u || (unsigned __int16)v20 > 0x102u)
|
|
1112 && ((unsigned __int16)v20 < 0xD9u || (unsigned __int16)v20 > 0xDBu)
|
|
1113 && ((unsigned __int16)v20 < 0xC7u || (unsigned __int16)v20 > 0xC9u)
|
|
1114 && ((unsigned __int16)v20 < 0xE5u || (unsigned __int16)v20 > 0xE7u)
|
|
1115 && ((unsigned __int16)v20 < 0xDFu || (unsigned __int16)v20 > 0xE1u)
|
|
1116 && ((unsigned __int16)v20 < 0x5Bu || (unsigned __int16)v20 > 0x5Du)
|
|
1117 && ((unsigned __int16)v20 < 0x49u || (unsigned __int16)v20 > 0x4Bu)
|
|
1118 && ((unsigned __int16)v20 < 0xFDu || (unsigned __int16)v20 > 0xFFu)
|
|
1119 && ((unsigned __int16)v20 < 0x61u || (unsigned __int16)v20 > 0x63u)
|
|
1120 && ((unsigned __int16)v20 < 0x10u || (unsigned __int16)v20 > 0x12u) )
|
|
1121 break;
|
|
1122 }
|
|
1123 pParty->field_750[v12] = rand() % 258 + 1;
|
|
1124 }
|
|
1125 }
|
|
1126 }
|
|
1127 else
|
|
1128 {
|
|
1129 while ( 1 )
|
|
1130 {
|
|
1131 v21 = pParty->field_750[v12];
|
|
1132 if ( (unsigned __int16)v21 < 0x73u || (unsigned __int16)v21 > 0x84u )
|
|
1133 {
|
|
1134 if ( ((unsigned __int16)v21 < 0xE8u || (unsigned __int16)v21 > 0xF9u)
|
|
1135 && ((unsigned __int16)v21 < 0x85u || (unsigned __int16)v21 > 0x96u)
|
|
1136 && ((unsigned __int16)v21 < 0x97u || (unsigned __int16)v21 > 0xBAu)
|
|
1137 && ((unsigned __int16)v21 < 0xBEu || (unsigned __int16)v21 > 0xC0u)
|
|
1138 && ((unsigned __int16)v21 < 0xC4u || (unsigned __int16)v21 > 0xC6u)
|
|
1139 && ((unsigned __int16)v21 < 0x2Bu || (unsigned __int16)v21 > 0x2Du)
|
|
1140 && ((unsigned __int16)v21 < 0x5Eu || (unsigned __int16)v21 > 0x60u)
|
|
1141 && ((unsigned __int16)v21 < 0x43u || (unsigned __int16)v21 > 0x45u)
|
|
1142 && ((unsigned __int16)v21 < 0x4Fu || (unsigned __int16)v21 > 0x51u)
|
|
1143 && ((unsigned __int16)v21 < 0xC1u || (unsigned __int16)v21 > 0xC3u)
|
|
1144 && ((unsigned __int16)v21 < 0x13u || (unsigned __int16)v21 > 0x15u)
|
|
1145 && ((unsigned __int16)v21 < 0xFDu || (unsigned __int16)v21 > 0xFFu)
|
|
1146 && ((unsigned __int16)v21 < 0x61u || (unsigned __int16)v21 > 0x63u)
|
|
1147 && ((unsigned __int16)v21 < 0x6Au || (unsigned __int16)v21 > 0x6Cu) )
|
|
1148 break;
|
|
1149 }
|
|
1150 pParty->field_750[v12] = rand() % 258 + 1;
|
|
1151 }
|
|
1152 }
|
|
1153 }
|
|
1154 else
|
|
1155 {
|
|
1156 while ( 1 )
|
|
1157 {
|
|
1158 v22 = pParty->field_750[v12];
|
|
1159 if ( (unsigned __int16)v22 < 0x73u || (unsigned __int16)v22 > 0x84u )
|
|
1160 {
|
|
1161 if ( ((unsigned __int16)v22 < 0xE8u || (unsigned __int16)v22 > 0xF9u)
|
|
1162 && ((unsigned __int16)v22 < 0x85u || (unsigned __int16)v22 > 0x96u)
|
|
1163 && ((unsigned __int16)v22 < 0x97u || (unsigned __int16)v22 > 0xBAu)
|
|
1164 && ((unsigned __int16)v22 < 0xBEu || (unsigned __int16)v22 > 0xC0u)
|
|
1165 && ((unsigned __int16)v22 < 0xC4u || (unsigned __int16)v22 > 0xC6u)
|
|
1166 && ((unsigned __int16)v22 < 0x2Bu || (unsigned __int16)v22 > 0x2Du)
|
|
1167 && ((unsigned __int16)v22 < 0x31u || (unsigned __int16)v22 > 0x33u)
|
|
1168 && ((unsigned __int16)v22 < 0x34u || (unsigned __int16)v22 > 0x36u)
|
|
1169 && ((unsigned __int16)v22 < 0xFDu || (unsigned __int16)v22 > 0xFFu)
|
|
1170 && ((unsigned __int16)v22 < 0x61u || (unsigned __int16)v22 > 0x63u)
|
|
1171 && ((unsigned __int16)v22 < 0x1Cu || (unsigned __int16)v22 > 0x1Eu) )
|
|
1172 break;
|
|
1173 }
|
|
1174 pParty->field_750[v12] = rand() % 258 + 1;
|
|
1175 }
|
|
1176 }
|
|
1177 }
|
|
1178 else
|
|
1179 {
|
|
1180 while ( 1 )
|
|
1181 {
|
|
1182 v23 = pParty->field_750[v12];
|
|
1183 if ( (unsigned __int16)v23 < 0x73u || (unsigned __int16)v23 > 0x84u )
|
|
1184 {
|
|
1185 if ( ((unsigned __int16)v23 < 0xE8u || (unsigned __int16)v23 > 0xF9u)
|
|
1186 && ((unsigned __int16)v23 < 0x85u || (unsigned __int16)v23 > 0x96u)
|
|
1187 && ((unsigned __int16)v23 < 0x97u || (unsigned __int16)v23 > 0xBAu)
|
|
1188 && ((unsigned __int16)v23 < 0xBEu || (unsigned __int16)v23 > 0xC0u)
|
|
1189 && ((unsigned __int16)v23 < 0xC4u || (unsigned __int16)v23 > 0xC6u)
|
|
1190 && ((unsigned __int16)v23 < 0x2Bu || (unsigned __int16)v23 > 0x2Du)
|
|
1191 && ((unsigned __int16)v23 < 0x52u || (unsigned __int16)v23 > 0x54u)
|
|
1192 && ((unsigned __int16)v23 < 4u || (unsigned __int16)v23 > 6u)
|
|
1193 && ((unsigned __int16)v23 < 0x37u || (unsigned __int16)v23 > 0x39u)
|
|
1194 && ((unsigned __int16)v23 < 0x3Au || (unsigned __int16)v23 > 0x3Cu)
|
|
1195 && ((unsigned __int16)v23 < 0x3Du || (unsigned __int16)v23 > 0x3Fu)
|
|
1196 && ((unsigned __int16)v23 < 0xFDu || (unsigned __int16)v23 > 0xFFu)
|
|
1197 && ((unsigned __int16)v23 < 0x61u || (unsigned __int16)v23 > 0x63u)
|
|
1198 && ((unsigned __int16)v23 < 0xCDu || (unsigned __int16)v23 > 0xCFu) )
|
|
1199 break;
|
|
1200 }
|
|
1201 pParty->field_750[v12] = rand() % 258 + 1;
|
|
1202 }
|
|
1203 }
|
|
1204 }
|
|
1205 else
|
|
1206 {
|
|
1207 while ( 1 )
|
|
1208 {
|
|
1209 v24 = pParty->field_750[v12];
|
|
1210 if ( (unsigned __int16)v24 < 0x73u || (unsigned __int16)v24 > 0x84u )
|
|
1211 {
|
|
1212 if ( ((unsigned __int16)v24 < 0xEBu || (unsigned __int16)v24 > 0xFCu)
|
|
1213 && ((unsigned __int16)v24 < 0x85u || (unsigned __int16)v24 > 0x96u)
|
|
1214 && ((unsigned __int16)v24 < 0x97u || (unsigned __int16)v24 > 0xBAu)
|
|
1215 && ((unsigned __int16)v24 < 0xBEu || (unsigned __int16)v24 > 0xC0u)
|
|
1216 && ((unsigned __int16)v24 < 0xC4u || (unsigned __int16)v24 > 0xC6u)
|
|
1217 && ((unsigned __int16)v24 < 0x2Bu || (unsigned __int16)v24 > 0x2Du)
|
|
1218 && ((unsigned __int16)v24 < 0xCDu || (unsigned __int16)v24 > 0xCFu)
|
|
1219 && ((unsigned __int16)v24 < 0x5Eu || (unsigned __int16)v24 > 0x60u)
|
|
1220 && ((unsigned __int16)v24 < 0xFDu || (unsigned __int16)v24 > 0xFFu)
|
|
1221 && ((unsigned __int16)v24 < 0x6Du || (unsigned __int16)v24 > 0x6Fu)
|
|
1222 && ((unsigned __int16)v24 < 0x61u || (unsigned __int16)v24 > 0x63u) )
|
|
1223 break;
|
|
1224 }
|
|
1225 pParty->field_750[v12] = rand() % 258 + 1;
|
|
1226 }
|
|
1227 }
|
|
1228 v10 = v56;
|
|
1229 }
|
|
1230 v25 = v10;
|
|
1231 v26 = pParty->field_750[v25];
|
|
1232 v27 = pParty->field_75A[v25] == v13;
|
|
1233 word_F8B1A0 = pParty->field_750[v25];
|
|
1234 if ( v27 )
|
|
1235 {
|
|
1236 //v1 = 0;
|
|
1237 v27 = v26 == v13;
|
|
1238 v29 = (int)pNPCTopics[351].pText;
|
|
1239 if ( v27 )
|
|
1240 v29 = (int)pNPCTopics[353].pText;
|
|
1241 dword_F8B1A4 = (char *)v29;
|
|
1242 }
|
|
1243 else
|
|
1244 {
|
|
1245 if ( v26 != v13 )
|
|
1246 {
|
|
1247 party_finds_gold(100 * pMonsterStats->pInfos[(unsigned __int16)v26].uLevel, 0);
|
|
1248 v28 = pParty->pPlayers;
|
|
1249 do
|
|
1250 {
|
|
1251 v28->SetVariable(VAR_Award, 86);
|
|
1252 ++v28;
|
|
1253 }
|
|
1254 while ( (signed int)v28 < (signed int)pParty->pHirelings );
|
|
1255 pParty->uNumBountiesCollected += 100 * pMonsterStats->pInfos[pParty->field_750[v25]].uLevel;
|
|
1256 pParty->field_750[v25] = v13;
|
|
1257 pParty->field_75A[v25] = v13;
|
|
1258 }
|
|
1259 //v1 = 0;
|
|
1260 dword_F8B1A4 = pNPCTopics[352].pText;
|
|
1261 }
|
|
1262 }
|
|
1263 else if ( uMessageParam == 100 )
|
|
1264 {
|
|
1265 pKeyActionMap->EnterText(1, 10, v8);
|
|
1266 }
|
|
1267 }
|
|
1268 }
|
|
1269 }
|
|
1270 */
|
|
1271
|
|
1272
|
|
1273 //LABEL_196:
|
|
1274 switch ( uMessageParam )
|
|
1275 {
|
|
1276 case HOUSE_DIALOGUE_LEARN_SKILLS:
|
|
1277 {
|
|
1278 pDialogueWindow->eWindowType = WINDOW_MainMenu;
|
|
1279 UI_CreateEndConversationButton();
|
|
1280 FillAviableSkillsToTeach(in_current_building_type);
|
|
1281 break;
|
|
1282 }
|
|
1283 case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_MAIN:
|
|
1284 {
|
|
1285 pDialogueWindow->eWindowType = WINDOW_MainMenu;
|
|
1286 UI_CreateEndConversationButton();
|
|
1287 sub_4B3A72(in_current_building_type);
|
|
1288 break;
|
|
1289 }
|
|
1290 case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_RULES:
|
|
1291 case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_VICTORY_CONDITIONS:
|
|
1292 {
|
|
1293 dialog_menu_id = (HOUSE_DIALOGUE_MENU)uMessageParam;
|
|
1294 break;
|
|
1295 }
|
|
1296 case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_RESULT:
|
|
1297 {
|
|
1298 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
|
|
1299 {
|
|
1300 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_PlayArcomage;
|
|
1301 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v1;
|
|
1302 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = v1;
|
|
1303 ++pMessageQueue_50CBD0->uNumMessages;
|
|
1304 }*/
|
|
1305 pMessageQueue_50CBD0->AddMessage(UIMSG_PlayArcomage, 0, 0);
|
|
1306 dialog_menu_id = HOUSE_DIALOGUE_TAVERN_ARCOMAGE_RESULT;
|
|
1307 break;
|
|
1308 }
|
|
1309 case HOUSE_DIALOGUE_SHOP_BUY_STANDARD:
|
|
1310 case HOUSE_DIALOGUE_SHOP_BUY_SPECIAL:
|
|
1311 {
|
|
1312 if ( pParty->field_3C.field_50[(unsigned int)v8->ptr_1C] < (signed __int64)pParty->uTimePlayed )
|
|
1313 {
|
|
1314 GenerateStandartShopItems();
|
|
1315 GenerateSpecialShopItems();
|
|
1316 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);
|
|
1317 }
|
|
1318 if ( uMessageParam == HOUSE_DIALOGUE_SHOP_BUY_STANDARD )
|
|
1319 {
|
|
1320 if ( uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType] )
|
|
1321 {
|
|
1322 for ( v43 = 0; v43 < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType]; ++v43 )
|
|
1323 {
|
|
1324 if ( pParty->StandartItemsInShops[(int)window_SpeakInHouse->ptr_1C][v43].uItemID )
|
|
1325 {
|
|
1326 v46 = pIcons_LOD->LoadTexture(pItemsTable->pItems[pParty->StandartItemsInShops[(int)window_SpeakInHouse->ptr_1C][v43].uItemID].pIconName, TEXTURE_16BIT_PALETTE);
|
|
1327 ItemsInShopTexture[v43] = &pIcons_LOD->pTextures[v46];
|
|
1328 }
|
|
1329 }
|
|
1330 }
|
|
1331 if ( in_current_building_type == BildingType_WeaponShop )
|
|
1332 {
|
|
1333 v48 = 0;
|
|
1334 if ( uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType] )
|
|
1335 {
|
|
1336 do
|
|
1337 {
|
|
1338 if ( pParty->StandartItemsInShops[(int)window_SpeakInHouse->ptr_1C][v48].uItemID)
|
|
1339 word_F8B158[v48] = rand() % (300 - ItemsInShopTexture[v48]->uTextureHeight);
|
|
1340 ++v48;
|
|
1341 }
|
|
1342 while ( v48 < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType] );
|
|
1343 }
|
|
1344 }
|
|
1345 }
|
|
1346 if ( uMessageParam == HOUSE_DIALOGUE_SHOP_BUY_SPECIAL )
|
|
1347 {
|
|
1348 if ( uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType] )
|
|
1349 {
|
|
1350 for ( v43 = 0; v43 < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType]; ++v43 )
|
|
1351 {
|
|
1352 if ( pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][(signed int)v43].uItemID )
|
|
1353 {
|
|
1354 v51 = pIcons_LOD->LoadTexture(pItemsTable->pItems[pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][(signed int)v43].uItemID].pIconName, TEXTURE_16BIT_PALETTE);
|
|
1355 ItemsInShopTexture[v43] = &pIcons_LOD->pTextures[v51];
|
|
1356 }
|
|
1357 }
|
|
1358 }
|
|
1359 if ( in_current_building_type == BildingType_WeaponShop )
|
|
1360 {
|
|
1361 v53 = 0;
|
|
1362 if ( uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType] )
|
|
1363 {
|
|
1364 do
|
|
1365 {
|
|
1366 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v53].uItemID)
|
|
1367 word_F8B158[v53] = rand() % (300 - ItemsInShopTexture[v53]->uTextureHeight);
|
|
1368 ++v53;
|
|
1369 }
|
|
1370 while ( v53 < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType ] );
|
|
1371 }
|
|
1372 }
|
|
1373 }
|
|
1374 break;
|
|
1375 }
|
|
1376 case HOUSE_DIALOGUE_SHOP_SELL:
|
|
1377 case HOUSE_DIALOGUE_SHOP_IDENTIFY:
|
|
1378 case HOUSE_DIALOGUE_SHOP_REPAIR:
|
|
1379 {
|
|
1380 dialog_menu_id = (HOUSE_DIALOGUE_MENU)uMessageParam;
|
|
1381 sub_421B2C_PlaceInInventory_or_DropPickedItem();
|
|
1382 break;
|
|
1383 }
|
|
1384 case HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT:
|
|
1385 {
|
|
1386 pDialogueWindow->eWindowType = WINDOW_MainMenu;
|
|
1387 UI_CreateEndConversationButton();
|
|
1388 sub_4B3AD4(in_current_building_type);
|
|
1389 break;
|
|
1390 }
|
|
1391 default:
|
|
1392 {
|
|
1393 if( uMessageParam >= HOUSE_DIALOGUE_36 && uMessageParam <= HOUSE_DIALOGUE_GUILD_LEARN_SKILL )
|
|
1394 {
|
|
1395 //v35 = pPlayers[uActiveCharacter];
|
|
1396 //v36 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (unsigned int)v8->ptr_1C] * 500.0);
|
|
1397 v36 = (signed __int64)(p2DEvents[(unsigned int)v8->ptr_1C - 1].flt_24 * 500.0);
|
|
1398 v37 = v36 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100;
|
|
1399 if ( v37 < v36 / 3 )
|
|
1400 v37 = v36 / 3;
|
|
1401 //if (false)
|
|
1402 if(byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][uMessageParam-36])
|
|
1403 //if ( *(&byte_4ED94C[37 * v35->uClass] + v55) )
|
|
1404 {
|
|
1405 //v38 = (int)(&pPlayers[uActiveCharacter]->uIntelligence + uMessageParam);
|
|
1406 if ( !pPlayers[uActiveCharacter]->pActiveSkills[uMessageParam - 36] )
|
|
1407 {
|
|
1408 if ( pParty->uNumGold < v37 )
|
|
1409 {
|
|
1410 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);
|
|
1411 if ( in_current_building_type == BildingType_Training || in_current_building_type == BildingType_Tavern )
|
|
1412 v39 = 4;
|
|
1413 else
|
|
1414 v39 = 2;
|
|
1415 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)v39);
|
|
1416 }
|
|
1417 else
|
|
1418 {
|
|
1419 Party::TakeGold(v37);
|
|
1420 dword_F8B1E4 = 1;
|
|
1421 pPlayers[uActiveCharacter]->pActiveSkills[uMessageParam - 36] = 1;
|
|
1422 pPlayers[uActiveCharacter]->PlaySound(SPEECH_78, 0);
|
|
1423 }
|
|
1424 }
|
|
1425 }
|
|
1426 }
|
|
1427 break;
|
|
1428 }
|
|
1429 }
|
|
1430 /*
|
|
1431 if ( uMessageParam != 95 && uMessageParam != 2 )
|
|
1432 {
|
|
1433 if ( uMessageParam == 3 )
|
|
1434 {
|
|
1435 dialog_menu_id = 3;
|
|
1436 }
|
|
1437 else
|
|
1438 {
|
|
1439 if ( uMessageParam == 4 )
|
|
1440 {
|
|
1441 dialog_menu_id = 4;
|
|
1442 }
|
|
1443 else
|
|
1444 {
|
|
1445 if ( uMessageParam != 5 )
|
|
1446 {
|
|
1447 if ( uMessageParam > 35 )
|
|
1448 {
|
|
1449 if ( uMessageParam <= 72 )
|
|
1450 {
|
|
1451 v35 = pPlayers[uActiveCharacter];
|
|
1452 //v36 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (unsigned int)v8->ptr_1C] * 500.0);
|
|
1453 v36 = (signed __int64)(p2DEvents[(unsigned int)v8->ptr_1C - 1].flt_24 * 500.0);
|
|
1454 v37 = v36 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100;
|
|
1455 if ( v37 < v36 / 3 )
|
|
1456 v37 = v36 / 3;
|
|
1457
|
|
1458 __debugbreak();
|
|
1459 //pSkillAvailabilityPerClass[8 + v58->uClass][4 + v23]
|
|
1460 // or
|
|
1461 //byte_4ED970_skill_learn_ability_by_class_table[v58->uClass][v23 - 36]
|
|
1462 // or
|
|
1463 //byte_4ED970_skill_learn_ability_by_class_table[v58->uClass - 1][v23 + 1]
|
|
1464
|
|
1465 if (false)
|
|
1466 //if ( *(&byte_4ED94C[37 * v35->uClass] + v55) )
|
|
1467 {
|
|
1468 v38 = (int)(&v35->uIntelligence + uMessageParam);
|
|
1469 if ( !*(short *)v38 )
|
|
1470 {
|
|
1471 if ( pParty->uNumGold < v37 )
|
|
1472 {
|
|
1473 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u);
|
|
1474 if ( in_current_building_type == BildingType_Training || in_current_building_type == BildingType_Tavern )
|
|
1475 v39 = 4;
|
|
1476 else
|
|
1477 v39 = 2;
|
|
1478 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, v39);
|
|
1479 }
|
|
1480 else
|
|
1481 {
|
|
1482 Party::TakeGold(v37);
|
|
1483 dword_F8B1E4 = 1;
|
|
1484 *(short *)v38 = 1;
|
|
1485 v35->PlaySound(SPEECH_78, 0);
|
|
1486 }
|
|
1487 }
|
|
1488 }
|
|
1489 }
|
|
1490 else
|
|
1491 {
|
|
1492 if ( uMessageParam == 94 )
|
|
1493 {
|
|
1494 pDialogueWindow->eWindowType = WINDOW_MainMenu;
|
|
1495 UI_CreateEndConversationButton();
|
|
1496 sub_4B3AD4(in_current_building_type);
|
|
1497 }
|
|
1498 }
|
|
1499 }
|
|
1500 return;
|
|
1501 }
|
|
1502 dialog_menu_id = 5;
|
|
1503 }
|
|
1504 }
|
|
1505 sub_421B2C_PlaceInInventory_or_DropPickedItem();
|
|
1506 return;
|
|
1507 }
|
|
1508 if ( pParty->field_3C.field_50[(unsigned int)v8->ptr_1C] < (signed __int64)pParty->uTimePlayed )
|
|
1509 {
|
|
1510 GenerateStandartShopItems();
|
|
1511 GenerateSpecialShopItems();
|
|
1512 v8 = window_SpeakInHouse;
|
|
1513 v40 = window_SpeakInHouse->par1C;
|
|
1514 //v3 = dword_F8B198;
|
|
1515 v41 = pParty->uTimePlayed
|
|
1516 //+ (signed __int64)((double)(11059200 * (signed int)p2DEvents_minus1[26 * (unsigned int)ptr_507BC0->ptr_1C])
|
|
1517 + (signed __int64)((double)(11059200 * (signed int)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].field_1C)
|
|
1518 * 0.033333335);
|
|
1519 pParty->field_3C.field_50[v40] = v41;
|
|
1520
|
|
1521 }
|
|
1522 v42 = v8->ptr_1C;
|
|
1523 v43 = 0;
|
|
1524 //v44 = p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C];
|
|
1525 v44 = p2DEvents[(unsigned int)v8->ptr_1C - 1].uType;
|
|
1526 if ( uMessageParam == 2 )
|
|
1527 {
|
|
1528 if ( uItemsAmountPerShopType[v44] )
|
|
1529 {
|
|
1530 do
|
|
1531 {
|
|
1532 v45 = pParty->StandartItemsInShops[(int)v42][v43].uItemID;
|
|
1533 if ( v45 )
|
|
1534 {
|
|
1535 v46 = pIcons_LOD->LoadTexture(pItemsTable->pItems[v45].pIconName, TEXTURE_16BIT_PALETTE);
|
|
1536 //v3 = dword_F8B198;
|
|
1537 v8 = window_SpeakInHouse;
|
|
1538 ItemsInShopTexture[v43] = &pIcons_LOD->pTextures[v46];
|
|
1539 }
|
|
1540 v42 = v8->ptr_1C;
|
|
1541 ++v43;
|
|
1542 }
|
|
1543 //while ( v43 < (unsigned __int8)_4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] );
|
|
1544 while ( v43 < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] );
|
|
1545 }
|
|
1546 if ( in_current_building_type == BildingType_WeaponShop )
|
|
1547 {
|
|
1548 v47 = v8->ptr_1C;
|
|
1549 v48 = 0;
|
|
1550 //if ( _4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] )
|
|
1551 if ( uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] )
|
|
1552 {
|
|
1553 do
|
|
1554 {
|
|
1555 // if ( pParty->field_777C[9 * (v48 + 12 * (int)v47)] )
|
|
1556 if ( pParty->StandartItemsInShops[(int)v47][v48].uItemID);
|
|
1557 {
|
|
1558 v49 = rand();
|
|
1559 v8 = window_SpeakInHouse;
|
|
1560 word_F8B158[v48] = v49 % (300 - ItemsInShopTexture[v48]->uTextureHeight);
|
|
1561 }
|
|
1562 v47 = v8->ptr_1C;
|
|
1563 ++v48;
|
|
1564 }
|
|
1565 //while ( v48 < (unsigned __int8)_4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] );
|
|
1566 while ( v48 < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] );
|
|
1567 }
|
|
1568 }
|
|
1569 }
|
|
1570 if ( uMessageParam == 95 )
|
|
1571 {
|
|
1572 if ( uItemsAmountPerShopType[v44] )
|
|
1573 {
|
|
1574 do
|
|
1575 {
|
|
1576 //v50 = pParty->field_C59C[9 * (v43 + 12 * (int)v42) + 724];
|
|
1577 v50=pParty->SpecialItemsInShops[(unsigned int)v42][(signed int)v43].uItemID;
|
|
1578 if ( v50 )
|
|
1579 {
|
|
1580 v51 = pIcons_LOD->LoadTexture(pItemsTable->pItems[v50].pIconName, TEXTURE_16BIT_PALETTE);
|
|
1581 //v3 = dword_F8B198;
|
|
1582 v8 = window_SpeakInHouse;
|
|
1583 ItemsInShopTexture[v43] = &pIcons_LOD->pTextures[v51];
|
|
1584 }
|
|
1585 v42 = v8->ptr_1C;
|
|
1586 ++v43;
|
|
1587 }
|
|
1588 //while ( v43 < (unsigned __int8)_4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] );
|
|
1589 while ( v43 < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] );
|
|
1590 }
|
|
1591 if ( in_current_building_type == BildingType_WeaponShop )
|
|
1592 {
|
|
1593 v52 = v8->ptr_1C;
|
|
1594 v53 = 0;
|
|
1595 //if ( _4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] )
|
|
1596 if ( uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] )
|
|
1597 {
|
|
1598 do
|
|
1599 {
|
|
1600 // if ( pParty->field_C59C[9 * (v53 + 12 * (int)v52) + 724] )
|
|
1601 if (pParty->SpecialItemsInShops[(unsigned int)v52][v53].uItemID)
|
|
1602 {
|
|
1603 v54 = rand();
|
|
1604 v8 = window_SpeakInHouse;
|
|
1605 word_F8B158[v53] = v54 % (300 - ItemsInShopTexture[v53]->uTextureHeight);
|
|
1606 }
|
|
1607 v52 = v8->ptr_1C;
|
|
1608 ++v53;
|
|
1609 }
|
|
1610 //while ( v53 < (unsigned __int8)_4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] );
|
|
1611 while ( v53 < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType ] );
|
|
1612 }
|
|
1613 }
|
|
1614 }
|
|
1615 */
|
|
1616 }
|
|
1617 //----- (004B6943) --------------------------------------------------------
|
|
1618 void __cdecl TravelByTransport()
|
|
1619 {
|
|
1620 GUIWindow *v0; // ebx@1
|
|
1621 Player *v1; // esi@1
|
|
1622 signed int v2; // edi@1
|
|
1623 unsigned int v3; // eax@1
|
|
1624 signed int v4; // ebx@1
|
|
1625 stru365_travel_info *v5; // esi@7
|
|
1626 //int v6; // eax@9
|
|
1627 //int v7; // eax@9
|
|
1628 //int v8; // eax@12
|
|
1629 //int v9; // edi@12
|
|
1630 //int v10; // edx@12
|
|
1631 int v11; // ecx@12
|
|
1632 signed int v12; // esi@13
|
|
1633 signed int v13; // edi@14
|
|
1634 DWORD v14; // eax@26
|
|
1635 DWORD v15; // edi@26
|
|
1636 GUIWindow *v16; // ebx@36
|
|
1637 int v17; // esi@36
|
|
1638 int v18; // eax@36
|
|
1639 int v19; // ecx@36
|
|
1640 int v20; // esi@36
|
|
1641 int v21; // eax@36
|
|
1642 void *v22; // eax@39
|
|
1643 int v23; // esi@39
|
|
1644 GUIButton *v24; // ebx@39
|
|
1645 signed int v25; // eax@41
|
|
1646 //int v26; // esi@44
|
|
1647 //const char *v27; // eax@46
|
|
1648 char *v28; // eax@62
|
|
1649 int v29; // eax@62
|
|
1650 unsigned int v30; // ecx@62
|
|
1651 char *v31; // eax@63
|
|
1652 MapInfo v32; // [sp-3Ch] [bp-2CCh]@62
|
|
1653 /*int v33; // [sp-38h] [bp-2C8h]@62
|
|
1654 int v34; // [sp-34h] [bp-2C4h]@62
|
|
1655 int v35; // [sp-30h] [bp-2C0h]@62
|
|
1656 int v36; // [sp-2Ch] [bp-2BCh]@62
|
|
1657 int v37; // [sp-28h] [bp-2B8h]@62
|
|
1658 int v38; // [sp-24h] [bp-2B4h]@62
|
|
1659 int v39; // [sp-20h] [bp-2B0h]@62
|
|
1660 int v40; // [sp-1Ch] [bp-2ACh]@62
|
|
1661 int v41; // [sp-18h] [bp-2A8h]@62
|
|
1662 int v42; // [sp-14h] [bp-2A4h]@62
|
|
1663 char *v43; // [sp-10h] [bp-2A0h]@62
|
|
1664 char *v44; // [sp-Ch] [bp-29Ch]@62
|
|
1665 unsigned int v45; // [sp-8h] [bp-298h]@62
|
|
1666 char *v46; // [sp-4h] [bp-294h]@62
|
|
1667 const char *v47[5]; // [sp+0h] [bp-290h]@7*/
|
|
1668 char v48[5][100]; // [sp+14h] [bp-27Ch]@37
|
|
1669 //char v49[100]; // [sp+78h] [bp-218h]@68
|
|
1670 //char v50[100]; // [sp+DCh] [bp-1B4h]@68
|
|
1671 //char v51[100]; // [sp+140h] [bp-150h]@68
|
|
1672 //char Dest[100]; // [sp+1A4h] [bp-ECh]@36
|
|
1673 GUIWindow v53; // [sp+208h] [bp-88h]@1
|
|
1674 int v54; // [sp+25Ch] [bp-34h]@36
|
|
1675 int v55; // [sp+260h] [bp-30h]@36
|
|
1676 //unsigned int v56; // [sp+264h] [bp-2Ch]@1
|
|
1677 //int v57; // [sp+268h] [bp-28h]@1
|
|
1678 int v58; // [sp+26Ch] [bp-24h]@36
|
|
1679 //GUIWindow *v59; // [sp+270h] [bp-20h]@1
|
|
1680 unsigned int v60; // [sp+274h] [bp-1Ch]@36
|
|
1681 //Player *v61; // [sp+278h] [bp-18h]@1
|
|
1682 int v62; // [sp+27Ch] [bp-14h]@36
|
|
1683 int v63; // [sp+280h] [bp-10h]@14
|
|
1684 char *a1; // [sp+284h] [bp-Ch]@37
|
|
1685 unsigned int s1; // [sp+288h] [bp-8h]@1
|
|
1686 int v66; // [sp+28Ch] [bp-4h]@48
|
|
1687
|
|
1688 v0 = window_SpeakInHouse;
|
|
1689 memcpy(&v53, window_SpeakInHouse, sizeof(v53));
|
|
1690 v2 = 255;
|
|
1691 //v61 = pPlayers[uActiveCharacter];
|
|
1692 v1 = pPlayers[uActiveCharacter];
|
|
1693 v53.uFrameX = 483;
|
|
1694 v53.uFrameWidth = 148;
|
|
1695 v53.uFrameZ = 334;
|
|
1696 auto color_default = TargetColor(255, 255, 255);
|
|
1697 auto color_selected = TargetColor(255, 255, 155);
|
|
1698 v3 = 52 * (unsigned int)v0->ptr_1C;
|
|
1699 //v59 = (GUIWindow *)((((p2DEvents_minus1___00[v3 / 2] != 27) - 1) & 0xFFFFFFE7) + 50);
|
|
1700 //v59 = (GUIWindow *)((((p2DEvents[(unsigned int)v0->ptr_1C - 1].uType != BildingType_Stables) - 1) & 0xFFFFFFE7) + 50);
|
|
1701 //v4 = (signed __int64)((double)(signed int)v59 * p2DEvents_minus1__20[v3 / 4]);
|
|
1702
|
|
1703 v4 = p2DEvents[(unsigned int)v0->ptr_1C - 1].uType == BildingType_Stables ? 25 : 50;
|
|
1704 v4 *= p2DEvents[(unsigned int)v0->ptr_1C - 1].fPriceMultiplier;
|
|
1705
|
|
1706 s1 = v4 * (100 - v1->GetMerchant()) / 100;
|
|
1707 if ( (signed int)s1 < v4 / 3 )
|
|
1708 s1 = v4 / 3;
|
|
1709 if ( dialog_menu_id == HOUSE_DIALOGUE_MAIN)
|
|
1710 {
|
1393
|
1711 if ( HouseUI_CheckIfPlayerCanInteract() )
|
1298
|
1712 {
|
|
1713 v16 = pDialogueWindow;
|
|
1714 v58 = 255;
|
|
1715 v62 = 0;
|
|
1716 v17 = LOBYTE(pFontArrus->uFontHeight) - 3;
|
|
1717 //v59 = pDialogueWindow;
|
|
1718 v54 = v17;
|
|
1719 strcpy(v48[4], "");
|
|
1720 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[405], s1); // Price: %lu gold
|
|
1721 v18 = pFontArrus->CalcTextHeight(pTmpBuf2.data(), &v53, 0, 0);
|
|
1722 v19 = v16->pNumPresenceButton;
|
|
1723 v20 = v18 + v17 + 146;
|
|
1724 v21 = v16->pStartingPosActiveItem;
|
|
1725 v63 = v20;
|
|
1726 v55 = v20;
|
|
1727 v60 = v21;
|
|
1728 if ( v21 >= v21 + v19 )
|
|
1729 goto LABEL_71;
|
|
1730 s1 = 2;
|
|
1731 a1 = (char *)v48;
|
|
1732 while ( 1 )
|
|
1733 {
|
|
1734 int v47 = v60;
|
|
1735 v22 = window_SpeakInHouse->ptr_1C;
|
|
1736 v23 = transport_routes[(unsigned int)v22 - HOUSE_STABLES_HARMONDALE][v62];
|
|
1737 //v23 = (unsigned __int8)*(&_4F0D38_TravelInfo[4 * (unsigned int)v22] + v62); // negindex. actual address is around + 0x36
|
|
1738 //v61 = (Player *)(unsigned __int8)*(&_4F0D38_TravelInfo[4 * (unsigned int)v22] + v62); // + 0x3F for sea travels, less for land
|
|
1739 v24 = v16->GetControl(v60);
|
|
1740
|
|
1741 if (v23 != v58)
|
|
1742 {
|
|
1743 if (v23 >= 25)
|
|
1744 Log::Warning(L"Transport UI: scedule overflow");
|
|
1745 if (s1 >= 6)
|
|
1746 v25 = true;
|
|
1747 else
|
|
1748 v25 = transport_schedule[v23].pSchedule[pParty->uDaysPlayed % 7];
|
|
1749 }
|
|
1750
|
|
1751 if (v23 != v58 && v25 && (!transport_schedule[v23].uQuestBit || _449B57_test_bit(pParty->_quest_bits, transport_schedule[v23].uQuestBit)) )
|
|
1752 {
|
|
1753 v58 = v23;
|
|
1754 if ( pDialogueWindow->pCurrentPosActiveItem == s1 )
|
|
1755 sprintf(a1, "\f%05d", color_selected);
|
|
1756 else
|
|
1757 sprintf(a1, "\f%05d", color_default);
|
|
1758
|
|
1759 //v32.uRedbookTrackID = v27;
|
|
1760 v66 = transport_schedule[v23].uTravelTime;
|
|
1761 if ( (unsigned int)window_SpeakInHouse->ptr_1C >= HOUSE_BOATS_63 )
|
|
1762 {
|
|
1763 if ( CheckHiredNPCSpeciality(Sailor) )
|
|
1764 v66 -= 2;
|
|
1765 if ( CheckHiredNPCSpeciality(Navigator) )
|
|
1766 v66 -= 3;
|
|
1767 if ( CheckHiredNPCSpeciality(Pirate) )
|
|
1768 v66 -= 2;
|
|
1769 }
|
|
1770 else
|
|
1771 {
|
|
1772 if ( CheckHiredNPCSpeciality(Horseman) )
|
|
1773 v66 -= 2;
|
|
1774 }
|
|
1775 if ( CheckHiredNPCSpeciality(Explorer) )
|
|
1776 --v66;
|
|
1777 if ( v66 < 1 )
|
|
1778 v66 = 1;
|
|
1779 if ( v23 != v2 )
|
|
1780 {
|
|
1781 memcpy(&v32, &pMapStats->pInfos[transport_schedule[v23].uMapInfoID], 0x44u);
|
|
1782 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[404], // Time - %d days, destination %s
|
|
1783 v66, v32.pName);
|
|
1784 strcat(a1, pTmpBuf.data());
|
|
1785 v28 = a1;
|
|
1786 a1 += 100;
|
|
1787 ++v62;
|
|
1788 ++s1;
|
|
1789 strcat(v28, "\n \n");
|
|
1790 v24->uY = v63;
|
|
1791 v29 = pFontArrus->CalcTextHeight(pTmpBuf.data(), &v53, 0, 0);
|
|
1792 v30 = v24->uY;
|
|
1793 v24->uHeight = v29;
|
|
1794 v2 = 255;
|
|
1795 v24->uW = v30 + v29 - 1;
|
|
1796 v63 += v54 + v29;
|
|
1797 }
|
|
1798 }
|
|
1799 else
|
|
1800 {
|
|
1801 v31 = a1;
|
|
1802 ++v62;
|
|
1803 ++s1;
|
|
1804 a1 += 100;
|
|
1805 strcpy(v31, "");
|
|
1806 if ( v24 )
|
|
1807 {
|
|
1808 v24->uW = 0;
|
|
1809 v24->uHeight = 0;
|
|
1810 v24->uY = 0;
|
|
1811 }
|
|
1812 }
|
|
1813 ++v60;
|
|
1814 if ( (signed int)v60 >= v16->pNumPresenceButton + v16->pStartingPosActiveItem )
|
|
1815 break;
|
|
1816 //v16 = v59;
|
|
1817 }
|
|
1818 if ( v63 != v55 )
|
|
1819 {
|
|
1820 /*v47[1] = &Dest;
|
|
1821 v47[0] = &v51;
|
|
1822 v46 = &v50;
|
|
1823 v45 = (unsigned int)&v49;
|
|
1824 v44 = &v48;
|
|
1825 v43 = pTmpBuf2.data();*/
|
|
1826 sprintf(pTmpBuf.data(), "%s\n \n%s%s%s%s%s", pTmpBuf2.data(), v48[0], v48[1], v48[2], v48[3], v48[4]);
|
|
1827 v53.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3u);
|
|
1828 }
|
|
1829 else
|
|
1830 {
|
|
1831 LABEL_71:
|
|
1832 v53.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[561], &v53, 0, 0)) / 2 + 138,
|
|
1833 color_default, pGlobalTXT_LocalizationStrings[561], 3);
|
|
1834 pAudioPlayer->StopChannels(-1, -1);
|
|
1835 }
|
|
1836 }
|
|
1837 }
|
|
1838 else
|
|
1839 {
|
|
1840 if ( dialog_menu_id >= HOUSE_DIALOGUE_TRANSPORT_SCHEDULE_1 && dialog_menu_id <= HOUSE_DIALOGUE_TRANSPORT_SCHEDULE_4 )
|
|
1841 {
|
|
1842 if ( pParty->uNumGold < s1 )
|
|
1843 {
|
|
1844 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u);
|
|
1845 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_Greeting_2);
|
|
1846 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
|
|
1847 return;
|
|
1848 }
|
|
1849
|
|
1850 Party::TakeGold(s1);
|
|
1851
|
|
1852 v5 = &transport_schedule[transport_routes[(unsigned int)window_SpeakInHouse->ptr_1C - HOUSE_STABLES_HARMONDALE][dialog_menu_id - HOUSE_DIALOGUE_TRANSPORT_SCHEDULE_1]];
|
|
1853 if ( v5->pSchedule[pParty->uDaysPlayed % 7] )
|
|
1854 {
|
|
1855 if ( _stricmp(pCurrentMapName.data(), pMapStats->pInfos[v5->uMapInfoID].pFilename) )
|
|
1856 {
|
|
1857 SaveGame(1, 0);
|
|
1858 strcpy(pCurrentMapName.data(), pMapStats->pInfos[v5->uMapInfoID].pFilename);
|
|
1859
|
|
1860 dword_6BE364_game_settings_1 |= 1u;
|
|
1861 _5B65B8_npcdata_hiword_house_or_other = 0;
|
|
1862 dword_5B65BC = 0;
|
|
1863 _5B65B4_npcdata_loword_house_or_other = v5->arrival_rot_y;
|
|
1864 v11 = *((int *)v5 + 3);
|
|
1865 uGameState = GAME_STATE_2;
|
|
1866 _5B65A8_npcdata_uflags_or_other = v11;
|
|
1867 _5B65AC_npcdata_fame_or_other = v5->arrival_y;
|
|
1868 _5B65B0_npcdata_rep_or_other = v5->arrival_z;
|
|
1869 dword_5B65C0 = v11 | v5->arrival_y | v5->arrival_z | v5->arrival_rot_y;
|
|
1870 }
|
|
1871 else
|
|
1872 {
|
|
1873 pIndoorCamera->sRotationY = 0;
|
|
1874 pParty->uFlags |= 2u;
|
|
1875 pParty->vPosition.x = v5->arrival_x;
|
|
1876 pParty->vPosition.y = v5->arrival_y;
|
|
1877 pParty->vPosition.z = v5->arrival_z;
|
|
1878 pParty->uFallStartY = pParty->vPosition.z;
|
|
1879 pParty->sRotationX = 0;
|
|
1880 pParty->sRotationY = v5->arrival_rot_y;
|
|
1881 }
|
|
1882 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful);
|
|
1883 v12 = v5->uTravelTime;
|
|
1884 int _v47;
|
|
1885 if ( (signed int)window_SpeakInHouse->ptr_1C >= 63 )
|
|
1886 {
|
|
1887 v63 = SPEECH_SetSail;
|
|
1888 v13 = 2500;
|
|
1889 if ( CheckHiredNPCSpeciality(Sailor) )
|
|
1890 v12 -= 2;
|
|
1891 if ( CheckHiredNPCSpeciality(Navigator) )
|
|
1892 v12 -= 3;
|
|
1893 //_v47 = 45;
|
|
1894 if ( CheckHiredNPCSpeciality(Pirate) )
|
|
1895 v12 -= 2;
|
|
1896 }
|
|
1897 else
|
|
1898 {
|
|
1899 v63 = SPEECH_CarriageReady;
|
|
1900 v13 = 1500;
|
|
1901 //_v47 = 35;
|
|
1902 if ( CheckHiredNPCSpeciality(Horseman) )
|
|
1903 v12 -= 2;
|
|
1904 }
|
|
1905 if ( CheckHiredNPCSpeciality(Explorer) )
|
|
1906 --v12;
|
|
1907 if ( v12 < 1 )
|
|
1908 v12 = 1;
|
|
1909 RestAndHeal(1440 * v12);
|
|
1910 v1->PlaySound((PlayerSpeech)v63, 0);
|
|
1911 v14 = GetTickCount();
|
|
1912 v15 = v14 + v13;
|
|
1913 if ( v15 < v14 )
|
|
1914 v15 = v14;
|
|
1915 while ( GetTickCount() < v15 )
|
|
1916 sqrt(3.1415926);
|
|
1917 while ( sub_4BD8B5() )
|
|
1918 ;
|
|
1919 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0);
|
|
1920 return;
|
|
1921 }
|
|
1922 else
|
|
1923 {
|
|
1924 dialog_menu_id = HOUSE_DIALOGUE_MAIN;
|
|
1925 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0);
|
|
1926 }
|
|
1927 }
|
|
1928 }
|
|
1929 }
|
|
1930 //----- (004B68EA) --------------------------------------------------------
|
|
1931 bool __fastcall IsTravelAvailable(int a1)
|
|
1932 {
|
|
1933 for (uint i = 0; i < 4; ++i)
|
|
1934 {
|
|
1935 uint route = transport_routes[a1][i];
|
|
1936 if (transport_schedule[route].pSchedule[pParty->uDaysPlayed % 7])
|
|
1937 {
|
|
1938 if (!transport_schedule[route].uQuestBit || _449B57_test_bit(pParty->_quest_bits, transport_schedule[route].uQuestBit))
|
|
1939 return true;
|
|
1940 }
|
|
1941 }
|
|
1942 return false;
|
|
1943 }
|
|
1944
|
|
1945
|
|
1946
|
|
1947 //----- (004B7911) --------------------------------------------------------
|
|
1948 void __cdecl TownHallDialog()
|
|
1949 {
|
|
1950 GUIWindow *v0; // eax@4
|
|
1951 int v1; // eax@10
|
|
1952 int v2; // esi@10
|
|
1953 GUIFont *v3; // ST20_4@20
|
|
1954 int v4; // eax@20
|
|
1955 MonsterInfo *v5; // edi@21
|
|
1956 unsigned int v6; // ST20_4@21
|
|
1957 char *v7; // ST1C_4@21
|
|
1958 unsigned int v8; // eax@21
|
|
1959 int v9; // esi@21
|
|
1960 char *v10; // eax@23
|
|
1961 signed int v11; // ebx@24
|
|
1962 signed int i; // esi@26
|
|
1963 int v13; // eax@27
|
|
1964 GUIWindow *v14; // ecx@28
|
|
1965 __int64 v15; // qax@28
|
|
1966 signed int v16; // ebx@28
|
|
1967 int v17; // ebx@28
|
|
1968 unsigned __int8 v18; // sf@28
|
|
1969 char **v19; // edi@29
|
|
1970 GUIButton *v20; // eax@30
|
|
1971 GUIButton *v21; // esi@30
|
|
1972 int v22; // eax@30
|
|
1973 unsigned int v23; // ecx@30
|
|
1974 unsigned __int16 v24; // ax@30
|
|
1975 GUIWindow a1; // [sp+Ch] [bp-110h]@21
|
|
1976 GUIWindow w; // [sp+60h] [bp-BCh]@21
|
|
1977 GUIWindow _this; // [sp+B4h] [bp-68h]@1
|
|
1978 int v28; // [sp+108h] [bp-14h]@1
|
|
1979 int v29; // [sp+10Ch] [bp-10h]@28
|
|
1980 int v30; // [sp+110h] [bp-Ch]@1
|
|
1981 int v31; // [sp+114h] [bp-8h]@29
|
|
1982 GUIFont *pOutString; // [sp+118h] [bp-4h]@21
|
|
1983
|
|
1984 memcpy(&_this, window_SpeakInHouse, sizeof(_this));
|
|
1985 _this.uFrameX = 483;
|
|
1986 _this.uFrameWidth = 148;
|
|
1987 _this.uFrameZ = 334;
|
|
1988 v28 = TargetColor(0xFFu, 0xFFu, 0xFFu);
|
|
1989 v30 = TargetColor(0xFFu, 0xFFu, 0x9Bu);
|
|
1990 sprintf(pTmpBuf.data(), "%s: %d", pGlobalTXT_LocalizationStrings[605], pParty->uFine);
|
|
1991 _this.DrawTitleText(pFontArrus, 0, 0x104u, v30, pTmpBuf.data(), 3u);
|
|
1992 switch(dialog_menu_id)
|
|
1993 {
|
|
1994 case HOUSE_DIALOGUE_MAIN:
|
|
1995 {
|
|
1996 v11 = 1;
|
|
1997 pOutString = 0;
|
|
1998 pShopOptions[0] = pGlobalTXT_LocalizationStrings[604];
|
|
1999 if ( pParty->uFine )
|
|
2000 {
|
|
2001 pShopOptions[1] = pGlobalTXT_LocalizationStrings[603];
|
|
2002 v11 = 2;
|
|
2003 }
|
|
2004 for ( i = 0; i < v11; ++i )
|
|
2005 {
|
|
2006 v13 = pFontArrus->CalcTextHeight(pShopOptions[i], &_this, 0, 0);
|
|
2007 pOutString = (GUIFont *)((char *)pOutString + v13);
|
|
2008 }
|
|
2009 v29 = (100 - (signed int)pOutString) / v11;
|
|
2010 v14 = pDialogueWindow;
|
|
2011 v15 = 80 - v11 * (100 - (signed int)pOutString) / v11 - (signed int)pOutString;
|
|
2012 v16 = v15 - HIDWORD(v15);
|
|
2013 LODWORD(v15) = pDialogueWindow->pStartingPosActiveItem;
|
|
2014 HIDWORD(v15) = v15 + pDialogueWindow->pNumPresenceButton;
|
|
2015 v17 = (v16 >> 1) - v29 / 2 + 158;
|
|
2016 v18 = -pDialogueWindow->pNumPresenceButton < 0;
|
|
2017 pOutString = (GUIFont *)pDialogueWindow->pStartingPosActiveItem;
|
|
2018 if ( v18 ^ __OFSUB__((int)v15, HIDWORD(v15)) )
|
|
2019 {
|
|
2020 v31 = 2;
|
|
2021 v19 = pShopOptions.data();
|
|
2022 do
|
|
2023 {
|
|
2024 v20 = v14->GetControl((unsigned int)pOutString);
|
|
2025 v21 = v20;
|
|
2026 v20->uY = v29 + v17;
|
|
2027 v22 = pFontArrus->CalcTextHeight(*v19, &_this, 0, 0);
|
|
2028 v23 = v21->uY;
|
|
2029 v21->uHeight = v22;
|
|
2030 v17 = v23 + v22 - 1;
|
|
2031 v21->uW = v17;
|
|
2032 v24 = v30;
|
|
2033 if ( pDialogueWindow->pCurrentPosActiveItem != v31 )
|
|
2034 v24 = v28;
|
|
2035 _this.DrawTitleText(pFontArrus, 0, v23, v24, *v19, 3u);
|
|
2036 v14 = pDialogueWindow;
|
|
2037 ++v31;
|
|
2038 ++v19;
|
|
2039 pOutString = (GUIFont *)((char *)pOutString + 1);
|
|
2040 }
|
|
2041 while ( (signed int)pOutString < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem );
|
|
2042 }
|
|
2043 break;
|
|
2044 }
|
|
2045
|
|
2046 case HOUSE_DIALOGUE_TOWNHALL_99:
|
|
2047 {
|
|
2048 v5 = &pMonsterStats->pInfos[word_F8B1A0];
|
|
2049 v6 = TargetColor(0xFFu, 0xFFu, 0xFFu);
|
|
2050 v7 = v5->pName;
|
|
2051 v8 = TargetColor(0xFFu, 0xFFu, 0x9Bu);
|
|
2052 sprintf(pTmpBuf.data(), "\f%05d%s\f%05d", v8, v7, v6);
|
|
2053 sprintf(pTmpBuf2.data(), dword_F8B1A4, pTmpBuf.data(), 100 * v5->uLevel);
|
|
2054 current_npc_text = pTmpBuf2.data();
|
|
2055 memcpy(&a1, pDialogueWindow, sizeof(a1));
|
|
2056 w.uFrameWidth = 458;
|
|
2057 w.uFrameZ = 457;
|
|
2058 pOutString = pFontArrus;
|
|
2059 v9 = pFontArrus->CalcTextHeight(pTmpBuf2.data(), &w, 13, 0) + 7;
|
|
2060 if ( 352 - v9 < 8 )
|
|
2061 {
|
|
2062 pOutString = pFontCreate;
|
|
2063 v9 = pFontCreate->CalcTextHeight(current_npc_text, &w, 13, 0) + 7;
|
|
2064 }
|
|
2065
|
|
2066 auto pTex = pIcons_LOD->GetTexture(uTextureID_Leather);
|
|
2067 pRenderer->_4A6A68(8u, 352 - v9, pTex, pTex->uTextureHeight - v9);
|
|
2068 pRenderer->DrawTextureIndexed(8u, 347 - v9, pTexture_591428);
|
|
2069 v10 = FitTextInAWindow(current_npc_text, pOutString, &w, 0xDu, 0);
|
|
2070 a1.DrawText(pOutString, 13, 354 - v9, 0, v10, 0, 0, 0);
|
|
2071 break;
|
|
2072 }
|
|
2073 case HOUSE_DIALOGUE_TOWNHALL_100:
|
|
2074 {
|
|
2075 v0 = window_SpeakInHouse;
|
|
2076 if ( window_SpeakInHouse->receives_keyboard_input_2 == WINDOW_INPUT_IN_PROGRESS)
|
|
2077 {
|
|
2078 sprintfex(pTmpBuf.data(), "%s\n%s", pGlobalTXT_LocalizationStrings[606], pGlobalTXT_LocalizationStrings[112]); // "Pay" "How Much?"
|
|
2079 _this.DrawTitleText(pFontArrus, 0, 0x92u, v30, pTmpBuf.data(), 3u);
|
|
2080 _this.DrawTitleText(pFontArrus, 0, 0xBAu, v28, (const char *)pKeyActionMap->pPressedKeysBuffer, 3);
|
|
2081 v3 = pFontArrus;
|
|
2082 v4 = pFontArrus->GetLineWidth((const char *)pKeyActionMap->pPressedKeysBuffer);
|
|
2083 _this.DrawFlashingInputCursor(v4 / 2 + 80, 185, v3);
|
|
2084 return;
|
|
2085 }
|
|
2086 if ( window_SpeakInHouse->receives_keyboard_input_2 == WINDOW_INPUT_CONFIRMED)
|
|
2087 {
|
|
2088 v1 = atoi((const char *)pKeyActionMap->pPressedKeysBuffer);
|
|
2089 v2 = v1;
|
|
2090 if ( v1 <= 0 )
|
|
2091 {
|
|
2092 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
|
|
2093 return;
|
|
2094 }
|
|
2095 if ( v1 > pParty->uNumGold )
|
|
2096 {
|
|
2097 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful);
|
|
2098 v2 = pParty->uNumGold;
|
|
2099 }
|
|
2100 if ( v2 > pParty->uFine )
|
|
2101 v2 = pParty->uFine;
|
|
2102 Party::TakeGold(v2);
|
|
2103 pParty->uFine -= v2;
|
|
2104 if ( pParty->uFine < 0 )
|
|
2105 pParty->uFine = 0;
|
|
2106 if ( uActiveCharacter )
|
|
2107 pPlayers[uActiveCharacter]->PlaySound(SPEECH_81, 0);
|
|
2108 v0 = window_SpeakInHouse;
|
|
2109 }
|
|
2110 if ( window_SpeakInHouse->receives_keyboard_input_2 == WINDOW_INPUT_CANCELLED)
|
|
2111 {
|
|
2112 v0->receives_keyboard_input_2 = WINDOW_INPUT_NONE;
|
|
2113 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
|
|
2114 }
|
|
2115 break;
|
|
2116 }
|
|
2117 default:
|
|
2118 {
|
|
2119 break;
|
|
2120 }
|
|
2121 }
|
|
2122 return;
|
|
2123 }
|
|
2124
|
|
2125 //----- (004B7D7E) --------------------------------------------------------
|
|
2126 void __cdecl BankDialog()
|
|
2127 {
|
|
2128 GUIWindow *v0; // eax@4
|
|
2129 //int v1; // ecx@5
|
|
2130 int v2; // eax@6
|
|
2131 unsigned int v3; // esi@6
|
|
2132 GUIFont *v4; // ST10_4@12
|
|
2133 int v5; // eax@12
|
|
2134 int v6; // eax@19
|
|
2135 unsigned int v7; // esi@19
|
|
2136 unsigned __int16 v8; // ax@27
|
|
2137 unsigned __int16 v9; // ax@29
|
|
2138 char *v10; // [sp-8h] [bp-70h]@11
|
|
2139 char *v11; // [sp-4h] [bp-6Ch]@11
|
|
2140 GUIWindow _this; // [sp+Ch] [bp-5Ch]@1
|
|
2141 __int16 v13[2]; // [sp+60h] [bp-8h]@1
|
|
2142 __int16 v14[2]; // [sp+64h] [bp-4h]@1
|
|
2143
|
|
2144 memcpy(&_this, window_SpeakInHouse, sizeof(_this));
|
|
2145 _this.uFrameX = 483;
|
|
2146 _this.uFrameWidth = 148;
|
|
2147 _this.uFrameZ = 334;
|
|
2148 *(int *)v13 = TargetColor(0xFFu, 0xFFu, 0xFFu);
|
|
2149 *(int *)v14 = TargetColor(0xFFu, 0xFFu, 0x9Bu);
|
|
2150 sprintf(pTmpBuf.data(), "%s: %d", pGlobalTXT_LocalizationStrings[25], pParty->uNumGoldInBank);
|
|
2151 _this.DrawTitleText(pFontArrus, 0, 0xDCu, v14[0], pTmpBuf.data(), 3u);
|
|
2152 switch(dialog_menu_id)
|
|
2153 {
|
|
2154 case HOUSE_DIALOGUE_MAIN:
|
|
2155 {
|
|
2156 v8 = v14[0];
|
|
2157 if ( pDialogueWindow->pCurrentPosActiveItem != 2 )
|
|
2158 v8 = v13[0];
|
|
2159 _this.DrawTitleText(pFontArrus, 0, 0x92u, v8, pGlobalTXT_LocalizationStrings[60], 3u);
|
|
2160 v9 = v14[0];
|
|
2161 if ( pDialogueWindow->pCurrentPosActiveItem != 3 )
|
|
2162 v9 = v13[0];
|
|
2163 _this.DrawTitleText(pFontArrus, 0, 0xB0u, v9, pGlobalTXT_LocalizationStrings[244], 3u);
|
|
2164 break;
|
|
2165 }
|
|
2166 case HOUSE_DIALOGUE_BANK_7:
|
|
2167 {
|
|
2168 v0 = window_SpeakInHouse;
|
|
2169 if ( window_SpeakInHouse->receives_keyboard_input_2 != WINDOW_INPUT_IN_PROGRESS)
|
|
2170 {
|
|
2171 if ( window_SpeakInHouse->receives_keyboard_input_2 == WINDOW_INPUT_CONFIRMED)
|
|
2172 {
|
|
2173 v6 = atoi((const char *)pKeyActionMap->pPressedKeysBuffer);
|
|
2174 v7 = v6;
|
|
2175 if ( !v6 )
|
|
2176 {
|
|
2177 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
|
|
2178 return;
|
|
2179 }
|
|
2180 if ( v6 > pParty->uNumGold )
|
|
2181 {
|
|
2182 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful);
|
|
2183 v7 = pParty->uNumGold;
|
|
2184 }
|
|
2185 if ( v7 )
|
|
2186 {
|
|
2187 Party::TakeGold(v7);
|
|
2188 pParty->uNumGoldInBank += v7;
|
|
2189 if ( uActiveCharacter )
|
|
2190 pPlayers[uActiveCharacter]->PlaySound(SPEECH_81, 0);
|
|
2191 }
|
|
2192 v0 = window_SpeakInHouse;
|
|
2193 v0->receives_keyboard_input_2 = WINDOW_INPUT_NONE;
|
|
2194 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
|
|
2195 return;
|
|
2196 }
|
|
2197 if (window_SpeakInHouse->receives_keyboard_input_2 != WINDOW_INPUT_CANCELLED)
|
|
2198 return;
|
|
2199 v0->receives_keyboard_input_2 = WINDOW_INPUT_NONE;
|
|
2200 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
|
|
2201 return;
|
|
2202 }
|
|
2203 v11 = pGlobalTXT_LocalizationStrings[112];
|
|
2204 v10 = pGlobalTXT_LocalizationStrings[60];
|
|
2205 sprintf(pTmpBuf.data(), "%s\n%s", v10, v11);
|
|
2206 _this.DrawTitleText(pFontArrus, 0, 0x92u, v14[0], pTmpBuf.data(), 3u);
|
|
2207 _this.DrawTitleText(pFontArrus, 0, 0xBAu, v13[0], (const char *)pKeyActionMap->pPressedKeysBuffer, 3u);
|
|
2208 v4 = pFontArrus;
|
|
2209 v5 = pFontArrus->GetLineWidth((const char *)pKeyActionMap->pPressedKeysBuffer);
|
|
2210 _this.DrawFlashingInputCursor(v5 / 2 + 80, 185, v4);
|
|
2211 break;
|
|
2212 }
|
|
2213
|
|
2214 case HOUSE_DIALOGUE_BANK_8:
|
|
2215 {
|
|
2216 v0 = window_SpeakInHouse;
|
|
2217 if ( window_SpeakInHouse->receives_keyboard_input_2 != WINDOW_INPUT_IN_PROGRESS)
|
|
2218 {
|
|
2219 if ( window_SpeakInHouse->receives_keyboard_input_2 == WINDOW_INPUT_CONFIRMED)
|
|
2220 {
|
|
2221 window_SpeakInHouse->receives_keyboard_input_2 = WINDOW_INPUT_NONE;
|
|
2222 v2 = atoi((const char *)pKeyActionMap->pPressedKeysBuffer);
|
|
2223 v3 = v2;
|
|
2224 if ( v2 )
|
|
2225 {
|
|
2226 if ( v2 > pParty->uNumGoldInBank )
|
|
2227 {
|
|
2228 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful);
|
|
2229 v3 = pParty->uNumGoldInBank;
|
|
2230 }
|
|
2231 if ( v3 )
|
|
2232 {
|
|
2233 Party::SetGold(pParty->uNumGold + v3);
|
|
2234 pParty->uNumGoldInBank -= v3;
|
|
2235 }
|
|
2236 }
|
|
2237 v0->receives_keyboard_input_2 = WINDOW_INPUT_NONE;
|
|
2238 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
|
|
2239 return;
|
|
2240 }
|
|
2241 if ( window_SpeakInHouse->receives_keyboard_input_2 != WINDOW_INPUT_CANCELLED)
|
|
2242 return;
|
|
2243 v0->receives_keyboard_input_2 = WINDOW_INPUT_NONE;
|
|
2244 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
|
|
2245 return;
|
|
2246 }
|
|
2247 v11 = pGlobalTXT_LocalizationStrings[112];
|
|
2248 v10 = pGlobalTXT_LocalizationStrings[244];
|
|
2249 sprintfex(pTmpBuf.data(), "%s\n%s", v10, v11);
|
|
2250 _this.DrawTitleText(pFontArrus, 0, 0x92u, v14[0], pTmpBuf.data(), 3u);
|
|
2251 _this.DrawTitleText(pFontArrus, 0, 0xBAu, v13[0], (const char *)pKeyActionMap->pPressedKeysBuffer, 3u);
|
|
2252 v4 = pFontArrus;
|
|
2253 v5 = pFontArrus->GetLineWidth((const char *)pKeyActionMap->pPressedKeysBuffer);
|
|
2254 _this.DrawFlashingInputCursor(v5 / 2 + 80, 185, v4);
|
|
2255 return;
|
|
2256 break;
|
|
2257 }
|
|
2258
|
|
2259 default:
|
|
2260 {
|
|
2261 break;
|
|
2262 }
|
|
2263 }
|
|
2264 }
|
|
2265 // F8B19C: using guessed type int dword_F8B19C;
|
|
2266
|
|
2267 //----- (004B8285) --------------------------------------------------------
|
|
2268 void __cdecl TavernDialog()
|
|
2269 {
|
|
2270 int v0;
|
|
2271 int pItemNum;
|
|
2272 double v2; // st7@1
|
|
2273 signed int v3; // ebx@1
|
|
2274 int v4; // ecx@1
|
|
2275 int v5; // esi@3
|
|
2276 signed int v6; // edi@5
|
|
2277 int v7; // ecx@5
|
|
2278 int pNumString; // edi@16
|
|
2279 signed int v9; // esi@16
|
|
2280 unsigned int pNumActiveItem; // esi@18
|
|
2281 int v11; // eax@18
|
|
2282 unsigned int v12; // eax@19
|
|
2283 int v13; // eax@21
|
|
2284 int v14; // ecx@26
|
|
2285 //GUIButton *v15; // eax@28
|
|
2286 //GUIButton *v16; // esi@28
|
|
2287 int v17; // eax@28
|
|
2288 char *v18; // eax@30
|
|
2289 int v19; // eax@30
|
|
2290 unsigned int v20; // ecx@30
|
|
2291 int v21; // edx@30
|
|
2292 int v22; // eax@30
|
|
2293 unsigned __int16 v23; // ax@30
|
|
2294 int v24; // eax@34
|
|
2295 int v25; // eax@34
|
|
2296 char *v26; // esi@36
|
|
2297 int v27; // edi@46
|
|
2298 unsigned int pColorText; // eax@57
|
|
2299 signed int v31; // eax@59
|
|
2300 //GUIWindow *v33; // edi@64
|
|
2301 int v34; // eax@64
|
|
2302 int v35; // ecx@64
|
|
2303 int v36; // esi@64
|
|
2304 char v37; // sf@64
|
|
2305 GUIButton *pButton; // eax@65
|
|
2306 int v39; // edx@69
|
|
2307 int v40; // ecx@69
|
|
2308 int v41; // ecx@69
|
|
2309 int v42; // ecx@70
|
|
2310 unsigned int v43; // edx@70
|
|
2311 int v44; // edx@71
|
|
2312 int v45; // ecx@71
|
|
2313 int v46; // ecx@72
|
|
2314 int v47; // eax@74
|
|
2315 signed int v48; // edi@77
|
|
2316 signed int i; // esi@79
|
|
2317 int v50; // eax@80
|
|
2318 //GUIWindow *v51; // ecx@81
|
|
2319 _QWORD v52; // qax@81
|
|
2320 signed int v53; // edi@81
|
|
2321 int v54; // edi@81
|
|
2322 //GUIButton *v55; // esi@83
|
|
2323 const char **v56; // eax@83
|
|
2324 int v57; // eax@83
|
|
2325 unsigned int v58; // ecx@83
|
|
2326 //Player *v59; // edx@83
|
|
2327 unsigned __int16 v60; // ax@83
|
|
2328 int v61; // eax@99
|
|
2329 char *v63; // eax@99
|
|
2330 GUIFont *v64; // edx@99
|
|
2331 GUIFont *v65; // edi@100
|
|
2332 unsigned int v66; // [sp-10h] [bp-284h]@75
|
|
2333 unsigned __int16 v67; // [sp-Ch] [bp-280h]@75
|
|
2334 int v68; // [sp-Ch] [bp-280h]@99
|
|
2335 char *v69; // [sp-8h] [bp-27Ch]@75
|
|
2336 int v70; // [sp-8h] [bp-27Ch]@99
|
|
2337 unsigned int v71; // [sp-4h] [bp-278h]@75
|
|
2338 const char *v72; // [sp-4h] [bp-278h]@93
|
|
2339 unsigned int v73; // [sp-4h] [bp-278h]@99
|
|
2340 char pTopic1[100]; // [sp+Ch] [bp-268h]@55
|
|
2341 char pTopic4[100]; // [sp+70h] [bp-204h]@59
|
|
2342 char pTopic2[100]; // [sp+D4h] [bp-1A0h]@57
|
|
2343 char pTopic3[100]; // [sp+138h] [bp-13Ch]@59
|
|
2344 //GUIWindow v78; // [sp+19Ch] [bp-D8h]@99
|
|
2345 GUIWindow dialog_window; // [sp+1F0h] [bp-84h]@1
|
|
2346 char *Str[2]; // [sp+244h] [bp-30h]@30
|
|
2347 unsigned int pColorWhite; // [sp+24Ch] [bp-28h]@1
|
|
2348 unsigned __int8 pTopic3Height; // [sp+253h] [bp-21h]@59
|
|
2349 int v83; // [sp+254h] [bp-20h]@1
|
|
2350 int pColorYellow; // [sp+258h] [bp-1Ch]@1
|
|
2351 Player *pPlayer; // [sp+25Ch] [bp-18h]@1
|
|
2352 int all_text_height; // [sp+260h] [bp-14h]@18
|
|
2353 unsigned __int8 v87; // [sp+266h] [bp-Eh]@59
|
|
2354 unsigned __int8 pTopic2Height; // [sp+267h] [bp-Dh]@57
|
|
2355 int v89; // [sp+268h] [bp-Ch]@1
|
|
2356 unsigned int pTopic1Height; // [sp+26Fh] [bp-5h]@55
|
|
2357 int v91; // [sp+270h] [bp-4h]@3
|
|
2358 GUIFont *pOutString;
|
|
2359 unsigned __int8 pTopic4Height;
|
|
2360 int pTextHeight;
|
|
2361
|
|
2362 pPlayer = pPlayers[uActiveCharacter];
|
|
2363 memcpy(&dialog_window, window_SpeakInHouse, sizeof(dialog_window));
|
|
2364 dialog_window.uFrameX = 483;
|
|
2365 dialog_window.uFrameWidth = 148;
|
|
2366 dialog_window.uFrameZ = 334;
|
|
2367 pColorWhite = TargetColor(0xFFu, 0xFFu, 0xFFu);
|
|
2368 pColorYellow = TargetColor(0xFFu, 0xFFu, 0x9Bu);
|
|
2369 v2 = p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier;
|
|
2370 *(float *)&v83 = v2;
|
|
2371 *(float *)&v89 = v2 * v2;
|
|
2372 v3 = (signed __int64)(*(float *)&v89 * 0.1);
|
|
2373 pItemNum = v3 * (100 - pPlayer->GetMerchant()) / 100;
|
|
2374 if ( pItemNum < v3 / 3 )
|
|
2375 pItemNum = v3 / 3;
|
|
2376 v5 = 1;
|
|
2377 pOutString = (GUIFont *)pItemNum;
|
|
2378 if ( pItemNum <= 0 )
|
|
2379 pOutString = (GUIFont *)1;
|
|
2380 v6 = (signed __int64)(*(float *)&v89 * *(float *)&v83 * 0.0099999998);
|
|
2381 v7 = v6 * (100 - pPlayer->GetMerchant()) / 100;
|
|
2382 if ( v7 < v6 / 3 )
|
|
2383 v7 = v6 / 3;
|
|
2384 v83 = v7;
|
|
2385 if ( v7 <= 0 )
|
|
2386 {
|
|
2387 v7 = 1;
|
|
2388 v83 = 1;
|
|
2389 }
|
|
2390
|
|
2391 switch(dialog_menu_id)
|
|
2392 {
|
|
2393 case HOUSE_DIALOGUE_MAIN:
|
|
2394 {
|
1393
|
2395 if ( !HouseUI_CheckIfPlayerCanInteract() )
|
1298
|
2396 return;
|
|
2397
|
|
2398 sprintf(pTopic1, "\f%05d", pDialogueWindow->pCurrentPosActiveItem == 2 ? pColorYellow : pColorWhite);
|
|
2399 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[178], pOutString); // Rent room for %d gold
|
|
2400 strcat(pTopic1, pTmpBuf2.data());
|
|
2401 pTopic1Height = pFontArrus->CalcTextHeight(pTopic1, &dialog_window, 0, 0);
|
|
2402 strcat(pTopic1, "\n \n");
|
|
2403
|
|
2404 sprintf(pTopic2, "\f%05d", pDialogueWindow->pCurrentPosActiveItem == 3 ? pColorYellow : pColorWhite);
|
|
2405 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[86], // Buy food for %d days for %d gold
|
|
2406 (unsigned int)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier, v83);
|
|
2407 strcat(pTopic2, pTmpBuf2.data());
|
|
2408 pTopic2Height = pFontArrus->CalcTextHeight(pTopic2, &dialog_window, 0, 0);
|
|
2409 strcat(pTopic2, "\n \n");
|
|
2410
|
|
2411 sprintf(pTopic3, "\f%05d", pDialogueWindow->pCurrentPosActiveItem == 4 ? pColorYellow : pColorWhite);
|
|
2412 strcat(pTopic3, pGlobalTXT_LocalizationStrings[160]); // Learn Skills
|
|
2413 pTopic3Height = pFontArrus->CalcTextHeight(pTopic3, &dialog_window, 0, 0);
|
|
2414 strcat(pTopic3, "\n \n");
|
|
2415 pTopic4[0] = 0;
|
|
2416 if ( (signed int)window_SpeakInHouse->par1C >= 108 && (signed int)window_SpeakInHouse->par1C <= 120 )
|
|
2417 {
|
|
2418 sprintf(pTopic4, "\f%05d", pDialogueWindow->pCurrentPosActiveItem == 5 ? pColorYellow : pColorWhite);
|
|
2419 strcat(pTopic4, pGlobalTXT_LocalizationStrings[611]); // Play Arcomage
|
|
2420 pTopic4Height = pFontArrus->CalcTextHeight(pTopic4, &dialog_window, 0, 0);
|
|
2421 }
|
|
2422 pNumActiveItem = pDialogueWindow->pStartingPosActiveItem;
|
|
2423 v36 = LOBYTE(pFontArrus->uFontHeight) - 3;
|
|
2424 v37 = -pDialogueWindow->pNumPresenceButton < 0;
|
|
2425 if ( !(v37 ^ (pNumActiveItem < pNumActiveItem + pDialogueWindow->pNumPresenceButton)) )
|
|
2426 {
|
|
2427 do
|
|
2428 {
|
|
2429 pButton = pDialogueWindow->GetControl(pNumActiveItem);
|
|
2430 if ( pButton->msg_param == 15 )
|
|
2431 {
|
|
2432 v46 = pTopic1Height;
|
|
2433 pButton->uHeight = pTopic1Height;
|
|
2434 pButton->uY = 146;
|
|
2435 v41 = v46 + 145;
|
|
2436 pButton->uW = v41;
|
|
2437 }
|
|
2438 else if ( pButton->msg_param == 16 )
|
|
2439 {
|
|
2440 v44 = pTopic2Height;
|
|
2441 v45 = pTopic1Height + v36 + 146;
|
|
2442 pButton->uHeight = pTopic2Height;
|
|
2443 pButton->uY = v45;
|
|
2444 v41 = v45 + v44 - 1;
|
|
2445 pButton->uW = v41;
|
|
2446 }
|
|
2447 else if ( pButton->msg_param == 96 )
|
|
2448 {
|
|
2449 v42 = pTopic1Height + pTopic2Height + 2 * v36 + 146;
|
|
2450 v43 = pTopic3Height;
|
|
2451 pButton->uY = v42;
|
|
2452 pButton->uHeight = v43;
|
|
2453 v41 = v43 + v42 - 1;
|
|
2454 pButton->uW = v41;
|
|
2455 }
|
|
2456 else if ( pButton->msg_param == 101 )
|
|
2457 {
|
|
2458 v39 = pTopic1Height + 3 * v36 + pTopic4Height + pTopic2Height + 146;
|
|
2459 v40 = pTopic4Height;
|
|
2460 pButton->uHeight = pTopic4Height;
|
|
2461 pButton->uY = v39;
|
|
2462 v41 = v39 + v40 - 1;
|
|
2463 pButton->uW = v41;
|
|
2464 }
|
|
2465 pNumActiveItem++;
|
|
2466 if ( pNumActiveItem >= pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem )
|
|
2467 {
|
1396
|
2468 sprintfex(pTmpBuf.data(), "%s%s%s%s", pTopic1, pTopic2, pTopic3, pTopic4);
|
1298
|
2469 dialog_window.DrawTitleText(pFontArrus, 0, 146, 0, pTmpBuf.data(), 3);
|
|
2470 }
|
|
2471 }
|
|
2472 while ( pNumActiveItem < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton );
|
|
2473 }
|
|
2474 break;
|
|
2475 }
|
|
2476 case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_RULES:
|
|
2477 {
|
|
2478 pOutString = pFontArrus;
|
|
2479 strcpy(pTmpBuf.data(), pNPCTopics[354].pText);
|
|
2480 dialog_window.uFrameWidth = game_viewport_width;
|
|
2481 dialog_window.uFrameZ = 452;
|
|
2482 pTextHeight = pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 12, 0) + 7;
|
|
2483 if ( 352 - pTextHeight < 8 )
|
|
2484 {
|
|
2485 pOutString = pFontCreate;
|
|
2486 pTextHeight = pFontCreate->CalcTextHeight(pTmpBuf.data(), &dialog_window, 12, 0) + 7;
|
|
2487 }
|
|
2488 auto pTex = pIcons_LOD->GetTexture(uTextureID_Leather);
|
|
2489 pRenderer->_4A6A68(8, 352 - pTextHeight, pTex, pTex->uTextureHeight - pTextHeight);
|
|
2490 pRenderer->DrawTextureIndexed(8, 347 - pTextHeight, pTexture_591428);
|
|
2491 v63 = FitTextInAWindow(pTmpBuf.data(), pOutString, &dialog_window, 0xCu, 0);
|
|
2492 window_SpeakInHouse->DrawText(pOutString, 12, 354 - pTextHeight, 0, v63, 0, 0, 0);
|
|
2493 break;
|
|
2494 }
|
|
2495 case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_VICTORY_CONDITIONS:
|
|
2496 {
|
|
2497 strcpy(pTmpBuf.data(), pNPCTopics[(uint)window_SpeakInHouse->ptr_1C + 247].pText);
|
|
2498 dialog_window.uFrameWidth = game_viewport_width;
|
|
2499 dialog_window.uFrameZ = 452;
|
|
2500 v61 = pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 12, 0);
|
|
2501 pTextHeight = v61 + 7;
|
|
2502 auto pTex = pIcons_LOD->GetTexture(uTextureID_Leather);
|
|
2503 pRenderer->_4A6A68(8, 352 - (v61 + 7), pTex, pTex->uTextureHeight - (v61 + 7));
|
|
2504 pRenderer->DrawTextureIndexed(8, 347 - pTextHeight, pTexture_591428);
|
|
2505 v63 = FitTextInAWindow(pTmpBuf.data(), pFontArrus, &dialog_window, 0xCu, 0);
|
|
2506 window_SpeakInHouse->DrawText(pFontArrus, 12, 354 - pTextHeight, 0, v63, 0, 0, 0);
|
|
2507 break;
|
|
2508 }
|
|
2509 case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_RESULT:
|
|
2510 {
|
|
2511 if ( pArcomageGame->bGameInProgress == 1 )
|
|
2512 return;
|
|
2513 if ( pArcomageGame->uGameResult )
|
|
2514 {
|
|
2515 if ( pArcomageGame->uGameResult == 1 )
|
|
2516 v72 = pGlobalTXT_LocalizationStrings[640];// You won!
|
|
2517 else
|
|
2518 v72 = pGlobalTXT_LocalizationStrings[641];// You lost!
|
|
2519 }
|
|
2520 else
|
|
2521 {
|
|
2522 v72 = pGlobalTXT_LocalizationStrings[639];// A tie!
|
|
2523 }
|
|
2524 strcpy(pTmpBuf.data(), v72);
|
|
2525 v66 = (174 - pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 0, 0)) / 2 + 138;
|
|
2526 dialog_window.DrawTitleText(pFontArrus, 0, v66, pColorYellow, pTmpBuf.data(), 3);
|
|
2527 break;
|
|
2528 }
|
|
2529 case HOUSE_DIALOGUE_TAVERN_REST:
|
|
2530 {
|
|
2531 if ( pParty->uNumGold >= (unsigned int)pOutString )
|
|
2532 {
|
|
2533 Party::TakeGold((unsigned int)pOutString);
|
|
2534 v27 = (int)window_SpeakInHouse->ptr_1C;//107
|
|
2535 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful);
|
|
2536 dialog_menu_id = HOUSE_DIALOGUE_NULL;
|
|
2537 sub_4BD8B5();
|
1407
|
2538 GetHouseGoodbyeSpeech();
|
1298
|
2539 pVideoPlayer->Unload();
|
|
2540 window_SpeakInHouse->Release();
|
|
2541 window_SpeakInHouse = 0;
|
|
2542 if ( pMessageQueue_50CBD0->uNumMessages )
|
|
2543 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
|
|
2544 pMessageQueue_50CBD0->pMessages[0].eType = UIMSG_RentRoom;
|
|
2545 pMessageQueue_50CBD0->pMessages[0].param = v27;
|
|
2546 pMessageQueue_50CBD0->pMessages[0].field_8 = 1;
|
|
2547 ++pMessageQueue_50CBD0->uNumMessages;
|
|
2548 return;
|
|
2549 }
|
|
2550 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);
|
|
2551 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_Goodbye);
|
|
2552 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, v5, 0);
|
|
2553 break;
|
|
2554 }
|
|
2555
|
|
2556 case HOUSE_DIALOGUE_LEARN_SKILLS:
|
|
2557 {
|
1393
|
2558 if ( !HouseUI_CheckIfPlayerCanInteract() )
|
1298
|
2559 return;
|
|
2560 v0 = 0;
|
|
2561 v9 = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0);
|
|
2562 pItemNum = v9 * (100 - pPlayer->GetMerchant()) / 100;
|
|
2563 if ( pItemNum < v9 / 3 )
|
|
2564 pItemNum = v9 / 3;
|
|
2565 pNumActiveItem = pDialogueWindow->pStartingPosActiveItem;
|
|
2566 all_text_height = 0;
|
|
2567 if ( pNumActiveItem < pNumActiveItem + pDialogueWindow->pNumPresenceButton )
|
|
2568 {
|
|
2569 do
|
|
2570 {
|
|
2571 v12 = pDialogueWindow->GetControl(pNumActiveItem)->msg_param - 36;
|
|
2572 if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayer->classType][v12] && !pPlayer->pActiveSkills[v12] )
|
|
2573 {
|
|
2574 all_text_height = pFontArrus->CalcTextHeight(pSkillNames[v12], &dialog_window, 0, 0);
|
|
2575 v0++;
|
|
2576 }
|
|
2577 ++pNumActiveItem;
|
|
2578 }
|
|
2579 while ( pNumActiveItem < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton );
|
|
2580 if ( v0 )
|
|
2581 {
|
|
2582 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[401], pItemNum);
|
|
2583 dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3);
|
|
2584 v91 = (149 - all_text_height) / v0;
|
|
2585 if ( (149 - all_text_height) / v0 > 32 )
|
|
2586 v91 = 32;
|
|
2587 v14 = (149 - v0 * v91 - all_text_height) / 2 - v91 / 2 + 162;
|
|
2588 pNumActiveItem = pDialogueWindow->pStartingPosActiveItem;
|
|
2589 if ( pNumActiveItem < pNumActiveItem + pDialogueWindow->pNumPresenceButton )
|
|
2590 {
|
|
2591 pItemNum = 2;
|
|
2592 do
|
|
2593 {
|
|
2594 pButton = pDialogueWindow->GetControl(pItemNum);
|
|
2595 v17 = pButton->msg_param - 36;
|
|
2596 if ( !byte_4ED970_skill_learn_ability_by_class_table[pPlayer->classType][v17] || pPlayer->pActiveSkills[v17] )
|
|
2597 {
|
|
2598 pButton->uW = 0;
|
|
2599 pButton->uHeight = 0;
|
|
2600 pButton->uY = 0;
|
|
2601 }
|
|
2602 else
|
|
2603 {
|
|
2604 pButton->uY = v91 + v14;
|
|
2605 pTextHeight = pFontArrus->CalcTextHeight(pSkillNames[v17], &dialog_window, 0, 0);
|
|
2606 pButton->uHeight = pTextHeight;
|
|
2607 v14 = pTextHeight + pButton->uY - 1;
|
|
2608 pButton->uW = v14;
|
|
2609 pColorText = pColorYellow;
|
|
2610 if ( pDialogueWindow->pCurrentPosActiveItem != pItemNum )
|
|
2611 pColorText = pColorWhite;
|
|
2612 dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, pSkillNames[v17], 3);
|
|
2613 }
|
|
2614 pNumActiveItem = pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton;
|
|
2615 pItemNum++;
|
|
2616 }
|
|
2617 while ( pItemNum < pNumActiveItem );
|
|
2618 }
|
|
2619 return;
|
|
2620 }
|
|
2621 }
|
|
2622 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayer->pName, pClassNames[pPlayer->classType]);
|
|
2623 strcat(pTmpBuf.data(), "\n \n");
|
|
2624 strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]);
|
|
2625 pTextHeight = (174 - pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 0, 0)) / 2 + 138;
|
|
2626 dialog_window.DrawTitleText(pFontArrus, 0, pTextHeight, pColorYellow, pTmpBuf.data(), 3);
|
|
2627 return;
|
|
2628 }
|
|
2629
|
|
2630 case HOUSE_DIALOGUE_TAVERN_BUY_FOOD:
|
|
2631 {
|
|
2632 *(_QWORD *)Str = pParty->uNumFoodRations;
|
|
2633 //if ( (double)pParty->uNumFoodRations >= p2DEvents_minus1__20[13 * (unsigned int)ptr_507BC0->ptr_1C] )
|
|
2634 if ( (double)pParty->uNumFoodRations >= p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier )
|
|
2635 {
|
|
2636 ShowStatusBarString(pGlobalTXT_LocalizationStrings[140], 2);
|
|
2637 if ( uActiveCharacter )
|
|
2638 pPlayers[uActiveCharacter]->PlaySound(SPEECH_67, 0);
|
|
2639 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, v5, 0);
|
|
2640 return;
|
|
2641 }
|
|
2642 if ( pParty->uNumGold >= v7 )
|
|
2643 {
|
|
2644 Party::TakeGold(v7);
|
|
2645 //pParty->uNumFoodRations = (signed __int64)p2DEvents_minus1__20[13 * (unsigned int)ptr_507BC0->ptr_1C];
|
|
2646 pParty->uNumFoodRations = (signed __int64)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier;
|
|
2647 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_Greeting_2);
|
|
2648 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
|
|
2649 return;
|
|
2650 }
|
|
2651 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2); // "You don't have enough gold"
|
|
2652 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_Goodbye);
|
|
2653 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, v5, 0);
|
|
2654 break;
|
|
2655 }
|
|
2656
|
|
2657 case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_MAIN:
|
|
2658 {
|
1393
|
2659 if ( HouseUI_CheckIfPlayerCanInteract() )
|
1298
|
2660 {
|
|
2661 v48 = 2;
|
|
2662 pShopOptions[0] = pGlobalTXT_LocalizationStrings[620];
|
|
2663 pShopOptions[1] = pGlobalTXT_LocalizationStrings[622];
|
|
2664 pOutString = 0;
|
|
2665 if ( pParty->HasItem(0x28Bu) )
|
|
2666 {
|
|
2667 pShopOptions[2] = pGlobalTXT_LocalizationStrings[621];
|
|
2668 v48 = 3;
|
|
2669 }
|
|
2670 for ( i = 0; i < v48; ++i )
|
|
2671 all_text_height = pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0);
|
|
2672 all_text_height = (174 - all_text_height) / v48;
|
|
2673 pNumActiveItem = pDialogueWindow->pStartingPosActiveItem;
|
|
2674 v54 = (174 - v48 * (174 - all_text_height) / v48 - all_text_height) / 2 - (174 - all_text_height) / v48 / 2 + 138;
|
|
2675 v37 = -pDialogueWindow->pNumPresenceButton < 0;
|
|
2676 if ( pNumActiveItem < pNumActiveItem + pDialogueWindow->pNumPresenceButton )
|
|
2677 {
|
|
2678 pItemNum = 2;
|
|
2679 pNumString = 0;
|
|
2680 do
|
|
2681 {
|
|
2682 pButton = pDialogueWindow->GetControl(pItemNum);
|
|
2683 pButton->uY = all_text_height + v54;
|
|
2684 pTextHeight = pFontArrus->CalcTextHeight((const char *)pShopOptions[pNumString], &dialog_window, 0, 0);
|
|
2685 pButton->uHeight = pTextHeight;
|
|
2686 v54 = pButton->uY + pTextHeight - 1;
|
|
2687 pButton->uW = v54;
|
|
2688 pColorText = pColorYellow;
|
|
2689 if ( pDialogueWindow->pCurrentPosActiveItem != pItemNum )
|
|
2690 pColorText = pColorWhite;
|
|
2691 dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, (const char *)pShopOptions[pNumString], 3);
|
|
2692 pItemNum++;
|
|
2693 ++pNumString;
|
|
2694 pNumActiveItem = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem;
|
|
2695 }
|
|
2696 while ( pItemNum < pNumActiveItem );
|
|
2697 }
|
|
2698 }
|
|
2699 break;
|
|
2700 }
|
|
2701 default:
|
|
2702 {
|
|
2703 break;
|
|
2704 }
|
|
2705 }
|
|
2706 }
|
|
2707
|
|
2708 //----- (004B705E) --------------------------------------------------------
|
|
2709 void TempleDialog()
|
|
2710 {
|
|
2711 GUIWindow *v0; // ebx@1
|
|
2712 Player *v1; // esi@1
|
|
2713 int v2; // edi@1
|
|
2714 int result; // eax@4
|
|
2715 GUIWindow *v4; // edi@6
|
|
2716 void *v5; // eax@6
|
|
2717 int v6; // eax@6
|
|
2718 unsigned int v7; // eax@8
|
|
2719 int v8; // ecx@8
|
|
2720 unsigned int v9; // eax@9
|
|
2721 int v10; // eax@11
|
|
2722 int v11; // eax@12
|
|
2723 GUIWindow *v12; // ecx@16
|
|
2724 int v13; // edx@16
|
|
2725 GUIButton *v14; // eax@19
|
|
2726 GUIButton *v15; // edi@19
|
|
2727 int v16; // eax@19
|
|
2728 const char *v17; // eax@21
|
|
2729 int v18; // eax@21
|
|
2730 unsigned int v19; // ecx@21
|
|
2731 int v20; // eax@21
|
|
2732 unsigned __int16 v21; // ax@21
|
|
2733 unsigned __int16 v22; // ST14_2@27
|
|
2734 int v23; // eax@27
|
|
2735 double v24; // st7@28
|
|
2736 unsigned int v25; // ebx@28
|
|
2737 DDM_DLV_Header *v26; // edi@29
|
|
2738 int v27; // eax@31
|
|
2739 int v28; // eax@32
|
|
2740 //unsigned int v29; // ecx@34
|
|
2741 unsigned int v30; // edx@36
|
|
2742 unsigned int v31; // edx@38
|
|
2743 unsigned int v32; // edx@40
|
|
2744 unsigned int v33; // edx@42
|
|
2745 unsigned int v34; // edx@44
|
|
2746 int v35; // edi@50
|
|
2747 signed int v36; // eax@50
|
|
2748 unsigned __int8 v37; // al@54
|
|
2749 int v38; // ecx@54
|
|
2750 GUIWindow *v39; // eax@56
|
|
2751 unsigned __int8 v40; // al@61
|
|
2752 GUIButton *v41; // edi@64
|
|
2753 int v42; // esi@66
|
|
2754 GUIWindow *v43; // ecx@66
|
|
2755 int v44; // edi@66
|
|
2756 int v45; // eax@68
|
|
2757 signed int v46; // edi@69
|
|
2758 int v47; // edi@71
|
|
2759 GUIButton *v48; // eax@73
|
|
2760 const char *v49; // edx@73
|
|
2761 GUIButton *v50; // esi@73
|
|
2762 int v51; // eax@73
|
|
2763 unsigned int v52; // ecx@73
|
|
2764 unsigned __int16 v53; // ax@73
|
|
2765 char a1[300]; // [sp+10h] [bp-1B4h]@64
|
|
2766 GUIWindow v57; // [sp+13Ch] [bp-88h]@1
|
|
2767 __int64 v58; // [sp+190h] [bp-34h]@1
|
|
2768 __int64 v59; // [sp+198h] [bp-2Ch]@1
|
|
2769 __int64 v60; // [sp+1A0h] [bp-24h]@1
|
|
2770 GUIWindow *v61; // [sp+1ACh] [bp-18h]@6
|
|
2771 unsigned int v62; // [sp+1B0h] [bp-14h]@8
|
|
2772 unsigned __int8 v63; // [sp+1B7h] [bp-Dh]@64
|
|
2773 int v64; // [sp+1B8h] [bp-Ch]@6
|
|
2774 unsigned int v65; // [sp+1BCh] [bp-8h]@6
|
|
2775 DDM_DLV_Header *v66; // [sp+1C0h] [bp-4h]@6
|
|
2776
|
|
2777 v0 = window_SpeakInHouse;
|
|
2778 memcpy(&v57, window_SpeakInHouse, sizeof(v57));
|
|
2779 v57.uFrameX = 483;
|
|
2780 v57.uFrameWidth = 148;
|
|
2781 v57.uFrameZ = 334;
|
|
2782 HIDWORD(v58) = TargetColor(0xFFu, 0xFFu, 0xFFu);
|
|
2783 HIDWORD(v59) = TargetColor(0xFFu, 0xFFu, 0x9Bu);
|
|
2784 v1 = pPlayers[uActiveCharacter];
|
|
2785 //v2 = pPlayers[uActiveCharacter]->_4B807C(p2DEvents_minus1__20[13 * (unsigned int)v0->ptr_1C]);
|
|
2786 v2 = pPlayers[uActiveCharacter]->GetTempleHealCostModifier(p2DEvents[v0->par1C - 1].fPriceMultiplier);
|
|
2787 HIDWORD(v60) = v2;
|
|
2788 if ( dialog_menu_id != HOUSE_DIALOGUE_MAIN )
|
|
2789 {
|
|
2790 if ( dialog_menu_id != HOUSE_DIALOGUE_TEMPLE_HEAL )
|
|
2791 {
|
|
2792 if ( dialog_menu_id != HOUSE_DIALOGUE_TEMPLE_DONATE )
|
|
2793 {
|
|
2794 if ( dialog_menu_id == HOUSE_DIALOGUE_LEARN_SKILLS )
|
|
2795 {
|
1393
|
2796 if ( HouseUI_CheckIfPlayerCanInteract() )
|
1298
|
2797 {
|
|
2798 v4 = pDialogueWindow;
|
|
2799 v61 = pDialogueWindow;
|
|
2800 v5 = window_SpeakInHouse->ptr_1C;
|
|
2801 v66 = 0;
|
|
2802 //v65 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (signed int)v5] * 500.0);
|
|
2803 v65 = (signed __int64)(p2DEvents[(signed int)v5 - 1].flt_24 * 500.0);
|
|
2804 v6 = v1->GetMerchant();
|
|
2805 v64 = (signed int)(v65 * (100 - v6)) / 100;
|
|
2806 if ( v64 < (signed int)v65 / 3 )
|
|
2807 v64 = (signed int)v65 / 3;
|
|
2808 v7 = v4->pStartingPosActiveItem;
|
|
2809 v8 = v7 + v4->pNumPresenceButton;
|
|
2810 v65 = 0;
|
|
2811 v62 = v7;
|
|
2812 if ( (signed int)v7 >= v8 )
|
|
2813 goto LABEL_78;
|
|
2814 do
|
|
2815 {
|
|
2816 v9 = v4->GetControl(v62)->msg_param - 36;
|
|
2817 if ( byte_4ED970_skill_learn_ability_by_class_table[v1->classType][v9] && !v1->pActiveSkills[v9] )
|
|
2818 {
|
|
2819 v10 = pFontArrus->CalcTextHeight(pSkillNames[v9], &v57, 0, 0);
|
|
2820 v66 = (DDM_DLV_Header *)((char *)v66 + v10);
|
|
2821 ++v65;
|
|
2822 }
|
|
2823 v11 = v4->pStartingPosActiveItem;
|
|
2824 ++v62;
|
|
2825 }
|
|
2826 while ( (signed int)v62 < v4->pNumPresenceButton + v11 );
|
|
2827 if ( v65 )
|
|
2828 {
|
|
2829 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[401], v64);
|
|
2830 v57.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3u);
|
|
2831 v64 = (149 - (signed int)v66) / (signed int)v65;
|
|
2832 if ( v64 > 32 )
|
|
2833 v64 = 32;
|
|
2834 v65 = (signed int)(149 - v65 * v64 - (int)v66) / 2 - v64 / 2 + 162;
|
|
2835 v12 = v61;
|
|
2836 result = v61->pStartingPosActiveItem;
|
|
2837 v13 = result + v61->pNumPresenceButton;
|
|
2838 v62 = v61->pStartingPosActiveItem;
|
|
2839 if ( result < v13 )
|
|
2840 {
|
|
2841 v66 = (DDM_DLV_Header *)2;
|
|
2842 while ( 1 )
|
|
2843 {
|
|
2844 v14 = v12->GetControl(v62);
|
|
2845 v15 = v14;
|
|
2846 v16 = v14->msg_param - 36;
|
|
2847 if ( !byte_4ED970_skill_learn_ability_by_class_table[v1->classType][v16] || v1->pActiveSkills[v16] )
|
|
2848 {
|
|
2849 v15->uW = 0;
|
|
2850 v15->uHeight = 0;
|
|
2851 v15->uY = 0;
|
|
2852 }
|
|
2853 else
|
|
2854 {
|
|
2855 v17 = pSkillNames[v16];
|
|
2856 v15->uY = v64 + v65;
|
|
2857 HIDWORD(v60) = (uint32)v17;
|
|
2858 v18 = pFontArrus->CalcTextHeight(v17, &v57, 0, 0);
|
|
2859 v19 = v15->uY;
|
|
2860 v15->uHeight = v18;
|
|
2861 v20 = v19 + v18 - 1;
|
|
2862 v15->uW = v20;
|
|
2863 v65 = v20;
|
|
2864 v21 = WORD2(v59);
|
|
2865 if ( (DDM_DLV_Header *)pDialogueWindow->pCurrentPosActiveItem != v66 )
|
|
2866 v21 = WORD2(v58);
|
|
2867 v57.DrawTitleText(pFontArrus, 0, v19, v21, (const char *)HIDWORD(v60), 3u);
|
|
2868 }
|
|
2869 result = (int)v61;
|
|
2870 ++v62;
|
|
2871 v66 = (DDM_DLV_Header *)((char *)v66 + 1);
|
|
2872 if ( (signed int)v62 >= v61->pNumPresenceButton + v61->pStartingPosActiveItem )
|
|
2873 break;
|
|
2874 v12 = v61;
|
|
2875 }
|
|
2876 }
|
|
2877 }
|
|
2878 else
|
|
2879 {
|
|
2880 LABEL_78:
|
|
2881 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], v1->pName, pClassNames[v1->classType]);
|
|
2882 strcat(pTmpBuf.data(), "\n \n");
|
|
2883 strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]);
|
|
2884 v22 = WORD2(v59);
|
|
2885 v23 = pFontArrus->CalcTextHeight(pTmpBuf.data(), &v57, 0, 0);
|
|
2886 v57.DrawTitleText(pFontArrus, 0, (174 - v23) / 2 + 138, v22, pTmpBuf.data(), 3u);
|
|
2887 }
|
|
2888 }
|
|
2889 }
|
|
2890 return;
|
|
2891 }
|
|
2892 // DONATION
|
|
2893 //v24 = p2DEvents_minus1__20[13 * (unsigned int)ptr_507BC0->ptr_1C];
|
|
2894 v24 = p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier;
|
|
2895 v25 = 0;
|
|
2896 if ( pParty->uNumGold >= (unsigned int)(signed __int64)v24 )
|
|
2897 {
|
|
2898 Party::TakeGold((signed __int64)v24);
|
|
2899 v26 = &pOutdoor->ddm;
|
|
2900 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor )
|
|
2901 v26 = &pIndoor->dlv;
|
|
2902 v27 = v26->uReputation;
|
|
2903 v66 = v26;
|
|
2904 if ( v27 > -5 )
|
|
2905 {
|
|
2906 v28 = v27 - 1;
|
|
2907 v26->uReputation = v28;
|
|
2908 if ( v28 < -5 )
|
|
2909 v26->uReputation = -5;
|
|
2910 }
|
|
2911 if ( (unsigned __int8)byte_F8B1EF[uActiveCharacter] == pParty->uDaysPlayed % 7 )
|
|
2912 {
|
|
2913 if ( v26->uReputation <= -5 )
|
|
2914 {
|
|
2915 v30 = pParty->uDaysPlayed % 7 + 1;
|
|
2916 LOBYTE(v30) = v30 | 0x80;
|
|
2917 _42777D_CastSpell_UseWand_ShootArrow(SPELL_AIR_WIZARD_EYE, uActiveCharacter - 1, v30, 48, 0);
|
|
2918 }
|
|
2919 if ( v26->uReputation <= -10 )
|
|
2920 {
|
|
2921 v31 = pParty->uDaysPlayed % 7 + 1;
|
|
2922 LOBYTE(v31) = v31 | 0x80;
|
|
2923 _42777D_CastSpell_UseWand_ShootArrow(SPELL_SPIRIT_PRESERVATION, uActiveCharacter - 1, v31, 48, 0);
|
|
2924 v26 = v66;
|
|
2925 }
|
|
2926 if ( v26->uReputation <= -15 )
|
|
2927 {
|
|
2928 v32 = pParty->uDaysPlayed % 7 + 1;
|
|
2929 LOBYTE(v32) = v32 | 0x80;
|
|
2930 _42777D_CastSpell_UseWand_ShootArrow(SPELL_BODY_PROTECTION_FROM_MAGIC, uActiveCharacter - 1, v32, 48, 0);
|
|
2931 v26 = v66;
|
|
2932 }
|
|
2933 if ( v26->uReputation <= -20 )
|
|
2934 {
|
|
2935 v33 = pParty->uDaysPlayed % 7 + 1;
|
|
2936 LOBYTE(v33) = v33 | 0x80;
|
|
2937 _42777D_CastSpell_UseWand_ShootArrow(SPELL_LIGHT_HOUR_OF_POWER, uActiveCharacter - 1, v33, 48, 0);
|
|
2938 v26 = v66;
|
|
2939 }
|
|
2940 if ( v26->uReputation <= -25 )
|
|
2941 {
|
|
2942 v34 = pParty->uDaysPlayed % 7 + 1;
|
|
2943 LOBYTE(v34) = v34 | 0x80;
|
|
2944 _42777D_CastSpell_UseWand_ShootArrow(SPELL_LIGHT_DAY_OF_PROTECTION, uActiveCharacter - 1, v34, 48, 0);
|
|
2945 }
|
|
2946 }
|
|
2947 ++byte_F8B1EF[uActiveCharacter];
|
|
2948 v1->PlaySound(SPEECH_83, 0);
|
|
2949 ShowStatusBarString(pGlobalTXT_LocalizationStrings[527], 2u); // "Thank You!"
|
|
2950 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, v25);
|
|
2951 return;
|
|
2952 }
|
|
2953 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u);
|
|
2954 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful);
|
|
2955 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, v25);
|
|
2956 return;
|
|
2957 }
|
|
2958 if ( !v1->IsPlayerHealableByTemple() )
|
|
2959 return;
|
|
2960 v25 = 0;
|
|
2961 if ( pParty->uNumGold < v2 )
|
|
2962 {
|
|
2963 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u);
|
|
2964 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful);
|
|
2965 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, v25);
|
|
2966 return;
|
|
2967 }
|
|
2968 Party::TakeGold(v2);
|
|
2969 v35 = LODWORD(v1->pConditions[17]);
|
|
2970 v59 = v1->pConditions[14];
|
|
2971 v58 = v1->pConditions[15];
|
|
2972 v60 = v1->pConditions[16];
|
|
2973 v61 = (GUIWindow *)HIDWORD(v1->pConditions[17]);
|
|
2974 memset(v1, 0, 0xA0u);
|
|
2975 v1->sHealth = v1->GetMaxHealth();
|
|
2976 v1->sMana = v1->GetMaxMana();
|
|
2977 v36 = (signed int)window_SpeakInHouse->ptr_1C;
|
|
2978 if ( v36 != 78 && (v36 <= 80 || v36 > 82) )
|
|
2979 {
|
|
2980 if ( (unsigned int)v61 | v35 )
|
|
2981 {
|
|
2982 v37 = LOBYTE(v1->uPrevFace);
|
|
2983 v38 = v1->uPrevVoiceID;
|
|
2984 v1->uCurrentFace = v37;
|
|
2985 v1->uVoiceID = v38;
|
|
2986 ReloadPlayerPortraits(uActiveCharacter - 1, (char)v37);
|
|
2987 }
|
|
2988 pAudioPlayer->PlaySound((SoundID)(SOUND_GoldReceived|0x2), -1, 0, -1, 0, 0, 0, 0);
|
|
2989 v1->PlaySound(SPEECH_82, 0);
|
|
2990 pOtherOverlayList->_4418B1(20, uActiveCharacter + 99, 0, 65536);
|
|
2991 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, v25);
|
|
2992 return;
|
|
2993 }
|
|
2994 v39 = v61;
|
|
2995 if ( (unsigned int)v61 | v35 )
|
|
2996 {
|
|
2997 LODWORD(v1->pConditions[17]) = v35;
|
|
2998 }
|
|
2999 else
|
|
3000 {
|
|
3001 if ( !v60 && !v58 && !v59 )
|
|
3002 {
|
|
3003 pAudioPlayer->PlaySound((SoundID)(SOUND_GoldReceived|0x2), -1, 0, -1, 0, 0, 0, 0);
|
|
3004 v1->PlaySound(SPEECH_82, 0);
|
|
3005 pOtherOverlayList->_4418B1(20, uActiveCharacter + 99, 0, 65536);
|
|
3006 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, v25);
|
|
3007 return;
|
|
3008 }
|
|
3009 v1->uPrevFace = v1->uCurrentFace;
|
|
3010 v1->uPrevVoiceID = v1->uVoiceID;
|
|
3011 v1->SetCondition(0x11u, 1);
|
|
3012 v1->uVoiceID = (v1->GetSexByVoice() != 0) + 23;
|
|
3013 v40 = (v1->GetSexByVoice() != 0) + 23;
|
|
3014 v1->uCurrentFace = v40;
|
|
3015 ReloadPlayerPortraits(uActiveCharacter - 1, (char)v40);
|
|
3016 LODWORD(v1->pConditions[17]) = LODWORD(pParty->uTimePlayed);
|
|
3017 v39 = (GUIWindow *)HIDWORD(pParty->uTimePlayed);
|
|
3018 }
|
|
3019 HIDWORD(v1->pConditions[17]) = (int)v39;
|
|
3020 pAudioPlayer->PlaySound((SoundID)(SOUND_GoldReceived|0x2), -1, 0, -1, 0, 0, 0, 0);
|
|
3021 v1->PlaySound(SPEECH_82, 0);
|
|
3022 pOtherOverlayList->_4418B1(20, uActiveCharacter + 99, 0, 65536);
|
|
3023 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, v25);
|
|
3024 return; // void func
|
|
3025 }
|
|
3026 v63 = 1;
|
|
3027 v41 = pDialogueWindow->GetControl(pDialogueWindow->pStartingPosActiveItem);
|
|
3028 strcpy(a1, "");
|
|
3029 v41->uHeight = 0;
|
|
3030 v41->uY = 0;
|
|
3031 if ( v1->IsPlayerHealableByTemple() )
|
|
3032 {
|
|
3033 sprintf(a1, "%s %d %s", pGlobalTXT_LocalizationStrings[104], HIDWORD(v60), pGlobalTXT_LocalizationStrings[97]);
|
|
3034 v63 = 0;
|
|
3035 }
|
|
3036 strcpy(&a1[100], pGlobalTXT_LocalizationStrings[68]);
|
|
3037 strcpy(&a1[200], pGlobalTXT_LocalizationStrings[160]);
|
|
3038 v42 = v63;
|
|
3039 v43 = pDialogueWindow;
|
|
3040 v44 = v63;
|
|
3041 v66 = 0;
|
|
3042 if ( v63 < pDialogueWindow->pNumPresenceButton )
|
|
3043 {
|
|
3044 v61 = (GUIWindow *)&a1[100 * v63];
|
|
3045 do
|
|
3046 {
|
|
3047 v45 = pFontArrus->CalcTextHeight((const char *)v61, &v57, 0, 0);
|
|
3048 v66 = (DDM_DLV_Header *)((char *)v66 + v45);
|
|
3049 v43 = pDialogueWindow;
|
|
3050 v61 = (GUIWindow *)((char *)v61 + 100);
|
|
3051 ++v44;
|
|
3052 }
|
|
3053 while ( v44 < pDialogueWindow->pNumPresenceButton );
|
|
3054 }
|
|
3055 v46 = v43->pNumPresenceButton - v42;
|
|
3056 v64 = (174 - (signed int)v66) / v46;
|
|
3057 if ( v64 > 32 )
|
|
3058 v64 = 32;
|
|
3059 v47 = (174 - v64 * v46 - (signed int)v66) / 2 - v64 / 2 + 138;
|
|
3060 v65 = v42 + v43->pStartingPosActiveItem;
|
|
3061 if ( v42 + v43->pStartingPosActiveItem < v43->pStartingPosActiveItem + v43->pNumPresenceButton )
|
|
3062 {
|
|
3063 v61 = (GUIWindow *)(v42 + 2);
|
|
3064 v66 = (DDM_DLV_Header *)&a1[100 * v42];
|
|
3065 do
|
|
3066 {
|
|
3067 v48 = v43->GetControl(v65);
|
|
3068 v49 = (const char *)v66;
|
|
3069 v50 = v48;
|
|
3070 v48->uY = v64 + v47;
|
|
3071 v51 = pFontArrus->CalcTextHeight(v49, &v57, 0, 0);
|
|
3072 v52 = v50->uY;
|
|
3073 v50->uHeight = v51;
|
|
3074 v47 = v52 + v51 - 1;
|
|
3075 v50->uW = v47;
|
|
3076 v53 = WORD2(v59);
|
|
3077 if ( (GUIWindow *)pDialogueWindow->pCurrentPosActiveItem != v61 )
|
|
3078 v53 = WORD2(v58);
|
|
3079 v57.DrawTitleText(pFontArrus, 0, v52, v53, (const char *)v66, 3u);
|
|
3080 v43 = pDialogueWindow;
|
|
3081 v66 = (DDM_DLV_Header *)((char *)v66 + 100);
|
|
3082 v61 = (GUIWindow *)((char *)v61 + 1);
|
|
3083 ++v65;
|
|
3084 }
|
|
3085 while ( (signed int)v65 < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem );
|
|
3086 }
|
|
3087 return;
|
|
3088 }
|
|
3089
|
|
3090 //----- (004B4710) --------------------------------------------------------
|
|
3091 void TrainingDialog()
|
|
3092 {
|
|
3093 //Player *v0; // ebx@1
|
|
3094 int color2; // eax@1
|
|
3095 //unsigned int v2; // ecx@1
|
|
3096 //int v3; // eax@1
|
|
3097 //signed int v4; // edx@1
|
|
3098 unsigned __int64 v5; // edi@3
|
|
3099 //unsigned int v6; // esi@3
|
|
3100 //void *v7; // ecx@3
|
|
3101 int v8; // edx@4
|
|
3102 double v9; // st7@6
|
|
3103 signed int v10; // esi@6
|
|
3104 int v11; // ecx@6
|
|
3105 //int result; // eax@9
|
|
3106 GUIWindow *v13; // edi@14
|
|
3107 signed int v14; // esi@14
|
|
3108 unsigned int v15; // esi@16
|
|
3109 int v16; // eax@16
|
|
3110 unsigned int v17; // eax@17
|
|
3111 int v18; // eax@19
|
|
3112 int v19; // ecx@24
|
|
3113 GUIButton *v20; // eax@26
|
|
3114 GUIButton *v21; // esi@26
|
|
3115 int v22; // eax@26
|
|
3116 const char *v23; // eax@28
|
|
3117 int v24; // eax@28
|
|
3118 unsigned int v25; // ecx@28
|
|
3119 int v26; // eax@28
|
|
3120 unsigned __int16 v27; // ax@28
|
|
3121 //int v28; // eax@32
|
|
3122 unsigned __int16 v29; // ST14_2@34
|
|
3123 int v30; // eax@34
|
|
3124 //const char *v31; // ST18_4@36
|
|
3125 //unsigned __int16 v32; // ST14_2@36
|
|
3126 int v33; // eax@36
|
|
3127 int v34; // eax@37
|
|
3128 unsigned int v35; // edi@38
|
|
3129 unsigned int v36; // eax@38
|
|
3130 //int v37; // ecx@41
|
|
3131 //char *v38; // eax@41
|
|
3132 //int *v39; // eax@45
|
|
3133 unsigned int v40; // eax@46
|
|
3134 //void *v41; // ecx@46
|
|
3135 unsigned int v42; // eax@46
|
|
3136 GUIWindow *v43; // ecx@59
|
|
3137 int v44; // edx@59
|
|
3138 char **v45; // esi@60
|
|
3139 //int v46; // eax@62
|
|
3140 int v47; // eax@68
|
|
3141 //int v48; // edx@69
|
|
3142 int v49; // ebx@69
|
|
3143 //unsigned __int8 v50; // sf@69
|
|
3144 char **v51; // edi@70
|
|
3145 GUIButton *v52; // eax@71
|
|
3146 GUIButton *v53; // esi@71
|
|
3147 int v54; // eax@71
|
|
3148 unsigned int v55; // ecx@71
|
|
3149 int v56; // eax@71
|
|
3150 unsigned __int16 v57; // ax@71
|
|
3151 unsigned __int16 v58; // [sp-Ch] [bp-90h]@38
|
|
3152 //const char *v59; // [sp-Ch] [bp-90h]@63
|
|
3153 char *v60; // [sp-8h] [bp-8Ch]@38
|
|
3154 //char *v61; // [sp-8h] [bp-8Ch]@63
|
|
3155 unsigned int v62; // [sp-4h] [bp-88h]@38
|
|
3156 int v63; // [sp-4h] [bp-88h]@52
|
|
3157 //char *v64; // [sp-4h] [bp-88h]@63
|
|
3158 GUIWindow v65; // [sp+Ch] [bp-78h]@1
|
|
3159 //__int64 v66; // [sp+60h] [bp-24h]@3
|
|
3160 unsigned int white; // [sp+68h] [bp-1Ch]@1
|
|
3161 int v68; // [sp+6Ch] [bp-18h]@3
|
|
3162 int v69; // [sp+70h] [bp-14h]@6
|
|
3163 //unsigned int i; // [sp+74h] [bp-10h]@1
|
|
3164 //int v71; // [sp+78h] [bp-Ch]@1
|
|
3165 int v72; // [sp+7Ch] [bp-8h]@16
|
|
3166 int v73; // [sp+80h] [bp-4h]@14
|
|
3167
|
|
3168 //v0 = pPlayers[uActiveCharacter];
|
|
3169 memcpy(&v65, window_SpeakInHouse, sizeof(v65));
|
|
3170 v65.uFrameX = 483;
|
|
3171 v65.uFrameWidth = 148;
|
|
3172 v65.uFrameZ = 334;
|
|
3173 white = TargetColor(255, 255, 255);
|
|
3174 color2 = TargetColor(0xE1u, 0xCDu, 0x23u);
|
|
3175 //v71 = color2;
|
|
3176 //v2 = v0->uLevel;
|
|
3177 //v3 = 0;
|
|
3178 //v4 = 0;
|
|
3179 //for ( i = v2; v4 < (signed int)v2; ++v4 )
|
|
3180 // v3 += v4 + 1;
|
|
3181 //v5 = 1000 * v3;
|
|
3182 v5 = 1000ui64 * pPlayers[uActiveCharacter]->uLevel * (pPlayers[uActiveCharacter]->uLevel + 1) / 2; // E n = n(n + 1) / 2
|
|
3183 //v6 = HIDWORD(v0->uExperience);
|
|
3184 //v7 = window_SpeakInHouse->ptr_1C;
|
|
3185 v68 = pMaxLevelPerTrainingHallType[(unsigned int)window_SpeakInHouse->ptr_1C - HOUSE_TRAINING_HALL_EMERALD_ISLE];
|
|
3186 //v66 = 1000 * v3;
|
|
3187 if (pPlayers[uActiveCharacter]->uExperience >= v5)
|
|
3188 {
|
|
3189 v8 = pPlayers[uActiveCharacter]->classType % 4 + 1;
|
|
3190 if ( v8 == 4 )
|
|
3191 v8 = 3;
|
|
3192 v9 = (double)pPlayers[uActiveCharacter]->uLevel;
|
|
3193 //i = 0;
|
|
3194 v69 = v8;
|
|
3195 //v10 = (signed __int64)(v9 * p2DEvents_minus1__20[13 * (signed int)v7] * (double)v8);
|
|
3196 v10 = (signed __int64)(v9 * p2DEvents[(signed int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier * (double)v8);
|
|
3197 v11 = v10 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100;
|
|
3198 if ( v11 < v10 / 3 )
|
|
3199 v11 = v10 / 3;
|
|
3200 //i = v11;
|
|
3201 }
|
|
3202
|
1393
|
3203 if (HouseUI_CheckIfPlayerCanInteract())
|
1298
|
3204 {
|
|
3205 if ( dialog_menu_id != HOUSE_DIALOGUE_MAIN )
|
|
3206 {
|
|
3207 if ( dialog_menu_id != HOUSE_DIALOGUE_TRAININGHALL_TRAIN )
|
|
3208 {
|
|
3209 if ( dialog_menu_id == HOUSE_DIALOGUE_LEARN_SKILLS )
|
|
3210 {
|
1393
|
3211 if (HouseUI_CheckIfPlayerCanInteract())
|
1298
|
3212 {
|
|
3213 //i = 0;
|
|
3214 int _v0 = 0;
|
|
3215 v13 = pDialogueWindow;
|
|
3216 //v14 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (unsigned int)ptr_507BC0->ptr_1C] * 500.0);
|
|
3217 v14 = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0);
|
|
3218 v73 = v14 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100;
|
|
3219 if ( v73 < v14 / 3 )
|
|
3220 v73 = v14 / 3;
|
|
3221 v15 = v13->pStartingPosActiveItem;
|
|
3222 v16 = v13->pNumPresenceButton;
|
|
3223 v72 = 0;
|
|
3224 if ( (signed int)v15 >= (signed int)(v15 + v16) )
|
|
3225 goto LABEL_76;
|
|
3226 do
|
|
3227 {
|
|
3228 v17 = v13->GetControl(v15)->msg_param - 36;
|
|
3229 if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][v17] && !pPlayers[uActiveCharacter]->pActiveSkills[v17] )
|
|
3230 {
|
|
3231 v18 = pFontArrus->CalcTextHeight(pSkillNames[v17], &v65, 0, 0);
|
|
3232 _v0 += v18;
|
|
3233 ++v72;
|
|
3234 }
|
|
3235 ++v15;
|
|
3236 }
|
|
3237 while ( (signed int)v15 < v13->pNumPresenceButton + v13->pStartingPosActiveItem );
|
|
3238 if ( v72 )
|
|
3239 {
|
|
3240 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[401], v73);// "Skill Cost: %lu"
|
|
3241 v65.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3u);
|
|
3242 v73 = (signed int)(149 - _v0) / v72;
|
|
3243 if ( v73 > 32 )
|
|
3244 v73 = 32;
|
|
3245 //result = v13->pStartingPosActiveItem;
|
|
3246 v19 = (signed int)(149 - v72 * v73 - _v0) / 2 - v73 / 2 + 162;
|
|
3247 int _v1 = v13->pStartingPosActiveItem;
|
|
3248 v68 = v19;
|
|
3249 if (v13->pStartingPosActiveItem < v13->pStartingPosActiveItem + v13->pNumPresenceButton )
|
|
3250 {
|
|
3251 v72 = 2;
|
|
3252 do
|
|
3253 {
|
|
3254 v20 = v13->GetControl(_v1);
|
|
3255 v21 = v20;
|
|
3256 v22 = v20->msg_param - 36;
|
|
3257 if ( !byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][v22] || pPlayers[uActiveCharacter]->pActiveSkills[v22] )
|
|
3258 {
|
|
3259 v21->uW = 0;
|
|
3260 v21->uHeight = 0;
|
|
3261 v21->uY = 0;
|
|
3262 }
|
|
3263 else
|
|
3264 {
|
|
3265 v23 = pSkillNames[v22];
|
|
3266 v21->uY = v73 + v68;
|
|
3267 //HIDWORD(v66) = (int)v23;
|
|
3268 v24 = pFontArrus->CalcTextHeight(v23, &v65, 0, 0);
|
|
3269 v25 = v21->uY;
|
|
3270 v21->uHeight = v24;
|
|
3271 v26 = v25 + v24 - 1;
|
|
3272 v21->uW = v26;
|
|
3273 v68 = v26;
|
|
3274 v27 = color2;
|
|
3275 if ( pDialogueWindow->pCurrentPosActiveItem != v72 )
|
|
3276 v27 = white;
|
|
3277 v65.DrawTitleText(pFontArrus, 0, v25, v27, v23, 3u);
|
|
3278 }
|
|
3279 ++_v1;
|
|
3280 ++v72;
|
|
3281 }
|
|
3282 while ( (signed int)_v1 < v13->pStartingPosActiveItem + v13->pNumPresenceButton );
|
|
3283 }
|
|
3284 }
|
|
3285 else
|
|
3286 {
|
|
3287 LABEL_76:
|
|
3288 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]);//
|
|
3289 // "Seek knowledge elsewhere %s the %s"
|
|
3290 strcat(pTmpBuf.data(), "\n \n");
|
|
3291 strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]);// "I can offer you nothing further."
|
|
3292 v29 = color2;
|
|
3293 v30 = pFontArrus->CalcTextHeight(pTmpBuf.data(), &v65, 0, 0);
|
|
3294 v65.DrawTitleText(pFontArrus, 0, (174 - v30) / 2 + 138, v29, pTmpBuf.data(), 3u);
|
|
3295 }
|
|
3296 }
|
|
3297 }
|
|
3298 return;
|
|
3299 }
|
1393
|
3300 if ( !HouseUI_CheckIfPlayerCanInteract() )
|
1298
|
3301 {
|
|
3302 //v31 = pNPCTopics[122].pText;
|
|
3303 //v32 = color2;
|
|
3304 v33 = pFontArrus->CalcTextHeight(pNPCTopics[122].pText, &v65, 0, 0);
|
|
3305 v65.DrawTitleText(pFontArrus, 0, (212 - v33) / 2 + 101, color2, pNPCTopics[122].pText, 3);
|
|
3306 pDialogueWindow->pNumPresenceButton = 0;
|
|
3307 return;
|
|
3308 }
|
|
3309 v34 = pPlayers[uActiveCharacter]->uLevel;
|
|
3310 if ( v34 < v68 )
|
|
3311 {
|
|
3312 if ( (signed __int64)pPlayers[uActiveCharacter]->uExperience >= v5 )
|
|
3313 {
|
|
3314 if ( pParty->uNumGold >= v11)
|
|
3315 {
|
|
3316 Party::TakeGold(v11);
|
|
3317 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful);
|
|
3318 ++pPlayers[uActiveCharacter]->uLevel;
|
|
3319 pPlayers[uActiveCharacter]->uSkillPoints += pPlayers[uActiveCharacter]->uLevel / 10 + 5;
|
|
3320 pPlayers[uActiveCharacter]->sHealth = pPlayers[uActiveCharacter]->GetMaxHealth();
|
|
3321 pPlayers[uActiveCharacter]->sMana = pPlayers[uActiveCharacter]->GetMaxMana();
|
|
3322
|
|
3323 uint max_level_in_party = player_levels[0];
|
|
3324 for (uint _it = 1; _it < 4; ++_it)
|
|
3325 {
|
|
3326 if (player_levels[_it] > max_level_in_party)
|
|
3327 max_level_in_party = player_levels[_it];
|
|
3328 }
|
|
3329
|
|
3330 ++player_levels[uActiveCharacter - 1];
|
|
3331 if (player_levels[uActiveCharacter - 1] > max_level_in_party) // if we reach new maximum party level
|
|
3332 // feature is broken thou, since this array is always zeroed in EnterHouse
|
|
3333 {
|
|
3334 v40 = _494820_training_time(pParty->uCurrentHour);
|
|
3335 //v41 = window_SpeakInHouse->ptr_1C;
|
|
3336 v42 = 60 * (v40 + 4) - pParty->uCurrentMinute;
|
|
3337 if ((unsigned int)window_SpeakInHouse->ptr_1C == HOUSE_TRAINING_HALL_94 ||
|
|
3338 (unsigned int)window_SpeakInHouse->ptr_1C == HOUSE_TRAINING_HALL_95)
|
|
3339 v42 += 720;
|
|
3340 RestAndHeal((signed int)(v42 + 10080));
|
|
3341 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor )
|
|
3342 pOutdoor->SetFog();
|
|
3343 }
|
|
3344 pPlayers[uActiveCharacter]->PlaySound(SPEECH_87, 0);
|
|
3345 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[430], pPlayers[uActiveCharacter]->pName, pPlayers[uActiveCharacter]->uLevel, pPlayers[uActiveCharacter]->uLevel / 10 + 5);//
|
|
3346 // "%s is now Level %lu and has earned %lu Skill Points!"
|
|
3347 ShowStatusBarString(pTmpBuf.data(), 2);
|
|
3348 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
|
|
3349 return;
|
|
3350 }
|
|
3351 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);// "You don't have enough gold"
|
|
3352 v63 = 4;
|
|
3353 LABEL_55:
|
|
3354 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)v63);
|
|
3355 //LABEL_56:
|
|
3356 /*result = pMessageQueue_50CBD0->uNumMessages;
|
|
3357 if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
|
|
3358 {
|
|
3359 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape;
|
|
3360 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1;
|
|
3361 result = 3 * pMessageQueue_50CBD0->uNumMessages + 3;
|
|
3362 *(&pMessageQueue_50CBD0->uNumMessages + result) = 0;
|
|
3363 ++pMessageQueue_50CBD0->uNumMessages;
|
|
3364 }
|
|
3365 return result;*/
|
|
3366 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
|
|
3367 return;
|
|
3368 }
|
|
3369 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[538], (unsigned int)(v5 - pPlayers[uActiveCharacter]->uExperience), v34 + 1);//
|
|
3370 // "You need %d more experience to train to level %d"
|
|
3371 v35 = 0;
|
|
3372 v62 = 3;
|
|
3373 v60 = pTmpBuf.data();
|
|
3374 v58 = color2;
|
|
3375 v36 = (212 - pFontArrus->CalcTextHeight(pTmpBuf.data(), &v65, 0, 0)) / 2 + 88;
|
|
3376 }
|
|
3377 else
|
|
3378 {
|
|
3379 sprintf(pTmpBuf.data(), "%s\n \n%s", pGlobalTXT_LocalizationStrings[536], pGlobalTXT_LocalizationStrings[529]);//
|
|
3380 // ""With your skills, you should be working here as a teacher.""
|
|
3381 // ""Sorry, but we are unable to train you.""
|
|
3382 v35 = 0;
|
|
3383 v62 = 3;
|
|
3384 v60 = pTmpBuf.data();
|
|
3385 v58 = color2;
|
|
3386 v36 = (212 - pFontArrus->CalcTextHeight(pTmpBuf.data(), &v65, 0, 0)) / 2 + 101;
|
|
3387 }
|
|
3388 v65.DrawTitleText(pFontArrus, v35, v36, v58, v60, v62);
|
|
3389 v63 = 3;
|
|
3390 goto LABEL_55;
|
|
3391 }
|
|
3392
|
1393
|
3393 if (HouseUI_CheckIfPlayerCanInteract())
|
1298
|
3394 {
|
|
3395 v43 = pDialogueWindow;
|
|
3396 v72 = 0;
|
|
3397 pShopOptions[0] = pTmpBuf.data();
|
|
3398 pShopOptions[1] = pGlobalTXT_LocalizationStrings[160];// "Learn Skills"
|
|
3399 v44 = pDialogueWindow->pNumPresenceButton;
|
|
3400 v73 = pDialogueWindow->pStartingPosActiveItem;
|
|
3401 if ( v73 < v73 + v44 )
|
|
3402 {
|
|
3403 v45 = pShopOptions.data();
|
|
3404 do
|
|
3405 {
|
|
3406 if ( v43->GetControl(v73)->msg_param == HOUSE_DIALOGUE_TRAININGHALL_TRAIN )
|
|
3407 {
|
|
3408 //v46 = pPlayers[uActiveCharacter]->uLevel;
|
|
3409 if (pPlayers[uActiveCharacter]->uLevel >= v68)
|
|
3410 sprintfex(*v45, "%s\n \n%s",
|
|
3411 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."
|
|
3412 else
|
|
3413 {
|
|
3414 if (pPlayers[uActiveCharacter]->uExperience < v5)
|
|
3415 sprintfex(*v45, pGlobalTXT_LocalizationStrings[538], // "You need %d more experience to train to level %d"
|
|
3416 (uint)(v5 - pPlayers[uActiveCharacter]->uExperience), pPlayers[uActiveCharacter]->uLevel + 1);
|
|
3417 else
|
|
3418 sprintfex(*v45, pGlobalTXT_LocalizationStrings[537], // "Train to level %d for %d gold"
|
|
3419 pPlayers[uActiveCharacter]->uLevel + 1, v11);
|
|
3420 }
|
|
3421 }
|
|
3422 v47 = pFontArrus->CalcTextHeight(*v45, &v65, 0, 0);
|
|
3423 v43 = pDialogueWindow;
|
|
3424 v72 += v47;
|
|
3425 ++v45;
|
|
3426 ++v73;
|
|
3427 }
|
|
3428 while ( v73 < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem );
|
|
3429 }
|
|
3430
|
|
3431 v49 = (2 * (87 - (174 - v72) / 2) - v72) / 2 - (174 - v72) / 2 / 2 + 138;
|
|
3432 v73 = v43->pStartingPosActiveItem;
|
|
3433 if (v43->pStartingPosActiveItem < v43->pStartingPosActiveItem + v43->pNumPresenceButton)
|
|
3434 {
|
|
3435 int _v3 = 2;
|
|
3436 v51 = pShopOptions.data();
|
|
3437 do
|
|
3438 {
|
|
3439 v52 = v43->GetControl(v73);
|
|
3440 v53 = v52;
|
|
3441 v52->uY = (174 - v72) / 2 + v49;
|
|
3442 v54 = pFontArrus->CalcTextHeight(*v51, &v65, 0, 0);
|
|
3443 v55 = v53->uY;
|
|
3444 v53->uHeight = v54;
|
|
3445 v56 = v54 + v55 - 1;
|
|
3446 v53->uW = v56;
|
|
3447 v49 = v56;
|
|
3448 v57 = color2;
|
|
3449 if ( pDialogueWindow->pCurrentPosActiveItem != _v3 )
|
|
3450 v57 = white;
|
|
3451 v65.DrawTitleText(pFontArrus, 0, v55, v57, *v51, 3u);
|
|
3452 v43 = pDialogueWindow;
|
|
3453 ++_v3;
|
|
3454 ++v51;
|
|
3455 ++v73;
|
|
3456 }
|
|
3457 while ( v73 < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton);
|
|
3458 }
|
|
3459 }
|
|
3460 }
|
|
3461 }
|
|
3462
|
|
3463 //----- (004B6478) --------------------------------------------------------
|
|
3464 void sub_4B6478()
|
|
3465 {
|
|
3466 GUIWindow *v0; // ebx@1
|
|
3467 Player *v1; // edi@1
|
|
3468 unsigned int v2; // eax@1
|
|
3469 signed int v3; // esi@1
|
|
3470 int v4; // ebx@1
|
|
3471 unsigned int v5; // esi@5
|
|
3472 int v6; // edi@6
|
|
3473 int result; // eax@13
|
|
3474 GUIWindow *v8; // ebx@17
|
|
3475 int v9; // eax@17
|
|
3476 int v10; // ecx@17
|
|
3477 unsigned int v11; // ecx@18
|
|
3478 int v12; // eax@20
|
|
3479 int v13; // eax@21
|
|
3480 GUIButton *v14; // esi@27
|
|
3481 int v15; // ecx@27
|
|
3482 unsigned int v16; // eax@28
|
|
3483 const char *v17; // ebx@29
|
|
3484 int v18; // eax@29
|
|
3485 unsigned int v19; // ecx@29
|
|
3486 int v20; // eax@29
|
|
3487 unsigned __int16 v21; // ax@29
|
|
3488 unsigned __int16 v22; // ST14_2@36
|
|
3489 int v23; // eax@36
|
|
3490 const char *v24; // ST18_4@37
|
|
3491 unsigned __int16 v25; // ST14_2@37
|
|
3492 int v26; // eax@37
|
|
3493 int v27; // [sp-4h] [bp-80h]@8
|
|
3494 GUIWindow v28; // [sp+Ch] [bp-70h]@1
|
|
3495 GUIWindow *v29; // [sp+60h] [bp-1Ch]@17
|
|
3496 unsigned int v30; // [sp+64h] [bp-18h]@1
|
|
3497 int v31; // [sp+68h] [bp-14h]@1
|
|
3498 int v32; // [sp+6Ch] [bp-10h]@1
|
|
3499 int v33; // [sp+70h] [bp-Ch]@17
|
|
3500 int v34; // [sp+74h] [bp-8h]@17
|
|
3501 int v35; // [sp+78h] [bp-4h]@17
|
|
3502
|
|
3503 v0 = window_SpeakInHouse;
|
|
3504 memcpy(&v28, window_SpeakInHouse, sizeof(v28));
|
|
3505 v1 = pPlayers[uActiveCharacter];
|
|
3506 v28.uFrameX = 483;
|
|
3507 v28.uFrameWidth = 148;
|
|
3508 v28.uFrameZ = 334;
|
|
3509 v30 = TargetColor(0xFFu, 0xFFu, 0xFFu);
|
|
3510 v31 = TargetColor(0xFFu, 0xFFu, 0x9Bu);
|
|
3511 v2 = 52 * (unsigned int)v0->ptr_1C;
|
|
3512 //v32 = (unsigned __int8)(((p2DEvents_minus1___00[v2 / 2] != 18) - 1) & 0x96) + 100;
|
|
3513 v32 = (unsigned __int8)(((p2DEvents[(unsigned int)v0->ptr_1C - 1].uType != 18) - 1) & 0x96) + 100;
|
|
3514 //v3 = (signed __int64)((double)v32 * p2DEvents_minus1__20[v2 / 4]);
|
|
3515 v3 = (signed __int64)((double)v32 * p2DEvents[(unsigned int)v0->ptr_1C - 1].fPriceMultiplier);
|
|
3516 v4 = v3 * (100 - v1->GetMerchant()) / 100;
|
|
3517 v32 = v4;
|
|
3518 if ( v4 < v3 / 3 )
|
|
3519 {
|
|
3520 v4 = v3 / 3;
|
|
3521 v32 = v3 / 3;
|
|
3522 }
|
|
3523 if ( dialog_menu_id != HOUSE_DIALOGUE_MAIN)
|
|
3524 {
|
1393
|
3525 if ( HouseUI_CheckIfPlayerCanInteract() )
|
1298
|
3526 {
|
|
3527 v5 = 0;
|
|
3528
|
|
3529 __debugbreak();
|
|
3530 //pSkillAvailabilityPerClass[8 + v58->uClass][4 + v23]
|
|
3531 // or
|
|
3532 //byte_4ED970_skill_learn_ability_by_class_table[v58->uClass][v23 - 36]
|
|
3533 // or
|
|
3534 //byte_4ED970_skill_learn_ability_by_class_table[v58->uClass - 1][v23 + 1]
|
|
3535 __debugbreak(); // whacky condition - fix
|
|
3536 if (false
|
|
3537 //if ( !*(&byte_4ED94C[37 * v1->uClass / 3] + dword_F8B19C)
|
|
3538 || (v6 = (int)(&v1->uIntelligence + dialog_menu_id), *(short *)v6) )
|
|
3539 {
|
|
3540 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0);
|
|
3541 }
|
|
3542 else
|
|
3543 {
|
|
3544 if ( pParty->uNumGold < v4 )
|
|
3545 {
|
|
3546 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u);
|
|
3547 v27 = 4;
|
|
3548 }
|
|
3549 else
|
|
3550 {
|
|
3551 Party::TakeGold(v4);
|
|
3552 *(short *)v6 = 1;
|
|
3553 v27 = 2;
|
|
3554 }
|
|
3555 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)v27);
|
|
3556 }
|
|
3557 }
|
|
3558 else
|
|
3559 {
|
|
3560 v5 = 0;
|
|
3561 }
|
|
3562 /*result = pMessageQueue_50CBD0->uNumMessages;
|
|
3563 if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
|
|
3564 {
|
|
3565 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape;
|
|
3566 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1;
|
|
3567 result = 3 * pMessageQueue_50CBD0->uNumMessages + 3;
|
|
3568 *(&pMessageQueue_50CBD0->uNumMessages + result) = v5;
|
|
3569 ++pMessageQueue_50CBD0->uNumMessages;
|
|
3570 }*/
|
|
3571 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, v5);
|
|
3572 return; // void func
|
|
3573 }
|
|
3574 if ( !(unsigned __int16)_449B57_test_bit((unsigned __int8 *)v1->_guilds_member_bits, word_4F0754[2 * (unsigned int)window_SpeakInHouse->ptr_1C]) )
|
|
3575 {
|
|
3576 v24 = pNPCTopics[171].pText;
|
|
3577 v25 = v31;
|
|
3578 v26 = pFontArrus->CalcTextHeight(pNPCTopics[171].pText, &v28, 0, 0);
|
|
3579 v28.DrawTitleText(pFontArrus, 0, (212 - v26) / 2 + 101, v25, v24, 3u);
|
|
3580 pDialogueWindow->pNumPresenceButton = 0;
|
|
3581 return ;
|
|
3582 }
|
|
3583
|
1393
|
3584 if ( !HouseUI_CheckIfPlayerCanInteract() )
|
1298
|
3585 return;
|
|
3586 v8 = pDialogueWindow;
|
|
3587 v33 = 0;
|
|
3588 v34 = 0;
|
|
3589 v29 = pDialogueWindow;
|
|
3590 v9 = pDialogueWindow->pStartingPosActiveItem;
|
|
3591 v10 = v9 + pDialogueWindow->pNumPresenceButton;
|
|
3592 v35 = pDialogueWindow->pStartingPosActiveItem;
|
|
3593 if ( v9 >= v10 )
|
|
3594 goto LABEL_40;
|
|
3595 do
|
|
3596 {
|
|
3597 v11 = v8->GetControl(v35)->msg_param - 36;
|
|
3598 if ( byte_4ED970_skill_learn_ability_by_class_table[v1->classType / 3][v11] && !v1->pActiveSkills[v11] )
|
|
3599 {
|
|
3600 v12 = pFontArrus->CalcTextHeight(pSkillNames[v11], &v28, 0, 0);
|
|
3601 v33 += v12;
|
|
3602 ++v34;
|
|
3603 }
|
|
3604 v13 = v8->pStartingPosActiveItem;
|
|
3605 ++v35;
|
|
3606 }
|
|
3607 while ( v35 < v8->pNumPresenceButton + v13 );
|
|
3608 if ( !v34 )
|
|
3609 {
|
|
3610 LABEL_40:
|
|
3611 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], v1->pName, pClassNames[v1->classType]);
|
|
3612 strcat(pTmpBuf.data(), "\n \n");
|
|
3613 strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]);
|
|
3614 v22 = v31;
|
|
3615 v23 = pFontArrus->CalcTextHeight(pTmpBuf.data(), &v28, 0, 0);
|
|
3616 v28.DrawTitleText(pFontArrus, 0, (174 - v23) / 2 + 138, v22, pTmpBuf.data(), 3u);
|
|
3617 return;
|
|
3618 }
|
|
3619 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[401], v32);
|
|
3620 v28.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3u);
|
|
3621 v32 = (149 - v33) / v34;
|
|
3622 if ( (149 - v33) / v34 > 32 )
|
|
3623 v32 = 32;
|
|
3624
|
|
3625 v35 = v8->pStartingPosActiveItem;
|
|
3626 v34 = (149 - v34 * v32 - v33) / 2 - v32 / 2 + 162;
|
|
3627 if ( v8->pStartingPosActiveItem < v8->pStartingPosActiveItem+ v8->pNumPresenceButton )
|
|
3628 {
|
|
3629 v33 = 2;
|
|
3630 do
|
|
3631 {
|
|
3632 v14 = v8->GetControl(v35);
|
|
3633 v15 = v14->msg_param - 36;
|
|
3634 if ( byte_4ED970_skill_learn_ability_by_class_table[v1->classType / 3][v15] )
|
|
3635 {
|
|
3636 v16 = 0;
|
|
3637 if ( !v1->pActiveSkills[v15] )
|
|
3638 {
|
|
3639 v17 = pSkillNames[v15];
|
|
3640 v14->uY = v32 + v34;
|
|
3641 v18 = pFontArrus->CalcTextHeight(v17, &v28, 0, 0);
|
|
3642 v19 = v14->uY;
|
|
3643 v14->uHeight = v18;
|
|
3644 v20 = v19 + v18 - 1;
|
|
3645 v14->uW = v20;
|
|
3646 v34 = v20;
|
|
3647 v21 = v31;
|
|
3648 if ( pDialogueWindow->pCurrentPosActiveItem != v33 )
|
|
3649 v21 = v30;
|
|
3650 v28.DrawTitleText(pFontArrus, 0, v19, v21, v17, 3u);
|
|
3651 goto LABEL_34;
|
|
3652 }
|
|
3653 }
|
|
3654 else
|
|
3655 {
|
|
3656 v16 = 0;
|
|
3657 }
|
|
3658 v14->uW = v16;
|
|
3659 v14->uHeight = v16;
|
|
3660 v14->uY = v16;
|
|
3661 LABEL_34:
|
|
3662 v8 = v29;
|
|
3663 ++v35;
|
|
3664 ++v33;
|
|
3665 }
|
|
3666 while ( v35 <v29->pNumPresenceButton + v29->pStartingPosActiveItem );
|
|
3667 }
|
|
3668 return;
|
|
3669 }
|
|
3670
|
|
3671 //----- (004B2A74) --------------------------------------------------------
|
|
3672 void SimpleHouseAndBoatsDialog()
|
|
3673 {
|
|
3674 char *v0; // esi@3
|
|
3675 char *v1; // ST1C_4@3
|
|
3676 char *v2; // eax@3
|
|
3677 const char *v3; // ST1C_4@5
|
|
3678 int v4; // eax@5
|
|
3679 unsigned int i; // eax@5
|
|
3680 NPCData *v6; // esi@6
|
|
3681 unsigned __int16 v7; // bx@6
|
|
3682 unsigned int v8; // eax@6
|
|
3683 int v9; // eax@11
|
|
3684 unsigned int v10; // ecx@12
|
|
3685 int v11; // eax@12
|
|
3686 int v12; // esi@12
|
|
3687 char *v13; // eax@12
|
|
3688 GUIWindow *v14; // ebx@13
|
|
3689 char *v15; // esi@14
|
|
3690 GUIButton *v16; // eax@15
|
|
3691 unsigned int v17; // ecx@15
|
|
3692 int v18; // ecx@17
|
|
3693 int v19; // ecx@18
|
|
3694 int v20; // ecx@19
|
|
3695 int v21; // ecx@20
|
|
3696 int v22; // ecx@21
|
|
3697 unsigned int v23; // ecx@23
|
|
3698 int v24; // ecx@35
|
|
3699 int v25; // ecx@36
|
|
3700 int v26; // ecx@37
|
|
3701 int v27; // ecx@38
|
|
3702 int v28; // ecx@39
|
|
3703 char *v29; // esi@42
|
|
3704 unsigned int v30; // ST20_4@42
|
|
3705 int v31; // ST1C_4@42
|
|
3706 unsigned int v32; // eax@42
|
|
3707 char *v33; // eax@43
|
|
3708 int v34; // esi@51
|
|
3709 int v35; // eax@51
|
|
3710 unsigned int v36; // edi@51
|
|
3711 GUIButton *v37; // eax@52
|
|
3712 int v38; // eax@52
|
|
3713 signed int v39; // ecx@54
|
|
3714 int v40; // edi@57
|
|
3715 GUIButton *v41; // eax@60
|
|
3716 GUIButton *v42; // esi@60
|
|
3717 const char *v43; // ebx@60
|
|
3718 int v44; // eax@60
|
|
3719 unsigned int v45; // ecx@60
|
|
3720 unsigned __int16 v46; // ax@60
|
|
3721 GUIFont *v47; // ebx@64
|
|
3722 int v48; // esi@64
|
|
3723 char *v49; // eax@66
|
|
3724 GUIWindow w; // [sp+Ch] [bp-110h]@64
|
|
3725 GUIWindow v52; // [sp+60h] [bp-BCh]@13
|
|
3726 GUIWindow a1; // [sp+B4h] [bp-68h]@1
|
|
3727 unsigned int v54; // [sp+108h] [bp-14h]@14
|
|
3728 int v55; // [sp+10Ch] [bp-10h]@6
|
|
3729 int v56; // [sp+110h] [bp-Ch]@13
|
|
3730 char *pInString; // [sp+114h] [bp-8h]@12
|
|
3731 NPCData *v58; // [sp+118h] [bp-4h]@6
|
|
3732
|
|
3733 memcpy(&a1, pDialogueWindow, sizeof(a1));
|
|
3734 if ( pDialogueNPCCount == uNumDialogueNPCPortraits && uHouse_ExitPic )
|
|
3735 {
|
|
3736 v0 = pMapStats->pInfos[uHouse_ExitPic].pName;
|
|
3737 v1 = pMapStats->pInfos[uHouse_ExitPic].pName;
|
|
3738 a1.uFrameX = 493;
|
|
3739 a1.uFrameWidth = 126;
|
|
3740 a1.uFrameZ = 366;
|
|
3741 a1.DrawTitleText(pFontCreate, 0, 2u, 0, v1, 3u);
|
|
3742 a1.uFrameX = 483;
|
|
3743 a1.uFrameWidth = 148;
|
|
3744 a1.uFrameZ = 334;
|
|
3745 v2 = pTransitionStrings[uHouse_ExitPic];
|
|
3746 if ( !v2 )
|
|
3747 {
|
|
3748 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[411], v0);
|
|
3749 v2 = pTmpBuf.data();
|
|
3750 }
|
|
3751 v3 = v2;
|
|
3752 v4 = pFontCreate->CalcTextHeight(v2, &a1, 0, 0);
|
|
3753 a1.DrawTitleText(pFontCreate, 0, (212 - v4) / 2 + 101, 0, v3, 3u);
|
|
3754 return;
|
|
3755 }
|
|
3756 a1.uFrameWidth -= 10;
|
|
3757 a1.uFrameZ -= 10;
|
|
3758 v58 = HouseNPCData[(unsigned int)((char *)pDialogueNPCCount + -(dword_591080 != 0) )];//- 1
|
|
3759 v6 = v58;
|
|
3760 v55 = TargetColor(0xE1u, 0xCDu, 0x23u);
|
|
3761 v7 = TargetColor(0x15u, 0x99u, 0xE9u);
|
|
3762 v8 = v6->uProfession;
|
|
3763 if ( v8 )
|
|
3764 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[429], v6->pName, aNPCProfessionNames[v8]);
|
|
3765 else
|
|
3766 strcpy(pTmpBuf.data(), v6->pName);
|
|
3767 a1.DrawTitleText(pFontCreate, 0x1E3u, 0x71u, v7, pTmpBuf.data(), 3u);
|
|
3768 if ( !dword_591080 )
|
|
3769 {
|
|
3770 if ( !uDialogueType )
|
|
3771 {
|
|
3772 v9 = v6->greet;
|
|
3773 if ( v9 )
|
|
3774 {
|
|
3775 v10 = v6->uFlags;
|
|
3776 a1.uFrameWidth = game_viewport_width;
|
|
3777 a1.uFrameZ = 452;
|
|
3778 pInString = (char *)*(&pNPCStats->field_17884 + ((v10 & 3) == 2) + 2 * v9);
|
|
3779 v11 = pFontArrus->CalcTextHeight(pInString, &a1, 13, 0);
|
|
3780 v12 = v11 + 7;
|
|
3781 pRenderer->_4A6A68(8, 352 - (v11 + 7),
|
|
3782 pIcons_LOD->GetTexture(uTextureID_Leather),
|
|
3783 pIcons_LOD->GetTexture(uTextureID_Leather)->uTextureHeight - (v11 + 7));
|
|
3784 pRenderer->DrawTextureIndexed(8u, 347 - v12, pTexture_591428);
|
|
3785 v13 = FitTextInAWindow(pInString, pFontArrus, &a1, 0xDu, 0);
|
|
3786 pDialogueWindow->DrawText(pFontArrus, 13, 354 - v12, 0, v13, 0, 0, 0);
|
|
3787 }
|
|
3788 }
|
|
3789 }
|
|
3790 v14 = pDialogueWindow;
|
|
3791 memcpy(&v52, pDialogueWindow, sizeof(v52));
|
|
3792 v52.uFrameX = 483;
|
|
3793 v52.uFrameWidth = 148;
|
|
3794 v52.uFrameZ = 334;
|
|
3795 v56 = v52.pStartingPosActiveItem;
|
|
3796 if ( v52.pStartingPosActiveItem < v52.pStartingPosActiveItem + v52.pNumPresenceButton )
|
|
3797 {
|
|
3798 v15 = "";//(char *)v54;
|
|
3799 while ( 1 )
|
|
3800 {
|
|
3801 v16 = v52.GetControl(v56);
|
|
3802 v17 = v16->msg_param;
|
|
3803 pInString = (char *)v16;
|
|
3804 if ( (signed int)v17 > 24 )
|
|
3805 {
|
|
3806 v24 = v17 - 76;
|
|
3807 if ( !v24 )
|
|
3808 {
|
|
3809 v15 = pGlobalTXT_LocalizationStrings[406];
|
|
3810 goto LABEL_49;
|
|
3811 }
|
|
3812 v25 = v24 - 1;
|
|
3813 if ( !v25 )
|
|
3814 {
|
|
3815 v15 = pGlobalTXT_LocalizationStrings[407];
|
|
3816 goto LABEL_49;
|
|
3817 }
|
|
3818 v26 = v25 - 2;
|
|
3819 if ( !v26 )
|
|
3820 {
|
|
3821 v33 = _4B254D_SkillMasteryTeacher((int)v52.ptr_1C);
|
|
3822 LABEL_44:
|
|
3823 v15 = v33;
|
|
3824 LABEL_45:
|
|
3825 v16 = (GUIButton *)pInString;
|
|
3826 goto LABEL_49;
|
|
3827 }
|
|
3828 v27 = v26 - 3;
|
|
3829 if ( !v27 )
|
|
3830 {
|
|
3831 v33 = (char *)ContractSelectText((int)v52.ptr_1C);
|
|
3832 goto LABEL_44;
|
|
3833 }
|
|
3834 v28 = v27 - 1;
|
|
3835 if ( !v28 )
|
|
3836 {
|
|
3837 v29 = (char *)&pMonsterStats + 88 * word_F8B1A0;
|
|
3838 v30 = TargetColor(0xFFu, 0xFFu, 0xFFu);
|
|
3839 v31 = *(int *)v29;
|
|
3840 v32 = TargetColor(0xFFu, 0xFFu, 0x9Bu);
|
|
3841 sprintfex(pTmpBuf.data(), "\f%05d%s\f%05d", v32, v31, v30);
|
|
3842 sprintfex(pTmpBuf2.data(), dword_F8B1A4, pTmpBuf.data(), 100 * (unsigned __int8)v29[8]);
|
|
3843 current_npc_text = pTmpBuf2.data();
|
|
3844 v15 = "";
|
|
3845 goto LABEL_45;
|
|
3846 }
|
|
3847 if ( v28 != 10 )
|
|
3848 goto LABEL_41;
|
|
3849 }
|
|
3850 else
|
|
3851 {
|
|
3852 if ( v17 == 24 )
|
|
3853 {
|
|
3854 v23 = v58->evt_F;
|
|
3855 LABEL_33:
|
|
3856 v15 = (char *)pNPCTopics[v23-1].pTopic;//(&dword_721660)[8 * v23];
|
|
3857 if ( !v15 )
|
|
3858 {
|
|
3859 v16->msg_param = 0;
|
|
3860 v15 = "";
|
|
3861 }
|
|
3862 goto LABEL_49;
|
|
3863 }
|
|
3864 v18 = v17 - 13;
|
|
3865 if ( v18 )
|
|
3866 {
|
|
3867 v19 = v18 - 6;
|
|
3868 if ( !v19 )
|
|
3869 {
|
|
3870 v23 = v58->evt_A;
|
|
3871 goto LABEL_33;
|
|
3872 }
|
|
3873 v20 = v19 - 1;
|
|
3874 if ( !v20 )
|
|
3875 {
|
|
3876 v15 = (char *)pNPCTopics[v58->evt_B-1].pTopic;//(&dword_721660)[8 * v58->evtb];
|
|
3877 if ( !v15 )
|
|
3878 {
|
|
3879 v16->msg_param = 0;
|
|
3880 v15 = "";
|
|
3881 }
|
|
3882 if ( uDialogueType != 84 )
|
|
3883 goto LABEL_49;
|
|
3884 sprintf(pTmpBuf.data(), format_4E2D80, v55, pItemsTable->pItems[contract_approved].pUnidentifiedName);
|
|
3885 sprintf(pTmpBuf2.data(), current_npc_text, pTmpBuf.data());
|
|
3886 current_npc_text = pTmpBuf2.data();
|
|
3887 goto LABEL_45;
|
|
3888 }
|
|
3889 v21 = v20 - 1;
|
|
3890 if ( !v21 )
|
|
3891 {
|
|
3892 v23 = v58->evt_C;
|
|
3893 goto LABEL_33;
|
|
3894 }
|
|
3895 v22 = v21 - 1;
|
|
3896 if ( !v22 )
|
|
3897 {
|
|
3898 v23 = v58->evt_D;
|
|
3899 goto LABEL_33;
|
|
3900 }
|
|
3901 if ( v22 == 1 )
|
|
3902 {
|
|
3903 v23 = v58->evt_E;
|
|
3904 goto LABEL_33;
|
|
3905 }
|
|
3906 LABEL_41:
|
|
3907 v15 = "";
|
|
3908 goto LABEL_49;
|
|
3909 }
|
|
3910 v15 = pGlobalTXT_LocalizationStrings[122];
|
|
3911 }
|
|
3912 LABEL_49:
|
|
3913 strcpy(v16->pButtonName, v15);
|
|
3914 ++v56;
|
|
3915 if ( v56 >= v52.pStartingPosActiveItem + v52.pNumPresenceButton )
|
|
3916 {
|
|
3917 v14 = pDialogueWindow;
|
|
3918 break;
|
|
3919 }
|
|
3920 }
|
|
3921 }
|
|
3922 v34 = 0;
|
|
3923 v54 = TargetColor(0xFFu, 0xFFu, 0xFFu);
|
|
3924 v35 = TargetColor(0xE1u, 0xCDu, 0x23u);
|
|
3925 v36 = v14->pStartingPosActiveItem;
|
|
3926 v55 = v35;
|
|
3927 for ( i = v36 + v14->pNumPresenceButton; (signed int)v36 < (signed int)i; i = pDialogueWindow->pNumPresenceButton
|
|
3928 + pDialogueWindow->pStartingPosActiveItem )
|
|
3929 {
|
|
3930 v37 = v14->GetControl(v36);
|
|
3931 v38 = pFontArrus->CalcTextHeight(v37->pButtonName, &v52, 0, 0);
|
|
3932 v14 = pDialogueWindow;
|
|
3933 v34 += v38;
|
|
3934 ++v36;
|
|
3935 }
|
|
3936 v39 = v14->pNumPresenceButton;
|
|
3937 if ( v39 )
|
|
3938 {
|
|
3939 v58 = (NPCData *)((174 - v34) / v39);
|
|
3940 if ( (signed int)v58 > 32 )
|
|
3941 v58 = (NPCData *)32;
|
|
3942 pInString = (char *)2;
|
|
3943 v40 = (174 - (signed int)v58 * v39 - v34) / 2 - (signed int)v58 / 2 + 138;
|
|
3944 v56 = v14->pStartingPosActiveItem;
|
|
3945 i = v56;
|
|
3946 if ( (signed int)i < (signed int)(i + v39) )
|
|
3947 {
|
|
3948 while ( 1 )
|
|
3949 {
|
|
3950 v41 = v14->GetControl(i);
|
|
3951 v42 = v41;
|
|
3952 v43 = v41->pButtonName;
|
|
3953 v41->uY = (unsigned int)((char *)v58 + v40);
|
|
3954 v44 = pFontArrus->CalcTextHeight(v41->pButtonName, &v52, 0, 0);
|
|
3955 v45 = v42->uY;
|
|
3956 v42->uHeight = v44;
|
|
3957 v40 = v45 + v44 - 1;
|
|
3958 v42->uW = v40;
|
|
3959 v46 = v55;
|
|
3960 if ( (char *)pDialogueWindow->pCurrentPosActiveItem != pInString )
|
|
3961 v46 = v54;
|
|
3962 v52.DrawTitleText(pFontArrus, 0, v45, v46, v43, 3u);
|
|
3963 v14 = pDialogueWindow;
|
|
3964 ++pInString;
|
|
3965 ++v56;
|
|
3966 i = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem;
|
|
3967 if ( v56 >= (signed int)i )
|
|
3968 break;
|
|
3969 i = v56;
|
|
3970 }
|
|
3971 }
|
|
3972 }
|
|
3973 if ( current_npc_text )
|
|
3974 {
|
|
3975 w.uFrameWidth = 458;
|
|
3976 w.uFrameZ = 457;
|
|
3977 v47 = pFontArrus;
|
|
3978 v48 = pFontArrus->CalcTextHeight(current_npc_text, &w, 13, 0) + 7;
|
|
3979 if ( 352 - v48 < 8 )
|
|
3980 {
|
|
3981 v47 = pFontCreate;
|
|
3982 v48 = pFontCreate->CalcTextHeight(current_npc_text, &w, 13, 0) + 7;
|
|
3983 }
|
|
3984 pRenderer->_4A6A68(8, 352 - v48,
|
|
3985 pIcons_LOD->GetTexture(uTextureID_Leather),
|
|
3986 pIcons_LOD->GetTexture(uTextureID_Leather)->uTextureHeight - v48);
|
|
3987 pRenderer->DrawTextureIndexed(8u, 347 - v48, pTexture_591428);
|
|
3988 v49 = FitTextInAWindow(current_npc_text, v47, &w, 0xDu, 0);
|
|
3989 a1.DrawText(v47, 13, 354 - v48, 0, v49, 0, 0, 0);
|
|
3990 }
|
|
3991 }
|
1300
|
3992 //----- (004B4F4F) --------------------------------------------------------
|
|
3993 void JailDialog()
|
1298
|
3994 {
|
1300
|
3995 const char *v0; // esi@1
|
|
3996 const char *v1; // ST10_4@1
|
|
3997 unsigned __int16 v2; // ST0C_2@1
|
|
3998 int v3; // eax@1
|
|
3999 GUIWindow v5; // [sp+8h] [bp-54h]@1
|
1298
|
4000
|
1300
|
4001 memcpy(&v5, window_SpeakInHouse, sizeof(v5));
|
|
4002 v0 = pGlobalTXT_LocalizationStrings[672];
|
|
4003 v1 = pGlobalTXT_LocalizationStrings[672];
|
|
4004 v5.uFrameX = 483;
|
|
4005 v5.uFrameWidth = 148;
|
|
4006 v5.uFrameZ = 334;
|
|
4007 v2 = TargetColor(0xFFu, 0xFFu, 0x9Bu);
|
|
4008 v3 = pFontArrus->CalcTextHeight(v0, &v5, 0, 0);
|
|
4009 v5.DrawTitleText(pFontArrus, 0, (310 - v3) / 2 + 18, v2, v1, 3u);
|
1298
|
4010 } |