Mercurial > mm7
comparison GUI/UI/Spellbook.cpp @ 2574:dd36326a9994
More texture refactoring
GetLeather -> DrawTextureCustomHeight
author | a.parshin |
---|---|
date | Mon, 07 Mar 2016 03:48:40 +0200 |
parents | 0c67be4ec900 |
children |
comparison
equal
deleted
inserted
replaced
2573:0c67be4ec900 | 2574:dd36326a9994 |
---|---|
1 #include "Engine/Engine.h" | 1 #include "Engine/Engine.h" |
2 #include "Engine/AssetsManager.h" | |
2 #include "Engine/Party.h" | 3 #include "Engine/Party.h" |
3 #include "Engine/LOD.h" | 4 #include "Engine/LOD.h" |
4 #include "Engine/Timer.h" | 5 #include "Engine/Timer.h" |
5 #include "Engine/texts.h" | 6 #include "Engine/texts.h" |
6 #include "Engine/Graphics/Render.h" | 7 #include "Engine/Graphics/Render.h" |
38 { 0, 9, 3, 7, 1, 5, 2, 10, 11, 8, 6, 4 } | 39 { 0, 9, 3, 7, 1, 5, 2, 10, 11, 8, 6, 4 } |
39 } | 40 } |
40 }; | 41 }; |
41 | 42 |
42 | 43 |
44 Image *ui_spellbook_btn_quckspell = nullptr; | |
45 Image *ui_spellbook_btn_quckspell_click = nullptr; | |
46 Image *ui_spellbook_btn_close = nullptr; | |
47 Image *ui_spellbook_btn_close_click = nullptr; | |
48 | |
49 | |
50 std::array<Image *, 12> SBPageCSpellsTextureList; | |
51 std::array<Image *, 12> SBPageSSpellsTextureList; | |
52 | |
53 std::array<Image *, 9> ui_spellbook_school_backgrounds; | |
54 std::array<std::array<Image *, 2>, 9> ui_spellbook_school_tabs; | |
55 | |
43 | 56 |
44 | 57 |
45 GUIWindow_Spellbook::GUIWindow_Spellbook() : | 58 GUIWindow_Spellbook::GUIWindow_Spellbook() : |
46 GUIWindow(0, 0, window->GetWidth(), window->GetHeight(), 0, nullptr) | 59 GUIWindow(0, 0, window->GetWidth(), window->GetHeight(), 0, nullptr) |
47 { | 60 { |
62 | 75 |
63 void GUIWindow_Spellbook::OpenSpellbookPage(int page) | 76 void GUIWindow_Spellbook::OpenSpellbookPage(int page) |
64 { | 77 { |
65 // ------------------------------------ | 78 // ------------------------------------ |
66 // 004304E7 void Game_EventLoop -- part | 79 // 004304E7 void Game_EventLoop -- part |
67 | 80 |
68 OnCloseSpellBookPage(); | 81 OnCloseSpellBookPage(); |
69 pPlayers[uActiveCharacter]->lastOpenedSpellbookPage = page; | 82 pPlayers[uActiveCharacter]->lastOpenedSpellbookPage = page; |
70 OpenSpellbook(); | 83 OpenSpellbook(); |
71 pAudioPlayer->PlaySound((SoundID)(SOUND_TurnPageU + rand() % 2), 0, 0, -1, 0, 0, 0, 0); | 84 pAudioPlayer->PlaySound((SoundID)(SOUND_TurnPageU + rand() % 2), 0, 0, -1, 0, 0, 0, 0); |
72 } | 85 } |
93 { | 106 { |
94 if (!chapter->bIsSpellAvailable[i]) | 107 if (!chapter->bIsSpellAvailable[i]) |
95 continue; | 108 continue; |
96 v4 = pPlayer->lastOpenedSpellbookPage; | 109 v4 = pPlayer->lastOpenedSpellbookPage; |
97 //v4 = (12 * pPlayer->lastOpenedSpellbookPage + pSpellbookSpellIndices[pPlayer->lastOpenedSpellbookPage][i + 1]); | 110 //v4 = (12 * pPlayer->lastOpenedSpellbookPage + pSpellbookSpellIndices[pPlayer->lastOpenedSpellbookPage][i + 1]); |
98 CreateButton(pViewport->uViewportTL_X + pIconPos[v4][pSpellbookSpellIndices[v4][i + 1]].Xpos, | 111 CreateButton( |
112 pViewport->uViewportTL_X + pIconPos[v4][pSpellbookSpellIndices[v4][i + 1]].Xpos, | |
99 pViewport->uViewportTL_Y + pIconPos[v4][pSpellbookSpellIndices[v4][i + 1]].Ypos, //dword_4E20D0 | 113 pViewport->uViewportTL_Y + pIconPos[v4][pSpellbookSpellIndices[v4][i + 1]].Ypos, //dword_4E20D0 |
100 SBPageSSpellsTextureList[i + 1]->uTextureWidth, | 114 SBPageSSpellsTextureList[i + 1]->GetWidth(), |
101 SBPageSSpellsTextureList[i + 1]->uTextureHeight, | 115 SBPageSSpellsTextureList[i + 1]->GetHeight(), |
102 1, 79, UIMSG_SelectSpell, i, 0, "", 0); | 116 1, 79, UIMSG_SelectSpell, i, 0, "", 0); |
103 ++a2; | 117 ++a2; |
104 //++v3; | 118 //++v3; |
105 } | 119 } |
106 //while ( (signed int)v3 < 11 ); | 120 //while ( (signed int)v3 < 11 ); |
117 if (pPlayer->pActiveSkills[PLAYER_SKILL_MIND]) CreateButton(400, 196, 50, 36, 1, 0, UIMSG_OpenSpellbookPage, 5, 0, aSpellSchoolNames[5], 0); | 131 if (pPlayer->pActiveSkills[PLAYER_SKILL_MIND]) CreateButton(400, 196, 50, 36, 1, 0, UIMSG_OpenSpellbookPage, 5, 0, aSpellSchoolNames[5], 0); |
118 if (pPlayer->pActiveSkills[PLAYER_SKILL_BODY]) CreateButton(400, 234, 50, 36, 1, 0, UIMSG_OpenSpellbookPage, 6, 0, aSpellSchoolNames[6], 0); | 132 if (pPlayer->pActiveSkills[PLAYER_SKILL_BODY]) CreateButton(400, 234, 50, 36, 1, 0, UIMSG_OpenSpellbookPage, 6, 0, aSpellSchoolNames[6], 0); |
119 if (pPlayer->pActiveSkills[PLAYER_SKILL_LIGHT]) CreateButton(400, 271, 50, 36, 1, 0, UIMSG_OpenSpellbookPage, 7, 0, aSpellSchoolNames[7], 0); | 133 if (pPlayer->pActiveSkills[PLAYER_SKILL_LIGHT]) CreateButton(400, 271, 50, 36, 1, 0, UIMSG_OpenSpellbookPage, 7, 0, aSpellSchoolNames[7], 0); |
120 if (pPlayer->pActiveSkills[PLAYER_SKILL_DARK]) CreateButton(400, 307, 50, 36, 1, 0, UIMSG_OpenSpellbookPage, 8, 0, aSpellSchoolNames[8], 0); | 134 if (pPlayer->pActiveSkills[PLAYER_SKILL_DARK]) CreateButton(400, 307, 50, 36, 1, 0, UIMSG_OpenSpellbookPage, 8, 0, aSpellSchoolNames[8], 0); |
121 | 135 |
122 CreateButton(476, 450, pSBClickQuickSpellBtnTextr->uTextureWidth, pSBClickQuickSpellBtnTextr->uTextureHeight, 1, 78, UIMSG_ClickInstallRemoveQuickSpellBtn, 0, 0, "", 0); | 136 CreateButton(476, 450, ui_spellbook_btn_quckspell->GetWidth(), ui_spellbook_btn_quckspell->GetHeight(), 1, 78, UIMSG_ClickInstallRemoveQuickSpellBtn, 0, 0, "", 0); |
123 pBtn_InstallRemoveSpell = CreateButton(476, 450, 48, 32, 1, 78, UIMSG_ClickInstallRemoveQuickSpellBtn, 0, 0, "", pSBClickQuickSpellBtnTextr, 0); | 137 pBtn_InstallRemoveSpell = CreateButton(476, 450, 48, 32, 1, 78, UIMSG_ClickInstallRemoveQuickSpellBtn, 0, 0, "", ui_spellbook_btn_quckspell_click, 0); |
124 CreateButton(561, 450, pSpellBookClickCloseBtnTextr->uTextureWidth, pSpellBookClickCloseBtnTextr->uTextureHeight, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[79], 0); | 138 CreateButton(561, 450, ui_spellbook_btn_close->GetWidth(), ui_spellbook_btn_close->GetHeight(), 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[79], 0); |
125 pBtn_CloseBook = CreateButton(561, 450, 48, 32, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[79], pSpellBookClickCloseBtnTextr, 0); | 139 pBtn_CloseBook = CreateButton(561, 450, 48, 32, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[79], ui_spellbook_btn_close_click, 0); |
126 } | 140 } |
127 | 141 |
128 void GUIWindow_Spellbook::Update() | 142 void GUIWindow_Spellbook::Update() |
129 { | 143 { |
130 // ----------------------------------- | 144 // ----------------------------------- |
135 // | 149 // |
136 // -------------------------------------------------- | 150 // -------------------------------------------------- |
137 // 00412B58 void DrawSpellBookContent(Player *player) | 151 // 00412B58 void DrawSpellBookContent(Player *player) |
138 auto player = pPlayers[uActiveCharacter]; | 152 auto player = pPlayers[uActiveCharacter]; |
139 | 153 |
140 Texture *PendingTexture; // edi@1 | 154 //Texture_MM7 *PendingTexture; // edi@1 |
141 Texture *pTexture; // edx@5 | 155 Image *pTexture; // edx@5 |
142 int v10; // eax@13 | 156 int v10; // eax@13 |
143 unsigned int pX_coord; // esi@18 | 157 unsigned int pX_coord; // esi@18 |
144 unsigned int pY_coord; // edi@18 | 158 unsigned int pY_coord; // edi@18 |
145 Texture *pPageTexture; // eax@21 | 159 //Texture_MM7 *pPageTexture; // eax@21 |
146 // signed int v22; // [sp-4h] [bp-24h]@22 | 160 // signed int v22; // [sp-4h] [bp-24h]@22 |
147 POINT a2; // [sp+18h] [bp-8h]@13 | 161 POINT a2; // [sp+18h] [bp-8h]@13 |
148 | 162 |
149 static unsigned int texture_tab_coord1[9][2] = | 163 static unsigned int texture_tab_coord1[9][2] = |
150 { { 406, 9 }, { 406, 46 }, { 406, 84 }, { 406, 121 }, { 407, 158 }, { 405, 196 }, { 405, 234 }, { 405, 272 }, { 405, 309 } }; | 164 { { 406, 9 }, { 406, 46 }, { 406, 84 }, { 406, 121 }, { 407, 158 }, { 405, 196 }, { 405, 234 }, { 405, 272 }, { 405, 309 } }; |
152 static unsigned int texture_tab_coord0[9][2] = | 166 static unsigned int texture_tab_coord0[9][2] = |
153 { { 415, 10 }, { 415, 46 }, { 415, 83 }, { 415, 121 }, { 415, 158 }, { 416, 196 }, { 416, 234 }, { 416, 271 }, { 416, 307 } }; | 167 { { 415, 10 }, { 415, 46 }, { 415, 83 }, { 415, 121 }, { 415, 158 }, { 416, 196 }, { 416, 234 }, { 416, 271 }, { 416, 307 } }; |
154 | 168 |
155 BookUI_Spellbook_DrawCurrentSchoolBackground(); | 169 BookUI_Spellbook_DrawCurrentSchoolBackground(); |
156 | 170 |
157 PendingTexture = pIcons_LOD->GetTexture(pIcons_LOD->FindTextureByName("Pending")); | 171 //PendingTexture = pIcons_LOD->GetTexture(pIcons_LOD->FindTextureByName("Pending")); |
158 pRenderer->ClearZBuffer(0, 479); | 172 pRenderer->ClearZBuffer(0, 479); |
159 if ((11 * player->lastOpenedSpellbookPage) || ((11 * player->lastOpenedSpellbookPage) + 11))//??? maybe structure need fix | 173 if ((11 * player->lastOpenedSpellbookPage) || ((11 * player->lastOpenedSpellbookPage) + 11))//??? maybe structure need fix |
160 { | 174 { |
161 for (uint i = 1; i <= 11; ++i) | 175 for (uint i = 1; i <= 11; ++i) |
162 { | 176 { |
163 if (player->_achieved_awards_bits[(11 * player->lastOpenedSpellbookPage) + i + 63]) | 177 if (player->_achieved_awards_bits[(11 * player->lastOpenedSpellbookPage) + i + 63]) |
164 { | 178 { |
165 if (SBPageSSpellsTextureList[i] != PendingTexture) | 179 if (SBPageSSpellsTextureList[i]) |
166 { | 180 { |
167 if (quick_spell_at_page == i) | 181 if (quick_spell_at_page == i) |
168 pTexture = SBPageCSpellsTextureList[i]; | 182 pTexture = SBPageCSpellsTextureList[i]; |
169 else | 183 else |
170 pTexture = SBPageSSpellsTextureList[i]; | 184 pTexture = SBPageSSpellsTextureList[i]; |
171 if (pTexture->paletted_pixels) | 185 if (pTexture) |
172 { | 186 { |
173 pX_coord = pViewport->uViewportTL_X + pIconPos[player->lastOpenedSpellbookPage][pSpellbookSpellIndices[player->lastOpenedSpellbookPage][i]].Xpos; | 187 pX_coord = pViewport->uViewportTL_X + pIconPos[player->lastOpenedSpellbookPage][pSpellbookSpellIndices[player->lastOpenedSpellbookPage][i]].Xpos; |
174 pY_coord = pViewport->uViewportTL_Y + pIconPos[player->lastOpenedSpellbookPage][pSpellbookSpellIndices[player->lastOpenedSpellbookPage][i]].Ypos; | 188 pY_coord = pViewport->uViewportTL_Y + pIconPos[player->lastOpenedSpellbookPage][pSpellbookSpellIndices[player->lastOpenedSpellbookPage][i]].Ypos; |
175 if (pTexture->pBits & 0x200) | 189 |
176 pRenderer->DrawTextureIndexedAlpha(pX_coord, pY_coord, pTexture); | 190 pRenderer->DrawTextureAlphaNew(pX_coord/640.0f, pY_coord/480.0f, pTexture); |
177 else | 191 pRenderer->ZDrawTextureAlpha( |
178 pRenderer->DrawTextureTransparentColorKey(pX_coord, pY_coord, pTexture); | 192 pIconPos[player->lastOpenedSpellbookPage][pSpellbookSpellIndices[player->lastOpenedSpellbookPage][i]].Xpos/640.0f, |
179 pRenderer->DrawMaskToZBuffer(pIconPos[player->lastOpenedSpellbookPage][pSpellbookSpellIndices[player->lastOpenedSpellbookPage][i]].Xpos, | 193 pIconPos[player->lastOpenedSpellbookPage][pSpellbookSpellIndices[player->lastOpenedSpellbookPage][i]].Ypos/480.0f, |
180 pIconPos[player->lastOpenedSpellbookPage][pSpellbookSpellIndices[player->lastOpenedSpellbookPage][i]].Ypos, pTexture, i); | 194 pTexture, i); |
181 } | 195 } |
182 } | 196 } |
183 } | 197 } |
184 } | 198 } |
185 } | 199 } |
186 | 200 |
187 pMouse->GetCursorPos(&a2); | 201 pMouse->GetCursorPos(&a2); |
188 v10 = pRenderer->pActiveZBuffer[a2.x + pSRZBufferLineOffsets[a2.y]] & 0xFFFF; | 202 v10 = pRenderer->pActiveZBuffer[a2.x + pSRZBufferLineOffsets[a2.y]] & 0xFFFF; |
189 if (v10) | 203 if (v10) |
190 { | 204 { |
191 if (SBPageCSpellsTextureList[v10]->paletted_pixels) | 205 if (SBPageCSpellsTextureList[v10]) |
192 { | 206 { |
193 pX_coord = pViewport->uViewportTL_X + pIconPos[player->lastOpenedSpellbookPage][pSpellbookSpellIndices[player->lastOpenedSpellbookPage][v10]].Xpos; | 207 pX_coord = pViewport->uViewportTL_X + pIconPos[player->lastOpenedSpellbookPage][pSpellbookSpellIndices[player->lastOpenedSpellbookPage][v10]].Xpos; |
194 pY_coord = pViewport->uViewportTL_Y + pIconPos[player->lastOpenedSpellbookPage][pSpellbookSpellIndices[player->lastOpenedSpellbookPage][v10]].Ypos; | 208 pY_coord = pViewport->uViewportTL_Y + pIconPos[player->lastOpenedSpellbookPage][pSpellbookSpellIndices[player->lastOpenedSpellbookPage][v10]].Ypos; |
195 if (SBPageCSpellsTextureList[v10]->pBits & 0x200) | 209 |
196 pRenderer->DrawTextureIndexedAlpha(pX_coord, pY_coord, SBPageCSpellsTextureList[v10]); | 210 pRenderer->DrawTextureAlphaNew(pX_coord/640.0f, pY_coord/480.0f, SBPageCSpellsTextureList[v10]); |
197 else | 211 } |
198 pRenderer->DrawTextureTransparentColorKey(pX_coord, pY_coord, SBPageCSpellsTextureList[v10]); | 212 } |
199 } | 213 |
200 } | |
201 //pX_coord = (unsigned int)&player->pActiveSkills[PLAYER_SKILL_FIRE]; | |
202 //pY_coord = (unsigned int)&player->pActiveSkills[PLAYER_SKILL_FIRE]; | |
203 for (uint i = 0; i < 9; i++) | 214 for (uint i = 0; i < 9; i++) |
204 { | 215 { |
205 if (player->pActiveSkills[PLAYER_SKILL_FIRE + i]) | 216 if (player->pActiveSkills[PLAYER_SKILL_FIRE + i]) |
206 { | 217 { |
218 auto pPageTexture = ui_spellbook_school_tabs[i][0]; | |
207 if (player->lastOpenedSpellbookPage == i) | 219 if (player->lastOpenedSpellbookPage == i) |
208 { | 220 { |
209 pPageTexture = pTextures_tabs[i][1]; | 221 pPageTexture = ui_spellbook_school_tabs[i][1]; |
210 pX_coord = texture_tab_coord1[i][0]; | 222 pX_coord = texture_tab_coord1[i][0]; |
211 pY_coord = texture_tab_coord1[i][1]; | 223 pY_coord = texture_tab_coord1[i][1]; |
212 } | 224 } |
213 else | 225 else |
214 { | 226 { |
215 pPageTexture = pTextures_tabs[i][0]; | 227 pPageTexture = ui_spellbook_school_tabs[i][0]; |
216 pX_coord = texture_tab_coord0[i][0]; | 228 pX_coord = texture_tab_coord0[i][0]; |
217 pY_coord = texture_tab_coord0[i][1]; | 229 pY_coord = texture_tab_coord0[i][1]; |
218 } | 230 } |
219 pRenderer->DrawTextureIndexedAlpha(pX_coord, pY_coord, pPageTexture); | 231 |
232 pRenderer->DrawTextureAlphaNew(pX_coord/640.0f, pY_coord/480.0f, pPageTexture); | |
220 } | 233 } |
221 } | 234 } |
222 } | 235 } |
223 | 236 |
224 | 237 |
247 for (uint i = 1; i <= 11; ++i) | 260 for (uint i = 1; i <= 11; ++i) |
248 { | 261 { |
249 if (pPlayers[uActiveCharacter]->spellbook.pChapters[spell_school].bIsSpellAvailable[i - 1]) | 262 if (pPlayers[uActiveCharacter]->spellbook.pChapters[spell_school].bIsSpellAvailable[i - 1]) |
250 { | 263 { |
251 sprintf(pContainer, "SB%sS%02d", spellbook_texture_filename_suffices[spell_school], pSpellbookSpellIndices[spell_school][i]); | 264 sprintf(pContainer, "SB%sS%02d", spellbook_texture_filename_suffices[spell_school], pSpellbookSpellIndices[spell_school][i]); |
252 SBPageSSpellsTextureList[i] = pIcons_LOD->LoadTexturePtr(pContainer, TEXTURE_16BIT_PALETTE); | 265 SBPageSSpellsTextureList[i] = assets->GetImage_16BitAlpha(pContainer); |
253 | 266 |
254 sprintf(pContainer, "SB%sC%02d", spellbook_texture_filename_suffices[spell_school], pSpellbookSpellIndices[spell_school][i]); | 267 sprintf(pContainer, "SB%sC%02d", spellbook_texture_filename_suffices[spell_school], pSpellbookSpellIndices[spell_school][i]); |
255 SBPageCSpellsTextureList[i] = pIcons_LOD->LoadTexturePtr(pContainer, TEXTURE_16BIT_PALETTE); | 268 SBPageCSpellsTextureList[i] = assets->GetImage_16BitAlpha(pContainer); |
256 } | 269 } |
257 } | 270 } |
258 } | 271 } |
259 | 272 |
260 //----- (00412AF9) -------------------------------------------------------- | 273 //----- (00412AF9) -------------------------------------------------------- |
261 static void BookUI_Spellbook_DrawCurrentSchoolBackground() | 274 static void BookUI_Spellbook_DrawCurrentSchoolBackground() |
262 { | 275 { |
263 int pTexID = 0; | 276 int pTexID = 0; |
264 if ( uActiveCharacter ) | 277 if ( uActiveCharacter ) |
265 pTexID = pParty->pPlayers[uActiveCharacter - 1].lastOpenedSpellbookPage; | 278 pTexID = pParty->pPlayers[uActiveCharacter - 1].lastOpenedSpellbookPage; |
266 pRenderer->DrawTextureTransparentColorKey(8, 8, pSpellBookPagesTextr[pTexID]); | 279 pRenderer->DrawTextureAlphaNew(8/640.0f, 8/480.0f, ui_spellbook_school_backgrounds[pTexID]); |
267 pRenderer->DrawTextureTransparentColorKey(476, 450, pSBQuickSpellBtnTextr); | 280 |
268 pRenderer->DrawTextureTransparentColorKey(561, 450, pSpellBookCloseBtnTextr); | 281 pRenderer->DrawTextureAlphaNew(476/640.0f, 450/480.0f, ui_spellbook_btn_quckspell); |
282 pRenderer->DrawTextureAlphaNew(561/640.0f, 450/480.0f, ui_spellbook_btn_close); | |
269 } | 283 } |
270 | 284 |
271 | 285 |
272 | 286 |
273 | 287 |
278 pAudioPlayer->StopChannels(-1, -1); | 292 pAudioPlayer->StopChannels(-1, -1); |
279 ++pIcons_LOD->uTexturePacksCount; | 293 ++pIcons_LOD->uTexturePacksCount; |
280 if (!pIcons_LOD->uNumPrevLoadedFiles) | 294 if (!pIcons_LOD->uNumPrevLoadedFiles) |
281 pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; | 295 pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; |
282 pAudioPlayer->PlaySound(SOUND_openbook, 0, 0, -1, 0, 0, 0, 0); | 296 pAudioPlayer->PlaySound(SOUND_openbook, 0, 0, -1, 0, 0, 0, 0); |
283 pSpellBookPagesTextr_9 = pIcons_LOD->LoadTexturePtr("book", TEXTURE_16BIT_PALETTE); | 297 |
284 pTexture_pagemask = pIcons_LOD->LoadTexturePtr("pagemask", TEXTURE_16BIT_PALETTE); | 298 ui_spellbook_btn_close = assets->GetImage_16BitAlpha(L"ib-m5-u"); |
285 pSpellBookCloseBtnTextr = pIcons_LOD->LoadTexturePtr("ib-m5-u", TEXTURE_16BIT_PALETTE); | 299 ui_spellbook_btn_close_click = assets->GetImage_16BitAlpha(L"ib-m5-d"); |
286 pSpellBookClickCloseBtnTextr = pIcons_LOD->LoadTexturePtr("ib-m5-d", TEXTURE_16BIT_PALETTE); | 300 ui_spellbook_btn_quckspell = assets->GetImage_16BitAlpha(L"ib-m6-u"); |
287 pSBQuickSpellBtnTextr = pIcons_LOD->LoadTexturePtr("ib-m6-u", TEXTURE_16BIT_PALETTE); | 301 ui_spellbook_btn_quckspell_click = assets->GetImage_16BitAlpha(L"ib-m6-d"); |
288 | 302 |
289 static const char *texNames[9] = // 004E24EC | 303 static const char *texNames[9] = // 004E24EC |
290 { | 304 { |
291 "SBFB00", "SBAB00", "SBWB00", "SBEB00", | 305 "SBFB00", "SBAB00", "SBWB00", "SBEB00", |
292 "SBSB00", "SBMB00", "SBBB00", "SBLB00", "SBDB00" | 306 "SBSB00", "SBMB00", "SBBB00", "SBLB00", "SBDB00" |
293 }; | 307 }; |
294 | 308 |
295 pSBClickQuickSpellBtnTextr = pIcons_LOD->LoadTexturePtr("ib-m6-d", TEXTURE_16BIT_PALETTE); | |
296 for (uint i = 0; i < 9; ++i) | 309 for (uint i = 0; i < 9; ++i) |
297 { | 310 { |
298 pSpellBookPagesTextr[i] = pIcons_LOD->LoadTexturePtr(texNames[i], TEXTURE_16BIT_PALETTE); | 311 ui_spellbook_school_backgrounds[i] = assets->GetImage_16BitColorKey(texNames[i], 0x7FF); |
312 | |
299 sprintf(pTmpBuf.data(), "tab%da", i + 1); | 313 sprintf(pTmpBuf.data(), "tab%da", i + 1); |
300 pTextures_tabs[i][0] = pIcons_LOD->LoadTexturePtr(pTmpBuf.data(), TEXTURE_16BIT_PALETTE); | 314 ui_spellbook_school_tabs[i][0] = assets->GetImage_16BitAlpha(pTmpBuf.data()); |
315 | |
301 sprintf(pTmpBuf.data(), "tab%db", i + 1); | 316 sprintf(pTmpBuf.data(), "tab%db", i + 1); |
302 pTextures_tabs[i][1] = pIcons_LOD->LoadTexturePtr(pTmpBuf.data(), TEXTURE_16BIT_PALETTE); | 317 ui_spellbook_school_tabs[i][1] = assets->GetImage_16BitAlpha(pTmpBuf.data()); |
303 } | 318 } |
304 } | 319 } |
305 | 320 |
306 | 321 |
307 //----- (00411473) -------------------------------------------------------- | 322 //----- (00411473) -------------------------------------------------------- |
308 void OnCloseSpellBook() | 323 void OnCloseSpellBook() |
309 { | 324 { |
310 pTexture_pagemask->Release(); | 325 if (ui_spellbook_btn_close) |
311 pSpellBookCloseBtnTextr->Release(); | 326 { |
312 pSBQuickSpellBtnTextr->Release(); | 327 ui_spellbook_btn_close->Release(); |
328 ui_spellbook_btn_close = nullptr; | |
329 } | |
330 if (ui_spellbook_btn_close_click) | |
331 { | |
332 ui_spellbook_btn_close_click->Release(); | |
333 ui_spellbook_btn_close_click = nullptr; | |
334 } | |
335 | |
336 | |
337 | |
338 if (ui_spellbook_btn_quckspell) | |
339 { | |
340 ui_spellbook_btn_quckspell->Release(); | |
341 ui_spellbook_btn_quckspell = nullptr; | |
342 } | |
343 if (ui_spellbook_btn_quckspell_click) | |
344 { | |
345 ui_spellbook_btn_quckspell_click->Release(); | |
346 ui_spellbook_btn_quckspell_click = nullptr; | |
347 } | |
348 | |
349 | |
313 for (uint i = 0; i < 9; ++i) | 350 for (uint i = 0; i < 9; ++i) |
314 { | 351 { |
315 pSpellBookPagesTextr[i]->Release(); | 352 if (ui_spellbook_school_backgrounds[i]) |
316 pTextures_tabs[i][0]->Release(); | 353 { |
317 pTextures_tabs[i][1]->Release(); | 354 ui_spellbook_school_backgrounds[i]->Release(); |
318 } | 355 ui_spellbook_school_backgrounds[i] = nullptr; |
356 } | |
357 | |
358 if (ui_spellbook_school_tabs[i][0]) | |
359 { | |
360 ui_spellbook_school_tabs[i][0]->Release(); | |
361 ui_spellbook_school_tabs[i][0] = nullptr; | |
362 } | |
363 if (ui_spellbook_school_tabs[i][1]) | |
364 { | |
365 ui_spellbook_school_tabs[i][1]->Release(); | |
366 ui_spellbook_school_tabs[i][1] = nullptr; | |
367 } | |
368 } | |
369 | |
319 pAudioPlayer->PlaySound(SOUND_openbook, 0, 0, -1, 0, 0, 0, 0); | 370 pAudioPlayer->PlaySound(SOUND_openbook, 0, 0, -1, 0, 0, 0, 0); |
320 pIcons_LOD->RemoveTexturesPackFromTextureList(); | 371 } |
321 } | 372 |
373 | |
374 | |
375 //----- (0041140B) -------------------------------------------------------- | |
376 void OnCloseSpellBookPage() | |
377 { | |
378 GUIButton *pNextButton; // esi@4 | |
379 for ( uint i = 1; i <= 11; i++ ) | |
380 { | |
381 if (SBPageCSpellsTextureList[i]) | |
382 { | |
383 SBPageCSpellsTextureList[i]->Release(); | |
384 SBPageCSpellsTextureList[i] = nullptr; | |
385 } | |
386 if (SBPageSSpellsTextureList[i]) | |
387 { | |
388 SBPageSSpellsTextureList[i]->Release(); | |
389 SBPageSSpellsTextureList[i] = nullptr; | |
390 } | |
391 } | |
392 | |
393 | |
394 pIcons_LOD->SyncLoadedFilesCount(); | |
395 if ( pGUIWindow_CurrentMenu->pControlsHead ) | |
396 { | |
397 do | |
398 { | |
399 pNextButton = pGUIWindow_CurrentMenu->pControlsHead->pNext; | |
400 free(pGUIWindow_CurrentMenu->pControlsHead); | |
401 pGUIWindow_CurrentMenu->pControlsHead = pNextButton; | |
402 } | |
403 while ( pNextButton ); | |
404 } | |
405 pGUIWindow_CurrentMenu->pControlsHead = 0; | |
406 pGUIWindow_CurrentMenu->pControlsTail = 0; | |
407 pGUIWindow_CurrentMenu->uNumControls = 0; | |
408 } | |
409 |