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