World of Might and Magic  0.2.0
Open reimplementation of Might and Magic 6 7 8 game engine
UIHouses.cpp
См. документацию.
1 #include <stdlib.h>
2 
4 
5 #include "Arcomage/Arcomage.h"
6 
7 #include "Engine/AssetsManager.h"
8 #include "Engine/Engine.h"
9 #include "Engine/Events.h"
10 #include "Engine/LOD.h"
11 #include "Engine/Localization.h"
12 #include "Engine/MapInfo.h"
13 #include "Engine/Party.h"
14 #include "Engine/SaveLoad.h"
15 #include "Engine/stru159.h"
16 
17 #include "Engine/Graphics/Image.h"
22 
24 
26 
27 #include "GUI/GUIButton.h"
28 #include "GUI/GUIFont.h"
29 #include "GUI/GUIWindow.h"
30 #include "GUI/UI/UIGame.h"
31 #include "GUI/UI/UIGuilds.h"
32 #include "GUI/UI/UIHouses.h"
33 #include "GUI/UI/UIPartyCreation.h"
34 #include "GUI/UI/UIShops.h"
35 #include "GUI/UI/UIStatusBar.h"
36 
37 #include "IO/Keyboard.h"
38 #include "IO/Mouse.h"
39 
41 #include "Media/MediaPlayer.h"
42 
44 
47 int dword_591080; // 591080
48 
51 
52 Image *_591428_endcap = nullptr;
53 
56 
57 #pragma pack(push, 1)
59  unsigned char uMapInfoID;
60  unsigned char pSchedule[7];
61  unsigned int uTravelTime;
62  int arrival_x;
63  int arrival_y;
64  int arrival_z;
66  unsigned int uQuestBit; // quest bit required to set for this travel option
67  // to be enabled; otherwise 0
68 };
69 #pragma pack(pop)
71  // location name days x y z
72  { MAP_STEADWICK, { 1, 0, 1, 0, 1, 0, 0 }, 2, -18048, 4636, 833, 1536, 0 }, // for stable
73  { MAP_PIERPONT, { 0, 1, 0, 1, 0, 1, 0 }, 2, -2527, -6773, 1153, 896, 0 },
74  { MAP_TATALIA, { 1, 0, 1, 0, 1, 0, 0 }, 2, 4730, -10580, 320, 1024, 0 },
75  { MAP_HARMONDALE, { 0, 1, 0, 1, 0, 1, 0 }, 2, -5692, 11137, 1, 1024, 0 },
76  { MAP_DEYJA, { 1, 0, 0, 1, 0, 0, 0 }, 3, 7227, -16007, 2625, 640, 0 },
77  { MAP_BRAKADA_DESERT, { 0, 0, 1, 0, 0, 1, 0 }, 3, 8923, 17191, 1, 512, 0 },
78  { MAP_AVLEE, { 1, 0, 1, 0, 1, 0, 0 }, 3, 17059, 12331, 512, 1152, 0 },
79  { MAP_DEYJA, { 0, 1, 0, 0, 1, 0, 1 }, 2, 7227, -16007, 2625, 640, 0 },
80  { MAP_HARMONDALE, { 0, 1, 0, 1, 0, 1, 0 }, 2, -5692, 11137, 1, 1024, 0 },
81  { MAP_STEADWICK, { 1, 0, 1, 0, 1, 0, 0 }, 3, -18048, 4636, 833, 1536, 0 },
82  { MAP_PIERPONT, { 0, 1, 0, 1, 0, 1, 0 }, 2, -2527, -6773, 1153, 896, 0 },
83  { MAP_STEADWICK, { 1, 0, 1, 0, 1, 0, 1 }, 3, -18048, 4636, 833, 1536, 0 },
84  { MAP_HARMONDALE, { 0, 1, 0, 0, 0, 1, 0 }, 5, -5692, 11137, 1, 1024, 0 },
85  { MAP_STEADWICK, { 0, 1, 0, 1, 0, 1, 0 }, 2, -18048, 4636, 833, 1536, 0 },
86  { MAP_PIERPONT, { 0, 1, 0, 1, 0, 1, 0 }, 3, -2527, -6773, 1153, 896, 0 },
87  { MAP_DEYJA, { 0, 0, 1, 0, 0, 0, 1 }, 5, 7227, -16007, 2625, 640, 0 },
88  { MAP_TATALIA, { 0, 1, 0, 1, 0, 1, 0 }, 2, -2183, -6941, 97, 0, 0 },
89  { MAP_AVLEE, { 1, 0, 0, 0, 1, 0, 0 }, 4, 7913, 9476, 193, 0, 0 },
90  { MAP_EVENMORN_ISLE, { 0, 0, 0, 0, 0, 0, 1 }, 7, 15616, 6390, 193, 1536, PARTY_QUEST_EVENMORN_MAP_FOUND },
91  { MAP_BRAKADA_DESERT, { 0, 0, 1, 0, 0, 0, 0 }, 6, 19171, -19722, 193, 1024, 0 },
92  { MAP_AVLEE, { 0, 1, 0, 1, 0, 1, 0 }, 3, 7913, 9476, 193, 0, 0 },
93  { MAP_BRAKADA_DESERT, { 1, 0, 1, 0, 0, 0, 0 }, 6, 19171, -19722, 193, 1024, 0 },
94  { MAP_TATALIA, { 1, 0, 1, 0, 1, 0, 0 }, 4, -2183, -6941, 97, 0, 0 },
95  { MAP_PIERPONT, { 0, 0, 0, 0, 0, 1, 0 }, 6, -709, -14087, 193, 1024, 0 }, // for boat
96  { MAP_STEADWICK, { 0, 0, 0, 0, 0, 0, 1 }, 6, -10471, 13497, 193, 1536, 0 },
97  { MAP_EVENMORN_ISLE, { 0, 1, 0, 1, 0, 0, 0 }, 1, 15616, 6390, 193, 1536, PARTY_QUEST_EVENMORN_MAP_FOUND },
98  { MAP_BRAKADA_DESERT, { 0, 1, 0, 1, 0, 0, 0 }, 1, 19171, -19722, 193, 1024, 0 },
99  { MAP_STEADWICK, { 0, 1, 0, 1, 0, 1, 0 }, 2, -10471, 13497, 193, 1536, 0 },
100  { MAP_BRAKADA_DESERT, { 1, 0, 1, 0, 0, 0, 0 }, 4, 19171, -19722, 193, 1024, 0 },
101  { MAP_EVENMORN_ISLE, { 0, 0, 0, 0, 0, 0, 1 }, 5, 15616, 6390, 193, 1536, PARTY_QUEST_EVENMORN_MAP_FOUND },
102  { MAP_AVLEE, { 0, 0, 0, 0, 1, 0, 0 }, 5, 7913, 9476, 193, 0, 0 },
103  { MAP_STEADWICK, { 0, 1, 0, 0, 0, 1, 0 }, 4, -10471, 13497, 193, 1536, 0 },
104  { MAP_PIERPONT, { 1, 0, 1, 0, 1, 0, 0 }, 3, -709, -14087, 193, 1024, 0 },
105  { MAP_TATALIA, { 0, 0, 0, 1, 0, 0, 0 }, 5, -2183, -6941, 97, 0, 0 },
106  { MAP_ARENA, { 0, 0, 0, 0, 0, 0, 1 }, 4, 3844, 2906, 193, 512, 0 }
107 };
108 
109 unsigned char transport_routes[20][4] = {
110  { 0, 1, 1, 34 }, // HOUSE_STABLES_HARMONDALE
111  { 2, 3, 4, 5 }, // HOUSE_STABLES_STEADWICK
112  { 6, 7, 8, 8 }, // HOUSE_STABLES_TULAREAN_FOREST
113  { 9, 10, 10, 10 }, // HOUSE_STABLES_DEYJA
114  { 11, 11, 12, 12 }, // HOUSE_STABLES_BRACADA_DESERT
115  { 13, 13, 13, 13 }, // HOUSE_STABLES_TATALIA
116  { 14, 14, 15, 15 }, // HOUSE_STABLES_AVLEE
117  { 255, 255, 255, 255 }, // HOUSE_STABLES_61
118  { 255, 255, 255, 255 }, // HOUSE_STABLES_62
119  { 255, 255, 255, 255 }, // HOUSE_BOATS_EMERALD_ISLE
120  { 16, 17, 18, 19 }, // HOUSE_BOATS_ERATHIA
121  { 18, 20, 21, 21 }, // HOUSE_BOATS_TULAREAN_FOREST
122  { 22, 23, 24, 25 }, // HOUSE_BOATS_BRACADA_DESERT
123  { 22, 22, 23, 23 }, // HOUSE_BOATS_EVENMORN_ISLAND
124  { 255, 255, 255, 255 }, // HOUSE_BOATS_68
125  { 27, 28, 29, 30 }, // HOUSE_BOATS_TATALIA
126  { 31, 32, 33, 33 }, // HOUSE_BOATS_AVLEE
127  { 24, 24, 24, 24 }, // HOUSE_BOATS_71
128  { 255, 255, 255, 255 }, // HOUSE_BOATS_72
129  { 255, 255, 255, 255 } // HOUSE_BOATS_73
130 };
131 
132 std::array<const stru159, 196> pAnimatedRooms = { { // 0x4E5F70
133  { "", 0x4, 0x1F4, 0, 0, 0 },
134  { "Human Armor01", 0x20, 0x2C0, 2, 58, 0 },
135  { "Necromancer Armor01", 0x20, 0x2D7, 2, 70, 0 },
136  { "Dwarven Armor01", 0x20, 0x2EE, 2, 5, 0 },
137  { "Wizard Armor", 0x20, 0x3BD, 2, 19, 0 },
138  { "Warlock Armor", 0x20, 0x2D6, 2, 35, 0 },
139  { "Elf Armor", 0x20, 0x2BC, 2, 79, 0 },
140  { "Human Alchemisht01", 0xE, 0x2BE, 4, 95, 0 },
141  { "Necromancer Alchemist01", 0xE, 0x2D6, 4, 69, 0 },
142  { "Dwarven Achemist01", 0xE, 0x387, 4, 4, 0 },
143  { "Wizard Alchemist", 0xE, 0x232, 4, 25, 0 },
144  { "Warlock Alchemist", 0xE, 0x2BE, 4, 42, 0 },
145  { "Elf Alchemist", 0xE, 0x38A, 4, 84, 0 },
146  { "Human Bank01", 0x6, 0x384, 22, 52, 0 },
147  { "Necromancer Bank01", 0x6, 0x2D8, 22, 71, 0 },
148  { "Dwarven Bank", 0x6, 0x2F3, 22, 6, 0 },
149  { "Wizard Bank", 0x6, 0x3BA, 22, 20, 0 },
150  { "Warlock Bank", 0x6, 0x39F, 22, 36, 0 },
151  { "Elf Bank", 0x6, 0x2BC, 22, 71, 0 },
152  { "Boat01", 0xF, 0x4C, 28, 53, 3 },
153  { "Boat01d", 0xF, 0x4C, 28, 53, 3 },
154  { "Human Magic Shop01", 0xA, 0x2C8, 3, 54, 0 },
155  { "Necromancer Magic Shop01", 0xE, 0x2DC, 3, 66, 0 },
156  { "Dwarven Magic Shop01", 0x2A, 0x2EF, 3, 91, 0 },
157  { "Wizard Magic Shop", 0x1E, 0x2DF, 3, 15, 0 },
158  { "Warlock Magic Shop", 0x7, 0x3B9, 3, 15, 0 },
159  { "Elf Magic Shop", 0x24, 0x2CC, 3, 82, 0 },
160  { "Human Stables01", 0x21, 0x31, 27, 48, 3 },
161  { "Necromancer Stables", 0x21, 0x2DD, 27, 67, 3 },
162  { "", 0x21, 0x2F0, 27, 91, 3 },
163  { "Wizard Stables", 0x21, 0x3BA, 27, 16, 3 },
164  { "Warlock Stables", 0x21, 0x181, 27, 77, 3 },
165  { "Elf Stables", 0x21, 0x195, 27, 77, 3 },
166  { "Human Tavern01", 0xD, 0x2C2, 21, 49, 0 },
167  { "Necromancer Tavern 01", 0xD, 0x3B0, 21, 57, 0 },
168  { "Dwarven Tavern01", 0xD, 0x2FE, 21, 94, 0 },
169  { "Wizard Tavern", 0xD, 0x3BB, 21, 17, 0 },
170  { "Warlock Tavern", 0xD, 0x3A8, 21, 33, 0 },
171  { "Elf Tavern", 0xD, 0x2CD, 21, 78, 0 },
172  { "Human Temple01", 0x24, 0x2DB, 23, 50, 3 },
173  { "Necromancer Temple", 0x24, 0x2DF, 23, 60, 3 },
174  { "Dwarven Temple01", 0x24, 0x2F1, 23, 86, 3 },
175  { "Wizard Temple", 0x24, 0x2E0, 23, 10, 3 },
176  { "Warlock Temple", 0x24, 0x3A4, 23, 27, 3 },
177  { "Elf Temple", 0x24, 0x2CE, 23, 72, 3 },
178  { "Human Town Hall", 0x10, 0x39C, 17, 14, 0 },
179  { "Necromancer Town Hall01", 0x10, 0x3A4, 17, 61, 0 },
180  { "Dwarven Town Hall", 0x10, 0x2DB, 17, 88, 0 },
181  { "Wizard Town Hall", 0x10, 0x3BD, 17, 11, 0 },
182  { "Warlock Town Hall", 0x10, 0x2DB, 17, 28, 0 },
183  { "Elf Town Hall", 0x10, 0x27A, 17, 73, 0 },
184  { "Human Training Ground01", 0x18, 0x2C7, 30, 44, 0 },
185  { "Necromancer Training Ground", 0x18, 0x3AD, 30, 62, 0 },
186  { "Dwarven Training Ground", 0x18, 0x2F2, 30, 89, 0 },
187  { "Wizard Training Ground", 0x18, 0x3A3, 30, 12, 0 },
188  { "Warlock Training Ground", 0x18, 0x3A6, 30, 29, 0 },
189  { "Elf Training Ground", 0x18, 0x19F, 30, 74, 0 },
190  { "Human Weapon Smith01", 0x16, 0x2C1, 1, 45, 4 },
191  { "Necromancer Weapon Smith01", 0x16, 0x2D9, 1, 63, 4 },
192  { "Dwarven Weapon Smith01", 0x16, 0x2EE, 1, 82, 4 },
193  { "Wizard Weapon Smith", 0x16, 0x2D5, 1, 13, 4 },
194  { "Warlock Weapon Smith", 0x16, 0x2D7, 1, 23, 4 },
195  { "Elf Weapon Smith", 0x16, 0x2CA, 1, 75, 4 },
196  { "Air Guild", 0x1D, 0xA4, 6, 1, 3 },
197  { "Body Guild", 0x19, 0x3BF, 11, 2, 0 },
198  { "Dark Guild", 0x19, 0x2D1, 13, 3, 0 },
199  { "Earth Guild", 0x19, 0x2CB, 8, 83, 0 },
200  { "Fire Guild", 0x1C, 0x2BF, 5, 56, 0 },
201  { "Light Guild", 0x1C, 0x2D5, 12, 46, 0 },
202  { "Mind Guild", 0x1C, 0xE5, 10, 40, 0 },
203  { "Spirit Guild", 0x1C, 0x2D2, 9, 41, 0 },
204  { "Water Guild", 0x1B, 0x2D3, 7, 24, 0 },
205  { "Lord And Judge Out01", 1, 0, 29, 39, 0 },
206  { "Human Poor House 1", 8, 0, 29, 0, 0 },
207  { "Human Poor House 2", 8, 0, 29, 0, 0 },
208  { "Human Poor House 3", 8, 0, 29, 0, 0 },
209  { "Human Medium House 1", 8, 0, 29, 0, 0 },
210  { "Human Medium House 2", 8, 0, 29, 0, 0 },
211  { "Human Medium House 3", 8, 0, 29, 0, 0 },
212  { "Human Rich House 1", 8, 0, 29, 0, 0 },
213  { "Human Rich House 2", 8, 0, 29, 0, 0 },
214  { "Human Rich House 3", 8, 0, 29, 0, 0 },
215  { "Elven Poor House 1", 8, 0, 29, 0, 0 },
216  { "Elven Poor House 2", 8, 0, 29, 0, 0 },
217  { "Elven Poor House 3", 8, 0, 29, 0, 0 },
218  { "Elven Medium House 1", 8, 0, 29, 0, 0 },
219  { "Elven Medium House 2", 8, 0, 29, 0, 0 },
220  { "Elven Medium House 3", 8, 0, 29, 0, 0 },
221  { "Elven Rich House 1", 8, 0, 29, 0, 0 },
222  { "Elven Rich House 2", 8, 0, 29, 0, 0 },
223  { "Elven Rich House 3", 8, 0, 29, 0, 0 },
224  { "Dwarven Poor House 1", 8, 0, 29, 0, 0 },
225  { "Dwarven Poor House 2", 8, 0, 29, 0, 0 },
226  { "Dwarven Poor House 3", 8, 0, 29, 0, 0 },
227  { "Dwarven Medium House 1", 8, 0, 29, 0, 0 },
228  { "Dwarven Medium house 2", 8, 0, 29, 0, 0 },
229  { "Dwarven Medium House 3", 8, 0, 29, 0, 0 },
230  { "Dwarven Rich House 1", 8, 0, 29, 0, 0 },
231  { "Dwarven Rich House 2", 8, 0, 29, 0, 0 },
232  { "Dwarven Rich House 3", 8, 0, 29, 0, 0 },
233  { "Wizard Poor House 1", 8, 0, 29, 0, 0 },
234  { "Wizard Poor House 2", 8, 0, 29, 0, 0 },
235  { "Wizard Poor House 3", 8, 0, 29, 0, 0 },
236  { "Wizard Medium House 1", 8, 0, 29, 0, 0 },
237  { "Wizard Medium House 2", 8, 0, 29, 0, 0 },
238  { "Wizard Mdeium House 3", 8, 0, 29, 0, 0 },
239  { "Wizard Rich House 1", 8, 0, 29, 0, 0 },
240  { "Wizard Rich House 2", 8, 0, 29, 0, 0 },
241  { "Wizard Rich House 3", 8, 0, 29, 0, 0 },
242  { "Necromancer Poor House 1", 8, 0, 29, 0, 0 },
243  { "Necromancer Poor House 2", 8, 0, 29, 0, 0 },
244  { "Necromancer Poor House 3", 8, 0, 29, 0, 0 },
245  { "Necromancer Medium House 1", 8, 0, 29, 0, 0 },
246  { "Necromancer Medium House 2", 8, 0, 29, 0, 0 },
247  { "Necromancer Mdeium House 3", 8, 0, 29, 0, 0 },
248  { "Necromancer Rich House 1", 8, 0, 29, 0, 0 },
249  { "Necromancer Rich House 2", 8, 0, 29, 0, 0 },
250  { "Necromancer Rich House 3", 8, 0, 29, 0, 0 },
251  { "Warlock Poor House 1", 8, 0, 29, 0, 0 },
252  { "Warlock Poor House 2", 8, 0, 29, 0, 0 },
253  { "Warlock Poor House 3", 8, 0, 29, 0, 0 },
254  { "Warlock Medium House 1", 8, 0, 29, 0, 0 },
255  { "Warlock Medium House 2", 8, 0, 29, 0, 0 },
256  { "Warlock Mdeium House 3", 8, 0, 29, 0, 0 },
257  { "Warlock Rich House 1", 8, 0, 29, 0, 0 },
258  { "Warlock Rich House 2", 8, 0, 29, 0, 0 },
259  { "Warlock Rich House 3", 8, 0, 29, 0, 0 },
260  { "Out01 Temple of the Moon", 0x24, 0, 25, 0, 0 },
261  { "Out01 Dragon Cave", 0x24, 0, 25, 0, 0 },
262  { "Out02 Castle Harmondy", 0x24, 0, 25, 0, 0 },
263  { "Out02 White Cliff Cave", 0x24, 0, 25, 0, 0 },
264  { "Out03 Erathian Sewer", 0x24, 0, 25, 0, 0 },
265  { "Out03 Fort Riverstride", 0x24, 0, 25, 0, 0 },
266  { "Out03 Castle Gryphonheart", 0x24, 0, 25, 0, 0 },
267  { "Out04 Elf Castle", 0x24, 0, 25, 0, 0 },
268  { "Out04 Tularean Caves", 0x24, 0, 25, 0, 0 },
269  { "Out04 Clanker's Laboratory", 0x24, 0, 25, 0, 0 },
270  { "Out05 Hall of the Pit", 0x24, 0, 25, 0, 0 },
271  { "Out05 Watchtower 6", 0x24, 0, 25, 0, 0 },
272  { "Out06 School of Sorcery", 0x24, 0, 25, 0, 0 },
273  { "Out06 Red Dwarf Mines", 0x24, 0, 25, 0, 0 },
274  { "Out07 Castle Lambert", 0x24, 0, 25, 0, 0 },
275  { "Out07 Walls of Mist", 0x24, 0, 25, 0, 0 },
276  { "Out07 Temple of the Light", 0x24, 0, 25, 0, 0 },
277  { "Out08 Evil Entrance", 0x24, 0, 25, 0, 0 },
278  { "Out08 Breeding Zone", 0x24, 0, 25, 0, 0 },
279  { "Out08 Temple of the Dark", 0x24, 0, 25, 0, 0 },
280  { "Out09 Grand Temple of the Moon", 0x24, 0, 25, 0, 0 },
281  { "Out09 Grand Tempple of the Sun", 0x24, 0, 25, 0, 0 },
282  { "Out10 Thunderfist Mountain", 0x24, 0, 25, 0, 0 },
283  { "Out10 The Maze", 0x24, 0, 25, 0, 0 },
284  { "Out10 Connecting Tunnel Cave #1", 0x24, 0, 25, 0, 0 },
285  { "", 0x24, 0, 25, 0, 0 },
286  { "", 0x24, 0, 25, 0, 0 },
287  { "Out11 Stone City", 0x24, 0, 25, 0, 0 },
288  { "", 0x24, 0, 25, 0, 0 },
289  { "Out12 Colony Zod", 0x24, 0, 25, 0, 0 },
290  { "Out12 Connecting Tunnel Cave #1", 0x24, 0, 25, 0, 0 },
291  { "", 0x24, 0, 25, 0, 0 },
292  { "", 0x24, 0, 25, 0, 0 },
293  { "Out13 Mercenary Guild", 0x24, 0, 25, 0, 0 },
294  { "Out13 Tidewater Caverns", 0x24, 0, 25, 0, 0 },
295  { "Out13 Wine Cellar", 0x24, 0, 25, 0, 0 },
296  { "Out14 Titan's Stronghold", 0x24, 0, 25, 0, 0 },
297  { "Out14 Temple Of Baa", 0x24, 0, 25, 0, 0 },
298  { "Out14 Hall under the Hill", 0x24, 0, 25, 0, 0 },
299  { "Out15 The Linclon", 0x24, 0, 25, 0, 0 },
300  { "Jail", 0x24, 0, 31, 0, 0 },
301  { "Harmondale Throne Room", 0x24, 0, 29, 0, 0 },
302  { "Gryphonheart Throne Room", 0x24, 0, 20, 0, 0 },
303  { "Elf Castle Throne Room", 0x24, 0, 20, 0, 0 },
304  { "Wizard Castle Throne Room", 0x24, 0, 20, 0, 0 },
305  { "Necromancer Casstle Trone Room", 0x24, 0, 20, 0, 0 },
306  { "Master Thief", 0x24, 0, 29, 0, 0 },
307  { "Dwarven King", 0x24, 0, 20, 0, 0 },
308  { "Arms Master", 0x24, 0, 29, 0, 0 },
309  { "Warlock", 0x24, 0, 29, 0, 0 },
310  { "Lord Markam", 0x24, 0, 20, 0, 0 },
311  { "Arbiter Neutral Town", 0x24, 0, 29, 0, 0 },
312  { "Arbiter Good Town", 0x24, 0, 29, 0, 0 },
313  { "Arbiter Evil Town", 0x24, 0, 29, 0, 0 },
314  { "Necromancer Throne Room Empty", 0x24, 0, 20, 0, 0 },
315  { "", 0x24, 0, 29, 0, 0 },
316  { "", 0x24, 0, 29, 0, 0 },
317  { "", 0x24, 0, 29, 0, 0 },
318  { "", 0x24, 0, 29, 0, 0 },
319  { "Boat01", 0xF, 0, 29, 53, 3 },
320  { "", 0x24, 0, 28, 0, 0 },
321  { "", 0x24, 0, 28, 0, 0 },
322  { "", 0x24, 0, 28, 0, 0 },
323  { "", 0x24, 0, 29, 0, 0 },
324  { "Arbiter Room Neutral", 0x24, 0, 29, 0, 0 },
325  { "Out02 Castle Harmondy Abandoned", 0x24, 0, 25, 0, 0 },
326  { "Human Temple02", 0x24, 0x3AB, 23, 27, 0 },
327  { "Player Castle Good", 0x24, 0, 25, 0, 0 },
328  { "Player Castle Bad", 0x24, 0, 25, 0, 0 }
329 } };
330 
331 static std::array<const char *, 19> _4F03B8_shop_background_names = {
332  { "", "WEPNTABL", "ARMORY", "MAGSHELF", "MAGSHELF", "MAGSHELF", "MAGSHELF",
333  "MAGSHELF", "MAGSHELF", "MAGSHELF", "MAGSHELF", "MAGSHELF", "MAGSHELF",
334  "MAGSHELF", "MAGSHELF", "MAGSHELF", "MAGSHELF", "MAGSHELF", "MAGSHELF" } };
335 
337  unsigned __int16 treasure_level;
338  unsigned __int16 item_class[4];
339 };
340 
341 std::array<const char, 5> uItemsAmountPerShopType = { 0, 6, 8, 12, 12 };
342 
344  { 0, { 00, 00, 00, 00 } }, { 1, { 23, 27, 20, 20 } }, { 1, { 23, 24, 28, 20 } },
345  { 2, { 23, 24, 25, 20 } }, { 2, { 27, 27, 26, 26 } }, { 4, { 24, 30, 25, 27 } },
346  { 4, { 24, 30, 25, 27 } }, { 3, { 30, 24, 20, 20 } }, { 2, { 20, 20, 20, 20 } },
347  { 3, { 27, 27, 26, 26 } }, { 3, { 28, 28, 25, 25 } }, { 2, { 23, 23, 24, 24 } },
348  { 3, { 23, 23, 26, 26 } }, { 2, { 30, 26, 26, 26 } }, { 2, { 28, 25, 28, 29 } }
349 };
350 
352  { 1, { 35, 35, 38, 38 } }, { 1, { 31, 31, 31, 34 } }, { 1, { 35, 35, 38, 38 } },
353  { 1, { 31, 31, 32, 34 } }, { 2, { 35, 35, 38, 38 } }, { 2, { 31, 32, 32, 33 } },
354  { 2, { 35, 35, 38, 38 } }, { 2, { 31, 31, 32, 32 } }, { 4, { 35, 35, 38, 38 } },
355  { 4, { 31, 32, 33, 34 } }, { 4, { 35, 35, 38, 38 } }, { 4, { 31, 32, 33, 34 } },
356  { 3, { 35, 35, 38, 38 } }, { 3, { 31, 31, 31, 31 } }, { 2, { 35, 35, 38, 38 } },
357  { 2, { 31, 32, 34, 34 } }, { 3, { 35, 35, 38, 38 } }, { 3, { 31, 31, 32, 32 } },
358  { 3, { 35, 35, 38, 38 } }, { 3, { 32, 32, 32, 33 } }, { 3, { 35, 35, 38, 38 } },
359  { 3, { 31, 31, 31, 32 } }, { 3, { 35, 35, 38, 38 } }, { 3, { 33, 31, 32, 34 } },
360  { 3, { 35, 35, 38, 38 } }, { 3, { 33, 31, 32, 34 } }, { 4, { 35, 35, 38, 38 } },
361  { 4, { 33, 31, 32, 34 } }
362 };
363 
364 const unsigned __int16 shopMagic_treasure_lvl[14] = { 0, 1, 1, 2, 2, 4, 4,
365 3, 2, 2, 2, 2, 2, 2 };
366 const unsigned __int16 shopAlch_treasure_lvl[13] = { 0, 1, 1, 2, 2, 3, 3,
367 4, 4, 2, 2, 2, 2 };
368 
370  { 0, { 00, 00, 00, 00 } }, { 2, { 25, 30, 20, 20 } }, { 2, { 23, 24, 28, 20 } },
371  { 3, { 23, 24, 25, 20 } }, { 3, { 27, 27, 26, 26 } }, { 5, { 23, 26, 28, 27 } },
372  { 5, { 23, 26, 28, 27 } }, { 4, { 30, 24, 20, 20 } }, { 3, { 20, 20, 20, 20 } },
373  { 4, { 27, 27, 26, 26 } }, { 4, { 28, 28, 25, 25 } }, { 4, { 23, 23, 24, 24 } },
374  { 4, { 24, 24, 27, 20 } }, { 4, { 30, 26, 26, 26 } }, { 4, { 28, 25, 28, 29 } }
375 };
376 
377 const unsigned __int16 shopMagicSpc_treasure_lvl[14] = { 0, 2, 2, 3, 3, 5, 5,
378 4, 3, 3, 3, 3, 3, 3 };
379 const unsigned __int16 shopAlchSpc_treasure_lvl[13] = { 0, 2, 2, 3, 3, 4, 4,
380 5, 5, 3, 2, 2, 2 };
381 
383  { 2, { 35, 35, 38, 38 } }, { 2, { 31, 31, 31, 34 } }, { 2, { 35, 35, 38, 38 } },
384  { 2, { 31, 31, 32, 34 } }, { 3, { 35, 35, 38, 38 } }, { 3, { 31, 32, 32, 33 } },
385  { 3, { 35, 35, 38, 38 } }, { 3, { 31, 31, 32, 32 } }, { 5, { 35, 35, 38, 38 } },
386  { 5, { 31, 32, 33, 34 } }, { 5, { 35, 35, 38, 38 } }, { 5, { 31, 32, 33, 34 } },
387  { 4, { 35, 35, 38, 38 } }, { 4, { 31, 31, 31, 31 } }, { 3, { 35, 35, 38, 38 } },
388  { 3, { 31, 32, 34, 34 } }, { 4, { 35, 35, 38, 38 } }, { 4, { 31, 31, 32, 33 } },
389  { 4, { 35, 35, 38, 38 } }, { 4, { 32, 32, 33, 34 } }, { 4, { 35, 35, 38, 38 } },
390  { 4, { 31, 31, 31, 32 } }, { 4, { 35, 35, 38, 38 } }, { 4, { 32, 32, 32, 32 } },
391  { 4, { 35, 35, 38, 38 } }, { 4, { 34, 34, 34, 34 } }, { 5, { 35, 35, 38, 38 } },
392  { 5, { 33, 33, 33, 33 } }
393 };
394 
396 
397 //----- (004B3A72) --------------------------------------------------------
399  int num_buttons; // esi@1
400 
401  num_buttons = 0;
402  if (type == BuildingType_Tavern) {
403  num_buttons = 2;
404  CreateButtonInColumn(0, 102);
405  CreateButtonInColumn(1, 103);
406  if (pParty->HasItem(651)) { // Arcomage Deck
407  num_buttons = 3;
408  CreateButtonInColumn(2, 104);
409  }
410  }
413 }
414 // F8B1E0: using guessed type int dword_F8B1E0;
415 
416 //----- (004B3AD4) --------------------------------------------------------
418  switch (type) {
422  {
423  CreateButtonInColumn(0, 3);
424  CreateButtonInColumn(1, 4);
425  CreateButtonInColumn(2, 5);
427  } break;
428 
430  {
431  CreateButtonInColumn(0, 3);
432  CreateButtonInColumn(1, 4);
434  } break;
435  }
436 
438 }
439 // F8B1E0: using guessed type int dword_F8B1E0;
440 
441 //----- (004B3B42) --------------------------------------------------------
443  switch (type) {
448  {
449  CreateButtonInColumn(0, 2);
450  CreateButtonInColumn(1, 95);
451  CreateButtonInColumn(2, 94);
452  CreateButtonInColumn(3, 96);
454  } break;
455 
457  {
458  CreateButtonInColumn(0, 18);
459  CreateButtonInColumn(1, 48);
460  CreateButtonInColumn(2, 72);
462  } break;
463 
465  {
466  CreateButtonInColumn(0, 18);
467  CreateButtonInColumn(1, 49);
468  CreateButtonInColumn(2, 72);
470  } break;
471 
473  {
474  CreateButtonInColumn(0, 18);
475  CreateButtonInColumn(1, 50);
476  CreateButtonInColumn(2, 72);
478  } break;
479 
481  {
482  CreateButtonInColumn(0, 18);
483  CreateButtonInColumn(1, 51);
484  CreateButtonInColumn(2, 72);
486  } break;
487 
489  {
490  CreateButtonInColumn(0, 18);
491  CreateButtonInColumn(1, 52);
492  CreateButtonInColumn(2, 61);
494  } break;
495 
497  {
498  CreateButtonInColumn(0, 18);
499  CreateButtonInColumn(1, 53);
500  CreateButtonInColumn(2, 61);
502  } break;
503 
505  {
506  CreateButtonInColumn(0, 18);
507  CreateButtonInColumn(1, 54);
508  CreateButtonInColumn(2, 61);
510  } break;
511 
513  {
514  CreateButtonInColumn(0, 18);
515  CreateButtonInColumn(1, 55);
517  } break;
518 
520  {
521  CreateButtonInColumn(0, 18);
522  CreateButtonInColumn(1, 56);
524  } break;
525 
527  {
528  CreateButtonInColumn(0, 18);
529  CreateButtonInColumn(1, 48);
530  CreateButtonInColumn(2, 49);
531  CreateButtonInColumn(3, 50);
532  CreateButtonInColumn(4, 51);
534  } break;
535 
537  {
538  CreateButtonInColumn(0, 18);
539  CreateButtonInColumn(1, 52);
540  CreateButtonInColumn(2, 53);
541  CreateButtonInColumn(3, 54);
543  } break;
544 
545  case BuildingType_16:
547  {
548  int num_buttons = 1;
549  CreateButtonInColumn(0, 99);
550 
551  if (pParty->uFine) {
552  num_buttons++;
553  CreateButtonInColumn(1, 100);
554  }
555 
557  0, 2);
558  } break;
559 
560  case BuildingType_Bank:
561  {
562  CreateButtonInColumn(0, 7);
563  CreateButtonInColumn(1, 8);
565  } break;
566 
567  case BuildingType_Temple:
568  {
569  CreateButtonInColumn(0, 10);
570  CreateButtonInColumn(1, 11);
571  CreateButtonInColumn(2, 96);
573  } break;
574 
576  case BuildingType_Boats:
577  {
578  CreateButtonInColumn(0, 105);
579  CreateButtonInColumn(1, 106);
580  CreateButtonInColumn(2, 107);
581  CreateButtonInColumn(3, 108);
583  } break;
584 
586  {
587  CreateButtonInColumn(0, 17);
588  CreateButtonInColumn(1, 96);
590  } break;
591 
592  case BuildingType_Tavern:
593  {
594  CreateButtonInColumn(0, 15);
595  CreateButtonInColumn(1, 16);
596  CreateButtonInColumn(2, 96);
597  if ((signed int)window_SpeakInHouse->ptr_1C < 108 ||
598  (signed int)window_SpeakInHouse->ptr_1C > 120) {
600  break;
601  }
602  CreateButtonInColumn(3, 101);
604  } break;
605 
606  case BuildingType_18:
607  case BuildingType_19:
609  case BuildingType_24:
610  case BuildingType_Unic:
611  case BuildingType_1A:
612  case BuildingType_House:
613  case BuildingType_Jail:
614  break;
615 
616  default:
617  Error("Invalid enumeration value: %u", type);
618  }
619 
620  /* if ( a1 > 13 )
621  {
622  if ( a1 > 22 )
623  {
624  if ( a1 == 23 )
625  {
626  CreateButtonInColumn(0, 0xAu);
627  CreateButtonInColumn(1, 0xBu);
628  v14 = 96;
629  LABEL_41:
630  CreateButtonInColumn(2, v14);
631  v17 = 2;
632  v11 = 0;
633  v10 = 1;
634  v9 = 3;
635  goto LABEL_42;
636  }
637  if ( a1 <= 26 )
638  goto LABEL_43;
639  if ( a1 > 28 )
640  {
641  if ( a1 != 30 )
642  goto LABEL_43;
643  CreateButtonInColumn(0, 0x11u);
644  v16 = 96;
645  goto LABEL_37;
646  }
647  CreateButtonInColumn(0, 0x69u);
648  CreateButtonInColumn(1, 0x6Au);
649  CreateButtonInColumn(2, 0x6Bu);
650  v12 = 108;
651  }
652  else
653  {
654  if ( a1 == 22 )
655  {
656  CreateButtonInColumn(0, 7u);
657  v16 = 8;
658  goto LABEL_37;
659  }
660  v1 = a1 - 14;
661  if ( !v1 ) // == 14
662  {
663  CreateButtonInColumn(0, 0x12u);
664  CreateButtonInColumn(1, 0x30u);
665  CreateButtonInColumn(2, 0x31u);
666  CreateButtonInColumn(3, 0x32u);
667  CreateButtonInColumn(4, 0x33u);
668  v17 = 2;
669  v11 = 0;
670  v10 = 1;
671  v9 = 5;
672  goto LABEL_42;
673  }
674  v2 = v1 - 1;
675  if ( v2 ) // > 15
676  {
677  v3 = v2 - 2;
678  if ( v3 ) // > 17
679  {
680  if ( v3 != 4 ) // 18, 19, 20
681  goto LABEL_43;
682  CreateButtonInColumn(0, 0xFu); // 21
683  CreateButtonInColumn(1, 0x10u);
684  v4 = 3;
685  CreateButtonInColumn(2, 0x60u);
686  v5 = (signed int)window_SpeakInHouse->ptr_1C;
687  if ( v5 < 108 || v5 > 120 )
688  goto LABEL_28;
689  v4 = 4;
690  v6 = 101;
691  v7 = 3;
692  }
693  else // 16, 17
694  {
695  v4 = 1;
696  CreateButtonInColumn(0, 0x63u);
697  if ( !pParty->uFine )
698  {
699  LABEL_28:
700  v17 = 2;
701  v11 = 0;
702  v10 = 1;
703  v9 = v4;
704  LABEL_42:
705  pDialogueWindow->_41D08F_set_keyboard_control_group(v9, v10,
706  v11, v17); goto LABEL_43;
707  }
708  v4 = 2;
709  v7 = 1;
710  v6 = 100;
711  }
712  CreateButtonInColumn(v7, v6);
713  goto LABEL_28;
714  }
715  CreateButtonInColumn(0, 0x12u); // 15
716  CreateButtonInColumn(1, 0x34u);
717  CreateButtonInColumn(2, 0x35u);
718  v12 = 54;
719  }
720  LABEL_39:
721  CreateButtonInColumn(3, v12);
722  v17 = 2;
723  v11 = 0;
724  v10 = 1;
725  v9 = 4;
726  goto LABEL_42;
727  }
728  if ( a1 == 13 )
729  {
730  CreateButtonInColumn(0, 0x12u);
731  v16 = 56;
732  LABEL_37:
733  CreateButtonInColumn(1, v16);
734  v17 = 2;
735  v11 = 0;
736  v10 = 1;
737  v9 = 2;
738  goto LABEL_42;
739  }
740  switch ( a1 )
741  {
742  case 1:
743  case 2:
744  case 3:
745  case 4:
746  CreateButtonInColumn(0, 2u);
747  CreateButtonInColumn(1, 0x5Fu);
748  CreateButtonInColumn(2, 0x5Eu);
749  v12 = 96;
750  goto LABEL_39;
751  case 5:
752  CreateButtonInColumn(0, 0x12u);
753  v13 = 48;
754  goto LABEL_9;
755  case 6:
756  CreateButtonInColumn(0, 0x12u);
757  v13 = 49;
758  goto LABEL_9;
759  case 7:
760  CreateButtonInColumn(0, 0x12u);
761  v13 = 50;
762  goto LABEL_9;
763  case 8:
764  CreateButtonInColumn(0, 0x12u);
765  v13 = 51;
766  LABEL_9:
767  CreateButtonInColumn(1, v13);
768  v14 = 72;
769  goto LABEL_41;
770  case 9:
771  CreateButtonInColumn(0, 0x12u);
772  v15 = 52;
773  goto LABEL_13;
774  case 10:
775  CreateButtonInColumn(0, 0x12u);
776  v15 = 53;
777  goto LABEL_13;
778  case 11:
779  CreateButtonInColumn(0, 0x12u);
780  v15 = 54;
781  LABEL_13:
782  CreateButtonInColumn(1, v15);
783  v14 = 61;
784  goto LABEL_41;
785  case 12:
786  CreateButtonInColumn(0, 0x12u);
787  v16 = 55;
788  goto LABEL_37;
789  default:
790  break;
791  }
792  LABEL_43:*/
794 }
795 // F8B1E0: using guessed type int dword_F8B1E0;
796 
798  if (uActiveCharacter == 0) { // to avoid access zeroeleement
799  return false;
800  }
801 
802  if (pPlayers[uActiveCharacter]->CanAct()) {
804  return true;
805  } else {
808  window.uFrameX = 483;
809  window.uFrameWidth = 143;
810  window.uFrameZ = 334;
811 
813  427, // %s is in no condition to %s
814  pPlayers[uActiveCharacter]->pName,
815  localization->GetString(562)); // do anything
816  window.DrawTitleText(
817  pFontArrus, 0,
818  (212 - pFontArrus->CalcTextHeight(str, window.uFrameWidth, 0)) / 2 +
819  101,
821  return false;
822  }
823 }
824 
825 //----- (0044622E) --------------------------------------------------------
826 bool EnterHouse(enum HOUSE_ID uHouseID) {
827  int uOpenTime; // eax@5
828  int uCloseTime; // esi@5
829  // unsigned int v5; // esi@5
830  // int v6; // edx@5
831  int am_pm_flag_open; // ecx@10
832  int am_pm_flag_close; // eax@10
833  // int v9; // esi@10
834  // int v11; // ecx@17
835  // unsigned int v12; // kr00_4@25
836  // int v14; // eax@25
837  // unsigned int v17; // eax@37
838  int v18; // edi@37
839  int v19; // edi@41
840  String pContainer; // [sp+Ch] [bp-30h]@32
841  // unsigned int v24; // [sp+34h] [bp-8h]@5
842 
847  uDialogueType = 0;
848  pKeyActionMap->SetWindowInputStatus(WINDOW_INPUT_CANCELLED);
850  if (uHouseID == HOUSE_600 || uHouseID == HOUSE_601) {
852  return 0;
853  }
854  uOpenTime = p2DEvents[uHouseID - 1].uOpenTime;
855  uCloseTime = p2DEvents[uHouseID - 1].uCloseTime;
856  current_npc_text.clear();
857  dword_F8B1E4 = 0;
858  memset(byte_F8B1F0.data(), 0, 4);
859  memset(player_levels.data(), 0, 16);
860  render->ClearZBuffer(0, 479);
861 
862  if (((uCloseTime - 1 <= uOpenTime) &&
863  ((pParty->uCurrentHour < uOpenTime) &&
864  (pParty->uCurrentHour >(uCloseTime - 1)))) ||
865  ((uCloseTime - 1 > uOpenTime) &&
866  ((pParty->uCurrentHour < uOpenTime) ||
867  (pParty->uCurrentHour >(uCloseTime - 1))))) {
868  am_pm_flag_open = 0;
869  am_pm_flag_close = 0;
870  if (uOpenTime > 12) {
871  uOpenTime -= 12;
872  am_pm_flag_open = 1;
873  }
874  if (uCloseTime > 12) {
875  uCloseTime -= 12;
876  am_pm_flag_close = 1;
877  }
878 
880  414, // This place is open from %d%s to %d%s
881  uOpenTime, localization->GetAmPm(am_pm_flag_open), uCloseTime,
882  localization->GetAmPm(am_pm_flag_close)));
883  if (uActiveCharacter)
884  pPlayers[uActiveCharacter]->PlaySound(SPEECH_3, 0);
885  return 0;
886  } else {
887  // v10 = uHouseID;
888  if (uHouseID < 53) { // entering shops and guilds
889  if (!(pParty->PartyTimes._shop_ban_times[uHouseID]) ||
890  (pParty->PartyTimes._shop_ban_times[uHouseID] <=
891  pParty->GetPlayingTime())) {
892  pParty->PartyTimes._shop_ban_times[uHouseID] = GameTime(0);
893  } else {
895  191)); // "You've been banned from this shop!"
896  return 0;
897  }
898  }
899  pAudioPlayer->StopChannels(-1, -1);
900 
905  pParty->uFine) { // going 2 jail
907  (signed __int16)p2DEvents[186].uAnimationID;
908  uHouseID = HOUSE_JAIL;
909  pParty->GetPlayingTime().AddYears(1); // += 123863040;
911  (BuildingType)
913  .uAnimationID]
914  .uBuildingType;
916  pParty->uFine = 0;
917  for (uint i = 0; i < 4; ++i) {
918  pParty->pPlayers[i].uTimeToRecovery = 0;
919  pParty->pPlayers[i].uNumDivineInterventionCastsThisDay = 0;
920  pParty->pPlayers[i].SetVariable(VAR_Award, 87);
921  }
922  }
923 
924  switch (pParty->alignment) {
926  pContainer = "evt02-b";
927  break;
929  pContainer = "evt02";
930  break;
932  pContainer = "evt02-c";
933  break;
934  default:
935  Error("Invalid alignment: %u", pParty->alignment);
936  }
937 
938  pDialogueNPCCount = 0;
940 
941  PrepareHouse(uHouseID);
942  v18 = 1;
943 
946  pAnimatedRooms[uCurrentHouse_Animation].video_name, 1u);
947  dword_5C35D4 = 1;
948  if ((signed int)uHouseID < 139 || (signed int)uHouseID > 172) {
949  if ((signed int)uHouseID >= HOUSE_STABLES_HARMONDALE &&
950  (signed int)uHouseID <= 73 &&
952  return 1;
953  }
954  } else { // guilds
956  [uHouseID -
958  // v20 = uHouseID;
959  // if ( !((unsigned __int8)(0x80u >> v19 % 8) &
960  // pPlayers[uActiveCharacter]->_guilds_member_bits[v19 /8]) )
961 
962  if (uActiveCharacter == 0) // avoid nzi
964 
965  if (!_449B57_test_bit(
966  pPlayers[uActiveCharacter]->_achieved_awards_bits, v19)) {
968  return 1;
969  }
970  }
972  dword_5C35D4 = 1;
973  return 1;
974  }
975 }
976 
977 //----- (0044606A) --------------------------------------------------------
978 void PrepareHouse(HOUSE_ID house) {
979  __int16 uExitMapID; // ax@2
980  // int v7; // ebx@11
981  // int v13; // [sp+30h] [bp-30h]@11
982  int npc_id_arr[6]; // [sp+34h] [bp-2Ch]@1
983  int uAnimationID; // [sp+50h] [bp-10h]@1
984 
985  uAnimationID = p2DEvents[house - 1].uAnimationID;
986  memset(npc_id_arr, 0, sizeof(npc_id_arr));
988  uHouse_ExitPic = p2DEvents[house - 1].uExitPicID;
989  if (uHouse_ExitPic) {
990  uExitMapID = p2DEvents[house - 1]._quest_related;
991  if (uExitMapID > 0) {
992  if (_449B57_test_bit(pParty->_quest_bits, uExitMapID)) {
993  uHouse_ExitPic = 0;
994  }
995  }
996  }
997 
998  dword_591080 = pAnimatedRooms[uAnimationID].house_npc_id;
999  HouseNPCData[0] = 0;
1001  if (dword_591080) {
1002  npc_id_arr[0] = dword_591080;
1004  }
1005 
1006  for (uint i = 1; i < pNPCStats->uNumNewNPCs; ++i) {
1007  if (pNPCStats->pNewNPCData[i].Location2D == house) {
1008  if (!(pNPCStats->pNewNPCData[i].uFlags & 0x80)) {
1010  ((dword_591080 != 0) ? 1 : 0)] =
1011  &pNPCStats->pNewNPCData[i];
1012  npc_id_arr[uNumDialogueNPCPortraits] =
1015  if ((pNPCStats->pNewNPCData[i].uFlags & 3) != 2)
1017  }
1018  }
1019  }
1020 
1021  for (int i = 0; i < uNumDialogueNPCPortraits; ++i) {
1023  StringPrintf("npc%03u", npc_id_arr[i]), 0x7FF);
1024  }
1025 
1026  if (uHouse_ExitPic) {
1029  0x7FF);
1031  uHouse_ExitPic = p2DEvents[house - 1].uExitMapID;
1032  }
1033 }
1034 
1035 //----- (004B1E92) --------------------------------------------------------
1036 void PlayHouseSound(unsigned int uHouseID, HouseSoundID sound) {
1037  if (pAnimatedRooms[p2DEvents[uHouseID-1].uAnimationID].uRoomSoundId)
1039  (SoundID)(sound +
1040  100 * (pAnimatedRooms[p2DEvents[uHouseID-1].uAnimationID]
1041  .uRoomSoundId +
1042  300)),
1043  806, 0, -1, 0, 0);
1044 }
1045 
1046 //----- (004BCACC) --------------------------------------------------------
1047 void OnSelectShopDialogueOption(signed int uMessageParam) {
1048  int experience_for_next_level; // eax@5
1049  int v16; // eax@32
1050  __int16 v24; // ax@163
1051  signed int v36; // esi@227
1052  int pPrice; // ecx@227
1053 
1054  if (!pDialogueWindow->pNumPresenceButton) return;
1055  render->ClearZBuffer(0, 479);
1058  if (uMessageParam == HOUSE_DIALOGUE_TRAININGHALL_TRAIN) {
1059  experience_for_next_level = 0;
1060  if (pPlayers[uActiveCharacter]->uLevel > 0) {
1061  for (uint i = 0; i < pPlayers[uActiveCharacter]->uLevel;
1062  i++)
1063  experience_for_next_level += i + 1;
1064  }
1065  if (pPlayers[uActiveCharacter]->uLevel <
1067  [(unsigned int)window_SpeakInHouse->ptr_1C - 89] &&
1068  (signed __int64)pPlayers[uActiveCharacter]->uExperience <
1069  1000 * experience_for_next_level) // test experience
1070  return;
1071  }
1073  pDialogueWindow = new GUIWindow(WINDOW_Dialogue, 0, 0, window->GetWidth(), 345, 0);
1075  526, 445, 75, 33, 1, 0, UIMSG_Escape, 0, 0,
1076  localization->GetString(74), // "End Conversation"
1077  { { ui_buttdesc2 } });
1078  pDialogueWindow->CreateButton(8, 8, 450, 320, 1, 0,
1080  "");
1081  }
1086  [transport_routes[(unsigned int)
1089  [uMessageParam -
1093  uMessageParam != BuildingType_MindGuild) {
1095  pDialogueWindow =
1096  new GUIWindow(WINDOW_Dialogue, 0, 0, window->GetWidth(), 345, 0);
1098  526, 445, 75, 33, 1, 0, UIMSG_Escape, 0, 0,
1099  localization->GetString(74), // "End Conversation"
1100  { { ui_buttdesc2 } });
1101  pDialogueWindow->CreateButton(8, 8, 450, 320, 1, 0,
1103  0, 0, "");
1104  } else if (uActiveCharacter) {
1105  if (!pPlayers[uActiveCharacter]->IsPlayerHealableByTemple())
1106  return;
1107  }
1108  }
1109  dialog_menu_id = (HOUSE_DIALOGUE_MENU)uMessageParam;
1113  0x7FF);
1114  }
1115  }
1116 
1117  // NEW
1118  switch (in_current_building_type) {
1120  case BuildingType_AirGuild:
1130  case BuildingType_16:
1131  {
1132  if (pParty->PartyTimes
1134  139] >=
1135  pParty->GetPlayingTime()) {
1136  for (uint i = 0; i < 12; ++i) {
1137  if (pParty
1138  ->SpellBooksInGuilds[window_SpeakInHouse->par1C -
1139  139][i]
1140  .uItemID)
1142  pParty
1143  ->SpellBooksInGuilds
1144  [window_SpeakInHouse->par1C - 139][i]
1145  .GetIconName(),
1146  0x7FF);
1147  }
1148  } else { // generation new books
1152  139] =
1155  p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1]
1157  }
1158  break;
1159  }
1160  case BuildingType_TownHall:
1161  {
1162  if (uMessageParam == HOUSE_DIALOGUE_TOWNHALL_MESSAGE) {
1164  int)((char *)window_SpeakInHouse->ptr_1C - 102)] <
1165  pParty->GetPlayingTime()) { // new generation
1167  int)((char *)window_SpeakInHouse->ptr_1C - 102)] =
1168  false;
1170  int)((char *)window_SpeakInHouse->ptr_1C - 102)] =
1171  GameTime((int64_t)((double)(309657600 *
1172  (pParty->uCurrentMonth +
1173  12ll *
1174  pParty->uCurrentYear -
1175  14015)) *
1176  0.033333335));
1178  int)((char *)window_SpeakInHouse->ptr_1C - 102)] =
1179  rand() % 258 + 1;
1180  v16 = (int)((char *)window_SpeakInHouse->ptr_1C - 102);
1181  if (!v16) {
1182  while (1) {
1184  int)((char *)window_SpeakInHouse->ptr_1C -
1185  102)];
1186  if ((unsigned __int16)v24 < 115 ||
1187  (unsigned __int16)v24 > 132) {
1188  if (((unsigned __int16)v24 < 235 ||
1189  (unsigned __int16)v24 > 252) &&
1190  ((unsigned __int16)v24 < 133 ||
1191  (unsigned __int16)v24 > 150) &&
1192  ((unsigned __int16)v24 < 0x97u ||
1193  (unsigned __int16)v24 > 0xBAu) &&
1194  ((unsigned __int16)v24 < 0xBEu ||
1195  (unsigned __int16)v24 > 0xC0u) &&
1196  ((unsigned __int16)v24 < 0xC4u ||
1197  (unsigned __int16)v24 > 0xC6u) &&
1198  ((unsigned __int16)v24 < 0x2Bu ||
1199  (unsigned __int16)v24 > 0x2Du) &&
1200  ((unsigned __int16)v24 < 0xCDu ||
1201  (unsigned __int16)v24 > 0xCFu) &&
1202  ((unsigned __int16)v24 < 0x5Eu ||
1203  (unsigned __int16)v24 > 0x60u) &&
1204  ((unsigned __int16)v24 < 0xFDu ||
1205  (unsigned __int16)v24 > 0xFFu) &&
1206  ((unsigned __int16)v24 < 0x6Du ||
1207  (unsigned __int16)v24 > 0x6Fu) &&
1208  ((unsigned __int16)v24 < 0x61u ||
1209  (unsigned __int16)v24 > 0x63u))
1210  break;
1211  }
1213  int)((char *)window_SpeakInHouse->ptr_1C -
1214  102)] = rand() % 258 + 1;
1215  }
1216  }
1217  if (v16 == 1) {
1218  while (1) {
1220  int)((char *)window_SpeakInHouse->ptr_1C -
1221  102)];
1222  if ((unsigned __int16)v24 < 115 ||
1223  (unsigned __int16)v24 > 132) {
1224  if (((unsigned __int16)v24 < 0xE8u ||
1225  (unsigned __int16)v24 > 0xF9u) &&
1226  ((unsigned __int16)v24 < 0x85u ||
1227  (unsigned __int16)v24 > 0x96u) &&
1228  ((unsigned __int16)v24 < 0x97u ||
1229  (unsigned __int16)v24 > 0xBAu) &&
1230  ((unsigned __int16)v24 < 0xBEu ||
1231  (unsigned __int16)v24 > 0xC0u) &&
1232  ((unsigned __int16)v24 < 0xC4u ||
1233  (unsigned __int16)v24 > 0xC6u) &&
1234  ((unsigned __int16)v24 < 0x2Bu ||
1235  (unsigned __int16)v24 > 0x2Du) &&
1236  ((unsigned __int16)v24 < 0x52u ||
1237  (unsigned __int16)v24 > 0x54u) &&
1238  ((unsigned __int16)v24 < 4 ||
1239  (unsigned __int16)v24 > 6) &&
1240  ((unsigned __int16)v24 < 0x37u ||
1241  (unsigned __int16)v24 > 0x39u) &&
1242  ((unsigned __int16)v24 < 0x3Au ||
1243  (unsigned __int16)v24 > 0x3Cu) &&
1244  ((unsigned __int16)v24 < 0x3Du ||
1245  (unsigned __int16)v24 > 0x3Fu) &&
1246  ((unsigned __int16)v24 < 0xFDu ||
1247  (unsigned __int16)v24 > 0xFFu) &&
1248  ((unsigned __int16)v24 < 0x61u ||
1249  (unsigned __int16)v24 > 0x63u) &&
1250  ((unsigned __int16)v24 < 0xCDu ||
1251  (unsigned __int16)v24 > 0xCFu))
1252  break;
1253  }
1255  int)((char *)window_SpeakInHouse->ptr_1C -
1256  102)] = rand() % 258 + 1;
1257  }
1258  }
1259  if (v16 == 2) {
1260  while (1) {
1262  int)((char *)window_SpeakInHouse->ptr_1C -
1263  102)];
1264  if ((unsigned __int16)v24 < 0x73u ||
1265  (unsigned __int16)v24 > 0x84u) {
1266  if (((unsigned __int16)v24 < 0xE8u ||
1267  (unsigned __int16)v24 > 0xF9u) &&
1268  ((unsigned __int16)v24 < 0x85u ||
1269  (unsigned __int16)v24 > 0x96u) &&
1270  ((unsigned __int16)v24 < 0x97u ||
1271  (unsigned __int16)v24 > 0xBAu) &&
1272  ((unsigned __int16)v24 < 0xBEu ||
1273  (unsigned __int16)v24 > 0xC0u) &&
1274  ((unsigned __int16)v24 < 0xC4u ||
1275  (unsigned __int16)v24 > 0xC6u) &&
1276  ((unsigned __int16)v24 < 0x2Bu ||
1277  (unsigned __int16)v24 > 0x2Du) &&
1278  ((unsigned __int16)v24 < 0x31u ||
1279  (unsigned __int16)v24 > 0x33u) &&
1280  ((unsigned __int16)v24 < 0x34u ||
1281  (unsigned __int16)v24 > 0x36u) &&
1282  ((unsigned __int16)v24 < 0xFDu ||
1283  (unsigned __int16)v24 > 0xFFu) &&
1284  ((unsigned __int16)v24 < 0x61u ||
1285  (unsigned __int16)v24 > 0x63u) &&
1286  ((unsigned __int16)v24 < 0x1Cu ||
1287  (unsigned __int16)v24 > 0x1Eu))
1288  break;
1289  }
1291  int)((char *)window_SpeakInHouse->ptr_1C -
1292  102)] = rand() % 258 + 1;
1293  }
1294  }
1295  if (v16 == 3) {
1296  while (1) {
1298  int)((char *)window_SpeakInHouse->ptr_1C -
1299  102)];
1300  if ((unsigned __int16)v24 < 0x73u ||
1301  (unsigned __int16)v24 > 0x84u) {
1302  if (((unsigned __int16)v24 < 0xE8u ||
1303  (unsigned __int16)v24 > 0xF9u) &&
1304  ((unsigned __int16)v24 < 0x85u ||
1305  (unsigned __int16)v24 > 0x96u) &&
1306  ((unsigned __int16)v24 < 0x97u ||
1307  (unsigned __int16)v24 > 0xBAu) &&
1308  ((unsigned __int16)v24 < 0xBEu ||
1309  (unsigned __int16)v24 > 0xC0u) &&
1310  ((unsigned __int16)v24 < 0xC4u ||
1311  (unsigned __int16)v24 > 0xC6u) &&
1312  ((unsigned __int16)v24 < 0x2Bu ||
1313  (unsigned __int16)v24 > 0x2Du) &&
1314  ((unsigned __int16)v24 < 0x5Eu ||
1315  (unsigned __int16)v24 > 0x60u) &&
1316  ((unsigned __int16)v24 < 0x43u ||
1317  (unsigned __int16)v24 > 0x45u) &&
1318  ((unsigned __int16)v24 < 0x4Fu ||
1319  (unsigned __int16)v24 > 0x51u) &&
1320  ((unsigned __int16)v24 < 0xC1u ||
1321  (unsigned __int16)v24 > 0xC3u) &&
1322  ((unsigned __int16)v24 < 0x13u ||
1323  (unsigned __int16)v24 > 0x15u) &&
1324  ((unsigned __int16)v24 < 0xFDu ||
1325  (unsigned __int16)v24 > 0xFFu) &&
1326  ((unsigned __int16)v24 < 0x61u ||
1327  (unsigned __int16)v24 > 0x63u) &&
1328  ((unsigned __int16)v24 < 0x6Au ||
1329  (unsigned __int16)v24 > 0x6Cu))
1330  break;
1331  }
1333  int)((char *)window_SpeakInHouse->ptr_1C -
1334  102)] = rand() % 258 + 1;
1335  }
1336  }
1337  if (v16 == 4) {
1338  while (1) {
1340  int)((char *)window_SpeakInHouse->ptr_1C -
1341  102)];
1342  if ((unsigned __int16)v24 < 0x73u ||
1343  (unsigned __int16)v24 > 0x84u) {
1344  if (((unsigned __int16)v24 < 0xE8u ||
1345  (unsigned __int16)v24 > 0xF9u) &&
1346  ((unsigned __int16)v24 < 0x85u ||
1347  (unsigned __int16)v24 > 0x96u) &&
1348  ((unsigned __int16)v24 < 0x97u ||
1349  (unsigned __int16)v24 > 0xBAu) &&
1350  ((unsigned __int16)v24 < 0xBEu ||
1351  (unsigned __int16)v24 > 0xC0u) &&
1352  ((unsigned __int16)v24 < 0xC4u ||
1353  (unsigned __int16)v24 > 0xC6u) &&
1354  ((unsigned __int16)v24 < 0x2Bu ||
1355  (unsigned __int16)v24 > 0x2Du) &&
1356  ((unsigned __int16)v24 < 0x6Du ||
1357  (unsigned __int16)v24 > 0x6Fu) &&
1358  ((unsigned __int16)v24 < 0x46u ||
1359  (unsigned __int16)v24 > 0x48u) &&
1360  ((unsigned __int16)v24 < 0x100u ||
1361  (unsigned __int16)v24 > 0x102u) &&
1362  ((unsigned __int16)v24 < 0xD9u ||
1363  (unsigned __int16)v24 > 0xDBu) &&
1364  ((unsigned __int16)v24 < 0xC7u ||
1365  (unsigned __int16)v24 > 0xC9u) &&
1366  ((unsigned __int16)v24 < 0xE5u ||
1367  (unsigned __int16)v24 > 0xE7u) &&
1368  ((unsigned __int16)v24 < 0xDFu ||
1369  (unsigned __int16)v24 > 0xE1u) &&
1370  ((unsigned __int16)v24 < 0x5Bu ||
1371  (unsigned __int16)v24 > 0x5Du) &&
1372  ((unsigned __int16)v24 < 0x49u ||
1373  (unsigned __int16)v24 > 0x4Bu) &&
1374  ((unsigned __int16)v24 < 0xFDu ||
1375  (unsigned __int16)v24 > 0xFFu) &&
1376  ((unsigned __int16)v24 < 0x61u ||
1377  (unsigned __int16)v24 > 0x63u) &&
1378  ((unsigned __int16)v24 < 0x10u ||
1379  (unsigned __int16)v24 > 0x12u))
1380  break;
1381  }
1383  int)((char *)window_SpeakInHouse->ptr_1C -
1384  102)] = rand() % 258 + 1;
1385  }
1386  }
1387  }
1390  int)((char *)window_SpeakInHouse->ptr_1C - 102)];
1392  int)((char *)window_SpeakInHouse->ptr_1C - 102)]) {
1394  pNPCTopics[351].pText; //"В этом месяцу назначена
1395  //награда за голову %s..."
1397  int)((char *)window_SpeakInHouse->ptr_1C - 102)])
1399  pNPCTopics[353].pText; //"Кое кто уже приходил в
1400  //этом месяце за наградой"
1401  } else {
1403  int)((char *)window_SpeakInHouse->ptr_1C - 102)] >
1404  0) { // get prize
1406  100 * pMonsterStats
1407  ->pInfos
1408  [(unsigned __int16)
1410  int)((char *)
1412  ->ptr_1C -
1413  102)]]
1414  .uLevel,
1415  0);
1416  for (uint i = 0; i < 4; ++i)
1417  pParty->pPlayers[i].SetVariable(VAR_Award, 86);
1419  100 *
1422  int)((char *)window_SpeakInHouse->ptr_1C -
1423  102)]]
1424  .uLevel;
1426  int)((char *)window_SpeakInHouse->ptr_1C - 102)] =
1427  0;
1429  int)((char *)window_SpeakInHouse->ptr_1C - 102)] =
1430  false;
1431  }
1433  pNPCTopics[352].pText; //"Поздравляю! Вы успешно..."
1434  }
1435  } else if (uMessageParam == HOUSE_DIALOGUE_TOWNHALL_PAY_FINE) {
1437  }
1438  break;
1439  }
1440  case BuildingType_Bank:
1441  {
1442  if (dialog_menu_id >= 7 && dialog_menu_id <= 8)
1444  return;
1445  break;
1446  }
1451  case BuildingType_Tavern:
1452  case BuildingType_Temple:
1453  case BuildingType_Training:
1454  {
1455  break;
1456  }
1457  default:
1458  {
1459  return;
1460  break;
1461  }
1462  }
1463 
1464  switch (uMessageParam) {
1466  {
1470  break;
1471  }
1473  {
1477  break;
1478  }
1481  {
1482  dialog_menu_id = (HOUSE_DIALOGUE_MENU)uMessageParam;
1483  break;
1484  }
1486  {
1487  pMessageQueue_50CBD0->AddGUIMessage(UIMSG_PlayArcomage, 0, 0);
1489  break;
1490  }
1493  {
1495  [(unsigned int)window_SpeakInHouse->ptr_1C] <
1496  pParty->GetPlayingTime()) {
1503  p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1]
1505  }
1506  if (uMessageParam == HOUSE_DIALOGUE_SHOP_BUY_STANDARD) {
1508  [p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C -
1509  1]
1510  .uType]) {
1511  for (uint i = 0;
1512  i < (unsigned __int8)uItemsAmountPerShopType
1513  [p2DEvents[(unsigned int)
1515  1]
1516  .uType];
1517  ++i) {
1518  if (pParty
1519  ->StandartItemsInShops[(int)window_SpeakInHouse
1520  ->ptr_1C][i]
1521  .uItemID)
1524  pParty
1526  [(int)window_SpeakInHouse->ptr_1C]
1527  [i]
1528  .GetIconName(),
1529  0x7FF);
1530  }
1531  }
1534  [p2DEvents
1535  [(unsigned int)window_SpeakInHouse->ptr_1C - 1]
1536  .uType]) {
1537  for (uint i = 0;
1538  i <
1539  (unsigned __int8)uItemsAmountPerShopType
1540  [p2DEvents[(unsigned int)
1542  1]
1543  .uType];
1544  ++i) {
1545  if (pParty
1546  ->StandartItemsInShops
1547  [(int)window_SpeakInHouse->ptr_1C][i]
1548  .uItemID)
1549  weapons_Ypos[i] =
1550  rand() %
1551  (300 -
1552  shop_ui_items_in_store[i]->GetHeight());
1553  }
1554  }
1555  }
1556  }
1557  if (uMessageParam == HOUSE_DIALOGUE_SHOP_BUY_SPECIAL) {
1559  [p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C -
1560  1]
1561  .uType]) {
1562  for (uint i = 0;
1563  i < (unsigned __int8)uItemsAmountPerShopType
1564  [p2DEvents[(unsigned int)
1566  1]
1567  .uType];
1568  ++i) {
1569  if (pParty
1570  ->SpecialItemsInShops[(unsigned int)
1572  ->ptr_1C][i]
1573  .uItemID)
1576  pParty
1578  [(unsigned int)
1580  .GetIconName(),
1581  0x7FF);
1582  }
1583  }
1586  [p2DEvents
1587  [(unsigned int)window_SpeakInHouse->ptr_1C - 1]
1588  .uType]) {
1589  for (uint i = 0;
1590  i <
1591  (unsigned __int8)uItemsAmountPerShopType
1592  [p2DEvents[(unsigned int)
1594  1]
1595  .uType];
1596  ++i) {
1597  if (pParty
1598  ->SpecialItemsInShops
1599  [(unsigned int)
1601  .uItemID)
1602  weapons_Ypos[i] =
1603  rand() %
1604  (300 -
1605  shop_ui_items_in_store[i]->GetHeight());
1606  }
1607  }
1608  }
1609  }
1610  break;
1611  }
1615  {
1616  dialog_menu_id = (HOUSE_DIALOGUE_MENU)uMessageParam;
1618  break;
1619  }
1621  {
1625  break;
1626  }
1627  default:
1628  {
1629  if (uMessageParam >= HOUSE_DIALOGUE_36 &&
1630  uMessageParam <= HOUSE_DIALOGUE_GUILD_LEARN_SKILL) {
1631  v36 =
1632  (signed __int64)(p2DEvents[(unsigned int)
1634  1]
1635  .flt_24 *
1636  500.0);
1637  pPrice = v36 *
1638  (100 - pPlayers[uActiveCharacter]->GetMerchant()) /
1639  100;
1640  if (pPrice < v36 / 3) pPrice = v36 / 3;
1642  [pPlayers[uActiveCharacter]->classType]
1643  [uMessageParam - 36]) {
1645  ->pActiveSkills[uMessageParam - 36]) {
1646  if (pParty->GetGold() < pPrice) {
1647  GameUI_StatusBar_OnEvent(localization->GetString(LSTR_NOT_ENOUGH_GOLD));
1652  (unsigned int)window_SpeakInHouse->ptr_1C,
1654  else
1656  (unsigned int)window_SpeakInHouse->ptr_1C,
1658  } else {
1659  Party::TakeGold(pPrice);
1660  dword_F8B1E4 = 1;
1662  ->pActiveSkills[uMessageParam - 36] = 1;
1663  pPlayers[uActiveCharacter]->PlaySound(SPEECH_78, 0);
1664  }
1665  }
1666  }
1667  }
1668  break;
1669  }
1670  }
1671 }
1672 
1674  signed int v4; // ebx@1
1675  stru365_travel_info *pTravel; // esi@7
1676  signed int v12; // esi@13
1677  signed int v13; // edi@14
1678  int v14; // eax@26
1679  int v15; // edi@26
1680  int pTextHeight; // eax@36
1681  int pRealTextHeight; // esi@36
1682  int schedule_id; // esi@39
1683  GUIButton *pButton; // ebx@39
1684  signed int v25; // eax@41
1685  MapInfo pMap; // [sp-3Ch] [bp-2CCh]@62
1686  char pTopicArray[5][100]; // [sp+14h] [bp-27Ch]@37
1687  int pPrimaryTextHeight; // [sp+260h] [bp-30h]@36
1688  int index; // [sp+27Ch] [bp-14h]@36
1689  unsigned int pPrice; // [sp+288h] [bp-8h]@1
1690  int travel_time; // [sp+28Ch] [bp-4h]@48
1691  enum PlayerSpeech pSpeech;
1692  unsigned int pCurrentButton;
1693 
1694  GUIWindow travel_window = *window_SpeakInHouse;
1695  travel_window.uFrameX = 483;
1696  travel_window.uFrameWidth = 143;
1697  travel_window.uFrameZ = 334;
1698 
1699  v4 = p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType ==
1701  ? 25
1702  : 50;
1703  v4 *= p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1]
1705 
1706  pPrice = v4 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100;
1707  if ((signed int)pPrice < v4 / 3) pPrice = v4 / 3;
1710  index = 0;
1711  strcpy(pTopicArray[4], "");
1712 
1713  String str =
1714  localization->FormatString(405, pPrice); // Price: %lu gold
1715  pTextHeight =
1716  pFontArrus->CalcTextHeight(str, travel_window.uFrameWidth, 0);
1717  pRealTextHeight = pTextHeight + (pFontArrus->GetHeight() - 3) + 146;
1718  pPrimaryTextHeight = pRealTextHeight;
1719  pCurrentButton = 2;
1721  i < (unsigned int)(pDialogueWindow->pNumPresenceButton +
1723  ++i) {
1724  schedule_id =
1727  pButton = pDialogueWindow->GetControl(i);
1728 
1729  if (schedule_id != 255) {
1730  // if (schedule_id >= 25)
1731  // logger->Warning(L"Transport UI: schedule overflow");
1732  if (pCurrentButton >= 6)
1733  v25 = true;
1734  else
1735  v25 = transport_schedule[schedule_id]
1737  }
1738 
1739  if (schedule_id != 255 && v25 &&
1740  (!transport_schedule[schedule_id].uQuestBit ||
1743  transport_schedule[schedule_id]
1744  .uQuestBit))) { // ошибка: рисуется несколько строчек
1745  // одного направления путешествия
1746  // get color for current string(определение цвета текущей
1747  // строки)----------
1749  pCurrentButton)
1750  sprintf(pTopicArray[index], "\f%05d",
1751  Color16(255, 255, 155));
1752  else
1753  sprintf(pTopicArray[index], "\f%05d",
1754  Color16(255, 255, 255));
1755  // hired NPC premium(премия наёмного
1756  // НПС)----------------------------------
1757  travel_time = transport_schedule[schedule_id].uTravelTime;
1758  if ((unsigned int)window_SpeakInHouse->ptr_1C >=
1760  if (CheckHiredNPCSpeciality(Sailor)) travel_time -= 2;
1762  travel_time -= 3;
1763  if (CheckHiredNPCSpeciality(Pirate)) travel_time -= 2;
1764  } else {
1765  if (CheckHiredNPCSpeciality(Horseman)) travel_time -= 2;
1766  }
1767  if (CheckHiredNPCSpeciality(Explorer)) --travel_time;
1768 
1769  if (travel_time < 1) travel_time = 1;
1770  if (schedule_id != 255) {
1771  memcpy(
1772  &pMap,
1773  &pMapStats->pInfos[transport_schedule[schedule_id]
1774  .uMapInfoID],
1775  0x44u);
1777  404, travel_time,
1778  pMap.pName); // Time - %d days, destination %s
1779  strcat(pTopicArray[index], str.c_str());
1780  strcat(pTopicArray[index], "\n \n");
1781  pButton->uY = pRealTextHeight;
1782  pTextHeight = pFontArrus->CalcTextHeight(
1783  str, travel_window.uFrameWidth, 0);
1784  pButton->uHeight = pTextHeight;
1785  pButton->uW = pButton->uY + pTextHeight - 1 + 6;
1786  pRealTextHeight +=
1787  (pFontArrus->GetHeight() - 3) + pTextHeight;
1788  }
1789  } else {
1790  strcpy(pTopicArray[index], "");
1791  if (pButton) {
1792  pButton->uW = 0;
1793  pButton->uHeight = 0;
1794  pButton->uY = 0;
1795  }
1796  }
1797  ++index;
1798  ++pCurrentButton;
1799  }
1800  if (pRealTextHeight != pPrimaryTextHeight) {
1801  __debugbreak(); // first %s on format string is ambiguous state
1802  // of pTmpBuf2
1803  travel_window.DrawTitleText(
1804  pFontArrus, 0, 146, 0,
1805  StringPrintf("%s\n \n%s%s%s%s%s", "", pTopicArray[0],
1806  pTopicArray[1], pTopicArray[2], pTopicArray[3],
1807  pTopicArray[4]),
1808  3);
1809  } else {
1810  travel_window.DrawTitleText(
1811  pFontArrus, 0,
1812  (174 -
1814  travel_window.uFrameWidth, 0)) /
1815  2 +
1816  138, //"Извините, приходите в другой день"
1817  Color16(255, 255, 255), localization->GetString(561), 3);
1818  pAudioPlayer->StopChannels(-1, -1);
1819  }
1820  }
1821  } else { //после нажатия топика
1824  if (pParty->GetGold() < pPrice) {
1825  GameUI_StatusBar_OnEvent(localization->GetString(LSTR_NOT_ENOUGH_GOLD));
1827  pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0);
1828  return;
1829  }
1830 
1831  Party::TakeGold(pPrice);
1832 
1833  pTravel =
1835  [transport_routes[(unsigned int)
1838  [dialog_menu_id -
1840  if (pTravel->pSchedule[pParty->uCurrentDayOfMonth % 7]) {
1841  if (pCurrentMapName != pMapStats->pInfos[pTravel->uMapInfoID].pFilename) {
1842  SaveGame(1, 0);
1844 
1845  dword_6BE364_game_settings_1 |= GAME_SETTINGS_0001;
1849  pTravel->arrival_rot_y;
1851  Party_Teleport_X_Pos = pTravel->arrival_x;
1852  Party_Teleport_Y_Pos = pTravel->arrival_y;
1853  Party_Teleport_Z_Pos = pTravel->arrival_z;
1854  Start_Party_Teleport_Flag = pTravel->arrival_x | pTravel->arrival_y |
1855  pTravel->arrival_z | pTravel->arrival_rot_y;
1856  } else {
1858 
1859  pParty->uFlags |= 2u;
1860  pParty->vPosition.x = pTravel->arrival_x;
1861  pParty->vPosition.y = pTravel->arrival_y;
1862  pParty->vPosition.z = pTravel->arrival_z;
1864  pParty->sRotationX = 0;
1865  pParty->sRotationY = pTravel->arrival_rot_y;
1866  }
1867  PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C,
1869  v12 = pTravel->uTravelTime;
1870  if ((signed int)window_SpeakInHouse->ptr_1C >= 63) {
1871  pSpeech = SPEECH_SetSail;
1872  v13 = 2500;
1873  if (CheckHiredNPCSpeciality(Sailor)) v12 -= 2;
1874  if (CheckHiredNPCSpeciality(Navigator)) v12 -= 3;
1875  if (CheckHiredNPCSpeciality(Pirate)) v12 -= 2;
1876  } else {
1877  pSpeech = SPEECH_CarriageReady;
1878  v13 = 1500;
1879  if (CheckHiredNPCSpeciality(Horseman)) v12 -= 2;
1880  }
1881  if (CheckHiredNPCSpeciality(Explorer)) --v12;
1882  if (v12 < 1) v12 = 1;
1883  RestAndHeal(24 * 60 * v12);
1884  pPlayers[uActiveCharacter]->PlaySound(pSpeech, 0);
1885  v14 = OS_GetTime();
1886  v15 = v14 + v13;
1887  if (v15 < v14) v15 = v14;
1888  while (OS_GetTime() < v15) OS_Sleep(1);
1889  while (HouseDialogPressCloseBtn());
1890  pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 0, 0);
1891  return;
1892  } else {
1894  pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0);
1895  }
1896  }
1897  }
1898 }
1899 
1900 bool IsTravelAvailable(int a1) {
1901  for (uint i = 0; i < 4; ++i) {
1903  .pSchedule[pParty->uCurrentDayOfMonth % 7]) {
1904  if (!transport_schedule[transport_routes[a1][i]].uQuestBit ||
1908  return true;
1909  }
1910  }
1911  return false;
1912 }
1913 
1914 //----- (004B7911) --------------------------------------------------------
1916  int v1; // eax@10
1917  int v2; // esi@10
1918  signed int pStringSum; // ebx@24
1919  signed int v16; // ebx@28
1920  int v17; // ebx@28
1921  GUIButton *pButton; // eax@30
1922  int pTextHeight; // eax@30
1923  unsigned __int16 pTextColor; // ax@30
1924  int v29; // [sp+10Ch] [bp-10h]@28
1925  int v31; // [sp+114h] [bp-8h]@29
1926  GUIFont *pOutString; // [sp+118h] [bp-4h]@21
1927 
1928  GUIWindow townHall_window = *window_SpeakInHouse;
1929  townHall_window.uFrameX = 483;
1930  townHall_window.uFrameWidth = 143;
1931  townHall_window.uFrameZ = 334;
1932 
1933  auto fine_str =
1934  StringPrintf("%s: %d", localization->GetString(605),
1935  pParty->uFine); // Fine: %d / Текущий штраф: %d
1936  townHall_window.DrawTitleText(pFontArrus, 0, 260,
1937  Color16(0xFFu, 0xFFu, 0x9Bu), fine_str, 3);
1938 
1939  switch (dialog_menu_id) {
1940  case HOUSE_DIALOGUE_MAIN:
1941  {
1942  pStringSum = 1;
1943  pTextHeight = 0;
1945  604); // Bounty Hunting Охота за вознаграждение
1946  if (pParty->uFine > 0) {
1948  603); // Pay fine Заплатить штраф
1949  pStringSum = 2;
1950  }
1951  for (uint i = 0; i < pStringSum; ++i)
1952  pTextHeight += pFontArrus->CalcTextHeight(
1953  pShopOptions[i], townHall_window.uFrameWidth, 0);
1954  v29 = (100 - pTextHeight) / pStringSum;
1955  v16 = 80 - pStringSum * ((100 - pTextHeight) / pStringSum);
1956  v17 = (v16 / 2) - v29 / 2 + 158;
1958  v31 = 2;
1959  uint j = 0;
1961  i < pDialogueWindow->pNumPresenceButton +
1963  ++i) {
1964  pButton = pDialogueWindow->GetControl(i);
1965  pButton->uY = v29 + v17;
1966  pTextHeight = pFontArrus->CalcTextHeight(
1967  pShopOptions[j], townHall_window.uFrameWidth, 0);
1968  pButton->uHeight = pTextHeight;
1969  v17 = pButton->uY + pTextHeight - 1;
1970  pButton->uW = v17 + 6;
1971  pTextColor = Color16(0xFFu, 0xFFu, 0x9Bu);
1973  pTextColor = Color16(0xFFu, 0xFFu, 0xFFu);
1974  townHall_window.DrawTitleText(pFontArrus, 0, pButton->uY,
1975  pTextColor, pShopOptions[j],
1976  3);
1977  ++v31;
1978  ++j;
1979  }
1980  }
1981  break;
1982  }
1984  {
1987  StringPrintf(
1988  "\f%05d%s\f%05d", Color16(0xFFu, 0xFFu, 0x9Bu),
1990  .pName,
1991  Color16(0xFFu, 0xFFu, 0xFFu)),
1992  100 *
1994  .uLevel);
1996  window.uFrameWidth = 458;
1997  window.uFrameZ = 457;
1998  pOutString = pFontArrus;
2000  window.uFrameWidth, 13) +
2001  7;
2002  if (352 - pTextHeight < 8) {
2003  pOutString = pFontCreate;
2004  pTextHeight = pFontCreate->CalcTextHeight(
2005  current_npc_text, window.uFrameWidth, 13) +
2006  7;
2007  }
2008  render->DrawTextureCustomHeight(8 / 640.0f,
2009  (352 - pTextHeight) / 480.0f,
2010  ui_leather_mm7, pTextHeight);
2011  render->DrawTextureAlphaNew(
2012  8 / 640.0f, (347 - pTextHeight) / 480.0f, _591428_endcap);
2013  window.DrawText(pOutString, 13, 354 - pTextHeight, 0,
2014  pOutString->FitTextInAWindow(
2015  current_npc_text, window.uFrameWidth, 13),
2016  0, 0, 0);
2017  break;
2018  }
2020  {
2022  WINDOW_INPUT_IN_PROGRESS) {
2023  townHall_window.DrawTitleText(
2024  pFontArrus, 0, 146, Color16(0xFFu, 0xFFu, 0x9Bu),
2025  StringPrintf("%s\n%s", localization->GetString(606),
2026  localization->GetString(112)),
2027  3); // "Pay" "How Much?"
2028  townHall_window.DrawTitleText(
2029  pFontArrus, 0, 186, Color16(0xFFu, 0xFFu, 0xFFu),
2031  townHall_window.DrawFlashingInputCursor(
2034  2 +
2035  80,
2036  185, pFontArrus);
2037  return;
2038  }
2040  WINDOW_INPUT_CONFIRMED) {
2043  if (v1 <= 0) {
2044  pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0);
2045  return;
2046  }
2047  if (v1 > pParty->GetGold()) {
2049  (unsigned int)window_SpeakInHouse->ptr_1C,
2051  v2 = pParty->GetGold();
2052  }
2053  if (v2 > pParty->uFine) v2 = pParty->uFine;
2055  pParty->uFine -= v2;
2056  if (pParty->uFine < 0) pParty->uFine = 0;
2057  if (uActiveCharacter)
2058  pPlayers[uActiveCharacter]->PlaySound(SPEECH_81, 0);
2059  }
2061  WINDOW_INPUT_CANCELLED) {
2063  WINDOW_INPUT_NONE;
2064  pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0);
2065  }
2066  break;
2067  }
2068  default:
2069  break;
2070  }
2071  return;
2072 }
2073 
2074 void BankDialog() {
2075  GUIWindow bank_window = *window_SpeakInHouse;
2076  bank_window.uFrameX = 483;
2077  bank_window.uFrameWidth = 143;
2078  bank_window.uFrameZ = 334;
2079  bank_window.DrawTitleText(
2080  pFontArrus, 0, 220, Color16(0xFFu, 0xFFu, 0x9Bu),
2081  StringPrintf("%s: %d", localization->GetString(25),
2083  3); // Balance / Баланс
2084  switch (dialog_menu_id) {
2085  case HOUSE_DIALOGUE_MAIN:
2086  {
2087  uint16_t pColorText = Color16(0xFFu, 0xFFu, 0x9Bu);
2089  pColorText = Color16(0xFFu, 0xFFu, 0xFFu);
2090  }
2091  bank_window.DrawTitleText(pFontArrus, 0, 146, pColorText,
2092  localization->GetString(60), 3);
2093  pColorText = Color16(0xFFu, 0xFFu, 0x9Bu);
2095  pColorText = Color16(0xFFu, 0xFFu, 0xFFu);
2096  }
2097  bank_window.DrawTitleText(pFontArrus, 0, 176, pColorText,
2098  localization->GetString(244), 3);
2099  break;
2100  }
2102  {
2103  if (window_SpeakInHouse->receives_keyboard_input_2 == WINDOW_INPUT_IN_PROGRESS) {
2104  bank_window.DrawTitleText(
2105  pFontArrus, 0, 146, Color16(0xFFu, 0xFFu, 0x9Bu),
2106  StringPrintf("%s\n%s", localization->GetString(60),
2107  localization->GetString(112)),
2108  3); // Deposit How much? / "Положить" "Сколько?"
2109  bank_window.DrawTitleText(pFontArrus, 0, 186,
2110  Color16(0xFFu, 0xFFu, 0xFFu),
2112  bank_window.DrawFlashingInputCursor(
2115  2 + 80, 185, pFontArrus);
2116  return;
2117  }
2119  WINDOW_INPUT_CONFIRMED) {
2120  int entered_sum = atoi(pKeyActionMap->pPressedKeysBuffer);
2121  unsigned int takes_sum = entered_sum;
2122  if (!entered_sum) {
2123  pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0);
2124  return;
2125  }
2126  if (entered_sum > pParty->GetGold()) {
2128  (unsigned int)window_SpeakInHouse->ptr_1C,
2130  takes_sum = pParty->GetGold();
2131  }
2132  if (takes_sum) {
2133  Party::TakeGold(takes_sum);
2134  pParty->uNumGoldInBank += takes_sum;
2135  if (uActiveCharacter) {
2136  pPlayers[uActiveCharacter]->PlaySound(SPEECH_81, 0);
2137  }
2138  }
2139  window_SpeakInHouse->receives_keyboard_input_2 = WINDOW_INPUT_NONE;
2140  pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0);
2141  return;
2142  }
2143  if (window_SpeakInHouse->receives_keyboard_input_2 == WINDOW_INPUT_CANCELLED) {
2144  window_SpeakInHouse->receives_keyboard_input_2 = WINDOW_INPUT_NONE;
2145  pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0);
2146  }
2147  return;
2148  }
2150  {
2152  WINDOW_INPUT_IN_PROGRESS) {
2153  bank_window.DrawTitleText(
2154  pFontArrus, 0, 146, Color16(0xFFu, 0xFFu, 0x9Bu),
2155  StringPrintf("%s\n%s", localization->GetString(244),
2156  localization->GetString(112)),
2157  3); // Withdraw How much? / "Снять" "Сколько?"
2158  bank_window.DrawTitleText(pFontArrus, 0, 186,
2159  Color16(0xFFu, 0xFFu, 0xFFu),
2161  bank_window.DrawFlashingInputCursor(
2164  2 +
2165  80,
2166  185, pFontArrus);
2167  return;
2168  }
2169  if (window_SpeakInHouse->receives_keyboard_input_2 == WINDOW_INPUT_CONFIRMED) {
2170  window_SpeakInHouse->receives_keyboard_input_2 = WINDOW_INPUT_NONE;
2171  int entered_sum = atoi(pKeyActionMap->pPressedKeysBuffer);
2172  unsigned int takes_sum = entered_sum;
2173  if (entered_sum) {
2174  if (entered_sum > pParty->uNumGoldInBank) {
2176  (unsigned int)window_SpeakInHouse->ptr_1C,
2178  takes_sum = pParty->uNumGoldInBank;
2179  }
2180  if (takes_sum) {
2181  Party::AddGold(takes_sum);
2182  pParty->uNumGoldInBank -= takes_sum;
2183  }
2184  }
2185  window_SpeakInHouse->receives_keyboard_input_2 = WINDOW_INPUT_NONE;
2186  pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0);
2187  return;
2188  }
2189  if (window_SpeakInHouse->receives_keyboard_input_2 == WINDOW_INPUT_CANCELLED) {
2190  window_SpeakInHouse->receives_keyboard_input_2 = WINDOW_INPUT_NONE;
2191  pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0);
2192  }
2193  return;
2194  }
2195  default: { break; }
2196  }
2197 }
2198 
2199 //----- (004B8285) --------------------------------------------------------
2201  int pPriceRoom;
2202  int pPriceFood;
2203  int pPriceSkill;
2204  int pItemNum;
2205  double v2; // st7@1
2206  int pNumString; // edi@16
2207  signed int v9; // esi@16
2208  unsigned int pColorText; // eax@57
2209  GUIButton *pButton; // eax@65
2210  int pSkillCount;
2211  signed int pOptionsCount; // edi@77
2212  signed int i; // esi@79
2213  // signed int v53; // edi@81
2214  int v54; // edi@81
2215  const char *pText; // [sp-4h] [bp-278h]@93
2216  int v91; // [sp+270h] [bp-4h]@3
2217  unsigned int pTopic1Height; // [sp+26Fh] [bp-5h]@55
2218  unsigned __int8 pTopic2Height; // [sp+267h] [bp-Dh]@57
2219  unsigned __int8 pTopic3Height; // [sp+253h] [bp-21h]@59
2220  unsigned __int8 pTopic4Height = 0;
2221  int pTextHeight;
2222  int all_text_height; // [sp+260h] [bp-14h]@18
2223  GUIFont *pOutString;
2224 
2225  GUIWindow dialog_window = *window_SpeakInHouse;
2226  dialog_window.uFrameX = 483;
2227  dialog_window.uFrameWidth = 143;
2228  dialog_window.uFrameZ = 334;
2229  v2 = p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1]
2231 
2232  if (uActiveCharacter == 0) // avoid nzi
2234 
2235  pPriceRoom = ((v2 * v2) / 10) *
2236  (100 - pPlayers[uActiveCharacter]->GetMerchant()) /
2237  100; // nzi
2238  if (pPriceRoom < ((v2 * v2) / 10) / 3) pPriceRoom = ((v2 * v2) / 10) / 3;
2239  if (pPriceRoom <= 0) pPriceRoom = 1;
2240 
2241  pPriceFood = ((v2 * v2) * v2 / 100) *
2242  (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100;
2243  if (pPriceFood < ((v2 * v2) * v2 / 100) / 3)
2244  pPriceFood = ((v2 * v2) * v2 / 100) / 3;
2245  if (pPriceFood <= 0) pPriceFood = 1;
2246 
2247  switch (dialog_menu_id) {
2248  case HOUSE_DIALOGUE_MAIN:
2249  {
2250  if (!HouseUI_CheckIfPlayerCanInteract()) return;
2251 
2252  String topic1 =
2253  StringPrintf("\f%05d",
2255  ? Color16(0xFFu, 0xFFu, 0x9Bu)
2256  : Color16(0xFFu, 0xFFu, 0xFFu)) +
2258  178, pPriceRoom); // Rent room for %d gold
2259  pTopic1Height = pFontArrus->CalcTextHeight(
2260  topic1, dialog_window.uFrameWidth, 0);
2261 
2262  String topic2 =
2263  StringPrintf("\f%05d",
2265  ? Color16(0xFFu, 0xFFu, 0x9Bu)
2266  : Color16(0xFFu, 0xFFu, 0xFFu)) +
2268  86, // Buy food for %d days for %d gold
2269  (unsigned int)
2270  p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1]
2272  pPriceFood);
2273  pTopic2Height = pFontArrus->CalcTextHeight(
2274  topic2, dialog_window.uFrameWidth, 0);
2275 
2276  String topic3 =
2277  StringPrintf("\f%05d",
2279  ? Color16(0xFFu, 0xFFu, 0x9Bu)
2280  : Color16(0xFFu, 0xFFu, 0xFFu)) +
2281  localization->GetString(160); // Learn Skills
2282  pTopic3Height = pFontArrus->CalcTextHeight(
2283  topic3, dialog_window.uFrameWidth, 0);
2284 
2285  String topic4;
2286  if ((signed int)window_SpeakInHouse->par1C >= 108 &&
2287  (signed int)window_SpeakInHouse->par1C <= 120) {
2288  topic4 =
2289  StringPrintf("\f%05d",
2291  ? Color16(0xFFu, 0xFFu, 0x9Bu)
2292  : Color16(0xFFu, 0xFFu, 0xFFu)) +
2293  localization->GetString(611); // Play Arcomage
2294  pTopic4Height = pFontArrus->CalcTextHeight(
2295  topic4, dialog_window.uFrameWidth, 0);
2296  }
2297 
2299  for (pItemNum = pDialogueWindow->pStartingPosActiveItem;
2300  pItemNum < pDialogueWindow->pStartingPosActiveItem +
2302  ++pItemNum) {
2303  pButton = pDialogueWindow->GetControl(pItemNum);
2304  if (pButton->msg_param == 15) {
2305  pButton->uHeight = pTopic1Height;
2306  pButton->uY = 146;
2307  pButton->uW = pTopic1Height + 145 + 6;
2308  } else if (pButton->msg_param == 16) {
2309  pButton->uHeight = pTopic2Height;
2310  pButton->uY =
2311  pTopic1Height + (pFontArrus->GetHeight() ) + 146;
2312  pButton->uW = (pTopic1Height +
2313  (pFontArrus->GetHeight() ) + 146) +
2314  pTopic2Height - 1 + 6;
2315  } else if (pButton->msg_param == 96) {
2316  pButton->uY = pTopic1Height + pTopic2Height +
2317  2 * (pFontArrus->GetHeight() ) + 146;
2318  pButton->uHeight = pTopic3Height;
2319  pButton->uW =
2320  pTopic3Height +
2321  (pTopic1Height + pTopic2Height +
2322  2 * (pFontArrus->GetHeight() ) + 146) -
2323  1 + 6;
2324  } else if (pButton->msg_param == 101) {
2325  pButton->uHeight = pTopic4Height;
2326  pButton->uY = pTopic1Height +
2327  3 * (pFontArrus->GetHeight() ) +
2328  pTopic4Height + pTopic2Height + 146;
2329  pButton->uW =
2330  (pTopic1Height + 3 * (pFontArrus->GetHeight() ) +
2331  pTopic4Height + pTopic2Height + 146) +
2332  pTopic4Height - 1 + 6;
2333  }
2334  }
2335  dialog_window.DrawTitleText(
2336  pFontArrus, 0, 146, 0,
2337  StringPrintf("%s\n \n%s\n \n%s\n \n%s", topic1.c_str(),
2338  topic2.c_str(), topic3.c_str(),
2339  topic4.c_str()),
2340  3);
2341  }
2342  break;
2343  }
2345  {
2346  pOutString = pFontArrus;
2347 
2348  String str = pNPCTopics[354].pText;
2349  dialog_window.uFrameWidth = game_viewport_width;
2350  dialog_window.uFrameZ = 452;
2351  pTextHeight =
2352  pFontArrus->CalcTextHeight(str, dialog_window.uFrameWidth, 12) +
2353  7;
2354  if (352 - pTextHeight < 8) {
2355  pOutString = pFontCreate;
2356  pTextHeight = pFontCreate->CalcTextHeight(
2357  str, dialog_window.uFrameWidth, 12) +
2358  7;
2359  }
2360  render->DrawTextureCustomHeight(8 / 640.0f,
2361  (352 - pTextHeight) / 480.0f,
2362  ui_leather_mm7, pTextHeight);
2363  render->DrawTextureAlphaNew(
2364  8 / 640.0f, (347 - pTextHeight) / 480.0f, _591428_endcap);
2366  pOutString, 12, 354 - pTextHeight, 0,
2367  pOutString->FitTextInAWindow(str, dialog_window.uFrameWidth,
2368  12),
2369  0, 0, 0);
2370  break;
2371  }
2372 
2374  {
2375  String label =
2376  pNPCTopics[(uint)window_SpeakInHouse->ptr_1C + 247].pText;
2377  dialog_window.uFrameWidth = game_viewport_width;
2378  dialog_window.uFrameZ = 452;
2379  pTextHeight = pFontArrus->CalcTextHeight(
2380  label, dialog_window.uFrameWidth, 12) +
2381  7;
2382  render->DrawTextureCustomHeight(8 / 640.0f,
2383  (352 - pTextHeight) / 480.0f,
2384  ui_leather_mm7, pTextHeight);
2385  render->DrawTextureAlphaNew(
2386  8 / 640.0f, (347 - pTextHeight) / 480.0f, _591428_endcap);
2388  pFontArrus, 12, 354 - pTextHeight, 0,
2389  pFontArrus->FitTextInAWindow(label, dialog_window.uFrameWidth,
2390  12));
2391  break;
2392  }
2393 
2395  {
2396  if (pArcomageGame->bGameInProgress == 1) return;
2397  if (pArcomageGame->uGameWinner) {
2398  if (pArcomageGame->uGameWinner == 1)
2399  pText = localization->GetString(640); // You won!
2400  else
2401  pText = localization->GetString(641); // You lost!
2402  } else {
2403  pText = localization->GetString(639); // A tie!
2404  }
2405  dialog_window.DrawTitleText(
2406  pFontArrus, 0,
2407  (174 - pFontArrus->CalcTextHeight(
2408  pText, dialog_window.uFrameWidth, 0)) /
2409  2 +
2410  138,
2411  Color16(0xFFu, 0xFFu, 0x9Bu), pText, 3);
2412  break;
2413  }
2415  {
2416  if (pParty->GetGold() >= pPriceRoom) {
2417  Party::TakeGold(pPriceRoom);
2418  PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C,
2423  pMediaPlayer->Unload();
2424 
2427  window_SpeakInHouse = 0;
2428  return;
2429  }
2430  GameUI_StatusBar_OnEvent(localization->GetString(LSTR_NOT_ENOUGH_GOLD));
2432  pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0);
2433  break;
2434  }
2435 
2437  {
2438  if (!HouseUI_CheckIfPlayerCanInteract()) return;
2439  pSkillCount = 0;
2440  v9 = (signed __int64)(p2DEvents[(unsigned int)
2442  1]
2443  .flt_24 *
2444  500.0);
2445  pPriceSkill =
2446  v9 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100;
2447  if (pPriceSkill < v9 / 3) pPriceSkill = v9 / 3;
2448  all_text_height = 0;
2450  i < pDialogueWindow->pStartingPosActiveItem +
2452  ++i) {
2454  [pPlayers[uActiveCharacter]->classType]
2455  [pDialogueWindow->GetControl(i)->msg_param - 36] &&
2456  !pPlayers[uActiveCharacter]->pActiveSkills
2457  [pDialogueWindow->GetControl(i)->msg_param - 36]) {
2458  all_text_height = pFontArrus->CalcTextHeight(
2461  dialog_window.uFrameWidth, 0);
2462  pSkillCount++;
2463  }
2464  }
2465  if (pSkillCount) {
2467  401, pPriceSkill); //Стоимость навыка: %lu
2468  dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, label, 3);
2469  v91 = (149 - all_text_height) / pSkillCount;
2470  if ((149 - all_text_height) / pSkillCount > 32) v91 = 32;
2471  v54 = (149 - pSkillCount * v91 - all_text_height) / 2 -
2472  v91 / 2 + 162;
2474  i < pDialogueWindow->pStartingPosActiveItem +
2476  i++) {
2477  pButton = pDialogueWindow->GetControl(i);
2479  [pPlayers[uActiveCharacter]->classType]
2480  [pButton->msg_param - 36] ||
2482  ->pActiveSkills[pButton->msg_param - 36]) {
2483  pButton->uW = 0;
2484  pButton->uHeight = 0;
2485  pButton->uY = 0;
2486  } else {
2487  pButton->uY = v91 + v54;
2488  pTextHeight = pFontArrus->CalcTextHeight(
2489  localization->GetSkillName(pButton->msg_param - 36),
2490  dialog_window.uFrameWidth, 0);
2491  pButton->uHeight = pTextHeight;
2492  v54 = pTextHeight + pButton->uY - 1;
2493  pButton->uW = v54 + 6;
2494  pColorText = Color16(0xFFu, 0xFFu, 0x9Bu);
2496  pColorText = Color16(0xFFu, 0xFFu, 0xFFu);
2497  dialog_window.DrawTitleText(
2498  pFontArrus, 0, pButton->uY, pColorText,
2499  localization->GetSkillName(pButton->msg_param - 36),
2500  3);
2501  }
2502  }
2503  return;
2504  }
2505 
2507  544, pPlayers[uActiveCharacter]->pName,
2510  ->classType)) + // Советую вам %s %s поискать
2511  // знания еще где-нибудь
2512  "\n \n" +
2514  528); //Больше ничего не могу предложить.
2515  pTextHeight = (174 - pFontArrus->CalcTextHeight(
2516  str, dialog_window.uFrameWidth, 0)) /
2517  2 +
2518  138;
2519  dialog_window.DrawTitleText(pFontArrus, 0, pTextHeight,
2520  Color16(0xFFu, 0xFFu, 0x9Bu), str, 3);
2521  return;
2522  }
2523 
2525  {
2526  if ((double)pParty->GetFood() >=
2527  p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1]
2528  .fPriceMultiplier) {
2529  GameUI_StatusBar_OnEvent(localization->GetString(140)); // You already bought food!
2530  if (uActiveCharacter)
2531  pPlayers[uActiveCharacter]->PlaySound(SPEECH_67, 0);
2532  pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0);
2533  return;
2534  }
2535  if (pParty->GetGold() >= pPriceFood) {
2536  Party::TakeGold(pPriceFood);
2538  p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1]
2539  .fPriceMultiplier);
2541  pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0);
2542  return;
2543  }
2544  GameUI_StatusBar_OnEvent(localization->GetString(LSTR_NOT_ENOUGH_GOLD));
2546  pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0);
2547  break;
2548  }
2549 
2551  {
2553  pOptionsCount = 2;
2554  pShopOptions[0] = localization->GetString(620); //Правила
2555  pShopOptions[1] =
2556  localization->GetString(622); //Условия победы
2557  if (pParty->HasItem(
2558  651)) { // 651 - Колода для игры в АркоМэйдж в Items.txt
2559  pShopOptions[2] = localization->GetString(621); //Играть
2560  pOptionsCount = 3;
2561  }
2562  for (i = 0; i < pOptionsCount; ++i)
2563  all_text_height = pFontArrus->CalcTextHeight(
2564  pShopOptions[i], dialog_window.uFrameWidth, 0);
2565  all_text_height = (174 - all_text_height) / pOptionsCount;
2566 
2567  v54 = (174 -
2568  pOptionsCount * (174 - all_text_height) / pOptionsCount -
2569  all_text_height) /
2570  2 -
2571  (174 - all_text_height) / pOptionsCount / 2 + 138;
2572  pNumString = 0;
2573  for (pItemNum = pDialogueWindow->pStartingPosActiveItem;
2574  pItemNum < pDialogueWindow->pNumPresenceButton +
2576  pItemNum++) {
2577  pButton = pDialogueWindow->GetControl(pItemNum);
2578  pButton->uY = all_text_height + v54;
2579  pTextHeight = pFontArrus->CalcTextHeight(
2580  pShopOptions[pNumString], dialog_window.uFrameWidth, 0);
2581  pButton->uHeight = pTextHeight;
2582  v54 = pButton->uY + pTextHeight - 1;
2583  pButton->uW = v54 + 6;
2584  pColorText = Color16(0xFFu, 0xFFu, 0x9Bu);
2585  if (pDialogueWindow->pCurrentPosActiveItem != pItemNum)
2586  pColorText = Color16(0xFFu, 0xFFu, 0xFFu);
2587  dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY,
2588  pColorText,
2589  pShopOptions[pNumString], 3);
2590  ++pNumString;
2591  }
2592  }
2593  break;
2594  }
2595  default: { break; }
2596  }
2597 }
2598 
2600  int pPrice; // edi@1
2601  int pTextHeight; // eax@11
2602  unsigned __int16 pTextColor; // ax@21
2603  DDM_DLV_Header *v26; // edi@29
2604  unsigned int v30; // edx@36
2605  GUIButton *pButton; // edi@64
2606  unsigned __int8 index; // [sp+1B7h] [bp-Dh]@64
2607  int v64; // [sp+1B8h] [bp-Ch]@6
2608  unsigned int pCurrentItem; // [sp+1BCh] [bp-8h]@6
2609  int all_text_height; // [sp+1C0h] [bp-4h]@6
2610 
2611  GUIWindow tample_window = *window_SpeakInHouse;
2612  tample_window.uFrameX = 483;
2613  tample_window.uFrameWidth = 143;
2614  tample_window.uFrameZ = 334;
2615 
2616  if (uActiveCharacter == 0) { // avoid nzi
2618  }
2619 
2620  pPrice = pPlayers[uActiveCharacter]->GetTempleHealCostModifier(
2623  index = 1;
2624  pButton = pDialogueWindow->GetControl(
2626  pButton->uHeight = 0;
2627  pButton->uY = 0;
2628  if (pPlayers[uActiveCharacter]->IsPlayerHealableByTemple()) {
2629  static String shop_option_container;
2630  shop_option_container =
2631  StringPrintf("%s %d %s", localization->GetString(104), pPrice,
2632  localization->GetString(97)); //"Лечить" "Золото"
2633  pShopOptions[0] = shop_option_container.c_str();
2634  index = 0;
2635  }
2636  pShopOptions[1] = localization->GetString(68); //"Пожертвовать"
2637  pShopOptions[2] = localization->GetString(160); //"Обучиться навыкам"
2638  all_text_height = 0;
2639  if (index < pDialogueWindow->pNumPresenceButton) {
2640  uint i = index;
2641  for (uint j = index; j < pDialogueWindow->pNumPresenceButton; ++j) {
2642  all_text_height += pFontArrus->CalcTextHeight(
2643  pShopOptions[1 * i], tample_window.uFrameWidth, 0);
2644  i++;
2645  }
2646  }
2647  v64 = (174 - (signed int)all_text_height) /
2649  if (v64 > 32) v64 = 32;
2650  all_text_height =
2651  (174 - v64 * (pDialogueWindow->pNumPresenceButton - index) -
2652  (signed int)all_text_height) /
2653  2 -
2654  v64 / 2 + 138;
2658  uint i = index;
2659  for (pCurrentItem = index + pDialogueWindow->pStartingPosActiveItem;
2660  (signed int)pCurrentItem <
2663  ++pCurrentItem) {
2664  pButton = pDialogueWindow->GetControl(pCurrentItem);
2665  pButton->uY = v64 + all_text_height;
2666  pTextHeight = pFontArrus->CalcTextHeight(
2667  pShopOptions[1 * i], tample_window.uFrameWidth, 0);
2668  pButton->uHeight = pTextHeight;
2669  pButton->uW = pButton->uY + pTextHeight - 1 + 6;
2670  all_text_height = pButton->uW;
2671  pTextColor = Color16(0xFFu, 0xFFu, 0x9Bu);
2673  pTextColor = Color16(0xFFu, 0xFFu, 0xFFu);
2674  tample_window.DrawTitleText(pFontArrus, 0, pButton->uY,
2675  pTextColor, pShopOptions[1 * i], 3);
2676  i++;
2677  index++;
2678  }
2679  }
2680  return;
2681  }
2682  //-------------------------------------------------
2684  if (!pPlayers[uActiveCharacter]->IsPlayerHealableByTemple()) return;
2685  if (pParty->GetGold() < pPrice) {
2686  GameUI_StatusBar_OnEvent(localization->GetString(LSTR_NOT_ENOUGH_GOLD));
2688  pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0);
2689  return;
2690  }
2691  Party::TakeGold(pPrice);
2692 
2693  pPlayers[uActiveCharacter]->conditions_times.fill(
2694  GameTime(0)); // sets all condition times to zero
2695  pPlayers[uActiveCharacter]->sHealth =
2696  pPlayers[uActiveCharacter]->GetMaxHealth();
2697  pPlayers[uActiveCharacter]->sMana =
2698  pPlayers[uActiveCharacter]->GetMaxMana();
2699 
2700  if ((signed int)window_SpeakInHouse->ptr_1C != 78 &&
2701  ((signed int)window_SpeakInHouse->ptr_1C <= 80 ||
2702  (signed int)window_SpeakInHouse->ptr_1C > 82)) {
2704  ->conditions_times[Condition_Zombie]
2705  .Valid()) { // если состояние зомби
2706  pPlayers[uActiveCharacter]->uCurrentFace =
2707  pPlayers[uActiveCharacter]->uPrevFace;
2708  pPlayers[uActiveCharacter]->uVoiceID =
2709  pPlayers[uActiveCharacter]->uPrevVoiceID;
2711  uActiveCharacter - 1,
2712  pPlayers[uActiveCharacter]->uPrevFace);
2713  }
2714  pAudioPlayer->PlaySound((SoundID)SOUND_heal, -1, 0, -1, 0, 0);
2715  pPlayers[uActiveCharacter]->PlaySound(SPEECH_82, 0);
2716  pOtherOverlayList->_4418B1(20, uActiveCharacter + 99, 0, 65536);
2717  pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0);
2718  return;
2719  }
2721  ->conditions_times[Condition_Zombie]
2722  .Valid()) {
2723  // LODWORD(pPlayers[uActiveCharacter]->pConditions[Condition_Zombie])
2724  // =
2725  // LODWORD(pPlayers[uActiveCharacter]->pConditions[Condition_Zombie]);
2726  } else {
2728  ->conditions_times[Condition_Eradicated]
2729  .Valid() &&
2731  ->conditions_times[Condition_Pertified]
2732  .Valid() &&
2734  ->conditions_times[Condition_Dead]
2735  .Valid()) {
2736  pAudioPlayer->PlaySound((SoundID)SOUND_heal, -1, 0, -1, 0, 0);
2737  pPlayers[uActiveCharacter]->PlaySound(SPEECH_82, 0);
2738  pOtherOverlayList->_4418B1(20, uActiveCharacter + 99, 0, 65536);
2739  pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0);
2740  return;
2741  }
2742  pPlayers[uActiveCharacter]->uPrevFace =
2743  pPlayers[uActiveCharacter]->uCurrentFace;
2744  pPlayers[uActiveCharacter]->uPrevVoiceID =
2745  pPlayers[uActiveCharacter]->uVoiceID;
2746  pPlayers[uActiveCharacter]->SetCondition(Condition_Zombie, 1);
2747  pPlayers[uActiveCharacter]->uVoiceID =
2748  (pPlayers[uActiveCharacter]->GetSexByVoice() != 0) + 23;
2749  pPlayers[uActiveCharacter]->uCurrentFace =
2750  (pPlayers[uActiveCharacter]->GetSexByVoice() != 0) + 23;
2752  uActiveCharacter - 1,
2753  (pPlayers[uActiveCharacter]->GetSexByVoice() != 0) + 23);
2754  pPlayers[uActiveCharacter]->conditions_times[Condition_Zombie] =
2756  // v39 = (GUIWindow *)HIDWORD(pParty->uTimePlayed);
2757  }
2758  // HIDWORD(pPlayers[uActiveCharacter]->pConditions[Condition_Zombie]) =
2759  // (int)v39;
2760  pPlayers[uActiveCharacter]->conditions_times[Condition_Zombie] =
2762  pAudioPlayer->PlaySound((SoundID)SOUND_heal, -1, 0, -1, 0, 0);
2763  pPlayers[uActiveCharacter]->PlaySound(SPEECH_82, 0);
2764  pOtherOverlayList->_4418B1(20, uActiveCharacter + 99, 0, 65536);
2765  pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0);
2766  return;
2767  }
2768  //---------------------------------------------------
2770  pPrice = p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier;
2771  if (pParty->GetGold() >= pPrice) {
2772  Party::TakeGold(pPrice);
2773  v26 = &pOutdoor->ddm;
2775  if (v26->uReputation > -5) {
2776  v26->uReputation = v26->uReputation - 1;
2777  if (v26->uReputation - 1 < -5) v26->uReputation = -5;
2778  }
2779  if ((unsigned __int8)byte_F8B1EF[uActiveCharacter] ==
2780  pParty->uCurrentDayOfMonth % 7) {
2781  if (v26->uReputation <= -5) {
2782  v30 = pParty->uCurrentDayOfMonth % 7 + 1;
2783  v30 |= 0x80;
2785  SPELL_AIR_WIZARD_EYE, uActiveCharacter - 1, v30, 48, 0);
2786  }
2787  if (v26->uReputation <= -10) {
2788  v30 = pParty->uCurrentDayOfMonth % 7 + 1;
2789  v30 |= 0x80;
2792  48, 0);
2793  }
2794  if (v26->uReputation <= -15) {
2795  v30 = pParty->uCurrentDayOfMonth % 7 + 1;
2796  v30 |= 0x80;
2799  v30, 48, 0);
2800  }
2801  if (v26->uReputation <= -20) {
2802  v30 = pParty->uCurrentDayOfMonth % 7 + 1;
2803  v30 |= 0x80;
2806  48, 0);
2807  }
2808  if (v26->uReputation <= -25) {
2809  v30 = pParty->uCurrentDayOfMonth % 7 + 1;
2810  v30 |= 0x80;
2813  v30, 48, 0);
2814  }
2815  }
2817  pPlayers[uActiveCharacter]->PlaySound(SPEECH_83, 0);
2819  localization->GetString(527)); // "Thank You!"
2820  pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0);
2821  return;
2822  }
2823  GameUI_StatusBar_OnEvent(localization->GetString(LSTR_NOT_ENOUGH_GOLD));
2824  PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C,
2826  pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0);
2827  return;
2828  }
2829  //------------------------------------------------
2832  all_text_height = 0;
2833  pCurrentItem =
2834  (signed __int64)(p2DEvents[(signed int)
2836  1]
2837  .flt_24 *
2838  500.0);
2839  v64 = (signed int)(pCurrentItem *
2840  (100 -
2841  pPlayers[uActiveCharacter]->GetMerchant())) /
2842  100;
2843  if (v64 < (signed int)pCurrentItem / 3)
2844  v64 = (signed int)pCurrentItem / 3;
2845  pCurrentItem = 0;
2847  i < pDialogueWindow->pNumPresenceButton +
2849  ++i) {
2851  [pPlayers[uActiveCharacter]->classType]
2852  [pDialogueWindow->GetControl(i)->msg_param - 36] &&
2853  !pPlayers[uActiveCharacter]->pActiveSkills
2854  [pDialogueWindow->GetControl(i)->msg_param - 36]) {
2855  all_text_height += pFontArrus->CalcTextHeight(
2858  tample_window.uFrameWidth, 0);
2859  ++pCurrentItem;
2860  }
2861  }
2862  if (pCurrentItem) {
2863  auto str = localization->FormatString(401, v64);
2864  tample_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, str, 3);
2865  v64 = (149 - (signed int)all_text_height) /
2866  (signed int)pCurrentItem;
2867  if (v64 > 32) v64 = 32;
2868  all_text_height = (signed int)(149 - pCurrentItem * v64 -
2869  (int)all_text_height) /
2870  2 -
2871  v64 / 2 + 162;
2875  pCurrentItem = 2;
2877  i < pDialogueWindow->pNumPresenceButton +
2879  ++i) {
2880  pButton = pDialogueWindow->GetControl(i);
2882  [pPlayers[uActiveCharacter]->classType]
2883  [pButton->msg_param - 36] ||
2885  ->pActiveSkills[pButton->msg_param - 36]) {
2886  pButton->uW = 0;
2887  pButton->uHeight = 0;
2888  pButton->uY = 0;
2889  } else {
2890  pButton->uY = v64 + all_text_height;
2891  pTextHeight = pFontArrus->CalcTextHeight(
2892  localization->GetSkillName(pButton->msg_param -
2893  36),
2894  tample_window.uFrameWidth, 0);
2895  pButton->uHeight = pTextHeight;
2896  pButton->uW = pButton->uY + pTextHeight - 1 + 6;
2897  all_text_height = pButton->uW;
2898  pTextColor = Color16(0xFFu, 0xFFu, 0x9Bu);
2900  pCurrentItem)
2901  pTextColor = Color16(0xFFu, 0xFFu, 0xFFu);
2902  tample_window.DrawTitleText(
2903  pFontArrus, 0, pButton->uY, pTextColor,
2904  localization->GetSkillName(pButton->msg_param -
2905  36),
2906  3);
2907  }
2908  pCurrentItem++;
2909  }
2910  }
2911  } else {
2912  String str =
2914  544, pPlayers[uActiveCharacter]->pName,
2917  ->classType)) + // Советую вам %s %s поискать
2918  // знания еще где-нибудь
2919  "\n \n" +
2921  528); //Больше ничего не могу предложить.
2922 
2923  pTextHeight = pFontArrus->CalcTextHeight(
2924  str, tample_window.uFrameWidth, 0);
2925  tample_window.DrawTitleText(
2926  pFontArrus, 0, (174 - pTextHeight) / 2 + 138,
2927  Color16(0xFFu, 0xFFu, 0x9Bu), str, 3);
2928  }
2929  }
2930  }
2931 }
2932 
2933 void TrainingDialog(const char *s) {
2934  unsigned __int64 v5; // edi@3
2935  int v8; // edx@4
2936  double v9; // st7@6
2937  signed int v10; // esi@6
2938  int pPrice = 0; // ecx@6
2939  int v14; // esi@14
2940  int v19; // ecx@24
2941  int v33; // eax@36
2942  unsigned int v36; // eax@38
2943  unsigned int v42; // eax@46
2944  int index;
2945  int all_text_height; // eax@68
2946  int v49; // ebx@69
2947  GUIButton *pButton; // eax@71
2948  int pTextHeight; // eax@71
2949  unsigned __int16 pTextColor; // ax@71
2950  int v69; // [sp+70h] [bp-14h]@6
2951  int v73; // [sp+80h] [bp-4h]@14
2952 
2953  GUIWindow training_dialog_window = *window_SpeakInHouse;
2954  training_dialog_window.uFrameX = 483;
2955  training_dialog_window.uFrameWidth = 143;
2956  training_dialog_window.uFrameZ = 334;
2957 
2958  if (uActiveCharacter == 0) // avoid nzi
2960 
2961  v5 = 1000ull * pPlayers[uActiveCharacter]->uLevel *
2962  (pPlayers[uActiveCharacter]->uLevel + 1) /
2963  2; // E n = n(n + 1) / 2
2964  // v68 = pMaxLevelPerTrainingHallType[(unsigned
2965  // int)window_SpeakInHouse->ptr_1C -
2966  // HOUSE_TRAINING_HALL_EMERALD_ISLE];
2967  if (pPlayers[uActiveCharacter]->uExperience >= v5) {
2968  v8 = pPlayers[uActiveCharacter]->classType % 4 + 1;
2969  if (v8 == 4) v8 = 3;
2970  v9 = (double)pPlayers[uActiveCharacter]->uLevel;
2971  v69 = v8;
2972  v10 = (signed __int64)(v9 *
2974  .fPriceMultiplier *
2975  (double)v8);
2976  pPrice = v10 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100;
2977  if (pPrice < v10 / 3) pPrice = v10 / 3;
2978  }
2979  //-------------------------------------------------------
2980  all_text_height = 0;
2984  index = 0;
2985  pShopOptions[0] = s; // set first item to fucntion param - this
2986  // always gets overwritten below??
2987  pShopOptions[1] =
2988  localization->GetString(160); // "Learn Skills"
2993  i < pDialogueWindow->pNumPresenceButton +
2995  ++i) {
2998  static String shop_option_str_container;
2999  if (pPlayers[uActiveCharacter]->uLevel >=
3001  [(unsigned int)window_SpeakInHouse->ptr_1C -
3003  shop_option_str_container =
3004  String(localization->GetString(536)) +
3005  "\n \n" +
3007  529); // "With your skills, you should
3008  // be working here as a teacher."
3009  // "Sorry, but we are unable to
3010  // train you."
3011  pShopOptions[index] =
3012  shop_option_str_container.c_str();
3013 
3014  } else {
3015  if (pPlayers[uActiveCharacter]->uExperience <
3016  v5)
3017  shop_option_str_container =
3019  LSTR_XP_UNTIL_NEXT_LEVEL,
3020  (uint)(v5 - pPlayers[uActiveCharacter]->uExperience),
3021  pPlayers[uActiveCharacter]->uLevel + 1);
3022  else
3023  shop_option_str_container =
3025  537,
3026  pPlayers[uActiveCharacter]->uLevel + 1,
3027  pPrice); // "Train to level %d for
3028  // %d gold"
3029  pShopOptions[index] =
3030  shop_option_str_container.c_str();
3031  }
3032  }
3033  all_text_height += pFontArrus->CalcTextHeight(
3035  training_dialog_window.uFrameWidth, 0);
3036  ++index;
3037  }
3038  }
3039  v49 =
3040  (2 * (87 - (174 - all_text_height) / 2) - all_text_height) /
3041  2 -
3042  (174 - all_text_height) / 2 / 2 + 138;
3046  index = 0;
3048  i < pDialogueWindow->pStartingPosActiveItem +
3050  ++i) {
3051  pButton = pDialogueWindow->GetControl(i);
3052  pButton->uY = (174 - all_text_height) / 2 + v49;
3053  pTextHeight = pFontArrus->CalcTextHeight(
3055  training_dialog_window.uFrameWidth, 0);
3056  pButton->uHeight = pTextHeight;
3057  pButton->uW = pTextHeight + pButton->uY - 1 + 6;
3058  v49 = pButton->uW;
3059  pTextColor = Color16(0xE1u, 0xCDu, 0x23u);
3061  pTextColor = Color16(255, 255, 255);
3062  training_dialog_window.DrawTitleText(
3063  pFontArrus, 0, pButton->uY, pTextColor,
3064  pShopOptions[index], 3);
3065  ++index;
3066  }
3067  }
3068  }
3069  }
3070  //------------------------------------------------------------------
3072  String label;
3073 
3075  v33 = pFontArrus->CalcTextHeight(
3076  pNPCTopics[122].pText, training_dialog_window.uFrameWidth,
3077  0);
3078  training_dialog_window.DrawTitleText(
3079  pFontArrus, 0, (212 - v33) / 2 + 101,
3080  Color16(0xE1u, 0xCDu, 0x23u), pNPCTopics[122].pText, 3);
3082  return;
3083  }
3084  if (pPlayers[uActiveCharacter]->uLevel <
3086  [(unsigned int)window_SpeakInHouse->ptr_1C -
3088  if ((signed __int64)pPlayers[uActiveCharacter]->uExperience >=
3089  v5) {
3090  if (pParty->GetGold() >= pPrice) {
3091  Party::TakeGold(pPrice);
3093  (unsigned int)window_SpeakInHouse->ptr_1C,
3095  ++pPlayers[uActiveCharacter]->uLevel;
3096  pPlayers[uActiveCharacter]->uSkillPoints +=
3097  pPlayers[uActiveCharacter]->uLevel / 10 + 5;
3098  pPlayers[uActiveCharacter]->sHealth =
3099  pPlayers[uActiveCharacter]->GetMaxHealth();
3100  pPlayers[uActiveCharacter]->sMana =
3101  pPlayers[uActiveCharacter]->GetMaxMana();
3102  uint max_level_in_party = player_levels[0];
3103  for (uint _it = 1; _it < 4; ++_it) {
3104  if (player_levels[_it] > max_level_in_party)
3105  max_level_in_party = player_levels[_it];
3106  }
3108  if (player_levels[uActiveCharacter - 1] >
3109  max_level_in_party) { // if we reach new maximum
3110  // party level feature is
3111  // broken thou, since this
3112  // array is always zeroed in
3113  // EnterHouse
3114  v42 = 60 * (_494820_training_time(
3115  pParty->uCurrentHour) +
3116  4) -
3118  if ((unsigned int)window_SpeakInHouse->ptr_1C ==
3120  (unsigned int)window_SpeakInHouse->ptr_1C ==
3122  v42 += 12 * 60;
3123  RestAndHeal(v42 + 7 * 24 * 60);
3125  pOutdoor->SetFog();
3126  }
3127  pPlayers[uActiveCharacter]->PlaySound(SPEECH_87, 0);
3128 
3130  430, pPlayers[uActiveCharacter]->pName,
3131  pPlayers[uActiveCharacter]->uLevel,
3132  pPlayers[uActiveCharacter]->uLevel / 10 +
3133  5)); // %s is now Level %lu and has earned %lu
3134  // Skill Points!
3135 
3136  pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0);
3137  return;
3138  }
3139 
3140  GameUI_StatusBar_OnEvent(localization->GetString(LSTR_NOT_ENOUGH_GOLD));
3142  pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0);
3143  return;
3144  }
3146  LSTR_XP_UNTIL_NEXT_LEVEL,
3147  (unsigned int)(v5 - pPlayers[uActiveCharacter]->uExperience),
3148  pPlayers[uActiveCharacter]->uLevel + 1);
3149  v36 =
3150  (212 - pFontArrus->CalcTextHeight(
3151  label, training_dialog_window.uFrameWidth, 0)) /
3152  2 +
3153  88;
3154  } else {
3155  label = StringPrintf(
3156  "%s\n \n%s",
3158  536), // With your skills, you should be working here
3159  // as a teacher.
3161  529)); // Sorry, but we are unable to train you.
3162  v36 =
3163  (212 - pFontArrus->CalcTextHeight(
3164  label, training_dialog_window.uFrameWidth, 0)) /
3165  2 +
3166  101;
3167  }
3168  training_dialog_window.DrawTitleText(
3169  pFontArrus, 0, v36, Color16(0xE1u, 0xCDu, 0x23u), label, 3);
3170 
3171  PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C,
3172  (HouseSoundID)3);
3173  pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0);
3174  return;
3175  }
3176  }
3177 
3178  //-------------------------------------------------------------
3181  v14 = (signed __int64)(p2DEvents[(unsigned int)
3183  1]
3184  .flt_24 *
3185  500.0);
3186  pPrice =
3187  v14 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100;
3188  if (pPrice < v14 / 3) pPrice = v14 / 3;
3189  index = 0;
3191  (signed int)i < pDialogueWindow->pNumPresenceButton +
3193  ++i) {
3195  [pPlayers[uActiveCharacter]->classType]
3196  [pDialogueWindow->GetControl(i)->msg_param - 36] &&
3197  !pPlayers[uActiveCharacter]->pActiveSkills
3198  [pDialogueWindow->GetControl(i)->msg_param - 36]) {
3199  all_text_height += pFontArrus->CalcTextHeight(
3202  training_dialog_window.uFrameWidth, 0);
3203  ++index;
3204  }
3205  }
3206  if (index) {
3207  training_dialog_window.DrawTitleText(
3208  pFontArrus, 0, 0x92u, 0,
3209  localization->FormatString(401, pPrice),
3210  3); // "Skill Cost: %lu"
3211  v73 = (signed int)(149 - all_text_height) / index;
3212  if (v73 > 32) v73 = 32;
3213  v19 = (signed int)(149 - index * v73 - all_text_height) / 2 -
3214  v73 / 2 + 162;
3216  (signed int)i < pDialogueWindow->pStartingPosActiveItem +
3218  ++i) {
3219  pButton = pDialogueWindow->GetControl(i);
3221  [pPlayers[uActiveCharacter]->classType]
3222  [pButton->msg_param - 36] ||
3224  ->pActiveSkills[pButton->msg_param - 36]) {
3225  pButton->uW = 0;
3226  pButton->uHeight = 0;
3227  pButton->uY = 0;
3228  } else {
3229  pButton->uY = v73 + v19;
3230  pTextHeight = pFontArrus->CalcTextHeight(
3231  localization->GetSkillName(pButton->msg_param - 36),
3232  training_dialog_window.uFrameWidth, 0);
3233  pButton->uHeight = pTextHeight;
3234  pButton->uW = pButton->uY + pTextHeight - 1 + 6;
3235  v19 = pButton->uY + pTextHeight - 1;
3236  pTextColor = Color16(0xE1u, 0xCDu, 0x23u);
3238  pTextColor = Color16(255, 255, 255);
3239  training_dialog_window.DrawTitleText(
3240  pFontArrus, 0, pButton->uY, pTextColor,
3241  localization->GetSkillName(pButton->msg_param - 36),
3242  3);
3243  }
3244  }
3245  } else {
3247  544, pPlayers[uActiveCharacter]->pName,
3250  ->classType)) + // Seek knowledge
3251  // elsewhere %s the %s
3252  "\n \n" +
3254  528); // I can offer you nothing further.
3255  auto label_height = pFontArrus->CalcTextHeight(
3256  label, training_dialog_window.uFrameWidth, 0);
3257  training_dialog_window.DrawTitleText(
3258  pFontArrus, 0, (174 - label_height) / 2 + 138,
3259  Color16(0xE1u, 0xCDu, 0x23u), label, 3);
3260  }
3261  }
3262  }
3263  return;
3264 }
3265 
3266 void sub_4B6478() {
3267  signed int v3; // esi@1
3268  int pPrice; // ebx@1
3269  unsigned int v5; // esi@5
3270  int v6; // edi@6
3271  int all_text_height; // eax@20
3272  GUIButton *pButton; // esi@27
3273  int pTextHeight; // eax@29
3274  unsigned __int16 pTextColor; // ax@29
3275  int v27; // [sp-4h] [bp-80h]@8
3276  int v32; // [sp+6Ch] [bp-10h]@1
3277  int index; // [sp+74h] [bp-8h]@17
3278 
3279  GUIWindow dialog_window = *window_SpeakInHouse;
3280  dialog_window.uFrameX = 483;
3281  dialog_window.uFrameWidth = 143;
3282  dialog_window.uFrameZ = 334;
3283 
3284  v32 =
3285  (unsigned __int8)(((p2DEvents
3286  [(unsigned int)window_SpeakInHouse->ptr_1C - 1]
3287  .uType != 18) -
3288  1) &
3289  0x96) +
3290  100;
3291  v3 = (signed __int64)((double)v32 *
3292  p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C -
3293  1]
3294  .fPriceMultiplier);
3295  pPrice = v3 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100;
3296  if (pPrice < v3 / 3) pPrice = v3 / 3;
3298  if (!(unsigned __int16)_449B57_test_bit(
3299  (unsigned __int8 *)pPlayers[uActiveCharacter]
3300  ->_achieved_awards_bits,
3301  word_4F0754[2 * (unsigned int)window_SpeakInHouse->ptr_1C])) {
3302  pTextHeight = pFontArrus->CalcTextHeight(
3303  pNPCTopics[171].pText, dialog_window.uFrameWidth, 0);
3304  dialog_window.DrawTitleText(
3305  pFontArrus, 0, (212 - pTextHeight) / 2 + 101,
3306  Color16(0xFFu, 0xFFu, 0x9Bu), pNPCTopics[171].pText, 3);
3308  return;
3309  }
3310  if (!HouseUI_CheckIfPlayerCanInteract()) return;
3311  all_text_height = 0;
3312  index = 0;
3314  i < pDialogueWindow->pNumPresenceButton +
3316  ++i) {
3318  [pPlayers[uActiveCharacter]->classType / 3]
3319  [pDialogueWindow->GetControl(i)->msg_param - 36] &&
3321  ->pActiveSkills[pDialogueWindow->GetControl(i)->msg_param -
3322  36]) {
3323  all_text_height += pFontArrus->CalcTextHeight(
3326  dialog_window.uFrameWidth, 0);
3327  ++index;
3328  }
3329  }
3330  if (!index) {
3332  544, pPlayers[uActiveCharacter]->pName,
3334  pPlayers[uActiveCharacter]->classType)) +
3335  "\n \n" +
3337  528); // Больше ничего не могу предложить.
3338  pTextHeight =
3339  pFontArrus->CalcTextHeight(str, dialog_window.uFrameWidth, 0);
3340  dialog_window.DrawTitleText(pFontArrus, 0,
3341  (174 - pTextHeight) / 2 + 138,
3342  Color16(0xFFu, 0xFFu, 0x9Bu), str, 3);
3343  return;
3344  }
3345 
3346  auto skill_price_label =
3347  localization->FormatString(401, pPrice); //Стоимость навыка: %lu
3348  dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, skill_price_label,
3349  3);
3350 
3351  v32 = (149 - all_text_height) / index;
3352  if (v32 > 32) v32 = 32;
3353  index = (149 - index * v32 - all_text_height) / 2 - v32 / 2 + 162;
3358  i < pDialogueWindow->pNumPresenceButton +
3360  ++i) {
3361  pButton = pDialogueWindow->GetControl(i);
3363  [pPlayers[uActiveCharacter]->classType / 3]
3364  [pButton->msg_param - 36]) {
3366  ->pActiveSkills[pButton->msg_param - 36]) {
3367  pButton->uY = v32 + index;
3368  pTextHeight = pFontArrus->CalcTextHeight(
3369  localization->GetSkillName(pButton->msg_param - 36),
3370  dialog_window.uFrameWidth, 0);
3371  pButton->uHeight = pTextHeight;
3372  pButton->uW = pButton->uY + pTextHeight - 1 + 6;
3373  index = pButton->uY + pTextHeight - 1;
3374  pTextColor = Color16(0xFFu, 0xFFu, 0x9Bu);
3376  pTextColor = Color16(0xFFu, 0xFFu, 0xFFu);
3377  dialog_window.DrawTitleText(
3378  pFontArrus, 0, pButton->uY, pTextColor,
3379  localization->GetSkillName(pButton->msg_param - 36),
3380  3);
3381  }
3382  } else {
3383  pButton->uW = 0;
3384  pButton->uHeight = 0;
3385  pButton->uY = 0;
3386  }
3387  }
3388  }
3389  return;
3390  }
3391 
3393  v5 = 0;
3394  __debugbreak();
3395  // pSkillAvailabilityPerClass[8 + v58->uClass][4 + v23]
3396  // or
3397  // byte_4ED970_skill_learn_ability_by_class_table[v58->uClass][v23 - 36]
3398  // or
3399  // byte_4ED970_skill_learn_ability_by_class_table[v58->uClass - 1][v23 +
3400  // 1]
3401  __debugbreak(); // whacky condition - fix
3402  if (false
3403  // if ( !*(&byte_4ED94C[37 * v1->uClass / 3] + dword_F8B19C)
3404  || (v6 = (int)(&pPlayers[uActiveCharacter]->uIntelligence +
3405  dialog_menu_id),
3406  *(short *)v6)) {
3407  pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0);
3408  } else {
3409  if (pParty->GetGold() < pPrice) {
3410  GameUI_StatusBar_OnEvent(localization->GetString(LSTR_NOT_ENOUGH_GOLD));
3411  v27 = 4;
3412  } else {
3413  Party::TakeGold(pPrice);
3414  *(short *)v6 = 1;
3415  v27 = 2;
3416  }
3417  PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)v27);
3418  }
3419  } else {
3420  v5 = 0;
3421  }
3422  pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, v5);
3423  return; // void func
3424 }
3425 
3427  NPCData *pNPC; // esi@6
3428  char *v15; // esi@14
3429  GUIButton *pButton; // eax@15
3430  char *v29; // esi@42
3431  int v31; // ST1C_4@42
3432  int index; // esi@51
3433  int v36;
3434  signed int all_text_height; // ecx@54
3435  int v40; // edi@57
3436  unsigned __int16 pTextColor; // ax@60
3437  GUIFont *pTextFont; // ebx@64
3438  int pTextHeight;
3439  GUIWindow w; // [sp+Ch] [bp-110h]@64
3440  char *pInString; // [sp+114h] [bp-8h]@12
3441 
3442  GUIWindow house_window = *pDialogueWindow;
3444  house_window.uFrameX = 493;
3445  house_window.uFrameWidth = 126;
3446  house_window.uFrameZ = 366;
3447  house_window.DrawTitleText(pFontCreate, 0, 2, 0,
3449  house_window.uFrameX = 483;
3450  house_window.uFrameWidth = 143;
3451  house_window.uFrameZ = 334;
3453  auto str = localization->FormatString(
3455  .pName); // Enter %s / Войти в ^Pv[%s]
3456  house_window.DrawTitleText(
3457  pFontCreate, 0,
3458  (212 - pFontCreate->CalcTextHeight(
3459  str, house_window.uFrameWidth, 0)) /
3460  2 +
3461  101,
3462  0, str, 3);
3463  return;
3464  }
3465 
3466  house_window.DrawTitleText(
3467  pFontCreate, 0,
3468  (212 -
3470  house_window.uFrameWidth, 0)) /
3471  2 +
3472  101,
3474  return;
3475  }
3476  house_window.uFrameWidth -= 10;
3477  house_window.uFrameZ -= 10;
3478  pNPC = HouseNPCData[(unsigned int)((char *)pDialogueNPCCount +
3479  -(dword_591080 != 0))]; //- 1
3480 
3481  String npc_name;
3482  if (pNPC->uProfession)
3483  npc_name = localization->FormatString(
3484  429, pNPC->pName,
3486  pNPC->uProfession)); // %s %s / ^Pi[%s] %s
3487  else
3488  npc_name = pNPC->pName;
3489  house_window.DrawTitleText(pFontCreate, 483, 113,
3490  Color16(0x15u, 0x99u, 0xE9u), npc_name, 3);
3491 
3492  if (!dword_591080) {
3493  if (!uDialogueType) {
3494  if (pNPC->greet) {
3495  house_window.uFrameWidth = game_viewport_width;
3496  house_window.uFrameZ = 452;
3497  pInString = pNPCStats->pNPCGreetings[pNPC->greet]
3498  .pGreetings[((pNPC->uFlags & 3) == 2)];
3499  // pInString = (char *)*(&pNPCStats->field_17884 +
3500  // ((pNPC->uFlags & 3) == 2) + 2 * pNPC->greet);
3501  render->DrawTextureCustomHeight(
3502  8 / 640.0f,
3503  (352 - (pFontArrus->CalcTextHeight(
3504  pInString, house_window.uFrameWidth, 13) +
3505  7)) /
3506  480.0f,
3508  (pFontArrus->CalcTextHeight(pInString,
3509  house_window.uFrameWidth, 13) +
3510  7));
3511 
3512  int h = (pFontArrus->CalcTextHeight(
3513  pInString, house_window.uFrameWidth, 13) +
3514  7);
3515  render->DrawTextureAlphaNew(8 / 640.0f, (347 - h) / 480.0f,
3516  _591428_endcap);
3518  pFontArrus, 13, 354 - h, 0,
3519  pFontArrus->FitTextInAWindow(pInString,
3520  house_window.uFrameWidth, 13),
3521  0, 0, 0);
3522  }
3523  }
3524  }
3525  // for right panel
3526  GUIWindow right_panel_window = *pDialogueWindow;
3527  right_panel_window.uFrameX = 483;
3528  right_panel_window.uFrameWidth = 143;
3529  right_panel_window.uFrameZ = 334;
3530  for (int i = right_panel_window.pStartingPosActiveItem;
3531  i < right_panel_window.pStartingPosActiveItem +
3532  right_panel_window.pNumPresenceButton;
3533  ++i) {
3534  pButton = right_panel_window.GetControl(i);
3535  switch (pButton->msg_param) {
3536  case 19: // evt_A
3537  v15 = (char *)pNPCTopics[pNPC->evt_A].pTopic;
3538  if (!v15) {
3539  pButton->msg_param = 0;
3540  v15 = "";
3541  }
3542  pButton->sLabel = v15;
3543  continue;
3544  case 20: // evt_B
3545  v15 = (char *)pNPCTopics[pNPC->evt_B].pTopic;
3546  if (!v15) {
3547  pButton->msg_param = 0;
3548  v15 = "";
3549  }
3550  if (uDialogueType != 84) {
3551  pButton->sLabel = v15;
3552  continue;
3553  }
3555  current_npc_text.c_str(),
3556  StringPrintf("\f%05d%s\f00000\n",
3557  Color16(0xE1u, 0xCDu, 0x23u),
3559  .pUnidentifiedName)
3560  .c_str());
3561  pButton->sLabel = v15;
3562  continue;
3563 
3564  case 21: // evt_C
3565  v15 = (char *)pNPCTopics[pNPC->evt_C].pTopic;
3566  if (!v15) {
3567  pButton->msg_param = 0;
3568  v15 = "";
3569  }
3570  pButton->sLabel = v15;
3571  continue;
3572  case 22: // evt_D
3573  v15 = (char *)pNPCTopics[pNPC->evt_D].pTopic;
3574  if (!v15) {
3575  pButton->msg_param = 0;
3576  v15 = "";
3577  }
3578  pButton->sLabel = v15;
3579  continue;
3580  case 23: // evt_E
3581  v15 = (char *)pNPCTopics[pNPC->evt_E].pTopic;
3582  if (!v15) {
3583  pButton->msg_param = 0;
3584  v15 = "";
3585  }
3586  pButton->sLabel = v15;
3587  continue;
3588  case 24: // evt_F
3589  v15 = (char *)pNPCTopics[pNPC->evt_F].pTopic;
3590  if (!v15) {
3591  pButton->msg_param = 0;
3592  v15 = "";
3593  }
3594  pButton->sLabel = v15;
3595  continue;
3596  case 76:
3597  pButton->sLabel =
3598  localization->GetString(406); // Hire / Нанять
3599  continue;
3600  case 77:
3601  pButton->sLabel =
3602  localization->GetString(407); // Details / Подробнее
3603  continue;
3604  case 79:
3605  pButton->sLabel =
3606  _4B254D_SkillMasteryTeacher((int)right_panel_window.ptr_1C);
3607  continue;
3608  case 82:
3609  pButton->sLabel =
3610  ContractSelectText((int)right_panel_window.ptr_1C);
3611  continue;
3612  case 83:
3613  v29 =
3615  .pName;
3616  v31 = *(int *)v29;
3617 
3620  StringPrintf("\f%05d%s\f%05d", Color16(0xFFu, 0xFFu, 0x9Bu),
3621  v31, Color16(0xFFu, 0xFFu, 0xFFu))
3622  .c_str(),
3623  100 * (unsigned __int8)v29[8]);
3624 
3625  pButton->sLabel.clear();
3626  continue;
3627  }
3628  if (pButton->msg_param > 0 && pButton->msg_param < 13) {
3629  pButton->sLabel = localization->GetString(122); // Вступить
3630  continue;
3631  }
3632  if (pButton->msg_param > 13 && pButton->msg_param < 19) {
3633  pButton->sLabel.clear();
3634  continue;
3635  }
3636  if (pButton->msg_param != 93) {
3637  pButton->sLabel.clear();
3638  continue;
3639  }
3640  }
3641  index = 0;
3642  all_text_height = 0;
3644  i < pDialogueWindow->pStartingPosActiveItem +
3646  ++i) {
3647  pButton = pDialogueWindow->GetControl(i);
3648  all_text_height += pFontArrus->CalcTextHeight(
3649  pButton->sLabel, right_panel_window.uFrameWidth, 0);
3650  index++;
3651  }
3652  if (index) {
3653  v36 = (174 - all_text_height) / index;
3654  if (v36 > 32) v36 = 32;
3655  v40 = (174 - v36 * index - all_text_height) / 2 - v36 / 2 + 138;
3657  i < pDialogueWindow->pNumPresenceButton +
3659  ++i) {
3660  pButton = pDialogueWindow->GetControl(i);
3661  pButton->uY = v36 + v40;
3662  pTextHeight = pFontArrus->CalcTextHeight(
3663  pButton->sLabel, right_panel_window.uFrameWidth, 0);
3664  pButton->uHeight = pTextHeight;
3665  v40 = pButton->uY + pTextHeight - 1;
3666  pButton->uW = v40 + 6;
3667  pTextColor = Color16(0xE1u, 0xCDu, 0x23u);
3669  pTextColor = Color16(0xFFu, 0xFFu, 0xFFu);
3670  right_panel_window.DrawTitleText(pFontArrus, 0, pButton->uY,
3671  pTextColor, pButton->sLabel, 3);
3672  }
3673  }
3674  if (current_npc_text.length() > 0) {
3675  w.uFrameWidth = 458;
3676  w.uFrameZ = 457;
3677  pTextFont = pFontArrus;
3678  pTextHeight =
3679  pFontArrus->CalcTextHeight(current_npc_text, w.uFrameWidth, 13) + 7;
3680  if (352 - pTextHeight < 8) {
3681  pTextFont = pFontCreate;
3683  w.uFrameWidth, 13) +
3684  7;
3685  }
3686  render->DrawTextureCustomHeight(8 / 640.0f,
3687  (352 - pTextHeight) / 480.0f,
3688  ui_leather_mm7, pTextHeight);
3689  render->DrawTextureAlphaNew(8 / 640.0f, (347 - pTextHeight) / 480.0f,
3690  _591428_endcap);
3691  house_window.DrawText(
3692  pTextFont, 13, 354 - pTextHeight, 0,
3693  pTextFont->FitTextInAWindow(current_npc_text, w.uFrameWidth, 13), 0,
3694  0, 0);
3695  }
3696 }
3697 
3698 void JailDialog() {
3699  GUIWindow jail_dialogue_window = *window_SpeakInHouse;
3700  jail_dialogue_window.uFrameX = 483;
3701  jail_dialogue_window.uFrameWidth = 143;
3702  jail_dialogue_window.uFrameZ = 334;
3703  jail_dialogue_window.DrawTitleText(
3704  pFontArrus, 0,
3706  jail_dialogue_window.uFrameWidth,
3707  0)) /
3708  2 +
3709  18,
3710  Color16(0xFFu, 0xFFu, 0x9Bu), localization->GetString(672),
3711  3); //"За многочисленные преступления и злодеяния вы были приговорены к
3712  //одному году заключения."
3713 }
3714 
3716  int i;
3717  char *test_string;
3718  unsigned char c;
3719  bool break_loop;
3720  unsigned int temp_str_len;
3721  char *tmp_pos;
3722  int decode_step;
3723 
3724  free(p2DEventsTXT_Raw);
3725  p2DEventsTXT_Raw = (char *)pEvents_LOD->LoadCompressedTexture("2dEvents.txt");
3726  strtok(p2DEventsTXT_Raw, "\r");
3727  strtok(NULL, "\r");
3728 
3729  for (i = 0; i < 525; ++i) {
3730  test_string = strtok(NULL, "\r") + 1;
3731  break_loop = false;
3732  decode_step = 0;
3733  do {
3734  c = *(unsigned char *)test_string;
3735  temp_str_len = 0;
3736  while ((c != '\t') && (c > 0)) {
3737  ++temp_str_len;
3738  c = test_string[temp_str_len];
3739  }
3740  tmp_pos = test_string + temp_str_len;
3741  if (*tmp_pos == 0) break_loop = true;
3742  *tmp_pos = 0;
3743  if (temp_str_len) {
3744  switch (decode_step) {
3745  case 2:
3746  {
3747  if (!_strnicmp(test_string, "wea", 3)) {
3749  break;
3750  }
3751  if (!_strnicmp(test_string, "arm", 3)) {
3753  break;
3754  }
3755  if (!_strnicmp(test_string, "mag", 3)) {
3757  break;
3758  }
3759  if (!_strnicmp(test_string, "alc", 3)) {
3761  break;
3762  }
3763  if (!_strnicmp(test_string, "sta", 3)) {
3765  break;
3766  }
3767  if (!_strnicmp(test_string, "boa", 3)) {
3769  break;
3770  }
3771  if (!_strnicmp(test_string, "tem", 3)) {
3773  break;
3774  }
3775  if (!_strnicmp(test_string, "tra", 3)) {
3777  break;
3778  }
3779  if (!_strnicmp(test_string, "tow", 3)) {
3781  break;
3782  }
3783 
3784  if (!_strnicmp(test_string, "tav", 3)) {
3786  break;
3787  }
3788  if (!_strnicmp(test_string, "ban", 3)) {
3790  break;
3791  }
3792  if (!_strnicmp(test_string, "fir", 3)) {
3794  break;
3795  }
3796  if (!_strnicmp(test_string, "air", 3)) {
3798  break;
3799  }
3800  if (!_strnicmp(test_string, "wat", 3)) {
3802  break;
3803  }
3804  if (!_strnicmp(test_string, "ear", 3)) {
3806  break;
3807  }
3808  if (!_strnicmp(test_string, "spi", 3)) {
3810  break;
3811  }
3812  if (!_strnicmp(test_string, "min", 3)) {
3814  break;
3815  }
3816  if (!_strnicmp(test_string, "bod", 3)) {
3818  break;
3819  }
3820  if (!_strnicmp(test_string, "lig", 3)) {
3822  break;
3823  }
3824  if (!_strnicmp(test_string, "dar", 3)) {
3826  break;
3827  }
3828  if (!_strnicmp(test_string, "ele",
3829  3)) { // "Element Guild" from mm6
3831  break;
3832  }
3833  if (!_strnicmp(test_string, "sel", 3)) {
3835  break;
3836  }
3837  if (!_strnicmp(test_string, "mir", 3)) {
3839  break;
3840  }
3841  if (!_strnicmp(test_string, "mer",
3842  3)) { // "Merc Guild" from mm6
3844  break;
3845  }
3847  } break;
3848 
3849  case 4:
3850  p2DEvents[i].uAnimationID = atoi(test_string);
3851  break;
3852  case 5:
3853  p2DEvents[i].pName = RemoveQuotes(test_string);
3854  break;
3855  case 6:
3857  RemoveQuotes(test_string);
3858  break;
3859  case 7:
3861  RemoveQuotes(test_string);
3862  break;
3863  case 8:
3864  p2DEvents[i].field_14 = atoi(test_string);
3865  break;
3866  case 9:
3867  p2DEvents[i]._state = atoi(test_string);
3868  break;
3869  case 10:
3870  p2DEvents[i]._rep = atoi(test_string);
3871  break;
3872  case 11:
3873  p2DEvents[i]._per = atoi(test_string);
3874  break;
3875  case 12:
3876  p2DEvents[i].fPriceMultiplier = atof(test_string);
3877  break;
3878  case 13:
3879  p2DEvents[i].flt_24 = atof(test_string);
3880  break;
3881  case 15:
3883  atoi(test_string);
3884  break;
3885  case 18:
3886  p2DEvents[i].uOpenTime = atoi(test_string);
3887  break;
3888  case 19:
3889  p2DEvents[i].uCloseTime = atoi(test_string);
3890  break;
3891  case 20:
3892  p2DEvents[i].uExitPicID = atoi(test_string);
3893  break;
3894  case 21:
3895  p2DEvents[i].uExitMapID = atoi(test_string);
3896  break;
3897  case 22:
3898  p2DEvents[i]._quest_related = atoi(test_string);
3899  break;
3900  case 23:
3901  p2DEvents[i].pEnterText = RemoveQuotes(test_string);
3902  break;
3903  }
3904  }
3905  ++decode_step;
3906  test_string = tmp_pos + 1;
3907  } while ((decode_step < 24) && !break_loop);
3908  }
3909 }
3910 
3913  pKeyActionMap->SetWindowInputStatus(WINDOW_INPUT_CANCELLED);
3915  activeLevelDecoration = nullptr;
3916  current_npc_text.clear();
3917  if (pDialogueNPCCount == 0) return 0;
3918 
3922  shop_ui_background = nullptr;
3923  }
3924 
3925  switch (dialog_menu_id) {
3926  case -1:
3927  _4B4224_UpdateNPCTopics((int)((char *)pDialogueNPCCount - 1));
3928  BackToHouseMenu();
3929  break;
3930 
3934  BackToHouseMenu();
3938  break;
3939 
3946  break;
3947 
3951  BackToHouseMenu();
3955  break;
3956 
3957  case HOUSE_DIALOGUE_NULL:
3958  case HOUSE_DIALOGUE_MAIN:
3959  pDialogueNPCCount = 0;
3962  pDialogueWindow = 0;
3963 
3964  if (uNumDialogueNPCPortraits == 1) return 0;
3965 
3967  if (uNumDialogueNPCPortraits > 0) {
3968  for (uint i = 0; i < (unsigned int)uNumDialogueNPCPortraits;
3969  ++i) {
3974  63, 73, 1, 0, UIMSG_ClickHouseNPCPortrait, i, 0,
3975  byte_591180[i].data());
3976  }
3977  }
3978 
3979  BackToHouseMenu();
3980  break;
3981 
3982  default:
3983  BackToHouseMenu();
3986  break;
3987  }
3988  return 1;
3989 }
3990 
3994  if (window_SpeakInHouse && window_SpeakInHouse->ptr_1C == (void *)165 &&
3995  !pMovie_Track) {
3996  bGameoverLoop = true;
3999  pParty->uFlags &= 0xFFFFFFFD;
4001  pAudioPlayer->PlaySound(SOUND_Invalid, 0, 0, -1, 0, 0);
4003  0, 0, window->GetWidth(), window->GetHeight(), 165, "");
4004  window_SpeakInHouse->CreateButton(0x3Du, 0x1A8u, 0x1Fu, 0, 2, 94,
4005  UIMSG_SelectCharacter, 1, 0x31,
4006  "");
4007  window_SpeakInHouse->CreateButton(0xB1u, 0x1A8u, 0x1Fu, 0, 2, 94,
4008  UIMSG_SelectCharacter, 2, 0x32,
4009  "");
4010  window_SpeakInHouse->CreateButton(0x124u, 0x1A8u, 0x1Fu, 0, 2, 94,
4011  UIMSG_SelectCharacter, 3, 0x33,
4012  "");
4013  window_SpeakInHouse->CreateButton(0x197u, 0x1A8u, 0x1Fu, 0, 2, 94,
4014  UIMSG_SelectCharacter, 4, 0x34,
4015  "");
4016  }
4017  bGameoverLoop = false;
4018  }
4019 }
4020 
4021 //----- (004BE571) --------------------------------------------------------
4022 int sub_4BE571_AddItemToSet(int valueToAdd, int *outPutSet,
4023  int elemsAlreadyPresent, int elemsNeeded) {
4024  int i; // esi@3
4025 
4026  if (elemsAlreadyPresent < elemsNeeded) {
4027  for (i = 0; i < elemsAlreadyPresent; ++i) {
4028  if (valueToAdd == outPutSet[i]) return elemsAlreadyPresent;
4029  }
4030  outPutSet[elemsAlreadyPresent] = valueToAdd;
4031  return elemsAlreadyPresent + 1;
4032  }
4033  return elemsNeeded;
4034 }
4035 
4036 //----- (004B3703) --------------------------------------------------------
4038  const char *v30; // ecx@65
4039  unsigned int v29; // edx@56
4040  int v15; // ecx@19
4041  int v33; // [sp-4h] [bp-2Ch]@23
4042  int v34; // [sp-4h] [bp-2Ch]@43
4043  int v21; // ecx@34
4044  int v35[5]; // [sp+Ch] [bp-1Ch]@8
4045  int v37 = 0; // [sp+24h] [bp-4h]@1*
4046  int i = 0;
4047 
4049 
4050  switch (type) {
4052  {
4053  for (int i = 0; i < 2; ++i) {
4054  for (int j = 0; j < 4; ++j) {
4055  if (i)
4057  [(unsigned int)window_SpeakInHouse->ptr_1C]
4058  .item_class[j];
4059  else
4061  [(unsigned int)window_SpeakInHouse->ptr_1C]
4062  .item_class[j];
4063 
4064  switch (v21) {
4065  case 23:
4066  v34 = 37;
4067  break;
4068  case 24:
4069  v34 = 38;
4070  break;
4071  case 25:
4072  v34 = 39;
4073  break;
4074  case 26:
4075  v34 = 40;
4076  break;
4077  case 27:
4078  v34 = 41;
4079  break;
4080  case 28:
4081  v34 = 42;
4082  break;
4083  case 30:
4084  v34 = 36;
4085  break;
4086  default:
4087  continue;
4088  }
4089  v37 = sub_4BE571_AddItemToSet(v34, v35, v37, 5);
4090  }
4091  }
4092  } break;
4093 
4095  {
4096  for (int i = 0; i < 2; ++i) {
4097  for (int j = 0; j < 2; ++j) {
4098  for (int k = 0; k < 4; ++k) {
4099  if (i)
4100  v15 =
4102  [(unsigned int)window_SpeakInHouse->ptr_1C -
4103  15 + j]
4104  .item_class[k];
4105  else
4106  v15 =
4108  [(unsigned int)window_SpeakInHouse->ptr_1C -
4109  15 + j]
4110  .item_class[k];
4111  switch (v15) {
4112  case 31:
4113  v33 = 45;
4114  break;
4115  case 32:
4116  v33 = 46;
4117  break;
4118  case 33:
4119  v33 = 47;
4120  break;
4121  case 34:
4122  v33 = 44;
4123  break;
4124  default:
4125  continue;
4126  }
4127  v37 = sub_4BE571_AddItemToSet(v33, v35, v37, 5);
4128  }
4129  }
4130  }
4131  } break;
4132 
4134  v37 = 2;
4135  v35[0] = 57;
4136  v35[1] = 59;
4137  break;
4139  v37 = 2;
4140  v35[0] = 71;
4141  v35[1] = 68;
4142  break;
4143  case BuildingType_Tavern:
4144  v37 = 3;
4145  v35[0] = 70;
4146  v35[1] = 65;
4147  v35[2] = 62;
4148  break;
4149  case BuildingType_Temple:
4150  v37 = 3;
4151  v35[0] = 67;
4152  v35[1] = 66;
4153  v35[2] = 58;
4154  break;
4155  case BuildingType_Training:
4156  v37 = 2;
4157  v35[0] = 69;
4158  v35[1] = 60;
4159  break;
4160  }
4161 
4162  for (i = 0; i < v37; ++i) {
4163  v29 = v35[i];
4164  switch (v29) {
4165  case 40:
4166  v30 = localization->GetSkillName(4);
4167  break;
4168  case 5:
4169  v30 = localization->GetSkillName(23);
4170  break;
4171  case 36:
4172  v30 = localization->GetSkillName(0);
4173  break;
4174  case 37:
4175  v30 = localization->GetSkillName(1);
4176  break;
4177  case 38:
4178  v30 = localization->GetSkillName(2);
4179  break;
4180  case 39:
4181  v30 = localization->GetSkillName(3);
4182  break;
4183  case 41:
4184  v30 = localization->GetSkillName(5);
4185  break;
4186  case 42:
4187  v30 = localization->GetSkillName(6);
4188  break;
4189  case 44:
4190  v30 = localization->GetSkillName(8);
4191  break;
4192  case 45:
4193  v30 = localization->GetSkillName(9);
4194  break;
4195  case 46:
4196  v30 = localization->GetSkillName(10);
4197  break;
4198  case 47:
4199  v30 = localization->GetSkillName(11);
4200  break;
4201  case 66:
4202  v30 = localization->GetSkillName(30);
4203  break;
4204  case 57:
4205  v30 = localization->GetSkillName(21);
4206  break;
4207  case 58:
4208  v30 = localization->GetSkillName(22);
4209  break;
4210  case 60:
4211  v30 = localization->GetSkillName(24);
4212  break;
4213  case 62:
4214  v30 = localization->GetSkillName(26);
4215  break;
4216  case 65:
4217  v30 = localization->GetSkillName(29);
4218  break;
4219  case 67:
4220  v30 = localization->GetSkillName(31);
4221  break;
4222  case 68:
4223  v30 = localization->GetSkillName(32);
4224  break;
4225  case 69:
4226  v30 = localization->GetSkillName(33);
4227  break;
4228  case 70:
4229  v30 = localization->GetSkillName(34);
4230  break;
4231  case 71:
4232  v30 = localization->GetSkillName(35);
4233  break;
4234  default:
4235  v30 = localization->GetString(127); // "No Text!"
4236  }
4239  CreateButtonInColumn(i + 1, v29);
4240  }
4243 }
4244 
4245 //----- (004B8F94) --------------------------------------------------------
4247  signed int item_count;
4248  signed int shop_index;
4249  int treasure_lvl = 0;
4250  int item_class = 0;
4251  int mdf;
4252 
4253  shop_index = (signed int)window_SpeakInHouse->ptr_1C;
4254  if (uItemsAmountPerShopType[p2DEvents[shop_index - 1].uType]) {
4255  for (item_count = 0;
4256  item_count <
4257  uItemsAmountPerShopType[p2DEvents[shop_index - 1].uType];
4258  ++item_count) {
4259  if (shop_index <= 14) { // weapon shop
4260  treasure_lvl =
4262  item_class =
4263  shopWeap_variation_spc[shop_index].item_class[rand() % 4];
4264  } else if (shop_index <= 28) { // armor shop
4265  mdf = 0;
4266  if (item_count > 3) ++mdf;
4267  treasure_lvl =
4268  shopArmr_variation_spc[2 * (shop_index - 15) + mdf]
4269  .treasure_level;
4270  item_class = shopArmr_variation_spc[2 * (shop_index - 15) + mdf]
4271  .item_class[rand() % 4];
4272  } else if (shop_index <= 41) { // magic shop
4273  treasure_lvl = shopMagicSpc_treasure_lvl[shop_index - 28];
4274  item_class = 22; // misc
4275  } else if (shop_index <= 53) { // alchemist shop
4276  if (item_count < 6) {
4277  pParty->SpecialItemsInShops[shop_index][item_count].Reset();
4278  pParty->SpecialItemsInShops[shop_index][item_count]
4279  .uItemID =
4280  rand() % 32 + ITEM_RECIPE_REJUVENATION; // mscrool
4281  continue;
4282  } else {
4283  treasure_lvl = shopAlchSpc_treasure_lvl[shop_index - 41];
4284  item_class = 44; // potion
4285  }
4286  }
4288  treasure_lvl, item_class,
4289  &pParty->SpecialItemsInShops[shop_index][item_count]);
4290  pParty->SpecialItemsInShops[shop_index][item_count]
4291  .SetIdentified(); // identified
4292  }
4293  }
4294  pParty->InTheShopFlags[shop_index] = 0;
4295 }
4296 
4297 //----- (004B8E3D) --------------------------------------------------------
4299  signed int item_count;
4300  signed int shop_index;
4301  int treasure_lvl = 0;
4302  int item_class = 0;
4303  int mdf;
4304 
4305  shop_index = (signed int)window_SpeakInHouse->ptr_1C;
4306  if (uItemsAmountPerShopType[p2DEvents[shop_index - 1].uType]) {
4307  for (item_count = 0;
4308  item_count <
4309  uItemsAmountPerShopType[p2DEvents[shop_index - 1].uType];
4310  ++item_count) {
4311  if (shop_index <= 14) { // weapon shop
4312  treasure_lvl =
4314  item_class =
4315  shopWeap_variation_ord[shop_index].item_class[rand() % 4];
4316  } else if (shop_index <= 28) { // armor shop
4317  mdf = 0;
4318  if (item_count > 3) ++mdf; // rechek offsets
4319  treasure_lvl =
4320  shopArmr_variation_ord[2 * (shop_index - 15) + mdf]
4321  .treasure_level;
4322  item_class = shopArmr_variation_ord[2 * (shop_index - 15) + mdf]
4323  .item_class[rand() % 4];
4324  } else if (shop_index <= 41) { // magic shop
4325  treasure_lvl = shopMagic_treasure_lvl[shop_index - 28];
4326  item_class = 22; // misc
4327  } else if (shop_index <= 53) { // alchemist shop
4328  if (item_count < 6) {
4329  pParty->StandartItemsInShops[shop_index][item_count]
4330  .Reset();
4331  pParty->StandartItemsInShops[shop_index][item_count]
4332  .uItemID = ITEM_POTION_BOTTLE; // potion bottle
4333  continue;
4334  } else {
4335  treasure_lvl = shopAlch_treasure_lvl[shop_index - 41];
4336  item_class = 45; // reagent
4337  }
4338  }
4340  treasure_lvl, item_class,
4341  &pParty->StandartItemsInShops[shop_index][item_count]);
4342  pParty->StandartItemsInShops[shop_index][item_count]
4343  .SetIdentified(); // identified
4344  }
4345  }
4346  pParty->InTheShopFlags[shop_index] = 0;
4347 }
4348 
4349 GUIWindow_House::GUIWindow_House(unsigned int x, unsigned int y, unsigned int width, unsigned int height, int button, const String &hint) :
4350  GUIWindow(WINDOW_HouseInterior, x, y, width, height, button, hint) {
4351  pEventTimer->Pause(); // pause timer so not attacked
4352  pAudioPlayer->StopChannels(-1, -1);
4353 
4355  pBtn_ExitCancel = CreateButton(471, 445, 169, 35, 1, 0, UIMSG_Escape, 0, 0, localization->GetString(80), // Quit building
4356  { { ui_exit_cancel_button_background } });
4357  for (int v26 = 0; v26 < uNumDialogueNPCPortraits; ++v26) {
4358  const char *v29;
4359  String v30;
4360  if (v26 + 1 == uNumDialogueNPCPortraits && uHouse_ExitPic) {
4362  v29 = localization->GetString(411); // Enter %s
4363  } else {
4364  if (v26 || !dword_591080)
4365  v30 = HouseNPCData[v26 + 1 - ((dword_591080 != 0) ? 1 : 0)]->pName;
4366  else
4367  v30 = p2DEvents[button - 1].pProprieterName;
4368  v29 = localization->GetString(435);
4369  }
4370  sprintf(byte_591180[v26].data(), v29, v30.c_str());
4373  63, 73, 1, 0, UIMSG_ClickHouseNPCPortrait, v26, 0, byte_591180[v26].data());
4374  }
4375  if (uNumDialogueNPCPortraits == 1) {
4376  window_SpeakInHouse = this;
4378  }
4379 }
4380 
4383  if (!window_SpeakInHouse)
4384  return;
4385  if (window_SpeakInHouse->par1C >= 53)
4386  return;
4388  if (window_SpeakInHouse->par1C < 53)
4390  return;
4391  }
4392  // dialog_menu_id = HOUSE_DIALOGUE_MAIN;
4393  pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 0, 0); // banned from shop so leaving
4394 }
4395 
4397  for (int i = 0; i < uNumDialogueNPCPortraits; ++i) {
4398  if (pDialogueNPCPortraits[i]) {
4399  pDialogueNPCPortraits[i]->Release();
4400  pDialogueNPCPortraits[i] = nullptr;
4401  }
4402  }
4404 
4407  game_ui_dialogue_background = nullptr;
4408  }
4409 
4410  dword_5C35D4 = 0;
4411  if (engine->config->flip_on_exit) {
4414  }
4415  pParty->uFlags |= 2u;
4416 
4418 }
HOUSE_TRAINING_HALL_EMERALD_ISLE
@ HOUSE_TRAINING_HALL_EMERALD_ISLE
Definition: UIHouses.h:79
UIGame.h
uNumDialogueNPCPortraits
int uNumDialogueNPCPortraits
Definition: NPC.cpp:28
uint16_t
unsigned __int16 uint16_t
Definition: SDL_config.h:37
GameOver.h
HOUSE_DIALOGUE_TEMPLE_HEAL
@ HOUSE_DIALOGUE_TEMPLE_HEAL
Definition: UIHouses.h:17
PartyAlignment::PartyAlignment_Good
@ PartyAlignment_Good
GUIWindow::DrawText
void DrawText(GUIFont *font, int x, int y, unsigned short uFontColor, const char *str, bool present_time_transparency=false, int max_text_height=0, int uFontShadowColor=0)
Definition: GUIWindow.cpp:694
BuildingType_House
@ BuildingType_House
Definition: Events2D.h:33
Party::vPosition
Vec3_int_ vPosition
Definition: Party.h:250
Engine_::IocContainer
Definition: IocContainer.h:15
ui_leather_mm7
Image * ui_leather_mm7
Definition: GUIWindow.cpp:106
s
GLdouble s
Definition: SDL_opengl.h:2063
Party::uNumBountiesCollected
unsigned int uNumBountiesCollected
Definition: Party.h:286
KeyboardActionMapping::EnterText
void EnterText(int a2, int max_string_len, GUIWindow *pWindow)
Definition: Keyboard.cpp:181
Localization::GetString
const char * GetString(unsigned int index) const
Definition: Localization.cpp:13
NPCData::uProfession
unsigned int uProfession
Definition: NPC.h:89
stru193_math::uIntegerDoublePi
static const unsigned int uIntegerDoublePi
Definition: OurMath.h:90
SPEECH_82
@ SPEECH_82
Definition: Player.h:128
SimpleHouseDialog
void SimpleHouseDialog()
Definition: UIHouses.cpp:3426
RemoveQuotes
char * RemoveQuotes(char *str)
Definition: Strings.h:17
UIMSG_Escape
@ UIMSG_Escape
Definition: GUIWindow.h:96
_2devent::uType
BuildingType uType
Definition: Events2D.h:41
PartyAlignment::PartyAlignment_Neutral
@ PartyAlignment_Neutral
Viewport.h
IndoorCameraD3D::sRotationY
int sRotationY
Definition: IndoorCameraD3D.h:247
Party::uCurrentMonth
unsigned int uCurrentMonth
Definition: Party.h:272
MapStats::pInfos
MapInfo pInfos[77]
Definition: MapInfo.h:79
LOD.h
Party::GetPlayingTime
GameTime & GetPlayingTime()
Definition: Party.h:230
WINDOW_HouseInterior
@ WINDOW_HouseInterior
Definition: GUIWindow.h:309
SPELL_SPIRIT_PRESERVATION
@ SPELL_SPIRIT_PRESERVATION
Definition: Spells.h:66
HOUSE_DIALOGUE_SHOP_BUY_SPECIAL
@ HOUSE_DIALOGUE_SHOP_BUY_SPECIAL
Definition: UIHouses.h:32
BuildingType_Training
@ BuildingType_Training
Definition: Events2D.h:34
GUIFont
Definition: GUIFont.h:8
NPCGreeting::pGreetings
char * pGreetings[2]
Definition: NPC.h:139
stru365_travel_info::uMapInfoID
unsigned char uMapInfoID
Definition: UIHouses.cpp:59
HOUSE_TRAINING_HALL_94
@ HOUSE_TRAINING_HALL_94
Definition: UIHouses.h:84
GUIWindow
Definition: GUIWindow.h:433
AssetsManager::GetImage_Solid
Texture * GetImage_Solid(const String &name)
Definition: AssetsManager.cpp:51
Party::uCurrentMinute
unsigned int uCurrentMinute
Definition: Party.h:276
BuildingType_DarkGuild
@ BuildingType_DarkGuild
Definition: Events2D.h:17
sub_4B6478
void sub_4B6478()
Definition: UIHouses.cpp:3266
Pirate
@ Pirate
Definition: NPC.h:50
TravelByTransport
void TravelByTransport()
Definition: UIHouses.cpp:1673
Monsters.h
Start_Party_Teleport_Flag
int Start_Party_Teleport_Flag
Definition: mm7_data.cpp:628
NPCData::uFlags
unsigned int uFlags
Definition: NPC.h:84
Party_Teleport_Y_Pos
int Party_Teleport_Y_Pos
Definition: mm7_data.cpp:623
pMonsterStats
struct MonsterStats * pMonsterStats
Definition: Monsters.cpp:8
HouseNPCData
std::array< struct NPCData *, 7 > HouseNPCData
Definition: mm7_data.cpp:617
Party::SetFood
static void SetFood(int amount)
Definition: Party.cpp:239
uGameState
unsigned int uGameState
Definition: mm7_data.cpp:695
_F8B1DC_currentShopOption
int _F8B1DC_currentShopOption
Definition: UIHouses.cpp:46
BuildingType_16
@ BuildingType_16
Definition: Events2D.h:20
HOUSE_DIALOGUE_TOWNHALL_MESSAGE
@ HOUSE_DIALOGUE_TOWNHALL_MESSAGE
Definition: UIHouses.h:36
UIPartyCreation.h
Party::uFine
int uFine
Definition: Party.h:324
Party::sRotationX
int sRotationX
Definition: Party.h:252
shop_ui_background
Image * shop_ui_background
Definition: UIShops.cpp:33
pArcomageGame
ArcomageGame * pArcomageGame
Definition: Arcomage.cpp:97
byte_591180
std::array< std::array< char, 100 >, 6 > byte_591180
Definition: mm7_data.cpp:615
_449B57_test_bit
bool _449B57_test_bit(unsigned __int8 *a1, __int16 a2)
Definition: Party.cpp:1185
GUIWindow::CreateButton
GUIButton * CreateButton(int x, int y, int width, int height, int a6, int a7, UIMessageType msg, unsigned int msg_param, uint8_t hotkey, const String &label, const std::vector< Image * > &textures=std::vector< Image * >())
Definition: GUIWindow.cpp:717
PartyTimeStruct::Shops_next_generation_time
std::array< GameTime, 85 > Shops_next_generation_time
Definition: Party.h:143
dialog_menu_id
HOUSE_DIALOGUE_MENU dialog_menu_id
Definition: UIHouses.cpp:50
LOD::File::LoadCompressedTexture
void * LoadCompressedTexture(const String &pContainer, size_t *data_size=nullptr)
Definition: LOD.cpp:921
player_levels
std::array< int, 4 > player_levels
Definition: mm7_data.cpp:768
_2devent::_per
int16_t _per
Definition: Events2D.h:50
SPELL_LIGHT_HOUR_OF_POWER
@ SPELL_LIGHT_HOUR_OF_POWER
Definition: Spells.h:105
height
EGLSurface EGLint EGLint EGLint EGLint height
Definition: SDL_egl.h:1596
HOUSE_DIALOGUE_TAVERN_ARCOMAGE_RESULT
@ HOUSE_DIALOGUE_TAVERN_ARCOMAGE_RESULT
Definition: UIHouses.h:41
_4F03B8_shop_background_names
static std::array< const char *, 19 > _4F03B8_shop_background_names
Definition: UIHouses.cpp:331
OtherOverlayList::_4418B1
int _4418B1(int a2, int a3, int a4, int a5)
Definition: Overlays.cpp:29
BuildingType_ArmorShop
@ BuildingType_ArmorShop
Definition: Events2D.h:6
GUIMessageQueue::Flush
void Flush()
Definition: GUIWindow.cpp:159
GUIWindow_House::Release
virtual void Release()
Definition: UIHouses.cpp:4396
UIMSG_ClickHouseNPCPortrait
@ UIMSG_ClickHouseNPCPortrait
Definition: GUIWindow.h:197
_2devent::pProprieterTitle
const char * pProprieterTitle
Definition: Events2D.h:46
SPELL_AIR_WIZARD_EYE
@ SPELL_AIR_WIZARD_EYE
Definition: Spells.h:25
SPELL_LIGHT_DAY_OF_PROTECTION
@ SPELL_LIGHT_DAY_OF_PROTECTION
Definition: Spells.h:104
PartyAlignment::PartyAlignment_Evil
@ PartyAlignment_Evil
CreateButtonInColumn
void CreateButtonInColumn(int column_pos, unsigned int control_id)
Definition: GUIButton.cpp:117
BuildingType_MindGuild
@ BuildingType_MindGuild
Definition: Events2D.h:14
MAP_TATALIA
@ MAP_TATALIA
Definition: MapInfo.h:19
SPEECH_67
@ SPEECH_67
Definition: Player.h:113
ll
long long ll
Definition: MM7.h:22
HOUSE_DIALOGUE_GUILD_LEARN_SKILL
@ HOUSE_DIALOGUE_GUILD_LEARN_SKILL
Definition: UIHouses.h:29
pNPCTopics
std::array< NPCTopic, 789 > pNPCTopics
Definition: mm7_data.cpp:740
AudioPlayer::PlaySound
void PlaySound(SoundID eSoundID, int pid, unsigned int uNumRepeats, int x, int y, int a7)
Definition: AudioPlayer.cpp:195
ITEM_VARIATION
Definition: UIHouses.cpp:336
Party::InTheShopFlags
std::array< int, 53 > InTheShopFlags
Definition: Party.h:323
shopMagic_treasure_lvl
const unsigned __int16 shopMagic_treasure_lvl[14]
Definition: UIHouses.cpp:364
engine
std::shared_ptr< Engine > engine
Definition: Engine.cpp:130
HOUSE_DIALOGUE_TRAININGHALL_TRAIN
@ HOUSE_DIALOGUE_TRAININGHALL_TRAIN
Definition: UIHouses.h:24
pTransitionStrings
std::array< char *, 465 > pTransitionStrings
Definition: mm7_data.cpp:309
BuildingType_FireGuild
@ BuildingType_FireGuild
Definition: Events2D.h:9
game_viewport_width
unsigned int game_viewport_width
Definition: mm7_data.cpp:194
weapons_Ypos
std::array< int16_t, 6 > weapons_Ypos
Definition: mm7_data.cpp:769
stru365_travel_info
Definition: UIHouses.cpp:58
SOUND_error
@ SOUND_error
Definition: AudioPlayer.h:19
HOUSE_DIALOGUE_LEARN_SKILLS
@ HOUSE_DIALOGUE_LEARN_SKILLS
Definition: UIHouses.h:33
NPCData::evt_B
unsigned int evt_B
Definition: NPC.h:94
HOUSE_BOATS_EMERALD_ISLE
@ HOUSE_BOATS_EMERALD_ISLE
Definition: UIHouses.h:66
pHouse_ExitPictures
std::array< const char *, 11 > pHouse_ExitPictures
Definition: mm7_data.cpp:298
Party::_quest_bits
unsigned __int8 _quest_bits[64]
Definition: Party.h:291
localization
Localization * localization
Definition: Localization.cpp:11
SPEECH_83
@ SPEECH_83
Definition: Player.h:129
SpellBookGenerator
void SpellBookGenerator()
Definition: UIGuilds.cpp:298
HouseSound_Greeting
@ HouseSound_Greeting
Definition: UIHouses.h:113
shopAlchSpc_treasure_lvl
const unsigned __int16 shopAlchSpc_treasure_lvl[13]
Definition: UIHouses.cpp:379
Overlays.h
_2devent::uExitMapID
int16_t uExitMapID
Definition: Events2D.h:58
ITEM_VARIATION::item_class
unsigned __int16 item_class[4]
Definition: UIHouses.cpp:338
pMediaPlayer
MPlayer * pMediaPlayer
Definition: MediaPlayer.cpp:43
Party::uCurrentHour
unsigned int uCurrentHour
Definition: Party.h:275
ull
unsigned long long ull
Definition: MM7.h:23
HOUSE_600
@ HOUSE_600
Definition: UIHouses.h:108
UIMSG_PlayArcomage
@ UIMSG_PlayArcomage
Definition: GUIWindow.h:33
sub_4BE571_AddItemToSet
int sub_4BE571_AddItemToSet(int valueToAdd, int *outPutSet, int elemsAlreadyPresent, int elemsNeeded)
Definition: UIHouses.cpp:4022
pNPCPortraits_y
std::array< std::array< int, 6 >, 6 > pNPCPortraits_y
Definition: mm7_data.cpp:290
FillAviableSkillsToTeach
void FillAviableSkillsToTeach(enum BuildingType type)
Definition: UIHouses.cpp:4037
int64_t
__int64 int64_t
Definition: alext.h:31
UIMSG_SelectCharacter
@ UIMSG_SelectCharacter
Definition: GUIWindow.h:93
InitializaDialogueOptions
void InitializaDialogueOptions(BuildingType type)
Definition: UIHouses.cpp:442
Party::pPlayers
std::array< Player, 4 > pPlayers
Definition: Party.h:310
pNPCPortraits_x
std::array< std::array< int, 6 >, 6 > pNPCPortraits_x
Definition: mm7_data.cpp:282
GUIWindow::DrawTitleText
void DrawTitleText(GUIFont *font, int horizontal_margin, int vertical_margin, unsigned __int16 uDefaultColor, const char *pInString, int line_spacing)
Definition: GUIWindow.cpp:665
GUIFont::GetLineWidth
unsigned int GetLineWidth(const String &str)
Definition: GUIFont.cpp:278
HouseSound_Greeting_2
@ HouseSound_Greeting_2
Definition: UIHouses.h:115
GUIWindow::Release
virtual void Release()
Definition: GUIWindow.cpp:292
Party::uNumPrisonTerms
int uNumPrisonTerms
Definition: Party.h:285
GUIFont.h
ITEM_RECIPE_REJUVENATION
@ ITEM_RECIPE_REJUVENATION
Definition: Items.h:221
ITEM_VARIATION::treasure_level
unsigned __int16 treasure_level
Definition: UIHouses.cpp:337
pMovie_Track
PMovie pMovie_Track
Definition: MediaPlayer.cpp:44
w
GLubyte GLubyte GLubyte GLubyte w
Definition: SDL_opengl_glext.h:734
Party::sub_421B2C_PlaceInInventory_or_DropPickedItem
void sub_421B2C_PlaceInInventory_or_DropPickedItem()
Definition: Party.cpp:1048
GUIFont::GetHeight
unsigned int GetHeight() const
Definition: GUIFont.cpp:84
MAP_PIERPONT
@ MAP_PIERPONT
Definition: MapInfo.h:10
shopWeap_variation_spc
const ITEM_VARIATION shopWeap_variation_spc[15]
Definition: UIHouses.cpp:369
NPCData::evt_E
unsigned int evt_E
Definition: NPC.h:97
PartyTimeStruct::bountyHunting_next_generation_time
std::array< GameTime, 10 > bountyHunting_next_generation_time
Definition: Party.h:142
MAP_STEADWICK
@ MAP_STEADWICK
Definition: MapInfo.h:9
PrepareHouse
void PrepareHouse(HOUSE_ID house)
Definition: UIHouses.cpp:978
BuildingType_Bank
@ BuildingType_Bank
Definition: Events2D.h:26
AssetsManager.h
HouseNPCPortraitsButtonsList
GUIButton * HouseNPCPortraitsButtonsList[6]
Definition: mm7_data.cpp:618
NPCData::evt_C
unsigned int evt_C
Definition: NPC.h:95
index
GLuint index
Definition: SDL_opengl_glext.h:663
pPlayers
NZIArray< struct Player *, 5 > pPlayers
Definition: Player.cpp:46
_2devent::uOpenTime
uint16_t uOpenTime
Definition: Events2D.h:55
pFontCreate
GUIFont * pFontCreate
Definition: GUIFont.cpp:22
GUIWindow::uFrameWidth
unsigned int uFrameWidth
Definition: GUIWindow.h:470
dword_591080
int dword_591080
Definition: UIHouses.cpp:47
BuildingType_Boats
@ BuildingType_Boats
Definition: Events2D.h:32
Localization::GetSkillName
const char * GetSkillName(unsigned int index) const
Definition: Localization.h:51
GUIButton
Definition: GUIButton.h:11
GUIWindow::receives_keyboard_input_2
int receives_keyboard_input_2
Definition: GUIWindow.h:486
pIndoor
IndoorLocation * pIndoor
Definition: Indoor.cpp:49
HOUSE_DIALOGUE_MENU
HOUSE_DIALOGUE_MENU
Definition: UIHouses.h:6
h
GLfloat GLfloat GLfloat GLfloat h
Definition: SDL_opengl_glext.h:1949
GUIWindow::uFrameZ
unsigned int uFrameZ
Definition: GUIWindow.h:472
_2devent::flt_24
float flt_24
Definition: Events2D.h:54
Engine.h
current_screen_type
enum CURRENT_SCREEN current_screen_type
Definition: GUIWindow.cpp:83
_494820_training_time
unsigned int _494820_training_time(unsigned int a1)
Definition: Engine.cpp:2263
HOUSE_DIALOGUE_TRANSPORT_SCHEDULE_1
@ HOUSE_DIALOGUE_TRANSPORT_SCHEDULE_1
Definition: UIHouses.h:42
Party::PartyTimes
PartyTimeStruct PartyTimes
Definition: Party.h:249
Image.h
MAP_HARMONDALE
@ MAP_HARMONDALE
Definition: MapInfo.h:8
dword_5C35D4
int dword_5C35D4
Definition: mm7_data.cpp:645
dword_F8B1E0
int dword_F8B1E0
Definition: mm7_data.cpp:778
p2DEvents
_2devent p2DEvents[525]
Definition: Events.cpp:57
_2devent::pName
char * pName
Definition: Events2D.h:43
pMapStats
struct MapStats * pMapStats
Definition: mm7_data.cpp:20
GUIWindow::pStartingPosActiveItem
int pStartingPosActiveItem
Definition: GUIWindow.h:485
TavernDialog
void TavernDialog()
Definition: UIHouses.cpp:2200
pShopOptions
std::array< const char *, 4 > pShopOptions
Definition: mm7_data.cpp:776
GUIWindow::vButtons
std::vector< GUIButton * > vButtons
Definition: GUIWindow.h:489
MAP_AVLEE
@ MAP_AVLEE
Definition: MapInfo.h:20
_42777D_CastSpell_UseWand_ShootArrow
void _42777D_CastSpell_UseWand_ShootArrow(SPELL_TYPE spell, unsigned int uPlayerID, unsigned int a4, __int16 flags, int a6)
Definition: CastSpellInfo.cpp:4369
uHouse_ExitPic
int uHouse_ExitPic
Definition: UIHouses.cpp:45
GUIWindow::_41D08F_set_keyboard_control_group
void _41D08F_set_keyboard_control_group(int num_buttons, int a3, int a4, int a5)
Definition: GUIWindow.cpp:273
Events.h
Party::uFallStartY
int uFallStartY
Definition: Party.h:265
ContractSelectText
const char * ContractSelectText(int pEventCode)
Definition: NPC.cpp:1052
HOUSE_DIALOGUE_BANK_PUT_GOLD
@ HOUSE_DIALOGUE_BANK_PUT_GOLD
Definition: UIHouses.h:14
UIHouses.h
OnSelectShopDialogueOption
void OnSelectShopDialogueOption(signed int uMessageParam)
Definition: UIHouses.cpp:1047
pItemsTable
struct ItemsTable * pItemsTable
Definition: Items.cpp:37
Party::PartyFindsGold
void PartyFindsGold(unsigned int uNumGold, int _1_dont_share_with_followers___2_the_same_but_without_a_message__else_normal)
Definition: Party.cpp:976
shopMagicSpc_treasure_lvl
const unsigned __int16 shopMagicSpc_treasure_lvl[14]
Definition: UIHouses.cpp:377
MPlayer::OpenHouseMovie
void OpenHouseMovie(const std::string &pMovieName, bool bLoop)
Definition: MediaPlayer.cpp:633
in_current_building_type
BuildingType in_current_building_type
Definition: UIHouses.cpp:49
Localization.h
NPCData::evt_A
unsigned int evt_A
Definition: NPC.h:93
BuildingType_WeaponShop
@ BuildingType_WeaponShop
Definition: Events2D.h:5
y
EGLSurface EGLint EGLint y
Definition: SDL_egl.h:1596
NPCData::evt_D
unsigned int evt_D
Definition: NPC.h:96
BuildingType_LightGuild
@ BuildingType_LightGuild
Definition: Events2D.h:16
NPCStats::uNumNewNPCs
unsigned int uNumNewNPCs
Definition: NPC.h:179
stru365_travel_info::arrival_y
int arrival_y
Definition: UIHouses.cpp:63
contract_approved
int contract_approved
Definition: mm7_data.cpp:772
window_SpeakInHouse
GUIWindow * window_SpeakInHouse
Definition: GUIWindow.cpp:51
Mouse::ClearPickedItem
void ClearPickedItem()
Definition: Mouse.cpp:195
shopWeap_variation_ord
const ITEM_VARIATION shopWeap_variation_ord[15]
Definition: UIHouses.cpp:343
BuildingType_18
@ BuildingType_18
Definition: Events2D.h:22
GUIButton.h
pBtn_ExitCancel
GUIButton * pBtn_ExitCancel
Definition: GUIButton.cpp:28
activeLevelDecoration
LevelDecoration * activeLevelDecoration
Definition: Decoration.cpp:10
HOUSE_ID
HOUSE_ID
Definition: UIHouses.h:50
pParty
Party * pParty
Definition: Party.cpp:30
Image
Definition: Image.h:19
HOUSE_DIALOGUE_MAIN
@ HOUSE_DIALOGUE_MAIN
Definition: UIHouses.h:8
Party_Teleport_Cam_Pitch
int Party_Teleport_Cam_Pitch
Definition: mm7_data.cpp:626
pAnimatedRooms
std::array< const stru159, 196 > pAnimatedRooms
Definition: UIHouses.cpp:132
transport_schedule
stru365_travel_info transport_schedule[35]
Definition: UIHouses.cpp:70
pFontArrus
GUIFont * pFontArrus
Definition: GUIFont.cpp:18
GUIWindow::pCurrentPosActiveItem
int pCurrentPosActiveItem
Definition: GUIWindow.h:482
shopArmr_variation_ord
const ITEM_VARIATION shopArmr_variation_ord[28]
Definition: UIHouses.cpp:351
HouseSoundID
HouseSoundID
Definition: UIHouses.h:112
OS_Sleep
void OS_Sleep(int ms)
Definition: Lin.cpp:36
NPCData::pName
char * pName
Definition: NPC.h:82
NPCStats::pNewNPCData
NPCData pNewNPCData[501]
Definition: NPC.h:165
current_npc_text
String current_npc_text
Definition: mm7_data.cpp:780
GUIWindow::pNumPresenceButton
int pNumPresenceButton
Definition: GUIWindow.h:481
_2devent::uCloseTime
uint16_t uCloseTime
Definition: Events2D.h:56
BackToHouseMenu
void BackToHouseMenu()
Definition: UIHouses.cpp:3991
x
EGLSurface EGLint x
Definition: SDL_egl.h:1596
SPEECH_SetSail
@ SPEECH_SetSail
Definition: Player.h:118
TrainingDialog
void TrainingDialog(const char *s)
Definition: UIHouses.cpp:2933
stru365_travel_info::arrival_rot_y
int arrival_rot_y
Definition: UIHouses.cpp:65
stru365_travel_info::arrival_x
int arrival_x
Definition: UIHouses.cpp:62
NPCStats::pNPCGreetings
NPCGreeting pNPCGreetings[205]
Definition: NPC.h:175
_2devent::uExitPicID
int16_t uExitPicID
Definition: Events2D.h:57
viewparams
struct ViewingParams * viewparams
Definition: mm7_data.cpp:22
ItemsTable::GenerateItem
void GenerateItem(int treasure_level, unsigned int uTreasureType, ItemGen *pItem)
Definition: Items.cpp:680
label
GLuint GLsizei const GLchar * label
Definition: SDL_opengl_glext.h:2488
OS_GetTime
unsigned int OS_GetTime()
Definition: Lin.cpp:12
GetHouseGoodbyeSpeech
void GetHouseGoodbyeSpeech()
Definition: UIShops.cpp:1654
_2devent::_state
int16_t _state
Definition: Events2D.h:48
Condition_Dead
@ Condition_Dead
Definition: Conditions.h:22
HOUSE_FIRE_GUILD_INITIATE_EMERALD_ISLE
@ HOUSE_FIRE_GUILD_INITIATE_EMERALD_ISLE
Definition: UIHouses.h:90
CURRENT_SCREEN::SCREEN_HOUSE
@ SCREEN_HOUSE
GameUI_StatusBar_Clear
void GameUI_StatusBar_Clear()
Definition: UIStatusBar.cpp:23
SaveLoad.h
Party_Teleport_X_Pos
int Party_Teleport_X_Pos
Definition: mm7_data.cpp:622
ArcomageGame::uGameWinner
int uGameWinner
Definition: Arcomage.h:152
AssetsManager::GetImage_ColorKey
Texture * GetImage_ColorKey(const String &name, uint16_t colorkey)
Definition: AssetsManager.cpp:34
WINDOW_Dialogue
@ WINDOW_Dialogue
Definition: GUIWindow.h:298
MPlayer::Unload
void Unload()
Definition: MediaPlayer.cpp:826
SPEECH_CarriageReady
@ SPEECH_CarriageReady
Definition: Player.h:117
UIGuilds.h
BuildingType_Temple
@ BuildingType_Temple
Definition: Events2D.h:27
v1
GLfloat GLfloat v1
Definition: SDL_opengl_glext.h:694
KeyboardActionMapping::pPressedKeysBuffer
char pPressedKeysBuffer[257]
Definition: Keyboard.h:66
ui_house_player_cant_interact_color
unsigned int ui_house_player_cant_interact_color
Definition: UICharacter.cpp:100
width
EGLSurface EGLint EGLint EGLint width
Definition: SDL_egl.h:1596
Engine_::IocContainer::ResolveMouse
static Mouse * ResolveMouse()
Definition: IocContainer.cpp:88
IndoorLocation::dlv
struct DDM_DLV_Header dlv
Definition: Indoor.h:648
Party::TakeGold
static void TakeGold(int amount)
Definition: Party.cpp:292
shopArmr_variation_spc
const ITEM_VARIATION shopArmr_variation_spc[28]
Definition: UIHouses.cpp:382
byte_F8B1EF
std::array< char, 777 > byte_F8B1EF
Definition: mm7_data.cpp:782
AudioPlayer::StopChannels
void StopChannels(int uStartChannel, int uEndChannel)
Definition: AudioPlayer.cpp:331
GUIFont::CalcTextHeight
unsigned int CalcTextHeight(const String &str, unsigned int width, int x_offset, bool return_on_carriage=false)
Definition: GUIFont.cpp:246
HOUSE_DIALOGUE_TAVERN_REST
@ HOUSE_DIALOGUE_TAVERN_REST
Definition: UIHouses.h:22
MediaPlayer.h
BuildingType_24
@ BuildingType_24
Definition: Events2D.h:28
Condition_Zombie
@ Condition_Zombie
Definition: Conditions.h:25
Party_Teleport_Cam_Yaw
int Party_Teleport_Cam_Yaw
Definition: mm7_data.cpp:625
BuildingType_MagicShop
@ BuildingType_MagicShop
Definition: Events2D.h:7
Arcomage.h
Party.h
BuildingType_EarthGuild
@ BuildingType_EarthGuild
Definition: Events2D.h:12
uCurrentHouse_Animation
int uCurrentHouse_Animation
Definition: mm7_data.cpp:607
BuildingType_SelfGuild
@ BuildingType_SelfGuild
Definition: Events2D.h:19
TempleDialog
void TempleDialog()
Definition: UIHouses.cpp:2599
_2devent::pEnterText
const char * pEnterText
Definition: Events2D.h:45
window
EGLSurface EGLNativeWindowType * window
Definition: SDL_egl.h:1580
GameUI_ReloadPlayerPortraits
void GameUI_ReloadPlayerPortraits(int player_id, int face_id)
Definition: UIGame.cpp:199
SPEECH_87
@ SPEECH_87
Definition: Player.h:133
Party::uFlags
unsigned int uFlags
Definition: Party.h:313
f
GLfloat f
Definition: SDL_opengl_glext.h:1873
SPEECH_3
@ SPEECH_3
Definition: Player.h:49
MonsterStats::pInfos
MonsterInfo pInfos[265]
Definition: Monsters.h:194
HOUSE_DIALOGUE_TOWNHALL_PAY_FINE
@ HOUSE_DIALOGUE_TOWNHALL_PAY_FINE
Definition: UIHouses.h:37
type
EGLenum type
Definition: SDL_egl.h:850
DDM_DLV_Header::uReputation
int uReputation
Definition: Indoor.h:96
MapInfo::pName
String pName
Definition: MapInfo.h:38
stru365_travel_info::uTravelTime
unsigned int uTravelTime
Definition: UIHouses.cpp:61
pMaxLevelPerTrainingHallType
std::array< unsigned short, 6 > pMaxLevelPerTrainingHallType
Definition: mm7_data.cpp:492
PARTY_QUEST_EVENMORN_MAP_FOUND
@ PARTY_QUEST_EVENMORN_MAP_FOUND
Definition: Party.h:23
SOUND_Invalid
@ SOUND_Invalid
Definition: AudioPlayer.h:11
HOUSE_DIALOGUE_TRANSPORT_SCHEDULE_4
@ HOUSE_DIALOGUE_TRANSPORT_SCHEDULE_4
Definition: UIHouses.h:45
shop_ui_items_in_store
std::array< Image *, 12 > shop_ui_items_in_store
Definition: UIShops.cpp:35
LEVEL_Outdoor
@ LEVEL_Outdoor
Definition: Indoor.h:287
DDM_DLV_Header
Definition: Indoor.h:82
Timer::Pause
void Pause()
Definition: Time.cpp:19
BuildingType_AirGuild
@ BuildingType_AirGuild
Definition: Events2D.h:10
NPCData
Definition: NPC.h:79
KeyboardActionMapping::ResetKeys
void ResetKeys()
Definition: Keyboard.cpp:176
byte_F8B1F0
std::array< char, 4 > byte_F8B1F0
Definition: mm7_data.cpp:783
_4B4224_UpdateNPCTopics
void _4B4224_UpdateNPCTopics(int _this)
Definition: NPC.cpp:1110
PlayHouseSound
void PlayHouseSound(unsigned int uHouseID, HouseSoundID sound)
Definition: UIHouses.cpp:1036
HOUSE_DIALOGUE_TAVERN_ARCOMAGE_MAIN
@ HOUSE_DIALOGUE_TAVERN_ARCOMAGE_MAIN
Definition: UIHouses.h:38
MapInfo
Definition: MapInfo.h:35
UIMSG_BuyInShop_Identify_Repair
@ UIMSG_BuyInShop_Identify_Repair
Definition: GUIWindow.h:66
pDialogueNPCCount
int pDialogueNPCCount
Definition: NPC.cpp:26
shopAlch_treasure_lvl
const unsigned __int16 shopAlch_treasure_lvl[13]
Definition: UIHouses.cpp:366
transport_routes
unsigned char transport_routes[20][4]
Definition: UIHouses.cpp:109
Party::GetFood
int GetFood() const
Definition: Party.cpp:272
pCurrentMapName
String pCurrentMapName
Definition: mm7_data.cpp:712
Party::StandartItemsInShops
std::array< std::array< ItemGen, 12 >, 53 > StandartItemsInShops
Definition: Party.h:314
BuildingType_1A
@ BuildingType_1A
Definition: Events2D.h:30
KeyboardActionMapping::SetWindowInputStatus
void SetWindowInputStatus(int a2)
Definition: Keyboard.cpp:195
Localization::GetAmPm
const char * GetAmPm(unsigned int index) const
Definition: Localization.h:79
Navigator
@ Navigator
Definition: NPC.h:14
GUIWindow_House::Update
virtual void Update()
Definition: UIHouses.cpp:4381
NPCData::uPortraitID
unsigned int uPortraitID
Definition: NPC.h:83
GUIWindow::HouseDialogManager
void HouseDialogManager()
Definition: GUIWindow.cpp:397
pEvents_LOD
LODFile_IconsBitmaps * pEvents_LOD
Definition: LOD.cpp:10
Explorer
@ Explorer
Definition: NPC.h:49
Outdoor.h
bountyHunting_monster_id_for_hunting
int16_t bountyHunting_monster_id_for_hunting
Definition: mm7_data.cpp:770
OutdoorLocation::ddm
struct DDM_DLV_Header ddm
Definition: Outdoor.h:131
HouseUI_CheckIfPlayerCanInteract
bool HouseUI_CheckIfPlayerCanInteract()
Definition: UIHouses.cpp:797
MAP_DEYJA
@ MAP_DEYJA
Definition: MapInfo.h:11
GUIButton::uW
unsigned int uW
Definition: GUIButton.h:26
UIMSG_RentRoom
@ UIMSG_RentRoom
Definition: GUIWindow.h:196
stru365_travel_info::arrival_z
int arrival_z
Definition: UIHouses.cpp:64
VAR_Award
@ VAR_Award
Definition: Events.h:140
HOUSE_DIALOGUE_36
@ HOUSE_DIALOGUE_36
Definition: UIHouses.h:27
GUIWindow::DrawFlashingInputCursor
void DrawFlashingInputCursor(int uX, int uY, GUIFont *a2)
Definition: GUIWindow.cpp:759
BuildingType_SpiritGuild
@ BuildingType_SpiritGuild
Definition: Events2D.h:13
OutdoorLocation::SetFog
void SetFog()
Definition: Outdoor.cpp:483
HOUSE_601
@ HOUSE_601
Definition: UIHouses.h:109
NPCData::Location2D
unsigned int Location2D
Definition: NPC.h:88
Party::uNumGoldInBank
unsigned int uNumGoldInBank
Definition: Party.h:282
AudioPlayer.h
Horseman
@ Horseman
Definition: NPC.h:40
RestAndHeal
void RestAndHeal(int minutes)
Definition: Party.cpp:872
pDialogueNPCPortraits
std::array< class Image *, 6 > pDialogueNPCPortraits
Definition: NPC.cpp:27
Party::HasItem
bool HasItem(unsigned int uItemID)
Definition: Party.cpp:216
HOUSE_DIALOGUE_SHOP_SELL
@ HOUSE_DIALOGUE_SHOP_SELL
Definition: UIHouses.h:10
MapInfo.h
Party::uCurrentDayOfMonth
unsigned int uCurrentDayOfMonth
Definition: Party.h:274
BuildingType_Jail
@ BuildingType_Jail
Definition: Events2D.h:35
GAME_STATE_CHANGE_LOCATION
@ GAME_STATE_CHANGE_LOCATION
Definition: Engine.h:34
UIShops.h
HOUSE_STABLES_HARMONDALE
@ HOUSE_STABLES_HARMONDALE
Definition: UIHouses.h:57
BuildingType_Stables
@ BuildingType_Stables
Definition: Events2D.h:31
uDialogueType
unsigned int uDialogueType
Definition: mm7_data.cpp:604
BankDialog
void BankDialog()
Definition: UIHouses.cpp:2074
data
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: SDL_opengl.h:1974
dword_F8B1E4
int dword_F8B1E4
Definition: mm7_data.cpp:779
pOtherOverlayList
struct OtherOverlayList * pOtherOverlayList
Definition: Overlays.cpp:19
Party_Teleport_Z_Speed
int Party_Teleport_Z_Speed
Definition: mm7_data.cpp:627
NPCData::greet
int greet
Definition: NPC.h:90
JailDialog
void JailDialog()
Definition: UIHouses.cpp:3698
_2devent::_rep
int16_t _rep
Definition: Events2D.h:49
HouseDialogPressCloseBtn
int HouseDialogPressCloseBtn()
Definition: UIHouses.cpp:3911
GUIButton::msg_param
unsigned int msg_param
Definition: GUIButton.h:30
p2DEventsTXT_Raw
char * p2DEventsTXT_Raw
Definition: mm7_data.cpp:643
WINDOW_MainMenu
@ WINDOW_MainMenu
Definition: GUIWindow.h:292
UIStatusBar.h
pKeyActionMap
struct KeyboardActionMapping * pKeyActionMap
Definition: Keyboard.cpp:35
c
const GLubyte * c
Definition: SDL_opengl_glext.h:11096
BuildingType_AlchemistShop
@ BuildingType_AlchemistShop
Definition: Events2D.h:8
v2
GLfloat GLfloat GLfloat v2
Definition: SDL_opengl_glext.h:695
HOUSE_LORD_AND_JUDGE_EMERALD_ISLE
@ HOUSE_LORD_AND_JUDGE_EMERALD_ISLE
Definition: UIHouses.h:96
assets
AssetsManager * assets
Definition: AssetsManager.cpp:12
uint
unsigned int uint
Definition: MM7.h:4
bGameoverLoop
int bGameoverLoop
Definition: mm7_data.cpp:785
uActiveCharacter
unsigned int uActiveCharacter
Definition: mm7_data.cpp:555
v3
GLfloat GLfloat GLfloat GLfloat v3
Definition: SDL_opengl_glext.h:696
Localization::FormatString
String FormatString(unsigned int index,...) const
Definition: Localization.cpp:17
GUIButton::uY
unsigned int uY
Definition: GUIButton.h:22
NPCData::evt_F
unsigned int evt_F
Definition: NPC.h:98
SPEECH_78
@ SPEECH_78
Definition: Player.h:124
__debugbreak
void __cdecl __debugbreak(void)
ITEM_POTION_BOTTLE
@ ITEM_POTION_BOTTLE
Definition: Items.h:120
GUIFont::FitTextInAWindow
String FitTextInAWindow(const String &inString, unsigned int width, int uX, bool return_on_carriage=false)
Definition: GUIFont.cpp:311
GUIButton::uHeight
unsigned int uHeight
Definition: GUIButton.h:24
GameTime::AddYears
void AddYears(int years)
Definition: Time.h:54
SOUND_heal
@ SOUND_heal
Definition: AudioPlayer.h:73
pNPCStats
struct NPCStats * pNPCStats
Definition: NPC.cpp:29
HOUSE_DIALOGUE_NULL
@ HOUSE_DIALOGUE_NULL
Definition: UIHouses.h:7
_2devent::fPriceMultiplier
float fPriceMultiplier
Definition: Events2D.h:53
GUIWindow::par1C
unsigned int par1C
Definition: GUIWindow.h:477
EnterHouse
bool EnterHouse(enum HOUSE_ID uHouseID)
Definition: UIHouses.cpp:826
GameUI_StatusBar_OnEvent
void GameUI_StatusBar_OnEvent(const String &str, unsigned int num_seconds)
Definition: UIStatusBar.cpp:33
Localization::GetNpcProfessionName
const char * GetNpcProfessionName(unsigned int index) const
Definition: Localization.h:83
GUIWindow::eWindowType
WindowType eWindowType
Definition: GUIWindow.h:474
Decoration.h
stru_5C6E00
struct stru193_math * stru_5C6E00
Definition: mm7_data.cpp:19
GUIWindow::ptr_1C
void * ptr_1C
Definition: GUIWindow.h:476
GenerateSpecialShopItems
void GenerateSpecialShopItems()
Definition: UIHouses.cpp:4246
stru365_travel_info::pSchedule
unsigned char pSchedule[7]
Definition: UIHouses.cpp:60
stru365_travel_info::uQuestBit
unsigned int uQuestBit
Definition: UIHouses.cpp:66
GUIWindow_House::GUIWindow_House
GUIWindow_House(unsigned int x, unsigned int y, unsigned int width, unsigned int height, int button, const String &hint=String())
Definition: UIHouses.cpp:4349
ViewingParams::bRedrawGameUI
int bRedrawGameUI
Definition: Viewport.h:74
PartyTimeStruct::_shop_ban_times
std::array< GameTime, 53 > _shop_ban_times
Definition: Party.h:144
HOUSE_JAIL
@ HOUSE_JAIL
Definition: UIHouses.h:97
BuildingType
BuildingType
Definition: Events2D.h:4
dword_6BE364_game_settings_1
int dword_6BE364_game_settings_1
Definition: mm7_data.cpp:714
GameTime::FromDays
static GameTime FromDays(int days)
Definition: Time.h:92
SoundID
SoundID
Definition: AudioPlayer.h:10
HouseSound_NotEnoughMoney_TrainingSuccessful
@ HouseSound_NotEnoughMoney_TrainingSuccessful
Definition: UIHouses.h:114
Application::GameOver_Loop
void GameOver_Loop(int)
GenerateStandartShopItems
void GenerateStandartShopItems()
Definition: UIHouses.cpp:4298
IsTravelAvailable
bool IsTravelAvailable(int a1)
Definition: UIHouses.cpp:1900
_2devent::pProprieterName
const char * pProprieterName
Definition: Events2D.h:44
game_ui_dialogue_background
Image * game_ui_dialogue_background
Definition: UIGame.cpp:93
HOUSE_DIALOGUE_TEMPLE_DONATE
@ HOUSE_DIALOGUE_TEMPLE_DONATE
Definition: UIHouses.h:18
uCurrentlyLoadedLevelType
LEVEL_TYPE uCurrentlyLoadedLevelType
Definition: Indoor.cpp:52
Party::GetFirstCanAct
int GetFirstCanAct()
Definition: Party.cpp:156
MapInfo::pFilename
String pFilename
Definition: MapInfo.h:39
MonsterInfo::pName
char * pName
Definition: Monsters.h:120
HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT
@ HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT
Definition: UIHouses.h:31
SPEECH_81
@ SPEECH_81
Definition: Player.h:127
GUIWindow::GetControl
GUIButton * GetControl(unsigned int uID)
Definition: GUIWindow.cpp:311
MAP_ARENA
@ MAP_ARENA
Definition: MapInfo.h:23
pPrimaryWindow
GUIWindow * pPrimaryWindow
Definition: GUIWindow.cpp:48
InitializeBuildingResidents
void InitializeBuildingResidents()
Definition: UIHouses.cpp:3715
guild_mambership_flags
std::array< int, 32 > guild_mambership_flags
Definition: mm7_data.cpp:480
BuildingType_Unic
@ BuildingType_Unic
Definition: Events2D.h:29
CheckHiredNPCSpeciality
bool CheckHiredNPCSpeciality(unsigned int uProfession)
Definition: NPC.cpp:754
GUIWindow::uFrameX
unsigned int uFrameX
Definition: GUIWindow.h:468
UI_CreateEndConversationButton
void UI_CreateEndConversationButton()
Definition: GUIButton.cpp:170
MAP_EVENMORN_ISLE
@ MAP_EVENMORN_ISLE
Definition: MapInfo.h:15
BuildingType_Throne_Room
@ BuildingType_Throne_Room
Definition: Events2D.h:24
HOUSE_DIALOGUE_SHOP_BUY_STANDARD
@ HOUSE_DIALOGUE_SHOP_BUY_STANDARD
Definition: UIHouses.h:9
MAP_BRAKADA_DESERT
@ MAP_BRAKADA_DESERT
Definition: MapInfo.h:12
pAudioPlayer
AudioPlayer * pAudioPlayer
Definition: AudioPlayer.cpp:20
Localization::GetClassName
const char * GetClassName(unsigned int index) const
Definition: Localization.h:35
HOUSE_TRAINING_HALL_95
@ HOUSE_TRAINING_HALL_95
Definition: UIHouses.h:85
Condition_Eradicated
@ Condition_Eradicated
Definition: Conditions.h:24
HOUSE_DIALOGUE_BANK_GET_GOLD
@ HOUSE_DIALOGUE_BANK_GET_GOLD
Definition: UIHouses.h:15
uItemsAmountPerShopType
std::array< const char, 5 > uItemsAmountPerShopType
Definition: UIHouses.cpp:341
_4B254D_SkillMasteryTeacher
String _4B254D_SkillMasteryTeacher(int trainerInfo)
Definition: GUIWindow.cpp:1846
GUIWindow.h
BuildingType_BodyGuild
@ BuildingType_BodyGuild
Definition: Events2D.h:15
pMessageQueue_50CBD0
struct GUIMessageQueue * pMessageQueue_50CBD0
Definition: GUIWindow.cpp:86
PlayerSpeech
PlayerSpeech
Definition: Player.h:46
_2devent::uAnimationID
uint16_t uAnimationID
Definition: Events2D.h:42
HOUSE_DIALOGUE_SHOP_REPAIR
@ HOUSE_DIALOGUE_SHOP_REPAIR
Definition: UIHouses.h:12
Condition_Pertified
@ Condition_Pertified
Definition: Conditions.h:23
pDialogueWindow
GUIWindow * pDialogueWindow
Definition: GUIWindow.cpp:50
Color16
uint16_t Color16(uint32_t r, uint32_t g, uint32_t b)
Definition: Engine.cpp:148
pOutdoor
OutdoorLocation * pOutdoor
Definition: Outdoor.cpp:48
BuildingType_ElementalGuild
@ BuildingType_ElementalGuild
Definition: Events2D.h:18
HOUSE_DIALOGUE_TAVERN_BUY_FOOD
@ HOUSE_DIALOGUE_TAVERN_BUY_FOOD
Definition: UIHouses.h:23
ArcomageGame::bGameInProgress
char bGameInProgress
Definition: Arcomage.h:162
pMouse
Mouse * pMouse
Definition: UIPopup.cpp:38
Party::uCurrentYear
unsigned int uCurrentYear
Definition: Party.h:271
_2devent::field_14
int16_t field_14
Definition: Events2D.h:47
pIndoorCameraD3D
IndoorCameraD3D * pIndoorCameraD3D
Definition: IndoorCameraD3D.cpp:21
StringPrintf
String StringPrintf(const char *fmt,...)
Definition: Strings.cpp:9
Party::AddGold
static void AddGold(int amount)
Definition: Party.cpp:287
BuildingType_Tavern
@ BuildingType_Tavern
Definition: Events2D.h:25
HOUSE_DIALOGUE_TAVERN_ARCOMAGE_VICTORY_CONDITIONS
@ HOUSE_DIALOGUE_TAVERN_ARCOMAGE_VICTORY_CONDITIONS
Definition: UIHouses.h:40
_2devent::generation_interval_days
int16_t generation_interval_days
Definition: Events2D.h:51
Party_Teleport_Z_Pos
int Party_Teleport_Z_Pos
Definition: mm7_data.cpp:624
TownHallDialog
void TownHallDialog()
Definition: UIHouses.cpp:1915
Party::SpecialItemsInShops
std::array< std::array< ItemGen, 12 >, 53 > SpecialItemsInShops
Definition: Party.h:315
GUIButton::sLabel
String sLabel
Definition: GUIButton.h:36
Party::sRotationY
int sRotationY
Definition: Party.h:251
HOUSE_DIALOGUE_SHOP_IDENTIFY
@ HOUSE_DIALOGUE_SHOP_IDENTIFY
Definition: UIHouses.h:11
InitializaDialogueOptions_Shops
void InitializaDialogueOptions_Shops(BuildingType type)
Definition: UIHouses.cpp:417
stru193_math::uIntegerPi
static const unsigned int uIntegerPi
Definition: OurMath.h:88
String
std::string String
Definition: Strings.h:10
HouseSound_Goodbye
@ HouseSound_Goodbye
Definition: UIHouses.h:116
byte_4ED970_skill_learn_ability_by_class_table
std::array< std::array< char, 37 >, 36 > byte_4ED970_skill_learn_ability_by_class_table
Definition: mm7_data.cpp:425
Keyboard.h
InitializaDialogueOptions_Tavern
void InitializaDialogueOptions_Tavern(BuildingType type)
Definition: UIHouses.cpp:398
bountyHunting_text
const char * bountyHunting_text
Definition: mm7_data.cpp:771
stru159.h
pEventTimer
Timer * pEventTimer
Definition: Time.cpp:8
GameTime
Definition: Time.h:14
_591428_endcap
Image * _591428_endcap
Definition: UIHouses.cpp:52
Party::monster_for_hunting_killed
std::array< __int16, 5 > monster_for_hunting_killed
Definition: Party.h:289
Party::GetGold
int GetGold() const
Definition: Party.cpp:264
_2devent::_quest_related
int16_t _quest_related
Definition: Events2D.h:59
word_4F0754
std::array< int16_t, 49 > word_4F0754
Definition: mm7_data.cpp:483
GUIWindow_House
Definition: UIHouses.h:155
MonsterInfo::uLevel
uint8_t uLevel
Definition: Monsters.h:122
Image::Release
bool Release()
Definition: Image.cpp:335
Party::monster_id_for_hunting
std::array< __int16, 5 > monster_id_for_hunting
Definition: Party.h:288
BuildingType_TownHall
@ BuildingType_TownHall
Definition: Events2D.h:21
ItemsTable::pItems
NZIArray< ItemDesc, 800 > pItems
Definition: Items.h:460
Mouse.h
SaveGame
void SaveGame(bool IsAutoSAve, bool NotSaveWorld)
Definition: SaveLoad.cpp:238
SPELL_BODY_PROTECTION_FROM_MAGIC
@ SPELL_BODY_PROTECTION_FROM_MAGIC
Definition: Spells.h:93
HOUSE_BODY_GUILD_ERATHIA
@ HOUSE_BODY_GUILD_ERATHIA
Definition: UIHouses.h:94
CastSpellInfo.h
Sailor
@ Sailor
Definition: NPC.h:13
Party::alignment
PartyAlignment alignment
Definition: Party.h:308
BuildingType_WaterGuild
@ BuildingType_WaterGuild
Definition: Events2D.h:11
BuildingType_19
@ BuildingType_19
Definition: Events2D.h:23
HOUSE_DIALOGUE_TAVERN_ARCOMAGE_RULES
@ HOUSE_DIALOGUE_TAVERN_ARCOMAGE_RULES
Definition: UIHouses.h:39
render
std::shared_ptr< IRender > render
Definition: RenderOpenGL.cpp:52