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