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