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