World of Might and Magic  0.2.0
Open reimplementation of Might and Magic 6 7 8 game engine
UIBooks.cpp
См. документацию.
1 #define _CRTDBG_MAP_ALLOC
2 #define _CRT_SECURE_NO_WARNINGS
3 #include <stdlib.h>
4 
5 #include "Engine/Awards.h"
6 #include "Engine/Engine.h"
7 #include "Engine/LOD.h"
8 #include "Engine/Localization.h"
9 
11 
12 #include "GUI/GUIFont.h"
13 #include "GUI/UI/UIBooks.h"
14 
16 
17 #include "Platform/Api.h"
18 
35 
37 
39 
40 //----- (00411597) --------------------------------------------------------
42  // -----------------------------------------
43  // 0041C26A void GUIWindow::Release --- part
44  free(pSpellFont);
45  pSpellFont = nullptr;
46  free(pBookFont);
47  pBookFont = nullptr;
48  free(pBook2Font);
49  pBook2Font = nullptr;
50  free(pAutonoteFont);
51  pAutonoteFont = nullptr;
52 
53  if (ui_book_map_frame) {
55  ui_book_map_frame = nullptr;
56  }
57 
58  pAudioPlayer->PlaySound(SOUND_closebook, 0, 0, -1, 0, 0);
59  MapBookOpen = 0;
60 
62 }
63 
65  : GUIWindow(WINDOW_Book, 0, 0, window->GetWidth(), window->GetHeight(), 0) {}
66 
68  pAudioPlayer->StopChannels(-1, -1);
70  CreateButton(475, 445, 158, 34, 1, 0, UIMSG_Escape, 0, 0,
71  localization->GetString(79)); // Close
77 }
78 
79 //----- (00411AAA) --------------------------------------------------------
81  pAudioPlayer->StopChannels(-1, -1);
82  pAudioPlayer->PlaySound(SOUND_openbook, 0, 0, -1, 0, 0);
83 
85 
86  pBookFont = GUIFont::LoadFont("book.fnt", "FONTPAL", NULL);
87  pBook2Font = GUIFont::LoadFont("book2.fnt", "FONTPAL", NULL);
88  pAutonoteFont = GUIFont::LoadFont("autonote.fnt", "FONTPAL", NULL);
89  pSpellFont = GUIFont::LoadFont("spell.fnt", "FONTPAL", NULL);
90 }
pAutonoteFont
GUIFont * pAutonoteFont
Definition: GUIFont.cpp:16
Localization::GetString
const char * GetString(unsigned int index) const
Definition: Localization.cpp:13
UIMSG_Escape
@ UIMSG_Escape
Definition: GUIWindow.h:96
LOD.h
Image::GetHeight
unsigned int GetHeight()
Definition: Image.cpp:230
ui_book_button8_on
Image * ui_book_button8_on
Definition: UIBooks.cpp:20
GUIWindow
Definition: GUIWindow.h:433
ui_book_button6_off
Image * ui_book_button6_off
Definition: UIBooks.cpp:23
SOUND_closebook
@ SOUND_closebook
Definition: AudioPlayer.h:94
ui_book_button7_off
Image * ui_book_button7_off
Definition: UIBooks.cpp:21
GUIWindow::CreateButton
GUIButton * CreateButton(int x, int y, int width, int height, int a6, int a7, UIMessageType msg, unsigned int msg_param, uint8_t hotkey, const String &label, const std::vector< Image * > &textures=std::vector< Image * >())
Definition: GUIWindow.cpp:717
ui_book_button4_off
Image * ui_book_button4_off
Definition: UIBooks.cpp:27
ui_book_button5_off
Image * ui_book_button5_off
Definition: UIBooks.cpp:25
ui_book_button1_on
Image * ui_book_button1_on
Definition: UIBooks.cpp:34
AudioPlayer::PlaySound
void PlaySound(SoundID eSoundID, int pid, unsigned int uNumRepeats, int x, int y, int a7)
Definition: AudioPlayer.cpp:195
ui_book_button3_off
Image * ui_book_button3_off
Definition: UIBooks.cpp:29
num_achieved_awards
int num_achieved_awards
Definition: mm7_data.cpp:28
localization
Localization * localization
Definition: Localization.cpp:11
ui_book_quest_div_bar
Image * ui_book_quest_div_bar
Definition: UIBooks.cpp:38
GUIWindow::Release
virtual void Release()
Definition: GUIWindow.cpp:292
GUIFont.h
Engine.h
current_screen_type
enum CURRENT_SCREEN current_screen_type
Definition: GUIWindow.cpp:83
ui_book_button6_on
Image * ui_book_button6_on
Definition: UIBooks.cpp:24
Localization.h
UIBooks.h
Image::GetWidth
unsigned int GetWidth()
Definition: Image.cpp:217
ui_book_button5_on
Image * ui_book_button5_on
Definition: UIBooks.cpp:26
Image
Definition: Image.h:19
IRender.h
GUIWindow_Book::InitializeFonts
void InitializeFonts()
Definition: UIBooks.cpp:80
pSpellFont
GUIFont * pSpellFont
Definition: GUIFont.cpp:17
ui_book_button2_on
Image * ui_book_button2_on
Definition: UIBooks.cpp:32
WINDOW_Book
@ WINDOW_Book
Definition: GUIWindow.h:297
ui_book_button4_on
Image * ui_book_button4_on
Definition: UIBooks.cpp:28
MapBookOpen
int MapBookOpen
Definition: mm7_data.cpp:519
GUIFont::LoadFont
static GUIFont * LoadFont(const char *pFontFile, const char *pFontPalette,...)
Definition: GUIFont.cpp:56
pBook2Font
GUIFont * pBook2Font
Definition: GUIFont.cpp:20
AudioPlayer::StopChannels
void StopChannels(int uStartChannel, int uEndChannel)
Definition: AudioPlayer.cpp:331
window
EGLSurface EGLNativeWindowType * window
Definition: SDL_egl.h:1580
pBookFont
GUIFont * pBookFont
Definition: GUIFont.cpp:21
CURRENT_SCREEN::SCREEN_BOOKS
@ SCREEN_BOOKS
ui_book_button1_off
Image * ui_book_button1_off
Definition: UIBooks.cpp:33
AudioPlayer.h
ui_book_button2_off
Image * ui_book_button2_off
Definition: UIBooks.cpp:31
GUIWindow_Book::BasicBookInitialization
void BasicBookInitialization()
Definition: UIBooks.cpp:67
Awards.h
assets
AssetsManager * assets
Definition: AssetsManager.cpp:12
books_primary_item_per_page
int books_primary_item_per_page
Definition: mm7_data.cpp:521
GUIWindow_Book::GUIWindow_Book
GUIWindow_Book()
Definition: UIBooks.cpp:64
books_page_number
int books_page_number
Definition: mm7_data.cpp:520
AssetsManager::GetImage_Alpha
Texture * GetImage_Alpha(const String &name)
Definition: AssetsManager.cpp:66
ui_book_button8_off
Image * ui_book_button8_off
Definition: UIBooks.cpp:19
GUIWindow_Book::Release
virtual void Release()
Definition: UIBooks.cpp:41
SOUND_openbook
@ SOUND_openbook
Definition: AudioPlayer.h:93
pAudioPlayer
AudioPlayer * pAudioPlayer
Definition: AudioPlayer.cpp:20
full_num_items_in_book
int full_num_items_in_book
Definition: mm7_data.cpp:29
ui_book_button7_on
Image * ui_book_button7_on
Definition: UIBooks.cpp:22
ui_book_button3_on
Image * ui_book_button3_on
Definition: UIBooks.cpp:30
Image::Release
bool Release()
Definition: Image.cpp:335
Api.h
ui_book_map_frame
Image * ui_book_map_frame
Definition: UIBooks.cpp:36