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