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