Mercurial > mm7
diff GUI/UI/Books/AutonotesBook.cpp @ 2574:dd36326a9994
More texture refactoring
GetLeather -> DrawTextureCustomHeight
author | a.parshin |
---|---|
date | Mon, 07 Mar 2016 03:48:40 +0200 |
parents | 0c67be4ec900 |
children |
line wrap: on
line diff
--- a/GUI/UI/Books/AutonotesBook.cpp Sat Mar 05 16:25:53 2016 +0200 +++ b/GUI/UI/Books/AutonotesBook.cpp Mon Mar 07 03:48:40 2016 +0200 @@ -1,4 +1,5 @@ #include "Engine/Engine.h" +#include "Engine/AssetsManager.h" #include "Engine/LOD.h" #include "Engine/Party.h" #include "Engine/Timer.h" @@ -13,6 +14,11 @@ #include "Media/Audio/AudioPlayer.h" + + +Image *ui_book_autonotes_background = nullptr; + + GUIWindow_AutonotesBook::GUIWindow_AutonotesBook() : GUIWindow_Book() { @@ -28,56 +34,57 @@ // ---------------------------------------------- // 00411BFC GUIWindow::InitializeBookView -- part - pTexture_AutonotesBook = pIcons_LOD->LoadTexturePtr("sbautnot", TEXTURE_16BIT_PALETTE); - pSpellBookPagesTextr_10 = pIcons_LOD->LoadTexturePtr("divbar", TEXTURE_16BIT_PALETTE); - pTex_book_button1_on = pIcons_LOD->LoadTexturePtr("tab-an-6b", TEXTURE_16BIT_PALETTE); - pTex_book_button2_on = pIcons_LOD->LoadTexturePtr("tab-an-7b", TEXTURE_16BIT_PALETTE); - pTex_book_button1_off = pIcons_LOD->LoadTexturePtr("tab-an-6a", TEXTURE_16BIT_PALETTE); - pTex_book_button2_off = pIcons_LOD->LoadTexturePtr("tab-an-7a", TEXTURE_16BIT_PALETTE); - pTex_book_button3_on = pIcons_LOD->LoadTexturePtr("tab-an-1b", TEXTURE_16BIT_PALETTE); - pTex_book_button3_off = pIcons_LOD->LoadTexturePtr("tab-an-1a", TEXTURE_16BIT_PALETTE); - pTex_book_button4_on = pIcons_LOD->LoadTexturePtr("tab-an-2b", TEXTURE_16BIT_PALETTE); - pTex_book_button4_off = pIcons_LOD->LoadTexturePtr("tab-an-2a", TEXTURE_16BIT_PALETTE); - pTex_book_button5_on = pIcons_LOD->LoadTexturePtr("tab-an-3b", TEXTURE_16BIT_PALETTE); - pTex_book_button5_off = pIcons_LOD->LoadTexturePtr("tab-an-3a", TEXTURE_16BIT_PALETTE); - pTex_book_button6_on = pIcons_LOD->LoadTexturePtr("tab-an-5b", TEXTURE_16BIT_PALETTE); - pTex_book_button6_off = pIcons_LOD->LoadTexturePtr("tab-an-5a", TEXTURE_16BIT_PALETTE); - pTex_book_button7_on = pIcons_LOD->LoadTexturePtr("tab-an-4b", TEXTURE_16BIT_PALETTE); - pTex_book_button7_off = pIcons_LOD->LoadTexturePtr("tab-an-4a", TEXTURE_16BIT_PALETTE); - pTex_book_button8_on = pIcons_LOD->LoadTexturePtr("tab-an-8b", TEXTURE_16BIT_PALETTE); - pTex_book_button8_off = pIcons_LOD->LoadTexturePtr("tab-an-8a", TEXTURE_16BIT_PALETTE); + ui_book_autonotes_background = assets->GetImage_16BitColorKey(L"sbautnot", 0x7FF); + ui_book_quest_div_bar = assets->GetImage_16BitAlpha(L"divbar"); + + ui_book_button1_on = assets->GetImage_16BitAlpha(L"tab-an-6b"); + ui_book_button2_on = assets->GetImage_16BitAlpha(L"tab-an-7b"); + ui_book_button3_on = assets->GetImage_16BitAlpha(L"tab-an-1b"); + ui_book_button4_on = assets->GetImage_16BitAlpha(L"tab-an-2b"); + ui_book_button5_on = assets->GetImage_16BitAlpha(L"tab-an-3b"); + ui_book_button6_on = assets->GetImage_16BitAlpha(L"tab-an-5b"); + ui_book_button7_on = assets->GetImage_16BitAlpha(L"tab-an-4b"); + ui_book_button8_on = assets->GetImage_16BitAlpha(L"tab-an-8b"); + ui_book_button1_off = assets->GetImage_16BitAlpha(L"tab-an-6a"); + ui_book_button2_off = assets->GetImage_16BitAlpha(L"tab-an-7a"); + ui_book_button3_off = assets->GetImage_16BitAlpha(L"tab-an-1a"); + ui_book_button4_off = assets->GetImage_16BitAlpha(L"tab-an-2a"); + ui_book_button5_off = assets->GetImage_16BitAlpha(L"tab-an-3a"); + ui_book_button6_off = assets->GetImage_16BitAlpha(L"tab-an-5a"); + ui_book_button7_off = assets->GetImage_16BitAlpha(L"tab-an-4a"); + ui_book_button8_off = assets->GetImage_16BitAlpha(L"tab-an-8a"); pBtn_Book_1 = CreateButton( pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 1, 50, 34, 1, 0, - UIMSG_ClickBooksBtn, 11, 0, pGlobalTXT_LocalizationStrings[193], pTex_book_button1_on, 0 + UIMSG_ClickBooksBtn, 11, 0, pGlobalTXT_LocalizationStrings[193], ui_book_button1_on, 0 ); pBtn_Book_2 = CreateButton( pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 38, 50, 34, 1, 0, - UIMSG_ClickBooksBtn, 10, 0, pGlobalTXT_LocalizationStrings[192], pTex_book_button2_on, 0 + UIMSG_ClickBooksBtn, 10, 0, pGlobalTXT_LocalizationStrings[192], ui_book_button2_on, 0 ); pBtn_Book_3 = CreateButton( pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 113, 50, 34, 1, 0, - UIMSG_ClickBooksBtn, 2, 0, pGlobalTXT_LocalizationStrings[85], pTex_book_button3_on, 0 + UIMSG_ClickBooksBtn, 2, 0, pGlobalTXT_LocalizationStrings[85], ui_book_button3_on, 0 ); // "Potion Notes" pBtn_Book_4 = CreateButton( pViewport->uViewportTL_X + 399, pViewport->uViewportTL_Y + 150, 50, 34, 1, 0, - UIMSG_ClickBooksBtn, 3, 0, pGlobalTXT_LocalizationStrings[137], pTex_book_button4_on, 0 + UIMSG_ClickBooksBtn, 3, 0, pGlobalTXT_LocalizationStrings[137], ui_book_button4_on, 0 ); // "Fountain Notes" pBtn_Book_5 = CreateButton( pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 188, 50, 34, 1, 0, - UIMSG_ClickBooksBtn, 4, 0, pGlobalTXT_LocalizationStrings[8], pTex_book_button5_on, 0 + UIMSG_ClickBooksBtn, 4, 0, pGlobalTXT_LocalizationStrings[8], ui_book_button5_on, 0 ); // "Obelisk Notes" pBtn_Book_6 = CreateButton( pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 226, 50, 34, 1, 0, - UIMSG_ClickBooksBtn, 5, 0, pGlobalTXT_LocalizationStrings[141], pTex_book_button6_on, 0 + UIMSG_ClickBooksBtn, 5, 0, pGlobalTXT_LocalizationStrings[141], ui_book_button6_on, 0 ); // "Seer Notes" pBtn_Autonotes_Misc = CreateButton( pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 264, 50, 34, 1, 0, - UIMSG_ClickBooksBtn, 6, 0, pGlobalTXT_LocalizationStrings[123], pTex_book_button7_on, 0 + UIMSG_ClickBooksBtn, 6, 0, pGlobalTXT_LocalizationStrings[123], ui_book_button7_on, 0 ); // "Miscellaneous Notes" pBtn_Autonotes_Instructors = CreateButton( pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 302, 50, 34, 1, 0, - UIMSG_ClickBooksBtn, 7, 0, pGlobalTXT_LocalizationStrings[662], pTex_book_button8_on, 0 + UIMSG_ClickBooksBtn, 7, 0, pGlobalTXT_LocalizationStrings[662], ui_book_button8_on, 0 ); // "Instructors" int num_achieved_awards = 0; @@ -123,135 +130,135 @@ GUIWindow autonotes_window; // [sp+14h] [bp-54h]@46 change_flag = false; - pRenderer->DrawTextureTransparentColorKey(pViewport->uViewportTL_X, pViewport->uViewportTL_Y, pTexture_AutonotesBook); + pRenderer->DrawTextureAlphaNew(pViewport->uViewportTL_X/640.0f, pViewport->uViewportTL_Y/480.0f, ui_book_autonotes_background); if (BtnUp_flag || !books_primary_item_per_page) - pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 407, pViewport->uViewportTL_Y + 2, pTex_book_button1_off); + pRenderer->DrawTextureAlphaNew((pViewport->uViewportTL_X + 407)/640.0f, (pViewport->uViewportTL_Y + 2)/480.0f, ui_book_button1_off); else - pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 1, pTex_book_button1_on); + pRenderer->DrawTextureAlphaNew((pViewport->uViewportTL_X + 398)/640.0f, (pViewport->uViewportTL_Y + 1)/480.0f, ui_book_button1_on); if (BtnDown_flag || books_primary_item_per_page + num_achieved_awards >= full_num_items_in_book) - pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 407, pViewport->uViewportTL_Y + 38, pTex_book_button2_off); + pRenderer->DrawTextureAlphaNew((pViewport->uViewportTL_X + 407)/640.0f, (pViewport->uViewportTL_Y + 38)/480.0f, ui_book_button2_off); else - pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 38, pTex_book_button2_on); + pRenderer->DrawTextureAlphaNew((pViewport->uViewportTL_X + 398)/640.0f, (pViewport->uViewportTL_Y + 38)/480.0f, ui_book_button2_on); if (Book_PageBtn3_flag)//Potions_page_flag { if (_506568_autonote_type == AUTONOTE_POTION_RECEPIE)//press again(повторное нажатие) - pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 113, pTex_book_button3_on); + pRenderer->DrawTextureAlphaNew((pViewport->uViewportTL_X + 398)/640.0f, (pViewport->uViewportTL_Y + 113)/480.0f, ui_book_button3_on); else//press(нажатие) { change_flag = true; pAudioPlayer->PlaySound(SOUND_StartMainChoice02, 0, 0, -1, 0, 0, 0, 0); _506568_autonote_type = AUTONOTE_POTION_RECEPIE; - pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 113, pTex_book_button3_on); + pRenderer->DrawTextureAlphaNew((pViewport->uViewportTL_X + 398)/640.0f, (pViewport->uViewportTL_Y + 113)/480.0f, ui_book_button3_on); } } else { if (_506568_autonote_type == AUTONOTE_POTION_RECEPIE)// default(по умолчанию при запуске окна) - pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 113, pTex_book_button3_on); + pRenderer->DrawTextureAlphaNew((pViewport->uViewportTL_X + 398)/640.0f, (pViewport->uViewportTL_Y + 113)/480.0f, ui_book_button3_on); else//Potions_page not active(вкладка снадобья не активна) - pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 113, pTex_book_button3_off); + pRenderer->DrawTextureAlphaNew((pViewport->uViewportTL_X + 408)/640.0f, (pViewport->uViewportTL_Y + 113)/480.0f, ui_book_button3_off); } if (Book_PageBtn4_flag)//Fontains_page_flag { if (_506568_autonote_type == AUTONOTE_STAT_HINT) - pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 399, pViewport->uViewportTL_Y + 150, pTex_book_button4_on); + pRenderer->DrawTextureAlphaNew((pViewport->uViewportTL_X + 399)/640.0f, (pViewport->uViewportTL_Y + 150)/480.0f, ui_book_button4_on); else { change_flag = true; pAudioPlayer->PlaySound(SOUND_StartMainChoice02, 0, 0, -1, 0, 0, 0, 0); _506568_autonote_type = AUTONOTE_STAT_HINT; - pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 399, pViewport->uViewportTL_Y + 150, pTex_book_button4_on); + pRenderer->DrawTextureAlphaNew((pViewport->uViewportTL_X + 399)/640.0f, (pViewport->uViewportTL_Y + 150)/480.0f, ui_book_button4_on); } } else { if (_506568_autonote_type == AUTONOTE_STAT_HINT) - pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 399, pViewport->uViewportTL_Y + 150, pTex_book_button4_on); + pRenderer->DrawTextureAlphaNew((pViewport->uViewportTL_X + 399)/640.0f, (pViewport->uViewportTL_Y + 150)/480.0f, ui_book_button4_on); else - pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 150, pTex_book_button4_off); + pRenderer->DrawTextureAlphaNew((pViewport->uViewportTL_X + 408)/640.0f, (pViewport->uViewportTL_Y + 150)/480.0f, ui_book_button4_off); } if (Book_PageBtn5_flag)//Autonotes_Obelisks_page_flag { if (_506568_autonote_type == AUTONOTE_OBELISK) - pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 188, pTex_book_button5_on); + pRenderer->DrawTextureAlphaNew((pViewport->uViewportTL_X + 397)/640.0f, (pViewport->uViewportTL_Y + 188)/480.0f, ui_book_button5_on); else { change_flag = true; pAudioPlayer->PlaySound(SOUND_StartMainChoice02, 0, 0, -1, 0, 0, 0, 0); _506568_autonote_type = AUTONOTE_OBELISK; - pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 188, pTex_book_button5_on); + pRenderer->DrawTextureAlphaNew((pViewport->uViewportTL_X + 397)/640.0f, (pViewport->uViewportTL_Y + 188)/480.0f, ui_book_button5_on); } } else { if (_506568_autonote_type == AUTONOTE_OBELISK) - pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 188, pTex_book_button5_on); + pRenderer->DrawTextureAlphaNew((pViewport->uViewportTL_X + 397)/640.0f, (pViewport->uViewportTL_Y + 188)/480.0f, ui_book_button5_on); else - pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 188, pTex_book_button5_off); + pRenderer->DrawTextureAlphaNew((pViewport->uViewportTL_X + 408)/640.0f, (pViewport->uViewportTL_Y + 188)/480.0f, ui_book_button5_off); } if (Book_PageBtn6_flag)//Autonotes_Seer_page_flag { if (_506568_autonote_type == AUTONOTE_SEER) - pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 226, pTex_book_button6_on); + pRenderer->DrawTextureAlphaNew((pViewport->uViewportTL_X + 397)/640.0f, (pViewport->uViewportTL_Y + 226)/480.0f, ui_book_button6_on); else { change_flag = true; pAudioPlayer->PlaySound(SOUND_StartMainChoice02, 0, 0, -1, 0, 0, 0, 0); _506568_autonote_type = AUTONOTE_SEER; - pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 226, pTex_book_button6_on); + pRenderer->DrawTextureAlphaNew((pViewport->uViewportTL_X + 397)/640.0f, (pViewport->uViewportTL_Y + 226)/480.0f, ui_book_button6_on); } } else { if (_506568_autonote_type == AUTONOTE_SEER) - pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 226, pTex_book_button6_on); + pRenderer->DrawTextureAlphaNew((pViewport->uViewportTL_X + 397)/640.0f, (pViewport->uViewportTL_Y + 226)/480.0f, ui_book_button6_on); else - pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 226, pTex_book_button6_off); + pRenderer->DrawTextureAlphaNew((pViewport->uViewportTL_X + 408)/640.0f, (pViewport->uViewportTL_Y + 226)/480.0f, ui_book_button6_off); } if (Autonotes_Misc_page_flag) { if (_506568_autonote_type == AUTONOTE_MISC) - pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 264, pTex_book_button7_on); + pRenderer->DrawTextureAlphaNew((pViewport->uViewportTL_X + 397)/640.0f, (pViewport->uViewportTL_Y + 264)/480.0f, ui_book_button7_on); else { change_flag = true; pAudioPlayer->PlaySound(SOUND_StartMainChoice02, 0, 0, -1, 0, 0, 0, 0); _506568_autonote_type = AUTONOTE_MISC; - pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 264, pTex_book_button7_on); + pRenderer->DrawTextureAlphaNew((pViewport->uViewportTL_X + 397)/640.0f, (pViewport->uViewportTL_Y + 264)/480.0f, ui_book_button7_on); } } else { if (_506568_autonote_type == AUTONOTE_MISC) - pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 264, pTex_book_button7_on); + pRenderer->DrawTextureAlphaNew((pViewport->uViewportTL_X + 397)/640.0f, (pViewport->uViewportTL_Y + 264)/480.0f, ui_book_button7_on); else - pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 263, pTex_book_button7_off); + pRenderer->DrawTextureAlphaNew((pViewport->uViewportTL_X + 408)/640.0f, (pViewport->uViewportTL_Y + 263)/480.0f, ui_book_button7_off); } if (Autonotes_Instructors_page_flag) { if (_506568_autonote_type == AUTONOTE_TEACHER) - pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 302, pTex_book_button8_on); + pRenderer->DrawTextureAlphaNew((pViewport->uViewportTL_X + 397)/640.0f, (pViewport->uViewportTL_Y + 302)/480.0f, ui_book_button8_on); else { change_flag = true; pAudioPlayer->PlaySound(SOUND_StartMainChoice02, 0, 0, -1, 0, 0, 0, 0); _506568_autonote_type = AUTONOTE_TEACHER; - pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 302, pTex_book_button8_on); + pRenderer->DrawTextureAlphaNew((pViewport->uViewportTL_X + 397)/640.0f, (pViewport->uViewportTL_Y + 302)/480.0f, ui_book_button8_on); } } else { if (_506568_autonote_type == AUTONOTE_TEACHER) - pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 302, pTex_book_button8_on); + pRenderer->DrawTextureAlphaNew((pViewport->uViewportTL_X + 397)/640.0f, (pViewport->uViewportTL_Y + 302)/480.0f, ui_book_button8_on); else - pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 302, pTex_book_button8_off); + pRenderer->DrawTextureAlphaNew((pViewport->uViewportTL_X + 408)/640.0f, (pViewport->uViewportTL_Y + 302)/480.0f, ui_book_button8_off); } //for title @@ -325,7 +332,9 @@ pTextHeight = pAutonoteFont->CalcTextHeight(pAutonoteTxt[achieved_awards[i]].pText, &autonotes_window, 1, 0); if ((signed int)(autonotes_window.uFrameY + pTextHeight) > (signed int)autonotes_window.uFrameHeight) break; - pRenderer->DrawTextureIndexedAlpha(100, (autonotes_window.uFrameY + pTextHeight) + 12, pSpellBookPagesTextr_10); + + pRenderer->DrawTextureAlphaNew(100/640.0f, ((autonotes_window.uFrameY + pTextHeight) + 12)/480.0f, ui_book_quest_div_bar); + autonotes_window.uFrameY = (autonotes_window.uFrameY + pTextHeight) + 24; } } \ No newline at end of file