Mercurial > mm7
annotate UI/UIBooks.cpp @ 1583:75fafd8ced59
Allocator (CMemory) bye-bye
author | Nomad |
---|---|
date | Tue, 10 Sep 2013 21:07:07 +0200 |
parents | c4ab816fcc5e |
children | d28d3c006077 |
rev | line source |
---|---|
1298 | 1 #ifdef _MSC_VER |
2 #define _CRT_SECURE_NO_WARNINGS | |
3 #endif | |
4 | |
1299 | 5 #include "..\MM7.h" |
1310 | 6 #include "UIBooks.h" |
1312 | 7 #include "..\Render.h" |
1299 | 8 #include "..\GUIWindow.h" |
9 #include "..\GUIFont.h" | |
10 #include "..\AudioPlayer.h" | |
11 #include "..\LOD.h" | |
1583 | 12 |
1299 | 13 #include "..\mm7_data.h" |
1298 | 14 |
15 //----- (00413CC6) -------------------------------------------------------- | |
16 void BookUI_Draw(WindowType book) | |
17 { | |
18 pRenderer->DrawTextureIndexed(471, 445, pIcons_LOD->GetTexture(uExitCancelTextureId)); | |
19 switch (book) | |
20 { | |
21 case WINDOW_QuestBook: BookUI_Questbook_Draw(); break; | |
22 case WINDOW_AutonotesBook: BookUI_Autonotes_Draw(); break; | |
23 case WINDOW_MapsBook: BookUI_Map_Draw(); break; | |
24 case WINDOW_CalendarBook: BookUI_Calendar_Draw(); break; | |
25 case WINDOW_JournalBook: BookUI_Journal_Draw(); break; | |
26 | |
27 case WINDOW_LloydsBeacon: DrawLloydBeaconsScreen(); break; | |
28 case WINDOW_TownPortal: BookUI_DrawTownPortalMap(); break; | |
29 } | |
30 } | |
31 | |
32 //----- (0041192C) -------------------------------------------------------- | |
33 void InitializeBookTextures() | |
34 { | |
35 pAudioPlayer->StopChannels(-1, -1); | |
36 ++pIcons_LOD->uTexturePacksCount; | |
37 if ( !pIcons_LOD->uNumPrevLoadedFiles ) | |
38 pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; | |
39 pAudioPlayer->PlaySound(SOUND_OpenBook, 0, 0, -1, 0, 0, 0, 0); | |
40 pSpellBookPagesTextr_9 = pIcons_LOD->LoadTexturePtr("book", TEXTURE_16BIT_PALETTE); | |
41 pTexture_pagemask = pIcons_LOD->LoadTexturePtr("pagemask", TEXTURE_16BIT_PALETTE); | |
1402 | 42 pSpellBookCloseBtnTextr = pIcons_LOD->LoadTexturePtr("ib-m5-u", TEXTURE_16BIT_PALETTE); |
43 pSpellBookClickCloseBtnTextr = pIcons_LOD->LoadTexturePtr("ib-m5-d", TEXTURE_16BIT_PALETTE); | |
44 pSBQuickSpellBtnTextr = pIcons_LOD->LoadTexturePtr("ib-m6-u",TEXTURE_16BIT_PALETTE); | |
1298 | 45 |
46 static const char *texNames[9] = // 004E24EC | |
47 { | |
48 "SBFB00", "SBAB00", "SBWB00", "SBEB00", | |
49 "SBSB00", "SBMB00", "SBBB00", "SBLB00", "SBDB00" | |
50 }; | |
51 | |
1402 | 52 pSBClickQuickSpellBtnTextr = pIcons_LOD->LoadTexturePtr("ib-m6-d",TEXTURE_16BIT_PALETTE); |
1455 | 53 for ( uint i = 0; i < 9; ++i ) |
1298 | 54 { |
55 pSpellBookPagesTextr[i] = pIcons_LOD->LoadTexturePtr(texNames[i], TEXTURE_16BIT_PALETTE); | |
1455 | 56 sprintf(pTmpBuf.data(), "tab%da", i + 1); |
1298 | 57 pTextures_tabs[i][0] = pIcons_LOD->LoadTexturePtr(pTmpBuf.data(), TEXTURE_16BIT_PALETTE); |
1455 | 58 sprintf(pTmpBuf.data(), "tab%db", i + 1); |
1298 | 59 pTextures_tabs[i][1] = pIcons_LOD->LoadTexturePtr(pTmpBuf.data(), TEXTURE_16BIT_PALETTE); |
60 } | |
61 } | |
62 | |
63 //----- (00411AAA) -------------------------------------------------------- | |
64 void InitializeBookFonts() | |
65 { | |
66 pAudioPlayer->StopChannels(-1, -1); | |
67 ++pIcons_LOD->uTexturePacksCount; | |
68 if ( !pIcons_LOD->uNumPrevLoadedFiles ) | |
69 pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; | |
70 pAudioPlayer->PlaySound(SOUND_OpenBook, 0, 0, -1, 0, 0, 0, 0); | |
71 pTexture_mapbordr = pIcons_LOD->LoadTexturePtr("mapbordr", TEXTURE_16BIT_PALETTE); | |
72 pBookFont = LoadFont("book.fnt", "FONTPAL", NULL); | |
73 pBook2Font = LoadFont("book2.fnt", "FONTPAL", NULL); | |
74 pAutonoteFont = LoadFont("autonote.fnt", "FONTPAL", NULL); | |
75 pSpellFont = LoadFont("spell.fnt", "FONTPAL", NULL); | |
76 } | |
77 | |
78 //----- (0041140B) -------------------------------------------------------- | |
1402 | 79 void OnCloseSpellBookPage() |
1298 | 80 { |
1402 | 81 GUIButton *pNextButton; // esi@4 |
82 for ( uint i = 1; i <= 11; i++ ) | |
1298 | 83 { |
1402 | 84 SBPageCSpellsTextureList[i]->Release(); |
85 SBPageSSpellsTextureList[i]->Release(); | |
1298 | 86 } |
87 pIcons_LOD->SyncLoadedFilesCount(); | |
1402 | 88 if ( pGUIWindow_CurrentMenu->pControlsHead ) |
1298 | 89 { |
90 do | |
91 { | |
1402 | 92 pNextButton = pGUIWindow_CurrentMenu->pControlsHead->pNext; |
1583 | 93 free(pGUIWindow_CurrentMenu->pControlsHead); |
1402 | 94 pGUIWindow_CurrentMenu->pControlsHead = pNextButton; |
1298 | 95 } |
1402 | 96 while ( pNextButton ); |
1298 | 97 } |
98 pGUIWindow_CurrentMenu->pControlsHead = 0; | |
99 pGUIWindow_CurrentMenu->pControlsTail = 0; | |
100 pGUIWindow_CurrentMenu->uNumControls = 0; | |
101 } | |
102 | |
103 //----- (00411473) -------------------------------------------------------- | |
1402 | 104 void OnCloseSpellBook() |
1298 | 105 { |
106 pTexture_pagemask->Release(); | |
1402 | 107 pSpellBookCloseBtnTextr->Release(); |
108 pSBQuickSpellBtnTextr->Release(); | |
1455 | 109 for ( uint i = 0; i < 9; ++i ) |
1403 | 110 { |
111 pSpellBookPagesTextr[i]->Release(); | |
112 pTextures_tabs[i][0]->Release(); | |
113 pTextures_tabs[i][1]->Release(); | |
114 } | |
1298 | 115 pAudioPlayer->PlaySound(SOUND_CloseBook, 0, 0, -1, 0, 0, 0, 0); |
1405
c0b273d33338
RemoveTexturesPackFromTextureList and RemoveTexturesFromTextureList
Ritor1
parents:
1404
diff
changeset
|
116 pIcons_LOD->RemoveTexturesPackFromTextureList(); |
1298 | 117 } |