Mercurial > mm7
annotate UI/UIHouses.cpp @ 2335:6e3ca612f132
int -> uint
author | Ritor1 |
---|---|
date | Wed, 02 Apr 2014 22:05:35 +0600 |
parents | ddb803517a48 |
children | d6887ee81068 |
rev | line source |
---|---|
2253
aff7a7b072b7
adding _CRT_SECURE_NO_WARNINGS to get rid of a few hundrer annoying warnings + adding count parameter to swprintf
Grumpy7
parents:
2234
diff
changeset
|
1 #define _CRT_SECURE_NO_WARNINGS |
1299 | 2 #include "..\Texture.h" |
3 #include "..\mm7_data.h" | |
1298 | 4 #include "UIHouses.h" |
1299 | 5 #include "..\Party.h" |
6 #include "..\texts.h" | |
7 #include "..\Events.h" | |
8 #include "..\Arcomage.h" | |
9 #include "..\LOD.h" | |
10 #include "..\Mouse.h" | |
11 #include "..\GUIWindow.h" | |
12 #include "..\GUIFont.h" | |
13 #include "..\Overlays.h" | |
14 #include "..\Outdoor.h" | |
1638
ccde94f02b75
class IndoorCamera split into BLVRenderParams and ODMRenderParams
Nomad
parents:
1630
diff
changeset
|
15 #include "..\Outdoor_stuff.h" |
1299 | 16 #include "..\AudioPlayer.h" |
17 #include "..\VideoPlayer.h" | |
18 #include "..\Monsters.h" | |
19 #include "..\Viewport.h" | |
20 #include "..\Keyboard.h" | |
21 #include "..\MapInfo.h" | |
22 #include "..\Log.h" | |
23 #include "..\Game.h" | |
1298 | 24 |
1299 | 25 #include "..\stru159.h" |
1298 | 26 int uHouse_ExitPic; // weak |
27 | |
28 int dword_591080; // weak | |
29 | |
1411 | 30 BuildingType in_current_building_type; // 00F8B198 |
1298 | 31 HOUSE_DIALOGUE_MENU dialog_menu_id; // 00F8B19C |
32 | |
33 #pragma pack(push, 1) | |
34 struct stru365_travel_info | |
35 { | |
36 unsigned char uMapInfoID; | |
37 unsigned char pSchedule[7]; | |
38 unsigned int uTravelTime; | |
39 int arrival_x; | |
40 int arrival_y; | |
41 int arrival_z; | |
42 int arrival_rot_y; | |
43 unsigned int uQuestBit; // quest bit required to set for this travel option to be enabled; otherwise 0 | |
44 }; | |
45 #pragma pack(pop) | |
46 stru365_travel_info transport_schedule[35] = // 004F09B0 | |
47 { | |
48 {MAP_STEADWICK, {1, 0, 1, 0, 1, 0, 0}, 2, -18048, 4636, 833, 1536, 0}, | |
49 {MAP_PIERPONT, {0, 1, 0, 1, 0, 1, 0}, 2, -2527, -6773, 1153, 896, 0}, | |
50 {MAP_TATALIA, {1, 0, 1, 0, 1, 0, 0}, 2, 4730, -10580, 320, 1024, 0}, | |
51 {MAP_HARMONDALE, {0, 1, 0, 1, 0, 1, 0}, 2, -5692, 11137, 1, 1024, 0}, | |
52 {MAP_DEYJA, {1, 0, 0, 1, 0, 0, 0}, 3, 7227, -16007, 2625, 640, 0}, | |
53 {MAP_BRAKADA_DESERT, {0, 0, 1, 0, 0, 1, 0}, 3, 8923, 17191, 1, 512, 0}, | |
54 {MAP_AVLEE, {1, 0, 1, 0, 1, 0, 0}, 3, 17059, 12331, 512, 1152, 0}, | |
55 {MAP_DEYJA, {0, 1, 0, 0, 1, 0, 1}, 2, 7227, -16007, 2625, 640, 0}, | |
56 {MAP_HARMONDALE, {0, 1, 0, 1, 0, 1, 0}, 2, -5692, 11137, 1, 1024, 0}, | |
57 {MAP_STEADWICK, {1, 0, 1, 0, 1, 0, 0}, 3, -18048, 4636, 833, 1536, 0}, | |
58 {MAP_PIERPONT, {0, 1, 0, 1, 0, 1, 0}, 2, -2527, -6773, 1153, 896, 0}, | |
59 {MAP_STEADWICK, {1, 0, 1, 0, 1, 0, 1}, 3, -18048, 4636, 833, 1536, 0}, | |
60 {MAP_HARMONDALE, {0, 1, 0, 0, 0, 1, 0}, 5, -5692, 11137, 1, 1024, 0}, | |
61 {MAP_STEADWICK, {0, 1, 0, 1, 0, 1, 0}, 2, -18048, 4636, 833, 1536, 0}, | |
62 {MAP_PIERPONT, {0, 1, 0, 1, 0, 1, 0}, 3, -2527, -16007, 1153, 896, 0}, | |
63 {MAP_DEYJA, {0, 0, 1, 0, 0, 0, 1}, 5, 7227, -16007, 2625, 640, 0}, | |
64 {MAP_TATALIA, {0, 1, 0, 1, 0, 1, 0}, 2, -2183, -6941, 97, 0, 0}, | |
65 {MAP_AVLEE, {1, 0, 0, 0, 1, 0, 0}, 4, 7913, 9476, 193, 0, 0}, | |
66 {MAP_EVENMORN_ISLE, {0, 0, 0, 0, 0, 0, 1}, 7, 15616, 6390, 193, 1536, PARTY_QUEST_EVENMORN_MAP_FOUND}, | |
67 {MAP_BRAKADA_DESERT, {0, 0, 1, 0, 0, 0, 0}, 6, 19171, -19722, 193, 1024, 0}, | |
68 {MAP_AVLEE, {0, 1, 0, 1, 0, 1, 0}, 3, 7913, 9476, 193, 0, 0}, | |
69 {MAP_BRAKADA_DESERT, {1, 0, 1, 0, 0, 0, 0}, 6, 19171, -19722, 193, 1024, 0}, | |
70 {MAP_TATALIA, {1, 0, 1, 0, 1, 0, 0}, 4, -2183, -6941, 97, 0, 0}, | |
71 {MAP_PIERPONT, {0, 0, 0, 0, 0, 1, 0}, 6, -709, -14087, 193, 1024, 0}, | |
72 {MAP_STEADWICK, {0, 0, 0, 0, 0, 0, 1}, 6, -10471, 13497, 193, 1536, 0}, | |
73 {MAP_EVENMORN_ISLE, {0, 1, 0, 1, 0, 0, 0}, 1, 15616, 6390, 193, 1536, PARTY_QUEST_EVENMORN_MAP_FOUND}, | |
74 {MAP_BRAKADA_DESERT, {0, 1, 0, 1, 0, 0, 0}, 1, 19171, -19722, 193, 1024, 0}, | |
75 {MAP_STEADWICK, {0, 1, 0, 1, 0, 1, 0}, 2, -10471, 13497, 193, 1536, 0}, | |
76 {MAP_BRAKADA_DESERT, {1, 0, 1, 0, 0, 0, 0}, 4, 19171, -19722, 193, 1024, 0}, | |
77 {MAP_EVENMORN_ISLE, {0, 0, 0, 0, 0, 0, 1}, 5, 15616, 6390, 193, 1536, PARTY_QUEST_EVENMORN_MAP_FOUND}, | |
78 {MAP_AVLEE, {0, 0, 0, 0, 1, 0, 0}, 5, 7913, 9476, 193, 0, 0}, | |
79 {MAP_STEADWICK, {0, 1, 0, 0, 0, 1, 0}, 4, -10471, 13497, 193, 1536, 0}, | |
80 {MAP_PIERPONT, {1, 0, 1, 0, 1, 0, 0}, 3, -709, -14087, 193, 1024, 0}, | |
81 {MAP_TATALIA, {0, 0, 0, 1, 0, 0, 0}, 5, -2183, -6941, 97, 0, 0}, | |
82 {MAP_ARENA, {0, 0, 0, 0, 0, 0, 1}, 4, 3844, 2906, 193, 512, 0} | |
83 }; | |
84 | |
85 unsigned char transport_routes[20][4] = | |
86 { | |
87 { 0, 1, 1, 34}, // HOUSE_STABLES_HARMONDALE | |
88 { 2, 3, 4, 5}, // HOUSE_STABLES_STEADWICK | |
1589 | 89 { 6, 7, 8, 8}, // HOUSE_STABLES_TULAREAN_FOREST |
90 { 9, 10, 10, 10}, // HOUSE_STABLES_DEYJA | |
1610 | 91 { 11, 11, 12, 12}, // HOUSE_STABLES_BRACADA_DESERT |
92 { 13, 13, 13, 13}, // HOUSE_STABLES_TATALIA | |
93 { 14, 14, 15, 15}, // HOUSE_STABLES_AVLEE | |
1298 | 94 {255, 255, 255, 255}, // HOUSE_STABLES_61 |
95 {255, 255, 255, 255}, // HOUSE_STABLES_62 | |
1610 | 96 {255, 255, 255, 255}, // HOUSE_BOATS_EMERALD_ISLE |
97 { 16, 17, 18, 19}, // HOUSE_BOATS_ERATHIA | |
98 { 18, 20, 21, 21}, // HOUSE_BOATS_TULAREAN_FOREST | |
99 { 22, 23, 24, 25}, // HOUSE_BOATS_BRACADA_DESERT | |
100 { 22, 22, 23, 23}, // HOUSE_BOATS_EVENMORN_ISLAND | |
1298 | 101 {255, 255, 255, 255}, // HOUSE_BOATS_68 |
1610 | 102 { 27, 28, 29, 30}, // HOUSE_BOATS_TATALIA |
103 { 31, 32, 33, 33}, // HOUSE_BOATS_AVLEE | |
1298 | 104 { 24, 24, 24, 24}, // HOUSE_BOATS_71 |
105 {255, 255, 255, 255}, // HOUSE_BOATS_72 | |
106 {255, 255, 255, 255} // HOUSE_BOATS_73 | |
107 }; | |
108 | |
109 std::array<const stru159, 196> pAnimatedRooms = //0x4E5F70 | |
110 {{ | |
111 {"", 0x4, 0x1F4, 0, 0, 0}, | |
112 {"Human Armor01", 0x20, 0x2C0, 2, 58, 0}, | |
113 {"Necromancer Armor01", 0x20, 0x2D7, 2, 70, 0 }, | |
114 {"Dwarven Armor01", 0x20, 0x2EE, 2, 5, 0 }, | |
115 {"Wizard Armor", 0x20, 0x3BD, 2, 19, 0 }, | |
116 {"Warlock Armor", 0x20, 0x2D6, 2, 35, 0 }, | |
117 {"Elf Armor", 0x20, 0x2BC, 2, 79, 0 }, | |
118 {"Human Alchemisht01", 0xE, 0x2BE, 4, 95, 0 }, | |
119 {"Necromancer Alchemist01", 0xE, 0x2D6, 4, 69, 0 }, | |
120 {"Dwarven Achemist01", 0xE, 0x387, 4, 4, 0 }, | |
121 {"Wizard Alchemist", 0xE, 0x232, 4, 25, 0 }, | |
122 {"Warlock Alchemist", 0xE, 0x2BE, 4, 42, 0 }, | |
123 {"Elf Alchemist", 0xE, 0x38A, 4, 84, 0 }, | |
124 {"Human Bank01", 0x6, 0x384, 22, 52, 0 }, | |
125 {"Necromancer Bank01", 0x6, 0x2D8, 22, 71, 0 }, | |
126 {"Dwarven Bank", 0x6, 0x2F3, 22, 6, 0 }, | |
127 {"Wizard Bank", 0x6, 0x3BA, 22, 20, 0 }, | |
128 {"Warlock Bank", 0x6, 0x39F, 22, 36, 0 }, | |
129 {"Elf Bank", 0x6, 0x2BC, 22, 71, 0 }, | |
130 {"Boat01", 0xF, 0x4C, 28, 53, 3 }, | |
131 {"Boat01d", 0xF, 0x4C, 28, 53, 3 }, | |
132 {"Human Magic Shop01", 0xA, 0x2C8, 3, 54, 0 }, | |
133 {"Necromancer Magic Shop01", 0xE, 0x2DC, 3, 66, 0 }, | |
134 {"Dwarven Magic Shop01", 0x2A, 0x2EF, 3, 91, 0 }, | |
135 {"Wizard Magic Shop", 0x1E, 0x2DF, 3, 15, 0 }, | |
136 {"Warlock Magic Shop", 0x7, 0x3B9, 3, 15, 0 }, | |
137 {"Elf Magic Shop", 0x24, 0x2CC, 3, 82, 0 }, | |
138 {"Human Stables01", 0x21, 0x31, 27, 48, 3 }, | |
139 {"Necromancer Stables", 0x21, 0x2DD, 27, 67, 3 }, | |
140 {"", 0x21, 0x2F0, 27, 91, 3 }, | |
141 {"Wizard Stables", 0x21, 0x3BA, 27, 16, 3 }, | |
142 {"Warlock Stables", 0x21, 0x181, 27, 77, 3 }, | |
143 {"Elf Stables", 0x21, 0x195, 27, 77, 3 }, | |
144 {"Human Tavern01", 0xD, 0x2C2, 21, 49, 0 }, | |
145 {"Necromancer Tavern01", 0xD, 0x3B0, 21, 57, 0 }, | |
146 {"Dwarven Tavern01", 0xD, 0x2FE, 21, 94, 0 }, | |
147 {"Wizard Tavern", 0xD, 0x3BB, 21, 17, 0 }, | |
148 {"Warlock Tavern", 0xD, 0x3A8, 21, 33, 0 }, | |
149 {"Elf Tavern", 0xD, 0x2CD, 21, 78, 0 }, | |
150 {"Human Temple01", 0x24, 0x2DB, 23, 50, 3 }, | |
151 {"Necromancer Temple", 0x24, 0x2DF, 23, 60, 3 }, | |
152 {"Dwarven Temple01", 0x24, 0x2F1, 23, 86, 3 }, | |
153 {"Wizard Temple", 0x24, 0x2E0, 23, 10, 3 }, | |
154 {"Warlock Temple", 0x24, 0x3A4, 23, 27, 3 }, | |
155 {"Elf Temple", 0x24, 0x2CE, 23, 72, 3 }, | |
156 {"Human Town Hall", 0x10, 0x39C, 17, 14, 0 }, | |
157 {"Necromancer Town Hall01", 0x10, 0x3A4, 17, 61, 0 }, | |
158 {"Dwarven Town Hall", 0x10, 0x2DB, 17, 88, 0 }, | |
159 {"Wizard Town Hall", 0x10, 0x3BD, 17, 11, 0 }, | |
160 {"Warlock Town Hall", 0x10, 0x2DB, 17, 28, 0 }, | |
161 {"Elf Town Hall", 0x10, 0x27A, 17, 73, 0 }, | |
162 {"Human Training Ground01", 0x18, 0x2C7, 30, 44, 0 }, | |
163 {"Necromancer Training Ground", 0x18, 0x3AD, 30, 62, 0 }, | |
164 {"Dwarven Training Ground", 0x18, 0x2F2, 30, 89, 0 }, | |
165 {"Wizard Training Ground", 0x18, 0x3A3, 30, 12, 0 }, | |
166 {"Warlock Training Ground", 0x18, 0x3A6, 30, 29, 0 }, | |
167 {"Elf Training Ground", 0x18, 0x19F, 30, 74, 0 }, | |
168 {"Human Weapon Smith01", 0x16, 0x2C1, 1, 45, 4 }, | |
169 {"Necromancer Weapon Smith01", 0x16, 0x2D9, 1, 63, 4 }, | |
170 {"Dwarven Weapon Smith01", 0x16, 0x2EE, 1, 82, 4 }, | |
171 {"Wizard Weapon Smith", 0x16, 0x2D5, 1, 13, 4 }, | |
172 {"Warlock Weapon Smith", 0x16, 0x2D7, 1, 23, 4 }, | |
173 {"Elf Weapon Smith", 0x16, 0x2CA, 1, 75, 4 }, | |
174 {"Air Guild", 0x1D, 0xA4, 6, 1, 3 }, | |
175 {"Body Guild", 0x19, 0x3BF, 11, 2, 0 }, | |
176 {"DarkGuild", 0x19, 0x2D1, 13, 3, 0 }, | |
177 {"EarthGuild", 0x19, 0x2CB, 8, 83, 0 }, | |
178 {"Fire Guild", 0x1C, 0x2BF, 5, 56, 0 }, | |
179 {"Light Guild", 0x1C, 0x2D5, 12, 46, 0 }, | |
180 {"Mind Guild", 0x1C, 0xE5, 10, 40, 0 }, | |
181 {"Spirit Guild", 0x1C, 0x2D2, 9, 41, 0 }, | |
182 {"Water Guild", 0x1B, 0x2D3, 7, 24, 0 }, | |
183 {"Lord And Judge Out01", 1, 0, 29, 39, 0 }, | |
184 {"Human Poor House 1", 8, 0, 29, 0, 0 }, | |
185 {"Human Poor House 2", 8, 0, 29, 0, 0 }, | |
186 {"Human Poor House 3", 8, 0, 29, 0, 0 }, | |
187 {"Human Medium House 1", 8, 0, 29, 0, 0 }, | |
188 {"Human Medium House 2", 8, 0, 29, 0, 0 }, | |
189 {"Human Medium House 3", 8, 0, 29, 0, 0 }, | |
190 {"Human Rich House 1", 8, 0, 29, 0, 0 }, | |
191 {"Human Rich House 2", 8, 0, 29, 0, 0 }, | |
192 {"Human Rich House 3", 8, 0, 29, 0, 0 }, | |
193 {"Elven Poor House 1", 8, 0, 29, 0, 0 }, | |
194 {"Elven Poor House 2", 8, 0, 29, 0, 0 }, | |
195 {"Elven Poor House 3", 8, 0, 29, 0, 0 }, | |
196 {"Elven Medium House 1", 8, 0, 29, 0, 0 }, | |
197 {"Elven Medium House 2", 8, 0, 29, 0, 0 }, | |
198 {"Elven Medium House 3", 8, 0, 29, 0, 0 }, | |
199 {"Elven Rich House 1", 8, 0, 29, 0, 0 }, | |
200 {"Elven Rich House 2", 8, 0, 29, 0, 0 }, | |
201 {"Elven Rich House 3", 8, 0, 29, 0, 0 }, | |
202 {"Dwarven Poor House 1", 8, 0, 29, 0, 0 }, | |
203 {"Dwarven Poor House 2", 8, 0, 29, 0, 0 }, | |
204 {"Dwarven Poor House 3", 8, 0, 29, 0, 0 }, | |
205 {"Dwarven Medium House 1", 8, 0, 29, 0, 0 }, | |
206 {"Dwarven Medium house 2", 8, 0, 29, 0, 0 }, | |
207 {"Dwarven Medium House 3", 8, 0, 29, 0, 0 }, | |
208 {"Dwarven Rich House 1", 8, 0, 29, 0, 0 }, | |
209 {"Dwarven Rich House 2", 8, 0, 29, 0, 0 }, | |
210 {"Dwarven Rich House 3", 8, 0, 29, 0, 0 }, | |
211 {"Wizard Poor House 1", 8, 0, 29, 0, 0 }, | |
212 {"Wizard Poor House 2", 8, 0, 29, 0, 0 }, | |
213 {"Wizard Poor House 3", 8, 0, 29, 0, 0 }, | |
214 {"Wizard Medium House 1", 8, 0, 29, 0, 0 }, | |
215 {"Wizard Medium House 2", 8, 0, 29, 0, 0 }, | |
216 {"Wizard Mdeium House 3", 8, 0, 29, 0, 0 }, | |
217 {"Wizard Rich House 1", 8, 0, 29, 0, 0 }, | |
218 {"Wizard Rich House 2", 8, 0, 29, 0, 0 }, | |
219 {"Wizard Rich House 3", 8, 0, 29, 0, 0 }, | |
220 {"Necromancer Poor House 1", 8, 0, 29, 0, 0 }, | |
221 {"Necromancer Poor House 2", 8, 0, 29, 0, 0 }, | |
222 {"Necromancer Poor House 3", 8, 0, 29, 0, 0 }, | |
223 {"Necromancer Medium House 1", 8, 0, 29, 0, 0 }, | |
224 {"Necromancer Medium House 2", 8, 0, 29, 0, 0 }, | |
225 {"Necromancer Mdeium House 3", 8, 0, 29, 0, 0 }, | |
226 {"Necromancer Rich House 1", 8, 0, 29, 0, 0 }, | |
227 {"Necromancer Rich House 2", 8, 0, 29, 0, 0 }, | |
228 {"Necromancer Rich House 3", 8, 0, 29, 0, 0 }, | |
229 {"Warlock Poor House 1", 8, 0, 29, 0, 0 }, | |
230 {"Warlock Poor House 2", 8, 0, 29, 0, 0 }, | |
231 {"Warlock Poor House 3", 8, 0, 29, 0, 0 }, | |
232 {"Warlock Medium House 1", 8, 0, 29, 0, 0 }, | |
233 {"Warlock Medium House 2", 8, 0, 29, 0, 0 }, | |
234 {"Warlock Mdeium House 3", 8, 0, 29, 0, 0 }, | |
235 {"Warlock Rich House 1", 8, 0, 29, 0, 0 }, | |
236 {"Warlock Rich House 2", 8, 0, 29, 0, 0 }, | |
237 {"Warlock Rich House 3", 8, 0, 29, 0, 0 }, | |
238 {"Out01 Temple of the Moon", 0x24, 0, 25, 0, 0 }, | |
239 {"Out01 Dragon Cave", 0x24, 0, 25, 0, 0 }, | |
240 {"Out02 Castle Harmondy", 0x24, 0, 25, 0, 0 }, | |
241 {"Out02 White Cliff Cave", 0x24, 0, 25, 0, 0 }, | |
242 {"Out03 Erathian Sewer", 0x24, 0, 25, 0, 0 }, | |
243 {"Out03 Fort Riverstride", 0x24, 0, 25, 0, 0 }, | |
244 {"Out03 Castle Gryphonheart", 0x24, 0, 25, 0, 0 }, | |
245 {"Out04 Elf Castle", 0x24, 0, 25, 0, 0 }, | |
246 {"Out04 Tularean Caves", 0x24, 0, 25, 0, 0 }, | |
247 {"Out04 Clanker's Laboratory", 0x24, 0, 25, 0, 0 }, | |
248 {"Out05 Hall of the Pit", 0x24, 0, 25, 0, 0 }, | |
249 {"Out05 Watchtower 6", 0x24, 0, 25, 0, 0 }, | |
250 {"Out06 School of Sorcery", 0x24, 0, 25, 0, 0 }, | |
251 {"Out06 Red Dwarf Mines", 0x24, 0, 25, 0, 0 }, | |
252 {"Out07 Castle Lambert", 0x24, 0, 25, 0, 0 }, | |
253 {"Out07 Walls of Mist", 0x24, 0, 25, 0, 0 }, | |
254 {"Out07 Temple of the Light", 0x24, 0, 25, 0, 0 }, | |
255 {"Out08 Evil Entrance", 0x24, 0, 25, 0, 0 }, | |
256 {"Out08 Breeding Zone", 0x24, 0, 25, 0, 0 }, | |
257 {"Out08 Temple of the Dark", 0x24, 0, 25, 0, 0 }, | |
258 {"Out09 Grand Temple of the Moon", 0x24, 0, 25, 0, 0 }, | |
259 {"Out09 Grand Tempple of the Sun", 0x24, 0, 25, 0, 0 }, | |
260 {"Out10 Thunderfist Mountain", 0x24, 0, 25, 0, 0 }, | |
261 {"Out10 The Maze", 0x24, 0, 25, 0, 0 }, | |
262 {"Out10 Connecting Tunnel Cave #1", 0x24, 0, 25, 0, 0 }, | |
263 {"", 0x24, 0, 25, 0, 0 }, | |
264 {"", 0x24, 0, 25, 0, 0 }, | |
265 {"Out11 Stone City", 0x24, 0, 25, 0, 0 }, | |
266 {"", 0x24, 0, 25, 0, 0 }, | |
267 {"Out12 Colony Zod", 0x24, 0, 25, 0, 0 }, | |
268 {"Out12 Connecting Tunnel Cave #1", 0x24, 0, 25, 0, 0 }, | |
269 {"", 0x24, 0, 25, 0, 0 }, | |
270 {"", 0x24, 0, 25, 0, 0 }, | |
271 {"Out13 Mercenary Guild", 0x24, 0, 25, 0, 0 }, | |
272 {"Out13 Tidewater Caverns", 0x24, 0, 25, 0, 0 }, | |
273 {"Out13 Wine Cellar", 0x24, 0, 25, 0, 0 }, | |
274 {"Out14 Titan's Stronghold", 0x24, 0, 25, 0, 0 }, | |
275 {"Out14 Temple Of Baa", 0x24, 0, 25, 0, 0 }, | |
276 {"Out14 Hall under the Hill", 0x24, 0, 25, 0, 0 }, | |
277 {"Out15 The Linclon", 0x24, 0, 25, 0, 0 }, | |
278 {"Jail", 0x24, 0, 31, 0, 0 }, | |
279 {"Harmondale Throne Room", 0x24, 0, 29, 0, 0 }, | |
280 {"Gryphonheart Throne Room", 0x24, 0, 20, 0, 0 }, | |
281 {"Elf Castle Throne Room", 0x24, 0, 20, 0, 0 }, | |
282 {"Wizard Castle Throne Room", 0x24, 0, 20, 0, 0 }, | |
283 {"Necromancer Casstle Trone Room", 0x24, 0, 20, 0, 0 }, | |
284 {"Master Thief", 0x24, 0, 29, 0, 0 }, | |
285 {"Dwarven King", 0x24, 0, 20, 0, 0 }, | |
286 {"Arms Master", 0x24, 0, 29, 0, 0 }, | |
287 {"Warlock", 0x24, 0, 29, 0, 0 }, | |
288 {"Lord Markam", 0x24, 0, 20, 0, 0 }, | |
289 {"Arbiter Neutral Town", 0x24, 0, 29, 0, 0 }, | |
290 {"Arbiter Good Town", 0x24, 0, 29, 0, 0 }, | |
291 {"Arbiter Evil Town", 0x24, 0, 29, 0, 0 }, | |
292 {"Necromancer Throne Room Empty", 0x24, 0, 20, 0, 0 }, | |
293 {"", 0x24, 0, 29, 0, 0 }, | |
294 {"", 0x24, 0, 29, 0, 0 }, | |
295 {"", 0x24, 0, 29, 0, 0 }, | |
296 {"", 0x24, 0, 29, 0, 0 }, | |
297 {"Boat01", 0xF, 0, 29, 53, 3 }, | |
298 {"", 0x24, 0, 28, 0, 0 }, | |
299 {"", 0x24, 0, 28, 0, 0 }, | |
300 {"", 0x24, 0, 28, 0, 0 }, | |
301 {"", 0x24, 0, 29, 0, 0 }, | |
302 {"Arbiter Room Neutral", 0x24, 0, 29, 0, 0 }, | |
303 {"Out02 Castle Harmondy Abandoned", 0x24, 0, 25, 0, 0 }, | |
304 {"Human Temple02", 0x24, 0x3AB, 23, 27, 0 }, | |
305 {"Player Castle Good", 0x24, 0, 25, 0, 0 }, | |
306 {"Player Castle Bad", 0x24, 0, 25, 0, 0} | |
307 }}; | |
308 | |
1393 | 309 |
1411 | 310 |
311 //----- (004B3A72) -------------------------------------------------------- | |
312 void InitializaDialogueOptions_Tavern(BuildingType type) | |
313 { | |
314 int num_buttons; // esi@1 | |
315 | |
316 num_buttons = 0; | |
317 if (type == BuildingType_Tavern) | |
318 { | |
319 num_buttons = 2; | |
320 CreateButtonInColumn(0, 102); | |
321 CreateButtonInColumn(1, 103); | |
1526 | 322 if ( pParty->HasItem(651) ) //Arcomage Deck |
1411 | 323 { |
324 num_buttons = 3; | |
325 CreateButtonInColumn(2, 104); | |
326 } | |
327 } | |
328 pDialogueWindow->_41D08F_set_keyboard_control_group(num_buttons, 1, 0, 2); | |
329 dword_F8B1E0 = pDialogueWindow->pNumPresenceButton; | |
330 } | |
331 // F8B1E0: using guessed type int dword_F8B1E0; | |
332 | |
333 //----- (004B3AD4) -------------------------------------------------------- | |
334 void InitializaDialogueOptions_Shops(BuildingType type) | |
335 { | |
336 switch (type) | |
337 { | |
338 case BuildingType_WeaponShop: | |
339 case BuildingType_ArmorShop: | |
340 case BuildingType_MagicShop: | |
341 { | |
342 CreateButtonInColumn(0, 3); | |
343 CreateButtonInColumn(1, 4); | |
344 CreateButtonInColumn(2, 5); | |
345 pDialogueWindow->_41D08F_set_keyboard_control_group(3, 1, 0, 2); | |
346 } | |
347 break; | |
348 | |
349 case BuildingType_AlchemistShop: | |
350 { | |
351 CreateButtonInColumn(0, 3); | |
352 CreateButtonInColumn(1, 4); | |
353 pDialogueWindow->_41D08F_set_keyboard_control_group(2, 1, 0, 2); | |
354 } | |
355 break; | |
356 } | |
357 | |
358 dword_F8B1E0 = pDialogueWindow->pNumPresenceButton; | |
359 } | |
360 // F8B1E0: using guessed type int dword_F8B1E0; | |
361 | |
362 //----- (004B3B42) -------------------------------------------------------- | |
363 void InitializaDialogueOptions(BuildingType type) | |
364 { | |
365 switch (type) | |
366 { | |
367 case BuildingType_WeaponShop: | |
368 case BuildingType_ArmorShop: | |
369 case BuildingType_MagicShop: | |
370 case BuildingType_AlchemistShop: | |
371 { | |
372 CreateButtonInColumn(0, 2); | |
373 CreateButtonInColumn(1, 95); | |
374 CreateButtonInColumn(2, 94); | |
375 CreateButtonInColumn(3, 96); | |
376 pDialogueWindow->_41D08F_set_keyboard_control_group(4, 1, 0, 2); | |
377 } | |
378 break; | |
379 | |
380 case BuildingType_FireGuild: | |
381 { | |
382 CreateButtonInColumn(0, 18); | |
383 CreateButtonInColumn(1, 48); | |
384 CreateButtonInColumn(2, 72); | |
385 pDialogueWindow->_41D08F_set_keyboard_control_group(3, 1, 0, 2); | |
386 } | |
387 break; | |
388 | |
389 case BuildingType_AirGuild: | |
390 { | |
391 CreateButtonInColumn(0, 18); | |
392 CreateButtonInColumn(1, 49); | |
393 CreateButtonInColumn(2, 72); | |
394 pDialogueWindow->_41D08F_set_keyboard_control_group(3, 1, 0, 2); | |
395 } | |
396 break; | |
397 | |
398 case BuildingType_WaterGuild: | |
399 { | |
400 CreateButtonInColumn(0, 18); | |
401 CreateButtonInColumn(1, 50); | |
402 CreateButtonInColumn(2, 72); | |
403 pDialogueWindow->_41D08F_set_keyboard_control_group(3, 1, 0, 2); | |
404 } | |
405 break; | |
406 | |
407 case BuildingType_EarthGuild: | |
408 { | |
409 CreateButtonInColumn(0, 18); | |
410 CreateButtonInColumn(1, 51); | |
411 CreateButtonInColumn(2, 72); | |
412 pDialogueWindow->_41D08F_set_keyboard_control_group(3, 1, 0, 2); | |
413 } | |
414 break; | |
415 | |
416 case BuildingType_SpiritGuild: | |
417 { | |
418 CreateButtonInColumn(0, 18); | |
419 CreateButtonInColumn(1, 52); | |
420 CreateButtonInColumn(2, 61); | |
421 pDialogueWindow->_41D08F_set_keyboard_control_group(3, 1, 0, 2); | |
422 } | |
423 break; | |
424 | |
425 case BuildingType_MindGuild: | |
426 { | |
427 CreateButtonInColumn(0, 18); | |
428 CreateButtonInColumn(1, 53); | |
429 CreateButtonInColumn(2, 61); | |
430 pDialogueWindow->_41D08F_set_keyboard_control_group(3, 1, 0, 2); | |
431 } | |
432 break; | |
433 | |
434 case BuildingType_BodyGuild: | |
435 { | |
436 CreateButtonInColumn(0, 18); | |
437 CreateButtonInColumn(1, 54); | |
438 CreateButtonInColumn(2, 61); | |
439 pDialogueWindow->_41D08F_set_keyboard_control_group(3, 1, 0, 2); | |
440 } | |
441 break; | |
442 | |
443 case BuildingType_LightGuild: | |
444 { | |
445 CreateButtonInColumn(0, 18); | |
446 CreateButtonInColumn(1, 55); | |
447 pDialogueWindow->_41D08F_set_keyboard_control_group(2, 1, 0, 2); | |
448 } | |
449 break; | |
450 | |
451 case BuildingType_DarkGuild: | |
452 { | |
453 CreateButtonInColumn(0, 18); | |
454 CreateButtonInColumn(1, 56); | |
455 pDialogueWindow->_41D08F_set_keyboard_control_group(2, 1, 0, 2); | |
456 } | |
457 break; | |
458 | |
1644 | 459 case BuildingType_ElementalGuild: |
1411 | 460 { |
461 CreateButtonInColumn(0, 18); | |
462 CreateButtonInColumn(1, 48); | |
463 CreateButtonInColumn(2, 49); | |
464 CreateButtonInColumn(3, 50); | |
465 CreateButtonInColumn(4, 51); | |
466 pDialogueWindow->_41D08F_set_keyboard_control_group(5, 1, 0, 2); | |
467 } | |
468 break; | |
469 | |
1644 | 470 case BuildingType_SelfGuild: |
1411 | 471 { |
472 CreateButtonInColumn(0, 18); | |
473 CreateButtonInColumn(1, 52); | |
474 CreateButtonInColumn(2, 53); | |
475 CreateButtonInColumn(3, 54); | |
476 pDialogueWindow->_41D08F_set_keyboard_control_group(4, 1, 0, 2); | |
477 } | |
478 break; | |
479 | |
480 case BuildingType_16: | |
481 case BuildingType_TownHall: | |
482 { | |
483 int num_buttons = 1; | |
484 CreateButtonInColumn(0, 99); | |
485 | |
486 if (pParty->uFine) | |
487 { | |
488 num_buttons++; | |
489 CreateButtonInColumn(1, 100); | |
490 } | |
491 | |
492 pDialogueWindow->_41D08F_set_keyboard_control_group(num_buttons, 1, 0, 2); | |
493 } | |
494 break; | |
495 | |
496 case BuildingType_Bank: | |
497 { | |
498 CreateButtonInColumn(0, 7); | |
499 CreateButtonInColumn(1, 8); | |
500 pDialogueWindow->_41D08F_set_keyboard_control_group(2, 1, 0, 2); | |
501 } | |
502 break; | |
503 | |
504 case BuildingType_Temple: | |
505 { | |
506 CreateButtonInColumn(0, 10); | |
507 CreateButtonInColumn(1, 11); | |
508 CreateButtonInColumn(2, 96); | |
509 pDialogueWindow->_41D08F_set_keyboard_control_group(3, 1, 0, 2); | |
510 } | |
511 break; | |
512 | |
513 case BuildingType_Stables: | |
514 case BuildingType_Boats: | |
515 { | |
516 CreateButtonInColumn(0, 105); | |
517 CreateButtonInColumn(1, 106); | |
518 CreateButtonInColumn(2, 107); | |
519 CreateButtonInColumn(3, 108); | |
520 pDialogueWindow->_41D08F_set_keyboard_control_group(4, 1, 0, 2); | |
521 } | |
522 break; | |
523 | |
524 case BuildingType_Training: | |
525 { | |
526 CreateButtonInColumn(0, 17); | |
527 CreateButtonInColumn(1, 96); | |
528 pDialogueWindow->_41D08F_set_keyboard_control_group(2, 1, 0, 2); | |
529 } | |
530 break; | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1411
diff
changeset
|
531 |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1411
diff
changeset
|
532 case BuildingType_Tavern: |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1411
diff
changeset
|
533 { |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1411
diff
changeset
|
534 CreateButtonInColumn(0, 0xFu); |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1411
diff
changeset
|
535 CreateButtonInColumn(1, 0x10u); |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1411
diff
changeset
|
536 CreateButtonInColumn(2, 0x60u); |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1411
diff
changeset
|
537 if ( (signed int)window_SpeakInHouse->ptr_1C < 108 || (signed int)window_SpeakInHouse->ptr_1C > 120 ) |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1411
diff
changeset
|
538 { |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1411
diff
changeset
|
539 pDialogueWindow->_41D08F_set_keyboard_control_group(3, 1, 0, 2); |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1411
diff
changeset
|
540 break; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1411
diff
changeset
|
541 } |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1411
diff
changeset
|
542 CreateButtonInColumn(3, 101); |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1411
diff
changeset
|
543 pDialogueWindow->_41D08F_set_keyboard_control_group(4, 1, 0, 2); |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1411
diff
changeset
|
544 } |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1411
diff
changeset
|
545 break; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1411
diff
changeset
|
546 |
1411 | 547 case BuildingType_18: |
548 case BuildingType_19: | |
549 case BuildingType_Throne_Room: | |
550 case BuildingType_24: | |
551 case BuildingType_Unic: | |
552 case BuildingType_1A: | |
553 case BuildingType_House: | |
554 case BuildingType_Jail: | |
555 break; | |
556 | |
557 default: | |
1545 | 558 Error("Invalid enumeration value: %u", type); |
1411 | 559 } |
560 | |
561 /* if ( a1 > 13 ) | |
562 { | |
563 if ( a1 > 22 ) | |
564 { | |
565 if ( a1 == 23 ) | |
566 { | |
567 CreateButtonInColumn(0, 0xAu); | |
568 CreateButtonInColumn(1, 0xBu); | |
569 v14 = 96; | |
570 LABEL_41: | |
571 CreateButtonInColumn(2, v14); | |
572 v17 = 2; | |
573 v11 = 0; | |
574 v10 = 1; | |
575 v9 = 3; | |
576 goto LABEL_42; | |
577 } | |
578 if ( a1 <= 26 ) | |
579 goto LABEL_43; | |
580 if ( a1 > 28 ) | |
581 { | |
582 if ( a1 != 30 ) | |
583 goto LABEL_43; | |
584 CreateButtonInColumn(0, 0x11u); | |
585 v16 = 96; | |
586 goto LABEL_37; | |
587 } | |
588 CreateButtonInColumn(0, 0x69u); | |
589 CreateButtonInColumn(1, 0x6Au); | |
590 CreateButtonInColumn(2, 0x6Bu); | |
591 v12 = 108; | |
592 } | |
593 else | |
594 { | |
595 if ( a1 == 22 ) | |
596 { | |
597 CreateButtonInColumn(0, 7u); | |
598 v16 = 8; | |
599 goto LABEL_37; | |
600 } | |
601 v1 = a1 - 14; | |
602 if ( !v1 ) // == 14 | |
603 { | |
604 CreateButtonInColumn(0, 0x12u); | |
605 CreateButtonInColumn(1, 0x30u); | |
606 CreateButtonInColumn(2, 0x31u); | |
607 CreateButtonInColumn(3, 0x32u); | |
608 CreateButtonInColumn(4, 0x33u); | |
609 v17 = 2; | |
610 v11 = 0; | |
611 v10 = 1; | |
612 v9 = 5; | |
613 goto LABEL_42; | |
614 } | |
615 v2 = v1 - 1; | |
616 if ( v2 ) // > 15 | |
617 { | |
618 v3 = v2 - 2; | |
619 if ( v3 ) // > 17 | |
620 { | |
621 if ( v3 != 4 ) // 18, 19, 20 | |
622 goto LABEL_43; | |
623 CreateButtonInColumn(0, 0xFu); // 21 | |
624 CreateButtonInColumn(1, 0x10u); | |
625 v4 = 3; | |
626 CreateButtonInColumn(2, 0x60u); | |
627 v5 = (signed int)window_SpeakInHouse->ptr_1C; | |
628 if ( v5 < 108 || v5 > 120 ) | |
629 goto LABEL_28; | |
630 v4 = 4; | |
631 v6 = 101; | |
632 v7 = 3; | |
633 } | |
634 else // 16, 17 | |
635 { | |
636 v4 = 1; | |
637 CreateButtonInColumn(0, 0x63u); | |
638 if ( !pParty->uFine ) | |
639 { | |
640 LABEL_28: | |
641 v17 = 2; | |
642 v11 = 0; | |
643 v10 = 1; | |
644 v9 = v4; | |
645 LABEL_42: | |
646 pDialogueWindow->_41D08F_set_keyboard_control_group(v9, v10, v11, v17); | |
647 goto LABEL_43; | |
648 } | |
649 v4 = 2; | |
650 v7 = 1; | |
651 v6 = 100; | |
652 } | |
653 CreateButtonInColumn(v7, v6); | |
654 goto LABEL_28; | |
655 } | |
656 CreateButtonInColumn(0, 0x12u); // 15 | |
657 CreateButtonInColumn(1, 0x34u); | |
658 CreateButtonInColumn(2, 0x35u); | |
659 v12 = 54; | |
660 } | |
661 LABEL_39: | |
662 CreateButtonInColumn(3, v12); | |
663 v17 = 2; | |
664 v11 = 0; | |
665 v10 = 1; | |
666 v9 = 4; | |
667 goto LABEL_42; | |
668 } | |
669 if ( a1 == 13 ) | |
670 { | |
671 CreateButtonInColumn(0, 0x12u); | |
672 v16 = 56; | |
673 LABEL_37: | |
674 CreateButtonInColumn(1, v16); | |
675 v17 = 2; | |
676 v11 = 0; | |
677 v10 = 1; | |
678 v9 = 2; | |
679 goto LABEL_42; | |
680 } | |
681 switch ( a1 ) | |
682 { | |
683 case 1: | |
684 case 2: | |
685 case 3: | |
686 case 4: | |
687 CreateButtonInColumn(0, 2u); | |
688 CreateButtonInColumn(1, 0x5Fu); | |
689 CreateButtonInColumn(2, 0x5Eu); | |
690 v12 = 96; | |
691 goto LABEL_39; | |
692 case 5: | |
693 CreateButtonInColumn(0, 0x12u); | |
694 v13 = 48; | |
695 goto LABEL_9; | |
696 case 6: | |
697 CreateButtonInColumn(0, 0x12u); | |
698 v13 = 49; | |
699 goto LABEL_9; | |
700 case 7: | |
701 CreateButtonInColumn(0, 0x12u); | |
702 v13 = 50; | |
703 goto LABEL_9; | |
704 case 8: | |
705 CreateButtonInColumn(0, 0x12u); | |
706 v13 = 51; | |
707 LABEL_9: | |
708 CreateButtonInColumn(1, v13); | |
709 v14 = 72; | |
710 goto LABEL_41; | |
711 case 9: | |
712 CreateButtonInColumn(0, 0x12u); | |
713 v15 = 52; | |
714 goto LABEL_13; | |
715 case 10: | |
716 CreateButtonInColumn(0, 0x12u); | |
717 v15 = 53; | |
718 goto LABEL_13; | |
719 case 11: | |
720 CreateButtonInColumn(0, 0x12u); | |
721 v15 = 54; | |
722 LABEL_13: | |
723 CreateButtonInColumn(1, v15); | |
724 v14 = 61; | |
725 goto LABEL_41; | |
726 case 12: | |
727 CreateButtonInColumn(0, 0x12u); | |
728 v16 = 55; | |
729 goto LABEL_37; | |
730 default: | |
731 break; | |
732 } | |
733 LABEL_43:*/ | |
734 dword_F8B1E0 = pDialogueWindow->pNumPresenceButton; | |
735 } | |
736 // F8B1E0: using guessed type int dword_F8B1E0; | |
737 | |
738 | |
1393 | 739 //----- (004B1784) -------------------------------------------------------- |
1458 | 740 bool HouseUI_CheckIfPlayerCanInteract() |
1393 | 741 { |
1526 | 742 GUIWindow window; // [sp+4h] [bp-54h]@3 |
1393 | 743 |
1526 | 744 if ( pPlayers[uActiveCharacter]->CanAct() ) |
1393 | 745 { |
746 pDialogueWindow->pNumPresenceButton = dword_F8B1E0; | |
1526 | 747 return true; |
1393 | 748 } |
749 else | |
750 { | |
751 pDialogueWindow->pNumPresenceButton = 0; | |
1526 | 752 memcpy(&window, pPrimaryWindow, sizeof(window)); |
753 window.uFrameX = 483; | |
754 window.uFrameWidth = 148; | |
755 window.uFrameZ = 334; | |
756 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[427], pPlayers[uActiveCharacter]->pName, | |
757 pGlobalTXT_LocalizationStrings[562]); // "%s is in no condition to %s""do anything" | |
758 window.DrawTitleText(pFontArrus, 0, (212 - pFontArrus->CalcTextHeight(pTmpBuf.data(), &window, 0, 0)) / 2 + 101, ui_house_player_cant_interact_color, pTmpBuf.data(), 3); | |
759 return false; | |
1393 | 760 } |
761 } | |
762 | |
1298 | 763 //----- (0044622E) -------------------------------------------------------- |
764 bool EnterHouse(enum HOUSE_ID uHouseID) | |
765 { | |
766 signed int uOpenTime; // eax@5 | |
767 signed int uCloseTime; // esi@5 | |
2334 | 768 // unsigned int v5; // esi@5 |
769 // int v6; // edx@5 | |
1298 | 770 signed int am_pm_flag_open; // ecx@10 |
771 signed int am_pm_flag_close; // eax@10 | |
2334 | 772 // int v9; // esi@10 |
773 // int v11; // ecx@17 | |
774 // unsigned int v12; // kr00_4@25 | |
775 // int v14; // eax@25 | |
1298 | 776 unsigned int v17; // eax@37 |
777 signed int v18; // edi@37 | |
778 signed int v19; // edi@41 | |
779 char pContainer[40]; // [sp+Ch] [bp-30h]@32 | |
2334 | 780 // unsigned int v24; // [sp+34h] [bp-8h]@5 |
1298 | 781 |
782 GameUI_Footer_TimedString[0] = 0; | |
783 pFooterString[0] = 0; | |
1526 | 784 ShowStatusBarString("", 2); |
1298 | 785 if ( pMessageQueue_50CBD0->uNumMessages ) |
786 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
787 viewparams->bRedrawGameUI = 1; | |
788 uDialogueType = 0; | |
1459 | 789 pKeyActionMap->SetWindowInputStatus(WINDOW_INPUT_CANCELLED); |
1298 | 790 pKeyActionMap->ResetKeys(); |
791 if (uHouseID == HOUSE_600 || uHouseID == HOUSE_601) | |
792 { | |
793 GameOverMenu(0); | |
794 return 0; | |
795 } | |
796 uOpenTime = p2DEvents[uHouseID - 1].uOpenTime; | |
797 uCloseTime = p2DEvents[uHouseID - 1].uCloseTime; | |
798 current_npc_text = 0; | |
799 dword_F8B1E4 = 0; | |
800 memset(byte_F8B1F0.data(), 0, 4); | |
801 memset(player_levels.data(), 0, 16); | |
802 pRenderer->ClearZBuffer(0, 479); | |
803 | |
804 if (((uCloseTime - 1 <= uOpenTime)&&((pParty->uCurrentHour <uOpenTime)&&(pParty->uCurrentHour >(uCloseTime - 1))))|| | |
805 ((uCloseTime - 1 > uOpenTime)&&((pParty->uCurrentHour < uOpenTime)||(pParty->uCurrentHour > (uCloseTime - 1))))) | |
806 | |
807 { | |
808 am_pm_flag_open = 0; | |
809 am_pm_flag_close = 0; | |
810 if (uOpenTime > 12 ) | |
811 { | |
812 uOpenTime -= 12; | |
813 am_pm_flag_open = 1; | |
814 } | |
815 if ( uCloseTime > 12 ) | |
816 { | |
817 uCloseTime -= 12; | |
818 am_pm_flag_close = 1; | |
819 } | |
820 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[414], uOpenTime, aAMPMNames[am_pm_flag_open], | |
821 uCloseTime, aAMPMNames[am_pm_flag_close]); //"This place is open from %d%s to %d%s" | |
822 ShowStatusBarString(pTmpBuf.data(), 2u); | |
823 if ( uActiveCharacter ) | |
824 pPlayers[uActiveCharacter]->PlaySound(SPEECH_3, 0); | |
825 return 0; | |
826 } | |
827 else | |
828 { | |
829 //v10 = uHouseID; | |
830 if ( (signed int)uHouseID < 53 ) //entering shops and guilds | |
831 { | |
1747
cecb080929c4
Party_stru0 renamed to PartyTimeStruct, fixed its members, renamed Party::field_3C to Party::PartyTimes, started Player::SetVariable refactoring start
Grumpy7
parents:
1709
diff
changeset
|
832 if ( !(pParty->PartyTimes._shop_ban_times[uHouseID]) |
cecb080929c4
Party_stru0 renamed to PartyTimeStruct, fixed its members, renamed Party::field_3C to Party::PartyTimes, started Player::SetVariable refactoring start
Grumpy7
parents:
1709
diff
changeset
|
833 || (pParty->PartyTimes._shop_ban_times[uHouseID] <= pParty->uTimePlayed) ) |
1298 | 834 { |
1747
cecb080929c4
Party_stru0 renamed to PartyTimeStruct, fixed its members, renamed Party::field_3C to Party::PartyTimes, started Player::SetVariable refactoring start
Grumpy7
parents:
1709
diff
changeset
|
835 pParty->PartyTimes._shop_ban_times[uHouseID] = 0; |
1298 | 836 } |
837 else | |
838 { | |
839 ShowStatusBarString(pGlobalTXT_LocalizationStrings[191], 2u);// "You've been banned from this shop!" | |
840 return 0; | |
841 } | |
842 } | |
843 pAudioPlayer->StopChannels(-1, -1); | |
844 | |
845 uCurrentHouse_Animation = p2DEvents[uHouseID - 1].uAnimationID; | |
1411 | 846 in_current_building_type = (BuildingType)pAnimatedRooms[uCurrentHouse_Animation].uBuildingType; |
847 if ( in_current_building_type == BuildingType_Throne_Room && pParty->uFine ) // going 2 jail | |
1298 | 848 { |
849 uCurrentHouse_Animation = (signed __int16)p2DEvents[186].uAnimationID; | |
850 uHouseID = HOUSE_JAIL; | |
851 pParty->uTimePlayed = pParty->uTimePlayed + 0x7620000; | |
1411 | 852 in_current_building_type = (BuildingType)pAnimatedRooms[p2DEvents[HOUSE_LORD_AND_JUDGE_EMERALD_ISLE].uAnimationID].uBuildingType; |
1298 | 853 ++pParty->uNumPrisonTerms; |
854 pParty->uFine = 0; | |
855 for (uint i = 0; i < 4; ++i) | |
856 { | |
857 pParty->pPlayers[i].uTimeToRecovery = 0; | |
858 pParty->pPlayers[i].uNumDivineInterventionCastsThisDay = 0; | |
859 pParty->pPlayers[i].SetVariable(VAR_Award, 87); | |
860 } | |
861 } | |
862 ++pIcons_LOD->uTexturePacksCount; | |
863 if ( !pIcons_LOD->uNumPrevLoadedFiles ) | |
864 pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; | |
865 switch (pParty->alignment) | |
1545 | 866 { |
1298 | 867 case PartyAlignment_Good: sprintf(pContainer, "evt%02d-b", const_2()); break; |
868 case PartyAlignment_Neutral: sprintf(pContainer, "evt%02d", const_2()); break; | |
869 case PartyAlignment_Evil: sprintf(pContainer, "evt%02d-c", const_2()); break; | |
1545 | 870 default: Error("Invalid alignment type: %u", pParty->alignment); |
871 } | |
1298 | 872 |
873 v17 = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); | |
874 pDialogueNPCCount = 0; | |
875 pTexture_Dialogue_Background = &pIcons_LOD->pTextures[v17]; | |
876 uTextureID_right_panel_loop = uTextureID_right_panel; | |
877 PrepareHouse(uHouseID); | |
878 v18 = 1; | |
879 uTextureID_right_panel_loop = uTextureID_right_panel; | |
880 if ( uNumDialogueNPCPortraits == 1 ) | |
881 pDialogueNPCCount = 1; | |
882 pVideoPlayer->OpenHouseMovie(pAnimatedRooms[uCurrentHouse_Animation].video_name, 1u); | |
883 dword_5C35D4 = 1; | |
884 if ( (signed int)uHouseID < 139 || (signed int)uHouseID > 172 ) | |
885 { | |
886 if ( (signed int)uHouseID >= HOUSE_STABLES_HARMONDALE && (signed int)uHouseID <= 73 && !IsTravelAvailable(uHouseID - HOUSE_STABLES_HARMONDALE) ) | |
887 { | |
888 return 1; | |
889 } | |
890 } | |
891 else | |
892 { //guilds | |
893 v19 = guild_mambership_flags[uHouseID - HOUSE_FIRE_GUILD_INITIATE_EMERALD_ISLE]; //guilds flags | |
894 //v20 = uHouseID; | |
895 //if ( !((unsigned __int8)(0x80u >> v19 % 8) & pPlayers[uActiveCharacter]->_guilds_member_bits[v19 /8]) ) | |
2234 | 896 if(!_449B57_test_bit(pPlayers[uActiveCharacter]->_achieved_awards_bits,v19)) |
1298 | 897 { |
898 PlayHouseSound(uHouseID, HouseSound_Greeting_2); | |
899 return 1; | |
900 } | |
901 } | |
902 PlayHouseSound(uHouseID, HouseSound_Greeting); | |
903 dword_5C35D4 = 1; | |
904 return 1; | |
905 } | |
906 } | |
907 | |
1300 | 908 //----- (0044606A) -------------------------------------------------------- |
909 void PrepareHouse(HOUSE_ID house) | |
910 { | |
911 __int16 uExitMapID; // ax@2 | |
2334 | 912 // int v7; // ebx@11 |
913 // int v13; // [sp+30h] [bp-30h]@11 | |
1300 | 914 int npc_id_arr[6]; // [sp+34h] [bp-2Ch]@1 |
915 int uAnimationID; // [sp+50h] [bp-10h]@1 | |
916 | |
917 | |
918 uAnimationID = p2DEvents[house - 1].uAnimationID; | |
919 memset(npc_id_arr, 0, sizeof(npc_id_arr)); | |
920 uNumDialogueNPCPortraits = 0; | |
921 uHouse_ExitPic = p2DEvents[house - 1].uExitPicID; | |
922 if ( uHouse_ExitPic ) | |
923 { | |
924 uExitMapID = p2DEvents[house - 1]._quest_related; | |
925 if ( uExitMapID > 0 ) | |
926 { | |
927 if(_449B57_test_bit(pParty->_quest_bits,uExitMapID)) | |
928 { | |
929 uHouse_ExitPic = 0; | |
930 } | |
931 } | |
932 } | |
933 | |
934 dword_591080 = pAnimatedRooms[uAnimationID].house_npc_id; | |
935 HouseNPCData[0]=0; | |
936 uNumDialogueNPCPortraits = 0; | |
937 if ( dword_591080 ) | |
938 { | |
939 | |
940 npc_id_arr[0] = dword_591080; | |
941 uNumDialogueNPCPortraits = 1; | |
942 } | |
943 | |
944 for (uint i = 1; i < pNPCStats->uNumNewNPCs; ++i) | |
945 { | |
946 if (pNPCStats->pNewNPCData[i].Location2D == house ) | |
947 { | |
948 if (!(pNPCStats->pNewNPCData[i].uFlags & 0x80)) | |
949 { | |
1313 | 950 HouseNPCData[uNumDialogueNPCPortraits+1-((dword_591080 != 0) ? 1 : 0) ] = &pNPCStats->pNewNPCData[i]; |
1300 | 951 npc_id_arr[uNumDialogueNPCPortraits] = pNPCStats->pNewNPCData[i].uPortraitID; |
952 ++uNumDialogueNPCPortraits; | |
953 if ((pNPCStats->pNewNPCData[i].uFlags & 3) != 2) | |
954 ++pNPCStats->pNewNPCData[i].uFlags; | |
955 } | |
956 } | |
957 | |
958 } | |
959 | |
2335 | 960 for (int i = 0; i < uNumDialogueNPCPortraits; ++i) |
1300 | 961 { |
962 | |
963 char icon_name[128]; | |
964 sprintfex(icon_name, "npc%03u", npc_id_arr[i]); | |
965 pDialogueNPCPortraits[i] = pIcons_LOD->LoadTexturePtr(icon_name, TEXTURE_16BIT_PALETTE); | |
966 } | |
967 | |
968 if (uHouse_ExitPic) | |
969 { | |
970 pDialogueNPCPortraits[uNumDialogueNPCPortraits] = pIcons_LOD->LoadTexturePtr(pHouse_ExitPictures[uHouse_ExitPic], TEXTURE_16BIT_PALETTE); | |
971 ++uNumDialogueNPCPortraits; | |
972 uHouse_ExitPic = p2DEvents[house - 1].uExitMapID; | |
973 } | |
974 } | |
1298 | 975 //----- (004B1E92) -------------------------------------------------------- |
976 void PlayHouseSound(unsigned int uHouseID, HouseSoundID sound) | |
977 { | |
1407 | 978 if ( pAnimatedRooms[p2DEvents[uHouseID].uAnimationID].uRoomSoundId ) |
979 pAudioPlayer->PlaySound((SoundID)(sound + 100 * (pAnimatedRooms[p2DEvents[uHouseID].uAnimationID].uRoomSoundId + 300)), | |
1298 | 980 806, 0, -1, 0, 0, 0, 0); |
981 } | |
982 | |
983 //----- (004BCACC) -------------------------------------------------------- | |
984 void __fastcall OnSelectShopDialogueOption(signed int uMessageParam) | |
985 { | |
1526 | 986 int experience_for_next_level; // eax@5 |
1298 | 987 int v16; // eax@32 |
988 __int16 v24; // ax@163 | |
989 signed int v36; // esi@227 | |
1739 | 990 int pPrice; // ecx@227 |
1298 | 991 |
992 if ( !pDialogueWindow->pNumPresenceButton ) | |
993 return; | |
994 pRenderer->ClearZBuffer(0, 479); | |
995 if (dialog_menu_id == HOUSE_DIALOGUE_MAIN) | |
996 { | |
1529 | 997 if ( in_current_building_type == BuildingType_Training ) |
998 { | |
999 if ( uMessageParam == HOUSE_DIALOGUE_TRAININGHALL_TRAIN ) | |
1000 { | |
1001 experience_for_next_level = 0; | |
1002 if ( pPlayers[uActiveCharacter]->uLevel > 0 ) | |
1003 { | |
1004 for( uint i = 0; i < pPlayers[uActiveCharacter]->uLevel; i++ ) | |
1005 experience_for_next_level += i + 1; | |
1006 } | |
1007 if (pPlayers[uActiveCharacter]->uLevel < pMaxLevelPerTrainingHallType[(unsigned int)window_SpeakInHouse->ptr_1C - 89] && | |
1008 (signed __int64)pPlayers[uActiveCharacter]->uExperience < 1000 * experience_for_next_level)//test experience | |
1009 return; | |
1010 } | |
1011 pDialogueWindow->Release(); | |
2215
e9625ad08541
fog fix and change 640,480 - window->GetWidth(), window->GetHeight()
Ritor1
parents:
2214
diff
changeset
|
1012 pDialogueWindow = GUIWindow::Create(0, 0, window->GetWidth(), 345, WINDOW_MainMenu, 0, 0); |
1529 | 1013 pBtn_ExitCancel = pDialogueWindow->CreateButton(526, 445, 75, 33, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[74],// "End Conversation" |
1014 pIcons_LOD->GetTexture(uTextureID_BUTTDESC2), 0); | |
1015 pDialogueWindow->CreateButton(8, 8, 450, 320, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", nullptr); | |
1016 } | |
1017 if ( in_current_building_type != BuildingType_Training ) | |
1018 { | |
1019 if ((in_current_building_type == BuildingType_Stables || in_current_building_type == BuildingType_Boats) && | |
1020 transport_schedule[transport_routes[(unsigned int)window_SpeakInHouse->ptr_1C - HOUSE_STABLES_HARMONDALE][uMessageParam - HOUSE_DIALOGUE_TRANSPORT_SCHEDULE_1]].pSchedule[pParty->uDaysPlayed % 7] | |
1021 || in_current_building_type != BuildingType_Temple || uMessageParam != BuildingType_MindGuild ) | |
1022 { | |
1023 pDialogueWindow->Release(); | |
2215
e9625ad08541
fog fix and change 640,480 - window->GetWidth(), window->GetHeight()
Ritor1
parents:
2214
diff
changeset
|
1024 pDialogueWindow = GUIWindow::Create(0, 0, window->GetWidth(), 345, WINDOW_MainMenu, 0, 0); |
1529 | 1025 pBtn_ExitCancel = pDialogueWindow->CreateButton(526, 445, 75, 33, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[74],// "End Conversation" |
1026 pIcons_LOD->GetTexture(uTextureID_BUTTDESC2), 0); | |
1027 pDialogueWindow->CreateButton(8, 8, 450, 320, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", nullptr); | |
1028 } | |
1029 else if (uActiveCharacter) | |
1030 { | |
1031 if ( !pPlayers[uActiveCharacter]->IsPlayerHealableByTemple() ) | |
1032 return; | |
1033 } | |
1034 } | |
1035 dialog_menu_id = (HOUSE_DIALOGUE_MENU)uMessageParam; | |
1036 if ( in_current_building_type < BuildingType_19 ) | |
1037 ShopTexture = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(off_4F03B8[(int)in_current_building_type], TEXTURE_16BIT_PALETTE)]; | |
1298 | 1038 } |
1039 | |
1040 //NEW | |
1411 | 1041 switch (in_current_building_type) |
1298 | 1042 { |
1411 | 1043 case BuildingType_FireGuild: |
1044 case BuildingType_AirGuild: | |
1045 case BuildingType_WaterGuild: | |
1046 case BuildingType_EarthGuild: | |
1047 case BuildingType_SpiritGuild: | |
1048 case BuildingType_MindGuild: | |
1049 case BuildingType_BodyGuild: | |
1050 case BuildingType_LightGuild: | |
1051 case BuildingType_DarkGuild: | |
1644 | 1052 case BuildingType_ElementalGuild: |
1053 case BuildingType_SelfGuild: | |
1411 | 1054 case BuildingType_16: |
1298 | 1055 { |
1920 | 1056 if ( pParty->PartyTimes.Shops_next_generation_time[window_SpeakInHouse->par1C - 139] >= (signed __int64)pParty->uTimePlayed ) |
1298 | 1057 { |
1526 | 1058 for ( uint i = 0; i < 12; ++i ) |
1298 | 1059 { |
1739 | 1060 if ( pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C - 139][i].uItemID ) |
1061 ItemsInShopTexture[i] = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C - 139][i].GetIconName(), TEXTURE_16BIT_PALETTE)]; | |
1298 | 1062 } |
1063 } | |
1529 | 1064 else//generation new books |
1298 | 1065 { |
1066 SpellBookGenerator(); | |
1920 | 1067 pParty->PartyTimes.Shops_next_generation_time[window_SpeakInHouse->par1C - 139] = pParty->uTimePlayed + (signed __int64)((double)(0xA8C000 |
1298 | 1068 * (signed int)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].field_1C) * 0.033333335); |
1069 } | |
1070 break; | |
1071 } | |
1411 | 1072 case BuildingType_TownHall: |
1298 | 1073 { |
1529 | 1074 if ( uMessageParam == HOUSE_DIALOGUE_TOWNHALL_MESSAGE ) |
1298 | 1075 { |
1748 | 1076 if ( pParty->PartyTimes.bountyHunting_next_generation_time[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] < (signed __int64)pParty->uTimePlayed )//new generation |
1298 | 1077 { |
1739 | 1078 pParty->monster_for_hunting_killed[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] = false; |
1748 | 1079 pParty->PartyTimes.bountyHunting_next_generation_time[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] = (signed __int64)((double)(309657600 * (pParty->uCurrentMonth + 12i64 * pParty->uCurrentYear - 14015)) * 0.033333335); |
1739 | 1080 pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] = rand() % 258 + 1; |
1529 | 1081 v16 = (int)((char *)window_SpeakInHouse->ptr_1C - 102); |
1082 if ( !v16 ) | |
1083 { | |
1084 while ( 1 ) | |
1085 { | |
1739 | 1086 v24 = pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)]; |
1529 | 1087 if ( (unsigned __int16)v24 < 115 || (unsigned __int16)v24 > 132 ) |
1088 { | |
1089 if ( ((unsigned __int16)v24 < 235 || (unsigned __int16)v24 > 252) | |
1090 && ((unsigned __int16)v24 < 133 || (unsigned __int16)v24 > 150) | |
1091 && ((unsigned __int16)v24 < 0x97u || (unsigned __int16)v24 > 0xBAu) | |
1092 && ((unsigned __int16)v24 < 0xBEu || (unsigned __int16)v24 > 0xC0u) | |
1093 && ((unsigned __int16)v24 < 0xC4u || (unsigned __int16)v24 > 0xC6u) | |
1094 && ((unsigned __int16)v24 < 0x2Bu || (unsigned __int16)v24 > 0x2Du) | |
1095 && ((unsigned __int16)v24 < 0xCDu || (unsigned __int16)v24 > 0xCFu) | |
1096 && ((unsigned __int16)v24 < 0x5Eu || (unsigned __int16)v24 > 0x60u) | |
1097 && ((unsigned __int16)v24 < 0xFDu || (unsigned __int16)v24 > 0xFFu) | |
1098 && ((unsigned __int16)v24 < 0x6Du || (unsigned __int16)v24 > 0x6Fu) | |
1099 && ((unsigned __int16)v24 < 0x61u || (unsigned __int16)v24 > 0x63u) ) | |
1100 break; | |
1101 } | |
1739 | 1102 pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] = rand() % 258 + 1; |
1529 | 1103 } |
1104 } | |
1105 if ( v16 == 1 ) | |
1106 { | |
1107 while ( 1 ) | |
1108 { | |
1739 | 1109 v24 = pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)]; |
1110 if ( (unsigned __int16)v24 < 115 || (unsigned __int16)v24 > 132 ) | |
1529 | 1111 { |
1739 | 1112 if ( ((unsigned __int16)v24 < 0xE8u || (unsigned __int16)v24 > 0xF9u) |
1113 && ((unsigned __int16)v24 < 0x85u || (unsigned __int16)v24 > 0x96u) | |
1114 && ((unsigned __int16)v24 < 0x97u || (unsigned __int16)v24 > 0xBAu) | |
1115 && ((unsigned __int16)v24 < 0xBEu || (unsigned __int16)v24 > 0xC0u) | |
1116 && ((unsigned __int16)v24 < 0xC4u || (unsigned __int16)v24 > 0xC6u) | |
1117 && ((unsigned __int16)v24 < 0x2Bu || (unsigned __int16)v24 > 0x2Du) | |
1118 && ((unsigned __int16)v24 < 0x52u || (unsigned __int16)v24 > 0x54u) | |
1119 && ((unsigned __int16)v24 < 4 || (unsigned __int16)v24 > 6) | |
1120 && ((unsigned __int16)v24 < 0x37u || (unsigned __int16)v24 > 0x39u) | |
1121 && ((unsigned __int16)v24 < 0x3Au || (unsigned __int16)v24 > 0x3Cu) | |
1122 && ((unsigned __int16)v24 < 0x3Du || (unsigned __int16)v24 > 0x3Fu) | |
1123 && ((unsigned __int16)v24 < 0xFDu || (unsigned __int16)v24 > 0xFFu) | |
1124 && ((unsigned __int16)v24 < 0x61u || (unsigned __int16)v24 > 0x63u) | |
1125 && ((unsigned __int16)v24 < 0xCDu || (unsigned __int16)v24 > 0xCFu) ) | |
1529 | 1126 break; |
1127 } | |
1739 | 1128 pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] = rand() % 258 + 1; |
1529 | 1129 } |
1130 } | |
1131 if ( v16 == 2 ) | |
1132 { | |
1133 while ( 1 ) | |
1134 { | |
1739 | 1135 v24 = pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)]; |
1136 if ( (unsigned __int16)v24 < 0x73u || (unsigned __int16)v24 > 0x84u ) | |
1529 | 1137 { |
1739 | 1138 if ( ((unsigned __int16)v24 < 0xE8u || (unsigned __int16)v24 > 0xF9u) |
1139 && ((unsigned __int16)v24 < 0x85u || (unsigned __int16)v24 > 0x96u) | |
1140 && ((unsigned __int16)v24 < 0x97u || (unsigned __int16)v24 > 0xBAu) | |
1141 && ((unsigned __int16)v24 < 0xBEu || (unsigned __int16)v24 > 0xC0u) | |
1142 && ((unsigned __int16)v24 < 0xC4u || (unsigned __int16)v24 > 0xC6u) | |
1143 && ((unsigned __int16)v24 < 0x2Bu || (unsigned __int16)v24 > 0x2Du) | |
1144 && ((unsigned __int16)v24 < 0x31u || (unsigned __int16)v24 > 0x33u) | |
1145 && ((unsigned __int16)v24 < 0x34u || (unsigned __int16)v24 > 0x36u) | |
1146 && ((unsigned __int16)v24 < 0xFDu || (unsigned __int16)v24 > 0xFFu) | |
1147 && ((unsigned __int16)v24 < 0x61u || (unsigned __int16)v24 > 0x63u) | |
1148 && ((unsigned __int16)v24 < 0x1Cu || (unsigned __int16)v24 > 0x1Eu) ) | |
1529 | 1149 break; |
1150 } | |
1739 | 1151 pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] = rand() % 258 + 1; |
1529 | 1152 } |
1153 } | |
1154 if ( v16 == 3 ) | |
1155 { | |
1156 while ( 1 ) | |
1157 { | |
1739 | 1158 v24 = pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)]; |
1159 if ( (unsigned __int16)v24 < 0x73u || (unsigned __int16)v24 > 0x84u ) | |
1529 | 1160 { |
1739 | 1161 if ( ((unsigned __int16)v24 < 0xE8u || (unsigned __int16)v24 > 0xF9u) |
1162 && ((unsigned __int16)v24 < 0x85u || (unsigned __int16)v24 > 0x96u) | |
1163 && ((unsigned __int16)v24 < 0x97u || (unsigned __int16)v24 > 0xBAu) | |
1164 && ((unsigned __int16)v24 < 0xBEu || (unsigned __int16)v24 > 0xC0u) | |
1165 && ((unsigned __int16)v24 < 0xC4u || (unsigned __int16)v24 > 0xC6u) | |
1166 && ((unsigned __int16)v24 < 0x2Bu || (unsigned __int16)v24 > 0x2Du) | |
1167 && ((unsigned __int16)v24 < 0x5Eu || (unsigned __int16)v24 > 0x60u) | |
1168 && ((unsigned __int16)v24 < 0x43u || (unsigned __int16)v24 > 0x45u) | |
1169 && ((unsigned __int16)v24 < 0x4Fu || (unsigned __int16)v24 > 0x51u) | |
1170 && ((unsigned __int16)v24 < 0xC1u || (unsigned __int16)v24 > 0xC3u) | |
1171 && ((unsigned __int16)v24 < 0x13u || (unsigned __int16)v24 > 0x15u) | |
1172 && ((unsigned __int16)v24 < 0xFDu || (unsigned __int16)v24 > 0xFFu) | |
1173 && ((unsigned __int16)v24 < 0x61u || (unsigned __int16)v24 > 0x63u) | |
1174 && ((unsigned __int16)v24 < 0x6Au || (unsigned __int16)v24 > 0x6Cu) ) | |
1529 | 1175 break; |
1176 } | |
1739 | 1177 pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] = rand() % 258 + 1; |
1529 | 1178 } |
1179 } | |
1180 if ( v16 == 4 ) | |
1181 { | |
1182 while ( 1 ) | |
1183 { | |
1739 | 1184 v24 = pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)]; |
1185 if ( (unsigned __int16)v24 < 0x73u || (unsigned __int16)v24 > 0x84u ) | |
1529 | 1186 { |
1739 | 1187 if ( ((unsigned __int16)v24 < 0xE8u || (unsigned __int16)v24 > 0xF9u) |
1188 && ((unsigned __int16)v24 < 0x85u || (unsigned __int16)v24 > 0x96u) | |
1189 && ((unsigned __int16)v24 < 0x97u || (unsigned __int16)v24 > 0xBAu) | |
1190 && ((unsigned __int16)v24 < 0xBEu || (unsigned __int16)v24 > 0xC0u) | |
1191 && ((unsigned __int16)v24 < 0xC4u || (unsigned __int16)v24 > 0xC6u) | |
1192 && ((unsigned __int16)v24 < 0x2Bu || (unsigned __int16)v24 > 0x2Du) | |
1193 && ((unsigned __int16)v24 < 0x6Du || (unsigned __int16)v24 > 0x6Fu) | |
1194 && ((unsigned __int16)v24 < 0x46u || (unsigned __int16)v24 > 0x48u) | |
1195 && ((unsigned __int16)v24 < 0x100u || (unsigned __int16)v24 > 0x102u) | |
1196 && ((unsigned __int16)v24 < 0xD9u || (unsigned __int16)v24 > 0xDBu) | |
1197 && ((unsigned __int16)v24 < 0xC7u || (unsigned __int16)v24 > 0xC9u) | |
1198 && ((unsigned __int16)v24 < 0xE5u || (unsigned __int16)v24 > 0xE7u) | |
1199 && ((unsigned __int16)v24 < 0xDFu || (unsigned __int16)v24 > 0xE1u) | |
1200 && ((unsigned __int16)v24 < 0x5Bu || (unsigned __int16)v24 > 0x5Du) | |
1201 && ((unsigned __int16)v24 < 0x49u || (unsigned __int16)v24 > 0x4Bu) | |
1202 && ((unsigned __int16)v24 < 0xFDu || (unsigned __int16)v24 > 0xFFu) | |
1203 && ((unsigned __int16)v24 < 0x61u || (unsigned __int16)v24 > 0x63u) | |
1204 && ((unsigned __int16)v24 < 0x10u || (unsigned __int16)v24 > 0x12u) ) | |
1529 | 1205 break; |
1206 } | |
1739 | 1207 pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] = rand() % 258 + 1; |
1529 | 1208 } |
1209 } | |
1210 } | |
1739 | 1211 bountyHunting_monster_id_for_hunting = pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)]; |
1212 if ( !pParty->monster_for_hunting_killed[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] ) | |
1529 | 1213 { |
1214 bountyHunting_text = pNPCTopics[351].pText;//"В этом месяцу назначена награда за голову %s..." | |
1739 | 1215 if ( !pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] ) |
1529 | 1216 bountyHunting_text = pNPCTopics[353].pText;//"Кое кто уже приходил в этом месяце за наградой" |
1298 | 1217 } |
1218 else | |
1219 { | |
1739 | 1220 if ( pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] > 0 )//get prize |
1298 | 1221 { |
1828
35c1e4ff6ba7
party_finds_gold to Party::PartyFindsGold, cleaned up, moved Level/Decoration.h reference out of Indoor.h
Grumpy7
parents:
1754
diff
changeset
|
1222 pParty->PartyFindsGold(100 * pMonsterStats->pInfos[(unsigned __int16)pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)]].uLevel, 0); |
1529 | 1223 for ( uint i = 0; i < 4; ++i ) |
1224 pParty->pPlayers[i].SetVariable(VAR_Award, 86); | |
1739 | 1225 pParty->uNumBountiesCollected += 100 * pMonsterStats->pInfos[pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)]].uLevel; |
1226 pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] = 0; | |
1227 pParty->monster_for_hunting_killed[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] = false; | |
1529 | 1228 } |
1229 bountyHunting_text = pNPCTopics[352].pText;//"Поздравляю! Вы успешно..." | |
1230 } | |
1231 } | |
1232 else if ( uMessageParam == HOUSE_DIALOGUE_TOWNHALL_PAY_FINE ) | |
1739 | 1233 pKeyActionMap->EnterText(1, 10, window_SpeakInHouse); |
1529 | 1234 break; |
1235 } | |
1411 | 1236 case BuildingType_Bank: |
1298 | 1237 { |
1238 if ( dialog_menu_id >= 7 && dialog_menu_id <= 8 ) | |
1739 | 1239 pKeyActionMap->EnterText(1, 10, window_SpeakInHouse); |
1298 | 1240 return; |
1241 break; | |
1242 } | |
1411 | 1243 case BuildingType_WeaponShop: |
1244 case BuildingType_ArmorShop: | |
1245 case BuildingType_MagicShop: | |
1246 case BuildingType_AlchemistShop: | |
1247 case BuildingType_Tavern: | |
1248 case BuildingType_Temple: | |
1249 case BuildingType_Training: | |
1298 | 1250 { |
1251 break; | |
1252 } | |
1253 default: | |
1254 { | |
1255 return; | |
1256 break; | |
1257 } | |
1258 } | |
1259 | |
1260 switch ( uMessageParam ) | |
1261 { | |
1262 case HOUSE_DIALOGUE_LEARN_SKILLS: | |
1263 { | |
1264 pDialogueWindow->eWindowType = WINDOW_MainMenu; | |
1265 UI_CreateEndConversationButton(); | |
1266 FillAviableSkillsToTeach(in_current_building_type); | |
1267 break; | |
1268 } | |
1269 case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_MAIN: | |
1270 { | |
1271 pDialogueWindow->eWindowType = WINDOW_MainMenu; | |
1272 UI_CreateEndConversationButton(); | |
1411 | 1273 InitializaDialogueOptions_Tavern(in_current_building_type); |
1298 | 1274 break; |
1275 } | |
1276 case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_RULES: | |
1277 case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_VICTORY_CONDITIONS: | |
1278 { | |
1279 dialog_menu_id = (HOUSE_DIALOGUE_MENU)uMessageParam; | |
1280 break; | |
1281 } | |
1282 case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_RESULT: | |
1283 { | |
1284 pMessageQueue_50CBD0->AddMessage(UIMSG_PlayArcomage, 0, 0); | |
1285 dialog_menu_id = HOUSE_DIALOGUE_TAVERN_ARCOMAGE_RESULT; | |
1286 break; | |
1287 } | |
1288 case HOUSE_DIALOGUE_SHOP_BUY_STANDARD: | |
1289 case HOUSE_DIALOGUE_SHOP_BUY_SPECIAL: | |
1290 { | |
1748 | 1291 if ( pParty->PartyTimes.Shops_next_generation_time[(unsigned int)window_SpeakInHouse->ptr_1C] < (signed __int64)pParty->uTimePlayed ) |
1298 | 1292 { |
1293 GenerateStandartShopItems(); | |
1294 GenerateSpecialShopItems(); | |
1747
cecb080929c4
Party_stru0 renamed to PartyTimeStruct, fixed its members, renamed Party::field_3C to Party::PartyTimes, started Player::SetVariable refactoring start
Grumpy7
parents:
1709
diff
changeset
|
1295 pParty->PartyTimes.Shops_next_generation_time[window_SpeakInHouse->par1C] = pParty->uTimePlayed + (signed __int64)((double)(11059200 * (signed int)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].field_1C) * 0.033333335); |
1298 | 1296 } |
1297 if ( uMessageParam == HOUSE_DIALOGUE_SHOP_BUY_STANDARD ) | |
1298 { | |
1299 if ( uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType] ) | |
1300 { | |
1739 | 1301 for ( uint i = 0; i < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType]; ++i ) |
1298 | 1302 { |
1739 | 1303 if ( pParty->StandartItemsInShops[(int)window_SpeakInHouse->ptr_1C][i].uItemID ) |
1304 ItemsInShopTexture[i] = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(pParty->StandartItemsInShops[(int)window_SpeakInHouse->ptr_1C][i].GetIconName(), TEXTURE_16BIT_PALETTE)]; | |
1298 | 1305 } |
1306 } | |
1411 | 1307 if ( in_current_building_type == BuildingType_WeaponShop ) |
1298 | 1308 { |
1309 if ( uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType] ) | |
1310 { | |
1739 | 1311 for ( uint i = 0; i < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType]; ++i ) |
1298 | 1312 { |
1739 | 1313 if ( pParty->StandartItemsInShops[(int)window_SpeakInHouse->ptr_1C][i].uItemID) |
1314 weapons_Ypos[i] = rand() % (300 - ItemsInShopTexture[i]->uTextureHeight); | |
1298 | 1315 } |
1316 } | |
1317 } | |
1739 | 1318 } |
1319 if ( uMessageParam == HOUSE_DIALOGUE_SHOP_BUY_SPECIAL ) | |
1320 { | |
1321 if ( uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType] ) | |
1322 { | |
1323 for ( uint i = 0; i < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType]; ++i ) | |
1324 { | |
1325 if ( pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].uItemID ) | |
1326 ItemsInShopTexture[i] = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].GetIconName(), TEXTURE_16BIT_PALETTE)]; | |
1327 } | |
1328 } | |
1329 if ( in_current_building_type == BuildingType_WeaponShop ) | |
1298 | 1330 { |
1331 if ( uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType] ) | |
1332 { | |
1739 | 1333 for ( uint i = 0; i < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType]; ++i ) |
1298 | 1334 { |
1739 | 1335 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].uItemID) |
1336 weapons_Ypos[i] = rand() % (300 - ItemsInShopTexture[i]->uTextureHeight); | |
1298 | 1337 } |
1338 } | |
1339 } | |
1739 | 1340 } |
1341 break; | |
1298 | 1342 } |
1343 case HOUSE_DIALOGUE_SHOP_SELL: | |
1344 case HOUSE_DIALOGUE_SHOP_IDENTIFY: | |
1345 case HOUSE_DIALOGUE_SHOP_REPAIR: | |
1346 { | |
1347 dialog_menu_id = (HOUSE_DIALOGUE_MENU)uMessageParam; | |
1829
e4e27261d84e
sub_421B2C_PlaceInInventory_or_DropPickedItem to Party::sub_421B2C_PlaceInInventory_or_DropPickedItem
Grumpy7
parents:
1828
diff
changeset
|
1348 pParty->sub_421B2C_PlaceInInventory_or_DropPickedItem(); |
1298 | 1349 break; |
1350 } | |
1351 case HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT: | |
1352 { | |
1353 pDialogueWindow->eWindowType = WINDOW_MainMenu; | |
1354 UI_CreateEndConversationButton(); | |
1411 | 1355 InitializaDialogueOptions_Shops(in_current_building_type); |
1298 | 1356 break; |
1357 } | |
1358 default: | |
1359 { | |
1360 if( uMessageParam >= HOUSE_DIALOGUE_36 && uMessageParam <= HOUSE_DIALOGUE_GUILD_LEARN_SKILL ) | |
1361 { | |
1739 | 1362 v36 = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0); |
1363 pPrice = v36 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; | |
1364 if ( pPrice < v36 / 3 ) | |
1365 pPrice = v36 / 3; | |
1366 if(byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][uMessageParam - 36]) | |
1298 | 1367 { |
1368 if ( !pPlayers[uActiveCharacter]->pActiveSkills[uMessageParam - 36] ) | |
1369 { | |
1739 | 1370 if ( pParty->uNumGold < pPrice ) |
1298 | 1371 { |
1372 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2); | |
1411 | 1373 if ( in_current_building_type == BuildingType_Training || in_current_building_type == BuildingType_Tavern ) |
1739 | 1374 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_Goodbye); |
1298 | 1375 else |
1739 | 1376 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful); |
1298 | 1377 } |
1378 else | |
1379 { | |
1739 | 1380 Party::TakeGold(pPrice); |
1298 | 1381 dword_F8B1E4 = 1; |
1382 pPlayers[uActiveCharacter]->pActiveSkills[uMessageParam - 36] = 1; | |
1383 pPlayers[uActiveCharacter]->PlaySound(SPEECH_78, 0); | |
1384 } | |
1385 } | |
1386 } | |
1387 } | |
1388 break; | |
1389 } | |
1390 } | |
1391 } | |
1392 //----- (004B6943) -------------------------------------------------------- | |
1458 | 1393 void TravelByTransport() |
1298 | 1394 { |
1395 signed int v4; // ebx@1 | |
1589 | 1396 stru365_travel_info *pTravel; // esi@7 |
1298 | 1397 signed int v12; // esi@13 |
1398 signed int v13; // edi@14 | |
1399 DWORD v14; // eax@26 | |
1400 DWORD v15; // edi@26 | |
1589 | 1401 int pTextHeight; // eax@36 |
1402 int pRealTextHeight; // esi@36 | |
1403 int schedule_id; // esi@39 | |
1404 GUIButton *pButton; // ebx@39 | |
1298 | 1405 signed int v25; // eax@41 |
1589 | 1406 MapInfo pMap; // [sp-3Ch] [bp-2CCh]@62 |
1407 char pTopicArray[5][100]; // [sp+14h] [bp-27Ch]@37 | |
1408 GUIWindow travel_window; // [sp+208h] [bp-88h]@1 | |
1409 int pPrimaryTextHeight; // [sp+260h] [bp-30h]@36 | |
1410 int index; // [sp+27Ch] [bp-14h]@36 | |
1411 unsigned int pPrice; // [sp+288h] [bp-8h]@1 | |
1412 int travel_time; // [sp+28Ch] [bp-4h]@48 | |
1413 enum PlayerSpeech pSpeech; | |
1414 unsigned int pCurrentButton; | |
1298 | 1415 |
1589 | 1416 memcpy(&travel_window, window_SpeakInHouse, sizeof(travel_window)); |
1417 travel_window.uFrameX = 483; | |
1418 travel_window.uFrameWidth = 148; | |
1419 travel_window.uFrameZ = 334; | |
1298 | 1420 |
1587 | 1421 v4 = p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType == BuildingType_Stables ? 25 : 50; |
1422 v4 *= p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier; | |
1298 | 1423 |
1589 | 1424 pPrice = v4 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; |
1425 if ( (signed int)pPrice < v4 / 3 ) | |
1426 pPrice = v4 / 3; | |
1298 | 1427 if ( dialog_menu_id == HOUSE_DIALOGUE_MAIN) |
1428 { | |
1393 | 1429 if ( HouseUI_CheckIfPlayerCanInteract() ) |
1298 | 1430 { |
1589 | 1431 index = 0; |
1432 strcpy(pTopicArray[4], ""); | |
1433 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[405], pPrice); // Price: %lu gold | |
1434 pTextHeight = pFontArrus->CalcTextHeight(pTmpBuf2.data(), &travel_window, 0, 0); | |
1435 pRealTextHeight = pTextHeight + (LOBYTE(pFontArrus->uFontHeight) - 3) + 146; | |
1436 pPrimaryTextHeight = pRealTextHeight; | |
1437 pCurrentButton = 2; | |
1438 for ( uint i = pDialogueWindow->pStartingPosActiveItem; i < (unsigned int)(pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem); ++i ) | |
1298 | 1439 { |
1589 | 1440 schedule_id = transport_routes[(unsigned int)window_SpeakInHouse->ptr_1C - HOUSE_STABLES_HARMONDALE][index]; |
1441 pButton = pDialogueWindow->GetControl(i); | |
1298 | 1442 |
1589 | 1443 if (schedule_id != 255) |
1298 | 1444 { |
1610 | 1445 //if (schedule_id >= 25) |
1446 //Log::Warning(L"Transport UI: schedule overflow"); | |
1589 | 1447 if ( pCurrentButton >= 6 ) |
1298 | 1448 v25 = true; |
1449 else | |
1589 | 1450 v25 = transport_schedule[schedule_id].pSchedule[pParty->uDaysPlayed % 7]; |
1298 | 1451 } |
1452 | |
1589 | 1453 if (schedule_id != 255 && v25 && (!transport_schedule[schedule_id].uQuestBit |
1625 | 1454 || _449B57_test_bit(pParty->_quest_bits, transport_schedule[schedule_id].uQuestBit)) )//ошибка: рисуется несколько строчек одного направления путешествия |
1298 | 1455 { |
1610 | 1456 //get color for current string(определение цвета текущей строки)---------- |
1589 | 1457 if ( pDialogueWindow->pCurrentPosActiveItem == pCurrentButton ) |
2069 | 1458 sprintf(pTopicArray[index], "\f%05d", Color16(255, 255, 155)); |
1589 | 1459 else |
2069 | 1460 sprintf(pTopicArray[index], "\f%05d", Color16(255, 255, 255)); |
1589 | 1461 //hired NPC premium(премия наёмного НПС)---------------------------------- |
1462 travel_time = transport_schedule[schedule_id].uTravelTime; | |
1591 | 1463 if ( (unsigned int)window_SpeakInHouse->ptr_1C >= HOUSE_BOATS_EMERALD_ISLE ) |
1298 | 1464 { |
1465 if ( CheckHiredNPCSpeciality(Sailor) ) | |
1589 | 1466 travel_time -= 2; |
1298 | 1467 if ( CheckHiredNPCSpeciality(Navigator) ) |
1589 | 1468 travel_time -= 3; |
1298 | 1469 if ( CheckHiredNPCSpeciality(Pirate) ) |
1589 | 1470 travel_time -= 2; |
1298 | 1471 } |
1472 else | |
1473 { | |
1474 if ( CheckHiredNPCSpeciality(Horseman) ) | |
1589 | 1475 travel_time -= 2; |
1298 | 1476 } |
1477 if ( CheckHiredNPCSpeciality(Explorer) ) | |
1589 | 1478 --travel_time; |
1479 | |
1480 if ( travel_time < 1 ) | |
1481 travel_time = 1; | |
1482 if ( schedule_id != 255 ) | |
1298 | 1483 { |
1589 | 1484 memcpy(&pMap, &pMapStats->pInfos[transport_schedule[schedule_id].uMapInfoID], 0x44u); |
1485 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[404], travel_time, pMap.pName); // Time - %d days, destination %s | |
1486 strcat(pTopicArray[index], pTmpBuf.data()); | |
1487 strcat(pTopicArray[index], "\n \n"); | |
1488 pButton->uY = pRealTextHeight; | |
1489 pTextHeight = pFontArrus->CalcTextHeight(pTmpBuf.data(), &travel_window, 0, 0); | |
1490 pButton->uHeight = pTextHeight; | |
1625 | 1491 pButton->uW = pButton->uY + pTextHeight - 1; |
1589 | 1492 pRealTextHeight += (LOBYTE(pFontArrus->uFontHeight) - 3) + pTextHeight; |
1298 | 1493 } |
1494 } | |
1495 else | |
1496 { | |
1589 | 1497 strcpy(pTopicArray[index], ""); |
1498 if ( pButton ) | |
1298 | 1499 { |
1589 | 1500 pButton->uW = 0; |
1501 pButton->uHeight = 0; | |
1502 pButton->uY = 0; | |
1298 | 1503 } |
1504 } | |
1589 | 1505 ++index; |
1506 ++pCurrentButton; | |
1298 | 1507 } |
1589 | 1508 if ( pRealTextHeight != pPrimaryTextHeight ) |
1298 | 1509 { |
1589 | 1510 sprintf(pTmpBuf.data(), "%s\n \n%s%s%s%s%s", pTmpBuf2.data(), pTopicArray[0], pTopicArray[1], pTopicArray[2], pTopicArray[3], pTopicArray[4]); |
1511 travel_window.DrawTitleText(pFontArrus, 0, 146, 0, pTmpBuf.data(), 3); | |
1298 | 1512 } |
1513 else | |
1514 { | |
1589 | 1515 travel_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[561], &travel_window, 0, 0)) / 2 + 138,//"Извините, приходите в другой день" |
2069 | 1516 Color16(255, 255, 255), pGlobalTXT_LocalizationStrings[561], 3); |
1298 | 1517 pAudioPlayer->StopChannels(-1, -1); |
1518 } | |
1519 } | |
1520 } | |
1589 | 1521 else//после нажатия топика |
1298 | 1522 { |
1523 if ( dialog_menu_id >= HOUSE_DIALOGUE_TRANSPORT_SCHEDULE_1 && dialog_menu_id <= HOUSE_DIALOGUE_TRANSPORT_SCHEDULE_4 ) | |
1524 { | |
1589 | 1525 if ( pParty->uNumGold < pPrice ) |
1298 | 1526 { |
1589 | 1527 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);//"У вас не хватает золота" |
1298 | 1528 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_Greeting_2); |
1529 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
1530 return; | |
1531 } | |
1532 | |
1589 | 1533 Party::TakeGold(pPrice); |
1298 | 1534 |
1589 | 1535 pTravel = &transport_schedule[transport_routes[(unsigned int)window_SpeakInHouse->ptr_1C - HOUSE_STABLES_HARMONDALE][dialog_menu_id - HOUSE_DIALOGUE_TRANSPORT_SCHEDULE_1]]; |
1536 if ( pTravel->pSchedule[pParty->uDaysPlayed % 7] ) | |
1298 | 1537 { |
1589 | 1538 if ( _stricmp(pCurrentMapName, pMapStats->pInfos[pTravel->uMapInfoID].pFilename) ) |
1298 | 1539 { |
1540 SaveGame(1, 0); | |
1589 | 1541 strcpy(pCurrentMapName, pMapStats->pInfos[pTravel->uMapInfoID].pFilename); |
1298 | 1542 |
2061 | 1543 dword_6BE364_game_settings_1 |= GAME_SETTINGS_0001; |
1298 | 1544 _5B65B8_npcdata_hiword_house_or_other = 0; |
1545 dword_5B65BC = 0; | |
1589 | 1546 _5B65B4_npcdata_loword_house_or_other = pTravel->arrival_rot_y; |
2124 | 1547 uGameState = GAME_STATE_CHANGE_LOCATION; |
1589 | 1548 _5B65A8_npcdata_uflags_or_other = pTravel->arrival_x; |
1549 _5B65AC_npcdata_fame_or_other = pTravel->arrival_y; | |
1550 _5B65B0_npcdata_rep_or_other = pTravel->arrival_z; | |
1551 dword_5B65C0 = pTravel->arrival_x | pTravel->arrival_y | pTravel->arrival_z | pTravel->arrival_rot_y; | |
1298 | 1552 } |
1553 else | |
1554 { | |
1640
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1639
diff
changeset
|
1555 pGame->pIndoorCameraD3D->sRotationY = 0; |
1638
ccde94f02b75
class IndoorCamera split into BLVRenderParams and ODMRenderParams
Nomad
parents:
1630
diff
changeset
|
1556 |
1298 | 1557 pParty->uFlags |= 2u; |
1589 | 1558 pParty->vPosition.x = pTravel->arrival_x; |
1559 pParty->vPosition.y = pTravel->arrival_y; | |
1560 pParty->vPosition.z = pTravel->arrival_z; | |
1298 | 1561 pParty->uFallStartY = pParty->vPosition.z; |
1562 pParty->sRotationX = 0; | |
1589 | 1563 pParty->sRotationY = pTravel->arrival_rot_y; |
1298 | 1564 } |
1565 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful); | |
1589 | 1566 v12 = pTravel->uTravelTime; |
1298 | 1567 if ( (signed int)window_SpeakInHouse->ptr_1C >= 63 ) |
1568 { | |
1589 | 1569 pSpeech = SPEECH_SetSail; |
1298 | 1570 v13 = 2500; |
1571 if ( CheckHiredNPCSpeciality(Sailor) ) | |
1572 v12 -= 2; | |
1573 if ( CheckHiredNPCSpeciality(Navigator) ) | |
1574 v12 -= 3; | |
1575 if ( CheckHiredNPCSpeciality(Pirate) ) | |
1576 v12 -= 2; | |
1577 } | |
1578 else | |
1579 { | |
1589 | 1580 pSpeech = SPEECH_CarriageReady; |
1298 | 1581 v13 = 1500; |
1582 if ( CheckHiredNPCSpeciality(Horseman) ) | |
1583 v12 -= 2; | |
1584 } | |
1585 if ( CheckHiredNPCSpeciality(Explorer) ) | |
1586 --v12; | |
1587 if ( v12 < 1 ) | |
1588 v12 = 1; | |
1589 RestAndHeal(1440 * v12); | |
1589 | 1590 pPlayers[uActiveCharacter]->PlaySound(pSpeech, 0); |
1298 | 1591 v14 = GetTickCount(); |
1592 v15 = v14 + v13; | |
1593 if ( v15 < v14 ) | |
1594 v15 = v14; | |
1595 while ( GetTickCount() < v15 ) | |
1596 sqrt(3.1415926); | |
1919 | 1597 while ( HouseDialogPressCloseBtn() ) |
1298 | 1598 ; |
1599 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
1600 return; | |
1601 } | |
1602 else | |
1603 { | |
1604 dialog_menu_id = HOUSE_DIALOGUE_MAIN; | |
1754 | 1605 pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0); |
1298 | 1606 } |
1607 } | |
1608 } | |
1609 } | |
1610 //----- (004B68EA) -------------------------------------------------------- | |
1611 bool __fastcall IsTravelAvailable(int a1) | |
1612 { | |
1587 | 1613 for ( uint i = 0; i < 4; ++i ) |
1298 | 1614 { |
1587 | 1615 if ( transport_schedule[transport_routes[a1][i]].pSchedule[pParty->uDaysPlayed % 7] ) |
1298 | 1616 { |
1587 | 1617 if (!transport_schedule[transport_routes[a1][i]].uQuestBit || _449B57_test_bit(pParty->_quest_bits, transport_schedule[transport_routes[a1][i]].uQuestBit)) |
1298 | 1618 return true; |
1619 } | |
1620 } | |
1621 return false; | |
1622 } | |
1623 | |
1624 //----- (004B7911) -------------------------------------------------------- | |
1458 | 1625 void TownHallDialog() |
1298 | 1626 { |
1627 int v1; // eax@10 | |
1628 int v2; // esi@10 | |
1529 | 1629 signed int pStringSum; // ebx@24 |
1298 | 1630 signed int v16; // ebx@28 |
1631 int v17; // ebx@28 | |
1529 | 1632 GUIButton *pButton; // eax@30 |
1633 int pTextHeight; // eax@30 | |
1634 unsigned __int16 pTextColor; // ax@30 | |
1635 GUIWindow window; // [sp+60h] [bp-BCh]@21 | |
1636 GUIWindow townHall_window; // [sp+B4h] [bp-68h]@1 | |
1298 | 1637 int v29; // [sp+10Ch] [bp-10h]@28 |
1638 int v31; // [sp+114h] [bp-8h]@29 | |
1639 GUIFont *pOutString; // [sp+118h] [bp-4h]@21 | |
1640 | |
1529 | 1641 memcpy(&townHall_window, window_SpeakInHouse, sizeof(townHall_window)); |
1642 townHall_window.uFrameX = 483; | |
1643 townHall_window.uFrameWidth = 148; | |
1644 townHall_window.uFrameZ = 334; | |
1645 sprintf(pTmpBuf.data(), "%s: %d", pGlobalTXT_LocalizationStrings[605], pParty->uFine);//Текущий штраф | |
2069 | 1646 townHall_window.DrawTitleText(pFontArrus, 0, 260, Color16(0xFFu, 0xFFu, 0x9Bu), pTmpBuf.data(), 3); |
1298 | 1647 switch(dialog_menu_id) |
1648 { | |
1529 | 1649 case HOUSE_DIALOGUE_MAIN: |
1650 { | |
1651 pStringSum = 1; | |
1652 pTextHeight = 0; | |
1843
2e6d3cd052e0
some char* cast removal + adding const_casts where appropriate
Grumpy7
parents:
1838
diff
changeset
|
1653 pShopOptions[0] = const_cast<char *>(pGlobalTXT_LocalizationStrings[604]);//Охота за вознаграждение |
1529 | 1654 if ( pParty->uFine > 0 ) |
1655 { | |
1843
2e6d3cd052e0
some char* cast removal + adding const_casts where appropriate
Grumpy7
parents:
1838
diff
changeset
|
1656 pShopOptions[1] = const_cast<char *>(pGlobalTXT_LocalizationStrings[603]);//Заплатить штраф |
1529 | 1657 pStringSum = 2; |
1658 } | |
1659 for ( uint i = 0; i < pStringSum; ++i ) | |
1660 pTextHeight += pFontArrus->CalcTextHeight(pShopOptions[i], &townHall_window, 0, 0); | |
1661 v29 = (100 - pTextHeight) / pStringSum; | |
1662 v16 = 80 - pStringSum * ((100 - pTextHeight) / pStringSum); | |
1663 v17 = (v16 / 2) - v29 / 2 + 158; | |
1664 if ( pDialogueWindow->pNumPresenceButton > 0 ) | |
1665 { | |
1666 v31 = 2; | |
1667 uint j = 0; | |
1668 for ( uint i = pDialogueWindow->pStartingPosActiveItem; | |
1669 i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) | |
1670 { | |
1671 pButton = pDialogueWindow->GetControl(i); | |
1672 pButton->uY = v29 + v17; | |
1673 pTextHeight = pFontArrus->CalcTextHeight(pShopOptions[j], &townHall_window, 0, 0); | |
1674 pButton->uHeight = pTextHeight; | |
1625 | 1675 v17 = pButton->uY + pTextHeight - 1; |
1529 | 1676 pButton->uW = v17; |
2069 | 1677 pTextColor = Color16(0xFFu, 0xFFu, 0x9Bu); |
1529 | 1678 if ( pDialogueWindow->pCurrentPosActiveItem != v31 ) |
2069 | 1679 pTextColor = Color16(0xFFu, 0xFFu, 0xFFu); |
1625 | 1680 townHall_window.DrawTitleText(pFontArrus, 0, pButton->uY, pTextColor, pShopOptions[j], 3); |
1529 | 1681 ++v31; |
1682 ++j; | |
1683 } | |
1684 } | |
1685 break; | |
1686 } | |
1687 case HOUSE_DIALOGUE_TOWNHALL_MESSAGE: | |
1688 { | |
2069 | 1689 sprintf(pTmpBuf.data(), "\f%05d%s\f%05d", Color16(0xFFu, 0xFFu, 0x9Bu), |
1690 pMonsterStats->pInfos[bountyHunting_monster_id_for_hunting].pName, Color16(0xFFu, 0xFFu, 0xFFu)); | |
1529 | 1691 sprintf(pTmpBuf2.data(), bountyHunting_text, pTmpBuf.data(), 100 * pMonsterStats->pInfos[bountyHunting_monster_id_for_hunting].uLevel); |
1692 current_npc_text = pTmpBuf2.data(); | |
1693 memcpy(&window, pDialogueWindow, sizeof(window)); | |
1694 window.uFrameWidth = 458; | |
1695 window.uFrameZ = 457; | |
1696 pOutString = pFontArrus; | |
1697 pTextHeight = pFontArrus->CalcTextHeight(pTmpBuf2.data(), &window, 13, 0) + 7; | |
1698 if ( 352 - pTextHeight < 8 ) | |
1699 { | |
1700 pOutString = pFontCreate; | |
1701 pTextHeight = pFontCreate->CalcTextHeight(current_npc_text, &window, 13, 0) + 7; | |
1702 } | |
1703 pRenderer->GetLeather(8, 352 - pTextHeight, pIcons_LOD->GetTexture(uTextureID_Leather), pIcons_LOD->GetTexture(uTextureID_Leather)->uTextureHeight - pTextHeight); | |
1704 pRenderer->DrawTextureIndexed(8, 347 - pTextHeight, pTexture_591428); | |
1705 window.DrawText(pOutString, 13, 354 - pTextHeight, 0, FitTextInAWindow(current_npc_text, pOutString, &window, 13, 0), 0, 0, 0); | |
1706 break; | |
1707 } | |
1708 case HOUSE_DIALOGUE_TOWNHALL_PAY_FINE: | |
1709 { | |
1710 if ( window_SpeakInHouse->receives_keyboard_input_2 == WINDOW_INPUT_IN_PROGRESS) | |
1711 { | |
1712 sprintfex(pTmpBuf.data(), "%s\n%s", pGlobalTXT_LocalizationStrings[606], pGlobalTXT_LocalizationStrings[112]); // "Pay" "How Much?" | |
2069 | 1713 townHall_window.DrawTitleText(pFontArrus, 0, 146, Color16(0xFFu, 0xFFu, 0x9Bu), pTmpBuf.data(), 3); |
1714 townHall_window.DrawTitleText(pFontArrus, 0, 186, Color16(0xFFu, 0xFFu, 0xFFu), (const char *)pKeyActionMap->pPressedKeysBuffer, 3); | |
1529 | 1715 townHall_window.DrawFlashingInputCursor(pFontArrus->GetLineWidth((const char *)pKeyActionMap->pPressedKeysBuffer) / 2 + 80, 185, pFontArrus); |
1716 return; | |
1717 } | |
1718 if ( window_SpeakInHouse->receives_keyboard_input_2 == WINDOW_INPUT_CONFIRMED) | |
1719 { | |
1720 v1 = atoi((const char *)pKeyActionMap->pPressedKeysBuffer); | |
1721 v2 = atoi((const char *)pKeyActionMap->pPressedKeysBuffer); | |
1722 if ( v1 <= 0 ) | |
1723 { | |
1724 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
1725 return; | |
1726 } | |
1727 if ( v1 > pParty->uNumGold ) | |
1728 { | |
1729 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful); | |
1730 v2 = pParty->uNumGold; | |
1731 } | |
1732 if ( v2 > pParty->uFine ) | |
1733 v2 = pParty->uFine; | |
1734 Party::TakeGold(v2); | |
1735 pParty->uFine -= v2; | |
1736 if ( pParty->uFine < 0 ) | |
1737 pParty->uFine = 0; | |
1738 if ( uActiveCharacter ) | |
1739 pPlayers[uActiveCharacter]->PlaySound(SPEECH_81, 0); | |
1740 } | |
1741 if ( window_SpeakInHouse->receives_keyboard_input_2 == WINDOW_INPUT_CANCELLED) | |
1742 { | |
1743 window_SpeakInHouse->receives_keyboard_input_2 = WINDOW_INPUT_NONE; | |
1744 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
1745 } | |
1746 break; | |
1747 } | |
1748 default: | |
1749 break; | |
1298 | 1750 } |
1751 return; | |
1752 } | |
1753 | |
1754 //----- (004B7D7E) -------------------------------------------------------- | |
1458 | 1755 void BankDialog() |
1298 | 1756 { |
1573 | 1757 int entered_sum; // eax@19 |
1758 unsigned int takes_sum; // esi@19 | |
1759 unsigned __int16 pColorText; // ax@27 | |
1760 GUIWindow bank_window; // [sp+Ch] [bp-5Ch]@1 | |
1298 | 1761 |
1573 | 1762 memcpy(&bank_window, window_SpeakInHouse, sizeof(bank_window)); |
1763 bank_window.uFrameX = 483; | |
1764 bank_window.uFrameWidth = 148; | |
1765 bank_window.uFrameZ = 334; | |
1766 sprintf(pTmpBuf.data(), "%s: %d", pGlobalTXT_LocalizationStrings[25], pParty->uNumGoldInBank);//Баланс | |
2069 | 1767 bank_window.DrawTitleText(pFontArrus, 0, 220, Color16(0xFFu, 0xFFu, 0x9Bu), pTmpBuf.data(), 3); |
1298 | 1768 switch(dialog_menu_id) |
1769 { | |
1573 | 1770 case HOUSE_DIALOGUE_MAIN: |
1771 { | |
2069 | 1772 pColorText = Color16(0xFFu, 0xFFu, 0x9Bu); |
1573 | 1773 if ( pDialogueWindow->pCurrentPosActiveItem != 2 ) |
2069 | 1774 pColorText = Color16(0xFFu, 0xFFu, 0xFFu); |
1573 | 1775 bank_window.DrawTitleText(pFontArrus, 0, 146, pColorText, pGlobalTXT_LocalizationStrings[60], 3); |
2069 | 1776 pColorText = Color16(0xFFu, 0xFFu, 0x9Bu); |
1573 | 1777 if ( pDialogueWindow->pCurrentPosActiveItem != 3 ) |
2069 | 1778 pColorText = Color16(0xFFu, 0xFFu, 0xFFu); |
1573 | 1779 bank_window.DrawTitleText(pFontArrus, 0, 176, pColorText, pGlobalTXT_LocalizationStrings[244], 3); |
1780 break; | |
1781 } | |
1782 case HOUSE_DIALOGUE_BANK_PUT_GOLD: | |
1783 { | |
1784 if ( window_SpeakInHouse->receives_keyboard_input_2 == WINDOW_INPUT_IN_PROGRESS) | |
1785 { | |
1786 sprintf(pTmpBuf.data(), "%s\n%s", pGlobalTXT_LocalizationStrings[60], pGlobalTXT_LocalizationStrings[112]);//"Положить" "Сколько?" | |
2069 | 1787 bank_window.DrawTitleText(pFontArrus, 0, 146, Color16(0xFFu, 0xFFu, 0x9Bu), pTmpBuf.data(), 3); |
1788 bank_window.DrawTitleText(pFontArrus, 0, 186, Color16(0xFFu, 0xFFu, 0xFFu), (const char *)pKeyActionMap->pPressedKeysBuffer, 3); | |
1573 | 1789 bank_window.DrawFlashingInputCursor(pFontArrus->GetLineWidth((const char *)pKeyActionMap->pPressedKeysBuffer) / 2 + 80, 185, pFontArrus); |
1790 return; | |
1791 } | |
1792 if ( window_SpeakInHouse->receives_keyboard_input_2 == WINDOW_INPUT_CONFIRMED) | |
1793 { | |
1794 entered_sum = atoi((const char *)pKeyActionMap->pPressedKeysBuffer); | |
1795 takes_sum = entered_sum; | |
1796 if ( !entered_sum ) | |
1797 { | |
1798 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
1799 return; | |
1800 } | |
1801 if ( entered_sum > pParty->uNumGold ) | |
1802 { | |
1803 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful); | |
1804 takes_sum = pParty->uNumGold; | |
1805 } | |
1806 if ( takes_sum ) | |
1807 { | |
1808 Party::TakeGold(takes_sum); | |
1809 pParty->uNumGoldInBank += takes_sum; | |
1810 if ( uActiveCharacter ) | |
1811 pPlayers[uActiveCharacter]->PlaySound(SPEECH_81, 0); | |
1812 } | |
1813 window_SpeakInHouse->receives_keyboard_input_2 = WINDOW_INPUT_NONE; | |
1814 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
1815 return; | |
1816 } | |
1817 if (window_SpeakInHouse->receives_keyboard_input_2 == WINDOW_INPUT_CANCELLED) | |
1818 { | |
1819 window_SpeakInHouse->receives_keyboard_input_2 = WINDOW_INPUT_NONE; | |
1820 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
1821 } | |
1822 return; | |
1823 } | |
1824 case HOUSE_DIALOGUE_BANK_GET_GOLD: | |
1825 { | |
1826 if ( window_SpeakInHouse->receives_keyboard_input_2 == WINDOW_INPUT_IN_PROGRESS) | |
1827 { | |
1828 sprintfex(pTmpBuf.data(), "%s\n%s", pGlobalTXT_LocalizationStrings[244], pGlobalTXT_LocalizationStrings[112]);//"Снять" "Сколько?" | |
2069 | 1829 bank_window.DrawTitleText(pFontArrus, 0, 146, Color16(0xFFu, 0xFFu, 0x9Bu), pTmpBuf.data(), 3); |
1830 bank_window.DrawTitleText(pFontArrus, 0, 186, Color16(0xFFu, 0xFFu, 0xFFu), (const char *)pKeyActionMap->pPressedKeysBuffer, 3); | |
1573 | 1831 bank_window.DrawFlashingInputCursor(pFontArrus->GetLineWidth((const char *)pKeyActionMap->pPressedKeysBuffer) / 2 + 80, 185, pFontArrus); |
1832 return; | |
1833 } | |
1834 if ( window_SpeakInHouse->receives_keyboard_input_2 == WINDOW_INPUT_CONFIRMED) | |
1835 { | |
1836 window_SpeakInHouse->receives_keyboard_input_2 = WINDOW_INPUT_NONE; | |
1837 entered_sum = atoi((const char *)pKeyActionMap->pPressedKeysBuffer); | |
1838 takes_sum = entered_sum; | |
1839 if ( entered_sum ) | |
1840 { | |
1841 if ( entered_sum > pParty->uNumGoldInBank ) | |
1842 { | |
1843 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful); | |
1844 takes_sum = pParty->uNumGoldInBank; | |
1845 } | |
1846 if ( takes_sum ) | |
1847 { | |
1848 Party::SetGold(pParty->uNumGold + takes_sum); | |
1849 pParty->uNumGoldInBank -= takes_sum; | |
1850 } | |
1851 } | |
1852 window_SpeakInHouse->receives_keyboard_input_2 = WINDOW_INPUT_NONE; | |
1853 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
1854 return; | |
1855 } | |
1856 if ( window_SpeakInHouse->receives_keyboard_input_2 == WINDOW_INPUT_CANCELLED) | |
1857 { | |
1858 window_SpeakInHouse->receives_keyboard_input_2 = WINDOW_INPUT_NONE; | |
1859 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
1860 } | |
1861 return; | |
1862 } | |
1863 default: | |
1864 { | |
1865 break; | |
1866 } | |
1298 | 1867 } |
1868 } | |
1869 // F8B19C: using guessed type int dword_F8B19C; | |
1870 | |
1871 //----- (004B8285) -------------------------------------------------------- | |
1458 | 1872 void TavernDialog() |
1298 | 1873 { |
1630 | 1874 int pPriceRoom; |
1875 int pPriceFood; | |
1876 int pPriceSkill; | |
1298 | 1877 int pItemNum; |
1878 double v2; // st7@1 | |
1879 int pNumString; // edi@16 | |
1880 signed int v9; // esi@16 | |
1881 unsigned int pColorText; // eax@57 | |
1882 GUIButton *pButton; // eax@65 | |
1630 | 1883 int pSkillCount; |
1884 signed int pOptionsCount; // edi@77 | |
1298 | 1885 signed int i; // esi@79 |
2334 | 1886 // signed int v53; // edi@81 |
1298 | 1887 int v54; // edi@81 |
1630 | 1888 const char *pText; // [sp-4h] [bp-278h]@93 |
1298 | 1889 char pTopic1[100]; // [sp+Ch] [bp-268h]@55 |
1890 char pTopic4[100]; // [sp+70h] [bp-204h]@59 | |
1891 char pTopic2[100]; // [sp+D4h] [bp-1A0h]@57 | |
1892 char pTopic3[100]; // [sp+138h] [bp-13Ch]@59 | |
1893 GUIWindow dialog_window; // [sp+1F0h] [bp-84h]@1 | |
1630 | 1894 int v91; // [sp+270h] [bp-4h]@3 |
1895 unsigned int pTopic1Height; // [sp+26Fh] [bp-5h]@55 | |
1896 unsigned __int8 pTopic2Height; // [sp+267h] [bp-Dh]@57 | |
1298 | 1897 unsigned __int8 pTopic3Height; // [sp+253h] [bp-21h]@59 |
1898 unsigned __int8 pTopic4Height; | |
1899 int pTextHeight; | |
1630 | 1900 int all_text_height; // [sp+260h] [bp-14h]@18 |
1901 GUIFont *pOutString; | |
1298 | 1902 |
1903 memcpy(&dialog_window, window_SpeakInHouse, sizeof(dialog_window)); | |
1904 dialog_window.uFrameX = 483; | |
1905 dialog_window.uFrameWidth = 148; | |
1906 dialog_window.uFrameZ = 334; | |
1907 v2 = p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier; | |
1630 | 1908 |
1909 pPriceRoom = ((v2 * v2) / 10) * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; | |
1910 if ( pPriceRoom < ((v2 * v2) / 10) / 3 ) | |
1911 pPriceRoom = ((v2 * v2) / 10) / 3; | |
1912 if ( pPriceRoom <= 0 ) | |
1913 pPriceRoom = 1; | |
1914 | |
1915 pPriceFood = ((v2 * v2) * v2 / 100) * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; | |
1916 if ( pPriceFood < ((v2 * v2) * v2 / 100) / 3 ) | |
1917 pPriceFood = ((v2 * v2) * v2 / 100) / 3; | |
1918 if ( pPriceFood <= 0 ) | |
1919 pPriceFood = 1; | |
1920 | |
1298 | 1921 |
1922 switch(dialog_menu_id) | |
1923 { | |
1924 case HOUSE_DIALOGUE_MAIN: | |
1925 { | |
1393 | 1926 if ( !HouseUI_CheckIfPlayerCanInteract() ) |
1298 | 1927 return; |
1928 | |
2069 | 1929 sprintf(pTopic1, "\f%05d", pDialogueWindow->pCurrentPosActiveItem == 2 ? Color16(0xFFu, 0xFFu, 0x9Bu) : Color16(0xFFu, 0xFFu, 0xFFu)); |
1630 | 1930 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[178], pPriceRoom); // Rent room for %d gold |
1298 | 1931 strcat(pTopic1, pTmpBuf2.data()); |
1932 pTopic1Height = pFontArrus->CalcTextHeight(pTopic1, &dialog_window, 0, 0); | |
1933 strcat(pTopic1, "\n \n"); | |
1934 | |
2069 | 1935 sprintf(pTopic2, "\f%05d", pDialogueWindow->pCurrentPosActiveItem == 3 ? Color16(0xFFu, 0xFFu, 0x9Bu) : Color16(0xFFu, 0xFFu, 0xFFu)); |
1298 | 1936 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[86], // Buy food for %d days for %d gold |
1630 | 1937 (unsigned int)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier, pPriceFood); |
1298 | 1938 strcat(pTopic2, pTmpBuf2.data()); |
1939 pTopic2Height = pFontArrus->CalcTextHeight(pTopic2, &dialog_window, 0, 0); | |
1940 strcat(pTopic2, "\n \n"); | |
1941 | |
2069 | 1942 sprintf(pTopic3, "\f%05d", pDialogueWindow->pCurrentPosActiveItem == 4 ? Color16(0xFFu, 0xFFu, 0x9Bu) : Color16(0xFFu, 0xFFu, 0xFFu)); |
1298 | 1943 strcat(pTopic3, pGlobalTXT_LocalizationStrings[160]); // Learn Skills |
1944 pTopic3Height = pFontArrus->CalcTextHeight(pTopic3, &dialog_window, 0, 0); | |
1945 strcat(pTopic3, "\n \n"); | |
1946 pTopic4[0] = 0; | |
1947 if ( (signed int)window_SpeakInHouse->par1C >= 108 && (signed int)window_SpeakInHouse->par1C <= 120 ) | |
1948 { | |
2069 | 1949 sprintf(pTopic4, "\f%05d", pDialogueWindow->pCurrentPosActiveItem == 5 ? Color16(0xFFu, 0xFFu, 0x9Bu) : Color16(0xFFu, 0xFFu, 0xFFu)); |
1298 | 1950 strcat(pTopic4, pGlobalTXT_LocalizationStrings[611]); // Play Arcomage |
1951 pTopic4Height = pFontArrus->CalcTextHeight(pTopic4, &dialog_window, 0, 0); | |
1952 } | |
1610 | 1953 |
1954 if ( pDialogueWindow->pNumPresenceButton ) | |
1298 | 1955 { |
1630 | 1956 for ( pItemNum = pDialogueWindow->pStartingPosActiveItem; |
1957 pItemNum < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton; ++pItemNum ) | |
1298 | 1958 { |
1630 | 1959 pButton = pDialogueWindow->GetControl(pItemNum); |
1298 | 1960 if ( pButton->msg_param == 15 ) |
1961 { | |
1962 pButton->uHeight = pTopic1Height; | |
1963 pButton->uY = 146; | |
1630 | 1964 pButton->uW = pTopic1Height + 145; |
1298 | 1965 } |
1966 else if ( pButton->msg_param == 16 ) | |
1967 { | |
1968 pButton->uHeight = pTopic2Height; | |
1630 | 1969 pButton->uY = pTopic1Height + (LOBYTE(pFontArrus->uFontHeight) - 3) + 146; |
1970 pButton->uW = (pTopic1Height + (LOBYTE(pFontArrus->uFontHeight) - 3) + 146) + pTopic2Height - 1; | |
1298 | 1971 } |
1972 else if ( pButton->msg_param == 96 ) | |
1973 { | |
1630 | 1974 pButton->uY = pTopic1Height + pTopic2Height + 2 * (LOBYTE(pFontArrus->uFontHeight) - 3) + 146; |
1975 pButton->uHeight = pTopic3Height; | |
1976 pButton->uW = pTopic3Height + (pTopic1Height + pTopic2Height + 2 * (LOBYTE(pFontArrus->uFontHeight) - 3) + 146) - 1; | |
1298 | 1977 } |
1978 else if ( pButton->msg_param == 101 ) | |
1979 { | |
1980 pButton->uHeight = pTopic4Height; | |
1630 | 1981 pButton->uY = pTopic1Height + 3 * (LOBYTE(pFontArrus->uFontHeight) - 3) + pTopic4Height + pTopic2Height + 146; |
1982 pButton->uW = (pTopic1Height + 3 * (LOBYTE(pFontArrus->uFontHeight) - 3) + pTopic4Height + pTopic2Height + 146) + pTopic4Height - 1; | |
1298 | 1983 } |
1984 } | |
1610 | 1985 sprintfex(pTmpBuf.data(), "%s%s%s%s", pTopic1, pTopic2, pTopic3, pTopic4); |
1986 dialog_window.DrawTitleText(pFontArrus, 0, 146, 0, pTmpBuf.data(), 3); | |
1298 | 1987 } |
1988 break; | |
1989 } | |
1990 case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_RULES: | |
1991 { | |
1992 pOutString = pFontArrus; | |
1993 strcpy(pTmpBuf.data(), pNPCTopics[354].pText); | |
1994 dialog_window.uFrameWidth = game_viewport_width; | |
1995 dialog_window.uFrameZ = 452; | |
1996 pTextHeight = pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 12, 0) + 7; | |
1997 if ( 352 - pTextHeight < 8 ) | |
1998 { | |
1999 pOutString = pFontCreate; | |
2000 pTextHeight = pFontCreate->CalcTextHeight(pTmpBuf.data(), &dialog_window, 12, 0) + 7; | |
2001 } | |
1630 | 2002 pRenderer->GetLeather(8, 352 - pTextHeight, pIcons_LOD->GetTexture(uTextureID_Leather), pIcons_LOD->GetTexture(uTextureID_Leather)->uTextureHeight - pTextHeight); |
1298 | 2003 pRenderer->DrawTextureIndexed(8, 347 - pTextHeight, pTexture_591428); |
1630 | 2004 window_SpeakInHouse->DrawText(pOutString, 12, 354 - pTextHeight, 0, FitTextInAWindow(pTmpBuf.data(), pOutString, &dialog_window, 0xCu, 0), 0, 0, 0); |
1298 | 2005 break; |
2006 } | |
2007 case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_VICTORY_CONDITIONS: | |
2008 { | |
2009 strcpy(pTmpBuf.data(), pNPCTopics[(uint)window_SpeakInHouse->ptr_1C + 247].pText); | |
2010 dialog_window.uFrameWidth = game_viewport_width; | |
2011 dialog_window.uFrameZ = 452; | |
1630 | 2012 pTextHeight = pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 12, 0) + 7; |
2013 pRenderer->GetLeather(8, 352 - pTextHeight, pIcons_LOD->GetTexture(uTextureID_Leather), pIcons_LOD->GetTexture(uTextureID_Leather)->uTextureHeight - pTextHeight); | |
1298 | 2014 pRenderer->DrawTextureIndexed(8, 347 - pTextHeight, pTexture_591428); |
1630 | 2015 window_SpeakInHouse->DrawText(pFontArrus, 12, 354 - pTextHeight, 0, |
2016 FitTextInAWindow(pTmpBuf.data(), pFontArrus, &dialog_window, 0xCu, 0), 0, 0, 0); | |
1298 | 2017 break; |
2018 } | |
2019 case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_RESULT: | |
2020 { | |
2021 if ( pArcomageGame->bGameInProgress == 1 ) | |
2022 return; | |
2214 | 2023 if ( pArcomageGame->uGameWinner ) |
1298 | 2024 { |
2214 | 2025 if ( pArcomageGame->uGameWinner == 1 ) |
1630 | 2026 pText = pGlobalTXT_LocalizationStrings[640];// You won! |
1298 | 2027 else |
1630 | 2028 pText = pGlobalTXT_LocalizationStrings[641];// You lost! |
1298 | 2029 } |
2030 else | |
2031 { | |
1630 | 2032 pText = pGlobalTXT_LocalizationStrings[639];// A tie! |
1298 | 2033 } |
1630 | 2034 strcpy(pTmpBuf.data(), pText); |
2035 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 0, 0)) / 2 + 138, | |
2069 | 2036 Color16(0xFFu, 0xFFu, 0x9Bu), pTmpBuf.data(), 3); |
1298 | 2037 break; |
2038 } | |
2039 case HOUSE_DIALOGUE_TAVERN_REST: | |
2040 { | |
1630 | 2041 if ( pParty->uNumGold >= pPriceRoom ) |
1298 | 2042 { |
1630 | 2043 Party::TakeGold(pPriceRoom); |
1298 | 2044 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful); |
2022 | 2045 dialog_menu_id = HOUSE_DIALOGUE_NULL; |
1919 | 2046 HouseDialogPressCloseBtn(); |
1407 | 2047 GetHouseGoodbyeSpeech(); |
1298 | 2048 pVideoPlayer->Unload(); |
2022 | 2049 /*if ( pMessageQueue_50CBD0->uNumMessages ) |
1298 | 2050 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; |
2051 pMessageQueue_50CBD0->pMessages[0].eType = UIMSG_RentRoom; | |
1630 | 2052 pMessageQueue_50CBD0->pMessages[0].param = (int)window_SpeakInHouse->ptr_1C;//107 |
1298 | 2053 pMessageQueue_50CBD0->pMessages[0].field_8 = 1; |
2022 | 2054 ++pMessageQueue_50CBD0->uNumMessages;*/ |
2055 pMessageQueue_50CBD0->AddMessage(UIMSG_RentRoom, (int)window_SpeakInHouse->ptr_1C, 1); | |
1630 | 2056 window_SpeakInHouse->Release(); |
2057 window_SpeakInHouse = 0; | |
1298 | 2058 return; |
2059 } | |
1630 | 2060 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);//У вас не хватает золота |
1298 | 2061 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_Goodbye); |
1630 | 2062 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); |
1298 | 2063 break; |
2064 } | |
2065 | |
2066 case HOUSE_DIALOGUE_LEARN_SKILLS: | |
2067 { | |
1393 | 2068 if ( !HouseUI_CheckIfPlayerCanInteract() ) |
1298 | 2069 return; |
1630 | 2070 pSkillCount = 0; |
1298 | 2071 v9 = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0); |
1630 | 2072 pPriceSkill = v9 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; |
2073 if ( pPriceSkill < v9 / 3 ) | |
2074 pPriceSkill = v9 / 3; | |
1298 | 2075 all_text_height = 0; |
1920 | 2076 for ( int i = pDialogueWindow->pStartingPosActiveItem; |
2077 i < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton; ++i ) | |
1298 | 2078 { |
1920 | 2079 if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][pDialogueWindow->GetControl(i)->msg_param - 36] |
2080 && !pPlayers[uActiveCharacter]->pActiveSkills[pDialogueWindow->GetControl(i)->msg_param - 36] ) | |
1298 | 2081 { |
1920 | 2082 all_text_height = pFontArrus->CalcTextHeight(pSkillNames[pDialogueWindow->GetControl(i)->msg_param - 36], &dialog_window, 0, 0); |
1630 | 2083 pSkillCount++; |
1298 | 2084 } |
2085 } | |
1630 | 2086 if ( pSkillCount ) |
2087 { | |
2088 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[401], pPriceSkill);//Стоимость навыка: %lu | |
2089 dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3); | |
2090 v91 = (149 - all_text_height) / pSkillCount; | |
2091 if ( (149 - all_text_height) / pSkillCount > 32 ) | |
2092 v91 = 32; | |
2093 v54 = (149 - pSkillCount * v91 - all_text_height) / 2 - v91 / 2 + 162; | |
1920 | 2094 for ( int i = pDialogueWindow->pStartingPosActiveItem; |
2095 i < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton; i++ ) | |
1630 | 2096 { |
1920 | 2097 pButton = pDialogueWindow->GetControl(i); |
1630 | 2098 if ( !byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][pButton->msg_param - 36] |
2099 || pPlayers[uActiveCharacter]->pActiveSkills[pButton->msg_param - 36] ) | |
2100 { | |
2101 pButton->uW = 0; | |
2102 pButton->uHeight = 0; | |
2103 pButton->uY = 0; | |
2104 } | |
2105 else | |
2106 { | |
2107 pButton->uY = v91 + v54; | |
2108 pTextHeight = pFontArrus->CalcTextHeight(pSkillNames[pButton->msg_param - 36], &dialog_window, 0, 0); | |
2109 pButton->uHeight = pTextHeight; | |
2110 v54 = pTextHeight + pButton->uY - 1; | |
2111 pButton->uW = v54; | |
2069 | 2112 pColorText = Color16(0xFFu, 0xFFu, 0x9Bu); |
1920 | 2113 if ( pDialogueWindow->pCurrentPosActiveItem != i ) |
2069 | 2114 pColorText = Color16(0xFFu, 0xFFu, 0xFFu); |
1630 | 2115 dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, pSkillNames[pButton->msg_param - 36], 3); |
2116 } | |
2117 } | |
2118 return; | |
2119 } | |
2120 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName,//Советую вам %s %s поискать знания еще где-нибудь | |
1610 | 2121 pClassNames[pPlayers[uActiveCharacter]->classType]); |
1298 | 2122 strcat(pTmpBuf.data(), "\n \n"); |
1630 | 2123 strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]);//Больше ничего не могу предложить. |
1298 | 2124 pTextHeight = (174 - pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 0, 0)) / 2 + 138; |
2069 | 2125 dialog_window.DrawTitleText(pFontArrus, 0, pTextHeight, Color16(0xFFu, 0xFFu, 0x9Bu), pTmpBuf.data(), 3); |
1298 | 2126 return; |
2127 } | |
2128 | |
2129 case HOUSE_DIALOGUE_TAVERN_BUY_FOOD: | |
2130 { | |
2131 if ( (double)pParty->uNumFoodRations >= p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier ) | |
2132 { | |
1630 | 2133 ShowStatusBarString(pGlobalTXT_LocalizationStrings[140], 2);//Вы уже купили еду! |
1298 | 2134 if ( uActiveCharacter ) |
2135 pPlayers[uActiveCharacter]->PlaySound(SPEECH_67, 0); | |
1630 | 2136 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); |
1298 | 2137 return; |
2138 } | |
1630 | 2139 if ( pParty->uNumGold >= pPriceFood ) |
1298 | 2140 { |
1630 | 2141 Party::TakeGold(pPriceFood); |
1298 | 2142 pParty->uNumFoodRations = (signed __int64)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier; |
2143 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_Greeting_2); | |
2144 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
2145 return; | |
2146 } | |
2147 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2); // "You don't have enough gold" | |
2148 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_Goodbye); | |
1630 | 2149 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); |
1298 | 2150 break; |
2151 } | |
2152 | |
2153 case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_MAIN: | |
2154 { | |
1393 | 2155 if ( HouseUI_CheckIfPlayerCanInteract() ) |
1298 | 2156 { |
1630 | 2157 pOptionsCount = 2; |
1843
2e6d3cd052e0
some char* cast removal + adding const_casts where appropriate
Grumpy7
parents:
1838
diff
changeset
|
2158 pShopOptions[0] = const_cast<char *>(pGlobalTXT_LocalizationStrings[620]);//Правила |
2e6d3cd052e0
some char* cast removal + adding const_casts where appropriate
Grumpy7
parents:
1838
diff
changeset
|
2159 pShopOptions[1] = const_cast<char *>(pGlobalTXT_LocalizationStrings[622]);//Условия победы |
1630 | 2160 if ( pParty->HasItem(651) )//651 - Колода для игры в АркоМэйдж в Items.txt |
1298 | 2161 { |
1843
2e6d3cd052e0
some char* cast removal + adding const_casts where appropriate
Grumpy7
parents:
1838
diff
changeset
|
2162 pShopOptions[2] = const_cast<char *>(pGlobalTXT_LocalizationStrings[621]);//Играть |
1630 | 2163 pOptionsCount = 3; |
2164 } | |
2165 for ( i = 0; i < pOptionsCount; ++i ) | |
2166 all_text_height = pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0); | |
2167 all_text_height = (174 - all_text_height) / pOptionsCount; | |
2168 | |
2169 v54 = (174 - pOptionsCount * (174 - all_text_height) / pOptionsCount - all_text_height) / 2 - (174 - all_text_height) / pOptionsCount / 2 + 138; | |
2170 pNumString = 0; | |
2171 for ( pItemNum = pDialogueWindow->pStartingPosActiveItem; | |
2172 pItemNum < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem ; pItemNum++ ) | |
2173 { | |
2174 pButton = pDialogueWindow->GetControl(pItemNum); | |
2175 pButton->uY = all_text_height + v54; | |
2176 pTextHeight = pFontArrus->CalcTextHeight((const char *)pShopOptions[pNumString], &dialog_window, 0, 0); | |
2177 pButton->uHeight = pTextHeight; | |
2178 v54 = pButton->uY + pTextHeight - 1; | |
2179 pButton->uW = v54; | |
2069 | 2180 pColorText = Color16(0xFFu, 0xFFu, 0x9Bu); |
1630 | 2181 if ( pDialogueWindow->pCurrentPosActiveItem != pItemNum ) |
2069 | 2182 pColorText = Color16(0xFFu, 0xFFu, 0xFFu); |
1630 | 2183 dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, (const char *)pShopOptions[pNumString], 3); |
2184 ++pNumString; | |
1298 | 2185 } |
2186 } | |
2187 break; | |
2188 } | |
2189 default: | |
2190 { | |
2191 break; | |
2192 } | |
2193 } | |
2194 } | |
2195 | |
2196 //----- (004B705E) -------------------------------------------------------- | |
2197 void TempleDialog() | |
1612 | 2198 { |
1622 | 2199 int pPrice; // edi@1 |
2200 int pTextHeight; // eax@11 | |
2201 unsigned __int16 pTextColor; // ax@21 | |
2202 DDM_DLV_Header *v26; // edi@29 | |
2203 unsigned int v30; // edx@36 | |
2204 int v35; // edi@50 | |
2205 GUIButton *pButton; // edi@64 | |
2334 | 2206 // int v47; // edi@71 |
1622 | 2207 GUIWindow tample_window; // [sp+13Ch] [bp-88h]@1 |
2208 unsigned __int8 index; // [sp+1B7h] [bp-Dh]@64 | |
2209 int v64; // [sp+1B8h] [bp-Ch]@6 | |
2210 unsigned int pCurrentItem; // [sp+1BCh] [bp-8h]@6 | |
2211 int all_text_height; // [sp+1C0h] [bp-4h]@6 | |
1298 | 2212 |
1612 | 2213 memcpy(&tample_window, window_SpeakInHouse, sizeof(tample_window)); |
2214 tample_window.uFrameX = 483; | |
2215 tample_window.uFrameWidth = 148; | |
2216 tample_window.uFrameZ = 334; | |
2217 pPrice = pPlayers[uActiveCharacter]->GetTempleHealCostModifier(p2DEvents[window_SpeakInHouse->par1C - 1].fPriceMultiplier); | |
2218 if ( dialog_menu_id == HOUSE_DIALOGUE_MAIN ) | |
2219 { | |
2220 index = 1; | |
2221 pButton = pDialogueWindow->GetControl(pDialogueWindow->pStartingPosActiveItem); | |
2222 pButton->uHeight = 0; | |
2223 pButton->uY = 0; | |
2224 if ( pPlayers[uActiveCharacter]->IsPlayerHealableByTemple() ) | |
1298 | 2225 { |
1612 | 2226 sprintfex(pTmpBuf.data(), "%s %d %s", pGlobalTXT_LocalizationStrings[104], pPrice, pGlobalTXT_LocalizationStrings[97]);//"Лечить" "Золото" |
2227 pShopOptions[0] = pTmpBuf.data(); | |
2228 index = 0; | |
2229 } | |
1843
2e6d3cd052e0
some char* cast removal + adding const_casts where appropriate
Grumpy7
parents:
1838
diff
changeset
|
2230 pShopOptions[1] = const_cast<char *>(pGlobalTXT_LocalizationStrings[68]);//"Пожертвовать" |
2e6d3cd052e0
some char* cast removal + adding const_casts where appropriate
Grumpy7
parents:
1838
diff
changeset
|
2231 pShopOptions[2] = const_cast<char *>(pGlobalTXT_LocalizationStrings[160]);//"Обучиться навыкам" |
1612 | 2232 all_text_height = 0; |
2233 if ( index < pDialogueWindow->pNumPresenceButton ) | |
2234 { | |
2235 uint i = index; | |
2236 for ( uint j = index; j < pDialogueWindow->pNumPresenceButton; ++j ) | |
2237 { | |
2238 all_text_height += pFontArrus->CalcTextHeight(pShopOptions[1 * i], &tample_window, 0, 0); | |
2239 i++; | |
2240 } | |
2241 } | |
2242 v64 = (174 - (signed int)all_text_height) / (pDialogueWindow->pNumPresenceButton - index); | |
2243 if ( v64 > 32 ) | |
2244 v64 = 32; | |
1622 | 2245 all_text_height = (174 - v64 * (pDialogueWindow->pNumPresenceButton - index) - (signed int)all_text_height) / 2 - v64 / 2 + 138; |
1612 | 2246 if ( index + pDialogueWindow->pStartingPosActiveItem < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton ) |
2247 { | |
2248 uint i = index; | |
2249 for ( pCurrentItem = index + pDialogueWindow->pStartingPosActiveItem; | |
2250 (signed int)pCurrentItem < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++pCurrentItem ) | |
1298 | 2251 { |
1612 | 2252 pButton = pDialogueWindow->GetControl(pCurrentItem); |
1622 | 2253 pButton->uY = v64 + all_text_height; |
1612 | 2254 pTextHeight = pFontArrus->CalcTextHeight(pShopOptions[1 * i], &tample_window, 0, 0); |
2255 pButton->uHeight = pTextHeight; | |
1622 | 2256 pButton->uW = pButton->uY + pTextHeight - 1; |
2257 all_text_height = pButton->uW; | |
2069 | 2258 pTextColor = Color16(0xFFu, 0xFFu, 0x9Bu); |
1612 | 2259 if ( pDialogueWindow->pCurrentPosActiveItem != index + 2 ) |
2069 | 2260 pTextColor = Color16(0xFFu, 0xFFu, 0xFFu); |
1622 | 2261 tample_window.DrawTitleText(pFontArrus, 0, pButton->uY, pTextColor, pShopOptions[1 * i], 3); |
1612 | 2262 i++; |
2263 index++; | |
2264 } | |
2265 } | |
2266 return; | |
2267 } | |
2268 //------------------------------------------------- | |
2269 if ( dialog_menu_id == HOUSE_DIALOGUE_TEMPLE_HEAL ) | |
2270 { | |
2271 if ( !pPlayers[uActiveCharacter]->IsPlayerHealableByTemple() ) | |
2272 return; | |
2273 if ( pParty->uNumGold < pPrice ) | |
2274 { | |
1622 | 2275 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);//"У вас не хватает золота" |
1612 | 2276 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful); |
1622 | 2277 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); |
1612 | 2278 return; |
2279 } | |
2280 Party::TakeGold(pPrice); | |
2057 | 2281 v35 = LODWORD(pPlayers[uActiveCharacter]->pConditions[Condition_Zombie]); |
1612 | 2282 memset(pPlayers[uActiveCharacter], 0, 0xA0u); |
2283 pPlayers[uActiveCharacter]->sHealth = pPlayers[uActiveCharacter]->GetMaxHealth(); | |
2284 pPlayers[uActiveCharacter]->sMana = pPlayers[uActiveCharacter]->GetMaxMana(); | |
1622 | 2285 if ( (signed int)window_SpeakInHouse->ptr_1C != 78 && ((signed int)window_SpeakInHouse->ptr_1C <= 80 || (signed int)window_SpeakInHouse->ptr_1C > 82) ) |
1612 | 2286 { |
2185 | 2287 if ( (unsigned int)pPlayers[uActiveCharacter]->pConditions[Condition_Zombie] | v35 )// если состояние зомби |
1612 | 2288 { |
1622 | 2289 pPlayers[uActiveCharacter]->uCurrentFace = pPlayers[uActiveCharacter]->uPrevFace; |
2290 pPlayers[uActiveCharacter]->uVoiceID = pPlayers[uActiveCharacter]->uPrevVoiceID; | |
2291 ReloadPlayerPortraits(uActiveCharacter - 1, pPlayers[uActiveCharacter]->uPrevFace); | |
1612 | 2292 } |
2293 pAudioPlayer->PlaySound((SoundID)(SOUND_GoldReceived|0x2), -1, 0, -1, 0, 0, 0, 0); | |
2294 pPlayers[uActiveCharacter]->PlaySound(SPEECH_82, 0); | |
2295 pOtherOverlayList->_4418B1(20, uActiveCharacter + 99, 0, 65536); | |
1622 | 2296 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); |
1612 | 2297 return; |
2298 } | |
2057 | 2299 if ( (unsigned int)pPlayers[uActiveCharacter]->pConditions[Condition_Zombie] | v35 ) |
2300 LODWORD(pPlayers[uActiveCharacter]->pConditions[Condition_Zombie]) = v35; | |
1612 | 2301 else |
2302 { | |
2057 | 2303 if ( !pPlayers[uActiveCharacter]->pConditions[Condition_Eradicated] |
2304 && !pPlayers[uActiveCharacter]->pConditions[Condition_Pertified] && !pPlayers[uActiveCharacter]->pConditions[Condition_Dead] ) | |
1612 | 2305 { |
1298 | 2306 pAudioPlayer->PlaySound((SoundID)(SOUND_GoldReceived|0x2), -1, 0, -1, 0, 0, 0, 0); |
1612 | 2307 pPlayers[uActiveCharacter]->PlaySound(SPEECH_82, 0); |
1298 | 2308 pOtherOverlayList->_4418B1(20, uActiveCharacter + 99, 0, 65536); |
1622 | 2309 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); |
1612 | 2310 return; |
2311 } | |
2312 pPlayers[uActiveCharacter]->uPrevFace = pPlayers[uActiveCharacter]->uCurrentFace; | |
2313 pPlayers[uActiveCharacter]->uPrevVoiceID = pPlayers[uActiveCharacter]->uVoiceID; | |
2185 | 2314 pPlayers[uActiveCharacter]->SetCondition(Condition_Zombie, 1); |
1612 | 2315 pPlayers[uActiveCharacter]->uVoiceID = (pPlayers[uActiveCharacter]->GetSexByVoice() != 0) + 23; |
1622 | 2316 pPlayers[uActiveCharacter]->uCurrentFace = (pPlayers[uActiveCharacter]->GetSexByVoice() != 0) + 23; |
2317 ReloadPlayerPortraits(uActiveCharacter - 1, (pPlayers[uActiveCharacter]->GetSexByVoice() != 0) + 23); | |
2185 | 2318 pPlayers[uActiveCharacter]->pConditions[Condition_Zombie] = pParty->uTimePlayed; |
1622 | 2319 //v39 = (GUIWindow *)HIDWORD(pParty->uTimePlayed); |
1612 | 2320 } |
2057 | 2321 //HIDWORD(pPlayers[uActiveCharacter]->pConditions[Condition_Zombie]) = (int)v39; |
2185 | 2322 pPlayers[uActiveCharacter]->pConditions[Condition_Zombie] = pParty->uTimePlayed; |
1612 | 2323 pAudioPlayer->PlaySound((SoundID)(SOUND_GoldReceived|0x2), -1, 0, -1, 0, 0, 0, 0); |
2324 pPlayers[uActiveCharacter]->PlaySound(SPEECH_82, 0); | |
2325 pOtherOverlayList->_4418B1(20, uActiveCharacter + 99, 0, 65536); | |
1622 | 2326 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); |
1612 | 2327 return; |
2328 } | |
2329 //--------------------------------------------------- | |
2330 if ( dialog_menu_id == HOUSE_DIALOGUE_TEMPLE_DONATE ) | |
2331 { | |
1622 | 2332 pPrice = p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier; |
2333 if ( pParty->uNumGold >= (unsigned int)pPrice ) | |
2334 { | |
2335 Party::TakeGold((unsigned int)pPrice); | |
2336 v26 = &pOutdoor->ddm; | |
2337 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
2338 v26 = &pIndoor->dlv; | |
2339 if ( v26->uReputation > -5 ) | |
1612 | 2340 { |
1622 | 2341 v26->uReputation = v26->uReputation - 1; |
2342 if ( v26->uReputation - 1 < -5 ) | |
2343 v26->uReputation = -5; | |
2344 } | |
2345 if ( (unsigned __int8)byte_F8B1EF[uActiveCharacter] == pParty->uDaysPlayed % 7 ) | |
2346 { | |
2347 if ( v26->uReputation <= -5 ) | |
1298 | 2348 { |
1622 | 2349 v30 = pParty->uDaysPlayed % 7 + 1; |
2350 LOBYTE(v30) = v30 | 0x80; | |
2351 _42777D_CastSpell_UseWand_ShootArrow(SPELL_AIR_WIZARD_EYE, uActiveCharacter - 1, v30, 48, 0); | |
1298 | 2352 } |
1622 | 2353 if ( v26->uReputation <= -10 ) |
1298 | 2354 { |
1622 | 2355 v30 = pParty->uDaysPlayed % 7 + 1; |
2356 LOBYTE(v30) = v30 | 0x80; | |
2357 _42777D_CastSpell_UseWand_ShootArrow(SPELL_SPIRIT_PRESERVATION, uActiveCharacter - 1, v30, 48, 0); | |
2358 } | |
2359 if ( v26->uReputation <= -15 ) | |
2360 { | |
2361 v30 = pParty->uDaysPlayed % 7 + 1; | |
2362 LOBYTE(v30) = v30 | 0x80; | |
2363 _42777D_CastSpell_UseWand_ShootArrow(SPELL_BODY_PROTECTION_FROM_MAGIC, uActiveCharacter - 1, v30, 48, 0); | |
2364 } | |
2365 if ( v26->uReputation <= -20 ) | |
2366 { | |
2367 v30 = pParty->uDaysPlayed % 7 + 1; | |
2368 LOBYTE(v30) = v30 | 0x80; | |
2369 _42777D_CastSpell_UseWand_ShootArrow(SPELL_LIGHT_HOUR_OF_POWER, uActiveCharacter - 1, v30, 48, 0); | |
1298 | 2370 } |
1622 | 2371 if ( v26->uReputation <= -25 ) |
2372 { | |
2373 v30 = pParty->uDaysPlayed % 7 + 1; | |
2374 LOBYTE(v30) = v30 | 0x80; | |
2375 _42777D_CastSpell_UseWand_ShootArrow(SPELL_LIGHT_DAY_OF_PROTECTION, uActiveCharacter - 1, v30, 48, 0); | |
2376 } | |
1612 | 2377 } |
1622 | 2378 ++byte_F8B1EF[uActiveCharacter]; |
2379 pPlayers[uActiveCharacter]->PlaySound(SPEECH_83, 0); | |
2380 ShowStatusBarString(pGlobalTXT_LocalizationStrings[527], 2); // "Thank You!" | |
2381 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
1612 | 2382 return; |
1622 | 2383 } |
2384 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);//"У вас не хватает золота" | |
2385 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful); | |
2386 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
2387 return; | |
1612 | 2388 } |
2389 //------------------------------------------------ | |
2390 if ( dialog_menu_id == HOUSE_DIALOGUE_LEARN_SKILLS ) | |
2391 { | |
2392 if ( HouseUI_CheckIfPlayerCanInteract() ) | |
2393 { | |
2394 all_text_height = 0; | |
2395 pCurrentItem = (signed __int64)(p2DEvents[(signed int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0); | |
2396 v64 = (signed int)(pCurrentItem * (100 - pPlayers[uActiveCharacter]->GetMerchant())) / 100; | |
2397 if ( v64 < (signed int)pCurrentItem / 3 ) | |
2398 v64 = (signed int)pCurrentItem / 3; | |
2399 pCurrentItem = 0; | |
1622 | 2400 for ( int i = pDialogueWindow->pStartingPosActiveItem; i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) |
1612 | 2401 { |
1622 | 2402 if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][pDialogueWindow->GetControl(i)->msg_param - 36] |
2403 && !pPlayers[uActiveCharacter]->pActiveSkills[pDialogueWindow->GetControl(i)->msg_param - 36] ) | |
1298 | 2404 { |
1622 | 2405 all_text_height += pFontArrus->CalcTextHeight(pSkillNames[pDialogueWindow->GetControl(i)->msg_param - 36], &tample_window, 0, 0); |
1612 | 2406 ++pCurrentItem; |
2407 } | |
2408 } | |
2409 if ( pCurrentItem ) | |
2410 { | |
2411 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[401], v64); | |
2412 tample_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3); | |
2413 v64 = (149 - (signed int)all_text_height) / (signed int)pCurrentItem; | |
2414 if ( v64 > 32 ) | |
2415 v64 = 32; | |
1622 | 2416 all_text_height = (signed int)(149 - pCurrentItem * v64 - (int)all_text_height) / 2 - v64 / 2 + 162; |
2417 if ( pDialogueWindow->pStartingPosActiveItem < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton ) | |
1612 | 2418 { |
1622 | 2419 pCurrentItem = 2; |
2420 for ( int i = pDialogueWindow->pStartingPosActiveItem; | |
2421 i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) | |
1612 | 2422 { |
1622 | 2423 pButton = pDialogueWindow->GetControl(i); |
2424 if ( !byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][pButton->msg_param - 36] | |
2425 || pPlayers[uActiveCharacter]->pActiveSkills[pButton->msg_param - 36] ) | |
1298 | 2426 { |
1622 | 2427 pButton->uW = 0; |
2428 pButton->uHeight = 0; | |
2429 pButton->uY = 0; | |
1612 | 2430 } |
2431 else | |
2432 { | |
1622 | 2433 pButton->uY = v64 + all_text_height; |
2434 pTextHeight = pFontArrus->CalcTextHeight(pSkillNames[pButton->msg_param - 36], &tample_window, 0, 0); | |
2435 pButton->uHeight = pTextHeight; | |
2436 pButton->uW = pButton->uY + pTextHeight - 1; | |
2437 all_text_height = pButton->uW; | |
2069 | 2438 pTextColor = Color16(0xFFu, 0xFFu, 0x9Bu); |
1622 | 2439 if ( pDialogueWindow->pCurrentPosActiveItem != pCurrentItem ) |
2069 | 2440 pTextColor = Color16(0xFFu, 0xFFu, 0xFFu); |
1622 | 2441 tample_window.DrawTitleText(pFontArrus, 0, pButton->uY, pTextColor, pSkillNames[pButton->msg_param - 36], 3); |
1298 | 2442 } |
1622 | 2443 pCurrentItem++; |
1612 | 2444 } |
1298 | 2445 } |
1612 | 2446 } |
2447 else | |
2448 { | |
1624 | 2449 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]);//"Советую вам %s %s поискать знания еще где-нибудь" |
1612 | 2450 strcat(pTmpBuf.data(), "\n \n"); |
1624 | 2451 strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]);//"Больше ничего не могу предложить." |
1612 | 2452 pTextHeight = pFontArrus->CalcTextHeight(pTmpBuf.data(), &tample_window, 0, 0); |
2069 | 2453 tample_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, Color16(0xFFu, 0xFFu, 0x9Bu), pTmpBuf.data(), 3); |
1612 | 2454 } |
1298 | 2455 } |
1612 | 2456 } |
2457 return; | |
2458 } | |
1298 | 2459 |
2460 //----- (004B4710) -------------------------------------------------------- | |
2461 void TrainingDialog() | |
2462 { | |
2463 unsigned __int64 v5; // edi@3 | |
2464 int v8; // edx@4 | |
2465 double v9; // st7@6 | |
2466 signed int v10; // esi@6 | |
1625 | 2467 int pPrice; // ecx@6 |
1298 | 2468 signed int v14; // esi@14 |
2334 | 2469 // int v16; // eax@16 |
1298 | 2470 int v19; // ecx@24 |
2471 int v33; // eax@36 | |
2472 unsigned int v36; // eax@38 | |
2473 unsigned int v42; // eax@46 | |
1625 | 2474 int index; |
2475 int all_text_height; // eax@68 | |
1298 | 2476 int v49; // ebx@69 |
1625 | 2477 GUIButton *pButton; // eax@71 |
2478 int pTextHeight; // eax@71 | |
2479 unsigned __int16 pTextColor; // ax@71 | |
2480 GUIWindow training_dialog_window; // [sp+Ch] [bp-78h]@1 | |
1298 | 2481 int v69; // [sp+70h] [bp-14h]@6 |
2482 int v73; // [sp+80h] [bp-4h]@14 | |
2483 | |
1625 | 2484 memcpy(&training_dialog_window, window_SpeakInHouse, sizeof(training_dialog_window)); |
2485 training_dialog_window.uFrameX = 483; | |
2486 training_dialog_window.uFrameWidth = 148; | |
2487 training_dialog_window.uFrameZ = 334; | |
1298 | 2488 v5 = 1000ui64 * pPlayers[uActiveCharacter]->uLevel * (pPlayers[uActiveCharacter]->uLevel + 1) / 2; // E n = n(n + 1) / 2 |
1634 | 2489 //v68 = pMaxLevelPerTrainingHallType[(unsigned int)window_SpeakInHouse->ptr_1C - HOUSE_TRAINING_HALL_EMERALD_ISLE]; |
1298 | 2490 if (pPlayers[uActiveCharacter]->uExperience >= v5) |
2491 { | |
2492 v8 = pPlayers[uActiveCharacter]->classType % 4 + 1; | |
2493 if ( v8 == 4 ) | |
2494 v8 = 3; | |
2495 v9 = (double)pPlayers[uActiveCharacter]->uLevel; | |
2496 v69 = v8; | |
2497 v10 = (signed __int64)(v9 * p2DEvents[(signed int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier * (double)v8); | |
1625 | 2498 pPrice = v10 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; |
2499 if ( pPrice < v10 / 3 ) | |
2500 pPrice = v10 / 3; | |
1298 | 2501 } |
1625 | 2502 //------------------------------------------------------- |
2503 all_text_height = 0; | |
1393 | 2504 if (HouseUI_CheckIfPlayerCanInteract()) |
1298 | 2505 { |
1625 | 2506 if ( dialog_menu_id == HOUSE_DIALOGUE_MAIN ) |
1298 | 2507 { |
1625 | 2508 if (HouseUI_CheckIfPlayerCanInteract()) |
1298 | 2509 { |
1625 | 2510 index = 0; |
2511 pShopOptions[0] = pTmpBuf.data(); | |
1843
2e6d3cd052e0
some char* cast removal + adding const_casts where appropriate
Grumpy7
parents:
1838
diff
changeset
|
2512 pShopOptions[1] = const_cast<char *>(pGlobalTXT_LocalizationStrings[160]);// "Learn Skills" |
1625 | 2513 if ( pDialogueWindow->pStartingPosActiveItem < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton ) |
1298 | 2514 { |
1625 | 2515 for ( int i = pDialogueWindow->pStartingPosActiveItem; |
2516 i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) | |
1298 | 2517 { |
1625 | 2518 if ( pDialogueWindow->GetControl(i)->msg_param == HOUSE_DIALOGUE_TRAININGHALL_TRAIN ) |
1298 | 2519 { |
1634 | 2520 if (pPlayers[uActiveCharacter]->uLevel >= pMaxLevelPerTrainingHallType[(unsigned int)window_SpeakInHouse->ptr_1C - HOUSE_TRAINING_HALL_EMERALD_ISLE]) |
1625 | 2521 sprintfex(pShopOptions[index], "%s\n \n%s", 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." |
2522 else | |
1298 | 2523 { |
1625 | 2524 if (pPlayers[uActiveCharacter]->uExperience < v5) |
2525 sprintfex(pShopOptions[index], pGlobalTXT_LocalizationStrings[538], (uint)(v5 - pPlayers[uActiveCharacter]->uExperience), pPlayers[uActiveCharacter]->uLevel + 1); // "You need %d more experience to train to level %d" | |
2526 else | |
2527 sprintfex(pShopOptions[index], pGlobalTXT_LocalizationStrings[537], pPlayers[uActiveCharacter]->uLevel + 1, pPrice); // "Train to level %d for %d gold" | |
1298 | 2528 } |
2529 } | |
1625 | 2530 all_text_height += pFontArrus->CalcTextHeight(pShopOptions[index], &training_dialog_window, 0, 0); |
2531 ++index; | |
1298 | 2532 } |
2533 } | |
1625 | 2534 v49 = (2 * (87 - (174 - all_text_height) / 2) - all_text_height) / 2 - (174 - all_text_height) / 2 / 2 + 138; |
2535 if (pDialogueWindow->pStartingPosActiveItem < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton) | |
2536 { | |
2537 index = 0; | |
2538 for ( int i = pDialogueWindow->pStartingPosActiveItem; | |
2539 i < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton; ++i ) | |
2540 { | |
2541 pButton = pDialogueWindow->GetControl(i); | |
2542 pButton->uY = (174 - all_text_height) / 2 + v49; | |
2543 pTextHeight = pFontArrus->CalcTextHeight(pShopOptions[index], &training_dialog_window, 0, 0); | |
2544 pButton->uHeight = pTextHeight; | |
2545 pButton->uW = pTextHeight + pButton->uY - 1; | |
2546 v49 = pButton->uW; | |
2069 | 2547 pTextColor = Color16(0xE1u, 0xCDu, 0x23u); |
1634 | 2548 if ( pDialogueWindow->pCurrentPosActiveItem != i ) |
2069 | 2549 pTextColor = Color16(255, 255, 255); |
1625 | 2550 training_dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pTextColor, pShopOptions[index], 3); |
2551 ++index; | |
2552 } | |
2553 } | |
1298 | 2554 } |
1625 | 2555 } |
2556 //------------------------------------------------------------------ | |
2557 if ( dialog_menu_id == HOUSE_DIALOGUE_TRAININGHALL_TRAIN ) | |
2558 { | |
1393 | 2559 if ( !HouseUI_CheckIfPlayerCanInteract() ) |
1298 | 2560 { |
1625 | 2561 v33 = pFontArrus->CalcTextHeight(pNPCTopics[122].pText, &training_dialog_window, 0, 0); |
2069 | 2562 training_dialog_window.DrawTitleText(pFontArrus, 0, (212 - v33) / 2 + 101, Color16(0xE1u, 0xCDu, 0x23u), pNPCTopics[122].pText, 3); |
1298 | 2563 pDialogueWindow->pNumPresenceButton = 0; |
2564 return; | |
2565 } | |
1634 | 2566 if ( pPlayers[uActiveCharacter]->uLevel < pMaxLevelPerTrainingHallType[(unsigned int)window_SpeakInHouse->ptr_1C - HOUSE_TRAINING_HALL_EMERALD_ISLE] ) |
1298 | 2567 { |
2568 if ( (signed __int64)pPlayers[uActiveCharacter]->uExperience >= v5 ) | |
2569 { | |
1625 | 2570 if ( pParty->uNumGold >= pPrice) |
1298 | 2571 { |
1625 | 2572 Party::TakeGold(pPrice); |
1298 | 2573 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful); |
2574 ++pPlayers[uActiveCharacter]->uLevel; | |
2575 pPlayers[uActiveCharacter]->uSkillPoints += pPlayers[uActiveCharacter]->uLevel / 10 + 5; | |
2576 pPlayers[uActiveCharacter]->sHealth = pPlayers[uActiveCharacter]->GetMaxHealth(); | |
2577 pPlayers[uActiveCharacter]->sMana = pPlayers[uActiveCharacter]->GetMaxMana(); | |
2578 uint max_level_in_party = player_levels[0]; | |
2579 for (uint _it = 1; _it < 4; ++_it) | |
2580 { | |
2581 if (player_levels[_it] > max_level_in_party) | |
2582 max_level_in_party = player_levels[_it]; | |
2583 } | |
2584 ++player_levels[uActiveCharacter - 1]; | |
2585 if (player_levels[uActiveCharacter - 1] > max_level_in_party) // if we reach new maximum party level | |
2586 // feature is broken thou, since this array is always zeroed in EnterHouse | |
2587 { | |
1625 | 2588 v42 = 60 * (_494820_training_time(pParty->uCurrentHour) + 4) - pParty->uCurrentMinute; |
1298 | 2589 if ((unsigned int)window_SpeakInHouse->ptr_1C == HOUSE_TRAINING_HALL_94 || |
2590 (unsigned int)window_SpeakInHouse->ptr_1C == HOUSE_TRAINING_HALL_95) | |
2591 v42 += 720; | |
2592 RestAndHeal((signed int)(v42 + 10080)); | |
2593 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor ) | |
2594 pOutdoor->SetFog(); | |
2595 } | |
2596 pPlayers[uActiveCharacter]->PlaySound(SPEECH_87, 0); | |
2597 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[430], pPlayers[uActiveCharacter]->pName, pPlayers[uActiveCharacter]->uLevel, pPlayers[uActiveCharacter]->uLevel / 10 + 5);// | |
2598 // "%s is now Level %lu and has earned %lu Skill Points!" | |
2599 ShowStatusBarString(pTmpBuf.data(), 2); | |
2600 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
2601 return; | |
2602 } | |
2603 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);// "You don't have enough gold" | |
1625 | 2604 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)4); |
1298 | 2605 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); |
2606 return; | |
2607 } | |
1625 | 2608 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[538], (unsigned int)(v5 - pPlayers[uActiveCharacter]->uExperience), pPlayers[uActiveCharacter]->uLevel + 1);// |
1298 | 2609 // "You need %d more experience to train to level %d" |
1625 | 2610 v36 = (212 - pFontArrus->CalcTextHeight(pTmpBuf.data(), &training_dialog_window, 0, 0)) / 2 + 88; |
1298 | 2611 } |
2612 else | |
2613 { | |
2614 sprintf(pTmpBuf.data(), "%s\n \n%s", pGlobalTXT_LocalizationStrings[536], pGlobalTXT_LocalizationStrings[529]);// | |
2615 // ""With your skills, you should be working here as a teacher."" | |
2616 // ""Sorry, but we are unable to train you."" | |
1625 | 2617 v36 = (212 - pFontArrus->CalcTextHeight(pTmpBuf.data(), &training_dialog_window, 0, 0)) / 2 + 101; |
1298 | 2618 } |
2069 | 2619 training_dialog_window.DrawTitleText(pFontArrus, 0, v36, Color16(0xE1u, 0xCDu, 0x23u), pTmpBuf.data(), 3); |
1625 | 2620 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)3); |
2621 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
2622 return; | |
1298 | 2623 } |
1625 | 2624 } |
2625 //------------------------------------------------------------- | |
2626 if ( dialog_menu_id == HOUSE_DIALOGUE_LEARN_SKILLS ) | |
2627 { | |
1393 | 2628 if (HouseUI_CheckIfPlayerCanInteract()) |
1298 | 2629 { |
1625 | 2630 v14 = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0); |
1634 | 2631 pPrice = v14 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; |
2632 if ( pPrice < v14 / 3 ) | |
2633 pPrice = v14 / 3; | |
1625 | 2634 index = 0; |
1634 | 2635 for ( int i = pDialogueWindow->pStartingPosActiveItem; |
2636 (signed int)i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) | |
1625 | 2637 { |
1634 | 2638 if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][pDialogueWindow->GetControl(i)->msg_param - 36] |
2639 && !pPlayers[uActiveCharacter]->pActiveSkills[pDialogueWindow->GetControl(i)->msg_param - 36] ) | |
1625 | 2640 { |
1634 | 2641 all_text_height += pFontArrus->CalcTextHeight(pSkillNames[pDialogueWindow->GetControl(i)->msg_param - 36], &training_dialog_window, 0, 0); |
1625 | 2642 ++index; |
2643 } | |
2644 } | |
2645 if ( index ) | |
1298 | 2646 { |
1634 | 2647 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[401], pPrice);// "Skill Cost: %lu" |
1625 | 2648 training_dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3); |
2649 v73 = (signed int)(149 - all_text_height) / index; | |
2650 if ( v73 > 32 ) | |
2651 v73 = 32; | |
2652 v19 = (signed int)(149 - index * v73 - all_text_height) / 2 - v73 / 2 + 162; | |
1634 | 2653 for ( int i = pDialogueWindow->pStartingPosActiveItem; |
2654 (signed int)i < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton; ++i ) | |
1298 | 2655 { |
1634 | 2656 pButton = pDialogueWindow->GetControl(i); |
2657 if ( !byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][pButton->msg_param - 36] | |
2658 || pPlayers[uActiveCharacter]->pActiveSkills[pButton->msg_param - 36] ) | |
1298 | 2659 { |
1634 | 2660 pButton->uW = 0; |
2661 pButton->uHeight = 0; | |
2662 pButton->uY = 0; | |
1298 | 2663 } |
1634 | 2664 else |
2665 { | |
2666 pButton->uY = v73 + v19; | |
2667 pTextHeight = pFontArrus->CalcTextHeight(pSkillNames[pButton->msg_param - 36], &training_dialog_window, 0, 0); | |
2668 pButton->uHeight = pTextHeight; | |
2669 pButton->uW = pButton->uY + pTextHeight - 1; | |
2670 v19 = pButton->uY + pTextHeight - 1; | |
2069 | 2671 pTextColor = Color16(0xE1u, 0xCDu, 0x23u); |
1634 | 2672 if ( pDialogueWindow->pCurrentPosActiveItem != i ) |
2069 | 2673 pTextColor = Color16(255, 255, 255); |
1634 | 2674 training_dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pTextColor, pSkillNames[pButton->msg_param - 36], 3); |
2675 } | |
1298 | 2676 } |
2677 } | |
1625 | 2678 else |
1298 | 2679 { |
1625 | 2680 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]);// |
2681 // "Seek knowledge elsewhere %s the %s" | |
2682 strcat(pTmpBuf.data(), "\n \n"); | |
2683 strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]);// "I can offer you nothing further." | |
1634 | 2684 pTextHeight = pFontArrus->CalcTextHeight(pTmpBuf.data(), &training_dialog_window, 0, 0); |
2069 | 2685 training_dialog_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, Color16(0xE1u, 0xCDu, 0x23u), pTmpBuf.data(), 3); |
1298 | 2686 } |
2687 } | |
2688 } | |
1625 | 2689 return; |
1298 | 2690 } |
2691 | |
2692 //----- (004B6478) -------------------------------------------------------- | |
2693 void sub_4B6478() | |
1634 | 2694 { |
1298 | 2695 unsigned int v2; // eax@1 |
2696 signed int v3; // esi@1 | |
1634 | 2697 int pPrice; // ebx@1 |
1298 | 2698 unsigned int v5; // esi@5 |
2699 int v6; // edi@6 | |
2334 | 2700 // int result; // eax@13 |
1653 | 2701 int all_text_height; // eax@20 |
2334 | 2702 // int v13; // eax@21 |
1634 | 2703 GUIButton *pButton; // esi@27 |
2334 | 2704 // unsigned int v16; // eax@28 |
1634 | 2705 int pTextHeight; // eax@29 |
2706 unsigned __int16 pTextColor; // ax@29 | |
2334 | 2707 // unsigned __int16 v22; // ST14_2@36 |
1298 | 2708 int v27; // [sp-4h] [bp-80h]@8 |
1634 | 2709 GUIWindow dialog_window; // [sp+Ch] [bp-70h]@1 |
1298 | 2710 int v32; // [sp+6Ch] [bp-10h]@1 |
1653 | 2711 int index; // [sp+74h] [bp-8h]@17 |
1298 | 2712 |
1634 | 2713 memcpy(&dialog_window, window_SpeakInHouse, sizeof(dialog_window)); |
2714 dialog_window.uFrameX = 483; | |
2715 dialog_window.uFrameWidth = 148; | |
2716 dialog_window.uFrameZ = 334; | |
2717 v2 = 52 * (unsigned int)window_SpeakInHouse->ptr_1C; | |
2718 v32 = (unsigned __int8)(((p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType != 18) - 1) & 0x96) + 100; | |
2719 v3 = (signed __int64)((double)v32 * p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier); | |
2720 pPrice = v3 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; | |
2721 if ( pPrice < v3 / 3 ) | |
2722 pPrice = v3 / 3; | |
2723 if ( dialog_menu_id == HOUSE_DIALOGUE_MAIN) | |
1298 | 2724 { |
1634 | 2725 if ( !(unsigned __int16)_449B57_test_bit((unsigned __int8 *)pPlayers[uActiveCharacter]->_achieved_awards_bits, word_4F0754[2 * (unsigned int)window_SpeakInHouse->ptr_1C]) ) |
2726 { | |
2727 pTextHeight = pFontArrus->CalcTextHeight(pNPCTopics[171].pText, &dialog_window, 0, 0);// | |
2069 | 2728 dialog_window.DrawTitleText(pFontArrus, 0, (212 - pTextHeight) / 2 + 101, Color16(0xFFu, 0xFFu, 0x9Bu), pNPCTopics[171].pText, 3); |
1634 | 2729 pDialogueWindow->pNumPresenceButton = 0; |
1636 | 2730 return; |
1634 | 2731 } |
2732 if ( !HouseUI_CheckIfPlayerCanInteract() ) | |
2733 return; | |
1653 | 2734 all_text_height = 0; |
2735 index = 0; | |
1634 | 2736 for ( int i = pDialogueWindow->pStartingPosActiveItem; |
2737 i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) | |
2738 { | |
2739 if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType / 3][pDialogueWindow->GetControl(i)->msg_param - 36] | |
2740 && !pPlayers[uActiveCharacter]->pActiveSkills[pDialogueWindow->GetControl(i)->msg_param - 36] ) | |
2741 { | |
1653 | 2742 all_text_height += pFontArrus->CalcTextHeight(pSkillNames[pDialogueWindow->GetControl(i)->msg_param - 36], &dialog_window, 0, 0); |
2743 ++index; | |
1634 | 2744 } |
2745 } | |
1653 | 2746 if ( !index ) |
1298 | 2747 { |
1634 | 2748 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]); |
2749 strcat(pTmpBuf.data(), "\n \n"); | |
2750 strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]);//Больше ничего не могу предложить. | |
2751 pTextHeight = pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 0, 0); | |
2069 | 2752 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, Color16(0xFFu, 0xFFu, 0x9Bu), pTmpBuf.data(), 3); |
1634 | 2753 return; |
2754 } | |
2755 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[401], pPrice);//Стоимость навыка: %lu | |
2756 dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3); | |
1653 | 2757 v32 = (149 - all_text_height) / index; |
2758 if ( v32 > 32 ) | |
1634 | 2759 v32 = 32; |
1653 | 2760 index = (149 - index * v32 - all_text_height) / 2 - v32 / 2 + 162; |
1634 | 2761 if ( pDialogueWindow->pStartingPosActiveItem < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton ) |
2762 { | |
2763 for ( int i = pDialogueWindow->pStartingPosActiveItem; | |
2764 i <pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) | |
1298 | 2765 { |
1634 | 2766 pButton = pDialogueWindow->GetControl(i); |
2767 if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType / 3][pButton->msg_param - 36] ) | |
1298 | 2768 { |
1634 | 2769 if ( !pPlayers[uActiveCharacter]->pActiveSkills[pButton->msg_param - 36] ) |
2770 { | |
1653 | 2771 pButton->uY = v32 + index; |
1634 | 2772 pTextHeight = pFontArrus->CalcTextHeight(pSkillNames[pButton->msg_param - 36], &dialog_window, 0, 0); |
2773 pButton->uHeight = pTextHeight; | |
2774 pButton->uW = pButton->uY + pTextHeight - 1; | |
1653 | 2775 index = pButton->uY + pTextHeight - 1; |
2069 | 2776 pTextColor = Color16(0xFFu, 0xFFu, 0x9Bu); |
1634 | 2777 if ( pDialogueWindow->pCurrentPosActiveItem != i ) |
2069 | 2778 pTextColor = Color16(0xFFu, 0xFFu, 0xFFu); |
1634 | 2779 dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pTextColor, pSkillNames[pButton->msg_param - 36], 3); |
2780 } | |
1298 | 2781 } |
2782 else | |
2783 { | |
1634 | 2784 pButton->uW = 0; |
2785 pButton->uHeight = 0; | |
2786 pButton->uY = 0; | |
1298 | 2787 } |
2788 } | |
2789 } | |
1634 | 2790 return; |
2791 } | |
2792 | |
2793 if ( HouseUI_CheckIfPlayerCanInteract() ) | |
2794 { | |
2795 v5 = 0; | |
2796 __debugbreak(); | |
2797 //pSkillAvailabilityPerClass[8 + v58->uClass][4 + v23] | |
2798 // or | |
2799 //byte_4ED970_skill_learn_ability_by_class_table[v58->uClass][v23 - 36] | |
2800 // or | |
2801 //byte_4ED970_skill_learn_ability_by_class_table[v58->uClass - 1][v23 + 1] | |
2802 __debugbreak(); // whacky condition - fix | |
2803 if (false | |
2804 //if ( !*(&byte_4ED94C[37 * v1->uClass / 3] + dword_F8B19C) | |
2805 || (v6 = (int)(&pPlayers[uActiveCharacter]->uIntelligence + dialog_menu_id), *(short *)v6) ) | |
2806 { | |
1754 | 2807 pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0); |
1634 | 2808 } |
1298 | 2809 else |
2810 { | |
1634 | 2811 if ( pParty->uNumGold < pPrice ) |
1298 | 2812 { |
1634 | 2813 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);//У вас не хватает золота |
2814 v27 = 4; | |
1298 | 2815 } |
2816 else | |
2817 { | |
1634 | 2818 Party::TakeGold(pPrice); |
2819 *(short *)v6 = 1; | |
2820 v27 = 2; | |
1298 | 2821 } |
1634 | 2822 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)v27); |
1298 | 2823 } |
2824 } | |
1634 | 2825 else |
2826 { | |
2827 v5 = 0; | |
2828 } | |
2829 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, v5); | |
2830 return; // void func | |
1298 | 2831 } |
2832 | |
2833 //----- (004B2A74) -------------------------------------------------------- | |
1634 | 2834 void SimpleHouseDialog() |
1298 | 2835 { |
1580 | 2836 NPCData *pNPC; // esi@6 |
1298 | 2837 char *v15; // esi@14 |
1580 | 2838 GUIButton *pButton; // eax@15 |
1298 | 2839 char *v29; // esi@42 |
2840 int v31; // ST1C_4@42 | |
1653 | 2841 int index; // esi@51 |
2842 int v36; | |
2843 signed int all_text_height; // ecx@54 | |
1298 | 2844 int v40; // edi@57 |
1653 | 2845 unsigned __int16 pTextColor; // ax@60 |
2846 GUIFont *pTextFont; // ebx@64 | |
2847 int pTextHeight; | |
1298 | 2848 GUIWindow w; // [sp+Ch] [bp-110h]@64 |
1636 | 2849 GUIWindow right_panel_window; // [sp+60h] [bp-BCh]@13 |
1580 | 2850 GUIWindow house_window; // [sp+B4h] [bp-68h]@1 |
1298 | 2851 char *pInString; // [sp+114h] [bp-8h]@12 |
2852 | |
1580 | 2853 memcpy(&house_window, pDialogueWindow, sizeof(house_window)); |
1298 | 2854 if ( pDialogueNPCCount == uNumDialogueNPCPortraits && uHouse_ExitPic ) |
2855 { | |
1580 | 2856 house_window.uFrameX = 493; |
2857 house_window.uFrameWidth = 126; | |
2858 house_window.uFrameZ = 366; | |
2859 house_window.DrawTitleText(pFontCreate, 0, 2, 0, pMapStats->pInfos[uHouse_ExitPic].pName, 3); | |
2860 house_window.uFrameX = 483; | |
2861 house_window.uFrameWidth = 148; | |
2862 house_window.uFrameZ = 334; | |
1653 | 2863 if ( !pTransitionStrings[uHouse_ExitPic] ) |
1298 | 2864 { |
1580 | 2865 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[411], pMapStats->pInfos[uHouse_ExitPic].pName);//Войти в ^Pv[%s] |
1653 | 2866 house_window.DrawTitleText(pFontCreate, 0, (212 - pFontCreate->CalcTextHeight(pTmpBuf.data(), &house_window, 0, 0)) / 2 + 101, 0, pTmpBuf.data(), 3); |
2867 return; | |
1298 | 2868 } |
1653 | 2869 house_window.DrawTitleText(pFontCreate, 0, |
2870 (212 - pFontCreate->CalcTextHeight(pTransitionStrings[uHouse_ExitPic], &house_window, 0, 0)) / 2 + 101, 0, pTransitionStrings[uHouse_ExitPic], 3); | |
1298 | 2871 return; |
2872 } | |
1580 | 2873 house_window.uFrameWidth -= 10; |
2874 house_window.uFrameZ -= 10; | |
2875 pNPC = HouseNPCData[(unsigned int)((char *)pDialogueNPCCount + -(dword_591080 != 0) )];//- 1 | |
2876 if ( pNPC->uProfession ) | |
2877 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[429], pNPC->pName, aNPCProfessionNames[pNPC->uProfession]);//^Pi[%s] %s | |
1298 | 2878 else |
1580 | 2879 strcpy(pTmpBuf.data(), pNPC->pName); |
2069 | 2880 house_window.DrawTitleText(pFontCreate, 483, 113, Color16(0x15u, 0x99u, 0xE9u), pTmpBuf.data(), 3); |
1298 | 2881 if ( !dword_591080 ) |
2882 { | |
2883 if ( !uDialogueType ) | |
2884 { | |
1580 | 2885 if ( pNPC->greet ) |
1298 | 2886 { |
1580 | 2887 house_window.uFrameWidth = game_viewport_width; |
2888 house_window.uFrameZ = 452; | |
1655 | 2889 pInString = pNPCStats->pNPCGreetings[pNPC->greet].pGreetings[((pNPC->uFlags & 3) == 2)]; |
1653 | 2890 //pInString = (char *)*(&pNPCStats->field_17884 + ((pNPC->uFlags & 3) == 2) + 2 * pNPC->greet); |
1580 | 2891 pRenderer->GetLeather(8, 352 - (pFontArrus->CalcTextHeight(pInString, &house_window, 13, 0) + 7), |
2892 pIcons_LOD->GetTexture(uTextureID_Leather), pIcons_LOD->GetTexture(uTextureID_Leather)->uTextureHeight | |
2893 - (pFontArrus->CalcTextHeight(pInString, &house_window, 13, 0) + 7)); | |
2894 pRenderer->DrawTextureIndexed(8, 347 - (pFontArrus->CalcTextHeight(pInString, &house_window, 13, 0) + 7), pTexture_591428); | |
2895 pDialogueWindow->DrawText(pFontArrus, 13, 354 - (pFontArrus->CalcTextHeight(pInString, &house_window, 13, 0) + 7), | |
2896 0, FitTextInAWindow(pInString, pFontArrus, &house_window, 0xDu, 0), 0, 0, 0); | |
1298 | 2897 } |
2898 } | |
2899 } | |
1636 | 2900 //for right panel |
2901 memcpy(&right_panel_window, pDialogueWindow, sizeof(right_panel_window)); | |
2902 right_panel_window.uFrameX = 483; | |
2903 right_panel_window.uFrameWidth = 148; | |
2904 right_panel_window.uFrameZ = 334; | |
2905 for ( int i = right_panel_window.pStartingPosActiveItem; | |
2906 i < right_panel_window.pStartingPosActiveItem + right_panel_window.pNumPresenceButton; ++i ) | |
1298 | 2907 { |
1636 | 2908 pButton = right_panel_window.GetControl(i); |
2909 switch ( pButton->msg_param ) | |
1298 | 2910 { |
1636 | 2911 case 19://evt_A |
1661 | 2912 v15 = (char *)pNPCTopics[pNPC->evt_A].pTopic; |
1636 | 2913 if ( !v15 ) |
1298 | 2914 { |
1636 | 2915 pButton->msg_param = 0; |
2916 v15 = ""; | |
1298 | 2917 } |
1636 | 2918 strcpy(pButton->pButtonName, v15); |
2919 continue; | |
2920 case 20://evt_B | |
1661 | 2921 v15 = (char *)pNPCTopics[pNPC->evt_B].pTopic; |
1636 | 2922 if ( !v15 ) |
1298 | 2923 { |
1636 | 2924 pButton->msg_param = 0; |
2925 v15 = ""; | |
2926 } | |
1653 | 2927 if ( uDialogueType != 84 ) |
1636 | 2928 { |
1653 | 2929 strcpy(pButton->pButtonName, v15); |
1636 | 2930 continue; |
2931 } | |
2069 | 2932 sprintf(pTmpBuf.data(), format_4E2D80, Color16(0xE1u, 0xCDu, 0x23u), pItemsTable->pItems[contract_approved].pUnidentifiedName); |
1653 | 2933 sprintf(pTmpBuf2.data(), current_npc_text, pTmpBuf.data()); |
2934 current_npc_text = pTmpBuf2.data(); | |
2935 strcpy(pButton->pButtonName, v15); | |
2936 continue; | |
2937 case 21://evt_C | |
1661 | 2938 v15 = (char *)pNPCTopics[pNPC->evt_C].pTopic; |
1653 | 2939 if ( !v15 ) |
1636 | 2940 { |
1653 | 2941 pButton->msg_param = 0; |
2942 v15 = ""; | |
2943 } | |
2944 strcpy(pButton->pButtonName, v15); | |
2945 continue; | |
2946 case 22://evt_D | |
1661 | 2947 v15 = (char *)pNPCTopics[pNPC->evt_D].pTopic; |
1653 | 2948 if ( !v15 ) |
2949 { | |
2950 pButton->msg_param = 0; | |
2951 v15 = ""; | |
2952 } | |
2953 strcpy(pButton->pButtonName, v15); | |
2954 continue; | |
2955 case 23://evt_E | |
1661 | 2956 v15 = (char *)pNPCTopics[pNPC->evt_E].pTopic; |
1653 | 2957 if ( !v15 ) |
2958 { | |
2959 pButton->msg_param = 0; | |
2960 v15 = ""; | |
1298 | 2961 } |
1653 | 2962 strcpy(pButton->pButtonName, v15); |
2963 continue; | |
2964 case 24://evt_F | |
1661 | 2965 v15 = (char *)pNPCTopics[pNPC->evt_F].pTopic; |
1653 | 2966 if ( !v15 ) |
1636 | 2967 { |
1653 | 2968 pButton->msg_param = 0; |
2969 v15 = ""; | |
1636 | 2970 } |
1653 | 2971 strcpy(pButton->pButtonName, v15); |
2972 continue; | |
2973 case 76: | |
2974 strcpy(pButton->pButtonName, pGlobalTXT_LocalizationStrings[406]);//Нанять | |
2975 continue; | |
2976 case 77: | |
2977 strcpy(pButton->pButtonName, pGlobalTXT_LocalizationStrings[407]);//Подробнее | |
2978 continue; | |
2979 case 79: | |
2980 strcpy(pButton->pButtonName, _4B254D_SkillMasteryTeacher((int)right_panel_window.ptr_1C)); | |
2981 continue; | |
2982 case 82: | |
2983 strcpy(pButton->pButtonName, ContractSelectText((int)right_panel_window.ptr_1C)); | |
2984 continue; | |
2985 case 83: | |
2986 v29 = pMonsterStats->pInfos[bountyHunting_monster_id_for_hunting].pName; | |
2987 v31 = *(int *)v29; | |
2069 | 2988 sprintfex(pTmpBuf.data(), "\f%05d%s\f%05d", Color16(0xFFu, 0xFFu, 0x9Bu), v31, Color16(0xFFu, 0xFFu, 0xFFu)); |
1653 | 2989 sprintfex(pTmpBuf2.data(), bountyHunting_text, pTmpBuf.data(), 100 * (unsigned __int8)v29[8]); |
2990 current_npc_text = pTmpBuf2.data(); | |
2991 strcpy(pButton->pButtonName, ""); | |
2992 continue; | |
1298 | 2993 } |
1653 | 2994 if ( pButton->msg_param > 0 && pButton->msg_param < 13 ) |
2995 { | |
2996 strcpy(pButton->pButtonName, pGlobalTXT_LocalizationStrings[122]);//Вступить | |
2997 continue; | |
2998 } | |
2999 if ( pButton->msg_param > 13 && pButton->msg_param < 19 ) | |
3000 { | |
3001 strcpy(pButton->pButtonName, ""); | |
3002 continue; | |
3003 } | |
3004 if ( pButton->msg_param != 93 ) | |
3005 { | |
3006 strcpy(pButton->pButtonName, ""); | |
3007 continue; | |
3008 } | |
1298 | 3009 } |
1653 | 3010 index = 0; |
3011 all_text_height = 0; | |
3012 for ( int i = pDialogueWindow->pStartingPosActiveItem; | |
3013 i < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton; ++i ) | |
1298 | 3014 { |
1653 | 3015 pButton = pDialogueWindow->GetControl(i); |
3016 all_text_height += pFontArrus->CalcTextHeight(pButton->pButtonName, &right_panel_window, 0, 0); | |
3017 index++; | |
3018 } | |
3019 if ( index ) | |
3020 { | |
3021 v36 = (174 - all_text_height) / index; | |
3022 if ( v36 > 32 ) | |
3023 v36 = 32; | |
3024 v40 = (174 - v36 * index - all_text_height) / 2 - v36 / 2 + 138; | |
3025 for ( int i = pDialogueWindow->pStartingPosActiveItem; i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) | |
1298 | 3026 { |
1606 | 3027 pButton = pDialogueWindow->GetControl(i); |
1653 | 3028 pButton->uY = v36 + v40; |
3029 pTextHeight = pFontArrus->CalcTextHeight(pButton->pButtonName, &right_panel_window, 0, 0); | |
3030 pButton->uHeight = pTextHeight; | |
3031 v40 = pButton->uY + pTextHeight - 1; | |
1606 | 3032 pButton->uW = v40; |
2069 | 3033 pTextColor = Color16(0xE1u, 0xCDu, 0x23u); |
1653 | 3034 if ( pDialogueWindow->pCurrentPosActiveItem != i ) |
2069 | 3035 pTextColor = Color16(0xFFu, 0xFFu, 0xFFu); |
1653 | 3036 right_panel_window.DrawTitleText(pFontArrus, 0, pButton->uY, pTextColor, pButton->pButtonName, 3); |
1298 | 3037 } |
3038 } | |
3039 if ( current_npc_text ) | |
3040 { | |
3041 w.uFrameWidth = 458; | |
3042 w.uFrameZ = 457; | |
1653 | 3043 pTextFont = pFontArrus; |
3044 pTextHeight = pFontArrus->CalcTextHeight(current_npc_text, &w, 13, 0) + 7; | |
3045 if ( 352 - pTextHeight < 8 ) | |
1298 | 3046 { |
1653 | 3047 pTextFont = pFontCreate; |
3048 pTextHeight = pFontCreate->CalcTextHeight(current_npc_text, &w, 13, 0) + 7; | |
1298 | 3049 } |
1653 | 3050 pRenderer->GetLeather(8, 352 - pTextHeight, pIcons_LOD->GetTexture(uTextureID_Leather), pIcons_LOD->GetTexture(uTextureID_Leather)->uTextureHeight - pTextHeight); |
3051 pRenderer->DrawTextureIndexed(8, 347 - pTextHeight, pTexture_591428); | |
3052 house_window.DrawText(pTextFont, 13, 354 - pTextHeight, 0, FitTextInAWindow(current_npc_text, pTextFont, &w, 13, 0), 0, 0, 0); | |
1298 | 3053 } |
3054 } | |
1434 | 3055 |
1300 | 3056 //----- (004B4F4F) -------------------------------------------------------- |
3057 void JailDialog() | |
1298 | 3058 { |
1608 | 3059 GUIWindow jail_dialogue_window; // [sp+8h] [bp-54h]@1 |
1298 | 3060 |
1608 | 3061 memcpy(&jail_dialogue_window, window_SpeakInHouse, sizeof(jail_dialogue_window)); |
3062 jail_dialogue_window.uFrameX = 483; | |
3063 jail_dialogue_window.uFrameWidth = 148; | |
3064 jail_dialogue_window.uFrameZ = 334; | |
3065 jail_dialogue_window.DrawTitleText(pFontArrus, 0, (310 - pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[672], &jail_dialogue_window, 0, 0)) / 2 + 18, | |
2069 | 3066 Color16(0xFFu, 0xFFu, 0x9Bu), pGlobalTXT_LocalizationStrings[672], 3);//"За многочисленные преступления и злодеяния вы были приговорены к одному году заключения." |
1298 | 3067 } |