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