1298
|
1 #ifdef _MSC_VER
|
|
2 #define _CRT_SECURE_NO_WARNINGS
|
|
3 #endif
|
|
4
|
|
5 #include <assert.h>
|
|
6
|
1299
|
7 #include "..\MM7.h"
|
1298
|
8
|
1310
|
9 #include "UIBooks.h"
|
1312
|
10 #include "..\Render.h"
|
1299
|
11 #include "..\GUIWindow.h"
|
|
12 #include "..\GUIFont.h"
|
|
13 #include "..\AudioPlayer.h"
|
|
14 #include "..\LOD.h"
|
|
15 #include "..\Allocator.h"
|
1312
|
16
|
1298
|
17
|
1299
|
18 #include "..\mm7_data.h"
|
1298
|
19
|
|
20
|
|
21
|
|
22
|
|
23
|
|
24
|
|
25 //----- (00413CC6) --------------------------------------------------------
|
|
26 void BookUI_Draw(WindowType book)
|
|
27 {
|
|
28 pRenderer->DrawTextureIndexed(471, 445, pIcons_LOD->GetTexture(uExitCancelTextureId));
|
|
29 switch (book)
|
|
30 {
|
|
31 case WINDOW_QuestBook: BookUI_Questbook_Draw(); break;
|
|
32 case WINDOW_AutonotesBook: BookUI_Autonotes_Draw(); break;
|
|
33 case WINDOW_MapsBook: BookUI_Map_Draw(); break;
|
|
34 case WINDOW_CalendarBook: BookUI_Calendar_Draw(); break;
|
|
35 case WINDOW_JournalBook: BookUI_Journal_Draw(); break;
|
|
36
|
|
37 case WINDOW_LloydsBeacon: DrawLloydBeaconsScreen(); break;
|
|
38 case WINDOW_TownPortal: BookUI_DrawTownPortalMap(); break;
|
|
39 }
|
|
40 }
|
|
41
|
|
42
|
|
43
|
|
44
|
|
45
|
|
46
|
|
47
|
|
48 //----- (0041192C) --------------------------------------------------------
|
|
49 void InitializeBookTextures()
|
|
50 {
|
|
51
|
|
52 pAudioPlayer->StopChannels(-1, -1);
|
|
53
|
|
54 ++pIcons_LOD->uTexturePacksCount;
|
|
55 if ( !pIcons_LOD->uNumPrevLoadedFiles )
|
|
56 pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles;
|
|
57
|
|
58 pAudioPlayer->PlaySound(SOUND_OpenBook, 0, 0, -1, 0, 0, 0, 0);
|
|
59 pSpellBookPagesTextr_9 = pIcons_LOD->LoadTexturePtr("book", TEXTURE_16BIT_PALETTE);
|
|
60 pTexture_pagemask = pIcons_LOD->LoadTexturePtr("pagemask", TEXTURE_16BIT_PALETTE);
|
1402
|
61 pSpellBookCloseBtnTextr = pIcons_LOD->LoadTexturePtr("ib-m5-u", TEXTURE_16BIT_PALETTE);
|
|
62 pSpellBookClickCloseBtnTextr = pIcons_LOD->LoadTexturePtr("ib-m5-d", TEXTURE_16BIT_PALETTE);
|
|
63 pSBQuickSpellBtnTextr = pIcons_LOD->LoadTexturePtr("ib-m6-u",TEXTURE_16BIT_PALETTE);
|
1298
|
64 //v0 = 1;
|
|
65
|
|
66 static const char *texNames[9] = // 004E24EC
|
|
67 {
|
|
68 "SBFB00", "SBAB00", "SBWB00", "SBEB00",
|
|
69 "SBSB00", "SBMB00", "SBBB00", "SBLB00", "SBDB00"
|
|
70 };
|
|
71
|
1402
|
72 pSBClickQuickSpellBtnTextr = pIcons_LOD->LoadTexturePtr("ib-m6-d",TEXTURE_16BIT_PALETTE);
|
1298
|
73 for (uint i = 0; i < 9; ++i)
|
|
74 {
|
|
75 pSpellBookPagesTextr[i] = pIcons_LOD->LoadTexturePtr(texNames[i], TEXTURE_16BIT_PALETTE);
|
|
76
|
|
77 sprintf(pTmpBuf.data(), "tab%da", i+1);
|
|
78 pTextures_tabs[i][0] = pIcons_LOD->LoadTexturePtr(pTmpBuf.data(), TEXTURE_16BIT_PALETTE);
|
|
79 sprintf(pTmpBuf.data(), "tab%db", i+1);
|
|
80 pTextures_tabs[i][1] = pIcons_LOD->LoadTexturePtr(pTmpBuf.data(), TEXTURE_16BIT_PALETTE);
|
|
81 }
|
|
82 }
|
|
83
|
|
84
|
|
85
|
|
86 //----- (00411AAA) --------------------------------------------------------
|
|
87 void InitializeBookFonts()
|
|
88 {
|
|
89 pAudioPlayer->StopChannels(-1, -1);
|
|
90
|
|
91 ++pIcons_LOD->uTexturePacksCount;
|
|
92 if ( !pIcons_LOD->uNumPrevLoadedFiles )
|
|
93 pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles;
|
|
94
|
|
95 pAudioPlayer->PlaySound(SOUND_OpenBook, 0, 0, -1, 0, 0, 0, 0);
|
|
96 pTexture_mapbordr = pIcons_LOD->LoadTexturePtr("mapbordr", TEXTURE_16BIT_PALETTE);
|
|
97 pBookFont = LoadFont("book.fnt", "FONTPAL", NULL);
|
|
98 pBook2Font = LoadFont("book2.fnt", "FONTPAL", NULL);
|
|
99 pAutonoteFont = LoadFont("autonote.fnt", "FONTPAL", NULL);
|
|
100 pSpellFont = LoadFont("spell.fnt", "FONTPAL", NULL);
|
|
101 }
|
|
102
|
|
103
|
|
104
|
|
105
|
|
106 //----- (0041140B) --------------------------------------------------------
|
1402
|
107 void OnCloseSpellBookPage()
|
1298
|
108 {
|
1402
|
109 GUIButton *pNextButton; // esi@4
|
1298
|
110
|
1402
|
111 for ( uint i = 1; i <= 11; i++ )
|
1298
|
112 {
|
1402
|
113 SBPageCSpellsTextureList[i]->Release();
|
|
114 SBPageSSpellsTextureList[i]->Release();
|
1298
|
115 }
|
|
116 pIcons_LOD->SyncLoadedFilesCount();
|
1402
|
117 if ( pGUIWindow_CurrentMenu->pControlsHead )
|
1298
|
118 {
|
|
119 do
|
|
120 {
|
1402
|
121 pNextButton = pGUIWindow_CurrentMenu->pControlsHead->pNext;
|
|
122 pAllocator->FreeChunk(pGUIWindow_CurrentMenu->pControlsHead);
|
|
123 pGUIWindow_CurrentMenu->pControlsHead = pNextButton;
|
1298
|
124 }
|
1402
|
125 while ( pNextButton );
|
1298
|
126 }
|
|
127 pGUIWindow_CurrentMenu->pControlsHead = 0;
|
|
128 pGUIWindow_CurrentMenu->pControlsTail = 0;
|
|
129 pGUIWindow_CurrentMenu->uNumControls = 0;
|
|
130 }
|
|
131
|
|
132 //----- (00411473) --------------------------------------------------------
|
1402
|
133 void OnCloseSpellBook()
|
1298
|
134 {
|
|
135 pTexture_pagemask->Release();
|
1402
|
136 pSpellBookCloseBtnTextr->Release();
|
|
137 pSBQuickSpellBtnTextr->Release();
|
1298
|
138 for (uint i = 0; i < 9; ++i)
|
1403
|
139 {
|
|
140 pSpellBookPagesTextr[i]->Release();
|
|
141 pTextures_tabs[i][0]->Release();
|
|
142 pTextures_tabs[i][1]->Release();
|
|
143 }
|
1298
|
144 pAudioPlayer->PlaySound(SOUND_CloseBook, 0, 0, -1, 0, 0, 0, 0);
|
|
145 pIcons_LOD->_4114F2();
|
|
146 }
|
|
147
|
|
148
|
|
149
|
|
150
|
|
151
|
|
152
|
|
153
|
|
154
|