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