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