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