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