Mercurial > mm7
view GUI/UI/Books/QuestBook.cpp @ 2573:0c67be4ec900
DrawTextureIndexed renamed to DrawTextureTransparentColorKey
Changing more class Texture to class Image.
author | a.parshin |
---|---|
date | Sat, 05 Mar 2016 16:25:53 +0200 |
parents | 87e5590d034b |
children | dd36326a9994 |
line wrap: on
line source
#include "Engine/Engine.h" #include "Engine/LOD.h" #include "Engine/Party.h" #include "Engine/Timer.h" #include "Engine/Awards.h" #include "Engine/texts.h" #include "Engine/Graphics/IRender.h" #include "Engine/Graphics/Viewport.h" #include "GUI/GUIFont.h" #include "GUI/UI/Books/QuestBook.h" #include "Media/Audio/AudioPlayer.h" GUIWindow_QuestBook::GUIWindow_QuestBook() : GUIWindow_Book() { this->ptr_1C = (void *)WINDOW_QuestBook; // inherited from GUIWindow::GUIWindow BasicBookInitialization(); // -------------------------------- // 004304E7 Game_EventLoop --- part pEventTimer->Pause(); pAudioPlayer->StopChannels(-1, -1); pBooksButtonOverlay = new GUIWindow_BooksButtonOverlay(493u, 355u, 0, 0, (int)pBtn_Quests, 0); bFlashQuestBook = 0; // ---------------------------------------------- // 00411BFC GUIWindow::InitializeBookView -- part pTexture_CurrentBook = pIcons_LOD->LoadTexturePtr("sbquiknot", 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); pBtn_Book_1 = CreateButton( pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 1, pTex_book_button1_on->uTextureWidth, pTex_book_button1_on->uTextureHeight, 1, 0, UIMSG_ClickBooksBtn, 0xBu, 0, pGlobalTXT_LocalizationStrings[192],// "Scroll Up" pTex_book_button1_on, 0 ); pBtn_Book_2 = CreateButton( pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 38, pTex_book_button2_on->uTextureHeight, pTex_book_button2_on->uTextureHeight, 1, 0, UIMSG_ClickBooksBtn, 0xAu, 0, pGlobalTXT_LocalizationStrings[193],// "Scroll Down" pTex_book_button2_on, 0 ); num_achieved_awards = 0; memset(achieved_awards.data(), 0, 4000); for (uint i = books_primary_item_per_page; i < 512; ++i) { if (_449B57_test_bit(pParty->_quest_bits, i) && pQuestTable[i]) { achieved_awards[num_achieved_awards] = (AwardType)i; ++num_achieved_awards; } } full_num_items_in_book = num_achieved_awards; num_achieved_awards = 0; } void GUIWindow_QuestBook::Update() { // ----------------------------------- // 004156F0 GUI_UpdateWindows --- part // { // BookUI_Draw((WindowType)(int)ptr_1C); // } // ----- (00413CC6) -------------------------------------------------------- // void BookUI_Draw(WindowType book) --- part // { pRenderer->DrawTextureAlphaNew(471/640.0f, 445/480.0f, ui_exit_cancel_button_background); // BookUI_Questbook_Draw(); // ----- (00413126) -------------------------------------------------------- // void BookUI_Questbook_Draw() // { int pTextHeight; // eax@19 GUIWindow questbook_window; // [sp+Ch] [bp-54h]@9 pRenderer->DrawTextureTransparentColorKey(pViewport->uViewportTL_X, pViewport->uViewportTL_Y, pTexture_CurrentBook); if (BtnUp_flag || !books_primary_item_per_page)//Bookmark Up(Закладка вверх) pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 407, pViewport->uViewportTL_Y + 2, pTex_book_button1_off); else pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 1, pTex_book_button1_on); if (BtnDown_flag || books_primary_item_per_page + num_achieved_awards >= full_num_items_in_book)//Bookmark Down(Закладка вниз) pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 407, pViewport->uViewportTL_Y + 38, pTex_book_button2_off); else pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 38, pTex_book_button2_on); //for title questbook_window.uFrameWidth = game_viewport_width; questbook_window.uFrameHeight = game_viewport_height; questbook_window.uFrameX = game_viewport_x; questbook_window.uFrameY = game_viewport_y; questbook_window.uFrameZ = game_viewport_z; questbook_window.uFrameW = game_viewport_w; questbook_window.DrawTitleText(pBook2Font, 0, 22, ui_book_quests_title_color, pGlobalTXT_LocalizationStrings[174], 3); //"Current Quests" //for other text questbook_window.uFrameX = 48; questbook_window.uFrameY = 70; questbook_window.uFrameWidth = 360; questbook_window.uFrameHeight = 264; questbook_window.uFrameZ = 407; questbook_window.uFrameW = 333; if (BtnDown_flag && books_primary_item_per_page + num_achieved_awards < full_num_items_in_book)//Click Bookmark Down(нажатие закладки вниз) { pAudioPlayer->PlaySound(SOUND_openbook, 0, 0, -1, 0, 0, 0, 0); books_primary_item_per_page += num_achieved_awards; books_num_items_per_page[books_page_number++] = num_achieved_awards; } if (BtnUp_flag && books_page_number)//Click Bookmark Up(Нажатие закладки вверх) { pAudioPlayer->PlaySound(SOUND_openbook, 0, 0, -1, 0, 0, 0, 0); --books_page_number; books_primary_item_per_page -= (unsigned __int8)books_num_items_per_page[books_page_number]; } if (!num_achieved_awards || !books_primary_item_per_page) { books_page_number = 0; books_primary_item_per_page = 0; } BtnDown_flag = 0; BtnUp_flag = 0; num_achieved_awards = 0; for (uint i = books_primary_item_per_page; i < full_num_items_in_book; ++i) { ++num_achieved_awards; questbook_window.DrawText(pAutonoteFont, 1, 0, ui_book_quests_text_color, pQuestTable[achieved_awards[i]], 0, 0, 0); pTextHeight = pAutonoteFont->CalcTextHeight(pQuestTable[achieved_awards[i]], &questbook_window, 1, 0); if ((signed int)(questbook_window.uFrameY + pTextHeight) > (signed int)questbook_window.uFrameHeight) break; pRenderer->DrawTextureIndexedAlpha(100, (questbook_window.uFrameY + pTextHeight) + 12, pSpellBookPagesTextr_10); questbook_window.uFrameY = (questbook_window.uFrameY + pTextHeight) + 24; } }