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