Mercurial > mm7
diff GUI/UI/UIBooks.cpp @ 2548:87e5590d034b
All Books windows are refactored into respective classes
author | a.parshin |
---|---|
date | Tue, 12 May 2015 03:24:19 +0200 |
parents | a902abdfc7f2 |
children | 3121fb54a110 |
line wrap: on
line diff
--- a/GUI/UI/UIBooks.cpp Tue May 12 01:45:31 2015 +0200 +++ b/GUI/UI/UIBooks.cpp Tue May 12 03:24:19 2015 +0200 @@ -1,37 +1,78 @@ #define _CRTDBG_MAP_ALLOC +#define _CRT_SECURE_NO_WARNINGS #include <stdlib.h> #include <crtdbg.h> -#define _CRT_SECURE_NO_WARNINGS +#include "Engine/Engine.h" +#include "Engine/Graphics/Render.h" +#include "Engine/LOD.h" +#include "Engine/texts.h" +#include "Engine/Awards.h" -#include "Engine/Engine.h" +#include "GUI/GUIFont.h" +#include "GUI/UI/UIBooks.h" + +#include "Media/Audio/AudioPlayer.h" + + -#include "UIBooks.h" -#include "..\../Engine/Graphics/Render.h" -#include "..\../GUI/GUIWindow.h" -#include "..\../GUI/GUIFont.h" -#include "..\../Media/Audio/AudioPlayer.h" -#include "..\../Engine/LOD.h" +//----- (00411597) -------------------------------------------------------- +void GUIWindow_Book::Release() +{ + free(pSpellFont); + pSpellFont = nullptr; + free(pBookFont); + pBookFont = nullptr; + free(pBook2Font); + pBook2Font = nullptr; + free(pAutonoteFont); + pAutonoteFont = nullptr; + pTexture_mapbordr->Release(); + pAudioPlayer->PlaySound(SOUND_closebook, 0, 0, -1, 0, 0, 0, 0); + pIcons_LOD->RemoveTexturesPackFromTextureList(); + dword_506364 = 0; + + GUIWindow::Release(); +} + -//----- (00413CC6) -------------------------------------------------------- -void BookUI_Draw(WindowType book) +GUIWindow_Book::GUIWindow_Book() : + GUIWindow(0, 0, window->GetWidth(), window->GetHeight(), 0, nullptr) +{ +} + +void GUIWindow_Book::BasicBookInitialization() { - pRenderer->DrawTextureIndexed(471, 445, pIcons_LOD->GetTexture(uExitCancelTextureId)); - switch (book) - { - case WINDOW_QuestBook: BookUI_Questbook_Draw(); break; - case WINDOW_AutonotesBook: BookUI_Autonotes_Draw(); break; - case WINDOW_MapsBook: BookUI_Map_Draw(); break; - case WINDOW_CalendarBook: BookUI_Calendar_Draw(); break; - case WINDOW_JournalBook: BookUI_Journal_Draw(); break; +// ----- (00411BFC) -------------------------------------------------------- +// void GUIWindow::InitializeBookView() --- part +// { + pAudioPlayer->StopChannels(-1, -1); + InitializeFonts(); + CreateButton(475, 445, 158, 34, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[79], 0); // Close + current_screen_type = SCREEN_BOOKS; + full_num_items_in_book = 0; + books_primary_item_per_page = 0; + books_page_number = 0; + num_achieved_awards = 0; +} - case WINDOW_LloydsBeacon: DrawLloydBeaconsScreen(); break; - case WINDOW_TownPortal: BookUI_DrawTownPortalMap(); break; - } +//----- (00411AAA) -------------------------------------------------------- +void GUIWindow_Book::InitializeFonts() +{ + pAudioPlayer->StopChannels(-1, -1); + ++pIcons_LOD->uTexturePacksCount; + if (!pIcons_LOD->uNumPrevLoadedFiles) + pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; + pAudioPlayer->PlaySound(SOUND_openbook, 0, 0, -1, 0, 0, 0, 0); + pTexture_mapbordr = pIcons_LOD->LoadTexturePtr("mapbordr", TEXTURE_16BIT_PALETTE); + pBookFont = LoadFont("book.fnt", "FONTPAL", NULL); + pBook2Font = LoadFont("book2.fnt", "FONTPAL", NULL); + pAutonoteFont = LoadFont("autonote.fnt", "FONTPAL", NULL); + pSpellFont = LoadFont("spell.fnt", "FONTPAL", NULL); } //----- (0041192C) -------------------------------------------------------- -void InitializeBookTextures() +void InitializeSpellBookTextures() { pAudioPlayer->StopChannels(-1, -1); ++pIcons_LOD->uTexturePacksCount; @@ -61,21 +102,6 @@ } } -//----- (00411AAA) -------------------------------------------------------- -void InitializeBookFonts() -{ - pAudioPlayer->StopChannels(-1, -1); - ++pIcons_LOD->uTexturePacksCount; - if ( !pIcons_LOD->uNumPrevLoadedFiles ) - pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; - pAudioPlayer->PlaySound(SOUND_openbook, 0, 0, -1, 0, 0, 0, 0); - pTexture_mapbordr = pIcons_LOD->LoadTexturePtr("mapbordr", TEXTURE_16BIT_PALETTE); - pBookFont = LoadFont("book.fnt", "FONTPAL", NULL); - pBook2Font = LoadFont("book2.fnt", "FONTPAL", NULL); - pAutonoteFont = LoadFont("autonote.fnt", "FONTPAL", NULL); - pSpellFont = LoadFont("spell.fnt", "FONTPAL", NULL); -} - //----- (0041140B) -------------------------------------------------------- void OnCloseSpellBookPage() {