Mercurial > mm7
annotate UI/UIBooks.cpp @ 1451:6b1c8c41c83f
m
author | Ritor1 |
---|---|
date | Tue, 06 Aug 2013 09:26:06 +0600 |
parents | c0b273d33338 |
children | bfe342ae0c1f |
rev | line source |
---|---|
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 //----- (0041192C) -------------------------------------------------------- | |
43 void InitializeBookTextures() | |
44 { | |
45 | |
46 pAudioPlayer->StopChannels(-1, -1); | |
47 | |
48 ++pIcons_LOD->uTexturePacksCount; | |
49 if ( !pIcons_LOD->uNumPrevLoadedFiles ) | |
50 pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; | |
51 | |
52 pAudioPlayer->PlaySound(SOUND_OpenBook, 0, 0, -1, 0, 0, 0, 0); | |
53 pSpellBookPagesTextr_9 = pIcons_LOD->LoadTexturePtr("book", TEXTURE_16BIT_PALETTE); | |
54 pTexture_pagemask = pIcons_LOD->LoadTexturePtr("pagemask", TEXTURE_16BIT_PALETTE); | |
1402 | 55 pSpellBookCloseBtnTextr = pIcons_LOD->LoadTexturePtr("ib-m5-u", TEXTURE_16BIT_PALETTE); |
56 pSpellBookClickCloseBtnTextr = pIcons_LOD->LoadTexturePtr("ib-m5-d", TEXTURE_16BIT_PALETTE); | |
57 pSBQuickSpellBtnTextr = pIcons_LOD->LoadTexturePtr("ib-m6-u",TEXTURE_16BIT_PALETTE); | |
1298 | 58 //v0 = 1; |
59 | |
60 static const char *texNames[9] = // 004E24EC | |
61 { | |
62 "SBFB00", "SBAB00", "SBWB00", "SBEB00", | |
63 "SBSB00", "SBMB00", "SBBB00", "SBLB00", "SBDB00" | |
64 }; | |
65 | |
1402 | 66 pSBClickQuickSpellBtnTextr = pIcons_LOD->LoadTexturePtr("ib-m6-d",TEXTURE_16BIT_PALETTE); |
1298 | 67 for (uint i = 0; i < 9; ++i) |
68 { | |
69 pSpellBookPagesTextr[i] = pIcons_LOD->LoadTexturePtr(texNames[i], TEXTURE_16BIT_PALETTE); | |
70 | |
71 sprintf(pTmpBuf.data(), "tab%da", i+1); | |
72 pTextures_tabs[i][0] = pIcons_LOD->LoadTexturePtr(pTmpBuf.data(), TEXTURE_16BIT_PALETTE); | |
73 sprintf(pTmpBuf.data(), "tab%db", i+1); | |
74 pTextures_tabs[i][1] = pIcons_LOD->LoadTexturePtr(pTmpBuf.data(), TEXTURE_16BIT_PALETTE); | |
75 } | |
76 } | |
77 | |
78 //----- (00411AAA) -------------------------------------------------------- | |
79 void InitializeBookFonts() | |
80 { | |
81 pAudioPlayer->StopChannels(-1, -1); | |
82 | |
83 ++pIcons_LOD->uTexturePacksCount; | |
84 if ( !pIcons_LOD->uNumPrevLoadedFiles ) | |
85 pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; | |
86 | |
87 pAudioPlayer->PlaySound(SOUND_OpenBook, 0, 0, -1, 0, 0, 0, 0); | |
88 pTexture_mapbordr = pIcons_LOD->LoadTexturePtr("mapbordr", TEXTURE_16BIT_PALETTE); | |
89 pBookFont = LoadFont("book.fnt", "FONTPAL", NULL); | |
90 pBook2Font = LoadFont("book2.fnt", "FONTPAL", NULL); | |
91 pAutonoteFont = LoadFont("autonote.fnt", "FONTPAL", NULL); | |
92 pSpellFont = LoadFont("spell.fnt", "FONTPAL", NULL); | |
93 } | |
94 | |
95 //----- (0041140B) -------------------------------------------------------- | |
1402 | 96 void OnCloseSpellBookPage() |
1298 | 97 { |
1402 | 98 GUIButton *pNextButton; // esi@4 |
1298 | 99 |
1402 | 100 for ( uint i = 1; i <= 11; i++ ) |
1298 | 101 { |
1402 | 102 SBPageCSpellsTextureList[i]->Release(); |
103 SBPageSSpellsTextureList[i]->Release(); | |
1298 | 104 } |
105 pIcons_LOD->SyncLoadedFilesCount(); | |
1402 | 106 if ( pGUIWindow_CurrentMenu->pControlsHead ) |
1298 | 107 { |
108 do | |
109 { | |
1402 | 110 pNextButton = pGUIWindow_CurrentMenu->pControlsHead->pNext; |
111 pAllocator->FreeChunk(pGUIWindow_CurrentMenu->pControlsHead); | |
112 pGUIWindow_CurrentMenu->pControlsHead = pNextButton; | |
1298 | 113 } |
1402 | 114 while ( pNextButton ); |
1298 | 115 } |
116 pGUIWindow_CurrentMenu->pControlsHead = 0; | |
117 pGUIWindow_CurrentMenu->pControlsTail = 0; | |
118 pGUIWindow_CurrentMenu->uNumControls = 0; | |
119 } | |
120 | |
121 //----- (00411473) -------------------------------------------------------- | |
1402 | 122 void OnCloseSpellBook() |
1298 | 123 { |
124 pTexture_pagemask->Release(); | |
1402 | 125 pSpellBookCloseBtnTextr->Release(); |
126 pSBQuickSpellBtnTextr->Release(); | |
1298 | 127 for (uint i = 0; i < 9; ++i) |
1403 | 128 { |
129 pSpellBookPagesTextr[i]->Release(); | |
130 pTextures_tabs[i][0]->Release(); | |
131 pTextures_tabs[i][1]->Release(); | |
132 } | |
1298 | 133 pAudioPlayer->PlaySound(SOUND_CloseBook, 0, 0, -1, 0, 0, 0, 0); |
1405
c0b273d33338
RemoveTexturesPackFromTextureList and RemoveTexturesFromTextureList
Ritor1
parents:
1404
diff
changeset
|
134 pIcons_LOD->RemoveTexturesPackFromTextureList(); |
1298 | 135 } |