Mercurial > mm7
comparison GUI/UI/Books/UINotesBooks.cpp @ 2501:0ff6a9e9bf7f
GUI folger
author | Ritor1 |
---|---|
date | Fri, 19 Sep 2014 04:21:12 +0600 |
parents | |
children | a77c34acdbc9 |
comparison
equal
deleted
inserted
replaced
2500:952025b157aa | 2501:0ff6a9e9bf7f |
---|---|
1 #define _CRT_SECURE_NO_WARNINGS | |
2 #include "..\..\..\Engine/MM7.h" | |
3 #include "..\..\..\Engine/Graphics/Render.h" | |
4 #include "..\..\..\Mouse.h" | |
5 #include "..\UIBooks.h" | |
6 #include "..\..\..\Engine/MapInfo.h" | |
7 #include "..\..\..\GUIWindow.h" | |
8 #include "..\..\..\GUIFont.h" | |
9 #include "..\..\..\Engine/Party.h" | |
10 #include "..\..\..\AudioPlayer.h" | |
11 #include "..\..\..\Engine/LOD.h" | |
12 #include "..\..\..\Engine/Graphics/Viewport.h" | |
13 #include "..\..\..\Engine/Awards.h" | |
14 #include "..\..\..\Engine/Autonotes.h" | |
15 #include "..\..\..\Engine/Tables/StorylineTextTable.h" | |
16 #include "..\..\..\Engine/texts.h" | |
17 #include "..\..\..\Engine/mm7_data.h" | |
18 | |
19 //----- (00413D3C) -------------------------------------------------------- | |
20 static const char *GetDayPart() | |
21 { | |
22 if ( pParty->uCurrentHour > 5 && pParty->uCurrentHour < 20 ) | |
23 return pGlobalTXT_LocalizationStrings[56]; // "Day" | |
24 else if ( pParty->uCurrentHour == 5 ) | |
25 return pGlobalTXT_LocalizationStrings[55]; // "Dawn" | |
26 else if ( pParty->uCurrentHour == 20 ) | |
27 return pGlobalTXT_LocalizationStrings[566]; // "Dusk" | |
28 else | |
29 return pGlobalTXT_LocalizationStrings[567]; // "Night" | |
30 } | |
31 | |
32 //----- (00413D6F) -------------------------------------------------------- | |
33 void BookUI_Calendar_Draw() | |
34 { | |
35 int am; // ecx@5 | |
36 char *pMapName; // eax@6 | |
37 GUIWindow calendar_window; // [sp+Ch] [bp-60h]@5 | |
38 unsigned int pMapID; // [sp+60h] [bp-Ch]@1 | |
39 unsigned int pHour; | |
40 | |
41 static unsigned int pDayMoonPhase[28] = // 4E1B18 | |
42 { | |
43 0, 0, 0, | |
44 1, 1, 1, 1, | |
45 2, 2, 2, | |
46 3, 3, 3, 3, | |
47 4, 4, 4, | |
48 3, 3, 3, 3, | |
49 2, 2, 2, | |
50 1, 1, 1, 1 | |
51 }; | |
52 | |
53 pRenderer->DrawTextureIndexed(pViewport->uViewportTL_X, pViewport->uViewportTL_Y, pSpellBookPagesTextr_13); | |
54 pHour = pParty->uCurrentHour; | |
55 if ( (signed int)pHour >= 12 ) | |
56 { | |
57 pHour -= 12; | |
58 if ( !pHour ) | |
59 pHour = 12; | |
60 am = 1; | |
61 } | |
62 else | |
63 am = 0; | |
64 | |
65 calendar_window.uFrameX = game_viewport_x; | |
66 calendar_window.uFrameY = game_viewport_y; | |
67 calendar_window.uFrameWidth = game_viewport_width; | |
68 calendar_window.uFrameHeight = game_viewport_height; | |
69 calendar_window.uFrameZ = game_viewport_z; | |
70 calendar_window.uFrameW = game_viewport_w; | |
71 calendar_window.DrawTitleText(pBook2Font, 0, 22, ui_book_calendar_title_color, pGlobalTXT_LocalizationStrings[186], 3); // "Time in Erathia" | |
72 | |
73 sprintf(pTmpBuf.data(), "%s\t100:\t110%d:%02d %s - %s", pGlobalTXT_LocalizationStrings[526], // "Time" | |
74 pHour, pParty->uCurrentMinute, aAMPMNames[am], GetDayPart()); | |
75 calendar_window.DrawText(pBookFont, 70, 55, ui_book_calendar_time_color, pTmpBuf.data(), 0, 0, 0); | |
76 | |
77 sprintf(pTmpBuf.data(), "%s\t100:\t110%d - %s", pGlobalTXT_LocalizationStrings[56], // "Day" | |
78 pParty->uDaysPlayed + 1, aDayNames[pParty->uDaysPlayed % 7]); | |
79 calendar_window.DrawText(pBookFont, 70, 2 * LOBYTE(pBookFont->uFontHeight) + 49, ui_book_calendar_day_color, pTmpBuf.data(), 0, 0, 0); | |
80 | |
81 sprintf(pTmpBuf.data(), "%s\t100:\t110%d - %s", pGlobalTXT_LocalizationStrings[146], // "Month" | |
82 pParty->uCurrentMonth + 1, aMonthNames[pParty->uCurrentMonth]); | |
83 calendar_window.DrawText(pBookFont, 70, 4 * LOBYTE(pBookFont->uFontHeight) + 43, ui_book_calendar_month_color, pTmpBuf.data(), 0, 0, 0); | |
84 | |
85 sprintf(pTmpBuf.data(), "%s\t100:\t110%d", pGlobalTXT_LocalizationStrings[245], pParty->uCurrentYear); // "Year" | |
86 calendar_window.DrawText(pBookFont, 70, 6 * LOBYTE(pBookFont->uFontHeight) + 37, ui_book_calendar_year_color, pTmpBuf.data(), 0, 0, 0); | |
87 | |
88 sprintf(pTmpBuf.data(), "%s\t100:\t110%s", pGlobalTXT_LocalizationStrings[530], aMoonPhaseNames[pDayMoonPhase[pParty->uDaysPlayed]]); // "Moon" | |
89 calendar_window.DrawText(pBookFont, 70, 8 * LOBYTE(pBookFont->uFontHeight) + 31, ui_book_calendar_moon_color, pTmpBuf.data(), 0, 0, 0); | |
90 | |
91 pMapID = pMapStats->GetMapInfo(pCurrentMapName); | |
92 if ( pMapID ) | |
93 pMapName = pMapStats->pInfos[pMapID].pName; | |
94 else | |
95 pMapName = "Unknown"; | |
96 sprintf(pTmpBuf.data(), "%s\t100:\t110%s", pGlobalTXT_LocalizationStrings[531], pMapName); // "Location" | |
97 calendar_window.DrawText(pBookFont, 70, 10 * LOBYTE(pBookFont->uFontHeight) + 25, ui_book_calendar_location_color, pTmpBuf.data(), 0, 0, 0); | |
98 } | |
99 | |
100 //----- (00413126) -------------------------------------------------------- | |
101 void BookUI_Questbook_Draw() | |
102 { | |
103 int pTextHeight; // eax@19 | |
104 GUIWindow questbook_window; // [sp+Ch] [bp-54h]@9 | |
105 | |
106 pRenderer->DrawTextureIndexed(pViewport->uViewportTL_X, pViewport->uViewportTL_Y, pTexture_CurrentBook); | |
107 if ( BtnUp_flag || !books_primary_item_per_page )//Bookmark Up(Закладка вверх) | |
108 pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 407, pViewport->uViewportTL_Y + 2, pTex_book_button1_off); | |
109 else | |
110 pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 1, pTex_book_button1_on); | |
111 | |
112 if ( BtnDown_flag || books_primary_item_per_page + num_achieved_awards >= full_num_items_in_book )//Bookmark Down(Закладка вниз) | |
113 pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 407, pViewport->uViewportTL_Y + 38, pTex_book_button2_off); | |
114 else | |
115 pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 38, pTex_book_button2_on); | |
116 | |
117 //for title | |
118 questbook_window.uFrameWidth = game_viewport_width; | |
119 questbook_window.uFrameHeight = game_viewport_height; | |
120 questbook_window.uFrameX = game_viewport_x; | |
121 questbook_window.uFrameY = game_viewport_y; | |
122 questbook_window.uFrameZ = game_viewport_z; | |
123 questbook_window.uFrameW = game_viewport_w; | |
124 questbook_window.DrawTitleText(pBook2Font, 0, 22, ui_book_quests_title_color, pGlobalTXT_LocalizationStrings[174], 3); //"Current Quests" | |
125 | |
126 //for other text | |
127 questbook_window.uFrameX = 48; | |
128 questbook_window.uFrameY = 70; | |
129 questbook_window.uFrameWidth = 360; | |
130 questbook_window.uFrameHeight = 264; | |
131 questbook_window.uFrameZ = 407; | |
132 questbook_window.uFrameW = 333; | |
133 if ( BtnDown_flag && books_primary_item_per_page + num_achieved_awards < full_num_items_in_book )//Click Bookmark Down(нажатие закладки вниз) | |
134 { | |
135 pAudioPlayer->PlaySound(SOUND_OpenBook, 0, 0, -1, 0, 0, 0, 0); | |
136 books_primary_item_per_page += num_achieved_awards; | |
137 books_num_items_per_page[books_page_number++] = num_achieved_awards; | |
138 } | |
139 if ( BtnUp_flag && books_page_number )//Click Bookmark Up(Нажатие закладки вверх) | |
140 { | |
141 pAudioPlayer->PlaySound(SOUND_OpenBook, 0, 0, -1, 0, 0, 0, 0); | |
142 --books_page_number; | |
143 books_primary_item_per_page -= (unsigned __int8)books_num_items_per_page[books_page_number]; | |
144 } | |
145 if ( !num_achieved_awards || !books_primary_item_per_page ) | |
146 { | |
147 books_page_number = 0; | |
148 books_primary_item_per_page = 0; | |
149 } | |
150 BtnDown_flag = 0; | |
151 BtnUp_flag = 0; | |
152 num_achieved_awards = 0; | |
153 for ( uint i = books_primary_item_per_page; i < full_num_items_in_book; ++i ) | |
154 { | |
155 ++num_achieved_awards; | |
156 questbook_window.DrawText(pAutonoteFont, 1, 0, ui_book_quests_text_color, pQuestTable[achieved_awards[i]], 0, 0, 0); | |
157 pTextHeight = pAutonoteFont->CalcTextHeight(pQuestTable[achieved_awards[i]], &questbook_window, 1, 0); | |
158 if ( (signed int)(questbook_window.uFrameY + pTextHeight) > (signed int)questbook_window.uFrameHeight ) | |
159 break; | |
160 pRenderer->DrawTextureTransparent(100, (questbook_window.uFrameY + pTextHeight) + 12, pSpellBookPagesTextr_10); | |
161 questbook_window.uFrameY = (questbook_window.uFrameY + pTextHeight) + 24; | |
162 } | |
163 } | |
164 | |
165 //----- (0041338E) -------------------------------------------------------- | |
166 void BookUI_Autonotes_Draw() | |
167 { | |
168 int pTextHeight; // eax@65 | |
169 bool change_flag; // [sp+10h] [bp-58h]@1 | |
170 GUIWindow autonotes_window; // [sp+14h] [bp-54h]@46 | |
171 | |
172 change_flag = false; | |
173 pRenderer->DrawTextureIndexed(pViewport->uViewportTL_X, pViewport->uViewportTL_Y, pTexture_AutonotesBook); | |
174 if ( BtnUp_flag || !books_primary_item_per_page ) | |
175 pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 407, pViewport->uViewportTL_Y + 2, pTex_book_button1_off); | |
176 else | |
177 pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 1, pTex_book_button1_on); | |
178 | |
179 if ( BtnDown_flag || books_primary_item_per_page + num_achieved_awards >= full_num_items_in_book ) | |
180 pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 407, pViewport->uViewportTL_Y + 38, pTex_book_button2_off); | |
181 else | |
182 pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 38, pTex_book_button2_on); | |
183 | |
184 if ( Book_PageBtn3_flag )//Potions_page_flag | |
185 { | |
186 if (_506568_autonote_type == AUTONOTE_POTION_RECEPIE)//press again(повторное нажатие) | |
187 pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 113, pTex_book_button3_on); | |
188 else//press(нажатие) | |
189 { | |
190 change_flag = true; | |
191 pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0); | |
192 _506568_autonote_type = AUTONOTE_POTION_RECEPIE; | |
193 pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 113, pTex_book_button3_on); | |
194 } | |
195 } | |
196 else | |
197 { | |
198 if (_506568_autonote_type == AUTONOTE_POTION_RECEPIE)// default(по умолчанию при запуске окна) | |
199 pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 113, pTex_book_button3_on); | |
200 else//Potions_page not active(вкладка снадобья не активна) | |
201 pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 113, pTex_book_button3_off); | |
202 } | |
203 | |
204 if ( Book_PageBtn4_flag )//Fontains_page_flag | |
205 { | |
206 if ( _506568_autonote_type == AUTONOTE_STAT_HINT ) | |
207 pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 399, pViewport->uViewportTL_Y + 150, pTex_book_button4_on); | |
208 else | |
209 { | |
210 change_flag = true; | |
211 pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0); | |
212 _506568_autonote_type = AUTONOTE_STAT_HINT; | |
213 pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 399, pViewport->uViewportTL_Y + 150, pTex_book_button4_on); | |
214 } | |
215 } | |
216 else | |
217 { | |
218 if ( _506568_autonote_type == AUTONOTE_STAT_HINT ) | |
219 pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 399, pViewport->uViewportTL_Y + 150, pTex_book_button4_on); | |
220 else | |
221 pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 150, pTex_book_button4_off); | |
222 } | |
223 | |
224 if ( Book_PageBtn5_flag )//Autonotes_Obelisks_page_flag | |
225 { | |
226 if ( _506568_autonote_type == AUTONOTE_OBELISK) | |
227 pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 188, pTex_book_button5_on); | |
228 else | |
229 { | |
230 change_flag = true; | |
231 pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0); | |
232 _506568_autonote_type = AUTONOTE_OBELISK; | |
233 pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 188, pTex_book_button5_on); | |
234 } | |
235 } | |
236 else | |
237 { | |
238 if ( _506568_autonote_type == AUTONOTE_OBELISK) | |
239 pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 188, pTex_book_button5_on); | |
240 else | |
241 pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 188, pTex_book_button5_off); | |
242 } | |
243 | |
244 if ( Book_PageBtn6_flag )//Autonotes_Seer_page_flag | |
245 { | |
246 if ( _506568_autonote_type == AUTONOTE_SEER) | |
247 pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 226, pTex_book_button6_on); | |
248 else | |
249 { | |
250 change_flag = true; | |
251 pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0); | |
252 _506568_autonote_type = AUTONOTE_SEER; | |
253 pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 226, pTex_book_button6_on); | |
254 } | |
255 } | |
256 else | |
257 { | |
258 if ( _506568_autonote_type == AUTONOTE_SEER) | |
259 pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 226, pTex_book_button6_on); | |
260 else | |
261 pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 226, pTex_book_button6_off); | |
262 } | |
263 | |
264 if ( Autonotes_Misc_page_flag ) | |
265 { | |
266 if ( _506568_autonote_type == AUTONOTE_MISC) | |
267 pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 264, pTex_book_button7_on); | |
268 else | |
269 { | |
270 change_flag = true; | |
271 pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0); | |
272 _506568_autonote_type = AUTONOTE_MISC; | |
273 pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 264, pTex_book_button7_on); | |
274 } | |
275 } | |
276 else | |
277 { | |
278 if ( _506568_autonote_type == AUTONOTE_MISC) | |
279 pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 264, pTex_book_button7_on); | |
280 else | |
281 pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 263, pTex_book_button7_off); | |
282 } | |
283 | |
284 if ( Autonotes_Instructors_page_flag ) | |
285 { | |
286 if ( _506568_autonote_type == AUTONOTE_TEACHER) | |
287 pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 302, pTex_book_button8_on); | |
288 else | |
289 { | |
290 change_flag = true; | |
291 pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0); | |
292 _506568_autonote_type = AUTONOTE_TEACHER; | |
293 pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 302, pTex_book_button8_on); | |
294 } | |
295 } | |
296 else | |
297 { | |
298 if ( _506568_autonote_type == AUTONOTE_TEACHER) | |
299 pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 302, pTex_book_button8_on); | |
300 else | |
301 pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 302, pTex_book_button8_off); | |
302 } | |
303 | |
304 //for title | |
305 autonotes_window.uFrameWidth = game_viewport_width; | |
306 autonotes_window.uFrameHeight = game_viewport_height; | |
307 autonotes_window.uFrameX = game_viewport_x; | |
308 autonotes_window.uFrameY = game_viewport_y; | |
309 autonotes_window.uFrameZ = game_viewport_z; | |
310 autonotes_window.uFrameW = game_viewport_w; | |
311 autonotes_window.DrawTitleText(pBook2Font, 0, 22, ui_book_autonotes_title_color, pGlobalTXT_LocalizationStrings[154], 3); // "Auto notes" | |
312 | |
313 //for other text | |
314 autonotes_window.uFrameX = 48; | |
315 autonotes_window.uFrameY = 70; | |
316 autonotes_window.uFrameWidth = 360; | |
317 autonotes_window.uFrameHeight = 264; | |
318 autonotes_window.uFrameZ = 407; | |
319 autonotes_window.uFrameW = 333; | |
320 if ( change_flag )//change bookmark(смена закладки) | |
321 { | |
322 full_num_items_in_book = 0; | |
323 books_primary_item_per_page = 0; | |
324 books_page_number = 0; | |
325 num_achieved_awards = 0; | |
326 for ( uint i = 1; i <= 195; ++i ) | |
327 { | |
328 if ( pAutonoteTxt[i].eType == _506568_autonote_type ) | |
329 { | |
330 if ( (unsigned __int16)_449B57_test_bit(pParty->_autonote_bits, i) && (char *)pAutonoteTxt[i].pText ) | |
331 achieved_awards[num_achieved_awards++] = (AwardType)i; | |
332 } | |
333 } | |
334 full_num_items_in_book = num_achieved_awards; | |
335 } | |
336 else//not change bookmark(не меняется закладка) | |
337 { | |
338 if ( BtnDown_flag )// press Down bookmark(нажатие закладки пролистать дальше) | |
339 { | |
340 if ( num_achieved_awards + books_primary_item_per_page < full_num_items_in_book ) | |
341 { | |
342 books_num_items_per_page[books_page_number++] = num_achieved_awards; | |
343 books_primary_item_per_page = num_achieved_awards + books_primary_item_per_page; | |
344 pAudioPlayer->PlaySound(SOUND_OpenBook, 0, 0, -1, 0, 0, 0, 0); | |
345 } | |
346 } | |
347 if ( BtnUp_flag && books_page_number )// press Up bookmark(нажатие закладки пролистать назад) | |
348 { | |
349 --books_page_number; | |
350 books_primary_item_per_page -= (unsigned __int8)books_num_items_per_page[books_page_number]; | |
351 pAudioPlayer->PlaySound(SOUND_OpenBook, 0, 0, -1, 0, 0, 0, 0); | |
352 } | |
353 if ( !num_achieved_awards || !books_primary_item_per_page )//количество записей 0 или номер первой страницы 0 | |
354 { | |
355 books_primary_item_per_page = 0; | |
356 books_page_number = 0; | |
357 } | |
358 } | |
359 BtnUp_flag = 0; | |
360 BtnDown_flag = 0; | |
361 Book_PageBtn3_flag = 0;//Potions_page_flag | |
362 Book_PageBtn4_flag = 0;//Fontains_page_flag | |
363 Book_PageBtn5_flag = 0;//Autonotes_Obelisks_page_flag | |
364 Book_PageBtn6_flag = 0;//Autonotes_Seer_page_flag | |
365 Autonotes_Misc_page_flag = 0; | |
366 Autonotes_Instructors_page_flag = 0; | |
367 num_achieved_awards = 0; | |
368 for ( uint i = books_primary_item_per_page; i < full_num_items_in_book; ++i ) | |
369 { | |
370 ++num_achieved_awards; | |
371 autonotes_window.DrawText(pAutonoteFont, 1, 0, ui_book_autonotes_text_color, pAutonoteTxt[achieved_awards[i]].pText, 0, 0, 0); | |
372 pTextHeight = pAutonoteFont->CalcTextHeight(pAutonoteTxt[achieved_awards[i]].pText, &autonotes_window, 1, 0); | |
373 if ( (signed int)(autonotes_window.uFrameY + pTextHeight) > (signed int)autonotes_window.uFrameHeight ) | |
374 break; | |
375 pRenderer->DrawTextureTransparent(100, (autonotes_window.uFrameY + pTextHeight) + 12, pSpellBookPagesTextr_10); | |
376 autonotes_window.uFrameY = (autonotes_window.uFrameY + pTextHeight) + 24; | |
377 } | |
378 } | |
379 | |
380 //----- (00412E85) -------------------------------------------------------- | |
381 void BookUI_Journal_Draw() | |
382 { | |
383 char *pDialogueString; // eax@21 | |
384 char* pStringOnPage; // eax@22 | |
385 GUIWindow journal_window; // [sp+8h] [bp-54h]@10 | |
386 | |
387 pRenderer->DrawTextureIndexed(pViewport->uViewportTL_X, pViewport->uViewportTL_Y, pSpellBookPagesTextr_11); | |
388 if ( BtnUp_flag || !books_primary_item_per_page ) | |
389 pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 407, pViewport->uViewportTL_Y + 2, pTex_book_button1_off); | |
390 else | |
391 pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 1, pTex_book_button1_on); | |
392 | |
393 if ( BtnDown_flag || books_primary_item_per_page + num_achieved_awards >= full_num_items_in_book ) | |
394 pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 407, pViewport->uViewportTL_Y + 38, pTex_book_button2_off); | |
395 else | |
396 pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 38, pTex_book_button2_on); | |
397 | |
398 if ( !Journal_limitation_factor[books_primary_item_per_page] )//for title | |
399 { | |
400 journal_window.uFrameWidth = game_viewport_width; | |
401 journal_window.uFrameX = game_viewport_x; | |
402 journal_window.uFrameY = game_viewport_y; | |
403 journal_window.uFrameHeight = game_viewport_height; | |
404 journal_window.uFrameZ = game_viewport_z; | |
405 journal_window.uFrameW = game_viewport_w; | |
406 if ( pStorylineText->StoreLine[achieved_awards[books_primary_item_per_page]].pPageTitle ) | |
407 journal_window.DrawTitleText(pBook2Font, 0, 22, ui_book_journal_title_color, pStorylineText->StoreLine[achieved_awards[books_primary_item_per_page]].pPageTitle, 3); | |
408 } | |
409 | |
410 //for other text | |
411 journal_window.uFrameX = 48; | |
412 journal_window.uFrameY = 70; | |
413 journal_window.uFrameWidth = 360; | |
414 journal_window.uFrameHeight = 264; | |
415 journal_window.uFrameZ = 407; | |
416 journal_window.uFrameW = journal_window.uFrameHeight + 69; | |
417 if ( BtnDown_flag && books_primary_item_per_page + num_achieved_awards < full_num_items_in_book )//Press bookmark next page | |
418 { | |
419 pAudioPlayer->PlaySound(SOUND_OpenBook, 0, 0, -1, 0, 0, 0, 0); | |
420 books_primary_item_per_page += num_achieved_awards; | |
421 books_num_items_per_page[books_page_number++] = num_achieved_awards; | |
422 } | |
423 if ( BtnUp_flag && books_page_number )//Press bookmark previous page | |
424 { | |
425 pAudioPlayer->PlaySound(SOUND_OpenBook, 0, 0, -1, 0, 0, 0, 0); | |
426 --books_page_number; | |
427 books_primary_item_per_page -= (unsigned __int8)books_num_items_per_page[books_page_number]; | |
428 } | |
429 if ( !num_achieved_awards || books_primary_item_per_page < 1 ) | |
430 { | |
431 books_primary_item_per_page = 0; | |
432 books_page_number = 0; | |
433 } | |
434 BtnDown_flag = 0; | |
435 BtnUp_flag = 0; | |
436 num_achieved_awards = 0; | |
437 if ( achieved_awards[books_primary_item_per_page] ) | |
438 { | |
439 int index = ((int)achieved_awards[books_primary_item_per_page] - 1); | |
440 pDialogueString = BuildDialogueString(pStorylineText->StoreLine[ achieved_awards[books_primary_item_per_page]].pText, uActiveCharacter - 1, | |
441 0, 0, 0, &pParty->PartyTimes.HistoryEventTimes[index]); | |
442 pStringOnPage = pAutonoteFont->GetPageTop(pDialogueString, &journal_window, 1, (unsigned __int8)Journal_limitation_factor[books_primary_item_per_page]); | |
443 journal_window.DrawText(pAutonoteFont, 1, 0, ui_book_journal_text_color, pStringOnPage, 0, | |
444 journal_window.uFrameY + journal_window.uFrameHeight, ui_book_journal_text_shadow); | |
445 ++num_achieved_awards; | |
446 } | |
447 } |