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