Mercurial > mm7
view GUI/UI/Books/AutonotesBook.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/Autonotes.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/AutonotesBook.h" #include "Media/Audio/AudioPlayer.h" GUIWindow_AutonotesBook::GUIWindow_AutonotesBook() : GUIWindow_Book() { this->ptr_1C = (void *)WINDOW_AutonotesBook; // inherited from GUIWindow::GUIWindow BasicBookInitialization(); // -------------------------------- // 004304E7 Game_EventLoop --- part pEventTimer->Pause(); pAudioPlayer->StopChannels(-1, -1); pBooksButtonOverlay = new GUIWindow_BooksButtonOverlay(527, 353, 0, 0, (int)pBtn_Autonotes, 0); bFlashAutonotesBook = 0; // ---------------------------------------------- // 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); 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 ); 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 ); 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 ); // "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 ); // "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 ); // "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 ); // "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 ); // "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 ); // "Instructors" int num_achieved_awards = 0; for (uint i = books_primary_item_per_page; i < 196; ++i) { if (_506568_autonote_type == pAutonoteTxt[i].eType)//dword_72371C[2 * v10] ) { if (i) { if (_449B57_test_bit(pParty->_autonote_bits, i) && pAutonoteTxt[i].pText) { achieved_awards[num_achieved_awards] = (AwardType)i; ++num_achieved_awards; } } } } full_num_items_in_book = num_achieved_awards; num_achieved_awards = 0; } void GUIWindow_AutonotesBook::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_Autonotes_Draw(); // ----- (0041338E) -------------------------------------------------------- // void BookUI_Autonotes_Draw() // { int pTextHeight; // eax@65 bool change_flag; // [sp+10h] [bp-58h]@1 GUIWindow autonotes_window; // [sp+14h] [bp-54h]@46 change_flag = false; pRenderer->DrawTextureTransparentColorKey(pViewport->uViewportTL_X, pViewport->uViewportTL_Y, pTexture_AutonotesBook); if (BtnUp_flag || !books_primary_item_per_page) 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) 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); 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); 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); } } else { if (_506568_autonote_type == AUTONOTE_POTION_RECEPIE)// default(по умолчанию при запуске окна) pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 113, pTex_book_button3_on); else//Potions_page not active(вкладка снадобья не активна) pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 113, pTex_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); 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); } } else { if (_506568_autonote_type == AUTONOTE_STAT_HINT) pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 399, pViewport->uViewportTL_Y + 150, pTex_book_button4_on); else pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 150, pTex_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); 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); } } else { if (_506568_autonote_type == AUTONOTE_OBELISK) pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 188, pTex_book_button5_on); else pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 188, pTex_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); 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); } } else { if (_506568_autonote_type == AUTONOTE_SEER) pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 226, pTex_book_button6_on); else pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 226, pTex_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); 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); } } else { if (_506568_autonote_type == AUTONOTE_MISC) pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 264, pTex_book_button7_on); else pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 263, pTex_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); 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); } } else { if (_506568_autonote_type == AUTONOTE_TEACHER) pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 302, pTex_book_button8_on); else pRenderer->DrawTextureIndexedAlpha(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 302, pTex_book_button8_off); } //for title autonotes_window.uFrameWidth = game_viewport_width; autonotes_window.uFrameHeight = game_viewport_height; autonotes_window.uFrameX = game_viewport_x; autonotes_window.uFrameY = game_viewport_y; autonotes_window.uFrameZ = game_viewport_z; autonotes_window.uFrameW = game_viewport_w; autonotes_window.DrawTitleText(pBook2Font, 0, 22, ui_book_autonotes_title_color, pGlobalTXT_LocalizationStrings[154], 3); // "Auto notes" //for other text autonotes_window.uFrameX = 48; autonotes_window.uFrameY = 70; autonotes_window.uFrameWidth = 360; autonotes_window.uFrameHeight = 264; autonotes_window.uFrameZ = 407; autonotes_window.uFrameW = 333; if (change_flag)//change bookmark(смена закладки) { full_num_items_in_book = 0; books_primary_item_per_page = 0; books_page_number = 0; num_achieved_awards = 0; for (uint i = 1; i <= 195; ++i) { if (pAutonoteTxt[i].eType == _506568_autonote_type) { if ((unsigned __int16)_449B57_test_bit(pParty->_autonote_bits, i) && (char *)pAutonoteTxt[i].pText) achieved_awards[num_achieved_awards++] = (AwardType)i; } } full_num_items_in_book = num_achieved_awards; } else//not change bookmark(не меняется закладка) { if (BtnDown_flag)// press Down bookmark(нажатие закладки пролистать дальше) { if (num_achieved_awards + books_primary_item_per_page < full_num_items_in_book) { books_num_items_per_page[books_page_number++] = num_achieved_awards; books_primary_item_per_page = num_achieved_awards + books_primary_item_per_page; pAudioPlayer->PlaySound(SOUND_openbook, 0, 0, -1, 0, 0, 0, 0); } } if (BtnUp_flag && books_page_number)// press Up bookmark(нажатие закладки пролистать назад) { --books_page_number; books_primary_item_per_page -= (unsigned __int8)books_num_items_per_page[books_page_number]; pAudioPlayer->PlaySound(SOUND_openbook, 0, 0, -1, 0, 0, 0, 0); } if (!num_achieved_awards || !books_primary_item_per_page)//количество записей 0 или номер первой страницы 0 { books_primary_item_per_page = 0; books_page_number = 0; } } BtnUp_flag = 0; BtnDown_flag = 0; Book_PageBtn3_flag = 0;//Potions_page_flag Book_PageBtn4_flag = 0;//Fontains_page_flag Book_PageBtn5_flag = 0;//Autonotes_Obelisks_page_flag Book_PageBtn6_flag = 0;//Autonotes_Seer_page_flag Autonotes_Misc_page_flag = 0; Autonotes_Instructors_page_flag = 0; num_achieved_awards = 0; for (uint i = books_primary_item_per_page; i < full_num_items_in_book; ++i) { ++num_achieved_awards; autonotes_window.DrawText(pAutonoteFont, 1, 0, ui_book_autonotes_text_color, pAutonoteTxt[achieved_awards[i]].pText, 0, 0, 0); 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); autonotes_window.uFrameY = (autonotes_window.uFrameY + pTextHeight) + 24; } }