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