Mercurial > mm7
annotate UI/UIHouses.cpp @ 2234:fd0b2a697416
fixing inverted guild greetings
author | Grumpy7 |
---|---|
date | Sun, 23 Feb 2014 00:34:38 +0100 |
parents | e9625ad08541 |
children | aff7a7b072b7 |
rev | line source |
---|---|
1299 | 1 #include "..\Texture.h" |
2 #include "..\mm7_data.h" | |
1298 | 3 #include "UIHouses.h" |
1299 | 4 #include "..\Party.h" |
5 #include "..\texts.h" | |
6 #include "..\Events.h" | |
7 #include "..\Arcomage.h" | |
8 #include "..\LOD.h" | |
9 #include "..\Mouse.h" | |
10 #include "..\GUIWindow.h" | |
11 #include "..\GUIFont.h" | |
12 #include "..\Overlays.h" | |
13 #include "..\Outdoor.h" | |
1638
ccde94f02b75
class IndoorCamera split into BLVRenderParams and ODMRenderParams
Nomad
parents:
1630
diff
changeset
|
14 #include "..\Outdoor_stuff.h" |
1299 | 15 #include "..\AudioPlayer.h" |
16 #include "..\VideoPlayer.h" | |
17 #include "..\Monsters.h" | |
18 #include "..\Viewport.h" | |
19 #include "..\Keyboard.h" | |
20 #include "..\MapInfo.h" | |
21 #include "..\Log.h" | |
22 #include "..\Game.h" | |
1298 | 23 |
1299 | 24 #include "..\stru159.h" |
1298 | 25 int uHouse_ExitPic; // weak |
26 | |
27 int dword_591080; // weak | |
28 | |
1411 | 29 BuildingType in_current_building_type; // 00F8B198 |
1298 | 30 HOUSE_DIALOGUE_MENU dialog_menu_id; // 00F8B19C |
31 | |
32 #pragma pack(push, 1) | |
33 struct stru365_travel_info | |
34 { | |
35 unsigned char uMapInfoID; | |
36 unsigned char pSchedule[7]; | |
37 unsigned int uTravelTime; | |
38 int arrival_x; | |
39 int arrival_y; | |
40 int arrival_z; | |
41 int arrival_rot_y; | |
42 unsigned int uQuestBit; // quest bit required to set for this travel option to be enabled; otherwise 0 | |
43 }; | |
44 #pragma pack(pop) | |
45 stru365_travel_info transport_schedule[35] = // 004F09B0 | |
46 { | |
47 {MAP_STEADWICK, {1, 0, 1, 0, 1, 0, 0}, 2, -18048, 4636, 833, 1536, 0}, | |
48 {MAP_PIERPONT, {0, 1, 0, 1, 0, 1, 0}, 2, -2527, -6773, 1153, 896, 0}, | |
49 {MAP_TATALIA, {1, 0, 1, 0, 1, 0, 0}, 2, 4730, -10580, 320, 1024, 0}, | |
50 {MAP_HARMONDALE, {0, 1, 0, 1, 0, 1, 0}, 2, -5692, 11137, 1, 1024, 0}, | |
51 {MAP_DEYJA, {1, 0, 0, 1, 0, 0, 0}, 3, 7227, -16007, 2625, 640, 0}, | |
52 {MAP_BRAKADA_DESERT, {0, 0, 1, 0, 0, 1, 0}, 3, 8923, 17191, 1, 512, 0}, | |
53 {MAP_AVLEE, {1, 0, 1, 0, 1, 0, 0}, 3, 17059, 12331, 512, 1152, 0}, | |
54 {MAP_DEYJA, {0, 1, 0, 0, 1, 0, 1}, 2, 7227, -16007, 2625, 640, 0}, | |
55 {MAP_HARMONDALE, {0, 1, 0, 1, 0, 1, 0}, 2, -5692, 11137, 1, 1024, 0}, | |
56 {MAP_STEADWICK, {1, 0, 1, 0, 1, 0, 0}, 3, -18048, 4636, 833, 1536, 0}, | |
57 {MAP_PIERPONT, {0, 1, 0, 1, 0, 1, 0}, 2, -2527, -6773, 1153, 896, 0}, | |
58 {MAP_STEADWICK, {1, 0, 1, 0, 1, 0, 1}, 3, -18048, 4636, 833, 1536, 0}, | |
59 {MAP_HARMONDALE, {0, 1, 0, 0, 0, 1, 0}, 5, -5692, 11137, 1, 1024, 0}, | |
60 {MAP_STEADWICK, {0, 1, 0, 1, 0, 1, 0}, 2, -18048, 4636, 833, 1536, 0}, | |
61 {MAP_PIERPONT, {0, 1, 0, 1, 0, 1, 0}, 3, -2527, -16007, 1153, 896, 0}, | |
62 {MAP_DEYJA, {0, 0, 1, 0, 0, 0, 1}, 5, 7227, -16007, 2625, 640, 0}, | |
63 {MAP_TATALIA, {0, 1, 0, 1, 0, 1, 0}, 2, -2183, -6941, 97, 0, 0}, | |
64 {MAP_AVLEE, {1, 0, 0, 0, 1, 0, 0}, 4, 7913, 9476, 193, 0, 0}, | |
65 {MAP_EVENMORN_ISLE, {0, 0, 0, 0, 0, 0, 1}, 7, 15616, 6390, 193, 1536, PARTY_QUEST_EVENMORN_MAP_FOUND}, | |
66 {MAP_BRAKADA_DESERT, {0, 0, 1, 0, 0, 0, 0}, 6, 19171, -19722, 193, 1024, 0}, | |
67 {MAP_AVLEE, {0, 1, 0, 1, 0, 1, 0}, 3, 7913, 9476, 193, 0, 0}, | |
68 {MAP_BRAKADA_DESERT, {1, 0, 1, 0, 0, 0, 0}, 6, 19171, -19722, 193, 1024, 0}, | |
69 {MAP_TATALIA, {1, 0, 1, 0, 1, 0, 0}, 4, -2183, -6941, 97, 0, 0}, | |
70 {MAP_PIERPONT, {0, 0, 0, 0, 0, 1, 0}, 6, -709, -14087, 193, 1024, 0}, | |
71 {MAP_STEADWICK, {0, 0, 0, 0, 0, 0, 1}, 6, -10471, 13497, 193, 1536, 0}, | |
72 {MAP_EVENMORN_ISLE, {0, 1, 0, 1, 0, 0, 0}, 1, 15616, 6390, 193, 1536, PARTY_QUEST_EVENMORN_MAP_FOUND}, | |
73 {MAP_BRAKADA_DESERT, {0, 1, 0, 1, 0, 0, 0}, 1, 19171, -19722, 193, 1024, 0}, | |
74 {MAP_STEADWICK, {0, 1, 0, 1, 0, 1, 0}, 2, -10471, 13497, 193, 1536, 0}, | |
75 {MAP_BRAKADA_DESERT, {1, 0, 1, 0, 0, 0, 0}, 4, 19171, -19722, 193, 1024, 0}, | |
76 {MAP_EVENMORN_ISLE, {0, 0, 0, 0, 0, 0, 1}, 5, 15616, 6390, 193, 1536, PARTY_QUEST_EVENMORN_MAP_FOUND}, | |
77 {MAP_AVLEE, {0, 0, 0, 0, 1, 0, 0}, 5, 7913, 9476, 193, 0, 0}, | |
78 {MAP_STEADWICK, {0, 1, 0, 0, 0, 1, 0}, 4, -10471, 13497, 193, 1536, 0}, | |
79 {MAP_PIERPONT, {1, 0, 1, 0, 1, 0, 0}, 3, -709, -14087, 193, 1024, 0}, | |
80 {MAP_TATALIA, {0, 0, 0, 1, 0, 0, 0}, 5, -2183, -6941, 97, 0, 0}, | |
81 {MAP_ARENA, {0, 0, 0, 0, 0, 0, 1}, 4, 3844, 2906, 193, 512, 0} | |
82 }; | |
83 | |
84 unsigned char transport_routes[20][4] = | |
85 { | |
86 { 0, 1, 1, 34}, // HOUSE_STABLES_HARMONDALE | |
87 { 2, 3, 4, 5}, // HOUSE_STABLES_STEADWICK | |
1589 | 88 { 6, 7, 8, 8}, // HOUSE_STABLES_TULAREAN_FOREST |
89 { 9, 10, 10, 10}, // HOUSE_STABLES_DEYJA | |
1610 | 90 { 11, 11, 12, 12}, // HOUSE_STABLES_BRACADA_DESERT |
91 { 13, 13, 13, 13}, // HOUSE_STABLES_TATALIA | |
92 { 14, 14, 15, 15}, // HOUSE_STABLES_AVLEE | |
1298 | 93 {255, 255, 255, 255}, // HOUSE_STABLES_61 |
94 {255, 255, 255, 255}, // HOUSE_STABLES_62 | |
1610 | 95 {255, 255, 255, 255}, // HOUSE_BOATS_EMERALD_ISLE |
96 { 16, 17, 18, 19}, // HOUSE_BOATS_ERATHIA | |
97 { 18, 20, 21, 21}, // HOUSE_BOATS_TULAREAN_FOREST | |
98 { 22, 23, 24, 25}, // HOUSE_BOATS_BRACADA_DESERT | |
99 { 22, 22, 23, 23}, // HOUSE_BOATS_EVENMORN_ISLAND | |
1298 | 100 {255, 255, 255, 255}, // HOUSE_BOATS_68 |
1610 | 101 { 27, 28, 29, 30}, // HOUSE_BOATS_TATALIA |
102 { 31, 32, 33, 33}, // HOUSE_BOATS_AVLEE | |
1298 | 103 { 24, 24, 24, 24}, // HOUSE_BOATS_71 |
104 {255, 255, 255, 255}, // HOUSE_BOATS_72 | |
105 {255, 255, 255, 255} // HOUSE_BOATS_73 | |
106 }; | |
107 | |
108 std::array<const stru159, 196> pAnimatedRooms = //0x4E5F70 | |
109 {{ | |
110 {"", 0x4, 0x1F4, 0, 0, 0}, | |
111 {"Human Armor01", 0x20, 0x2C0, 2, 58, 0}, | |
112 {"Necromancer Armor01", 0x20, 0x2D7, 2, 70, 0 }, | |
113 {"Dwarven Armor01", 0x20, 0x2EE, 2, 5, 0 }, | |
114 {"Wizard Armor", 0x20, 0x3BD, 2, 19, 0 }, | |
115 {"Warlock Armor", 0x20, 0x2D6, 2, 35, 0 }, | |
116 {"Elf Armor", 0x20, 0x2BC, 2, 79, 0 }, | |
117 {"Human Alchemisht01", 0xE, 0x2BE, 4, 95, 0 }, | |
118 {"Necromancer Alchemist01", 0xE, 0x2D6, 4, 69, 0 }, | |
119 {"Dwarven Achemist01", 0xE, 0x387, 4, 4, 0 }, | |
120 {"Wizard Alchemist", 0xE, 0x232, 4, 25, 0 }, | |
121 {"Warlock Alchemist", 0xE, 0x2BE, 4, 42, 0 }, | |
122 {"Elf Alchemist", 0xE, 0x38A, 4, 84, 0 }, | |
123 {"Human Bank01", 0x6, 0x384, 22, 52, 0 }, | |
124 {"Necromancer Bank01", 0x6, 0x2D8, 22, 71, 0 }, | |
125 {"Dwarven Bank", 0x6, 0x2F3, 22, 6, 0 }, | |
126 {"Wizard Bank", 0x6, 0x3BA, 22, 20, 0 }, | |
127 {"Warlock Bank", 0x6, 0x39F, 22, 36, 0 }, | |
128 {"Elf Bank", 0x6, 0x2BC, 22, 71, 0 }, | |
129 {"Boat01", 0xF, 0x4C, 28, 53, 3 }, | |
130 {"Boat01d", 0xF, 0x4C, 28, 53, 3 }, | |
131 {"Human Magic Shop01", 0xA, 0x2C8, 3, 54, 0 }, | |
132 {"Necromancer Magic Shop01", 0xE, 0x2DC, 3, 66, 0 }, | |
133 {"Dwarven Magic Shop01", 0x2A, 0x2EF, 3, 91, 0 }, | |
134 {"Wizard Magic Shop", 0x1E, 0x2DF, 3, 15, 0 }, | |
135 {"Warlock Magic Shop", 0x7, 0x3B9, 3, 15, 0 }, | |
136 {"Elf Magic Shop", 0x24, 0x2CC, 3, 82, 0 }, | |
137 {"Human Stables01", 0x21, 0x31, 27, 48, 3 }, | |
138 {"Necromancer Stables", 0x21, 0x2DD, 27, 67, 3 }, | |
139 {"", 0x21, 0x2F0, 27, 91, 3 }, | |
140 {"Wizard Stables", 0x21, 0x3BA, 27, 16, 3 }, | |
141 {"Warlock Stables", 0x21, 0x181, 27, 77, 3 }, | |
142 {"Elf Stables", 0x21, 0x195, 27, 77, 3 }, | |
143 {"Human Tavern01", 0xD, 0x2C2, 21, 49, 0 }, | |
144 {"Necromancer Tavern01", 0xD, 0x3B0, 21, 57, 0 }, | |
145 {"Dwarven Tavern01", 0xD, 0x2FE, 21, 94, 0 }, | |
146 {"Wizard Tavern", 0xD, 0x3BB, 21, 17, 0 }, | |
147 {"Warlock Tavern", 0xD, 0x3A8, 21, 33, 0 }, | |
148 {"Elf Tavern", 0xD, 0x2CD, 21, 78, 0 }, | |
149 {"Human Temple01", 0x24, 0x2DB, 23, 50, 3 }, | |
150 {"Necromancer Temple", 0x24, 0x2DF, 23, 60, 3 }, | |
151 {"Dwarven Temple01", 0x24, 0x2F1, 23, 86, 3 }, | |
152 {"Wizard Temple", 0x24, 0x2E0, 23, 10, 3 }, | |
153 {"Warlock Temple", 0x24, 0x3A4, 23, 27, 3 }, | |
154 {"Elf Temple", 0x24, 0x2CE, 23, 72, 3 }, | |
155 {"Human Town Hall", 0x10, 0x39C, 17, 14, 0 }, | |
156 {"Necromancer Town Hall01", 0x10, 0x3A4, 17, 61, 0 }, | |
157 {"Dwarven Town Hall", 0x10, 0x2DB, 17, 88, 0 }, | |
158 {"Wizard Town Hall", 0x10, 0x3BD, 17, 11, 0 }, | |
159 {"Warlock Town Hall", 0x10, 0x2DB, 17, 28, 0 }, | |
160 {"Elf Town Hall", 0x10, 0x27A, 17, 73, 0 }, | |
161 {"Human Training Ground01", 0x18, 0x2C7, 30, 44, 0 }, | |
162 {"Necromancer Training Ground", 0x18, 0x3AD, 30, 62, 0 }, | |
163 {"Dwarven Training Ground", 0x18, 0x2F2, 30, 89, 0 }, | |
164 {"Wizard Training Ground", 0x18, 0x3A3, 30, 12, 0 }, | |
165 {"Warlock Training Ground", 0x18, 0x3A6, 30, 29, 0 }, | |
166 {"Elf Training Ground", 0x18, 0x19F, 30, 74, 0 }, | |
167 {"Human Weapon Smith01", 0x16, 0x2C1, 1, 45, 4 }, | |
168 {"Necromancer Weapon Smith01", 0x16, 0x2D9, 1, 63, 4 }, | |
169 {"Dwarven Weapon Smith01", 0x16, 0x2EE, 1, 82, 4 }, | |
170 {"Wizard Weapon Smith", 0x16, 0x2D5, 1, 13, 4 }, | |
171 {"Warlock Weapon Smith", 0x16, 0x2D7, 1, 23, 4 }, | |
172 {"Elf Weapon Smith", 0x16, 0x2CA, 1, 75, 4 }, | |
173 {"Air Guild", 0x1D, 0xA4, 6, 1, 3 }, | |
174 {"Body Guild", 0x19, 0x3BF, 11, 2, 0 }, | |
175 {"DarkGuild", 0x19, 0x2D1, 13, 3, 0 }, | |
176 {"EarthGuild", 0x19, 0x2CB, 8, 83, 0 }, | |
177 {"Fire Guild", 0x1C, 0x2BF, 5, 56, 0 }, | |
178 {"Light Guild", 0x1C, 0x2D5, 12, 46, 0 }, | |
179 {"Mind Guild", 0x1C, 0xE5, 10, 40, 0 }, | |
180 {"Spirit Guild", 0x1C, 0x2D2, 9, 41, 0 }, | |
181 {"Water Guild", 0x1B, 0x2D3, 7, 24, 0 }, | |
182 {"Lord And Judge Out01", 1, 0, 29, 39, 0 }, | |
183 {"Human Poor House 1", 8, 0, 29, 0, 0 }, | |
184 {"Human Poor House 2", 8, 0, 29, 0, 0 }, | |
185 {"Human Poor House 3", 8, 0, 29, 0, 0 }, | |
186 {"Human Medium House 1", 8, 0, 29, 0, 0 }, | |
187 {"Human Medium House 2", 8, 0, 29, 0, 0 }, | |
188 {"Human Medium House 3", 8, 0, 29, 0, 0 }, | |
189 {"Human Rich House 1", 8, 0, 29, 0, 0 }, | |
190 {"Human Rich House 2", 8, 0, 29, 0, 0 }, | |
191 {"Human Rich House 3", 8, 0, 29, 0, 0 }, | |
192 {"Elven Poor House 1", 8, 0, 29, 0, 0 }, | |
193 {"Elven Poor House 2", 8, 0, 29, 0, 0 }, | |
194 {"Elven Poor House 3", 8, 0, 29, 0, 0 }, | |
195 {"Elven Medium House 1", 8, 0, 29, 0, 0 }, | |
196 {"Elven Medium House 2", 8, 0, 29, 0, 0 }, | |
197 {"Elven Medium House 3", 8, 0, 29, 0, 0 }, | |
198 {"Elven Rich House 1", 8, 0, 29, 0, 0 }, | |
199 {"Elven Rich House 2", 8, 0, 29, 0, 0 }, | |
200 {"Elven Rich House 3", 8, 0, 29, 0, 0 }, | |
201 {"Dwarven Poor House 1", 8, 0, 29, 0, 0 }, | |
202 {"Dwarven Poor House 2", 8, 0, 29, 0, 0 }, | |
203 {"Dwarven Poor House 3", 8, 0, 29, 0, 0 }, | |
204 {"Dwarven Medium House 1", 8, 0, 29, 0, 0 }, | |
205 {"Dwarven Medium house 2", 8, 0, 29, 0, 0 }, | |
206 {"Dwarven Medium House 3", 8, 0, 29, 0, 0 }, | |
207 {"Dwarven Rich House 1", 8, 0, 29, 0, 0 }, | |
208 {"Dwarven Rich House 2", 8, 0, 29, 0, 0 }, | |
209 {"Dwarven Rich House 3", 8, 0, 29, 0, 0 }, | |
210 {"Wizard Poor House 1", 8, 0, 29, 0, 0 }, | |
211 {"Wizard Poor House 2", 8, 0, 29, 0, 0 }, | |
212 {"Wizard Poor House 3", 8, 0, 29, 0, 0 }, | |
213 {"Wizard Medium House 1", 8, 0, 29, 0, 0 }, | |
214 {"Wizard Medium House 2", 8, 0, 29, 0, 0 }, | |
215 {"Wizard Mdeium House 3", 8, 0, 29, 0, 0 }, | |
216 {"Wizard Rich House 1", 8, 0, 29, 0, 0 }, | |
217 {"Wizard Rich House 2", 8, 0, 29, 0, 0 }, | |
218 {"Wizard Rich House 3", 8, 0, 29, 0, 0 }, | |
219 {"Necromancer Poor House 1", 8, 0, 29, 0, 0 }, | |
220 {"Necromancer Poor House 2", 8, 0, 29, 0, 0 }, | |
221 {"Necromancer Poor House 3", 8, 0, 29, 0, 0 }, | |
222 {"Necromancer Medium House 1", 8, 0, 29, 0, 0 }, | |
223 {"Necromancer Medium House 2", 8, 0, 29, 0, 0 }, | |
224 {"Necromancer Mdeium House 3", 8, 0, 29, 0, 0 }, | |
225 {"Necromancer Rich House 1", 8, 0, 29, 0, 0 }, | |
226 {"Necromancer Rich House 2", 8, 0, 29, 0, 0 }, | |
227 {"Necromancer Rich House 3", 8, 0, 29, 0, 0 }, | |
228 {"Warlock Poor House 1", 8, 0, 29, 0, 0 }, | |
229 {"Warlock Poor House 2", 8, 0, 29, 0, 0 }, | |
230 {"Warlock Poor House 3", 8, 0, 29, 0, 0 }, | |
231 {"Warlock Medium House 1", 8, 0, 29, 0, 0 }, | |
232 {"Warlock Medium House 2", 8, 0, 29, 0, 0 }, | |
233 {"Warlock Mdeium House 3", 8, 0, 29, 0, 0 }, | |
234 {"Warlock Rich House 1", 8, 0, 29, 0, 0 }, | |
235 {"Warlock Rich House 2", 8, 0, 29, 0, 0 }, | |
236 {"Warlock Rich House 3", 8, 0, 29, 0, 0 }, | |
237 {"Out01 Temple of the Moon", 0x24, 0, 25, 0, 0 }, | |
238 {"Out01 Dragon Cave", 0x24, 0, 25, 0, 0 }, | |
239 {"Out02 Castle Harmondy", 0x24, 0, 25, 0, 0 }, | |
240 {"Out02 White Cliff Cave", 0x24, 0, 25, 0, 0 }, | |
241 {"Out03 Erathian Sewer", 0x24, 0, 25, 0, 0 }, | |
242 {"Out03 Fort Riverstride", 0x24, 0, 25, 0, 0 }, | |
243 {"Out03 Castle Gryphonheart", 0x24, 0, 25, 0, 0 }, | |
244 {"Out04 Elf Castle", 0x24, 0, 25, 0, 0 }, | |
245 {"Out04 Tularean Caves", 0x24, 0, 25, 0, 0 }, | |
246 {"Out04 Clanker's Laboratory", 0x24, 0, 25, 0, 0 }, | |
247 {"Out05 Hall of the Pit", 0x24, 0, 25, 0, 0 }, | |
248 {"Out05 Watchtower 6", 0x24, 0, 25, 0, 0 }, | |
249 {"Out06 School of Sorcery", 0x24, 0, 25, 0, 0 }, | |
250 {"Out06 Red Dwarf Mines", 0x24, 0, 25, 0, 0 }, | |
251 {"Out07 Castle Lambert", 0x24, 0, 25, 0, 0 }, | |
252 {"Out07 Walls of Mist", 0x24, 0, 25, 0, 0 }, | |
253 {"Out07 Temple of the Light", 0x24, 0, 25, 0, 0 }, | |
254 {"Out08 Evil Entrance", 0x24, 0, 25, 0, 0 }, | |
255 {"Out08 Breeding Zone", 0x24, 0, 25, 0, 0 }, | |
256 {"Out08 Temple of the Dark", 0x24, 0, 25, 0, 0 }, | |
257 {"Out09 Grand Temple of the Moon", 0x24, 0, 25, 0, 0 }, | |
258 {"Out09 Grand Tempple of the Sun", 0x24, 0, 25, 0, 0 }, | |
259 {"Out10 Thunderfist Mountain", 0x24, 0, 25, 0, 0 }, | |
260 {"Out10 The Maze", 0x24, 0, 25, 0, 0 }, | |
261 {"Out10 Connecting Tunnel Cave #1", 0x24, 0, 25, 0, 0 }, | |
262 {"", 0x24, 0, 25, 0, 0 }, | |
263 {"", 0x24, 0, 25, 0, 0 }, | |
264 {"Out11 Stone City", 0x24, 0, 25, 0, 0 }, | |
265 {"", 0x24, 0, 25, 0, 0 }, | |
266 {"Out12 Colony Zod", 0x24, 0, 25, 0, 0 }, | |
267 {"Out12 Connecting Tunnel Cave #1", 0x24, 0, 25, 0, 0 }, | |
268 {"", 0x24, 0, 25, 0, 0 }, | |
269 {"", 0x24, 0, 25, 0, 0 }, | |
270 {"Out13 Mercenary Guild", 0x24, 0, 25, 0, 0 }, | |
271 {"Out13 Tidewater Caverns", 0x24, 0, 25, 0, 0 }, | |
272 {"Out13 Wine Cellar", 0x24, 0, 25, 0, 0 }, | |
273 {"Out14 Titan's Stronghold", 0x24, 0, 25, 0, 0 }, | |
274 {"Out14 Temple Of Baa", 0x24, 0, 25, 0, 0 }, | |
275 {"Out14 Hall under the Hill", 0x24, 0, 25, 0, 0 }, | |
276 {"Out15 The Linclon", 0x24, 0, 25, 0, 0 }, | |
277 {"Jail", 0x24, 0, 31, 0, 0 }, | |
278 {"Harmondale Throne Room", 0x24, 0, 29, 0, 0 }, | |
279 {"Gryphonheart Throne Room", 0x24, 0, 20, 0, 0 }, | |
280 {"Elf Castle Throne Room", 0x24, 0, 20, 0, 0 }, | |
281 {"Wizard Castle Throne Room", 0x24, 0, 20, 0, 0 }, | |
282 {"Necromancer Casstle Trone Room", 0x24, 0, 20, 0, 0 }, | |
283 {"Master Thief", 0x24, 0, 29, 0, 0 }, | |
284 {"Dwarven King", 0x24, 0, 20, 0, 0 }, | |
285 {"Arms Master", 0x24, 0, 29, 0, 0 }, | |
286 {"Warlock", 0x24, 0, 29, 0, 0 }, | |
287 {"Lord Markam", 0x24, 0, 20, 0, 0 }, | |
288 {"Arbiter Neutral Town", 0x24, 0, 29, 0, 0 }, | |
289 {"Arbiter Good Town", 0x24, 0, 29, 0, 0 }, | |
290 {"Arbiter Evil Town", 0x24, 0, 29, 0, 0 }, | |
291 {"Necromancer Throne Room Empty", 0x24, 0, 20, 0, 0 }, | |
292 {"", 0x24, 0, 29, 0, 0 }, | |
293 {"", 0x24, 0, 29, 0, 0 }, | |
294 {"", 0x24, 0, 29, 0, 0 }, | |
295 {"", 0x24, 0, 29, 0, 0 }, | |
296 {"Boat01", 0xF, 0, 29, 53, 3 }, | |
297 {"", 0x24, 0, 28, 0, 0 }, | |
298 {"", 0x24, 0, 28, 0, 0 }, | |
299 {"", 0x24, 0, 28, 0, 0 }, | |
300 {"", 0x24, 0, 29, 0, 0 }, | |
301 {"Arbiter Room Neutral", 0x24, 0, 29, 0, 0 }, | |
302 {"Out02 Castle Harmondy Abandoned", 0x24, 0, 25, 0, 0 }, | |
303 {"Human Temple02", 0x24, 0x3AB, 23, 27, 0 }, | |
304 {"Player Castle Good", 0x24, 0, 25, 0, 0 }, | |
305 {"Player Castle Bad", 0x24, 0, 25, 0, 0} | |
306 }}; | |
307 | |
1393 | 308 |
1411 | 309 |
310 //----- (004B3A72) -------------------------------------------------------- | |
311 void InitializaDialogueOptions_Tavern(BuildingType type) | |
312 { | |
313 int num_buttons; // esi@1 | |
314 | |
315 num_buttons = 0; | |
316 if (type == BuildingType_Tavern) | |
317 { | |
318 num_buttons = 2; | |
319 CreateButtonInColumn(0, 102); | |
320 CreateButtonInColumn(1, 103); | |
1526 | 321 if ( pParty->HasItem(651) ) //Arcomage Deck |
1411 | 322 { |
323 num_buttons = 3; | |
324 CreateButtonInColumn(2, 104); | |
325 } | |
326 } | |
327 pDialogueWindow->_41D08F_set_keyboard_control_group(num_buttons, 1, 0, 2); | |
328 dword_F8B1E0 = pDialogueWindow->pNumPresenceButton; | |
329 } | |
330 // F8B1E0: using guessed type int dword_F8B1E0; | |
331 | |
332 //----- (004B3AD4) -------------------------------------------------------- | |
333 void InitializaDialogueOptions_Shops(BuildingType type) | |
334 { | |
335 switch (type) | |
336 { | |
337 case BuildingType_WeaponShop: | |
338 case BuildingType_ArmorShop: | |
339 case BuildingType_MagicShop: | |
340 { | |
341 CreateButtonInColumn(0, 3); | |
342 CreateButtonInColumn(1, 4); | |
343 CreateButtonInColumn(2, 5); | |
344 pDialogueWindow->_41D08F_set_keyboard_control_group(3, 1, 0, 2); | |
345 } | |
346 break; | |
347 | |
348 case BuildingType_AlchemistShop: | |
349 { | |
350 CreateButtonInColumn(0, 3); | |
351 CreateButtonInColumn(1, 4); | |
352 pDialogueWindow->_41D08F_set_keyboard_control_group(2, 1, 0, 2); | |
353 } | |
354 break; | |
355 } | |
356 | |
357 dword_F8B1E0 = pDialogueWindow->pNumPresenceButton; | |
358 } | |
359 // F8B1E0: using guessed type int dword_F8B1E0; | |
360 | |
361 //----- (004B3B42) -------------------------------------------------------- | |
362 void InitializaDialogueOptions(BuildingType type) | |
363 { | |
364 switch (type) | |
365 { | |
366 case BuildingType_WeaponShop: | |
367 case BuildingType_ArmorShop: | |
368 case BuildingType_MagicShop: | |
369 case BuildingType_AlchemistShop: | |
370 { | |
371 CreateButtonInColumn(0, 2); | |
372 CreateButtonInColumn(1, 95); | |
373 CreateButtonInColumn(2, 94); | |
374 CreateButtonInColumn(3, 96); | |
375 pDialogueWindow->_41D08F_set_keyboard_control_group(4, 1, 0, 2); | |
376 } | |
377 break; | |
378 | |
379 case BuildingType_FireGuild: | |
380 { | |
381 CreateButtonInColumn(0, 18); | |
382 CreateButtonInColumn(1, 48); | |
383 CreateButtonInColumn(2, 72); | |
384 pDialogueWindow->_41D08F_set_keyboard_control_group(3, 1, 0, 2); | |
385 } | |
386 break; | |
387 | |
388 case BuildingType_AirGuild: | |
389 { | |
390 CreateButtonInColumn(0, 18); | |
391 CreateButtonInColumn(1, 49); | |
392 CreateButtonInColumn(2, 72); | |
393 pDialogueWindow->_41D08F_set_keyboard_control_group(3, 1, 0, 2); | |
394 } | |
395 break; | |
396 | |
397 case BuildingType_WaterGuild: | |
398 { | |
399 CreateButtonInColumn(0, 18); | |
400 CreateButtonInColumn(1, 50); | |
401 CreateButtonInColumn(2, 72); | |
402 pDialogueWindow->_41D08F_set_keyboard_control_group(3, 1, 0, 2); | |
403 } | |
404 break; | |
405 | |
406 case BuildingType_EarthGuild: | |
407 { | |
408 CreateButtonInColumn(0, 18); | |
409 CreateButtonInColumn(1, 51); | |
410 CreateButtonInColumn(2, 72); | |
411 pDialogueWindow->_41D08F_set_keyboard_control_group(3, 1, 0, 2); | |
412 } | |
413 break; | |
414 | |
415 case BuildingType_SpiritGuild: | |
416 { | |
417 CreateButtonInColumn(0, 18); | |
418 CreateButtonInColumn(1, 52); | |
419 CreateButtonInColumn(2, 61); | |
420 pDialogueWindow->_41D08F_set_keyboard_control_group(3, 1, 0, 2); | |
421 } | |
422 break; | |
423 | |
424 case BuildingType_MindGuild: | |
425 { | |
426 CreateButtonInColumn(0, 18); | |
427 CreateButtonInColumn(1, 53); | |
428 CreateButtonInColumn(2, 61); | |
429 pDialogueWindow->_41D08F_set_keyboard_control_group(3, 1, 0, 2); | |
430 } | |
431 break; | |
432 | |
433 case BuildingType_BodyGuild: | |
434 { | |
435 CreateButtonInColumn(0, 18); | |
436 CreateButtonInColumn(1, 54); | |
437 CreateButtonInColumn(2, 61); | |
438 pDialogueWindow->_41D08F_set_keyboard_control_group(3, 1, 0, 2); | |
439 } | |
440 break; | |
441 | |
442 case BuildingType_LightGuild: | |
443 { | |
444 CreateButtonInColumn(0, 18); | |
445 CreateButtonInColumn(1, 55); | |
446 pDialogueWindow->_41D08F_set_keyboard_control_group(2, 1, 0, 2); | |
447 } | |
448 break; | |
449 | |
450 case BuildingType_DarkGuild: | |
451 { | |
452 CreateButtonInColumn(0, 18); | |
453 CreateButtonInColumn(1, 56); | |
454 pDialogueWindow->_41D08F_set_keyboard_control_group(2, 1, 0, 2); | |
455 } | |
456 break; | |
457 | |
1644 | 458 case BuildingType_ElementalGuild: |
1411 | 459 { |
460 CreateButtonInColumn(0, 18); | |
461 CreateButtonInColumn(1, 48); | |
462 CreateButtonInColumn(2, 49); | |
463 CreateButtonInColumn(3, 50); | |
464 CreateButtonInColumn(4, 51); | |
465 pDialogueWindow->_41D08F_set_keyboard_control_group(5, 1, 0, 2); | |
466 } | |
467 break; | |
468 | |
1644 | 469 case BuildingType_SelfGuild: |
1411 | 470 { |
471 CreateButtonInColumn(0, 18); | |
472 CreateButtonInColumn(1, 52); | |
473 CreateButtonInColumn(2, 53); | |
474 CreateButtonInColumn(3, 54); | |
475 pDialogueWindow->_41D08F_set_keyboard_control_group(4, 1, 0, 2); | |
476 } | |
477 break; | |
478 | |
479 case BuildingType_16: | |
480 case BuildingType_TownHall: | |
481 { | |
482 int num_buttons = 1; | |
483 CreateButtonInColumn(0, 99); | |
484 | |
485 if (pParty->uFine) | |
486 { | |
487 num_buttons++; | |
488 CreateButtonInColumn(1, 100); | |
489 } | |
490 | |
491 pDialogueWindow->_41D08F_set_keyboard_control_group(num_buttons, 1, 0, 2); | |
492 } | |
493 break; | |
494 | |
495 case BuildingType_Bank: | |
496 { | |
497 CreateButtonInColumn(0, 7); | |
498 CreateButtonInColumn(1, 8); | |
499 pDialogueWindow->_41D08F_set_keyboard_control_group(2, 1, 0, 2); | |
500 } | |
501 break; | |
502 | |
503 case BuildingType_Temple: | |
504 { | |
505 CreateButtonInColumn(0, 10); | |
506 CreateButtonInColumn(1, 11); | |
507 CreateButtonInColumn(2, 96); | |
508 pDialogueWindow->_41D08F_set_keyboard_control_group(3, 1, 0, 2); | |
509 } | |
510 break; | |
511 | |
512 case BuildingType_Stables: | |
513 case BuildingType_Boats: | |
514 { | |
515 CreateButtonInColumn(0, 105); | |
516 CreateButtonInColumn(1, 106); | |
517 CreateButtonInColumn(2, 107); | |
518 CreateButtonInColumn(3, 108); | |
519 pDialogueWindow->_41D08F_set_keyboard_control_group(4, 1, 0, 2); | |
520 } | |
521 break; | |
522 | |
523 case BuildingType_Training: | |
524 { | |
525 CreateButtonInColumn(0, 17); | |
526 CreateButtonInColumn(1, 96); | |
527 pDialogueWindow->_41D08F_set_keyboard_control_group(2, 1, 0, 2); | |
528 } | |
529 break; | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1411
diff
changeset
|
530 |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1411
diff
changeset
|
531 case BuildingType_Tavern: |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1411
diff
changeset
|
532 { |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1411
diff
changeset
|
533 CreateButtonInColumn(0, 0xFu); |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1411
diff
changeset
|
534 CreateButtonInColumn(1, 0x10u); |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1411
diff
changeset
|
535 CreateButtonInColumn(2, 0x60u); |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1411
diff
changeset
|
536 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
|
537 { |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1411
diff
changeset
|
538 pDialogueWindow->_41D08F_set_keyboard_control_group(3, 1, 0, 2); |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1411
diff
changeset
|
539 break; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1411
diff
changeset
|
540 } |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1411
diff
changeset
|
541 CreateButtonInColumn(3, 101); |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1411
diff
changeset
|
542 pDialogueWindow->_41D08F_set_keyboard_control_group(4, 1, 0, 2); |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1411
diff
changeset
|
543 } |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1411
diff
changeset
|
544 break; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1411
diff
changeset
|
545 |
1411 | 546 case BuildingType_18: |
547 case BuildingType_19: | |
548 case BuildingType_Throne_Room: | |
549 case BuildingType_24: | |
550 case BuildingType_Unic: | |
551 case BuildingType_1A: | |
552 case BuildingType_House: | |
553 case BuildingType_Jail: | |
554 break; | |
555 | |
556 default: | |
1545 | 557 Error("Invalid enumeration value: %u", type); |
1411 | 558 } |
559 | |
560 /* if ( a1 > 13 ) | |
561 { | |
562 if ( a1 > 22 ) | |
563 { | |
564 if ( a1 == 23 ) | |
565 { | |
566 CreateButtonInColumn(0, 0xAu); | |
567 CreateButtonInColumn(1, 0xBu); | |
568 v14 = 96; | |
569 LABEL_41: | |
570 CreateButtonInColumn(2, v14); | |
571 v17 = 2; | |
572 v11 = 0; | |
573 v10 = 1; | |
574 v9 = 3; | |
575 goto LABEL_42; | |
576 } | |
577 if ( a1 <= 26 ) | |
578 goto LABEL_43; | |
579 if ( a1 > 28 ) | |
580 { | |
581 if ( a1 != 30 ) | |
582 goto LABEL_43; | |
583 CreateButtonInColumn(0, 0x11u); | |
584 v16 = 96; | |
585 goto LABEL_37; | |
586 } | |
587 CreateButtonInColumn(0, 0x69u); | |
588 CreateButtonInColumn(1, 0x6Au); | |
589 CreateButtonInColumn(2, 0x6Bu); | |
590 v12 = 108; | |
591 } | |
592 else | |
593 { | |
594 if ( a1 == 22 ) | |
595 { | |
596 CreateButtonInColumn(0, 7u); | |
597 v16 = 8; | |
598 goto LABEL_37; | |
599 } | |
600 v1 = a1 - 14; | |
601 if ( !v1 ) // == 14 | |
602 { | |
603 CreateButtonInColumn(0, 0x12u); | |
604 CreateButtonInColumn(1, 0x30u); | |
605 CreateButtonInColumn(2, 0x31u); | |
606 CreateButtonInColumn(3, 0x32u); | |
607 CreateButtonInColumn(4, 0x33u); | |
608 v17 = 2; | |
609 v11 = 0; | |
610 v10 = 1; | |
611 v9 = 5; | |
612 goto LABEL_42; | |
613 } | |
614 v2 = v1 - 1; | |
615 if ( v2 ) // > 15 | |
616 { | |
617 v3 = v2 - 2; | |
618 if ( v3 ) // > 17 | |
619 { | |
620 if ( v3 != 4 ) // 18, 19, 20 | |
621 goto LABEL_43; | |
622 CreateButtonInColumn(0, 0xFu); // 21 | |
623 CreateButtonInColumn(1, 0x10u); | |
624 v4 = 3; | |
625 CreateButtonInColumn(2, 0x60u); | |
626 v5 = (signed int)window_SpeakInHouse->ptr_1C; | |
627 if ( v5 < 108 || v5 > 120 ) | |
628 goto LABEL_28; | |
629 v4 = 4; | |
630 v6 = 101; | |
631 v7 = 3; | |
632 } | |
633 else // 16, 17 | |
634 { | |
635 v4 = 1; | |
636 CreateButtonInColumn(0, 0x63u); | |
637 if ( !pParty->uFine ) | |
638 { | |
639 LABEL_28: | |
640 v17 = 2; | |
641 v11 = 0; | |
642 v10 = 1; | |
643 v9 = v4; | |
644 LABEL_42: | |
645 pDialogueWindow->_41D08F_set_keyboard_control_group(v9, v10, v11, v17); | |
646 goto LABEL_43; | |
647 } | |
648 v4 = 2; | |
649 v7 = 1; | |
650 v6 = 100; | |
651 } | |
652 CreateButtonInColumn(v7, v6); | |
653 goto LABEL_28; | |
654 } | |
655 CreateButtonInColumn(0, 0x12u); // 15 | |
656 CreateButtonInColumn(1, 0x34u); | |
657 CreateButtonInColumn(2, 0x35u); | |
658 v12 = 54; | |
659 } | |
660 LABEL_39: | |
661 CreateButtonInColumn(3, v12); | |
662 v17 = 2; | |
663 v11 = 0; | |
664 v10 = 1; | |
665 v9 = 4; | |
666 goto LABEL_42; | |
667 } | |
668 if ( a1 == 13 ) | |
669 { | |
670 CreateButtonInColumn(0, 0x12u); | |
671 v16 = 56; | |
672 LABEL_37: | |
673 CreateButtonInColumn(1, v16); | |
674 v17 = 2; | |
675 v11 = 0; | |
676 v10 = 1; | |
677 v9 = 2; | |
678 goto LABEL_42; | |
679 } | |
680 switch ( a1 ) | |
681 { | |
682 case 1: | |
683 case 2: | |
684 case 3: | |
685 case 4: | |
686 CreateButtonInColumn(0, 2u); | |
687 CreateButtonInColumn(1, 0x5Fu); | |
688 CreateButtonInColumn(2, 0x5Eu); | |
689 v12 = 96; | |
690 goto LABEL_39; | |
691 case 5: | |
692 CreateButtonInColumn(0, 0x12u); | |
693 v13 = 48; | |
694 goto LABEL_9; | |
695 case 6: | |
696 CreateButtonInColumn(0, 0x12u); | |
697 v13 = 49; | |
698 goto LABEL_9; | |
699 case 7: | |
700 CreateButtonInColumn(0, 0x12u); | |
701 v13 = 50; | |
702 goto LABEL_9; | |
703 case 8: | |
704 CreateButtonInColumn(0, 0x12u); | |
705 v13 = 51; | |
706 LABEL_9: | |
707 CreateButtonInColumn(1, v13); | |
708 v14 = 72; | |
709 goto LABEL_41; | |
710 case 9: | |
711 CreateButtonInColumn(0, 0x12u); | |
712 v15 = 52; | |
713 goto LABEL_13; | |
714 case 10: | |
715 CreateButtonInColumn(0, 0x12u); | |
716 v15 = 53; | |
717 goto LABEL_13; | |
718 case 11: | |
719 CreateButtonInColumn(0, 0x12u); | |
720 v15 = 54; | |
721 LABEL_13: | |
722 CreateButtonInColumn(1, v15); | |
723 v14 = 61; | |
724 goto LABEL_41; | |
725 case 12: | |
726 CreateButtonInColumn(0, 0x12u); | |
727 v16 = 55; | |
728 goto LABEL_37; | |
729 default: | |
730 break; | |
731 } | |
732 LABEL_43:*/ | |
733 dword_F8B1E0 = pDialogueWindow->pNumPresenceButton; | |
734 } | |
735 // F8B1E0: using guessed type int dword_F8B1E0; | |
736 | |
737 | |
1393 | 738 //----- (004B1784) -------------------------------------------------------- |
1458 | 739 bool HouseUI_CheckIfPlayerCanInteract() |
1393 | 740 { |
1526 | 741 GUIWindow window; // [sp+4h] [bp-54h]@3 |
1393 | 742 |
1526 | 743 if ( pPlayers[uActiveCharacter]->CanAct() ) |
1393 | 744 { |
745 pDialogueWindow->pNumPresenceButton = dword_F8B1E0; | |
1526 | 746 return true; |
1393 | 747 } |
748 else | |
749 { | |
750 pDialogueWindow->pNumPresenceButton = 0; | |
1526 | 751 memcpy(&window, pPrimaryWindow, sizeof(window)); |
752 window.uFrameX = 483; | |
753 window.uFrameWidth = 148; | |
754 window.uFrameZ = 334; | |
755 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[427], pPlayers[uActiveCharacter]->pName, | |
756 pGlobalTXT_LocalizationStrings[562]); // "%s is in no condition to %s""do anything" | |
757 window.DrawTitleText(pFontArrus, 0, (212 - pFontArrus->CalcTextHeight(pTmpBuf.data(), &window, 0, 0)) / 2 + 101, ui_house_player_cant_interact_color, pTmpBuf.data(), 3); | |
758 return false; | |
1393 | 759 } |
760 } | |
761 | |
1298 | 762 //----- (0044622E) -------------------------------------------------------- |
763 bool EnterHouse(enum HOUSE_ID uHouseID) | |
764 { | |
765 signed int uOpenTime; // eax@5 | |
766 signed int uCloseTime; // esi@5 | |
767 unsigned int v5; // esi@5 | |
768 int v6; // edx@5 | |
769 signed int am_pm_flag_open; // ecx@10 | |
770 signed int am_pm_flag_close; // eax@10 | |
771 int v9; // esi@10 | |
772 int v11; // ecx@17 | |
773 unsigned int v12; // kr00_4@25 | |
774 int v14; // eax@25 | |
775 unsigned int v17; // eax@37 | |
776 signed int v18; // edi@37 | |
777 signed int v19; // edi@41 | |
778 char pContainer[40]; // [sp+Ch] [bp-30h]@32 | |
779 unsigned int v24; // [sp+34h] [bp-8h]@5 | |
780 | |
781 GameUI_Footer_TimedString[0] = 0; | |
782 pFooterString[0] = 0; | |
1526 | 783 ShowStatusBarString("", 2); |
1298 | 784 if ( pMessageQueue_50CBD0->uNumMessages ) |
785 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
786 viewparams->bRedrawGameUI = 1; | |
787 uDialogueType = 0; | |
1459 | 788 pKeyActionMap->SetWindowInputStatus(WINDOW_INPUT_CANCELLED); |
1298 | 789 pKeyActionMap->ResetKeys(); |
790 if (uHouseID == HOUSE_600 || uHouseID == HOUSE_601) | |
791 { | |
792 GameOverMenu(0); | |
793 return 0; | |
794 } | |
795 uOpenTime = p2DEvents[uHouseID - 1].uOpenTime; | |
796 uCloseTime = p2DEvents[uHouseID - 1].uCloseTime; | |
797 current_npc_text = 0; | |
798 dword_F8B1E4 = 0; | |
799 memset(byte_F8B1F0.data(), 0, 4); | |
800 memset(player_levels.data(), 0, 16); | |
801 pRenderer->ClearZBuffer(0, 479); | |
802 | |
803 if (((uCloseTime - 1 <= uOpenTime)&&((pParty->uCurrentHour <uOpenTime)&&(pParty->uCurrentHour >(uCloseTime - 1))))|| | |
804 ((uCloseTime - 1 > uOpenTime)&&((pParty->uCurrentHour < uOpenTime)||(pParty->uCurrentHour > (uCloseTime - 1))))) | |
805 | |
806 { | |
807 am_pm_flag_open = 0; | |
808 am_pm_flag_close = 0; | |
809 if (uOpenTime > 12 ) | |
810 { | |
811 uOpenTime -= 12; | |
812 am_pm_flag_open = 1; | |
813 } | |
814 if ( uCloseTime > 12 ) | |
815 { | |
816 uCloseTime -= 12; | |
817 am_pm_flag_close = 1; | |
818 } | |
819 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[414], uOpenTime, aAMPMNames[am_pm_flag_open], | |
820 uCloseTime, aAMPMNames[am_pm_flag_close]); //"This place is open from %d%s to %d%s" | |
821 ShowStatusBarString(pTmpBuf.data(), 2u); | |
822 if ( uActiveCharacter ) | |
823 pPlayers[uActiveCharacter]->PlaySound(SPEECH_3, 0); | |
824 return 0; | |
825 } | |
826 else | |
827 { | |
828 //v10 = uHouseID; | |
829 if ( (signed int)uHouseID < 53 ) //entering shops and guilds | |
830 { | |
1747
cecb080929c4
Party_stru0 renamed to PartyTimeStruct, fixed its members, renamed Party::field_3C to Party::PartyTimes, started Player::SetVariable refactoring start
Grumpy7
parents:
1709
diff
changeset
|
831 if ( !(pParty->PartyTimes._shop_ban_times[uHouseID]) |
cecb080929c4
Party_stru0 renamed to PartyTimeStruct, fixed its members, renamed Party::field_3C to Party::PartyTimes, started Player::SetVariable refactoring start
Grumpy7
parents:
1709
diff
changeset
|
832 || (pParty->PartyTimes._shop_ban_times[uHouseID] <= pParty->uTimePlayed) ) |
1298 | 833 { |
1747
cecb080929c4
Party_stru0 renamed to PartyTimeStruct, fixed its members, renamed Party::field_3C to Party::PartyTimes, started Player::SetVariable refactoring start
Grumpy7
parents:
1709
diff
changeset
|
834 pParty->PartyTimes._shop_ban_times[uHouseID] = 0; |
1298 | 835 } |
836 else | |
837 { | |
838 ShowStatusBarString(pGlobalTXT_LocalizationStrings[191], 2u);// "You've been banned from this shop!" | |
839 return 0; | |
840 } | |
841 } | |
842 pAudioPlayer->StopChannels(-1, -1); | |
843 | |
844 uCurrentHouse_Animation = p2DEvents[uHouseID - 1].uAnimationID; | |
1411 | 845 in_current_building_type = (BuildingType)pAnimatedRooms[uCurrentHouse_Animation].uBuildingType; |
846 if ( in_current_building_type == BuildingType_Throne_Room && pParty->uFine ) // going 2 jail | |
1298 | 847 { |
848 uCurrentHouse_Animation = (signed __int16)p2DEvents[186].uAnimationID; | |
849 uHouseID = HOUSE_JAIL; | |
850 pParty->uTimePlayed = pParty->uTimePlayed + 0x7620000; | |
1411 | 851 in_current_building_type = (BuildingType)pAnimatedRooms[p2DEvents[HOUSE_LORD_AND_JUDGE_EMERALD_ISLE].uAnimationID].uBuildingType; |
1298 | 852 ++pParty->uNumPrisonTerms; |
853 pParty->uFine = 0; | |
854 for (uint i = 0; i < 4; ++i) | |
855 { | |
856 pParty->pPlayers[i].uTimeToRecovery = 0; | |
857 pParty->pPlayers[i].uNumDivineInterventionCastsThisDay = 0; | |
858 pParty->pPlayers[i].SetVariable(VAR_Award, 87); | |
859 } | |
860 } | |
861 ++pIcons_LOD->uTexturePacksCount; | |
862 if ( !pIcons_LOD->uNumPrevLoadedFiles ) | |
863 pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; | |
864 switch (pParty->alignment) | |
1545 | 865 { |
1298 | 866 case PartyAlignment_Good: sprintf(pContainer, "evt%02d-b", const_2()); break; |
867 case PartyAlignment_Neutral: sprintf(pContainer, "evt%02d", const_2()); break; | |
868 case PartyAlignment_Evil: sprintf(pContainer, "evt%02d-c", const_2()); break; | |
1545 | 869 default: Error("Invalid alignment type: %u", pParty->alignment); |
870 } | |
1298 | 871 |
872 v17 = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); | |
873 pDialogueNPCCount = 0; | |
874 pTexture_Dialogue_Background = &pIcons_LOD->pTextures[v17]; | |
875 uTextureID_right_panel_loop = uTextureID_right_panel; | |
876 PrepareHouse(uHouseID); | |
877 v18 = 1; | |
878 uTextureID_right_panel_loop = uTextureID_right_panel; | |
879 if ( uNumDialogueNPCPortraits == 1 ) | |
880 pDialogueNPCCount = 1; | |
881 pVideoPlayer->OpenHouseMovie(pAnimatedRooms[uCurrentHouse_Animation].video_name, 1u); | |
882 dword_5C35D4 = 1; | |
883 if ( (signed int)uHouseID < 139 || (signed int)uHouseID > 172 ) | |
884 { | |
885 if ( (signed int)uHouseID >= HOUSE_STABLES_HARMONDALE && (signed int)uHouseID <= 73 && !IsTravelAvailable(uHouseID - HOUSE_STABLES_HARMONDALE) ) | |
886 { | |
887 return 1; | |
888 } | |
889 } | |
890 else | |
891 { //guilds | |
892 v19 = guild_mambership_flags[uHouseID - HOUSE_FIRE_GUILD_INITIATE_EMERALD_ISLE]; //guilds flags | |
893 //v20 = uHouseID; | |
894 //if ( !((unsigned __int8)(0x80u >> v19 % 8) & pPlayers[uActiveCharacter]->_guilds_member_bits[v19 /8]) ) | |
2234 | 895 if(!_449B57_test_bit(pPlayers[uActiveCharacter]->_achieved_awards_bits,v19)) |
1298 | 896 { |
897 PlayHouseSound(uHouseID, HouseSound_Greeting_2); | |
898 return 1; | |
899 } | |
900 } | |
901 PlayHouseSound(uHouseID, HouseSound_Greeting); | |
902 dword_5C35D4 = 1; | |
903 return 1; | |
904 } | |
905 } | |
906 | |
1300 | 907 //----- (0044606A) -------------------------------------------------------- |
908 void PrepareHouse(HOUSE_ID house) | |
909 { | |
910 __int16 uExitMapID; // ax@2 | |
911 int v7; // ebx@11 | |
912 int v13; // [sp+30h] [bp-30h]@11 | |
913 int npc_id_arr[6]; // [sp+34h] [bp-2Ch]@1 | |
914 int uAnimationID; // [sp+50h] [bp-10h]@1 | |
915 | |
916 | |
917 uAnimationID = p2DEvents[house - 1].uAnimationID; | |
918 memset(npc_id_arr, 0, sizeof(npc_id_arr)); | |
919 uNumDialogueNPCPortraits = 0; | |
920 uHouse_ExitPic = p2DEvents[house - 1].uExitPicID; | |
921 if ( uHouse_ExitPic ) | |
922 { | |
923 uExitMapID = p2DEvents[house - 1]._quest_related; | |
924 if ( uExitMapID > 0 ) | |
925 { | |
926 if(_449B57_test_bit(pParty->_quest_bits,uExitMapID)) | |
927 { | |
928 uHouse_ExitPic = 0; | |
929 } | |
930 } | |
931 } | |
932 | |
933 dword_591080 = pAnimatedRooms[uAnimationID].house_npc_id; | |
934 HouseNPCData[0]=0; | |
935 uNumDialogueNPCPortraits = 0; | |
936 if ( dword_591080 ) | |
937 { | |
938 | |
939 npc_id_arr[0] = dword_591080; | |
940 uNumDialogueNPCPortraits = 1; | |
941 } | |
942 | |
943 for (uint i = 1; i < pNPCStats->uNumNewNPCs; ++i) | |
944 { | |
945 if (pNPCStats->pNewNPCData[i].Location2D == house ) | |
946 { | |
947 if (!(pNPCStats->pNewNPCData[i].uFlags & 0x80)) | |
948 { | |
1313 | 949 HouseNPCData[uNumDialogueNPCPortraits+1-((dword_591080 != 0) ? 1 : 0) ] = &pNPCStats->pNewNPCData[i]; |
1300 | 950 npc_id_arr[uNumDialogueNPCPortraits] = pNPCStats->pNewNPCData[i].uPortraitID; |
951 ++uNumDialogueNPCPortraits; | |
952 if ((pNPCStats->pNewNPCData[i].uFlags & 3) != 2) | |
953 ++pNPCStats->pNewNPCData[i].uFlags; | |
954 } | |
955 } | |
956 | |
957 } | |
958 | |
959 for (uint i = 0; i < uNumDialogueNPCPortraits; ++i) | |
960 { | |
961 | |
962 char icon_name[128]; | |
963 sprintfex(icon_name, "npc%03u", npc_id_arr[i]); | |
964 pDialogueNPCPortraits[i] = pIcons_LOD->LoadTexturePtr(icon_name, TEXTURE_16BIT_PALETTE); | |
965 } | |
966 | |
967 if (uHouse_ExitPic) | |
968 { | |
969 pDialogueNPCPortraits[uNumDialogueNPCPortraits] = pIcons_LOD->LoadTexturePtr(pHouse_ExitPictures[uHouse_ExitPic], TEXTURE_16BIT_PALETTE); | |
970 ++uNumDialogueNPCPortraits; | |
971 uHouse_ExitPic = p2DEvents[house - 1].uExitMapID; | |
972 } | |
973 } | |
1298 | 974 //----- (004B1E92) -------------------------------------------------------- |
975 void PlayHouseSound(unsigned int uHouseID, HouseSoundID sound) | |
976 { | |
1407 | 977 if ( pAnimatedRooms[p2DEvents[uHouseID].uAnimationID].uRoomSoundId ) |
978 pAudioPlayer->PlaySound((SoundID)(sound + 100 * (pAnimatedRooms[p2DEvents[uHouseID].uAnimationID].uRoomSoundId + 300)), | |
1298 | 979 806, 0, -1, 0, 0, 0, 0); |
980 } | |
981 | |
982 //----- (004BCACC) -------------------------------------------------------- | |
983 void __fastcall OnSelectShopDialogueOption(signed int uMessageParam) | |
984 { | |
1526 | 985 int experience_for_next_level; // eax@5 |
1298 | 986 int v16; // eax@32 |
987 __int16 v24; // ax@163 | |
988 signed int v36; // esi@227 | |
1739 | 989 int pPrice; // ecx@227 |
1298 | 990 |
991 if ( !pDialogueWindow->pNumPresenceButton ) | |
992 return; | |
993 pRenderer->ClearZBuffer(0, 479); | |
994 if (dialog_menu_id == HOUSE_DIALOGUE_MAIN) | |
995 { | |
1529 | 996 if ( in_current_building_type == BuildingType_Training ) |
997 { | |
998 if ( uMessageParam == HOUSE_DIALOGUE_TRAININGHALL_TRAIN ) | |
999 { | |
1000 experience_for_next_level = 0; | |
1001 if ( pPlayers[uActiveCharacter]->uLevel > 0 ) | |
1002 { | |
1003 for( uint i = 0; i < pPlayers[uActiveCharacter]->uLevel; i++ ) | |
1004 experience_for_next_level += i + 1; | |
1005 } | |
1006 if (pPlayers[uActiveCharacter]->uLevel < pMaxLevelPerTrainingHallType[(unsigned int)window_SpeakInHouse->ptr_1C - 89] && | |
1007 (signed __int64)pPlayers[uActiveCharacter]->uExperience < 1000 * experience_for_next_level)//test experience | |
1008 return; | |
1009 } | |
1010 pDialogueWindow->Release(); | |
2215
e9625ad08541
fog fix and change 640,480 - window->GetWidth(), window->GetHeight()
Ritor1
parents:
2214
diff
changeset
|
1011 pDialogueWindow = GUIWindow::Create(0, 0, window->GetWidth(), 345, WINDOW_MainMenu, 0, 0); |
1529 | 1012 pBtn_ExitCancel = pDialogueWindow->CreateButton(526, 445, 75, 33, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[74],// "End Conversation" |
1013 pIcons_LOD->GetTexture(uTextureID_BUTTDESC2), 0); | |
1014 pDialogueWindow->CreateButton(8, 8, 450, 320, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", nullptr); | |
1015 } | |
1016 if ( in_current_building_type != BuildingType_Training ) | |
1017 { | |
1018 if ((in_current_building_type == BuildingType_Stables || in_current_building_type == BuildingType_Boats) && | |
1019 transport_schedule[transport_routes[(unsigned int)window_SpeakInHouse->ptr_1C - HOUSE_STABLES_HARMONDALE][uMessageParam - HOUSE_DIALOGUE_TRANSPORT_SCHEDULE_1]].pSchedule[pParty->uDaysPlayed % 7] | |
1020 || in_current_building_type != BuildingType_Temple || uMessageParam != BuildingType_MindGuild ) | |
1021 { | |
1022 pDialogueWindow->Release(); | |
2215
e9625ad08541
fog fix and change 640,480 - window->GetWidth(), window->GetHeight()
Ritor1
parents:
2214
diff
changeset
|
1023 pDialogueWindow = GUIWindow::Create(0, 0, window->GetWidth(), 345, WINDOW_MainMenu, 0, 0); |
1529 | 1024 pBtn_ExitCancel = pDialogueWindow->CreateButton(526, 445, 75, 33, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[74],// "End Conversation" |
1025 pIcons_LOD->GetTexture(uTextureID_BUTTDESC2), 0); | |
1026 pDialogueWindow->CreateButton(8, 8, 450, 320, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", nullptr); | |
1027 } | |
1028 else if (uActiveCharacter) | |
1029 { | |
1030 if ( !pPlayers[uActiveCharacter]->IsPlayerHealableByTemple() ) | |
1031 return; | |
1032 } | |
1033 } | |
1034 dialog_menu_id = (HOUSE_DIALOGUE_MENU)uMessageParam; | |
1035 if ( in_current_building_type < BuildingType_19 ) | |
1036 ShopTexture = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(off_4F03B8[(int)in_current_building_type], TEXTURE_16BIT_PALETTE)]; | |
1298 | 1037 } |
1038 | |
1039 //NEW | |
1411 | 1040 switch (in_current_building_type) |
1298 | 1041 { |
1411 | 1042 case BuildingType_FireGuild: |
1043 case BuildingType_AirGuild: | |
1044 case BuildingType_WaterGuild: | |
1045 case BuildingType_EarthGuild: | |
1046 case BuildingType_SpiritGuild: | |
1047 case BuildingType_MindGuild: | |
1048 case BuildingType_BodyGuild: | |
1049 case BuildingType_LightGuild: | |
1050 case BuildingType_DarkGuild: | |
1644 | 1051 case BuildingType_ElementalGuild: |
1052 case BuildingType_SelfGuild: | |
1411 | 1053 case BuildingType_16: |
1298 | 1054 { |
1920 | 1055 if ( pParty->PartyTimes.Shops_next_generation_time[window_SpeakInHouse->par1C - 139] >= (signed __int64)pParty->uTimePlayed ) |
1298 | 1056 { |
1526 | 1057 for ( uint i = 0; i < 12; ++i ) |
1298 | 1058 { |
1739 | 1059 if ( pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C - 139][i].uItemID ) |
1060 ItemsInShopTexture[i] = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C - 139][i].GetIconName(), TEXTURE_16BIT_PALETTE)]; | |
1298 | 1061 } |
1062 } | |
1529 | 1063 else//generation new books |
1298 | 1064 { |
1065 SpellBookGenerator(); | |
1920 | 1066 pParty->PartyTimes.Shops_next_generation_time[window_SpeakInHouse->par1C - 139] = pParty->uTimePlayed + (signed __int64)((double)(0xA8C000 |
1298 | 1067 * (signed int)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].field_1C) * 0.033333335); |
1068 } | |
1069 break; | |
1070 } | |
1411 | 1071 case BuildingType_TownHall: |
1298 | 1072 { |
1529 | 1073 if ( uMessageParam == HOUSE_DIALOGUE_TOWNHALL_MESSAGE ) |
1298 | 1074 { |
1748 | 1075 if ( pParty->PartyTimes.bountyHunting_next_generation_time[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] < (signed __int64)pParty->uTimePlayed )//new generation |
1298 | 1076 { |
1739 | 1077 pParty->monster_for_hunting_killed[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] = false; |
1748 | 1078 pParty->PartyTimes.bountyHunting_next_generation_time[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] = (signed __int64)((double)(309657600 * (pParty->uCurrentMonth + 12i64 * pParty->uCurrentYear - 14015)) * 0.033333335); |
1739 | 1079 pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] = rand() % 258 + 1; |
1529 | 1080 v16 = (int)((char *)window_SpeakInHouse->ptr_1C - 102); |
1081 if ( !v16 ) | |
1082 { | |
1083 while ( 1 ) | |
1084 { | |
1739 | 1085 v24 = pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)]; |
1529 | 1086 if ( (unsigned __int16)v24 < 115 || (unsigned __int16)v24 > 132 ) |
1087 { | |
1088 if ( ((unsigned __int16)v24 < 235 || (unsigned __int16)v24 > 252) | |
1089 && ((unsigned __int16)v24 < 133 || (unsigned __int16)v24 > 150) | |
1090 && ((unsigned __int16)v24 < 0x97u || (unsigned __int16)v24 > 0xBAu) | |
1091 && ((unsigned __int16)v24 < 0xBEu || (unsigned __int16)v24 > 0xC0u) | |
1092 && ((unsigned __int16)v24 < 0xC4u || (unsigned __int16)v24 > 0xC6u) | |
1093 && ((unsigned __int16)v24 < 0x2Bu || (unsigned __int16)v24 > 0x2Du) | |
1094 && ((unsigned __int16)v24 < 0xCDu || (unsigned __int16)v24 > 0xCFu) | |
1095 && ((unsigned __int16)v24 < 0x5Eu || (unsigned __int16)v24 > 0x60u) | |
1096 && ((unsigned __int16)v24 < 0xFDu || (unsigned __int16)v24 > 0xFFu) | |
1097 && ((unsigned __int16)v24 < 0x6Du || (unsigned __int16)v24 > 0x6Fu) | |
1098 && ((unsigned __int16)v24 < 0x61u || (unsigned __int16)v24 > 0x63u) ) | |
1099 break; | |
1100 } | |
1739 | 1101 pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] = rand() % 258 + 1; |
1529 | 1102 } |
1103 } | |
1104 if ( v16 == 1 ) | |
1105 { | |
1106 while ( 1 ) | |
1107 { | |
1739 | 1108 v24 = pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)]; |
1109 if ( (unsigned __int16)v24 < 115 || (unsigned __int16)v24 > 132 ) | |
1529 | 1110 { |
1739 | 1111 if ( ((unsigned __int16)v24 < 0xE8u || (unsigned __int16)v24 > 0xF9u) |
1112 && ((unsigned __int16)v24 < 0x85u || (unsigned __int16)v24 > 0x96u) | |
1113 && ((unsigned __int16)v24 < 0x97u || (unsigned __int16)v24 > 0xBAu) | |
1114 && ((unsigned __int16)v24 < 0xBEu || (unsigned __int16)v24 > 0xC0u) | |
1115 && ((unsigned __int16)v24 < 0xC4u || (unsigned __int16)v24 > 0xC6u) | |
1116 && ((unsigned __int16)v24 < 0x2Bu || (unsigned __int16)v24 > 0x2Du) | |
1117 && ((unsigned __int16)v24 < 0x52u || (unsigned __int16)v24 > 0x54u) | |
1118 && ((unsigned __int16)v24 < 4 || (unsigned __int16)v24 > 6) | |
1119 && ((unsigned __int16)v24 < 0x37u || (unsigned __int16)v24 > 0x39u) | |
1120 && ((unsigned __int16)v24 < 0x3Au || (unsigned __int16)v24 > 0x3Cu) | |
1121 && ((unsigned __int16)v24 < 0x3Du || (unsigned __int16)v24 > 0x3Fu) | |
1122 && ((unsigned __int16)v24 < 0xFDu || (unsigned __int16)v24 > 0xFFu) | |
1123 && ((unsigned __int16)v24 < 0x61u || (unsigned __int16)v24 > 0x63u) | |
1124 && ((unsigned __int16)v24 < 0xCDu || (unsigned __int16)v24 > 0xCFu) ) | |
1529 | 1125 break; |
1126 } | |
1739 | 1127 pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] = rand() % 258 + 1; |
1529 | 1128 } |
1129 } | |
1130 if ( v16 == 2 ) | |
1131 { | |
1132 while ( 1 ) | |
1133 { | |
1739 | 1134 v24 = pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)]; |
1135 if ( (unsigned __int16)v24 < 0x73u || (unsigned __int16)v24 > 0x84u ) | |
1529 | 1136 { |
1739 | 1137 if ( ((unsigned __int16)v24 < 0xE8u || (unsigned __int16)v24 > 0xF9u) |
1138 && ((unsigned __int16)v24 < 0x85u || (unsigned __int16)v24 > 0x96u) | |
1139 && ((unsigned __int16)v24 < 0x97u || (unsigned __int16)v24 > 0xBAu) | |
1140 && ((unsigned __int16)v24 < 0xBEu || (unsigned __int16)v24 > 0xC0u) | |
1141 && ((unsigned __int16)v24 < 0xC4u || (unsigned __int16)v24 > 0xC6u) | |
1142 && ((unsigned __int16)v24 < 0x2Bu || (unsigned __int16)v24 > 0x2Du) | |
1143 && ((unsigned __int16)v24 < 0x31u || (unsigned __int16)v24 > 0x33u) | |
1144 && ((unsigned __int16)v24 < 0x34u || (unsigned __int16)v24 > 0x36u) | |
1145 && ((unsigned __int16)v24 < 0xFDu || (unsigned __int16)v24 > 0xFFu) | |
1146 && ((unsigned __int16)v24 < 0x61u || (unsigned __int16)v24 > 0x63u) | |
1147 && ((unsigned __int16)v24 < 0x1Cu || (unsigned __int16)v24 > 0x1Eu) ) | |
1529 | 1148 break; |
1149 } | |
1739 | 1150 pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] = rand() % 258 + 1; |
1529 | 1151 } |
1152 } | |
1153 if ( v16 == 3 ) | |
1154 { | |
1155 while ( 1 ) | |
1156 { | |
1739 | 1157 v24 = pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)]; |
1158 if ( (unsigned __int16)v24 < 0x73u || (unsigned __int16)v24 > 0x84u ) | |
1529 | 1159 { |
1739 | 1160 if ( ((unsigned __int16)v24 < 0xE8u || (unsigned __int16)v24 > 0xF9u) |
1161 && ((unsigned __int16)v24 < 0x85u || (unsigned __int16)v24 > 0x96u) | |
1162 && ((unsigned __int16)v24 < 0x97u || (unsigned __int16)v24 > 0xBAu) | |
1163 && ((unsigned __int16)v24 < 0xBEu || (unsigned __int16)v24 > 0xC0u) | |
1164 && ((unsigned __int16)v24 < 0xC4u || (unsigned __int16)v24 > 0xC6u) | |
1165 && ((unsigned __int16)v24 < 0x2Bu || (unsigned __int16)v24 > 0x2Du) | |
1166 && ((unsigned __int16)v24 < 0x5Eu || (unsigned __int16)v24 > 0x60u) | |
1167 && ((unsigned __int16)v24 < 0x43u || (unsigned __int16)v24 > 0x45u) | |
1168 && ((unsigned __int16)v24 < 0x4Fu || (unsigned __int16)v24 > 0x51u) | |
1169 && ((unsigned __int16)v24 < 0xC1u || (unsigned __int16)v24 > 0xC3u) | |
1170 && ((unsigned __int16)v24 < 0x13u || (unsigned __int16)v24 > 0x15u) | |
1171 && ((unsigned __int16)v24 < 0xFDu || (unsigned __int16)v24 > 0xFFu) | |
1172 && ((unsigned __int16)v24 < 0x61u || (unsigned __int16)v24 > 0x63u) | |
1173 && ((unsigned __int16)v24 < 0x6Au || (unsigned __int16)v24 > 0x6Cu) ) | |
1529 | 1174 break; |
1175 } | |
1739 | 1176 pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] = rand() % 258 + 1; |
1529 | 1177 } |
1178 } | |
1179 if ( v16 == 4 ) | |
1180 { | |
1181 while ( 1 ) | |
1182 { | |
1739 | 1183 v24 = pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)]; |
1184 if ( (unsigned __int16)v24 < 0x73u || (unsigned __int16)v24 > 0x84u ) | |
1529 | 1185 { |
1739 | 1186 if ( ((unsigned __int16)v24 < 0xE8u || (unsigned __int16)v24 > 0xF9u) |
1187 && ((unsigned __int16)v24 < 0x85u || (unsigned __int16)v24 > 0x96u) | |
1188 && ((unsigned __int16)v24 < 0x97u || (unsigned __int16)v24 > 0xBAu) | |
1189 && ((unsigned __int16)v24 < 0xBEu || (unsigned __int16)v24 > 0xC0u) | |
1190 && ((unsigned __int16)v24 < 0xC4u || (unsigned __int16)v24 > 0xC6u) | |
1191 && ((unsigned __int16)v24 < 0x2Bu || (unsigned __int16)v24 > 0x2Du) | |
1192 && ((unsigned __int16)v24 < 0x6Du || (unsigned __int16)v24 > 0x6Fu) | |
1193 && ((unsigned __int16)v24 < 0x46u || (unsigned __int16)v24 > 0x48u) | |
1194 && ((unsigned __int16)v24 < 0x100u || (unsigned __int16)v24 > 0x102u) | |
1195 && ((unsigned __int16)v24 < 0xD9u || (unsigned __int16)v24 > 0xDBu) | |
1196 && ((unsigned __int16)v24 < 0xC7u || (unsigned __int16)v24 > 0xC9u) | |
1197 && ((unsigned __int16)v24 < 0xE5u || (unsigned __int16)v24 > 0xE7u) | |
1198 && ((unsigned __int16)v24 < 0xDFu || (unsigned __int16)v24 > 0xE1u) | |
1199 && ((unsigned __int16)v24 < 0x5Bu || (unsigned __int16)v24 > 0x5Du) | |
1200 && ((unsigned __int16)v24 < 0x49u || (unsigned __int16)v24 > 0x4Bu) | |
1201 && ((unsigned __int16)v24 < 0xFDu || (unsigned __int16)v24 > 0xFFu) | |
1202 && ((unsigned __int16)v24 < 0x61u || (unsigned __int16)v24 > 0x63u) | |
1203 && ((unsigned __int16)v24 < 0x10u || (unsigned __int16)v24 > 0x12u) ) | |
1529 | 1204 break; |
1205 } | |
1739 | 1206 pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] = rand() % 258 + 1; |
1529 | 1207 } |
1208 } | |
1209 } | |
1739 | 1210 bountyHunting_monster_id_for_hunting = pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)]; |
1211 if ( !pParty->monster_for_hunting_killed[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] ) | |
1529 | 1212 { |
1213 bountyHunting_text = pNPCTopics[351].pText;//"В этом месяцу назначена награда за голову %s..." | |
1739 | 1214 if ( !pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] ) |
1529 | 1215 bountyHunting_text = pNPCTopics[353].pText;//"Кое кто уже приходил в этом месяце за наградой" |
1298 | 1216 } |
1217 else | |
1218 { | |
1739 | 1219 if ( pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] > 0 )//get prize |
1298 | 1220 { |
1828
35c1e4ff6ba7
party_finds_gold to Party::PartyFindsGold, cleaned up, moved Level/Decoration.h reference out of Indoor.h
Grumpy7
parents:
1754
diff
changeset
|
1221 pParty->PartyFindsGold(100 * pMonsterStats->pInfos[(unsigned __int16)pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)]].uLevel, 0); |
1529 | 1222 for ( uint i = 0; i < 4; ++i ) |
1223 pParty->pPlayers[i].SetVariable(VAR_Award, 86); | |
1739 | 1224 pParty->uNumBountiesCollected += 100 * pMonsterStats->pInfos[pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)]].uLevel; |
1225 pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] = 0; | |
1226 pParty->monster_for_hunting_killed[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] = false; | |
1529 | 1227 } |
1228 bountyHunting_text = pNPCTopics[352].pText;//"Поздравляю! Вы успешно..." | |
1229 } | |
1230 } | |
1231 else if ( uMessageParam == HOUSE_DIALOGUE_TOWNHALL_PAY_FINE ) | |
1739 | 1232 pKeyActionMap->EnterText(1, 10, window_SpeakInHouse); |
1529 | 1233 break; |
1234 } | |
1411 | 1235 case BuildingType_Bank: |
1298 | 1236 { |
1237 if ( dialog_menu_id >= 7 && dialog_menu_id <= 8 ) | |
1739 | 1238 pKeyActionMap->EnterText(1, 10, window_SpeakInHouse); |
1298 | 1239 return; |
1240 break; | |
1241 } | |
1411 | 1242 case BuildingType_WeaponShop: |
1243 case BuildingType_ArmorShop: | |
1244 case BuildingType_MagicShop: | |
1245 case BuildingType_AlchemistShop: | |
1246 case BuildingType_Tavern: | |
1247 case BuildingType_Temple: | |
1248 case BuildingType_Training: | |
1298 | 1249 { |
1250 break; | |
1251 } | |
1252 default: | |
1253 { | |
1254 return; | |
1255 break; | |
1256 } | |
1257 } | |
1258 | |
1259 switch ( uMessageParam ) | |
1260 { | |
1261 case HOUSE_DIALOGUE_LEARN_SKILLS: | |
1262 { | |
1263 pDialogueWindow->eWindowType = WINDOW_MainMenu; | |
1264 UI_CreateEndConversationButton(); | |
1265 FillAviableSkillsToTeach(in_current_building_type); | |
1266 break; | |
1267 } | |
1268 case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_MAIN: | |
1269 { | |
1270 pDialogueWindow->eWindowType = WINDOW_MainMenu; | |
1271 UI_CreateEndConversationButton(); | |
1411 | 1272 InitializaDialogueOptions_Tavern(in_current_building_type); |
1298 | 1273 break; |
1274 } | |
1275 case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_RULES: | |
1276 case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_VICTORY_CONDITIONS: | |
1277 { | |
1278 dialog_menu_id = (HOUSE_DIALOGUE_MENU)uMessageParam; | |
1279 break; | |
1280 } | |
1281 case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_RESULT: | |
1282 { | |
1283 pMessageQueue_50CBD0->AddMessage(UIMSG_PlayArcomage, 0, 0); | |
1284 dialog_menu_id = HOUSE_DIALOGUE_TAVERN_ARCOMAGE_RESULT; | |
1285 break; | |
1286 } | |
1287 case HOUSE_DIALOGUE_SHOP_BUY_STANDARD: | |
1288 case HOUSE_DIALOGUE_SHOP_BUY_SPECIAL: | |
1289 { | |
1748 | 1290 if ( pParty->PartyTimes.Shops_next_generation_time[(unsigned int)window_SpeakInHouse->ptr_1C] < (signed __int64)pParty->uTimePlayed ) |
1298 | 1291 { |
1292 GenerateStandartShopItems(); | |
1293 GenerateSpecialShopItems(); | |
1747
cecb080929c4
Party_stru0 renamed to PartyTimeStruct, fixed its members, renamed Party::field_3C to Party::PartyTimes, started Player::SetVariable refactoring start
Grumpy7
parents:
1709
diff
changeset
|
1294 pParty->PartyTimes.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 | 1295 } |
1296 if ( uMessageParam == HOUSE_DIALOGUE_SHOP_BUY_STANDARD ) | |
1297 { | |
1298 if ( uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType] ) | |
1299 { | |
1739 | 1300 for ( uint i = 0; i < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType]; ++i ) |
1298 | 1301 { |
1739 | 1302 if ( pParty->StandartItemsInShops[(int)window_SpeakInHouse->ptr_1C][i].uItemID ) |
1303 ItemsInShopTexture[i] = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(pParty->StandartItemsInShops[(int)window_SpeakInHouse->ptr_1C][i].GetIconName(), TEXTURE_16BIT_PALETTE)]; | |
1298 | 1304 } |
1305 } | |
1411 | 1306 if ( in_current_building_type == BuildingType_WeaponShop ) |
1298 | 1307 { |
1308 if ( uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType] ) | |
1309 { | |
1739 | 1310 for ( uint i = 0; i < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType]; ++i ) |
1298 | 1311 { |
1739 | 1312 if ( pParty->StandartItemsInShops[(int)window_SpeakInHouse->ptr_1C][i].uItemID) |
1313 weapons_Ypos[i] = rand() % (300 - ItemsInShopTexture[i]->uTextureHeight); | |
1298 | 1314 } |
1315 } | |
1316 } | |
1739 | 1317 } |
1318 if ( uMessageParam == HOUSE_DIALOGUE_SHOP_BUY_SPECIAL ) | |
1319 { | |
1320 if ( uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType] ) | |
1321 { | |
1322 for ( uint i = 0; i < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType]; ++i ) | |
1323 { | |
1324 if ( pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].uItemID ) | |
1325 ItemsInShopTexture[i] = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].GetIconName(), TEXTURE_16BIT_PALETTE)]; | |
1326 } | |
1327 } | |
1328 if ( in_current_building_type == BuildingType_WeaponShop ) | |
1298 | 1329 { |
1330 if ( uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType] ) | |
1331 { | |
1739 | 1332 for ( uint i = 0; i < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType]; ++i ) |
1298 | 1333 { |
1739 | 1334 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].uItemID) |
1335 weapons_Ypos[i] = rand() % (300 - ItemsInShopTexture[i]->uTextureHeight); | |
1298 | 1336 } |
1337 } | |
1338 } | |
1739 | 1339 } |
1340 break; | |
1298 | 1341 } |
1342 case HOUSE_DIALOGUE_SHOP_SELL: | |
1343 case HOUSE_DIALOGUE_SHOP_IDENTIFY: | |
1344 case HOUSE_DIALOGUE_SHOP_REPAIR: | |
1345 { | |
1346 dialog_menu_id = (HOUSE_DIALOGUE_MENU)uMessageParam; | |
1829
e4e27261d84e
sub_421B2C_PlaceInInventory_or_DropPickedItem to Party::sub_421B2C_PlaceInInventory_or_DropPickedItem
Grumpy7
parents:
1828
diff
changeset
|
1347 pParty->sub_421B2C_PlaceInInventory_or_DropPickedItem(); |
1298 | 1348 break; |
1349 } | |
1350 case HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT: | |
1351 { | |
1352 pDialogueWindow->eWindowType = WINDOW_MainMenu; | |
1353 UI_CreateEndConversationButton(); | |
1411 | 1354 InitializaDialogueOptions_Shops(in_current_building_type); |
1298 | 1355 break; |
1356 } | |
1357 default: | |
1358 { | |
1359 if( uMessageParam >= HOUSE_DIALOGUE_36 && uMessageParam <= HOUSE_DIALOGUE_GUILD_LEARN_SKILL ) | |
1360 { | |
1739 | 1361 v36 = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0); |
1362 pPrice = v36 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; | |
1363 if ( pPrice < v36 / 3 ) | |
1364 pPrice = v36 / 3; | |
1365 if(byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][uMessageParam - 36]) | |
1298 | 1366 { |
1367 if ( !pPlayers[uActiveCharacter]->pActiveSkills[uMessageParam - 36] ) | |
1368 { | |
1739 | 1369 if ( pParty->uNumGold < pPrice ) |
1298 | 1370 { |
1371 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2); | |
1411 | 1372 if ( in_current_building_type == BuildingType_Training || in_current_building_type == BuildingType_Tavern ) |
1739 | 1373 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_Goodbye); |
1298 | 1374 else |
1739 | 1375 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful); |
1298 | 1376 } |
1377 else | |
1378 { | |
1739 | 1379 Party::TakeGold(pPrice); |
1298 | 1380 dword_F8B1E4 = 1; |
1381 pPlayers[uActiveCharacter]->pActiveSkills[uMessageParam - 36] = 1; | |
1382 pPlayers[uActiveCharacter]->PlaySound(SPEECH_78, 0); | |
1383 } | |
1384 } | |
1385 } | |
1386 } | |
1387 break; | |
1388 } | |
1389 } | |
1390 } | |
1391 //----- (004B6943) -------------------------------------------------------- | |
1458 | 1392 void TravelByTransport() |
1298 | 1393 { |
1394 signed int v4; // ebx@1 | |
1589 | 1395 stru365_travel_info *pTravel; // esi@7 |
1298 | 1396 signed int v12; // esi@13 |
1397 signed int v13; // edi@14 | |
1398 DWORD v14; // eax@26 | |
1399 DWORD v15; // edi@26 | |
1589 | 1400 int pTextHeight; // eax@36 |
1401 int pRealTextHeight; // esi@36 | |
1402 int schedule_id; // esi@39 | |
1403 GUIButton *pButton; // ebx@39 | |
1298 | 1404 signed int v25; // eax@41 |
1589 | 1405 MapInfo pMap; // [sp-3Ch] [bp-2CCh]@62 |
1406 char pTopicArray[5][100]; // [sp+14h] [bp-27Ch]@37 | |
1407 GUIWindow travel_window; // [sp+208h] [bp-88h]@1 | |
1408 int pPrimaryTextHeight; // [sp+260h] [bp-30h]@36 | |
1409 int index; // [sp+27Ch] [bp-14h]@36 | |
1410 unsigned int pPrice; // [sp+288h] [bp-8h]@1 | |
1411 int travel_time; // [sp+28Ch] [bp-4h]@48 | |
1412 enum PlayerSpeech pSpeech; | |
1413 unsigned int pCurrentButton; | |
1298 | 1414 |
1589 | 1415 memcpy(&travel_window, window_SpeakInHouse, sizeof(travel_window)); |
1416 travel_window.uFrameX = 483; | |
1417 travel_window.uFrameWidth = 148; | |
1418 travel_window.uFrameZ = 334; | |
1298 | 1419 |
1587 | 1420 v4 = p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType == BuildingType_Stables ? 25 : 50; |
1421 v4 *= p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier; | |
1298 | 1422 |
1589 | 1423 pPrice = v4 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; |
1424 if ( (signed int)pPrice < v4 / 3 ) | |
1425 pPrice = v4 / 3; | |
1298 | 1426 if ( dialog_menu_id == HOUSE_DIALOGUE_MAIN) |
1427 { | |
1393 | 1428 if ( HouseUI_CheckIfPlayerCanInteract() ) |
1298 | 1429 { |
1589 | 1430 index = 0; |
1431 strcpy(pTopicArray[4], ""); | |
1432 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[405], pPrice); // Price: %lu gold | |
1433 pTextHeight = pFontArrus->CalcTextHeight(pTmpBuf2.data(), &travel_window, 0, 0); | |
1434 pRealTextHeight = pTextHeight + (LOBYTE(pFontArrus->uFontHeight) - 3) + 146; | |
1435 pPrimaryTextHeight = pRealTextHeight; | |
1436 pCurrentButton = 2; | |
1437 for ( uint i = pDialogueWindow->pStartingPosActiveItem; i < (unsigned int)(pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem); ++i ) | |
1298 | 1438 { |
1589 | 1439 schedule_id = transport_routes[(unsigned int)window_SpeakInHouse->ptr_1C - HOUSE_STABLES_HARMONDALE][index]; |
1440 pButton = pDialogueWindow->GetControl(i); | |
1298 | 1441 |
1589 | 1442 if (schedule_id != 255) |
1298 | 1443 { |
1610 | 1444 //if (schedule_id >= 25) |
1445 //Log::Warning(L"Transport UI: schedule overflow"); | |
1589 | 1446 if ( pCurrentButton >= 6 ) |
1298 | 1447 v25 = true; |
1448 else | |
1589 | 1449 v25 = transport_schedule[schedule_id].pSchedule[pParty->uDaysPlayed % 7]; |
1298 | 1450 } |
1451 | |
1589 | 1452 if (schedule_id != 255 && v25 && (!transport_schedule[schedule_id].uQuestBit |
1625 | 1453 || _449B57_test_bit(pParty->_quest_bits, transport_schedule[schedule_id].uQuestBit)) )//ошибка: рисуется несколько строчек одного направления путешествия |
1298 | 1454 { |
1610 | 1455 //get color for current string(определение цвета текущей строки)---------- |
1589 | 1456 if ( pDialogueWindow->pCurrentPosActiveItem == pCurrentButton ) |
2069 | 1457 sprintf(pTopicArray[index], "\f%05d", Color16(255, 255, 155)); |
1589 | 1458 else |
2069 | 1459 sprintf(pTopicArray[index], "\f%05d", Color16(255, 255, 255)); |
1589 | 1460 //hired NPC premium(премия наёмного НПС)---------------------------------- |
1461 travel_time = transport_schedule[schedule_id].uTravelTime; | |
1591 | 1462 if ( (unsigned int)window_SpeakInHouse->ptr_1C >= HOUSE_BOATS_EMERALD_ISLE ) |
1298 | 1463 { |
1464 if ( CheckHiredNPCSpeciality(Sailor) ) | |
1589 | 1465 travel_time -= 2; |
1298 | 1466 if ( CheckHiredNPCSpeciality(Navigator) ) |
1589 | 1467 travel_time -= 3; |
1298 | 1468 if ( CheckHiredNPCSpeciality(Pirate) ) |
1589 | 1469 travel_time -= 2; |
1298 | 1470 } |
1471 else | |
1472 { | |
1473 if ( CheckHiredNPCSpeciality(Horseman) ) | |
1589 | 1474 travel_time -= 2; |
1298 | 1475 } |
1476 if ( CheckHiredNPCSpeciality(Explorer) ) | |
1589 | 1477 --travel_time; |
1478 | |
1479 if ( travel_time < 1 ) | |
1480 travel_time = 1; | |
1481 if ( schedule_id != 255 ) | |
1298 | 1482 { |
1589 | 1483 memcpy(&pMap, &pMapStats->pInfos[transport_schedule[schedule_id].uMapInfoID], 0x44u); |
1484 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[404], travel_time, pMap.pName); // Time - %d days, destination %s | |
1485 strcat(pTopicArray[index], pTmpBuf.data()); | |
1486 strcat(pTopicArray[index], "\n \n"); | |
1487 pButton->uY = pRealTextHeight; | |
1488 pTextHeight = pFontArrus->CalcTextHeight(pTmpBuf.data(), &travel_window, 0, 0); | |
1489 pButton->uHeight = pTextHeight; | |
1625 | 1490 pButton->uW = pButton->uY + pTextHeight - 1; |
1589 | 1491 pRealTextHeight += (LOBYTE(pFontArrus->uFontHeight) - 3) + pTextHeight; |
1298 | 1492 } |
1493 } | |
1494 else | |
1495 { | |
1589 | 1496 strcpy(pTopicArray[index], ""); |
1497 if ( pButton ) | |
1298 | 1498 { |
1589 | 1499 pButton->uW = 0; |
1500 pButton->uHeight = 0; | |
1501 pButton->uY = 0; | |
1298 | 1502 } |
1503 } | |
1589 | 1504 ++index; |
1505 ++pCurrentButton; | |
1298 | 1506 } |
1589 | 1507 if ( pRealTextHeight != pPrimaryTextHeight ) |
1298 | 1508 { |
1589 | 1509 sprintf(pTmpBuf.data(), "%s\n \n%s%s%s%s%s", pTmpBuf2.data(), pTopicArray[0], pTopicArray[1], pTopicArray[2], pTopicArray[3], pTopicArray[4]); |
1510 travel_window.DrawTitleText(pFontArrus, 0, 146, 0, pTmpBuf.data(), 3); | |
1298 | 1511 } |
1512 else | |
1513 { | |
1589 | 1514 travel_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[561], &travel_window, 0, 0)) / 2 + 138,//"Извините, приходите в другой день" |
2069 | 1515 Color16(255, 255, 255), pGlobalTXT_LocalizationStrings[561], 3); |
1298 | 1516 pAudioPlayer->StopChannels(-1, -1); |
1517 } | |
1518 } | |
1519 } | |
1589 | 1520 else//после нажатия топика |
1298 | 1521 { |
1522 if ( dialog_menu_id >= HOUSE_DIALOGUE_TRANSPORT_SCHEDULE_1 && dialog_menu_id <= HOUSE_DIALOGUE_TRANSPORT_SCHEDULE_4 ) | |
1523 { | |
1589 | 1524 if ( pParty->uNumGold < pPrice ) |
1298 | 1525 { |
1589 | 1526 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);//"У вас не хватает золота" |
1298 | 1527 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_Greeting_2); |
1528 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
1529 return; | |
1530 } | |
1531 | |
1589 | 1532 Party::TakeGold(pPrice); |
1298 | 1533 |
1589 | 1534 pTravel = &transport_schedule[transport_routes[(unsigned int)window_SpeakInHouse->ptr_1C - HOUSE_STABLES_HARMONDALE][dialog_menu_id - HOUSE_DIALOGUE_TRANSPORT_SCHEDULE_1]]; |
1535 if ( pTravel->pSchedule[pParty->uDaysPlayed % 7] ) | |
1298 | 1536 { |
1589 | 1537 if ( _stricmp(pCurrentMapName, pMapStats->pInfos[pTravel->uMapInfoID].pFilename) ) |
1298 | 1538 { |
1539 SaveGame(1, 0); | |
1589 | 1540 strcpy(pCurrentMapName, pMapStats->pInfos[pTravel->uMapInfoID].pFilename); |
1298 | 1541 |
2061 | 1542 dword_6BE364_game_settings_1 |= GAME_SETTINGS_0001; |
1298 | 1543 _5B65B8_npcdata_hiword_house_or_other = 0; |
1544 dword_5B65BC = 0; | |
1589 | 1545 _5B65B4_npcdata_loword_house_or_other = pTravel->arrival_rot_y; |
2124 | 1546 uGameState = GAME_STATE_CHANGE_LOCATION; |
1589 | 1547 _5B65A8_npcdata_uflags_or_other = pTravel->arrival_x; |
1548 _5B65AC_npcdata_fame_or_other = pTravel->arrival_y; | |
1549 _5B65B0_npcdata_rep_or_other = pTravel->arrival_z; | |
1550 dword_5B65C0 = pTravel->arrival_x | pTravel->arrival_y | pTravel->arrival_z | pTravel->arrival_rot_y; | |
1298 | 1551 } |
1552 else | |
1553 { | |
1640
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1639
diff
changeset
|
1554 pGame->pIndoorCameraD3D->sRotationY = 0; |
1638
ccde94f02b75
class IndoorCamera split into BLVRenderParams and ODMRenderParams
Nomad
parents:
1630
diff
changeset
|
1555 |
1298 | 1556 pParty->uFlags |= 2u; |
1589 | 1557 pParty->vPosition.x = pTravel->arrival_x; |
1558 pParty->vPosition.y = pTravel->arrival_y; | |
1559 pParty->vPosition.z = pTravel->arrival_z; | |
1298 | 1560 pParty->uFallStartY = pParty->vPosition.z; |
1561 pParty->sRotationX = 0; | |
1589 | 1562 pParty->sRotationY = pTravel->arrival_rot_y; |
1298 | 1563 } |
1564 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful); | |
1589 | 1565 v12 = pTravel->uTravelTime; |
1298 | 1566 if ( (signed int)window_SpeakInHouse->ptr_1C >= 63 ) |
1567 { | |
1589 | 1568 pSpeech = SPEECH_SetSail; |
1298 | 1569 v13 = 2500; |
1570 if ( CheckHiredNPCSpeciality(Sailor) ) | |
1571 v12 -= 2; | |
1572 if ( CheckHiredNPCSpeciality(Navigator) ) | |
1573 v12 -= 3; | |
1574 if ( CheckHiredNPCSpeciality(Pirate) ) | |
1575 v12 -= 2; | |
1576 } | |
1577 else | |
1578 { | |
1589 | 1579 pSpeech = SPEECH_CarriageReady; |
1298 | 1580 v13 = 1500; |
1581 if ( CheckHiredNPCSpeciality(Horseman) ) | |
1582 v12 -= 2; | |
1583 } | |
1584 if ( CheckHiredNPCSpeciality(Explorer) ) | |
1585 --v12; | |
1586 if ( v12 < 1 ) | |
1587 v12 = 1; | |
1588 RestAndHeal(1440 * v12); | |
1589 | 1589 pPlayers[uActiveCharacter]->PlaySound(pSpeech, 0); |
1298 | 1590 v14 = GetTickCount(); |
1591 v15 = v14 + v13; | |
1592 if ( v15 < v14 ) | |
1593 v15 = v14; | |
1594 while ( GetTickCount() < v15 ) | |
1595 sqrt(3.1415926); | |
1919 | 1596 while ( HouseDialogPressCloseBtn() ) |
1298 | 1597 ; |
1598 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
1599 return; | |
1600 } | |
1601 else | |
1602 { | |
1603 dialog_menu_id = HOUSE_DIALOGUE_MAIN; | |
1754 | 1604 pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0); |
1298 | 1605 } |
1606 } | |
1607 } | |
1608 } | |
1609 //----- (004B68EA) -------------------------------------------------------- | |
1610 bool __fastcall IsTravelAvailable(int a1) | |
1611 { | |
1587 | 1612 for ( uint i = 0; i < 4; ++i ) |
1298 | 1613 { |
1587 | 1614 if ( transport_schedule[transport_routes[a1][i]].pSchedule[pParty->uDaysPlayed % 7] ) |
1298 | 1615 { |
1587 | 1616 if (!transport_schedule[transport_routes[a1][i]].uQuestBit || _449B57_test_bit(pParty->_quest_bits, transport_schedule[transport_routes[a1][i]].uQuestBit)) |
1298 | 1617 return true; |
1618 } | |
1619 } | |
1620 return false; | |
1621 } | |
1622 | |
1623 //----- (004B7911) -------------------------------------------------------- | |
1458 | 1624 void TownHallDialog() |
1298 | 1625 { |
1626 int v1; // eax@10 | |
1627 int v2; // esi@10 | |
1529 | 1628 signed int pStringSum; // ebx@24 |
1298 | 1629 signed int v16; // ebx@28 |
1630 int v17; // ebx@28 | |
1529 | 1631 GUIButton *pButton; // eax@30 |
1632 int pTextHeight; // eax@30 | |
1633 unsigned __int16 pTextColor; // ax@30 | |
1634 GUIWindow window; // [sp+60h] [bp-BCh]@21 | |
1635 GUIWindow townHall_window; // [sp+B4h] [bp-68h]@1 | |
1298 | 1636 int v29; // [sp+10Ch] [bp-10h]@28 |
1637 int v31; // [sp+114h] [bp-8h]@29 | |
1638 GUIFont *pOutString; // [sp+118h] [bp-4h]@21 | |
1639 | |
1529 | 1640 memcpy(&townHall_window, window_SpeakInHouse, sizeof(townHall_window)); |
1641 townHall_window.uFrameX = 483; | |
1642 townHall_window.uFrameWidth = 148; | |
1643 townHall_window.uFrameZ = 334; | |
1644 sprintf(pTmpBuf.data(), "%s: %d", pGlobalTXT_LocalizationStrings[605], pParty->uFine);//Текущий штраф | |
2069 | 1645 townHall_window.DrawTitleText(pFontArrus, 0, 260, Color16(0xFFu, 0xFFu, 0x9Bu), pTmpBuf.data(), 3); |
1298 | 1646 switch(dialog_menu_id) |
1647 { | |
1529 | 1648 case HOUSE_DIALOGUE_MAIN: |
1649 { | |
1650 pStringSum = 1; | |
1651 pTextHeight = 0; | |
1843
2e6d3cd052e0
some char* cast removal + adding const_casts where appropriate
Grumpy7
parents:
1838
diff
changeset
|
1652 pShopOptions[0] = const_cast<char *>(pGlobalTXT_LocalizationStrings[604]);//Охота за вознаграждение |
1529 | 1653 if ( pParty->uFine > 0 ) |
1654 { | |
1843
2e6d3cd052e0
some char* cast removal + adding const_casts where appropriate
Grumpy7
parents:
1838
diff
changeset
|
1655 pShopOptions[1] = const_cast<char *>(pGlobalTXT_LocalizationStrings[603]);//Заплатить штраф |
1529 | 1656 pStringSum = 2; |
1657 } | |
1658 for ( uint i = 0; i < pStringSum; ++i ) | |
1659 pTextHeight += pFontArrus->CalcTextHeight(pShopOptions[i], &townHall_window, 0, 0); | |
1660 v29 = (100 - pTextHeight) / pStringSum; | |
1661 v16 = 80 - pStringSum * ((100 - pTextHeight) / pStringSum); | |
1662 v17 = (v16 / 2) - v29 / 2 + 158; | |
1663 if ( pDialogueWindow->pNumPresenceButton > 0 ) | |
1664 { | |
1665 v31 = 2; | |
1666 uint j = 0; | |
1667 for ( uint i = pDialogueWindow->pStartingPosActiveItem; | |
1668 i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) | |
1669 { | |
1670 pButton = pDialogueWindow->GetControl(i); | |
1671 pButton->uY = v29 + v17; | |
1672 pTextHeight = pFontArrus->CalcTextHeight(pShopOptions[j], &townHall_window, 0, 0); | |
1673 pButton->uHeight = pTextHeight; | |
1625 | 1674 v17 = pButton->uY + pTextHeight - 1; |
1529 | 1675 pButton->uW = v17; |
2069 | 1676 pTextColor = Color16(0xFFu, 0xFFu, 0x9Bu); |
1529 | 1677 if ( pDialogueWindow->pCurrentPosActiveItem != v31 ) |
2069 | 1678 pTextColor = Color16(0xFFu, 0xFFu, 0xFFu); |
1625 | 1679 townHall_window.DrawTitleText(pFontArrus, 0, pButton->uY, pTextColor, pShopOptions[j], 3); |
1529 | 1680 ++v31; |
1681 ++j; | |
1682 } | |
1683 } | |
1684 break; | |
1685 } | |
1686 case HOUSE_DIALOGUE_TOWNHALL_MESSAGE: | |
1687 { | |
2069 | 1688 sprintf(pTmpBuf.data(), "\f%05d%s\f%05d", Color16(0xFFu, 0xFFu, 0x9Bu), |
1689 pMonsterStats->pInfos[bountyHunting_monster_id_for_hunting].pName, Color16(0xFFu, 0xFFu, 0xFFu)); | |
1529 | 1690 sprintf(pTmpBuf2.data(), bountyHunting_text, pTmpBuf.data(), 100 * pMonsterStats->pInfos[bountyHunting_monster_id_for_hunting].uLevel); |
1691 current_npc_text = pTmpBuf2.data(); | |
1692 memcpy(&window, pDialogueWindow, sizeof(window)); | |
1693 window.uFrameWidth = 458; | |
1694 window.uFrameZ = 457; | |
1695 pOutString = pFontArrus; | |
1696 pTextHeight = pFontArrus->CalcTextHeight(pTmpBuf2.data(), &window, 13, 0) + 7; | |
1697 if ( 352 - pTextHeight < 8 ) | |
1698 { | |
1699 pOutString = pFontCreate; | |
1700 pTextHeight = pFontCreate->CalcTextHeight(current_npc_text, &window, 13, 0) + 7; | |
1701 } | |
1702 pRenderer->GetLeather(8, 352 - pTextHeight, pIcons_LOD->GetTexture(uTextureID_Leather), pIcons_LOD->GetTexture(uTextureID_Leather)->uTextureHeight - pTextHeight); | |
1703 pRenderer->DrawTextureIndexed(8, 347 - pTextHeight, pTexture_591428); | |
1704 window.DrawText(pOutString, 13, 354 - pTextHeight, 0, FitTextInAWindow(current_npc_text, pOutString, &window, 13, 0), 0, 0, 0); | |
1705 break; | |
1706 } | |
1707 case HOUSE_DIALOGUE_TOWNHALL_PAY_FINE: | |
1708 { | |
1709 if ( window_SpeakInHouse->receives_keyboard_input_2 == WINDOW_INPUT_IN_PROGRESS) | |
1710 { | |
1711 sprintfex(pTmpBuf.data(), "%s\n%s", pGlobalTXT_LocalizationStrings[606], pGlobalTXT_LocalizationStrings[112]); // "Pay" "How Much?" | |
2069 | 1712 townHall_window.DrawTitleText(pFontArrus, 0, 146, Color16(0xFFu, 0xFFu, 0x9Bu), pTmpBuf.data(), 3); |
1713 townHall_window.DrawTitleText(pFontArrus, 0, 186, Color16(0xFFu, 0xFFu, 0xFFu), (const char *)pKeyActionMap->pPressedKeysBuffer, 3); | |
1529 | 1714 townHall_window.DrawFlashingInputCursor(pFontArrus->GetLineWidth((const char *)pKeyActionMap->pPressedKeysBuffer) / 2 + 80, 185, pFontArrus); |
1715 return; | |
1716 } | |
1717 if ( window_SpeakInHouse->receives_keyboard_input_2 == WINDOW_INPUT_CONFIRMED) | |
1718 { | |
1719 v1 = atoi((const char *)pKeyActionMap->pPressedKeysBuffer); | |
1720 v2 = atoi((const char *)pKeyActionMap->pPressedKeysBuffer); | |
1721 if ( v1 <= 0 ) | |
1722 { | |
1723 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
1724 return; | |
1725 } | |
1726 if ( v1 > pParty->uNumGold ) | |
1727 { | |
1728 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful); | |
1729 v2 = pParty->uNumGold; | |
1730 } | |
1731 if ( v2 > pParty->uFine ) | |
1732 v2 = pParty->uFine; | |
1733 Party::TakeGold(v2); | |
1734 pParty->uFine -= v2; | |
1735 if ( pParty->uFine < 0 ) | |
1736 pParty->uFine = 0; | |
1737 if ( uActiveCharacter ) | |
1738 pPlayers[uActiveCharacter]->PlaySound(SPEECH_81, 0); | |
1739 } | |
1740 if ( window_SpeakInHouse->receives_keyboard_input_2 == WINDOW_INPUT_CANCELLED) | |
1741 { | |
1742 window_SpeakInHouse->receives_keyboard_input_2 = WINDOW_INPUT_NONE; | |
1743 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
1744 } | |
1745 break; | |
1746 } | |
1747 default: | |
1748 break; | |
1298 | 1749 } |
1750 return; | |
1751 } | |
1752 | |
1753 //----- (004B7D7E) -------------------------------------------------------- | |
1458 | 1754 void BankDialog() |
1298 | 1755 { |
1573 | 1756 int entered_sum; // eax@19 |
1757 unsigned int takes_sum; // esi@19 | |
1758 unsigned __int16 pColorText; // ax@27 | |
1759 GUIWindow bank_window; // [sp+Ch] [bp-5Ch]@1 | |
1298 | 1760 |
1573 | 1761 memcpy(&bank_window, window_SpeakInHouse, sizeof(bank_window)); |
1762 bank_window.uFrameX = 483; | |
1763 bank_window.uFrameWidth = 148; | |
1764 bank_window.uFrameZ = 334; | |
1765 sprintf(pTmpBuf.data(), "%s: %d", pGlobalTXT_LocalizationStrings[25], pParty->uNumGoldInBank);//Баланс | |
2069 | 1766 bank_window.DrawTitleText(pFontArrus, 0, 220, Color16(0xFFu, 0xFFu, 0x9Bu), pTmpBuf.data(), 3); |
1298 | 1767 switch(dialog_menu_id) |
1768 { | |
1573 | 1769 case HOUSE_DIALOGUE_MAIN: |
1770 { | |
2069 | 1771 pColorText = Color16(0xFFu, 0xFFu, 0x9Bu); |
1573 | 1772 if ( pDialogueWindow->pCurrentPosActiveItem != 2 ) |
2069 | 1773 pColorText = Color16(0xFFu, 0xFFu, 0xFFu); |
1573 | 1774 bank_window.DrawTitleText(pFontArrus, 0, 146, pColorText, pGlobalTXT_LocalizationStrings[60], 3); |
2069 | 1775 pColorText = Color16(0xFFu, 0xFFu, 0x9Bu); |
1573 | 1776 if ( pDialogueWindow->pCurrentPosActiveItem != 3 ) |
2069 | 1777 pColorText = Color16(0xFFu, 0xFFu, 0xFFu); |
1573 | 1778 bank_window.DrawTitleText(pFontArrus, 0, 176, pColorText, pGlobalTXT_LocalizationStrings[244], 3); |
1779 break; | |
1780 } | |
1781 case HOUSE_DIALOGUE_BANK_PUT_GOLD: | |
1782 { | |
1783 if ( window_SpeakInHouse->receives_keyboard_input_2 == WINDOW_INPUT_IN_PROGRESS) | |
1784 { | |
1785 sprintf(pTmpBuf.data(), "%s\n%s", pGlobalTXT_LocalizationStrings[60], pGlobalTXT_LocalizationStrings[112]);//"Положить" "Сколько?" | |
2069 | 1786 bank_window.DrawTitleText(pFontArrus, 0, 146, Color16(0xFFu, 0xFFu, 0x9Bu), pTmpBuf.data(), 3); |
1787 bank_window.DrawTitleText(pFontArrus, 0, 186, Color16(0xFFu, 0xFFu, 0xFFu), (const char *)pKeyActionMap->pPressedKeysBuffer, 3); | |
1573 | 1788 bank_window.DrawFlashingInputCursor(pFontArrus->GetLineWidth((const char *)pKeyActionMap->pPressedKeysBuffer) / 2 + 80, 185, pFontArrus); |
1789 return; | |
1790 } | |
1791 if ( window_SpeakInHouse->receives_keyboard_input_2 == WINDOW_INPUT_CONFIRMED) | |
1792 { | |
1793 entered_sum = atoi((const char *)pKeyActionMap->pPressedKeysBuffer); | |
1794 takes_sum = entered_sum; | |
1795 if ( !entered_sum ) | |
1796 { | |
1797 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
1798 return; | |
1799 } | |
1800 if ( entered_sum > pParty->uNumGold ) | |
1801 { | |
1802 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful); | |
1803 takes_sum = pParty->uNumGold; | |
1804 } | |
1805 if ( takes_sum ) | |
1806 { | |
1807 Party::TakeGold(takes_sum); | |
1808 pParty->uNumGoldInBank += takes_sum; | |
1809 if ( uActiveCharacter ) | |
1810 pPlayers[uActiveCharacter]->PlaySound(SPEECH_81, 0); | |
1811 } | |
1812 window_SpeakInHouse->receives_keyboard_input_2 = WINDOW_INPUT_NONE; | |
1813 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
1814 return; | |
1815 } | |
1816 if (window_SpeakInHouse->receives_keyboard_input_2 == WINDOW_INPUT_CANCELLED) | |
1817 { | |
1818 window_SpeakInHouse->receives_keyboard_input_2 = WINDOW_INPUT_NONE; | |
1819 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
1820 } | |
1821 return; | |
1822 } | |
1823 case HOUSE_DIALOGUE_BANK_GET_GOLD: | |
1824 { | |
1825 if ( window_SpeakInHouse->receives_keyboard_input_2 == WINDOW_INPUT_IN_PROGRESS) | |
1826 { | |
1827 sprintfex(pTmpBuf.data(), "%s\n%s", pGlobalTXT_LocalizationStrings[244], pGlobalTXT_LocalizationStrings[112]);//"Снять" "Сколько?" | |
2069 | 1828 bank_window.DrawTitleText(pFontArrus, 0, 146, Color16(0xFFu, 0xFFu, 0x9Bu), pTmpBuf.data(), 3); |
1829 bank_window.DrawTitleText(pFontArrus, 0, 186, Color16(0xFFu, 0xFFu, 0xFFu), (const char *)pKeyActionMap->pPressedKeysBuffer, 3); | |
1573 | 1830 bank_window.DrawFlashingInputCursor(pFontArrus->GetLineWidth((const char *)pKeyActionMap->pPressedKeysBuffer) / 2 + 80, 185, pFontArrus); |
1831 return; | |
1832 } | |
1833 if ( window_SpeakInHouse->receives_keyboard_input_2 == WINDOW_INPUT_CONFIRMED) | |
1834 { | |
1835 window_SpeakInHouse->receives_keyboard_input_2 = WINDOW_INPUT_NONE; | |
1836 entered_sum = atoi((const char *)pKeyActionMap->pPressedKeysBuffer); | |
1837 takes_sum = entered_sum; | |
1838 if ( entered_sum ) | |
1839 { | |
1840 if ( entered_sum > pParty->uNumGoldInBank ) | |
1841 { | |
1842 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful); | |
1843 takes_sum = pParty->uNumGoldInBank; | |
1844 } | |
1845 if ( takes_sum ) | |
1846 { | |
1847 Party::SetGold(pParty->uNumGold + takes_sum); | |
1848 pParty->uNumGoldInBank -= takes_sum; | |
1849 } | |
1850 } | |
1851 window_SpeakInHouse->receives_keyboard_input_2 = WINDOW_INPUT_NONE; | |
1852 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
1853 return; | |
1854 } | |
1855 if ( window_SpeakInHouse->receives_keyboard_input_2 == WINDOW_INPUT_CANCELLED) | |
1856 { | |
1857 window_SpeakInHouse->receives_keyboard_input_2 = WINDOW_INPUT_NONE; | |
1858 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
1859 } | |
1860 return; | |
1861 } | |
1862 default: | |
1863 { | |
1864 break; | |
1865 } | |
1298 | 1866 } |
1867 } | |
1868 // F8B19C: using guessed type int dword_F8B19C; | |
1869 | |
1870 //----- (004B8285) -------------------------------------------------------- | |
1458 | 1871 void TavernDialog() |
1298 | 1872 { |
1630 | 1873 int pPriceRoom; |
1874 int pPriceFood; | |
1875 int pPriceSkill; | |
1298 | 1876 int pItemNum; |
1877 double v2; // st7@1 | |
1878 int pNumString; // edi@16 | |
1879 signed int v9; // esi@16 | |
1880 unsigned int pColorText; // eax@57 | |
1881 GUIButton *pButton; // eax@65 | |
1630 | 1882 int pSkillCount; |
1883 signed int pOptionsCount; // edi@77 | |
1298 | 1884 signed int i; // esi@79 |
1885 signed int v53; // edi@81 | |
1886 int v54; // edi@81 | |
1630 | 1887 const char *pText; // [sp-4h] [bp-278h]@93 |
1298 | 1888 char pTopic1[100]; // [sp+Ch] [bp-268h]@55 |
1889 char pTopic4[100]; // [sp+70h] [bp-204h]@59 | |
1890 char pTopic2[100]; // [sp+D4h] [bp-1A0h]@57 | |
1891 char pTopic3[100]; // [sp+138h] [bp-13Ch]@59 | |
1892 GUIWindow dialog_window; // [sp+1F0h] [bp-84h]@1 | |
1630 | 1893 int v91; // [sp+270h] [bp-4h]@3 |
1894 unsigned int pTopic1Height; // [sp+26Fh] [bp-5h]@55 | |
1895 unsigned __int8 pTopic2Height; // [sp+267h] [bp-Dh]@57 | |
1298 | 1896 unsigned __int8 pTopic3Height; // [sp+253h] [bp-21h]@59 |
1897 unsigned __int8 pTopic4Height; | |
1898 int pTextHeight; | |
1630 | 1899 int all_text_height; // [sp+260h] [bp-14h]@18 |
1900 GUIFont *pOutString; | |
1298 | 1901 |
1902 memcpy(&dialog_window, window_SpeakInHouse, sizeof(dialog_window)); | |
1903 dialog_window.uFrameX = 483; | |
1904 dialog_window.uFrameWidth = 148; | |
1905 dialog_window.uFrameZ = 334; | |
1906 v2 = p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier; | |
1630 | 1907 |
1908 pPriceRoom = ((v2 * v2) / 10) * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; | |
1909 if ( pPriceRoom < ((v2 * v2) / 10) / 3 ) | |
1910 pPriceRoom = ((v2 * v2) / 10) / 3; | |
1911 if ( pPriceRoom <= 0 ) | |
1912 pPriceRoom = 1; | |
1913 | |
1914 pPriceFood = ((v2 * v2) * v2 / 100) * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; | |
1915 if ( pPriceFood < ((v2 * v2) * v2 / 100) / 3 ) | |
1916 pPriceFood = ((v2 * v2) * v2 / 100) / 3; | |
1917 if ( pPriceFood <= 0 ) | |
1918 pPriceFood = 1; | |
1919 | |
1298 | 1920 |
1921 switch(dialog_menu_id) | |
1922 { | |
1923 case HOUSE_DIALOGUE_MAIN: | |
1924 { | |
1393 | 1925 if ( !HouseUI_CheckIfPlayerCanInteract() ) |
1298 | 1926 return; |
1927 | |
2069 | 1928 sprintf(pTopic1, "\f%05d", pDialogueWindow->pCurrentPosActiveItem == 2 ? Color16(0xFFu, 0xFFu, 0x9Bu) : Color16(0xFFu, 0xFFu, 0xFFu)); |
1630 | 1929 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[178], pPriceRoom); // Rent room for %d gold |
1298 | 1930 strcat(pTopic1, pTmpBuf2.data()); |
1931 pTopic1Height = pFontArrus->CalcTextHeight(pTopic1, &dialog_window, 0, 0); | |
1932 strcat(pTopic1, "\n \n"); | |
1933 | |
2069 | 1934 sprintf(pTopic2, "\f%05d", pDialogueWindow->pCurrentPosActiveItem == 3 ? Color16(0xFFu, 0xFFu, 0x9Bu) : Color16(0xFFu, 0xFFu, 0xFFu)); |
1298 | 1935 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[86], // Buy food for %d days for %d gold |
1630 | 1936 (unsigned int)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier, pPriceFood); |
1298 | 1937 strcat(pTopic2, pTmpBuf2.data()); |
1938 pTopic2Height = pFontArrus->CalcTextHeight(pTopic2, &dialog_window, 0, 0); | |
1939 strcat(pTopic2, "\n \n"); | |
1940 | |
2069 | 1941 sprintf(pTopic3, "\f%05d", pDialogueWindow->pCurrentPosActiveItem == 4 ? Color16(0xFFu, 0xFFu, 0x9Bu) : Color16(0xFFu, 0xFFu, 0xFFu)); |
1298 | 1942 strcat(pTopic3, pGlobalTXT_LocalizationStrings[160]); // Learn Skills |
1943 pTopic3Height = pFontArrus->CalcTextHeight(pTopic3, &dialog_window, 0, 0); | |
1944 strcat(pTopic3, "\n \n"); | |
1945 pTopic4[0] = 0; | |
1946 if ( (signed int)window_SpeakInHouse->par1C >= 108 && (signed int)window_SpeakInHouse->par1C <= 120 ) | |
1947 { | |
2069 | 1948 sprintf(pTopic4, "\f%05d", pDialogueWindow->pCurrentPosActiveItem == 5 ? Color16(0xFFu, 0xFFu, 0x9Bu) : Color16(0xFFu, 0xFFu, 0xFFu)); |
1298 | 1949 strcat(pTopic4, pGlobalTXT_LocalizationStrings[611]); // Play Arcomage |
1950 pTopic4Height = pFontArrus->CalcTextHeight(pTopic4, &dialog_window, 0, 0); | |
1951 } | |
1610 | 1952 |
1953 if ( pDialogueWindow->pNumPresenceButton ) | |
1298 | 1954 { |
1630 | 1955 for ( pItemNum = pDialogueWindow->pStartingPosActiveItem; |
1956 pItemNum < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton; ++pItemNum ) | |
1298 | 1957 { |
1630 | 1958 pButton = pDialogueWindow->GetControl(pItemNum); |
1298 | 1959 if ( pButton->msg_param == 15 ) |
1960 { | |
1961 pButton->uHeight = pTopic1Height; | |
1962 pButton->uY = 146; | |
1630 | 1963 pButton->uW = pTopic1Height + 145; |
1298 | 1964 } |
1965 else if ( pButton->msg_param == 16 ) | |
1966 { | |
1967 pButton->uHeight = pTopic2Height; | |
1630 | 1968 pButton->uY = pTopic1Height + (LOBYTE(pFontArrus->uFontHeight) - 3) + 146; |
1969 pButton->uW = (pTopic1Height + (LOBYTE(pFontArrus->uFontHeight) - 3) + 146) + pTopic2Height - 1; | |
1298 | 1970 } |
1971 else if ( pButton->msg_param == 96 ) | |
1972 { | |
1630 | 1973 pButton->uY = pTopic1Height + pTopic2Height + 2 * (LOBYTE(pFontArrus->uFontHeight) - 3) + 146; |
1974 pButton->uHeight = pTopic3Height; | |
1975 pButton->uW = pTopic3Height + (pTopic1Height + pTopic2Height + 2 * (LOBYTE(pFontArrus->uFontHeight) - 3) + 146) - 1; | |
1298 | 1976 } |
1977 else if ( pButton->msg_param == 101 ) | |
1978 { | |
1979 pButton->uHeight = pTopic4Height; | |
1630 | 1980 pButton->uY = pTopic1Height + 3 * (LOBYTE(pFontArrus->uFontHeight) - 3) + pTopic4Height + pTopic2Height + 146; |
1981 pButton->uW = (pTopic1Height + 3 * (LOBYTE(pFontArrus->uFontHeight) - 3) + pTopic4Height + pTopic2Height + 146) + pTopic4Height - 1; | |
1298 | 1982 } |
1983 } | |
1610 | 1984 sprintfex(pTmpBuf.data(), "%s%s%s%s", pTopic1, pTopic2, pTopic3, pTopic4); |
1985 dialog_window.DrawTitleText(pFontArrus, 0, 146, 0, pTmpBuf.data(), 3); | |
1298 | 1986 } |
1987 break; | |
1988 } | |
1989 case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_RULES: | |
1990 { | |
1991 pOutString = pFontArrus; | |
1992 strcpy(pTmpBuf.data(), pNPCTopics[354].pText); | |
1993 dialog_window.uFrameWidth = game_viewport_width; | |
1994 dialog_window.uFrameZ = 452; | |
1995 pTextHeight = pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 12, 0) + 7; | |
1996 if ( 352 - pTextHeight < 8 ) | |
1997 { | |
1998 pOutString = pFontCreate; | |
1999 pTextHeight = pFontCreate->CalcTextHeight(pTmpBuf.data(), &dialog_window, 12, 0) + 7; | |
2000 } | |
1630 | 2001 pRenderer->GetLeather(8, 352 - pTextHeight, pIcons_LOD->GetTexture(uTextureID_Leather), pIcons_LOD->GetTexture(uTextureID_Leather)->uTextureHeight - pTextHeight); |
1298 | 2002 pRenderer->DrawTextureIndexed(8, 347 - pTextHeight, pTexture_591428); |
1630 | 2003 window_SpeakInHouse->DrawText(pOutString, 12, 354 - pTextHeight, 0, FitTextInAWindow(pTmpBuf.data(), pOutString, &dialog_window, 0xCu, 0), 0, 0, 0); |
1298 | 2004 break; |
2005 } | |
2006 case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_VICTORY_CONDITIONS: | |
2007 { | |
2008 strcpy(pTmpBuf.data(), pNPCTopics[(uint)window_SpeakInHouse->ptr_1C + 247].pText); | |
2009 dialog_window.uFrameWidth = game_viewport_width; | |
2010 dialog_window.uFrameZ = 452; | |
1630 | 2011 pTextHeight = pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 12, 0) + 7; |
2012 pRenderer->GetLeather(8, 352 - pTextHeight, pIcons_LOD->GetTexture(uTextureID_Leather), pIcons_LOD->GetTexture(uTextureID_Leather)->uTextureHeight - pTextHeight); | |
1298 | 2013 pRenderer->DrawTextureIndexed(8, 347 - pTextHeight, pTexture_591428); |
1630 | 2014 window_SpeakInHouse->DrawText(pFontArrus, 12, 354 - pTextHeight, 0, |
2015 FitTextInAWindow(pTmpBuf.data(), pFontArrus, &dialog_window, 0xCu, 0), 0, 0, 0); | |
1298 | 2016 break; |
2017 } | |
2018 case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_RESULT: | |
2019 { | |
2020 if ( pArcomageGame->bGameInProgress == 1 ) | |
2021 return; | |
2214 | 2022 if ( pArcomageGame->uGameWinner ) |
1298 | 2023 { |
2214 | 2024 if ( pArcomageGame->uGameWinner == 1 ) |
1630 | 2025 pText = pGlobalTXT_LocalizationStrings[640];// You won! |
1298 | 2026 else |
1630 | 2027 pText = pGlobalTXT_LocalizationStrings[641];// You lost! |
1298 | 2028 } |
2029 else | |
2030 { | |
1630 | 2031 pText = pGlobalTXT_LocalizationStrings[639];// A tie! |
1298 | 2032 } |
1630 | 2033 strcpy(pTmpBuf.data(), pText); |
2034 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 0, 0)) / 2 + 138, | |
2069 | 2035 Color16(0xFFu, 0xFFu, 0x9Bu), pTmpBuf.data(), 3); |
1298 | 2036 break; |
2037 } | |
2038 case HOUSE_DIALOGUE_TAVERN_REST: | |
2039 { | |
1630 | 2040 if ( pParty->uNumGold >= pPriceRoom ) |
1298 | 2041 { |
1630 | 2042 Party::TakeGold(pPriceRoom); |
1298 | 2043 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful); |
2022 | 2044 dialog_menu_id = HOUSE_DIALOGUE_NULL; |
1919 | 2045 HouseDialogPressCloseBtn(); |
1407 | 2046 GetHouseGoodbyeSpeech(); |
1298 | 2047 pVideoPlayer->Unload(); |
2022 | 2048 /*if ( pMessageQueue_50CBD0->uNumMessages ) |
1298 | 2049 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; |
2050 pMessageQueue_50CBD0->pMessages[0].eType = UIMSG_RentRoom; | |
1630 | 2051 pMessageQueue_50CBD0->pMessages[0].param = (int)window_SpeakInHouse->ptr_1C;//107 |
1298 | 2052 pMessageQueue_50CBD0->pMessages[0].field_8 = 1; |
2022 | 2053 ++pMessageQueue_50CBD0->uNumMessages;*/ |
2054 pMessageQueue_50CBD0->AddMessage(UIMSG_RentRoom, (int)window_SpeakInHouse->ptr_1C, 1); | |
1630 | 2055 window_SpeakInHouse->Release(); |
2056 window_SpeakInHouse = 0; | |
1298 | 2057 return; |
2058 } | |
1630 | 2059 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);//У вас не хватает золота |
1298 | 2060 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_Goodbye); |
1630 | 2061 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); |
1298 | 2062 break; |
2063 } | |
2064 | |
2065 case HOUSE_DIALOGUE_LEARN_SKILLS: | |
2066 { | |
1393 | 2067 if ( !HouseUI_CheckIfPlayerCanInteract() ) |
1298 | 2068 return; |
1630 | 2069 pSkillCount = 0; |
1298 | 2070 v9 = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0); |
1630 | 2071 pPriceSkill = v9 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; |
2072 if ( pPriceSkill < v9 / 3 ) | |
2073 pPriceSkill = v9 / 3; | |
1298 | 2074 all_text_height = 0; |
1920 | 2075 for ( int i = pDialogueWindow->pStartingPosActiveItem; |
2076 i < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton; ++i ) | |
1298 | 2077 { |
1920 | 2078 if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][pDialogueWindow->GetControl(i)->msg_param - 36] |
2079 && !pPlayers[uActiveCharacter]->pActiveSkills[pDialogueWindow->GetControl(i)->msg_param - 36] ) | |
1298 | 2080 { |
1920 | 2081 all_text_height = pFontArrus->CalcTextHeight(pSkillNames[pDialogueWindow->GetControl(i)->msg_param - 36], &dialog_window, 0, 0); |
1630 | 2082 pSkillCount++; |
1298 | 2083 } |
2084 } | |
1630 | 2085 if ( pSkillCount ) |
2086 { | |
2087 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[401], pPriceSkill);//Стоимость навыка: %lu | |
2088 dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3); | |
2089 v91 = (149 - all_text_height) / pSkillCount; | |
2090 if ( (149 - all_text_height) / pSkillCount > 32 ) | |
2091 v91 = 32; | |
2092 v54 = (149 - pSkillCount * v91 - all_text_height) / 2 - v91 / 2 + 162; | |
1920 | 2093 for ( int i = pDialogueWindow->pStartingPosActiveItem; |
2094 i < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton; i++ ) | |
1630 | 2095 { |
1920 | 2096 pButton = pDialogueWindow->GetControl(i); |
1630 | 2097 if ( !byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][pButton->msg_param - 36] |
2098 || pPlayers[uActiveCharacter]->pActiveSkills[pButton->msg_param - 36] ) | |
2099 { | |
2100 pButton->uW = 0; | |
2101 pButton->uHeight = 0; | |
2102 pButton->uY = 0; | |
2103 } | |
2104 else | |
2105 { | |
2106 pButton->uY = v91 + v54; | |
2107 pTextHeight = pFontArrus->CalcTextHeight(pSkillNames[pButton->msg_param - 36], &dialog_window, 0, 0); | |
2108 pButton->uHeight = pTextHeight; | |
2109 v54 = pTextHeight + pButton->uY - 1; | |
2110 pButton->uW = v54; | |
2069 | 2111 pColorText = Color16(0xFFu, 0xFFu, 0x9Bu); |
1920 | 2112 if ( pDialogueWindow->pCurrentPosActiveItem != i ) |
2069 | 2113 pColorText = Color16(0xFFu, 0xFFu, 0xFFu); |
1630 | 2114 dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, pSkillNames[pButton->msg_param - 36], 3); |
2115 } | |
2116 } | |
2117 return; | |
2118 } | |
2119 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName,//Советую вам %s %s поискать знания еще где-нибудь | |
1610 | 2120 pClassNames[pPlayers[uActiveCharacter]->classType]); |
1298 | 2121 strcat(pTmpBuf.data(), "\n \n"); |
1630 | 2122 strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]);//Больше ничего не могу предложить. |
1298 | 2123 pTextHeight = (174 - pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 0, 0)) / 2 + 138; |
2069 | 2124 dialog_window.DrawTitleText(pFontArrus, 0, pTextHeight, Color16(0xFFu, 0xFFu, 0x9Bu), pTmpBuf.data(), 3); |
1298 | 2125 return; |
2126 } | |
2127 | |
2128 case HOUSE_DIALOGUE_TAVERN_BUY_FOOD: | |
2129 { | |
2130 if ( (double)pParty->uNumFoodRations >= p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier ) | |
2131 { | |
1630 | 2132 ShowStatusBarString(pGlobalTXT_LocalizationStrings[140], 2);//Вы уже купили еду! |
1298 | 2133 if ( uActiveCharacter ) |
2134 pPlayers[uActiveCharacter]->PlaySound(SPEECH_67, 0); | |
1630 | 2135 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); |
1298 | 2136 return; |
2137 } | |
1630 | 2138 if ( pParty->uNumGold >= pPriceFood ) |
1298 | 2139 { |
1630 | 2140 Party::TakeGold(pPriceFood); |
1298 | 2141 pParty->uNumFoodRations = (signed __int64)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier; |
2142 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_Greeting_2); | |
2143 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
2144 return; | |
2145 } | |
2146 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2); // "You don't have enough gold" | |
2147 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_Goodbye); | |
1630 | 2148 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); |
1298 | 2149 break; |
2150 } | |
2151 | |
2152 case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_MAIN: | |
2153 { | |
1393 | 2154 if ( HouseUI_CheckIfPlayerCanInteract() ) |
1298 | 2155 { |
1630 | 2156 pOptionsCount = 2; |
1843
2e6d3cd052e0
some char* cast removal + adding const_casts where appropriate
Grumpy7
parents:
1838
diff
changeset
|
2157 pShopOptions[0] = const_cast<char *>(pGlobalTXT_LocalizationStrings[620]);//Правила |
2e6d3cd052e0
some char* cast removal + adding const_casts where appropriate
Grumpy7
parents:
1838
diff
changeset
|
2158 pShopOptions[1] = const_cast<char *>(pGlobalTXT_LocalizationStrings[622]);//Условия победы |
1630 | 2159 if ( pParty->HasItem(651) )//651 - Колода для игры в АркоМэйдж в Items.txt |
1298 | 2160 { |
1843
2e6d3cd052e0
some char* cast removal + adding const_casts where appropriate
Grumpy7
parents:
1838
diff
changeset
|
2161 pShopOptions[2] = const_cast<char *>(pGlobalTXT_LocalizationStrings[621]);//Играть |
1630 | 2162 pOptionsCount = 3; |
2163 } | |
2164 for ( i = 0; i < pOptionsCount; ++i ) | |
2165 all_text_height = pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0); | |
2166 all_text_height = (174 - all_text_height) / pOptionsCount; | |
2167 | |
2168 v54 = (174 - pOptionsCount * (174 - all_text_height) / pOptionsCount - all_text_height) / 2 - (174 - all_text_height) / pOptionsCount / 2 + 138; | |
2169 pNumString = 0; | |
2170 for ( pItemNum = pDialogueWindow->pStartingPosActiveItem; | |
2171 pItemNum < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem ; pItemNum++ ) | |
2172 { | |
2173 pButton = pDialogueWindow->GetControl(pItemNum); | |
2174 pButton->uY = all_text_height + v54; | |
2175 pTextHeight = pFontArrus->CalcTextHeight((const char *)pShopOptions[pNumString], &dialog_window, 0, 0); | |
2176 pButton->uHeight = pTextHeight; | |
2177 v54 = pButton->uY + pTextHeight - 1; | |
2178 pButton->uW = v54; | |
2069 | 2179 pColorText = Color16(0xFFu, 0xFFu, 0x9Bu); |
1630 | 2180 if ( pDialogueWindow->pCurrentPosActiveItem != pItemNum ) |
2069 | 2181 pColorText = Color16(0xFFu, 0xFFu, 0xFFu); |
1630 | 2182 dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, (const char *)pShopOptions[pNumString], 3); |
2183 ++pNumString; | |
1298 | 2184 } |
2185 } | |
2186 break; | |
2187 } | |
2188 default: | |
2189 { | |
2190 break; | |
2191 } | |
2192 } | |
2193 } | |
2194 | |
2195 //----- (004B705E) -------------------------------------------------------- | |
2196 void TempleDialog() | |
1612 | 2197 { |
1622 | 2198 int pPrice; // edi@1 |
2199 int pTextHeight; // eax@11 | |
2200 unsigned __int16 pTextColor; // ax@21 | |
2201 DDM_DLV_Header *v26; // edi@29 | |
2202 unsigned int v30; // edx@36 | |
2203 int v35; // edi@50 | |
2204 GUIButton *pButton; // edi@64 | |
2205 int v47; // edi@71 | |
2206 GUIWindow tample_window; // [sp+13Ch] [bp-88h]@1 | |
2207 unsigned __int8 index; // [sp+1B7h] [bp-Dh]@64 | |
2208 int v64; // [sp+1B8h] [bp-Ch]@6 | |
2209 unsigned int pCurrentItem; // [sp+1BCh] [bp-8h]@6 | |
2210 int all_text_height; // [sp+1C0h] [bp-4h]@6 | |
1298 | 2211 |
1612 | 2212 memcpy(&tample_window, window_SpeakInHouse, sizeof(tample_window)); |
2213 tample_window.uFrameX = 483; | |
2214 tample_window.uFrameWidth = 148; | |
2215 tample_window.uFrameZ = 334; | |
2216 pPrice = pPlayers[uActiveCharacter]->GetTempleHealCostModifier(p2DEvents[window_SpeakInHouse->par1C - 1].fPriceMultiplier); | |
2217 if ( dialog_menu_id == HOUSE_DIALOGUE_MAIN ) | |
2218 { | |
2219 index = 1; | |
2220 pButton = pDialogueWindow->GetControl(pDialogueWindow->pStartingPosActiveItem); | |
2221 pButton->uHeight = 0; | |
2222 pButton->uY = 0; | |
2223 if ( pPlayers[uActiveCharacter]->IsPlayerHealableByTemple() ) | |
1298 | 2224 { |
1612 | 2225 sprintfex(pTmpBuf.data(), "%s %d %s", pGlobalTXT_LocalizationStrings[104], pPrice, pGlobalTXT_LocalizationStrings[97]);//"Лечить" "Золото" |
2226 pShopOptions[0] = pTmpBuf.data(); | |
2227 index = 0; | |
2228 } | |
1843
2e6d3cd052e0
some char* cast removal + adding const_casts where appropriate
Grumpy7
parents:
1838
diff
changeset
|
2229 pShopOptions[1] = const_cast<char *>(pGlobalTXT_LocalizationStrings[68]);//"Пожертвовать" |
2e6d3cd052e0
some char* cast removal + adding const_casts where appropriate
Grumpy7
parents:
1838
diff
changeset
|
2230 pShopOptions[2] = const_cast<char *>(pGlobalTXT_LocalizationStrings[160]);//"Обучиться навыкам" |
1612 | 2231 all_text_height = 0; |
2232 if ( index < pDialogueWindow->pNumPresenceButton ) | |
2233 { | |
2234 uint i = index; | |
2235 for ( uint j = index; j < pDialogueWindow->pNumPresenceButton; ++j ) | |
2236 { | |
2237 all_text_height += pFontArrus->CalcTextHeight(pShopOptions[1 * i], &tample_window, 0, 0); | |
2238 i++; | |
2239 } | |
2240 } | |
2241 v64 = (174 - (signed int)all_text_height) / (pDialogueWindow->pNumPresenceButton - index); | |
2242 if ( v64 > 32 ) | |
2243 v64 = 32; | |
1622 | 2244 all_text_height = (174 - v64 * (pDialogueWindow->pNumPresenceButton - index) - (signed int)all_text_height) / 2 - v64 / 2 + 138; |
1612 | 2245 if ( index + pDialogueWindow->pStartingPosActiveItem < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton ) |
2246 { | |
2247 uint i = index; | |
2248 for ( pCurrentItem = index + pDialogueWindow->pStartingPosActiveItem; | |
2249 (signed int)pCurrentItem < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++pCurrentItem ) | |
1298 | 2250 { |
1612 | 2251 pButton = pDialogueWindow->GetControl(pCurrentItem); |
1622 | 2252 pButton->uY = v64 + all_text_height; |
1612 | 2253 pTextHeight = pFontArrus->CalcTextHeight(pShopOptions[1 * i], &tample_window, 0, 0); |
2254 pButton->uHeight = pTextHeight; | |
1622 | 2255 pButton->uW = pButton->uY + pTextHeight - 1; |
2256 all_text_height = pButton->uW; | |
2069 | 2257 pTextColor = Color16(0xFFu, 0xFFu, 0x9Bu); |
1612 | 2258 if ( pDialogueWindow->pCurrentPosActiveItem != index + 2 ) |
2069 | 2259 pTextColor = Color16(0xFFu, 0xFFu, 0xFFu); |
1622 | 2260 tample_window.DrawTitleText(pFontArrus, 0, pButton->uY, pTextColor, pShopOptions[1 * i], 3); |
1612 | 2261 i++; |
2262 index++; | |
2263 } | |
2264 } | |
2265 return; | |
2266 } | |
2267 //------------------------------------------------- | |
2268 if ( dialog_menu_id == HOUSE_DIALOGUE_TEMPLE_HEAL ) | |
2269 { | |
2270 if ( !pPlayers[uActiveCharacter]->IsPlayerHealableByTemple() ) | |
2271 return; | |
2272 if ( pParty->uNumGold < pPrice ) | |
2273 { | |
1622 | 2274 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);//"У вас не хватает золота" |
1612 | 2275 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful); |
1622 | 2276 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); |
1612 | 2277 return; |
2278 } | |
2279 Party::TakeGold(pPrice); | |
2057 | 2280 v35 = LODWORD(pPlayers[uActiveCharacter]->pConditions[Condition_Zombie]); |
1612 | 2281 memset(pPlayers[uActiveCharacter], 0, 0xA0u); |
2282 pPlayers[uActiveCharacter]->sHealth = pPlayers[uActiveCharacter]->GetMaxHealth(); | |
2283 pPlayers[uActiveCharacter]->sMana = pPlayers[uActiveCharacter]->GetMaxMana(); | |
1622 | 2284 if ( (signed int)window_SpeakInHouse->ptr_1C != 78 && ((signed int)window_SpeakInHouse->ptr_1C <= 80 || (signed int)window_SpeakInHouse->ptr_1C > 82) ) |
1612 | 2285 { |
2185 | 2286 if ( (unsigned int)pPlayers[uActiveCharacter]->pConditions[Condition_Zombie] | v35 )// если состояние зомби |
1612 | 2287 { |
1622 | 2288 pPlayers[uActiveCharacter]->uCurrentFace = pPlayers[uActiveCharacter]->uPrevFace; |
2289 pPlayers[uActiveCharacter]->uVoiceID = pPlayers[uActiveCharacter]->uPrevVoiceID; | |
2290 ReloadPlayerPortraits(uActiveCharacter - 1, pPlayers[uActiveCharacter]->uPrevFace); | |
1612 | 2291 } |
2292 pAudioPlayer->PlaySound((SoundID)(SOUND_GoldReceived|0x2), -1, 0, -1, 0, 0, 0, 0); | |
2293 pPlayers[uActiveCharacter]->PlaySound(SPEECH_82, 0); | |
2294 pOtherOverlayList->_4418B1(20, uActiveCharacter + 99, 0, 65536); | |
1622 | 2295 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); |
1612 | 2296 return; |
2297 } | |
2057 | 2298 if ( (unsigned int)pPlayers[uActiveCharacter]->pConditions[Condition_Zombie] | v35 ) |
2299 LODWORD(pPlayers[uActiveCharacter]->pConditions[Condition_Zombie]) = v35; | |
1612 | 2300 else |
2301 { | |
2057 | 2302 if ( !pPlayers[uActiveCharacter]->pConditions[Condition_Eradicated] |
2303 && !pPlayers[uActiveCharacter]->pConditions[Condition_Pertified] && !pPlayers[uActiveCharacter]->pConditions[Condition_Dead] ) | |
1612 | 2304 { |
1298 | 2305 pAudioPlayer->PlaySound((SoundID)(SOUND_GoldReceived|0x2), -1, 0, -1, 0, 0, 0, 0); |
1612 | 2306 pPlayers[uActiveCharacter]->PlaySound(SPEECH_82, 0); |
1298 | 2307 pOtherOverlayList->_4418B1(20, uActiveCharacter + 99, 0, 65536); |
1622 | 2308 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); |
1612 | 2309 return; |
2310 } | |
2311 pPlayers[uActiveCharacter]->uPrevFace = pPlayers[uActiveCharacter]->uCurrentFace; | |
2312 pPlayers[uActiveCharacter]->uPrevVoiceID = pPlayers[uActiveCharacter]->uVoiceID; | |
2185 | 2313 pPlayers[uActiveCharacter]->SetCondition(Condition_Zombie, 1); |
1612 | 2314 pPlayers[uActiveCharacter]->uVoiceID = (pPlayers[uActiveCharacter]->GetSexByVoice() != 0) + 23; |
1622 | 2315 pPlayers[uActiveCharacter]->uCurrentFace = (pPlayers[uActiveCharacter]->GetSexByVoice() != 0) + 23; |
2316 ReloadPlayerPortraits(uActiveCharacter - 1, (pPlayers[uActiveCharacter]->GetSexByVoice() != 0) + 23); | |
2185 | 2317 pPlayers[uActiveCharacter]->pConditions[Condition_Zombie] = pParty->uTimePlayed; |
1622 | 2318 //v39 = (GUIWindow *)HIDWORD(pParty->uTimePlayed); |
1612 | 2319 } |
2057 | 2320 //HIDWORD(pPlayers[uActiveCharacter]->pConditions[Condition_Zombie]) = (int)v39; |
2185 | 2321 pPlayers[uActiveCharacter]->pConditions[Condition_Zombie] = pParty->uTimePlayed; |
1612 | 2322 pAudioPlayer->PlaySound((SoundID)(SOUND_GoldReceived|0x2), -1, 0, -1, 0, 0, 0, 0); |
2323 pPlayers[uActiveCharacter]->PlaySound(SPEECH_82, 0); | |
2324 pOtherOverlayList->_4418B1(20, uActiveCharacter + 99, 0, 65536); | |
1622 | 2325 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); |
1612 | 2326 return; |
2327 } | |
2328 //--------------------------------------------------- | |
2329 if ( dialog_menu_id == HOUSE_DIALOGUE_TEMPLE_DONATE ) | |
2330 { | |
1622 | 2331 pPrice = p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier; |
2332 if ( pParty->uNumGold >= (unsigned int)pPrice ) | |
2333 { | |
2334 Party::TakeGold((unsigned int)pPrice); | |
2335 v26 = &pOutdoor->ddm; | |
2336 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
2337 v26 = &pIndoor->dlv; | |
2338 if ( v26->uReputation > -5 ) | |
1612 | 2339 { |
1622 | 2340 v26->uReputation = v26->uReputation - 1; |
2341 if ( v26->uReputation - 1 < -5 ) | |
2342 v26->uReputation = -5; | |
2343 } | |
2344 if ( (unsigned __int8)byte_F8B1EF[uActiveCharacter] == pParty->uDaysPlayed % 7 ) | |
2345 { | |
2346 if ( v26->uReputation <= -5 ) | |
1298 | 2347 { |
1622 | 2348 v30 = pParty->uDaysPlayed % 7 + 1; |
2349 LOBYTE(v30) = v30 | 0x80; | |
2350 _42777D_CastSpell_UseWand_ShootArrow(SPELL_AIR_WIZARD_EYE, uActiveCharacter - 1, v30, 48, 0); | |
1298 | 2351 } |
1622 | 2352 if ( v26->uReputation <= -10 ) |
1298 | 2353 { |
1622 | 2354 v30 = pParty->uDaysPlayed % 7 + 1; |
2355 LOBYTE(v30) = v30 | 0x80; | |
2356 _42777D_CastSpell_UseWand_ShootArrow(SPELL_SPIRIT_PRESERVATION, uActiveCharacter - 1, v30, 48, 0); | |
2357 } | |
2358 if ( v26->uReputation <= -15 ) | |
2359 { | |
2360 v30 = pParty->uDaysPlayed % 7 + 1; | |
2361 LOBYTE(v30) = v30 | 0x80; | |
2362 _42777D_CastSpell_UseWand_ShootArrow(SPELL_BODY_PROTECTION_FROM_MAGIC, uActiveCharacter - 1, v30, 48, 0); | |
2363 } | |
2364 if ( v26->uReputation <= -20 ) | |
2365 { | |
2366 v30 = pParty->uDaysPlayed % 7 + 1; | |
2367 LOBYTE(v30) = v30 | 0x80; | |
2368 _42777D_CastSpell_UseWand_ShootArrow(SPELL_LIGHT_HOUR_OF_POWER, uActiveCharacter - 1, v30, 48, 0); | |
1298 | 2369 } |
1622 | 2370 if ( v26->uReputation <= -25 ) |
2371 { | |
2372 v30 = pParty->uDaysPlayed % 7 + 1; | |
2373 LOBYTE(v30) = v30 | 0x80; | |
2374 _42777D_CastSpell_UseWand_ShootArrow(SPELL_LIGHT_DAY_OF_PROTECTION, uActiveCharacter - 1, v30, 48, 0); | |
2375 } | |
1612 | 2376 } |
1622 | 2377 ++byte_F8B1EF[uActiveCharacter]; |
2378 pPlayers[uActiveCharacter]->PlaySound(SPEECH_83, 0); | |
2379 ShowStatusBarString(pGlobalTXT_LocalizationStrings[527], 2); // "Thank You!" | |
2380 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
1612 | 2381 return; |
1622 | 2382 } |
2383 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);//"У вас не хватает золота" | |
2384 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful); | |
2385 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
2386 return; | |
1612 | 2387 } |
2388 //------------------------------------------------ | |
2389 if ( dialog_menu_id == HOUSE_DIALOGUE_LEARN_SKILLS ) | |
2390 { | |
2391 if ( HouseUI_CheckIfPlayerCanInteract() ) | |
2392 { | |
2393 all_text_height = 0; | |
2394 pCurrentItem = (signed __int64)(p2DEvents[(signed int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0); | |
2395 v64 = (signed int)(pCurrentItem * (100 - pPlayers[uActiveCharacter]->GetMerchant())) / 100; | |
2396 if ( v64 < (signed int)pCurrentItem / 3 ) | |
2397 v64 = (signed int)pCurrentItem / 3; | |
2398 pCurrentItem = 0; | |
1622 | 2399 for ( int i = pDialogueWindow->pStartingPosActiveItem; i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) |
1612 | 2400 { |
1622 | 2401 if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][pDialogueWindow->GetControl(i)->msg_param - 36] |
2402 && !pPlayers[uActiveCharacter]->pActiveSkills[pDialogueWindow->GetControl(i)->msg_param - 36] ) | |
1298 | 2403 { |
1622 | 2404 all_text_height += pFontArrus->CalcTextHeight(pSkillNames[pDialogueWindow->GetControl(i)->msg_param - 36], &tample_window, 0, 0); |
1612 | 2405 ++pCurrentItem; |
2406 } | |
2407 } | |
2408 if ( pCurrentItem ) | |
2409 { | |
2410 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[401], v64); | |
2411 tample_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3); | |
2412 v64 = (149 - (signed int)all_text_height) / (signed int)pCurrentItem; | |
2413 if ( v64 > 32 ) | |
2414 v64 = 32; | |
1622 | 2415 all_text_height = (signed int)(149 - pCurrentItem * v64 - (int)all_text_height) / 2 - v64 / 2 + 162; |
2416 if ( pDialogueWindow->pStartingPosActiveItem < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton ) | |
1612 | 2417 { |
1622 | 2418 pCurrentItem = 2; |
2419 for ( int i = pDialogueWindow->pStartingPosActiveItem; | |
2420 i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) | |
1612 | 2421 { |
1622 | 2422 pButton = pDialogueWindow->GetControl(i); |
2423 if ( !byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][pButton->msg_param - 36] | |
2424 || pPlayers[uActiveCharacter]->pActiveSkills[pButton->msg_param - 36] ) | |
1298 | 2425 { |
1622 | 2426 pButton->uW = 0; |
2427 pButton->uHeight = 0; | |
2428 pButton->uY = 0; | |
1612 | 2429 } |
2430 else | |
2431 { | |
1622 | 2432 pButton->uY = v64 + all_text_height; |
2433 pTextHeight = pFontArrus->CalcTextHeight(pSkillNames[pButton->msg_param - 36], &tample_window, 0, 0); | |
2434 pButton->uHeight = pTextHeight; | |
2435 pButton->uW = pButton->uY + pTextHeight - 1; | |
2436 all_text_height = pButton->uW; | |
2069 | 2437 pTextColor = Color16(0xFFu, 0xFFu, 0x9Bu); |
1622 | 2438 if ( pDialogueWindow->pCurrentPosActiveItem != pCurrentItem ) |
2069 | 2439 pTextColor = Color16(0xFFu, 0xFFu, 0xFFu); |
1622 | 2440 tample_window.DrawTitleText(pFontArrus, 0, pButton->uY, pTextColor, pSkillNames[pButton->msg_param - 36], 3); |
1298 | 2441 } |
1622 | 2442 pCurrentItem++; |
1612 | 2443 } |
1298 | 2444 } |
1612 | 2445 } |
2446 else | |
2447 { | |
1624 | 2448 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]);//"Советую вам %s %s поискать знания еще где-нибудь" |
1612 | 2449 strcat(pTmpBuf.data(), "\n \n"); |
1624 | 2450 strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]);//"Больше ничего не могу предложить." |
1612 | 2451 pTextHeight = pFontArrus->CalcTextHeight(pTmpBuf.data(), &tample_window, 0, 0); |
2069 | 2452 tample_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, Color16(0xFFu, 0xFFu, 0x9Bu), pTmpBuf.data(), 3); |
1612 | 2453 } |
1298 | 2454 } |
1612 | 2455 } |
2456 return; | |
2457 } | |
1298 | 2458 |
2459 //----- (004B4710) -------------------------------------------------------- | |
2460 void TrainingDialog() | |
2461 { | |
2462 unsigned __int64 v5; // edi@3 | |
2463 int v8; // edx@4 | |
2464 double v9; // st7@6 | |
2465 signed int v10; // esi@6 | |
1625 | 2466 int pPrice; // ecx@6 |
1298 | 2467 signed int v14; // esi@14 |
2468 int v16; // eax@16 | |
2469 int v19; // ecx@24 | |
2470 int v33; // eax@36 | |
2471 unsigned int v36; // eax@38 | |
2472 unsigned int v42; // eax@46 | |
1625 | 2473 int index; |
2474 int all_text_height; // eax@68 | |
1298 | 2475 int v49; // ebx@69 |
1625 | 2476 GUIButton *pButton; // eax@71 |
2477 int pTextHeight; // eax@71 | |
2478 unsigned __int16 pTextColor; // ax@71 | |
2479 GUIWindow training_dialog_window; // [sp+Ch] [bp-78h]@1 | |
1298 | 2480 int v69; // [sp+70h] [bp-14h]@6 |
2481 int v73; // [sp+80h] [bp-4h]@14 | |
2482 | |
1625 | 2483 memcpy(&training_dialog_window, window_SpeakInHouse, sizeof(training_dialog_window)); |
2484 training_dialog_window.uFrameX = 483; | |
2485 training_dialog_window.uFrameWidth = 148; | |
2486 training_dialog_window.uFrameZ = 334; | |
1298 | 2487 v5 = 1000ui64 * pPlayers[uActiveCharacter]->uLevel * (pPlayers[uActiveCharacter]->uLevel + 1) / 2; // E n = n(n + 1) / 2 |
1634 | 2488 //v68 = pMaxLevelPerTrainingHallType[(unsigned int)window_SpeakInHouse->ptr_1C - HOUSE_TRAINING_HALL_EMERALD_ISLE]; |
1298 | 2489 if (pPlayers[uActiveCharacter]->uExperience >= v5) |
2490 { | |
2491 v8 = pPlayers[uActiveCharacter]->classType % 4 + 1; | |
2492 if ( v8 == 4 ) | |
2493 v8 = 3; | |
2494 v9 = (double)pPlayers[uActiveCharacter]->uLevel; | |
2495 v69 = v8; | |
2496 v10 = (signed __int64)(v9 * p2DEvents[(signed int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier * (double)v8); | |
1625 | 2497 pPrice = v10 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; |
2498 if ( pPrice < v10 / 3 ) | |
2499 pPrice = v10 / 3; | |
1298 | 2500 } |
1625 | 2501 //------------------------------------------------------- |
2502 all_text_height = 0; | |
1393 | 2503 if (HouseUI_CheckIfPlayerCanInteract()) |
1298 | 2504 { |
1625 | 2505 if ( dialog_menu_id == HOUSE_DIALOGUE_MAIN ) |
1298 | 2506 { |
1625 | 2507 if (HouseUI_CheckIfPlayerCanInteract()) |
1298 | 2508 { |
1625 | 2509 index = 0; |
2510 pShopOptions[0] = pTmpBuf.data(); | |
1843
2e6d3cd052e0
some char* cast removal + adding const_casts where appropriate
Grumpy7
parents:
1838
diff
changeset
|
2511 pShopOptions[1] = const_cast<char *>(pGlobalTXT_LocalizationStrings[160]);// "Learn Skills" |
1625 | 2512 if ( pDialogueWindow->pStartingPosActiveItem < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton ) |
1298 | 2513 { |
1625 | 2514 for ( int i = pDialogueWindow->pStartingPosActiveItem; |
2515 i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) | |
1298 | 2516 { |
1625 | 2517 if ( pDialogueWindow->GetControl(i)->msg_param == HOUSE_DIALOGUE_TRAININGHALL_TRAIN ) |
1298 | 2518 { |
1634 | 2519 if (pPlayers[uActiveCharacter]->uLevel >= pMaxLevelPerTrainingHallType[(unsigned int)window_SpeakInHouse->ptr_1C - HOUSE_TRAINING_HALL_EMERALD_ISLE]) |
1625 | 2520 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." |
2521 else | |
1298 | 2522 { |
1625 | 2523 if (pPlayers[uActiveCharacter]->uExperience < v5) |
2524 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" | |
2525 else | |
2526 sprintfex(pShopOptions[index], pGlobalTXT_LocalizationStrings[537], pPlayers[uActiveCharacter]->uLevel + 1, pPrice); // "Train to level %d for %d gold" | |
1298 | 2527 } |
2528 } | |
1625 | 2529 all_text_height += pFontArrus->CalcTextHeight(pShopOptions[index], &training_dialog_window, 0, 0); |
2530 ++index; | |
1298 | 2531 } |
2532 } | |
1625 | 2533 v49 = (2 * (87 - (174 - all_text_height) / 2) - all_text_height) / 2 - (174 - all_text_height) / 2 / 2 + 138; |
2534 if (pDialogueWindow->pStartingPosActiveItem < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton) | |
2535 { | |
2536 index = 0; | |
2537 for ( int i = pDialogueWindow->pStartingPosActiveItem; | |
2538 i < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton; ++i ) | |
2539 { | |
2540 pButton = pDialogueWindow->GetControl(i); | |
2541 pButton->uY = (174 - all_text_height) / 2 + v49; | |
2542 pTextHeight = pFontArrus->CalcTextHeight(pShopOptions[index], &training_dialog_window, 0, 0); | |
2543 pButton->uHeight = pTextHeight; | |
2544 pButton->uW = pTextHeight + pButton->uY - 1; | |
2545 v49 = pButton->uW; | |
2069 | 2546 pTextColor = Color16(0xE1u, 0xCDu, 0x23u); |
1634 | 2547 if ( pDialogueWindow->pCurrentPosActiveItem != i ) |
2069 | 2548 pTextColor = Color16(255, 255, 255); |
1625 | 2549 training_dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pTextColor, pShopOptions[index], 3); |
2550 ++index; | |
2551 } | |
2552 } | |
1298 | 2553 } |
1625 | 2554 } |
2555 //------------------------------------------------------------------ | |
2556 if ( dialog_menu_id == HOUSE_DIALOGUE_TRAININGHALL_TRAIN ) | |
2557 { | |
1393 | 2558 if ( !HouseUI_CheckIfPlayerCanInteract() ) |
1298 | 2559 { |
1625 | 2560 v33 = pFontArrus->CalcTextHeight(pNPCTopics[122].pText, &training_dialog_window, 0, 0); |
2069 | 2561 training_dialog_window.DrawTitleText(pFontArrus, 0, (212 - v33) / 2 + 101, Color16(0xE1u, 0xCDu, 0x23u), pNPCTopics[122].pText, 3); |
1298 | 2562 pDialogueWindow->pNumPresenceButton = 0; |
2563 return; | |
2564 } | |
1634 | 2565 if ( pPlayers[uActiveCharacter]->uLevel < pMaxLevelPerTrainingHallType[(unsigned int)window_SpeakInHouse->ptr_1C - HOUSE_TRAINING_HALL_EMERALD_ISLE] ) |
1298 | 2566 { |
2567 if ( (signed __int64)pPlayers[uActiveCharacter]->uExperience >= v5 ) | |
2568 { | |
1625 | 2569 if ( pParty->uNumGold >= pPrice) |
1298 | 2570 { |
1625 | 2571 Party::TakeGold(pPrice); |
1298 | 2572 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful); |
2573 ++pPlayers[uActiveCharacter]->uLevel; | |
2574 pPlayers[uActiveCharacter]->uSkillPoints += pPlayers[uActiveCharacter]->uLevel / 10 + 5; | |
2575 pPlayers[uActiveCharacter]->sHealth = pPlayers[uActiveCharacter]->GetMaxHealth(); | |
2576 pPlayers[uActiveCharacter]->sMana = pPlayers[uActiveCharacter]->GetMaxMana(); | |
2577 uint max_level_in_party = player_levels[0]; | |
2578 for (uint _it = 1; _it < 4; ++_it) | |
2579 { | |
2580 if (player_levels[_it] > max_level_in_party) | |
2581 max_level_in_party = player_levels[_it]; | |
2582 } | |
2583 ++player_levels[uActiveCharacter - 1]; | |
2584 if (player_levels[uActiveCharacter - 1] > max_level_in_party) // if we reach new maximum party level | |
2585 // feature is broken thou, since this array is always zeroed in EnterHouse | |
2586 { | |
1625 | 2587 v42 = 60 * (_494820_training_time(pParty->uCurrentHour) + 4) - pParty->uCurrentMinute; |
1298 | 2588 if ((unsigned int)window_SpeakInHouse->ptr_1C == HOUSE_TRAINING_HALL_94 || |
2589 (unsigned int)window_SpeakInHouse->ptr_1C == HOUSE_TRAINING_HALL_95) | |
2590 v42 += 720; | |
2591 RestAndHeal((signed int)(v42 + 10080)); | |
2592 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor ) | |
2593 pOutdoor->SetFog(); | |
2594 } | |
2595 pPlayers[uActiveCharacter]->PlaySound(SPEECH_87, 0); | |
2596 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[430], pPlayers[uActiveCharacter]->pName, pPlayers[uActiveCharacter]->uLevel, pPlayers[uActiveCharacter]->uLevel / 10 + 5);// | |
2597 // "%s is now Level %lu and has earned %lu Skill Points!" | |
2598 ShowStatusBarString(pTmpBuf.data(), 2); | |
2599 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
2600 return; | |
2601 } | |
2602 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);// "You don't have enough gold" | |
1625 | 2603 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)4); |
1298 | 2604 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); |
2605 return; | |
2606 } | |
1625 | 2607 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[538], (unsigned int)(v5 - pPlayers[uActiveCharacter]->uExperience), pPlayers[uActiveCharacter]->uLevel + 1);// |
1298 | 2608 // "You need %d more experience to train to level %d" |
1625 | 2609 v36 = (212 - pFontArrus->CalcTextHeight(pTmpBuf.data(), &training_dialog_window, 0, 0)) / 2 + 88; |
1298 | 2610 } |
2611 else | |
2612 { | |
2613 sprintf(pTmpBuf.data(), "%s\n \n%s", pGlobalTXT_LocalizationStrings[536], pGlobalTXT_LocalizationStrings[529]);// | |
2614 // ""With your skills, you should be working here as a teacher."" | |
2615 // ""Sorry, but we are unable to train you."" | |
1625 | 2616 v36 = (212 - pFontArrus->CalcTextHeight(pTmpBuf.data(), &training_dialog_window, 0, 0)) / 2 + 101; |
1298 | 2617 } |
2069 | 2618 training_dialog_window.DrawTitleText(pFontArrus, 0, v36, Color16(0xE1u, 0xCDu, 0x23u), pTmpBuf.data(), 3); |
1625 | 2619 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)3); |
2620 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
2621 return; | |
1298 | 2622 } |
1625 | 2623 } |
2624 //------------------------------------------------------------- | |
2625 if ( dialog_menu_id == HOUSE_DIALOGUE_LEARN_SKILLS ) | |
2626 { | |
1393 | 2627 if (HouseUI_CheckIfPlayerCanInteract()) |
1298 | 2628 { |
1625 | 2629 v14 = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0); |
1634 | 2630 pPrice = v14 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; |
2631 if ( pPrice < v14 / 3 ) | |
2632 pPrice = v14 / 3; | |
1625 | 2633 index = 0; |
1634 | 2634 for ( int i = pDialogueWindow->pStartingPosActiveItem; |
2635 (signed int)i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) | |
1625 | 2636 { |
1634 | 2637 if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][pDialogueWindow->GetControl(i)->msg_param - 36] |
2638 && !pPlayers[uActiveCharacter]->pActiveSkills[pDialogueWindow->GetControl(i)->msg_param - 36] ) | |
1625 | 2639 { |
1634 | 2640 all_text_height += pFontArrus->CalcTextHeight(pSkillNames[pDialogueWindow->GetControl(i)->msg_param - 36], &training_dialog_window, 0, 0); |
1625 | 2641 ++index; |
2642 } | |
2643 } | |
2644 if ( index ) | |
1298 | 2645 { |
1634 | 2646 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[401], pPrice);// "Skill Cost: %lu" |
1625 | 2647 training_dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3); |
2648 v73 = (signed int)(149 - all_text_height) / index; | |
2649 if ( v73 > 32 ) | |
2650 v73 = 32; | |
2651 v19 = (signed int)(149 - index * v73 - all_text_height) / 2 - v73 / 2 + 162; | |
1634 | 2652 for ( int i = pDialogueWindow->pStartingPosActiveItem; |
2653 (signed int)i < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton; ++i ) | |
1298 | 2654 { |
1634 | 2655 pButton = pDialogueWindow->GetControl(i); |
2656 if ( !byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][pButton->msg_param - 36] | |
2657 || pPlayers[uActiveCharacter]->pActiveSkills[pButton->msg_param - 36] ) | |
1298 | 2658 { |
1634 | 2659 pButton->uW = 0; |
2660 pButton->uHeight = 0; | |
2661 pButton->uY = 0; | |
1298 | 2662 } |
1634 | 2663 else |
2664 { | |
2665 pButton->uY = v73 + v19; | |
2666 pTextHeight = pFontArrus->CalcTextHeight(pSkillNames[pButton->msg_param - 36], &training_dialog_window, 0, 0); | |
2667 pButton->uHeight = pTextHeight; | |
2668 pButton->uW = pButton->uY + pTextHeight - 1; | |
2669 v19 = pButton->uY + pTextHeight - 1; | |
2069 | 2670 pTextColor = Color16(0xE1u, 0xCDu, 0x23u); |
1634 | 2671 if ( pDialogueWindow->pCurrentPosActiveItem != i ) |
2069 | 2672 pTextColor = Color16(255, 255, 255); |
1634 | 2673 training_dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pTextColor, pSkillNames[pButton->msg_param - 36], 3); |
2674 } | |
1298 | 2675 } |
2676 } | |
1625 | 2677 else |
1298 | 2678 { |
1625 | 2679 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]);// |
2680 // "Seek knowledge elsewhere %s the %s" | |
2681 strcat(pTmpBuf.data(), "\n \n"); | |
2682 strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]);// "I can offer you nothing further." | |
1634 | 2683 pTextHeight = pFontArrus->CalcTextHeight(pTmpBuf.data(), &training_dialog_window, 0, 0); |
2069 | 2684 training_dialog_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, Color16(0xE1u, 0xCDu, 0x23u), pTmpBuf.data(), 3); |
1298 | 2685 } |
2686 } | |
2687 } | |
1625 | 2688 return; |
1298 | 2689 } |
2690 | |
2691 //----- (004B6478) -------------------------------------------------------- | |
2692 void sub_4B6478() | |
1634 | 2693 { |
1298 | 2694 unsigned int v2; // eax@1 |
2695 signed int v3; // esi@1 | |
1634 | 2696 int pPrice; // ebx@1 |
1298 | 2697 unsigned int v5; // esi@5 |
2698 int v6; // edi@6 | |
2699 int result; // eax@13 | |
1653 | 2700 int all_text_height; // eax@20 |
1298 | 2701 int v13; // eax@21 |
1634 | 2702 GUIButton *pButton; // esi@27 |
1298 | 2703 unsigned int v16; // eax@28 |
1634 | 2704 int pTextHeight; // eax@29 |
2705 unsigned __int16 pTextColor; // ax@29 | |
1298 | 2706 unsigned __int16 v22; // ST14_2@36 |
2707 int v27; // [sp-4h] [bp-80h]@8 | |
1634 | 2708 GUIWindow dialog_window; // [sp+Ch] [bp-70h]@1 |
1298 | 2709 int v32; // [sp+6Ch] [bp-10h]@1 |
1653 | 2710 int index; // [sp+74h] [bp-8h]@17 |
1298 | 2711 |
1634 | 2712 memcpy(&dialog_window, window_SpeakInHouse, sizeof(dialog_window)); |
2713 dialog_window.uFrameX = 483; | |
2714 dialog_window.uFrameWidth = 148; | |
2715 dialog_window.uFrameZ = 334; | |
2716 v2 = 52 * (unsigned int)window_SpeakInHouse->ptr_1C; | |
2717 v32 = (unsigned __int8)(((p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType != 18) - 1) & 0x96) + 100; | |
2718 v3 = (signed __int64)((double)v32 * p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier); | |
2719 pPrice = v3 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; | |
2720 if ( pPrice < v3 / 3 ) | |
2721 pPrice = v3 / 3; | |
2722 if ( dialog_menu_id == HOUSE_DIALOGUE_MAIN) | |
1298 | 2723 { |
1634 | 2724 if ( !(unsigned __int16)_449B57_test_bit((unsigned __int8 *)pPlayers[uActiveCharacter]->_achieved_awards_bits, word_4F0754[2 * (unsigned int)window_SpeakInHouse->ptr_1C]) ) |
2725 { | |
2726 pTextHeight = pFontArrus->CalcTextHeight(pNPCTopics[171].pText, &dialog_window, 0, 0);// | |
2069 | 2727 dialog_window.DrawTitleText(pFontArrus, 0, (212 - pTextHeight) / 2 + 101, Color16(0xFFu, 0xFFu, 0x9Bu), pNPCTopics[171].pText, 3); |
1634 | 2728 pDialogueWindow->pNumPresenceButton = 0; |
1636 | 2729 return; |
1634 | 2730 } |
2731 if ( !HouseUI_CheckIfPlayerCanInteract() ) | |
2732 return; | |
1653 | 2733 all_text_height = 0; |
2734 index = 0; | |
1634 | 2735 for ( int i = pDialogueWindow->pStartingPosActiveItem; |
2736 i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) | |
2737 { | |
2738 if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType / 3][pDialogueWindow->GetControl(i)->msg_param - 36] | |
2739 && !pPlayers[uActiveCharacter]->pActiveSkills[pDialogueWindow->GetControl(i)->msg_param - 36] ) | |
2740 { | |
1653 | 2741 all_text_height += pFontArrus->CalcTextHeight(pSkillNames[pDialogueWindow->GetControl(i)->msg_param - 36], &dialog_window, 0, 0); |
2742 ++index; | |
1634 | 2743 } |
2744 } | |
1653 | 2745 if ( !index ) |
1298 | 2746 { |
1634 | 2747 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]); |
2748 strcat(pTmpBuf.data(), "\n \n"); | |
2749 strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]);//Больше ничего не могу предложить. | |
2750 pTextHeight = pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 0, 0); | |
2069 | 2751 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, Color16(0xFFu, 0xFFu, 0x9Bu), pTmpBuf.data(), 3); |
1634 | 2752 return; |
2753 } | |
2754 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[401], pPrice);//Стоимость навыка: %lu | |
2755 dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3); | |
1653 | 2756 v32 = (149 - all_text_height) / index; |
2757 if ( v32 > 32 ) | |
1634 | 2758 v32 = 32; |
1653 | 2759 index = (149 - index * v32 - all_text_height) / 2 - v32 / 2 + 162; |
1634 | 2760 if ( pDialogueWindow->pStartingPosActiveItem < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton ) |
2761 { | |
2762 for ( int i = pDialogueWindow->pStartingPosActiveItem; | |
2763 i <pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) | |
1298 | 2764 { |
1634 | 2765 pButton = pDialogueWindow->GetControl(i); |
2766 if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType / 3][pButton->msg_param - 36] ) | |
1298 | 2767 { |
1634 | 2768 if ( !pPlayers[uActiveCharacter]->pActiveSkills[pButton->msg_param - 36] ) |
2769 { | |
1653 | 2770 pButton->uY = v32 + index; |
1634 | 2771 pTextHeight = pFontArrus->CalcTextHeight(pSkillNames[pButton->msg_param - 36], &dialog_window, 0, 0); |
2772 pButton->uHeight = pTextHeight; | |
2773 pButton->uW = pButton->uY + pTextHeight - 1; | |
1653 | 2774 index = pButton->uY + pTextHeight - 1; |
2069 | 2775 pTextColor = Color16(0xFFu, 0xFFu, 0x9Bu); |
1634 | 2776 if ( pDialogueWindow->pCurrentPosActiveItem != i ) |
2069 | 2777 pTextColor = Color16(0xFFu, 0xFFu, 0xFFu); |
1634 | 2778 dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pTextColor, pSkillNames[pButton->msg_param - 36], 3); |
2779 } | |
1298 | 2780 } |
2781 else | |
2782 { | |
1634 | 2783 pButton->uW = 0; |
2784 pButton->uHeight = 0; | |
2785 pButton->uY = 0; | |
1298 | 2786 } |
2787 } | |
2788 } | |
1634 | 2789 return; |
2790 } | |
2791 | |
2792 if ( HouseUI_CheckIfPlayerCanInteract() ) | |
2793 { | |
2794 v5 = 0; | |
2795 __debugbreak(); | |
2796 //pSkillAvailabilityPerClass[8 + v58->uClass][4 + v23] | |
2797 // or | |
2798 //byte_4ED970_skill_learn_ability_by_class_table[v58->uClass][v23 - 36] | |
2799 // or | |
2800 //byte_4ED970_skill_learn_ability_by_class_table[v58->uClass - 1][v23 + 1] | |
2801 __debugbreak(); // whacky condition - fix | |
2802 if (false | |
2803 //if ( !*(&byte_4ED94C[37 * v1->uClass / 3] + dword_F8B19C) | |
2804 || (v6 = (int)(&pPlayers[uActiveCharacter]->uIntelligence + dialog_menu_id), *(short *)v6) ) | |
2805 { | |
1754 | 2806 pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0); |
1634 | 2807 } |
1298 | 2808 else |
2809 { | |
1634 | 2810 if ( pParty->uNumGold < pPrice ) |
1298 | 2811 { |
1634 | 2812 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);//У вас не хватает золота |
2813 v27 = 4; | |
1298 | 2814 } |
2815 else | |
2816 { | |
1634 | 2817 Party::TakeGold(pPrice); |
2818 *(short *)v6 = 1; | |
2819 v27 = 2; | |
1298 | 2820 } |
1634 | 2821 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)v27); |
1298 | 2822 } |
2823 } | |
1634 | 2824 else |
2825 { | |
2826 v5 = 0; | |
2827 } | |
2828 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, v5); | |
2829 return; // void func | |
1298 | 2830 } |
2831 | |
2832 //----- (004B2A74) -------------------------------------------------------- | |
1634 | 2833 void SimpleHouseDialog() |
1298 | 2834 { |
1580 | 2835 NPCData *pNPC; // esi@6 |
1298 | 2836 char *v15; // esi@14 |
1580 | 2837 GUIButton *pButton; // eax@15 |
1298 | 2838 char *v29; // esi@42 |
2839 int v31; // ST1C_4@42 | |
1653 | 2840 int index; // esi@51 |
2841 int v36; | |
2842 signed int all_text_height; // ecx@54 | |
1298 | 2843 int v40; // edi@57 |
1653 | 2844 unsigned __int16 pTextColor; // ax@60 |
2845 GUIFont *pTextFont; // ebx@64 | |
2846 int pTextHeight; | |
1298 | 2847 GUIWindow w; // [sp+Ch] [bp-110h]@64 |
1636 | 2848 GUIWindow right_panel_window; // [sp+60h] [bp-BCh]@13 |
1580 | 2849 GUIWindow house_window; // [sp+B4h] [bp-68h]@1 |
1298 | 2850 char *pInString; // [sp+114h] [bp-8h]@12 |
2851 | |
1580 | 2852 memcpy(&house_window, pDialogueWindow, sizeof(house_window)); |
1298 | 2853 if ( pDialogueNPCCount == uNumDialogueNPCPortraits && uHouse_ExitPic ) |
2854 { | |
1580 | 2855 house_window.uFrameX = 493; |
2856 house_window.uFrameWidth = 126; | |
2857 house_window.uFrameZ = 366; | |
2858 house_window.DrawTitleText(pFontCreate, 0, 2, 0, pMapStats->pInfos[uHouse_ExitPic].pName, 3); | |
2859 house_window.uFrameX = 483; | |
2860 house_window.uFrameWidth = 148; | |
2861 house_window.uFrameZ = 334; | |
1653 | 2862 if ( !pTransitionStrings[uHouse_ExitPic] ) |
1298 | 2863 { |
1580 | 2864 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[411], pMapStats->pInfos[uHouse_ExitPic].pName);//Войти в ^Pv[%s] |
1653 | 2865 house_window.DrawTitleText(pFontCreate, 0, (212 - pFontCreate->CalcTextHeight(pTmpBuf.data(), &house_window, 0, 0)) / 2 + 101, 0, pTmpBuf.data(), 3); |
2866 return; | |
1298 | 2867 } |
1653 | 2868 house_window.DrawTitleText(pFontCreate, 0, |
2869 (212 - pFontCreate->CalcTextHeight(pTransitionStrings[uHouse_ExitPic], &house_window, 0, 0)) / 2 + 101, 0, pTransitionStrings[uHouse_ExitPic], 3); | |
1298 | 2870 return; |
2871 } | |
1580 | 2872 house_window.uFrameWidth -= 10; |
2873 house_window.uFrameZ -= 10; | |
2874 pNPC = HouseNPCData[(unsigned int)((char *)pDialogueNPCCount + -(dword_591080 != 0) )];//- 1 | |
2875 if ( pNPC->uProfession ) | |
2876 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[429], pNPC->pName, aNPCProfessionNames[pNPC->uProfession]);//^Pi[%s] %s | |
1298 | 2877 else |
1580 | 2878 strcpy(pTmpBuf.data(), pNPC->pName); |
2069 | 2879 house_window.DrawTitleText(pFontCreate, 483, 113, Color16(0x15u, 0x99u, 0xE9u), pTmpBuf.data(), 3); |
1298 | 2880 if ( !dword_591080 ) |
2881 { | |
2882 if ( !uDialogueType ) | |
2883 { | |
1580 | 2884 if ( pNPC->greet ) |
1298 | 2885 { |
1580 | 2886 house_window.uFrameWidth = game_viewport_width; |
2887 house_window.uFrameZ = 452; | |
1655 | 2888 pInString = pNPCStats->pNPCGreetings[pNPC->greet].pGreetings[((pNPC->uFlags & 3) == 2)]; |
1653 | 2889 //pInString = (char *)*(&pNPCStats->field_17884 + ((pNPC->uFlags & 3) == 2) + 2 * pNPC->greet); |
1580 | 2890 pRenderer->GetLeather(8, 352 - (pFontArrus->CalcTextHeight(pInString, &house_window, 13, 0) + 7), |
2891 pIcons_LOD->GetTexture(uTextureID_Leather), pIcons_LOD->GetTexture(uTextureID_Leather)->uTextureHeight | |
2892 - (pFontArrus->CalcTextHeight(pInString, &house_window, 13, 0) + 7)); | |
2893 pRenderer->DrawTextureIndexed(8, 347 - (pFontArrus->CalcTextHeight(pInString, &house_window, 13, 0) + 7), pTexture_591428); | |
2894 pDialogueWindow->DrawText(pFontArrus, 13, 354 - (pFontArrus->CalcTextHeight(pInString, &house_window, 13, 0) + 7), | |
2895 0, FitTextInAWindow(pInString, pFontArrus, &house_window, 0xDu, 0), 0, 0, 0); | |
1298 | 2896 } |
2897 } | |
2898 } | |
1636 | 2899 //for right panel |
2900 memcpy(&right_panel_window, pDialogueWindow, sizeof(right_panel_window)); | |
2901 right_panel_window.uFrameX = 483; | |
2902 right_panel_window.uFrameWidth = 148; | |
2903 right_panel_window.uFrameZ = 334; | |
2904 for ( int i = right_panel_window.pStartingPosActiveItem; | |
2905 i < right_panel_window.pStartingPosActiveItem + right_panel_window.pNumPresenceButton; ++i ) | |
1298 | 2906 { |
1636 | 2907 pButton = right_panel_window.GetControl(i); |
2908 switch ( pButton->msg_param ) | |
1298 | 2909 { |
1636 | 2910 case 19://evt_A |
1661 | 2911 v15 = (char *)pNPCTopics[pNPC->evt_A].pTopic; |
1636 | 2912 if ( !v15 ) |
1298 | 2913 { |
1636 | 2914 pButton->msg_param = 0; |
2915 v15 = ""; | |
1298 | 2916 } |
1636 | 2917 strcpy(pButton->pButtonName, v15); |
2918 continue; | |
2919 case 20://evt_B | |
1661 | 2920 v15 = (char *)pNPCTopics[pNPC->evt_B].pTopic; |
1636 | 2921 if ( !v15 ) |
1298 | 2922 { |
1636 | 2923 pButton->msg_param = 0; |
2924 v15 = ""; | |
2925 } | |
1653 | 2926 if ( uDialogueType != 84 ) |
1636 | 2927 { |
1653 | 2928 strcpy(pButton->pButtonName, v15); |
1636 | 2929 continue; |
2930 } | |
2069 | 2931 sprintf(pTmpBuf.data(), format_4E2D80, Color16(0xE1u, 0xCDu, 0x23u), pItemsTable->pItems[contract_approved].pUnidentifiedName); |
1653 | 2932 sprintf(pTmpBuf2.data(), current_npc_text, pTmpBuf.data()); |
2933 current_npc_text = pTmpBuf2.data(); | |
2934 strcpy(pButton->pButtonName, v15); | |
2935 continue; | |
2936 case 21://evt_C | |
1661 | 2937 v15 = (char *)pNPCTopics[pNPC->evt_C].pTopic; |
1653 | 2938 if ( !v15 ) |
1636 | 2939 { |
1653 | 2940 pButton->msg_param = 0; |
2941 v15 = ""; | |
2942 } | |
2943 strcpy(pButton->pButtonName, v15); | |
2944 continue; | |
2945 case 22://evt_D | |
1661 | 2946 v15 = (char *)pNPCTopics[pNPC->evt_D].pTopic; |
1653 | 2947 if ( !v15 ) |
2948 { | |
2949 pButton->msg_param = 0; | |
2950 v15 = ""; | |
2951 } | |
2952 strcpy(pButton->pButtonName, v15); | |
2953 continue; | |
2954 case 23://evt_E | |
1661 | 2955 v15 = (char *)pNPCTopics[pNPC->evt_E].pTopic; |
1653 | 2956 if ( !v15 ) |
2957 { | |
2958 pButton->msg_param = 0; | |
2959 v15 = ""; | |
1298 | 2960 } |
1653 | 2961 strcpy(pButton->pButtonName, v15); |
2962 continue; | |
2963 case 24://evt_F | |
1661 | 2964 v15 = (char *)pNPCTopics[pNPC->evt_F].pTopic; |
1653 | 2965 if ( !v15 ) |
1636 | 2966 { |
1653 | 2967 pButton->msg_param = 0; |
2968 v15 = ""; | |
1636 | 2969 } |
1653 | 2970 strcpy(pButton->pButtonName, v15); |
2971 continue; | |
2972 case 76: | |
2973 strcpy(pButton->pButtonName, pGlobalTXT_LocalizationStrings[406]);//Нанять | |
2974 continue; | |
2975 case 77: | |
2976 strcpy(pButton->pButtonName, pGlobalTXT_LocalizationStrings[407]);//Подробнее | |
2977 continue; | |
2978 case 79: | |
2979 strcpy(pButton->pButtonName, _4B254D_SkillMasteryTeacher((int)right_panel_window.ptr_1C)); | |
2980 continue; | |
2981 case 82: | |
2982 strcpy(pButton->pButtonName, ContractSelectText((int)right_panel_window.ptr_1C)); | |
2983 continue; | |
2984 case 83: | |
2985 v29 = pMonsterStats->pInfos[bountyHunting_monster_id_for_hunting].pName; | |
2986 v31 = *(int *)v29; | |
2069 | 2987 sprintfex(pTmpBuf.data(), "\f%05d%s\f%05d", Color16(0xFFu, 0xFFu, 0x9Bu), v31, Color16(0xFFu, 0xFFu, 0xFFu)); |
1653 | 2988 sprintfex(pTmpBuf2.data(), bountyHunting_text, pTmpBuf.data(), 100 * (unsigned __int8)v29[8]); |
2989 current_npc_text = pTmpBuf2.data(); | |
2990 strcpy(pButton->pButtonName, ""); | |
2991 continue; | |
1298 | 2992 } |
1653 | 2993 if ( pButton->msg_param > 0 && pButton->msg_param < 13 ) |
2994 { | |
2995 strcpy(pButton->pButtonName, pGlobalTXT_LocalizationStrings[122]);//Вступить | |
2996 continue; | |
2997 } | |
2998 if ( pButton->msg_param > 13 && pButton->msg_param < 19 ) | |
2999 { | |
3000 strcpy(pButton->pButtonName, ""); | |
3001 continue; | |
3002 } | |
3003 if ( pButton->msg_param != 93 ) | |
3004 { | |
3005 strcpy(pButton->pButtonName, ""); | |
3006 continue; | |
3007 } | |
1298 | 3008 } |
1653 | 3009 index = 0; |
3010 all_text_height = 0; | |
3011 for ( int i = pDialogueWindow->pStartingPosActiveItem; | |
3012 i < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton; ++i ) | |
1298 | 3013 { |
1653 | 3014 pButton = pDialogueWindow->GetControl(i); |
3015 all_text_height += pFontArrus->CalcTextHeight(pButton->pButtonName, &right_panel_window, 0, 0); | |
3016 index++; | |
3017 } | |
3018 if ( index ) | |
3019 { | |
3020 v36 = (174 - all_text_height) / index; | |
3021 if ( v36 > 32 ) | |
3022 v36 = 32; | |
3023 v40 = (174 - v36 * index - all_text_height) / 2 - v36 / 2 + 138; | |
3024 for ( int i = pDialogueWindow->pStartingPosActiveItem; i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) | |
1298 | 3025 { |
1606 | 3026 pButton = pDialogueWindow->GetControl(i); |
1653 | 3027 pButton->uY = v36 + v40; |
3028 pTextHeight = pFontArrus->CalcTextHeight(pButton->pButtonName, &right_panel_window, 0, 0); | |
3029 pButton->uHeight = pTextHeight; | |
3030 v40 = pButton->uY + pTextHeight - 1; | |
1606 | 3031 pButton->uW = v40; |
2069 | 3032 pTextColor = Color16(0xE1u, 0xCDu, 0x23u); |
1653 | 3033 if ( pDialogueWindow->pCurrentPosActiveItem != i ) |
2069 | 3034 pTextColor = Color16(0xFFu, 0xFFu, 0xFFu); |
1653 | 3035 right_panel_window.DrawTitleText(pFontArrus, 0, pButton->uY, pTextColor, pButton->pButtonName, 3); |
1298 | 3036 } |
3037 } | |
3038 if ( current_npc_text ) | |
3039 { | |
3040 w.uFrameWidth = 458; | |
3041 w.uFrameZ = 457; | |
1653 | 3042 pTextFont = pFontArrus; |
3043 pTextHeight = pFontArrus->CalcTextHeight(current_npc_text, &w, 13, 0) + 7; | |
3044 if ( 352 - pTextHeight < 8 ) | |
1298 | 3045 { |
1653 | 3046 pTextFont = pFontCreate; |
3047 pTextHeight = pFontCreate->CalcTextHeight(current_npc_text, &w, 13, 0) + 7; | |
1298 | 3048 } |
1653 | 3049 pRenderer->GetLeather(8, 352 - pTextHeight, pIcons_LOD->GetTexture(uTextureID_Leather), pIcons_LOD->GetTexture(uTextureID_Leather)->uTextureHeight - pTextHeight); |
3050 pRenderer->DrawTextureIndexed(8, 347 - pTextHeight, pTexture_591428); | |
3051 house_window.DrawText(pTextFont, 13, 354 - pTextHeight, 0, FitTextInAWindow(current_npc_text, pTextFont, &w, 13, 0), 0, 0, 0); | |
1298 | 3052 } |
3053 } | |
1434 | 3054 |
1300 | 3055 //----- (004B4F4F) -------------------------------------------------------- |
3056 void JailDialog() | |
1298 | 3057 { |
1608 | 3058 GUIWindow jail_dialogue_window; // [sp+8h] [bp-54h]@1 |
1298 | 3059 |
1608 | 3060 memcpy(&jail_dialogue_window, window_SpeakInHouse, sizeof(jail_dialogue_window)); |
3061 jail_dialogue_window.uFrameX = 483; | |
3062 jail_dialogue_window.uFrameWidth = 148; | |
3063 jail_dialogue_window.uFrameZ = 334; | |
3064 jail_dialogue_window.DrawTitleText(pFontArrus, 0, (310 - pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[672], &jail_dialogue_window, 0, 0)) / 2 + 18, | |
2069 | 3065 Color16(0xFFu, 0xFFu, 0x9Bu), pGlobalTXT_LocalizationStrings[672], 3);//"За многочисленные преступления и злодеяния вы были приговорены к одному году заключения." |
1298 | 3066 } |