Mercurial > mm7
annotate UI/UIHouses.cpp @ 1630:ee4a65ac9d21
TavernDialog cleared
author | Ritor1 |
---|---|
date | Tue, 17 Sep 2013 13:20:58 +0600 |
parents | 2149b14614ad |
children | 08ebd0fee604 ccde94f02b75 |
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 | |
1589 | 92 { 6, 7, 8, 8}, // HOUSE_STABLES_TULAREAN_FOREST |
93 { 9, 10, 10, 10}, // HOUSE_STABLES_DEYJA | |
1610 | 94 { 11, 11, 12, 12}, // HOUSE_STABLES_BRACADA_DESERT |
95 { 13, 13, 13, 13}, // HOUSE_STABLES_TATALIA | |
96 { 14, 14, 15, 15}, // HOUSE_STABLES_AVLEE | |
1298 | 97 {255, 255, 255, 255}, // HOUSE_STABLES_61 |
98 {255, 255, 255, 255}, // HOUSE_STABLES_62 | |
1610 | 99 {255, 255, 255, 255}, // HOUSE_BOATS_EMERALD_ISLE |
100 { 16, 17, 18, 19}, // HOUSE_BOATS_ERATHIA | |
101 { 18, 20, 21, 21}, // HOUSE_BOATS_TULAREAN_FOREST | |
102 { 22, 23, 24, 25}, // HOUSE_BOATS_BRACADA_DESERT | |
103 { 22, 22, 23, 23}, // HOUSE_BOATS_EVENMORN_ISLAND | |
1298 | 104 {255, 255, 255, 255}, // HOUSE_BOATS_68 |
1610 | 105 { 27, 28, 29, 30}, // HOUSE_BOATS_TATALIA |
106 { 31, 32, 33, 33}, // HOUSE_BOATS_AVLEE | |
1298 | 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: | |
1545 | 561 Error("Invalid enumeration value: %u", type); |
1411 | 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) | |
1545 | 870 { |
1298 | 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; | |
1545 | 874 default: Error("Invalid alignment type: %u", pParty->alignment); |
875 } | |
1298 | 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 |
992 int v16; // eax@32 | |
993 int v17; // eax@33 | |
994 int v18; // eax@34 | |
995 int v19; // eax@35 | |
996 __int16 v20; // ax@37 | |
997 __int16 v21; // ax@76 | |
998 __int16 v22; // ax@107 | |
999 __int16 v23; // ax@132 | |
1000 __int16 v24; // ax@163 | |
1001 unsigned int v34; // eax@211 | |
1002 signed int v36; // esi@227 | |
1003 int v37; // ecx@227 | |
1004 int v38; // esi@230 | |
1005 int v39; // edx@235 | |
1006 int v40; // edi@243 | |
1007 unsigned __int64 v41; // qax@243 | |
1008 signed int v43; // edi@244 | |
1009 int v44; // edx@244 | |
1010 int v45; // eax@246 | |
1011 unsigned int v46; // eax@247 | |
1012 void *v47; // eax@250 | |
1013 signed int v48; // edi@250 | |
1014 int v49; // eax@252 | |
1015 int v50; // eax@256 | |
1016 unsigned int v51; // eax@257 | |
1017 void *v52; // eax@260 | |
1018 signed int v53; // edi@260 | |
1019 int v54; // eax@262 | |
1020 | |
1021 if ( !pDialogueWindow->pNumPresenceButton ) | |
1022 return; | |
1023 pRenderer->ClearZBuffer(0, 479); | |
1024 if ( dialog_menu_id != HOUSE_DIALOGUE_MAIN) | |
1025 v8 = window_SpeakInHouse; | |
1026 if (dialog_menu_id == HOUSE_DIALOGUE_MAIN) | |
1027 { | |
1529 | 1028 if ( in_current_building_type == BuildingType_Training ) |
1029 { | |
1030 if ( uMessageParam == HOUSE_DIALOGUE_TRAININGHALL_TRAIN ) | |
1031 { | |
1032 experience_for_next_level = 0; | |
1033 if ( pPlayers[uActiveCharacter]->uLevel > 0 ) | |
1034 { | |
1035 for( uint i = 0; i < pPlayers[uActiveCharacter]->uLevel; i++ ) | |
1036 experience_for_next_level += i + 1; | |
1037 } | |
1038 if (pPlayers[uActiveCharacter]->uLevel < pMaxLevelPerTrainingHallType[(unsigned int)window_SpeakInHouse->ptr_1C - 89] && | |
1039 (signed __int64)pPlayers[uActiveCharacter]->uExperience < 1000 * experience_for_next_level)//test experience | |
1040 return; | |
1041 } | |
1042 pDialogueWindow->Release(); | |
1043 pDialogueWindow = GUIWindow::Create(0, 0, 640, 345, WINDOW_MainMenu, 0, 0); | |
1044 pBtn_ExitCancel = pDialogueWindow->CreateButton(526, 445, 75, 33, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[74],// "End Conversation" | |
1045 pIcons_LOD->GetTexture(uTextureID_BUTTDESC2), 0); | |
1046 pDialogueWindow->CreateButton(8, 8, 450, 320, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", nullptr); | |
1047 v8 = window_SpeakInHouse; | |
1048 } | |
1049 if ( in_current_building_type != BuildingType_Training ) | |
1050 { | |
1051 v8 = window_SpeakInHouse; | |
1052 if ((in_current_building_type == BuildingType_Stables || in_current_building_type == BuildingType_Boats) && | |
1053 transport_schedule[transport_routes[(unsigned int)window_SpeakInHouse->ptr_1C - HOUSE_STABLES_HARMONDALE][uMessageParam - HOUSE_DIALOGUE_TRANSPORT_SCHEDULE_1]].pSchedule[pParty->uDaysPlayed % 7] | |
1054 || in_current_building_type != BuildingType_Temple || uMessageParam != BuildingType_MindGuild ) | |
1055 { | |
1056 pDialogueWindow->Release(); | |
1057 pDialogueWindow = GUIWindow::Create(0, 0, 640, 345, WINDOW_MainMenu, 0, 0); | |
1058 pBtn_ExitCancel = pDialogueWindow->CreateButton(526, 445, 75, 33, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[74],// "End Conversation" | |
1059 pIcons_LOD->GetTexture(uTextureID_BUTTDESC2), 0); | |
1060 pDialogueWindow->CreateButton(8, 8, 450, 320, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", nullptr); | |
1061 v8 = window_SpeakInHouse; | |
1062 } | |
1063 else if (uActiveCharacter) | |
1064 { | |
1065 if ( !pPlayers[uActiveCharacter]->IsPlayerHealableByTemple() ) | |
1066 return; | |
1067 v8 = window_SpeakInHouse; | |
1068 } | |
1069 } | |
1070 dialog_menu_id = (HOUSE_DIALOGUE_MENU)uMessageParam; | |
1071 if ( in_current_building_type < BuildingType_19 ) | |
1072 { | |
1073 ShopTexture = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(off_4F03B8[(int)in_current_building_type], TEXTURE_16BIT_PALETTE)]; | |
1074 v8 = window_SpeakInHouse; | |
1075 } | |
1298 | 1076 } |
1077 | |
1078 //NEW | |
1411 | 1079 switch (in_current_building_type) |
1298 | 1080 { |
1411 | 1081 case BuildingType_FireGuild: |
1082 case BuildingType_AirGuild: | |
1083 case BuildingType_WaterGuild: | |
1084 case BuildingType_EarthGuild: | |
1085 case BuildingType_SpiritGuild: | |
1086 case BuildingType_MindGuild: | |
1087 case BuildingType_BodyGuild: | |
1088 case BuildingType_LightGuild: | |
1089 case BuildingType_DarkGuild: | |
1090 case BuildingType_14: | |
1091 case BuildingType_15: | |
1092 case BuildingType_16: | |
1298 | 1093 { |
1529 | 1094 if ( pParty->field_3C.Shops_next_generation_time[window_SpeakInHouse->par1C] >= (signed __int64)pParty->uTimePlayed ) |
1298 | 1095 { |
1526 | 1096 for ( uint i = 0; i < 12; ++i ) |
1298 | 1097 { |
1526 | 1098 if ( pParty->SpellBooksInGuilds[v8->par1C-139][i].uItemID ) |
1298 | 1099 { |
1526 | 1100 v34 = pIcons_LOD->LoadTexture(pItemsTable->pItems[pParty->SpellBooksInGuilds[v8->par1C-139][i].uItemID].pIconName, TEXTURE_16BIT_PALETTE); |
1298 | 1101 v8 = window_SpeakInHouse; |
1526 | 1102 ItemsInShopTexture[i] = &pIcons_LOD->pTextures[v34]; |
1298 | 1103 } |
1104 } | |
1105 } | |
1529 | 1106 else//generation new books |
1298 | 1107 { |
1108 SpellBookGenerator(); | |
1529 | 1109 pParty->field_3C.Shops_next_generation_time[window_SpeakInHouse->par1C] = pParty->uTimePlayed + (signed __int64)((double)(0xA8C000 |
1298 | 1110 * (signed int)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].field_1C) * 0.033333335); |
1111 } | |
1112 break; | |
1113 } | |
1411 | 1114 case BuildingType_TownHall: |
1298 | 1115 { |
1529 | 1116 if ( uMessageParam == HOUSE_DIALOGUE_TOWNHALL_MESSAGE ) |
1298 | 1117 { |
1529 | 1118 if ( pParty->field_3C.bountyHunting_next_generation_time[(int)((char *)v8->ptr_1C - 102)] < (signed __int64)pParty->uTimePlayed )//new generation |
1298 | 1119 { |
1529 | 1120 pParty->monster_for_hunting_killed[(int)((char *)v8->ptr_1C - 102)] = false; |
1121 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); | |
1122 pParty->monster_id_for_hunting[(int)((char *)v8->ptr_1C - 102)] = rand() % 258 + 1; | |
1123 v16 = (int)((char *)window_SpeakInHouse->ptr_1C - 102); | |
1124 if ( !v16 ) | |
1125 { | |
1126 while ( 1 ) | |
1127 { | |
1128 v24 = pParty->monster_id_for_hunting[(int)((char *)v8->ptr_1C - 102)]; | |
1129 if ( (unsigned __int16)v24 < 115 || (unsigned __int16)v24 > 132 ) | |
1130 { | |
1131 if ( ((unsigned __int16)v24 < 235 || (unsigned __int16)v24 > 252) | |
1132 && ((unsigned __int16)v24 < 133 || (unsigned __int16)v24 > 150) | |
1133 && ((unsigned __int16)v24 < 0x97u || (unsigned __int16)v24 > 0xBAu) | |
1134 && ((unsigned __int16)v24 < 0xBEu || (unsigned __int16)v24 > 0xC0u) | |
1135 && ((unsigned __int16)v24 < 0xC4u || (unsigned __int16)v24 > 0xC6u) | |
1136 && ((unsigned __int16)v24 < 0x2Bu || (unsigned __int16)v24 > 0x2Du) | |
1137 && ((unsigned __int16)v24 < 0xCDu || (unsigned __int16)v24 > 0xCFu) | |
1138 && ((unsigned __int16)v24 < 0x5Eu || (unsigned __int16)v24 > 0x60u) | |
1139 && ((unsigned __int16)v24 < 0xFDu || (unsigned __int16)v24 > 0xFFu) | |
1140 && ((unsigned __int16)v24 < 0x6Du || (unsigned __int16)v24 > 0x6Fu) | |
1141 && ((unsigned __int16)v24 < 0x61u || (unsigned __int16)v24 > 0x63u) ) | |
1142 break; | |
1143 } | |
1144 pParty->monster_id_for_hunting[(int)((char *)v8->ptr_1C - 102)] = rand() % 258 + 1; | |
1145 } | |
1146 } | |
1147 if ( v16 == 1 ) | |
1148 { | |
1149 while ( 1 ) | |
1150 { | |
1151 v23 = pParty->monster_id_for_hunting[(int)((char *)v8->ptr_1C - 102)]; | |
1152 if ( (unsigned __int16)v23 < 115 || (unsigned __int16)v23 > 132 ) | |
1153 { | |
1154 if ( ((unsigned __int16)v23 < 0xE8u || (unsigned __int16)v23 > 0xF9u) | |
1155 && ((unsigned __int16)v23 < 0x85u || (unsigned __int16)v23 > 0x96u) | |
1156 && ((unsigned __int16)v23 < 0x97u || (unsigned __int16)v23 > 0xBAu) | |
1157 && ((unsigned __int16)v23 < 0xBEu || (unsigned __int16)v23 > 0xC0u) | |
1158 && ((unsigned __int16)v23 < 0xC4u || (unsigned __int16)v23 > 0xC6u) | |
1159 && ((unsigned __int16)v23 < 0x2Bu || (unsigned __int16)v23 > 0x2Du) | |
1160 && ((unsigned __int16)v23 < 0x52u || (unsigned __int16)v23 > 0x54u) | |
1161 && ((unsigned __int16)v23 < 4 || (unsigned __int16)v23 > 6) | |
1162 && ((unsigned __int16)v23 < 0x37u || (unsigned __int16)v23 > 0x39u) | |
1163 && ((unsigned __int16)v23 < 0x3Au || (unsigned __int16)v23 > 0x3Cu) | |
1164 && ((unsigned __int16)v23 < 0x3Du || (unsigned __int16)v23 > 0x3Fu) | |
1165 && ((unsigned __int16)v23 < 0xFDu || (unsigned __int16)v23 > 0xFFu) | |
1166 && ((unsigned __int16)v23 < 0x61u || (unsigned __int16)v23 > 0x63u) | |
1167 && ((unsigned __int16)v23 < 0xCDu || (unsigned __int16)v23 > 0xCFu) ) | |
1168 break; | |
1169 } | |
1170 pParty->monster_id_for_hunting[(int)((char *)v8->ptr_1C - 102)] = rand() % 258 + 1; | |
1171 } | |
1172 } | |
1173 if ( v16 == 2 ) | |
1174 { | |
1175 while ( 1 ) | |
1176 { | |
1177 v22 = pParty->monster_id_for_hunting[(int)((char *)v8->ptr_1C - 102)]; | |
1178 if ( (unsigned __int16)v22 < 0x73u || (unsigned __int16)v22 > 0x84u ) | |
1179 { | |
1180 if ( ((unsigned __int16)v22 < 0xE8u || (unsigned __int16)v22 > 0xF9u) | |
1181 && ((unsigned __int16)v22 < 0x85u || (unsigned __int16)v22 > 0x96u) | |
1182 && ((unsigned __int16)v22 < 0x97u || (unsigned __int16)v22 > 0xBAu) | |
1183 && ((unsigned __int16)v22 < 0xBEu || (unsigned __int16)v22 > 0xC0u) | |
1184 && ((unsigned __int16)v22 < 0xC4u || (unsigned __int16)v22 > 0xC6u) | |
1185 && ((unsigned __int16)v22 < 0x2Bu || (unsigned __int16)v22 > 0x2Du) | |
1186 && ((unsigned __int16)v22 < 0x31u || (unsigned __int16)v22 > 0x33u) | |
1187 && ((unsigned __int16)v22 < 0x34u || (unsigned __int16)v22 > 0x36u) | |
1188 && ((unsigned __int16)v22 < 0xFDu || (unsigned __int16)v22 > 0xFFu) | |
1189 && ((unsigned __int16)v22 < 0x61u || (unsigned __int16)v22 > 0x63u) | |
1190 && ((unsigned __int16)v22 < 0x1Cu || (unsigned __int16)v22 > 0x1Eu) ) | |
1191 break; | |
1192 } | |
1193 pParty->monster_id_for_hunting[(int)((char *)v8->ptr_1C - 102)] = rand() % 258 + 1; | |
1194 } | |
1195 } | |
1196 if ( v16 == 3 ) | |
1197 { | |
1198 while ( 1 ) | |
1199 { | |
1200 v21 = pParty->monster_id_for_hunting[(int)((char *)v8->ptr_1C - 102)]; | |
1201 if ( (unsigned __int16)v21 < 0x73u || (unsigned __int16)v21 > 0x84u ) | |
1202 { | |
1203 if ( ((unsigned __int16)v21 < 0xE8u || (unsigned __int16)v21 > 0xF9u) | |
1204 && ((unsigned __int16)v21 < 0x85u || (unsigned __int16)v21 > 0x96u) | |
1205 && ((unsigned __int16)v21 < 0x97u || (unsigned __int16)v21 > 0xBAu) | |
1206 && ((unsigned __int16)v21 < 0xBEu || (unsigned __int16)v21 > 0xC0u) | |
1207 && ((unsigned __int16)v21 < 0xC4u || (unsigned __int16)v21 > 0xC6u) | |
1208 && ((unsigned __int16)v21 < 0x2Bu || (unsigned __int16)v21 > 0x2Du) | |
1209 && ((unsigned __int16)v21 < 0x5Eu || (unsigned __int16)v21 > 0x60u) | |
1210 && ((unsigned __int16)v21 < 0x43u || (unsigned __int16)v21 > 0x45u) | |
1211 && ((unsigned __int16)v21 < 0x4Fu || (unsigned __int16)v21 > 0x51u) | |
1212 && ((unsigned __int16)v21 < 0xC1u || (unsigned __int16)v21 > 0xC3u) | |
1213 && ((unsigned __int16)v21 < 0x13u || (unsigned __int16)v21 > 0x15u) | |
1214 && ((unsigned __int16)v21 < 0xFDu || (unsigned __int16)v21 > 0xFFu) | |
1215 && ((unsigned __int16)v21 < 0x61u || (unsigned __int16)v21 > 0x63u) | |
1216 && ((unsigned __int16)v21 < 0x6Au || (unsigned __int16)v21 > 0x6Cu) ) | |
1217 break; | |
1218 } | |
1219 pParty->monster_id_for_hunting[(int)((char *)v8->ptr_1C - 102)] = rand() % 258 + 1; | |
1220 } | |
1221 } | |
1222 if ( v16 == 4 ) | |
1223 { | |
1224 while ( 1 ) | |
1225 { | |
1226 v20 = pParty->monster_id_for_hunting[(int)((char *)v8->ptr_1C - 102)]; | |
1227 if ( (unsigned __int16)v20 < 0x73u || (unsigned __int16)v20 > 0x84u ) | |
1228 { | |
1229 if ( ((unsigned __int16)v20 < 0xE8u || (unsigned __int16)v20 > 0xF9u) | |
1230 && ((unsigned __int16)v20 < 0x85u || (unsigned __int16)v20 > 0x96u) | |
1231 && ((unsigned __int16)v20 < 0x97u || (unsigned __int16)v20 > 0xBAu) | |
1232 && ((unsigned __int16)v20 < 0xBEu || (unsigned __int16)v20 > 0xC0u) | |
1233 && ((unsigned __int16)v20 < 0xC4u || (unsigned __int16)v20 > 0xC6u) | |
1234 && ((unsigned __int16)v20 < 0x2Bu || (unsigned __int16)v20 > 0x2Du) | |
1235 && ((unsigned __int16)v20 < 0x6Du || (unsigned __int16)v20 > 0x6Fu) | |
1236 && ((unsigned __int16)v20 < 0x46u || (unsigned __int16)v20 > 0x48u) | |
1237 && ((unsigned __int16)v20 < 0x100u || (unsigned __int16)v20 > 0x102u) | |
1238 && ((unsigned __int16)v20 < 0xD9u || (unsigned __int16)v20 > 0xDBu) | |
1239 && ((unsigned __int16)v20 < 0xC7u || (unsigned __int16)v20 > 0xC9u) | |
1240 && ((unsigned __int16)v20 < 0xE5u || (unsigned __int16)v20 > 0xE7u) | |
1241 && ((unsigned __int16)v20 < 0xDFu || (unsigned __int16)v20 > 0xE1u) | |
1242 && ((unsigned __int16)v20 < 0x5Bu || (unsigned __int16)v20 > 0x5Du) | |
1243 && ((unsigned __int16)v20 < 0x49u || (unsigned __int16)v20 > 0x4Bu) | |
1244 && ((unsigned __int16)v20 < 0xFDu || (unsigned __int16)v20 > 0xFFu) | |
1245 && ((unsigned __int16)v20 < 0x61u || (unsigned __int16)v20 > 0x63u) | |
1246 && ((unsigned __int16)v20 < 0x10u || (unsigned __int16)v20 > 0x12u) ) | |
1247 break; | |
1248 } | |
1249 pParty->monster_id_for_hunting[(int)((char *)v8->ptr_1C - 102)] = rand() % 258 + 1; | |
1250 } | |
1251 } | |
1252 } | |
1253 bountyHunting_monster_id_for_hunting = pParty->monster_id_for_hunting[(int)((char *)v8->ptr_1C - 102)]; | |
1254 if ( !pParty->monster_for_hunting_killed[(int)((char *)v8->ptr_1C - 102)] ) | |
1255 { | |
1256 bountyHunting_text = pNPCTopics[351].pText;//"В этом месяцу назначена награда за голову %s..." | |
1257 if ( !pParty->monster_id_for_hunting[(int)((char *)v8->ptr_1C - 102)] ) | |
1258 bountyHunting_text = pNPCTopics[353].pText;//"Кое кто уже приходил в этом месяце за наградой" | |
1298 | 1259 } |
1260 else | |
1261 { | |
1529 | 1262 if ( pParty->monster_id_for_hunting[(int)((char *)v8->ptr_1C - 102)] > 0 )//get prize |
1298 | 1263 { |
1529 | 1264 party_finds_gold(100 * pMonsterStats->pInfos[(unsigned __int16)pParty->monster_id_for_hunting[(int)((char *)v8->ptr_1C - 102)]].uLevel, 0); |
1265 for ( uint i = 0; i < 4; ++i ) | |
1266 pParty->pPlayers[i].SetVariable(VAR_Award, 86); | |
1267 pParty->uNumBountiesCollected += 100 * pMonsterStats->pInfos[pParty->monster_id_for_hunting[(int)((char *)v8->ptr_1C - 102)]].uLevel; | |
1268 pParty->monster_id_for_hunting[(int)((char *)v8->ptr_1C - 102)] = 0; | |
1269 pParty->monster_for_hunting_killed[(int)((char *)v8->ptr_1C - 102)] = false; | |
1270 } | |
1271 bountyHunting_text = pNPCTopics[352].pText;//"Поздравляю! Вы успешно..." | |
1272 } | |
1273 } | |
1274 else if ( uMessageParam == HOUSE_DIALOGUE_TOWNHALL_PAY_FINE ) | |
1275 pKeyActionMap->EnterText(1, 10, v8); | |
1276 break; | |
1277 } | |
1411 | 1278 case BuildingType_Bank: |
1298 | 1279 { |
1280 if ( dialog_menu_id >= 7 && dialog_menu_id <= 8 ) | |
1281 pKeyActionMap->EnterText(1, 10, v8); | |
1282 return; | |
1283 break; | |
1284 } | |
1411 | 1285 case BuildingType_WeaponShop: |
1286 case BuildingType_ArmorShop: | |
1287 case BuildingType_MagicShop: | |
1288 case BuildingType_AlchemistShop: | |
1289 case BuildingType_Tavern: | |
1290 case BuildingType_Temple: | |
1291 case BuildingType_Training: | |
1298 | 1292 { |
1293 break; | |
1294 } | |
1295 default: | |
1296 { | |
1297 return; | |
1298 break; | |
1299 } | |
1300 } | |
1301 | |
1302 /* | |
1411 | 1303 if ( in_current_building_type > BuildingType_Tavern ) |
1298 | 1304 { |
1411 | 1305 if ( in_current_building_type == BuildingType_Bank ) |
1298 | 1306 { |
1307 if ( dialog_menu_id >= 7 && dialog_menu_id <= 8 ) | |
1308 pKeyActionMap->EnterText(1, 10, v8); | |
1309 return; | |
1310 } | |
1411 | 1311 if ( in_current_building_type != BuildingType_Temple && in_current_building_type != BuildingType_Training ) |
1298 | 1312 return; |
1313 } | |
1314 //else | |
1411 | 1315 if ( in_current_building_type < BuildingType_Tavern ) |
1298 | 1316 { |
1317 if (in_current_building_type <= 0) | |
1318 return; | |
1411 | 1319 if ( in_current_building_type > BuildingType_AlchemistShop ) |
1298 | 1320 { |
1411 | 1321 if ( in_current_building_type <= BuildingType_16 ) |
1298 | 1322 { |
1323 if ( (signed __int64)__PAIR__( | |
1324 *(int *)&stru_AA1058[3].pSounds[8 * (unsigned int)v8->ptr_1C + 44472], | |
1325 *(int *)&stru_AA1058[3].pSounds[8 * (unsigned int)v8->ptr_1C + 44468]) >= (signed __int64)pParty->uTimePlayed ) | |
1326 { | |
1327 v32 = 0; | |
1328 do | |
1329 { | |
1330 //v33 = *(&pParty->pPlayers[1].pInstalledBeacons[0].field_18 + 9 * (v32 + 12 * (unsigned int)v8->ptr_1C)); | |
1331 v33 = pParty->SpellBooksInGuilds[v8->par1C-139][v32].uItemID; | |
1332 if ( v33 ) | |
1333 { | |
1334 v34 = pIcons_LOD->LoadTexture(pItemsTable->pItems[v33].pIconName, TEXTURE_16BIT_PALETTE); | |
1335 v8 = window_SpeakInHouse; | |
1336 ItemsInShopTexture[v32] = &pIcons_LOD->pTextures[v34]; | |
1337 } | |
1338 ++v32; | |
1339 } | |
1340 while ( v32 < 12 ); | |
1341 } | |
1342 else | |
1343 { | |
1344 SpellBookGenerator(); | |
1345 v30 = window_SpeakInHouse->ptr_1C; | |
1346 v31 = pParty->uTimePlayed | |
1347 + (signed __int64)((double)(0xA8C000 | |
1348 //* (signed int)p2DEvents_minus1[26 * (unsigned int)ptr_507BC0->ptr_1C]) | |
1349 * (signed int)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].field_1C) | |
1350 * 0.033333335); | |
1351 *(int *)&stru_AA1058[3].pSounds[8 * (int)v30 + 44468] = v31; | |
1352 *(int *)&stru_AA1058[3].pSounds[8 * (int)v30 + 44472] = HIDWORD(v31); | |
1353 } | |
1354 return; | |
1355 } | |
1411 | 1356 if ( in_current_building_type != BuildingType_TownHall ) |
1298 | 1357 return; |
1411 | 1358 if ( in_current_building_type == BuildingType_TownHall ) |
1298 | 1359 { |
1360 if ( uMessageParam == 99 ) | |
1361 { | |
1362 v10 = (int)((char *)v8->ptr_1C - 102); | |
1363 v56 = v10; | |
1364 v11 = 8 * v10 + 11325428; | |
1365 if ( (signed __int64)__PAIR__(pParty->field_3C.field_0[2 * v10 + 1], pParty->field_3C.field_0[2 * v10]) >= (signed __int64)pParty->uTimePlayed ) | |
1366 { | |
1367 v13 = 0; | |
1368 } | |
1369 else | |
1370 { | |
1371 v12 = v10; | |
1372 v13 = 0; | |
1373 pParty->field_75A[v12] = 0; | |
1374 *(_QWORD *)v11 = (signed __int64)((double)(309657600 * (pParty->uCurrentMonth + 12i64 * pParty->uCurrentYear - 14015)) * 0.033333335); | |
1375 v14 = rand() % 258; | |
1376 v15 = window_SpeakInHouse; | |
1377 pParty->field_750[v12] = v14 + 1; | |
1378 v16 = (int)((char *)v15->ptr_1C - 102); | |
1379 if ( v16 ) | |
1380 { | |
1381 v17 = v16 - 1; | |
1382 if ( v17 ) | |
1383 { | |
1384 v18 = v17 - 1; | |
1385 if ( v18 ) | |
1386 { | |
1387 v19 = v18 - 1; | |
1388 if ( v19 ) | |
1389 { | |
1390 if ( v19 == 1 ) | |
1391 { | |
1392 while ( 1 ) | |
1393 { | |
1394 v20 = pParty->field_750[v12]; | |
1395 if ( (unsigned __int16)v20 < 0x73u || (unsigned __int16)v20 > 0x84u ) | |
1396 { | |
1397 if ( ((unsigned __int16)v20 < 0xE8u || (unsigned __int16)v20 > 0xF9u) | |
1398 && ((unsigned __int16)v20 < 0x85u || (unsigned __int16)v20 > 0x96u) | |
1399 && ((unsigned __int16)v20 < 0x97u || (unsigned __int16)v20 > 0xBAu) | |
1400 && ((unsigned __int16)v20 < 0xBEu || (unsigned __int16)v20 > 0xC0u) | |
1401 && ((unsigned __int16)v20 < 0xC4u || (unsigned __int16)v20 > 0xC6u) | |
1402 && ((unsigned __int16)v20 < 0x2Bu || (unsigned __int16)v20 > 0x2Du) | |
1403 && ((unsigned __int16)v20 < 0x6Du || (unsigned __int16)v20 > 0x6Fu) | |
1404 && ((unsigned __int16)v20 < 0x46u || (unsigned __int16)v20 > 0x48u) | |
1405 && ((unsigned __int16)v20 < 0x100u || (unsigned __int16)v20 > 0x102u) | |
1406 && ((unsigned __int16)v20 < 0xD9u || (unsigned __int16)v20 > 0xDBu) | |
1407 && ((unsigned __int16)v20 < 0xC7u || (unsigned __int16)v20 > 0xC9u) | |
1408 && ((unsigned __int16)v20 < 0xE5u || (unsigned __int16)v20 > 0xE7u) | |
1409 && ((unsigned __int16)v20 < 0xDFu || (unsigned __int16)v20 > 0xE1u) | |
1410 && ((unsigned __int16)v20 < 0x5Bu || (unsigned __int16)v20 > 0x5Du) | |
1411 && ((unsigned __int16)v20 < 0x49u || (unsigned __int16)v20 > 0x4Bu) | |
1412 && ((unsigned __int16)v20 < 0xFDu || (unsigned __int16)v20 > 0xFFu) | |
1413 && ((unsigned __int16)v20 < 0x61u || (unsigned __int16)v20 > 0x63u) | |
1414 && ((unsigned __int16)v20 < 0x10u || (unsigned __int16)v20 > 0x12u) ) | |
1415 break; | |
1416 } | |
1417 pParty->field_750[v12] = rand() % 258 + 1; | |
1418 } | |
1419 } | |
1420 } | |
1421 else | |
1422 { | |
1423 while ( 1 ) | |
1424 { | |
1425 v21 = pParty->field_750[v12]; | |
1426 if ( (unsigned __int16)v21 < 0x73u || (unsigned __int16)v21 > 0x84u ) | |
1427 { | |
1428 if ( ((unsigned __int16)v21 < 0xE8u || (unsigned __int16)v21 > 0xF9u) | |
1429 && ((unsigned __int16)v21 < 0x85u || (unsigned __int16)v21 > 0x96u) | |
1430 && ((unsigned __int16)v21 < 0x97u || (unsigned __int16)v21 > 0xBAu) | |
1431 && ((unsigned __int16)v21 < 0xBEu || (unsigned __int16)v21 > 0xC0u) | |
1432 && ((unsigned __int16)v21 < 0xC4u || (unsigned __int16)v21 > 0xC6u) | |
1433 && ((unsigned __int16)v21 < 0x2Bu || (unsigned __int16)v21 > 0x2Du) | |
1434 && ((unsigned __int16)v21 < 0x5Eu || (unsigned __int16)v21 > 0x60u) | |
1435 && ((unsigned __int16)v21 < 0x43u || (unsigned __int16)v21 > 0x45u) | |
1436 && ((unsigned __int16)v21 < 0x4Fu || (unsigned __int16)v21 > 0x51u) | |
1437 && ((unsigned __int16)v21 < 0xC1u || (unsigned __int16)v21 > 0xC3u) | |
1438 && ((unsigned __int16)v21 < 0x13u || (unsigned __int16)v21 > 0x15u) | |
1439 && ((unsigned __int16)v21 < 0xFDu || (unsigned __int16)v21 > 0xFFu) | |
1440 && ((unsigned __int16)v21 < 0x61u || (unsigned __int16)v21 > 0x63u) | |
1441 && ((unsigned __int16)v21 < 0x6Au || (unsigned __int16)v21 > 0x6Cu) ) | |
1442 break; | |
1443 } | |
1444 pParty->field_750[v12] = rand() % 258 + 1; | |
1445 } | |
1446 } | |
1447 } | |
1448 else | |
1449 { | |
1450 while ( 1 ) | |
1451 { | |
1452 v22 = pParty->field_750[v12]; | |
1453 if ( (unsigned __int16)v22 < 0x73u || (unsigned __int16)v22 > 0x84u ) | |
1454 { | |
1455 if ( ((unsigned __int16)v22 < 0xE8u || (unsigned __int16)v22 > 0xF9u) | |
1456 && ((unsigned __int16)v22 < 0x85u || (unsigned __int16)v22 > 0x96u) | |
1457 && ((unsigned __int16)v22 < 0x97u || (unsigned __int16)v22 > 0xBAu) | |
1458 && ((unsigned __int16)v22 < 0xBEu || (unsigned __int16)v22 > 0xC0u) | |
1459 && ((unsigned __int16)v22 < 0xC4u || (unsigned __int16)v22 > 0xC6u) | |
1460 && ((unsigned __int16)v22 < 0x2Bu || (unsigned __int16)v22 > 0x2Du) | |
1461 && ((unsigned __int16)v22 < 0x31u || (unsigned __int16)v22 > 0x33u) | |
1462 && ((unsigned __int16)v22 < 0x34u || (unsigned __int16)v22 > 0x36u) | |
1463 && ((unsigned __int16)v22 < 0xFDu || (unsigned __int16)v22 > 0xFFu) | |
1464 && ((unsigned __int16)v22 < 0x61u || (unsigned __int16)v22 > 0x63u) | |
1465 && ((unsigned __int16)v22 < 0x1Cu || (unsigned __int16)v22 > 0x1Eu) ) | |
1466 break; | |
1467 } | |
1468 pParty->field_750[v12] = rand() % 258 + 1; | |
1469 } | |
1470 } | |
1471 } | |
1472 else | |
1473 { | |
1474 while ( 1 ) | |
1475 { | |
1476 v23 = pParty->field_750[v12]; | |
1477 if ( (unsigned __int16)v23 < 0x73u || (unsigned __int16)v23 > 0x84u ) | |
1478 { | |
1479 if ( ((unsigned __int16)v23 < 0xE8u || (unsigned __int16)v23 > 0xF9u) | |
1480 && ((unsigned __int16)v23 < 0x85u || (unsigned __int16)v23 > 0x96u) | |
1481 && ((unsigned __int16)v23 < 0x97u || (unsigned __int16)v23 > 0xBAu) | |
1482 && ((unsigned __int16)v23 < 0xBEu || (unsigned __int16)v23 > 0xC0u) | |
1483 && ((unsigned __int16)v23 < 0xC4u || (unsigned __int16)v23 > 0xC6u) | |
1484 && ((unsigned __int16)v23 < 0x2Bu || (unsigned __int16)v23 > 0x2Du) | |
1485 && ((unsigned __int16)v23 < 0x52u || (unsigned __int16)v23 > 0x54u) | |
1486 && ((unsigned __int16)v23 < 4u || (unsigned __int16)v23 > 6u) | |
1487 && ((unsigned __int16)v23 < 0x37u || (unsigned __int16)v23 > 0x39u) | |
1488 && ((unsigned __int16)v23 < 0x3Au || (unsigned __int16)v23 > 0x3Cu) | |
1489 && ((unsigned __int16)v23 < 0x3Du || (unsigned __int16)v23 > 0x3Fu) | |
1490 && ((unsigned __int16)v23 < 0xFDu || (unsigned __int16)v23 > 0xFFu) | |
1491 && ((unsigned __int16)v23 < 0x61u || (unsigned __int16)v23 > 0x63u) | |
1492 && ((unsigned __int16)v23 < 0xCDu || (unsigned __int16)v23 > 0xCFu) ) | |
1493 break; | |
1494 } | |
1495 pParty->field_750[v12] = rand() % 258 + 1; | |
1496 } | |
1497 } | |
1498 } | |
1499 else | |
1500 { | |
1501 while ( 1 ) | |
1502 { | |
1503 v24 = pParty->field_750[v12]; | |
1504 if ( (unsigned __int16)v24 < 0x73u || (unsigned __int16)v24 > 0x84u ) | |
1505 { | |
1506 if ( ((unsigned __int16)v24 < 0xEBu || (unsigned __int16)v24 > 0xFCu) | |
1507 && ((unsigned __int16)v24 < 0x85u || (unsigned __int16)v24 > 0x96u) | |
1508 && ((unsigned __int16)v24 < 0x97u || (unsigned __int16)v24 > 0xBAu) | |
1509 && ((unsigned __int16)v24 < 0xBEu || (unsigned __int16)v24 > 0xC0u) | |
1510 && ((unsigned __int16)v24 < 0xC4u || (unsigned __int16)v24 > 0xC6u) | |
1511 && ((unsigned __int16)v24 < 0x2Bu || (unsigned __int16)v24 > 0x2Du) | |
1512 && ((unsigned __int16)v24 < 0xCDu || (unsigned __int16)v24 > 0xCFu) | |
1513 && ((unsigned __int16)v24 < 0x5Eu || (unsigned __int16)v24 > 0x60u) | |
1514 && ((unsigned __int16)v24 < 0xFDu || (unsigned __int16)v24 > 0xFFu) | |
1515 && ((unsigned __int16)v24 < 0x6Du || (unsigned __int16)v24 > 0x6Fu) | |
1516 && ((unsigned __int16)v24 < 0x61u || (unsigned __int16)v24 > 0x63u) ) | |
1517 break; | |
1518 } | |
1519 pParty->field_750[v12] = rand() % 258 + 1; | |
1520 } | |
1521 } | |
1522 v10 = v56; | |
1523 } | |
1524 v25 = v10; | |
1525 v26 = pParty->field_750[v25]; | |
1526 v27 = pParty->field_75A[v25] == v13; | |
1529 | 1527 bountyHunting_monster_id_for_hunting = pParty->field_750[v25]; |
1298 | 1528 if ( v27 ) |
1529 { | |
1530 //v1 = 0; | |
1531 v27 = v26 == v13; | |
1532 v29 = (int)pNPCTopics[351].pText; | |
1533 if ( v27 ) | |
1534 v29 = (int)pNPCTopics[353].pText; | |
1529 | 1535 bountyHunting_text = (char *)v29; |
1298 | 1536 } |
1537 else | |
1538 { | |
1539 if ( v26 != v13 ) | |
1540 { | |
1541 party_finds_gold(100 * pMonsterStats->pInfos[(unsigned __int16)v26].uLevel, 0); | |
1542 v28 = pParty->pPlayers; | |
1543 do | |
1544 { | |
1545 v28->SetVariable(VAR_Award, 86); | |
1546 ++v28; | |
1547 } | |
1548 while ( (signed int)v28 < (signed int)pParty->pHirelings ); | |
1549 pParty->uNumBountiesCollected += 100 * pMonsterStats->pInfos[pParty->field_750[v25]].uLevel; | |
1550 pParty->field_750[v25] = v13; | |
1551 pParty->field_75A[v25] = v13; | |
1552 } | |
1553 //v1 = 0; | |
1529 | 1554 bountyHunting_text = pNPCTopics[352].pText; |
1298 | 1555 } |
1556 } | |
1557 else if ( uMessageParam == 100 ) | |
1558 { | |
1559 pKeyActionMap->EnterText(1, 10, v8); | |
1560 } | |
1561 } | |
1562 } | |
1563 } | |
1564 */ | |
1565 | |
1566 | |
1567 //LABEL_196: | |
1568 switch ( uMessageParam ) | |
1569 { | |
1570 case HOUSE_DIALOGUE_LEARN_SKILLS: | |
1571 { | |
1572 pDialogueWindow->eWindowType = WINDOW_MainMenu; | |
1573 UI_CreateEndConversationButton(); | |
1574 FillAviableSkillsToTeach(in_current_building_type); | |
1575 break; | |
1576 } | |
1577 case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_MAIN: | |
1578 { | |
1579 pDialogueWindow->eWindowType = WINDOW_MainMenu; | |
1580 UI_CreateEndConversationButton(); | |
1411 | 1581 InitializaDialogueOptions_Tavern(in_current_building_type); |
1298 | 1582 break; |
1583 } | |
1584 case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_RULES: | |
1585 case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_VICTORY_CONDITIONS: | |
1586 { | |
1587 dialog_menu_id = (HOUSE_DIALOGUE_MENU)uMessageParam; | |
1588 break; | |
1589 } | |
1590 case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_RESULT: | |
1591 { | |
1592 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) | |
1593 { | |
1594 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_PlayArcomage; | |
1595 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v1; | |
1596 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = v1; | |
1597 ++pMessageQueue_50CBD0->uNumMessages; | |
1598 }*/ | |
1599 pMessageQueue_50CBD0->AddMessage(UIMSG_PlayArcomage, 0, 0); | |
1600 dialog_menu_id = HOUSE_DIALOGUE_TAVERN_ARCOMAGE_RESULT; | |
1601 break; | |
1602 } | |
1603 case HOUSE_DIALOGUE_SHOP_BUY_STANDARD: | |
1604 case HOUSE_DIALOGUE_SHOP_BUY_SPECIAL: | |
1605 { | |
1529 | 1606 if ( pParty->field_3C.Shops_next_generation_time[(unsigned int)v8->ptr_1C] < (signed __int64)pParty->uTimePlayed ) |
1298 | 1607 { |
1608 GenerateStandartShopItems(); | |
1609 GenerateSpecialShopItems(); | |
1529 | 1610 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 | 1611 } |
1612 if ( uMessageParam == HOUSE_DIALOGUE_SHOP_BUY_STANDARD ) | |
1613 { | |
1614 if ( uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType] ) | |
1615 { | |
1616 for ( v43 = 0; v43 < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType]; ++v43 ) | |
1617 { | |
1618 if ( pParty->StandartItemsInShops[(int)window_SpeakInHouse->ptr_1C][v43].uItemID ) | |
1619 { | |
1620 v46 = pIcons_LOD->LoadTexture(pItemsTable->pItems[pParty->StandartItemsInShops[(int)window_SpeakInHouse->ptr_1C][v43].uItemID].pIconName, TEXTURE_16BIT_PALETTE); | |
1621 ItemsInShopTexture[v43] = &pIcons_LOD->pTextures[v46]; | |
1622 } | |
1623 } | |
1624 } | |
1411 | 1625 if ( in_current_building_type == BuildingType_WeaponShop ) |
1298 | 1626 { |
1627 v48 = 0; | |
1628 if ( uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType] ) | |
1629 { | |
1630 do | |
1631 { | |
1632 if ( pParty->StandartItemsInShops[(int)window_SpeakInHouse->ptr_1C][v48].uItemID) | |
1633 word_F8B158[v48] = rand() % (300 - ItemsInShopTexture[v48]->uTextureHeight); | |
1634 ++v48; | |
1635 } | |
1636 while ( v48 < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType] ); | |
1637 } | |
1638 } | |
1639 } | |
1640 if ( uMessageParam == HOUSE_DIALOGUE_SHOP_BUY_SPECIAL ) | |
1641 { | |
1642 if ( uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType] ) | |
1643 { | |
1644 for ( v43 = 0; v43 < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType]; ++v43 ) | |
1645 { | |
1646 if ( pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][(signed int)v43].uItemID ) | |
1647 { | |
1648 v51 = pIcons_LOD->LoadTexture(pItemsTable->pItems[pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][(signed int)v43].uItemID].pIconName, TEXTURE_16BIT_PALETTE); | |
1649 ItemsInShopTexture[v43] = &pIcons_LOD->pTextures[v51]; | |
1650 } | |
1651 } | |
1652 } | |
1411 | 1653 if ( in_current_building_type == BuildingType_WeaponShop ) |
1298 | 1654 { |
1655 v53 = 0; | |
1656 if ( uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType] ) | |
1657 { | |
1658 do | |
1659 { | |
1660 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v53].uItemID) | |
1661 word_F8B158[v53] = rand() % (300 - ItemsInShopTexture[v53]->uTextureHeight); | |
1662 ++v53; | |
1663 } | |
1664 while ( v53 < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType ] ); | |
1665 } | |
1666 } | |
1667 } | |
1668 break; | |
1669 } | |
1670 case HOUSE_DIALOGUE_SHOP_SELL: | |
1671 case HOUSE_DIALOGUE_SHOP_IDENTIFY: | |
1672 case HOUSE_DIALOGUE_SHOP_REPAIR: | |
1673 { | |
1674 dialog_menu_id = (HOUSE_DIALOGUE_MENU)uMessageParam; | |
1675 sub_421B2C_PlaceInInventory_or_DropPickedItem(); | |
1676 break; | |
1677 } | |
1678 case HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT: | |
1679 { | |
1680 pDialogueWindow->eWindowType = WINDOW_MainMenu; | |
1681 UI_CreateEndConversationButton(); | |
1411 | 1682 InitializaDialogueOptions_Shops(in_current_building_type); |
1298 | 1683 break; |
1684 } | |
1685 default: | |
1686 { | |
1687 if( uMessageParam >= HOUSE_DIALOGUE_36 && uMessageParam <= HOUSE_DIALOGUE_GUILD_LEARN_SKILL ) | |
1688 { | |
1689 v36 = (signed __int64)(p2DEvents[(unsigned int)v8->ptr_1C - 1].flt_24 * 500.0); | |
1690 v37 = v36 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; | |
1691 if ( v37 < v36 / 3 ) | |
1692 v37 = v36 / 3; | |
1693 //if (false) | |
1694 if(byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][uMessageParam-36]) | |
1695 //if ( *(&byte_4ED94C[37 * v35->uClass] + v55) ) | |
1696 { | |
1697 //v38 = (int)(&pPlayers[uActiveCharacter]->uIntelligence + uMessageParam); | |
1698 if ( !pPlayers[uActiveCharacter]->pActiveSkills[uMessageParam - 36] ) | |
1699 { | |
1700 if ( pParty->uNumGold < v37 ) | |
1701 { | |
1702 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2); | |
1411 | 1703 if ( in_current_building_type == BuildingType_Training || in_current_building_type == BuildingType_Tavern ) |
1298 | 1704 v39 = 4; |
1705 else | |
1706 v39 = 2; | |
1707 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)v39); | |
1708 } | |
1709 else | |
1710 { | |
1711 Party::TakeGold(v37); | |
1712 dword_F8B1E4 = 1; | |
1713 pPlayers[uActiveCharacter]->pActiveSkills[uMessageParam - 36] = 1; | |
1714 pPlayers[uActiveCharacter]->PlaySound(SPEECH_78, 0); | |
1715 } | |
1716 } | |
1717 } | |
1718 } | |
1719 break; | |
1720 } | |
1721 } | |
1722 /* | |
1723 if ( uMessageParam != 95 && uMessageParam != 2 ) | |
1724 { | |
1725 if ( uMessageParam == 3 ) | |
1726 { | |
1727 dialog_menu_id = 3; | |
1728 } | |
1729 else | |
1730 { | |
1731 if ( uMessageParam == 4 ) | |
1732 { | |
1733 dialog_menu_id = 4; | |
1734 } | |
1735 else | |
1736 { | |
1737 if ( uMessageParam != 5 ) | |
1738 { | |
1739 if ( uMessageParam > 35 ) | |
1740 { | |
1741 if ( uMessageParam <= 72 ) | |
1742 { | |
1743 v35 = pPlayers[uActiveCharacter]; | |
1744 //v36 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (unsigned int)v8->ptr_1C] * 500.0); | |
1745 v36 = (signed __int64)(p2DEvents[(unsigned int)v8->ptr_1C - 1].flt_24 * 500.0); | |
1746 v37 = v36 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; | |
1747 if ( v37 < v36 / 3 ) | |
1748 v37 = v36 / 3; | |
1749 | |
1750 __debugbreak(); | |
1751 //pSkillAvailabilityPerClass[8 + v58->uClass][4 + v23] | |
1752 // or | |
1753 //byte_4ED970_skill_learn_ability_by_class_table[v58->uClass][v23 - 36] | |
1754 // or | |
1755 //byte_4ED970_skill_learn_ability_by_class_table[v58->uClass - 1][v23 + 1] | |
1756 | |
1757 if (false) | |
1758 //if ( *(&byte_4ED94C[37 * v35->uClass] + v55) ) | |
1759 { | |
1760 v38 = (int)(&v35->uIntelligence + uMessageParam); | |
1761 if ( !*(short *)v38 ) | |
1762 { | |
1763 if ( pParty->uNumGold < v37 ) | |
1764 { | |
1765 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u); | |
1411 | 1766 if ( in_current_building_type == BuildingType_Training || in_current_building_type == BuildingType_Tavern ) |
1298 | 1767 v39 = 4; |
1768 else | |
1769 v39 = 2; | |
1770 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, v39); | |
1771 } | |
1772 else | |
1773 { | |
1774 Party::TakeGold(v37); | |
1775 dword_F8B1E4 = 1; | |
1776 *(short *)v38 = 1; | |
1777 v35->PlaySound(SPEECH_78, 0); | |
1778 } | |
1779 } | |
1780 } | |
1781 } | |
1782 else | |
1783 { | |
1784 if ( uMessageParam == 94 ) | |
1785 { | |
1786 pDialogueWindow->eWindowType = WINDOW_MainMenu; | |
1787 UI_CreateEndConversationButton(); | |
1411 | 1788 InitializaDialogueOptions_Shops(in_current_building_type); |
1298 | 1789 } |
1790 } | |
1791 } | |
1792 return; | |
1793 } | |
1794 dialog_menu_id = 5; | |
1795 } | |
1796 } | |
1797 sub_421B2C_PlaceInInventory_or_DropPickedItem(); | |
1798 return; | |
1799 } | |
1529 | 1800 if ( pParty->field_3C.Shops_next_generation_time[(unsigned int)v8->ptr_1C] < (signed __int64)pParty->uTimePlayed ) |
1298 | 1801 { |
1802 GenerateStandartShopItems(); | |
1803 GenerateSpecialShopItems(); | |
1804 v8 = window_SpeakInHouse; | |
1805 v40 = window_SpeakInHouse->par1C; | |
1806 //v3 = dword_F8B198; | |
1807 v41 = pParty->uTimePlayed | |
1808 //+ (signed __int64)((double)(11059200 * (signed int)p2DEvents_minus1[26 * (unsigned int)ptr_507BC0->ptr_1C]) | |
1809 + (signed __int64)((double)(11059200 * (signed int)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].field_1C) | |
1810 * 0.033333335); | |
1529 | 1811 pParty->field_3C.Shops_next_generation_time[v40] = v41; |
1298 | 1812 |
1813 } | |
1814 v42 = v8->ptr_1C; | |
1815 v43 = 0; | |
1816 //v44 = p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]; | |
1817 v44 = p2DEvents[(unsigned int)v8->ptr_1C - 1].uType; | |
1818 if ( uMessageParam == 2 ) | |
1819 { | |
1820 if ( uItemsAmountPerShopType[v44] ) | |
1821 { | |
1822 do | |
1823 { | |
1824 v45 = pParty->StandartItemsInShops[(int)v42][v43].uItemID; | |
1825 if ( v45 ) | |
1826 { | |
1827 v46 = pIcons_LOD->LoadTexture(pItemsTable->pItems[v45].pIconName, TEXTURE_16BIT_PALETTE); | |
1828 //v3 = dword_F8B198; | |
1829 v8 = window_SpeakInHouse; | |
1830 ItemsInShopTexture[v43] = &pIcons_LOD->pTextures[v46]; | |
1831 } | |
1832 v42 = v8->ptr_1C; | |
1833 ++v43; | |
1834 } | |
1835 //while ( v43 < (unsigned __int8)_4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] ); | |
1836 while ( v43 < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] ); | |
1837 } | |
1411 | 1838 if ( in_current_building_type == BuildingType_WeaponShop ) |
1298 | 1839 { |
1840 v47 = v8->ptr_1C; | |
1841 v48 = 0; | |
1842 //if ( _4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] ) | |
1843 if ( uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] ) | |
1844 { | |
1845 do | |
1846 { | |
1847 // if ( pParty->field_777C[9 * (v48 + 12 * (int)v47)] ) | |
1848 if ( pParty->StandartItemsInShops[(int)v47][v48].uItemID); | |
1849 { | |
1850 v49 = rand(); | |
1851 v8 = window_SpeakInHouse; | |
1852 word_F8B158[v48] = v49 % (300 - ItemsInShopTexture[v48]->uTextureHeight); | |
1853 } | |
1854 v47 = v8->ptr_1C; | |
1855 ++v48; | |
1856 } | |
1857 //while ( v48 < (unsigned __int8)_4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] ); | |
1858 while ( v48 < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] ); | |
1859 } | |
1860 } | |
1861 } | |
1862 if ( uMessageParam == 95 ) | |
1863 { | |
1864 if ( uItemsAmountPerShopType[v44] ) | |
1865 { | |
1866 do | |
1867 { | |
1868 //v50 = pParty->field_C59C[9 * (v43 + 12 * (int)v42) + 724]; | |
1869 v50=pParty->SpecialItemsInShops[(unsigned int)v42][(signed int)v43].uItemID; | |
1870 if ( v50 ) | |
1871 { | |
1872 v51 = pIcons_LOD->LoadTexture(pItemsTable->pItems[v50].pIconName, TEXTURE_16BIT_PALETTE); | |
1873 //v3 = dword_F8B198; | |
1874 v8 = window_SpeakInHouse; | |
1875 ItemsInShopTexture[v43] = &pIcons_LOD->pTextures[v51]; | |
1876 } | |
1877 v42 = v8->ptr_1C; | |
1878 ++v43; | |
1879 } | |
1880 //while ( v43 < (unsigned __int8)_4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] ); | |
1881 while ( v43 < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] ); | |
1882 } | |
1411 | 1883 if ( in_current_building_type == BuildingType_WeaponShop ) |
1298 | 1884 { |
1885 v52 = v8->ptr_1C; | |
1886 v53 = 0; | |
1887 //if ( _4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] ) | |
1888 if ( uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] ) | |
1889 { | |
1890 do | |
1891 { | |
1892 // if ( pParty->field_C59C[9 * (v53 + 12 * (int)v52) + 724] ) | |
1893 if (pParty->SpecialItemsInShops[(unsigned int)v52][v53].uItemID) | |
1894 { | |
1895 v54 = rand(); | |
1896 v8 = window_SpeakInHouse; | |
1897 word_F8B158[v53] = v54 % (300 - ItemsInShopTexture[v53]->uTextureHeight); | |
1898 } | |
1899 v52 = v8->ptr_1C; | |
1900 ++v53; | |
1901 } | |
1902 //while ( v53 < (unsigned __int8)_4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] ); | |
1903 while ( v53 < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType ] ); | |
1904 } | |
1905 } | |
1906 } | |
1907 */ | |
1908 } | |
1909 //----- (004B6943) -------------------------------------------------------- | |
1458 | 1910 void TravelByTransport() |
1298 | 1911 { |
1912 signed int v4; // ebx@1 | |
1589 | 1913 stru365_travel_info *pTravel; // esi@7 |
1298 | 1914 signed int v12; // esi@13 |
1915 signed int v13; // edi@14 | |
1916 DWORD v14; // eax@26 | |
1917 DWORD v15; // edi@26 | |
1589 | 1918 int pTextHeight; // eax@36 |
1919 int pRealTextHeight; // esi@36 | |
1920 int schedule_id; // esi@39 | |
1921 GUIButton *pButton; // ebx@39 | |
1298 | 1922 signed int v25; // eax@41 |
1589 | 1923 MapInfo pMap; // [sp-3Ch] [bp-2CCh]@62 |
1924 char pTopicArray[5][100]; // [sp+14h] [bp-27Ch]@37 | |
1925 GUIWindow travel_window; // [sp+208h] [bp-88h]@1 | |
1926 int pPrimaryTextHeight; // [sp+260h] [bp-30h]@36 | |
1927 int index; // [sp+27Ch] [bp-14h]@36 | |
1928 unsigned int pPrice; // [sp+288h] [bp-8h]@1 | |
1929 int travel_time; // [sp+28Ch] [bp-4h]@48 | |
1930 enum PlayerSpeech pSpeech; | |
1931 unsigned int pCurrentButton; | |
1298 | 1932 |
1589 | 1933 memcpy(&travel_window, window_SpeakInHouse, sizeof(travel_window)); |
1934 travel_window.uFrameX = 483; | |
1935 travel_window.uFrameWidth = 148; | |
1936 travel_window.uFrameZ = 334; | |
1298 | 1937 |
1587 | 1938 v4 = p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType == BuildingType_Stables ? 25 : 50; |
1939 v4 *= p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier; | |
1298 | 1940 |
1589 | 1941 pPrice = v4 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; |
1942 if ( (signed int)pPrice < v4 / 3 ) | |
1943 pPrice = v4 / 3; | |
1298 | 1944 if ( dialog_menu_id == HOUSE_DIALOGUE_MAIN) |
1945 { | |
1393 | 1946 if ( HouseUI_CheckIfPlayerCanInteract() ) |
1298 | 1947 { |
1589 | 1948 index = 0; |
1949 strcpy(pTopicArray[4], ""); | |
1950 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[405], pPrice); // Price: %lu gold | |
1951 pTextHeight = pFontArrus->CalcTextHeight(pTmpBuf2.data(), &travel_window, 0, 0); | |
1952 pRealTextHeight = pTextHeight + (LOBYTE(pFontArrus->uFontHeight) - 3) + 146; | |
1953 pPrimaryTextHeight = pRealTextHeight; | |
1954 pCurrentButton = 2; | |
1955 for ( uint i = pDialogueWindow->pStartingPosActiveItem; i < (unsigned int)(pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem); ++i ) | |
1298 | 1956 { |
1589 | 1957 schedule_id = transport_routes[(unsigned int)window_SpeakInHouse->ptr_1C - HOUSE_STABLES_HARMONDALE][index]; |
1958 pButton = pDialogueWindow->GetControl(i); | |
1298 | 1959 |
1589 | 1960 if (schedule_id != 255) |
1298 | 1961 { |
1610 | 1962 //if (schedule_id >= 25) |
1963 //Log::Warning(L"Transport UI: schedule overflow"); | |
1589 | 1964 if ( pCurrentButton >= 6 ) |
1298 | 1965 v25 = true; |
1966 else | |
1589 | 1967 v25 = transport_schedule[schedule_id].pSchedule[pParty->uDaysPlayed % 7]; |
1298 | 1968 } |
1969 | |
1589 | 1970 if (schedule_id != 255 && v25 && (!transport_schedule[schedule_id].uQuestBit |
1625 | 1971 || _449B57_test_bit(pParty->_quest_bits, transport_schedule[schedule_id].uQuestBit)) )//ошибка: рисуется несколько строчек одного направления путешествия |
1298 | 1972 { |
1610 | 1973 //get color for current string(определение цвета текущей строки)---------- |
1589 | 1974 if ( pDialogueWindow->pCurrentPosActiveItem == pCurrentButton ) |
1975 sprintf(pTopicArray[index], "\f%05d", TargetColor(255, 255, 155)); | |
1976 else | |
1977 sprintf(pTopicArray[index], "\f%05d", TargetColor(255, 255, 255)); | |
1978 //hired NPC premium(премия наёмного НПС)---------------------------------- | |
1979 travel_time = transport_schedule[schedule_id].uTravelTime; | |
1591 | 1980 if ( (unsigned int)window_SpeakInHouse->ptr_1C >= HOUSE_BOATS_EMERALD_ISLE ) |
1298 | 1981 { |
1982 if ( CheckHiredNPCSpeciality(Sailor) ) | |
1589 | 1983 travel_time -= 2; |
1298 | 1984 if ( CheckHiredNPCSpeciality(Navigator) ) |
1589 | 1985 travel_time -= 3; |
1298 | 1986 if ( CheckHiredNPCSpeciality(Pirate) ) |
1589 | 1987 travel_time -= 2; |
1298 | 1988 } |
1989 else | |
1990 { | |
1991 if ( CheckHiredNPCSpeciality(Horseman) ) | |
1589 | 1992 travel_time -= 2; |
1298 | 1993 } |
1994 if ( CheckHiredNPCSpeciality(Explorer) ) | |
1589 | 1995 --travel_time; |
1996 | |
1997 if ( travel_time < 1 ) | |
1998 travel_time = 1; | |
1999 if ( schedule_id != 255 ) | |
1298 | 2000 { |
1589 | 2001 memcpy(&pMap, &pMapStats->pInfos[transport_schedule[schedule_id].uMapInfoID], 0x44u); |
2002 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[404], travel_time, pMap.pName); // Time - %d days, destination %s | |
2003 strcat(pTopicArray[index], pTmpBuf.data()); | |
2004 strcat(pTopicArray[index], "\n \n"); | |
2005 pButton->uY = pRealTextHeight; | |
2006 pTextHeight = pFontArrus->CalcTextHeight(pTmpBuf.data(), &travel_window, 0, 0); | |
2007 pButton->uHeight = pTextHeight; | |
1625 | 2008 pButton->uW = pButton->uY + pTextHeight - 1; |
1589 | 2009 pRealTextHeight += (LOBYTE(pFontArrus->uFontHeight) - 3) + pTextHeight; |
1298 | 2010 } |
2011 } | |
2012 else | |
2013 { | |
1589 | 2014 strcpy(pTopicArray[index], ""); |
2015 if ( pButton ) | |
1298 | 2016 { |
1589 | 2017 pButton->uW = 0; |
2018 pButton->uHeight = 0; | |
2019 pButton->uY = 0; | |
1298 | 2020 } |
2021 } | |
1589 | 2022 ++index; |
2023 ++pCurrentButton; | |
1298 | 2024 } |
1589 | 2025 if ( pRealTextHeight != pPrimaryTextHeight ) |
1298 | 2026 { |
1589 | 2027 sprintf(pTmpBuf.data(), "%s\n \n%s%s%s%s%s", pTmpBuf2.data(), pTopicArray[0], pTopicArray[1], pTopicArray[2], pTopicArray[3], pTopicArray[4]); |
2028 travel_window.DrawTitleText(pFontArrus, 0, 146, 0, pTmpBuf.data(), 3); | |
1298 | 2029 } |
2030 else | |
2031 { | |
1589 | 2032 travel_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[561], &travel_window, 0, 0)) / 2 + 138,//"Извините, приходите в другой день" |
1587 | 2033 TargetColor(255, 255, 255), pGlobalTXT_LocalizationStrings[561], 3); |
1298 | 2034 pAudioPlayer->StopChannels(-1, -1); |
2035 } | |
2036 } | |
2037 } | |
1589 | 2038 else//после нажатия топика |
1298 | 2039 { |
2040 if ( dialog_menu_id >= HOUSE_DIALOGUE_TRANSPORT_SCHEDULE_1 && dialog_menu_id <= HOUSE_DIALOGUE_TRANSPORT_SCHEDULE_4 ) | |
2041 { | |
1589 | 2042 if ( pParty->uNumGold < pPrice ) |
1298 | 2043 { |
1589 | 2044 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);//"У вас не хватает золота" |
1298 | 2045 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_Greeting_2); |
2046 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
2047 return; | |
2048 } | |
2049 | |
1589 | 2050 Party::TakeGold(pPrice); |
1298 | 2051 |
1589 | 2052 pTravel = &transport_schedule[transport_routes[(unsigned int)window_SpeakInHouse->ptr_1C - HOUSE_STABLES_HARMONDALE][dialog_menu_id - HOUSE_DIALOGUE_TRANSPORT_SCHEDULE_1]]; |
2053 if ( pTravel->pSchedule[pParty->uDaysPlayed % 7] ) | |
1298 | 2054 { |
1589 | 2055 if ( _stricmp(pCurrentMapName, pMapStats->pInfos[pTravel->uMapInfoID].pFilename) ) |
1298 | 2056 { |
2057 SaveGame(1, 0); | |
1589 | 2058 strcpy(pCurrentMapName, pMapStats->pInfos[pTravel->uMapInfoID].pFilename); |
1298 | 2059 |
2060 dword_6BE364_game_settings_1 |= 1u; | |
2061 _5B65B8_npcdata_hiword_house_or_other = 0; | |
2062 dword_5B65BC = 0; | |
1589 | 2063 _5B65B4_npcdata_loword_house_or_other = pTravel->arrival_rot_y; |
1298 | 2064 uGameState = GAME_STATE_2; |
1589 | 2065 _5B65A8_npcdata_uflags_or_other = pTravel->arrival_x; |
2066 _5B65AC_npcdata_fame_or_other = pTravel->arrival_y; | |
2067 _5B65B0_npcdata_rep_or_other = pTravel->arrival_z; | |
2068 dword_5B65C0 = pTravel->arrival_x | pTravel->arrival_y | pTravel->arrival_z | pTravel->arrival_rot_y; | |
1298 | 2069 } |
2070 else | |
2071 { | |
2072 pIndoorCamera->sRotationY = 0; | |
2073 pParty->uFlags |= 2u; | |
1589 | 2074 pParty->vPosition.x = pTravel->arrival_x; |
2075 pParty->vPosition.y = pTravel->arrival_y; | |
2076 pParty->vPosition.z = pTravel->arrival_z; | |
1298 | 2077 pParty->uFallStartY = pParty->vPosition.z; |
2078 pParty->sRotationX = 0; | |
1589 | 2079 pParty->sRotationY = pTravel->arrival_rot_y; |
1298 | 2080 } |
2081 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful); | |
1589 | 2082 v12 = pTravel->uTravelTime; |
1298 | 2083 if ( (signed int)window_SpeakInHouse->ptr_1C >= 63 ) |
2084 { | |
1589 | 2085 pSpeech = SPEECH_SetSail; |
1298 | 2086 v13 = 2500; |
2087 if ( CheckHiredNPCSpeciality(Sailor) ) | |
2088 v12 -= 2; | |
2089 if ( CheckHiredNPCSpeciality(Navigator) ) | |
2090 v12 -= 3; | |
2091 if ( CheckHiredNPCSpeciality(Pirate) ) | |
2092 v12 -= 2; | |
2093 } | |
2094 else | |
2095 { | |
1589 | 2096 pSpeech = SPEECH_CarriageReady; |
1298 | 2097 v13 = 1500; |
2098 if ( CheckHiredNPCSpeciality(Horseman) ) | |
2099 v12 -= 2; | |
2100 } | |
2101 if ( CheckHiredNPCSpeciality(Explorer) ) | |
2102 --v12; | |
2103 if ( v12 < 1 ) | |
2104 v12 = 1; | |
2105 RestAndHeal(1440 * v12); | |
1589 | 2106 pPlayers[uActiveCharacter]->PlaySound(pSpeech, 0); |
1298 | 2107 v14 = GetTickCount(); |
2108 v15 = v14 + v13; | |
2109 if ( v15 < v14 ) | |
2110 v15 = v14; | |
2111 while ( GetTickCount() < v15 ) | |
2112 sqrt(3.1415926); | |
2113 while ( sub_4BD8B5() ) | |
2114 ; | |
2115 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
2116 return; | |
2117 } | |
2118 else | |
2119 { | |
2120 dialog_menu_id = HOUSE_DIALOGUE_MAIN; | |
2121 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); | |
2122 } | |
2123 } | |
2124 } | |
2125 } | |
2126 //----- (004B68EA) -------------------------------------------------------- | |
2127 bool __fastcall IsTravelAvailable(int a1) | |
2128 { | |
1587 | 2129 for ( uint i = 0; i < 4; ++i ) |
1298 | 2130 { |
1587 | 2131 if ( transport_schedule[transport_routes[a1][i]].pSchedule[pParty->uDaysPlayed % 7] ) |
1298 | 2132 { |
1587 | 2133 if (!transport_schedule[transport_routes[a1][i]].uQuestBit || _449B57_test_bit(pParty->_quest_bits, transport_schedule[transport_routes[a1][i]].uQuestBit)) |
1298 | 2134 return true; |
2135 } | |
2136 } | |
2137 return false; | |
2138 } | |
2139 | |
2140 //----- (004B7911) -------------------------------------------------------- | |
1458 | 2141 void TownHallDialog() |
1298 | 2142 { |
2143 int v1; // eax@10 | |
2144 int v2; // esi@10 | |
1529 | 2145 signed int pStringSum; // ebx@24 |
1298 | 2146 signed int v16; // ebx@28 |
2147 int v17; // ebx@28 | |
1529 | 2148 GUIButton *pButton; // eax@30 |
2149 int pTextHeight; // eax@30 | |
2150 unsigned __int16 pTextColor; // ax@30 | |
2151 GUIWindow window; // [sp+60h] [bp-BCh]@21 | |
2152 GUIWindow townHall_window; // [sp+B4h] [bp-68h]@1 | |
1298 | 2153 int v29; // [sp+10Ch] [bp-10h]@28 |
2154 int v31; // [sp+114h] [bp-8h]@29 | |
2155 GUIFont *pOutString; // [sp+118h] [bp-4h]@21 | |
2156 | |
1529 | 2157 memcpy(&townHall_window, window_SpeakInHouse, sizeof(townHall_window)); |
2158 townHall_window.uFrameX = 483; | |
2159 townHall_window.uFrameWidth = 148; | |
2160 townHall_window.uFrameZ = 334; | |
2161 sprintf(pTmpBuf.data(), "%s: %d", pGlobalTXT_LocalizationStrings[605], pParty->uFine);//Текущий штраф | |
2162 townHall_window.DrawTitleText(pFontArrus, 0, 260, TargetColor(0xFFu, 0xFFu, 0x9Bu), pTmpBuf.data(), 3); | |
1298 | 2163 switch(dialog_menu_id) |
2164 { | |
1529 | 2165 case HOUSE_DIALOGUE_MAIN: |
2166 { | |
2167 pStringSum = 1; | |
2168 pTextHeight = 0; | |
2169 pShopOptions[0] = pGlobalTXT_LocalizationStrings[604];//Охота за вознаграждение | |
2170 if ( pParty->uFine > 0 ) | |
2171 { | |
2172 pShopOptions[1] = pGlobalTXT_LocalizationStrings[603];//Заплатить штраф | |
2173 pStringSum = 2; | |
2174 } | |
2175 for ( uint i = 0; i < pStringSum; ++i ) | |
2176 pTextHeight += pFontArrus->CalcTextHeight(pShopOptions[i], &townHall_window, 0, 0); | |
2177 v29 = (100 - pTextHeight) / pStringSum; | |
2178 v16 = 80 - pStringSum * ((100 - pTextHeight) / pStringSum); | |
2179 v17 = (v16 / 2) - v29 / 2 + 158; | |
2180 if ( pDialogueWindow->pNumPresenceButton > 0 ) | |
2181 { | |
2182 v31 = 2; | |
2183 uint j = 0; | |
2184 for ( uint i = pDialogueWindow->pStartingPosActiveItem; | |
2185 i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) | |
2186 { | |
2187 pButton = pDialogueWindow->GetControl(i); | |
2188 pButton->uY = v29 + v17; | |
2189 pTextHeight = pFontArrus->CalcTextHeight(pShopOptions[j], &townHall_window, 0, 0); | |
2190 pButton->uHeight = pTextHeight; | |
1625 | 2191 v17 = pButton->uY + pTextHeight - 1; |
1529 | 2192 pButton->uW = v17; |
2193 pTextColor = TargetColor(0xFFu, 0xFFu, 0x9Bu); | |
2194 if ( pDialogueWindow->pCurrentPosActiveItem != v31 ) | |
2195 pTextColor = TargetColor(0xFFu, 0xFFu, 0xFFu); | |
1625 | 2196 townHall_window.DrawTitleText(pFontArrus, 0, pButton->uY, pTextColor, pShopOptions[j], 3); |
1529 | 2197 ++v31; |
2198 ++j; | |
2199 } | |
2200 } | |
2201 break; | |
2202 } | |
2203 case HOUSE_DIALOGUE_TOWNHALL_MESSAGE: | |
2204 { | |
2205 sprintf(pTmpBuf.data(), "\f%05d%s\f%05d", TargetColor(0xFFu, 0xFFu, 0x9Bu), | |
2206 pMonsterStats->pInfos[bountyHunting_monster_id_for_hunting].pName, TargetColor(0xFFu, 0xFFu, 0xFFu)); | |
2207 sprintf(pTmpBuf2.data(), bountyHunting_text, pTmpBuf.data(), 100 * pMonsterStats->pInfos[bountyHunting_monster_id_for_hunting].uLevel); | |
2208 current_npc_text = pTmpBuf2.data(); | |
2209 memcpy(&window, pDialogueWindow, sizeof(window)); | |
2210 window.uFrameWidth = 458; | |
2211 window.uFrameZ = 457; | |
2212 pOutString = pFontArrus; | |
2213 pTextHeight = pFontArrus->CalcTextHeight(pTmpBuf2.data(), &window, 13, 0) + 7; | |
2214 if ( 352 - pTextHeight < 8 ) | |
2215 { | |
2216 pOutString = pFontCreate; | |
2217 pTextHeight = pFontCreate->CalcTextHeight(current_npc_text, &window, 13, 0) + 7; | |
2218 } | |
2219 pRenderer->GetLeather(8, 352 - pTextHeight, pIcons_LOD->GetTexture(uTextureID_Leather), pIcons_LOD->GetTexture(uTextureID_Leather)->uTextureHeight - pTextHeight); | |
2220 pRenderer->DrawTextureIndexed(8, 347 - pTextHeight, pTexture_591428); | |
2221 window.DrawText(pOutString, 13, 354 - pTextHeight, 0, FitTextInAWindow(current_npc_text, pOutString, &window, 13, 0), 0, 0, 0); | |
2222 break; | |
2223 } | |
2224 case HOUSE_DIALOGUE_TOWNHALL_PAY_FINE: | |
2225 { | |
2226 if ( window_SpeakInHouse->receives_keyboard_input_2 == WINDOW_INPUT_IN_PROGRESS) | |
2227 { | |
2228 sprintfex(pTmpBuf.data(), "%s\n%s", pGlobalTXT_LocalizationStrings[606], pGlobalTXT_LocalizationStrings[112]); // "Pay" "How Much?" | |
2229 townHall_window.DrawTitleText(pFontArrus, 0, 146, TargetColor(0xFFu, 0xFFu, 0x9Bu), pTmpBuf.data(), 3); | |
2230 townHall_window.DrawTitleText(pFontArrus, 0, 186, TargetColor(0xFFu, 0xFFu, 0xFFu), (const char *)pKeyActionMap->pPressedKeysBuffer, 3); | |
2231 townHall_window.DrawFlashingInputCursor(pFontArrus->GetLineWidth((const char *)pKeyActionMap->pPressedKeysBuffer) / 2 + 80, 185, pFontArrus); | |
2232 return; | |
2233 } | |
2234 if ( window_SpeakInHouse->receives_keyboard_input_2 == WINDOW_INPUT_CONFIRMED) | |
2235 { | |
2236 v1 = atoi((const char *)pKeyActionMap->pPressedKeysBuffer); | |
2237 v2 = atoi((const char *)pKeyActionMap->pPressedKeysBuffer); | |
2238 if ( v1 <= 0 ) | |
2239 { | |
2240 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
2241 return; | |
2242 } | |
2243 if ( v1 > pParty->uNumGold ) | |
2244 { | |
2245 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful); | |
2246 v2 = pParty->uNumGold; | |
2247 } | |
2248 if ( v2 > pParty->uFine ) | |
2249 v2 = pParty->uFine; | |
2250 Party::TakeGold(v2); | |
2251 pParty->uFine -= v2; | |
2252 if ( pParty->uFine < 0 ) | |
2253 pParty->uFine = 0; | |
2254 if ( uActiveCharacter ) | |
2255 pPlayers[uActiveCharacter]->PlaySound(SPEECH_81, 0); | |
2256 } | |
2257 if ( window_SpeakInHouse->receives_keyboard_input_2 == WINDOW_INPUT_CANCELLED) | |
2258 { | |
2259 window_SpeakInHouse->receives_keyboard_input_2 = WINDOW_INPUT_NONE; | |
2260 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
2261 } | |
2262 break; | |
2263 } | |
2264 default: | |
2265 break; | |
1298 | 2266 } |
2267 return; | |
2268 } | |
2269 | |
2270 //----- (004B7D7E) -------------------------------------------------------- | |
1458 | 2271 void BankDialog() |
1298 | 2272 { |
1573 | 2273 int entered_sum; // eax@19 |
2274 unsigned int takes_sum; // esi@19 | |
2275 unsigned __int16 pColorText; // ax@27 | |
2276 GUIWindow bank_window; // [sp+Ch] [bp-5Ch]@1 | |
1298 | 2277 |
1573 | 2278 memcpy(&bank_window, window_SpeakInHouse, sizeof(bank_window)); |
2279 bank_window.uFrameX = 483; | |
2280 bank_window.uFrameWidth = 148; | |
2281 bank_window.uFrameZ = 334; | |
2282 sprintf(pTmpBuf.data(), "%s: %d", pGlobalTXT_LocalizationStrings[25], pParty->uNumGoldInBank);//Баланс | |
2283 bank_window.DrawTitleText(pFontArrus, 0, 220, TargetColor(0xFFu, 0xFFu, 0x9Bu), pTmpBuf.data(), 3); | |
1298 | 2284 switch(dialog_menu_id) |
2285 { | |
1573 | 2286 case HOUSE_DIALOGUE_MAIN: |
2287 { | |
2288 pColorText = TargetColor(0xFFu, 0xFFu, 0x9Bu); | |
2289 if ( pDialogueWindow->pCurrentPosActiveItem != 2 ) | |
2290 pColorText = TargetColor(0xFFu, 0xFFu, 0xFFu); | |
2291 bank_window.DrawTitleText(pFontArrus, 0, 146, pColorText, pGlobalTXT_LocalizationStrings[60], 3); | |
2292 pColorText = TargetColor(0xFFu, 0xFFu, 0x9Bu); | |
2293 if ( pDialogueWindow->pCurrentPosActiveItem != 3 ) | |
2294 pColorText = TargetColor(0xFFu, 0xFFu, 0xFFu); | |
2295 bank_window.DrawTitleText(pFontArrus, 0, 176, pColorText, pGlobalTXT_LocalizationStrings[244], 3); | |
2296 break; | |
2297 } | |
2298 case HOUSE_DIALOGUE_BANK_PUT_GOLD: | |
2299 { | |
2300 if ( window_SpeakInHouse->receives_keyboard_input_2 == WINDOW_INPUT_IN_PROGRESS) | |
2301 { | |
2302 sprintf(pTmpBuf.data(), "%s\n%s", pGlobalTXT_LocalizationStrings[60], pGlobalTXT_LocalizationStrings[112]);//"Положить" "Сколько?" | |
2303 bank_window.DrawTitleText(pFontArrus, 0, 146, TargetColor(0xFFu, 0xFFu, 0x9Bu), pTmpBuf.data(), 3); | |
2304 bank_window.DrawTitleText(pFontArrus, 0, 186, TargetColor(0xFFu, 0xFFu, 0xFFu), (const char *)pKeyActionMap->pPressedKeysBuffer, 3); | |
2305 bank_window.DrawFlashingInputCursor(pFontArrus->GetLineWidth((const char *)pKeyActionMap->pPressedKeysBuffer) / 2 + 80, 185, pFontArrus); | |
2306 return; | |
2307 } | |
2308 if ( window_SpeakInHouse->receives_keyboard_input_2 == WINDOW_INPUT_CONFIRMED) | |
2309 { | |
2310 entered_sum = atoi((const char *)pKeyActionMap->pPressedKeysBuffer); | |
2311 takes_sum = entered_sum; | |
2312 if ( !entered_sum ) | |
2313 { | |
2314 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
2315 return; | |
2316 } | |
2317 if ( entered_sum > pParty->uNumGold ) | |
2318 { | |
2319 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful); | |
2320 takes_sum = pParty->uNumGold; | |
2321 } | |
2322 if ( takes_sum ) | |
2323 { | |
2324 Party::TakeGold(takes_sum); | |
2325 pParty->uNumGoldInBank += takes_sum; | |
2326 if ( uActiveCharacter ) | |
2327 pPlayers[uActiveCharacter]->PlaySound(SPEECH_81, 0); | |
2328 } | |
2329 window_SpeakInHouse->receives_keyboard_input_2 = WINDOW_INPUT_NONE; | |
2330 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
2331 return; | |
2332 } | |
2333 if (window_SpeakInHouse->receives_keyboard_input_2 == WINDOW_INPUT_CANCELLED) | |
2334 { | |
2335 window_SpeakInHouse->receives_keyboard_input_2 = WINDOW_INPUT_NONE; | |
2336 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
2337 } | |
2338 return; | |
2339 } | |
2340 case HOUSE_DIALOGUE_BANK_GET_GOLD: | |
2341 { | |
2342 if ( window_SpeakInHouse->receives_keyboard_input_2 == WINDOW_INPUT_IN_PROGRESS) | |
2343 { | |
2344 sprintfex(pTmpBuf.data(), "%s\n%s", pGlobalTXT_LocalizationStrings[244], pGlobalTXT_LocalizationStrings[112]);//"Снять" "Сколько?" | |
2345 bank_window.DrawTitleText(pFontArrus, 0, 146, TargetColor(0xFFu, 0xFFu, 0x9Bu), pTmpBuf.data(), 3); | |
2346 bank_window.DrawTitleText(pFontArrus, 0, 186, TargetColor(0xFFu, 0xFFu, 0xFFu), (const char *)pKeyActionMap->pPressedKeysBuffer, 3); | |
2347 bank_window.DrawFlashingInputCursor(pFontArrus->GetLineWidth((const char *)pKeyActionMap->pPressedKeysBuffer) / 2 + 80, 185, pFontArrus); | |
2348 return; | |
2349 } | |
2350 if ( window_SpeakInHouse->receives_keyboard_input_2 == WINDOW_INPUT_CONFIRMED) | |
2351 { | |
2352 window_SpeakInHouse->receives_keyboard_input_2 = WINDOW_INPUT_NONE; | |
2353 entered_sum = atoi((const char *)pKeyActionMap->pPressedKeysBuffer); | |
2354 takes_sum = entered_sum; | |
2355 if ( entered_sum ) | |
2356 { | |
2357 if ( entered_sum > pParty->uNumGoldInBank ) | |
2358 { | |
2359 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful); | |
2360 takes_sum = pParty->uNumGoldInBank; | |
2361 } | |
2362 if ( takes_sum ) | |
2363 { | |
2364 Party::SetGold(pParty->uNumGold + takes_sum); | |
2365 pParty->uNumGoldInBank -= takes_sum; | |
2366 } | |
2367 } | |
2368 window_SpeakInHouse->receives_keyboard_input_2 = WINDOW_INPUT_NONE; | |
2369 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
2370 return; | |
2371 } | |
2372 if ( window_SpeakInHouse->receives_keyboard_input_2 == WINDOW_INPUT_CANCELLED) | |
2373 { | |
2374 window_SpeakInHouse->receives_keyboard_input_2 = WINDOW_INPUT_NONE; | |
2375 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
2376 } | |
2377 return; | |
2378 } | |
2379 default: | |
2380 { | |
2381 break; | |
2382 } | |
1298 | 2383 } |
2384 } | |
2385 // F8B19C: using guessed type int dword_F8B19C; | |
2386 | |
2387 //----- (004B8285) -------------------------------------------------------- | |
1458 | 2388 void TavernDialog() |
1298 | 2389 { |
1630 | 2390 int pPriceRoom; |
2391 int pPriceFood; | |
2392 int pPriceSkill; | |
1298 | 2393 int pItemNum; |
2394 double v2; // st7@1 | |
2395 int pNumString; // edi@16 | |
2396 signed int v9; // esi@16 | |
2397 unsigned int pColorText; // eax@57 | |
2398 GUIButton *pButton; // eax@65 | |
1630 | 2399 int pSkillCount; |
2400 signed int pOptionsCount; // edi@77 | |
1298 | 2401 signed int i; // esi@79 |
2402 signed int v53; // edi@81 | |
2403 int v54; // edi@81 | |
1630 | 2404 const char *pText; // [sp-4h] [bp-278h]@93 |
1298 | 2405 char pTopic1[100]; // [sp+Ch] [bp-268h]@55 |
2406 char pTopic4[100]; // [sp+70h] [bp-204h]@59 | |
2407 char pTopic2[100]; // [sp+D4h] [bp-1A0h]@57 | |
2408 char pTopic3[100]; // [sp+138h] [bp-13Ch]@59 | |
2409 GUIWindow dialog_window; // [sp+1F0h] [bp-84h]@1 | |
1630 | 2410 int v91; // [sp+270h] [bp-4h]@3 |
2411 unsigned int pTopic1Height; // [sp+26Fh] [bp-5h]@55 | |
2412 unsigned __int8 pTopic2Height; // [sp+267h] [bp-Dh]@57 | |
1298 | 2413 unsigned __int8 pTopic3Height; // [sp+253h] [bp-21h]@59 |
2414 unsigned __int8 pTopic4Height; | |
2415 int pTextHeight; | |
1630 | 2416 int all_text_height; // [sp+260h] [bp-14h]@18 |
2417 GUIFont *pOutString; | |
1298 | 2418 |
2419 memcpy(&dialog_window, window_SpeakInHouse, sizeof(dialog_window)); | |
2420 dialog_window.uFrameX = 483; | |
2421 dialog_window.uFrameWidth = 148; | |
2422 dialog_window.uFrameZ = 334; | |
2423 v2 = p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier; | |
1630 | 2424 |
2425 pPriceRoom = ((v2 * v2) / 10) * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; | |
2426 if ( pPriceRoom < ((v2 * v2) / 10) / 3 ) | |
2427 pPriceRoom = ((v2 * v2) / 10) / 3; | |
2428 if ( pPriceRoom <= 0 ) | |
2429 pPriceRoom = 1; | |
2430 | |
2431 pPriceFood = ((v2 * v2) * v2 / 100) * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; | |
2432 if ( pPriceFood < ((v2 * v2) * v2 / 100) / 3 ) | |
2433 pPriceFood = ((v2 * v2) * v2 / 100) / 3; | |
2434 if ( pPriceFood <= 0 ) | |
2435 pPriceFood = 1; | |
2436 | |
1298 | 2437 |
2438 switch(dialog_menu_id) | |
2439 { | |
2440 case HOUSE_DIALOGUE_MAIN: | |
2441 { | |
1393 | 2442 if ( !HouseUI_CheckIfPlayerCanInteract() ) |
1298 | 2443 return; |
2444 | |
1610 | 2445 sprintf(pTopic1, "\f%05d", pDialogueWindow->pCurrentPosActiveItem == 2 ? TargetColor(0xFFu, 0xFFu, 0x9Bu) : TargetColor(0xFFu, 0xFFu, 0xFFu)); |
1630 | 2446 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[178], pPriceRoom); // Rent room for %d gold |
1298 | 2447 strcat(pTopic1, pTmpBuf2.data()); |
2448 pTopic1Height = pFontArrus->CalcTextHeight(pTopic1, &dialog_window, 0, 0); | |
2449 strcat(pTopic1, "\n \n"); | |
2450 | |
1610 | 2451 sprintf(pTopic2, "\f%05d", pDialogueWindow->pCurrentPosActiveItem == 3 ? TargetColor(0xFFu, 0xFFu, 0x9Bu) : TargetColor(0xFFu, 0xFFu, 0xFFu)); |
1298 | 2452 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[86], // Buy food for %d days for %d gold |
1630 | 2453 (unsigned int)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier, pPriceFood); |
1298 | 2454 strcat(pTopic2, pTmpBuf2.data()); |
2455 pTopic2Height = pFontArrus->CalcTextHeight(pTopic2, &dialog_window, 0, 0); | |
2456 strcat(pTopic2, "\n \n"); | |
2457 | |
1610 | 2458 sprintf(pTopic3, "\f%05d", pDialogueWindow->pCurrentPosActiveItem == 4 ? TargetColor(0xFFu, 0xFFu, 0x9Bu) : TargetColor(0xFFu, 0xFFu, 0xFFu)); |
1298 | 2459 strcat(pTopic3, pGlobalTXT_LocalizationStrings[160]); // Learn Skills |
2460 pTopic3Height = pFontArrus->CalcTextHeight(pTopic3, &dialog_window, 0, 0); | |
2461 strcat(pTopic3, "\n \n"); | |
2462 pTopic4[0] = 0; | |
2463 if ( (signed int)window_SpeakInHouse->par1C >= 108 && (signed int)window_SpeakInHouse->par1C <= 120 ) | |
2464 { | |
1610 | 2465 sprintf(pTopic4, "\f%05d", pDialogueWindow->pCurrentPosActiveItem == 5 ? TargetColor(0xFFu, 0xFFu, 0x9Bu) : TargetColor(0xFFu, 0xFFu, 0xFFu)); |
1298 | 2466 strcat(pTopic4, pGlobalTXT_LocalizationStrings[611]); // Play Arcomage |
2467 pTopic4Height = pFontArrus->CalcTextHeight(pTopic4, &dialog_window, 0, 0); | |
2468 } | |
1610 | 2469 |
2470 if ( pDialogueWindow->pNumPresenceButton ) | |
1298 | 2471 { |
1630 | 2472 for ( pItemNum = pDialogueWindow->pStartingPosActiveItem; |
2473 pItemNum < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton; ++pItemNum ) | |
1298 | 2474 { |
1630 | 2475 pButton = pDialogueWindow->GetControl(pItemNum); |
1298 | 2476 if ( pButton->msg_param == 15 ) |
2477 { | |
2478 pButton->uHeight = pTopic1Height; | |
2479 pButton->uY = 146; | |
1630 | 2480 pButton->uW = pTopic1Height + 145; |
1298 | 2481 } |
2482 else if ( pButton->msg_param == 16 ) | |
2483 { | |
2484 pButton->uHeight = pTopic2Height; | |
1630 | 2485 pButton->uY = pTopic1Height + (LOBYTE(pFontArrus->uFontHeight) - 3) + 146; |
2486 pButton->uW = (pTopic1Height + (LOBYTE(pFontArrus->uFontHeight) - 3) + 146) + pTopic2Height - 1; | |
1298 | 2487 } |
2488 else if ( pButton->msg_param == 96 ) | |
2489 { | |
1630 | 2490 pButton->uY = pTopic1Height + pTopic2Height + 2 * (LOBYTE(pFontArrus->uFontHeight) - 3) + 146; |
2491 pButton->uHeight = pTopic3Height; | |
2492 pButton->uW = pTopic3Height + (pTopic1Height + pTopic2Height + 2 * (LOBYTE(pFontArrus->uFontHeight) - 3) + 146) - 1; | |
1298 | 2493 } |
2494 else if ( pButton->msg_param == 101 ) | |
2495 { | |
2496 pButton->uHeight = pTopic4Height; | |
1630 | 2497 pButton->uY = pTopic1Height + 3 * (LOBYTE(pFontArrus->uFontHeight) - 3) + pTopic4Height + pTopic2Height + 146; |
2498 pButton->uW = (pTopic1Height + 3 * (LOBYTE(pFontArrus->uFontHeight) - 3) + pTopic4Height + pTopic2Height + 146) + pTopic4Height - 1; | |
1298 | 2499 } |
2500 } | |
1610 | 2501 sprintfex(pTmpBuf.data(), "%s%s%s%s", pTopic1, pTopic2, pTopic3, pTopic4); |
2502 dialog_window.DrawTitleText(pFontArrus, 0, 146, 0, pTmpBuf.data(), 3); | |
1298 | 2503 } |
2504 break; | |
2505 } | |
2506 case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_RULES: | |
2507 { | |
2508 pOutString = pFontArrus; | |
2509 strcpy(pTmpBuf.data(), pNPCTopics[354].pText); | |
2510 dialog_window.uFrameWidth = game_viewport_width; | |
2511 dialog_window.uFrameZ = 452; | |
2512 pTextHeight = pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 12, 0) + 7; | |
2513 if ( 352 - pTextHeight < 8 ) | |
2514 { | |
2515 pOutString = pFontCreate; | |
2516 pTextHeight = pFontCreate->CalcTextHeight(pTmpBuf.data(), &dialog_window, 12, 0) + 7; | |
2517 } | |
1630 | 2518 pRenderer->GetLeather(8, 352 - pTextHeight, pIcons_LOD->GetTexture(uTextureID_Leather), pIcons_LOD->GetTexture(uTextureID_Leather)->uTextureHeight - pTextHeight); |
1298 | 2519 pRenderer->DrawTextureIndexed(8, 347 - pTextHeight, pTexture_591428); |
1630 | 2520 window_SpeakInHouse->DrawText(pOutString, 12, 354 - pTextHeight, 0, FitTextInAWindow(pTmpBuf.data(), pOutString, &dialog_window, 0xCu, 0), 0, 0, 0); |
1298 | 2521 break; |
2522 } | |
2523 case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_VICTORY_CONDITIONS: | |
2524 { | |
2525 strcpy(pTmpBuf.data(), pNPCTopics[(uint)window_SpeakInHouse->ptr_1C + 247].pText); | |
2526 dialog_window.uFrameWidth = game_viewport_width; | |
2527 dialog_window.uFrameZ = 452; | |
1630 | 2528 pTextHeight = pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 12, 0) + 7; |
2529 pRenderer->GetLeather(8, 352 - pTextHeight, pIcons_LOD->GetTexture(uTextureID_Leather), pIcons_LOD->GetTexture(uTextureID_Leather)->uTextureHeight - pTextHeight); | |
1298 | 2530 pRenderer->DrawTextureIndexed(8, 347 - pTextHeight, pTexture_591428); |
1630 | 2531 window_SpeakInHouse->DrawText(pFontArrus, 12, 354 - pTextHeight, 0, |
2532 FitTextInAWindow(pTmpBuf.data(), pFontArrus, &dialog_window, 0xCu, 0), 0, 0, 0); | |
1298 | 2533 break; |
2534 } | |
2535 case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_RESULT: | |
2536 { | |
2537 if ( pArcomageGame->bGameInProgress == 1 ) | |
2538 return; | |
2539 if ( pArcomageGame->uGameResult ) | |
2540 { | |
2541 if ( pArcomageGame->uGameResult == 1 ) | |
1630 | 2542 pText = pGlobalTXT_LocalizationStrings[640];// You won! |
1298 | 2543 else |
1630 | 2544 pText = pGlobalTXT_LocalizationStrings[641];// You lost! |
1298 | 2545 } |
2546 else | |
2547 { | |
1630 | 2548 pText = pGlobalTXT_LocalizationStrings[639];// A tie! |
1298 | 2549 } |
1630 | 2550 strcpy(pTmpBuf.data(), pText); |
2551 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 0, 0)) / 2 + 138, | |
2552 TargetColor(0xFFu, 0xFFu, 0x9Bu), pTmpBuf.data(), 3); | |
1298 | 2553 break; |
2554 } | |
2555 case HOUSE_DIALOGUE_TAVERN_REST: | |
2556 { | |
1630 | 2557 if ( pParty->uNumGold >= pPriceRoom ) |
1298 | 2558 { |
1630 | 2559 Party::TakeGold(pPriceRoom); |
1298 | 2560 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful); |
2561 dialog_menu_id = HOUSE_DIALOGUE_NULL; | |
2562 sub_4BD8B5(); | |
1407 | 2563 GetHouseGoodbyeSpeech(); |
1298 | 2564 pVideoPlayer->Unload(); |
2565 if ( pMessageQueue_50CBD0->uNumMessages ) | |
2566 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
2567 pMessageQueue_50CBD0->pMessages[0].eType = UIMSG_RentRoom; | |
1630 | 2568 pMessageQueue_50CBD0->pMessages[0].param = (int)window_SpeakInHouse->ptr_1C;//107 |
1298 | 2569 pMessageQueue_50CBD0->pMessages[0].field_8 = 1; |
2570 ++pMessageQueue_50CBD0->uNumMessages; | |
1630 | 2571 window_SpeakInHouse->Release(); |
2572 window_SpeakInHouse = 0; | |
1298 | 2573 return; |
2574 } | |
1630 | 2575 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);//У вас не хватает золота |
1298 | 2576 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_Goodbye); |
1630 | 2577 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); |
1298 | 2578 break; |
2579 } | |
2580 | |
2581 case HOUSE_DIALOGUE_LEARN_SKILLS: | |
2582 { | |
1393 | 2583 if ( !HouseUI_CheckIfPlayerCanInteract() ) |
1298 | 2584 return; |
1630 | 2585 pSkillCount = 0; |
1298 | 2586 v9 = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0); |
1630 | 2587 pPriceSkill = v9 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; |
2588 if ( pPriceSkill < v9 / 3 ) | |
2589 pPriceSkill = v9 / 3; | |
1298 | 2590 all_text_height = 0; |
1630 | 2591 for ( pItemNum = pDialogueWindow->pStartingPosActiveItem; |
2592 pItemNum < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton; ++pItemNum ) | |
1298 | 2593 { |
1630 | 2594 if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][pDialogueWindow->GetControl(pItemNum)->msg_param - 36] |
2595 && !pPlayers[uActiveCharacter]->pActiveSkills[pDialogueWindow->GetControl(pItemNum)->msg_param - 36] ) | |
1298 | 2596 { |
1630 | 2597 all_text_height = pFontArrus->CalcTextHeight(pSkillNames[pDialogueWindow->GetControl(pItemNum)->msg_param - 36], &dialog_window, 0, 0); |
2598 pSkillCount++; | |
1298 | 2599 } |
2600 } | |
1630 | 2601 if ( pSkillCount ) |
2602 { | |
2603 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[401], pPriceSkill);//Стоимость навыка: %lu | |
2604 dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3); | |
2605 v91 = (149 - all_text_height) / pSkillCount; | |
2606 if ( (149 - all_text_height) / pSkillCount > 32 ) | |
2607 v91 = 32; | |
2608 v54 = (149 - pSkillCount * v91 - all_text_height) / 2 - v91 / 2 + 162; | |
2609 for ( pItemNum = pDialogueWindow->pStartingPosActiveItem; | |
2610 pItemNum < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton; pItemNum++ ) | |
2611 { | |
2612 pButton = pDialogueWindow->GetControl(pItemNum); | |
2613 if ( !byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][pButton->msg_param - 36] | |
2614 || pPlayers[uActiveCharacter]->pActiveSkills[pButton->msg_param - 36] ) | |
2615 { | |
2616 pButton->uW = 0; | |
2617 pButton->uHeight = 0; | |
2618 pButton->uY = 0; | |
2619 } | |
2620 else | |
2621 { | |
2622 pButton->uY = v91 + v54; | |
2623 pTextHeight = pFontArrus->CalcTextHeight(pSkillNames[pButton->msg_param - 36], &dialog_window, 0, 0); | |
2624 pButton->uHeight = pTextHeight; | |
2625 v54 = pTextHeight + pButton->uY - 1; | |
2626 pButton->uW = v54; | |
2627 pColorText = TargetColor(0xFFu, 0xFFu, 0x9Bu); | |
2628 if ( pDialogueWindow->pCurrentPosActiveItem != pItemNum ) | |
2629 pColorText = TargetColor(0xFFu, 0xFFu, 0xFFu); | |
2630 dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, pSkillNames[pButton->msg_param - 36], 3); | |
2631 } | |
2632 } | |
2633 return; | |
2634 } | |
2635 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName,//Советую вам %s %s поискать знания еще где-нибудь | |
1610 | 2636 pClassNames[pPlayers[uActiveCharacter]->classType]); |
1298 | 2637 strcat(pTmpBuf.data(), "\n \n"); |
1630 | 2638 strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]);//Больше ничего не могу предложить. |
1298 | 2639 pTextHeight = (174 - pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 0, 0)) / 2 + 138; |
1610 | 2640 dialog_window.DrawTitleText(pFontArrus, 0, pTextHeight, TargetColor(0xFFu, 0xFFu, 0x9Bu), pTmpBuf.data(), 3); |
1298 | 2641 return; |
2642 } | |
2643 | |
2644 case HOUSE_DIALOGUE_TAVERN_BUY_FOOD: | |
2645 { | |
2646 if ( (double)pParty->uNumFoodRations >= p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier ) | |
2647 { | |
1630 | 2648 ShowStatusBarString(pGlobalTXT_LocalizationStrings[140], 2);//Вы уже купили еду! |
1298 | 2649 if ( uActiveCharacter ) |
2650 pPlayers[uActiveCharacter]->PlaySound(SPEECH_67, 0); | |
1630 | 2651 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); |
1298 | 2652 return; |
2653 } | |
1630 | 2654 if ( pParty->uNumGold >= pPriceFood ) |
1298 | 2655 { |
1630 | 2656 Party::TakeGold(pPriceFood); |
1298 | 2657 pParty->uNumFoodRations = (signed __int64)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier; |
2658 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_Greeting_2); | |
2659 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
2660 return; | |
2661 } | |
2662 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2); // "You don't have enough gold" | |
2663 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_Goodbye); | |
1630 | 2664 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); |
1298 | 2665 break; |
2666 } | |
2667 | |
2668 case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_MAIN: | |
2669 { | |
1393 | 2670 if ( HouseUI_CheckIfPlayerCanInteract() ) |
1298 | 2671 { |
1630 | 2672 pOptionsCount = 2; |
2673 pShopOptions[0] = pGlobalTXT_LocalizationStrings[620];//Правила | |
2674 pShopOptions[1] = pGlobalTXT_LocalizationStrings[622];//Условия победы | |
2675 if ( pParty->HasItem(651) )//651 - Колода для игры в АркоМэйдж в Items.txt | |
1298 | 2676 { |
1630 | 2677 pShopOptions[2] = pGlobalTXT_LocalizationStrings[621];//Играть |
2678 pOptionsCount = 3; | |
2679 } | |
2680 for ( i = 0; i < pOptionsCount; ++i ) | |
2681 all_text_height = pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0); | |
2682 all_text_height = (174 - all_text_height) / pOptionsCount; | |
2683 | |
2684 v54 = (174 - pOptionsCount * (174 - all_text_height) / pOptionsCount - all_text_height) / 2 - (174 - all_text_height) / pOptionsCount / 2 + 138; | |
2685 pNumString = 0; | |
2686 for ( pItemNum = pDialogueWindow->pStartingPosActiveItem; | |
2687 pItemNum < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem ; pItemNum++ ) | |
2688 { | |
2689 pButton = pDialogueWindow->GetControl(pItemNum); | |
2690 pButton->uY = all_text_height + v54; | |
2691 pTextHeight = pFontArrus->CalcTextHeight((const char *)pShopOptions[pNumString], &dialog_window, 0, 0); | |
2692 pButton->uHeight = pTextHeight; | |
2693 v54 = pButton->uY + pTextHeight - 1; | |
2694 pButton->uW = v54; | |
2695 pColorText = TargetColor(0xFFu, 0xFFu, 0x9Bu); | |
2696 if ( pDialogueWindow->pCurrentPosActiveItem != pItemNum ) | |
2697 pColorText = TargetColor(0xFFu, 0xFFu, 0xFFu); | |
2698 dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, (const char *)pShopOptions[pNumString], 3); | |
2699 ++pNumString; | |
1298 | 2700 } |
2701 } | |
2702 break; | |
2703 } | |
2704 default: | |
2705 { | |
2706 break; | |
2707 } | |
2708 } | |
2709 } | |
2710 | |
2711 //----- (004B705E) -------------------------------------------------------- | |
2712 void TempleDialog() | |
1612 | 2713 { |
1622 | 2714 int pPrice; // edi@1 |
2715 int pTextHeight; // eax@11 | |
2716 unsigned __int16 pTextColor; // ax@21 | |
2717 DDM_DLV_Header *v26; // edi@29 | |
2718 unsigned int v30; // edx@36 | |
2719 int v35; // edi@50 | |
2720 GUIButton *pButton; // edi@64 | |
2721 int v47; // edi@71 | |
2722 GUIWindow tample_window; // [sp+13Ch] [bp-88h]@1 | |
2723 unsigned __int8 index; // [sp+1B7h] [bp-Dh]@64 | |
2724 int v64; // [sp+1B8h] [bp-Ch]@6 | |
2725 unsigned int pCurrentItem; // [sp+1BCh] [bp-8h]@6 | |
2726 int all_text_height; // [sp+1C0h] [bp-4h]@6 | |
1298 | 2727 |
1612 | 2728 memcpy(&tample_window, window_SpeakInHouse, sizeof(tample_window)); |
2729 tample_window.uFrameX = 483; | |
2730 tample_window.uFrameWidth = 148; | |
2731 tample_window.uFrameZ = 334; | |
2732 pPrice = pPlayers[uActiveCharacter]->GetTempleHealCostModifier(p2DEvents[window_SpeakInHouse->par1C - 1].fPriceMultiplier); | |
2733 if ( dialog_menu_id == HOUSE_DIALOGUE_MAIN ) | |
2734 { | |
2735 index = 1; | |
2736 pButton = pDialogueWindow->GetControl(pDialogueWindow->pStartingPosActiveItem); | |
2737 pButton->uHeight = 0; | |
2738 pButton->uY = 0; | |
2739 if ( pPlayers[uActiveCharacter]->IsPlayerHealableByTemple() ) | |
1298 | 2740 { |
1612 | 2741 sprintfex(pTmpBuf.data(), "%s %d %s", pGlobalTXT_LocalizationStrings[104], pPrice, pGlobalTXT_LocalizationStrings[97]);//"Лечить" "Золото" |
2742 pShopOptions[0] = pTmpBuf.data(); | |
2743 index = 0; | |
2744 } | |
2745 pShopOptions[1] = pGlobalTXT_LocalizationStrings[68];//"Пожертвовать" | |
2746 pShopOptions[2] = pGlobalTXT_LocalizationStrings[160];//"Обучиться навыкам" | |
2747 all_text_height = 0; | |
2748 if ( index < pDialogueWindow->pNumPresenceButton ) | |
2749 { | |
2750 uint i = index; | |
2751 for ( uint j = index; j < pDialogueWindow->pNumPresenceButton; ++j ) | |
2752 { | |
2753 all_text_height += pFontArrus->CalcTextHeight(pShopOptions[1 * i], &tample_window, 0, 0); | |
2754 i++; | |
2755 } | |
2756 } | |
2757 v64 = (174 - (signed int)all_text_height) / (pDialogueWindow->pNumPresenceButton - index); | |
2758 if ( v64 > 32 ) | |
2759 v64 = 32; | |
1622 | 2760 all_text_height = (174 - v64 * (pDialogueWindow->pNumPresenceButton - index) - (signed int)all_text_height) / 2 - v64 / 2 + 138; |
1612 | 2761 if ( index + pDialogueWindow->pStartingPosActiveItem < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton ) |
2762 { | |
2763 uint i = index; | |
2764 for ( pCurrentItem = index + pDialogueWindow->pStartingPosActiveItem; | |
2765 (signed int)pCurrentItem < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++pCurrentItem ) | |
1298 | 2766 { |
1612 | 2767 pButton = pDialogueWindow->GetControl(pCurrentItem); |
1622 | 2768 pButton->uY = v64 + all_text_height; |
1612 | 2769 pTextHeight = pFontArrus->CalcTextHeight(pShopOptions[1 * i], &tample_window, 0, 0); |
2770 pButton->uHeight = pTextHeight; | |
1622 | 2771 pButton->uW = pButton->uY + pTextHeight - 1; |
2772 all_text_height = pButton->uW; | |
1612 | 2773 pTextColor = TargetColor(0xFFu, 0xFFu, 0x9Bu); |
2774 if ( pDialogueWindow->pCurrentPosActiveItem != index + 2 ) | |
2775 pTextColor = TargetColor(0xFFu, 0xFFu, 0xFFu); | |
1622 | 2776 tample_window.DrawTitleText(pFontArrus, 0, pButton->uY, pTextColor, pShopOptions[1 * i], 3); |
1612 | 2777 i++; |
2778 index++; | |
2779 } | |
2780 } | |
2781 return; | |
2782 } | |
2783 //------------------------------------------------- | |
2784 if ( dialog_menu_id == HOUSE_DIALOGUE_TEMPLE_HEAL ) | |
2785 { | |
2786 if ( !pPlayers[uActiveCharacter]->IsPlayerHealableByTemple() ) | |
2787 return; | |
2788 if ( pParty->uNumGold < pPrice ) | |
2789 { | |
1622 | 2790 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);//"У вас не хватает золота" |
1612 | 2791 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful); |
1622 | 2792 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); |
1612 | 2793 return; |
2794 } | |
2795 Party::TakeGold(pPrice); | |
2796 v35 = LODWORD(pPlayers[uActiveCharacter]->pConditions[17]); | |
2797 memset(pPlayers[uActiveCharacter], 0, 0xA0u); | |
2798 pPlayers[uActiveCharacter]->sHealth = pPlayers[uActiveCharacter]->GetMaxHealth(); | |
2799 pPlayers[uActiveCharacter]->sMana = pPlayers[uActiveCharacter]->GetMaxMana(); | |
1622 | 2800 if ( (signed int)window_SpeakInHouse->ptr_1C != 78 && ((signed int)window_SpeakInHouse->ptr_1C <= 80 || (signed int)window_SpeakInHouse->ptr_1C > 82) ) |
1612 | 2801 { |
2802 if ( (unsigned int)pPlayers[uActiveCharacter]->pConditions[17] | v35 ) | |
2803 { | |
1622 | 2804 pPlayers[uActiveCharacter]->uCurrentFace = pPlayers[uActiveCharacter]->uPrevFace; |
2805 pPlayers[uActiveCharacter]->uVoiceID = pPlayers[uActiveCharacter]->uPrevVoiceID; | |
2806 ReloadPlayerPortraits(uActiveCharacter - 1, pPlayers[uActiveCharacter]->uPrevFace); | |
1612 | 2807 } |
2808 pAudioPlayer->PlaySound((SoundID)(SOUND_GoldReceived|0x2), -1, 0, -1, 0, 0, 0, 0); | |
2809 pPlayers[uActiveCharacter]->PlaySound(SPEECH_82, 0); | |
2810 pOtherOverlayList->_4418B1(20, uActiveCharacter + 99, 0, 65536); | |
1622 | 2811 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); |
1612 | 2812 return; |
2813 } | |
2814 if ( (unsigned int)pPlayers[uActiveCharacter]->pConditions[17] | v35 ) | |
2815 { | |
2816 LODWORD(pPlayers[uActiveCharacter]->pConditions[17]) = v35; | |
2817 } | |
2818 else | |
2819 { | |
2820 if ( !pPlayers[uActiveCharacter]->pConditions[16] | |
2821 && !pPlayers[uActiveCharacter]->pConditions[15] && !pPlayers[uActiveCharacter]->pConditions[14] ) | |
2822 { | |
1298 | 2823 pAudioPlayer->PlaySound((SoundID)(SOUND_GoldReceived|0x2), -1, 0, -1, 0, 0, 0, 0); |
1612 | 2824 pPlayers[uActiveCharacter]->PlaySound(SPEECH_82, 0); |
1298 | 2825 pOtherOverlayList->_4418B1(20, uActiveCharacter + 99, 0, 65536); |
1622 | 2826 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); |
1612 | 2827 return; |
2828 } | |
2829 pPlayers[uActiveCharacter]->uPrevFace = pPlayers[uActiveCharacter]->uCurrentFace; | |
2830 pPlayers[uActiveCharacter]->uPrevVoiceID = pPlayers[uActiveCharacter]->uVoiceID; | |
2831 pPlayers[uActiveCharacter]->SetCondition(0x11u, 1); | |
2832 pPlayers[uActiveCharacter]->uVoiceID = (pPlayers[uActiveCharacter]->GetSexByVoice() != 0) + 23; | |
1622 | 2833 pPlayers[uActiveCharacter]->uCurrentFace = (pPlayers[uActiveCharacter]->GetSexByVoice() != 0) + 23; |
2834 ReloadPlayerPortraits(uActiveCharacter - 1, (pPlayers[uActiveCharacter]->GetSexByVoice() != 0) + 23); | |
1612 | 2835 LODWORD(pPlayers[uActiveCharacter]->pConditions[17]) = LODWORD(pParty->uTimePlayed); |
1622 | 2836 //v39 = (GUIWindow *)HIDWORD(pParty->uTimePlayed); |
1612 | 2837 } |
1622 | 2838 //HIDWORD(pPlayers[uActiveCharacter]->pConditions[17]) = (int)v39; |
2839 pPlayers[uActiveCharacter]->pConditions[17] =pParty->uTimePlayed; | |
1612 | 2840 pAudioPlayer->PlaySound((SoundID)(SOUND_GoldReceived|0x2), -1, 0, -1, 0, 0, 0, 0); |
2841 pPlayers[uActiveCharacter]->PlaySound(SPEECH_82, 0); | |
2842 pOtherOverlayList->_4418B1(20, uActiveCharacter + 99, 0, 65536); | |
1622 | 2843 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); |
1612 | 2844 return; |
2845 } | |
2846 //--------------------------------------------------- | |
2847 if ( dialog_menu_id == HOUSE_DIALOGUE_TEMPLE_DONATE ) | |
2848 { | |
1622 | 2849 pPrice = p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier; |
2850 if ( pParty->uNumGold >= (unsigned int)pPrice ) | |
2851 { | |
2852 Party::TakeGold((unsigned int)pPrice); | |
2853 v26 = &pOutdoor->ddm; | |
2854 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
2855 v26 = &pIndoor->dlv; | |
2856 if ( v26->uReputation > -5 ) | |
1612 | 2857 { |
1622 | 2858 v26->uReputation = v26->uReputation - 1; |
2859 if ( v26->uReputation - 1 < -5 ) | |
2860 v26->uReputation = -5; | |
2861 } | |
2862 if ( (unsigned __int8)byte_F8B1EF[uActiveCharacter] == pParty->uDaysPlayed % 7 ) | |
2863 { | |
2864 if ( v26->uReputation <= -5 ) | |
1298 | 2865 { |
1622 | 2866 v30 = pParty->uDaysPlayed % 7 + 1; |
2867 LOBYTE(v30) = v30 | 0x80; | |
2868 _42777D_CastSpell_UseWand_ShootArrow(SPELL_AIR_WIZARD_EYE, uActiveCharacter - 1, v30, 48, 0); | |
1298 | 2869 } |
1622 | 2870 if ( v26->uReputation <= -10 ) |
1298 | 2871 { |
1622 | 2872 v30 = pParty->uDaysPlayed % 7 + 1; |
2873 LOBYTE(v30) = v30 | 0x80; | |
2874 _42777D_CastSpell_UseWand_ShootArrow(SPELL_SPIRIT_PRESERVATION, uActiveCharacter - 1, v30, 48, 0); | |
2875 } | |
2876 if ( v26->uReputation <= -15 ) | |
2877 { | |
2878 v30 = pParty->uDaysPlayed % 7 + 1; | |
2879 LOBYTE(v30) = v30 | 0x80; | |
2880 _42777D_CastSpell_UseWand_ShootArrow(SPELL_BODY_PROTECTION_FROM_MAGIC, uActiveCharacter - 1, v30, 48, 0); | |
2881 } | |
2882 if ( v26->uReputation <= -20 ) | |
2883 { | |
2884 v30 = pParty->uDaysPlayed % 7 + 1; | |
2885 LOBYTE(v30) = v30 | 0x80; | |
2886 _42777D_CastSpell_UseWand_ShootArrow(SPELL_LIGHT_HOUR_OF_POWER, uActiveCharacter - 1, v30, 48, 0); | |
1298 | 2887 } |
1622 | 2888 if ( v26->uReputation <= -25 ) |
2889 { | |
2890 v30 = pParty->uDaysPlayed % 7 + 1; | |
2891 LOBYTE(v30) = v30 | 0x80; | |
2892 _42777D_CastSpell_UseWand_ShootArrow(SPELL_LIGHT_DAY_OF_PROTECTION, uActiveCharacter - 1, v30, 48, 0); | |
2893 } | |
1612 | 2894 } |
1622 | 2895 ++byte_F8B1EF[uActiveCharacter]; |
2896 pPlayers[uActiveCharacter]->PlaySound(SPEECH_83, 0); | |
2897 ShowStatusBarString(pGlobalTXT_LocalizationStrings[527], 2); // "Thank You!" | |
2898 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
1612 | 2899 return; |
1622 | 2900 } |
2901 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);//"У вас не хватает золота" | |
2902 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful); | |
2903 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
2904 return; | |
1612 | 2905 } |
2906 //------------------------------------------------ | |
2907 if ( dialog_menu_id == HOUSE_DIALOGUE_LEARN_SKILLS ) | |
2908 { | |
2909 if ( HouseUI_CheckIfPlayerCanInteract() ) | |
2910 { | |
2911 all_text_height = 0; | |
2912 pCurrentItem = (signed __int64)(p2DEvents[(signed int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0); | |
2913 v64 = (signed int)(pCurrentItem * (100 - pPlayers[uActiveCharacter]->GetMerchant())) / 100; | |
2914 if ( v64 < (signed int)pCurrentItem / 3 ) | |
2915 v64 = (signed int)pCurrentItem / 3; | |
2916 pCurrentItem = 0; | |
1622 | 2917 for ( int i = pDialogueWindow->pStartingPosActiveItem; i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) |
1612 | 2918 { |
1622 | 2919 if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][pDialogueWindow->GetControl(i)->msg_param - 36] |
2920 && !pPlayers[uActiveCharacter]->pActiveSkills[pDialogueWindow->GetControl(i)->msg_param - 36] ) | |
1298 | 2921 { |
1622 | 2922 all_text_height += pFontArrus->CalcTextHeight(pSkillNames[pDialogueWindow->GetControl(i)->msg_param - 36], &tample_window, 0, 0); |
1612 | 2923 ++pCurrentItem; |
2924 } | |
2925 } | |
2926 if ( pCurrentItem ) | |
2927 { | |
2928 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[401], v64); | |
2929 tample_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3); | |
2930 v64 = (149 - (signed int)all_text_height) / (signed int)pCurrentItem; | |
2931 if ( v64 > 32 ) | |
2932 v64 = 32; | |
1622 | 2933 all_text_height = (signed int)(149 - pCurrentItem * v64 - (int)all_text_height) / 2 - v64 / 2 + 162; |
2934 if ( pDialogueWindow->pStartingPosActiveItem < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton ) | |
1612 | 2935 { |
1622 | 2936 pCurrentItem = 2; |
2937 for ( int i = pDialogueWindow->pStartingPosActiveItem; | |
2938 i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) | |
1612 | 2939 { |
1622 | 2940 pButton = pDialogueWindow->GetControl(i); |
2941 if ( !byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][pButton->msg_param - 36] | |
2942 || pPlayers[uActiveCharacter]->pActiveSkills[pButton->msg_param - 36] ) | |
1298 | 2943 { |
1622 | 2944 pButton->uW = 0; |
2945 pButton->uHeight = 0; | |
2946 pButton->uY = 0; | |
1612 | 2947 } |
2948 else | |
2949 { | |
1622 | 2950 pButton->uY = v64 + all_text_height; |
2951 pTextHeight = pFontArrus->CalcTextHeight(pSkillNames[pButton->msg_param - 36], &tample_window, 0, 0); | |
2952 pButton->uHeight = pTextHeight; | |
2953 pButton->uW = pButton->uY + pTextHeight - 1; | |
2954 all_text_height = pButton->uW; | |
1612 | 2955 pTextColor = TargetColor(0xFFu, 0xFFu, 0x9Bu); |
1622 | 2956 if ( pDialogueWindow->pCurrentPosActiveItem != pCurrentItem ) |
1612 | 2957 pTextColor = TargetColor(0xFFu, 0xFFu, 0xFFu); |
1622 | 2958 tample_window.DrawTitleText(pFontArrus, 0, pButton->uY, pTextColor, pSkillNames[pButton->msg_param - 36], 3); |
1298 | 2959 } |
1622 | 2960 pCurrentItem++; |
1612 | 2961 } |
1298 | 2962 } |
1612 | 2963 } |
2964 else | |
2965 { | |
1624 | 2966 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]);//"Советую вам %s %s поискать знания еще где-нибудь" |
1612 | 2967 strcat(pTmpBuf.data(), "\n \n"); |
1624 | 2968 strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]);//"Больше ничего не могу предложить." |
1612 | 2969 pTextHeight = pFontArrus->CalcTextHeight(pTmpBuf.data(), &tample_window, 0, 0); |
2970 tample_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, TargetColor(0xFFu, 0xFFu, 0x9Bu), pTmpBuf.data(), 3); | |
2971 } | |
1298 | 2972 } |
1612 | 2973 } |
2974 return; | |
2975 } | |
1298 | 2976 |
2977 //----- (004B4710) -------------------------------------------------------- | |
2978 void TrainingDialog() | |
2979 { | |
2980 unsigned __int64 v5; // edi@3 | |
2981 int v8; // edx@4 | |
2982 double v9; // st7@6 | |
2983 signed int v10; // esi@6 | |
1625 | 2984 int pPrice; // ecx@6 |
1298 | 2985 signed int v14; // esi@14 |
2986 unsigned int v15; // esi@16 | |
2987 int v16; // eax@16 | |
2988 unsigned int v17; // eax@17 | |
2989 int v19; // ecx@24 | |
2990 GUIButton *v20; // eax@26 | |
2991 GUIButton *v21; // esi@26 | |
2992 int v22; // eax@26 | |
2993 const char *v23; // eax@28 | |
2994 int v24; // eax@28 | |
2995 unsigned int v25; // ecx@28 | |
2996 int v26; // eax@28 | |
2997 unsigned __int16 v27; // ax@28 | |
2998 unsigned __int16 v29; // ST14_2@34 | |
2999 int v30; // eax@34 | |
3000 int v33; // eax@36 | |
3001 unsigned int v36; // eax@38 | |
3002 unsigned int v42; // eax@46 | |
1625 | 3003 int index; |
3004 int all_text_height; // eax@68 | |
1298 | 3005 int v49; // ebx@69 |
1625 | 3006 GUIButton *pButton; // eax@71 |
3007 int pTextHeight; // eax@71 | |
3008 unsigned __int16 pTextColor; // ax@71 | |
3009 GUIWindow training_dialog_window; // [sp+Ch] [bp-78h]@1 | |
1298 | 3010 int v68; // [sp+6Ch] [bp-18h]@3 |
3011 int v69; // [sp+70h] [bp-14h]@6 | |
3012 int v73; // [sp+80h] [bp-4h]@14 | |
3013 | |
1625 | 3014 memcpy(&training_dialog_window, window_SpeakInHouse, sizeof(training_dialog_window)); |
3015 training_dialog_window.uFrameX = 483; | |
3016 training_dialog_window.uFrameWidth = 148; | |
3017 training_dialog_window.uFrameZ = 334; | |
1298 | 3018 v5 = 1000ui64 * pPlayers[uActiveCharacter]->uLevel * (pPlayers[uActiveCharacter]->uLevel + 1) / 2; // E n = n(n + 1) / 2 |
3019 v68 = pMaxLevelPerTrainingHallType[(unsigned int)window_SpeakInHouse->ptr_1C - HOUSE_TRAINING_HALL_EMERALD_ISLE]; | |
3020 if (pPlayers[uActiveCharacter]->uExperience >= v5) | |
3021 { | |
3022 v8 = pPlayers[uActiveCharacter]->classType % 4 + 1; | |
3023 if ( v8 == 4 ) | |
3024 v8 = 3; | |
3025 v9 = (double)pPlayers[uActiveCharacter]->uLevel; | |
3026 v69 = v8; | |
3027 v10 = (signed __int64)(v9 * p2DEvents[(signed int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier * (double)v8); | |
1625 | 3028 pPrice = v10 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; |
3029 if ( pPrice < v10 / 3 ) | |
3030 pPrice = v10 / 3; | |
1298 | 3031 } |
1625 | 3032 //------------------------------------------------------- |
3033 all_text_height = 0; | |
1393 | 3034 if (HouseUI_CheckIfPlayerCanInteract()) |
1298 | 3035 { |
1625 | 3036 if ( dialog_menu_id == HOUSE_DIALOGUE_MAIN ) |
1298 | 3037 { |
1625 | 3038 if (HouseUI_CheckIfPlayerCanInteract()) |
1298 | 3039 { |
1625 | 3040 index = 0; |
3041 pShopOptions[0] = pTmpBuf.data(); | |
3042 pShopOptions[1] = pGlobalTXT_LocalizationStrings[160];// "Learn Skills" | |
3043 if ( pDialogueWindow->pStartingPosActiveItem < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton ) | |
1298 | 3044 { |
1625 | 3045 for ( int i = pDialogueWindow->pStartingPosActiveItem; |
3046 i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) | |
1298 | 3047 { |
1625 | 3048 if ( pDialogueWindow->GetControl(i)->msg_param == HOUSE_DIALOGUE_TRAININGHALL_TRAIN ) |
1298 | 3049 { |
1625 | 3050 if (pPlayers[uActiveCharacter]->uLevel >= v68) |
3051 sprintfex(pShopOptions[index], "%s\n \n%s", 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." | |
3052 else | |
1298 | 3053 { |
1625 | 3054 if (pPlayers[uActiveCharacter]->uExperience < v5) |
3055 sprintfex(pShopOptions[index], pGlobalTXT_LocalizationStrings[538], (uint)(v5 - pPlayers[uActiveCharacter]->uExperience), pPlayers[uActiveCharacter]->uLevel + 1); // "You need %d more experience to train to level %d" | |
3056 else | |
3057 sprintfex(pShopOptions[index], pGlobalTXT_LocalizationStrings[537], pPlayers[uActiveCharacter]->uLevel + 1, pPrice); // "Train to level %d for %d gold" | |
1298 | 3058 } |
3059 } | |
1625 | 3060 all_text_height += pFontArrus->CalcTextHeight(pShopOptions[index], &training_dialog_window, 0, 0); |
3061 ++index; | |
1298 | 3062 } |
3063 } | |
1625 | 3064 v49 = (2 * (87 - (174 - all_text_height) / 2) - all_text_height) / 2 - (174 - all_text_height) / 2 / 2 + 138; |
3065 if (pDialogueWindow->pStartingPosActiveItem < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton) | |
3066 { | |
3067 int pCurrentItem = 2; | |
3068 index = 0; | |
3069 for ( int i = pDialogueWindow->pStartingPosActiveItem; | |
3070 i < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton; ++i ) | |
3071 { | |
3072 pButton = pDialogueWindow->GetControl(i); | |
3073 pButton->uY = (174 - all_text_height) / 2 + v49; | |
3074 pTextHeight = pFontArrus->CalcTextHeight(pShopOptions[index], &training_dialog_window, 0, 0); | |
3075 pButton->uHeight = pTextHeight; | |
3076 pButton->uW = pTextHeight + pButton->uY - 1; | |
3077 v49 = pButton->uW; | |
3078 pTextColor = TargetColor(0xE1u, 0xCDu, 0x23u); | |
3079 if ( pDialogueWindow->pCurrentPosActiveItem != pCurrentItem ) | |
3080 pTextColor = TargetColor(255, 255, 255); | |
3081 training_dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pTextColor, pShopOptions[index], 3); | |
3082 ++pCurrentItem; | |
3083 ++index; | |
3084 } | |
3085 } | |
1298 | 3086 } |
1625 | 3087 } |
3088 //------------------------------------------------------------------ | |
3089 if ( dialog_menu_id == HOUSE_DIALOGUE_TRAININGHALL_TRAIN ) | |
3090 { | |
1393 | 3091 if ( !HouseUI_CheckIfPlayerCanInteract() ) |
1298 | 3092 { |
1625 | 3093 v33 = pFontArrus->CalcTextHeight(pNPCTopics[122].pText, &training_dialog_window, 0, 0); |
3094 training_dialog_window.DrawTitleText(pFontArrus, 0, (212 - v33) / 2 + 101, TargetColor(0xE1u, 0xCDu, 0x23u), pNPCTopics[122].pText, 3); | |
1298 | 3095 pDialogueWindow->pNumPresenceButton = 0; |
3096 return; | |
3097 } | |
1625 | 3098 //v34 = pPlayers[uActiveCharacter]->uLevel; |
3099 if ( pPlayers[uActiveCharacter]->uLevel < v68 ) | |
1298 | 3100 { |
3101 if ( (signed __int64)pPlayers[uActiveCharacter]->uExperience >= v5 ) | |
3102 { | |
1625 | 3103 if ( pParty->uNumGold >= pPrice) |
1298 | 3104 { |
1625 | 3105 Party::TakeGold(pPrice); |
1298 | 3106 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful); |
3107 ++pPlayers[uActiveCharacter]->uLevel; | |
3108 pPlayers[uActiveCharacter]->uSkillPoints += pPlayers[uActiveCharacter]->uLevel / 10 + 5; | |
3109 pPlayers[uActiveCharacter]->sHealth = pPlayers[uActiveCharacter]->GetMaxHealth(); | |
3110 pPlayers[uActiveCharacter]->sMana = pPlayers[uActiveCharacter]->GetMaxMana(); | |
3111 uint max_level_in_party = player_levels[0]; | |
3112 for (uint _it = 1; _it < 4; ++_it) | |
3113 { | |
3114 if (player_levels[_it] > max_level_in_party) | |
3115 max_level_in_party = player_levels[_it]; | |
3116 } | |
3117 ++player_levels[uActiveCharacter - 1]; | |
3118 if (player_levels[uActiveCharacter - 1] > max_level_in_party) // if we reach new maximum party level | |
3119 // feature is broken thou, since this array is always zeroed in EnterHouse | |
3120 { | |
1625 | 3121 v42 = 60 * (_494820_training_time(pParty->uCurrentHour) + 4) - pParty->uCurrentMinute; |
1298 | 3122 if ((unsigned int)window_SpeakInHouse->ptr_1C == HOUSE_TRAINING_HALL_94 || |
3123 (unsigned int)window_SpeakInHouse->ptr_1C == HOUSE_TRAINING_HALL_95) | |
3124 v42 += 720; | |
3125 RestAndHeal((signed int)(v42 + 10080)); | |
3126 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor ) | |
3127 pOutdoor->SetFog(); | |
3128 } | |
3129 pPlayers[uActiveCharacter]->PlaySound(SPEECH_87, 0); | |
3130 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[430], pPlayers[uActiveCharacter]->pName, pPlayers[uActiveCharacter]->uLevel, pPlayers[uActiveCharacter]->uLevel / 10 + 5);// | |
3131 // "%s is now Level %lu and has earned %lu Skill Points!" | |
3132 ShowStatusBarString(pTmpBuf.data(), 2); | |
3133 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
3134 return; | |
3135 } | |
3136 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);// "You don't have enough gold" | |
1625 | 3137 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)4); |
1298 | 3138 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); |
3139 return; | |
3140 } | |
1625 | 3141 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[538], (unsigned int)(v5 - pPlayers[uActiveCharacter]->uExperience), pPlayers[uActiveCharacter]->uLevel + 1);// |
1298 | 3142 // "You need %d more experience to train to level %d" |
1625 | 3143 v36 = (212 - pFontArrus->CalcTextHeight(pTmpBuf.data(), &training_dialog_window, 0, 0)) / 2 + 88; |
1298 | 3144 } |
3145 else | |
3146 { | |
3147 sprintf(pTmpBuf.data(), "%s\n \n%s", pGlobalTXT_LocalizationStrings[536], pGlobalTXT_LocalizationStrings[529]);// | |
3148 // ""With your skills, you should be working here as a teacher."" | |
3149 // ""Sorry, but we are unable to train you."" | |
1625 | 3150 v36 = (212 - pFontArrus->CalcTextHeight(pTmpBuf.data(), &training_dialog_window, 0, 0)) / 2 + 101; |
1298 | 3151 } |
1625 | 3152 training_dialog_window.DrawTitleText(pFontArrus, 0, v36, TargetColor(0xE1u, 0xCDu, 0x23u), pTmpBuf.data(), 3); |
3153 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)3); | |
3154 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
3155 return; | |
1298 | 3156 } |
1625 | 3157 } |
3158 //------------------------------------------------------------- | |
3159 if ( dialog_menu_id == HOUSE_DIALOGUE_LEARN_SKILLS ) | |
3160 { | |
1393 | 3161 if (HouseUI_CheckIfPlayerCanInteract()) |
1298 | 3162 { |
1625 | 3163 v14 = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0); |
3164 v73 = v14 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; | |
3165 if ( v73 < v14 / 3 ) | |
3166 v73 = v14 / 3; | |
3167 v15 = pDialogueWindow->pStartingPosActiveItem; | |
3168 v16 = pDialogueWindow->pNumPresenceButton; | |
3169 index = 0; | |
3170 if ( (signed int)v15 >= (signed int)(v15 + v16) ) | |
3171 goto LABEL_76; | |
3172 do | |
3173 { | |
3174 v17 = pDialogueWindow->GetControl(v15)->msg_param - 36; | |
3175 if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][v17] && !pPlayers[uActiveCharacter]->pActiveSkills[v17] ) | |
3176 { | |
3177 all_text_height += pFontArrus->CalcTextHeight(pSkillNames[v17], &training_dialog_window, 0, 0); | |
3178 ++index; | |
3179 } | |
3180 ++v15; | |
3181 } | |
3182 while ( (signed int)v15 < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem ); | |
3183 if ( index ) | |
1298 | 3184 { |
1625 | 3185 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[401], v73);// "Skill Cost: %lu" |
3186 training_dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3); | |
3187 v73 = (signed int)(149 - all_text_height) / index; | |
3188 if ( v73 > 32 ) | |
3189 v73 = 32; | |
3190 v19 = (signed int)(149 - index * v73 - all_text_height) / 2 - v73 / 2 + 162; | |
3191 int _v1 = pDialogueWindow->pStartingPosActiveItem; | |
3192 v68 = v19; | |
3193 if (pDialogueWindow->pStartingPosActiveItem < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton ) | |
1298 | 3194 { |
1625 | 3195 index = 2; |
3196 do | |
1298 | 3197 { |
1625 | 3198 v20 = pDialogueWindow->GetControl(_v1); |
3199 v21 = v20; | |
3200 v22 = v20->msg_param - 36; | |
3201 if ( !byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][v22] || pPlayers[uActiveCharacter]->pActiveSkills[v22] ) | |
3202 { | |
3203 v21->uW = 0; | |
3204 v21->uHeight = 0; | |
3205 v21->uY = 0; | |
3206 } | |
1298 | 3207 else |
3208 { | |
1625 | 3209 v23 = pSkillNames[v22]; |
3210 v21->uY = v73 + v68; | |
3211 //HIDWORD(v66) = (int)v23; | |
3212 v24 = pFontArrus->CalcTextHeight(v23, &training_dialog_window, 0, 0); | |
3213 v25 = v21->uY; | |
3214 v21->uHeight = v24; | |
3215 v26 = v25 + v24 - 1; | |
3216 v21->uW = v26; | |
3217 v68 = v26; | |
3218 v27 = TargetColor(0xE1u, 0xCDu, 0x23u); | |
3219 if ( pDialogueWindow->pCurrentPosActiveItem != index ) | |
3220 v27 = TargetColor(255, 255, 255); | |
3221 training_dialog_window.DrawTitleText(pFontArrus, 0, v25, v27, v23, 3); | |
1298 | 3222 } |
1625 | 3223 ++_v1; |
3224 ++index; | |
1298 | 3225 } |
1625 | 3226 while ( (signed int)_v1 < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton ); |
1298 | 3227 } |
3228 } | |
1625 | 3229 else |
1298 | 3230 { |
1625 | 3231 LABEL_76: |
3232 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]);// | |
3233 // "Seek knowledge elsewhere %s the %s" | |
3234 strcat(pTmpBuf.data(), "\n \n"); | |
3235 strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]);// "I can offer you nothing further." | |
3236 v29 = TargetColor(0xE1u, 0xCDu, 0x23u); | |
3237 v30 = pFontArrus->CalcTextHeight(pTmpBuf.data(), &training_dialog_window, 0, 0); | |
3238 training_dialog_window.DrawTitleText(pFontArrus, 0, (174 - v30) / 2 + 138, v29, pTmpBuf.data(), 3); | |
1298 | 3239 } |
3240 } | |
3241 } | |
1625 | 3242 return; |
1298 | 3243 } |
3244 | |
3245 //----- (004B6478) -------------------------------------------------------- | |
3246 void sub_4B6478() | |
3247 { | |
3248 GUIWindow *v0; // ebx@1 | |
3249 Player *v1; // edi@1 | |
3250 unsigned int v2; // eax@1 | |
3251 signed int v3; // esi@1 | |
3252 int v4; // ebx@1 | |
3253 unsigned int v5; // esi@5 | |
3254 int v6; // edi@6 | |
3255 int result; // eax@13 | |
3256 GUIWindow *v8; // ebx@17 | |
3257 int v9; // eax@17 | |
3258 int v10; // ecx@17 | |
3259 unsigned int v11; // ecx@18 | |
3260 int v12; // eax@20 | |
3261 int v13; // eax@21 | |
3262 GUIButton *v14; // esi@27 | |
3263 int v15; // ecx@27 | |
3264 unsigned int v16; // eax@28 | |
3265 const char *v17; // ebx@29 | |
3266 int v18; // eax@29 | |
3267 unsigned int v19; // ecx@29 | |
3268 int v20; // eax@29 | |
3269 unsigned __int16 v21; // ax@29 | |
3270 unsigned __int16 v22; // ST14_2@36 | |
3271 int v23; // eax@36 | |
3272 const char *v24; // ST18_4@37 | |
3273 unsigned __int16 v25; // ST14_2@37 | |
3274 int v26; // eax@37 | |
3275 int v27; // [sp-4h] [bp-80h]@8 | |
3276 GUIWindow v28; // [sp+Ch] [bp-70h]@1 | |
3277 GUIWindow *v29; // [sp+60h] [bp-1Ch]@17 | |
3278 unsigned int v30; // [sp+64h] [bp-18h]@1 | |
3279 int v31; // [sp+68h] [bp-14h]@1 | |
3280 int v32; // [sp+6Ch] [bp-10h]@1 | |
3281 int v33; // [sp+70h] [bp-Ch]@17 | |
3282 int v34; // [sp+74h] [bp-8h]@17 | |
3283 int v35; // [sp+78h] [bp-4h]@17 | |
3284 | |
3285 v0 = window_SpeakInHouse; | |
3286 memcpy(&v28, window_SpeakInHouse, sizeof(v28)); | |
3287 v1 = pPlayers[uActiveCharacter]; | |
3288 v28.uFrameX = 483; | |
3289 v28.uFrameWidth = 148; | |
3290 v28.uFrameZ = 334; | |
3291 v30 = TargetColor(0xFFu, 0xFFu, 0xFFu); | |
3292 v31 = TargetColor(0xFFu, 0xFFu, 0x9Bu); | |
3293 v2 = 52 * (unsigned int)v0->ptr_1C; | |
3294 //v32 = (unsigned __int8)(((p2DEvents_minus1___00[v2 / 2] != 18) - 1) & 0x96) + 100; | |
3295 v32 = (unsigned __int8)(((p2DEvents[(unsigned int)v0->ptr_1C - 1].uType != 18) - 1) & 0x96) + 100; | |
3296 //v3 = (signed __int64)((double)v32 * p2DEvents_minus1__20[v2 / 4]); | |
3297 v3 = (signed __int64)((double)v32 * p2DEvents[(unsigned int)v0->ptr_1C - 1].fPriceMultiplier); | |
3298 v4 = v3 * (100 - v1->GetMerchant()) / 100; | |
3299 v32 = v4; | |
3300 if ( v4 < v3 / 3 ) | |
3301 { | |
3302 v4 = v3 / 3; | |
3303 v32 = v3 / 3; | |
3304 } | |
3305 if ( dialog_menu_id != HOUSE_DIALOGUE_MAIN) | |
3306 { | |
1393 | 3307 if ( HouseUI_CheckIfPlayerCanInteract() ) |
1298 | 3308 { |
3309 v5 = 0; | |
3310 | |
3311 __debugbreak(); | |
3312 //pSkillAvailabilityPerClass[8 + v58->uClass][4 + v23] | |
3313 // or | |
3314 //byte_4ED970_skill_learn_ability_by_class_table[v58->uClass][v23 - 36] | |
3315 // or | |
3316 //byte_4ED970_skill_learn_ability_by_class_table[v58->uClass - 1][v23 + 1] | |
3317 __debugbreak(); // whacky condition - fix | |
3318 if (false | |
3319 //if ( !*(&byte_4ED94C[37 * v1->uClass / 3] + dword_F8B19C) | |
3320 || (v6 = (int)(&v1->uIntelligence + dialog_menu_id), *(short *)v6) ) | |
3321 { | |
3322 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); | |
3323 } | |
3324 else | |
3325 { | |
3326 if ( pParty->uNumGold < v4 ) | |
3327 { | |
3328 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u); | |
3329 v27 = 4; | |
3330 } | |
3331 else | |
3332 { | |
3333 Party::TakeGold(v4); | |
3334 *(short *)v6 = 1; | |
3335 v27 = 2; | |
3336 } | |
3337 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)v27); | |
3338 } | |
3339 } | |
3340 else | |
3341 { | |
3342 v5 = 0; | |
3343 } | |
3344 /*result = pMessageQueue_50CBD0->uNumMessages; | |
3345 if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) | |
3346 { | |
3347 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; | |
3348 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1; | |
3349 result = 3 * pMessageQueue_50CBD0->uNumMessages + 3; | |
3350 *(&pMessageQueue_50CBD0->uNumMessages + result) = v5; | |
3351 ++pMessageQueue_50CBD0->uNumMessages; | |
3352 }*/ | |
3353 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, v5); | |
3354 return; // void func | |
3355 } | |
1460
ff2118028c71
renaming _guilds_member_bits to _achieved_awards_bits
Gloval
parents:
1445
diff
changeset
|
3356 if ( !(unsigned __int16)_449B57_test_bit((unsigned __int8 *)v1->_achieved_awards_bits, word_4F0754[2 * (unsigned int)window_SpeakInHouse->ptr_1C]) ) |
1298 | 3357 { |
3358 v24 = pNPCTopics[171].pText; | |
3359 v25 = v31; | |
3360 v26 = pFontArrus->CalcTextHeight(pNPCTopics[171].pText, &v28, 0, 0); | |
3361 v28.DrawTitleText(pFontArrus, 0, (212 - v26) / 2 + 101, v25, v24, 3u); | |
3362 pDialogueWindow->pNumPresenceButton = 0; | |
3363 return ; | |
3364 } | |
3365 | |
1393 | 3366 if ( !HouseUI_CheckIfPlayerCanInteract() ) |
1298 | 3367 return; |
3368 v8 = pDialogueWindow; | |
3369 v33 = 0; | |
3370 v34 = 0; | |
3371 v29 = pDialogueWindow; | |
3372 v9 = pDialogueWindow->pStartingPosActiveItem; | |
3373 v10 = v9 + pDialogueWindow->pNumPresenceButton; | |
3374 v35 = pDialogueWindow->pStartingPosActiveItem; | |
3375 if ( v9 >= v10 ) | |
3376 goto LABEL_40; | |
3377 do | |
3378 { | |
3379 v11 = v8->GetControl(v35)->msg_param - 36; | |
3380 if ( byte_4ED970_skill_learn_ability_by_class_table[v1->classType / 3][v11] && !v1->pActiveSkills[v11] ) | |
3381 { | |
3382 v12 = pFontArrus->CalcTextHeight(pSkillNames[v11], &v28, 0, 0); | |
3383 v33 += v12; | |
3384 ++v34; | |
3385 } | |
3386 v13 = v8->pStartingPosActiveItem; | |
3387 ++v35; | |
3388 } | |
3389 while ( v35 < v8->pNumPresenceButton + v13 ); | |
3390 if ( !v34 ) | |
3391 { | |
3392 LABEL_40: | |
3393 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], v1->pName, pClassNames[v1->classType]); | |
3394 strcat(pTmpBuf.data(), "\n \n"); | |
3395 strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]); | |
3396 v22 = v31; | |
3397 v23 = pFontArrus->CalcTextHeight(pTmpBuf.data(), &v28, 0, 0); | |
3398 v28.DrawTitleText(pFontArrus, 0, (174 - v23) / 2 + 138, v22, pTmpBuf.data(), 3u); | |
3399 return; | |
3400 } | |
3401 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[401], v32); | |
3402 v28.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3u); | |
3403 v32 = (149 - v33) / v34; | |
3404 if ( (149 - v33) / v34 > 32 ) | |
3405 v32 = 32; | |
3406 | |
3407 v35 = v8->pStartingPosActiveItem; | |
3408 v34 = (149 - v34 * v32 - v33) / 2 - v32 / 2 + 162; | |
3409 if ( v8->pStartingPosActiveItem < v8->pStartingPosActiveItem+ v8->pNumPresenceButton ) | |
3410 { | |
3411 v33 = 2; | |
3412 do | |
3413 { | |
3414 v14 = v8->GetControl(v35); | |
3415 v15 = v14->msg_param - 36; | |
3416 if ( byte_4ED970_skill_learn_ability_by_class_table[v1->classType / 3][v15] ) | |
3417 { | |
3418 v16 = 0; | |
3419 if ( !v1->pActiveSkills[v15] ) | |
3420 { | |
3421 v17 = pSkillNames[v15]; | |
3422 v14->uY = v32 + v34; | |
3423 v18 = pFontArrus->CalcTextHeight(v17, &v28, 0, 0); | |
3424 v19 = v14->uY; | |
3425 v14->uHeight = v18; | |
3426 v20 = v19 + v18 - 1; | |
3427 v14->uW = v20; | |
3428 v34 = v20; | |
3429 v21 = v31; | |
3430 if ( pDialogueWindow->pCurrentPosActiveItem != v33 ) | |
3431 v21 = v30; | |
3432 v28.DrawTitleText(pFontArrus, 0, v19, v21, v17, 3u); | |
3433 goto LABEL_34; | |
3434 } | |
3435 } | |
3436 else | |
3437 { | |
3438 v16 = 0; | |
3439 } | |
3440 v14->uW = v16; | |
3441 v14->uHeight = v16; | |
3442 v14->uY = v16; | |
3443 LABEL_34: | |
3444 v8 = v29; | |
3445 ++v35; | |
3446 ++v33; | |
3447 } | |
3448 while ( v35 <v29->pNumPresenceButton + v29->pStartingPosActiveItem ); | |
3449 } | |
3450 return; | |
3451 } | |
3452 | |
3453 //----- (004B2A74) -------------------------------------------------------- | |
3454 void SimpleHouseAndBoatsDialog() | |
3455 { | |
3456 char *v2; // eax@3 | |
3457 unsigned int i; // eax@5 | |
1580 | 3458 NPCData *pNPC; // esi@6 |
1298 | 3459 char *v15; // esi@14 |
1580 | 3460 GUIButton *pButton; // eax@15 |
1298 | 3461 int v18; // ecx@17 |
3462 char *v29; // esi@42 | |
3463 int v31; // ST1C_4@42 | |
3464 int v34; // esi@51 | |
3465 unsigned int v36; // edi@51 | |
3466 GUIButton *v37; // eax@52 | |
3467 int v38; // eax@52 | |
3468 signed int v39; // ecx@54 | |
3469 int v40; // edi@57 | |
3470 const char *v43; // ebx@60 | |
3471 int v44; // eax@60 | |
3472 unsigned int v45; // ecx@60 | |
3473 unsigned __int16 v46; // ax@60 | |
3474 GUIFont *v47; // ebx@64 | |
3475 int v48; // esi@64 | |
3476 GUIWindow w; // [sp+Ch] [bp-110h]@64 | |
3477 GUIWindow v52; // [sp+60h] [bp-BCh]@13 | |
1580 | 3478 GUIWindow house_window; // [sp+B4h] [bp-68h]@1 |
1298 | 3479 char *pInString; // [sp+114h] [bp-8h]@12 |
3480 | |
1580 | 3481 memcpy(&house_window, pDialogueWindow, sizeof(house_window)); |
1298 | 3482 if ( pDialogueNPCCount == uNumDialogueNPCPortraits && uHouse_ExitPic ) |
3483 { | |
1580 | 3484 house_window.uFrameX = 493; |
3485 house_window.uFrameWidth = 126; | |
3486 house_window.uFrameZ = 366; | |
3487 house_window.DrawTitleText(pFontCreate, 0, 2, 0, pMapStats->pInfos[uHouse_ExitPic].pName, 3); | |
3488 house_window.uFrameX = 483; | |
3489 house_window.uFrameWidth = 148; | |
3490 house_window.uFrameZ = 334; | |
1298 | 3491 v2 = pTransitionStrings[uHouse_ExitPic]; |
3492 if ( !v2 ) | |
3493 { | |
1580 | 3494 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[411], pMapStats->pInfos[uHouse_ExitPic].pName);//Войти в ^Pv[%s] |
1298 | 3495 v2 = pTmpBuf.data(); |
3496 } | |
1580 | 3497 house_window.DrawTitleText(pFontCreate, 0, (212 - pFontCreate->CalcTextHeight(v2, &house_window, 0, 0)) / 2 + 101, 0, v2, 3); |
1298 | 3498 return; |
3499 } | |
1580 | 3500 house_window.uFrameWidth -= 10; |
3501 house_window.uFrameZ -= 10; | |
3502 pNPC = HouseNPCData[(unsigned int)((char *)pDialogueNPCCount + -(dword_591080 != 0) )];//- 1 | |
3503 if ( pNPC->uProfession ) | |
3504 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[429], pNPC->pName, aNPCProfessionNames[pNPC->uProfession]);//^Pi[%s] %s | |
1298 | 3505 else |
1580 | 3506 strcpy(pTmpBuf.data(), pNPC->pName); |
3507 house_window.DrawTitleText(pFontCreate, 483, 113, TargetColor(0x15u, 0x99u, 0xE9u), pTmpBuf.data(), 3); | |
1298 | 3508 if ( !dword_591080 ) |
3509 { | |
3510 if ( !uDialogueType ) | |
3511 { | |
1580 | 3512 if ( pNPC->greet ) |
1298 | 3513 { |
1580 | 3514 house_window.uFrameWidth = game_viewport_width; |
3515 house_window.uFrameZ = 452; | |
3516 pInString = (char *)*(&pNPCStats->field_17884 + ((pNPC->uFlags & 3) == 2) + 2 * pNPC->greet); | |
3517 pRenderer->GetLeather(8, 352 - (pFontArrus->CalcTextHeight(pInString, &house_window, 13, 0) + 7), | |
3518 pIcons_LOD->GetTexture(uTextureID_Leather), pIcons_LOD->GetTexture(uTextureID_Leather)->uTextureHeight | |
3519 - (pFontArrus->CalcTextHeight(pInString, &house_window, 13, 0) + 7)); | |
3520 pRenderer->DrawTextureIndexed(8, 347 - (pFontArrus->CalcTextHeight(pInString, &house_window, 13, 0) + 7), pTexture_591428); | |
3521 pDialogueWindow->DrawText(pFontArrus, 13, 354 - (pFontArrus->CalcTextHeight(pInString, &house_window, 13, 0) + 7), | |
3522 0, FitTextInAWindow(pInString, pFontArrus, &house_window, 0xDu, 0), 0, 0, 0); | |
1298 | 3523 } |
3524 } | |
3525 } | |
3526 memcpy(&v52, pDialogueWindow, sizeof(v52)); | |
3527 v52.uFrameX = 483; | |
3528 v52.uFrameWidth = 148; | |
3529 v52.uFrameZ = 334; | |
1580 | 3530 |
1298 | 3531 if ( v52.pStartingPosActiveItem < v52.pStartingPosActiveItem + v52.pNumPresenceButton ) |
3532 { | |
1580 | 3533 v15 = ""; |
3534 for ( int i = v52.pStartingPosActiveItem; i < v52.pStartingPosActiveItem + v52.pNumPresenceButton; ++i ) | |
1298 | 3535 { |
1580 | 3536 pButton = v52.GetControl(i); |
3537 if ( (signed int)pButton->msg_param > 24 ) | |
1298 | 3538 { |
1580 | 3539 if ( pButton->msg_param == 76 ) |
1298 | 3540 { |
1580 | 3541 v15 = pGlobalTXT_LocalizationStrings[406];//Нанять |
3542 strcpy(pButton->pButtonName, v15); | |
3543 continue; | |
1298 | 3544 } |
1580 | 3545 if ( pButton->msg_param == 77 ) |
1298 | 3546 { |
1580 | 3547 strcpy(pButton->pButtonName, pGlobalTXT_LocalizationStrings[407]);//Подробнее |
3548 continue; | |
1298 | 3549 } |
1580 | 3550 if ( pButton->msg_param == 79 ) |
1298 | 3551 { |
1580 | 3552 strcpy(pButton->pButtonName, _4B254D_SkillMasteryTeacher((int)v52.ptr_1C)); |
3553 continue; | |
1298 | 3554 } |
1580 | 3555 if ( pButton->msg_param == 82 ) |
1298 | 3556 { |
1580 | 3557 strcpy(pButton->pButtonName, ContractSelectText((int)v52.ptr_1C)); |
3558 continue; | |
1298 | 3559 } |
1580 | 3560 if ( pButton->msg_param == 83 ) |
1298 | 3561 { |
1529 | 3562 v29 = pMonsterStats->pInfos[bountyHunting_monster_id_for_hunting].pName; |
1298 | 3563 v31 = *(int *)v29; |
1580 | 3564 sprintfex(pTmpBuf.data(), "\f%05d%s\f%05d", TargetColor(0xFFu, 0xFFu, 0x9Bu), v31, TargetColor(0xFFu, 0xFFu, 0xFFu)); |
1529 | 3565 sprintfex(pTmpBuf2.data(), bountyHunting_text, pTmpBuf.data(), 100 * (unsigned __int8)v29[8]); |
1298 | 3566 current_npc_text = pTmpBuf2.data(); |
1580 | 3567 strcpy(pButton->pButtonName, ""); |
3568 continue; | |
1298 | 3569 } |
1580 | 3570 if ( pButton->msg_param != 93 ) |
1573 | 3571 { |
1580 | 3572 strcpy(pButton->pButtonName, ""); |
3573 continue; | |
1573 | 3574 } |
1298 | 3575 } |
3576 else | |
3577 { | |
1580 | 3578 if ( pButton->msg_param == 24 )//evt_F |
1298 | 3579 { |
1580 | 3580 v15 = (char *)pNPCTopics[pNPC->evt_F-1].pTopic; |
1298 | 3581 if ( !v15 ) |
3582 { | |
1580 | 3583 pButton->msg_param = 0; |
1298 | 3584 v15 = ""; |
3585 } | |
1580 | 3586 strcpy(pButton->pButtonName, v15); |
3587 continue; | |
1298 | 3588 } |
1580 | 3589 v18 = pButton->msg_param - 13; |
1298 | 3590 if ( v18 ) |
3591 { | |
1580 | 3592 if ( pButton->msg_param == 19 )//evt_A |
1298 | 3593 { |
1580 | 3594 v15 = (char *)pNPCTopics[pNPC->evt_A-1].pTopic; |
1298 | 3595 if ( !v15 ) |
3596 { | |
1580 | 3597 pButton->msg_param = 0; |
3598 v15 = ""; | |
3599 } | |
3600 strcpy(pButton->pButtonName, v15); | |
3601 continue; | |
3602 } | |
3603 if ( pButton->msg_param == 20 )//evt_B | |
3604 { | |
3605 v15 = (char *)pNPCTopics[pNPC->evt_B-1].pTopic; | |
3606 if ( !v15 ) | |
3607 { | |
3608 pButton->msg_param = 0; | |
1298 | 3609 v15 = ""; |
3610 } | |
3611 if ( uDialogueType != 84 ) | |
1580 | 3612 { |
3613 strcpy(pButton->pButtonName, v15); | |
3614 continue; | |
3615 } | |
3616 sprintf(pTmpBuf.data(), format_4E2D80, TargetColor(0xE1u, 0xCDu, 0x23u), pItemsTable->pItems[contract_approved].pUnidentifiedName); | |
1298 | 3617 sprintf(pTmpBuf2.data(), current_npc_text, pTmpBuf.data()); |
3618 current_npc_text = pTmpBuf2.data(); | |
1580 | 3619 strcpy(pButton->pButtonName, v15); |
3620 continue; | |
1298 | 3621 } |
1580 | 3622 if ( pButton->msg_param == 21 )//evt_C |
1298 | 3623 { |
1580 | 3624 v15 = (char *)pNPCTopics[pNPC->evt_C-1].pTopic; |
3625 if ( !v15 ) | |
3626 { | |
3627 pButton->msg_param = 0; | |
3628 v15 = ""; | |
3629 } | |
3630 strcpy(pButton->pButtonName, v15); | |
3631 continue; | |
1298 | 3632 } |
1580 | 3633 if ( pButton->msg_param == 22 )//evt_D |
1298 | 3634 { |
1580 | 3635 v15 = (char *)pNPCTopics[pNPC->evt_D-1].pTopic; |
3636 if ( !v15 ) | |
3637 { | |
3638 pButton->msg_param = 0; | |
3639 v15 = ""; | |
3640 } | |
3641 strcpy(pButton->pButtonName, v15); | |
3642 continue; | |
1298 | 3643 } |
1580 | 3644 if ( pButton->msg_param == 23 )//evt_E |
3645 { | |
3646 v15 = (char *)pNPCTopics[pNPC->evt_E-1].pTopic; | |
3647 if ( !v15 ) | |
3648 { | |
3649 pButton->msg_param = 0; | |
3650 v15 = ""; | |
3651 } | |
3652 strcpy(pButton->pButtonName, v15); | |
3653 continue; | |
3654 } | |
3655 strcpy(pButton->pButtonName, ""); | |
3656 continue; | |
1298 | 3657 } |
1580 | 3658 strcpy(pButton->pButtonName, pGlobalTXT_LocalizationStrings[122]);//Вступить |
1298 | 3659 } |
3660 } | |
3661 } | |
3662 v34 = 0; | |
1580 | 3663 v36 = pDialogueWindow->pStartingPosActiveItem; |
3664 for ( i = v36 + pDialogueWindow->pNumPresenceButton; (signed int)v36 < (signed int)i; i = pDialogueWindow->pNumPresenceButton | |
1298 | 3665 + pDialogueWindow->pStartingPosActiveItem ) |
3666 { | |
1580 | 3667 v37 = pDialogueWindow->GetControl(v36); |
1298 | 3668 v38 = pFontArrus->CalcTextHeight(v37->pButtonName, &v52, 0, 0); |
3669 v34 += v38; | |
3670 ++v36; | |
3671 } | |
1580 | 3672 v39 = pDialogueWindow->pNumPresenceButton; |
1298 | 3673 if ( v39 ) |
3674 { | |
1580 | 3675 pNPC = (NPCData *)((174 - v34) / v39); |
3676 if ( (signed int)pNPC > 32 ) | |
3677 pNPC = (NPCData *)32; | |
1298 | 3678 pInString = (char *)2; |
1580 | 3679 v40 = (174 - (signed int)pNPC * v39 - v34) / 2 - (signed int)pNPC / 2 + 138; |
3680 for ( i = pDialogueWindow->pStartingPosActiveItem; i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) | |
1298 | 3681 { |
1606 | 3682 pButton = pDialogueWindow->GetControl(i); |
3683 //v42 = v41; | |
3684 v43 = pButton->pButtonName; | |
3685 pButton->uY = (unsigned int)((char *)pNPC + v40); | |
3686 v44 = pFontArrus->CalcTextHeight(pButton->pButtonName, &v52, 0, 0); | |
3687 v45 = pButton->uY; | |
3688 pButton->uHeight = v44; | |
1580 | 3689 v40 = v45 + v44 - 1; |
1606 | 3690 pButton->uW = v40; |
1580 | 3691 v46 = TargetColor(0xE1u, 0xCDu, 0x23u); |
3692 if ( (char *)pDialogueWindow->pCurrentPosActiveItem != pInString ) | |
3693 v46 = TargetColor(0xFFu, 0xFFu, 0xFFu); | |
3694 v52.DrawTitleText(pFontArrus, 0, v45, v46, v43, 3); | |
3695 ++pInString; | |
1298 | 3696 } |
3697 } | |
3698 if ( current_npc_text ) | |
3699 { | |
3700 w.uFrameWidth = 458; | |
3701 w.uFrameZ = 457; | |
3702 v47 = pFontArrus; | |
3703 v48 = pFontArrus->CalcTextHeight(current_npc_text, &w, 13, 0) + 7; | |
3704 if ( 352 - v48 < 8 ) | |
3705 { | |
3706 v47 = pFontCreate; | |
3707 v48 = pFontCreate->CalcTextHeight(current_npc_text, &w, 13, 0) + 7; | |
3708 } | |
1496 | 3709 pRenderer->GetLeather(8, 352 - v48, pIcons_LOD->GetTexture(uTextureID_Leather), pIcons_LOD->GetTexture(uTextureID_Leather)->uTextureHeight - v48); |
1580 | 3710 pRenderer->DrawTextureIndexed(8, 347 - v48, pTexture_591428); |
3711 house_window.DrawText(v47, 13, 354 - v48, 0, FitTextInAWindow(current_npc_text, v47, &w, 13, 0), 0, 0, 0); | |
1298 | 3712 } |
3713 } | |
1434 | 3714 |
1300 | 3715 //----- (004B4F4F) -------------------------------------------------------- |
3716 void JailDialog() | |
1298 | 3717 { |
1608 | 3718 GUIWindow jail_dialogue_window; // [sp+8h] [bp-54h]@1 |
1298 | 3719 |
1608 | 3720 memcpy(&jail_dialogue_window, window_SpeakInHouse, sizeof(jail_dialogue_window)); |
3721 jail_dialogue_window.uFrameX = 483; | |
3722 jail_dialogue_window.uFrameWidth = 148; | |
3723 jail_dialogue_window.uFrameZ = 334; | |
3724 jail_dialogue_window.DrawTitleText(pFontArrus, 0, (310 - pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[672], &jail_dialogue_window, 0, 0)) / 2 + 18, | |
3725 TargetColor(0xFFu, 0xFFu, 0x9Bu), pGlobalTXT_LocalizationStrings[672], 3); | |
1298 | 3726 } |