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