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