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