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