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