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