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