Mercurial > mm7
annotate GUI/UI/UiGame.cpp @ 2575:a76d408c5132 tip
DrawTranslucent -> DrawTextureGrayShade
Removed old texture drawing stuff
author | a.parshin |
---|---|
date | Wed, 09 Mar 2016 01:39:52 +0200 |
parents | dd36326a9994 |
children |
rev | line source |
---|---|
2501 | 1 #define _CRTDBG_MAP_ALLOC |
2546 | 2 #define _CRT_SECURE_NO_WARNINGS |
2501 | 3 #include <stdlib.h> |
4 #include <crtdbg.h> | |
5 | |
2541 | 6 #include "Engine/Engine.h" |
2574 | 7 #include "Engine/AssetsManager.h" |
2546 | 8 #include "Engine/Events.h" |
9 #include "Engine/Graphics/Texture.h" | |
10 #include "Engine/Graphics/Vis.h" | |
11 #include "Engine/MapInfo.h" | |
12 #include "Engine/Party.h" | |
13 #include "Engine/Graphics/Outdoor.h" | |
14 #include "Engine/LOD.h" | |
15 #include "Engine/Objects/Actor.h" | |
16 #include "Engine/Graphics/Viewport.h" | |
17 #include "Engine/Objects/SpriteObject.h" | |
18 #include "Engine/Objects/ObjectList.h" | |
19 #include "Engine/Graphics/DecorationList.h" | |
20 #include "Engine/Tables/PlayerFrameTable.h" | |
21 #include "Engine/stru123.h" | |
22 #include "Engine/Timer.h" | |
23 #include "Engine/Tables/IconFrameTable.h" | |
24 #include "Engine/TurnEngine/TurnEngine.h" | |
25 #include "Engine/texts.h" | |
26 #include "Engine/Graphics/Sprites.h" | |
27 #include "Engine/Graphics/PaletteManager.h" | |
28 #include "Engine/Graphics/BSPModel.h" | |
29 #include "Engine/OurMath.h" | |
30 #include "Engine/Graphics/Level/Decoration.h" | |
31 #include "Engine/Objects/Chest.h" | |
32 #include "Engine/Graphics/Overlays.h" | |
2501 | 33 |
2572
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2566
diff
changeset
|
34 #include "Game/Game.h" |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2566
diff
changeset
|
35 |
2546 | 36 #include "IO/Mouse.h" |
37 #include "IO/Keyboard.h" | |
2501 | 38 |
2546 | 39 #include "GUI/GUIWindow.h" |
40 #include "GUI/GUIFont.h" | |
41 #include "GUI/UI/UIHouses.h" | |
42 #include "GUI/UI/UIGame.h" | |
2547 | 43 #include "GUI/UI/UICharacter.h" |
2501 | 44 |
2546 | 45 #include "Media/Audio/AudioPlayer.h" |
2501 | 46 |
2546 | 47 |
2572
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2566
diff
changeset
|
48 Image *game_ui_statusbar = nullptr; |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2566
diff
changeset
|
49 Image *game_ui_rightframe = nullptr; |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2566
diff
changeset
|
50 Image *game_ui_topframe = nullptr; |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2566
diff
changeset
|
51 Image *game_ui_leftframe = nullptr; |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2566
diff
changeset
|
52 Image *game_ui_bottomframe = nullptr; |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2566
diff
changeset
|
53 |
2574 | 54 Image *game_ui_monster_hp_green = nullptr; |
55 Image *game_ui_monster_hp_yellow = nullptr; | |
56 Image *game_ui_monster_hp_red = nullptr; | |
57 Image *game_ui_monster_hp_background = nullptr; | |
58 Image *game_ui_monster_hp_border_left = nullptr; | |
59 Image *game_ui_monster_hp_border_right = nullptr; | |
60 | |
61 Image *game_ui_minimap_frame = nullptr; // 5079D8 | |
62 Image *game_ui_minimap_compass = nullptr; // 5079B4 | |
63 std::array<Image *, 8> game_ui_minimap_dirs; | |
64 | |
65 Image *game_ui_menu_quit = nullptr; | |
66 Image *game_ui_menu_resume = nullptr; | |
67 Image *game_ui_menu_controls = nullptr; | |
68 Image *game_ui_menu_save = nullptr; | |
69 Image *game_ui_menu_load = nullptr; | |
70 Image *game_ui_menu_new = nullptr; | |
71 Image *game_ui_menu_options = nullptr; | |
72 | |
73 Image *game_ui_tome_storyline = nullptr; | |
74 Image *game_ui_tome_calendar = nullptr; | |
75 Image *game_ui_tome_maps = nullptr; | |
76 Image *game_ui_tome_autonotes = nullptr; | |
77 Image *game_ui_tome_quests = nullptr; | |
78 | |
79 Image *game_ui_btn_rest = nullptr; | |
80 Image *game_ui_btn_cast = nullptr; | |
81 Image *game_ui_btn_zoomin = nullptr; | |
82 Image *game_ui_btn_zoomout = nullptr; | |
83 Image *game_ui_btn_quickref = nullptr; | |
84 Image *game_ui_btn_settings = nullptr; | |
85 | |
86 Image *game_ui_dialogue_background = nullptr; | |
87 | |
88 Image *game_ui_menu_options_video_background = nullptr; | |
89 Image *game_ui_menu_options_video_bloodsplats = nullptr; | |
90 Image *game_ui_menu_options_video_coloredlights = nullptr; | |
91 Image *game_ui_menu_options_video_tinting = nullptr; | |
92 std::array<Image *, 10> game_ui_menu_options_video_gamma_positions; | |
93 std::array<Image *, 5> game_ui_options_controls; | |
94 | |
95 Image *game_ui_evtnpc = nullptr; // 50795C | |
96 | |
2575 | 97 std::array< std::array<Image *, 56>, 4> game_ui_player_faces; |
98 Image *game_ui_player_face_eradicated = nullptr; | |
99 Image *game_ui_player_face_dead = nullptr; | |
100 | |
101 Image *game_ui_player_selection_frame = nullptr; // 50C98C | |
102 Image *game_ui_player_alert_yellow = nullptr; // 5079C8 | |
103 Image *game_ui_player_alert_red = nullptr; // 5079CC | |
104 Image *game_ui_player_alert_green = nullptr; // 5079D0 | |
105 | |
106 Image *game_ui_bar_red = nullptr; | |
107 Image *game_ui_bar_yellow = nullptr; | |
108 Image *game_ui_bar_green = nullptr; | |
109 Image *game_ui_bar_blue = nullptr; | |
110 | |
111 Image *game_ui_playerbuff_pain_reflection = nullptr; | |
112 Image *game_ui_playerbuff_hammerhands = nullptr; | |
113 Image *game_ui_playerbuff_preservation = nullptr; | |
114 Image *game_ui_playerbuff_bless = nullptr; | |
2572
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2566
diff
changeset
|
115 |
2546 | 116 GUIWindow_GameMenu::GUIWindow_GameMenu() : |
117 GUIWindow(0, 0, window->GetWidth(), window->GetHeight(), 0, nullptr) | |
118 { | |
119 // ----------------------- | |
120 // GameMenuUI_Load -- part | |
2574 | 121 game_ui_menu_options = assets->GetImage_16BitAlpha(L"options"); |
122 game_ui_menu_new = assets->GetImage_16BitAlpha(L"new1"); | |
123 game_ui_menu_load = assets->GetImage_16BitAlpha(L"load1"); | |
124 game_ui_menu_save = assets->GetImage_16BitAlpha(L"save1"); | |
125 game_ui_menu_controls = assets->GetImage_16BitAlpha(L"controls1"); | |
126 game_ui_menu_resume = assets->GetImage_16BitAlpha(L"resume1"); | |
127 game_ui_menu_quit = assets->GetImage_16BitAlpha(L"quit1"); | |
2546 | 128 |
129 pBtn_NewGame = CreateButton( | |
130 0x13u, 0x9Bu, 0xD6u, 0x28u, 1, 0, UIMSG_StartNewGame, 0, 0x4Eu, | |
131 pGlobalTXT_LocalizationStrings[614],// "New Game" | |
2574 | 132 game_ui_menu_new, |
2546 | 133 0 |
134 ); | |
135 pBtn_SaveGame = CreateButton( | |
136 0x13u, 0xD1u, 0xD6u, 0x28u, 1, 0, UIMSG_Game_OpenSaveGameDialog, 0, 0x53u, | |
137 pGlobalTXT_LocalizationStrings[615],// "Save Game" | |
2574 | 138 game_ui_menu_save, |
2546 | 139 0 |
140 ); | |
141 pBtn_LoadGame = CreateButton( | |
142 19, 263, 0xD6u, 0x28u, 1, 0, UIMSG_Game_OpenLoadGameDialog, 0, 0x4Cu, | |
143 pGlobalTXT_LocalizationStrings[616],// "Load Game" | |
2574 | 144 game_ui_menu_load, |
2546 | 145 0 |
146 ); | |
147 pBtn_GameControls = CreateButton( | |
148 241, 155, 214, 40, 1, 0, UIMSG_Game_OpenOptionsDialog, 0, 0x43u, | |
149 pGlobalTXT_LocalizationStrings[617],// ""Sound, Keyboard, Game Options:"" | |
2574 | 150 game_ui_menu_controls, |
2546 | 151 0 |
152 ); | |
153 pBtn_QuitGame = CreateButton( | |
154 241, 209, 214, 40, 1, 0, UIMSG_Quit, 0, 0x51u, | |
155 pGlobalTXT_LocalizationStrings[618],// "Quit" | |
2574 | 156 game_ui_menu_quit, |
2546 | 157 0 |
158 ); | |
159 pBtn_Resume = CreateButton( | |
160 241, 263, 214, 40, 1, 0, UIMSG_GameMenu_ReturnToGame, 0, 0x52u, | |
161 pGlobalTXT_LocalizationStrings[619],// "Return to Game" | |
2574 | 162 game_ui_menu_resume, |
2546 | 163 0 |
164 ); | |
165 _41D08F_set_keyboard_control_group(6, 1, 0, 0); | |
166 } | |
167 | |
168 void GUIWindow_GameMenu::Update() | |
169 { | |
170 // ----------------------------------- | |
171 // 004156F0 GUI_UpdateWindows --- part | |
2574 | 172 pRenderer->DrawTextureAlphaNew( |
173 pViewport->uViewportTL_X/640.0f, | |
174 pViewport->uViewportTL_Y/480.0f, | |
175 game_ui_menu_options | |
2546 | 176 ); |
2574 | 177 |
178 viewparams->bRedrawGameUI = true; | |
2546 | 179 } |
180 | |
181 | |
182 | |
183 | |
184 | |
185 | |
186 std::array<bool, 28> GameMenuUI_InvaligKeyBindingsFlags; // 506E6C | |
187 //----- (00414D24) -------------------------------------------------------- | |
188 static unsigned int GameMenuUI_GetKeyBindingColor(int key_index) | |
189 { | |
190 if (uGameMenuUI_CurentlySelectedKeyIdx == key_index) | |
191 { | |
192 if (GetTickCount() % 1000 < 500) | |
193 return ui_gamemenu_keys_key_selection_blink_color_1; | |
194 else | |
195 return ui_gamemenu_keys_key_selection_blink_color_2; | |
196 } | |
197 else if (GameMenuUI_InvaligKeyBindingsFlags[key_index]) | |
198 { | |
199 int intensity; | |
200 | |
201 int time = GetTickCount() % 800; | |
202 if (time < 400) | |
203 intensity = -70 + 70 * time / 400; | |
204 else | |
205 intensity = +70 - 70 * time / 800; | |
206 | |
207 return Color16(185 + intensity, 40 + intensity / 4, 40 + intensity / 4); | |
208 } | |
209 | |
210 return ui_gamemenu_keys_key_default_color; | |
211 } | |
212 | |
213 | |
214 | |
215 GUIWindow_GameKeyBindings::GUIWindow_GameKeyBindings(): | |
216 GUIWindow(0, 0, window->GetWidth(), window->GetHeight(), 0, nullptr) | |
217 { | |
218 // ------------------------------------------ | |
219 // GameMenuUI_OptionsKeymapping_Load --- part | |
2574 | 220 game_ui_options_controls[0] = assets->GetImage_16BitColorKey(L"optkb", 0x7FF); |
221 game_ui_options_controls[1] = assets->GetImage_16BitColorKey(L"optkb_h", 0x7FF); | |
222 game_ui_options_controls[2] = assets->GetImage_16BitColorKey(L"resume1", 0x7FF); | |
223 game_ui_options_controls[3] = assets->GetImage_16BitColorKey(L"optkb_1", 0x7FF); | |
224 game_ui_options_controls[4] = assets->GetImage_16BitColorKey(L"optkb_2", 0x7FF); | |
2546 | 225 |
226 CreateButton(241, 302, 214, 40, 1, 0, UIMSG_Escape, 0, 0, "", 0); | |
227 | |
228 CreateButton(19, 302, 108, 20, 1, 0, UIMSG_SelectKeyPage1, 0, 0, "", 0); | |
229 CreateButton(127, 302, 108, 20, 1, 0, UIMSG_SelectKeyPage2, 0, 0, "", 0); | |
230 CreateButton(127, 324, 108, 20, 1, 0, UIMSG_ResetKeyMapping, 0, 0, "", 0); | |
231 CreateButton(19, 324, 108, 20, 1, 0, UIMSG_Game_OpenOptionsDialog, 0, 0, "", 0); | |
232 | |
233 CreateButton(129, 148, 70, 19, 1, 0, UIMSG_ChangeKeyButton, 0, 0, "", 0); | |
234 CreateButton(129, 167, 70, 19, 1, 0, UIMSG_ChangeKeyButton, 1, 0, "", 0); | |
235 CreateButton(129, 186, 70, 19, 1, 0, UIMSG_ChangeKeyButton, 2, 0, "", 0); | |
236 CreateButton(129, 205, 70, 19, 1, 0, UIMSG_ChangeKeyButton, 3, 0, "", 0); | |
237 CreateButton(129, 224, 70, 19, 1, 0, UIMSG_ChangeKeyButton, 4, 0, "", 0); | |
238 CreateButton(129, 243, 70, 19, 1, 0, UIMSG_ChangeKeyButton, 5, 0, "", 0); | |
239 CreateButton(129, 262, 70, 19, 1, 0, UIMSG_ChangeKeyButton, 6, 0, "", 0); | |
240 | |
241 CreateButton(350, 148, 70, 19, 1, 0, UIMSG_ChangeKeyButton, 7, 0, "", 0); | |
242 CreateButton(350, 167, 70, 19, 1, 0, UIMSG_ChangeKeyButton, 8, 0, "", 0); | |
243 CreateButton(350, 186, 70, 19, 1, 0, UIMSG_ChangeKeyButton, 9, 0, "", 0); | |
244 CreateButton(350, 205, 70, 19, 1, 0, UIMSG_ChangeKeyButton, 10, 0, "", 0); | |
245 CreateButton(350, 224, 70, 19, 1, 0, UIMSG_ChangeKeyButton, 11, 0, "", 0); | |
246 CreateButton(350, 243, 70, 19, 1, 0, UIMSG_ChangeKeyButton, 12, 0, "", 0); | |
247 CreateButton(350, 262, 70, 19, 1, 0, UIMSG_ChangeKeyButton, 13, 0, "", 0); | |
248 | |
249 uGameMenuUI_CurentlySelectedKeyIdx = -1; | |
250 KeyboardPageNum = 1; | |
251 memset(GameMenuUI_InvaligKeyBindingsFlags.data(), 0, sizeof(GameMenuUI_InvaligKeyBindingsFlags)); | |
252 memcpy(pPrevVirtualCidesMapping.data(), pKeyActionMap->pVirtualKeyCodesMapping, 0x78u); | |
253 } | |
254 | |
255 //----- (004142D3) -------------------------------------------------------- | |
256 void GUIWindow_GameKeyBindings::Update() | |
257 { | |
258 // ----------------------------------- | |
259 // 004156F0 GUI_UpdateWindows --- part | |
260 signed int v4; // ecx@7 | |
261 signed int v5; // eax@8 | |
262 | |
263 if (pGUIWindow_CurrentMenu->receives_keyboard_input_2 == WINDOW_INPUT_CONFIRMED) | |
264 { | |
265 pPrevVirtualCidesMapping[uGameMenuUI_CurentlySelectedKeyIdx] = pKeyActionMap->pPressedKeysBuffer[0]; | |
266 memset(GameMenuUI_InvaligKeyBindingsFlags.data(), 0, sizeof(GameMenuUI_InvaligKeyBindingsFlags)); | |
267 v4 = 0; | |
268 do | |
269 { | |
270 v5 = 0; | |
271 do | |
272 { | |
273 if (v4 != v5 && pPrevVirtualCidesMapping[v4] == pPrevVirtualCidesMapping[v5]) | |
274 { | |
275 GameMenuUI_InvaligKeyBindingsFlags[v4] = true; | |
276 GameMenuUI_InvaligKeyBindingsFlags[v5] = true; | |
277 } | |
278 ++v5; | |
279 } while (v5 < 28); | |
280 ++v4; | |
281 } while (v4 < 28); | |
282 uGameMenuUI_CurentlySelectedKeyIdx = -1; | |
283 pGUIWindow_CurrentMenu->receives_keyboard_input_2 = WINDOW_INPUT_NONE; | |
284 } | |
2574 | 285 pRenderer->DrawTextureAlphaNew(8/640.0f, 8/480.0f, game_ui_options_controls[0]);//draw base texture |
2546 | 286 if (KeyboardPageNum == 1) |
287 { | |
2574 | 288 pRenderer->DrawTextureAlphaNew(19/640.0f, 302/480.0f, game_ui_options_controls[3]); |
2546 | 289 |
290 pGUIWindow_CurrentMenu->DrawText(pFontLucida, 23, 142, ui_gamemenu_keys_action_name_color, "ÂÏÅШÄ", 0, 0, 0); | |
291 pGUIWindow_CurrentMenu->DrawText(pFontLucida, 127, 142, GameMenuUI_GetKeyBindingColor(0), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[0]), 0, 0, 0); | |
292 pGUIWindow_CurrentMenu->DrawText(pFontLucida, 23, 163, ui_gamemenu_keys_action_name_color, "ÍÀÇÀÄ", 0, 0, 0); | |
293 pGUIWindow_CurrentMenu->DrawText(pFontLucida, 127, 163, GameMenuUI_GetKeyBindingColor(1), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[1]), 0, 0, 0); | |
294 pGUIWindow_CurrentMenu->DrawText(pFontLucida, 23, 184, ui_gamemenu_keys_action_name_color, "ÂËÅÂÎ", 0, 0, 0); | |
295 pGUIWindow_CurrentMenu->DrawText(pFontLucida, 127, 184, GameMenuUI_GetKeyBindingColor(2), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[2]), 0, 0, 0); | |
296 pGUIWindow_CurrentMenu->DrawText(pFontLucida, 23, 205, ui_gamemenu_keys_action_name_color, "ÂÏÐÀÂÎ", 0, 0, 0); | |
297 pGUIWindow_CurrentMenu->DrawText(pFontLucida, 127, 205, GameMenuUI_GetKeyBindingColor(3), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[3]), 0, 0, 0); | |
298 pGUIWindow_CurrentMenu->DrawText(pFontLucida, 23, 226, ui_gamemenu_keys_action_name_color, "ÊÐÈÊ", 0, 0, 0); | |
299 pGUIWindow_CurrentMenu->DrawText(pFontLucida, 127, 226, GameMenuUI_GetKeyBindingColor(4), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[4]), 0, 0, 0); | |
300 pGUIWindow_CurrentMenu->DrawText(pFontLucida, 23, 247, ui_gamemenu_keys_action_name_color, "ÏÐÛÆÎÊ", 0, 0, 0); | |
301 pGUIWindow_CurrentMenu->DrawText(pFontLucida, 127, 247, GameMenuUI_GetKeyBindingColor(5), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[5]), 0, 0, 0); | |
302 pGUIWindow_CurrentMenu->DrawText(pFontLucida, 23, 268, ui_gamemenu_keys_action_name_color, "Ï.ÐÅÆÈÌ", 0, 0, 0); | |
303 pGUIWindow_CurrentMenu->DrawText(pFontLucida, 127, 268, GameMenuUI_GetKeyBindingColor(6), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[6]), 0, 0, 0); | |
304 pGUIWindow_CurrentMenu->DrawText(pFontLucida, 247, 142, ui_gamemenu_keys_action_name_color, "ÏÐÈÌ. ÇÀÊË.", 0, 0, 0); | |
305 pGUIWindow_CurrentMenu->DrawText(pFontLucida, 350, 142, GameMenuUI_GetKeyBindingColor(7), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[7]), 0, 0, 0); | |
306 pGUIWindow_CurrentMenu->DrawText(pFontLucida, 247, 163, ui_gamemenu_keys_action_name_color, "ÀÒÀÊÀ", 0, 0, 0); | |
307 pGUIWindow_CurrentMenu->DrawText(pFontLucida, 350, 163, GameMenuUI_GetKeyBindingColor(8), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[8]), 0, 0, 0); | |
308 pGUIWindow_CurrentMenu->DrawText(pFontLucida, 247, 184, ui_gamemenu_keys_action_name_color, "ÄÅÉÑÒÂ.", 0, 0, 0); | |
309 pGUIWindow_CurrentMenu->DrawText(pFontLucida, 350, 184, GameMenuUI_GetKeyBindingColor(9), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[9]), 0, 0, 0); | |
310 pGUIWindow_CurrentMenu->DrawText(pFontLucida, 247, 205, ui_gamemenu_keys_action_name_color, "ÇÀÊËÈÍ.", 0, 0, 0); | |
311 pGUIWindow_CurrentMenu->DrawText(pFontLucida, 350, 205, GameMenuUI_GetKeyBindingColor(10), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[10]), 0, 0, 0); | |
312 pGUIWindow_CurrentMenu->DrawText(pFontLucida, 247, 226, ui_gamemenu_keys_action_name_color, "ÈÃÐÎÊ", 0, 0, 0); | |
313 pGUIWindow_CurrentMenu->DrawText(pFontLucida, 350, 226, GameMenuUI_GetKeyBindingColor(11), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[11]), 0, 0, 0); | |
314 pGUIWindow_CurrentMenu->DrawText(pFontLucida, 247, 247, ui_gamemenu_keys_action_name_color, "ÑËÅÄ. ÈÃÐÎÊ", 0, 0, 0); | |
315 pGUIWindow_CurrentMenu->DrawText(pFontLucida, 350, 247, GameMenuUI_GetKeyBindingColor(12), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[12]), 0, 0, 0); | |
316 pGUIWindow_CurrentMenu->DrawText(pFontLucida, 247, 268, ui_gamemenu_keys_action_name_color, "ÇÀÄÀÍÈß", 0, 0, 0); | |
317 pGUIWindow_CurrentMenu->DrawText(pFontLucida, 350, 268, GameMenuUI_GetKeyBindingColor(13), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[13]), 0, 0, 0); | |
318 } | |
319 else | |
320 { | |
2574 | 321 pRenderer->DrawTextureAlphaNew(127/640.0f, 302/480.0f, game_ui_options_controls[4]); |
2546 | 322 |
323 pGUIWindow_CurrentMenu->DrawText(pFontLucida, 23, 142, ui_gamemenu_keys_action_name_color, "Á. ÑÏÐÀÂÊÀ", 0, 0, 0); | |
324 pGUIWindow_CurrentMenu->DrawText(pFontLucida, 127, 142, GameMenuUI_GetKeyBindingColor(14), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[14]), 0, 0, 0); | |
325 pGUIWindow_CurrentMenu->DrawText(pFontLucida, 23, 163, ui_gamemenu_keys_action_name_color, "ÎÒÄÛÕ", 0, 0, 0); | |
326 pGUIWindow_CurrentMenu->DrawText(pFontLucida, 127, 163, GameMenuUI_GetKeyBindingColor(15), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[15]), 0, 0, 0); | |
327 pGUIWindow_CurrentMenu->DrawText(pFontLucida, 23, 184, ui_gamemenu_keys_action_name_color, "ÒÅÊ. ÂÐÅÌß", 0, 0, 0); | |
328 pGUIWindow_CurrentMenu->DrawText(pFontLucida, 127, 184, GameMenuUI_GetKeyBindingColor(16), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[16]), 0, 0, 0); | |
329 pGUIWindow_CurrentMenu->DrawText(pFontLucida, 23, 205, ui_gamemenu_keys_action_name_color, "ÀÂÒÎÇÀÌÅÒÊÈ", 0, 0, 0); | |
330 pGUIWindow_CurrentMenu->DrawText(pFontLucida, 127, 205, GameMenuUI_GetKeyBindingColor(17), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[17]), 0, 0, 0); | |
331 pGUIWindow_CurrentMenu->DrawText(pFontLucida, 23, 226, ui_gamemenu_keys_action_name_color, "ÊÀÐÒÀ", 0, 0, 0); | |
332 pGUIWindow_CurrentMenu->DrawText(pFontLucida, 127, 226, GameMenuUI_GetKeyBindingColor(18), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[18]), 0, 0, 0); | |
333 pGUIWindow_CurrentMenu->DrawText(pFontLucida, 23, 247, ui_gamemenu_keys_action_name_color, "ÁÅÆÀÒÜ", 0, 0, 0); | |
334 pGUIWindow_CurrentMenu->DrawText(pFontLucida, 127, 247, GameMenuUI_GetKeyBindingColor(19), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[19]), 0, 0, 0); | |
335 pGUIWindow_CurrentMenu->DrawText(pFontLucida, 23, 268, ui_gamemenu_keys_action_name_color, "ÑÌ. ÂÂÅÐÕ", 0, 0, 0); | |
336 pGUIWindow_CurrentMenu->DrawText(pFontLucida, 127, 268, GameMenuUI_GetKeyBindingColor(20), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[20]), 0, 0, 0); | |
337 pGUIWindow_CurrentMenu->DrawText(pFontLucida, 247, 142, ui_gamemenu_keys_action_name_color, "ÑÌ. ÂÍÈÇ", 0, 0, 0); | |
338 pGUIWindow_CurrentMenu->DrawText(pFontLucida, 350, 142, GameMenuUI_GetKeyBindingColor(21), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[21]), 0, 0, 0); | |
339 pGUIWindow_CurrentMenu->DrawText(pFontLucida, 247, 163, ui_gamemenu_keys_action_name_color, "ÑÌ. ÂÏÅШÄ", 0, 0, 0); | |
340 pGUIWindow_CurrentMenu->DrawText(pFontLucida, 350, 163, GameMenuUI_GetKeyBindingColor(22), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[22]), 0, 0, 0); | |
341 pGUIWindow_CurrentMenu->DrawText(pFontLucida, 247, 184, ui_gamemenu_keys_action_name_color, "ÏÐÈÁËÈÇ", 0, 0, 0); | |
342 pGUIWindow_CurrentMenu->DrawText(pFontLucida, 350, 184, GameMenuUI_GetKeyBindingColor(23), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[23]), 0, 0, 0); | |
343 pGUIWindow_CurrentMenu->DrawText(pFontLucida, 247, 205, ui_gamemenu_keys_action_name_color, "ÎÒÄÀËÈÒÜ", 0, 0, 0); | |
344 pGUIWindow_CurrentMenu->DrawText(pFontLucida, 350, 205, GameMenuUI_GetKeyBindingColor(24), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[24]), 0, 0, 0); | |
345 pGUIWindow_CurrentMenu->DrawText(pFontLucida, 247, 226, ui_gamemenu_keys_action_name_color, "Ï. ÂÂÅÐÕ", 0, 0, 0); | |
346 pGUIWindow_CurrentMenu->DrawText(pFontLucida, 350, 226, GameMenuUI_GetKeyBindingColor(25), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[25]), 0, 0, 0); | |
347 pGUIWindow_CurrentMenu->DrawText(pFontLucida, 247, 247, ui_gamemenu_keys_action_name_color, "Ï. ÂÍÈÇ", 0, 0, 0); | |
348 pGUIWindow_CurrentMenu->DrawText(pFontLucida, 350, 247, GameMenuUI_GetKeyBindingColor(26), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[26]), 0, 0, 0); | |
349 pGUIWindow_CurrentMenu->DrawText(pFontLucida, 247, 268, ui_gamemenu_keys_action_name_color, "ÏÐÈÇÅÌË", 0, 0, 0); | |
350 pGUIWindow_CurrentMenu->DrawText(pFontLucida, 350, 268, GameMenuUI_GetKeyBindingColor(27), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[27]), 0, 0, 0); | |
351 } | |
352 } | |
353 | |
354 | |
355 | |
356 GUIWindow_GameVideoOptions::GUIWindow_GameVideoOptions() : | |
357 GUIWindow(0, 0, window->GetWidth(), window->GetHeight(), 0, nullptr) | |
358 { | |
359 // ------------------------------------- | |
360 // GameMenuUI_OptionsVideo_Load --- part | |
2574 | 361 game_ui_menu_options_video_background = assets->GetImage_16BitColorKey(L"optvid", 0x7FF); |
362 game_ui_menu_options_video_bloodsplats = assets->GetImage_16BitColorKey(L"opvdH-bs", 0x7FF); | |
363 game_ui_menu_options_video_coloredlights = assets->GetImage_16BitColorKey(L"opvdH-cl", 0x7FF); | |
364 game_ui_menu_options_video_tinting = assets->GetImage_16BitColorKey(L"opvdH-tn", 0x7FF); | |
365 | |
366 game_ui_menu_options_video_gamma_positions[0] = assets->GetImage_16BitColorKey(L"convol10", 0x7FF); | |
367 game_ui_menu_options_video_gamma_positions[1] = assets->GetImage_16BitColorKey(L"convol20", 0x7FF); | |
368 game_ui_menu_options_video_gamma_positions[2] = assets->GetImage_16BitColorKey(L"convol30", 0x7FF); | |
369 game_ui_menu_options_video_gamma_positions[3] = assets->GetImage_16BitColorKey(L"convol40", 0x7FF); | |
370 game_ui_menu_options_video_gamma_positions[4] = assets->GetImage_16BitColorKey(L"convol50", 0x7FF); | |
371 game_ui_menu_options_video_gamma_positions[5] = assets->GetImage_16BitColorKey(L"convol60", 0x7FF); | |
372 game_ui_menu_options_video_gamma_positions[6] = assets->GetImage_16BitColorKey(L"convol70", 0x7FF); | |
373 game_ui_menu_options_video_gamma_positions[7] = assets->GetImage_16BitColorKey(L"convol80", 0x7FF); | |
374 game_ui_menu_options_video_gamma_positions[8] = assets->GetImage_16BitColorKey(L"convol90", 0x7FF); | |
375 game_ui_menu_options_video_gamma_positions[9] = assets->GetImage_16BitColorKey(L"convol00", 0x7FF); | |
376 //not_available_bloodsplats_texture_id = pIcons_LOD->LoadTexture("opvdG-bs", TEXTURE_16BIT_PALETTE); | |
377 //not_available_us_colored_lights_texture_id = pIcons_LOD->LoadTexture("opvdG-cl", TEXTURE_16BIT_PALETTE); | |
378 //not_available_tinting_texture_id = pIcons_LOD->LoadTexture("opvdG-tn", TEXTURE_16BIT_PALETTE); | |
2546 | 379 |
380 CreateButton(0xF1u, 0x12Eu, 0xD6u, 0x28u, 1, 0, UIMSG_Escape, 0, 0, "", 0); | |
381 //if ( pRenderer->pRenderD3D ) | |
382 { | |
383 CreateButton(0x13u, 0x118u, 0xD6u, 0x12u, 1, 0, UIMSG_ToggleBloodsplats, 0, 0, "", 0); | |
384 CreateButton(0x13u, 0x12Eu, 0xD6u, 0x12u, 1, 0, UIMSG_ToggleColoredLights, 0, 0, "", 0); | |
385 CreateButton(0x13u, 0x144u, 0xD6u, 0x12u, 1, 0, UIMSG_ToggleTint, 0, 0, "", 0); | |
386 } | |
387 } | |
388 | |
389 | |
390 | |
391 //----- (00414D9A) -------------------------------------------------------- | |
392 void GUIWindow_GameVideoOptions::Update() | |
393 { | |
394 // ----------------------------------- | |
395 // 004156F0 GUI_UpdateWindows --- part | |
396 GUIWindow msg_window; // [sp+8h] [bp-54h]@3 | |
397 | |
2574 | 398 pRenderer->DrawTextureAlphaNew(8/640.0f, 8/480.0f, game_ui_menu_options_video_background);//draw base texture |
2546 | 399 //if ( !pRenderer->bWindowMode && pRenderer->IsGammaSupported() ) |
400 { | |
2574 | 401 pRenderer->DrawTextureAlphaNew( |
402 (17 * uGammaPos + 42)/640.0f, | |
403 162/480.0f, | |
404 game_ui_menu_options_video_gamma_positions[uGammaPos]); | |
405 | |
2572
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2566
diff
changeset
|
406 pRenderer->DrawTextureNew(274/640.0f, 169/480.0f, gamma_preview_image); |
2546 | 407 msg_window.uFrameX = 22; |
408 msg_window.uFrameY = 190; | |
409 msg_window.uFrameWidth = 211; | |
410 msg_window.uFrameHeight = 79; | |
411 msg_window.uFrameZ = 232; | |
412 msg_window.uFrameW = 268; | |
413 msg_window.DrawTitleText(pFontSmallnum, 0, 0, ui_gamemenu_video_gamma_title_color, pGlobalTXT_LocalizationStrings[226], 3); // "Gamma controls the relative ""brightness"" of the game. May vary depending on your monitor." | |
414 } | |
415 | |
2574 | 416 |
2546 | 417 if (pEngine->uFlags2 & GAME_FLAGS_2_DRAW_BLOODSPLATS) |
2574 | 418 pRenderer->DrawTextureAlphaNew(20/640.0f, 281/480.0f, game_ui_menu_options_video_bloodsplats); |
2546 | 419 if (pRenderer->bUseColoredLights) |
2574 | 420 pRenderer->DrawTextureAlphaNew(20/640.0f, 303/480.0f, game_ui_menu_options_video_coloredlights); |
2546 | 421 if (pRenderer->bTinting) |
2574 | 422 pRenderer->DrawTextureAlphaNew(20/640.0f, 325/480.0f, game_ui_menu_options_video_tinting); |
2546 | 423 } |
424 | |
425 | |
426 | |
427 | |
428 | |
429 | |
430 | |
431 | |
432 | |
433 | |
434 | |
435 | |
436 | |
437 | |
438 OptionsMenuSkin options_menu_skin; // 507C60 | |
439 OptionsMenuSkin::OptionsMenuSkin() : | |
440 uTextureID_Background(0), | |
441 uTextureID_ArrowLeft(0), | |
442 uTextureID_ArrowRight(0), | |
443 uTextureID_unused_0(0), uTextureID_unused_1(0), uTextureID_unused_2(0), | |
444 uTextureID_FlipOnExit(0), | |
445 uTextureID_AlwaysRun(0), | |
446 uTextureID_WalkSound(0), | |
447 uTextureID_ShowDamage(0) | |
448 { | |
449 for (uint i = 0; i < 3; ++i) uTextureID_TurnSpeed[i] = 0; | |
450 for (uint i = 0; i < 10; ++i) uTextureID_SoundLevels[i] = 0; | |
451 } | |
452 | |
453 void OptionsMenuSkin::Relaease() | |
454 { | |
2574 | 455 #define RELEASE(img) \ |
2546 | 456 {\ |
2574 | 457 if (img)\ |
458 {\ | |
459 img->Release(); \ | |
460 img = nullptr; \ | |
461 }\ | |
2546 | 462 } |
463 | |
464 RELEASE(uTextureID_Background); | |
465 for (uint i = 0; i < 3; ++i) | |
466 RELEASE(uTextureID_TurnSpeed[i]); | |
467 RELEASE(uTextureID_ArrowLeft); | |
468 RELEASE(uTextureID_ArrowRight); | |
469 RELEASE(uTextureID_FlipOnExit); | |
470 for (uint i = 0; i < 10; ++i) | |
471 RELEASE(uTextureID_SoundLevels[i]); | |
472 RELEASE(uTextureID_AlwaysRun); | |
473 RELEASE(uTextureID_WalkSound); | |
474 RELEASE(uTextureID_ShowDamage); | |
475 | |
476 #undef RELEASE | |
477 } | |
478 | |
479 | |
480 GUIWindow_GameOptions::GUIWindow_GameOptions() : | |
481 GUIWindow(0, 0, window->GetWidth(), window->GetHeight(), 0, nullptr) | |
482 { | |
483 // GameMenuUI_Options_Load -- part | |
2574 | 484 options_menu_skin.uTextureID_Background = assets->GetImage_16BitColorKey(L"ControlBG", 0x7FF); |
485 options_menu_skin.uTextureID_TurnSpeed[2] = assets->GetImage_16BitColorKey(L"con_16x", 0x7FF); | |
486 options_menu_skin.uTextureID_TurnSpeed[1] = assets->GetImage_16BitColorKey(L"con_32x", 0x7FF); | |
487 options_menu_skin.uTextureID_TurnSpeed[0] = assets->GetImage_16BitColorKey(L"con_Smoo", 0x7FF); | |
488 options_menu_skin.uTextureID_ArrowLeft = assets->GetImage_16BitAlpha(L"con_ArrL"); | |
489 options_menu_skin.uTextureID_ArrowRight = assets->GetImage_16BitAlpha(L"con_ArrR"); | |
490 options_menu_skin.uTextureID_SoundLevels[0] = assets->GetImage_16BitColorKey(L"convol10", 0x7FF); | |
491 options_menu_skin.uTextureID_SoundLevels[1] = assets->GetImage_16BitColorKey(L"convol20", 0x7FF); | |
492 options_menu_skin.uTextureID_SoundLevels[2] = assets->GetImage_16BitColorKey(L"convol30", 0x7FF); | |
493 options_menu_skin.uTextureID_SoundLevels[3] = assets->GetImage_16BitColorKey(L"convol40", 0x7FF); | |
494 options_menu_skin.uTextureID_SoundLevels[4] = assets->GetImage_16BitColorKey(L"convol50", 0x7FF); | |
495 options_menu_skin.uTextureID_SoundLevels[5] = assets->GetImage_16BitColorKey(L"convol60", 0x7FF); | |
496 options_menu_skin.uTextureID_SoundLevels[6] = assets->GetImage_16BitColorKey(L"convol70", 0x7FF); | |
497 options_menu_skin.uTextureID_SoundLevels[7] = assets->GetImage_16BitColorKey(L"convol80", 0x7FF); | |
498 options_menu_skin.uTextureID_SoundLevels[8] = assets->GetImage_16BitColorKey(L"convol90", 0x7FF); | |
499 options_menu_skin.uTextureID_SoundLevels[9] = assets->GetImage_16BitColorKey(L"convol00", 0x7FF); | |
500 options_menu_skin.uTextureID_FlipOnExit = assets->GetImage_16BitColorKey(L"option04", 0x7FF); | |
501 options_menu_skin.uTextureID_AlwaysRun = assets->GetImage_16BitColorKey(L"option03", 0x7FF); | |
502 options_menu_skin.uTextureID_ShowDamage = assets->GetImage_16BitColorKey(L"option02", 0x7FF); | |
503 options_menu_skin.uTextureID_WalkSound = assets->GetImage_16BitColorKey(L"option01", 0x7FF); | |
2546 | 504 |
505 CreateButton(22, 270, | |
2574 | 506 options_menu_skin.uTextureID_TurnSpeed[2]->GetWidth(), |
507 options_menu_skin.uTextureID_TurnSpeed[2]->GetHeight(), | |
2546 | 508 1, 0, UIMSG_SetTurnSpeed, 0x80, 0, "", 0); |
509 CreateButton(93, 270, | |
2574 | 510 options_menu_skin.uTextureID_TurnSpeed[1]->GetWidth(), |
511 options_menu_skin.uTextureID_TurnSpeed[1]->GetHeight(), | |
2546 | 512 1, 0, UIMSG_SetTurnSpeed, 0x40u, 0, "", 0); |
513 CreateButton(164, 270, | |
2574 | 514 options_menu_skin.uTextureID_TurnSpeed[0]->GetWidth(), |
515 options_menu_skin.uTextureID_TurnSpeed[0]->GetHeight(), | |
2546 | 516 1, 0, UIMSG_SetTurnSpeed, 0, 0, "", 0); |
517 | |
518 CreateButton(20, 303, | |
2574 | 519 options_menu_skin.uTextureID_WalkSound->GetWidth(), |
520 options_menu_skin.uTextureID_WalkSound->GetHeight(), | |
2546 | 521 1, 0, UIMSG_ToggleWalkSound, 0, 0, "", 0); |
522 CreateButton(128, 303, | |
2574 | 523 options_menu_skin.uTextureID_ShowDamage->GetWidth(), |
524 options_menu_skin.uTextureID_ShowDamage->GetHeight(), | |
2546 | 525 1, 0, UIMSG_ToggleShowDamage, 0, 0, "", 0); |
526 CreateButton(20, 325, | |
2574 | 527 options_menu_skin.uTextureID_AlwaysRun->GetWidth(), |
528 options_menu_skin.uTextureID_AlwaysRun->GetHeight(), | |
2546 | 529 1, 0, UIMSG_ToggleAlwaysRun, 0, 0, "", 0); |
530 CreateButton(128, 325, | |
2574 | 531 options_menu_skin.uTextureID_FlipOnExit->GetWidth(), |
532 options_menu_skin.uTextureID_FlipOnExit->GetHeight(), | |
2546 | 533 1, 0, UIMSG_ToggleFlipOnExit, 0, 0, "", 0); |
534 | |
2574 | 535 pBtn_SliderLeft = CreateButton(243, 162, 16, 16, 1, 0, UIMSG_ChangeSoundVolume, 4, 0, "", options_menu_skin.uTextureID_ArrowLeft, 0); |
536 pBtn_SliderRight = CreateButton(435, 162, 16, 16, 1, 0, UIMSG_ChangeSoundVolume, 5, 0, "", options_menu_skin.uTextureID_ArrowRight, 0); | |
2546 | 537 CreateButton(263, 162, 172, 17, 1, 0, UIMSG_ChangeSoundVolume, 0, 0, "", 0); |
538 | |
2574 | 539 pBtn_SliderLeft = CreateButton(243, 216, 16, 16, 1, 0, UIMSG_ChangeMusicVolume, 4, 0, "", options_menu_skin.uTextureID_ArrowLeft, 0); |
540 pBtn_SliderRight = CreateButton(435, 216, 16, 16, 1, 0, UIMSG_ChangeMusicVolume, 5, 0, "", options_menu_skin.uTextureID_ArrowRight, 0); | |
2546 | 541 CreateButton(263, 216, 172, 17, 1, 0, UIMSG_ChangeMusicVolume, 0, 0, "", 0); |
542 | |
2574 | 543 pBtn_SliderLeft = CreateButton(243, 270, 16, 16, 1, 0, UIMSG_ChangeVoiceVolume, 4, 0, "", options_menu_skin.uTextureID_ArrowLeft, 0); |
544 pBtn_SliderRight = CreateButton(435, 270, 16, 16, 1, 0, UIMSG_ChangeVoiceVolume, 5, 0, "", options_menu_skin.uTextureID_ArrowRight, 0); | |
2546 | 545 CreateButton(263, 270, 172, 17, 1, 0, UIMSG_ChangeVoiceVolume, 0, 0, "", 0); |
546 | |
547 CreateButton(241, 302, 214, 40, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[619], 0); // "Return to Game" | |
548 CreateButton(19, 140, 214, 40, 1, 0, UIMSG_OpenKeyMappingOptions, 0, 0x4Bu, "", 0); | |
549 CreateButton(19, 194, 214, 40, 1, 0, UIMSG_OpenVideoOptions, 0, 86, "", 0); | |
550 } | |
551 | |
552 | |
553 | |
554 | |
555 //----- (00414F82) -------------------------------------------------------- | |
556 void GUIWindow_GameOptions::Update() | |
557 { | |
558 // ----------------------------------- | |
559 // 004156F0 GUI_UpdateWindows --- part | |
2574 | 560 pRenderer->DrawTextureAlphaNew(8/640.0f, 8/480.0f, game_ui_menu_options); |
561 pRenderer->DrawTextureAlphaNew(8/640.0f, 132/480.0f, options_menu_skin.uTextureID_Background); | |
2546 | 562 |
563 switch (uTurnSpeed) | |
564 { | |
2574 | 565 case 64: pRenderer->DrawTextureAlphaNew(BtnTurnCoord[1]/640.0f, 270/480.0f, options_menu_skin.uTextureID_TurnSpeed[1]); break; |
566 case 128: pRenderer->DrawTextureAlphaNew(BtnTurnCoord[2]/640.0f, 270/480.0f, options_menu_skin.uTextureID_TurnSpeed[2]); break; | |
567 default: pRenderer->DrawTextureAlphaNew(BtnTurnCoord[0]/640.0f, 270/480.0f, options_menu_skin.uTextureID_TurnSpeed[0]); break; | |
2546 | 568 } |
569 | |
2574 | 570 if (bWalkSound) pRenderer->DrawTextureAlphaNew(20/640.0f, 303/480.0f, options_menu_skin.uTextureID_WalkSound); |
571 if (bShowDamage) pRenderer->DrawTextureAlphaNew(128/640.0f, 303/480.0f, options_menu_skin.uTextureID_ShowDamage); | |
572 if (bFlipOnExit) pRenderer->DrawTextureAlphaNew(128/640.0f, 325/480.0f, options_menu_skin.uTextureID_FlipOnExit); | |
573 if (bAlwaysRun) pRenderer->DrawTextureAlphaNew(20/640.0f, 325/480.0f, options_menu_skin.uTextureID_AlwaysRun); | |
2546 | 574 |
2574 | 575 pRenderer->DrawTextureAlphaNew((265 + 17 * uSoundVolumeMultiplier)/640.0f, 162/480.0f, options_menu_skin.uTextureID_SoundLevels[uSoundVolumeMultiplier]); |
576 pRenderer->DrawTextureAlphaNew((265 + 17 * uMusicVolimeMultiplier)/640.0f, 216/480.0f, options_menu_skin.uTextureID_SoundLevels[uMusicVolimeMultiplier]); | |
577 pRenderer->DrawTextureAlphaNew((265 + 17 * uVoicesVolumeMultiplier)/640.0f, 270/480.0f, options_menu_skin.uTextureID_SoundLevels[uVoicesVolumeMultiplier]); | |
2546 | 578 } |
579 | |
580 | |
581 | |
582 | |
583 | |
584 | |
585 | |
586 | |
587 | |
588 | |
2501 | 589 //----- (00421D00) -------------------------------------------------------- |
590 void __fastcall GameUI_OnPlayerPortraitLeftClick(unsigned int uPlayerID) | |
591 { | |
592 Player* player = &pParty->pPlayers[uPlayerID - 1]; | |
593 if (pParty->pPickedItem.uItemID) | |
594 { | |
595 if (int slot = player->AddItem(-1, pParty->pPickedItem.uItemID)) | |
596 { | |
597 memcpy(&player->pInventoryItemList[slot-1], &pParty->pPickedItem, 0x24u); | |
598 viewparams->bRedrawGameUI = true; | |
599 pMouse->RemoveHoldingItem(); | |
600 return; | |
601 } | |
602 | |
603 if (!player->CanAct()) | |
604 { | |
605 player = pPlayers[uActiveCharacter]; | |
606 } | |
607 if( player->CanAct() || !pPlayers[uActiveCharacter]->CanAct() ) | |
608 player->PlaySound(SPEECH_NoRoom, 0); | |
609 } | |
610 | |
2541 | 611 if (current_screen_type == SCREEN_GAME) |
2501 | 612 { |
613 viewparams->bRedrawGameUI = true; | |
614 if ( uActiveCharacter != uPlayerID ) | |
615 { | |
616 if ( pPlayers[uPlayerID]->uTimeToRecovery ) | |
617 return; | |
618 | |
619 uActiveCharacter = uPlayerID; | |
620 return; | |
621 } | |
2547 | 622 pGUIWindow_CurrentMenu = new GUIWindow_CharacterRecord(uActiveCharacter, SCREEN_CHARACTERS);//CharacterUI_Initialize(SCREEN_CHARACTERS); |
2501 | 623 return; |
624 } | |
2541 | 625 if ( current_screen_type == SCREEN_SPELL_BOOK ) |
2501 | 626 return; |
2541 | 627 if ( current_screen_type == SCREEN_CHEST ) |
2501 | 628 { |
629 viewparams->bRedrawGameUI = true; | |
630 if ( uActiveCharacter == uPlayerID ) | |
631 { | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2541
diff
changeset
|
632 current_character_screen_window = WINDOW_CharacterWindow_Inventory; |
2541 | 633 current_screen_type = SCREEN_CHEST_INVENTORY; |
2501 | 634 uActiveCharacter = uPlayerID; |
635 return; | |
636 } | |
637 if ( pPlayers[uPlayerID]->uTimeToRecovery ) | |
638 return; | |
639 uActiveCharacter = uPlayerID; | |
640 return; | |
641 } | |
2541 | 642 if ( current_screen_type != SCREEN_HOUSE ) |
2501 | 643 { |
2541 | 644 if ( current_screen_type == SCREEN_E ) |
2501 | 645 { |
646 uActiveCharacter = uPlayerID; | |
647 return; | |
648 } | |
2541 | 649 if ( current_screen_type != SCREEN_CHEST_INVENTORY ) |
2501 | 650 { |
651 viewparams->bRedrawGameUI = true; | |
652 uActiveCharacter = uPlayerID; | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2541
diff
changeset
|
653 if (current_character_screen_window == WINDOW_CharacterWindow_Awards) |
2501 | 654 FillAwardsData(); |
655 return; | |
656 } | |
657 viewparams->bRedrawGameUI = true; | |
658 if ( uActiveCharacter == uPlayerID ) | |
659 { | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2541
diff
changeset
|
660 current_character_screen_window = WINDOW_CharacterWindow_Inventory; |
2541 | 661 current_screen_type = SCREEN_CHEST_INVENTORY; |
2501 | 662 uActiveCharacter = uPlayerID; |
663 return; | |
664 } | |
665 if ( pPlayers[uPlayerID]->uTimeToRecovery ) | |
666 return; | |
667 uActiveCharacter = uPlayerID; | |
668 return; | |
669 } | |
670 if ( window_SpeakInHouse->receives_keyboard_input_2 == WINDOW_INPUT_IN_PROGRESS) | |
671 return; | |
672 viewparams->bRedrawGameUI = true; | |
673 if ( uActiveCharacter != uPlayerID ) | |
674 { | |
675 uActiveCharacter = uPlayerID; | |
676 return; | |
677 } | |
678 if (dialog_menu_id == HOUSE_DIALOGUE_SHOP_BUY_STANDARD || dialog_menu_id == HOUSE_DIALOGUE_SHOP_6) | |
679 { | |
680 __debugbreak(); // fix indexing | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2541
diff
changeset
|
681 current_character_screen_window = WINDOW_CharacterWindow_Inventory; |
2547 | 682 pGUIWindow_CurrentMenu = new GUIWindow_CharacterRecord(uActiveCharacter, SCREEN_E);//CharacterUI_Initialize(SCREEN_E); |
2501 | 683 return; |
684 } | |
685 } | |
686 | |
687 //----- (00416B01) -------------------------------------------------------- | |
688 void GameUI_DrawNPCPopup(void *_this)//PopupWindowForBenefitAndJoinText | |
689 { | |
690 int v1; // edi@2 | |
691 NPCData *pNPC; // eax@16 | |
692 const CHAR *pText; // eax@18 | |
693 char *v11; // esi@26 | |
694 GUIWindow popup_window; // [sp+Ch] [bp-60h]@23 | |
695 int a2; // [sp+60h] [bp-Ch]@16 | |
696 LPCSTR lpsz; // [sp+68h] [bp-4h]@6 | |
697 | |
698 if ( bNoNPCHiring != 1 ) | |
699 { | |
700 v1 = 0; | |
701 /*do | |
702 { | |
703 if ( v3->pName ) | |
704 pTmpBuf[v1++] = v2; | |
705 ++v3; | |
706 ++v2; | |
707 } | |
708 while ( (signed int)v3 < (signed int)&pParty->pPickedItem );*/ | |
709 for (int i = 0; i < 2; ++i) | |
710 { | |
711 if (pParty->pHirelings[i].pName) | |
712 pTmpBuf[v1++] = i; | |
713 } | |
714 lpsz = 0; | |
715 if ( (signed int)pNPCStats->uNumNewNPCs > 0 ) | |
716 { | |
717 /*v4 = pNPCStats->pNewNPCData; | |
718 do | |
719 { | |
720 if ( v4->uFlags & 0x80 | |
721 && (!pParty->pHirelings[0].pName || strcmp(v4->pName, pParty->pHirelings[0].pName)) | |
722 && (!pParty->pHirelings[1].pName || strcmp(v4->pName, pParty->pHirelings[1].pName)) ) | |
723 pTmpBuf[v1++] = (char)lpsz + 2; | |
724 ++lpsz; | |
725 ++v4; | |
726 } | |
727 while ( (signed int)lpsz < (signed int)pNPCStats->uNumNewNPCs );*/ | |
728 for ( uint i = 0; i < pNPCStats->uNumNewNPCs; ++i ) | |
729 { | |
730 if (pNPCStats->pNewNPCData[i].Hired()) | |
731 { | |
732 if (!pParty->pHirelings[0].pName || strcmp((char *)pNPCStats->pNewNPCData[i].pName, (char *)pParty->pHirelings[0].pName)) | |
733 { | |
734 if (!pParty->pHirelings[1].pName || strcmp((char *)pNPCStats->pNewNPCData[i].pName, (char *)pParty->pHirelings[1].pName)) | |
735 pTmpBuf[v1++] = i + 2; | |
736 } | |
737 } | |
738 } | |
739 } | |
740 if ( (signed int)((char *)_this + pParty->hirelingScrollPosition) < v1 ) | |
741 { | |
742 sDialogue_SpeakingActorNPC_ID = -1 - pParty->hirelingScrollPosition - (int)_this; | |
743 pNPC = GetNewNPCData(sDialogue_SpeakingActorNPC_ID, &a2); | |
744 if ( pNPC ) | |
745 { | |
746 if ( a2 == 57 ) | |
747 pText = pNPCTopics[512].pText; // Baby dragon | |
748 else | |
749 pText = (const CHAR *)pNPCStats->pProfessions[pNPC->uProfession].pBenefits; | |
750 lpsz = pText; | |
751 if ( !pText ) | |
752 { | |
753 lpsz = (LPCSTR)pNPCStats->pProfessions[pNPC->uProfession].pJoinText; | |
754 if ( !lpsz ) | |
755 lpsz = ""; | |
756 } | |
757 popup_window.Hint = nullptr; | |
758 popup_window.uFrameX = 38; | |
759 popup_window.uFrameY = 60; | |
760 popup_window.uFrameWidth = 276; | |
761 popup_window.uFrameZ = 313; | |
762 popup_window.uFrameHeight = pFontArrus->CalcTextHeight(lpsz, &popup_window, 0, 0) + 2 * LOBYTE(pFontArrus->uFontHeight) + 24; | |
763 if ( (signed int)popup_window.uFrameHeight < 130 ) | |
764 popup_window.uFrameHeight = 130; | |
765 popup_window.uFrameWidth = 400; | |
766 popup_window.uFrameZ = popup_window.uFrameX + 399; | |
767 popup_window.DrawMessageBox(0); | |
768 sprintfex(pTmpBuf2.data(), "NPC%03d", pNPC->uPortraitID); | |
2575 | 769 pRenderer->DrawTextureAlphaNew( |
770 (popup_window.uFrameX + 22)/640.0f, | |
771 (popup_window.uFrameY + 36)/480.0f, | |
772 assets->GetImage_16BitColorKey(pTmpBuf2.data(), 0x7FF) | |
773 ); | |
2501 | 774 if ( pNPC->uProfession ) |
775 { | |
776 v11 = pTmpBuf.data(); | |
777 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[429], pNPC->pName, aNPCProfessionNames[pNPC->uProfession]); | |
778 } | |
779 else | |
780 { | |
781 v11 = pTmpBuf.data(); | |
782 strcpy(pTmpBuf.data(), pNPC->pName); | |
783 } | |
784 popup_window.DrawTitleText(pFontArrus, 0, 12, Color16(0xFFu, 0xFFu, 0x9Bu), v11, 3); | |
785 popup_window.uFrameWidth -= 24; | |
786 popup_window.uFrameZ = popup_window.uFrameX + popup_window.uFrameWidth - 1; | |
787 popup_window.DrawText(pFontArrus, 100, 36, 0, BuildDialogueString((char *)lpsz, uActiveCharacter - 1, 0, 0, 0, 0), 0, 0, 0); | |
788 } | |
789 } | |
790 } | |
791 } | |
792 | |
793 //----- (00445D4A) -------------------------------------------------------- | |
794 void GameUI_InitializeDialogue(Actor *actor, int bPlayerSaysHello) | |
795 { | |
796 NPCData *pNPCInfo; // ebp@1 | |
797 int v9; // esi@8 | |
798 int pNumberContacts; // eax@11 | |
799 char pContainer[32]; // [sp+14h] [bp-28h]@3 | |
800 | |
801 dword_A74CDC = -1; | |
802 pNPCStats->dword_AE336C_LastMispronouncedNameFirstLetter = -1; | |
803 pEventTimer->Pause(); | |
804 pMiscTimer->Pause(); | |
805 pAudioPlayer->StopChannels(-1, -1); | |
806 uDialogueType = 0; | |
807 sDialogue_SpeakingActorNPC_ID = actor->sNPC_ID; | |
808 pDialogue_SpeakingActor = actor; | |
809 pNPCInfo = GetNPCData(actor->sNPC_ID); | |
810 if ( (pNPCInfo->uFlags & 3) != 2 ) | |
811 pNPCInfo->uFlags = pNPCInfo->uFlags + 1; | |
812 | |
813 switch (pParty->alignment) | |
814 { | |
815 case PartyAlignment_Good: sprintfex(pContainer, "evt%02d-b", const_2()); break; | |
816 case PartyAlignment_Neutral: sprintfex(pContainer, "evt%02d", const_2()); break; | |
817 case PartyAlignment_Evil: sprintfex(pContainer, "evt%02d-c", const_2()); break; | |
818 } | |
819 | |
820 pDialogueNPCCount = 0; | |
821 uNumDialogueNPCPortraits = 1; | |
2574 | 822 |
823 game_ui_dialogue_background = assets->GetImage_16Bit(pContainer); | |
2501 | 824 sprintfex(pContainer, "npc%03u", pNPCInfo->uPortraitID); |
825 v9 = 0; | |
2575 | 826 pDialogueNPCPortraits[0] = assets->GetImage_16BitColorKey(pContainer, 0x7FF); |
2501 | 827 dword_591084 = areWeLoadingTexture; |
2573
0c67be4ec900
DrawTextureIndexed renamed to DrawTextureTransparentColorKey
a.parshin
parents:
2572
diff
changeset
|
828 |
2501 | 829 if ( !pNPCInfo->Hired() && pNPCInfo->Location2D >= 0 ) |
830 { | |
831 if ( (signed int)pParty->GetPartyFame() <= pNPCInfo->fame | |
832 || (pNumberContacts = pNPCInfo->uFlags & 0xFFFFFF7F, (pNumberContacts & 0x80000000u) != 0) ) | |
833 { | |
834 v9 = 1; | |
835 } | |
836 else | |
837 { | |
838 if ( pNumberContacts > 1 ) | |
839 { | |
840 if ( pNumberContacts == 2 ) | |
841 { | |
842 v9 = 3; | |
843 } | |
844 else | |
845 { | |
846 if ( pNumberContacts != 3 ) | |
847 { | |
848 if ( pNumberContacts != 4 ) | |
849 v9 = 1; | |
850 } | |
851 else | |
852 { | |
853 v9 = 2; | |
854 } | |
855 } | |
856 } | |
857 else if ( pNPCInfo->rep ) | |
858 { | |
859 v9 = 2; | |
860 } | |
861 } | |
862 } | |
863 if (sDialogue_SpeakingActorNPC_ID < 0) | |
864 v9 = 4; | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2541
diff
changeset
|
865 pDialogueWindow = new GUIWindow_Dialogue(0, 0, window->GetWidth(), window->GetHeight(), 3, 0);//pNumberContacts = 1, v9 = 0; pNumberContacts = 2, v9 = 3; |
2501 | 866 if (pNPCInfo->Hired() && !pNPCInfo->bHasUsedTheAbility) |
867 { | |
868 if (pNPCInfo->uProfession == 10 || //Healer | |
869 pNPCInfo->uProfession == 11 || //Expert Healer | |
870 pNPCInfo->uProfession == 12 || //Master Healer | |
871 pNPCInfo->uProfession == 33 || //Cook | |
872 pNPCInfo->uProfession == 34 || //Chef | |
873 pNPCInfo->uProfession == 39 || //Wind Master | |
874 pNPCInfo->uProfession == 40 || //Water Master | |
875 pNPCInfo->uProfession == 41 || //Gate Master | |
876 pNPCInfo->uProfession == 42 || //Chaplain | |
877 pNPCInfo->uProfession == 43 || //Piper | |
878 pNPCInfo->uProfession == 52 //Fallen Wizard | |
879 ) | |
880 { | |
881 pDialogueWindow->CreateButton(480, 250, 140, LOBYTE(pFontArrus->uFontHeight) - 3, 1, 0, UIMSG_SelectNPCDialogueOption, 9, 0, "", 0); | |
882 pDialogueWindow->_41D08F_set_keyboard_control_group(4, 1, 0, 1); | |
883 } | |
884 } | |
885 | |
886 pDialogueWindow->CreateButton( 61, 424, 31, 40, 2, 94, UIMSG_SelectCharacter, 1, '1', "", 0); | |
887 pDialogueWindow->CreateButton(177, 424, 31, 40, 2, 94, UIMSG_SelectCharacter, 2, '2', "", 0); | |
888 pDialogueWindow->CreateButton(292, 424, 31, 40, 2, 94, UIMSG_SelectCharacter, 3, '3', "", 0); | |
889 pDialogueWindow->CreateButton(407, 424, 31, 40, 2, 94, UIMSG_SelectCharacter, 4, '4', "", 0); | |
890 | |
891 if (bPlayerSaysHello && uActiveCharacter && !pNPCInfo->Hired()) | |
892 { | |
893 if (pParty->uCurrentHour < 5 || pParty->uCurrentHour > 21) | |
894 pPlayers[uActiveCharacter]->PlaySound(SPEECH_GoodEvening, 0); | |
895 else | |
896 pPlayers[uActiveCharacter]->PlaySound(SPEECH_GoodDay, 0); | |
897 } | |
898 } | |
899 | |
900 //----- (00445350) -------------------------------------------------------- | |
901 void GameUI_DrawDialogue() | |
902 { | |
903 NPCData *pNPC; // ebx@2 | |
904 int pGreetType; // eax@2 | |
905 int pTextHeight; // esi@39 | |
906 GUIButton *pButton; // eax@43 | |
907 int all_text_height; // ebx@93 | |
908 signed int index; // esi@99 | |
909 int v42; // edi@102 | |
910 int v45; | |
911 unsigned __int16 pTextColor; // ax@104 | |
912 GUIWindow window; // [sp+ACh] [bp-68h]@42 | |
913 // GUIFont *pOutString; // [sp+10Ch] [bp-8h]@39 | |
914 const char *pInString=nullptr; // [sp+110h] [bp-4h]@32 | |
915 | |
916 if ( !pDialogueWindow ) | |
917 return; | |
918 | |
919 // Window title(Çàãîëîâîê îêíà)---- | |
920 memcpy(&window, pDialogueWindow, sizeof(window)); | |
921 pNPC = GetNPCData(sDialogue_SpeakingActorNPC_ID); | |
922 pGreetType = GetGreetType(sDialogue_SpeakingActorNPC_ID); | |
923 window.uFrameWidth -= 10; | |
924 window.uFrameZ -= 10; | |
2574 | 925 pRenderer->DrawTextureNew(477/640.0f, 0, game_ui_dialogue_background); |
2573
0c67be4ec900
DrawTextureIndexed renamed to DrawTextureTransparentColorKey
a.parshin
parents:
2572
diff
changeset
|
926 pRenderer->DrawTextureAlphaNew(468/640.0f, 0, game_ui_right_panel_frame); |
2574 | 927 pRenderer->DrawTextureAlphaNew((pNPCPortraits_x[0][0] - 4)/640.0f, (pNPCPortraits_y[0][0] - 4)/480.0f, game_ui_evtnpc); |
2575 | 928 pRenderer->DrawTextureAlphaNew(pNPCPortraits_x[0][0]/640.0f, pNPCPortraits_y[0][0]/480.0f, pDialogueNPCPortraits[0]); |
2501 | 929 |
930 if (pNPC->uProfession) | |
931 { | |
932 assert(pNPC->uProfession < sizeof(aNPCProfessionNames) / sizeof(*aNPCProfessionNames.data())); // sometimes buffer overflows; errors emerge both here and in dialogue text | |
933 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[429], pNPC->pName, aNPCProfessionNames[pNPC->uProfession]);//^Pi[%s] %s | |
934 } | |
935 else if (pNPC->pName) | |
936 strcpy(pTmpBuf.data(), pNPC->pName); | |
937 | |
938 window.DrawTitleText(pFontArrus, 483, 112, ui_game_dialogue_npc_name_color, pTmpBuf.data(), 3); | |
939 pParty->GetPartyFame(); | |
940 | |
941 pInString = nullptr; | |
942 switch (uDialogueType) | |
943 { | |
944 case DIALOGUE_13: | |
945 pInString = BuildDialogueString(pNPCStats->pProfessions[pNPC->uProfession].pJoinText, uActiveCharacter - 1, 0, 0, 0, 0); | |
946 break; | |
947 | |
948 case DIALOGUE_PROFESSION_DETAILS: | |
949 { | |
950 //auto prof = pNPCStats->pProfessions[pNPC->uProfession]; | |
951 | |
952 if (dialogue_show_profession_details) | |
953 pInString = BuildDialogueString(pNPCStats->pProfessions[pNPC->uProfession].pBenefits, uActiveCharacter - 1, 0, 0, 0, 0); | |
954 else if (pNPC->Hired()) | |
955 pInString = BuildDialogueString(pNPCStats->pProfessions[pNPC->uProfession].pDismissText, uActiveCharacter - 1, 0, 0, 0, 0); | |
956 else | |
957 pInString = BuildDialogueString(pNPCStats->pProfessions[pNPC->uProfession].pJoinText, uActiveCharacter - 1, 0, 0, 0, 0); | |
958 } | |
959 break; | |
960 | |
961 | |
962 case DIALOGUE_ARENA_WELCOME: | |
963 pInString = pGlobalTXT_LocalizationStrings[574]; // "Welcome to the Arena of Life and Death. Remember, you are only allowed one arena combat per visit. To fight an arena battle, select the option that best describes your abilities and return to me- if you survive:" | |
964 break; | |
965 | |
966 case DIALOGUE_ARENA_FIGHT_NOT_OVER_YET: | |
967 pInString = pGlobalTXT_LocalizationStrings[577]; //"Get back in there you wimps:" | |
968 break; | |
969 | |
970 case DIALOGUE_ARENA_REWARD: | |
971 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[576], gold_transaction_amount);// "Congratulations on your win: here's your stuff: %u gold." | |
972 pInString = pTmpBuf.data(); | |
973 break; | |
974 | |
975 case DIALOGUE_ARENA_ALREADY_WON: | |
976 pInString = pGlobalTXT_LocalizationStrings[582]; // "You already won this trip to the Arena:" | |
977 break; | |
978 | |
979 default: | |
980 if (uDialogueType > DIALOGUE_18 && uDialogueType < DIALOGUE_EVT_E && !byte_5B0938[0]) | |
981 { | |
982 pInString = (char *)current_npc_text; | |
983 } | |
984 else if (pGreetType == 1)//QuestNPC_greet | |
985 { | |
986 if (pNPC->greet) | |
987 { | |
988 if ((pNPC->uFlags & 3) == 2) | |
989 pInString = pNPCStats->pNPCGreetings[pNPC->greet].pGreeting2; | |
990 else | |
991 pInString = pNPCStats->pNPCGreetings[pNPC->greet].pGreeting1; | |
992 } | |
993 } | |
994 else if (pGreetType == 2)//HiredNPC_greet | |
995 { | |
996 NPCProfession* prof = &pNPCStats->pProfessions[pNPC->uProfession]; | |
997 | |
998 if (pNPC->Hired()) | |
999 pInString = BuildDialogueString(prof->pDismissText, uActiveCharacter - 1, 0, 0, 0, 0); | |
1000 else | |
1001 pInString = BuildDialogueString(prof->pJoinText, uActiveCharacter - 1, 0, 0, 0, 0); | |
1002 } | |
1003 break; | |
1004 } | |
1005 | |
1006 // Message window(Îêíî ñîîáùåíèÿ)---- | |
1007 if (pInString) | |
1008 { | |
1009 window.uFrameWidth = game_viewport_width; | |
1010 window.uFrameZ = 452; | |
1011 GUIFont* font = pFontArrus; | |
1012 pTextHeight = pFontArrus->CalcTextHeight(pInString, &window, 13, 0) + 7; | |
1013 if ( 352 - pTextHeight < 8 ) | |
1014 { | |
1015 font = pFontCreate; | |
1016 pTextHeight = pFontCreate->CalcTextHeight(pInString, &window, 13, 0) + 7; | |
1017 } | |
2574 | 1018 |
1019 if (ui_leather_mm7) | |
1020 pRenderer->DrawTextureCustomHeight( | |
1021 8/640.0f, | |
1022 (352 - pTextHeight)/480.0f, | |
1023 ui_leather_mm7, | |
1024 pTextHeight); | |
1025 | |
2573
0c67be4ec900
DrawTextureIndexed renamed to DrawTextureTransparentColorKey
a.parshin
parents:
2572
diff
changeset
|
1026 pRenderer->DrawTextureAlphaNew(8/640.0f, (347 - pTextHeight)/480.0f, _591428_endcap); |
2501 | 1027 pDialogueWindow->DrawText(font, 13, 354 - pTextHeight, 0, FitTextInAWindow(pInString, font, &window, 13, 0), 0, 0, 0); |
1028 } | |
1029 // Right panel(Ïðàâàÿ ïàíåëü)------- | |
1030 memcpy(&window, pDialogueWindow, sizeof(window)); | |
1031 window.uFrameX = 483; | |
1032 window.uFrameWidth = 148; | |
1033 window.uFrameZ = 334; | |
1034 for (int i = window.pStartingPosActiveItem; i < window.pStartingPosActiveItem + window.pNumPresenceButton; ++i) | |
1035 { | |
1036 pButton = window.GetControl(i); | |
1037 if ( !pButton ) | |
1038 break; | |
1039 | |
1040 if ( pButton->msg_param > 88 ) | |
1041 pButton->pButtonName[0] = 0; | |
1042 else if (pButton->msg_param == 88) | |
1043 strcpy(pButton->pButtonName, pGlobalTXT_LocalizationStrings[581]); // Lord | |
1044 else if (pButton->msg_param == 87) | |
1045 strcpy(pButton->pButtonName, pGlobalTXT_LocalizationStrings[580]); // Knight | |
1046 else if (pButton->msg_param == 86) | |
1047 strcpy(pButton->pButtonName, pGlobalTXT_LocalizationStrings[579]); // Squire | |
1048 else if (pButton->msg_param == 85) | |
1049 strcpy(pButton->pButtonName, pGlobalTXT_LocalizationStrings[578]); // Page | |
1050 else if (pButton->msg_param == 77) | |
1051 strcpy(pButton->pButtonName, pGlobalTXT_LocalizationStrings[407]); // Details | |
1052 else if (pButton->msg_param == 76) | |
1053 { | |
1054 if (pNPC->Hired()) | |
1055 sprintf(pButton->pButtonName, (const char*)pGlobalTXT_LocalizationStrings[408], pNPC->pName); // Release %s | |
1056 else | |
1057 strcpy(pButton->pButtonName, pGlobalTXT_LocalizationStrings[406]); // Hire | |
1058 } | |
1059 else if (pButton->msg_param == 24) | |
1060 { | |
1061 __debugbreak(); // learn conditions of this event | |
1062 if (!pNPC->evt_F) | |
1063 { | |
1064 pButton->pButtonName[0] = 0; | |
1065 pButton->msg_param = 0; | |
1066 } | |
1067 else | |
1068 strcpy(pButton->pButtonName, pNPCTopics[pNPC->evt_F].pTopic); | |
1069 } | |
1070 else if (pButton->msg_param == 9) | |
1071 strcpy(pButton->pButtonName, GetProfessionActionText(pNPC->uProfession)); | |
1072 else if (pButton->msg_param == 19) // Scavenger Hunt | |
1073 { | |
1074 if (!pNPC->evt_A) | |
1075 { | |
1076 pButton->pButtonName[0] = 0; | |
1077 pButton->msg_param = 0; | |
1078 } | |
1079 else | |
1080 strcpy(pButton->pButtonName, pNPCTopics[pNPC->evt_A].pTopic); | |
1081 } | |
1082 else if (pButton->msg_param == 20) // Scavenger Hunt | |
1083 { | |
1084 if (!pNPC->evt_B) | |
1085 { | |
1086 pButton->pButtonName[0] = 0; | |
1087 pButton->msg_param = 0; | |
1088 } | |
1089 else strcpy(pButton->pButtonName, pNPCTopics[pNPC->evt_B].pTopic); | |
1090 } | |
1091 else if (pButton->msg_param == 21) | |
1092 { | |
1093 //__debugbreak(); // learn conditions of this event | |
1094 if (!pNPC->evt_C) | |
1095 { | |
1096 pButton->pButtonName[0] = 0; | |
1097 pButton->msg_param = 0; | |
1098 } | |
1099 else strcpy(pButton->pButtonName, pNPCTopics[pNPC->evt_C].pTopic); | |
1100 } | |
1101 else if (pButton->msg_param == 22) | |
1102 { | |
1103 //__debugbreak(); // learn conditions of this event | |
1104 if (!pNPC->evt_D) | |
1105 { | |
1106 pButton->pButtonName[0] = 0; | |
1107 pButton->msg_param = 0; | |
1108 } | |
1109 else strcpy(pButton->pButtonName, pNPCTopics[pNPC->evt_D].pTopic); | |
1110 } | |
1111 else if (pButton->msg_param == 23) | |
1112 { | |
1113 //__debugbreak(); // learn conditions of this event | |
1114 if (!pNPC->evt_E) | |
1115 { | |
1116 pButton->pButtonName[0] = 0; | |
1117 pButton->msg_param = 0; | |
1118 } | |
1119 else strcpy(pButton->pButtonName, pNPCTopics[pNPC->evt_E].pTopic); | |
1120 } | |
1121 else if (pButton->msg_param == 13) | |
1122 { | |
1123 if (pNPC->Hired()) | |
1124 sprintf(pButton->pButtonName, pGlobalTXT_LocalizationStrings[408], pNPC->pName); // Release %s | |
1125 else | |
1126 strcpy(pButton->pButtonName, pGlobalTXT_LocalizationStrings[122]); // Join | |
1127 } | |
1128 else | |
1129 pButton->pButtonName[0] = 0; | |
1130 | |
1131 if (pParty->field_7B5_in_arena_quest && pParty->field_7B5_in_arena_quest != -1) | |
1132 { | |
1133 int num_dead_actors = 0; | |
1134 pInString = nullptr; | |
1135 for ( uint i = 0; i < uNumActors; ++i ) | |
1136 { | |
1137 if (pActors[i].uAIState == Dead || pActors[i].uAIState == Removed || pActors[i].uAIState == Disabled) | |
1138 ++num_dead_actors; | |
1139 else | |
1140 { | |
1141 int sumonner_type = PID_TYPE(pActors[i].uSummonerID); | |
1142 if (sumonner_type == OBJECT_Player) | |
1143 ++num_dead_actors; | |
1144 } | |
1145 } | |
1146 if (num_dead_actors == uNumActors) | |
1147 strcpy(pButton->pButtonName, pGlobalTXT_LocalizationStrings[658]); // Collect Prize | |
1148 } | |
1149 } | |
1150 | |
1151 // Install Buttons(Óñòàíîâêà êíîïîê)-------- | |
1152 index = 0; | |
1153 all_text_height = 0; | |
1154 for ( int i = pDialogueWindow->pStartingPosActiveItem; | |
1155 i < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton; ++i ) | |
1156 { | |
1157 pButton = pDialogueWindow->GetControl(i); | |
1158 if ( !pButton ) | |
1159 break; | |
1160 all_text_height += pFontArrus->CalcTextHeight(pButton->pButtonName, &window, 0, 0); | |
1161 index++; | |
1162 } | |
1163 if ( index ) | |
1164 { | |
1165 v45 = (174 - all_text_height) / index; | |
1166 if ( v45 > 32 ) | |
1167 v45 = 32; | |
1168 v42 = (174 - v45 * index - all_text_height)/ 2 - v45 / 2 + 138; | |
1169 for ( int i = pDialogueWindow->pStartingPosActiveItem; | |
1170 i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) | |
1171 { | |
1172 pButton = pDialogueWindow->GetControl(i); | |
1173 if ( !pButton ) | |
1174 break; | |
1175 pButton->uY = (unsigned int)(v45 + v42); | |
1176 pTextHeight = pFontArrus->CalcTextHeight(pButton->pButtonName, &window, 0, 0); | |
1177 pButton->uHeight = pTextHeight; | |
1178 v42 = pButton->uY + pTextHeight - 1; | |
1179 pButton->uW = v42; | |
1180 pTextColor = ui_game_dialogue_option_normal_color; | |
1181 if ( pDialogueWindow->pCurrentPosActiveItem == i ) | |
1182 pTextColor = ui_game_dialogue_option_highlight_color; | |
1183 window.DrawTitleText(pFontArrus, 0, pButton->uY, pTextColor, pButton->pButtonName, 3); | |
1184 } | |
1185 } | |
2573
0c67be4ec900
DrawTextureIndexed renamed to DrawTextureTransparentColorKey
a.parshin
parents:
2572
diff
changeset
|
1186 pRenderer->DrawTextureAlphaNew(471/640.0f, 445/480.0f, ui_exit_cancel_button_background); |
2501 | 1187 } |
1188 | |
1189 //----- (00444FBE) -------------------------------------------------------- | |
1190 void GameUI_DrawBranchlessDialogue() | |
1191 { | |
1192 int pTextHeight; // esi@4 | |
1193 char Str[200]; // [sp+Ch] [bp-120h]@12 | |
1194 GUIWindow BranchlessDlg_window; // [sp+D4h] [bp-58h]@4 | |
1195 GUIFont *pFont; // [sp+128h] [bp-4h]@1 | |
1196 | |
1197 pFont = pFontArrus; | |
1198 if ( current_npc_text && !byte_5B0938[0] ) | |
1199 strcpy(byte_5B0938.data(), current_npc_text); | |
1200 BranchlessDlg_window.uFrameWidth = game_viewport_width; | |
1201 BranchlessDlg_window.uFrameZ = 452; | |
1202 pTextHeight = pFontArrus->CalcTextHeight(byte_5B0938.data(), &BranchlessDlg_window, 12, 0) + 7; | |
1203 if ( 352 - pTextHeight < 8 ) | |
1204 { | |
1205 pFont = pFontCreate; | |
1206 pTextHeight = pFontCreate->CalcTextHeight(byte_5B0938.data(), &BranchlessDlg_window, 12, 0) + 7; | |
1207 } | |
2574 | 1208 |
1209 pRenderer->DrawTextureCustomHeight( | |
1210 8/640.0f, | |
1211 (352 - pTextHeight)/480.0f, | |
1212 ui_leather_mm7, | |
1213 pTextHeight); | |
2573
0c67be4ec900
DrawTextureIndexed renamed to DrawTextureTransparentColorKey
a.parshin
parents:
2572
diff
changeset
|
1214 pRenderer->DrawTextureAlphaNew(8/640.0f, (347 - pTextHeight)/480.0f, _591428_endcap); |
2501 | 1215 pGUIWindow2->DrawText(pFont, 12, 354 - pTextHeight, 0, FitTextInAWindow(byte_5B0938.data(), pFont, &BranchlessDlg_window, 12, 0), 0, 0, 0); |
2572
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2566
diff
changeset
|
1216 pRenderer->DrawTextureNew(0, 352/480.0f, game_ui_statusbar); |
2501 | 1217 if ( pGUIWindow2->receives_keyboard_input_2 != WINDOW_INPUT_IN_PROGRESS) |
1218 { | |
1219 if ( pGUIWindow2->receives_keyboard_input_2 == WINDOW_INPUT_CONFIRMED) | |
1220 { | |
1221 pGUIWindow2->receives_keyboard_input_2 = WINDOW_INPUT_NONE; | |
1222 strcpy(GameUI_Footer_TimedString.data(), pKeyActionMap->pPressedKeysBuffer); | |
1223 sub_4452BB(); | |
1224 return; | |
1225 } | |
1226 if ( pGUIWindow2->receives_keyboard_input_2 != WINDOW_INPUT_CANCELLED) | |
1227 return; | |
1228 pGUIWindow2->receives_keyboard_input_2 = WINDOW_INPUT_NONE; | |
1229 memset(GameUI_Footer_TimedString.data(), 0, 0xC8u); | |
1230 sub_4452BB(); | |
1231 return; | |
1232 } | |
1233 if ( pGUIWindow2->ptr_1C == (void *)26 ) | |
1234 { | |
1235 sprintf(Str, "%s %s", GameUI_Footer_TimedString, pKeyActionMap->pPressedKeysBuffer); | |
1236 pGUIWindow2->DrawText(pFontLucida, 13, 357, 0, Str, 0, 0, 0); | |
1237 pGUIWindow2->DrawFlashingInputCursor(pFontLucida->GetLineWidth(Str) + 13, 357, pFontLucida); | |
1238 return; | |
1239 } | |
1240 if ( pKeyActionMap->pPressedKeysBuffer[0] ) | |
1241 { | |
1242 pKeyActionMap->SetWindowInputStatus(WINDOW_INPUT_NONE); | |
1243 memset(GameUI_Footer_TimedString.data(), 0, 0xC8u); | |
1244 sub_4452BB(); | |
1245 return; | |
1246 } | |
1247 } | |
1248 | |
1249 //----- (004443D5) -------------------------------------------------------- | |
1250 const char *GameUI_GetMinimapHintText() | |
1251 { | |
1252 double v3; // st7@1 | |
1253 int v7; // eax@4 | |
1254 const char *v14; // eax@8 | |
1255 char *result; // eax@12 | |
1256 unsigned int pMapID; // eax@14 | |
1257 int global_coord_X; // [sp+10h] [bp-1Ch]@1 | |
1258 int global_coord_Y; // [sp+14h] [bp-18h]@1 | |
1259 unsigned int pY; // [sp+1Ch] [bp-10h]@1 | |
1260 unsigned int pX; // [sp+28h] [bp-4h]@1 | |
1261 | |
1262 result = 0; | |
1263 pMouse->GetClickPos(&pX, &pY); | |
1264 v3 = 1.0 / (float)((signed int)viewparams->uMinimapZoom * 0.000015258789); | |
1265 global_coord_X = (signed __int64)((double)(pX - 557) * v3 + (double)pParty->vPosition.x); | |
1266 global_coord_Y = (signed __int64)((double)pParty->vPosition.y - (double)(pY - 74) * v3); | |
1267 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor || pOutdoor->uNumBModels <= 0 ) | |
1268 { | |
1269 pMapID = pMapStats->GetMapInfo(pCurrentMapName); | |
1270 if ( pMapID == 0 ) | |
1271 result = "No Maze Info for this maze on file!"; | |
1272 else | |
1273 result = pMapStats->pInfos[pMapID].pName; | |
1274 } | |
1275 else | |
1276 { | |
1277 for ( uint j = 0; j < (uint)pOutdoor->uNumBModels; ++j ) | |
1278 { | |
1279 v7 = int_get_vector_length(abs((signed)pOutdoor->pBModels[j].vBoundingCenter.x - global_coord_X), | |
1280 abs((signed)pOutdoor->pBModels[j].vBoundingCenter.y - global_coord_Y), 0); | |
1281 if ( v7 < 2 * pOutdoor->pBModels[j].sBoundingRadius ) | |
1282 { | |
1283 if ( pOutdoor->pBModels[j].uNumFaces ) | |
1284 { | |
1285 for ( uint i = 0; i < (uint)pOutdoor->pBModels[j].uNumFaces; ++i ) | |
1286 { | |
1287 if ( pOutdoor->pBModels[j].pFaces[i].sCogTriggeredID ) | |
1288 { | |
1289 if ( !(pOutdoor->pBModels[j].pFaces[i].uAttributes & FACE_HAS_EVENT) ) | |
1290 { | |
1291 v14 = GetEventHintString(pOutdoor->pBModels[j].pFaces[i].sCogTriggeredID); | |
1292 if ( v14 ) | |
1293 { | |
1294 if ( _stricmp(v14, "") ) | |
1295 result = (char *)v14; | |
1296 } | |
1297 } | |
1298 } | |
1299 } | |
1300 } | |
1301 if ( result ) | |
1302 return result; | |
1303 } | |
1304 } | |
1305 pMapID = pMapStats->GetMapInfo(pCurrentMapName); | |
1306 if ( pMapID == 0 ) | |
1307 result = "No Maze Info for this maze on file!"; | |
1308 else | |
1309 result = pMapStats->pInfos[pMapID].pName; | |
1310 return result; | |
1311 } | |
1312 return result; | |
1313 } | |
1314 | |
1315 //----- (0041D3B7) -------------------------------------------------------- | |
1316 void GameUI_CharacterQuickRecord_Draw(GUIWindow *window, Player *player) | |
1317 { | |
2575 | 1318 Image *v13; // eax@6 |
2501 | 1319 PlayerFrame *v15; // eax@12 |
1320 unsigned int pTextColor; // eax@15 | |
1321 const char *v29; // eax@16 | |
1322 int v36; // esi@22 | |
1323 const char *v39; // eax@24 | |
1324 signed int uFramesetID; // [sp+20h] [bp-8h]@9 | |
1325 int uFramesetIDa; // [sp+20h] [bp-8h]@18 | |
1326 | |
1327 uint numActivePlayerBuffs = 0; | |
1328 for (uint i = 0; i < 24; ++i) | |
1329 if (player->pPlayerBuffs[i].uExpireTime > 0) | |
1330 ++numActivePlayerBuffs; | |
1331 | |
1332 window->uFrameHeight = ((pFontArrus->uFontHeight + 162) + ((numActivePlayerBuffs - 1) * pFontArrus->uFontHeight)); | |
1333 window->uFrameZ = window->uFrameWidth + window->uFrameX - 1; | |
1334 window->uFrameW = ((pFontArrus->uFontHeight + 162) + ((numActivePlayerBuffs - 1) * pFontArrus->uFontHeight)) + window->uFrameY - 1; | |
1335 window->DrawMessageBox(0); | |
1336 | |
1337 if (player->IsEradicated()) | |
2575 | 1338 v13 = game_ui_player_face_eradicated; |
2501 | 1339 else if (player->IsDead()) |
2575 | 1340 v13 = game_ui_player_face_dead; |
2501 | 1341 else |
1342 { | |
1343 uFramesetID = pPlayerFrameTable->GetFrameIdByExpression(player->expression); | |
1344 if ( !uFramesetID ) | |
1345 uFramesetID = 1; | |
1346 if ( player->expression == CHARACTER_EXPRESSION_21) | |
1347 v15 = pPlayerFrameTable->GetFrameBy_y(&player->_expression21_frameset, &player->_expression21_animtime, pMiscTimer->uTimeElapsed); | |
1348 else | |
1349 v15 = pPlayerFrameTable->GetFrameBy_x(uFramesetID, pMiscTimer->Time()); | |
1350 player->field_1AA2 = v15->uTextureID - 1; | |
2575 | 1351 v13 = game_ui_player_faces[(unsigned int)window->ptr_1C][v15->uTextureID - 1]; |
2501 | 1352 } |
1353 | |
2575 | 1354 pRenderer->DrawTextureAlphaNew((window->uFrameX + 24)/640.0f, (window->uFrameY + 24)/480.0f, v13); |
2501 | 1355 |
1356 sprintfex(pTmpBuf.data(), "\f%05d", ui_character_header_text_color); | |
1357 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[429], player->pName, pClassNames[player->classType]); // "%s the %s" | |
1358 strcat(pTmpBuf.data(), pTmpBuf2.data()); | |
1359 strcat(pTmpBuf.data(), "\f00000\n"); | |
1360 | |
1361 pTextColor = UI_GetHealthManaAndOtherQualitiesStringColor(player->sHealth, player->GetMaxHealth()); | |
1362 sprintfex(pTmpBuf2.data(), "%s : \f%05u%d\f00000 / %d\n", pGlobalTXT_LocalizationStrings[108], // "Hit Points" | |
1363 pTextColor, player->sHealth, player->GetMaxHealth()); | |
1364 strcat(pTmpBuf.data(), pTmpBuf2.data()); | |
1365 | |
1366 pTextColor = UI_GetHealthManaAndOtherQualitiesStringColor(player->sMana, player->GetMaxMana()); | |
1367 sprintfex(pTmpBuf2.data(), "%s : \f%05u%d\f00000 / %d\n", pGlobalTXT_LocalizationStrings[212], // "Spell Points" | |
1368 pTextColor, player->sMana, player->GetMaxMana()); | |
1369 strcat(pTmpBuf.data(), pTmpBuf2.data()); | |
1370 | |
1371 pTextColor = player->GetMajorConditionIdx(); | |
1372 sprintfex(pTmpBuf2.data(), "%s: \f%05d%s\f00000\n", pGlobalTXT_LocalizationStrings[47], // "Condition | |
1373 GetConditionDrawColor(pTextColor), aCharacterConditionNames[pTextColor]); | |
1374 strcat(pTmpBuf.data(), pTmpBuf2.data()); | |
1375 | |
1376 if ( player->uQuickSpell ) | |
1377 v29 = pSpellStats->pInfos[player->uQuickSpell].pShortName; | |
1378 else | |
1379 v29 = pGlobalTXT_LocalizationStrings[153]; | |
1380 sprintfex(pTmpBuf2.data(), "%s: %s", pGlobalTXT_LocalizationStrings[172], v29); // "Quick Spell" | |
1381 strcat(pTmpBuf.data(), pTmpBuf2.data()); | |
1382 | |
1383 window->DrawText(pFontArrus, 120, 22, 0, pTmpBuf.data(), 0, 0, 0); | |
1384 | |
1385 uFramesetIDa = 0; | |
1386 for (uint i = 0; i < 24; ++i) | |
1387 { | |
1388 SpellBuff* buff = &player->pPlayerBuffs[i]; | |
1389 if (buff->uExpireTime > 0) | |
1390 { | |
1391 v36 = uFramesetIDa++ * pFontComic->uFontHeight + 134; | |
1392 window->DrawText(pFontComic, 52, v36, ui_game_character_record_playerbuff_colors[i], aSpellNames[20 + i], 0, 0, 0); | |
1393 DrawBuff_remaining_time_string(v36, window, buff->uExpireTime - pParty->uTimePlayed, pFontComic); | |
1394 } | |
1395 } | |
1396 | |
1397 v39 = ""; | |
1398 if ( uFramesetIDa == 0 ) | |
1399 v39 = pGlobalTXT_LocalizationStrings[153]; // "None" | |
1400 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[450], v39); // "Active Spells: %s" | |
1401 window->DrawText(pFontArrus, 14, 114, 0, pTmpBuf.data(), 0, 0, 0); | |
1402 } | |
1403 | |
1404 //----- (0041AD6E) -------------------------------------------------------- | |
1405 void GameUI_DrawRightPanelItems() | |
1406 { | |
1407 if ( (unsigned long long)GameUI_RightPanel_BookFlashTimer > pParty->uTimePlayed ) | |
1408 GameUI_RightPanel_BookFlashTimer = 0; | |
1409 | |
1410 if ( pParty->uTimePlayed - GameUI_RightPanel_BookFlashTimer > 128 ) | |
1411 { | |
1412 GameUI_RightPanel_BookFlashTimer = pParty->uTimePlayed; | |
1413 | |
2572
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2566
diff
changeset
|
1414 static bool _50697C_book_flasher = false; // 50697C |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2566
diff
changeset
|
1415 _50697C_book_flasher = !_50697C_book_flasher; |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2566
diff
changeset
|
1416 if (_50697C_book_flasher && current_screen_type != SCREEN_REST ) |
2501 | 1417 { |
2574 | 1418 if (bFlashQuestBook) pRenderer->DrawTextureAlphaNew(493/640.0f, 355/480.0f, game_ui_tome_quests); |
1419 if (bFlashAutonotesBook) pRenderer->DrawTextureAlphaNew(527/640.0f, 353/480.0f, game_ui_tome_autonotes); | |
1420 if (bFlashHistoryBook) pRenderer->DrawTextureAlphaNew(600/640.0f, 361/480.0f, game_ui_tome_storyline); | |
2501 | 1421 } |
1422 else | |
1423 { | |
2572
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2566
diff
changeset
|
1424 pRenderer->DrawTextureNew(468/640.0f, 0, game_ui_rightframe); |
2501 | 1425 GameUI_DrawHiredNPCs(); |
1426 } | |
1427 } | |
1428 } | |
1429 | |
1430 //----- (0041AEBB) -------------------------------------------------------- | |
1431 void GameUI_DrawFoodAndGold() | |
1432 { | |
1433 int text_y; // esi@2 | |
1434 | |
1435 if ( uGameState != GAME_STATE_FINAL_WINDOW ) | |
1436 { | |
1437 text_y = _44100D_should_alter_right_panel() != 0 ? 381 : 322; | |
1438 sprintf(pTmpBuf.data(), "\r087%lu", pParty->uNumFoodRations); | |
1439 pPrimaryWindow->DrawText(pFontSmallnum, 0, text_y, uGameUIFontMain, pTmpBuf.data(), 0, 0, uGameUIFontShadow); | |
1440 sprintf(pTmpBuf.data(), "\r028%lu", pParty->uNumGold); | |
1441 pPrimaryWindow->DrawText(pFontSmallnum, 0, text_y, uGameUIFontMain, pTmpBuf.data(), 0, 0, uGameUIFontShadow); | |
1442 } | |
1443 } | |
1444 | |
1445 //----- (0041B0C9) -------------------------------------------------------- | |
1446 void GameUI_DrawLifeManaBars() | |
1447 { | |
1448 double v3; // st7@3 | |
1449 double v7; // st7@25 | |
1450 | |
1451 for (uint i = 0; i < 4; ++i) | |
1452 { | |
1453 if (pParty->pPlayers[i].sHealth > 0) | |
1454 { | |
1455 int v17 = 0; | |
1456 if (i == 2 || i == 3) | |
1457 v17 = 2; | |
1458 v3 = (double)pParty->pPlayers[i].sHealth / (double)pParty->pPlayers[i].GetMaxHealth(); | |
2574 | 1459 |
1460 auto pTextureHealth = game_ui_bar_green; | |
2501 | 1461 if( v3 > 0.5 ) |
1462 { | |
1463 if ( v3 > 1.0 ) | |
1464 v3 = 1.0; | |
1465 } | |
1466 else if ( v3 > 0.25 ) | |
2574 | 1467 pTextureHealth = game_ui_bar_yellow; |
2501 | 1468 else if ( v3 > 0.0 ) |
2574 | 1469 pTextureHealth = game_ui_bar_red; |
2501 | 1470 if( v3 > 0.0 ) |
1471 { | |
2574 | 1472 pRenderer->SetUIClipRect( |
1473 v17 + pHealthBarPos[i], | |
1474 (signed __int64)((1.0 - v3) * pTextureHealth->GetHeight()) + 402, | |
1475 v17 + pHealthBarPos[i] + pTextureHealth->GetWidth(), | |
1476 pTextureHealth->GetHeight() + 402); | |
1477 pRenderer->DrawTextureAlphaNew((v17 + pHealthBarPos[i])/640.0f, 402/480.0f, pTextureHealth); | |
2524 | 1478 pRenderer->ResetUIClipRect(); |
2501 | 1479 } |
1480 } | |
1481 if (pParty->pPlayers[i].sMana > 0) | |
1482 { | |
1483 v7 = pParty->pPlayers[i].sMana / (double)pParty->pPlayers[i].GetMaxMana(); | |
1484 if ( v7 > 1.0 ) | |
1485 v7 = 1.0; | |
1486 int v17 = 0; | |
1487 if (i == 2) | |
1488 v17 = 1; | |
2574 | 1489 pRenderer->SetUIClipRect( |
1490 v17 + pManaBarPos[i], | |
1491 (signed __int64)((1.0 - v7) * game_ui_bar_blue->GetHeight()) + 402, | |
1492 v17 + pManaBarPos[i] + game_ui_bar_blue->GetWidth(), | |
1493 game_ui_bar_blue->GetHeight() + 402); | |
1494 pRenderer->DrawTextureAlphaNew((v17 + pManaBarPos[i])/640.0f, 402/480.0f, game_ui_bar_blue); | |
2524 | 1495 pRenderer->ResetUIClipRect(); |
2501 | 1496 } |
1497 } | |
1498 } | |
1499 | |
1500 //----- (0041B3B6) -------------------------------------------------------- | |
1501 void GameUI_DrawRightPanel() | |
1502 { | |
2573
0c67be4ec900
DrawTextureIndexed renamed to DrawTextureTransparentColorKey
a.parshin
parents:
2572
diff
changeset
|
1503 pRenderer->DrawTextureAlphaNew(pViewport->uViewportBR_X/640.0f, 0, game_ui_right_panel_frame); |
2501 | 1504 } |
1505 | |
1506 //----- (0041B3E2) -------------------------------------------------------- | |
1507 void GameUI_DrawRightPanelFrames() | |
1508 { | |
2572
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2566
diff
changeset
|
1509 pRenderer->DrawTextureNew(0, 0, game_ui_topframe); |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2566
diff
changeset
|
1510 pRenderer->DrawTextureNew(0, 8/480.0f, game_ui_leftframe); |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2566
diff
changeset
|
1511 pRenderer->DrawTextureNew(468/640.0f, 0, game_ui_rightframe); |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2566
diff
changeset
|
1512 pRenderer->DrawTextureNew(0, 352 / 480.0f, game_ui_bottomframe); |
2501 | 1513 GameUI_DrawFoodAndGold(); |
1514 GameUI_DrawRightPanelItems(); | |
2572
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2566
diff
changeset
|
1515 |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2566
diff
changeset
|
1516 //pRenderer->EndScene(); |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2566
diff
changeset
|
1517 //pRenderer->Present(); |
2501 | 1518 } |
1519 | |
1520 //----- (0041C047) -------------------------------------------------------- | |
1521 void GameUI_Footer_2() | |
1522 { | |
1523 char *v1; // edx@2 | |
1524 int v5; // eax@5 | |
1525 | |
2572
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2566
diff
changeset
|
1526 pRenderer->DrawTextureNew(0, 352/480.0f, game_ui_statusbar); |
2501 | 1527 if (GameUI_Footer_TimeLeft) |
1528 v1 = GameUI_Footer_TimedString.data(); | |
1529 else | |
1530 { | |
1531 if (!pFooterString[0]) | |
1532 return; | |
1533 v1 = pFooterString.data(); | |
1534 } | |
1535 | |
1536 v5 = pFontLucida->AlignText_Center(450, v1); | |
1537 pPrimaryWindow->DrawText(pFontLucida, v5 + 11, 357, uGameUIFontMain, v1, 0, 0, uGameUIFontShadow); | |
1538 } | |
1539 | |
1540 //----- (0041C0B8) -------------------------------------------------------- | |
1541 void GameUI_SetFooterString(const char *pStr) | |
1542 { | |
1543 const char *v1; // esi@1 | |
1544 | |
1545 v1 = pStr; | |
1546 if ( pStr && strcmp(pStr, "test") && !IsBadStringPtrA(pStr, 1) && (*v1 || GameUI_Footer_TimeLeft) ) | |
1547 { | |
1548 if ( GameUI_Footer_TimeLeft ) | |
1549 { | |
1550 for ( int i = pFontLucida->GetLineWidth(GameUI_Footer_TimedString.data()); i > 450; i = pFontLucida->GetLineWidth(GameUI_Footer_TimedString.data()) ) | |
1551 GameUI_Footer_TimedString[strlen(GameUI_Footer_TimedString.data()) - 1] = 0; | |
1552 } | |
1553 else | |
1554 { | |
1555 strcpy(pFooterString.data(), v1); | |
1556 for ( int j = pFontLucida->GetLineWidth(pFooterString.data()); j > 450; j = pFontLucida->GetLineWidth(pFooterString.data()) ) | |
1557 pFooterString[strlen(pFooterString.data()) - 1] = 0; | |
1558 } | |
1559 } | |
1560 } | |
1561 | |
1562 //----- (0041C179) -------------------------------------------------------- | |
1563 void GameUI_Footer() | |
1564 { | |
1565 char *v1; // edi@5 | |
1566 int v2; // eax@5 | |
1567 int v6; // eax@9 | |
1568 char v9; // zf@12 | |
1569 | |
1570 if ( pFooterString[0] || GameUI_Footer_TimeLeft || bForceDrawFooter ) | |
1571 { | |
2572
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2566
diff
changeset
|
1572 pRenderer->DrawTextureNew(0, 352/480.0f, game_ui_statusbar); |
2501 | 1573 if ( GameUI_Footer_TimeLeft ) |
1574 { | |
1575 v1 = GameUI_Footer_TimedString.data(); | |
1576 v2 = pFontLucida->GetLineWidth(GameUI_Footer_TimedString.data()); | |
1577 while ( v2 > 450 ) | |
1578 { | |
1579 GameUI_Footer_TimedString[strlen(GameUI_Footer_TimedString.data()) - 1] = 0; | |
1580 v2 = pFontLucida->GetLineWidth(GameUI_Footer_TimedString.data()); | |
1581 } | |
1582 } | |
1583 else | |
1584 { | |
1585 v1 = pFooterString.data(); | |
1586 v6 = pFontLucida->GetLineWidth(pFooterString.data()); | |
1587 while ( v6 > 450 ) | |
1588 { | |
1589 pFooterString[strlen(pFooterString.data()) - 1] = 0; | |
1590 v6 = pFontLucida->GetLineWidth(pFooterString.data()); | |
1591 } | |
1592 } | |
1593 v9 = *v1 == 0; | |
1594 bForceDrawFooter = 0; | |
1595 if ( !v9 ) | |
1596 pPrimaryWindow->DrawText(pFontLucida, pFontLucida->AlignText_Center(450, v1) + 11, 357, uGameUIFontMain, v1, 0, 0, uGameUIFontShadow); | |
1597 } | |
1598 } | |
1599 // 5C35BC: using guessed type int bForceDrawFooter; | |
1600 //----- (00420EFF) -------------------------------------------------------- | |
1601 void GameUI_WritePointedObjectStatusString() | |
1602 { | |
1603 GUIWindow *pWindow; // edi@7 | |
1604 GUIButton *pButton; // ecx@11 | |
1605 int requiredSkillpoints; // ecx@19 | |
1606 enum UIMessageType pMessageType1; // esi@24 | |
1607 int v14; // eax@41 | |
1608 ItemGen *pItemGen; // ecx@44 | |
1609 int v16; // ecx@46 | |
1610 signed int pickedObjectPID; // eax@55 | |
1611 signed int v18b; | |
1612 signed int pickedObjectID; // ecx@63 | |
1613 BLVFace *pFace; // eax@69 | |
1614 const char *pText; // ecx@79 | |
1615 enum UIMessageType pMessageType2; // esi@110 | |
1616 enum UIMessageType pMessageType3; // edx@117 | |
1617 char Str1[200]; // [sp+Ch] [bp-D4h]@129 | |
1618 unsigned int pX; // [sp+D4h] [bp-Ch]@1 | |
1619 unsigned int pY; // [sp+D8h] [bp-8h]@1 | |
1620 | |
1621 pMouse->uPointingObjectID = 0; | |
1622 pMouse->GetClickPos(&pX, &pY); | |
1623 if ( pX < 0 || pX > window->GetWidth() - 1 || pY < 0 || pY > window->GetHeight() - 1 ) | |
1624 return; | |
2541 | 1625 if ( current_screen_type == SCREEN_GAME ) |
2501 | 1626 { |
1627 if ( pX <= (window->GetWidth() - 1) * 0.73125 && pY <= (window->GetHeight() - 1) * 0.73125 ) | |
1628 { | |
1629 //if ( pRenderer->pRenderD3D ) // inlined mm8::4C1E01 | |
1630 { | |
2541 | 1631 pickedObjectPID = pEngine->pVisInstance->get_picked_object_zbuf_val(); |
2501 | 1632 if ( pX < (unsigned int)pViewport->uScreen_TL_X || pX > (unsigned int)pViewport->uScreen_BR_X |
1633 || pY < (unsigned int)pViewport->uScreen_TL_Y || pY > (unsigned int)pViewport->uScreen_BR_Y ) | |
1634 pickedObjectPID = -1; | |
1635 if ( pickedObjectPID == -1 ) | |
1636 { | |
1637 if ( uLastPointedObjectID != 0 ) | |
1638 { | |
1639 pFooterString[0] = 0; | |
1640 bForceDrawFooter = 1; | |
1641 } | |
1642 uLastPointedObjectID = 0; | |
1643 return; | |
1644 } | |
1645 } | |
1646 /*else | |
1647 { | |
1648 v18 = pRenderer->pActiveZBuffer[pX + pSRZBufferLineOffsets[pY]]; | |
1649 }*/ | |
1650 pMouse->uPointingObjectID = (unsigned __int16)pickedObjectPID; | |
1651 pickedObjectID = (signed)PID_ID(pickedObjectPID); | |
1652 if ( PID_TYPE(pickedObjectPID) == OBJECT_Item ) | |
1653 { | |
1654 if ( pObjectList->pObjects[pSpriteObjects[pickedObjectID].uObjectDescID].uFlags & 0x10 ) | |
1655 { | |
1656 pMouse->uPointingObjectID = 0; | |
1657 pFooterString[0] = 0; | |
1658 bForceDrawFooter = 1; | |
1659 uLastPointedObjectID = 0; | |
1660 return; | |
1661 } | |
1662 if ( pickedObjectPID >= 0x2000000u || pParty->pPickedItem.uItemID ) | |
1663 { | |
2566 | 1664 GameUI_SetFooterString(pSpriteObjects[pickedObjectID].containing_item.GetDisplayName()); |
2501 | 1665 } |
1666 else | |
1667 { | |
2566 | 1668 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[470], pSpriteObjects[pickedObjectID].containing_item.GetDisplayName());// "Get %s" |
2501 | 1669 GameUI_SetFooterString(pTmpBuf.data()); |
1670 } //intentional fallthrough | |
1671 } | |
1672 else if ( PID_TYPE(pickedObjectPID) == OBJECT_Decoration ) | |
1673 { | |
1674 if ( !pLevelDecorations[pickedObjectID].uEventID ) | |
1675 { | |
1676 if ( pLevelDecorations[pickedObjectID].IsInteractive() ) | |
1677 pText = pNPCTopics[stru_5E4C90_MapPersistVars._decor_events[pLevelDecorations[pickedObjectID]._idx_in_stru123 - 75] + 380].pTopic;//íåâåðíî äëÿ êîñòðà | |
1678 else | |
1679 pText = pDecorationList->pDecorations[pLevelDecorations[pickedObjectID].uDecorationDescID].field_20; | |
1680 GameUI_SetFooterString(pText); | |
1681 } | |
1682 else | |
1683 { | |
1684 char* hintString = GetEventHintString(pLevelDecorations[pickedObjectID].uEventID); | |
1685 if ( hintString != '\0' ) | |
1686 { | |
1687 GameUI_SetFooterString(hintString); | |
1688 } | |
1689 } //intentional fallthrough | |
1690 } | |
1691 else if ( PID_TYPE(pickedObjectPID) == OBJECT_BModel ) | |
1692 { | |
1693 if ( pickedObjectPID < 0x2000000u ) | |
1694 { | |
1695 char* newString = nullptr; | |
1696 if ( uCurrentlyLoadedLevelType != LEVEL_Indoor ) | |
1697 { | |
1698 v18b = (signed int)(unsigned __int16)pickedObjectPID >> 9; | |
1699 short triggeredId = pOutdoor->pBModels[v18b].pFaces[pickedObjectID & 0x3F].sCogTriggeredID; | |
1700 if (triggeredId != 0) | |
1701 { | |
1702 newString = GetEventHintString(pOutdoor->pBModels[v18b].pFaces[pickedObjectID & 0x3F].sCogTriggeredID); | |
1703 } | |
1704 } | |
1705 else | |
1706 { | |
1707 pFace = &pIndoor->pFaces[pickedObjectID]; | |
1708 if ( pFace->uAttributes & FACE_INDICATE ) | |
1709 { | |
1710 unsigned short eventId = pIndoor->pFaceExtras[pFace->uFaceExtraID].uEventID; | |
1711 if (eventId != 0) | |
1712 { | |
1713 newString = GetEventHintString(pIndoor->pFaceExtras[pFace->uFaceExtraID].uEventID); | |
1714 } | |
1715 } | |
1716 } | |
1717 if (newString) | |
1718 { | |
1719 GameUI_SetFooterString(newString); | |
1720 if ( pMouse->uPointingObjectID == 0 && uLastPointedObjectID != 0) | |
1721 { | |
1722 pFooterString[0] = 0; | |
1723 bForceDrawFooter = 1; | |
1724 } | |
1725 uLastPointedObjectID = pMouse->uPointingObjectID; | |
1726 return; | |
1727 } | |
1728 } | |
1729 pMouse->uPointingObjectID = 0; | |
1730 pFooterString[0] = 0; | |
1731 bForceDrawFooter = 1; | |
1732 uLastPointedObjectID = 0; | |
1733 return; | |
1734 } | |
1735 else if ( PID_TYPE(pickedObjectPID) == OBJECT_Actor ) | |
1736 { | |
1737 if ( pickedObjectPID >= 0x2000000 ) | |
1738 { | |
1739 pMouse->uPointingObjectID = 0; | |
1740 if ( uLastPointedObjectID != 0 ) | |
1741 { | |
1742 pFooterString[0] = 0; | |
1743 bForceDrawFooter = 1; | |
1744 } | |
1745 uLastPointedObjectID = 0; | |
1746 return; | |
1747 } | |
1748 if ( pActors[pickedObjectID].dword_000334_unique_name ) | |
1749 pText = pMonsterStats->pPlaceStrings[pActors[pickedObjectID].dword_000334_unique_name]; | |
1750 else | |
1751 pText = pMonsterStats->pInfos[pActors[pickedObjectID].pMonsterInfo.uID].pName; | |
1752 GameUI_SetFooterString(pText); //intentional fallthrough | |
1753 } | |
1754 if ( pMouse->uPointingObjectID == 0 && uLastPointedObjectID != 0) | |
1755 { | |
1756 pFooterString[0] = 0; | |
1757 bForceDrawFooter = 1; | |
1758 } | |
1759 uLastPointedObjectID = pMouse->uPointingObjectID; | |
1760 return; | |
1761 } | |
1762 } | |
1763 else | |
1764 { | |
1765 for (int i = uNumVisibleWindows; i > 0; --i) | |
1766 { | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2541
diff
changeset
|
1767 pWindow = pWindowList[pVisibleWindowsIdxs[i] - 1]; |
2501 | 1768 if ( (signed int)pX >= (signed int)pWindow->uFrameX && (signed int)pX <= (signed int)pWindow->uFrameZ |
1769 && (signed int)pY >= (signed int)pWindow->uFrameY && (signed int)pY <= (signed int)pWindow->uFrameW ) | |
1770 { | |
1771 for ( pButton = pWindow->pControlsHead; pButton != nullptr; pButton = pButton->pNext ) | |
1772 { | |
1773 switch ( pButton->uButtonType ) | |
1774 { | |
1775 case 1://for dialogue window | |
1776 if ( (signed int)pX >= (signed int)pButton->uX && (signed int)pX <= (signed int)pButton->uZ | |
1777 && (signed int)pY >= (signed int)pButton->uY && (signed int)pY <= (signed int)pButton->uW ) | |
1778 { | |
1779 pMessageType1 = (UIMessageType)pButton->field_1C; | |
1780 if ( pMessageType1 ) | |
1781 pMessageQueue_50CBD0->AddGUIMessage(pMessageType1, pButton->msg_param, 0); | |
1782 GameUI_SetFooterString(pButton->pButtonName); | |
1783 uLastPointedObjectID = 1; | |
1784 return; | |
1785 } | |
1786 break; | |
1787 case 2://hovering over portraits | |
1788 if (pButton->uWidth != 0 && pButton->uHeight != 0) | |
1789 { | |
1790 uint distW = pX - pButton->uX; | |
1791 uint distY = pY - pButton->uY; | |
1792 | |
1793 double ratioX = 1.0 * (distW*distW) / (pButton->uWidth*pButton->uWidth); | |
1794 double ratioY = 1.0 * (distY*distY) / (pButton->uHeight*pButton->uHeight); | |
1795 | |
1796 if (ratioX + ratioY < 1.0) | |
1797 { | |
1798 pMessageType2 = (UIMessageType)pButton->field_1C; | |
1799 if ( pMessageType2 != 0 ) | |
1800 pMessageQueue_50CBD0->AddGUIMessage(pMessageType2, pButton->msg_param, 0); | |
1801 GameUI_SetFooterString(pButton->pButtonName); // for character name | |
1802 uLastPointedObjectID = 1; | |
1803 return; | |
1804 } | |
1805 } | |
1806 break; | |
1807 case 3:// click on skill | |
1808 if ( pX >= pButton->uX && pX <= pButton->uZ | |
1809 && pY >= pButton->uY && pY <= pButton->uW ) | |
1810 { | |
1811 requiredSkillpoints = (LOBYTE(pPlayers[uActiveCharacter]->pActiveSkills[pButton->msg_param]) & 0x3F) + 1; | |
1812 if ( pPlayers[uActiveCharacter]->uSkillPoints < requiredSkillpoints ) | |
1813 sprintf(Str1, pGlobalTXT_LocalizationStrings[469], requiredSkillpoints - pPlayers[uActiveCharacter]->uSkillPoints);// "You need %d more Skill Points to advance here" | |
1814 else | |
1815 sprintf(Str1, pGlobalTXT_LocalizationStrings[468], requiredSkillpoints);// "Clicking here will spend %d Skill Points" | |
1816 GameUI_SetFooterString(Str1); | |
1817 uLastPointedObjectID = 1; | |
1818 return; | |
1819 } | |
1820 break; | |
1821 } | |
1822 } | |
1823 } | |
1824 if ( pWindow->uFrameHeight == 480 ) | |
1825 { | |
1826 //DebugBreak(); //Why is this condition here (in the original too)? Might check fullscreen windows. Let Silvo know if you find out | |
1827 return; | |
1828 } | |
1829 } | |
1830 //The game never gets to this point even in the original. It's also bugged(neither branch displays anything). | |
1831 //TODO fix these and move them up before the window check loop. | |
2541 | 1832 if ( current_screen_type == SCREEN_CHEST ) |
2501 | 1833 { |
1834 Chest::ChestUI_WritePointedObjectStatusString(); | |
1835 if ( uLastPointedObjectID != 0 ) | |
1836 { | |
1837 pFooterString[0] = 0; | |
1838 bForceDrawFooter = 1; | |
1839 } | |
1840 uLastPointedObjectID = 0; | |
1841 return; | |
1842 } | |
2541 | 1843 else if ( current_screen_type == SCREEN_HOUSE ) |
2501 | 1844 { |
1845 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD | |
1846 || (v16 = pRenderer->pActiveZBuffer[pX + pSRZBufferLineOffsets[pY]], v16 == 0) | |
1847 || v16 == -65536 ) | |
1848 { | |
1849 if ( uLastPointedObjectID != 0 ) | |
1850 { | |
1851 pFooterString[0] = 0; | |
1852 bForceDrawFooter = 1; | |
1853 } | |
1854 uLastPointedObjectID = 0; | |
1855 return; | |
1856 } | |
1857 pItemGen = (ItemGen *)((char *)&pParty->pPickedItem + 36 * (v16 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 4); | |
1858 GameUI_SetFooterString(pItemGen->GetDisplayName()); | |
1859 pFooterString[0] = 0; | |
1860 bForceDrawFooter = 1; | |
1861 uLastPointedObjectID = 0; | |
1862 return; | |
1863 } | |
1864 if ( pY < 350 ) | |
1865 { | |
1866 v14 = pRenderer->pActiveZBuffer[pX + pSRZBufferLineOffsets[pY]]; | |
1867 if ( v14 == 0 || v14 == -65536 || v14 >= 5000 ) | |
1868 { | |
1869 if ( pMouse->uPointingObjectID == 0 ) | |
1870 { | |
1871 if ( uLastPointedObjectID != 0 ) | |
1872 { | |
1873 pFooterString[0] = 0; | |
1874 bForceDrawFooter = 1; | |
1875 } | |
1876 } | |
1877 uLastPointedObjectID = pMouse->uPointingObjectID; | |
1878 return; | |
1879 } | |
1880 pItemGen = (ItemGen *)&pPlayers[uActiveCharacter]->pInventoryItemList[v14-1]; | |
1881 GameUI_SetFooterString(pItemGen->GetDisplayName()); | |
1882 pFooterString[0] = 0; | |
1883 bForceDrawFooter = 1; | |
1884 uLastPointedObjectID = 0; | |
1885 return; | |
1886 } | |
1887 } | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2541
diff
changeset
|
1888 if ( (signed int)pX >= (signed int)pWindowList[0]->uFrameX && (signed int)pX <= (signed int)pWindowList[0]->uFrameZ |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2541
diff
changeset
|
1889 && (signed int)pY >= (signed int)pWindowList[0]->uFrameY && (signed int)pY <= (signed int)pWindowList[0]->uFrameW ) |
2501 | 1890 { |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2541
diff
changeset
|
1891 for ( pButton = pWindowList[0]->pControlsHead; pButton != nullptr; pButton = pButton->pNext ) |
2501 | 1892 { |
1893 switch (pButton->uButtonType) | |
1894 { | |
1895 case 1: | |
1896 if ( (signed int)pX >= (signed int)pButton->uX && (signed int)pX <= (signed int)pButton->uZ | |
1897 && (signed int)pY >= (signed int)pButton->uY && (signed int)pY <= (signed int)pButton->uW ) | |
1898 { | |
1899 pMessageType3 = (UIMessageType)pButton->field_1C; | |
1900 if ( pMessageType3 == 0 ) // For books | |
1901 { | |
1902 GameUI_SetFooterString(pButton->pButtonName); | |
1903 } | |
1904 else | |
1905 { | |
1906 pMessageQueue_50CBD0->AddGUIMessage(pMessageType3, pButton->msg_param, 0); | |
1907 } | |
1908 uLastPointedObjectID = 1; | |
1909 return; | |
1910 } | |
1911 break; | |
1912 case 2://hovering over portraits | |
1913 if (pButton->uWidth != 0 && pButton->uHeight != 0) | |
1914 { | |
1915 uint distW = pX - pButton->uX; | |
1916 uint distY = pY - pButton->uY; | |
1917 | |
1918 double ratioX = 1.0 * (distW*distW) / (pButton->uWidth*pButton->uWidth); | |
1919 double ratioY = 1.0 * (distY*distY) / (pButton->uHeight*pButton->uHeight); | |
1920 | |
1921 if (ratioX + ratioY < 1.0) | |
1922 { | |
1923 pMessageType2 = (UIMessageType)pButton->field_1C; | |
1924 if ( pMessageType2 != 0 ) | |
1925 pMessageQueue_50CBD0->AddGUIMessage(pMessageType2, pButton->msg_param, 0); | |
1926 GameUI_SetFooterString(pButton->pButtonName); // for character name | |
1927 uLastPointedObjectID = 1; | |
1928 return; | |
1929 } | |
1930 } | |
1931 break; | |
1932 case 3: | |
1933 if ( pX >= pButton->uX && pX <= pButton->uZ | |
1934 && pY >= pButton->uY && pY <= pButton->uW ) | |
1935 { | |
1936 requiredSkillpoints = (LOBYTE(pPlayers[uActiveCharacter]->pActiveSkills[pButton->msg_param]) & 0x3F) + 1; | |
1937 if ( pPlayers[uActiveCharacter]->uSkillPoints < requiredSkillpoints ) | |
1938 sprintf(Str1, pGlobalTXT_LocalizationStrings[469], requiredSkillpoints - pPlayers[uActiveCharacter]->uSkillPoints);// "You need %d more Skill Points to advance here" | |
1939 else | |
1940 sprintf(Str1, pGlobalTXT_LocalizationStrings[468], requiredSkillpoints);// "Clicking here will spend %d Skill Points" | |
1941 GameUI_SetFooterString(Str1); | |
1942 uLastPointedObjectID = 1; | |
1943 return; | |
1944 } | |
1945 break; | |
1946 } | |
1947 } | |
1948 } | |
1949 //pMouse->uPointingObjectID = sub_46A99B(); //for software | |
1950 if ( uLastPointedObjectID != 0 ) | |
1951 { | |
1952 pFooterString[0] = 0; | |
1953 bForceDrawFooter = 1; | |
1954 } | |
1955 uLastPointedObjectID = 0; | |
1956 return; | |
1957 } | |
1958 | |
1959 //----- (0044158F) -------------------------------------------------------- | |
1960 void GameUI_DrawCharacterSelectionFrame() | |
1961 { | |
1962 if ( uActiveCharacter ) | |
2575 | 1963 pRenderer->DrawTextureAlphaNew( |
1964 (pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[uActiveCharacter - 1] - 9)/640.0f, | |
1965 380/480.0f, | |
1966 game_ui_player_selection_frame); | |
2501 | 1967 } |
1968 | |
1969 //----- (0044162D) -------------------------------------------------------- | |
1970 void GameUI_DrawPartySpells() | |
1971 { | |
1972 unsigned int v0; // ebp@1 | |
2575 | 1973 Image *spell_texture; // [sp-4h] [bp-1Ch]@12 |
2574 | 1974 //Texture_MM7 *v9; // [sp-4h] [bp-1Ch]@21 |
2501 | 1975 |
1976 v0 = (signed __int64)((double)GetTickCount() * 0.050000001); | |
1977 //v1 = 0; | |
1978 for (uint i = 0; i < 14; ++i) | |
1979 { | |
1980 //v2 = byte_4E5DD8[v1]; | |
1981 if (pParty->pPartyBuffs[byte_4E5DD8[i]].uExpireTime) | |
1982 { | |
2574 | 1983 Texture_MM7* tex = pIcons_LOD->GetTexture(pTextureIDs_PartyBuffIcons[i]); |
2501 | 1984 //v3 = pTextureIDs_PartyBuffIcons[i]; |
2575 | 1985 pRenderer->_4A65CC( |
1986 pPartySpellbuffsUI_XYs[i][0], | |
1987 pPartySpellbuffsUI_XYs[i][1], tex, tex, | |
1988 v0 + 20 * pPartySpellbuffsUI_smthns[i], 0, 63 | |
1989 ); | |
2501 | 1990 } |
1991 //++v1; | |
1992 } | |
1993 //while ( v1 < 14 ); | |
2541 | 1994 if (current_screen_type == SCREEN_GAME || current_screen_type == SCREEN_NPC_DIALOGUE) |
2501 | 1995 { |
1996 if (pParty->FlyActive()) | |
1997 { | |
1998 if ( pParty->bFlying ) | |
2575 | 1999 spell_texture = pIconsFrameTable->GetFrame(uIconIdx_FlySpell, v0)->texture; |
2501 | 2000 else |
2575 | 2001 spell_texture = pIconsFrameTable->GetFrame(uIconIdx_FlySpell, 0)->texture; |
2501 | 2002 //if ( pRenderer->pRenderD3D ) |
2575 | 2003 pRenderer->DrawTextureAlphaNew(8/640.0f, 8/480.0f, spell_texture); |
2501 | 2004 /*else |
2524 | 2005 pRenderer->DrawTextureIndexedAlpha(8, 8, v7);*/ |
2501 | 2006 } |
2007 if ( pParty->WaterWalkActive() ) | |
2008 { | |
2009 if ( pParty->uFlags & PARTY_FLAGS_1_STANDING_ON_WATER ) | |
2575 | 2010 spell_texture = pIconsFrameTable->GetFrame(uIconIdx_WaterWalk, v0)->texture; |
2501 | 2011 else |
2575 | 2012 spell_texture = pIconsFrameTable->GetFrame(uIconIdx_WaterWalk, 0)->texture; |
2501 | 2013 //if ( pRenderer->pRenderD3D ) |
2575 | 2014 pRenderer->DrawTextureAlphaNew(396/640.0f, 8/480.0f, spell_texture); |
2501 | 2015 /*else |
2524 | 2016 pRenderer->DrawTextureIndexedAlpha(396, 8, v9);*/ |
2501 | 2017 } |
2018 } | |
2019 for (uint i = 0; i < 4; ++i) | |
2020 { | |
2021 if ( pParty->pPlayers[i].pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].uExpireTime ) | |
2575 | 2022 pRenderer->DrawTextureAlphaNew((pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i] + 72)/640.0f, 427/480.0f, game_ui_playerbuff_hammerhands); |
2501 | 2023 if ( pParty->pPlayers[i].pPlayerBuffs[PLAYER_BUFF_BLESS].uExpireTime ) |
2575 | 2024 pRenderer->DrawTextureAlphaNew((pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i] + 72)/640.0f, 393/480.0f, game_ui_playerbuff_bless); |
2501 | 2025 if ( pParty->pPlayers[i].pPlayerBuffs[PLAYER_BUFF_PRESERVATION].uExpireTime ) |
2575 | 2026 pRenderer->DrawTextureAlphaNew((pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i] + 72)/640.0f, 410/480.0f, game_ui_playerbuff_preservation); |
2501 | 2027 if ( pParty->pPlayers[i].pPlayerBuffs[PLAYER_BUFF_PAIN_REFLECTION].uExpireTime ) |
2575 | 2028 pRenderer->DrawTextureAlphaNew((pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i] + 72)/640.0f, 444/480.0f, game_ui_playerbuff_pain_reflection); |
2501 | 2029 } |
2030 } | |
2031 | |
2032 //----- (004921C1) -------------------------------------------------------- | |
2033 void GameUI_DrawPortraits(unsigned int _this) | |
2034 { | |
2035 unsigned int face_expression_ID; // eax@17 | |
2036 PlayerFrame *pFrame; // eax@21 | |
2575 | 2037 Image *pPortrait; // [sp-4h] [bp-1Ch]@27 |
2501 | 2038 |
2039 if ( _A750D8_player_speech_timer ) | |
2040 { | |
2041 _A750D8_player_speech_timer -= (signed int)pMiscTimer->uTimeElapsed; | |
2042 if ( _A750D8_player_speech_timer <= 0 ) | |
2043 { | |
2044 if ( pPlayers[uSpeakingCharacter]->CanAct() ) | |
2045 pPlayers[uSpeakingCharacter]->PlaySound(PlayerSpeechID, 0); | |
2046 _A750D8_player_speech_timer = 0i64; | |
2047 } | |
2048 } | |
2049 | |
2050 for (uint i = 0; i < 4; ++i) | |
2051 { | |
2052 Player* pPlayer = &pParty->pPlayers[i]; | |
2053 if ( pPlayer->IsEradicated() ) | |
2054 { | |
2575 | 2055 pPortrait = game_ui_player_face_eradicated; |
2501 | 2056 if ( pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime ) |
2575 | 2057 pRenderer->DrawTextureGrayShade(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i]/640.0f, 388/480.0f, pPortrait); |
2501 | 2058 else |
2575 | 2059 pRenderer->DrawTextureAlphaNew((pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i] + 1)/640.0f, 388/480.0f, pPortrait); |
2501 | 2060 if ( pPlayer->pPlayerBuffs[PLAYER_BUFF_BLESS].uExpireTime | pPlayer->pPlayerBuffs[PLAYER_BUFF_HASTE].uExpireTime |
2061 | pPlayer->pPlayerBuffs[PLAYER_BUFF_HEROISM].uExpireTime | pPlayer->pPlayerBuffs[PLAYER_BUFF_SHIELD].uExpireTime | |
2062 | pPlayer->pPlayerBuffs[PLAYER_BUFF_STONESKIN].uExpireTime ) | |
2063 sub_441A4E(i); | |
2064 continue; | |
2065 } | |
2066 if (pPlayer->IsDead()) | |
2067 { | |
2575 | 2068 pPortrait = game_ui_player_face_dead; |
2501 | 2069 if ( pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime ) |
2575 | 2070 pRenderer->DrawTextureGrayShade(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i]/640.0f, 388/480.0f, pPortrait); |
2501 | 2071 else |
2575 | 2072 pRenderer->DrawTextureAlphaNew((pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i] + 1)/640.0f, 388/480.0f, pPortrait); |
2501 | 2073 if ( pPlayer->pPlayerBuffs[PLAYER_BUFF_BLESS].uExpireTime | pPlayer->pPlayerBuffs[PLAYER_BUFF_HASTE].uExpireTime |
2074 | pPlayer->pPlayerBuffs[PLAYER_BUFF_HEROISM].uExpireTime | pPlayer->pPlayerBuffs[PLAYER_BUFF_SHIELD].uExpireTime | |
2075 | pPlayer->pPlayerBuffs[PLAYER_BUFF_STONESKIN].uExpireTime ) | |
2076 sub_441A4E(i); | |
2077 continue; | |
2078 } | |
2079 face_expression_ID = 0; | |
2080 for ( uint j = 0; j < pPlayerFrameTable->uNumFrames; ++j ) | |
2081 if ( pPlayerFrameTable->pFrames[j].expression == pPlayer->expression ) | |
2082 { | |
2083 face_expression_ID = j; | |
2084 break; | |
2085 } | |
2086 if ( face_expression_ID == 0 ) | |
2087 face_expression_ID = 1; | |
2088 if (pPlayer->expression == CHARACTER_EXPRESSION_21) | |
2089 pFrame = pPlayerFrameTable->GetFrameBy_y(&pPlayer->_expression21_frameset, &pPlayer->_expression21_animtime, pMiscTimer->uTimeElapsed); | |
2090 else | |
2091 pFrame = pPlayerFrameTable->GetFrameBy_x(face_expression_ID, pPlayer->uExpressionTimePassed); | |
2092 if (pPlayer->field_1AA2 != pFrame->uTextureID - 1 || _this ) | |
2093 { | |
2094 pPlayer->field_1AA2 = pFrame->uTextureID - 1; | |
2575 | 2095 pPortrait = game_ui_player_faces[i][pPlayer->field_1AA2];//pFace = (Texture_MM7 *)game_ui_player_faces[i][pFrame->uTextureID]; |
2501 | 2096 if ( pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime ) |
2575 | 2097 pRenderer->DrawTextureGrayShade(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i]/640.0f, 388/480.0f, pPortrait); |
2501 | 2098 else |
2575 | 2099 pRenderer->DrawTextureAlphaNew((pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i] + 1)/640.0f, 388/480.0f, pPortrait); |
2501 | 2100 if ( pPlayer->pPlayerBuffs[PLAYER_BUFF_BLESS].uExpireTime | pPlayer->pPlayerBuffs[PLAYER_BUFF_HASTE].uExpireTime |
2101 | pPlayer->pPlayerBuffs[PLAYER_BUFF_HEROISM].uExpireTime | pPlayer->pPlayerBuffs[PLAYER_BUFF_SHIELD].uExpireTime | |
2102 | pPlayer->pPlayerBuffs[PLAYER_BUFF_STONESKIN].uExpireTime ) | |
2103 sub_441A4E(i); | |
2104 continue; | |
2105 } | |
2106 } | |
2107 if ( pParty->bTurnBasedModeOn == 1 ) | |
2108 { | |
2109 if ( pTurnEngine->turn_stage != TE_WAIT ) | |
2110 { | |
2111 if (PID_TYPE(pTurnEngine->pQueue[0].uPackedID) == OBJECT_Player) | |
2112 { | |
2113 if ( pTurnEngine->uActorQueueSize > 0 ) | |
2114 { | |
2115 for (uint i = 0; i < (uint)pTurnEngine->uActorQueueSize; ++i) | |
2116 { | |
2117 if (PID_TYPE(pTurnEngine->pQueue[i].uPackedID) != OBJECT_Player) | |
2118 break; | |
2572
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2566
diff
changeset
|
2119 |
2574 | 2120 auto alert_texture = game_ui_player_alert_green; |
2121 if (pParty->GetRedAlert()) | |
2122 alert_texture = game_ui_player_alert_red; | |
2123 else if (pParty->GetYellowAlert()) | |
2124 alert_texture = game_ui_player_alert_yellow; | |
2125 | |
2126 pRenderer->DrawTextureAlphaNew( | |
2127 (pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[PID_ID(pTurnEngine->pQueue[i].uPackedID)] - 4)/640.0f, | |
2128 385/480.0f, | |
2129 alert_texture | |
2572
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2566
diff
changeset
|
2130 ); |
2501 | 2131 } |
2132 } | |
2133 } | |
2134 } | |
2135 } | |
2136 else | |
2137 { | |
2138 for (uint i = 0; i < 4; ++i) | |
2139 { | |
2140 if (pParty->pPlayers[i].CanAct() && !pParty->pPlayers[i].uTimeToRecovery) | |
2141 { | |
2574 | 2142 auto alert_texture = game_ui_player_alert_green; |
2143 if (pParty->GetRedAlert()) | |
2144 alert_texture = game_ui_player_alert_red; | |
2145 else if (pParty->GetYellowAlert()) | |
2146 alert_texture = game_ui_player_alert_yellow; | |
2147 | |
2148 pRenderer->DrawTextureAlphaNew( | |
2149 (pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i] - 4)/640.0f, | |
2150 385/480.0f, | |
2151 alert_texture); | |
2501 | 2152 } |
2153 } | |
2154 } | |
2155 } | |
2156 | |
2157 //----- (00441D38) -------------------------------------------------------- | |
2158 void GameUI_DrawMinimap(unsigned int uX, unsigned int uY, unsigned int uZ, unsigned int uW, unsigned int uZoom, unsigned int bRedrawOdmMinimap) | |
2159 { | |
2160 int uHeight; // ebx@6 | |
2161 signed int pW; // ebx@23 | |
2162 int v15; // eax@23 | |
2163 double v20; // st7@30 | |
2164 signed int v27; // eax@37 | |
2165 //unsigned __int16 *v28; // ecx@37 | |
2166 signed int v29; // edi@40 | |
2167 int pPoint_X; // edi@72 | |
2168 int pPoint_Y; // ebx@72 | |
2169 unsigned int lPitch; // [sp+20h] [bp-34h]@1 | |
2170 signed int pY; // [sp+20h] [bp-34h]@23 | |
2171 signed int pX; // [sp+24h] [bp-30h]@23 | |
2172 signed int v70; // [sp+24h] [bp-30h]@37 | |
2173 signed int uBluea; // [sp+28h] [bp-2Ch]@37 | |
2174 int v73; // [sp+2Ch] [bp-28h]@30 | |
2175 signed int uCenterY; // [sp+48h] [bp-Ch]@1 | |
2176 signed int uCenterX; // [sp+4Ch] [bp-8h]@1 | |
2177 signed int uWidth; // [sp+5Ch] [bp+8h]@30 | |
2178 signed int pZ; // [sp+60h] [bp+Ch]@23 | |
2179 float uWb; // [sp+60h] [bp+Ch]@30 | |
2180 unsigned int pColor; | |
2181 | |
2182 uCenterX = (uX + uZ) / 2; | |
2183 uCenterY = (uY + uW) / 2; | |
2184 lPitch = pRenderer->uTargetSurfacePitch; | |
2185 bool bWizardEyeActive = pParty->WizardEyeActive(); | |
2186 int uWizardEyeSkillLevel = pParty->WizardEyeSkillLevel(); | |
2187 if ( CheckHiredNPCSpeciality(Cartographer) ) | |
2188 { | |
2189 bWizardEyeActive = true; | |
2190 uWizardEyeSkillLevel = 2; | |
2191 } | |
2192 | |
2193 if ( wizard_eye ) | |
2194 { | |
2195 bWizardEyeActive = true; | |
2196 uWizardEyeSkillLevel = 3; | |
2197 } | |
2198 pRenderer->SetRasterClipRect(uX, uY, uZ - 1, uW - 1); | |
2199 uHeight = uW - uY; | |
2200 uWidth = uZ - uX; | |
2201 | |
2202 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor) | |
2203 { | |
2572
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2566
diff
changeset
|
2204 uchar* pMapLod0 = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].paletted_pixels; |
2501 | 2205 ushort* pPal = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].pPalette16; |
2206 v73 = (1 << (pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uWidthLn2 + 16)) / (signed int)uZoom; | |
2207 v20 = (double)(pParty->vPosition.x + 32768) / (double)(1 << (16 - pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uWidthLn2)); | |
2208 uWb = (double)(32768 - pParty->vPosition.y) / (double)(1 << (16 - pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uWidthLn2)); | |
2209 switch (uZoom) | |
2210 { | |
2211 case 512: | |
2212 { | |
2213 v20 = v20 - (double)(uWidth / 2); | |
2214 uWb = uWb - (double)(uHeight / 2); | |
2215 } | |
2216 break; | |
2217 case 1024: | |
2218 { | |
2219 v20 = v20 - (double)(uWidth / 4); | |
2220 uWb = uWb - (double)(uHeight / 4); | |
2221 } | |
2222 break; | |
2223 case 2048: | |
2224 { | |
2225 v20 = v20 - (double)(uWidth / 8); | |
2226 uWb = uWb - (double)(uHeight / 8); | |
2227 } | |
2228 break; | |
2229 default: assert(false); | |
2230 } | |
2231 | |
2232 static unsigned __int16 pOdmMinimap[117][137]; | |
2233 assert(sizeof(pOdmMinimap) == 137 * 117 * sizeof(short)); | |
2234 | |
2235 v70 = floorf(v20 * 65536.0 + 0.5f);//LODWORD(v24); | |
2236 uBluea = floorf(uWb * 65536.0 + 0.5f);//LODWORD(v25); | |
2237 v27 = uBluea >> 16; | |
2238 //v28 = &pRenderer->pTargetSurface[uX + uY * lPitch]; | |
2239 | |
2240 if (pMapLod0 && bRedrawOdmMinimap) | |
2241 { | |
2242 assert(uWidth == 137 && uHeight == 117); | |
2243 //auto pMinimap = (unsigned __int16 *)pOdmMinimap; | |
2244 | |
2245 ushort mapWidth = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uTextureWidth; | |
2246 | |
2247 v29 = v70 >> 16; | |
2248 for (int y = 0; y < uHeight; ++y) | |
2249 { | |
2250 uchar* pMapLod0Line = &pMapLod0[v27 * mapWidth]; | |
2251 for (int x = 0; x < uWidth; ++x) | |
2252 { | |
2253 //*pMinimap++ = pPal[pMapLod0Line[v29]]; | |
2254 pRenderer->WritePixel16(uX + x, uY + y, pPal[pMapLod0Line[v29]]); | |
2255 v29 = (v70 + x * v73) >> 16; | |
2256 } | |
2257 uBluea += v73; | |
2258 v27 = uBluea >> 16; | |
2259 } | |
2260 | |
2261 /*v29 = v70 >> 16; | |
2262 for (int y = 0; y < uHeight; ++y) | |
2263 { | |
2264 uchar* pMapLod0Line = &pMapLod0[v27 * mapWidth]; | |
2265 for (int x = 0; x < uWidth; ++x) | |
2266 { | |
2267 //*pMinimap++ = pPal[pMapLod0Line[v29]]; | |
2268 pOdmMinimap[y][x] = pPal[pMapLod0Line[v29]]; | |
2269 v29 = (v70 + x * v73) >> 16; | |
2270 } | |
2271 v29 = v70 >> 16; | |
2272 v28 += 137 - uWidth; | |
2273 uBluea += v73; | |
2274 v27 = uBluea >> 16; | |
2275 }*/ | |
2276 } | |
2277 | |
2278 /*for (int y = 0; y < 117; ++y) | |
2279 { | |
2280 for (int x = 0; x < 137; ++x) | |
2281 { | |
2282 *v28++ = pOdmMinimap[y][x]; | |
2283 } | |
2284 v28 += lPitch - 137; | |
2285 }*/ | |
2286 uNumBlueFacesInBLVMinimap = 0; | |
2287 } | |
2288 else// uCurrentlyLoadedLevelType == LEVEL_Indoor | |
2289 { | |
2290 pRenderer->FillRectFast(uX, uY, uZ - uX, uHeight, 0xF); | |
2291 uNumBlueFacesInBLVMinimap = 0; | |
2292 | |
2293 for (uint i = 0; i < (uint)pIndoor->pMapOutlines->uNumOutlines; ++i) | |
2294 { | |
2295 BLVMapOutline* pOutline = &pIndoor->pMapOutlines->pOutlines[i]; | |
2296 //BLVFace* pFace1 = &pIndoor->pFaces[pOutline->uFace1ID]; | |
2297 //BLVFace* pFace2 = &pIndoor->pFaces[pOutline->uFace2ID]; | |
2298 if (pIndoor->pFaces[pOutline->uFace1ID].Visible() && pIndoor->pFaces[pOutline->uFace2ID].Visible()) | |
2299 { | |
2300 if ( pOutline->uFlags & 1 ) | |
2301 { | |
2302 if (bWizardEyeActive && uWizardEyeSkillLevel >= 3 && | |
2303 (pIndoor->pFaces[pOutline->uFace1ID].Clickable() || pIndoor->pFaces[pOutline->uFace2ID].Clickable()) && | |
2508 | 2304 (pIndoor->pFaceExtras[pIndoor->pFaces[pOutline->uFace1ID].uFaceExtraID].uEventID |
2305 || pIndoor->pFaceExtras[pIndoor->pFaces[pOutline->uFace2ID].uFaceExtraID].uEventID)) | |
2501 | 2306 { |
2307 if (uNumBlueFacesInBLVMinimap < 49) | |
2308 pBlueFacesInBLVMinimapIDs[uNumBlueFacesInBLVMinimap++] = i; | |
2309 } | |
2310 else | |
2311 { | |
2312 pX = uCenterX + ((signed int)(((unsigned int)(fixpoint_mul(uZoom, pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex1ID].x)) << 16) - uZoom * pParty->vPosition.x) >> 16); | |
2313 pY = uCenterY - ((signed int)(((unsigned int)(fixpoint_mul(uZoom, pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex1ID].y)) << 16) - uZoom * pParty->vPosition.y) >> 16); | |
2314 pZ = uCenterX + ((signed int)(((unsigned int)(fixpoint_mul(uZoom, pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex2ID].x)) << 16) - uZoom * pParty->vPosition.x) >> 16); | |
2315 pW = uCenterY - ((signed int)(((unsigned int)(fixpoint_mul(uZoom, pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex2ID].y)) << 16) - uZoom * pParty->vPosition.y) >> 16); | |
2316 v15 = abs(pOutline->sZ - pParty->vPosition.z) / 8; | |
2317 if ( v15 > 100 ) | |
2318 v15 = 100; | |
2319 pRenderer->RasterLine2D(pX, pY, pZ, pW, viewparams->pPalette[-v15 + 200]); | |
2320 } | |
2321 continue; | |
2322 } | |
2508 | 2323 if (pIndoor->pFaces[pOutline->uFace1ID].uAttributes & FACE_UNKNOW7 |
2324 || pIndoor->pFaces[pOutline->uFace2ID].uAttributes & FACE_UNKNOW7) | |
2501 | 2325 { |
2326 pOutline->uFlags = pOutline->uFlags | 1; | |
2327 pIndoor->_visible_outlines[i >> 3] |= 1 << (7 - i % 8); | |
2328 if (bWizardEyeActive && uWizardEyeSkillLevel >= 3 && | |
2329 (pIndoor->pFaces[pOutline->uFace1ID].Clickable() || pIndoor->pFaces[pOutline->uFace2ID].Clickable()) && | |
2330 (pIndoor->pFaceExtras[pIndoor->pFaces[pOutline->uFace1ID].uFaceExtraID].uEventID || pIndoor->pFaceExtras[pIndoor->pFaces[pOutline->uFace2ID].uFaceExtraID].uEventID)) | |
2331 { | |
2332 if (uNumBlueFacesInBLVMinimap < 49) | |
2333 pBlueFacesInBLVMinimapIDs[uNumBlueFacesInBLVMinimap++] = i; | |
2334 } | |
2335 else | |
2336 { | |
2337 pX = uCenterX + ((signed int)(((unsigned int)(fixpoint_mul(uZoom, pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex1ID].x)) << 16) - uZoom * pParty->vPosition.x) >> 16); | |
2338 pY = uCenterY - ((signed int)(((unsigned int)(fixpoint_mul(uZoom, pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex1ID].y)) << 16) - uZoom * pParty->vPosition.y) >> 16); | |
2339 pZ = uCenterX + ((signed int)(((unsigned int)(fixpoint_mul(uZoom, pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex2ID].x)) << 16) - uZoom * pParty->vPosition.x) >> 16); | |
2340 pW = uCenterY - ((signed int)(((unsigned int)(fixpoint_mul(uZoom, pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex2ID].y)) << 16) - uZoom * pParty->vPosition.y) >> 16); | |
2341 v15 = abs(pOutline->sZ - pParty->vPosition.z) / 8; | |
2342 if ( v15 > 100 ) | |
2343 v15 = 100; | |
2344 pRenderer->RasterLine2D(pX, pY, pZ, pW, viewparams->pPalette[-v15 + 200]); | |
2345 } | |
2346 continue; | |
2347 } | |
2348 } | |
2349 } | |
2350 | |
2351 for (uint i = 0; i < uNumBlueFacesInBLVMinimap; ++i) | |
2352 { | |
2353 BLVMapOutline* pOutline = &pIndoor->pMapOutlines->pOutlines[pBlueFacesInBLVMinimapIDs[i]]; | |
2354 pX = uCenterX + ((signed int)(((unsigned int)(fixpoint_mul(uZoom, pIndoor->pVertices[pOutline->uVertex1ID].x)) << 16) - uZoom * pParty->vPosition.x) >> 16); | |
2355 pY = uCenterY - ((signed int)(((unsigned int)(fixpoint_mul(uZoom, pIndoor->pVertices[pOutline->uVertex1ID].y)) << 16) - uZoom * pParty->vPosition.y) >> 16); | |
2356 pZ = uCenterX + ((signed int)(((unsigned int)(fixpoint_mul(uZoom, pIndoor->pVertices[pOutline->uVertex2ID].x)) << 16) - uZoom * pParty->vPosition.x) >> 16); | |
2357 pW = uCenterY - ((signed int)(((unsigned int)(fixpoint_mul(uZoom, pIndoor->pVertices[pOutline->uVertex2ID].y)) << 16) - uZoom * pParty->vPosition.y) >> 16); | |
2358 pRenderer->RasterLine2D(pX, pY, pZ, pW, ui_game_minimap_outline_color); | |
2359 } | |
2360 } | |
2361 | |
2362 //draw arrow on the minimap(include. Ritor1) | |
2363 uint arrow_idx; | |
2364 unsigned int rotate = pParty->sRotationY & stru_5C6E00->uDoublePiMask; | |
2365 if ( (signed int)rotate <= 1920 ) | |
2366 arrow_idx = 6; | |
2516 | 2367 if ( (signed int)rotate < 1664 ) |
2501 | 2368 arrow_idx = 5; |
2516 | 2369 if ( (signed int)rotate <= 1408 ) |
2501 | 2370 arrow_idx = 4; |
2516 | 2371 if ( (signed int)rotate < 1152 ) |
2501 | 2372 arrow_idx = 3; |
2516 | 2373 if ( (signed int)rotate <= 896 ) |
2501 | 2374 arrow_idx = 2; |
2516 | 2375 if ( (signed int)rotate < 640 ) |
2501 | 2376 arrow_idx = 1; |
2516 | 2377 if ( (signed int)rotate <= 384 ) |
2501 | 2378 arrow_idx = 0; |
2516 | 2379 if ( (signed int)rotate < 128 || (signed int)rotate > 1920 ) |
2501 | 2380 arrow_idx = 7; |
2574 | 2381 pRenderer->DrawTextureAlphaNew( |
2382 (uCenterX - 3)/640.0f, | |
2383 (uCenterY - 3)/480.0f, | |
2384 game_ui_minimap_dirs[arrow_idx]); | |
2501 | 2385 |
2386 //draw objects on the minimap | |
2387 if ( bWizardEyeActive ) | |
2388 { | |
2389 if ( uWizardEyeSkillLevel >= 2 ) | |
2390 { | |
2391 for ( uint i = 0; i < uNumSpriteObjects; ++i ) | |
2392 { | |
2393 if ( !pSpriteObjects[i].uType || !pSpriteObjects[i].uObjectDescID ) | |
2394 continue; | |
2395 //if (uWizardEyeSkillLevel == 1 | |
2396 pPoint_X = uCenterX + fixpoint_mul((pSpriteObjects[i].vPosition.x - pParty->vPosition.x), uZoom); | |
2397 pPoint_Y = uCenterY - fixpoint_mul((pSpriteObjects[i].vPosition.y - pParty->vPosition.y), uZoom); | |
2398 //if ( pPoint_X >= pRenderer->raster_clip_x && pPoint_X <= pRenderer->raster_clip_z && | |
2399 // pPoint_Y >= pRenderer->raster_clip_y && pPoint_Y <= pRenderer->raster_clip_w) | |
2400 { | |
2401 if (pObjectList->pObjects[pSpriteObjects[i].uObjectDescID].uFlags & OBJECT_DESC_UNPICKABLE) | |
2402 { | |
2403 pRenderer->RasterLine2D(pPoint_X, pPoint_Y, pPoint_X, pPoint_Y, ui_game_minimap_projectile_color); | |
2404 } | |
2405 else if ( uZoom > 512 ) | |
2406 { | |
2407 pRenderer->RasterLine2D(pPoint_X - 2, pPoint_Y, pPoint_X - 2, pPoint_Y + 1, ui_game_minimap_treasure_color); | |
2408 pRenderer->RasterLine2D(pPoint_X - 1, pPoint_Y - 1, pPoint_X - 1, pPoint_Y + 1, ui_game_minimap_treasure_color); | |
2409 pRenderer->RasterLine2D(pPoint_X, pPoint_Y - 2, pPoint_X, pPoint_Y + 1, ui_game_minimap_treasure_color); | |
2410 pRenderer->RasterLine2D(pPoint_X + 1, pPoint_Y - 1, pPoint_X + 1, pPoint_Y + 1, ui_game_minimap_treasure_color); | |
2411 pRenderer->RasterLine2D(pPoint_X + 2, pPoint_Y, pPoint_X + 2, pPoint_Y + 1, ui_game_minimap_treasure_color); | |
2412 } | |
2413 else | |
2414 { | |
2415 pRenderer->RasterLine2D(pPoint_X - 1, pPoint_Y - 1, pPoint_X - 1, pPoint_Y, ui_game_minimap_treasure_color); | |
2416 pRenderer->RasterLine2D(pPoint_X, pPoint_Y - 1, pPoint_X, pPoint_Y, ui_game_minimap_treasure_color); | |
2417 } | |
2418 } | |
2419 } | |
2420 } | |
2421 for ( uint i = 0; i < uNumActors; ++i )//draw actors(îòðèñîâêà ìîíñòðîâ è íïñ) | |
2422 { | |
2423 if ( pActors[i].uAIState != Removed && pActors[i].uAIState != Disabled | |
2424 && (pActors[i].uAIState == Dead || pActors[i].ActorNearby()) ) | |
2425 { | |
2426 pPoint_X = uCenterX + (fixpoint_mul((pActors[i].vPosition.x - pParty->vPosition.x), uZoom)); | |
2427 pPoint_Y = uCenterY - (fixpoint_mul((pActors[i].vPosition.y - pParty->vPosition.y), uZoom)); | |
2428 //if ( pPoint_X >= pRenderer->raster_clip_x && pPoint_X <= pRenderer->raster_clip_z | |
2429 // && pPoint_Y >= pRenderer->raster_clip_y && pPoint_Y <= pRenderer->raster_clip_w ) | |
2430 { | |
2431 pColor = ui_game_minimap_actor_friendly_color; | |
2432 if ( pActors[i].uAttributes & ACTOR_HOSTILE ) | |
2433 pColor = ui_game_minimap_actor_hostile_color; | |
2434 if ( pActors[i].uAIState == Dead) | |
2435 pColor = ui_game_minimap_actor_corpse_color; | |
2436 if ( uZoom > 1024 ) | |
2437 { | |
2438 pRenderer->RasterLine2D(pPoint_X - 2, pPoint_Y - 1, pPoint_X - 2, pPoint_Y + 1, pColor); | |
2439 pRenderer->RasterLine2D(pPoint_X - 1, pPoint_Y - 2, pPoint_X - 1, pPoint_Y + 2, pColor); | |
2440 pRenderer->RasterLine2D(pPoint_X, pPoint_Y - 2, pPoint_X, pPoint_Y + 2, pColor); | |
2441 pRenderer->RasterLine2D(pPoint_X + 1, pPoint_Y - 2, pPoint_X + 1, pPoint_Y + 2, pColor); | |
2442 pRenderer->RasterLine2D(pPoint_X + 2, pPoint_Y - 1, pPoint_X + 2, pPoint_Y + 1, pColor); | |
2443 } | |
2444 else | |
2445 { | |
2446 pRenderer->RasterLine2D(pPoint_X - 1, pPoint_Y - 1, pPoint_X - 1, pPoint_Y, pColor); | |
2447 pRenderer->RasterLine2D(pPoint_X, pPoint_Y - 1, pPoint_X, pPoint_Y, pColor); | |
2448 } | |
2449 } | |
2450 } | |
2451 } | |
2452 for ( uint i = 0; i < (signed int)uNumLevelDecorations; ++i )//draw items(îòðèñîâêà ïðåäìåòîâ) | |
2453 { | |
2454 if ( pLevelDecorations[i].uFlags & 8 ) | |
2455 { | |
2456 pPoint_X = uCenterX + (fixpoint_mul((pLevelDecorations[i].vPosition.x - pParty->vPosition.x), uZoom)); | |
2457 pPoint_Y = uCenterY - (fixpoint_mul((pLevelDecorations[i].vPosition.y - pParty->vPosition.y), uZoom)); | |
2458 //if ( pPoint_X >= pRenderer->raster_clip_x && pPoint_X <= pRenderer->raster_clip_z | |
2459 // && pPoint_Y >= pRenderer->raster_clip_y && pPoint_Y <= pRenderer->raster_clip_w ) | |
2460 { | |
2461 if ( (signed int)uZoom > 512 ) | |
2462 { | |
2463 pRenderer->RasterLine2D(pPoint_X - 1, pPoint_Y - 1, pPoint_X - 1, pPoint_Y + 1, ui_game_minimap_decoration_color_1); | |
2464 pRenderer->RasterLine2D(pPoint_X, pPoint_Y - 1, pPoint_X, pPoint_Y + 1, ui_game_minimap_decoration_color_1); | |
2465 pRenderer->RasterLine2D(pPoint_X + 1, pPoint_Y - 1, pPoint_X + 1, pPoint_Y + 1, ui_game_minimap_decoration_color_1); | |
2466 } | |
2467 else | |
2468 pRenderer->RasterLine2D(pPoint_X, pPoint_Y, pPoint_X, pPoint_Y, ui_game_minimap_decoration_color_1); | |
2469 } | |
2470 } | |
2471 } | |
2472 } | |
2574 | 2473 pRenderer->DrawTextureAlphaNew(468/640.0f, 0, game_ui_minimap_frame); |
2524 | 2474 pRenderer->SetUIClipRect(541, 0, 567, 480); |
2574 | 2475 pRenderer->DrawTextureAlphaNew( |
2476 (floorf(((double)pParty->sRotationY * 0.1171875) + 0.5f) + 285)/640.0f, | |
2477 136/480.0f, | |
2478 game_ui_minimap_compass); | |
2524 | 2479 pRenderer->ResetUIClipRect(); |
2501 | 2480 } |
2481 | |
2482 //----- (00441498) -------------------------------------------------------- | |
2483 void GameUI_DrawTorchlightAndWizardEye() | |
2484 { | |
2541 | 2485 if (current_screen_type == SCREEN_GAME |
2486 || current_screen_type == SCREEN_MENU | |
2487 || current_screen_type == SCREEN_OPTIONS | |
2488 || current_screen_type == SCREEN_REST | |
2489 || current_screen_type == SCREEN_SPELL_BOOK | |
2490 || current_screen_type == SCREEN_CHEST | |
2491 || current_screen_type == SCREEN_SAVEGAME | |
2492 || current_screen_type == SCREEN_LOADGAME | |
2493 || current_screen_type == SCREEN_CHEST_INVENTORY | |
2494 || current_screen_type == SCREEN_BOOKS | |
2495 || current_screen_type == SCREEN_BRANCHLESS_NPC_DIALOG ) | |
2501 | 2496 { |
2497 if (pParty->TorchlightActive()) | |
2498 { | |
2575 | 2499 pRenderer->DrawTextureAlphaNew( |
2500 pUIAnum_Torchlight->x/640.0f, | |
2501 pUIAnum_Torchlight->y/480.0f, | |
2502 pIconsFrameTable->GetFrame(pUIAnum_Torchlight->icon->id, pEventTimer->Time())->texture | |
2503 ); | |
2501 | 2504 } |
2505 if (pParty->WizardEyeActive()) | |
2506 { | |
2575 | 2507 pRenderer->DrawTextureAlphaNew( |
2508 pUIAnim_WizardEye->x/640.0f, | |
2509 pUIAnim_WizardEye->y/480.0f, | |
2510 pIconsFrameTable->GetFrame(pUIAnim_WizardEye->icon->id, pEventTimer->Time())->texture | |
2511 ); | |
2501 | 2512 } |
2513 } | |
2514 } | |
2515 | |
2516 | |
2517 //----- (00491F87) -------------------------------------------------------- | |
2518 void GameUI_DrawHiredNPCs() | |
2519 { | |
2520 unsigned int v13; // eax@23 | |
2521 char pContainer[20]; // [sp+Ch] [bp-30h]@18 | |
2522 signed int uFrameID; // [sp+24h] [bp-18h]@19 | |
2523 int v22; // [sp+34h] [bp-8h]@2 | |
2524 unsigned __int8 pNPC_limit_ID; // [sp+3Bh] [bp-1h]@2 | |
2525 | |
2526 if ( bNoNPCHiring != 1 ) | |
2527 { | |
2528 pNPC_limit_ID = 0; | |
2529 v22 = 0; | |
2530 if (pParty->pHirelings[0].pName) | |
2531 pTmpBuf[v22++] = 0; | |
2532 if (pParty->pHirelings[1].pName) | |
2533 pTmpBuf[v22++] = 1; | |
2534 | |
2535 for (uint i = 0; i < pNPCStats->uNumNewNPCs; ++i) | |
2536 { | |
2537 if (pNPCStats->pNewNPCData[i].uFlags & 128) | |
2538 { | |
2539 if (!pParty->pHirelings[0].pName || strcmp(pNPCStats->pNewNPCData[i].pName, pParty->pHirelings[0].pName)) | |
2540 { | |
2541 if (!pParty->pHirelings[1].pName || strcmp(pNPCStats->pNewNPCData[i].pName, pParty->pHirelings[1].pName)) | |
2542 pTmpBuf[v22++] = i + 2; | |
2543 } | |
2544 } | |
2545 } | |
2546 | |
2547 for ( int i = pParty->hirelingScrollPosition; i < v22 && pNPC_limit_ID < 2; i++ ) | |
2548 { | |
2549 if ( (unsigned __int8)pTmpBuf[i] >= 2 ) | |
2550 { | |
2551 sprintf(pContainer, "NPC%03d", pNPCStats->pNPCData[(unsigned __int8)pTmpBuf[i] + 499].uPortraitID); | |
2575 | 2552 pRenderer->DrawTextureAlphaNew( |
2553 pHiredNPCsIconsOffsetsX[pNPC_limit_ID]/640.0f, | |
2554 pHiredNPCsIconsOffsetsY[pNPC_limit_ID]/480.0f, | |
2555 //pIcons_LOD->GetTexture(pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE)) | |
2556 assets->GetImage_16BitColorKey(pContainer, 0x7FF) | |
2557 ); | |
2501 | 2558 } |
2559 else | |
2560 { | |
2561 sprintf(pContainer, "NPC%03d", pParty->pHirelings[(unsigned __int8)pTmpBuf[i]].uPortraitID); | |
2575 | 2562 pRenderer->DrawTextureAlphaNew( |
2563 pHiredNPCsIconsOffsetsX[pNPC_limit_ID]/640.0f, | |
2564 pHiredNPCsIconsOffsetsY[pNPC_limit_ID]/480.0f, | |
2565 //pIcons_LOD->GetTexture(pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE)) | |
2566 assets->GetImage_16BitColorKey(pContainer, 0x7FF) | |
2567 ); | |
2501 | 2568 if ( pParty->pHirelings[(unsigned __int8)pTmpBuf[i]].evt_A == 1 ) |
2569 { | |
2570 uFrameID = pParty->pHirelings[(unsigned __int8)pTmpBuf[i]].evt_B; | |
2571 v13 = 0; | |
2572 if (pIconsFrameTable->uNumIcons) | |
2573 { | |
2574 for ( v13 = 0; v13 < pIconsFrameTable->uNumIcons; ++v13 ) | |
2575 { | |
2575 | 2576 if ( !_stricmp("spell96", pIconsFrameTable->pIcons[v13].GetAnimationName()) ) |
2501 | 2577 break; |
2578 } | |
2579 } | |
2575 | 2580 pRenderer->DrawTextureAlphaNew( |
2581 pHiredNPCsIconsOffsetsX[pNPC_limit_ID]/640.0f, | |
2582 pHiredNPCsIconsOffsetsY[pNPC_limit_ID]/480.0f, | |
2583 //&pIcons_LOD->pTextures[pIconsFrameTable->GetFrame(v13, uFrameID)->uTextureID] | |
2584 pIconsFrameTable->GetFrame(v13, uFrameID)->texture | |
2585 ); | |
2501 | 2586 } |
2587 } | |
2588 ++pNPC_limit_ID; | |
2589 } | |
2590 } | |
2591 } | |
2592 | |
2593 //----- (004178FE) -------------------------------------------------------- | |
2594 unsigned int UI_GetHealthManaAndOtherQualitiesStringColor(signed int current_pos, signed int base_pos) | |
2595 { | |
2596 unsigned __int16 R, G, B; | |
2597 | |
2598 if ( current_pos <= base_pos ) | |
2599 { | |
2600 if ( current_pos == base_pos )//White | |
2601 return 0; | |
2602 if ( 100 * current_pos / base_pos >= 25 )//Yellow( current_pos > 1/4 ) | |
2603 R = 255, G = 255, B = 100; | |
2604 else//Red( current_pos < 1/4 ) | |
2605 R = 255, G = 0, B = 0; | |
2606 } | |
2607 else//Green | |
2608 R = 0, G = 255, B = 0; | |
2609 return Color16(R, G, B); | |
2610 } | |
2611 | |
2612 //----- (00417939) -------------------------------------------------------- | |
2613 int GetConditionDrawColor(unsigned int uConditionIdx) | |
2614 { | |
2615 switch (uConditionIdx) | |
2616 { | |
2617 case Condition_Zombie: | |
2618 case Condition_Good: | |
2619 return ui_character_condition_normal_color; | |
2620 | |
2621 case Condition_Cursed: | |
2622 case Condition_Weak: | |
2623 case Condition_Fear: | |
2624 case Condition_Drunk: | |
2625 case Condition_Insane: | |
2626 case Condition_Poison_Weak: | |
2627 case Condition_Disease_Weak: | |
2628 return ui_character_condition_light_color; | |
2629 | |
2630 case Condition_Sleep: | |
2631 case Condition_Poison_Medium: | |
2632 case Condition_Disease_Medium: | |
2633 case Condition_Paralyzed: | |
2634 case Condition_Unconcious: | |
2635 return ui_character_condition_moderate_color; | |
2636 | |
2637 case Condition_Poison_Severe: | |
2638 case Condition_Disease_Severe: | |
2639 case Condition_Dead: | |
2640 case Condition_Pertified: | |
2641 case Condition_Eradicated: | |
2642 return ui_character_condition_severe_color; | |
2643 } | |
2644 Error("Invalid condition (%u)", uConditionIdx); | |
2645 } | |
2646 | |
2647 //----- (00495430) -------------------------------------------------------- | |
2648 const char * GetReputationString(signed int a1) | |
2649 { | |
2650 if (a1 >= 25) | |
2651 return pGlobalTXT_LocalizationStrings[379]; // Hated | |
2652 else if (a1 >= 6) | |
2653 return pGlobalTXT_LocalizationStrings[392]; // Unfriendly | |
2654 else if (a1 >= -5) | |
2655 return pGlobalTXT_LocalizationStrings[399]; // Neutral; | |
2656 else if (a1 >= -24) | |
2657 return pGlobalTXT_LocalizationStrings[402]; // Friendly | |
2658 else | |
2659 return pGlobalTXT_LocalizationStrings[434]; // Respected; | |
2660 } | |
2661 | |
2662 //----- (00441A4E) -------------------------------------------------------- | |
2663 __int16 __fastcall sub_441A4E(int a1)//for blessing | |
2664 { | |
2665 __int16 result; // ax@1 | |
2666 int v2; // ebx@1 | |
2667 // char *v3; // esi@1 | |
2668 // int v4; // edi@4 | |
2669 bool v5; // ecx@4 | |
2670 SpriteFrame *pFrame; // eax@6 | |
2671 //SpriteFrame *v7; // edi@6 | |
2672 int v8; // eax@6 | |
2673 // unsigned __int16 v9; // ax@6 | |
2674 RenderBillboardTransform_local0 v10; // [sp+Ch] [bp-5Ch]@1 | |
2675 int v11; // [sp+5Ch] [bp-Ch]@6 | |
2676 int v12; // [sp+60h] [bp-8h]@1 | |
2677 //int v13; // [sp+64h] [bp-4h]@6 | |
2678 | |
2679 v10.sParentBillboardID = -1; | |
2680 v10.pTarget = pRenderer->pTargetSurface; | |
2681 v10.pTargetZ = pRenderer->pActiveZBuffer; | |
2682 v10.uTargetPitch = pRenderer->GetRenderWidth(); | |
2683 result = 0; | |
2684 v2 = a1; | |
2685 v10.uViewportX = 0; | |
2686 v10.uViewportY = 0; | |
2687 v10.uViewportZ = window->GetWidth() - 1; | |
2688 v10.uViewportW = window->GetHeight() - 1; | |
2689 v12 = 0; | |
2690 //v3 = (char *)&pOtherOverlayList->pOverlays[0].field_C; | |
2691 //do | |
2692 for (uint i = 0; i < 50; ++i) | |
2693 { | |
2694 if (pOtherOverlayList->pOverlays[i].field_6 > 0) | |
2695 { | |
2696 result = pOtherOverlayList->pOverlays[i].field_0; | |
2697 if (pOtherOverlayList->pOverlays[i].field_0 >= 300) | |
2698 { | |
2699 //v4 = result; | |
2700 v5 = pOtherOverlayList->pOverlays[i].field_0 == v2 + 320 | |
2701 || pOtherOverlayList->pOverlays[i].field_0 == v2 + 330 | |
2702 || pOtherOverlayList->pOverlays[i].field_0 == v2 + 340 | |
2703 || pOtherOverlayList->pOverlays[i].field_0 == v2 + 350; | |
2704 pOtherOverlayList->pOverlays[i].field_0 = v2 + 310; | |
2705 if (pOtherOverlayList->pOverlays[i].field_0 == v2 + 310 || v5) | |
2706 { | |
2707 if (!pOtherOverlayList->pOverlays[i].field_0) | |
2708 { | |
2709 pFrame = pSpriteFrameTable->GetFrame(pOverlayList->pOverlays[pOtherOverlayList->pOverlays[i].field_2].uSpriteFramesetID, | |
2710 pOtherOverlayList->pOverlays[i].field_4); | |
2711 //v7 = v6; | |
2712 v11 = pOtherOverlayList->pOverlays[i].field_E; | |
2713 //v13 = pFrame->scale; | |
2714 //v13 = fixpoint_mul(v11, pFrame->scale); | |
2715 v10.uScreenSpaceX = pOtherOverlayList->pOverlays[i].field_8; | |
2716 v10.uScreenSpaceY = pOtherOverlayList->pOverlays[i].field_A; | |
2717 v10._screenspace_x_scaler_packedfloat = fixpoint_mul(v11, pFrame->scale); | |
2718 v10._screenspace_y_scaler_packedfloat = fixpoint_mul(v11, pFrame->scale); | |
2719 v10.pPalette = PaletteManager::Get_Dark_or_Red_LUT(pFrame->uPaletteIndex, 0, 1); | |
2720 v8 = pOtherOverlayList->pOverlays[i].field_2; | |
2721 v10.sZValue = 0; | |
2722 v10.uFlags = 0; | |
2723 //v9 = pOverlayList->pOverlays[v8].uOverlayType; | |
2724 if (!pOverlayList->pOverlays[v8].uOverlayType || pOverlayList->pOverlays[v8].uOverlayType == 2) | |
2725 v10.uScreenSpaceY += pSprites_LOD->pSpriteHeaders[pFrame->pHwSpriteIDs[0]].uHeight / 2; | |
2726 result = pSprites_LOD->pSpriteHeaders[pFrame->pHwSpriteIDs[0]]._4AD2D1(&v10, 0); | |
2727 ++v12; | |
2728 if (v12 == 5) | |
2729 break; | |
2730 } | |
2731 } | |
2732 } | |
2733 } | |
2734 //v3 += 20; | |
2735 } | |
2736 //while ( (signed int)v3 < (signed int)&pOverlayList->pOverlays ); | |
2737 return result; | |
2738 } |