annotate UI/UIBooks.cpp @ 1323:bfde0563ecdc

removed weather.h from indoor.h
author Grumpy7
date Mon, 01 Jul 2013 22:42:09 +0200
parents ae435824ac4d
children a519a6a412d0
rev   line source
1298
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
1 #ifdef _MSC_VER
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
2 #define _CRT_SECURE_NO_WARNINGS
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
3 #endif
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
4
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
5 #include <assert.h>
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
6
1299
8c2f689b5f0b folder UI
Ritor1
parents: 1298
diff changeset
7 #include "..\MM7.h"
1298
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
8
1310
0665a061132b autonotes and quest tables overflow fixed
Gloval
parents: 1299
diff changeset
9 #include "UIBooks.h"
1312
ae435824ac4d books code splitted to separate files
Gloval
parents: 1310
diff changeset
10 #include "..\Render.h"
1299
8c2f689b5f0b folder UI
Ritor1
parents: 1298
diff changeset
11 #include "..\GUIWindow.h"
8c2f689b5f0b folder UI
Ritor1
parents: 1298
diff changeset
12 #include "..\GUIFont.h"
8c2f689b5f0b folder UI
Ritor1
parents: 1298
diff changeset
13 #include "..\AudioPlayer.h"
8c2f689b5f0b folder UI
Ritor1
parents: 1298
diff changeset
14 #include "..\LOD.h"
8c2f689b5f0b folder UI
Ritor1
parents: 1298
diff changeset
15 #include "..\Allocator.h"
1312
ae435824ac4d books code splitted to separate files
Gloval
parents: 1310
diff changeset
16
1298
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
17
1299
8c2f689b5f0b folder UI
Ritor1
parents: 1298
diff changeset
18 #include "..\mm7_data.h"
1298
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
19
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
20
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
21
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
22
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
23
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
24
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
25 //----- (00413CC6) --------------------------------------------------------
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
26 void BookUI_Draw(WindowType book)
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
27 {
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
28 pRenderer->DrawTextureIndexed(471, 445, pIcons_LOD->GetTexture(uExitCancelTextureId));
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
29 switch (book)
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
30 {
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
31 case WINDOW_QuestBook: BookUI_Questbook_Draw(); break;
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
32 case WINDOW_AutonotesBook: BookUI_Autonotes_Draw(); break;
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
33 case WINDOW_MapsBook: BookUI_Map_Draw(); break;
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
34 case WINDOW_CalendarBook: BookUI_Calendar_Draw(); break;
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
35 case WINDOW_JournalBook: BookUI_Journal_Draw(); break;
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
36
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
37 case WINDOW_LloydsBeacon: DrawLloydBeaconsScreen(); break;
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
38 case WINDOW_TownPortal: BookUI_DrawTownPortalMap(); break;
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
39 }
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
40 }
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
41
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
42
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
43
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
44
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
45
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
46
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
47
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
48 //----- (0041192C) --------------------------------------------------------
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
49 void InitializeBookTextures()
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
50 {
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
51 //signed int v0; // ebp@3
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
52 //Texture **v1; // ebx@3
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
53
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
54 pAudioPlayer->StopChannels(-1, -1);
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
55
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
56 ++pIcons_LOD->uTexturePacksCount;
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
57 if ( !pIcons_LOD->uNumPrevLoadedFiles )
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
58 pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles;
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
59
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
60 pAudioPlayer->PlaySound(SOUND_OpenBook, 0, 0, -1, 0, 0, 0, 0);
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
61 pSpellBookPagesTextr_9 = pIcons_LOD->LoadTexturePtr("book", TEXTURE_16BIT_PALETTE);
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
62 pTexture_pagemask = pIcons_LOD->LoadTexturePtr("pagemask", TEXTURE_16BIT_PALETTE);
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
63 pTexture_506448 = pIcons_LOD->LoadTexturePtr("ib-m5-u", TEXTURE_16BIT_PALETTE);
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
64 ptr_506440 = pIcons_LOD->LoadTexturePtr("ib-m5-d", TEXTURE_16BIT_PALETTE);
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
65 pTexture_50643C = pIcons_LOD->LoadTexturePtr("ib-m6-u",TEXTURE_16BIT_PALETTE);
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
66 //v0 = 1;
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
67
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
68 static const char *texNames[9] = // 004E24EC
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
69 {
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
70 "SBFB00", "SBAB00", "SBWB00", "SBEB00",
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
71 "SBSB00", "SBMB00", "SBBB00", "SBLB00", "SBDB00"
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
72 };
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
73
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
74 pTexture_506444 = pIcons_LOD->LoadTexturePtr("ib-m6-d",TEXTURE_16BIT_PALETTE);
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
75 for (uint i = 0; i < 9; ++i)
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
76 {
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
77 pSpellBookPagesTextr[i] = pIcons_LOD->LoadTexturePtr(texNames[i], TEXTURE_16BIT_PALETTE);
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
78
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
79 sprintf(pTmpBuf.data(), "tab%da", i+1);
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
80 pTextures_tabs[i][0] = pIcons_LOD->LoadTexturePtr(pTmpBuf.data(), TEXTURE_16BIT_PALETTE);
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
81 sprintf(pTmpBuf.data(), "tab%db", i+1);
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
82 pTextures_tabs[i][1] = pIcons_LOD->LoadTexturePtr(pTmpBuf.data(), TEXTURE_16BIT_PALETTE);
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
83 }
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
84 }
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
85
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
86
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
87
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
88 //----- (00411AAA) --------------------------------------------------------
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
89 void InitializeBookFonts()
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
90 {
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
91 pAudioPlayer->StopChannels(-1, -1);
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
92
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
93 ++pIcons_LOD->uTexturePacksCount;
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
94 if ( !pIcons_LOD->uNumPrevLoadedFiles )
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
95 pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles;
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
96
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
97 pAudioPlayer->PlaySound(SOUND_OpenBook, 0, 0, -1, 0, 0, 0, 0);
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
98 pTexture_mapbordr = pIcons_LOD->LoadTexturePtr("mapbordr", TEXTURE_16BIT_PALETTE);
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
99 pBookFont = LoadFont("book.fnt", "FONTPAL", NULL);
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
100 pBook2Font = LoadFont("book2.fnt", "FONTPAL", NULL);
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
101 pAutonoteFont = LoadFont("autonote.fnt", "FONTPAL", NULL);
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
102 pSpellFont = LoadFont("spell.fnt", "FONTPAL", NULL);
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
103 }
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
104
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
105
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
106
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
107
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
108 //----- (0041140B) --------------------------------------------------------
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
109 void sub_41140B()
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
110 {
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
111 signed int v0; // esi@1
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
112 GUIButton *v1; // eax@3
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
113 GUIButton *v2; // esi@4
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
114
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
115 v0 = 0;
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
116 do
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
117 {
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
118 dword_5063D8[11+v0]->Release();
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
119 dword_506408[11+v0]->Release();
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
120 --v0;
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
121 }
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
122 while ( v0 >= -11 );
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
123 pIcons_LOD->SyncLoadedFilesCount();
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
124 v1 = pGUIWindow_CurrentMenu->pControlsHead;
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
125 if ( v1 )
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
126 {
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
127 do
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
128 {
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
129 v2 = v1->pNext;
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
130 pAllocator->FreeChunk(v1);
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
131 v1 = v2;
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
132 }
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
133 while ( v2 );
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
134 }
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
135 pGUIWindow_CurrentMenu->pControlsHead = 0;
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
136 pGUIWindow_CurrentMenu->pControlsTail = 0;
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
137 pGUIWindow_CurrentMenu->uNumControls = 0;
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
138 }
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
139
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
140 //----- (00411473) --------------------------------------------------------
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
141 void sub_411473()
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
142 {
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
143 pTexture_pagemask->Release();
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
144 pTexture_506448->Release();
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
145 pTexture_50643C->Release();
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
146 for (uint i = 0; i < 9; ++i)
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
147 {
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
148 pSpellBookPagesTextr[i]->Release();
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
149 pTextures_tabs[i][0]->Release();
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
150 pTextures_tabs[i][1]->Release();
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
151 }
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
152 pAudioPlayer->PlaySound(SOUND_CloseBook, 0, 0, -1, 0, 0, 0, 0);
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
153 pIcons_LOD->_4114F2();
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
154 }
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
155
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
156
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
157
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
158
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
159
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
160
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
161
b97d0cdd6c79 new folder UI
Ritor1
parents:
diff changeset
162