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 //signed int v0; // ebp@3
|
|
52 //Texture **v1; // ebx@3
|
|
53
|
|
54 pAudioPlayer->StopChannels(-1, -1);
|
|
55
|
|
56 ++pIcons_LOD->uTexturePacksCount;
|
|
57 if ( !pIcons_LOD->uNumPrevLoadedFiles )
|
|
58 pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles;
|
|
59
|
|
60 pAudioPlayer->PlaySound(SOUND_OpenBook, 0, 0, -1, 0, 0, 0, 0);
|
|
61 pSpellBookPagesTextr_9 = pIcons_LOD->LoadTexturePtr("book", TEXTURE_16BIT_PALETTE);
|
|
62 pTexture_pagemask = pIcons_LOD->LoadTexturePtr("pagemask", TEXTURE_16BIT_PALETTE);
|
|
63 pTexture_506448 = pIcons_LOD->LoadTexturePtr("ib-m5-u", TEXTURE_16BIT_PALETTE);
|
|
64 ptr_506440 = pIcons_LOD->LoadTexturePtr("ib-m5-d", TEXTURE_16BIT_PALETTE);
|
|
65 pTexture_50643C = pIcons_LOD->LoadTexturePtr("ib-m6-u",TEXTURE_16BIT_PALETTE);
|
|
66 //v0 = 1;
|
|
67
|
|
68 static const char *texNames[9] = // 004E24EC
|
|
69 {
|
|
70 "SBFB00", "SBAB00", "SBWB00", "SBEB00",
|
|
71 "SBSB00", "SBMB00", "SBBB00", "SBLB00", "SBDB00"
|
|
72 };
|
|
73
|
|
74 pTexture_506444 = pIcons_LOD->LoadTexturePtr("ib-m6-d",TEXTURE_16BIT_PALETTE);
|
|
75 for (uint i = 0; i < 9; ++i)
|
|
76 {
|
|
77 pSpellBookPagesTextr[i] = pIcons_LOD->LoadTexturePtr(texNames[i], TEXTURE_16BIT_PALETTE);
|
|
78
|
|
79 sprintf(pTmpBuf.data(), "tab%da", i+1);
|
|
80 pTextures_tabs[i][0] = pIcons_LOD->LoadTexturePtr(pTmpBuf.data(), TEXTURE_16BIT_PALETTE);
|
|
81 sprintf(pTmpBuf.data(), "tab%db", i+1);
|
|
82 pTextures_tabs[i][1] = pIcons_LOD->LoadTexturePtr(pTmpBuf.data(), TEXTURE_16BIT_PALETTE);
|
|
83 }
|
|
84 }
|
|
85
|
|
86
|
|
87
|
|
88 //----- (00411AAA) --------------------------------------------------------
|
|
89 void InitializeBookFonts()
|
|
90 {
|
|
91 pAudioPlayer->StopChannels(-1, -1);
|
|
92
|
|
93 ++pIcons_LOD->uTexturePacksCount;
|
|
94 if ( !pIcons_LOD->uNumPrevLoadedFiles )
|
|
95 pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles;
|
|
96
|
|
97 pAudioPlayer->PlaySound(SOUND_OpenBook, 0, 0, -1, 0, 0, 0, 0);
|
|
98 pTexture_mapbordr = pIcons_LOD->LoadTexturePtr("mapbordr", TEXTURE_16BIT_PALETTE);
|
|
99 pBookFont = LoadFont("book.fnt", "FONTPAL", NULL);
|
|
100 pBook2Font = LoadFont("book2.fnt", "FONTPAL", NULL);
|
|
101 pAutonoteFont = LoadFont("autonote.fnt", "FONTPAL", NULL);
|
|
102 pSpellFont = LoadFont("spell.fnt", "FONTPAL", NULL);
|
|
103 }
|
|
104
|
|
105
|
|
106
|
|
107
|
|
108 //----- (0041140B) --------------------------------------------------------
|
|
109 void sub_41140B()
|
|
110 {
|
|
111 signed int v0; // esi@1
|
|
112 GUIButton *v1; // eax@3
|
|
113 GUIButton *v2; // esi@4
|
|
114
|
|
115 v0 = 0;
|
|
116 do
|
|
117 {
|
|
118 dword_5063D8[11+v0]->Release();
|
|
119 dword_506408[11+v0]->Release();
|
|
120 --v0;
|
|
121 }
|
|
122 while ( v0 >= -11 );
|
|
123 pIcons_LOD->SyncLoadedFilesCount();
|
|
124 v1 = pGUIWindow_CurrentMenu->pControlsHead;
|
|
125 if ( v1 )
|
|
126 {
|
|
127 do
|
|
128 {
|
|
129 v2 = v1->pNext;
|
|
130 pAllocator->FreeChunk(v1);
|
|
131 v1 = v2;
|
|
132 }
|
|
133 while ( v2 );
|
|
134 }
|
|
135 pGUIWindow_CurrentMenu->pControlsHead = 0;
|
|
136 pGUIWindow_CurrentMenu->pControlsTail = 0;
|
|
137 pGUIWindow_CurrentMenu->uNumControls = 0;
|
|
138 }
|
|
139
|
|
140 //----- (00411473) --------------------------------------------------------
|
|
141 void sub_411473()
|
|
142 {
|
|
143 pTexture_pagemask->Release();
|
|
144 pTexture_506448->Release();
|
|
145 pTexture_50643C->Release();
|
|
146 for (uint i = 0; i < 9; ++i)
|
|
147 {
|
|
148 pSpellBookPagesTextr[i]->Release();
|
|
149 pTextures_tabs[i][0]->Release();
|
|
150 pTextures_tabs[i][1]->Release();
|
|
151 }
|
|
152 pAudioPlayer->PlaySound(SOUND_CloseBook, 0, 0, -1, 0, 0, 0, 0);
|
|
153 pIcons_LOD->_4114F2();
|
|
154 }
|
|
155
|
|
156
|
|
157
|
|
158
|
|
159
|
|
160
|
|
161
|
|
162
|