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