annotate GUI/UI/UIBooks.cpp @ 2575:a76d408c5132 tip

DrawTranslucent -> DrawTextureGrayShade Removed old texture drawing stuff
author a.parshin
date Wed, 09 Mar 2016 01:39:52 +0200
parents dd36326a9994
children
rev   line source
2501
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
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
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
3 #include <stdlib.h>
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
4 #include <crtdbg.h>
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
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
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2534
diff changeset
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
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2534
diff changeset
18
2574
dd36326a9994 More texture refactoring
a.parshin
parents: 2549
diff changeset
19
dd36326a9994 More texture refactoring
a.parshin
parents: 2549
diff changeset
20 Image *ui_book_button8_off = nullptr;
dd36326a9994 More texture refactoring
a.parshin
parents: 2549
diff changeset
21 Image *ui_book_button8_on = nullptr;
dd36326a9994 More texture refactoring
a.parshin
parents: 2549
diff changeset
22 Image *ui_book_button7_off = nullptr;
dd36326a9994 More texture refactoring
a.parshin
parents: 2549
diff changeset
23 Image *ui_book_button7_on = nullptr;
dd36326a9994 More texture refactoring
a.parshin
parents: 2549
diff changeset
24 Image *ui_book_button6_off = nullptr;
dd36326a9994 More texture refactoring
a.parshin
parents: 2549
diff changeset
25 Image *ui_book_button6_on = nullptr;
dd36326a9994 More texture refactoring
a.parshin
parents: 2549
diff changeset
26 Image *ui_book_button5_off = nullptr;
dd36326a9994 More texture refactoring
a.parshin
parents: 2549
diff changeset
27 Image *ui_book_button5_on = nullptr;
dd36326a9994 More texture refactoring
a.parshin
parents: 2549
diff changeset
28 Image *ui_book_button4_off = nullptr;
dd36326a9994 More texture refactoring
a.parshin
parents: 2549
diff changeset
29 Image *ui_book_button4_on = nullptr;
dd36326a9994 More texture refactoring
a.parshin
parents: 2549
diff changeset
30 Image *ui_book_button3_off = nullptr;
dd36326a9994 More texture refactoring
a.parshin
parents: 2549
diff changeset
31 Image *ui_book_button3_on = nullptr;
dd36326a9994 More texture refactoring
a.parshin
parents: 2549
diff changeset
32 Image *ui_book_button2_off = nullptr;
dd36326a9994 More texture refactoring
a.parshin
parents: 2549
diff changeset
33 Image *ui_book_button2_on = nullptr;
dd36326a9994 More texture refactoring
a.parshin
parents: 2549
diff changeset
34 Image *ui_book_button1_off = nullptr;
dd36326a9994 More texture refactoring
a.parshin
parents: 2549
diff changeset
35 Image *ui_book_button1_on = nullptr;
dd36326a9994 More texture refactoring
a.parshin
parents: 2549
diff changeset
36
dd36326a9994 More texture refactoring
a.parshin
parents: 2549
diff changeset
37 Image *ui_book_map_frame = nullptr;
dd36326a9994 More texture refactoring
a.parshin
parents: 2549
diff changeset
38
dd36326a9994 More texture refactoring
a.parshin
parents: 2549
diff changeset
39 Image *ui_book_quest_div_bar = nullptr;
dd36326a9994 More texture refactoring
a.parshin
parents: 2549
diff changeset
40
2548
87e5590d034b All Books windows are refactored into respective classes
a.parshin
parents: 2541
diff changeset
41 //----- (00411597) --------------------------------------------------------
87e5590d034b All Books windows are refactored into respective classes
a.parshin
parents: 2541
diff changeset
42 void GUIWindow_Book::Release()
87e5590d034b All Books windows are refactored into respective classes
a.parshin
parents: 2541
diff changeset
43 {
2549
3121fb54a110 Rest & Spelbook refactored into class
a.parshin
parents: 2548
diff changeset
44 // -----------------------------------------
3121fb54a110 Rest & Spelbook refactored into class
a.parshin
parents: 2548
diff changeset
45 // 0041C26A void GUIWindow::Release --- part
2548
87e5590d034b All Books windows are refactored into respective classes
a.parshin
parents: 2541
diff changeset
46 free(pSpellFont);
87e5590d034b All Books windows are refactored into respective classes
a.parshin
parents: 2541
diff changeset
47 pSpellFont = nullptr;
87e5590d034b All Books windows are refactored into respective classes
a.parshin
parents: 2541
diff changeset
48 free(pBookFont);
87e5590d034b All Books windows are refactored into respective classes
a.parshin
parents: 2541
diff changeset
49 pBookFont = nullptr;
87e5590d034b All Books windows are refactored into respective classes
a.parshin
parents: 2541
diff changeset
50 free(pBook2Font);
87e5590d034b All Books windows are refactored into respective classes
a.parshin
parents: 2541
diff changeset
51 pBook2Font = nullptr;
87e5590d034b All Books windows are refactored into respective classes
a.parshin
parents: 2541
diff changeset
52 free(pAutonoteFont);
87e5590d034b All Books windows are refactored into respective classes
a.parshin
parents: 2541
diff changeset
53 pAutonoteFont = nullptr;
2574
dd36326a9994 More texture refactoring
a.parshin
parents: 2549
diff changeset
54
dd36326a9994 More texture refactoring
a.parshin
parents: 2549
diff changeset
55 if (ui_book_map_frame)
dd36326a9994 More texture refactoring
a.parshin
parents: 2549
diff changeset
56 {
dd36326a9994 More texture refactoring
a.parshin
parents: 2549
diff changeset
57 ui_book_map_frame->Release();
dd36326a9994 More texture refactoring
a.parshin
parents: 2549
diff changeset
58 ui_book_map_frame = nullptr;
dd36326a9994 More texture refactoring
a.parshin
parents: 2549
diff changeset
59 }
dd36326a9994 More texture refactoring
a.parshin
parents: 2549
diff changeset
60
2548
87e5590d034b All Books windows are refactored into respective classes
a.parshin
parents: 2541
diff changeset
61 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
62 pIcons_LOD->RemoveTexturesPackFromTextureList();
87e5590d034b All Books windows are refactored into respective classes
a.parshin
parents: 2541
diff changeset
63 dword_506364 = 0;
87e5590d034b All Books windows are refactored into respective classes
a.parshin
parents: 2541
diff changeset
64
87e5590d034b All Books windows are refactored into respective classes
a.parshin
parents: 2541
diff changeset
65 GUIWindow::Release();
87e5590d034b All Books windows are refactored into respective classes
a.parshin
parents: 2541
diff changeset
66 }
87e5590d034b All Books windows are refactored into respective classes
a.parshin
parents: 2541
diff changeset
67
2501
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
68
2548
87e5590d034b All Books windows are refactored into respective classes
a.parshin
parents: 2541
diff changeset
69 GUIWindow_Book::GUIWindow_Book() :
87e5590d034b All Books windows are refactored into respective classes
a.parshin
parents: 2541
diff changeset
70 GUIWindow(0, 0, window->GetWidth(), window->GetHeight(), 0, nullptr)
87e5590d034b All Books windows are refactored into respective classes
a.parshin
parents: 2541
diff changeset
71 {
87e5590d034b All Books windows are refactored into respective classes
a.parshin
parents: 2541
diff changeset
72 }
87e5590d034b All Books windows are refactored into respective classes
a.parshin
parents: 2541
diff changeset
73
87e5590d034b All Books windows are refactored into respective classes
a.parshin
parents: 2541
diff changeset
74 void GUIWindow_Book::BasicBookInitialization()
2501
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
75 {
2548
87e5590d034b All Books windows are refactored into respective classes
a.parshin
parents: 2541
diff changeset
76 // ----- (00411BFC) --------------------------------------------------------
87e5590d034b All Books windows are refactored into respective classes
a.parshin
parents: 2541
diff changeset
77 // void GUIWindow::InitializeBookView() --- part
87e5590d034b All Books windows are refactored into respective classes
a.parshin
parents: 2541
diff changeset
78 // {
87e5590d034b All Books windows are refactored into respective classes
a.parshin
parents: 2541
diff changeset
79 pAudioPlayer->StopChannels(-1, -1);
87e5590d034b All Books windows are refactored into respective classes
a.parshin
parents: 2541
diff changeset
80 InitializeFonts();
87e5590d034b All Books windows are refactored into respective classes
a.parshin
parents: 2541
diff changeset
81 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
82 current_screen_type = SCREEN_BOOKS;
87e5590d034b All Books windows are refactored into respective classes
a.parshin
parents: 2541
diff changeset
83 full_num_items_in_book = 0;
87e5590d034b All Books windows are refactored into respective classes
a.parshin
parents: 2541
diff changeset
84 books_primary_item_per_page = 0;
87e5590d034b All Books windows are refactored into respective classes
a.parshin
parents: 2541
diff changeset
85 books_page_number = 0;
87e5590d034b All Books windows are refactored into respective classes
a.parshin
parents: 2541
diff changeset
86 num_achieved_awards = 0;
87e5590d034b All Books windows are refactored into respective classes
a.parshin
parents: 2541
diff changeset
87 }
2501
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
88
2548
87e5590d034b All Books windows are refactored into respective classes
a.parshin
parents: 2541
diff changeset
89 //----- (00411AAA) --------------------------------------------------------
87e5590d034b All Books windows are refactored into respective classes
a.parshin
parents: 2541
diff changeset
90 void GUIWindow_Book::InitializeFonts()
87e5590d034b All Books windows are refactored into respective classes
a.parshin
parents: 2541
diff changeset
91 {
87e5590d034b All Books windows are refactored into respective classes
a.parshin
parents: 2541
diff changeset
92 pAudioPlayer->StopChannels(-1, -1);
87e5590d034b All Books windows are refactored into respective classes
a.parshin
parents: 2541
diff changeset
93 ++pIcons_LOD->uTexturePacksCount;
87e5590d034b All Books windows are refactored into respective classes
a.parshin
parents: 2541
diff changeset
94 if (!pIcons_LOD->uNumPrevLoadedFiles)
87e5590d034b All Books windows are refactored into respective classes
a.parshin
parents: 2541
diff changeset
95 pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles;
87e5590d034b All Books windows are refactored into respective classes
a.parshin
parents: 2541
diff changeset
96 pAudioPlayer->PlaySound(SOUND_openbook, 0, 0, -1, 0, 0, 0, 0);
2574
dd36326a9994 More texture refactoring
a.parshin
parents: 2549
diff changeset
97
dd36326a9994 More texture refactoring
a.parshin
parents: 2549
diff changeset
98 ui_book_map_frame = assets->GetImage_16BitAlpha("mapbordr");
dd36326a9994 More texture refactoring
a.parshin
parents: 2549
diff changeset
99
2548
87e5590d034b All Books windows are refactored into respective classes
a.parshin
parents: 2541
diff changeset
100 pBookFont = LoadFont("book.fnt", "FONTPAL", NULL);
87e5590d034b All Books windows are refactored into respective classes
a.parshin
parents: 2541
diff changeset
101 pBook2Font = LoadFont("book2.fnt", "FONTPAL", NULL);
87e5590d034b All Books windows are refactored into respective classes
a.parshin
parents: 2541
diff changeset
102 pAutonoteFont = LoadFont("autonote.fnt", "FONTPAL", NULL);
87e5590d034b All Books windows are refactored into respective classes
a.parshin
parents: 2541
diff changeset
103 pSpellFont = LoadFont("spell.fnt", "FONTPAL", NULL);
2501
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
104 }