Mercurial > mm7
annotate GUI/UI/UIBooks.cpp @ 2553:48708da03b7f
Party Creation UI logic separated from MainMenu
author | a.parshin |
---|---|
date | Wed, 13 May 2015 02:20:05 +0200 |
parents | 3121fb54a110 |
children | dd36326a9994 |
rev | line source |
---|---|
2501 | 1 #define _CRTDBG_MAP_ALLOC |
2548
87e5590d034b
All Books windows are refactored into respective classes
a.parshin
parents:
2541
diff
changeset
|
2 #define _CRT_SECURE_NO_WARNINGS |
2501 | 3 #include <stdlib.h> |
4 #include <crtdbg.h> | |
5 | |
2548
87e5590d034b
All Books windows are refactored into respective classes
a.parshin
parents:
2541
diff
changeset
|
6 #include "Engine/Engine.h" |
87e5590d034b
All Books windows are refactored into respective classes
a.parshin
parents:
2541
diff
changeset
|
7 #include "Engine/Graphics/Render.h" |
87e5590d034b
All Books windows are refactored into respective classes
a.parshin
parents:
2541
diff
changeset
|
8 #include "Engine/LOD.h" |
87e5590d034b
All Books windows are refactored into respective classes
a.parshin
parents:
2541
diff
changeset
|
9 #include "Engine/texts.h" |
87e5590d034b
All Books windows are refactored into respective classes
a.parshin
parents:
2541
diff
changeset
|
10 #include "Engine/Awards.h" |
2541 | 11 |
2548
87e5590d034b
All Books windows are refactored into respective classes
a.parshin
parents:
2541
diff
changeset
|
12 #include "GUI/GUIFont.h" |
87e5590d034b
All Books windows are refactored into respective classes
a.parshin
parents:
2541
diff
changeset
|
13 #include "GUI/UI/UIBooks.h" |
87e5590d034b
All Books windows are refactored into respective classes
a.parshin
parents:
2541
diff
changeset
|
14 |
87e5590d034b
All Books windows are refactored into respective classes
a.parshin
parents:
2541
diff
changeset
|
15 #include "Media/Audio/AudioPlayer.h" |
87e5590d034b
All Books windows are refactored into respective classes
a.parshin
parents:
2541
diff
changeset
|
16 |
87e5590d034b
All Books windows are refactored into respective classes
a.parshin
parents:
2541
diff
changeset
|
17 |
2541 | 18 |
2548
87e5590d034b
All Books windows are refactored into respective classes
a.parshin
parents:
2541
diff
changeset
|
19 //----- (00411597) -------------------------------------------------------- |
87e5590d034b
All Books windows are refactored into respective classes
a.parshin
parents:
2541
diff
changeset
|
20 void GUIWindow_Book::Release() |
87e5590d034b
All Books windows are refactored into respective classes
a.parshin
parents:
2541
diff
changeset
|
21 { |
2549 | 22 // ----------------------------------------- |
23 // 0041C26A void GUIWindow::Release --- part | |
2548
87e5590d034b
All Books windows are refactored into respective classes
a.parshin
parents:
2541
diff
changeset
|
24 free(pSpellFont); |
87e5590d034b
All Books windows are refactored into respective classes
a.parshin
parents:
2541
diff
changeset
|
25 pSpellFont = nullptr; |
87e5590d034b
All Books windows are refactored into respective classes
a.parshin
parents:
2541
diff
changeset
|
26 free(pBookFont); |
87e5590d034b
All Books windows are refactored into respective classes
a.parshin
parents:
2541
diff
changeset
|
27 pBookFont = nullptr; |
87e5590d034b
All Books windows are refactored into respective classes
a.parshin
parents:
2541
diff
changeset
|
28 free(pBook2Font); |
87e5590d034b
All Books windows are refactored into respective classes
a.parshin
parents:
2541
diff
changeset
|
29 pBook2Font = nullptr; |
87e5590d034b
All Books windows are refactored into respective classes
a.parshin
parents:
2541
diff
changeset
|
30 free(pAutonoteFont); |
87e5590d034b
All Books windows are refactored into respective classes
a.parshin
parents:
2541
diff
changeset
|
31 pAutonoteFont = nullptr; |
87e5590d034b
All Books windows are refactored into respective classes
a.parshin
parents:
2541
diff
changeset
|
32 pTexture_mapbordr->Release(); |
87e5590d034b
All Books windows are refactored into respective classes
a.parshin
parents:
2541
diff
changeset
|
33 pAudioPlayer->PlaySound(SOUND_closebook, 0, 0, -1, 0, 0, 0, 0); |
87e5590d034b
All Books windows are refactored into respective classes
a.parshin
parents:
2541
diff
changeset
|
34 pIcons_LOD->RemoveTexturesPackFromTextureList(); |
87e5590d034b
All Books windows are refactored into respective classes
a.parshin
parents:
2541
diff
changeset
|
35 dword_506364 = 0; |
87e5590d034b
All Books windows are refactored into respective classes
a.parshin
parents:
2541
diff
changeset
|
36 |
87e5590d034b
All Books windows are refactored into respective classes
a.parshin
parents:
2541
diff
changeset
|
37 GUIWindow::Release(); |
87e5590d034b
All Books windows are refactored into respective classes
a.parshin
parents:
2541
diff
changeset
|
38 } |
87e5590d034b
All Books windows are refactored into respective classes
a.parshin
parents:
2541
diff
changeset
|
39 |
2501 | 40 |
2548
87e5590d034b
All Books windows are refactored into respective classes
a.parshin
parents:
2541
diff
changeset
|
41 GUIWindow_Book::GUIWindow_Book() : |
87e5590d034b
All Books windows are refactored into respective classes
a.parshin
parents:
2541
diff
changeset
|
42 GUIWindow(0, 0, window->GetWidth(), window->GetHeight(), 0, nullptr) |
87e5590d034b
All Books windows are refactored into respective classes
a.parshin
parents:
2541
diff
changeset
|
43 { |
87e5590d034b
All Books windows are refactored into respective classes
a.parshin
parents:
2541
diff
changeset
|
44 } |
87e5590d034b
All Books windows are refactored into respective classes
a.parshin
parents:
2541
diff
changeset
|
45 |
87e5590d034b
All Books windows are refactored into respective classes
a.parshin
parents:
2541
diff
changeset
|
46 void GUIWindow_Book::BasicBookInitialization() |
2501 | 47 { |
2548
87e5590d034b
All Books windows are refactored into respective classes
a.parshin
parents:
2541
diff
changeset
|
48 // ----- (00411BFC) -------------------------------------------------------- |
87e5590d034b
All Books windows are refactored into respective classes
a.parshin
parents:
2541
diff
changeset
|
49 // void GUIWindow::InitializeBookView() --- part |
87e5590d034b
All Books windows are refactored into respective classes
a.parshin
parents:
2541
diff
changeset
|
50 // { |
87e5590d034b
All Books windows are refactored into respective classes
a.parshin
parents:
2541
diff
changeset
|
51 pAudioPlayer->StopChannels(-1, -1); |
87e5590d034b
All Books windows are refactored into respective classes
a.parshin
parents:
2541
diff
changeset
|
52 InitializeFonts(); |
87e5590d034b
All Books windows are refactored into respective classes
a.parshin
parents:
2541
diff
changeset
|
53 CreateButton(475, 445, 158, 34, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[79], 0); // Close |
87e5590d034b
All Books windows are refactored into respective classes
a.parshin
parents:
2541
diff
changeset
|
54 current_screen_type = SCREEN_BOOKS; |
87e5590d034b
All Books windows are refactored into respective classes
a.parshin
parents:
2541
diff
changeset
|
55 full_num_items_in_book = 0; |
87e5590d034b
All Books windows are refactored into respective classes
a.parshin
parents:
2541
diff
changeset
|
56 books_primary_item_per_page = 0; |
87e5590d034b
All Books windows are refactored into respective classes
a.parshin
parents:
2541
diff
changeset
|
57 books_page_number = 0; |
87e5590d034b
All Books windows are refactored into respective classes
a.parshin
parents:
2541
diff
changeset
|
58 num_achieved_awards = 0; |
87e5590d034b
All Books windows are refactored into respective classes
a.parshin
parents:
2541
diff
changeset
|
59 } |
2501 | 60 |
2548
87e5590d034b
All Books windows are refactored into respective classes
a.parshin
parents:
2541
diff
changeset
|
61 //----- (00411AAA) -------------------------------------------------------- |
87e5590d034b
All Books windows are refactored into respective classes
a.parshin
parents:
2541
diff
changeset
|
62 void GUIWindow_Book::InitializeFonts() |
87e5590d034b
All Books windows are refactored into respective classes
a.parshin
parents:
2541
diff
changeset
|
63 { |
87e5590d034b
All Books windows are refactored into respective classes
a.parshin
parents:
2541
diff
changeset
|
64 pAudioPlayer->StopChannels(-1, -1); |
87e5590d034b
All Books windows are refactored into respective classes
a.parshin
parents:
2541
diff
changeset
|
65 ++pIcons_LOD->uTexturePacksCount; |
87e5590d034b
All Books windows are refactored into respective classes
a.parshin
parents:
2541
diff
changeset
|
66 if (!pIcons_LOD->uNumPrevLoadedFiles) |
87e5590d034b
All Books windows are refactored into respective classes
a.parshin
parents:
2541
diff
changeset
|
67 pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; |
87e5590d034b
All Books windows are refactored into respective classes
a.parshin
parents:
2541
diff
changeset
|
68 pAudioPlayer->PlaySound(SOUND_openbook, 0, 0, -1, 0, 0, 0, 0); |
87e5590d034b
All Books windows are refactored into respective classes
a.parshin
parents:
2541
diff
changeset
|
69 pTexture_mapbordr = pIcons_LOD->LoadTexturePtr("mapbordr", TEXTURE_16BIT_PALETTE); |
87e5590d034b
All Books windows are refactored into respective classes
a.parshin
parents:
2541
diff
changeset
|
70 pBookFont = LoadFont("book.fnt", "FONTPAL", NULL); |
87e5590d034b
All Books windows are refactored into respective classes
a.parshin
parents:
2541
diff
changeset
|
71 pBook2Font = LoadFont("book2.fnt", "FONTPAL", NULL); |
87e5590d034b
All Books windows are refactored into respective classes
a.parshin
parents:
2541
diff
changeset
|
72 pAutonoteFont = LoadFont("autonote.fnt", "FONTPAL", NULL); |
87e5590d034b
All Books windows are refactored into respective classes
a.parshin
parents:
2541
diff
changeset
|
73 pSpellFont = LoadFont("spell.fnt", "FONTPAL", NULL); |
2501 | 74 } |
75 | |
76 | |
77 //----- (0041140B) -------------------------------------------------------- | |
78 void OnCloseSpellBookPage() | |
79 { | |
80 GUIButton *pNextButton; // esi@4 | |
81 for ( uint i = 1; i <= 11; i++ ) | |
82 { | |
83 SBPageCSpellsTextureList[i]->Release(); | |
84 SBPageSSpellsTextureList[i]->Release(); | |
85 } | |
86 pIcons_LOD->SyncLoadedFilesCount(); | |
87 if ( pGUIWindow_CurrentMenu->pControlsHead ) | |
88 { | |
89 do | |
90 { | |
91 pNextButton = pGUIWindow_CurrentMenu->pControlsHead->pNext; | |
92 free(pGUIWindow_CurrentMenu->pControlsHead); | |
93 pGUIWindow_CurrentMenu->pControlsHead = pNextButton; | |
94 } | |
95 while ( pNextButton ); | |
96 } | |
97 pGUIWindow_CurrentMenu->pControlsHead = 0; | |
98 pGUIWindow_CurrentMenu->pControlsTail = 0; | |
99 pGUIWindow_CurrentMenu->uNumControls = 0; | |
100 } |