620
|
1 #include "UIHouses.h"
|
629
|
2 #include "Party.h"
|
|
3 #include "Player.h"
|
|
4 #include "texts.h"
|
|
5 #include "Events.h"
|
|
6 #include "Arcomage.h"
|
|
7 #include "LOD.h"
|
|
8 #include "Mouse.h"
|
|
9 #include "GUIWindow.h"
|
|
10 #include "GUIFont.h"
|
|
11 #include "Events2D.h"
|
|
12 #include "Overlays.h"
|
|
13 #include "Render.h"
|
|
14 #include "Indoor.h"
|
|
15 #include "Outdoor.h"
|
|
16 #include "AudioPlayer.h"
|
|
17 #include "VideoPlayer.h"
|
|
18 #include "Monsters.h"
|
|
19 #include "Viewport.h"
|
|
20 #include "Keyboard.h"
|
|
21 #include "NPC.h"
|
775
|
22 #include "IndoorCamera.h"
|
|
23 #include "MapInfo.h"
|
777
|
24 #include "Log.h"
|
727
|
25 #include "MM7.h"
|
629
|
26 #include "mm7_data.h"
|
978
|
27 #include "Game.h"
|
629
|
28
|
1016
|
29 #include "stru159.h"
|
629
|
30 int uHouse_ExitPic; // weak
|
|
31
|
|
32 int dword_591080; // weak
|
|
33
|
747
|
34 int in_current_building_type; // 00F8B198
|
|
35 HOUSE_DIALOGUE_MENU dialog_menu_id; // 00F8B19C
|
|
36
|
775
|
37 #pragma pack(push, 1)
|
|
38 struct stru365_travel_info
|
|
39 {
|
|
40 unsigned char uMapInfoID;
|
|
41 unsigned char pSchedule[7];
|
776
|
42 unsigned int uTravelTime;
|
777
|
43 int arrival_x;
|
|
44 int arrival_y;
|
|
45 int arrival_z;
|
|
46 int arrival_rot_y;
|
775
|
47 unsigned int uQuestBit; // quest bit required to set for this travel option to be enabled; otherwise 0
|
|
48 };
|
|
49 #pragma pack(pop)
|
777
|
50 stru365_travel_info transport_schedule[35] = // 004F09B0
|
775
|
51 {
|
778
|
52 {MAP_STEADWICK, {1, 0, 1, 0, 1, 0, 0}, 2, -18048, 4636, 833, 1536, 0},
|
|
53 {MAP_PIERPONT, {0, 1, 0, 1, 0, 1, 0}, 2, -2527, -6773, 1153, 896, 0},
|
|
54 {MAP_TATALIA, {1, 0, 1, 0, 1, 0, 0}, 2, 4730, -10580, 320, 1024, 0},
|
|
55 {MAP_HARMONDALE, {0, 1, 0, 1, 0, 1, 0}, 2, -5692, 11137, 1, 1024, 0},
|
|
56 {MAP_DEYJA, {1, 0, 0, 1, 0, 0, 0}, 3, 7227, -16007, 2625, 640, 0},
|
|
57 {MAP_BRAKADA_DESERT, {0, 0, 1, 0, 0, 1, 0}, 3, 8923, 17191, 1, 512, 0},
|
|
58 {MAP_AVLEE, {1, 0, 1, 0, 1, 0, 0}, 3, 17059, 12331, 512, 1152, 0},
|
|
59 {MAP_DEYJA, {0, 1, 0, 0, 1, 0, 1}, 2, 7227, -16007, 2625, 640, 0},
|
|
60 {MAP_HARMONDALE, {0, 1, 0, 1, 0, 1, 0}, 2, -5692, 11137, 1, 1024, 0},
|
|
61 {MAP_STEADWICK, {1, 0, 1, 0, 1, 0, 0}, 3, -18048, 4636, 833, 1536, 0},
|
|
62 {MAP_PIERPONT, {0, 1, 0, 1, 0, 1, 0}, 2, -2527, -6773, 1153, 896, 0},
|
|
63 {MAP_STEADWICK, {1, 0, 1, 0, 1, 0, 1}, 3, -18048, 4636, 833, 1536, 0},
|
|
64 {MAP_HARMONDALE, {0, 1, 0, 0, 0, 1, 0}, 5, -5692, 11137, 1, 1024, 0},
|
|
65 {MAP_STEADWICK, {0, 1, 0, 1, 0, 1, 0}, 2, -18048, 4636, 833, 1536, 0},
|
|
66 {MAP_PIERPONT, {0, 1, 0, 1, 0, 1, 0}, 3, -2527, -16007, 1153, 896, 0},
|
|
67 {MAP_DEYJA, {0, 0, 1, 0, 0, 0, 1}, 5, 7227, -16007, 2625, 640, 0},
|
|
68 {MAP_TATALIA, {0, 1, 0, 1, 0, 1, 0}, 2, -2183, -6941, 97, 0, 0},
|
|
69 {MAP_AVLEE, {1, 0, 0, 0, 1, 0, 0}, 4, 7913, 9476, 193, 0, 0},
|
|
70 {MAP_EVENMORN_ISLE, {0, 0, 0, 0, 0, 0, 1}, 7, 15616, 6390, 193, 1536, PARTY_QUEST_EVENMORN_MAP_FOUND},
|
|
71 {MAP_BRAKADA_DESERT, {0, 0, 1, 0, 0, 0, 0}, 6, 19171, -19722, 193, 1024, 0},
|
|
72 {MAP_AVLEE, {0, 1, 0, 1, 0, 1, 0}, 3, 7913, 9476, 193, 0, 0},
|
|
73 {MAP_BRAKADA_DESERT, {1, 0, 1, 0, 0, 0, 0}, 6, 19171, -19722, 193, 1024, 0},
|
|
74 {MAP_TATALIA, {1, 0, 1, 0, 1, 0, 0}, 4, -2183, -6941, 97, 0, 0},
|
|
75 {MAP_PIERPONT, {0, 0, 0, 0, 0, 1, 0}, 6, -709, -14087, 193, 1024, 0},
|
|
76 {MAP_STEADWICK, {0, 0, 0, 0, 0, 0, 1}, 6, -10471, 13497, 193, 1536, 0},
|
|
77 {MAP_EVENMORN_ISLE, {0, 1, 0, 1, 0, 0, 0}, 1, 15616, 6390, 193, 1536, PARTY_QUEST_EVENMORN_MAP_FOUND},
|
|
78 {MAP_BRAKADA_DESERT, {0, 1, 0, 1, 0, 0, 0}, 1, 19171, -19722, 193, 1024, 0},
|
|
79 {MAP_STEADWICK, {0, 1, 0, 1, 0, 1, 0}, 2, -10471, 13497, 193, 1536, 0},
|
|
80 {MAP_BRAKADA_DESERT, {1, 0, 1, 0, 0, 0, 0}, 4, 19171, -19722, 193, 1024, 0},
|
|
81 {MAP_EVENMORN_ISLE, {0, 0, 0, 0, 0, 0, 1}, 5, 15616, 6390, 193, 1536, PARTY_QUEST_EVENMORN_MAP_FOUND},
|
|
82 {MAP_AVLEE, {0, 0, 0, 0, 1, 0, 0}, 5, 7913, 9476, 193, 0, 0},
|
|
83 {MAP_STEADWICK, {0, 1, 0, 0, 0, 1, 0}, 4, -10471, 13497, 193, 1536, 0},
|
|
84 {MAP_PIERPONT, {1, 0, 1, 0, 1, 0, 0}, 3, -709, -14087, 193, 1024, 0},
|
|
85 {MAP_TATALIA, {0, 0, 0, 1, 0, 0, 0}, 5, -2183, -6941, 97, 0, 0},
|
|
86 {MAP_ARENA, {0, 0, 0, 0, 0, 0, 1}, 4, 3844, 2906, 193, 512, 0}
|
775
|
87 };
|
|
88
|
777
|
89 unsigned char transport_routes[20][4] =
|
|
90 {
|
|
91 { 0, 1, 1, 34}, // HOUSE_STABLES_HARMONDALE
|
|
92 { 2, 3, 4, 5}, // HOUSE_STABLES_STEADWICK
|
|
93 { 6, 7, 8, 8}, // HOUSE_STABLES_56
|
|
94 { 9, 10, 10, 10}, // HOUSE_STABLES_57
|
|
95 { 11, 11, 12, 12}, // HOUSE_STABLES_58
|
|
96 { 13, 13, 13, 13}, // HOUSE_STABLES_59
|
|
97 { 14, 14, 15, 15}, // HOUSE_STABLES_60
|
|
98 {255, 255, 255, 255}, // HOUSE_STABLES_61
|
|
99 {255, 255, 255, 255}, // HOUSE_STABLES_62
|
|
100 {255, 255, 255, 255}, // HOUSE_BOATS_63
|
|
101 { 16, 17, 18, 19}, // HOUSE_BOATS_64
|
|
102 { 18, 20, 21, 21}, // HOUSE_BOATS_65
|
|
103 { 22, 23, 24, 25}, // HOUSE_BOATS_66
|
|
104 { 22, 22, 23, 23}, // HOUSE_BOATS_67
|
|
105 {255, 255, 255, 255}, // HOUSE_BOATS_68
|
|
106 { 27, 28, 29, 30}, // HOUSE_BOATS_69
|
|
107 { 31, 32, 33, 33}, // HOUSE_BOATS_70
|
|
108 { 24, 24, 24, 24}, // HOUSE_BOATS_71
|
|
109 {255, 255, 255, 255}, // HOUSE_BOATS_72
|
|
110 {255, 255, 255, 255} // HOUSE_BOATS_73
|
|
111 };
|
|
112
|
|
113
|
|
114
|
|
115
|
|
116
|
629
|
117 const stru159 pAnimatedRooms[196] = //0x4E5F70
|
778
|
118 {
|
629
|
119 {"", 0x4, 0x1F4, 0, 0, 0},
|
|
120 {"Human Armor01", 0x20, 0x2C0, 2, 58, 0},
|
|
121 {"Necromancer Armor01", 0x20, 0x2D7, 2, 70, 0 },
|
|
122 {"Dwarven Armor01", 0x20, 0x2EE, 2, 5, 0 },
|
|
123 {"Wizard Armor", 0x20, 0x3BD, 2, 19, 0 },
|
|
124 {"Warlock Armor", 0x20, 0x2D6, 2, 35, 0 },
|
|
125 {"Elf Armor", 0x20, 0x2BC, 2, 79, 0 },
|
|
126 {"Human Alchemisht01", 0xE, 0x2BE, 4, 95, 0 },
|
|
127 {"Necromancer Alchemist01", 0xE, 0x2D6, 4, 69, 0 },
|
|
128 {"Dwarven Achemist01", 0xE, 0x387, 4, 4, 0 },
|
|
129 {"Wizard Alchemist", 0xE, 0x232, 4, 25, 0 },
|
|
130 {"Warlock Alchemist", 0xE, 0x2BE, 4, 42, 0 },
|
|
131 {"Elf Alchemist", 0xE, 0x38A, 4, 84, 0 },
|
|
132 {"Human Bank01", 0x6, 0x384, 22, 52, 0 },
|
|
133 {"Necromancer Bank01", 0x6, 0x2D8, 22, 71, 0 },
|
|
134 {"Dwarven Bank", 0x6, 0x2F3, 22, 6, 0 },
|
|
135 {"Wizard Bank", 0x6, 0x3BA, 22, 20, 0 },
|
|
136 {"Warlock Bank", 0x6, 0x39F, 22, 36, 0 },
|
|
137 {"Elf Bank", 0x6, 0x2BC, 22, 71, 0 },
|
|
138 {"Boat01", 0xF, 0x4C, 28, 53, 3 },
|
|
139 {"Boat01d", 0xF, 0x4C, 28, 53, 3 },
|
|
140 {"Human Magic Shop01", 0xA, 0x2C8, 3, 54, 0 },
|
|
141 {"Necromancer Magic Shop01", 0xE, 0x2DC, 3, 66, 0 },
|
|
142 {"Dwarven Magic Shop01", 0x2A, 0x2EF, 3, 91, 0 },
|
|
143 {"Wizard Magic Shop", 0x1E, 0x2DF, 3, 15, 0 },
|
|
144 {"Warlock Magic Shop", 0x7, 0x3B9, 3, 15, 0 },
|
|
145 {"Elf Magic Shop", 0x24, 0x2CC, 3, 82, 0 },
|
|
146 {"Human Stables01", 0x21, 0x31, 27, 48, 3 },
|
|
147 {"Necromancer Stables", 0x21, 0x2DD, 27, 67, 3 },
|
|
148 {"", 0x21, 0x2F0, 27, 91, 3 },
|
|
149 {"Wizard Stables", 0x21, 0x3BA, 27, 16, 3 },
|
|
150 {"Warlock Stables", 0x21, 0x181, 27, 77, 3 },
|
|
151 {"Elf Stables", 0x21, 0x195, 27, 77, 3 },
|
|
152 {"Human Tavern01", 0xD, 0x2C2, 21, 49, 0 },
|
|
153 {"Necromancer Tavern01", 0xD, 0x3B0, 21, 57, 0 },
|
|
154 {"Dwarven Tavern01", 0xD, 0x2FE, 21, 94, 0 },
|
|
155 {"Wizard Tavern", 0xD, 0x3BB, 21, 17, 0 },
|
|
156 {"Warlock Tavern", 0xD, 0x3A8, 21, 33, 0 },
|
|
157 {"Elf Tavern", 0xD, 0x2CD, 21, 78, 0 },
|
|
158 {"Human Temple01", 0x24, 0x2DB, 23, 50, 3 },
|
|
159 {"Necromancer Temple", 0x24, 0x2DF, 23, 60, 3 },
|
|
160 {"Dwarven Temple01", 0x24, 0x2F1, 23, 86, 3 },
|
|
161 {"Wizard Temple", 0x24, 0x2E0, 23, 10, 3 },
|
|
162 {"Warlock Temple", 0x24, 0x3A4, 23, 27, 3 },
|
|
163 {"Elf Temple", 0x24, 0x2CE, 23, 72, 3 },
|
|
164 {"Human Town Hall", 0x10, 0x39C, 17, 14, 0 },
|
|
165 {"Necromancer Town Hall01", 0x10, 0x3A4, 17, 61, 0 },
|
|
166 {"Dwarven Town Hall", 0x10, 0x2DB, 17, 88, 0 },
|
|
167 {"Wizard Town Hall", 0x10, 0x3BD, 17, 11, 0 },
|
|
168 {"Warlock Town Hall", 0x10, 0x2DB, 17, 28, 0 },
|
|
169 {"Elf Town Hall", 0x10, 0x27A, 17, 73, 0 },
|
|
170 {"Human Training Ground01", 0x18, 0x2C7, 30, 44, 0 },
|
|
171 {"Necromancer Training Ground", 0x18, 0x3AD, 30, 62, 0 },
|
|
172 {"Dwarven Training Ground", 0x18, 0x2F2, 30, 89, 0 },
|
|
173 {"Wizard Training Ground", 0x18, 0x3A3, 30, 12, 0 },
|
|
174 {"Warlock Training Ground", 0x18, 0x3A6, 30, 29, 0 },
|
|
175 {"Elf Training Ground", 0x18, 0x19F, 30, 74, 0 },
|
|
176 {"Human Weapon Smith01", 0x16, 0x2C1, 1, 45, 4 },
|
|
177 {"Necromancer Weapon Smith01", 0x16, 0x2D9, 1, 63, 4 },
|
|
178 {"Dwarven Weapon Smith01", 0x16, 0x2EE, 1, 82, 4 },
|
|
179 {"Wizard Weapon Smith", 0x16, 0x2D5, 1, 13, 4 },
|
|
180 {"Warlock Weapon Smith", 0x16, 0x2D7, 1, 23, 4 },
|
|
181 {"Elf Weapon Smith", 0x16, 0x2CA, 1, 75, 4 },
|
|
182 {"Air Guild", 0x1D, 0xA4, 6, 1, 3 },
|
|
183 {"Body Guild", 0x19, 0x3BF, 11, 2, 0 },
|
|
184 {"DarkGuild", 0x19, 0x2D1, 13, 3, 0 },
|
|
185 {"EarthGuild", 0x19, 0x2CB, 8, 83, 0 },
|
|
186 {"Fire Guild", 0x1C, 0x2BF, 5, 56, 0 },
|
|
187 {"Light Guild", 0x1C, 0x2D5, 12, 46, 0 },
|
|
188 {"Mind Guild", 0x1C, 0xE5, 10, 40, 0 },
|
|
189 {"Spirit Guild", 0x1C, 0x2D2, 9, 41, 0 },
|
|
190 {"Water Guild", 0x1B, 0x2D3, 7, 24, 0 },
|
|
191 {"Lord And Judge Out01", 1, 0, 29, 39, 0 },
|
|
192 {"Human Poor House 1", 8, 0, 29, 0, 0 },
|
|
193 {"Human Poor House 2", 8, 0, 29, 0, 0 },
|
|
194 {"Human Poor House 3", 8, 0, 29, 0, 0 },
|
|
195 {"Human Medium House 1", 8, 0, 29, 0, 0 },
|
|
196 {"Human Medium House 2", 8, 0, 29, 0, 0 },
|
|
197 {"Human Medium House 3", 8, 0, 29, 0, 0 },
|
|
198 {"Human Rich House 1", 8, 0, 29, 0, 0 },
|
|
199 {"Human Rich House 2", 8, 0, 29, 0, 0 },
|
|
200 {"Human Rich House 3", 8, 0, 29, 0, 0 },
|
|
201 {"Elven Poor House 1", 8, 0, 29, 0, 0 },
|
|
202 {"Elven Poor House 2", 8, 0, 29, 0, 0 },
|
|
203 {"Elven Poor House 3", 8, 0, 29, 0, 0 },
|
|
204 {"Elven Medium House 1", 8, 0, 29, 0, 0 },
|
|
205 {"Elven Medium House 2", 8, 0, 29, 0, 0 },
|
|
206 {"Elven Medium House 3", 8, 0, 29, 0, 0 },
|
|
207 {"Elven Rich House 1", 8, 0, 29, 0, 0 },
|
|
208 {"Elven Rich House 2", 8, 0, 29, 0, 0 },
|
|
209 {"Elven Rich House 3", 8, 0, 29, 0, 0 },
|
|
210 {"Dwarven Poor House 1", 8, 0, 29, 0, 0 },
|
|
211 {"Dwarven Poor House 2", 8, 0, 29, 0, 0 },
|
|
212 {"Dwarven Poor House 3", 8, 0, 29, 0, 0 },
|
|
213 {"Dwarven Medium House 1", 8, 0, 29, 0, 0 },
|
|
214 {"Dwarven Medium house 2", 8, 0, 29, 0, 0 },
|
|
215 {"Dwarven Medium House 3", 8, 0, 29, 0, 0 },
|
|
216 {"Dwarven Rich House 1", 8, 0, 29, 0, 0 },
|
|
217 {"Dwarven Rich House 2", 8, 0, 29, 0, 0 },
|
|
218 {"Dwarven Rich House 3", 8, 0, 29, 0, 0 },
|
|
219 {"Wizard Poor House 1", 8, 0, 29, 0, 0 },
|
|
220 {"Wizard Poor House 2", 8, 0, 29, 0, 0 },
|
|
221 {"Wizard Poor House 3", 8, 0, 29, 0, 0 },
|
|
222 {"Wizard Medium House 1", 8, 0, 29, 0, 0 },
|
|
223 {"Wizard Medium House 2", 8, 0, 29, 0, 0 },
|
|
224 {"Wizard Mdeium House 3", 8, 0, 29, 0, 0 },
|
|
225 {"Wizard Rich House 1", 8, 0, 29, 0, 0 },
|
|
226 {"Wizard Rich House 2", 8, 0, 29, 0, 0 },
|
|
227 {"Wizard Rich House 3", 8, 0, 29, 0, 0 },
|
|
228 {"Necromancer Poor House 1", 8, 0, 29, 0, 0 },
|
|
229 {"Necromancer Poor House 2", 8, 0, 29, 0, 0 },
|
|
230 {"Necromancer Poor House 3", 8, 0, 29, 0, 0 },
|
|
231 {"Necromancer Medium House 1", 8, 0, 29, 0, 0 },
|
|
232 {"Necromancer Medium House 2", 8, 0, 29, 0, 0 },
|
|
233 {"Necromancer Mdeium House 3", 8, 0, 29, 0, 0 },
|
|
234 {"Necromancer Rich House 1", 8, 0, 29, 0, 0 },
|
|
235 {"Necromancer Rich House 2", 8, 0, 29, 0, 0 },
|
|
236 {"Necromancer Rich House 3", 8, 0, 29, 0, 0 },
|
|
237 {"Warlock Poor House 1", 8, 0, 29, 0, 0 },
|
|
238 {"Warlock Poor House 2", 8, 0, 29, 0, 0 },
|
|
239 {"Warlock Poor House 3", 8, 0, 29, 0, 0 },
|
|
240 {"Warlock Medium House 1", 8, 0, 29, 0, 0 },
|
|
241 {"Warlock Medium House 2", 8, 0, 29, 0, 0 },
|
|
242 {"Warlock Mdeium House 3", 8, 0, 29, 0, 0 },
|
|
243 {"Warlock Rich House 1", 8, 0, 29, 0, 0 },
|
|
244 {"Warlock Rich House 2", 8, 0, 29, 0, 0 },
|
|
245 {"Warlock Rich House 3", 8, 0, 29, 0, 0 },
|
|
246 {"Out01 Temple of the Moon", 0x24, 0, 25, 0, 0 },
|
|
247 {"Out01 Dragon Cave", 0x24, 0, 25, 0, 0 },
|
|
248 {"Out02 Castle Harmondy", 0x24, 0, 25, 0, 0 },
|
|
249 {"Out02 White Cliff Cave", 0x24, 0, 25, 0, 0 },
|
|
250 {"Out03 Erathian Sewer", 0x24, 0, 25, 0, 0 },
|
|
251 {"Out03 Fort Riverstride", 0x24, 0, 25, 0, 0 },
|
|
252 {"Out03 Castle Gryphonheart", 0x24, 0, 25, 0, 0 },
|
|
253 {"Out04 Elf Castle", 0x24, 0, 25, 0, 0 },
|
|
254 {"Out04 Tularean Caves", 0x24, 0, 25, 0, 0 },
|
|
255 {"Out04 Clanker's Laboratory", 0x24, 0, 25, 0, 0 },
|
|
256 {"Out05 Hall of the Pit", 0x24, 0, 25, 0, 0 },
|
|
257 {"Out05 Watchtower 6", 0x24, 0, 25, 0, 0 },
|
|
258 {"Out06 School of Sorcery", 0x24, 0, 25, 0, 0 },
|
|
259 {"Out06 Red Dwarf Mines", 0x24, 0, 25, 0, 0 },
|
|
260 {"Out07 Castle Lambert", 0x24, 0, 25, 0, 0 },
|
|
261 {"Out07 Walls of Mist", 0x24, 0, 25, 0, 0 },
|
|
262 {"Out07 Temple of the Light", 0x24, 0, 25, 0, 0 },
|
|
263 {"Out08 Evil Entrance", 0x24, 0, 25, 0, 0 },
|
|
264 {"Out08 Breeding Zone", 0x24, 0, 25, 0, 0 },
|
|
265 {"Out08 Temple of the Dark", 0x24, 0, 25, 0, 0 },
|
|
266 {"Out09 Grand Temple of the Moon", 0x24, 0, 25, 0, 0 },
|
|
267 {"Out09 Grand Tempple of the Sun", 0x24, 0, 25, 0, 0 },
|
|
268 {"Out10 Thunderfist Mountain", 0x24, 0, 25, 0, 0 },
|
|
269 {"Out10 The Maze", 0x24, 0, 25, 0, 0 },
|
|
270 {"Out10 Connecting Tunnel Cave #1", 0x24, 0, 25, 0, 0 },
|
|
271 {"", 0x24, 0, 25, 0, 0 },
|
|
272 {"", 0x24, 0, 25, 0, 0 },
|
|
273 {"Out11 Stone City", 0x24, 0, 25, 0, 0 },
|
|
274 {"", 0x24, 0, 25, 0, 0 },
|
|
275 {"Out12 Colony Zod", 0x24, 0, 25, 0, 0 },
|
|
276 {"Out12 Connecting Tunnel Cave #1", 0x24, 0, 25, 0, 0 },
|
|
277 {"", 0x24, 0, 25, 0, 0 },
|
|
278 {"", 0x24, 0, 25, 0, 0 },
|
|
279 {"Out13 Mercenary Guild", 0x24, 0, 25, 0, 0 },
|
|
280 {"Out13 Tidewater Caverns", 0x24, 0, 25, 0, 0 },
|
|
281 {"Out13 Wine Cellar", 0x24, 0, 25, 0, 0 },
|
|
282 {"Out14 Titan's Stronghold", 0x24, 0, 25, 0, 0 },
|
|
283 {"Out14 Temple Of Baa", 0x24, 0, 25, 0, 0 },
|
|
284 {"Out14 Hall under the Hill", 0x24, 0, 25, 0, 0 },
|
|
285 {"Out15 The Linclon", 0x24, 0, 25, 0, 0 },
|
|
286 {"Jail", 0x24, 0, 31, 0, 0 },
|
|
287 {"Harmondale Throne Room", 0x24, 0, 29, 0, 0 },
|
|
288 {"Gryphonheart Throne Room", 0x24, 0, 20, 0, 0 },
|
|
289 {"Elf Castle Throne Room", 0x24, 0, 20, 0, 0 },
|
|
290 {"Wizard Castle Throne Room", 0x24, 0, 20, 0, 0 },
|
|
291 {"Necromancer Casstle Trone Room", 0x24, 0, 20, 0, 0 },
|
|
292 {"Master Thief", 0x24, 0, 29, 0, 0 },
|
|
293 {"Dwarven King", 0x24, 0, 20, 0, 0 },
|
|
294 {"Arms Master", 0x24, 0, 29, 0, 0 },
|
|
295 {"Warlock", 0x24, 0, 29, 0, 0 },
|
|
296 {"Lord Markam", 0x24, 0, 20, 0, 0 },
|
|
297 {"Arbiter Neutral Town", 0x24, 0, 29, 0, 0 },
|
|
298 {"Arbiter Good Town", 0x24, 0, 29, 0, 0 },
|
|
299 {"Arbiter Evil Town", 0x24, 0, 29, 0, 0 },
|
|
300 {"Necromancer Throne Room Empty", 0x24, 0, 20, 0, 0 },
|
|
301 {"", 0x24, 0, 29, 0, 0 },
|
|
302 {"", 0x24, 0, 29, 0, 0 },
|
|
303 {"", 0x24, 0, 29, 0, 0 },
|
|
304 {"", 0x24, 0, 29, 0, 0 },
|
|
305 {"Boat01", 0xF, 0, 29, 53, 3 },
|
|
306 {"", 0x24, 0, 28, 0, 0 },
|
|
307 {"", 0x24, 0, 28, 0, 0 },
|
|
308 {"", 0x24, 0, 28, 0, 0 },
|
|
309 {"", 0x24, 0, 29, 0, 0 },
|
|
310 {"Arbiter Room Neutral", 0x24, 0, 29, 0, 0 },
|
|
311 {"Out02 Castle Harmondy Abandoned", 0x24, 0, 25, 0, 0 },
|
|
312 {"Human Temple02", 0x24, 0x3AB, 23, 27, 0 },
|
|
313 {"Player Castle Good", 0x24, 0, 25, 0, 0 },
|
|
314 {"Player Castle Bad", 0x24, 0, 25, 0, 0}
|
778
|
315 };
|
629
|
316
|
|
317
|
|
318
|
|
319 //----- (0044606A) --------------------------------------------------------
|
|
320 void PrepareHouse(HOUSE_ID house)
|
|
321 {
|
|
322 //unsigned int v1; // ebx@1
|
|
323 //signed int v2; // esi@1
|
|
324 //int uExitPic; // edi@1
|
|
325 __int16 uExitMapID; // ax@2
|
|
326 //int result; // eax@5
|
|
327 //unsigned int *v6; // ecx@8
|
|
328 int v7; // ebx@11
|
|
329 //int v8; // esi@16
|
|
330 //unsigned int v9; // eax@16
|
|
331 //unsigned int v10; // eax@19
|
|
332 //int v11; // ecx@19
|
|
333 //char pContainer[36]; // [sp+Ch] [bp-54h]@16
|
|
334 int v13; // [sp+30h] [bp-30h]@11
|
|
335 int Dst[6]; // [sp+34h] [bp-2Ch]@1
|
|
336 //unsigned int v15; // [sp+4Ch] [bp-14h]@1
|
|
337 int uAnimationID; // [sp+50h] [bp-10h]@1
|
|
338 //unsigned int *v17; // [sp+54h] [bp-Ch]@3
|
|
339 //unsigned int v18; // [sp+58h] [bp-8h]@1
|
|
340 //int v19; // [sp+5Ch] [bp-4h]@7
|
|
341
|
|
342 //v15 = uHouseID;
|
|
343 //v1 = 52 * uHouseID;
|
|
344 //uAnimationID = p2DEvents_minus1___02[26 * uHouseID];
|
|
345 uAnimationID = p2DEvents[house - 1].uAnimationID;
|
|
346 //v18 = 52 * uHouseID;
|
|
347 memset(Dst, 0, 0x18u);
|
|
348 //uExitPic = *(__int16 *)((char *)p2DEvents_minus1_::2C + v1);
|
|
349 //uExitPic = p2DEvents[uHouseID - 1].uExitPicID;
|
|
350 uNumDialogueNPCPortraits = 0;
|
|
351 uHouse_ExitPic = p2DEvents[house - 1].uExitPicID;
|
|
352 if ( uHouse_ExitPic )
|
|
353 {
|
|
354 //uExitMapID = *(__int16 *)((char *)p2DEvents_minus1_::30 + v1);
|
|
355 uExitMapID = p2DEvents[house - 1]._quest_related;
|
|
356 if ( uExitMapID > 0 )
|
|
357 {
|
|
358 //v17 = (unsigned int *)(uExitMapID - 1);
|
|
359 if(_449B57_test_bit(pParty->_quest_bits,uExitMapID))
|
|
360 // if ( !((unsigned __int8)(0x80u >> (uExitMapID - 1) % 8) & pParty->_quest_bits[(uExitMapID - 1) >> 3]) )
|
|
361 {
|
|
362 //uExitPic = 0;
|
|
363 uHouse_ExitPic = 0;
|
|
364 }
|
|
365 }
|
|
366 }
|
|
367
|
|
368 dword_591080 = pAnimatedRooms[uAnimationID].field_8;
|
|
369 //result = dword_591080;
|
|
370
|
|
371 //v2 = 0;
|
|
372 uNumDialogueNPCPortraits = 0;
|
|
373 if ( dword_591080 )
|
|
374 {
|
|
375 //v2 = 1;
|
|
376 Dst[0] = dword_591080;
|
|
377 uNumDialogueNPCPortraits = 1;
|
|
378 }
|
|
379
|
|
380 //v19 = 1;
|
|
381 for (uint i = 0; i < pNPCStats->uNumNewNPCs; ++i)
|
|
382 {
|
|
383 auto npc = pNPCStats->pNewNPCData + i;
|
|
384 //v6 = &pNPCStats->pNewNPCData[1].uFlags;
|
|
385 //v17 = &pNPCStats->pNewNPCData[1].uFlags;
|
|
386 //do
|
|
387 //{
|
|
388 if (npc->Location2D == house )
|
|
389 {
|
|
390 if (~npc->uFlags & 0x80)
|
|
391 //if ( !(*(char *)v6 & 0x80) )
|
|
392 {
|
873
|
393 v7 = uNumDialogueNPCPortraits++ - (dword_591080 != 0) ? 1 : 0;
|
629
|
394 HouseNPCData[v7] = npc;
|
|
395 //v6 = v17;
|
|
396 //*(&v13 + v2) = *(v17 - 1);
|
|
397 Dst[uNumDialogueNPCPortraits - 1] = npc->uPortraitID;
|
|
398 //v1 = v18;
|
|
399 if ((npc->uFlags & 3) != 2)
|
|
400 ++npc->uFlags;
|
|
401 }
|
|
402 }
|
|
403 //++v19;
|
|
404 //v6 += 19;
|
|
405 //v17 = v6;
|
|
406 //}
|
|
407 //while ( v19 < (signed int)pNPCStats->uNumNewNPCs );
|
|
408 }
|
|
409 //uNumDialogueNPCPortraits = v2;
|
|
410
|
|
411 //v19 = 0;
|
|
412 for (uint i = 0; i < uNumDialogueNPCPortraits; ++i)
|
|
413 //if ( v2 > 0 )
|
|
414 {
|
|
415 //do
|
|
416 //{
|
|
417 //v8 = v19;
|
|
418 char icon_name[128];
|
|
419 sprintfex(icon_name, "npc%03u", Dst[i]);
|
|
420 //v9 = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
|
|
421 //++v19;
|
|
422 pDialogueNPCPortraits[i] = pIcons_LOD->LoadTexturePtr(icon_name, TEXTURE_16BIT_PALETTE);
|
|
423 //result = v19;
|
|
424 //}
|
|
425 //while ( v19 < uNumDialogueNPCPortraits );
|
|
426 //uExitPic = uHouse_ExitPic;
|
|
427 }
|
|
428
|
|
429 if (uHouse_ExitPic)
|
|
430 {
|
|
431 //v10 = pIcons_LOD->LoadTexture(pHouse_ExitPictures[uHouse_ExitPic], TEXTURE_16BIT_PALETTE);
|
|
432 //v11 = uNumDialogueNPCPortraits++;
|
|
433 pDialogueNPCPortraits[uNumDialogueNPCPortraits++] = pIcons_LOD->LoadTexturePtr(pHouse_ExitPictures[uHouse_ExitPic], TEXTURE_16BIT_PALETTE);
|
|
434 //result = *(__int16 *)((char *)p2DEvents_minus1_::2E + v1);
|
|
435 //result = p2DEvents[house - 1].uExitMapID;
|
|
436 uHouse_ExitPic = p2DEvents[house - 1].uExitMapID;
|
|
437 }
|
|
438 //return result;
|
|
439 }
|
|
440
|
|
441
|
|
442 //----- (0044622E) --------------------------------------------------------
|
735
|
443 bool EnterHouse(enum HOUSE_ID uHouseID)
|
|
444 {
|
629
|
445 //enum HOUSE_ID v1; // edi@1
|
|
446 //int v2; // edi@5
|
|
447 signed int uOpenTime; // eax@5
|
|
448 signed int uCloseTime; // esi@5
|
|
449 unsigned int v5; // esi@5
|
|
450 int v6; // edx@5
|
|
451 signed int am_pm_flag_open; // ecx@10
|
|
452 signed int am_pm_flag_close; // eax@10
|
|
453 int v9; // esi@10
|
|
454 //unsigned int v10; // esi@16
|
|
455 int v11; // ecx@17
|
|
456 unsigned int v12; // kr00_4@25
|
|
457 //Player *v13; // esi@25
|
|
458 int v14; // eax@25
|
|
459 //Player *v15; // esi@27
|
|
460 //signed int v16; // eax@32
|
|
461 unsigned int v17; // eax@37
|
|
462 signed int v18; // edi@37
|
|
463 signed int v19; // edi@41
|
|
464 //unsigned int v20; // ecx@41
|
|
465 //const char *v22; // [sp-4h] [bp-40h]@33
|
|
466 char pContainer[40]; // [sp+Ch] [bp-30h]@32
|
|
467 unsigned int v24; // [sp+34h] [bp-8h]@5
|
|
468 //enum HOUSE_ID v25; // [sp+38h] [bp-4h]@1
|
|
469
|
|
470 //v1 = uHouseID;
|
|
471 //v25 = uHouseID;
|
783
|
472 GameUI_Footer_TimedString[0] = 0;
|
|
473 pFooterString[0] = 0;
|
629
|
474 ShowStatusBarString("", 2u);
|
|
475 if ( pMessageQueue_50CBD0->uNumMessages )
|
|
476 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
|
|
477 viewparams->bRedrawGameUI = 1;
|
|
478 uDialogueType = 0;
|
1038
|
479 pKeyActionMap->SetWindowInputStatus(3);
|
629
|
480 pKeyActionMap->ResetKeys();
|
|
481 if (uHouseID == HOUSE_600 || uHouseID == HOUSE_601)
|
|
482 {
|
|
483 GameOverMenu(0);
|
|
484 return 0;
|
|
485 }
|
|
486 uOpenTime = p2DEvents[uHouseID - 1].uOpenTime;
|
|
487 uCloseTime = p2DEvents[uHouseID - 1].uCloseTime;
|
827
|
488 current_npc_text = 0;
|
629
|
489 dword_F8B1E4 = 0;
|
|
490 dword_F8B1F4 = 0;
|
|
491 memset(byte_F8B1F0, 0, 4);
|
758
|
492 memset(player_levels, 0, 16);
|
629
|
493 pRenderer->ClearZBuffer(0, 479);
|
|
494
|
|
495 if (((uCloseTime - 1 <= uOpenTime)&&((pParty->uCurrentHour <uOpenTime)&&(pParty->uCurrentHour >(uCloseTime - 1))))||
|
|
496 ((uCloseTime - 1 > uOpenTime)&&((pParty->uCurrentHour < uOpenTime)||(pParty->uCurrentHour > (uCloseTime - 1)))))
|
|
497
|
|
498 {
|
|
499 am_pm_flag_open = 0;
|
|
500 am_pm_flag_close = 0;
|
|
501 if (uOpenTime > 12 )
|
|
502 {
|
|
503 uOpenTime -= 12;
|
|
504 am_pm_flag_open = 1;
|
|
505 }
|
|
506 if ( uCloseTime > 12 )
|
|
507 {
|
|
508 uCloseTime -= 12;
|
|
509 am_pm_flag_close = 1;
|
|
510 }
|
|
511 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[414], uOpenTime, aAMPMNames[am_pm_flag_open],
|
|
512 uCloseTime, aAMPMNames[am_pm_flag_close]); //"This place is open from %d%s to %d%s"
|
|
513 ShowStatusBarString(pTmpBuf, 2u);
|
|
514 if ( uActiveCharacter )
|
|
515 pPlayers[uActiveCharacter]->PlaySound(SPEECH_3, 0);
|
|
516 return 0;
|
|
517 }
|
|
518 else
|
|
519 {
|
|
520 //v10 = uHouseID;
|
|
521 if ( (signed int)uHouseID < 53 ) //entering shops and guilds
|
|
522 {
|
|
523 if ( !(pParty->field_3C._shop_ban_times[uHouseID])
|
|
524 || (pParty->field_3C._shop_ban_times[uHouseID] <= pParty->uTimePlayed) )
|
|
525 {
|
|
526 pParty->field_3C._shop_ban_times[uHouseID] = 0;
|
|
527 }
|
|
528 else
|
|
529 {
|
|
530 ShowStatusBarString(pGlobalTXT_LocalizationStrings[191], 2u);// "You've been banned from this shop!"
|
|
531 return 0;
|
|
532 }
|
|
533 }
|
|
534 if ( !start_event_seq_number )
|
|
535 pAudioPlayer->StopChannels(-1, -1);
|
|
536
|
|
537 uCurrentHouse_Animation = p2DEvents[uHouseID - 1].uAnimationID;
|
|
538 in_current_building_type = pAnimatedRooms[uCurrentHouse_Animation].uBuildingType;
|
|
539 if ( in_current_building_type == BildingType_Throne_Room && pParty->uFine ) // going 2 jail
|
|
540 {
|
|
541 uCurrentHouse_Animation = (signed __int16)p2DEvents[186].uAnimationID;
|
|
542 uHouseID = HOUSE_JAIL;
|
727
|
543 pParty->uTimePlayed = pParty->uTimePlayed + 0x7620000;
|
|
544 in_current_building_type = pAnimatedRooms[p2DEvents[HOUSE_LORD_AND_JUDGE_EMERALD_ISLE].uAnimationID].uBuildingType;
|
629
|
545 ++pParty->uNumPrisonTerms;
|
|
546 pParty->uFine = 0;
|
|
547 for (uint i = 0; i < 4; ++i)
|
|
548 {
|
|
549 pParty->pPlayers[i].uTimeToRecovery = 0;
|
|
550 pParty->pPlayers[i].uNumDivineInterventionCastsThisDay = 0;
|
|
551 pParty->pPlayers[i].SetVariable(VAR_Award, 87);
|
|
552 }
|
|
553 }
|
|
554 ++pIcons_LOD->uTexturePacksCount;
|
|
555 if ( !pIcons_LOD->uNumPrevLoadedFiles )
|
|
556 pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles;
|
|
557 switch (pParty->alignment)
|
|
558 {
|
|
559 case PartyAlignment_Good: sprintf(pContainer, "evt%02d-b", const_2()); break;
|
|
560 case PartyAlignment_Neutral: sprintf(pContainer, "evt%02d", const_2()); break;
|
|
561 case PartyAlignment_Evil: sprintf(pContainer, "evt%02d-c", const_2()); break;
|
|
562 default: assert(false);
|
|
563 }
|
|
564
|
|
565 v17 = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
|
|
566 pDialogueNPCCount = 0;
|
|
567 pTexture_Dialogue_Background = &pIcons_LOD->pTextures[v17];
|
910
|
568 uTextureID_right_panel_loop = uTextureID_right_panel;
|
629
|
569 PrepareHouse(uHouseID);
|
|
570 v18 = 1;
|
910
|
571 uTextureID_right_panel_loop = uTextureID_right_panel;
|
629
|
572 if ( uNumDialogueNPCPortraits == 1 )
|
|
573 pDialogueNPCCount = 1;
|
898
|
574 pVideoPlayer->OpenHouseMovie(pAnimatedRooms[uCurrentHouse_Animation].video_name, 1u);
|
629
|
575 dword_5C35D4 = 1;
|
|
576 if ( (signed int)uHouseID < 139 || (signed int)uHouseID > 172 )
|
727
|
577 {
|
|
578 if ( (signed int)uHouseID >= HOUSE_STABLES_HARMONDALE && (signed int)uHouseID <= 73 && !IsTravelAvailable(uHouseID - HOUSE_STABLES_HARMONDALE) )
|
|
579 {
|
|
580 return 1;
|
|
581 }
|
|
582 }
|
629
|
583 else
|
735
|
584 { //guilds
|
|
585 v19 = guild_mambership_flags[uHouseID - HOUSE_FIRE_GUILD_INITIATE_EMERALD_ISLE]; //guilds flags
|
629
|
586 //v20 = uHouseID;
|
|
587 //if ( !((unsigned __int8)(0x80u >> v19 % 8) & pPlayers[uActiveCharacter]->_guilds_member_bits[v19 /8]) )
|
735
|
588 if(_449B57_test_bit(pPlayers[uActiveCharacter]->_guilds_member_bits,v19))
|
|
589 {
|
|
590 PlayHouseSound(uHouseID, HouseSound_Greeting_2);
|
629
|
591 return 1;
|
735
|
592 }
|
|
593 }
|
|
594 PlayHouseSound(uHouseID, HouseSound_Greeting);
|
629
|
595 dword_5C35D4 = 1;
|
|
596 return 1;
|
|
597 }
|
|
598 }
|
|
599
|
|
600 //----- (004B1E92) --------------------------------------------------------
|
735
|
601 void PlayHouseSound(unsigned int uHouseID, HouseSoundID sound)
|
|
602 {
|
629
|
603 //if ( BYTE1(pAnimatedRooms[p2DEvents_minus1___02[26 * uHouseID]].field_C) )
|
|
604 if ( pAnimatedRooms[p2DEvents[uHouseID - 1].uAnimationID].uRoomSoundId )
|
|
605 pAudioPlayer->PlaySound(
|
|
606 //(SoundID)(a2 + 100 * (BYTE1(pAnimatedRooms[p2DEvents_minus1___02[26 * uHouseID]].field_C) + 300)),
|
735
|
607 (SoundID)(sound + 100 * (pAnimatedRooms[p2DEvents[uHouseID - 1].uAnimationID].uRoomSoundId + 300)),
|
629
|
608 806, 0, -1, 0, 0, 0, 0);
|
735
|
609 }
|
629
|
610
|
762
|
611 //----- (004B4F4F) --------------------------------------------------------
|
|
612 void JailDialog()
|
629
|
613 {
|
|
614 const char *v0; // esi@1
|
|
615 const char *v1; // ST10_4@1
|
|
616 unsigned __int16 v2; // ST0C_2@1
|
|
617 int v3; // eax@1
|
|
618 GUIWindow v5; // [sp+8h] [bp-54h]@1
|
|
619
|
|
620 memcpy(&v5, window_SpeakInHouse, sizeof(v5));
|
|
621 v0 = pGlobalTXT_LocalizationStrings[672];
|
|
622 v1 = pGlobalTXT_LocalizationStrings[672];
|
|
623 v5.uFrameX = 483;
|
|
624 v5.uFrameWidth = 148;
|
|
625 v5.uFrameZ = 334;
|
949
|
626 v2 = TargetColor(0xFFu, 0xFFu, 0x9Bu);
|
629
|
627 v3 = pFontArrus->CalcTextHeight(v0, &v5, 0, 0);
|
762
|
628 v5.DrawTitleText(pFontArrus, 0, (310 - v3) / 2 + 18, v2, v1, 3u);
|
629
|
629 }
|
|
630
|
|
631
|
|
632
|
775
|
633
|
|
634 //----- (004BCACC) --------------------------------------------------------
|
|
635 void __fastcall OnSelectShopDialogueOption(signed int uMessageParam)
|
|
636 {
|
|
637 //unsigned int v1; // edi@1
|
|
638 //signed int v2; // ebx@1
|
|
639 //signed int v3; // ecx@2
|
|
640 int v4; // eax@5
|
|
641 signed int v5; // esi@5
|
|
642 //Player *v6; // ecx@5
|
|
643 //signed int v7; // edx@5
|
|
644 GUIWindow *v8; // esi@10
|
|
645 unsigned int v9; // eax@12
|
|
646 int v10; // esi@31
|
|
647 int v11; // edi@31
|
|
648 int v12; // esi@32
|
|
649 __int16 v13; // bp@32
|
|
650 int v14; // edx@32
|
|
651 GUIWindow *v15; // eax@32
|
|
652 int v16; // eax@32
|
|
653 int v17; // eax@33
|
|
654 int v18; // eax@34
|
|
655 int v19; // eax@35
|
|
656 __int16 v20; // ax@37
|
|
657 __int16 v21; // ax@76
|
|
658 __int16 v22; // ax@107
|
|
659 __int16 v23; // ax@132
|
|
660 __int16 v24; // ax@163
|
|
661 int v25; // esi@190
|
|
662 __int16 v26; // ax@190
|
|
663 char v27; // zf@190
|
|
664 Player *v28; // edi@192
|
|
665 int v29; // eax@204
|
|
666 void *v30; // esi@208
|
|
667 unsigned __int64 v31; // qax@208
|
|
668 signed int v32; // edi@209
|
|
669 int v33; // eax@210
|
|
670 unsigned int v34; // eax@211
|
893
|
671 //Player *v35; // edi@227
|
775
|
672 signed int v36; // esi@227
|
|
673 int v37; // ecx@227
|
|
674 int v38; // esi@230
|
|
675 int v39; // edx@235
|
|
676 int v40; // edi@243
|
|
677 unsigned __int64 v41; // qax@243
|
900
|
678 //void *v42; // eax@244
|
775
|
679 signed int v43; // edi@244
|
|
680 int v44; // edx@244
|
|
681 int v45; // eax@246
|
|
682 unsigned int v46; // eax@247
|
|
683 void *v47; // eax@250
|
|
684 signed int v48; // edi@250
|
|
685 int v49; // eax@252
|
|
686 int v50; // eax@256
|
|
687 unsigned int v51; // eax@257
|
|
688 void *v52; // eax@260
|
|
689 signed int v53; // edi@260
|
|
690 int v54; // eax@262
|
|
691 //signed int v55; // [sp+10h] [bp-10h]@1
|
|
692 int v56; // [sp+14h] [bp-Ch]@31
|
|
693
|
|
694 //v1 = 0;
|
|
695 //v2 = a1;
|
|
696 //v55 = a1;
|
|
697 if ( !pDialogueWindow->pNumPresenceButton )
|
|
698 return;
|
|
699 pRenderer->ClearZBuffer(0, 479);
|
|
700 //v3 = dword_F8B198;
|
|
701 if ( dialog_menu_id != HOUSE_DIALOGUE_MAIN)
|
900
|
702 v8 = window_SpeakInHouse;
|
775
|
703 //else
|
|
704 if (dialog_menu_id == HOUSE_DIALOGUE_MAIN)
|
|
705 {
|
|
706 if ( in_current_building_type == BildingType_Training )
|
|
707 {
|
777
|
708 if ( uMessageParam == HOUSE_DIALOGUE_TRAININGHALL_TRAIN )
|
775
|
709 {
|
|
710 v4 = 0;
|
|
711 v5 = 0;
|
|
712 //v6 = pPlayers[uActiveCharacter];
|
|
713 //v7 = pPlayers[uActiveCharacter]->uLevel;
|
|
714 if ( pPlayers[uActiveCharacter]->uLevel > 0 )
|
|
715 {
|
|
716 do
|
|
717 v4 += v5++ + 1;
|
|
718 while ( v5 < pPlayers[uActiveCharacter]->uLevel );
|
|
719 }
|
|
720 if (pPlayers[uActiveCharacter]->uLevel < pMaxLevelPerTrainingHallType[(unsigned int)window_SpeakInHouse->ptr_1C - 89] &&
|
|
721 (signed __int64)pPlayers[uActiveCharacter]->uExperience < 1000 * v4)
|
|
722 return;
|
|
723 }
|
|
724 pDialogueWindow->Release();
|
|
725 pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x159u, WINDOW_MainMenu, 0, 0);
|
832
|
726 pBtn_ExitCancel = pDialogueWindow->CreateButton(526, 445, 75, 33, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[74],// "End Conversation"
|
775
|
727 pIcons_LOD->GetTexture(uTextureID_BUTTDESC2), 0);
|
900
|
728 pDialogueWindow->CreateButton(8, 8, 0x1C2, 0x140, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", nullptr);
|
775
|
729 // LABEL_10:
|
|
730 //v3 = dword_F8B198;
|
|
731 v8 = window_SpeakInHouse;
|
|
732 }
|
|
733 //else
|
|
734 if ( in_current_building_type != BildingType_Training )
|
|
735 {
|
|
736 v8 = window_SpeakInHouse;
|
|
737 if ((in_current_building_type == BildingType_Stables || in_current_building_type == BildingType_Boats) &&
|
777
|
738 transport_schedule[transport_routes[(unsigned int)window_SpeakInHouse->ptr_1C - HOUSE_STABLES_HARMONDALE][uMessageParam - HOUSE_DIALOGUE_TRANSPORT_SCHEDULE_1]].pSchedule[pParty->uDaysPlayed % 7]
|
775
|
739 || in_current_building_type != BildingType_Temple || uMessageParam != BildingType_MindGuild )
|
|
740 {
|
|
741 //LABEL_9:
|
|
742 pDialogueWindow->Release();
|
|
743 pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x159u, WINDOW_MainMenu, 0, 0);
|
832
|
744 pBtn_ExitCancel = pDialogueWindow->CreateButton(526, 445, 75, 33, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[74],// "End Conversation"
|
775
|
745 pIcons_LOD->GetTexture(uTextureID_BUTTDESC2), 0);
|
832
|
746 pDialogueWindow->CreateButton(8u, 8u, 0x1C2u, 0x140u, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", nullptr);
|
775
|
747 // LABEL_10:
|
|
748 //v3 = dword_F8B198;
|
|
749 v8 = window_SpeakInHouse;
|
|
750 }
|
|
751 else if (uActiveCharacter)
|
|
752 {
|
|
753 if ( !pPlayers[uActiveCharacter]->_4B6FF9() )
|
|
754 return;
|
|
755 v8 = window_SpeakInHouse;
|
|
756 }
|
|
757 }
|
|
758 //LABEL_11:
|
|
759 dialog_menu_id = (HOUSE_DIALOGUE_MENU)uMessageParam;
|
|
760 if ( in_current_building_type < BildingType_19 )
|
|
761 {
|
|
762 v9 = pIcons_LOD->LoadTexture(off_4F03B8[in_current_building_type], TEXTURE_16BIT_PALETTE);
|
|
763 //v3 = dword_F8B198;
|
|
764 ShopTexture = &pIcons_LOD->pTextures[v9];
|
|
765 //LABEL_13:
|
|
766 v8 = window_SpeakInHouse;
|
|
767 }
|
|
768 }
|
|
769
|
|
770 //NEW
|
|
771 switch(in_current_building_type)
|
|
772 {
|
900
|
773 case BildingType_FireGuild:
|
|
774 case BildingType_AirGuild:
|
|
775 case BildingType_WaterGuild:
|
|
776 case BildingType_EarthGuild:
|
|
777 case BildingType_SpiritGuild:
|
|
778 case BildingType_MindGuild:
|
|
779 case BildingType_BodyGuild:
|
|
780 case BildingType_LightGuild:
|
|
781 case BildingType_DarkGuild:
|
|
782 case BildingType_14:
|
|
783 case BildingType_15:
|
|
784 case BildingType_16:
|
|
785 {
|
|
786 if ( *(int *)&stru_AA1058[3].pSounds[8 * (unsigned int)v8->ptr_1C + 44472] >= (signed __int64)pParty->uTimePlayed &&
|
|
787 *(int *)&stru_AA1058[3].pSounds[8 * (unsigned int)v8->ptr_1C + 44468] >= (signed __int64)pParty->uTimePlayed )
|
|
788 {
|
|
789 v32 = 0;
|
|
790 do
|
775
|
791 {
|
900
|
792 //v33 = *(&pParty->pPlayers[1].pInstalledBeacons[0].field_18 + 9 * (v32 + 12 * (unsigned int)v8->ptr_1C));
|
|
793 v33 = pParty->SpellBooksInGuilds[v8->par1C-139][v32].uItemID;
|
|
794 if ( v33 )
|
|
795 {
|
|
796 v34 = pIcons_LOD->LoadTexture(pItemsTable->pItems[v33].pIconName, TEXTURE_16BIT_PALETTE);
|
|
797 v8 = window_SpeakInHouse;
|
|
798 ItemsInShopTexture[v32] = &pIcons_LOD->pTextures[v34];
|
|
799 }
|
|
800 ++v32;
|
|
801 }
|
|
802 while ( v32 < 12 );
|
|
803 }
|
|
804 else
|
|
805 {
|
|
806 SpellBookGenerator();
|
|
807 v30 = window_SpeakInHouse->ptr_1C;
|
|
808 v31 = pParty->uTimePlayed + (signed __int64)((double)(0xA8C000
|
|
809 //* (signed int)p2DEvents_minus1[26 * (unsigned int)ptr_507BC0->ptr_1C])
|
|
810 * (signed int)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].field_1C) * 0.033333335);
|
|
811 *(int *)&stru_AA1058[3].pSounds[8 * (int)v30 + 44468] = v31;
|
|
812 *(int *)&stru_AA1058[3].pSounds[8 * (int)v30 + 44472] = HIDWORD(v31);
|
|
813 }
|
|
814 //return;
|
|
815 break;
|
|
816 }
|
|
817 case BildingType_TownHall:
|
|
818 {
|
|
819 if ( uMessageParam == 99 )
|
|
820 {
|
|
821 v10 = (int)((char *)v8->ptr_1C - 102);
|
|
822 v56 = v10;
|
|
823 v11 = 8 * v10 + 11325428;
|
|
824 if ( pParty->field_3C.field_0[2 * v10 + 1] >= (signed __int64)pParty->uTimePlayed
|
|
825 && pParty->field_3C.field_0[2 * v10] >= (signed __int64)pParty->uTimePlayed )
|
|
826 {
|
|
827 v13 = 0;
|
775
|
828 }
|
|
829 else
|
|
830 {
|
900
|
831 v12 = v10;
|
|
832 v13 = 0;
|
|
833 pParty->field_75A[v12] = 0;
|
|
834 *(_QWORD *)v11 = (signed __int64)((double)(309657600 * (pParty->uCurrentMonth + 12i64 * pParty->uCurrentYear - 14015)) * 0.033333335);
|
|
835 v14 = rand() % 258;
|
|
836 v15 = window_SpeakInHouse;
|
|
837 pParty->field_750[v12] = v14 + 1;
|
|
838 v16 = (int)((char *)v15->ptr_1C - 102);
|
|
839 if ( v16 )
|
|
840 {
|
|
841 v17 = v16 - 1;
|
|
842 if ( v17 )
|
|
843 {
|
|
844 v18 = v17 - 1;
|
|
845 if ( v18 )
|
775
|
846 {
|
900
|
847 v19 = v18 - 1;
|
|
848 if ( v19 )
|
775
|
849 {
|
900
|
850 if ( v19 == 1 )
|
775
|
851 {
|
|
852 while ( 1 )
|
|
853 {
|
900
|
854 v20 = pParty->field_750[v12];
|
|
855 if ( (unsigned __int16)v20 < 0x73u || (unsigned __int16)v20 > 0x84u )
|
775
|
856 {
|
900
|
857 if ( ((unsigned __int16)v20 < 0xE8u || (unsigned __int16)v20 > 0xF9u)
|
|
858 && ((unsigned __int16)v20 < 0x85u || (unsigned __int16)v20 > 0x96u)
|
|
859 && ((unsigned __int16)v20 < 0x97u || (unsigned __int16)v20 > 0xBAu)
|
|
860 && ((unsigned __int16)v20 < 0xBEu || (unsigned __int16)v20 > 0xC0u)
|
|
861 && ((unsigned __int16)v20 < 0xC4u || (unsigned __int16)v20 > 0xC6u)
|
|
862 && ((unsigned __int16)v20 < 0x2Bu || (unsigned __int16)v20 > 0x2Du)
|
|
863 && ((unsigned __int16)v20 < 0x6Du || (unsigned __int16)v20 > 0x6Fu)
|
|
864 && ((unsigned __int16)v20 < 0x46u || (unsigned __int16)v20 > 0x48u)
|
|
865 && ((unsigned __int16)v20 < 0x100u || (unsigned __int16)v20 > 0x102u)
|
|
866 && ((unsigned __int16)v20 < 0xD9u || (unsigned __int16)v20 > 0xDBu)
|
|
867 && ((unsigned __int16)v20 < 0xC7u || (unsigned __int16)v20 > 0xC9u)
|
|
868 && ((unsigned __int16)v20 < 0xE5u || (unsigned __int16)v20 > 0xE7u)
|
|
869 && ((unsigned __int16)v20 < 0xDFu || (unsigned __int16)v20 > 0xE1u)
|
|
870 && ((unsigned __int16)v20 < 0x5Bu || (unsigned __int16)v20 > 0x5Du)
|
|
871 && ((unsigned __int16)v20 < 0x49u || (unsigned __int16)v20 > 0x4Bu)
|
|
872 && ((unsigned __int16)v20 < 0xFDu || (unsigned __int16)v20 > 0xFFu)
|
|
873 && ((unsigned __int16)v20 < 0x61u || (unsigned __int16)v20 > 0x63u)
|
|
874 && ((unsigned __int16)v20 < 0x10u || (unsigned __int16)v20 > 0x12u) )
|
775
|
875 break;
|
|
876 }
|
|
877 pParty->field_750[v12] = rand() % 258 + 1;
|
|
878 }
|
|
879 }
|
|
880 }
|
|
881 else
|
|
882 {
|
|
883 while ( 1 )
|
|
884 {
|
900
|
885 v21 = pParty->field_750[v12];
|
|
886 if ( (unsigned __int16)v21 < 0x73u || (unsigned __int16)v21 > 0x84u )
|
775
|
887 {
|
900
|
888 if ( ((unsigned __int16)v21 < 0xE8u || (unsigned __int16)v21 > 0xF9u)
|
|
889 && ((unsigned __int16)v21 < 0x85u || (unsigned __int16)v21 > 0x96u)
|
|
890 && ((unsigned __int16)v21 < 0x97u || (unsigned __int16)v21 > 0xBAu)
|
|
891 && ((unsigned __int16)v21 < 0xBEu || (unsigned __int16)v21 > 0xC0u)
|
|
892 && ((unsigned __int16)v21 < 0xC4u || (unsigned __int16)v21 > 0xC6u)
|
|
893 && ((unsigned __int16)v21 < 0x2Bu || (unsigned __int16)v21 > 0x2Du)
|
|
894 && ((unsigned __int16)v21 < 0x5Eu || (unsigned __int16)v21 > 0x60u)
|
|
895 && ((unsigned __int16)v21 < 0x43u || (unsigned __int16)v21 > 0x45u)
|
|
896 && ((unsigned __int16)v21 < 0x4Fu || (unsigned __int16)v21 > 0x51u)
|
|
897 && ((unsigned __int16)v21 < 0xC1u || (unsigned __int16)v21 > 0xC3u)
|
|
898 && ((unsigned __int16)v21 < 0x13u || (unsigned __int16)v21 > 0x15u)
|
|
899 && ((unsigned __int16)v21 < 0xFDu || (unsigned __int16)v21 > 0xFFu)
|
|
900 && ((unsigned __int16)v21 < 0x61u || (unsigned __int16)v21 > 0x63u)
|
|
901 && ((unsigned __int16)v21 < 0x6Au || (unsigned __int16)v21 > 0x6Cu) )
|
|
902 break;
|
775
|
903 }
|
|
904 pParty->field_750[v12] = rand() % 258 + 1;
|
|
905 }
|
|
906 }
|
|
907 }
|
|
908 else
|
|
909 {
|
|
910 while ( 1 )
|
|
911 {
|
900
|
912 v22 = pParty->field_750[v12];
|
|
913 if ( (unsigned __int16)v22 < 0x73u || (unsigned __int16)v22 > 0x84u )
|
775
|
914 {
|
900
|
915 if ( ((unsigned __int16)v22 < 0xE8u || (unsigned __int16)v22 > 0xF9u)
|
|
916 && ((unsigned __int16)v22 < 0x85u || (unsigned __int16)v22 > 0x96u)
|
|
917 && ((unsigned __int16)v22 < 0x97u || (unsigned __int16)v22 > 0xBAu)
|
|
918 && ((unsigned __int16)v22 < 0xBEu || (unsigned __int16)v22 > 0xC0u)
|
|
919 && ((unsigned __int16)v22 < 0xC4u || (unsigned __int16)v22 > 0xC6u)
|
|
920 && ((unsigned __int16)v22 < 0x2Bu || (unsigned __int16)v22 > 0x2Du)
|
|
921 && ((unsigned __int16)v22 < 0x31u || (unsigned __int16)v22 > 0x33u)
|
|
922 && ((unsigned __int16)v22 < 0x34u || (unsigned __int16)v22 > 0x36u)
|
|
923 && ((unsigned __int16)v22 < 0xFDu || (unsigned __int16)v22 > 0xFFu)
|
|
924 && ((unsigned __int16)v22 < 0x61u || (unsigned __int16)v22 > 0x63u)
|
|
925 && ((unsigned __int16)v22 < 0x1Cu || (unsigned __int16)v22 > 0x1Eu) )
|
|
926 break;
|
775
|
927 }
|
|
928 pParty->field_750[v12] = rand() % 258 + 1;
|
|
929 }
|
|
930 }
|
|
931 }
|
|
932 else
|
|
933 {
|
|
934 while ( 1 )
|
|
935 {
|
900
|
936 v23 = pParty->field_750[v12];
|
|
937 if ( (unsigned __int16)v23 < 0x73u || (unsigned __int16)v23 > 0x84u )
|
775
|
938 {
|
900
|
939 if ( ((unsigned __int16)v23 < 0xE8u || (unsigned __int16)v23 > 0xF9u)
|
|
940 && ((unsigned __int16)v23 < 0x85u || (unsigned __int16)v23 > 0x96u)
|
|
941 && ((unsigned __int16)v23 < 0x97u || (unsigned __int16)v23 > 0xBAu)
|
|
942 && ((unsigned __int16)v23 < 0xBEu || (unsigned __int16)v23 > 0xC0u)
|
|
943 && ((unsigned __int16)v23 < 0xC4u || (unsigned __int16)v23 > 0xC6u)
|
|
944 && ((unsigned __int16)v23 < 0x2Bu || (unsigned __int16)v23 > 0x2Du)
|
|
945 && ((unsigned __int16)v23 < 0x52u || (unsigned __int16)v23 > 0x54u)
|
|
946 && ((unsigned __int16)v23 < 4u || (unsigned __int16)v23 > 6u)
|
|
947 && ((unsigned __int16)v23 < 0x37u || (unsigned __int16)v23 > 0x39u)
|
|
948 && ((unsigned __int16)v23 < 0x3Au || (unsigned __int16)v23 > 0x3Cu)
|
|
949 && ((unsigned __int16)v23 < 0x3Du || (unsigned __int16)v23 > 0x3Fu)
|
|
950 && ((unsigned __int16)v23 < 0xFDu || (unsigned __int16)v23 > 0xFFu)
|
|
951 && ((unsigned __int16)v23 < 0x61u || (unsigned __int16)v23 > 0x63u)
|
|
952 && ((unsigned __int16)v23 < 0xCDu || (unsigned __int16)v23 > 0xCFu) )
|
775
|
953 break;
|
|
954 }
|
|
955 pParty->field_750[v12] = rand() % 258 + 1;
|
|
956 }
|
|
957 }
|
|
958 }
|
|
959 else
|
|
960 {
|
900
|
961 while ( 1 )
|
775
|
962 {
|
900
|
963 v24 = pParty->field_750[v12];
|
|
964 if ( (unsigned __int16)v24 < 0x73u || (unsigned __int16)v24 > 0x84u )
|
775
|
965 {
|
900
|
966 if ( ((unsigned __int16)v24 < 0xEBu || (unsigned __int16)v24 > 0xFCu)
|
|
967 && ((unsigned __int16)v24 < 0x85u || (unsigned __int16)v24 > 0x96u)
|
|
968 && ((unsigned __int16)v24 < 0x97u || (unsigned __int16)v24 > 0xBAu)
|
|
969 && ((unsigned __int16)v24 < 0xBEu || (unsigned __int16)v24 > 0xC0u)
|
|
970 && ((unsigned __int16)v24 < 0xC4u || (unsigned __int16)v24 > 0xC6u)
|
|
971 && ((unsigned __int16)v24 < 0x2Bu || (unsigned __int16)v24 > 0x2Du)
|
|
972 && ((unsigned __int16)v24 < 0xCDu || (unsigned __int16)v24 > 0xCFu)
|
|
973 && ((unsigned __int16)v24 < 0x5Eu || (unsigned __int16)v24 > 0x60u)
|
|
974 && ((unsigned __int16)v24 < 0xFDu || (unsigned __int16)v24 > 0xFFu)
|
|
975 && ((unsigned __int16)v24 < 0x6Du || (unsigned __int16)v24 > 0x6Fu)
|
|
976 && ((unsigned __int16)v24 < 0x61u || (unsigned __int16)v24 > 0x63u) )
|
|
977 break;
|
775
|
978 }
|
900
|
979 pParty->field_750[v12] = rand() % 258 + 1;
|
775
|
980 }
|
|
981 }
|
900
|
982 v10 = v56;
|
775
|
983 }
|
900
|
984 v25 = v10;
|
|
985 v26 = pParty->field_750[v25];
|
|
986 v27 = pParty->field_75A[v25] == v13;
|
|
987 word_F8B1A0 = pParty->field_750[v25];
|
|
988 if ( v27 )
|
775
|
989 {
|
900
|
990 //v1 = 0;
|
|
991 v27 = v26 == v13;
|
|
992 v29 = (int)pNPCTopics[351].pText;
|
|
993 if ( v27 )
|
|
994 v29 = (int)pNPCTopics[353].pText;
|
|
995 dword_F8B1A4 = (char *)v29;
|
775
|
996 }
|
900
|
997 else
|
775
|
998 {
|
900
|
999 if ( v26 != v13 )
|
|
1000 {
|
|
1001 party_finds_gold(100 * pMonsterStats->pInfos[(unsigned __int16)v26].uLevel, 0);
|
|
1002 v28 = pParty->pPlayers;
|
|
1003 do
|
|
1004 {
|
|
1005 v28->SetVariable(VAR_Award, 86);
|
|
1006 ++v28;
|
|
1007 }
|
|
1008 while ( (signed int)v28 < (signed int)pParty->pHirelings );
|
|
1009 pParty->uNumBountiesCollected += 100 * pMonsterStats->pInfos[pParty->field_750[v25]].uLevel;
|
|
1010 pParty->field_750[v25] = v13;
|
|
1011 pParty->field_75A[v25] = v13;
|
|
1012 }
|
|
1013 //v1 = 0;
|
|
1014 dword_F8B1A4 = pNPCTopics[352].pText;
|
775
|
1015 }
|
900
|
1016 }
|
|
1017 else if ( uMessageParam == HOUSE_DIALOGUE_TOWNHALL_100 )
|
|
1018 {
|
|
1019 pKeyActionMap->EnterText(1, 10, v8);
|
|
1020 }
|
|
1021 break;
|
|
1022 }
|
|
1023 case BildingType_Bank:
|
|
1024 {
|
|
1025 if ( dialog_menu_id >= 7 && dialog_menu_id <= 8 )
|
|
1026 pKeyActionMap->EnterText(1, 10, v8);
|
|
1027 return;
|
|
1028 break;
|
|
1029 }
|
|
1030 case BildingType_WeaponShop:
|
|
1031 case BildingType_ArmorShop:
|
|
1032 case BildingType_MagicShop:
|
|
1033 case BildingType_AlchemistShop:
|
|
1034 case BildingType_Tavern:
|
|
1035 case BildingType_Temple:
|
|
1036 case BildingType_Training:
|
|
1037 {
|
|
1038 break;
|
|
1039 }
|
|
1040 default:
|
|
1041 {
|
|
1042 return;
|
|
1043 break;
|
|
1044 }
|
775
|
1045 }
|
|
1046
|
|
1047 /*
|
|
1048 if ( in_current_building_type > BildingType_Tavern )
|
|
1049 {
|
|
1050 if ( in_current_building_type == BildingType_Bank )
|
|
1051 {
|
|
1052 if ( dialog_menu_id >= 7 && dialog_menu_id <= 8 )
|
|
1053 pKeyActionMap->EnterText(1, 10, v8);
|
|
1054 return;
|
|
1055 }
|
|
1056 if ( in_current_building_type != BildingType_Temple && in_current_building_type != BildingType_Training )
|
|
1057 return;
|
|
1058 }
|
|
1059 //else
|
|
1060 if ( in_current_building_type < BildingType_Tavern )
|
|
1061 {
|
|
1062 if (in_current_building_type <= 0)
|
|
1063 return;
|
|
1064 if ( in_current_building_type > BildingType_AlchemistShop )
|
|
1065 {
|
|
1066 if ( in_current_building_type <= BildingType_16 )
|
|
1067 {
|
|
1068 if ( (signed __int64)__PAIR__(
|
|
1069 *(int *)&stru_AA1058[3].pSounds[8 * (unsigned int)v8->ptr_1C + 44472],
|
|
1070 *(int *)&stru_AA1058[3].pSounds[8 * (unsigned int)v8->ptr_1C + 44468]) >= (signed __int64)pParty->uTimePlayed )
|
|
1071 {
|
|
1072 v32 = 0;
|
|
1073 do
|
|
1074 {
|
|
1075 //v33 = *(&pParty->pPlayers[1].pInstalledBeacons[0].field_18 + 9 * (v32 + 12 * (unsigned int)v8->ptr_1C));
|
|
1076 v33 = pParty->SpellBooksInGuilds[v8->par1C-139][v32].uItemID;
|
|
1077 if ( v33 )
|
|
1078 {
|
|
1079 v34 = pIcons_LOD->LoadTexture(pItemsTable->pItems[v33].pIconName, TEXTURE_16BIT_PALETTE);
|
|
1080 v8 = window_SpeakInHouse;
|
|
1081 ItemsInShopTexture[v32] = &pIcons_LOD->pTextures[v34];
|
|
1082 }
|
|
1083 ++v32;
|
|
1084 }
|
|
1085 while ( v32 < 12 );
|
|
1086 }
|
|
1087 else
|
|
1088 {
|
|
1089 SpellBookGenerator();
|
|
1090 v30 = window_SpeakInHouse->ptr_1C;
|
|
1091 v31 = pParty->uTimePlayed
|
|
1092 + (signed __int64)((double)(0xA8C000
|
|
1093 //* (signed int)p2DEvents_minus1[26 * (unsigned int)ptr_507BC0->ptr_1C])
|
|
1094 * (signed int)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].field_1C)
|
|
1095 * 0.033333335);
|
|
1096 *(int *)&stru_AA1058[3].pSounds[8 * (int)v30 + 44468] = v31;
|
|
1097 *(int *)&stru_AA1058[3].pSounds[8 * (int)v30 + 44472] = HIDWORD(v31);
|
|
1098 }
|
|
1099 return;
|
|
1100 }
|
|
1101 if ( in_current_building_type != BildingType_TownHall )
|
|
1102 return;
|
|
1103 if ( in_current_building_type == BildingType_TownHall )
|
|
1104 {
|
|
1105 if ( uMessageParam == 99 )
|
|
1106 {
|
|
1107 v10 = (int)((char *)v8->ptr_1C - 102);
|
|
1108 v56 = v10;
|
|
1109 v11 = 8 * v10 + 11325428;
|
|
1110 if ( (signed __int64)__PAIR__(pParty->field_3C.field_0[2 * v10 + 1], pParty->field_3C.field_0[2 * v10]) >= (signed __int64)pParty->uTimePlayed )
|
|
1111 {
|
|
1112 v13 = 0;
|
|
1113 }
|
|
1114 else
|
|
1115 {
|
|
1116 v12 = v10;
|
|
1117 v13 = 0;
|
|
1118 pParty->field_75A[v12] = 0;
|
|
1119 *(_QWORD *)v11 = (signed __int64)((double)(309657600 * (pParty->uCurrentMonth + 12i64 * pParty->uCurrentYear - 14015)) * 0.033333335);
|
|
1120 v14 = rand() % 258;
|
|
1121 v15 = window_SpeakInHouse;
|
|
1122 pParty->field_750[v12] = v14 + 1;
|
|
1123 v16 = (int)((char *)v15->ptr_1C - 102);
|
|
1124 if ( v16 )
|
|
1125 {
|
|
1126 v17 = v16 - 1;
|
|
1127 if ( v17 )
|
|
1128 {
|
|
1129 v18 = v17 - 1;
|
|
1130 if ( v18 )
|
|
1131 {
|
|
1132 v19 = v18 - 1;
|
|
1133 if ( v19 )
|
|
1134 {
|
|
1135 if ( v19 == 1 )
|
|
1136 {
|
|
1137 while ( 1 )
|
|
1138 {
|
|
1139 v20 = pParty->field_750[v12];
|
|
1140 if ( (unsigned __int16)v20 < 0x73u || (unsigned __int16)v20 > 0x84u )
|
|
1141 {
|
|
1142 if ( ((unsigned __int16)v20 < 0xE8u || (unsigned __int16)v20 > 0xF9u)
|
|
1143 && ((unsigned __int16)v20 < 0x85u || (unsigned __int16)v20 > 0x96u)
|
|
1144 && ((unsigned __int16)v20 < 0x97u || (unsigned __int16)v20 > 0xBAu)
|
|
1145 && ((unsigned __int16)v20 < 0xBEu || (unsigned __int16)v20 > 0xC0u)
|
|
1146 && ((unsigned __int16)v20 < 0xC4u || (unsigned __int16)v20 > 0xC6u)
|
|
1147 && ((unsigned __int16)v20 < 0x2Bu || (unsigned __int16)v20 > 0x2Du)
|
|
1148 && ((unsigned __int16)v20 < 0x6Du || (unsigned __int16)v20 > 0x6Fu)
|
|
1149 && ((unsigned __int16)v20 < 0x46u || (unsigned __int16)v20 > 0x48u)
|
|
1150 && ((unsigned __int16)v20 < 0x100u || (unsigned __int16)v20 > 0x102u)
|
|
1151 && ((unsigned __int16)v20 < 0xD9u || (unsigned __int16)v20 > 0xDBu)
|
|
1152 && ((unsigned __int16)v20 < 0xC7u || (unsigned __int16)v20 > 0xC9u)
|
|
1153 && ((unsigned __int16)v20 < 0xE5u || (unsigned __int16)v20 > 0xE7u)
|
|
1154 && ((unsigned __int16)v20 < 0xDFu || (unsigned __int16)v20 > 0xE1u)
|
|
1155 && ((unsigned __int16)v20 < 0x5Bu || (unsigned __int16)v20 > 0x5Du)
|
|
1156 && ((unsigned __int16)v20 < 0x49u || (unsigned __int16)v20 > 0x4Bu)
|
|
1157 && ((unsigned __int16)v20 < 0xFDu || (unsigned __int16)v20 > 0xFFu)
|
|
1158 && ((unsigned __int16)v20 < 0x61u || (unsigned __int16)v20 > 0x63u)
|
|
1159 && ((unsigned __int16)v20 < 0x10u || (unsigned __int16)v20 > 0x12u) )
|
|
1160 break;
|
|
1161 }
|
|
1162 pParty->field_750[v12] = rand() % 258 + 1;
|
|
1163 }
|
|
1164 }
|
|
1165 }
|
|
1166 else
|
|
1167 {
|
|
1168 while ( 1 )
|
|
1169 {
|
|
1170 v21 = pParty->field_750[v12];
|
|
1171 if ( (unsigned __int16)v21 < 0x73u || (unsigned __int16)v21 > 0x84u )
|
|
1172 {
|
|
1173 if ( ((unsigned __int16)v21 < 0xE8u || (unsigned __int16)v21 > 0xF9u)
|
|
1174 && ((unsigned __int16)v21 < 0x85u || (unsigned __int16)v21 > 0x96u)
|
|
1175 && ((unsigned __int16)v21 < 0x97u || (unsigned __int16)v21 > 0xBAu)
|
|
1176 && ((unsigned __int16)v21 < 0xBEu || (unsigned __int16)v21 > 0xC0u)
|
|
1177 && ((unsigned __int16)v21 < 0xC4u || (unsigned __int16)v21 > 0xC6u)
|
|
1178 && ((unsigned __int16)v21 < 0x2Bu || (unsigned __int16)v21 > 0x2Du)
|
|
1179 && ((unsigned __int16)v21 < 0x5Eu || (unsigned __int16)v21 > 0x60u)
|
|
1180 && ((unsigned __int16)v21 < 0x43u || (unsigned __int16)v21 > 0x45u)
|
|
1181 && ((unsigned __int16)v21 < 0x4Fu || (unsigned __int16)v21 > 0x51u)
|
|
1182 && ((unsigned __int16)v21 < 0xC1u || (unsigned __int16)v21 > 0xC3u)
|
|
1183 && ((unsigned __int16)v21 < 0x13u || (unsigned __int16)v21 > 0x15u)
|
|
1184 && ((unsigned __int16)v21 < 0xFDu || (unsigned __int16)v21 > 0xFFu)
|
|
1185 && ((unsigned __int16)v21 < 0x61u || (unsigned __int16)v21 > 0x63u)
|
|
1186 && ((unsigned __int16)v21 < 0x6Au || (unsigned __int16)v21 > 0x6Cu) )
|
|
1187 break;
|
|
1188 }
|
|
1189 pParty->field_750[v12] = rand() % 258 + 1;
|
|
1190 }
|
|
1191 }
|
|
1192 }
|
|
1193 else
|
|
1194 {
|
|
1195 while ( 1 )
|
|
1196 {
|
|
1197 v22 = pParty->field_750[v12];
|
|
1198 if ( (unsigned __int16)v22 < 0x73u || (unsigned __int16)v22 > 0x84u )
|
|
1199 {
|
|
1200 if ( ((unsigned __int16)v22 < 0xE8u || (unsigned __int16)v22 > 0xF9u)
|
|
1201 && ((unsigned __int16)v22 < 0x85u || (unsigned __int16)v22 > 0x96u)
|
|
1202 && ((unsigned __int16)v22 < 0x97u || (unsigned __int16)v22 > 0xBAu)
|
|
1203 && ((unsigned __int16)v22 < 0xBEu || (unsigned __int16)v22 > 0xC0u)
|
|
1204 && ((unsigned __int16)v22 < 0xC4u || (unsigned __int16)v22 > 0xC6u)
|
|
1205 && ((unsigned __int16)v22 < 0x2Bu || (unsigned __int16)v22 > 0x2Du)
|
|
1206 && ((unsigned __int16)v22 < 0x31u || (unsigned __int16)v22 > 0x33u)
|
|
1207 && ((unsigned __int16)v22 < 0x34u || (unsigned __int16)v22 > 0x36u)
|
|
1208 && ((unsigned __int16)v22 < 0xFDu || (unsigned __int16)v22 > 0xFFu)
|
|
1209 && ((unsigned __int16)v22 < 0x61u || (unsigned __int16)v22 > 0x63u)
|
|
1210 && ((unsigned __int16)v22 < 0x1Cu || (unsigned __int16)v22 > 0x1Eu) )
|
|
1211 break;
|
|
1212 }
|
|
1213 pParty->field_750[v12] = rand() % 258 + 1;
|
|
1214 }
|
|
1215 }
|
|
1216 }
|
|
1217 else
|
|
1218 {
|
|
1219 while ( 1 )
|
|
1220 {
|
|
1221 v23 = pParty->field_750[v12];
|
|
1222 if ( (unsigned __int16)v23 < 0x73u || (unsigned __int16)v23 > 0x84u )
|
|
1223 {
|
|
1224 if ( ((unsigned __int16)v23 < 0xE8u || (unsigned __int16)v23 > 0xF9u)
|
|
1225 && ((unsigned __int16)v23 < 0x85u || (unsigned __int16)v23 > 0x96u)
|
|
1226 && ((unsigned __int16)v23 < 0x97u || (unsigned __int16)v23 > 0xBAu)
|
|
1227 && ((unsigned __int16)v23 < 0xBEu || (unsigned __int16)v23 > 0xC0u)
|
|
1228 && ((unsigned __int16)v23 < 0xC4u || (unsigned __int16)v23 > 0xC6u)
|
|
1229 && ((unsigned __int16)v23 < 0x2Bu || (unsigned __int16)v23 > 0x2Du)
|
|
1230 && ((unsigned __int16)v23 < 0x52u || (unsigned __int16)v23 > 0x54u)
|
|
1231 && ((unsigned __int16)v23 < 4u || (unsigned __int16)v23 > 6u)
|
|
1232 && ((unsigned __int16)v23 < 0x37u || (unsigned __int16)v23 > 0x39u)
|
|
1233 && ((unsigned __int16)v23 < 0x3Au || (unsigned __int16)v23 > 0x3Cu)
|
|
1234 && ((unsigned __int16)v23 < 0x3Du || (unsigned __int16)v23 > 0x3Fu)
|
|
1235 && ((unsigned __int16)v23 < 0xFDu || (unsigned __int16)v23 > 0xFFu)
|
|
1236 && ((unsigned __int16)v23 < 0x61u || (unsigned __int16)v23 > 0x63u)
|
|
1237 && ((unsigned __int16)v23 < 0xCDu || (unsigned __int16)v23 > 0xCFu) )
|
|
1238 break;
|
|
1239 }
|
|
1240 pParty->field_750[v12] = rand() % 258 + 1;
|
|
1241 }
|
|
1242 }
|
|
1243 }
|
|
1244 else
|
|
1245 {
|
|
1246 while ( 1 )
|
|
1247 {
|
|
1248 v24 = pParty->field_750[v12];
|
|
1249 if ( (unsigned __int16)v24 < 0x73u || (unsigned __int16)v24 > 0x84u )
|
|
1250 {
|
|
1251 if ( ((unsigned __int16)v24 < 0xEBu || (unsigned __int16)v24 > 0xFCu)
|
|
1252 && ((unsigned __int16)v24 < 0x85u || (unsigned __int16)v24 > 0x96u)
|
|
1253 && ((unsigned __int16)v24 < 0x97u || (unsigned __int16)v24 > 0xBAu)
|
|
1254 && ((unsigned __int16)v24 < 0xBEu || (unsigned __int16)v24 > 0xC0u)
|
|
1255 && ((unsigned __int16)v24 < 0xC4u || (unsigned __int16)v24 > 0xC6u)
|
|
1256 && ((unsigned __int16)v24 < 0x2Bu || (unsigned __int16)v24 > 0x2Du)
|
|
1257 && ((unsigned __int16)v24 < 0xCDu || (unsigned __int16)v24 > 0xCFu)
|
|
1258 && ((unsigned __int16)v24 < 0x5Eu || (unsigned __int16)v24 > 0x60u)
|
|
1259 && ((unsigned __int16)v24 < 0xFDu || (unsigned __int16)v24 > 0xFFu)
|
|
1260 && ((unsigned __int16)v24 < 0x6Du || (unsigned __int16)v24 > 0x6Fu)
|
|
1261 && ((unsigned __int16)v24 < 0x61u || (unsigned __int16)v24 > 0x63u) )
|
|
1262 break;
|
|
1263 }
|
|
1264 pParty->field_750[v12] = rand() % 258 + 1;
|
|
1265 }
|
|
1266 }
|
|
1267 v10 = v56;
|
|
1268 }
|
|
1269 v25 = v10;
|
|
1270 v26 = pParty->field_750[v25];
|
|
1271 v27 = pParty->field_75A[v25] == v13;
|
|
1272 word_F8B1A0 = pParty->field_750[v25];
|
|
1273 if ( v27 )
|
|
1274 {
|
|
1275 //v1 = 0;
|
|
1276 v27 = v26 == v13;
|
|
1277 v29 = (int)pNPCTopics[351].pText;
|
|
1278 if ( v27 )
|
|
1279 v29 = (int)pNPCTopics[353].pText;
|
|
1280 dword_F8B1A4 = (char *)v29;
|
|
1281 }
|
|
1282 else
|
|
1283 {
|
|
1284 if ( v26 != v13 )
|
|
1285 {
|
|
1286 party_finds_gold(100 * pMonsterStats->pInfos[(unsigned __int16)v26].uLevel, 0);
|
|
1287 v28 = pParty->pPlayers;
|
|
1288 do
|
|
1289 {
|
|
1290 v28->SetVariable(VAR_Award, 86);
|
|
1291 ++v28;
|
|
1292 }
|
|
1293 while ( (signed int)v28 < (signed int)pParty->pHirelings );
|
|
1294 pParty->uNumBountiesCollected += 100 * pMonsterStats->pInfos[pParty->field_750[v25]].uLevel;
|
|
1295 pParty->field_750[v25] = v13;
|
|
1296 pParty->field_75A[v25] = v13;
|
|
1297 }
|
|
1298 //v1 = 0;
|
|
1299 dword_F8B1A4 = pNPCTopics[352].pText;
|
|
1300 }
|
|
1301 }
|
|
1302 else if ( uMessageParam == 100 )
|
|
1303 {
|
|
1304 pKeyActionMap->EnterText(1, 10, v8);
|
|
1305 }
|
|
1306 }
|
|
1307 }
|
|
1308 }
|
|
1309 */
|
|
1310
|
|
1311
|
|
1312 //LABEL_196:
|
|
1313 switch ( uMessageParam )
|
|
1314 {
|
900
|
1315 case HOUSE_DIALOGUE_LEARN_SKILLS:
|
|
1316 {
|
|
1317 pDialogueWindow->eWindowType = WINDOW_MainMenu;
|
|
1318 UI_CreateEndConversationButton();
|
|
1319 FillAviableSkillsToTeach(in_current_building_type);
|
|
1320 break;
|
|
1321 }
|
|
1322 case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_MAIN:
|
|
1323 {
|
|
1324 pDialogueWindow->eWindowType = WINDOW_MainMenu;
|
|
1325 UI_CreateEndConversationButton();
|
|
1326 sub_4B3A72(in_current_building_type);
|
|
1327 break;
|
|
1328 }
|
|
1329 case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_RULES:
|
|
1330 case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_VICTORY_CONDITIONS:
|
|
1331 {
|
|
1332 dialog_menu_id = (HOUSE_DIALOGUE_MENU)uMessageParam;
|
|
1333 break;
|
|
1334 }
|
|
1335 case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_RESULT:
|
|
1336 {
|
|
1337 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
|
|
1338 {
|
990
|
1339 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_PlayArcomage;
|
900
|
1340 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v1;
|
|
1341 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = v1;
|
|
1342 ++pMessageQueue_50CBD0->uNumMessages;
|
|
1343 }*/
|
|
1344 pMessageQueue_50CBD0->AddMessage(UIMSG_PlayArcomage, 0, 0);
|
|
1345 dialog_menu_id = HOUSE_DIALOGUE_TAVERN_ARCOMAGE_RESULT;
|
|
1346 break;
|
|
1347 }
|
|
1348 case HOUSE_DIALOGUE_SHOP_BUY_STANDARD:
|
|
1349 case HOUSE_DIALOGUE_SHOP_BUY_SPECIAL:
|
|
1350 {
|
|
1351 if ( pParty->field_3C.field_50[(unsigned int)v8->ptr_1C] < (signed __int64)pParty->uTimePlayed )
|
|
1352 {
|
|
1353 GenerateStandartShopItems();
|
|
1354 GenerateSpecialShopItems();
|
|
1355 pParty->field_3C.field_50[window_SpeakInHouse->par1C] = pParty->uTimePlayed + (signed __int64)((double)(11059200 * (signed int)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].field_1C) * 0.033333335);
|
|
1356 }
|
|
1357 if ( uMessageParam == HOUSE_DIALOGUE_SHOP_BUY_STANDARD )
|
|
1358 {
|
|
1359 if ( uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType] )
|
775
|
1360 {
|
900
|
1361 for ( v43 = 0; v43 < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType]; ++v43 )
|
|
1362 {
|
|
1363 if ( pParty->StandartItemsInShops[(int)window_SpeakInHouse->ptr_1C][v43].uItemID )
|
|
1364 {
|
|
1365 v46 = pIcons_LOD->LoadTexture(pItemsTable->pItems[pParty->StandartItemsInShops[(int)window_SpeakInHouse->ptr_1C][v43].uItemID].pIconName, TEXTURE_16BIT_PALETTE);
|
|
1366 ItemsInShopTexture[v43] = &pIcons_LOD->pTextures[v46];
|
|
1367 }
|
|
1368 }
|
|
1369 }
|
|
1370 if ( in_current_building_type == BildingType_WeaponShop )
|
|
1371 {
|
|
1372 v48 = 0;
|
|
1373 if ( uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType] )
|
|
1374 {
|
|
1375 do
|
|
1376 {
|
|
1377 if ( pParty->StandartItemsInShops[(int)window_SpeakInHouse->ptr_1C][v48].uItemID)
|
|
1378 word_F8B158[v48] = rand() % (300 - ItemsInShopTexture[v48]->uTextureHeight);
|
|
1379 ++v48;
|
|
1380 }
|
|
1381 while ( v48 < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType] );
|
|
1382 }
|
|
1383 }
|
|
1384 }
|
|
1385 if ( uMessageParam == HOUSE_DIALOGUE_SHOP_BUY_SPECIAL )
|
|
1386 {
|
|
1387 if ( uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType] )
|
|
1388 {
|
|
1389 for ( v43 = 0; v43 < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType]; ++v43 )
|
|
1390 {
|
|
1391 if ( pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][(signed int)v43].uItemID )
|
|
1392 {
|
|
1393 v51 = pIcons_LOD->LoadTexture(pItemsTable->pItems[pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][(signed int)v43].uItemID].pIconName, TEXTURE_16BIT_PALETTE);
|
|
1394 ItemsInShopTexture[v43] = &pIcons_LOD->pTextures[v51];
|
|
1395 }
|
|
1396 }
|
|
1397 }
|
|
1398 if ( in_current_building_type == BildingType_WeaponShop )
|
|
1399 {
|
|
1400 v53 = 0;
|
|
1401 if ( uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType] )
|
|
1402 {
|
|
1403 do
|
|
1404 {
|
|
1405 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v53].uItemID)
|
|
1406 word_F8B158[v53] = rand() % (300 - ItemsInShopTexture[v53]->uTextureHeight);
|
|
1407 ++v53;
|
|
1408 }
|
|
1409 while ( v53 < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType ] );
|
|
1410 }
|
|
1411 }
|
|
1412 }
|
775
|
1413 break;
|
900
|
1414 }
|
|
1415 case HOUSE_DIALOGUE_SHOP_SELL:
|
|
1416 case HOUSE_DIALOGUE_SHOP_IDENTIFY:
|
|
1417 case HOUSE_DIALOGUE_SHOP_REPAIR:
|
|
1418 {
|
|
1419 dialog_menu_id = (HOUSE_DIALOGUE_MENU)uMessageParam;
|
|
1420 sub_421B2C_PlaceInInventory_or_DropPickedItem();
|
|
1421 break;
|
|
1422 }
|
|
1423 case HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT:
|
|
1424 {
|
|
1425 pDialogueWindow->eWindowType = WINDOW_MainMenu;
|
|
1426 UI_CreateEndConversationButton();
|
|
1427 sub_4B3AD4(in_current_building_type);
|
|
1428 break;
|
|
1429 }
|
|
1430 default:
|
|
1431 {
|
|
1432 if( uMessageParam >= HOUSE_DIALOGUE_36 && uMessageParam <= HOUSE_DIALOGUE_GUILD_LEARN_SKILL )
|
|
1433 {
|
|
1434 //v35 = pPlayers[uActiveCharacter];
|
|
1435 //v36 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (unsigned int)v8->ptr_1C] * 500.0);
|
|
1436 v36 = (signed __int64)(p2DEvents[(unsigned int)v8->ptr_1C - 1].flt_24 * 500.0);
|
|
1437 v37 = v36 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100;
|
|
1438 if ( v37 < v36 / 3 )
|
|
1439 v37 = v36 / 3;
|
|
1440 //if (false)
|
|
1441 if(byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][uMessageParam-36])
|
|
1442 //if ( *(&byte_4ED94C[37 * v35->uClass] + v55) )
|
|
1443 {
|
|
1444 //v38 = (int)(&pPlayers[uActiveCharacter]->uIntelligence + uMessageParam);
|
|
1445 if ( !pPlayers[uActiveCharacter]->pActiveSkills[uMessageParam - 36] )
|
|
1446 {
|
|
1447 if ( pParty->uNumGold < v37 )
|
|
1448 {
|
|
1449 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);
|
|
1450 if ( in_current_building_type == BildingType_Training || in_current_building_type == BildingType_Tavern )
|
|
1451 v39 = 4;
|
|
1452 else
|
|
1453 v39 = 2;
|
|
1454 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)v39);
|
|
1455 }
|
|
1456 else
|
|
1457 {
|
|
1458 Party::TakeGold(v37);
|
|
1459 dword_F8B1E4 = 1;
|
|
1460 pPlayers[uActiveCharacter]->pActiveSkills[uMessageParam - 36] = 1;
|
|
1461 pPlayers[uActiveCharacter]->PlaySound(SPEECH_78, 0);
|
|
1462 }
|
|
1463 }
|
|
1464 }
|
|
1465 }
|
|
1466 break;
|
|
1467 }
|
775
|
1468 }
|
|
1469 /*
|
|
1470 if ( uMessageParam != 95 && uMessageParam != 2 )
|
|
1471 {
|
|
1472 if ( uMessageParam == 3 )
|
|
1473 {
|
|
1474 dialog_menu_id = 3;
|
|
1475 }
|
|
1476 else
|
|
1477 {
|
|
1478 if ( uMessageParam == 4 )
|
|
1479 {
|
|
1480 dialog_menu_id = 4;
|
|
1481 }
|
|
1482 else
|
|
1483 {
|
|
1484 if ( uMessageParam != 5 )
|
|
1485 {
|
|
1486 if ( uMessageParam > 35 )
|
|
1487 {
|
|
1488 if ( uMessageParam <= 72 )
|
|
1489 {
|
|
1490 v35 = pPlayers[uActiveCharacter];
|
|
1491 //v36 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (unsigned int)v8->ptr_1C] * 500.0);
|
|
1492 v36 = (signed __int64)(p2DEvents[(unsigned int)v8->ptr_1C - 1].flt_24 * 500.0);
|
|
1493 v37 = v36 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100;
|
|
1494 if ( v37 < v36 / 3 )
|
|
1495 v37 = v36 / 3;
|
|
1496
|
|
1497 __debugbreak();
|
|
1498 //pSkillAvailabilityPerClass[8 + v58->uClass][4 + v23]
|
|
1499 // or
|
|
1500 //byte_4ED970_skill_learn_ability_by_class_table[v58->uClass][v23 - 36]
|
|
1501 // or
|
|
1502 //byte_4ED970_skill_learn_ability_by_class_table[v58->uClass - 1][v23 + 1]
|
|
1503
|
|
1504 if (false)
|
|
1505 //if ( *(&byte_4ED94C[37 * v35->uClass] + v55) )
|
|
1506 {
|
|
1507 v38 = (int)(&v35->uIntelligence + uMessageParam);
|
|
1508 if ( !*(short *)v38 )
|
|
1509 {
|
|
1510 if ( pParty->uNumGold < v37 )
|
|
1511 {
|
|
1512 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u);
|
|
1513 if ( in_current_building_type == BildingType_Training || in_current_building_type == BildingType_Tavern )
|
|
1514 v39 = 4;
|
|
1515 else
|
|
1516 v39 = 2;
|
|
1517 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, v39);
|
|
1518 }
|
|
1519 else
|
|
1520 {
|
|
1521 Party::TakeGold(v37);
|
|
1522 dword_F8B1E4 = 1;
|
|
1523 *(short *)v38 = 1;
|
|
1524 v35->PlaySound(SPEECH_78, 0);
|
|
1525 }
|
|
1526 }
|
|
1527 }
|
|
1528 }
|
|
1529 else
|
|
1530 {
|
|
1531 if ( uMessageParam == 94 )
|
|
1532 {
|
|
1533 pDialogueWindow->eWindowType = WINDOW_MainMenu;
|
|
1534 UI_CreateEndConversationButton();
|
|
1535 sub_4B3AD4(in_current_building_type);
|
|
1536 }
|
|
1537 }
|
|
1538 }
|
|
1539 return;
|
|
1540 }
|
|
1541 dialog_menu_id = 5;
|
|
1542 }
|
|
1543 }
|
|
1544 sub_421B2C_PlaceInInventory_or_DropPickedItem();
|
|
1545 return;
|
|
1546 }
|
|
1547 if ( pParty->field_3C.field_50[(unsigned int)v8->ptr_1C] < (signed __int64)pParty->uTimePlayed )
|
|
1548 {
|
|
1549 GenerateStandartShopItems();
|
|
1550 GenerateSpecialShopItems();
|
|
1551 v8 = window_SpeakInHouse;
|
|
1552 v40 = window_SpeakInHouse->par1C;
|
|
1553 //v3 = dword_F8B198;
|
|
1554 v41 = pParty->uTimePlayed
|
|
1555 //+ (signed __int64)((double)(11059200 * (signed int)p2DEvents_minus1[26 * (unsigned int)ptr_507BC0->ptr_1C])
|
|
1556 + (signed __int64)((double)(11059200 * (signed int)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].field_1C)
|
|
1557 * 0.033333335);
|
|
1558 pParty->field_3C.field_50[v40] = v41;
|
|
1559
|
|
1560 }
|
|
1561 v42 = v8->ptr_1C;
|
|
1562 v43 = 0;
|
|
1563 //v44 = p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C];
|
|
1564 v44 = p2DEvents[(unsigned int)v8->ptr_1C - 1].uType;
|
|
1565 if ( uMessageParam == 2 )
|
|
1566 {
|
|
1567 if ( uItemsAmountPerShopType[v44] )
|
|
1568 {
|
|
1569 do
|
|
1570 {
|
|
1571 v45 = pParty->StandartItemsInShops[(int)v42][v43].uItemID;
|
|
1572 if ( v45 )
|
|
1573 {
|
|
1574 v46 = pIcons_LOD->LoadTexture(pItemsTable->pItems[v45].pIconName, TEXTURE_16BIT_PALETTE);
|
|
1575 //v3 = dword_F8B198;
|
|
1576 v8 = window_SpeakInHouse;
|
|
1577 ItemsInShopTexture[v43] = &pIcons_LOD->pTextures[v46];
|
|
1578 }
|
|
1579 v42 = v8->ptr_1C;
|
|
1580 ++v43;
|
|
1581 }
|
|
1582 //while ( v43 < (unsigned __int8)_4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] );
|
|
1583 while ( v43 < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] );
|
|
1584 }
|
|
1585 if ( in_current_building_type == BildingType_WeaponShop )
|
|
1586 {
|
|
1587 v47 = v8->ptr_1C;
|
|
1588 v48 = 0;
|
|
1589 //if ( _4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] )
|
|
1590 if ( uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] )
|
|
1591 {
|
|
1592 do
|
|
1593 {
|
|
1594 // if ( pParty->field_777C[9 * (v48 + 12 * (int)v47)] )
|
|
1595 if ( pParty->StandartItemsInShops[(int)v47][v48].uItemID);
|
|
1596 {
|
|
1597 v49 = rand();
|
|
1598 v8 = window_SpeakInHouse;
|
|
1599 word_F8B158[v48] = v49 % (300 - ItemsInShopTexture[v48]->uTextureHeight);
|
|
1600 }
|
|
1601 v47 = v8->ptr_1C;
|
|
1602 ++v48;
|
|
1603 }
|
|
1604 //while ( v48 < (unsigned __int8)_4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] );
|
|
1605 while ( v48 < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] );
|
|
1606 }
|
|
1607 }
|
|
1608 }
|
|
1609 if ( uMessageParam == 95 )
|
|
1610 {
|
|
1611 if ( uItemsAmountPerShopType[v44] )
|
|
1612 {
|
|
1613 do
|
|
1614 {
|
|
1615 //v50 = pParty->field_C59C[9 * (v43 + 12 * (int)v42) + 724];
|
|
1616 v50=pParty->SpecialItemsInShops[(unsigned int)v42][(signed int)v43].uItemID;
|
|
1617 if ( v50 )
|
|
1618 {
|
|
1619 v51 = pIcons_LOD->LoadTexture(pItemsTable->pItems[v50].pIconName, TEXTURE_16BIT_PALETTE);
|
|
1620 //v3 = dword_F8B198;
|
|
1621 v8 = window_SpeakInHouse;
|
|
1622 ItemsInShopTexture[v43] = &pIcons_LOD->pTextures[v51];
|
|
1623 }
|
|
1624 v42 = v8->ptr_1C;
|
|
1625 ++v43;
|
|
1626 }
|
|
1627 //while ( v43 < (unsigned __int8)_4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] );
|
|
1628 while ( v43 < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] );
|
|
1629 }
|
|
1630 if ( in_current_building_type == BildingType_WeaponShop )
|
|
1631 {
|
|
1632 v52 = v8->ptr_1C;
|
|
1633 v53 = 0;
|
|
1634 //if ( _4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] )
|
|
1635 if ( uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] )
|
|
1636 {
|
|
1637 do
|
|
1638 {
|
|
1639 // if ( pParty->field_C59C[9 * (v53 + 12 * (int)v52) + 724] )
|
|
1640 if (pParty->SpecialItemsInShops[(unsigned int)v52][v53].uItemID)
|
|
1641 {
|
|
1642 v54 = rand();
|
|
1643 v8 = window_SpeakInHouse;
|
|
1644 word_F8B158[v53] = v54 % (300 - ItemsInShopTexture[v53]->uTextureHeight);
|
|
1645 }
|
|
1646 v52 = v8->ptr_1C;
|
|
1647 ++v53;
|
|
1648 }
|
|
1649 //while ( v53 < (unsigned __int8)_4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] );
|
|
1650 while ( v53 < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType ] );
|
|
1651 }
|
|
1652 }
|
|
1653 }
|
|
1654 */
|
|
1655 }
|
|
1656
|
|
1657
|
|
1658
|
|
1659 //----- (004B6943) --------------------------------------------------------
|
|
1660 void __cdecl TravelByTransport()
|
|
1661 {
|
|
1662 GUIWindow *v0; // ebx@1
|
|
1663 Player *v1; // esi@1
|
|
1664 signed int v2; // edi@1
|
|
1665 unsigned int v3; // eax@1
|
|
1666 signed int v4; // ebx@1
|
|
1667 stru365_travel_info *v5; // esi@7
|
777
|
1668 //int v6; // eax@9
|
|
1669 //int v7; // eax@9
|
|
1670 //int v8; // eax@12
|
|
1671 //int v9; // edi@12
|
|
1672 //int v10; // edx@12
|
775
|
1673 int v11; // ecx@12
|
|
1674 signed int v12; // esi@13
|
|
1675 signed int v13; // edi@14
|
|
1676 DWORD v14; // eax@26
|
|
1677 DWORD v15; // edi@26
|
|
1678 GUIWindow *v16; // ebx@36
|
|
1679 int v17; // esi@36
|
|
1680 int v18; // eax@36
|
|
1681 int v19; // ecx@36
|
|
1682 int v20; // esi@36
|
|
1683 int v21; // eax@36
|
|
1684 void *v22; // eax@39
|
|
1685 int v23; // esi@39
|
|
1686 GUIButton *v24; // ebx@39
|
|
1687 signed int v25; // eax@41
|
|
1688 //int v26; // esi@44
|
777
|
1689 //const char *v27; // eax@46
|
775
|
1690 char *v28; // eax@62
|
|
1691 int v29; // eax@62
|
|
1692 unsigned int v30; // ecx@62
|
|
1693 char *v31; // eax@63
|
|
1694 MapInfo v32; // [sp-3Ch] [bp-2CCh]@62
|
|
1695 /*int v33; // [sp-38h] [bp-2C8h]@62
|
|
1696 int v34; // [sp-34h] [bp-2C4h]@62
|
|
1697 int v35; // [sp-30h] [bp-2C0h]@62
|
|
1698 int v36; // [sp-2Ch] [bp-2BCh]@62
|
|
1699 int v37; // [sp-28h] [bp-2B8h]@62
|
|
1700 int v38; // [sp-24h] [bp-2B4h]@62
|
|
1701 int v39; // [sp-20h] [bp-2B0h]@62
|
|
1702 int v40; // [sp-1Ch] [bp-2ACh]@62
|
|
1703 int v41; // [sp-18h] [bp-2A8h]@62
|
|
1704 int v42; // [sp-14h] [bp-2A4h]@62
|
|
1705 char *v43; // [sp-10h] [bp-2A0h]@62
|
|
1706 char *v44; // [sp-Ch] [bp-29Ch]@62
|
|
1707 unsigned int v45; // [sp-8h] [bp-298h]@62
|
|
1708 char *v46; // [sp-4h] [bp-294h]@62
|
|
1709 const char *v47[5]; // [sp+0h] [bp-290h]@7*/
|
777
|
1710 char v48[5][100]; // [sp+14h] [bp-27Ch]@37
|
|
1711 //char v49[100]; // [sp+78h] [bp-218h]@68
|
|
1712 //char v50[100]; // [sp+DCh] [bp-1B4h]@68
|
|
1713 //char v51[100]; // [sp+140h] [bp-150h]@68
|
|
1714 //char Dest[100]; // [sp+1A4h] [bp-ECh]@36
|
775
|
1715 GUIWindow v53; // [sp+208h] [bp-88h]@1
|
|
1716 int v54; // [sp+25Ch] [bp-34h]@36
|
|
1717 int v55; // [sp+260h] [bp-30h]@36
|
777
|
1718 //unsigned int v56; // [sp+264h] [bp-2Ch]@1
|
|
1719 //int v57; // [sp+268h] [bp-28h]@1
|
775
|
1720 int v58; // [sp+26Ch] [bp-24h]@36
|
777
|
1721 //GUIWindow *v59; // [sp+270h] [bp-20h]@1
|
775
|
1722 unsigned int v60; // [sp+274h] [bp-1Ch]@36
|
|
1723 //Player *v61; // [sp+278h] [bp-18h]@1
|
|
1724 int v62; // [sp+27Ch] [bp-14h]@36
|
|
1725 int v63; // [sp+280h] [bp-10h]@14
|
|
1726 char *a1; // [sp+284h] [bp-Ch]@37
|
|
1727 unsigned int s1; // [sp+288h] [bp-8h]@1
|
|
1728 int v66; // [sp+28Ch] [bp-4h]@48
|
|
1729
|
|
1730 v0 = window_SpeakInHouse;
|
|
1731 memcpy(&v53, window_SpeakInHouse, sizeof(v53));
|
|
1732 v2 = 255;
|
|
1733 //v61 = pPlayers[uActiveCharacter];
|
|
1734 v1 = pPlayers[uActiveCharacter];
|
|
1735 v53.uFrameX = 483;
|
|
1736 v53.uFrameWidth = 148;
|
|
1737 v53.uFrameZ = 334;
|
949
|
1738 auto color_default = TargetColor(255, 255, 255);
|
|
1739 auto color_selected = TargetColor(255, 255, 155);
|
775
|
1740 v3 = 52 * (unsigned int)v0->ptr_1C;
|
|
1741 //v59 = (GUIWindow *)((((p2DEvents_minus1___00[v3 / 2] != 27) - 1) & 0xFFFFFFE7) + 50);
|
777
|
1742 //v59 = (GUIWindow *)((((p2DEvents[(unsigned int)v0->ptr_1C - 1].uType != BildingType_Stables) - 1) & 0xFFFFFFE7) + 50);
|
775
|
1743 //v4 = (signed __int64)((double)(signed int)v59 * p2DEvents_minus1__20[v3 / 4]);
|
777
|
1744
|
|
1745 v4 = p2DEvents[(unsigned int)v0->ptr_1C - 1].uType == BildingType_Stables ? 25 : 50;
|
|
1746 v4 *= p2DEvents[(unsigned int)v0->ptr_1C - 1].fPriceMultiplier;
|
|
1747
|
775
|
1748 s1 = v4 * (100 - v1->GetMerchant()) / 100;
|
|
1749 if ( (signed int)s1 < v4 / 3 )
|
|
1750 s1 = v4 / 3;
|
|
1751 if ( dialog_menu_id == HOUSE_DIALOGUE_MAIN)
|
|
1752 {
|
|
1753 if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
|
|
1754 {
|
|
1755 v16 = pDialogueWindow;
|
777
|
1756 v58 = 255;
|
775
|
1757 v62 = 0;
|
|
1758 v17 = LOBYTE(pFontArrus->uFontHeight) - 3;
|
777
|
1759 //v59 = pDialogueWindow;
|
775
|
1760 v54 = v17;
|
777
|
1761 strcpy(v48[4], "");
|
775
|
1762 sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[405], s1); // Price: %lu gold
|
|
1763 v18 = pFontArrus->CalcTextHeight(pTmpBuf2, &v53, 0, 0);
|
|
1764 v19 = v16->pNumPresenceButton;
|
|
1765 v20 = v18 + v17 + 146;
|
|
1766 v21 = v16->pStartingPosActiveItem;
|
|
1767 v63 = v20;
|
|
1768 v55 = v20;
|
|
1769 v60 = v21;
|
|
1770 if ( v21 >= v21 + v19 )
|
|
1771 goto LABEL_71;
|
|
1772 s1 = 2;
|
777
|
1773 a1 = (char *)v48;
|
775
|
1774 while ( 1 )
|
|
1775 {
|
|
1776 int v47 = v60;
|
|
1777 v22 = window_SpeakInHouse->ptr_1C;
|
777
|
1778 v23 = transport_routes[(unsigned int)v22 - HOUSE_STABLES_HARMONDALE][v62];
|
775
|
1779 //v23 = (unsigned __int8)*(&_4F0D38_TravelInfo[4 * (unsigned int)v22] + v62); // negindex. actual address is around + 0x36
|
|
1780 //v61 = (Player *)(unsigned __int8)*(&_4F0D38_TravelInfo[4 * (unsigned int)v22] + v62); // + 0x3F for sea travels, less for land
|
|
1781 v24 = v16->GetControl(v60);
|
777
|
1782
|
|
1783 if (v23 != v58)
|
775
|
1784 {
|
777
|
1785 if (v23 >= 25)
|
|
1786 Log::Warning(L"Transport UI: scedule overflow");
|
|
1787 if (s1 >= 6)
|
|
1788 v25 = true;
|
|
1789 else
|
|
1790 v25 = transport_schedule[v23].pSchedule[pParty->uDaysPlayed % 7];
|
|
1791 }
|
|
1792
|
|
1793 if (v23 != v58 && v25 && (!transport_schedule[v23].uQuestBit || _449B57_test_bit(pParty->_quest_bits, transport_schedule[v23].uQuestBit)) )
|
|
1794 {
|
|
1795 v58 = v23;
|
|
1796 if ( pDialogueWindow->pCurrentPosActiveItem == s1 )
|
|
1797 sprintf(a1, "\f%05d", color_selected);
|
|
1798 else
|
|
1799 sprintf(a1, "\f%05d", color_default);
|
|
1800
|
775
|
1801 //v32.uRedbookTrackID = v27;
|
777
|
1802 v66 = transport_schedule[v23].uTravelTime;
|
|
1803 if ( (unsigned int)window_SpeakInHouse->ptr_1C >= HOUSE_BOATS_63 )
|
775
|
1804 {
|
|
1805 if ( CheckHiredNPCSpeciality(Sailor) )
|
|
1806 v66 -= 2;
|
|
1807 if ( CheckHiredNPCSpeciality(Navigator) )
|
|
1808 v66 -= 3;
|
|
1809 if ( CheckHiredNPCSpeciality(Pirate) )
|
|
1810 v66 -= 2;
|
|
1811 }
|
|
1812 else
|
|
1813 {
|
|
1814 if ( CheckHiredNPCSpeciality(Horseman) )
|
|
1815 v66 -= 2;
|
|
1816 }
|
|
1817 if ( CheckHiredNPCSpeciality(Explorer) )
|
|
1818 --v66;
|
|
1819 if ( v66 < 1 )
|
|
1820 v66 = 1;
|
|
1821 if ( v23 != v2 )
|
|
1822 {
|
777
|
1823 memcpy(&v32, &pMapStats->pInfos[transport_schedule[v23].uMapInfoID], 0x44u);
|
775
|
1824 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[404], // Time - %d days, destination %s
|
777
|
1825 v66, v32.pName);
|
775
|
1826 strcat(a1, pTmpBuf);
|
|
1827 v28 = a1;
|
|
1828 a1 += 100;
|
|
1829 ++v62;
|
|
1830 ++s1;
|
|
1831 strcat(v28, "\n \n");
|
|
1832 v24->uY = v63;
|
|
1833 v29 = pFontArrus->CalcTextHeight(pTmpBuf, &v53, 0, 0);
|
|
1834 v30 = v24->uY;
|
|
1835 v24->uHeight = v29;
|
|
1836 v2 = 255;
|
|
1837 v24->uW = v30 + v29 - 1;
|
|
1838 v63 += v54 + v29;
|
|
1839 }
|
|
1840 }
|
|
1841 else
|
|
1842 {
|
|
1843 v31 = a1;
|
|
1844 ++v62;
|
|
1845 ++s1;
|
|
1846 a1 += 100;
|
|
1847 strcpy(v31, "");
|
|
1848 if ( v24 )
|
|
1849 {
|
|
1850 v24->uW = 0;
|
|
1851 v24->uHeight = 0;
|
|
1852 v24->uY = 0;
|
|
1853 }
|
|
1854 }
|
|
1855 ++v60;
|
777
|
1856 if ( (signed int)v60 >= v16->pNumPresenceButton + v16->pStartingPosActiveItem )
|
775
|
1857 break;
|
777
|
1858 //v16 = v59;
|
775
|
1859 }
|
|
1860 if ( v63 != v55 )
|
|
1861 {
|
|
1862 /*v47[1] = &Dest;
|
|
1863 v47[0] = &v51;
|
|
1864 v46 = &v50;
|
|
1865 v45 = (unsigned int)&v49;
|
|
1866 v44 = &v48;
|
|
1867 v43 = pTmpBuf2;*/
|
777
|
1868 sprintf(pTmpBuf, "%s\n \n%s%s%s%s%s", pTmpBuf2, v48[0], v48[1], v48[2], v48[3], v48[4]);
|
775
|
1869 v53.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u);
|
|
1870 }
|
|
1871 else
|
|
1872 {
|
|
1873 LABEL_71:
|
|
1874 v53.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[561], &v53, 0, 0)) / 2 + 138,
|
777
|
1875 color_default, pGlobalTXT_LocalizationStrings[561], 3);
|
775
|
1876 pAudioPlayer->StopChannels(-1, -1);
|
|
1877 }
|
|
1878 }
|
|
1879 }
|
|
1880 else
|
|
1881 {
|
777
|
1882 if ( dialog_menu_id >= HOUSE_DIALOGUE_TRANSPORT_SCHEDULE_1 && dialog_menu_id <= HOUSE_DIALOGUE_TRANSPORT_SCHEDULE_4 )
|
775
|
1883 {
|
|
1884 if ( pParty->uNumGold < s1 )
|
|
1885 {
|
|
1886 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u);
|
|
1887 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_Greeting_2);
|
|
1888 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
|
778
|
1889 return;
|
775
|
1890 }
|
778
|
1891
|
775
|
1892 Party::TakeGold(s1);
|
778
|
1893
|
777
|
1894 v5 = &transport_schedule[transport_routes[(unsigned int)window_SpeakInHouse->ptr_1C - HOUSE_STABLES_HARMONDALE][dialog_menu_id - HOUSE_DIALOGUE_TRANSPORT_SCHEDULE_1]];
|
775
|
1895 if ( v5->pSchedule[pParty->uDaysPlayed % 7] )
|
|
1896 {
|
|
1897 if ( _strcmpi(pCurrentMapName, pMapStats->pInfos[v5->uMapInfoID].pFilename) )
|
|
1898 {
|
|
1899 SaveGame(1, 0);
|
|
1900 strcpy(pCurrentMapName, pMapStats->pInfos[v5->uMapInfoID].pFilename);
|
777
|
1901
|
775
|
1902 dword_6BE364_game_settings_1 |= 1u;
|
|
1903 _5B65B8_npcdata_hiword_house_or_other = 0;
|
|
1904 dword_5B65BC = 0;
|
777
|
1905 _5B65B4_npcdata_loword_house_or_other = v5->arrival_rot_y;
|
775
|
1906 v11 = *((int *)v5 + 3);
|
978
|
1907 uGameState = GAME_STATE_2;
|
775
|
1908 _5B65A8_npcdata_uflags_or_other = v11;
|
777
|
1909 _5B65AC_npcdata_fame_or_other = v5->arrival_y;
|
|
1910 _5B65B0_npcdata_rep_or_other = v5->arrival_z;
|
|
1911 dword_5B65C0 = v11 | v5->arrival_y | v5->arrival_z | v5->arrival_rot_y;
|
775
|
1912 }
|
|
1913 else
|
|
1914 {
|
|
1915 pIndoorCamera->sRotationY = 0;
|
|
1916 pParty->uFlags |= 2u;
|
777
|
1917 pParty->vPosition.x = v5->arrival_x;
|
|
1918 pParty->vPosition.y = v5->arrival_y;
|
|
1919 pParty->vPosition.z = v5->arrival_z;
|
775
|
1920 pParty->uFallStartY = pParty->vPosition.z;
|
777
|
1921 pParty->sRotationX = 0;
|
|
1922 pParty->sRotationY = v5->arrival_rot_y;
|
775
|
1923 }
|
|
1924 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful);
|
|
1925 v12 = v5->uTravelTime;
|
|
1926 int _v47;
|
|
1927 if ( (signed int)window_SpeakInHouse->ptr_1C >= 63 )
|
|
1928 {
|
|
1929 v63 = SPEECH_SetSail;
|
|
1930 v13 = 2500;
|
|
1931 if ( CheckHiredNPCSpeciality(Sailor) )
|
|
1932 v12 -= 2;
|
|
1933 if ( CheckHiredNPCSpeciality(Navigator) )
|
|
1934 v12 -= 3;
|
|
1935 //_v47 = 45;
|
|
1936 if ( CheckHiredNPCSpeciality(Pirate) )
|
|
1937 v12 -= 2;
|
|
1938 }
|
|
1939 else
|
|
1940 {
|
|
1941 v63 = SPEECH_CarriageReady;
|
|
1942 v13 = 1500;
|
|
1943 //_v47 = 35;
|
|
1944 if ( CheckHiredNPCSpeciality(Horseman) )
|
|
1945 v12 -= 2;
|
|
1946 }
|
|
1947 if ( CheckHiredNPCSpeciality(Explorer) )
|
|
1948 --v12;
|
|
1949 if ( v12 < 1 )
|
|
1950 v12 = 1;
|
|
1951 RestAndHeal(1440 * v12);
|
|
1952 v1->PlaySound((PlayerSpeech)v63, 0);
|
|
1953 v14 = GetTickCount();
|
|
1954 v15 = v14 + v13;
|
|
1955 if ( v15 < v14 )
|
|
1956 v15 = v14;
|
|
1957 while ( GetTickCount() < v15 )
|
|
1958 sqrt(3.1415926);
|
|
1959 while ( sub_4BD8B5() )
|
|
1960 ;
|
|
1961 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0);
|
778
|
1962 return;
|
775
|
1963 }
|
|
1964 else
|
|
1965 {
|
|
1966 dialog_menu_id = HOUSE_DIALOGUE_MAIN;
|
|
1967 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0);
|
|
1968 }
|
|
1969 }
|
|
1970 }
|
|
1971 }
|
|
1972
|
|
1973
|
|
1974
|
|
1975
|
|
1976
|
|
1977
|
629
|
1978 //----- (004B68EA) --------------------------------------------------------
|
727
|
1979 bool __fastcall IsTravelAvailable(int a1)
|
629
|
1980 {
|
727
|
1981 for (uint i = 0; i < 4; ++i)
|
629
|
1982 {
|
777
|
1983 uint route = transport_routes[a1][i];
|
|
1984 if (transport_schedule[route].pSchedule[pParty->uDaysPlayed % 7])
|
629
|
1985 {
|
777
|
1986 if (!transport_schedule[route].uQuestBit || _449B57_test_bit(pParty->_quest_bits, transport_schedule[route].uQuestBit))
|
727
|
1987 return true;
|
629
|
1988 }
|
|
1989 }
|
727
|
1990 return false;
|
629
|
1991 }
|
|
1992
|
|
1993
|
|
1994
|
|
1995 //----- (004B7911) --------------------------------------------------------
|
|
1996 void __cdecl TownHallDialog()
|
|
1997 {
|
|
1998 GUIWindow *v0; // eax@4
|
|
1999 int v1; // eax@10
|
|
2000 int v2; // esi@10
|
|
2001 GUIFont *v3; // ST20_4@20
|
|
2002 int v4; // eax@20
|
|
2003 MonsterInfo *v5; // edi@21
|
|
2004 unsigned int v6; // ST20_4@21
|
|
2005 char *v7; // ST1C_4@21
|
|
2006 unsigned int v8; // eax@21
|
|
2007 int v9; // esi@21
|
|
2008 char *v10; // eax@23
|
|
2009 signed int v11; // ebx@24
|
|
2010 signed int i; // esi@26
|
|
2011 int v13; // eax@27
|
|
2012 GUIWindow *v14; // ecx@28
|
|
2013 __int64 v15; // qax@28
|
|
2014 signed int v16; // ebx@28
|
|
2015 int v17; // ebx@28
|
|
2016 unsigned __int8 v18; // sf@28
|
|
2017 char **v19; // edi@29
|
|
2018 GUIButton *v20; // eax@30
|
|
2019 GUIButton *v21; // esi@30
|
|
2020 int v22; // eax@30
|
|
2021 unsigned int v23; // ecx@30
|
|
2022 unsigned __int16 v24; // ax@30
|
|
2023 GUIWindow a1; // [sp+Ch] [bp-110h]@21
|
|
2024 GUIWindow w; // [sp+60h] [bp-BCh]@21
|
|
2025 GUIWindow _this; // [sp+B4h] [bp-68h]@1
|
|
2026 int v28; // [sp+108h] [bp-14h]@1
|
|
2027 int v29; // [sp+10Ch] [bp-10h]@28
|
|
2028 int v30; // [sp+110h] [bp-Ch]@1
|
|
2029 int v31; // [sp+114h] [bp-8h]@29
|
|
2030 GUIFont *pOutString; // [sp+118h] [bp-4h]@21
|
|
2031
|
|
2032 memcpy(&_this, window_SpeakInHouse, sizeof(_this));
|
|
2033 _this.uFrameX = 483;
|
|
2034 _this.uFrameWidth = 148;
|
|
2035 _this.uFrameZ = 334;
|
949
|
2036 v28 = TargetColor(0xFFu, 0xFFu, 0xFFu);
|
|
2037 v30 = TargetColor(0xFFu, 0xFFu, 0x9Bu);
|
629
|
2038 sprintf(pTmpBuf, "%s: %d", pGlobalTXT_LocalizationStrings[605], pParty->uFine);
|
|
2039 _this.DrawTitleText(pFontArrus, 0, 0x104u, v30, pTmpBuf, 3u);
|
|
2040 switch(dialog_menu_id)
|
|
2041 {
|
749
|
2042 case HOUSE_DIALOGUE_MAIN:
|
629
|
2043 {
|
|
2044 v11 = 1;
|
|
2045 pOutString = 0;
|
|
2046 pShopOptions[0] = pGlobalTXT_LocalizationStrings[604];
|
|
2047 if ( pParty->uFine )
|
|
2048 {
|
|
2049 pShopOptions[1] = pGlobalTXT_LocalizationStrings[603];
|
|
2050 v11 = 2;
|
|
2051 }
|
|
2052 for ( i = 0; i < v11; ++i )
|
|
2053 {
|
|
2054 v13 = pFontArrus->CalcTextHeight(pShopOptions[i], &_this, 0, 0);
|
|
2055 pOutString = (GUIFont *)((char *)pOutString + v13);
|
|
2056 }
|
|
2057 v29 = (100 - (signed int)pOutString) / v11;
|
|
2058 v14 = pDialogueWindow;
|
|
2059 v15 = 80 - v11 * (100 - (signed int)pOutString) / v11 - (signed int)pOutString;
|
|
2060 v16 = v15 - HIDWORD(v15);
|
|
2061 LODWORD(v15) = pDialogueWindow->pStartingPosActiveItem;
|
|
2062 HIDWORD(v15) = v15 + pDialogueWindow->pNumPresenceButton;
|
|
2063 v17 = (v16 >> 1) - v29 / 2 + 158;
|
|
2064 v18 = -pDialogueWindow->pNumPresenceButton < 0;
|
|
2065 pOutString = (GUIFont *)pDialogueWindow->pStartingPosActiveItem;
|
|
2066 if ( v18 ^ __OFSUB__((int)v15, HIDWORD(v15)) )
|
|
2067 {
|
|
2068 v31 = 2;
|
|
2069 v19 = pShopOptions;
|
|
2070 do
|
|
2071 {
|
|
2072 v20 = v14->GetControl((unsigned int)pOutString);
|
|
2073 v21 = v20;
|
|
2074 v20->uY = v29 + v17;
|
|
2075 v22 = pFontArrus->CalcTextHeight(*v19, &_this, 0, 0);
|
|
2076 v23 = v21->uY;
|
|
2077 v21->uHeight = v22;
|
|
2078 v17 = v23 + v22 - 1;
|
|
2079 v21->uW = v17;
|
|
2080 v24 = v30;
|
|
2081 if ( pDialogueWindow->pCurrentPosActiveItem != v31 )
|
|
2082 v24 = v28;
|
|
2083 _this.DrawTitleText(pFontArrus, 0, v23, v24, *v19, 3u);
|
|
2084 v14 = pDialogueWindow;
|
|
2085 ++v31;
|
|
2086 ++v19;
|
|
2087 pOutString = (GUIFont *)((char *)pOutString + 1);
|
|
2088 }
|
|
2089 while ( (signed int)pOutString < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem );
|
|
2090 }
|
|
2091 break;
|
|
2092 }
|
749
|
2093
|
|
2094 case HOUSE_DIALOGUE_TOWNHALL_99:
|
629
|
2095 {
|
|
2096 v5 = &pMonsterStats->pInfos[word_F8B1A0];
|
949
|
2097 v6 = TargetColor(0xFFu, 0xFFu, 0xFFu);
|
629
|
2098 v7 = v5->pName;
|
949
|
2099 v8 = TargetColor(0xFFu, 0xFFu, 0x9Bu);
|
1033
|
2100 sprintf(pTmpBuf, "\f%05d%s\f%05d", v8, v7, v6);
|
629
|
2101 sprintf(pTmpBuf2, dword_F8B1A4, pTmpBuf, 100 * v5->uLevel);
|
827
|
2102 current_npc_text = pTmpBuf2;
|
629
|
2103 memcpy(&a1, pDialogueWindow, sizeof(a1));
|
|
2104 w.uFrameWidth = 458;
|
|
2105 w.uFrameZ = 457;
|
|
2106 pOutString = pFontArrus;
|
|
2107 v9 = pFontArrus->CalcTextHeight(pTmpBuf2, &w, 13, 0) + 7;
|
|
2108 if ( 352 - v9 < 8 )
|
|
2109 {
|
|
2110 pOutString = pFontCreate;
|
827
|
2111 v9 = pFontCreate->CalcTextHeight(current_npc_text, &w, 13, 0) + 7;
|
629
|
2112 }
|
|
2113
|
948
|
2114 auto pTex = pIcons_LOD->GetTexture(uTextureID_Leather);
|
|
2115 pRenderer->_4A6A68(8u, 352 - v9, pTex, pTex->uTextureHeight - v9);
|
629
|
2116 pRenderer->DrawTextureIndexed(8u, 347 - v9, pTexture_591428);
|
827
|
2117 v10 = FitTextInAWindow(current_npc_text, pOutString, &w, 0xDu, 0);
|
629
|
2118 a1.DrawText(pOutString, 13, 354 - v9, 0, v10, 0, 0, 0);
|
|
2119 break;
|
|
2120 }
|
749
|
2121 case HOUSE_DIALOGUE_TOWNHALL_100:
|
629
|
2122 {
|
|
2123 v0 = window_SpeakInHouse;
|
1038
|
2124 if ( window_SpeakInHouse->receives_keyboard_input_2 == WINDOW_INPUT_IN_PROGRESS)
|
629
|
2125 {
|
1038
|
2126 sprintfex(pTmpBuf, "%s\n%s", pGlobalTXT_LocalizationStrings[606], pGlobalTXT_LocalizationStrings[112]); // "Pay" "How Much?"
|
629
|
2127 _this.DrawTitleText(pFontArrus, 0, 0x92u, v30, pTmpBuf, 3u);
|
1033
|
2128 _this.DrawTitleText(pFontArrus, 0, 0xBAu, v28, (const char *)pKeyActionMap->pPressedKeysBuffer, 3);
|
629
|
2129 v3 = pFontArrus;
|
|
2130 v4 = pFontArrus->GetLineWidth((const char *)pKeyActionMap->pPressedKeysBuffer);
|
|
2131 _this.DrawFlashingInputCursor(v4 / 2 + 80, 185, v3);
|
|
2132 return;
|
|
2133 }
|
1038
|
2134 if ( window_SpeakInHouse->receives_keyboard_input_2 == WINDOW_INPUT_CONFIRMED)
|
629
|
2135 {
|
|
2136 v1 = atoi((const char *)pKeyActionMap->pPressedKeysBuffer);
|
|
2137 v2 = v1;
|
|
2138 if ( v1 <= 0 )
|
|
2139 {
|
|
2140 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
|
|
2141 return;
|
|
2142 }
|
|
2143 if ( v1 > pParty->uNumGold )
|
|
2144 {
|
758
|
2145 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful);
|
629
|
2146 v2 = pParty->uNumGold;
|
|
2147 }
|
|
2148 if ( v2 > pParty->uFine )
|
|
2149 v2 = pParty->uFine;
|
|
2150 Party::TakeGold(v2);
|
|
2151 pParty->uFine -= v2;
|
|
2152 if ( pParty->uFine < 0 )
|
|
2153 pParty->uFine = 0;
|
|
2154 if ( uActiveCharacter )
|
|
2155 pPlayers[uActiveCharacter]->PlaySound(SPEECH_81, 0);
|
|
2156 v0 = window_SpeakInHouse;
|
|
2157 }
|
1038
|
2158 if ( window_SpeakInHouse->receives_keyboard_input_2 == WINDOW_INPUT_CANCELLED)
|
629
|
2159 {
|
1038
|
2160 v0->receives_keyboard_input_2 = WINDOW_INPUT_NONE;
|
629
|
2161 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
|
|
2162 }
|
|
2163 break;
|
|
2164 }
|
|
2165 default:
|
|
2166 {
|
|
2167 break;
|
|
2168 }
|
|
2169 }
|
|
2170 return;
|
|
2171 }
|
1033
|
2172
|
|
2173
|
629
|
2174
|
|
2175 //----- (004B7D7E) --------------------------------------------------------
|
|
2176 void __cdecl BankDialog()
|
|
2177 {
|
|
2178 GUIWindow *v0; // eax@4
|
1038
|
2179 //int v1; // ecx@5
|
629
|
2180 int v2; // eax@6
|
|
2181 unsigned int v3; // esi@6
|
|
2182 GUIFont *v4; // ST10_4@12
|
|
2183 int v5; // eax@12
|
|
2184 int v6; // eax@19
|
|
2185 unsigned int v7; // esi@19
|
|
2186 unsigned __int16 v8; // ax@27
|
|
2187 unsigned __int16 v9; // ax@29
|
|
2188 char *v10; // [sp-8h] [bp-70h]@11
|
|
2189 char *v11; // [sp-4h] [bp-6Ch]@11
|
|
2190 GUIWindow _this; // [sp+Ch] [bp-5Ch]@1
|
|
2191 __int16 v13[2]; // [sp+60h] [bp-8h]@1
|
|
2192 __int16 v14[2]; // [sp+64h] [bp-4h]@1
|
|
2193
|
|
2194 memcpy(&_this, window_SpeakInHouse, sizeof(_this));
|
|
2195 _this.uFrameX = 483;
|
|
2196 _this.uFrameWidth = 148;
|
|
2197 _this.uFrameZ = 334;
|
949
|
2198 *(int *)v13 = TargetColor(0xFFu, 0xFFu, 0xFFu);
|
|
2199 *(int *)v14 = TargetColor(0xFFu, 0xFFu, 0x9Bu);
|
629
|
2200 sprintf(pTmpBuf, "%s: %d", pGlobalTXT_LocalizationStrings[25], pParty->uNumGoldInBank);
|
|
2201 _this.DrawTitleText(pFontArrus, 0, 0xDCu, v14[0], pTmpBuf, 3u);
|
|
2202 switch(dialog_menu_id)
|
|
2203 {
|
749
|
2204 case HOUSE_DIALOGUE_MAIN:
|
629
|
2205 {
|
|
2206 v8 = v14[0];
|
|
2207 if ( pDialogueWindow->pCurrentPosActiveItem != 2 )
|
|
2208 v8 = v13[0];
|
|
2209 _this.DrawTitleText(pFontArrus, 0, 0x92u, v8, pGlobalTXT_LocalizationStrings[60], 3u);
|
|
2210 v9 = v14[0];
|
|
2211 if ( pDialogueWindow->pCurrentPosActiveItem != 3 )
|
|
2212 v9 = v13[0];
|
|
2213 _this.DrawTitleText(pFontArrus, 0, 0xB0u, v9, pGlobalTXT_LocalizationStrings[244], 3u);
|
|
2214 break;
|
|
2215 }
|
749
|
2216 case HOUSE_DIALOGUE_BANK_7:
|
629
|
2217 {
|
|
2218 v0 = window_SpeakInHouse;
|
1038
|
2219 if ( window_SpeakInHouse->receives_keyboard_input_2 != WINDOW_INPUT_IN_PROGRESS)
|
629
|
2220 {
|
1038
|
2221 if ( window_SpeakInHouse->receives_keyboard_input_2 == WINDOW_INPUT_CONFIRMED)
|
629
|
2222 {
|
|
2223 v6 = atoi((const char *)pKeyActionMap->pPressedKeysBuffer);
|
|
2224 v7 = v6;
|
|
2225 if ( !v6 )
|
|
2226 {
|
|
2227 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
|
|
2228 return;
|
|
2229 }
|
|
2230 if ( v6 > pParty->uNumGold )
|
|
2231 {
|
758
|
2232 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful);
|
629
|
2233 v7 = pParty->uNumGold;
|
|
2234 }
|
|
2235 if ( v7 )
|
|
2236 {
|
|
2237 Party::TakeGold(v7);
|
|
2238 pParty->uNumGoldInBank += v7;
|
|
2239 if ( uActiveCharacter )
|
|
2240 pPlayers[uActiveCharacter]->PlaySound(SPEECH_81, 0);
|
|
2241 }
|
|
2242 v0 = window_SpeakInHouse;
|
1038
|
2243 v0->receives_keyboard_input_2 = WINDOW_INPUT_NONE;
|
629
|
2244 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
|
|
2245 return;
|
|
2246 }
|
1038
|
2247 if (window_SpeakInHouse->receives_keyboard_input_2 != WINDOW_INPUT_CANCELLED)
|
629
|
2248 return;
|
1038
|
2249 v0->receives_keyboard_input_2 = WINDOW_INPUT_NONE;
|
629
|
2250 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
|
|
2251 return;
|
|
2252 }
|
|
2253 v11 = pGlobalTXT_LocalizationStrings[112];
|
|
2254 v10 = pGlobalTXT_LocalizationStrings[60];
|
|
2255 sprintf(pTmpBuf, "%s\n%s", v10, v11);
|
|
2256 _this.DrawTitleText(pFontArrus, 0, 0x92u, v14[0], pTmpBuf, 3u);
|
|
2257 _this.DrawTitleText(pFontArrus, 0, 0xBAu, v13[0], (const char *)pKeyActionMap->pPressedKeysBuffer, 3u);
|
|
2258 v4 = pFontArrus;
|
|
2259 v5 = pFontArrus->GetLineWidth((const char *)pKeyActionMap->pPressedKeysBuffer);
|
|
2260 _this.DrawFlashingInputCursor(v5 / 2 + 80, 185, v4);
|
|
2261 break;
|
|
2262 }
|
|
2263
|
749
|
2264 case HOUSE_DIALOGUE_BANK_8:
|
629
|
2265 {
|
|
2266 v0 = window_SpeakInHouse;
|
1038
|
2267 if ( window_SpeakInHouse->receives_keyboard_input_2 != WINDOW_INPUT_IN_PROGRESS)
|
629
|
2268 {
|
1038
|
2269 if ( window_SpeakInHouse->receives_keyboard_input_2 == WINDOW_INPUT_CONFIRMED)
|
629
|
2270 {
|
1038
|
2271 window_SpeakInHouse->receives_keyboard_input_2 = WINDOW_INPUT_NONE;
|
629
|
2272 v2 = atoi((const char *)pKeyActionMap->pPressedKeysBuffer);
|
|
2273 v3 = v2;
|
|
2274 if ( v2 )
|
|
2275 {
|
|
2276 if ( v2 > pParty->uNumGoldInBank )
|
|
2277 {
|
758
|
2278 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful);
|
629
|
2279 v3 = pParty->uNumGoldInBank;
|
|
2280 }
|
|
2281 if ( v3 )
|
|
2282 {
|
|
2283 Party::SetGold(pParty->uNumGold + v3);
|
|
2284 pParty->uNumGoldInBank -= v3;
|
|
2285 }
|
|
2286 }
|
1038
|
2287 v0->receives_keyboard_input_2 = WINDOW_INPUT_NONE;
|
629
|
2288 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
|
|
2289 return;
|
|
2290 }
|
1038
|
2291 if ( window_SpeakInHouse->receives_keyboard_input_2 != WINDOW_INPUT_CANCELLED)
|
629
|
2292 return;
|
1038
|
2293 v0->receives_keyboard_input_2 = WINDOW_INPUT_NONE;
|
629
|
2294 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
|
|
2295 return;
|
|
2296 }
|
|
2297 v11 = pGlobalTXT_LocalizationStrings[112];
|
|
2298 v10 = pGlobalTXT_LocalizationStrings[244];
|
1038
|
2299 sprintfex(pTmpBuf, "%s\n%s", v10, v11);
|
629
|
2300 _this.DrawTitleText(pFontArrus, 0, 0x92u, v14[0], pTmpBuf, 3u);
|
|
2301 _this.DrawTitleText(pFontArrus, 0, 0xBAu, v13[0], (const char *)pKeyActionMap->pPressedKeysBuffer, 3u);
|
|
2302 v4 = pFontArrus;
|
|
2303 v5 = pFontArrus->GetLineWidth((const char *)pKeyActionMap->pPressedKeysBuffer);
|
|
2304 _this.DrawFlashingInputCursor(v5 / 2 + 80, 185, v4);
|
|
2305 return;
|
|
2306 break;
|
|
2307 }
|
|
2308
|
|
2309 default:
|
|
2310 {
|
|
2311 break;
|
|
2312 }
|
|
2313 }
|
|
2314 }
|
|
2315 // F8B19C: using guessed type int dword_F8B19C;
|
|
2316
|
|
2317 //----- (004B8285) --------------------------------------------------------
|
|
2318 void __cdecl TavernDialog()
|
|
2319 {
|
644
|
2320 int v0;
|
|
2321 int pItemNum;
|
629
|
2322 double v2; // st7@1
|
|
2323 signed int v3; // ebx@1
|
|
2324 int v4; // ecx@1
|
|
2325 int v5; // esi@3
|
|
2326 signed int v6; // edi@5
|
|
2327 int v7; // ecx@5
|
644
|
2328 int pNumString; // edi@16
|
629
|
2329 signed int v9; // esi@16
|
644
|
2330 unsigned int pNumActiveItem; // esi@18
|
629
|
2331 int v11; // eax@18
|
|
2332 unsigned int v12; // eax@19
|
|
2333 int v13; // eax@21
|
|
2334 int v14; // ecx@26
|
644
|
2335 //GUIButton *v15; // eax@28
|
|
2336 //GUIButton *v16; // esi@28
|
629
|
2337 int v17; // eax@28
|
|
2338 char *v18; // eax@30
|
|
2339 int v19; // eax@30
|
|
2340 unsigned int v20; // ecx@30
|
|
2341 int v21; // edx@30
|
|
2342 int v22; // eax@30
|
|
2343 unsigned __int16 v23; // ax@30
|
|
2344 int v24; // eax@34
|
|
2345 int v25; // eax@34
|
|
2346 char *v26; // esi@36
|
|
2347 int v27; // edi@46
|
644
|
2348 unsigned int pColorText; // eax@57
|
629
|
2349 signed int v31; // eax@59
|
644
|
2350 //GUIWindow *v33; // edi@64
|
629
|
2351 int v34; // eax@64
|
|
2352 int v35; // ecx@64
|
|
2353 int v36; // esi@64
|
|
2354 char v37; // sf@64
|
644
|
2355 GUIButton *pButton; // eax@65
|
629
|
2356 int v39; // edx@69
|
|
2357 int v40; // ecx@69
|
|
2358 int v41; // ecx@69
|
|
2359 int v42; // ecx@70
|
|
2360 unsigned int v43; // edx@70
|
|
2361 int v44; // edx@71
|
|
2362 int v45; // ecx@71
|
|
2363 int v46; // ecx@72
|
|
2364 int v47; // eax@74
|
|
2365 signed int v48; // edi@77
|
|
2366 signed int i; // esi@79
|
|
2367 int v50; // eax@80
|
644
|
2368 //GUIWindow *v51; // ecx@81
|
629
|
2369 _QWORD v52; // qax@81
|
|
2370 signed int v53; // edi@81
|
|
2371 int v54; // edi@81
|
644
|
2372 //GUIButton *v55; // esi@83
|
629
|
2373 const char **v56; // eax@83
|
|
2374 int v57; // eax@83
|
|
2375 unsigned int v58; // ecx@83
|
644
|
2376 //Player *v59; // edx@83
|
629
|
2377 unsigned __int16 v60; // ax@83
|
|
2378 int v61; // eax@99
|
|
2379 char *v63; // eax@99
|
|
2380 GUIFont *v64; // edx@99
|
|
2381 GUIFont *v65; // edi@100
|
|
2382 unsigned int v66; // [sp-10h] [bp-284h]@75
|
|
2383 unsigned __int16 v67; // [sp-Ch] [bp-280h]@75
|
|
2384 int v68; // [sp-Ch] [bp-280h]@99
|
|
2385 char *v69; // [sp-8h] [bp-27Ch]@75
|
|
2386 int v70; // [sp-8h] [bp-27Ch]@99
|
|
2387 unsigned int v71; // [sp-4h] [bp-278h]@75
|
|
2388 const char *v72; // [sp-4h] [bp-278h]@93
|
|
2389 unsigned int v73; // [sp-4h] [bp-278h]@99
|
870
|
2390 char pTopic1[100]; // [sp+Ch] [bp-268h]@55
|
|
2391 char pTopic4[100]; // [sp+70h] [bp-204h]@59
|
|
2392 char pTopic2[100]; // [sp+D4h] [bp-1A0h]@57
|
|
2393 char pTopic3[100]; // [sp+138h] [bp-13Ch]@59
|
644
|
2394 //GUIWindow v78; // [sp+19Ch] [bp-D8h]@99
|
|
2395 GUIWindow dialog_window; // [sp+1F0h] [bp-84h]@1
|
629
|
2396 char *Str[2]; // [sp+244h] [bp-30h]@30
|
644
|
2397 unsigned int pColorWhite; // [sp+24Ch] [bp-28h]@1
|
870
|
2398 unsigned __int8 pTopic3Height; // [sp+253h] [bp-21h]@59
|
629
|
2399 int v83; // [sp+254h] [bp-20h]@1
|
644
|
2400 int pColorYellow; // [sp+258h] [bp-1Ch]@1
|
|
2401 Player *pPlayer; // [sp+25Ch] [bp-18h]@1
|
|
2402 int all_text_height; // [sp+260h] [bp-14h]@18
|
629
|
2403 unsigned __int8 v87; // [sp+266h] [bp-Eh]@59
|
870
|
2404 unsigned __int8 pTopic2Height; // [sp+267h] [bp-Dh]@57
|
629
|
2405 int v89; // [sp+268h] [bp-Ch]@1
|
870
|
2406 unsigned int pTopic1Height; // [sp+26Fh] [bp-5h]@55
|
644
|
2407 int v91; // [sp+270h] [bp-4h]@3
|
|
2408 GUIFont *pOutString;
|
870
|
2409 unsigned __int8 pTopic4Height;
|
|
2410 int pTextHeight;
|
629
|
2411
|
644
|
2412 pPlayer = pPlayers[uActiveCharacter];
|
|
2413 memcpy(&dialog_window, window_SpeakInHouse, sizeof(dialog_window));
|
|
2414 dialog_window.uFrameX = 483;
|
|
2415 dialog_window.uFrameWidth = 148;
|
|
2416 dialog_window.uFrameZ = 334;
|
949
|
2417 pColorWhite = TargetColor(0xFFu, 0xFFu, 0xFFu);
|
|
2418 pColorYellow = TargetColor(0xFFu, 0xFFu, 0x9Bu);
|
644
|
2419 v2 = p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier;
|
629
|
2420 *(float *)&v83 = v2;
|
|
2421 *(float *)&v89 = v2 * v2;
|
|
2422 v3 = (signed __int64)(*(float *)&v89 * 0.1);
|
662
|
2423 pItemNum = v3 * (100 - pPlayer->GetMerchant()) / 100;
|
|
2424 if ( pItemNum < v3 / 3 )
|
|
2425 pItemNum = v3 / 3;
|
629
|
2426 v5 = 1;
|
662
|
2427 pOutString = (GUIFont *)pItemNum;
|
|
2428 if ( pItemNum <= 0 )
|
629
|
2429 pOutString = (GUIFont *)1;
|
|
2430 v6 = (signed __int64)(*(float *)&v89 * *(float *)&v83 * 0.0099999998);
|
644
|
2431 v7 = v6 * (100 - pPlayer->GetMerchant()) / 100;
|
629
|
2432 if ( v7 < v6 / 3 )
|
662
|
2433 v7 = v6 / 3;
|
629
|
2434 v83 = v7;
|
|
2435 if ( v7 <= 0 )
|
|
2436 {
|
|
2437 v7 = 1;
|
|
2438 v83 = 1;
|
|
2439 }
|
747
|
2440
|
629
|
2441 switch(dialog_menu_id)
|
|
2442 {
|
747
|
2443 case HOUSE_DIALOGUE_MAIN:
|
644
|
2444 {
|
|
2445 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
|
629
|
2446 return;
|
648
|
2447
|
870
|
2448 sprintf(pTopic1, "\f%05d", pDialogueWindow->pCurrentPosActiveItem == 2 ? pColorYellow : pColorWhite);
|
648
|
2449 sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[178], pOutString); // Rent room for %d gold
|
870
|
2450 strcat(pTopic1, pTmpBuf2);
|
|
2451 pTopic1Height = pFontArrus->CalcTextHeight(pTopic1, &dialog_window, 0, 0);
|
|
2452 strcat(pTopic1, "\n \n");
|
648
|
2453
|
870
|
2454 sprintf(pTopic2, "\f%05d", pDialogueWindow->pCurrentPosActiveItem == 3 ? pColorYellow : pColorWhite);
|
648
|
2455 sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[86], // Buy food for %d days for %d gold
|
870
|
2456 (unsigned int)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier, v83);
|
|
2457 strcat(pTopic2, pTmpBuf2);
|
|
2458 pTopic2Height = pFontArrus->CalcTextHeight(pTopic2, &dialog_window, 0, 0);
|
|
2459 strcat(pTopic2, "\n \n");
|
648
|
2460
|
870
|
2461 sprintf(pTopic3, "\f%05d", pDialogueWindow->pCurrentPosActiveItem == 4 ? pColorYellow : pColorWhite);
|
|
2462 strcat(pTopic3, pGlobalTXT_LocalizationStrings[160]); // Learn Skills
|
|
2463 pTopic3Height = pFontArrus->CalcTextHeight(pTopic3, &dialog_window, 0, 0);
|
|
2464 strcat(pTopic3, "\n \n");
|
|
2465 pTopic4[0] = 0;
|
690
|
2466 if ( (signed int)window_SpeakInHouse->par1C >= 108 && (signed int)window_SpeakInHouse->par1C <= 120 )
|
644
|
2467 {
|
870
|
2468 sprintf(pTopic4, "\f%05d", pDialogueWindow->pCurrentPosActiveItem == 5 ? pColorYellow : pColorWhite);
|
|
2469 strcat(pTopic4, pGlobalTXT_LocalizationStrings[611]); // Play Arcomage
|
|
2470 pTopic4Height = pFontArrus->CalcTextHeight(pTopic4, &dialog_window, 0, 0);
|
644
|
2471 }
|
662
|
2472 pNumActiveItem = pDialogueWindow->pStartingPosActiveItem;
|
644
|
2473 v36 = LOBYTE(pFontArrus->uFontHeight) - 3;
|
|
2474 v37 = -pDialogueWindow->pNumPresenceButton < 0;
|
662
|
2475 if ( !(v37 ^ pNumActiveItem < pNumActiveItem + pDialogueWindow->pNumPresenceButton) )
|
644
|
2476 {
|
870
|
2477 do
|
629
|
2478 {
|
870
|
2479 pButton = pDialogueWindow->GetControl(pNumActiveItem);
|
|
2480 if ( pButton->msg_param == 15 )
|
|
2481 {
|
|
2482 v46 = pTopic1Height;
|
|
2483 pButton->uHeight = pTopic1Height;
|
|
2484 pButton->uY = 146;
|
|
2485 v41 = v46 + 145;
|
|
2486 pButton->uW = v41;
|
|
2487 }
|
|
2488 else if ( pButton->msg_param == 16 )
|
|
2489 {
|
|
2490 v44 = pTopic2Height;
|
|
2491 v45 = pTopic1Height + v36 + 146;
|
|
2492 pButton->uHeight = pTopic2Height;
|
|
2493 pButton->uY = v45;
|
|
2494 v41 = v45 + v44 - 1;
|
|
2495 pButton->uW = v41;
|
|
2496 }
|
|
2497 else if ( pButton->msg_param == 96 )
|
|
2498 {
|
|
2499 v42 = pTopic1Height + pTopic2Height + 2 * v36 + 146;
|
|
2500 v43 = pTopic3Height;
|
|
2501 pButton->uY = v42;
|
|
2502 pButton->uHeight = v43;
|
|
2503 v41 = v43 + v42 - 1;
|
|
2504 pButton->uW = v41;
|
|
2505 }
|
|
2506 else if ( pButton->msg_param == 101 )
|
|
2507 {
|
|
2508 v39 = pTopic1Height + 3 * v36 + pTopic4Height + pTopic2Height + 146;
|
|
2509 v40 = pTopic4Height;
|
|
2510 pButton->uHeight = pTopic4Height;
|
|
2511 pButton->uY = v39;
|
|
2512 v41 = v39 + v40 - 1;
|
|
2513 pButton->uW = v41;
|
|
2514 }
|
|
2515 pNumActiveItem++;
|
|
2516 if ( pNumActiveItem >= pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem )
|
|
2517 {
|
|
2518 sprintfex(pTmpBuf, "%s%s%s%s", &pTopic1, &pTopic2, &pTopic3, &pTopic4);
|
|
2519 dialog_window.DrawTitleText(pFontArrus, 0, 146, 0, pTmpBuf, 3);
|
|
2520 }
|
644
|
2521 }
|
870
|
2522 while ( pNumActiveItem < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton );
|
644
|
2523 }
|
|
2524 break;
|
|
2525 }
|
854
|
2526 case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_RULES:
|
644
|
2527 {
|
|
2528 pOutString = pFontArrus;
|
|
2529 strcpy(pTmpBuf, pNPCTopics[354].pText);
|
819
|
2530 dialog_window.uFrameWidth = game_viewport_width;
|
644
|
2531 dialog_window.uFrameZ = 452;
|
|
2532 pTextHeight = pFontArrus->CalcTextHeight(pTmpBuf, &dialog_window, 12, 0) + 7;
|
|
2533 if ( 352 - pTextHeight < 8 )
|
|
2534 {
|
|
2535 pOutString = pFontCreate;
|
|
2536 pTextHeight = pFontCreate->CalcTextHeight(pTmpBuf, &dialog_window, 12, 0) + 7;
|
|
2537 }
|
948
|
2538 auto pTex = pIcons_LOD->GetTexture(uTextureID_Leather);
|
|
2539 pRenderer->_4A6A68(8, 352 - pTextHeight, pTex, pTex->uTextureHeight - pTextHeight);
|
644
|
2540 pRenderer->DrawTextureIndexed(8, 347 - pTextHeight, pTexture_591428);
|
|
2541 v63 = FitTextInAWindow(pTmpBuf, pOutString, &dialog_window, 0xCu, 0);
|
|
2542 window_SpeakInHouse->DrawText(pOutString, 12, 354 - pTextHeight, 0, v63, 0, 0, 0);
|
|
2543 break;
|
|
2544 }
|
854
|
2545 case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_VICTORY_CONDITIONS:
|
644
|
2546 {
|
|
2547 strcpy(pTmpBuf, pNPCTopics[(uint)window_SpeakInHouse->ptr_1C + 247].pText);
|
819
|
2548 dialog_window.uFrameWidth = game_viewport_width;
|
644
|
2549 dialog_window.uFrameZ = 452;
|
|
2550 v61 = pFontArrus->CalcTextHeight(pTmpBuf, &dialog_window, 12, 0);
|
|
2551 pTextHeight = v61 + 7;
|
948
|
2552 auto pTex = pIcons_LOD->GetTexture(uTextureID_Leather);
|
|
2553 pRenderer->_4A6A68(8, 352 - (v61 + 7), pTex, pTex->uTextureHeight - (v61 + 7));
|
644
|
2554 pRenderer->DrawTextureIndexed(8, 347 - pTextHeight, pTexture_591428);
|
|
2555 v63 = FitTextInAWindow(pTmpBuf, pFontArrus, &dialog_window, 0xCu, 0);
|
|
2556 window_SpeakInHouse->DrawText(pFontArrus, 12, 354 - pTextHeight, 0, v63, 0, 0, 0);
|
|
2557 break;
|
|
2558 }
|
747
|
2559 case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_RESULT:
|
644
|
2560 {
|
|
2561 if ( pArcomageGame->bGameInProgress == 1 )
|
|
2562 return;
|
|
2563 if ( pArcomageGame->uGameResult )
|
|
2564 {
|
|
2565 if ( pArcomageGame->uGameResult == 1 )
|
|
2566 v72 = pGlobalTXT_LocalizationStrings[640];// You won!
|
|
2567 else
|
|
2568 v72 = pGlobalTXT_LocalizationStrings[641];// You lost!
|
|
2569 }
|
|
2570 else
|
|
2571 {
|
|
2572 v72 = pGlobalTXT_LocalizationStrings[639];// A tie!
|
|
2573 }
|
|
2574 strcpy(pTmpBuf, v72);
|
|
2575 v66 = (174 - pFontArrus->CalcTextHeight(pTmpBuf, &dialog_window, 0, 0)) / 2 + 138;
|
|
2576 dialog_window.DrawTitleText(pFontArrus, 0, v66, pColorYellow, pTmpBuf, 3);
|
|
2577 break;
|
|
2578 }
|
747
|
2579 case HOUSE_DIALOGUE_TAVERN_REST:
|
644
|
2580 {
|
|
2581 if ( pParty->uNumGold >= (unsigned int)pOutString )
|
|
2582 {
|
|
2583 Party::TakeGold((unsigned int)pOutString);
|
907
|
2584 v27 = (int)window_SpeakInHouse->ptr_1C;//107
|
758
|
2585 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful);
|
747
|
2586 dialog_menu_id = HOUSE_DIALOGUE_NULL;
|
644
|
2587 sub_4BD8B5();
|
|
2588 sub_4B1D27();
|
|
2589 pVideoPlayer->Unload();
|
|
2590 window_SpeakInHouse->Release();
|
|
2591 window_SpeakInHouse = 0;
|
|
2592 if ( pMessageQueue_50CBD0->uNumMessages )
|
|
2593 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
|
907
|
2594 pMessageQueue_50CBD0->pMessages[0].eType = UIMSG_RentRoom;
|
644
|
2595 pMessageQueue_50CBD0->pMessages[0].param = v27;
|
|
2596 pMessageQueue_50CBD0->pMessages[0].field_8 = 1;
|
|
2597 ++pMessageQueue_50CBD0->uNumMessages;
|
|
2598 return;
|
|
2599 }
|
|
2600 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);
|
736
|
2601 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_Goodbye);
|
644
|
2602 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, v5, 0);
|
|
2603 break;
|
|
2604 }
|
747
|
2605
|
|
2606 case HOUSE_DIALOGUE_LEARN_SKILLS:
|
644
|
2607 {
|
|
2608 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
|
|
2609 return;
|
|
2610 v0 = 0;
|
|
2611 v9 = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0);
|
|
2612 pItemNum = v9 * (100 - pPlayer->GetMerchant()) / 100;
|
|
2613 if ( pItemNum < v9 / 3 )
|
|
2614 pItemNum = v9 / 3;
|
|
2615 pNumActiveItem = pDialogueWindow->pStartingPosActiveItem;
|
|
2616 all_text_height = 0;
|
|
2617 if ( pNumActiveItem < pNumActiveItem + pDialogueWindow->pNumPresenceButton )
|
|
2618 {
|
|
2619 do
|
629
|
2620 {
|
832
|
2621 v12 = pDialogueWindow->GetControl(pNumActiveItem)->msg_param - 36;
|
644
|
2622 if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayer->classType][v12] && !pPlayer->pActiveSkills[v12] )
|
|
2623 {
|
|
2624 all_text_height = pFontArrus->CalcTextHeight(pSkillNames[v12], &dialog_window, 0, 0);
|
|
2625 v0++;
|
|
2626 }
|
|
2627 ++pNumActiveItem;
|
|
2628 }
|
|
2629 while ( pNumActiveItem < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton );
|
|
2630 if ( v0 )
|
|
2631 {
|
|
2632 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], pItemNum);
|
|
2633 dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3);
|
|
2634 v91 = (149 - all_text_height) / v0;
|
|
2635 if ( (149 - all_text_height) / v0 > 32 )
|
|
2636 v91 = 32;
|
|
2637 v14 = (149 - v0 * v91 - all_text_height) / 2 - v91 / 2 + 162;
|
|
2638 pNumActiveItem = pDialogueWindow->pStartingPosActiveItem;
|
|
2639 if ( pNumActiveItem < pNumActiveItem + pDialogueWindow->pNumPresenceButton )
|
|
2640 {
|
|
2641 pItemNum = 2;
|
|
2642 do
|
|
2643 {
|
|
2644 pButton = pDialogueWindow->GetControl(pItemNum);
|
832
|
2645 v17 = pButton->msg_param - 36;
|
644
|
2646 if ( !byte_4ED970_skill_learn_ability_by_class_table[pPlayer->classType][v17] || pPlayer->pActiveSkills[v17] )
|
|
2647 {
|
|
2648 pButton->uW = 0;
|
|
2649 pButton->uHeight = 0;
|
|
2650 pButton->uY = 0;
|
|
2651 }
|
|
2652 else
|
|
2653 {
|
|
2654 pButton->uY = v91 + v14;
|
|
2655 pTextHeight = pFontArrus->CalcTextHeight(pSkillNames[v17], &dialog_window, 0, 0);
|
|
2656 pButton->uHeight = pTextHeight;
|
|
2657 v14 = pTextHeight + pButton->uY - 1;
|
|
2658 pButton->uW = v14;
|
|
2659 pColorText = pColorYellow;
|
|
2660 if ( pDialogueWindow->pCurrentPosActiveItem != pItemNum )
|
|
2661 pColorText = pColorWhite;
|
|
2662 dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, pSkillNames[v17], 3);
|
|
2663 }
|
|
2664 pNumActiveItem = pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton;
|
|
2665 pItemNum++;
|
|
2666 }
|
|
2667 while ( pItemNum < pNumActiveItem );
|
|
2668 }
|
629
|
2669 return;
|
|
2670 }
|
644
|
2671 }
|
|
2672 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], pPlayer->pName, pClassNames[pPlayer->classType]);
|
|
2673 strcat(pTmpBuf, "\n \n");
|
|
2674 strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]);
|
|
2675 pTextHeight = (174 - pFontArrus->CalcTextHeight(pTmpBuf, &dialog_window, 0, 0)) / 2 + 138;
|
|
2676 dialog_window.DrawTitleText(pFontArrus, 0, pTextHeight, pColorYellow, pTmpBuf, 3);
|
|
2677 return;
|
|
2678 }
|
747
|
2679
|
|
2680 case HOUSE_DIALOGUE_TAVERN_BUY_FOOD:
|
644
|
2681 {
|
|
2682 *(_QWORD *)Str = pParty->uNumFoodRations;
|
|
2683 //if ( (double)pParty->uNumFoodRations >= p2DEvents_minus1__20[13 * (unsigned int)ptr_507BC0->ptr_1C] )
|
|
2684 if ( (double)pParty->uNumFoodRations >= p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier )
|
|
2685 {
|
|
2686 ShowStatusBarString(pGlobalTXT_LocalizationStrings[140], 2);
|
|
2687 if ( uActiveCharacter )
|
|
2688 pPlayers[uActiveCharacter]->PlaySound(SPEECH_67, 0);
|
629
|
2689 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, v5, 0);
|
644
|
2690 return;
|
|
2691 }
|
|
2692 if ( pParty->uNumGold >= v7 )
|
|
2693 {
|
|
2694 Party::TakeGold(v7);
|
|
2695 //pParty->uNumFoodRations = (signed __int64)p2DEvents_minus1__20[13 * (unsigned int)ptr_507BC0->ptr_1C];
|
|
2696 pParty->uNumFoodRations = (signed __int64)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier;
|
735
|
2697 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_Greeting_2);
|
644
|
2698 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
|
|
2699 return;
|
|
2700 }
|
735
|
2701 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2); // "You don't have enough gold"
|
736
|
2702 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_Goodbye);
|
644
|
2703 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, v5, 0);
|
|
2704 break;
|
|
2705 }
|
747
|
2706
|
|
2707 case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_MAIN:
|
644
|
2708 {
|
|
2709 if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
|
|
2710 {
|
|
2711 v48 = 2;
|
|
2712 pShopOptions[0] = pGlobalTXT_LocalizationStrings[620];
|
|
2713 pShopOptions[1] = pGlobalTXT_LocalizationStrings[622];
|
|
2714 pOutString = 0;
|
|
2715 if ( pParty->HasItem(0x28Bu) )
|
|
2716 {
|
|
2717 pShopOptions[2] = pGlobalTXT_LocalizationStrings[621];
|
|
2718 v48 = 3;
|
|
2719 }
|
|
2720 for ( i = 0; i < v48; ++i )
|
|
2721 all_text_height = pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0);
|
|
2722 all_text_height = (174 - all_text_height) / v48;
|
|
2723 pNumActiveItem = pDialogueWindow->pStartingPosActiveItem;
|
|
2724 v54 = (174 - v48 * (174 - all_text_height) / v48 - all_text_height) / 2 - (174 - all_text_height) / v48 / 2 + 138;
|
|
2725 v37 = -pDialogueWindow->pNumPresenceButton < 0;
|
854
|
2726 if ( pNumActiveItem < pNumActiveItem + pDialogueWindow->pNumPresenceButton )
|
644
|
2727 {
|
|
2728 pItemNum = 2;
|
|
2729 pNumString = 0;
|
|
2730 do
|
|
2731 {
|
|
2732 pButton = pDialogueWindow->GetControl(pItemNum);
|
|
2733 pButton->uY = all_text_height + v54;
|
|
2734 pTextHeight = pFontArrus->CalcTextHeight((const char *)pShopOptions[pNumString], &dialog_window, 0, 0);
|
|
2735 pButton->uHeight = pTextHeight;
|
|
2736 v54 = pButton->uY + pTextHeight - 1;
|
|
2737 pButton->uW = v54;
|
|
2738 pColorText = pColorYellow;
|
|
2739 if ( pDialogueWindow->pCurrentPosActiveItem != pItemNum )
|
|
2740 pColorText = pColorWhite;
|
854
|
2741 dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, (const char *)pShopOptions[pNumString], 3);
|
644
|
2742 pItemNum++;
|
854
|
2743 ++pNumString;
|
644
|
2744 pNumActiveItem = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem;
|
|
2745 }
|
|
2746 while ( pItemNum < pNumActiveItem );
|
|
2747 }
|
|
2748 }
|
|
2749 break;
|
|
2750 }
|
|
2751 default:
|
|
2752 {
|
|
2753 break;
|
|
2754 }
|
629
|
2755 }
|
|
2756 }
|
|
2757
|
|
2758
|
|
2759 //----- (004B910F) --------------------------------------------------------
|
|
2760 void __cdecl WeaponShopDialog()
|
|
2761 {
|
634
|
2762 int v0; // ebx@1
|
629
|
2763 int pNumActiveItem; // eax@6
|
|
2764 signed int v2; // esi@8
|
|
2765 ItemGen *v4; // eax@11
|
|
2766 char *v5; // ecx@12
|
|
2767 unsigned __int8 v6; // dl@13
|
|
2768 char *v7; // edx@14
|
|
2769 int v9; // ST08_4@16
|
|
2770 int v10; // eax@16
|
|
2771 signed int v11; // esi@18
|
|
2772 int v12; // ST08_4@21
|
|
2773 int v13; // eax@21
|
|
2774 int v14; // edi@23
|
|
2775 char **v15; // esi@23
|
|
2776 int v16; // eax@24
|
644
|
2777 //int v18; // edx@25
|
629
|
2778 int v19; // edi@25
|
|
2779 unsigned __int8 v20; // sf@25
|
|
2780 GUIButton *pButton; // esi@27
|
|
2781 int pNewItem; // eax@27
|
|
2782 unsigned int v24; // ecx@27
|
|
2783 int v25; // edx@27
|
644
|
2784 unsigned int pColorText; // ax@27
|
629
|
2785 signed int v27; // esi@32
|
|
2786 int v28; // ST08_4@36
|
|
2787 int v29; // eax@36
|
|
2788 signed int v32; // esi@41
|
|
2789 unsigned int v33; // esi@43
|
|
2790 int v34; // eax@43
|
|
2791 unsigned int v35; // eax@44
|
|
2792 int v36; // eax@46
|
|
2793 __int32 v37; // ecx@51
|
|
2794 int v40; // eax@53
|
|
2795 char *v41; // eax@55
|
|
2796 unsigned int v43; // ecx@55
|
|
2797 const char **v44; // edx@55
|
|
2798 int v45; // eax@55
|
|
2799 int v47; // eax@59
|
|
2800 const char **v48; // eax@63
|
|
2801 unsigned int v49; // esi@65
|
|
2802 Texture *v50; // eax@65
|
|
2803 int v51; // edi@65
|
|
2804 int v52; // esi@70
|
|
2805 Texture *v53; // ST1C_4@70
|
|
2806 int v54; // edi@70
|
|
2807 signed int v55; // ecx@73
|
|
2808 SHORT v56; // di@82
|
|
2809 bool v57; // eax@82
|
|
2810 const char *v58; // ecx@84
|
|
2811 POINT *v59; // esi@89
|
|
2812 LONG v60; // ecx@90
|
|
2813 int v61; // eax@90
|
|
2814 int v62; // ecx@90
|
917
|
2815 ItemGen *pItemInShop; // esi@90
|
629
|
2816 int v64; // eax@95
|
|
2817 int all_text_height; // esi@96
|
|
2818 char **v66; // edi@96
|
|
2819 int v67; // eax@97
|
|
2820 int v69; // edx@98
|
|
2821 int v70; // edi@98
|
634
|
2822 int v71;
|
629
|
2823 const char **v72; // eax@100
|
|
2824 int pTextHeight; // eax@100
|
|
2825 unsigned int v74; // ecx@100
|
|
2826 int v78; // [sp-14h] [bp-10Ch]@14
|
|
2827 ItemGen *v79; // [sp-10h] [bp-108h]@12
|
|
2828 int v80; // [sp-10h] [bp-108h]@14
|
|
2829 void *v81; // [sp-Ch] [bp-104h]@12
|
|
2830 unsigned __int16 v82; // [sp-Ch] [bp-104h]@14
|
|
2831 int v83; // [sp-8h] [bp-100h]@11
|
|
2832 char *v84; // [sp-8h] [bp-100h]@14
|
|
2833 __int64 *v85; // [sp-4h] [bp-FCh]@11
|
|
2834 unsigned int v86; // [sp-4h] [bp-FCh]@14
|
|
2835 POINT v87; // [sp+Ch] [bp-ECh]@8
|
|
2836 POINT v88; // [sp+14h] [bp-E4h]@18
|
|
2837 POINT v89; // [sp+1Ch] [bp-DCh]@89
|
|
2838 POINT v90; // [sp+24h] [bp-D4h]@19
|
|
2839 POINT v91; // [sp+2Ch] [bp-CCh]@89
|
|
2840 POINT v92; // [sp+34h] [bp-C4h]@9
|
|
2841 POINT v93; // [sp+3Ch] [bp-BCh]@33
|
|
2842 POINT v94; // [sp+44h] [bp-B4h]@18
|
|
2843 POINT v95; // [sp+4Ch] [bp-ACh]@32
|
|
2844 POINT v96; // [sp+54h] [bp-A4h]@18
|
|
2845 POINT v97; // [sp+5Ch] [bp-9Ch]@32
|
|
2846 POINT a2; // [sp+64h] [bp-94h]@8
|
|
2847 POINT v99; // [sp+6Ch] [bp-8Ch]@32
|
|
2848 POINT v100; // [sp+74h] [bp-84h]@8
|
|
2849 GUIWindow dialog_window; // [sp+7Ch] [bp-7Ch]@1
|
|
2850 char *Str; // [sp+D0h] [bp-28h]@55
|
|
2851 __int32 v103; // [sp+D4h] [bp-24h]@25
|
644
|
2852 int pColorYellow; // [sp+D8h] [bp-20h]@1
|
629
|
2853 int pColorWhite; // [sp+DCh] [bp-1Ch]@1
|
|
2854 POINT v106; // [sp+E0h] [bp-18h]@8
|
|
2855 Player *pPlayer; // [sp+E8h] [bp-10h]@1
|
|
2856 int pItemNum; // [sp+ECh] [bp-Ch]@26
|
|
2857 const char **v109; // [sp+F0h] [bp-8h]@26
|
|
2858 unsigned __int8 v110; // [sp+F7h] [bp-1h]@16
|
|
2859 int pNumString;
|
|
2860
|
|
2861 pPlayer = pPlayers[uActiveCharacter];
|
|
2862 memcpy(&dialog_window, window_SpeakInHouse, sizeof(dialog_window));
|
|
2863 dialog_window.uFrameX = 483;
|
|
2864 dialog_window.uFrameWidth = 148;
|
|
2865 dialog_window.uFrameZ = 334;
|
949
|
2866 pColorWhite = TargetColor(0xFFu, 0xFFu, 0xFFu);
|
|
2867 pColorYellow = TargetColor(0xE1u, 0xCDu, 0x23u);
|
747
|
2868
|
629
|
2869 switch(dialog_menu_id)
|
|
2870 {
|
747
|
2871 case HOUSE_DIALOGUE_MAIN:
|
629
|
2872 {
|
|
2873 pNumActiveItem = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win();
|
|
2874 if ( pNumActiveItem )
|
|
2875 {
|
|
2876 pShopOptions[0] = pGlobalTXT_LocalizationStrings[134];
|
|
2877 pShopOptions[1] = pGlobalTXT_LocalizationStrings[152];
|
|
2878 pShopOptions[2] = pGlobalTXT_LocalizationStrings[159];
|
|
2879 pShopOptions[3] = pGlobalTXT_LocalizationStrings[160];
|
|
2880 all_text_height = 0;
|
|
2881 for (int i = 0; i < 4; ++i)//while ( (signed int)v15 < (signed int)&unk_F8B1C8 );
|
|
2882 all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0);
|
|
2883 v103 = (174 - all_text_height) / 4;
|
|
2884 pNumActiveItem = pDialogueWindow->pStartingPosActiveItem;
|
|
2885 v19 = (174 - 4 * (174 - all_text_height) / 4 - all_text_height) / 2 - (174 - all_text_height) / 4 / 2 + 138;
|
|
2886 v20 = -pDialogueWindow->pNumPresenceButton < 0;
|
644
|
2887 if ( v20 ^ pNumActiveItem > pNumActiveItem + pDialogueWindow->pNumPresenceButton )
|
629
|
2888 {
|
|
2889 pItemNum = 2;
|
|
2890 pNumString = 0;
|
|
2891 do
|
|
2892 {
|
|
2893 pButton = pDialogueWindow->GetControl(pItemNum);
|
|
2894 pButton->uY = v103 + v19;
|
|
2895 pTextHeight = pFontArrus->CalcTextHeight((const char *)pShopOptions[pNumString], &dialog_window, 0, 0);
|
|
2896 pButton->uHeight = pTextHeight;
|
|
2897 v19 = pButton->uY + pTextHeight - 1;
|
|
2898 pButton->uW = v19;
|
644
|
2899 pColorText = pColorYellow;
|
629
|
2900 if ( pDialogueWindow->pCurrentPosActiveItem != pItemNum )
|
644
|
2901 pColorText = pColorWhite;
|
|
2902 dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, (const char *)pShopOptions[pNumString], 3);
|
629
|
2903 ++pItemNum;
|
|
2904 ++pNumString;
|
|
2905 pNumActiveItem = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem;
|
|
2906 }
|
|
2907 while ( pItemNum < pNumActiveItem );
|
|
2908 }
|
|
2909 }
|
|
2910 break;
|
|
2911 }
|
747
|
2912
|
|
2913 case HOUSE_DIALOGUE_SHOP_BUY_STANDARD:
|
629
|
2914 {
|
|
2915 pRenderer->DrawTextureIndexed(8, 8, ShopTexture);
|
|
2916 v48 = 0;
|
|
2917 pItemNum = 0;
|
|
2918 v109 = 0;
|
|
2919 do
|
|
2920 {
|
|
2921 // if ( pParty->field_777C[9 * (int)&v48[3 * (unsigned int)window_SpeakInHouse->ptr_1C]] )
|
668
|
2922 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][(int)v48].uItemID)
|
629
|
2923 {
|
|
2924 v49 = word_F8B158[(signed int)v48];
|
|
2925 v50 = ItemsInShopTexture[(signed int)v48];
|
|
2926 v49 += 30;
|
|
2927 v51 = 60 - ((signed int)v50->uTextureWidth >> 1);
|
|
2928 pRenderer->DrawTextureTransparent(v51 + pItemNum, v49, v50);
|
|
2929 sub_40F92A(&pRenderer->pActiveZBuffer[v51 + pItemNum + 640 * v49], ItemsInShopTexture[(signed int)v109], (int)((char *)v109 + 1));
|
|
2930 v48 = v109;
|
|
2931 }
|
|
2932 pItemNum += 70;
|
|
2933 v48 = (const char **)((char *)v48 + 1);
|
|
2934 v109 = v48;
|
|
2935 }
|
|
2936 while ( (signed int)v48 < 6 );
|
|
2937 pNumActiveItem = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win();
|
|
2938 if ( pNumActiveItem )
|
|
2939 {
|
|
2940 v55 = 0;
|
|
2941 v106.x = 0;
|
|
2942 v106.x = 0;
|
|
2943 do
|
|
2944 {
|
757
|
2945 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v55].uItemID)//9 * (v55 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] )
|
629
|
2946 ++v106.x;
|
|
2947 ++v55;
|
|
2948 }
|
|
2949 while ( v55 < 6 );
|
|
2950 v56 = GetAsyncKeyState(17);
|
|
2951 v57 = pPlayer->CanSteal();
|
|
2952 Str = (char *)v57;
|
|
2953 if ( v56 && v57 )
|
|
2954 {
|
|
2955 v58 = pGlobalTXT_LocalizationStrings[185];
|
|
2956 }
|
|
2957 else
|
|
2958 {
|
|
2959 v58 = pGlobalTXT_LocalizationStrings[195];
|
749
|
2960 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD)
|
629
|
2961 v58 = pGlobalTXT_LocalizationStrings[196];
|
|
2962 }
|
|
2963 DrawTextAtStatusBar(v58, 0);
|
|
2964 if ( v106.x )
|
|
2965 {
|
|
2966 v59 = pMouse->GetCursorPos(&v91);
|
|
2967 pNumActiveItem = v59->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v89)->y];
|
|
2968 if ( pRenderer->pActiveZBuffer[pNumActiveItem] & 0xFFFF )
|
|
2969 {
|
|
2970 v60 = (pRenderer->pActiveZBuffer[pNumActiveItem] & 0xFFFF) - 1;
|
|
2971 v106.x = v60;
|
917
|
2972 v61 = (int)window_SpeakInHouse->ptr_1C;//maybe ptr_1C - BuildID_2Events
|
629
|
2973 // v62 = 9 * (v60 + 12 * v61);
|
917
|
2974 pItemInShop = (ItemGen *)&pParty->StandartItemsInShops[(int)v61][v60];
|
749
|
2975 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD)
|
917
|
2976 pItemInShop = &pParty->SpecialItemsInShops[(int)v61][v60];
|
629
|
2977 if ( !v56 || !Str )
|
|
2978 {
|
917
|
2979 v64 = pPlayer->SelectPhrasesTransaction(pItemInShop, BildingType_WeaponShop, v61, 2);
|
|
2980 v7 = BuilDialogueString((char *)pMerchantsBuyPhrases[v64], uActiveCharacter - 1, pItemInShop, (char *)window_SpeakInHouse->ptr_1C, 2, 0);
|
634
|
2981 pTextHeight = pFontArrus->CalcTextHeight(v7, &dialog_window, 0, 0);
|
|
2982 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, pColorWhite, v7, 3);
|
629
|
2983 }
|
|
2984 else
|
|
2985 {
|
917
|
2986 v7 = BuilDialogueString(pGlobalTXT_LocalizationStrings[181], uActiveCharacter - 1, pItemInShop, (char *)window_SpeakInHouse->ptr_1C, 2, 0);
|
|
2987 pTextHeight = pFontArrus->CalcTextHeight(v7, &dialog_window, 0, 0);
|
|
2988 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, pColorWhite, v7, 3);
|
629
|
2989 }
|
|
2990 }
|
|
2991 }
|
|
2992 else
|
|
2993 {
|
|
2994 dialog_window.DrawCurrentTime( pParty->field_3C.field_50[(unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed);
|
|
2995 pNumActiveItem = 0; //added
|
|
2996 }
|
|
2997 }
|
|
2998 break;
|
|
2999 }
|
747
|
3000
|
|
3001 case HOUSE_DIALOGUE_SHOP_SELL:
|
629
|
3002 {
|
|
3003 draw_leather();
|
984
|
3004 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true);
|
629
|
3005 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[199], 0);
|
|
3006 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
|
|
3007 return;
|
|
3008 if((v11 = pMouse->GetCursorPos(&v96)->x - 14, v106.x = (v11 >> 5) + 14 * ((pMouse->GetCursorPos(&v88)->y - 17) >> 5),
|
|
3009 pMouse->GetCursorPos(&v94)->x <= 13) || pMouse->GetCursorPos(&v90)->x >= 462
|
634
|
3010 || (pNumActiveItem = pPlayer->GetItemIDAtInventoryIndex((int *)&v106.x), !pNumActiveItem) )
|
629
|
3011 return;
|
|
3012 v79 = (ItemGen *)&pPlayer->pInventoryItems[pNumActiveItem - 1];
|
917
|
3013 v13 = pPlayer->SelectPhrasesTransaction(v79, BildingType_WeaponShop, (int)window_SpeakInHouse->ptr_1C, 3);
|
629
|
3014 v7 = BuilDialogueString((char *)pMerchantsSellPhrases[v13], uActiveCharacter - 1, v79, (char *)window_SpeakInHouse->ptr_1C, 3, 0);
|
634
|
3015 pTextHeight = pFontArrus->CalcTextHeight(v7, &dialog_window, 0, 0);
|
|
3016 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, pColorWhite, v7, 3);
|
629
|
3017 break;
|
|
3018 }
|
747
|
3019
|
|
3020 case HOUSE_DIALOGUE_SHOP_IDENTIFY:
|
629
|
3021 {
|
|
3022 draw_leather();
|
984
|
3023 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true);
|
629
|
3024 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[197], 0);
|
|
3025 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
|
|
3026 return;
|
|
3027 if((v2 = pMouse->GetCursorPos(&a2)->x - 14, v106.x = (v2 >> 5) + 14 * ((pMouse->GetCursorPos(&v87)->y - 17) >> 5),
|
|
3028 pMouse->GetCursorPos(&v100)->x <= 13) || pMouse->GetCursorPos(&v92)->x >= 462
|
634
|
3029 || (pNumActiveItem = pPlayer->GetItemIDAtInventoryIndex((int *)&v106.x), !pNumActiveItem) )
|
629
|
3030 return;
|
|
3031 v4 = (ItemGen *)&pPlayer->pInventoryItems[pNumActiveItem - 1];
|
|
3032 if (!v4->Identified())
|
|
3033 {
|
917
|
3034 v10 = pPlayer->SelectPhrasesTransaction(v4, BildingType_WeaponShop, (int)window_SpeakInHouse->ptr_1C, 4);
|
629
|
3035 v7 = BuilDialogueString((char *)pMerchantsIdentifyPhrases[v10], uActiveCharacter - 1, v4, (char *)window_SpeakInHouse->ptr_1C, 4, 0);
|
634
|
3036 pTextHeight = pFontArrus->CalcTextHeight(v7, &dialog_window, 0, 0);
|
|
3037 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, pColorWhite, v7, 3);
|
629
|
3038 }
|
634
|
3039 else
|
|
3040 {
|
|
3041 v7 = BuilDialogueString("%24", uActiveCharacter - 1, v4, (char *)window_SpeakInHouse->ptr_1C, 4, 0);
|
|
3042 pTextHeight = pFontArrus->CalcTextHeight(v7, &dialog_window, 0, 0);
|
|
3043 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, pColorWhite, v7, 3);
|
|
3044 }
|
629
|
3045 break;
|
|
3046 }
|
747
|
3047
|
|
3048 case HOUSE_DIALOGUE_SHOP_REPAIR:
|
629
|
3049 {
|
|
3050 draw_leather();
|
984
|
3051 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true);
|
629
|
3052 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[198], 0);
|
|
3053 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win())
|
|
3054 return;
|
|
3055 if( (v2 = pMouse->GetCursorPos(&a2)->x - 14, v106.x = (v2 >> 5) + 14 * ((pMouse->GetCursorPos(&v87)->y - 17) >> 5),
|
|
3056 pMouse->GetCursorPos(&v100)->x <= 13) || pMouse->GetCursorPos(&v92)->x >= 462
|
634
|
3057 || (pNumActiveItem = pPlayer->GetItemIDAtInventoryIndex((int *)&v106.x), !pNumActiveItem)
|
1019
|
3058 || (!(pPlayer->pOwnItems[pNumActiveItem-1].uAttributes& 2)) )
|
629
|
3059 return;
|
|
3060 v4 = (ItemGen *)&pPlayer->pInventoryItems[pNumActiveItem - 1];
|
917
|
3061 v10 = pPlayer->SelectPhrasesTransaction(v4, BildingType_ArmorShop, (int)window_SpeakInHouse->ptr_1C, 5);
|
629
|
3062 v7 = BuilDialogueString((char *)pMerchantsRepairPhrases[v10], uActiveCharacter - 1, v4, (char *)window_SpeakInHouse->ptr_1C, 5, 0);
|
|
3063 pTextHeight = (174 - pFontArrus->CalcTextHeight(v7, &dialog_window, 0, 0)) / 2 + 138;
|
|
3064 dialog_window.DrawTitleText(pFontArrus, 0, pTextHeight, pColorWhite, v7, 3);
|
|
3065 return;
|
|
3066 }
|
|
3067 break;
|
747
|
3068
|
|
3069 case HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT:
|
629
|
3070 {
|
|
3071 draw_leather();
|
984
|
3072 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true);
|
629
|
3073 pShopOptions[0] = pGlobalTXT_LocalizationStrings[200];//sell
|
|
3074 pShopOptions[1] = pGlobalTXT_LocalizationStrings[113];//identify
|
|
3075 pShopOptions[2] = pGlobalTXT_LocalizationStrings[179];//repair
|
|
3076 all_text_height = 0;
|
|
3077 for ( int i = 0; i < 3; ++i )
|
|
3078 all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0);
|
|
3079 v103 = (174 - all_text_height) / 3;
|
|
3080 pNumActiveItem = pDialogueWindow->pStartingPosActiveItem;
|
|
3081 v70 = (3 * (58 - (signed int)v103) - all_text_height) / 2 - ((174 - all_text_height) / 3) / 2 + 138;
|
|
3082 v20 = -pDialogueWindow->pNumPresenceButton < 0;
|
644
|
3083 if ( v20 ^ pNumActiveItem > pNumActiveItem + pDialogueWindow->pNumPresenceButton )
|
629
|
3084 {
|
|
3085 pItemNum = 2;
|
|
3086 pNumString = 0;
|
|
3087 do
|
|
3088 {
|
|
3089 pButton = pDialogueWindow->GetControl(pItemNum);
|
|
3090 pButton->uY = v103 + v70;
|
|
3091 pTextHeight = pFontArrus->CalcTextHeight((const char *)pShopOptions[pNumString], &dialog_window, 0, 0);
|
|
3092 pButton->uHeight = pTextHeight;
|
|
3093 v70 = pButton->uY + pTextHeight - 1;
|
|
3094 pButton->uW = v70;
|
644
|
3095 pColorText = pColorYellow;
|
629
|
3096 if ( pDialogueWindow->pCurrentPosActiveItem != pItemNum )
|
644
|
3097 pColorText = pColorWhite;
|
|
3098 dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, (const char *)pShopOptions[pNumString], 3);
|
629
|
3099 ++pItemNum;
|
|
3100 ++pNumString;
|
|
3101 pNumActiveItem = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem;
|
|
3102 }
|
|
3103 while ( pItemNum < pNumActiveItem );
|
|
3104 }
|
|
3105 break;
|
|
3106 }
|
747
|
3107
|
|
3108 case HOUSE_DIALOGUE_SHOP_BUY_SPECIAL:
|
629
|
3109 {
|
|
3110 pRenderer->DrawTextureIndexed(8, 8, ShopTexture);
|
|
3111 v109 = 0;
|
|
3112 pItemNum = 0;
|
|
3113 do
|
|
3114 {
|
|
3115 // if ( pParty->field_C59C[9 * (int)&v109[3 * (unsigned int)window_SpeakInHouse->ptr_1C] + 724] )
|
|
3116 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][(signed int)v109].uItemID)
|
|
3117 {
|
|
3118 v52 = word_F8B158[(signed int)v109] + 30;
|
|
3119 v53 = ItemsInShopTexture[(signed int)v109];
|
|
3120 v54 = 60 - ((signed int)v53->uTextureWidth >> 1);
|
|
3121 pRenderer->DrawTextureTransparent(v54 + pItemNum, word_F8B158[(signed int)v109] + 30, v53);
|
|
3122 sub_40F92A(&pRenderer->pActiveZBuffer[v54 + pItemNum + 640 * v52], ItemsInShopTexture[(signed int)v109], (int)((char *)v109 + 1));
|
|
3123 }
|
|
3124 v109 = (const char **)((char *)v109 + 1);
|
|
3125 pItemNum += 70;
|
|
3126 }
|
|
3127 while ( (signed int)v109 < 6 );
|
|
3128 pNumActiveItem = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win();
|
|
3129 if ( pNumActiveItem )
|
|
3130 {
|
|
3131 v55 = 0;
|
|
3132 v106.x = 0;
|
|
3133 do
|
|
3134 {
|
|
3135 // if ( pParty->field_C59C[9 * (v55 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] )
|
|
3136 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v55].uItemID)
|
|
3137 ++v106.x;
|
|
3138 ++v55;
|
|
3139 }
|
|
3140 while ( v55 < 6 );
|
|
3141 v56 = GetAsyncKeyState(17);
|
|
3142 v57 = pPlayer->CanSteal();
|
|
3143 Str = (char *)v57;
|
|
3144 if ( v56 && v57 )
|
|
3145 {
|
|
3146 v58 = pGlobalTXT_LocalizationStrings[185];
|
|
3147 }
|
|
3148 else
|
|
3149 {
|
|
3150 v58 = pGlobalTXT_LocalizationStrings[195];
|
749
|
3151 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD)
|
629
|
3152 v58 = pGlobalTXT_LocalizationStrings[196];
|
|
3153 }
|
|
3154 DrawTextAtStatusBar(v58, 0);
|
|
3155 if ( v106.x )
|
|
3156 {
|
|
3157 v59 = pMouse->GetCursorPos(&v91);
|
|
3158 pNumActiveItem = v59->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v89)->y];
|
|
3159 if ( pRenderer->pActiveZBuffer[pNumActiveItem] & 0xFFFF )
|
|
3160 {
|
|
3161 v60 = (pRenderer->pActiveZBuffer[pNumActiveItem] & 0xFFFF) - 1;
|
|
3162 v106.x = v60;
|
|
3163 v61 = (int)window_SpeakInHouse->ptr_1C;
|
|
3164 // v62 = 9 * (v60 + 12 * v61);
|
917
|
3165 pItemInShop = (ItemGen *)&pParty->StandartItemsInShops[(int)v61][v60];
|
749
|
3166 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD)
|
917
|
3167 pItemInShop = &pParty->SpecialItemsInShops[(int)v61][v60];//v63 = (ItemGen *)&pParty->field_C59C[v62 + 724];
|
629
|
3168 if ( !v56 || !Str )
|
|
3169 {
|
917
|
3170 v64 = pPlayer->SelectPhrasesTransaction(pItemInShop, BildingType_WeaponShop, v61, 2);
|
|
3171 v7 = BuilDialogueString((char *)pMerchantsBuyPhrases[v64], uActiveCharacter - 1, pItemInShop, (char *)window_SpeakInHouse->ptr_1C, 2, 0);
|
634
|
3172 pTextHeight = pFontArrus->CalcTextHeight(v7, &dialog_window, 0, 0);
|
|
3173 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, pColorWhite, v7, 3);
|
629
|
3174 }
|
|
3175 else
|
|
3176 {
|
917
|
3177 v7 = BuilDialogueString(pGlobalTXT_LocalizationStrings[181], uActiveCharacter - 1, pItemInShop, (char *)window_SpeakInHouse->ptr_1C, 2, 0);
|
634
|
3178 pTextHeight = pFontArrus->CalcTextHeight(v7, &dialog_window, 0, 0);
|
|
3179 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, pColorWhite, v7, 3);
|
629
|
3180 }
|
|
3181 }
|
|
3182 }
|
|
3183 else
|
|
3184 {
|
|
3185 dialog_window.DrawCurrentTime( pParty->field_3C.field_50[(unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed);
|
|
3186 pNumActiveItem = 0; //added
|
|
3187 }
|
|
3188 }
|
|
3189 break;
|
|
3190 }
|
747
|
3191
|
|
3192 case HOUSE_DIALOGUE_LEARN_SKILLS:
|
629
|
3193 {
|
634
|
3194 if (!sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win())
|
|
3195 return;
|
|
3196 v0 = 0;
|
|
3197 all_text_height = 0;
|
|
3198 //v32 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (signed int)v31] * 500.0);
|
|
3199 v32 = (signed __int64)(p2DEvents[(signed int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0);
|
|
3200 pItemNum = v32 * (100 - pPlayer->GetMerchant()) / 100;
|
|
3201 if ( pItemNum < v32 / 3 )
|
|
3202 pItemNum = v32 / 3;
|
|
3203 pNumActiveItem = pDialogueWindow->pStartingPosActiveItem;
|
|
3204 if ( pNumActiveItem >= pNumActiveItem + pDialogueWindow->pNumPresenceButton )
|
|
3205 {
|
|
3206 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], pPlayer->pName, pClassNames[pPlayer->classType]);
|
|
3207 strcat(pTmpBuf, "\n \n");
|
|
3208 strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]);
|
|
3209 pTextHeight = pFontArrus->CalcTextHeight(pTmpBuf, &dialog_window, 0, 0);
|
644
|
3210 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, pColorYellow, pTmpBuf, 3);
|
634
|
3211 return;
|
|
3212 }
|
|
3213 do
|
629
|
3214 {
|
832
|
3215 v35 = pDialogueWindow->GetControl(pNumActiveItem)->msg_param - 36;
|
634
|
3216 if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayer->classType][v35] && !pPlayer->pActiveSkills[v35] )
|
629
|
3217 {
|
634
|
3218 all_text_height += pFontArrus->CalcTextHeight(pSkillNames[v35], &dialog_window, 0, 0);
|
|
3219 v0++;
|
629
|
3220 }
|
634
|
3221 ++pNumActiveItem;
|
|
3222 }
|
|
3223 while ( pNumActiveItem < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem );
|
|
3224 if ( !v0 )
|
|
3225 {
|
|
3226 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], pPlayer->pName, pClassNames[pPlayer->classType]);
|
|
3227 strcat(pTmpBuf, "\n \n");
|
|
3228 strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]);
|
|
3229 pTextHeight = pFontArrus->CalcTextHeight(pTmpBuf, &dialog_window, 0, 0);
|
644
|
3230 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, pColorYellow, pTmpBuf, 3);
|
634
|
3231 return;
|
|
3232 }
|
|
3233 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], pItemNum);
|
|
3234 dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3);
|
|
3235 v103 = (149 - all_text_height) / v0;
|
|
3236 if ( (149 - all_text_height) / v0 > 32 )
|
|
3237 v103 = 32;
|
|
3238 pNumActiveItem = pDialogueWindow->pStartingPosActiveItem;
|
|
3239 v37 = (149 - v0 * v103 - all_text_height) / 2 - v103 / 2 + 162;
|
|
3240 if ( pNumActiveItem < pNumActiveItem + pDialogueWindow->pNumPresenceButton )
|
|
3241 {
|
|
3242 pItemNum = 2;
|
629
|
3243 do
|
|
3244 {
|
634
|
3245 pButton = pDialogueWindow->GetControl(pItemNum);
|
832
|
3246 v40 = pButton->msg_param - 36;
|
634
|
3247 if ( !byte_4ED970_skill_learn_ability_by_class_table[pPlayer->classType][v40] || pPlayer->pActiveSkills[v40] )
|
629
|
3248 {
|
634
|
3249 pButton->uW = 0;
|
|
3250 pButton->uHeight = 0;
|
|
3251 pButton->uY = 0;
|
629
|
3252 }
|
634
|
3253 else
|
|
3254 {
|
|
3255 pButton->uY = v103 + v37;
|
|
3256 pTextHeight = pFontArrus->CalcTextHeight(pSkillNames[v40], &dialog_window, 0, 0);
|
|
3257 pButton->uHeight = pTextHeight;
|
|
3258 v37 = pButton->uY + pTextHeight - 1;
|
|
3259 pButton->uW = v37;
|
644
|
3260 pColorText = pColorYellow;
|
634
|
3261 if ( pDialogueWindow->pCurrentPosActiveItem != pItemNum )
|
644
|
3262 pColorText = pColorWhite;
|
|
3263 dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, pSkillNames[v40], 3);
|
634
|
3264 }
|
|
3265 pNumActiveItem = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem;
|
|
3266 pItemNum++;
|
629
|
3267 }
|
634
|
3268 while ( pItemNum < pNumActiveItem );
|
629
|
3269 }
|
|
3270 break;
|
|
3271 }
|
|
3272 default:
|
|
3273 {
|
749
|
3274 if( dialog_menu_id > HOUSE_DIALOGUE_SHOP_REPAIR)
|
629
|
3275 pNumActiveItem = dialog_menu_id - 96;
|
|
3276 else
|
|
3277 pNumActiveItem = dialog_menu_id - 4;
|
|
3278 break;
|
|
3279 }
|
|
3280 }
|
|
3281 }
|
|
3282
|
|
3283
|
|
3284
|
|
3285 //----- (004B9CC6) --------------------------------------------------------
|
|
3286 void __cdecl AlchemistDialog()
|
|
3287 {
|
634
|
3288 int v0;
|
|
3289 int pNumActiveItem; // eax@7
|
629
|
3290 signed int v5; // esi@9
|
|
3291 unsigned int v6; // esi@11
|
|
3292 int v7; // eax@11
|
|
3293 unsigned int v8; // eax@12
|
|
3294 int v9; // eax@14
|
|
3295 int v10; // ecx@19
|
|
3296 int v13; // eax@21
|
|
3297 char *v14; // eax@23
|
|
3298 int v15; // eax@23
|
|
3299 unsigned int v16; // ecx@23
|
|
3300 int v17; // edx@23
|
|
3301 int v18; // eax@23
|
|
3302 int v20; // eax@27
|
|
3303 char *v21; // edx@29
|
|
3304 int v22; // esi@30
|
|
3305 char **v23; // edi@30
|
|
3306 int v24; // eax@31
|
|
3307 int v26; // edx@32
|
|
3308 int v27; // edi@32
|
|
3309 unsigned __int8 v28; // sf@32
|
|
3310 const char **v30; // eax@34
|
|
3311 int v31; // eax@34
|
|
3312 unsigned int v32; // ecx@34
|
|
3313 int v34; // eax@34
|
|
3314 signed int v36; // esi@39
|
|
3315 ItemGen *v37; // eax@42
|
|
3316 char *v38; // ecx@43
|
|
3317 unsigned __int8 v39; // dl@44
|
|
3318 int v40; // eax@46
|
|
3319 int v41; // ST08_4@47
|
|
3320 int v42; // eax@47
|
|
3321 signed int v43; // esi@49
|
|
3322 int v44; // ST08_4@52
|
|
3323 int v45; // eax@52
|
|
3324 Texture *v46; // ecx@55
|
|
3325 unsigned int v47; // edi@55
|
|
3326 unsigned int v48; // esi@57
|
|
3327 int v49; // edx@61
|
|
3328 Texture *v50; // ecx@67
|
|
3329 unsigned int v51; // edi@67
|
|
3330 unsigned int v52; // esi@69
|
|
3331 int v53; // edx@73
|
|
3332 Texture *v54; // ecx@79
|
|
3333 unsigned int v55; // edi@79
|
|
3334 unsigned int v56; // esi@81
|
|
3335 int v57; // edx@85
|
|
3336 Texture *v58; // ecx@91
|
|
3337 unsigned int v59; // edi@91
|
|
3338 unsigned int v60; // esi@93
|
|
3339 int v61; // edx@97
|
|
3340 signed int v62; // ecx@102
|
|
3341 SHORT v63; // di@110
|
|
3342 bool v64; // eax@110
|
|
3343 const char *v65; // ecx@112
|
|
3344 POINT *v66; // esi@117
|
|
3345 int v67; // ecx@118
|
|
3346 int v68; // eax@118
|
|
3347 int v69; // ecx@118
|
|
3348 ItemGen *v70; // esi@118
|
|
3349 int v71; // eax@123
|
634
|
3350 int all_text_height; // edi@125
|
629
|
3351 char **v73; // esi@125
|
|
3352 int v74; // eax@126
|
634
|
3353 int pItemNum;
|
629
|
3354 int v76; // edx@127
|
|
3355 int v77; // edi@127
|
634
|
3356 GUIButton *pButton; // esi@129
|
629
|
3357 const char **v79; // eax@129
|
634
|
3358 int pTextHeight; // eax@129
|
629
|
3359 unsigned int v81; // ecx@129
|
644
|
3360 unsigned int pColorText; // ax@129
|
629
|
3361 int v85; // [sp-14h] [bp-ECh]@29
|
|
3362 int v86; // [sp-10h] [bp-E8h]@29
|
|
3363 ItemGen *v87; // [sp-10h] [bp-E8h]@43
|
|
3364 unsigned __int16 v88; // [sp-Ch] [bp-E4h]@29
|
|
3365 void *v89; // [sp-Ch] [bp-E4h]@43
|
|
3366 char *v90; // [sp-8h] [bp-E0h]@29
|
|
3367 int v91; // [sp-8h] [bp-E0h]@42
|
|
3368 unsigned int v92; // [sp-4h] [bp-DCh]@29
|
|
3369 __int64 *v93; // [sp-4h] [bp-DCh]@42
|
|
3370 POINT v94; // [sp+Ch] [bp-CCh]@39
|
|
3371 POINT v95; // [sp+14h] [bp-C4h]@49
|
|
3372 POINT v96; // [sp+1Ch] [bp-BCh]@117
|
|
3373 POINT v97; // [sp+24h] [bp-B4h]@40
|
|
3374 POINT v98; // [sp+2Ch] [bp-ACh]@117
|
|
3375 POINT v99; // [sp+34h] [bp-A4h]@49
|
|
3376 POINT v100; // [sp+3Ch] [bp-9Ch]@50
|
|
3377 POINT v101; // [sp+44h] [bp-94h]@39
|
|
3378 POINT v102; // [sp+4Ch] [bp-8Ch]@49
|
|
3379 POINT a2; // [sp+54h] [bp-84h]@39
|
634
|
3380 GUIWindow dialog_window; // [sp+5Ch] [bp-7Ch]@1
|
629
|
3381 int v105; // [sp+B0h] [bp-28h]@19
|
644
|
3382 int pColorYellow; // [sp+B4h] [bp-24h]@1
|
634
|
3383 int Str; // [sp+B8h] [bp-20h]@23
|
|
3384 int pColorWhite; // [sp+BCh] [bp-1Ch]@1
|
629
|
3385 __int32 v109; // [sp+C0h] [bp-18h]@39
|
634
|
3386 Player *pPlayer; // [sp+C4h] [bp-14h]@1
|
|
3387 int pNumString; // [sp+C8h] [bp-10h]@9
|
629
|
3388 unsigned int v112; // [sp+CCh] [bp-Ch]@9
|
|
3389 unsigned __int8 v113; // [sp+D3h] [bp-5h]@47
|
|
3390 int v114; // [sp+D4h] [bp-4h]@11
|
|
3391
|
634
|
3392 pPlayer = pPlayers[uActiveCharacter];
|
|
3393 memcpy(&dialog_window, window_SpeakInHouse, sizeof(dialog_window));
|
|
3394 dialog_window.uFrameX = 483;
|
|
3395 dialog_window.uFrameWidth = 148;
|
|
3396 dialog_window.uFrameZ = 334;
|
949
|
3397 pColorWhite = TargetColor(0xFFu, 0xFFu, 0xFFu);
|
|
3398 pColorYellow = TargetColor(0xE1u, 0xCDu, 0x23u);
|
629
|
3399 switch(dialog_menu_id)
|
|
3400 {
|
747
|
3401 case HOUSE_DIALOGUE_MAIN:
|
634
|
3402 {
|
|
3403 if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
|
|
3404 {
|
|
3405 pShopOptions[0] = pGlobalTXT_LocalizationStrings[134];
|
|
3406 pShopOptions[1] = pGlobalTXT_LocalizationStrings[152];
|
|
3407 pShopOptions[2] = pGlobalTXT_LocalizationStrings[159];
|
|
3408 pShopOptions[3] = pGlobalTXT_LocalizationStrings[160];
|
|
3409 all_text_height = 0;
|
|
3410 for (int i = 0; i < 4; ++i)//while ( (signed int)v15 < (signed int)&unk_F8B1C8 );
|
|
3411 all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0);
|
|
3412 Str = (174 - all_text_height) / 4;
|
|
3413 pNumActiveItem = pDialogueWindow->pStartingPosActiveItem;
|
|
3414 v76 = pNumActiveItem + pDialogueWindow->pNumPresenceButton;
|
|
3415 v77 = (174 - 4 * (174 - all_text_height) / 4 - all_text_height) / 2 - (174 - all_text_height) / 4 / 2 + 138;
|
|
3416 v28 = -pDialogueWindow->pNumPresenceButton < 0;
|
|
3417 if ( v28 ^ pNumActiveItem > v76 )
|
|
3418 {
|
|
3419 pItemNum = 2;
|
|
3420 pNumString = 0;
|
|
3421 do
|
|
3422 {
|
|
3423 pButton = pDialogueWindow->GetControl(pItemNum);
|
|
3424 pButton->uY = Str + v77;
|
|
3425 pTextHeight = pFontArrus->CalcTextHeight((const char *)pShopOptions[pNumString], &dialog_window, 0, 0);
|
|
3426 pButton->uHeight = pTextHeight;
|
|
3427 v77 = pButton->uY + pTextHeight - 1;
|
|
3428 pButton->uW = v77;
|
644
|
3429 pColorText = pColorYellow;
|
634
|
3430 if ( pDialogueWindow->pCurrentPosActiveItem != pItemNum )
|
644
|
3431 pColorText = pColorWhite;
|
|
3432 dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, (const char *)pShopOptions[pNumString], 3);
|
634
|
3433 ++pItemNum;
|
|
3434 ++pNumString;
|
|
3435 pNumActiveItem = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem;
|
|
3436 }
|
|
3437 while ( pItemNum < pNumActiveItem );
|
|
3438 }
|
|
3439 }
|
|
3440 return;
|
|
3441 }
|
747
|
3442 case HOUSE_DIALOGUE_SHOP_BUY_STANDARD:
|
634
|
3443 {
|
|
3444 pRenderer->DrawTextureIndexed(8, 8, ShopTexture);
|
|
3445 v114 = 0;
|
|
3446 do
|
|
3447 {
|
757
|
3448 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v114].uItemID)
|
629
|
3449 {
|
634
|
3450 v46 = ItemsInShopTexture[v114];
|
|
3451 v47 = 152 - v46->uTextureHeight;
|
|
3452 if ( (signed int)v47 < 1 )
|
|
3453 v47 = 0;
|
|
3454 v48 = 75 * v114 - v46->uTextureWidth / 2 + 40;
|
|
3455 if ( v114 )
|
|
3456 {
|
|
3457 if ( v114 == 5 )
|
|
3458 {
|
|
3459 v49 = ItemsInShopTexture[5]->uTextureWidth;
|
|
3460 if ( (signed int)v48 > 457 - v49 )
|
|
3461 v48 = 457 - v49;
|
|
3462 }
|
|
3463 }
|
|
3464 else if ( (signed int)v48 < 18 )
|
|
3465 v48 = 18;
|
|
3466 pRenderer->DrawTextureTransparent(v48, v47, v46);
|
|
3467 sub_40F92A(&pRenderer->pActiveZBuffer[v48 + 640 * v47], ItemsInShopTexture[v114], v114 + 1);
|
629
|
3468 }
|
634
|
3469 ++v114;
|
|
3470 }
|
|
3471 while ( v114 < 6 );
|
|
3472 v114 = 0;
|
|
3473 do
|
|
3474 {
|
917
|
3475 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v114 + 6].uItemID)
|
634
|
3476 {
|
|
3477 v50 = ItemsInShopTexture[v114 + 6];
|
|
3478 v51 = 308 - v50->uTextureHeight;
|
|
3479 if ( (signed int)v51 < 1 )
|
|
3480 v51 = 0;
|
|
3481 v52 = 75 * v114 - v50->uTextureWidth / 2 + 40;
|
|
3482 if ( v114 )
|
|
3483 {
|
|
3484 if ( v114 == 5 )
|
|
3485 {
|
|
3486 v53 = ItemsInShopTexture[11]->uTextureWidth;
|
|
3487 if ( (signed int)v52 > 457 - v53 )
|
|
3488 v52 = 457 - v53;
|
|
3489 }
|
|
3490 }
|
|
3491 else
|
|
3492 {
|
|
3493 if ( (signed int)v52 < 18 )
|
|
3494 v52 = 18;
|
|
3495 }
|
|
3496 pRenderer->DrawTextureTransparent(v52, v51, v50);
|
|
3497 sub_40F92A(&pRenderer->pActiveZBuffer[v52 + 640 * v51], ItemsInShopTexture[v114 + 6], v114 + 7);
|
|
3498 }
|
|
3499 ++v114;
|
|
3500 }
|
|
3501 while ( v114 < 6 );
|
|
3502 if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
|
|
3503 {
|
|
3504 v62 = 0;
|
|
3505 v109 = 0;
|
629
|
3506 do
|
|
3507 {
|
757
|
3508 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v62].uItemID)
|
634
|
3509 ++v109;
|
|
3510 ++v62;
|
|
3511 }
|
|
3512 while ( v62 < 12 );
|
|
3513 v63 = GetAsyncKeyState(17);
|
|
3514 v64 = pPlayer->CanSteal();
|
|
3515 Str = v64;
|
|
3516 if ( v63 && v64 )
|
|
3517 {
|
|
3518 v65 = pGlobalTXT_LocalizationStrings[185];
|
|
3519 }
|
749
|
3520 else if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_BUY_STANDARD)
|
634
|
3521 {
|
|
3522 v65 = pGlobalTXT_LocalizationStrings[195];
|
|
3523 }
|
|
3524 else
|
|
3525 {
|
|
3526 v65 = pGlobalTXT_LocalizationStrings[196];
|
|
3527 }
|
|
3528 DrawTextAtStatusBar(v65, 0);
|
|
3529 if ( !v109 )
|
|
3530 {
|
|
3531 dialog_window.DrawCurrentTime( pParty->field_3C.field_50[ (unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed);
|
|
3532 return;
|
|
3533 }
|
|
3534 v66 = pMouse->GetCursorPos(&v98);
|
|
3535 pNumActiveItem = v66->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v96)->y];
|
|
3536 if ( pRenderer->pActiveZBuffer[pNumActiveItem] & 0xFFFF )
|
|
3537 {
|
|
3538 v67 = (pRenderer->pActiveZBuffer[pNumActiveItem] & 0xFFFF) - 1;
|
|
3539 v70 = (ItemGen *)&pParty->StandartItemsInShops[(int)window_SpeakInHouse->ptr_1C][v67];
|
749
|
3540 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD)
|
634
|
3541 v70 = &pParty->SpecialItemsInShops[(int)window_SpeakInHouse->ptr_1C][v67];//v70 = (ItemGen *)&pParty->field_C59C[v69 + 724];
|
|
3542 if ( !v63 || !Str )
|
|
3543 {
|
917
|
3544 v71 = pPlayer->SelectPhrasesTransaction(v70, BildingType_AlchemistShop, (int)window_SpeakInHouse->ptr_1C, 2);
|
634
|
3545 v38 = (char *)pMerchantsBuyPhrases[v71];
|
|
3546 }
|
|
3547 else
|
|
3548 {
|
|
3549 v38 = pGlobalTXT_LocalizationStrings[181];
|
|
3550 }
|
|
3551 v21 = BuilDialogueString(v38, uActiveCharacter - 1, v70, (char *)window_SpeakInHouse->ptr_1C, 2, 0);
|
|
3552 v40 = pFontArrus->CalcTextHeight(v21, &dialog_window, 0, 0);
|
|
3553 dialog_window.DrawTitleText(pFontArrus, 0, (174 - v40) / 2 + 138, pColorWhite, v21, 3);
|
|
3554 return ;
|
|
3555 }
|
|
3556 }
|
|
3557 return;
|
|
3558 }
|
747
|
3559 case HOUSE_DIALOGUE_SHOP_SELL:
|
634
|
3560 {
|
|
3561 draw_leather();
|
984
|
3562 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true);
|
634
|
3563 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[199], 0);
|
|
3564 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
|
|
3565 return;
|
|
3566 if ((v43 = pMouse->GetCursorPos(&v99)->x - 14, v109 = (v43 >> 5) + 14 * ((pMouse->GetCursorPos(&v95)->y - 17) >> 5),
|
|
3567 pMouse->GetCursorPos(&v102)->x <= 13) || pMouse->GetCursorPos(&v100)->x >= 462
|
|
3568 || (pNumActiveItem = pPlayer->GetItemIDAtInventoryIndex((int *)&v109), !pNumActiveItem) )
|
|
3569 return;
|
|
3570 v87 = (ItemGen *)&pPlayer->pInventoryItems[pNumActiveItem - 1];
|
917
|
3571 v45 = pPlayer->SelectPhrasesTransaction(v87, BildingType_AlchemistShop, (int)window_SpeakInHouse->ptr_1C, 3);
|
634
|
3572 v21 = BuilDialogueString((char *)pMerchantsSellPhrases[v45], uActiveCharacter - 1, v87, (char *)window_SpeakInHouse->ptr_1C, 3, 0);
|
|
3573 pTextHeight = pFontArrus->CalcTextHeight(v21, &dialog_window, 0, 0);
|
|
3574 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, pColorWhite, v21, 3);
|
|
3575 return;
|
|
3576 }
|
747
|
3577 case HOUSE_DIALOGUE_SHOP_IDENTIFY:
|
634
|
3578 {
|
|
3579 draw_leather();
|
984
|
3580 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true);
|
634
|
3581 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[197], 0);
|
|
3582 if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
|
|
3583 return;
|
|
3584 if ((v36 = pMouse->GetCursorPos(&a2)->x - 14, v109 = (v36 >> 5) + 14 * ((pMouse->GetCursorPos(&v94)->y - 17) >> 5),
|
|
3585 pMouse->GetCursorPos(&v101)->x <= 13) || pMouse->GetCursorPos(&v97)->x >= 462
|
|
3586 || (pNumActiveItem = pPlayer->GetItemIDAtInventoryIndex((int *)&v109), !pNumActiveItem) )
|
|
3587 return;
|
|
3588 v37 = (ItemGen *)&pPlayer->pInventoryItems[pNumActiveItem - 1];
|
|
3589 if (!v37->Identified())
|
|
3590 {
|
917
|
3591 v42 = pPlayer->SelectPhrasesTransaction(v37, BildingType_AlchemistShop, (int)window_SpeakInHouse->ptr_1C, 4);
|
634
|
3592 v38 = (char *)pMerchantsIdentifyPhrases[v42];
|
|
3593 }
|
|
3594 else
|
|
3595 {
|
|
3596 v38 = "%24";
|
|
3597 }
|
|
3598 v21 = BuilDialogueString(v38, uActiveCharacter - 1, v37, (char *)window_SpeakInHouse->ptr_1C, 4, 0);
|
|
3599 v40 = pFontArrus->CalcTextHeight(v21, &dialog_window, 0, 0);
|
|
3600 dialog_window.DrawTitleText(pFontArrus, 0, (174 - v40) / 2 + 138, pColorWhite, v21, 3);
|
|
3601 return;
|
|
3602 }
|
747
|
3603 case HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT:
|
634
|
3604 {
|
|
3605 draw_leather();
|
984
|
3606 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true);
|
634
|
3607 pShopOptions[0] = pGlobalTXT_LocalizationStrings[200];
|
|
3608 pShopOptions[1] = pGlobalTXT_LocalizationStrings[113];
|
|
3609 all_text_height = 0;
|
|
3610 for ( int i = 0; i < 2; ++i )
|
|
3611 all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0);
|
|
3612 Str = (174 - all_text_height) / 2;
|
|
3613 pNumActiveItem = pDialogueWindow->pStartingPosActiveItem;
|
|
3614 v26 = pNumActiveItem + pDialogueWindow->pNumPresenceButton;
|
|
3615 v27 = (2 * (87 - (174 - all_text_height) / 2) - all_text_height) / 2 - (174 - all_text_height) / 2 / 2 + 138;
|
|
3616 v28 = -pDialogueWindow->pNumPresenceButton < 0;
|
|
3617 if ( v28 ^ pNumActiveItem > v26 )
|
|
3618 {
|
|
3619 pItemNum = 2;
|
|
3620 pNumString = 0;
|
|
3621 do
|
|
3622 {
|
|
3623 pButton = pDialogueWindow->GetControl(pItemNum);
|
|
3624 pButton->uY = Str + v27;
|
|
3625 pTextHeight = pFontArrus->CalcTextHeight((const char *)pShopOptions[pNumString], &dialog_window, 0, 0);
|
|
3626 pButton->uHeight = pTextHeight;
|
|
3627 v27 = pButton->uY + pTextHeight - 1;
|
|
3628 pButton->uW = v27;
|
644
|
3629 pColorText = pColorYellow;
|
634
|
3630 if ( pDialogueWindow->pCurrentPosActiveItem != pItemNum )
|
644
|
3631 pColorText = pColorWhite;
|
|
3632 dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, (const char *)pShopOptions[pNumString], 3);
|
634
|
3633 ++pItemNum;
|
|
3634 ++pNumString;
|
|
3635 pNumActiveItem = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem;
|
629
|
3636 }
|
634
|
3637 while ( pItemNum < pNumActiveItem );
|
|
3638 }
|
|
3639 return;
|
|
3640 }
|
747
|
3641 case HOUSE_DIALOGUE_SHOP_BUY_SPECIAL:
|
634
|
3642 {
|
|
3643 pRenderer->DrawTextureIndexed(8, 8, ShopTexture);
|
|
3644 v114 = 0;
|
|
3645 do
|
|
3646 {
|
|
3647 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v114].uItemID)
|
|
3648 {
|
|
3649 v54 = ItemsInShopTexture[v114];
|
|
3650 v55 = 152 - v54->uTextureHeight;
|
|
3651 if ( (signed int)v55 < 1 )
|
|
3652 v55 = 0;
|
|
3653 v56 = 75 * v114 - v54->uTextureWidth / 2 + 40;
|
|
3654 if ( v114 )
|
|
3655 {
|
|
3656 if ( v114 == 5 )
|
|
3657 {
|
|
3658 v57 = ItemsInShopTexture[5]->uTextureWidth;
|
|
3659 if ( (signed int)v56 > 457 - v57 )
|
|
3660 v56 = 457 - v57;
|
|
3661 }
|
|
3662 }
|
|
3663 else
|
|
3664 {
|
|
3665 if ( (signed int)v56 < 18 )
|
|
3666 v56 = 18;
|
|
3667 }
|
|
3668 pRenderer->DrawTextureTransparent(v56, v55, v54);
|
|
3669 sub_40F92A(&pRenderer->pActiveZBuffer[v56 + 640 * v55], ItemsInShopTexture[v114], v114 + 1);
|
|
3670 }
|
|
3671 ++v114;
|
|
3672 }
|
|
3673 while ( v114 < 6 );
|
|
3674 v114 = 0;
|
|
3675 do
|
|
3676 {
|
917
|
3677 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][(signed int)v114 + 6].uItemID) //not itemid
|
634
|
3678 {
|
|
3679 v58 = ItemsInShopTexture[v114 + 6];
|
|
3680 v59 = 308 - v58->uTextureHeight;
|
|
3681 if ( (signed int)v59 < 1 )
|
|
3682 v59 = 0;
|
|
3683 v60 = 75 * v114 - v58->uTextureWidth / 2 + 40;
|
|
3684 if ( v114 )
|
|
3685 {
|
|
3686 if ( v114 == 5 )
|
|
3687 {
|
|
3688 v61 = ItemsInShopTexture[11]->uTextureWidth;
|
|
3689 if ( (signed int)v60 > 457 - v61 )
|
|
3690 v60 = 457 - v61;
|
|
3691 }
|
|
3692 }
|
|
3693 else
|
|
3694 {
|
|
3695 if ( (signed int)v60 < 18 )
|
|
3696 v60 = 18;
|
|
3697 }
|
|
3698 pRenderer->DrawTextureTransparent(v60, v59, v58);
|
|
3699 sub_40F92A(&pRenderer->pActiveZBuffer[v60 + 640 * v59], ItemsInShopTexture[v114 + 6], v114 + 7);
|
|
3700 }
|
|
3701 ++v114;
|
|
3702 }
|
|
3703 while ( v114 < 6 );
|
|
3704 if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
|
|
3705 {
|
|
3706 v62 = 0;
|
|
3707 v109 = 0;
|
|
3708 do
|
|
3709 {
|
|
3710 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v62].uItemID)
|
|
3711 ++v109;
|
|
3712 ++v62;
|
|
3713 }
|
|
3714 while ( v62 < 12 );
|
|
3715 v63 = GetAsyncKeyState(17);
|
|
3716 v64 = pPlayer->CanSteal();
|
|
3717 Str = v64;
|
|
3718 if ( v63 && v64 )
|
|
3719 {
|
|
3720 v65 = pGlobalTXT_LocalizationStrings[185];
|
|
3721 }
|
|
3722 else
|
629
|
3723 {
|
634
|
3724 v65 = pGlobalTXT_LocalizationStrings[195];
|
749
|
3725 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD)
|
634
|
3726 v65 = pGlobalTXT_LocalizationStrings[196];
|
|
3727 }
|
|
3728 DrawTextAtStatusBar(v65, 0);
|
|
3729 if ( !v109 )
|
|
3730 {
|
|
3731 dialog_window.DrawCurrentTime( pParty->field_3C.field_50[ (unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed);
|
|
3732 return;
|
|
3733 }
|
|
3734 v66 = pMouse->GetCursorPos(&v98);
|
|
3735 pNumActiveItem = v66->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v96)->y];
|
|
3736 if ( pRenderer->pActiveZBuffer[pNumActiveItem] & 0xFFFF )
|
|
3737 {
|
|
3738 v67 = (pRenderer->pActiveZBuffer[pNumActiveItem] & 0xFFFF) - 1;
|
|
3739 v109 = v67;
|
|
3740 v68 = (int)window_SpeakInHouse->ptr_1C;
|
|
3741 // v69 = 9 * (v67 + 12 * v68);
|
|
3742 v70 = (ItemGen *)&pParty->StandartItemsInShops[v68][v67];
|
749
|
3743 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD)
|
634
|
3744 v70 = &pParty->SpecialItemsInShops[(int)v68][v67];//v70 = (ItemGen *)&pParty->field_C59C[v69 + 724];
|
|
3745 if ( !v63 || !Str )
|
|
3746 {
|
917
|
3747 v71 = pPlayer->SelectPhrasesTransaction(v70, BildingType_AlchemistShop, v68, 2);
|
634
|
3748 v38 = (char *)pMerchantsBuyPhrases[v71];
|
|
3749 }
|
|
3750 else
|
|
3751 {
|
|
3752 v38 = pGlobalTXT_LocalizationStrings[181];
|
|
3753 }
|
|
3754 v21 = BuilDialogueString(v38, uActiveCharacter - 1, v70, (char *)window_SpeakInHouse->ptr_1C, 2, 0);
|
|
3755 v40 = pFontArrus->CalcTextHeight(v21, &dialog_window, 0, 0);
|
|
3756 dialog_window.DrawTitleText(pFontArrus, 0, (174 - v40) / 2 + 138, pColorWhite, v21, 3);
|
|
3757 return;
|
|
3758 }
|
|
3759 }
|
|
3760 return;
|
|
3761 }
|
747
|
3762 case HOUSE_DIALOGUE_LEARN_SKILLS:
|
634
|
3763 {
|
|
3764 if (!sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win())
|
|
3765 return;
|
|
3766 all_text_height = 0;
|
|
3767 v5 = (signed __int64)(p2DEvents[(signed int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0);
|
|
3768 pItemNum = v5 * (100 - pPlayer->GetMerchant()) / 100;
|
|
3769 if ( pItemNum < v5 / 3 )
|
|
3770 pItemNum = v5 / 3;
|
|
3771 pNumActiveItem = pDialogueWindow->pStartingPosActiveItem;
|
|
3772 v114 = 0;
|
|
3773 if ( pNumActiveItem >= pNumActiveItem + pDialogueWindow->pNumPresenceButton )
|
|
3774 {
|
|
3775 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], pPlayer->pName, pClassNames[pPlayer->classType]);
|
|
3776 strcat(pTmpBuf, "\n \n");
|
|
3777 strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]);
|
|
3778 v40 = pFontArrus->CalcTextHeight(pTmpBuf, &dialog_window, 0, 0);
|
644
|
3779 dialog_window.DrawTitleText(pFontArrus, 0, (174 - v40) / 2 + 138, pColorYellow, pTmpBuf, 3);
|
634
|
3780 return;
|
|
3781 }
|
|
3782 do
|
|
3783 {
|
832
|
3784 v8 = pDialogueWindow->GetControl(pNumActiveItem)->msg_param - 36;
|
634
|
3785 if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayer->classType][v8] && !pPlayer->pActiveSkills[v8] )
|
|
3786 {
|
|
3787 all_text_height = pFontArrus->CalcTextHeight(pSkillNames[v8], &dialog_window, 0, 0);
|
|
3788 ++v114;
|
|
3789 }
|
|
3790 ++pNumActiveItem;
|
|
3791 }
|
|
3792 while ( pNumActiveItem < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem );
|
|
3793 if ( !v114 )
|
|
3794 {
|
|
3795 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], pPlayer->pName, pClassNames[pPlayer->classType]);
|
|
3796 strcat(pTmpBuf, "\n \n");
|
|
3797 strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]);
|
|
3798 v40 = pFontArrus->CalcTextHeight(pTmpBuf, &dialog_window, 0, 0);
|
644
|
3799 dialog_window.DrawTitleText(pFontArrus, 0, (174 - v40) / 2 + 138, pColorYellow, pTmpBuf, 3);
|
634
|
3800 return;
|
|
3801 }
|
|
3802 if ( v114 )
|
|
3803 {
|
|
3804 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], pItemNum);
|
|
3805 dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3);
|
|
3806 v18 = (149 - all_text_height) / v114;
|
|
3807 if ( (149 - all_text_height) / v114 > 32 )
|
|
3808 v18 = 32;
|
|
3809 pNumActiveItem = pDialogueWindow->pStartingPosActiveItem;
|
|
3810 v105 = (149 - v114 * v18 - all_text_height) / 2 - v18 / 2 + 162;
|
|
3811 if ( pNumActiveItem < pNumActiveItem + pDialogueWindow->pNumPresenceButton )
|
|
3812 {
|
|
3813 pItemNum = 2;
|
629
|
3814 do
|
|
3815 {
|
634
|
3816 pButton = pDialogueWindow->GetControl(pItemNum);
|
832
|
3817 v13 = pButton->msg_param - 36;
|
634
|
3818 if ( !byte_4ED970_skill_learn_ability_by_class_table[pPlayer->classType][v13] || pPlayer->pActiveSkills[v13] )
|
|
3819 {
|
|
3820 pButton->uW = 0;
|
|
3821 pButton->uHeight = 0;
|
|
3822 pButton->uY = 0;
|
|
3823 }
|
|
3824 else
|
|
3825 {
|
|
3826 pButton->uY = v18 + v105;
|
|
3827 pTextHeight = pFontArrus->CalcTextHeight(pSkillNames[v13], &dialog_window, 0, 0);
|
|
3828 pButton->uHeight = pTextHeight;
|
|
3829 v105 = pButton->uY + pTextHeight - 1;
|
|
3830 pButton->uW = v105;
|
644
|
3831 pColorText = pColorYellow;
|
634
|
3832 if ( pDialogueWindow->pCurrentPosActiveItem != pItemNum )
|
644
|
3833 pColorText = pColorWhite;
|
|
3834 dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, pSkillNames[v13], 3);
|
634
|
3835 }
|
|
3836 pNumActiveItem = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem;
|
|
3837 pItemNum++;
|
629
|
3838 }
|
634
|
3839 while ( pItemNum < pNumActiveItem );
|
629
|
3840 }
|
|
3841 return;
|
634
|
3842 }
|
|
3843 }
|
|
3844 default:
|
|
3845 {
|
|
3846 return;// (POINT *)dialog_menu_id - 96;
|
|
3847 }
|
629
|
3848 }
|
|
3849 }
|
|
3850
|
|
3851 //----- (004BA928) --------------------------------------------------------
|
|
3852 void __cdecl ArmorShopDialog()
|
900
|
3853 {
|
|
3854 signed int v1; // esi@8
|
|
3855 unsigned int v2; // eax@10
|
|
3856 ItemGen *v3; // eax@11
|
|
3857 char *v5; // ecx@12
|
|
3858 char *v6; // eax@13
|
|
3859 int v8; // eax@15
|
|
3860 signed int v9; // esi@17
|
|
3861 unsigned int v10; // eax@19
|
|
3862 char *v11; // edi@19
|
|
3863 int v12; // ST08_4@20
|
|
3864 int v13; // eax@20
|
|
3865 char *v15; // ecx@20
|
|
3866 char **v16; // edi@22
|
|
3867 int all_text_height; // ebx@22
|
|
3868 char **v18; // esi@22
|
|
3869 int v19; // eax@23
|
|
3870 GUIWindow *v20; // ecx@24
|
|
3871 int v21; // eax@24
|
|
3872 int v22; // edx@24
|
|
3873 int v23; // ebx@24
|
|
3874 unsigned __int8 v24; // sf@24
|
|
3875 GUIButton *pButton; // eax@26
|
|
3876 unsigned int v28; // ecx@26
|
|
3877 int v29; // edx@26
|
|
3878 signed int v31; // esi@31
|
|
3879 unsigned int v32; // eax@33
|
|
3880 int v33; // eax@34
|
|
3881 int v35; // eax@35
|
|
3882 char *v36; // edx@36
|
|
3883 signed int v38; // esi@42
|
|
3884 unsigned int v39; // esi@44
|
|
3885 int v40; // eax@44
|
|
3886 unsigned int v41; // eax@45
|
|
3887 int v42; // eax@47
|
|
3888 int v43; // ecx@52
|
|
3889 int v46; // eax@54
|
|
3890 unsigned int v49; // ecx@56
|
|
3891 int v51; // eax@56
|
|
3892 int v53; // eax@60
|
|
3893 int textureH; // eax@60
|
|
3894 signed int textureW; // ebx@65
|
|
3895 Texture *v56; // eax@67
|
|
3896 unsigned int pY_item; // edi@68
|
|
3897 Texture *v58; // ST1C_4@68
|
|
3898 int v59; // eax@68
|
|
3899 int v60; // edi@69
|
|
3900 signed int v61; // ebx@73
|
|
3901 Texture *v62; // eax@75
|
|
3902 int v63; // edi@76
|
|
3903 Texture *v64; // ST1C_4@76
|
|
3904 unsigned int v65; // ST18_4@76
|
|
3905 int v66; // eax@76
|
|
3906 int v67; // edi@77
|
|
3907 signed int v68; // ecx@81
|
|
3908 const char *pStatusText; // ecx@91
|
|
3909 void *v72; // eax@95
|
|
3910 POINT *v73; // esi@97
|
|
3911 int v74; // ecx@97
|
|
3912 int v75; // eax@98
|
|
3913 int v76; // ecx@98
|
|
3914 ItemGen *selected_item; // ecx@99
|
|
3915 unsigned __int8 v78; // bl@104
|
|
3916 int v80; // ebx@105
|
|
3917 char **v81; // esi@105
|
|
3918 int v82; // eax@106
|
|
3919 int v86; // ebx@107
|
|
3920 int pTextHeight; // eax@109
|
|
3921 unsigned int v90; // ecx@109
|
|
3922 int pNumString; // edx@109
|
|
3923 unsigned __int16 pTextColor; // ax@109
|
|
3924 signed int v93; // edx@114
|
|
3925 POINT *v94; // edi@120
|
|
3926 __int32 v95; // ecx@120
|
|
3927 void *v96; // ST14_4@122
|
|
3928 unsigned __int8 v97; // bl@122
|
|
3929 ItemGen *v98; // ST10_4@122
|
|
3930 int v99; // eax@122
|
|
3931 char *v100; // eax@122
|
|
3932 const char *v101; // ST18_4@122
|
|
3933 unsigned __int16 v102; // ST14_2@122
|
|
3934 int v103; // eax@122
|
|
3935 signed int v104; // edi@123
|
|
3936 Texture *v105; // eax@125
|
|
3937 int v106; // ebx@126
|
|
3938 unsigned int v108; // ST18_4@126
|
|
3939 int v109; // eax@126
|
|
3940 int v110; // ebx@127
|
|
3941 GUIWindow *v111; // [sp-18h] [bp-11Ch]@36
|
|
3942 unsigned int v112; // [sp-14h] [bp-118h]@13
|
|
3943 int v113; // [sp-14h] [bp-118h]@36
|
|
3944 unsigned int v115; // [sp-10h] [bp-114h]@13
|
|
3945 ItemGen *v116; // [sp-10h] [bp-114h]@20
|
|
3946 int v117; // [sp-10h] [bp-114h]@36
|
|
3947 unsigned __int16 v119; // [sp-Ch] [bp-110h]@13
|
|
3948 char *v121; // [sp-8h] [bp-10Ch]@13
|
|
3949 int v122; // [sp-8h] [bp-10Ch]@20
|
|
3950 unsigned int v123; // [sp-4h] [bp-108h]@13
|
|
3951 __int64 *v124; // [sp-4h] [bp-108h]@20
|
|
3952 int v125; // [sp-4h] [bp-108h]@68
|
|
3953 int v126; // [sp-4h] [bp-108h]@76
|
|
3954 int v127; // [sp-4h] [bp-108h]@126
|
|
3955 POINT v128; // [sp+Ch] [bp-F8h]@8
|
|
3956 POINT v129; // [sp+14h] [bp-F0h]@18
|
|
3957 char v130; // [sp+1Ch] [bp-E8h]@120
|
|
3958 POINT a2; // [sp+24h] [bp-E0h]@8
|
|
3959 POINT v132; // [sp+2Ch] [bp-D8h]@120
|
|
3960 POINT v133; // [sp+34h] [bp-D0h]@17
|
|
3961 POINT v134; // [sp+3Ch] [bp-C8h]@97
|
|
3962 POINT v135; // [sp+44h] [bp-C0h]@31
|
|
3963 POINT v136; // [sp+4Ch] [bp-B8h]@97
|
|
3964 POINT v137; // [sp+54h] [bp-B0h]@17
|
|
3965 POINT v138; // [sp+5Ch] [bp-A8h]@32
|
|
3966 POINT v139; // [sp+64h] [bp-A0h]@17
|
|
3967 POINT v140; // [sp+6Ch] [bp-98h]@31
|
|
3968 POINT v141; // [sp+74h] [bp-90h]@8
|
|
3969 POINT v142; // [sp+7Ch] [bp-88h]@31
|
|
3970 POINT v143; // [sp+84h] [bp-80h]@9
|
|
3971 GUIWindow dialog_window; // [sp+8Ch] [bp-78h]@1
|
|
3972 int v146; // [sp+E4h] [bp-20h]@24
|
|
3973 int pYellowColor; // [sp+E8h] [bp-1Ch]@1
|
|
3974 int pWhiteColor; // [sp+ECh] [bp-18h]@1
|
|
3975 __int32 pItemCount; // [sp+F0h] [bp-14h]@8
|
|
3976 int v152; // [sp+FCh] [bp-8h]@24
|
|
3977 int v153; // [sp+100h] [bp-4h]@44
|
|
3978 int th;
|
|
3979 short text_color;
|
|
3980 int pActiveButton;
|
629
|
3981
|
900
|
3982 memcpy(&dialog_window, window_SpeakInHouse, sizeof(dialog_window));
|
|
3983 dialog_window.uFrameX = 483;
|
|
3984 dialog_window.uFrameWidth = 148;
|
|
3985 dialog_window.uFrameZ = 334;
|
949
|
3986 pWhiteColor = TargetColor(0xFFu, 0xFFu, 0xFFu);
|
|
3987 pYellowColor = TargetColor(0xE1u, 0xCDu, 0x23u);
|
900
|
3988 switch (dialog_menu_id)
|
|
3989 {
|
|
3990 case HOUSE_DIALOGUE_MAIN:
|
|
3991 {
|
|
3992 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
|
|
3993 return;
|
|
3994 pShopOptions[0] = pGlobalTXT_LocalizationStrings[134]; //"Buy Standard"
|
|
3995 pShopOptions[1] = pGlobalTXT_LocalizationStrings[152]; //"Buy Special"
|
|
3996 pShopOptions[2] = pGlobalTXT_LocalizationStrings[159]; //"Display Inventory"
|
|
3997 pShopOptions[3] = pGlobalTXT_LocalizationStrings[160];
|
|
3998 all_text_height = 0;
|
|
3999 for( int i = 0; i < 4; ++i )
|
|
4000 all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0);
|
|
4001 v146 = ( 174 - all_text_height ) / 4;
|
|
4002 v23 = ( 174 - 4 * ( 174 - all_text_height ) / 4 - all_text_height ) / 2 - ( 174 - all_text_height ) / 4 / 2 + 138;
|
|
4003 pNumString = 0;
|
|
4004 if ( pDialogueWindow->pNumPresenceButton>=0 )
|
|
4005 {
|
|
4006 for (pActiveButton = pDialogueWindow->pStartingPosActiveItem; pActiveButton < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++pActiveButton)
|
|
4007 {
|
|
4008 pButton = pDialogueWindow->GetControl(pActiveButton);
|
|
4009 pButton->uY = v146 + v23;
|
|
4010 pTextHeight = pFontArrus->CalcTextHeight(pShopOptions[pNumString], &dialog_window, 0, 0);
|
|
4011 pButton->uHeight = pTextHeight;
|
|
4012 v23 = pButton->uY + pButton->uHeight - 1;
|
|
4013 pButton->uW = v23;
|
|
4014 pTextColor = pYellowColor;
|
|
4015 if ( pDialogueWindow->pCurrentPosActiveItem != pActiveButton )
|
|
4016 pTextColor = pWhiteColor;
|
|
4017 dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pTextColor, pShopOptions[pNumString], 3);
|
|
4018 ++pNumString;
|
|
4019 }
|
|
4020 }
|
|
4021 }
|
|
4022 break;
|
|
4023 case HOUSE_DIALOGUE_SHOP_BUY_STANDARD:
|
|
4024 {
|
|
4025 pRenderer->DrawTextureIndexed(8, 8, ShopTexture);// ïîäëîæêà
|
|
4026 textureW = 0;
|
|
4027 v153 = 0;
|
|
4028 for ( int i = 0; i < 8; ++i )// ðàçìåñòèòü âåùè
|
|
4029 {
|
|
4030 if ( pParty->StandartItemsInShops[window_SpeakInHouse->par1C][i].uItemID)
|
|
4031 {
|
|
4032 textureW = ItemsInShopTexture[i]->uTextureWidth;
|
|
4033 textureH = ItemsInShopTexture[i]->uTextureHeight;
|
|
4034 if ( i >= 4 ) //low row
|
|
4035 {
|
|
4036 v60 = 90 - (textureW/2);
|
|
4037 pRenderer->DrawTextureTransparent(v60 + v153 - 420, 126, ItemsInShopTexture[i]);
|
|
4038 v59 = v60 + v153 + 80220;
|
|
4039 }
|
|
4040 else
|
|
4041 {
|
|
4042 pY_item = 98 - textureH;
|
|
4043 v152 = 86 - (textureW/2);
|
|
4044 pRenderer->DrawTextureTransparent(v152 + v153, pY_item, ItemsInShopTexture[i]);
|
|
4045 v59 = v153 + v152 + 640 * pY_item;
|
|
4046 }
|
|
4047 ZBuffer_DoFill(&pRenderer->pActiveZBuffer[v59], ItemsInShopTexture[i], i + 1);
|
|
4048 }
|
|
4049 v153 += 105;
|
|
4050 }
|
|
4051 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
|
|
4052 return;
|
|
4053 pItemCount = 0;
|
|
4054 for ( int i = 0; i < 8; ++i )
|
|
4055 {
|
|
4056 if ( pParty->StandartItemsInShops[window_SpeakInHouse->par1C][i].uItemID )
|
|
4057 ++pItemCount;
|
|
4058 }
|
|
4059 if ( GetAsyncKeyState(17) == 0 || pPlayers[uActiveCharacter]->CanSteal() == 0 )
|
|
4060 pStatusText = pGlobalTXT_LocalizationStrings[195]; //"Select the Item to Buy"
|
|
4061 else
|
|
4062 pStatusText = pGlobalTXT_LocalizationStrings[185];//"Steal item"
|
|
4063 DrawTextAtStatusBar(pStatusText, 0);
|
|
4064 if ( pItemCount != 0 )
|
|
4065 {
|
|
4066 v73 = pMouse->GetCursorPos(&v136);
|
|
4067 v74 = pRenderer->pActiveZBuffer[v73->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v134)->y]] & 0xFFFF;
|
|
4068 if ( !v74 )
|
|
4069 return;
|
|
4070 pItemCount = v74 - 1;
|
|
4071 selected_item = &pParty->StandartItemsInShops[window_SpeakInHouse->par1C][v74-1];
|
|
4072 if ( GetAsyncKeyState(17) == 0 || pPlayers[uActiveCharacter]->CanSteal() == 0)
|
917
|
4073 v15 = (char *)pMerchantsBuyPhrases[pPlayers[uActiveCharacter]->SelectPhrasesTransaction(selected_item, BildingType_ArmorShop, window_SpeakInHouse->par1C, 2)];
|
900
|
4074 else
|
|
4075 v15 = pGlobalTXT_LocalizationStrings[181]; //"Steal %24"
|
|
4076 v36 = BuilDialogueString(v15, uActiveCharacter - 1, selected_item, (char *)window_SpeakInHouse->ptr_1C, 2, 0);
|
|
4077 v115 = (174 - pFontArrus->CalcTextHeight(v36, &dialog_window, 0, 0)) / 2 + 138;
|
|
4078 dialog_window.DrawTitleText(pFontArrus, 0, v115, pWhiteColor, v36, 3);
|
|
4079 return;
|
|
4080 }
|
|
4081 dialog_window.DrawCurrentTime( pParty->field_3C.field_50[window_SpeakInHouse->par1C]- pParty->uTimePlayed);
|
|
4082 return;
|
|
4083 }
|
|
4084 break;
|
|
4085 case HOUSE_DIALOGUE_SHOP_BUY_SPECIAL:
|
629
|
4086 {
|
900
|
4087 pRenderer->DrawTextureIndexed(8, 8, ShopTexture);
|
|
4088 v11 = 0;
|
|
4089 v61 = 0;
|
|
4090 v153 = 0;
|
|
4091 do
|
|
4092 {
|
|
4093 if (pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][v61].uItemID)
|
629
|
4094 {
|
900
|
4095 v62 = ItemsInShopTexture[v61];
|
|
4096 if ( v61 >= 4 )
|
|
4097 {
|
|
4098 v67 = 90 - ((signed int)v62->uTextureWidth >> 1);
|
|
4099 pRenderer->DrawTextureTransparent(v153 + v67 - 420, 0x7Eu, ItemsInShopTexture[v61]);
|
|
4100 v66 = v153 + v67 + 80220;
|
|
4101 }
|
|
4102 else
|
|
4103 {
|
|
4104 v63 = 98 - v62->uTextureHeight;
|
|
4105 v64 = ItemsInShopTexture[v61];
|
|
4106 v65 = 98 - v62->uTextureHeight;
|
|
4107 v152 = 86 - ((signed int)v62->uTextureWidth >> 1);
|
|
4108 pRenderer->DrawTextureTransparent(v152 + v153, v65, v64);
|
|
4109 v66 = v152 + v153 + 640 * v63;
|
|
4110 }
|
|
4111 ZBuffer_DoFill(&pRenderer->pActiveZBuffer[v66], ItemsInShopTexture[v61], v61 + 1);
|
|
4112 }
|
|
4113 v153 += 105;
|
|
4114 ++v61;
|
|
4115 }
|
|
4116 while ( v61 < 8 );
|
|
4117 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
|
|
4118 return;
|
|
4119 v68 = 0;
|
|
4120 pItemCount = 0;
|
|
4121 do
|
|
4122 {
|
|
4123 if (pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][(signed int)v68].uItemID)
|
|
4124 ++pItemCount;
|
|
4125 ++v68;
|
|
4126 }
|
|
4127 while ( v68 < 6 );
|
|
4128 if ( GetAsyncKeyState(17) == 0 || pPlayers[uActiveCharacter]->CanSteal() == 0 )
|
|
4129 pStatusText = pGlobalTXT_LocalizationStrings[196]; //Select the Special Item to Buy"
|
|
4130 else
|
|
4131 pStatusText = pGlobalTXT_LocalizationStrings[185];
|
|
4132 DrawTextAtStatusBar(pStatusText, 0);
|
|
4133 if ( (char *)pItemCount != 0 )
|
|
4134 {
|
|
4135 v73 = pMouse->GetCursorPos(&v136);
|
|
4136 v74 = pRenderer->pActiveZBuffer[v73->x + pSRZBufferLineOffsets[pMouse->GetCursorPos((POINT *)&v134)->y]] & 0xFFFF;
|
|
4137 if ( !v74 )
|
|
4138 return;
|
|
4139 pItemCount = v74 - 1;
|
|
4140 if ( dialog_menu_id == 2 )
|
917
|
4141 selected_item = &pParty->StandartItemsInShops[window_SpeakInHouse->par1C][v74 - 1];
|
629
|
4142 else
|
907
|
4143 selected_item = &pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][v74 - 1];
|
900
|
4144 if ( GetAsyncKeyState(17) == 0 || pPlayers[uActiveCharacter]->CanSteal() == 0 )
|
917
|
4145 v15 = (char *)pMerchantsBuyPhrases[pPlayers[uActiveCharacter]->SelectPhrasesTransaction(selected_item, BildingType_ArmorShop, window_SpeakInHouse->par1C, 2)];
|
900
|
4146 else
|
|
4147 v15 = pGlobalTXT_LocalizationStrings[181]; //"Steal %24"
|
|
4148 v36 = BuilDialogueString(v15, uActiveCharacter - 1, selected_item, (char *)window_SpeakInHouse->ptr_1C, 2, 0);
|
|
4149 v115 = (174 - pFontArrus->CalcTextHeight(v36, &dialog_window, 0, 0)) / 2 + 138;
|
|
4150 dialog_window.DrawTitleText(pFontArrus, 0, v115, pWhiteColor, v36, 3);
|
629
|
4151 return;
|
900
|
4152 }
|
|
4153 dialog_window.DrawCurrentTime( pParty->field_3C.field_50[window_SpeakInHouse->par1C]- pParty->uTimePlayed);
|
|
4154 return;
|
|
4155 }
|
|
4156 break;
|
|
4157 case HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT:
|
|
4158 {
|
|
4159 draw_leather();
|
984
|
4160 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true);
|
900
|
4161 pShopOptions[0] = pGlobalTXT_LocalizationStrings[200]; //"Sell"
|
|
4162 pShopOptions[1] = pGlobalTXT_LocalizationStrings[113]; //"Identify"
|
|
4163 pShopOptions[2] = pGlobalTXT_LocalizationStrings[179]; //"Repair"
|
|
4164 all_text_height = 0;
|
|
4165 for ( int i = 0; i < 3; ++i )
|
|
4166 all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0);
|
|
4167 v152 = (174 - all_text_height) / 3;
|
|
4168 v86 = (3 * (58 - v152) - all_text_height) / 2 - v152 / 2 + 138;
|
|
4169 v24 = -pDialogueWindow->pNumPresenceButton < 0;
|
|
4170 pActiveButton = pDialogueWindow->pStartingPosActiveItem;
|
|
4171 if ( v24 ^ pDialogueWindow->pStartingPosActiveItem > pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton )
|
|
4172 {
|
|
4173 pNumString = 0;
|
|
4174 do
|
|
4175 {
|
|
4176 pButton = pDialogueWindow->GetControl((unsigned int)pActiveButton);
|
|
4177 pButton->uY = v152 + v86;
|
|
4178 pTextHeight = pFontArrus->CalcTextHeight(pShopOptions[pNumString], &dialog_window, 0, 0);
|
|
4179 v90 = pButton->uY;
|
|
4180 pButton->uHeight = pTextHeight;
|
|
4181 v86 = v90 + pTextHeight - 1;
|
|
4182 pButton->uW = v86;
|
|
4183 pTextColor = pYellowColor;
|
|
4184 if ( pDialogueWindow->pCurrentPosActiveItem != pActiveButton )
|
|
4185 pTextColor = pWhiteColor;
|
|
4186 dialog_window.DrawTitleText(pFontArrus, 0, v90, pTextColor, pShopOptions[pNumString], 3);
|
|
4187 ++pNumString;
|
|
4188 ++pActiveButton;
|
629
|
4189 }
|
900
|
4190 while ( (signed int)pActiveButton < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem );
|
|
4191 }
|
|
4192 return;
|
|
4193 }
|
|
4194 break;
|
747
|
4195 case HOUSE_DIALOGUE_SHOP_SELL:
|
629
|
4196 {
|
|
4197 draw_leather();
|
984
|
4198 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true);
|
629
|
4199 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[199], 0);//"Select the Item to Sell"
|
|
4200 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win())
|
|
4201 return;
|
900
|
4202 if((v9 = pMouse->GetCursorPos(&v139)->x - 14, pItemCount = (v9 >> 5) + 14 * ((pMouse->GetCursorPos(&v133)->y - 17) >> 5),
|
629
|
4203 pMouse->GetCursorPos(&v137)->x <= 13) || pMouse->GetCursorPos(&v129)->x >= 462
|
900
|
4204 || (v10 = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&pItemCount), v11 = 0, !v10) )
|
629
|
4205 return;
|
907
|
4206 v116 = (ItemGen *)&pPlayers[uActiveCharacter]->pInventoryItems[v10 - 1];
|
917
|
4207 v13 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(v116, BildingType_ArmorShop, window_SpeakInHouse->par1C, 3);
|
|
4208 v15 = (char *)pMerchantsSellPhrases[pPlayers[uActiveCharacter]->SelectPhrasesTransaction(v116, BildingType_ArmorShop, window_SpeakInHouse->par1C, 3)];
|
629
|
4209 v36 = BuilDialogueString(v15, uActiveCharacter - 1, v116, (char *) window_SpeakInHouse->par1C, 3, 0);
|
|
4210 v115 = (174 - pFontArrus->CalcTextHeight(v36, &dialog_window, 0, 0)) / 2 + 138;
|
900
|
4211 dialog_window.DrawTitleText(pFontArrus, 0, v115, pWhiteColor, v36, 3);
|
629
|
4212 return;
|
|
4213 }
|
|
4214 break;
|
747
|
4215 case HOUSE_DIALOGUE_SHOP_IDENTIFY:
|
900
|
4216 {
|
|
4217 draw_leather();
|
984
|
4218 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true);
|
900
|
4219 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[197], 0); //"Select the Item to Identify"
|
|
4220 if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
|
|
4221 {
|
|
4222 v1 = pMouse->GetCursorPos(&a2)->x - 14;
|
|
4223 pItemCount = (v1 >> 5) + 14 * ((pMouse->GetCursorPos(&v128)->y - 17) >> 5);
|
|
4224 if ( pMouse->GetCursorPos(&v141)->x > 13 )
|
629
|
4225 {
|
900
|
4226 if ( pMouse->GetCursorPos(&v143)->x < 462 )
|
|
4227 {
|
|
4228 v2 = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&pItemCount);
|
|
4229 if ( v2 )
|
629
|
4230 {
|
900
|
4231 v3 = (ItemGen *)&pPlayers[uActiveCharacter]->pInventoryItems[v2-1];
|
|
4232 if (v3->Identified())
|
|
4233 v5 = "%24";
|
|
4234 else
|
|
4235 {
|
917
|
4236 v8 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(v3, BildingType_ArmorShop, (int)window_SpeakInHouse->ptr_1C, 4);
|
900
|
4237 v5 = (char *)pMerchantsIdentifyPhrases[v8];
|
|
4238 }
|
|
4239 v6 = BuilDialogueString(v5, uActiveCharacter - 1, v3, (char *)window_SpeakInHouse->ptr_1C, 4, 0);
|
|
4240 v115 = (174 - pFontArrus->CalcTextHeight(v6, &dialog_window, 0, 0)) / 2 + 138;
|
|
4241 dialog_window.DrawTitleText(pFontArrus, 0, v115, pWhiteColor, v6, 3);
|
|
4242 return;
|
629
|
4243 }
|
900
|
4244 }
|
629
|
4245 }
|
900
|
4246 }
|
|
4247 }
|
|
4248 break;
|
747
|
4249 case HOUSE_DIALOGUE_SHOP_REPAIR:
|
900
|
4250 {
|
|
4251 draw_leather();
|
984
|
4252 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true);
|
900
|
4253 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[198], 0);
|
|
4254 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win())
|
|
4255 return;
|
|
4256 if( (v31 = pMouse->GetCursorPos(&v135)->x - 14,
|
|
4257 pItemCount = (v31 >> 5) + 14 * ((pMouse->GetCursorPos(&v142)->y - 17) >> 5),
|
629
|
4258 pMouse->GetCursorPos(&v140)->x <= 13)
|
|
4259 || pMouse->GetCursorPos(&v138)->x >= 462
|
900
|
4260 || (v32 = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&pItemCount), v11 = 0, !v32)
|
1019
|
4261 || (!(pPlayers[uActiveCharacter]->pOwnItems[v32-1].uAttributes& 2)) )
|
900
|
4262 return;
|
|
4263 v116 = &pPlayers[uActiveCharacter]->pInventoryItems[v33 - 1];
|
1019
|
4264 v35 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(&pPlayers[uActiveCharacter]->pInventoryItems[v32 - 1], BildingType_ArmorShop, window_SpeakInHouse->par1C, 5);
|
900
|
4265 v15 = (char *)pMerchantsRepairPhrases[v35];
|
|
4266 v36 = BuilDialogueString(v15, uActiveCharacter - 1, v116, (char *)window_SpeakInHouse->ptr_1C, 5, 0);
|
|
4267 v115 = (174 - pFontArrus->CalcTextHeight(v36, &dialog_window, 0, 0)) / 2 + 138;
|
|
4268 dialog_window.DrawTitleText(pFontArrus, 0, v115, pWhiteColor, v36, 3);
|
|
4269 return;
|
|
4270 }
|
|
4271 break;
|
|
4272 case HOUSE_DIALOGUE_SHOP_6: //buy standart ???
|
|
4273 {
|
|
4274 pRenderer->DrawTextureIndexed(8u, 8u, ShopTexture);
|
|
4275 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[195], 0); //"Select the Item to Buy"
|
|
4276 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
|
629
|
4277 return;
|
900
|
4278 pItemCount = 0;
|
|
4279 for( int i = 0; i < 6 ; ++i )
|
|
4280 if (pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][i].uItemID)
|
|
4281 ++pItemCount;
|
|
4282 if ( pItemCount )
|
|
4283 {
|
|
4284 v94 = pMouse->GetCursorPos(&v132);
|
|
4285 pItemCount = pRenderer->pActiveZBuffer[v94->x + pSRZBufferLineOffsets[pMouse->GetCursorPos((POINT *)&v130)->y]];
|
|
4286 v95 = pItemCount;
|
|
4287 if ( pItemCount && pItemCount != -65536 )
|
629
|
4288 {
|
900
|
4289 --pItemCount;
|
|
4290 v97 = uActiveCharacter - 1;
|
917
|
4291 v99 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(&pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][v95-1], BildingType_ArmorShop, window_SpeakInHouse->par1C, 2);
|
900
|
4292 v100 = BuilDialogueString((char *)pMerchantsBuyPhrases[v99], uActiveCharacter - 1, v98, (char *)window_SpeakInHouse->par1C, 2, 0);
|
|
4293 v103 = pFontArrus->CalcTextHeight(v100, &dialog_window, 0, 0);
|
|
4294 dialog_window.DrawTitleText(pFontArrus, 0, (174 - v103) / 2 + 138, pWhiteColor, v100, 3);
|
|
4295 }
|
|
4296 v104 = 0;
|
|
4297 v153 = 0;
|
|
4298 do
|
|
4299 {
|
|
4300 //if ( pParty->field_C59C[9 * (v104 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] )
|
|
4301 if (pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][v104].uItemID)
|
|
4302 {
|
|
4303 v105 = ItemsInShopTexture[v104];
|
|
4304 if ( v104 >= 4 )
|
|
4305 {
|
|
4306 v110 = 90 - ((signed int)v105->uTextureWidth >> 1);
|
|
4307 pRenderer->DrawTextureTransparent(v153 + v110 - 420, 0x7Eu, ItemsInShopTexture[v104]);
|
|
4308 v127 = v104 + 1;
|
|
4309 v109 = v153 + v110 + 80220;
|
|
4310 }
|
|
4311 else
|
629
|
4312 {
|
900
|
4313 v106 = 98 - v105->uTextureHeight;
|
|
4314 v108 = 98 - v105->uTextureHeight;
|
|
4315 v152 = 86 - ((signed int)v105->uTextureWidth >> 1);
|
|
4316 pRenderer->DrawTextureTransparent(v152 + v153, v108, ItemsInShopTexture[v104]);
|
|
4317 v127 = v104 + 1;
|
|
4318 v109 = v152 + v153 + 640 * v106;
|
629
|
4319 }
|
900
|
4320 ZBuffer_DoFill(&pRenderer->pActiveZBuffer[v109], ItemsInShopTexture[v104], v127);
|
|
4321 }
|
|
4322 v153 += 105;
|
|
4323 ++v104;
|
629
|
4324 }
|
900
|
4325 while ( v104 < 8 );
|
|
4326 return;
|
|
4327 }
|
|
4328 dialog_window.DrawCurrentTime(pParty->field_3C.field_50[window_SpeakInHouse->par1C]- pParty->uTimePlayed);
|
|
4329 return;
|
|
4330 }
|
|
4331 break;
|
|
4332 case HOUSE_DIALOGUE_LEARN_SKILLS:
|
|
4333 {
|
|
4334 if (!sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
|
|
4335 return;
|
|
4336 v152 = 0;
|
|
4337 v38 = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0);
|
|
4338 pActiveButton = v38 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100;
|
|
4339 if ( (signed int)pActiveButton < v38 / 3 )
|
|
4340 pActiveButton = v38 / 3;
|
907
|
4341 v39 = pDialogueWindow->pStartingPosActiveItem;
|
|
4342 v40 = pDialogueWindow->pNumPresenceButton;
|
900
|
4343 v153 = 0;
|
|
4344 if ( (signed int)v39 < (signed int)(v39 + v40) )
|
|
4345 {
|
|
4346 do
|
629
|
4347 {
|
907
|
4348 v41 = pDialogueWindow->GetControl(v39)->msg_param - 36;
|
900
|
4349 if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][v41] && !pPlayers[uActiveCharacter]->pActiveSkills[v41] )
|
|
4350 {
|
|
4351 v42 = pFontArrus->CalcTextHeight(pSkillNames[v41], &dialog_window, 0, 0);
|
|
4352 v152 += v42;
|
|
4353 ++v153;
|
|
4354 }
|
|
4355 ++v39;
|
|
4356 }
|
907
|
4357 while ( (signed int)v39 < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem );
|
900
|
4358 if ( v153 )
|
|
4359 {
|
|
4360 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], pActiveButton);
|
|
4361 dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3);
|
|
4362 pActiveButton = (149 - v152) / v153;
|
|
4363 if ( (149 - v152) / v153 > 32 )
|
|
4364 pActiveButton = 32;
|
|
4365 v43 = (149 - v153 * (signed int)pActiveButton - v152) / 2 - (signed int)pActiveButton / 2 + 162;
|
907
|
4366 v152 = pDialogueWindow->pStartingPosActiveItem;
|
900
|
4367 v146 = v43;
|
907
|
4368 if ( v152 < v152 + pDialogueWindow->pNumPresenceButton )
|
900
|
4369 {
|
629
|
4370 v153 = 2;
|
|
4371 do
|
|
4372 {
|
907
|
4373 pButton = pDialogueWindow->GetControl(v152);
|
900
|
4374 v46 = pButton->msg_param - 36;
|
|
4375 if ( !byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][v46] || pPlayers[uActiveCharacter]->pActiveSkills[v46] )
|
|
4376 {
|
|
4377 pButton->uW = 0;
|
|
4378 pButton->uHeight = 0;
|
|
4379 pButton->uY = 0;
|
|
4380 }
|
|
4381 else
|
|
4382 {
|
|
4383 pButton->uY = (unsigned int)((char *)pActiveButton + v146);
|
|
4384 pTextHeight = pFontArrus->CalcTextHeight(pSkillNames[v46], &dialog_window, 0, 0);
|
|
4385 v49 = pButton->uY;
|
|
4386 pButton->uHeight = pTextHeight;
|
|
4387 v51 = v49 + pTextHeight - 1;
|
|
4388 pButton->uW = v51;
|
|
4389 v146 = v51;
|
|
4390 pTextColor = pYellowColor;
|
|
4391 if ( pDialogueWindow->pCurrentPosActiveItem != v153 )
|
|
4392 pTextColor = pWhiteColor;
|
|
4393 dialog_window.DrawTitleText(pFontArrus, 0, v49, pTextColor, pSkillNames[v46], 3);
|
|
4394 }
|
907
|
4395 v53 = pDialogueWindow->pStartingPosActiveItem;
|
900
|
4396 ++v152;
|
907
|
4397 textureH = pDialogueWindow->pNumPresenceButton + v53;
|
900
|
4398 ++v153;
|
629
|
4399 }
|
900
|
4400 while ( v152 < textureH );
|
|
4401 }
|
|
4402 return;
|
629
|
4403 }
|
|
4404 }
|
900
|
4405 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]); //"Seek knowledge elsewhere %s the %s"
|
|
4406 strcat(pTmpBuf, "\n \n");
|
|
4407 strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]); //"I can offer you nothing further."
|
|
4408 v115 = (174 - pFontArrus->CalcTextHeight(pTmpBuf, &dialog_window, 0, 0)) / 2 + 138;
|
|
4409 dialog_window.DrawTitleText(pFontArrus, 0, v115, pYellowColor, pTmpBuf, 3);
|
|
4410 return;
|
629
|
4411 }
|
900
|
4412 break;
|
|
4413 }
|
|
4414 }
|
629
|
4415
|
881
|
4416 //----- (004B5D7C) --------------------------------------------------------
|
|
4417 void GuildDialog()
|
|
4418 {
|
893
|
4419 signed int base_teach_price; // ebx@1
|
|
4420 int v3; // edi@6
|
|
4421 int result; // eax@11
|
|
4422 int v6; // esi@13
|
|
4423 signed int v7; // esi@17
|
|
4424 int v8; // esi@22
|
|
4425 signed int v9; // ecx@22
|
|
4426 char *v10; // eax@22
|
|
4427 const char *statusbar_string; // ecx@26
|
|
4428 POINT *v12; // esi@30
|
|
4429 int v13; // ecx@30
|
|
4430 void *v14; // ST1C_4@31
|
|
4431 ItemGen *v15; // ST18_4@31
|
|
4432 int v16; // ST10_4@31
|
|
4433 int v17; // eax@31
|
|
4434 char *v18; // edx@31
|
|
4435 int v19; // eax@32
|
|
4436 int pActiveItem; // esi@35
|
|
4437 int v22; // eax@35
|
|
4438 unsigned int v23; // eax@36
|
|
4439 int v24; // eax@39
|
|
4440 int v25; // eax@40
|
|
4441 int v26; // ecx@47
|
|
4442 GUIButton *pButton; // eax@49
|
|
4443 unsigned int v29; // eax@49
|
|
4444 char *pText; // eax@52
|
|
4445 int pTextHeight; // eax@55
|
|
4446 unsigned int v32; // ecx@55
|
|
4447 int v33; // eax@55
|
|
4448 unsigned __int16 pTextColor; // ax@55
|
|
4449 int v35; // eax@58
|
|
4450 const char *v36; // ST20_4@61
|
|
4451 unsigned __int16 v37; // ST1C_2@61
|
|
4452 int v38; // eax@61
|
|
4453 int v40; // [sp-14h] [bp-300h]@31
|
|
4454 int v41; // [sp-10h] [bp-2FCh]@31
|
|
4455 unsigned __int16 v42; // [sp-Ch] [bp-2F8h]@31
|
|
4456 char *v43; // [sp-8h] [bp-2F4h]@31
|
|
4457 unsigned int v44; // [sp-4h] [bp-2F0h]@31
|
|
4458 char Dest[100]; // [sp+Ch] [bp-2E0h]@3
|
|
4459 char v46[100]; // [sp+70h] [bp-27Ch]@3
|
|
4460 char v47[100]; // [sp+D4h] [bp-218h]@3
|
|
4461 char v48[100]; // [sp+138h] [bp-1B4h]@3
|
|
4462 char v49[100]; // [sp+19Ch] [bp-150h]@3
|
|
4463 POINT v50; // [sp+264h] [bp-88h]@30
|
|
4464 POINT v51; // [sp+26Ch] [bp-80h]@30
|
|
4465 GUIWindow working_window; // [sp+274h] [bp-78h]@1
|
|
4466 signed int v53; // [sp+27Ch] [bp-70h]@1
|
|
4467 signed int v54; // [sp+284h] [bp-68h]@1
|
|
4468 int pColorWhite; // [sp+2CCh] [bp-20h]@1
|
|
4469 int pColorYellow; // [sp+2D0h] [bp-1Ch]@1
|
|
4470 int v58; // [sp+2D4h] [bp-18h]@1
|
|
4471 unsigned __int8 uPlayerID; // [sp+2DBh] [bp-11h]@31
|
881
|
4472 bool pSkillFlag; // [sp+2DCh] [bp-10h]@35
|
893
|
4473 int v61; // [sp+2E0h] [bp-Ch]@35
|
881
|
4474 int pItemNum;
|
893
|
4475 unsigned int v62; // [sp+2E4h] [bp-8h]@13
|
|
4476 int v63; // [sp+2E8h] [bp-4h]@1
|
881
|
4477 int pNumActivItem;
|
|
4478 int all_text_height;
|
629
|
4479
|
881
|
4480 memcpy(&working_window, window_SpeakInHouse, sizeof(GUIWindow));
|
|
4481 working_window.uFrameX = 483;
|
|
4482 working_window.uFrameWidth = 148;
|
|
4483 working_window.uFrameZ = 334;
|
949
|
4484 pColorWhite = TargetColor(0xFFu, 0xFFu, 0xFFu);
|
|
4485 pColorYellow = TargetColor(0xFFu, 0xFFu, 0x9Bu);
|
881
|
4486 base_teach_price = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier * 500.0);
|
|
4487 v63 = base_teach_price * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100;
|
|
4488 if ( v63 < base_teach_price / 3 )
|
|
4489 v63 = base_teach_price / 3;
|
|
4490 strcpy(Dest, "");
|
|
4491 strcpy(v46, "");
|
|
4492 strcpy(v47, "");
|
|
4493 strcpy(v48, "");
|
|
4494 strcpy(v49, "");
|
|
4495 if ( dialog_menu_id != HOUSE_DIALOGUE_MAIN )
|
|
4496 {
|
|
4497 if ( dialog_menu_id != HOUSE_DIALOGUE_GUILD_BUY_BOOKS ) //buy skill
|
|
4498 {
|
|
4499 if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
|
|
4500 {
|
|
4501 if ( pPlayers[uActiveCharacter]->pActiveSkills[dialog_menu_id-36] )
|
|
4502 {
|
|
4503 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[403], pClassNames[dialog_menu_id - 16]); //"You already know the %s skill"
|
|
4504 ShowStatusBarString(pTmpBuf, 2);
|
|
4505 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0);
|
|
4506 }
|
|
4507 else
|
|
4508 {
|
|
4509 if ( pParty->uNumGold < v63 )
|
|
4510 {
|
|
4511 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u); //"You don't have enough gold"
|
|
4512 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful);
|
|
4513 }
|
|
4514 else
|
|
4515 {
|
|
4516 Party::TakeGold(v63);
|
|
4517 pPlayers[uActiveCharacter]->pActiveSkills[dialog_menu_id-36] = 1;
|
|
4518 }
|
|
4519 }
|
|
4520 }
|
|
4521 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
|
|
4522 return;
|
|
4523 }
|
|
4524 pRenderer->DrawTextureIndexed(8, 8, ShopTexture);
|
|
4525 v6 = 0;
|
|
4526 v62 = 0;
|
|
4527 v63 = 32;
|
|
4528 do
|
|
4529 {
|
|
4530 if (pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C-139][v6].uItemID)
|
|
4531 {
|
|
4532 pRenderer->DrawTextureTransparent(v63, 0x5Au, ItemsInShopTexture[v6]);
|
|
4533 ZBuffer_DoFill((int *)((char *)pRenderer->pActiveZBuffer + v62 + 230528), ItemsInShopTexture[v6], v6 + 1);
|
|
4534 }
|
|
4535 v63 += 70;
|
|
4536 v62 += 280;
|
|
4537 ++v6;
|
|
4538 }
|
|
4539 while ( v63 < 452 );
|
|
4540 v62 = 1680;
|
|
4541 v7 = 6;
|
|
4542 v63 = 32;
|
|
4543 do
|
|
4544 {
|
|
4545 if (pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C-139][v7].uItemID)
|
|
4546 {
|
|
4547 pRenderer->DrawTextureTransparent(v63, 0xFAu, ItemsInShopTexture[v7]);
|
|
4548 ZBuffer_DoFill((int *)((char *)pRenderer->pActiveZBuffer + v62 + 638448), ItemsInShopTexture[v7], v7 + 1);
|
|
4549 }
|
|
4550 v63 += 70;
|
|
4551 v62 += 280;
|
|
4552 ++v7;
|
|
4553 }
|
|
4554 while ( v63 < 452 );
|
|
4555 if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
|
|
4556 {
|
|
4557 v8 = 0;
|
|
4558 v9 = 12;
|
|
4559 do
|
|
4560 {
|
|
4561 if (pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C-139][v9].uItemID )
|
|
4562 ++v8;
|
|
4563 --v9;
|
|
4564 }
|
|
4565 while ( v9 );
|
|
4566 GetAsyncKeyState(17);
|
|
4567 statusbar_string = pGlobalTXT_LocalizationStrings[195]; //"Select the Item to Buy"
|
|
4568 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD)
|
|
4569 statusbar_string = pGlobalTXT_LocalizationStrings[196]; //"Select the Special Item to Buy"
|
|
4570 DrawTextAtStatusBar(statusbar_string, 0);
|
|
4571 if ( !v8 )
|
|
4572 {
|
|
4573 working_window.DrawCurrentTime(__PAIR__( *(int *)&stru_AA1058[3].pSounds[8 * (unsigned int)window_SpeakInHouse->ptr_1C + 44472],
|
|
4574 *(int *)&stru_AA1058[3].pSounds[8 * (unsigned int)window_SpeakInHouse->ptr_1C + 44468]) - pParty->uTimePlayed);
|
|
4575 return;
|
|
4576 }
|
|
4577 v12 = pMouse->GetCursorPos(&v51);
|
|
4578 result = v12->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v50)->y];
|
|
4579 v13 = pRenderer->pActiveZBuffer[result] & 0xFFFF;
|
|
4580 if ( pRenderer->pActiveZBuffer[result] & 0xFFFF )
|
|
4581 {
|
|
4582 v14 = window_SpeakInHouse->ptr_1C;
|
|
4583 v15 = (ItemGen *)(&pParty->pPlayers[1].uExpressionTimeLength + 18 * (v13 + 12 * (int)v14));
|
|
4584 v16 = (int)window_SpeakInHouse->ptr_1C;
|
|
4585 uPlayerID = uActiveCharacter - 1;
|
917
|
4586 v17 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction( (ItemGen *)&pParty->pPlayers[1].uExpressionTimeLength + v13 + 12 * (int)v14, BildingType_MagicShop, v16, 2);
|
881
|
4587 v18 = BuilDialogueString((char *)pMerchantsBuyPhrases[v17], uPlayerID, v15, (char *)v14, 2, 0);
|
|
4588 v19 = pFontArrus->CalcTextHeight(v18, &working_window, 0, 0);
|
|
4589 working_window.DrawTitleText(pFontArrus, 0, (174 - v19) / 2 + 138, pColorWhite, v18, 3);
|
|
4590 return;
|
|
4591 }
|
|
4592 }
|
|
4593 return;
|
|
4594 }
|
|
4595 if ( !(unsigned __int16)_449B57_test_bit((unsigned __int8 *)pPlayers[uActiveCharacter]->_guilds_member_bits,
|
629
|
4596 guild_mambership_flags[(unsigned int)window_SpeakInHouse->ptr_1C-139]) )
|
881
|
4597 { //you must me member
|
|
4598 v38 = pFontArrus->CalcTextHeight(pNPCTopics[121].pText, &working_window, 0, 0);
|
|
4599 working_window.DrawTitleText(pFontArrus, 0, (212 - v38) / 2 + 101, pColorYellow, pNPCTopics[121].pText, 3u);
|
|
4600 pDialogueWindow->pNumPresenceButton = 0;
|
|
4601 return;
|
|
4602 }
|
|
4603 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
|
|
4604 return;
|
|
4605 v61 = 0;
|
|
4606 pSkillFlag = false;
|
|
4607 pActiveItem = pDialogueWindow->pStartingPosActiveItem;
|
|
4608 v22 = pActiveItem + pDialogueWindow->pNumPresenceButton;
|
|
4609 pItemNum = 0;
|
|
4610 if ( pDialogueWindow->pStartingPosActiveItem >= pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton )
|
|
4611 {
|
|
4612 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]); // "Seek knowledge elsewhere %s the %s"
|
|
4613 strcat(pTmpBuf, "\n \n");
|
|
4614 strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]); //"I can offer you nothing further."
|
|
4615 v19 = pFontArrus->CalcTextHeight(pTmpBuf, &working_window, 0, 0);
|
|
4616 working_window.DrawTitleText(pFontArrus, 0, (174 - v19) / 2 + 138, pColorYellow, pTmpBuf, 3);
|
|
4617 return;
|
|
4618 }
|
|
4619 all_text_height = 0;
|
|
4620 do
|
|
4621 {
|
|
4622 v23 = pDialogueWindow->GetControl(pActiveItem)->msg_param;
|
|
4623 if ( v23 == 18 )
|
|
4624 {
|
|
4625 all_text_height += pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[400], &working_window, 0, 0); //"Buy Spells"
|
|
4626 v61++;
|
|
4627 }
|
|
4628 else
|
|
4629 {
|
893
|
4630 if( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][v23 - 36]
|
|
4631 && !pPlayers[uActiveCharacter]->pActiveSkills[v23 - 36] )
|
881
|
4632 {
|
|
4633 all_text_height += pFontArrus->CalcTextHeight(pSkillNames[v23 - 36], &working_window, 0, 0);
|
|
4634 v61++;
|
|
4635 pSkillFlag = true;
|
|
4636 }
|
|
4637 }
|
|
4638 ++pActiveItem;
|
|
4639 }
|
|
4640 while ( pActiveItem < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem );
|
|
4641 if ( !v61 )
|
|
4642 {
|
|
4643 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]); // "Seek knowledge elsewhere %s the %s"
|
|
4644 strcat(pTmpBuf, "\n \n");
|
|
4645 strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]); //"I can offer you nothing further."
|
|
4646 v19 = pFontArrus->CalcTextHeight(pTmpBuf, &working_window, 0, 0);
|
|
4647 working_window.DrawTitleText(pFontArrus, 0, (174 - v19) / 2 + 138, pColorYellow, pTmpBuf, 3);
|
|
4648 return;
|
|
4649 }
|
|
4650 if ( pSkillFlag )
|
|
4651 {
|
|
4652 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], v63); //"Skill Cost: %lu"
|
|
4653 working_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3);
|
|
4654 }
|
|
4655 v58 = (149 - all_text_height) / v61;
|
|
4656 if ( v58 > 32 )
|
|
4657 v58 = 32;
|
|
4658 v26 = (149 - v61 * v58 - all_text_height) / 2 - v58 / 2 + 162;
|
|
4659 pNumActivItem = pDialogueWindow->pStartingPosActiveItem;
|
|
4660 if (pDialogueWindow->pStartingPosActiveItem < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton )
|
|
4661 {
|
|
4662 pItemNum = 2;
|
|
4663 do
|
|
4664 {
|
|
4665 pButton = pDialogueWindow->GetControl(pItemNum);
|
|
4666 v29 = pButton->msg_param;
|
|
4667 if ( v29 == 18 )
|
|
4668 {
|
|
4669 pText = pGlobalTXT_LocalizationStrings[400]; //"Buy Spells"
|
|
4670 pButton->uY = v58 + v26;
|
|
4671 pTextHeight = pFontArrus->CalcTextHeight(pText, &working_window, 0, 0);
|
|
4672 v32 = pButton->uY;
|
|
4673 pButton->uHeight = pTextHeight;
|
|
4674 v33 = v32 + pTextHeight - 1;
|
|
4675 pButton->uW = v33;
|
|
4676 v26 = v33;
|
|
4677 pTextColor = pColorYellow;
|
|
4678 if ( pDialogueWindow->pCurrentPosActiveItem != pItemNum )
|
|
4679 pTextColor = pColorWhite;
|
|
4680 working_window.DrawTitleText(pFontArrus, 0, v32, pTextColor, pText, 3);
|
|
4681 }
|
|
4682 else
|
|
4683 {
|
893
|
4684 if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][v29 - 36]
|
|
4685 && !pPlayers[uActiveCharacter]->pActiveSkills[v29 - 36] )
|
886
|
4686 {
|
|
4687 pButton->uY = v58 + v26;
|
|
4688 pTextHeight = pFontArrus->CalcTextHeight(pSkillNames[v29 - 36], &working_window, 0, 0);
|
|
4689 v32 = pButton->uY;
|
|
4690 pButton->uHeight = pTextHeight;
|
|
4691 v33 = v32 + pTextHeight - 1;
|
|
4692 pButton->uW = v33;
|
|
4693 v26 = v33;
|
|
4694 pTextColor = pColorYellow;
|
|
4695 if ( pDialogueWindow->pCurrentPosActiveItem != pItemNum )
|
|
4696 pTextColor = pColorWhite;
|
|
4697 working_window.DrawTitleText(pFontArrus, 0, v32, pTextColor, pSkillNames[v29 - 36], 3);
|
|
4698 }
|
893
|
4699 else
|
|
4700 {
|
886
|
4701 pButton->uW = 0;
|
|
4702 pButton->uHeight = 0;
|
|
4703 pButton->uY = 0;
|
893
|
4704 }
|
|
4705 }
|
881
|
4706 ++pItemNum;
|
|
4707 }
|
|
4708 while ( pItemNum < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem );
|
|
4709 }
|
|
4710 return;
|
|
4711 }
|
629
|
4712
|
|
4713 //----- (004B705E) --------------------------------------------------------
|
|
4714 void TempleDialog()
|
|
4715 {
|
|
4716 GUIWindow *v0; // ebx@1
|
|
4717 Player *v1; // esi@1
|
|
4718 int v2; // edi@1
|
|
4719 int result; // eax@4
|
|
4720 GUIWindow *v4; // edi@6
|
|
4721 void *v5; // eax@6
|
|
4722 int v6; // eax@6
|
|
4723 unsigned int v7; // eax@8
|
|
4724 int v8; // ecx@8
|
|
4725 unsigned int v9; // eax@9
|
|
4726 int v10; // eax@11
|
|
4727 int v11; // eax@12
|
|
4728 GUIWindow *v12; // ecx@16
|
|
4729 int v13; // edx@16
|
|
4730 GUIButton *v14; // eax@19
|
|
4731 GUIButton *v15; // edi@19
|
|
4732 int v16; // eax@19
|
|
4733 const char *v17; // eax@21
|
|
4734 int v18; // eax@21
|
|
4735 unsigned int v19; // ecx@21
|
|
4736 int v20; // eax@21
|
|
4737 unsigned __int16 v21; // ax@21
|
|
4738 unsigned __int16 v22; // ST14_2@27
|
|
4739 int v23; // eax@27
|
|
4740 double v24; // st7@28
|
|
4741 unsigned int v25; // ebx@28
|
|
4742 DDM_DLV_Header *v26; // edi@29
|
|
4743 int v27; // eax@31
|
|
4744 int v28; // eax@32
|
|
4745 //unsigned int v29; // ecx@34
|
|
4746 unsigned int v30; // edx@36
|
|
4747 unsigned int v31; // edx@38
|
|
4748 unsigned int v32; // edx@40
|
|
4749 unsigned int v33; // edx@42
|
|
4750 unsigned int v34; // edx@44
|
|
4751 int v35; // edi@50
|
|
4752 signed int v36; // eax@50
|
|
4753 unsigned __int8 v37; // al@54
|
|
4754 int v38; // ecx@54
|
|
4755 GUIWindow *v39; // eax@56
|
|
4756 unsigned __int8 v40; // al@61
|
|
4757 GUIButton *v41; // edi@64
|
|
4758 int v42; // esi@66
|
|
4759 GUIWindow *v43; // ecx@66
|
|
4760 int v44; // edi@66
|
|
4761 int v45; // eax@68
|
|
4762 signed int v46; // edi@69
|
|
4763 int v47; // edi@71
|
|
4764 GUIButton *v48; // eax@73
|
|
4765 const char *v49; // edx@73
|
|
4766 GUIButton *v50; // esi@73
|
|
4767 int v51; // eax@73
|
|
4768 unsigned int v52; // ecx@73
|
|
4769 unsigned __int16 v53; // ax@73
|
|
4770 char a1[300]; // [sp+10h] [bp-1B4h]@64
|
|
4771 GUIWindow v57; // [sp+13Ch] [bp-88h]@1
|
|
4772 __int64 v58; // [sp+190h] [bp-34h]@1
|
|
4773 __int64 v59; // [sp+198h] [bp-2Ch]@1
|
|
4774 __int64 v60; // [sp+1A0h] [bp-24h]@1
|
|
4775 GUIWindow *v61; // [sp+1ACh] [bp-18h]@6
|
|
4776 unsigned int v62; // [sp+1B0h] [bp-14h]@8
|
|
4777 unsigned __int8 v63; // [sp+1B7h] [bp-Dh]@64
|
|
4778 int v64; // [sp+1B8h] [bp-Ch]@6
|
|
4779 unsigned int v65; // [sp+1BCh] [bp-8h]@6
|
|
4780 DDM_DLV_Header *v66; // [sp+1C0h] [bp-4h]@6
|
|
4781
|
|
4782 v0 = window_SpeakInHouse;
|
|
4783 memcpy(&v57, window_SpeakInHouse, sizeof(v57));
|
|
4784 v57.uFrameX = 483;
|
|
4785 v57.uFrameWidth = 148;
|
|
4786 v57.uFrameZ = 334;
|
949
|
4787 HIDWORD(v58) = TargetColor(0xFFu, 0xFFu, 0xFFu);
|
|
4788 HIDWORD(v59) = TargetColor(0xFFu, 0xFFu, 0x9Bu);
|
629
|
4789 v1 = pPlayers[uActiveCharacter];
|
|
4790 //v2 = pPlayers[uActiveCharacter]->_4B807C(p2DEvents_minus1__20[13 * (unsigned int)v0->ptr_1C]);
|
1036
|
4791 v2 = pPlayers[uActiveCharacter]->_4B807C(p2DEvents[v0->par1C - 1].fPriceMultiplier);
|
629
|
4792 HIDWORD(v60) = v2;
|
749
|
4793 if ( dialog_menu_id != HOUSE_DIALOGUE_MAIN )
|
900
|
4794 {
|
|
4795 if ( dialog_menu_id != HOUSE_DIALOGUE_TEMPLE_HEAL )
|
|
4796 {
|
|
4797 if ( dialog_menu_id != HOUSE_DIALOGUE_TEMPLE_DONATE )
|
629
|
4798 {
|
900
|
4799 if ( dialog_menu_id == HOUSE_DIALOGUE_LEARN_SKILLS )
|
|
4800 {
|
|
4801 if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
|
629
|
4802 {
|
900
|
4803 v4 = pDialogueWindow;
|
|
4804 v61 = pDialogueWindow;
|
|
4805 v5 = window_SpeakInHouse->ptr_1C;
|
|
4806 v66 = 0;
|
|
4807 //v65 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (signed int)v5] * 500.0);
|
|
4808 v65 = (signed __int64)(p2DEvents[(signed int)v5 - 1].flt_24 * 500.0);
|
|
4809 v6 = v1->GetMerchant();
|
|
4810 v64 = (signed int)(v65 * (100 - v6)) / 100;
|
|
4811 if ( v64 < (signed int)v65 / 3 )
|
|
4812 v64 = (signed int)v65 / 3;
|
|
4813 v7 = v4->pStartingPosActiveItem;
|
|
4814 v8 = v7 + v4->pNumPresenceButton;
|
|
4815 v65 = 0;
|
|
4816 v62 = v7;
|
|
4817 if ( (signed int)v7 >= v8 )
|
|
4818 goto LABEL_78;
|
|
4819 do
|
|
4820 {
|
|
4821 v9 = v4->GetControl(v62)->msg_param - 36;
|
|
4822 if ( byte_4ED970_skill_learn_ability_by_class_table[v1->classType][v9] && !v1->pActiveSkills[v9] )
|
629
|
4823 {
|
900
|
4824 v10 = pFontArrus->CalcTextHeight(pSkillNames[v9], &v57, 0, 0);
|
|
4825 v66 = (DDM_DLV_Header *)((char *)v66 + v10);
|
|
4826 ++v65;
|
|
4827 }
|
|
4828 v11 = v4->pStartingPosActiveItem;
|
|
4829 ++v62;
|
|
4830 }
|
|
4831 while ( (signed int)v62 < v4->pNumPresenceButton + v11 );
|
|
4832 if ( v65 )
|
|
4833 {
|
|
4834 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], v64);
|
|
4835 v57.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u);
|
|
4836 v64 = (149 - (signed int)v66) / (signed int)v65;
|
|
4837 if ( v64 > 32 )
|
|
4838 v64 = 32;
|
|
4839 v65 = (signed int)(149 - v65 * v64 - (int)v66) / 2 - v64 / 2 + 162;
|
|
4840 v12 = v61;
|
|
4841 result = v61->pStartingPosActiveItem;
|
|
4842 v13 = result + v61->pNumPresenceButton;
|
|
4843 v62 = v61->pStartingPosActiveItem;
|
|
4844 if ( result < v13 )
|
|
4845 {
|
|
4846 v66 = (DDM_DLV_Header *)2;
|
|
4847 while ( 1 )
|
|
4848 {
|
|
4849 v14 = v12->GetControl(v62);
|
|
4850 v15 = v14;
|
|
4851 v16 = v14->msg_param - 36;
|
|
4852 if ( !byte_4ED970_skill_learn_ability_by_class_table[v1->classType][v16] || v1->pActiveSkills[v16] )
|
629
|
4853 {
|
900
|
4854 v15->uW = 0;
|
|
4855 v15->uHeight = 0;
|
|
4856 v15->uY = 0;
|
|
4857 }
|
|
4858 else
|
|
4859 {
|
|
4860 v17 = pSkillNames[v16];
|
|
4861 v15->uY = v64 + v65;
|
|
4862 HIDWORD(v60) = (uint32)v17;
|
|
4863 v18 = pFontArrus->CalcTextHeight(v17, &v57, 0, 0);
|
|
4864 v19 = v15->uY;
|
|
4865 v15->uHeight = v18;
|
|
4866 v20 = v19 + v18 - 1;
|
|
4867 v15->uW = v20;
|
|
4868 v65 = v20;
|
|
4869 v21 = WORD2(v59);
|
|
4870 if ( (DDM_DLV_Header *)pDialogueWindow->pCurrentPosActiveItem != v66 )
|
|
4871 v21 = WORD2(v58);
|
|
4872 v57.DrawTitleText(pFontArrus, 0, v19, v21, (const char *)HIDWORD(v60), 3u);
|
|
4873 }
|
|
4874 result = (int)v61;
|
|
4875 ++v62;
|
|
4876 v66 = (DDM_DLV_Header *)((char *)v66 + 1);
|
|
4877 if ( (signed int)v62 >= v61->pNumPresenceButton + v61->pStartingPosActiveItem )
|
|
4878 break;
|
|
4879 v12 = v61;
|
|
4880 }
|
|
4881 }
|
|
4882 }
|
|
4883 else
|
|
4884 {
|
629
|
4885 LABEL_78:
|
900
|
4886 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], v1->pName, pClassNames[v1->classType]);
|
|
4887 strcat(pTmpBuf, "\n \n");
|
|
4888 strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]);
|
|
4889 v22 = WORD2(v59);
|
|
4890 v23 = pFontArrus->CalcTextHeight(pTmpBuf, &v57, 0, 0);
|
|
4891 v57.DrawTitleText(pFontArrus, 0, (174 - v23) / 2 + 138, v22, pTmpBuf, 3u);
|
|
4892 }
|
|
4893 }
|
|
4894 }
|
|
4895 return;
|
|
4896 }
|
|
4897 // DONATION
|
|
4898 //v24 = p2DEvents_minus1__20[13 * (unsigned int)ptr_507BC0->ptr_1C];
|
|
4899 v24 = p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier;
|
|
4900 v25 = 0;
|
|
4901 if ( pParty->uNumGold >= (unsigned int)(signed __int64)v24 )
|
|
4902 {
|
629
|
4903 Party::TakeGold((signed __int64)v24);
|
|
4904 v26 = &pOutdoor->ddm;
|
|
4905 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor )
|
|
4906 v26 = &pIndoor->dlv;
|
|
4907 v27 = v26->uReputation;
|
|
4908 v66 = v26;
|
|
4909 if ( v27 > -5 )
|
|
4910 {
|
|
4911 v28 = v27 - 1;
|
|
4912 v26->uReputation = v28;
|
|
4913 if ( v28 < -5 )
|
|
4914 v26->uReputation = -5;
|
|
4915 }
|
|
4916 if ( (unsigned __int8)byte_F8B1EF[uActiveCharacter] == pParty->uDaysPlayed % 7 )
|
|
4917 {
|
|
4918 if ( v26->uReputation <= -5 )
|
|
4919 {
|
|
4920 v30 = pParty->uDaysPlayed % 7 + 1;
|
|
4921 LOBYTE(v30) = v30 | 0x80;
|
|
4922 _42777D_CastSpell_UseWand_ShootArrow(SPELL_AIR_WIZARD_EYE, uActiveCharacter - 1, v30, 48, 0);
|
|
4923 }
|
|
4924 if ( v26->uReputation <= -10 )
|
|
4925 {
|
|
4926 v31 = pParty->uDaysPlayed % 7 + 1;
|
|
4927 LOBYTE(v31) = v31 | 0x80;
|
|
4928 _42777D_CastSpell_UseWand_ShootArrow(SPELL_SPIRIT_PRESERVATION, uActiveCharacter - 1, v31, 48, 0);
|
|
4929 v26 = v66;
|
|
4930 }
|
|
4931 if ( v26->uReputation <= -15 )
|
|
4932 {
|
|
4933 v32 = pParty->uDaysPlayed % 7 + 1;
|
|
4934 LOBYTE(v32) = v32 | 0x80;
|
|
4935 _42777D_CastSpell_UseWand_ShootArrow(SPELL_BODY_PROTECTION_FROM_MAGIC, uActiveCharacter - 1, v32, 48, 0);
|
|
4936 v26 = v66;
|
|
4937 }
|
|
4938 if ( v26->uReputation <= -20 )
|
|
4939 {
|
|
4940 v33 = pParty->uDaysPlayed % 7 + 1;
|
|
4941 LOBYTE(v33) = v33 | 0x80;
|
|
4942 _42777D_CastSpell_UseWand_ShootArrow(SPELL_LIGHT_HOUR_OF_POWER, uActiveCharacter - 1, v33, 48, 0);
|
|
4943 v26 = v66;
|
|
4944 }
|
|
4945 if ( v26->uReputation <= -25 )
|
|
4946 {
|
|
4947 v34 = pParty->uDaysPlayed % 7 + 1;
|
|
4948 LOBYTE(v34) = v34 | 0x80;
|
|
4949 _42777D_CastSpell_UseWand_ShootArrow(SPELL_LIGHT_DAY_OF_PROTECTION, uActiveCharacter - 1, v34, 48, 0);
|
|
4950 }
|
|
4951 }
|
|
4952 ++byte_F8B1EF[uActiveCharacter];
|
|
4953 v1->PlaySound(SPEECH_83, 0);
|
|
4954 ShowStatusBarString(pGlobalTXT_LocalizationStrings[527], 2u); // "Thank You!"
|
900
|
4955 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, v25);
|
|
4956 return;
|
|
4957 }
|
|
4958 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u);
|
|
4959 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful);
|
|
4960 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, v25);
|
|
4961 return;
|
|
4962 }
|
629
|
4963 if ( !v1->_4B6FF9() )
|
|
4964 return;
|
|
4965 v25 = 0;
|
|
4966 if ( pParty->uNumGold < v2 )
|
900
|
4967 {
|
|
4968 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u);
|
|
4969 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful);
|
|
4970 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, v25);
|
|
4971 return;
|
|
4972 }
|
629
|
4973 Party::TakeGold(v2);
|
|
4974 v35 = LODWORD(v1->pConditions[17]);
|
|
4975 v59 = v1->pConditions[14];
|
|
4976 v58 = v1->pConditions[15];
|
|
4977 v60 = v1->pConditions[16];
|
|
4978 v61 = (GUIWindow *)HIDWORD(v1->pConditions[17]);
|
|
4979 memset(v1, 0, 0xA0u);
|
|
4980 v1->sHealth = v1->GetMaxHealth();
|
|
4981 v1->sMana = v1->GetMaxMana();
|
|
4982 v36 = (signed int)window_SpeakInHouse->ptr_1C;
|
|
4983 if ( v36 != 78 && (v36 <= 80 || v36 > 82) )
|
|
4984 {
|
|
4985 if ( (unsigned int)v61 | v35 )
|
|
4986 {
|
1014
|
4987 v37 = LOBYTE(v1->uPrevFace);
|
|
4988 v38 = v1->uPrevVoiceID;
|
|
4989 v1->uCurrentFace = v37;
|
629
|
4990 v1->uVoiceID = v38;
|
|
4991 ReloadPlayerPortraits(uActiveCharacter - 1, (char)v37);
|
|
4992 }
|
900
|
4993 pAudioPlayer->PlaySound((SoundID)(SOUND_GoldReceived|0x2), -1, 0, -1, 0, 0, 0, 0);
|
|
4994 v1->PlaySound(SPEECH_82, 0);
|
|
4995 pOtherOverlayList->_4418B1(20, uActiveCharacter + 99, 0, 65536);
|
|
4996 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, v25);
|
|
4997 return;
|
629
|
4998 }
|
|
4999 v39 = v61;
|
|
5000 if ( (unsigned int)v61 | v35 )
|
|
5001 {
|
|
5002 LODWORD(v1->pConditions[17]) = v35;
|
|
5003 }
|
|
5004 else
|
|
5005 {
|
|
5006 if ( !v60 && !v58 && !v59 )
|
900
|
5007 {
|
|
5008 pAudioPlayer->PlaySound((SoundID)(SOUND_GoldReceived|0x2), -1, 0, -1, 0, 0, 0, 0);
|
|
5009 v1->PlaySound(SPEECH_82, 0);
|
|
5010 pOtherOverlayList->_4418B1(20, uActiveCharacter + 99, 0, 65536);
|
|
5011 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, v25);
|
|
5012 return;
|
|
5013 }
|
1014
|
5014 v1->uPrevFace = v1->uCurrentFace;
|
|
5015 v1->uPrevVoiceID = v1->uVoiceID;
|
629
|
5016 v1->SetCondition(0x11u, 1);
|
|
5017 v1->uVoiceID = (v1->GetSexByVoice() != 0) + 23;
|
|
5018 v40 = (v1->GetSexByVoice() != 0) + 23;
|
1014
|
5019 v1->uCurrentFace = v40;
|
629
|
5020 ReloadPlayerPortraits(uActiveCharacter - 1, (char)v40);
|
|
5021 LODWORD(v1->pConditions[17]) = LODWORD(pParty->uTimePlayed);
|
|
5022 v39 = (GUIWindow *)HIDWORD(pParty->uTimePlayed);
|
|
5023 }
|
|
5024 HIDWORD(v1->pConditions[17]) = (int)v39;
|
|
5025 pAudioPlayer->PlaySound((SoundID)(SOUND_GoldReceived|0x2), -1, 0, -1, 0, 0, 0, 0);
|
|
5026 v1->PlaySound(SPEECH_82, 0);
|
|
5027 pOtherOverlayList->_4418B1(20, uActiveCharacter + 99, 0, 65536);
|
|
5028 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, v25);
|
900
|
5029 return; // void func
|
629
|
5030 }
|
|
5031 v63 = 1;
|
|
5032 v41 = pDialogueWindow->GetControl(pDialogueWindow->pStartingPosActiveItem);
|
|
5033 strcpy(a1, "");
|
|
5034 v41->uHeight = 0;
|
|
5035 v41->uY = 0;
|
|
5036 if ( v1->_4B6FF9() )
|
|
5037 {
|
|
5038 sprintf(a1, "%s %d %s", pGlobalTXT_LocalizationStrings[104], HIDWORD(v60), pGlobalTXT_LocalizationStrings[97]);
|
|
5039 v63 = 0;
|
|
5040 }
|
|
5041 strcpy(&a1[100], pGlobalTXT_LocalizationStrings[68]);
|
|
5042 strcpy(&a1[200], pGlobalTXT_LocalizationStrings[160]);
|
|
5043 v42 = v63;
|
|
5044 v43 = pDialogueWindow;
|
|
5045 v44 = v63;
|
|
5046 v66 = 0;
|
|
5047 if ( v63 < pDialogueWindow->pNumPresenceButton )
|
|
5048 {
|
|
5049 v61 = (GUIWindow *)&a1[100 * v63];
|
|
5050 do
|
|
5051 {
|
|
5052 v45 = pFontArrus->CalcTextHeight((const char *)v61, &v57, 0, 0);
|
|
5053 v66 = (DDM_DLV_Header *)((char *)v66 + v45);
|
|
5054 v43 = pDialogueWindow;
|
|
5055 v61 = (GUIWindow *)((char *)v61 + 100);
|
|
5056 ++v44;
|
|
5057 }
|
|
5058 while ( v44 < pDialogueWindow->pNumPresenceButton );
|
|
5059 }
|
|
5060 v46 = v43->pNumPresenceButton - v42;
|
|
5061 v64 = (174 - (signed int)v66) / v46;
|
|
5062 if ( v64 > 32 )
|
|
5063 v64 = 32;
|
|
5064 v47 = (174 - v64 * v46 - (signed int)v66) / 2 - v64 / 2 + 138;
|
|
5065 v65 = v42 + v43->pStartingPosActiveItem;
|
|
5066 if ( v42 + v43->pStartingPosActiveItem < v43->pStartingPosActiveItem + v43->pNumPresenceButton )
|
|
5067 {
|
|
5068 v61 = (GUIWindow *)(v42 + 2);
|
|
5069 v66 = (DDM_DLV_Header *)&a1[100 * v42];
|
|
5070 do
|
|
5071 {
|
|
5072 v48 = v43->GetControl(v65);
|
|
5073 v49 = (const char *)v66;
|
|
5074 v50 = v48;
|
|
5075 v48->uY = v64 + v47;
|
|
5076 v51 = pFontArrus->CalcTextHeight(v49, &v57, 0, 0);
|
|
5077 v52 = v50->uY;
|
|
5078 v50->uHeight = v51;
|
|
5079 v47 = v52 + v51 - 1;
|
|
5080 v50->uW = v47;
|
|
5081 v53 = WORD2(v59);
|
|
5082 if ( (GUIWindow *)pDialogueWindow->pCurrentPosActiveItem != v61 )
|
|
5083 v53 = WORD2(v58);
|
|
5084 v57.DrawTitleText(pFontArrus, 0, v52, v53, (const char *)v66, 3u);
|
|
5085 v43 = pDialogueWindow;
|
|
5086 v66 = (DDM_DLV_Header *)((char *)v66 + 100);
|
|
5087 v61 = (GUIWindow *)((char *)v61 + 1);
|
|
5088 ++v65;
|
|
5089 }
|
|
5090 while ( (signed int)v65 < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem );
|
|
5091 }
|
|
5092 return;
|
|
5093 }
|
|
5094
|
|
5095 //----- (004B4710) --------------------------------------------------------
|
758
|
5096 void TrainingDialog()
|
629
|
5097 {
|
717
|
5098 //Player *v0; // ebx@1
|
629
|
5099 int color2; // eax@1
|
651
|
5100 //unsigned int v2; // ecx@1
|
|
5101 //int v3; // eax@1
|
|
5102 //signed int v4; // edx@1
|
|
5103 unsigned __int64 v5; // edi@3
|
|
5104 //unsigned int v6; // esi@3
|
|
5105 //void *v7; // ecx@3
|
629
|
5106 int v8; // edx@4
|
|
5107 double v9; // st7@6
|
|
5108 signed int v10; // esi@6
|
|
5109 int v11; // ecx@6
|
758
|
5110 //int result; // eax@9
|
629
|
5111 GUIWindow *v13; // edi@14
|
|
5112 signed int v14; // esi@14
|
|
5113 unsigned int v15; // esi@16
|
|
5114 int v16; // eax@16
|
|
5115 unsigned int v17; // eax@17
|
|
5116 int v18; // eax@19
|
|
5117 int v19; // ecx@24
|
|
5118 GUIButton *v20; // eax@26
|
|
5119 GUIButton *v21; // esi@26
|
|
5120 int v22; // eax@26
|
|
5121 const char *v23; // eax@28
|
|
5122 int v24; // eax@28
|
|
5123 unsigned int v25; // ecx@28
|
|
5124 int v26; // eax@28
|
|
5125 unsigned __int16 v27; // ax@28
|
758
|
5126 //int v28; // eax@32
|
629
|
5127 unsigned __int16 v29; // ST14_2@34
|
|
5128 int v30; // eax@34
|
758
|
5129 //const char *v31; // ST18_4@36
|
|
5130 //unsigned __int16 v32; // ST14_2@36
|
629
|
5131 int v33; // eax@36
|
|
5132 int v34; // eax@37
|
|
5133 unsigned int v35; // edi@38
|
|
5134 unsigned int v36; // eax@38
|
758
|
5135 //int v37; // ecx@41
|
|
5136 //char *v38; // eax@41
|
|
5137 //int *v39; // eax@45
|
629
|
5138 unsigned int v40; // eax@46
|
758
|
5139 //void *v41; // ecx@46
|
629
|
5140 unsigned int v42; // eax@46
|
|
5141 GUIWindow *v43; // ecx@59
|
|
5142 int v44; // edx@59
|
|
5143 char **v45; // esi@60
|
758
|
5144 //int v46; // eax@62
|
629
|
5145 int v47; // eax@68
|
758
|
5146 //int v48; // edx@69
|
629
|
5147 int v49; // ebx@69
|
758
|
5148 //unsigned __int8 v50; // sf@69
|
629
|
5149 char **v51; // edi@70
|
|
5150 GUIButton *v52; // eax@71
|
|
5151 GUIButton *v53; // esi@71
|
|
5152 int v54; // eax@71
|
|
5153 unsigned int v55; // ecx@71
|
|
5154 int v56; // eax@71
|
|
5155 unsigned __int16 v57; // ax@71
|
|
5156 unsigned __int16 v58; // [sp-Ch] [bp-90h]@38
|
758
|
5157 //const char *v59; // [sp-Ch] [bp-90h]@63
|
629
|
5158 char *v60; // [sp-8h] [bp-8Ch]@38
|
758
|
5159 //char *v61; // [sp-8h] [bp-8Ch]@63
|
629
|
5160 unsigned int v62; // [sp-4h] [bp-88h]@38
|
|
5161 int v63; // [sp-4h] [bp-88h]@52
|
758
|
5162 //char *v64; // [sp-4h] [bp-88h]@63
|
629
|
5163 GUIWindow v65; // [sp+Ch] [bp-78h]@1
|
651
|
5164 //__int64 v66; // [sp+60h] [bp-24h]@3
|
629
|
5165 unsigned int white; // [sp+68h] [bp-1Ch]@1
|
|
5166 int v68; // [sp+6Ch] [bp-18h]@3
|
|
5167 int v69; // [sp+70h] [bp-14h]@6
|
651
|
5168 //unsigned int i; // [sp+74h] [bp-10h]@1
|
|
5169 //int v71; // [sp+78h] [bp-Ch]@1
|
629
|
5170 int v72; // [sp+7Ch] [bp-8h]@16
|
|
5171 int v73; // [sp+80h] [bp-4h]@14
|
|
5172
|
717
|
5173 //v0 = pPlayers[uActiveCharacter];
|
629
|
5174 memcpy(&v65, window_SpeakInHouse, sizeof(v65));
|
|
5175 v65.uFrameX = 483;
|
|
5176 v65.uFrameWidth = 148;
|
|
5177 v65.uFrameZ = 334;
|
949
|
5178 white = TargetColor(255, 255, 255);
|
|
5179 color2 = TargetColor(0xE1u, 0xCDu, 0x23u);
|
651
|
5180 //v71 = color2;
|
|
5181 //v2 = v0->uLevel;
|
|
5182 //v3 = 0;
|
|
5183 //v4 = 0;
|
|
5184 //for ( i = v2; v4 < (signed int)v2; ++v4 )
|
|
5185 // v3 += v4 + 1;
|
|
5186 //v5 = 1000 * v3;
|
717
|
5187 v5 = 1000ui64 * pPlayers[uActiveCharacter]->uLevel * (pPlayers[uActiveCharacter]->uLevel + 1) / 2; // E n = n(n + 1) / 2
|
651
|
5188 //v6 = HIDWORD(v0->uExperience);
|
|
5189 //v7 = window_SpeakInHouse->ptr_1C;
|
758
|
5190 v68 = pMaxLevelPerTrainingHallType[(unsigned int)window_SpeakInHouse->ptr_1C - HOUSE_TRAINING_HALL_EMERALD_ISLE];
|
651
|
5191 //v66 = 1000 * v3;
|
717
|
5192 if (pPlayers[uActiveCharacter]->uExperience >= v5)
|
629
|
5193 {
|
717
|
5194 v8 = pPlayers[uActiveCharacter]->classType % 4 + 1;
|
629
|
5195 if ( v8 == 4 )
|
|
5196 v8 = 3;
|
717
|
5197 v9 = (double)pPlayers[uActiveCharacter]->uLevel;
|
651
|
5198 //i = 0;
|
629
|
5199 v69 = v8;
|
|
5200 //v10 = (signed __int64)(v9 * p2DEvents_minus1__20[13 * (signed int)v7] * (double)v8);
|
651
|
5201 v10 = (signed __int64)(v9 * p2DEvents[(signed int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier * (double)v8);
|
717
|
5202 v11 = v10 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100;
|
629
|
5203 if ( v11 < v10 / 3 )
|
|
5204 v11 = v10 / 3;
|
651
|
5205 //i = v11;
|
629
|
5206 }
|
758
|
5207
|
|
5208 if (sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win())
|
629
|
5209 {
|
749
|
5210 if ( dialog_menu_id != HOUSE_DIALOGUE_MAIN )
|
629
|
5211 {
|
758
|
5212 if ( dialog_menu_id != HOUSE_DIALOGUE_TRAININGHALL_TRAIN )
|
629
|
5213 {
|
749
|
5214 if ( dialog_menu_id == HOUSE_DIALOGUE_LEARN_SKILLS )
|
629
|
5215 {
|
758
|
5216 if (sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win())
|
629
|
5217 {
|
651
|
5218 //i = 0;
|
|
5219 int _v0 = 0;
|
629
|
5220 v13 = pDialogueWindow;
|
|
5221 //v14 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (unsigned int)ptr_507BC0->ptr_1C] * 500.0);
|
|
5222 v14 = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0);
|
717
|
5223 v73 = v14 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100;
|
629
|
5224 if ( v73 < v14 / 3 )
|
|
5225 v73 = v14 / 3;
|
|
5226 v15 = v13->pStartingPosActiveItem;
|
|
5227 v16 = v13->pNumPresenceButton;
|
|
5228 v72 = 0;
|
|
5229 if ( (signed int)v15 >= (signed int)(v15 + v16) )
|
|
5230 goto LABEL_76;
|
|
5231 do
|
|
5232 {
|
832
|
5233 v17 = v13->GetControl(v15)->msg_param - 36;
|
717
|
5234 if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][v17] && !pPlayers[uActiveCharacter]->pActiveSkills[v17] )
|
629
|
5235 {
|
|
5236 v18 = pFontArrus->CalcTextHeight(pSkillNames[v17], &v65, 0, 0);
|
651
|
5237 _v0 += v18;
|
629
|
5238 ++v72;
|
|
5239 }
|
|
5240 ++v15;
|
|
5241 }
|
|
5242 while ( (signed int)v15 < v13->pNumPresenceButton + v13->pStartingPosActiveItem );
|
|
5243 if ( v72 )
|
|
5244 {
|
|
5245 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], v73);// "Skill Cost: %lu"
|
|
5246 v65.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u);
|
651
|
5247 v73 = (signed int)(149 - _v0) / v72;
|
629
|
5248 if ( v73 > 32 )
|
|
5249 v73 = 32;
|
758
|
5250 //result = v13->pStartingPosActiveItem;
|
651
|
5251 v19 = (signed int)(149 - v72 * v73 - _v0) / 2 - v73 / 2 + 162;
|
758
|
5252 int _v1 = v13->pStartingPosActiveItem;
|
629
|
5253 v68 = v19;
|
758
|
5254 if (v13->pStartingPosActiveItem < v13->pStartingPosActiveItem + v13->pNumPresenceButton )
|
629
|
5255 {
|
|
5256 v72 = 2;
|
|
5257 do
|
|
5258 {
|
651
|
5259 v20 = v13->GetControl(_v1);
|
629
|
5260 v21 = v20;
|
832
|
5261 v22 = v20->msg_param - 36;
|
717
|
5262 if ( !byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][v22] || pPlayers[uActiveCharacter]->pActiveSkills[v22] )
|
629
|
5263 {
|
|
5264 v21->uW = 0;
|
|
5265 v21->uHeight = 0;
|
|
5266 v21->uY = 0;
|
|
5267 }
|
|
5268 else
|
|
5269 {
|
|
5270 v23 = pSkillNames[v22];
|
|
5271 v21->uY = v73 + v68;
|
651
|
5272 //HIDWORD(v66) = (int)v23;
|
629
|
5273 v24 = pFontArrus->CalcTextHeight(v23, &v65, 0, 0);
|
|
5274 v25 = v21->uY;
|
|
5275 v21->uHeight = v24;
|
|
5276 v26 = v25 + v24 - 1;
|
|
5277 v21->uW = v26;
|
|
5278 v68 = v26;
|
651
|
5279 v27 = color2;
|
629
|
5280 if ( pDialogueWindow->pCurrentPosActiveItem != v72 )
|
|
5281 v27 = white;
|
651
|
5282 v65.DrawTitleText(pFontArrus, 0, v25, v27, v23, 3u);
|
629
|
5283 }
|
651
|
5284 ++_v1;
|
629
|
5285 ++v72;
|
|
5286 }
|
758
|
5287 while ( (signed int)_v1 < v13->pStartingPosActiveItem + v13->pNumPresenceButton );
|
629
|
5288 }
|
|
5289 }
|
|
5290 else
|
|
5291 {
|
|
5292 LABEL_76:
|
717
|
5293 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]);//
|
629
|
5294 // "Seek knowledge elsewhere %s the %s"
|
|
5295 strcat(pTmpBuf, "\n \n");
|
|
5296 strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]);// "I can offer you nothing further."
|
651
|
5297 v29 = color2;
|
629
|
5298 v30 = pFontArrus->CalcTextHeight(pTmpBuf, &v65, 0, 0);
|
762
|
5299 v65.DrawTitleText(pFontArrus, 0, (174 - v30) / 2 + 138, v29, pTmpBuf, 3u);
|
629
|
5300 }
|
|
5301 }
|
|
5302 }
|
758
|
5303 return;
|
629
|
5304 }
|
|
5305 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
|
|
5306 {
|
758
|
5307 //v31 = pNPCTopics[122].pText;
|
|
5308 //v32 = color2;
|
629
|
5309 v33 = pFontArrus->CalcTextHeight(pNPCTopics[122].pText, &v65, 0, 0);
|
758
|
5310 v65.DrawTitleText(pFontArrus, 0, (212 - v33) / 2 + 101, color2, pNPCTopics[122].pText, 3);
|
629
|
5311 pDialogueWindow->pNumPresenceButton = 0;
|
758
|
5312 return;
|
629
|
5313 }
|
717
|
5314 v34 = pPlayers[uActiveCharacter]->uLevel;
|
629
|
5315 if ( v34 < v68 )
|
|
5316 {
|
717
|
5317 if ( (signed __int64)pPlayers[uActiveCharacter]->uExperience >= v5 )
|
629
|
5318 {
|
651
|
5319 if ( pParty->uNumGold >= v11)
|
629
|
5320 {
|
651
|
5321 Party::TakeGold(v11);
|
758
|
5322 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful);
|
717
|
5323 ++pPlayers[uActiveCharacter]->uLevel;
|
|
5324 pPlayers[uActiveCharacter]->uSkillPoints += pPlayers[uActiveCharacter]->uLevel / 10 + 5;
|
|
5325 pPlayers[uActiveCharacter]->sHealth = pPlayers[uActiveCharacter]->GetMaxHealth();
|
|
5326 pPlayers[uActiveCharacter]->sMana = pPlayers[uActiveCharacter]->GetMaxMana();
|
758
|
5327
|
|
5328 uint max_level_in_party = player_levels[0];
|
|
5329 for (uint _it = 1; _it < 4; ++_it)
|
629
|
5330 {
|
758
|
5331 if (player_levels[_it] > max_level_in_party)
|
|
5332 max_level_in_party = player_levels[_it];
|
629
|
5333 }
|
758
|
5334
|
|
5335 ++player_levels[uActiveCharacter - 1];
|
|
5336 if (player_levels[uActiveCharacter - 1] > max_level_in_party) // if we reach new maximum party level
|
|
5337 // feature is broken thou, since this array is always zeroed in EnterHouse
|
629
|
5338 {
|
758
|
5339 v40 = _494820_training_time(pParty->uCurrentHour);
|
|
5340 //v41 = window_SpeakInHouse->ptr_1C;
|
629
|
5341 v42 = 60 * (v40 + 4) - pParty->uCurrentMinute;
|
758
|
5342 if ((unsigned int)window_SpeakInHouse->ptr_1C == HOUSE_TRAINING_HALL_94 ||
|
|
5343 (unsigned int)window_SpeakInHouse->ptr_1C == HOUSE_TRAINING_HALL_95)
|
629
|
5344 v42 += 720;
|
|
5345 RestAndHeal((signed int)(v42 + 10080));
|
|
5346 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor )
|
|
5347 pOutdoor->SetFog();
|
|
5348 }
|
717
|
5349 pPlayers[uActiveCharacter]->PlaySound(SPEECH_87, 0);
|
|
5350 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[430], pPlayers[uActiveCharacter]->pName, pPlayers[uActiveCharacter]->uLevel, pPlayers[uActiveCharacter]->uLevel / 10 + 5);//
|
629
|
5351 // "%s is now Level %lu and has earned %lu Skill Points!"
|
717
|
5352 ShowStatusBarString(pTmpBuf, 2);
|
|
5353 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
|
758
|
5354 return;
|
629
|
5355 }
|
717
|
5356 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);// "You don't have enough gold"
|
629
|
5357 v63 = 4;
|
|
5358 LABEL_55:
|
735
|
5359 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)v63);
|
717
|
5360 //LABEL_56:
|
629
|
5361 /*result = pMessageQueue_50CBD0->uNumMessages;
|
|
5362 if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
|
|
5363 {
|
990
|
5364 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape;
|
629
|
5365 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1;
|
|
5366 result = 3 * pMessageQueue_50CBD0->uNumMessages + 3;
|
|
5367 *(&pMessageQueue_50CBD0->uNumMessages + result) = 0;
|
|
5368 ++pMessageQueue_50CBD0->uNumMessages;
|
|
5369 }
|
|
5370 return result;*/
|
|
5371 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
|
758
|
5372 return;
|
629
|
5373 }
|
717
|
5374 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[538], (unsigned int)(v5 - pPlayers[uActiveCharacter]->uExperience), v34 + 1);//
|
629
|
5375 // "You need %d more experience to train to level %d"
|
|
5376 v35 = 0;
|
|
5377 v62 = 3;
|
|
5378 v60 = pTmpBuf;
|
651
|
5379 v58 = color2;
|
629
|
5380 v36 = (212 - pFontArrus->CalcTextHeight(pTmpBuf, &v65, 0, 0)) / 2 + 88;
|
|
5381 }
|
|
5382 else
|
|
5383 {
|
|
5384 sprintf(pTmpBuf, "%s\n \n%s", pGlobalTXT_LocalizationStrings[536], pGlobalTXT_LocalizationStrings[529]);//
|
|
5385 // ""With your skills, you should be working here as a teacher.""
|
|
5386 // ""Sorry, but we are unable to train you.""
|
|
5387 v35 = 0;
|
|
5388 v62 = 3;
|
|
5389 v60 = pTmpBuf;
|
651
|
5390 v58 = color2;
|
629
|
5391 v36 = (212 - pFontArrus->CalcTextHeight(pTmpBuf, &v65, 0, 0)) / 2 + 101;
|
|
5392 }
|
|
5393 v65.DrawTitleText(pFontArrus, v35, v36, v58, v60, v62);
|
|
5394 v63 = 3;
|
|
5395 goto LABEL_55;
|
|
5396 }
|
758
|
5397
|
|
5398 if (sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win())
|
629
|
5399 {
|
|
5400 v43 = pDialogueWindow;
|
|
5401 v72 = 0;
|
|
5402 pShopOptions[0] = pTmpBuf;
|
|
5403 pShopOptions[1] = pGlobalTXT_LocalizationStrings[160];// "Learn Skills"
|
|
5404 v44 = pDialogueWindow->pNumPresenceButton;
|
|
5405 v73 = pDialogueWindow->pStartingPosActiveItem;
|
|
5406 if ( v73 < v73 + v44 )
|
|
5407 {
|
|
5408 v45 = pShopOptions;
|
|
5409 do
|
|
5410 {
|
832
|
5411 if ( v43->GetControl(v73)->msg_param == HOUSE_DIALOGUE_TRAININGHALL_TRAIN )
|
629
|
5412 {
|
758
|
5413 //v46 = pPlayers[uActiveCharacter]->uLevel;
|
|
5414 if (pPlayers[uActiveCharacter]->uLevel >= v68)
|
|
5415 sprintfex(*v45, "%s\n \n%s",
|
|
5416 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."
|
629
|
5417 else
|
|
5418 {
|
758
|
5419 if (pPlayers[uActiveCharacter]->uExperience < v5)
|
|
5420 sprintfex(*v45, pGlobalTXT_LocalizationStrings[538], // "You need %d more experience to train to level %d"
|
|
5421 (uint)(v5 - pPlayers[uActiveCharacter]->uExperience), pPlayers[uActiveCharacter]->uLevel + 1);
|
|
5422 else
|
|
5423 sprintfex(*v45, pGlobalTXT_LocalizationStrings[537], // "Train to level %d for %d gold"
|
|
5424 pPlayers[uActiveCharacter]->uLevel + 1, v11);
|
629
|
5425 }
|
|
5426 }
|
|
5427 v47 = pFontArrus->CalcTextHeight(*v45, &v65, 0, 0);
|
|
5428 v43 = pDialogueWindow;
|
|
5429 v72 += v47;
|
|
5430 ++v45;
|
|
5431 ++v73;
|
|
5432 }
|
|
5433 while ( v73 < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem );
|
|
5434 }
|
758
|
5435
|
629
|
5436 v49 = (2 * (87 - (174 - v72) / 2) - v72) / 2 - (174 - v72) / 2 / 2 + 138;
|
|
5437 v73 = v43->pStartingPosActiveItem;
|
758
|
5438 if (v43->pStartingPosActiveItem < v43->pStartingPosActiveItem + v43->pNumPresenceButton)
|
629
|
5439 {
|
651
|
5440 int _v3 = 2;
|
629
|
5441 v51 = pShopOptions;
|
|
5442 do
|
|
5443 {
|
|
5444 v52 = v43->GetControl(v73);
|
|
5445 v53 = v52;
|
651
|
5446 v52->uY = (174 - v72) / 2 + v49;
|
629
|
5447 v54 = pFontArrus->CalcTextHeight(*v51, &v65, 0, 0);
|
|
5448 v55 = v53->uY;
|
|
5449 v53->uHeight = v54;
|
|
5450 v56 = v54 + v55 - 1;
|
|
5451 v53->uW = v56;
|
|
5452 v49 = v56;
|
651
|
5453 v57 = color2;
|
|
5454 if ( pDialogueWindow->pCurrentPosActiveItem != _v3 )
|
629
|
5455 v57 = white;
|
|
5456 v65.DrawTitleText(pFontArrus, 0, v55, v57, *v51, 3u);
|
|
5457 v43 = pDialogueWindow;
|
651
|
5458 ++_v3;
|
629
|
5459 ++v51;
|
|
5460 ++v73;
|
|
5461 }
|
758
|
5462 while ( v73 < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton);
|
629
|
5463 }
|
|
5464 }
|
|
5465 }
|
|
5466 }
|
|
5467
|
|
5468 //----- (004B4FCF) --------------------------------------------------------
|
|
5469 void MagicShopDialog()
|
900
|
5470 {
|
629
|
5471 int result; // eax@6
|
|
5472 signed int v2; // esi@8
|
|
5473 unsigned int v3; // ebx@10
|
|
5474 char *v4; // eax@11
|
|
5475 char *v5; // eax@12
|
|
5476 unsigned int v6; // eax@12
|
|
5477 int v7; // ST08_4@14
|
|
5478 int v8; // eax@14
|
|
5479 unsigned __int8 v9; // dl@14
|
|
5480 char *v10; // ecx@14
|
|
5481 signed int v11; // esi@16
|
|
5482 int v12; // ST08_4@19
|
|
5483 int v13; // eax@19
|
|
5484 int all_text_height; // edi@21
|
|
5485 char **v15; // esi@21
|
|
5486 int v16; // eax@22
|
|
5487 int v18; // edx@23
|
|
5488 int v19; // edi@23
|
|
5489 unsigned __int8 v20; // sf@23
|
|
5490 GUIButton *control_button; // esi@25
|
|
5491 const char **v22; // eax@25
|
|
5492 int v23; // eax@25
|
|
5493 unsigned int v24; // ecx@25
|
|
5494 const char **v25; // edx@25
|
|
5495 unsigned __int16 text_color; // ax@25
|
917
|
5496 signed int pTextHeight; // esi@30
|
629
|
5497 int v28; // ST08_4@34
|
|
5498 int v29; // eax@34
|
|
5499 char *v30; // edx@35
|
|
5500 void *v32; // eax@40
|
|
5501 signed int v33; // esi@40
|
|
5502 unsigned int v34; // esi@42
|
|
5503 int v35; // eax@42
|
|
5504 unsigned int v36; // eax@43
|
|
5505 int v37; // eax@45
|
|
5506 int v38; // ecx@50
|
|
5507 int v41; // eax@52
|
|
5508 char *v42; // eax@54
|
|
5509 int v43; // eax@54
|
|
5510 unsigned int v44; // ecx@54
|
|
5511 int v45; // edx@54
|
|
5512 int v46; // eax@54
|
|
5513 unsigned __int16 v47; // ax@54
|
|
5514 int v48; // eax@58
|
|
5515 signed int v49; // esi@62
|
|
5516 Texture *v50; // ecx@64
|
|
5517 unsigned int v51; // edi@64
|
|
5518 unsigned int v52; // esi@66
|
|
5519 int v53; // edx@70
|
|
5520 Texture *v54; // ecx@76
|
|
5521 unsigned int v55; // edi@76
|
|
5522 unsigned int v56; // esi@76
|
|
5523 int v57; // edx@80
|
|
5524 unsigned int v59; // edi@86
|
|
5525 unsigned int v60; // esi@88
|
|
5526 int v61; // edx@92
|
|
5527 unsigned int v63; // edi@98
|
|
5528 unsigned int v64; // esi@100
|
|
5529 int v65; // edx@104
|
|
5530 signed int v66; // ecx@109
|
|
5531 SHORT v67; // di@117
|
|
5532 bool v68; // eax@117
|
|
5533 const char *v69; // ecx@119
|
|
5534 POINT *v70; // esi@124
|
|
5535 int v71; // ecx@125
|
|
5536 int v73; // ecx@125
|
|
5537 int v75; // eax@130
|
|
5538 int v78; // eax@132
|
|
5539 int v80; // edx@133
|
|
5540 int v81; // edi@133
|
|
5541 const char **v83; // eax@135
|
|
5542 int v84; // eax@135
|
|
5543 unsigned int v85; // ecx@135
|
|
5544 int v86; // edx@135
|
|
5545 int v89; // [sp-14h] [bp-10Ch]@35
|
|
5546 int v91; // [sp-10h] [bp-108h]@35
|
|
5547 unsigned __int16 v92; // [sp-Ch] [bp-104h]@12
|
|
5548 void *v93; // [sp-Ch] [bp-104h]@14
|
|
5549 int v94; // [sp-8h] [bp-100h]@11
|
|
5550 char *v95; // [sp-8h] [bp-100h]@12
|
|
5551 __int64 *v96; // [sp-4h] [bp-FCh]@11
|
|
5552 unsigned int v97; // [sp-4h] [bp-FCh]@12
|
|
5553 POINT v98; // [sp+Ch] [bp-ECh]@8
|
|
5554 POINT v99; // [sp+14h] [bp-E4h]@16
|
|
5555 POINT v100; // [sp+1Ch] [bp-DCh]@124
|
|
5556 POINT v101; // [sp+24h] [bp-D4h]@17
|
|
5557 POINT v102; // [sp+2Ch] [bp-CCh]@124
|
|
5558 POINT v103; // [sp+34h] [bp-C4h]@9
|
|
5559 POINT v104; // [sp+3Ch] [bp-BCh]@31
|
|
5560 POINT v105; // [sp+44h] [bp-B4h]@16
|
|
5561 POINT v106; // [sp+4Ch] [bp-ACh]@30
|
|
5562 POINT v107; // [sp+54h] [bp-A4h]@16
|
|
5563 POINT v108; // [sp+5Ch] [bp-9Ch]@30
|
|
5564 POINT a2; // [sp+64h] [bp-94h]@8
|
|
5565 POINT v110; // [sp+6Ch] [bp-8Ch]@30
|
|
5566 POINT v111; // [sp+74h] [bp-84h]@8
|
|
5567 GUIWindow dialog_window; // [sp+7Ch] [bp-7Ch]@1
|
|
5568 char *Str; // [sp+D0h] [bp-28h]@54
|
|
5569 int v146; // [sp+D4h] [bp-24h]@23
|
917
|
5570 unsigned int pYellowColor; // [sp+D8h] [bp-20h]@1
|
|
5571 unsigned int pWhiteColor; // [sp+DCh] [bp-1Ch]@1
|
629
|
5572 __int32 v117; // [sp+E0h] [bp-18h]@8
|
|
5573 int v118; // [sp+E4h] [bp-14h]@40
|
|
5574 const char **v119; // [sp+E8h] [bp-10h]@24
|
917
|
5575 int _this; // [sp+ECh] [bp-Ch]@1
|
629
|
5576 unsigned __int8 uPlayerID; // [sp+F3h] [bp-5h]@14
|
|
5577 int v152; // [sp+F4h] [bp-4h]@23
|
|
5578 int v122;
|
|
5579 int v114;
|
917
|
5580 int pSrtingNum;
|
|
5581 int pActiveItemNum;
|
|
5582 ItemGen *item;
|
629
|
5583
|
|
5584 memcpy(&dialog_window, window_SpeakInHouse, sizeof(dialog_window));
|
|
5585 dialog_window.uFrameX = 483;
|
|
5586 dialog_window.uFrameWidth = 148;
|
|
5587 dialog_window.uFrameZ = 334;
|
949
|
5588 pWhiteColor = TargetColor(255, 255, 255);
|
|
5589 pYellowColor = TargetColor(225, 205, 35);
|
900
|
5590 if ( dialog_menu_id == HOUSE_DIALOGUE_MAIN)
|
|
5591 {
|
|
5592 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
|
|
5593 return;
|
|
5594 pShopOptions[0] = pGlobalTXT_LocalizationStrings[134]; //"Buy Standard"
|
|
5595 pShopOptions[1] = pGlobalTXT_LocalizationStrings[152]; //"Buy Special"
|
|
5596 pShopOptions[2] = pGlobalTXT_LocalizationStrings[159]; //"Display Inventory"
|
|
5597 pShopOptions[3] = pGlobalTXT_LocalizationStrings[160];
|
|
5598 all_text_height = 0;
|
|
5599 for ( int i = 0; i < 4; ++i )
|
|
5600 all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0);
|
|
5601 v146 = (174 - all_text_height) / 4;
|
|
5602 v23 = (174 - 4 * (174 - all_text_height) / 4 - all_text_height) / 2 - (174 - all_text_height) / 4 / 2 + 138;
|
|
5603 int j = 0;
|
|
5604 if ( pDialogueWindow->pNumPresenceButton>=0 )
|
|
5605 {
|
|
5606 int th = 2;
|
|
5607 for (v152 = pDialogueWindow->pStartingPosActiveItem; v152 < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++v152)
|
|
5608 {
|
|
5609 control_button = pDialogueWindow->GetControl(v152);
|
|
5610 control_button->uY = v146 + v23;
|
917
|
5611 pTextHeight = pFontArrus->CalcTextHeight(pShopOptions[j], &dialog_window, 0, 0);
|
|
5612 control_button->uHeight = pTextHeight;
|
900
|
5613 v23 = control_button->uY + control_button->uHeight - 1;
|
|
5614 control_button->uW = v23;
|
917
|
5615 text_color = pYellowColor;
|
900
|
5616 if ( pDialogueWindow->pCurrentPosActiveItem != th )
|
917
|
5617 text_color = pWhiteColor;
|
900
|
5618 dialog_window.DrawTitleText(pFontArrus, 0, control_button->uY, text_color, pShopOptions[j], 3);
|
|
5619 ++th;
|
|
5620 ++j;
|
|
5621 }
|
|
5622 }
|
|
5623 return;
|
|
5624 }
|
749
|
5625 if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_BUY_STANDARD)
|
629
|
5626 {
|
920
|
5627 pRenderer->DrawTextureIndexed(8, 8, ShopTexture);
|
|
5628 v3 = 0;
|
|
5629 v49 = 0;
|
|
5630 v122 = 0;
|
629
|
5631 do
|
|
5632 {
|
907
|
5633 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v49].uItemID)
|
629
|
5634 {
|
|
5635 v50 = ItemsInShopTexture[v49];
|
|
5636 v51 = 152 - v50->uTextureHeight;
|
|
5637 if ( (signed int)v51 < 1 )
|
|
5638 v51 = 0;
|
|
5639 v52 = 75 * v49 - v50->uTextureWidth / 2 + 40;
|
|
5640 if ( v122 )
|
|
5641 {
|
|
5642 if ( v122 == 5 )
|
|
5643 {
|
|
5644 v53 = ItemsInShopTexture[5]->uTextureWidth;
|
|
5645 if ( (signed int)v52 > 457 - v53 )
|
|
5646 v52 = 457 - v53;
|
|
5647 }
|
|
5648 }
|
|
5649 else
|
|
5650 {
|
|
5651 if ( (signed int)v52 < 18 )
|
|
5652 v52 = 18;
|
|
5653 }
|
|
5654 pRenderer->DrawTextureTransparent(v52, v51, v50);
|
|
5655 sub_40F92A(&pRenderer->pActiveZBuffer[v52 + 640 * v51], ItemsInShopTexture[v122], v122 + 1);
|
|
5656 v49 = v122;
|
|
5657 }
|
|
5658 ++v49;
|
|
5659 v122 = v49;
|
|
5660 }
|
|
5661 while ( v49 < 6 );
|
|
5662 v122 = 0;
|
|
5663 do
|
|
5664 {
|
917
|
5665 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v122 + 6].uItemID)
|
629
|
5666 {
|
|
5667 v54 = ItemsInShopTexture[v122 + 6];
|
|
5668 v55 = 306 - v54->uTextureHeight;
|
|
5669 v56 = 75 * v122 - v54->uTextureWidth / 2 + 40;
|
|
5670 if ( v122 )
|
|
5671 {
|
|
5672 if ( v122 == 5 )
|
|
5673 {
|
|
5674 v57 = ItemsInShopTexture[11]->uTextureWidth;
|
|
5675 if ( (signed int)v56 > 457 - v57 )
|
|
5676 v56 = 457 - v57;
|
|
5677 }
|
|
5678 }
|
|
5679 else
|
|
5680 {
|
|
5681 if ( (signed int)v56 < 18 )
|
|
5682 v56 = 18;
|
|
5683 }
|
|
5684 pRenderer->DrawTextureTransparent(v56, v55, v54);
|
|
5685 sub_40F92A(&pRenderer->pActiveZBuffer[v56 + 640 * v55], ItemsInShopTexture[v122 + 6], v122 + 7);
|
|
5686 }
|
|
5687 ++v122;
|
|
5688 }
|
|
5689 while ( v122 < 6 );
|
920
|
5690 if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
|
|
5691 {
|
|
5692 v66 = 0;
|
|
5693 v117 = 0;
|
|
5694 if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_BUY_STANDARD)
|
|
5695 {
|
|
5696 do
|
|
5697 {
|
|
5698 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v66].uItemID) //9 * (v66 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] )
|
|
5699 ++v117;
|
|
5700 ++v66;
|
|
5701 }
|
|
5702 while ( v66 < 12 );
|
|
5703 }
|
|
5704 else
|
|
5705 {
|
|
5706 do
|
|
5707 {
|
|
5708 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v66].uItemID)
|
|
5709 ++v117;
|
|
5710 ++v66;
|
|
5711 }
|
|
5712 while ( v66 < 12 );
|
|
5713 }
|
|
5714 v67 = GetAsyncKeyState(VK_CONTROL);
|
|
5715 v68 = pPlayers[uActiveCharacter]->CanSteal();
|
|
5716 Str = (char *)v68;
|
|
5717 if ( v67 && v68 )
|
|
5718 {
|
|
5719 v69 = pGlobalTXT_LocalizationStrings[185];// "Steal item"
|
|
5720 }
|
|
5721 else
|
|
5722 {
|
|
5723 v69 = pGlobalTXT_LocalizationStrings[195];// "Select the Item to Buy"
|
|
5724 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD)
|
|
5725 v69 = pGlobalTXT_LocalizationStrings[196];// "Select the Special Item to Buy"
|
|
5726 }
|
|
5727 DrawTextAtStatusBar(v69, 0);
|
|
5728 if ( !v117 )
|
|
5729 {
|
|
5730 dialog_window.DrawCurrentTime( pParty->field_3C.field_50[(unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed);
|
|
5731 return;
|
|
5732 }
|
|
5733 v70 = pMouse->GetCursorPos(&v102);
|
|
5734 result = v70->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v100)->y];
|
|
5735 if ( pRenderer->pActiveZBuffer[result] & 0xFFFF )
|
|
5736 {
|
|
5737 v71 = (pRenderer->pActiveZBuffer[result] & 0xFFFF) - 1;
|
|
5738 item = &pParty->StandartItemsInShops[(int)window_SpeakInHouse->ptr_1C][v71];
|
|
5739 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD)
|
|
5740 item = &pParty->SpecialItemsInShops[(int)window_SpeakInHouse->ptr_1C][v71];
|
|
5741 if ( v67 && Str )
|
|
5742 v10 = pGlobalTXT_LocalizationStrings[181];// "Steal %24"
|
|
5743 else
|
|
5744 {
|
|
5745 v75 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(item, BildingType_MagicShop, (int)window_SpeakInHouse->ptr_1C, 2);
|
|
5746 v10 = (char *)pMerchantsBuyPhrases[v75];
|
|
5747 }
|
|
5748 v30 = BuilDialogueString(v10, uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 2, 0);
|
|
5749 v6 = (174 - pFontArrus->CalcTextHeight(v30, &dialog_window, v3, v3)) / 2 + 138;
|
|
5750 dialog_window.DrawTitleText(pFontArrus, v3, v6, pWhiteColor, v30, 3);
|
|
5751 return;
|
|
5752 }
|
|
5753 }
|
|
5754 return;
|
629
|
5755 }
|
920
|
5756 if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_BUY_SPECIAL)
|
629
|
5757 {
|
920
|
5758 pRenderer->DrawTextureIndexed(8, 8, ShopTexture);
|
|
5759 v3 = 0;
|
|
5760 v49 = 0;
|
|
5761 v122 = 0;
|
629
|
5762 do
|
|
5763 {
|
920
|
5764 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v49].uItemID)
|
629
|
5765 {
|
920
|
5766 v59 = 152 - ItemsInShopTexture[v49]->uTextureHeight;
|
629
|
5767 if ( (signed int)v59 < 1 )
|
|
5768 v59 = 0;
|
920
|
5769 v60 = 75 * v49 - ItemsInShopTexture[v49]->uTextureWidth / 2 + 40;
|
629
|
5770 if ( v122 )
|
|
5771 {
|
|
5772 if ( v122 == 5 )
|
|
5773 {
|
|
5774 v61 = ItemsInShopTexture[5]->uTextureWidth;
|
|
5775 if ( (signed int)v60 > 457 - v61 )
|
|
5776 v60 = 457 - v61;
|
|
5777 }
|
|
5778 }
|
|
5779 else
|
|
5780 {
|
|
5781 if ( (signed int)v60 < 18 )
|
|
5782 v60 = 18;
|
|
5783 }
|
920
|
5784 pRenderer->DrawTextureTransparent(v60, v59, ItemsInShopTexture[v49]);
|
629
|
5785 sub_40F92A(&pRenderer->pActiveZBuffer[v60 + 640 * v59], ItemsInShopTexture[v122], v122 + 1);
|
|
5786 v49 = v122;
|
|
5787 }
|
|
5788 ++v49;
|
|
5789 v122 = v49;
|
|
5790 }
|
|
5791 while ( v49 < 6 );
|
|
5792 v122 = 0;
|
|
5793 do
|
|
5794 {
|
917
|
5795 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v122 + 6].uItemID)
|
629
|
5796 {
|
920
|
5797 v63 = 306 - ItemsInShopTexture[v122 + 6]->uTextureHeight;
|
629
|
5798 if ( (signed int)v63 < 1 )
|
|
5799 v63 = 0;
|
920
|
5800 v64 = 75 * v122 - ItemsInShopTexture[v122 + 6]->uTextureWidth / 2 + 40;
|
629
|
5801 if ( v122 )
|
|
5802 {
|
|
5803 if ( v122 == 5 )
|
|
5804 {
|
|
5805 v65 = ItemsInShopTexture[11]->uTextureWidth;
|
|
5806 if ( (signed int)v64 > 457 - v65 )
|
|
5807 v64 = 457 - v65;
|
|
5808 }
|
|
5809 }
|
|
5810 else
|
|
5811 {
|
|
5812 if ( (signed int)v64 < 18 )
|
|
5813 v64 = 18;
|
|
5814 }
|
920
|
5815 pRenderer->DrawTextureTransparent(v64, v63, ItemsInShopTexture[v122 + 6]);
|
629
|
5816 sub_40F92A(&pRenderer->pActiveZBuffer[v64 + 640 * v63], ItemsInShopTexture[v122 + 6], v122 + 7);
|
|
5817 }
|
|
5818 ++v122;
|
|
5819 }
|
|
5820 while ( v122 < 6 );
|
920
|
5821 if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
|
629
|
5822 {
|
920
|
5823 v66 = 0;
|
|
5824 v117 = 0;
|
|
5825 if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_BUY_STANDARD)
|
|
5826 {
|
|
5827 do
|
|
5828 {
|
|
5829 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v66].uItemID) //9 * (v66 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] )
|
|
5830 ++v117;
|
|
5831 ++v66;
|
|
5832 }
|
|
5833 while ( v66 < 12 );
|
|
5834 }
|
|
5835 else
|
|
5836 {
|
|
5837 do
|
|
5838 {
|
|
5839 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v66].uItemID)
|
|
5840 ++v117;
|
|
5841 ++v66;
|
|
5842 }
|
|
5843 while ( v66 < 12 );
|
|
5844 }
|
|
5845 v67 = GetAsyncKeyState(VK_CONTROL);
|
|
5846 v68 = pPlayers[uActiveCharacter]->CanSteal();
|
|
5847 Str = (char *)v68;
|
|
5848 if ( v67 && v68 )
|
|
5849 {
|
|
5850 v69 = pGlobalTXT_LocalizationStrings[185];// "Steal item"
|
|
5851 }
|
|
5852 else
|
|
5853 {
|
|
5854 v69 = pGlobalTXT_LocalizationStrings[195];// "Select the Item to Buy"
|
|
5855 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD)
|
|
5856 v69 = pGlobalTXT_LocalizationStrings[196];// "Select the Special Item to Buy"
|
|
5857 }
|
|
5858 DrawTextAtStatusBar(v69, 0);
|
|
5859 if ( !v117 )
|
629
|
5860 {
|
920
|
5861 dialog_window.DrawCurrentTime( pParty->field_3C.field_50[(unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed);
|
|
5862 return;
|
629
|
5863 }
|
920
|
5864 v70 = pMouse->GetCursorPos(&v102);
|
|
5865 result = v70->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v100)->y];
|
|
5866 if ( pRenderer->pActiveZBuffer[result] & 0xFFFF )
|
|
5867 {
|
|
5868 v71 = (pRenderer->pActiveZBuffer[result] & 0xFFFF) - 1;
|
|
5869 item = &pParty->StandartItemsInShops[(int)window_SpeakInHouse->ptr_1C][v71];
|
|
5870 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD)
|
|
5871 item = &pParty->SpecialItemsInShops[(int)window_SpeakInHouse->ptr_1C][v71];
|
|
5872 if ( v67 && Str )
|
|
5873 v10 = pGlobalTXT_LocalizationStrings[181];// "Steal %24"
|
|
5874 else
|
|
5875 {
|
|
5876 v75 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(item, BildingType_MagicShop, (int)window_SpeakInHouse->ptr_1C, 2);
|
|
5877 v10 = (char *)pMerchantsBuyPhrases[v75];
|
|
5878 }
|
|
5879 v30 = BuilDialogueString(v10, uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 2, 0);
|
|
5880 v6 = (174 - pFontArrus->CalcTextHeight(v30, &dialog_window, v3, v3)) / 2 + 138;
|
|
5881 dialog_window.DrawTitleText(pFontArrus, v3, v6, pWhiteColor, v30, 3);
|
|
5882 return;
|
|
5883 }
|
629
|
5884 }
|
920
|
5885 return;
|
|
5886 }
|
|
5887 if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT )
|
|
5888 {
|
|
5889 draw_leather();
|
984
|
5890 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true);
|
920
|
5891 pShopOptions[0] = pGlobalTXT_LocalizationStrings[200];// "Sell"
|
|
5892 pShopOptions[1] = pGlobalTXT_LocalizationStrings[113];// "Identify"
|
|
5893 pShopOptions[2] = pGlobalTXT_LocalizationStrings[179];// "Repair"
|
|
5894 all_text_height = 0;
|
|
5895 for ( uint i = 0; i < 3; ++i )
|
|
5896 all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0);
|
|
5897 _this = ((174 - all_text_height) / 3);
|
|
5898 v81 = (3 * (58 - (signed int)_this) - all_text_height) / 2 - (174 - all_text_height) / 3 / 2 + 138;
|
|
5899 v20 = -pDialogueWindow->pNumPresenceButton < 0;
|
|
5900 v118 = pDialogueWindow->pStartingPosActiveItem;
|
|
5901 if ( v20 ^ pDialogueWindow->pStartingPosActiveItem > pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton )
|
629
|
5902 {
|
920
|
5903 v122 = 2;
|
|
5904 pSrtingNum = 0;
|
629
|
5905 do
|
|
5906 {
|
920
|
5907 control_button = pDialogueWindow->GetControl(v118);
|
|
5908 control_button->uY = (unsigned int)((char *)_this + v81);
|
|
5909 pTextHeight = pFontArrus->CalcTextHeight(pShopOptions[pSrtingNum], &dialog_window, 0, 0);
|
|
5910 v85 = control_button->uY;
|
|
5911 control_button->uHeight = pTextHeight;
|
|
5912 v81 = pTextHeight + v85 - 1;
|
|
5913 control_button->uW = v81;
|
|
5914 text_color = pYellowColor;
|
|
5915 if ( pDialogueWindow->pCurrentPosActiveItem != v122 )
|
|
5916 text_color = pWhiteColor;
|
|
5917 dialog_window.DrawTitleText(pFontArrus, 0, v85, text_color, pShopOptions[pSrtingNum], 3);
|
|
5918 ++v122;
|
|
5919 ++pSrtingNum;
|
|
5920 ++v118;
|
629
|
5921 }
|
920
|
5922 while ( v118 < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem );
|
629
|
5923 }
|
920
|
5924 return;
|
|
5925 }
|
|
5926 if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_SELL)
|
|
5927 {
|
|
5928 draw_leather();
|
984
|
5929 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true);
|
920
|
5930 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[199], 0);// "Select the Item to Sell"
|
|
5931 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win()
|
|
5932 || (v11 = pMouse->GetCursorPos(&v107)->x - 14,
|
|
5933 v117 = (v11 >> 5) + 14 * ((pMouse->GetCursorPos(&v99)->y - 17) >> 5),
|
|
5934 result = (int)pMouse->GetCursorPos(&v105),
|
|
5935 *(int *)result <= 13)
|
|
5936 || (result = (int)pMouse->GetCursorPos(&v101), *(int *)result >= 462)
|
|
5937 || (result = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v117), v3 = 0, !result) )
|
|
5938 return;
|
|
5939 item = &pPlayers[uActiveCharacter]->pInventoryItems[result - 1];
|
|
5940 v13 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(item, BildingType_MagicShop, (int)window_SpeakInHouse->ptr_1C, 3);
|
|
5941 v30 = BuilDialogueString((char *)pMerchantsSellPhrases[v13], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 3, 0);
|
|
5942 v6 = (174 - pFontArrus->CalcTextHeight(v30, &dialog_window, v3, v3)) / 2 + 138;
|
|
5943 dialog_window.DrawTitleText(pFontArrus, v3, v6, pWhiteColor, v30, 3);
|
|
5944 return;
|
|
5945 }
|
|
5946 if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_IDENTIFY)
|
|
5947 {
|
|
5948 draw_leather();
|
984
|
5949 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true);
|
920
|
5950 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[197], 0);// "Select the Item to Identify"
|
|
5951 if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
|
629
|
5952 {
|
920
|
5953 v2 = pMouse->GetCursorPos(&a2)->x - 14;
|
|
5954 v117 = (v2 >> 5) + 14 * ((pMouse->GetCursorPos(&v98)->y - 17) >> 5);
|
|
5955 result = (int)pMouse->GetCursorPos(&v111);
|
|
5956 if ( *(int *)result > 13 )
|
|
5957 {
|
|
5958 result = (int)pMouse->GetCursorPos(&v103);
|
|
5959 if ( *(int *)result < 462 )
|
|
5960 {
|
|
5961 result = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v117);
|
|
5962 if ( result )
|
|
5963 {
|
|
5964 item = &pPlayers[uActiveCharacter]->pInventoryItems[result-1];
|
|
5965 if ( item->uAttributes & 1 )
|
|
5966 {
|
|
5967 v5 = BuilDialogueString("%24", uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 4, 0);
|
|
5968 v6 = (212 - pFontArrus->CalcTextHeight(v5, &dialog_window, 0, 0)) / 2 + 101;
|
|
5969 dialog_window.DrawTitleText(pFontArrus, 0, v6, pWhiteColor, v5, 3);
|
|
5970 return;
|
|
5971 }
|
|
5972 v8 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(item, BildingType_MagicShop, (int)window_SpeakInHouse->ptr_1C, 4);
|
|
5973 v30 = BuilDialogueString((char *)pMerchantsIdentifyPhrases[v8], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 4, 0);
|
|
5974 v6 = (174 - pFontArrus->CalcTextHeight(v30, &dialog_window, 0, 0)) / 2 + 138;
|
|
5975 dialog_window.DrawTitleText(pFontArrus, 0, v6, pWhiteColor, v30, 3);
|
|
5976 return;
|
|
5977 }
|
|
5978 }
|
|
5979 }
|
629
|
5980 }
|
920
|
5981 return;
|
|
5982 }
|
|
5983 if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_REPAIR)
|
|
5984 {
|
|
5985 draw_leather();
|
984
|
5986 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true);
|
920
|
5987 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[198], 0);// "Select the Item to Repair"
|
|
5988 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win()
|
|
5989 || (pTextHeight = pMouse->GetCursorPos(&v110)->x - 14,
|
|
5990 v117 = (pTextHeight >> 5) + 14 * ((pMouse->GetCursorPos(&v108)->y - 17) >> 5),
|
|
5991 result = (int)pMouse->GetCursorPos(&v106),
|
|
5992 *(int *)result <= 13)
|
|
5993 || (result = (int)pMouse->GetCursorPos(&v104), *(int *)result >= 462)
|
|
5994 || (result = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v117), v3 = 0, !result)
|
1019
|
5995 // || (result *= 9, !(pPlayers[uActiveCharacter]->field_1F5[4 * result + 15] & 2)) )
|
|
5996 || (!(pPlayers[uActiveCharacter]->pOwnItems[result-1].uAttributes& 2)) )
|
920
|
5997 return;
|
|
5998 item = &pPlayers[uActiveCharacter]->pInventoryItems[result - 1];
|
|
5999 v29 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(&pPlayers[uActiveCharacter]->pInventoryItems[result - 1], BildingType_MagicShop, (int)window_SpeakInHouse->ptr_1C, 5);
|
|
6000 v30 = BuilDialogueString((char *)pMerchantsRepairPhrases[v29], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 5, 0);
|
|
6001 v6 = (174 - pFontArrus->CalcTextHeight(v30, &dialog_window, v3, v3)) / 2 + 138;
|
|
6002 dialog_window.DrawTitleText(pFontArrus, v3, v6, pWhiteColor, v30, 3);
|
|
6003 return;
|
|
6004 }
|
|
6005 if ( dialog_menu_id == HOUSE_DIALOGUE_LEARN_SKILLS )
|
|
6006 {
|
|
6007 if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
|
629
|
6008 {
|
920
|
6009 v3 = 0;
|
|
6010 all_text_height = 0;
|
|
6011 v33 = (signed __int64)(p2DEvents[(signed int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0);
|
|
6012 v119 = (const char **)(v33 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100);
|
|
6013 if ( (signed int)v119 < v33 / 3 )
|
|
6014 v119 = (const char **)(v33 / 3);
|
|
6015 pActiveItemNum = pDialogueWindow->pStartingPosActiveItem;
|
|
6016 v122 = 0;
|
|
6017 if ( (signed int)pDialogueWindow->pStartingPosActiveItem >= pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton )
|
|
6018 {
|
|
6019 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]);//
|
|
6020 // "Seek knowledge elsewhere %s the %s"
|
|
6021 strcat(pTmpBuf, "\n \n");
|
|
6022 strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]);// "I can offer you nothing further."
|
|
6023 v6 = (174 - pFontArrus->CalcTextHeight(pTmpBuf, &dialog_window, 0, 0)) / 2 + 138;
|
|
6024 dialog_window.DrawTitleText(pFontArrus, v3, v6, pYellowColor, pTmpBuf, 3);
|
|
6025 return;
|
|
6026 }
|
|
6027 do
|
|
6028 {
|
|
6029 v36 = pDialogueWindow->GetControl(pActiveItemNum)->msg_param - 36;
|
|
6030 if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][v36] && !pPlayers[uActiveCharacter]->pActiveSkills[v36] )
|
|
6031 {
|
|
6032 all_text_height += pFontArrus->CalcTextHeight(pSkillNames[v36], &dialog_window, 0, 0);
|
|
6033 ++v122;
|
|
6034 }
|
|
6035 ++pActiveItemNum;
|
|
6036 }
|
|
6037 while ( pActiveItemNum < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem );
|
|
6038 if ( !v122 )
|
629
|
6039 {
|
920
|
6040 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]);//
|
|
6041 // "Seek knowledge elsewhere %s the %s"
|
|
6042 strcat(pTmpBuf, "\n \n");
|
|
6043 strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]);// "I can offer you nothing further."
|
|
6044 v6 = (174 - pFontArrus->CalcTextHeight(pTmpBuf, &dialog_window, 0, 0)) / 2 + 138;
|
|
6045 dialog_window.DrawTitleText(pFontArrus, v3, v6, pYellowColor, pTmpBuf, 3);
|
|
6046 return;
|
629
|
6047 }
|
920
|
6048 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], v119);// "Skill Cost: %lu"
|
|
6049 dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u);
|
|
6050 v119 = (const char **)((149 - all_text_height) / v122);
|
|
6051 if ( (149 - all_text_height) / v122 > 32 )
|
|
6052 v119 = (const char **)32;
|
|
6053 v38 = (149 - v122 * (signed int)v119 - all_text_height) / 2 - (signed int)v119 / 2 + 162;
|
|
6054 v118 = 2;
|
|
6055 if ( pDialogueWindow->pStartingPosActiveItem < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton )
|
|
6056 {
|
|
6057 v122 = 2;
|
|
6058 do
|
|
6059 {
|
|
6060 control_button = pDialogueWindow->GetControl(v122);
|
|
6061 v41 = control_button->msg_param - 36;
|
|
6062 if ( !byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][v41] || pPlayers[uActiveCharacter]->pActiveSkills[v41] )
|
|
6063 {
|
|
6064 control_button->uW = 0;
|
|
6065 control_button->uHeight = 0;
|
|
6066 control_button->uY = 0;
|
|
6067 }
|
|
6068 else
|
|
6069 {
|
|
6070 control_button->uY = (unsigned int)((char *)v119 + v38);
|
|
6071 pTextHeight = pFontArrus->CalcTextHeight(pSkillNames[v41], &dialog_window, 0, 0);
|
|
6072 v44 = control_button->uY;
|
|
6073 control_button->uHeight = pTextHeight;
|
|
6074 v38 = v44 + pTextHeight - 1;
|
|
6075 control_button->uW = v38;
|
|
6076 text_color = pYellowColor;
|
|
6077 if ( pDialogueWindow->pCurrentPosActiveItem != v122 )
|
|
6078 text_color = pWhiteColor;
|
|
6079 dialog_window.DrawTitleText(pFontArrus, 0, v44, text_color, pSkillNames[v41], 3);
|
|
6080 }
|
|
6081 ++v122;
|
|
6082 }
|
|
6083 while ( v122 < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem );
|
|
6084 }
|
629
|
6085 }
|
920
|
6086 return;
|
629
|
6087 }
|
|
6088 return;
|
|
6089 }
|