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