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