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