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