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