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