Mercurial > mm7
comparison GUI/UI/Books/QuestBook.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/LOD.h" | 3 #include "Engine/LOD.h" |
3 #include "Engine/Party.h" | 4 #include "Engine/Party.h" |
4 #include "Engine/Timer.h" | 5 #include "Engine/Timer.h" |
5 #include "Engine/Awards.h" | 6 #include "Engine/Awards.h" |
6 #include "Engine/texts.h" | 7 #include "Engine/texts.h" |
9 | 10 |
10 #include "GUI/GUIFont.h" | 11 #include "GUI/GUIFont.h" |
11 #include "GUI/UI/Books/QuestBook.h" | 12 #include "GUI/UI/Books/QuestBook.h" |
12 | 13 |
13 #include "Media/Audio/AudioPlayer.h" | 14 #include "Media/Audio/AudioPlayer.h" |
15 | |
16 Image *ui_book_quests_background = nullptr; | |
14 | 17 |
15 GUIWindow_QuestBook::GUIWindow_QuestBook() : | 18 GUIWindow_QuestBook::GUIWindow_QuestBook() : |
16 GUIWindow_Book() | 19 GUIWindow_Book() |
17 { | 20 { |
18 this->ptr_1C = (void *)WINDOW_QuestBook; // inherited from GUIWindow::GUIWindow | 21 this->ptr_1C = (void *)WINDOW_QuestBook; // inherited from GUIWindow::GUIWindow |
25 pBooksButtonOverlay = new GUIWindow_BooksButtonOverlay(493u, 355u, 0, 0, (int)pBtn_Quests, 0); | 28 pBooksButtonOverlay = new GUIWindow_BooksButtonOverlay(493u, 355u, 0, 0, (int)pBtn_Quests, 0); |
26 bFlashQuestBook = 0; | 29 bFlashQuestBook = 0; |
27 | 30 |
28 // ---------------------------------------------- | 31 // ---------------------------------------------- |
29 // 00411BFC GUIWindow::InitializeBookView -- part | 32 // 00411BFC GUIWindow::InitializeBookView -- part |
30 pTexture_CurrentBook = pIcons_LOD->LoadTexturePtr("sbquiknot", TEXTURE_16BIT_PALETTE); | 33 ui_book_quests_background = assets->GetImage_16Bit(L"sbquiknot"); |
31 pSpellBookPagesTextr_10 = pIcons_LOD->LoadTexturePtr("divbar", TEXTURE_16BIT_PALETTE); | 34 ui_book_quest_div_bar = assets->GetImage_16BitAlpha(L"divbar"); |
32 pTex_book_button1_on = pIcons_LOD->LoadTexturePtr("tab-an-6b", TEXTURE_16BIT_PALETTE); | 35 |
33 pTex_book_button2_on = pIcons_LOD->LoadTexturePtr("tab-an-7b", TEXTURE_16BIT_PALETTE); | 36 ui_book_button1_on = assets->GetImage_16BitAlpha(L"tab-an-6b"); |
34 pTex_book_button1_off = pIcons_LOD->LoadTexturePtr("tab-an-6a", TEXTURE_16BIT_PALETTE); | 37 ui_book_button2_on = assets->GetImage_16BitAlpha(L"tab-an-7b"); |
35 pTex_book_button2_off = pIcons_LOD->LoadTexturePtr("tab-an-7a", TEXTURE_16BIT_PALETTE); | 38 ui_book_button1_off = assets->GetImage_16BitAlpha(L"tab-an-6a"); |
39 ui_book_button2_off = assets->GetImage_16BitAlpha(L"tab-an-7a"); | |
40 | |
36 pBtn_Book_1 = CreateButton( | 41 pBtn_Book_1 = CreateButton( |
37 pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 1, | 42 pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 1, |
38 pTex_book_button1_on->uTextureWidth, pTex_book_button1_on->uTextureHeight, | 43 ui_book_button1_on->GetWidth(), ui_book_button1_on->GetWidth(), |
39 1, 0, UIMSG_ClickBooksBtn, 0xBu, 0, pGlobalTXT_LocalizationStrings[192],// "Scroll Up" | 44 1, 0, UIMSG_ClickBooksBtn, 0xBu, 0, pGlobalTXT_LocalizationStrings[192],// "Scroll Up" |
40 pTex_book_button1_on, 0 | 45 ui_book_button1_on, 0 |
41 ); | 46 ); |
42 pBtn_Book_2 = CreateButton( | 47 pBtn_Book_2 = CreateButton( |
43 pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 38, | 48 pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 38, |
44 pTex_book_button2_on->uTextureHeight, pTex_book_button2_on->uTextureHeight, | 49 ui_book_button2_on->GetWidth(), ui_book_button2_on->GetHeight(), |
45 1, 0, UIMSG_ClickBooksBtn, 0xAu, 0, pGlobalTXT_LocalizationStrings[193],// "Scroll Down" | 50 1, 0, UIMSG_ClickBooksBtn, 0xAu, 0, pGlobalTXT_LocalizationStrings[193],// "Scroll Down" |
46 pTex_book_button2_on, 0 | 51 ui_book_button2_on, 0 |
47 ); | 52 ); |
48 num_achieved_awards = 0; | 53 num_achieved_awards = 0; |
49 memset(achieved_awards.data(), 0, 4000); | 54 memset(achieved_awards.data(), 0, 4000); |
50 for (uint i = books_primary_item_per_page; i < 512; ++i) | 55 for (uint i = books_primary_item_per_page; i < 512; ++i) |
51 { | 56 { |
79 // void BookUI_Questbook_Draw() | 84 // void BookUI_Questbook_Draw() |
80 // { | 85 // { |
81 int pTextHeight; // eax@19 | 86 int pTextHeight; // eax@19 |
82 GUIWindow questbook_window; // [sp+Ch] [bp-54h]@9 | 87 GUIWindow questbook_window; // [sp+Ch] [bp-54h]@9 |
83 | 88 |
84 pRenderer->DrawTextureTransparentColorKey(pViewport->uViewportTL_X, pViewport->uViewportTL_Y, pTexture_CurrentBook); | 89 pRenderer->DrawTextureNew(pViewport->uViewportTL_X/640.0f, pViewport->uViewportTL_Y/480.0f, ui_book_quests_background); |
85 if (BtnUp_flag || !books_primary_item_per_page)//Bookmark Up(Закладка вверх) | 90 if (BtnUp_flag || !books_primary_item_per_page)//Bookmark Up(Закладка вверх) |
86 pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 407, pViewport->uViewportTL_Y + 2, pTex_book_button1_off); | 91 pRenderer->DrawTextureAlphaNew((pViewport->uViewportTL_X + 407)/640.0f, (pViewport->uViewportTL_Y + 2)/480.0f, ui_book_button1_off); |
87 else | 92 else |
88 pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 1, pTex_book_button1_on); | 93 pRenderer->DrawTextureAlphaNew((pViewport->uViewportTL_X + 398)/640.0f, (pViewport->uViewportTL_Y + 1)/480.0f, ui_book_button1_on); |
89 | 94 |
90 if (BtnDown_flag || books_primary_item_per_page + num_achieved_awards >= full_num_items_in_book)//Bookmark Down(Закладка вниз) | 95 if (BtnDown_flag || books_primary_item_per_page + num_achieved_awards >= full_num_items_in_book)//Bookmark Down(Закладка вниз) |
91 pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 407, pViewport->uViewportTL_Y + 38, pTex_book_button2_off); | 96 pRenderer->DrawTextureAlphaNew((pViewport->uViewportTL_X + 407)/640.0f, (pViewport->uViewportTL_Y + 38)/480.0f, ui_book_button2_off); |
92 else | 97 else |
93 pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 38, pTex_book_button2_on); | 98 pRenderer->DrawTextureAlphaNew((pViewport->uViewportTL_X + 398)/640.0f, (pViewport->uViewportTL_Y + 38)/480.0f, ui_book_button2_on); |
94 | 99 |
95 //for title | 100 //for title |
96 questbook_window.uFrameWidth = game_viewport_width; | 101 questbook_window.uFrameWidth = game_viewport_width; |
97 questbook_window.uFrameHeight = game_viewport_height; | 102 questbook_window.uFrameHeight = game_viewport_height; |
98 questbook_window.uFrameX = game_viewport_x; | 103 questbook_window.uFrameX = game_viewport_x; |
133 ++num_achieved_awards; | 138 ++num_achieved_awards; |
134 questbook_window.DrawText(pAutonoteFont, 1, 0, ui_book_quests_text_color, pQuestTable[achieved_awards[i]], 0, 0, 0); | 139 questbook_window.DrawText(pAutonoteFont, 1, 0, ui_book_quests_text_color, pQuestTable[achieved_awards[i]], 0, 0, 0); |
135 pTextHeight = pAutonoteFont->CalcTextHeight(pQuestTable[achieved_awards[i]], &questbook_window, 1, 0); | 140 pTextHeight = pAutonoteFont->CalcTextHeight(pQuestTable[achieved_awards[i]], &questbook_window, 1, 0); |
136 if ((signed int)(questbook_window.uFrameY + pTextHeight) > (signed int)questbook_window.uFrameHeight) | 141 if ((signed int)(questbook_window.uFrameY + pTextHeight) > (signed int)questbook_window.uFrameHeight) |
137 break; | 142 break; |
138 pRenderer->DrawTextureIndexedAlpha(100, (questbook_window.uFrameY + pTextHeight) + 12, pSpellBookPagesTextr_10); | 143 |
144 pRenderer->DrawTextureAlphaNew(100/640.0f, ((questbook_window.uFrameY + pTextHeight) + 12)/480.0f, ui_book_quest_div_bar); | |
145 | |
139 questbook_window.uFrameY = (questbook_window.uFrameY + pTextHeight) + 24; | 146 questbook_window.uFrameY = (questbook_window.uFrameY + pTextHeight) + 24; |
140 } | 147 } |
141 } | 148 } |