Mercurial > mm7
annotate UI/Books/UINotesBooks.cpp @ 2287:4e3236a4ea63
GenerateItemsInChest cleaned up a bit, unified the two switches
author | Grumpy7 |
---|---|
date | Sat, 15 Mar 2014 23:42:51 +0100 |
parents | aff7a7b072b7 |
children | d6887ee81068 |
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 |
1312 | 2 #include "..\..\MM7.h" |
3 #include "..\..\Render.h" | |
4 #include "..\..\Mouse.h" | |
5 #include "..\UIBooks.h" | |
6 #include "..\..\MapInfo.h" | |
7 #include "..\..\GUIWindow.h" | |
8 #include "..\..\GUIFont.h" | |
9 #include "..\..\Party.h" | |
10 #include "..\..\AudioPlayer.h" | |
11 #include "..\..\LOD.h" | |
12 #include "..\..\Viewport.h" | |
13 #include "..\..\Awards.h" | |
14 #include "..\..\Autonotes.h" | |
15 #include "..\..\StorylineTextTable.h" | |
16 #include "..\..\texts.h" | |
17 #include "..\..\mm7_data.h" | |
18 | |
19 //----- (00413D3C) -------------------------------------------------------- | |
20 static const char *GetDayPart() | |
1453 | 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 } | |
1312 | 31 |
32 //----- (00413D6F) -------------------------------------------------------- | |
33 void BookUI_Calendar_Draw() | |
1446 | 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; | |
1312 | 40 |
1446 | 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 }; | |
1312 | 52 |
1446 | 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; | |
1312 | 64 |
1446 | 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" | |
1312 | 72 |
1446 | 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); | |
1312 | 76 |
1446 | 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); | |
1312 | 80 |
1446 | 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); | |
1312 | 84 |
1446 | 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); | |
1312 | 87 |
1446 | 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); | |
1312 | 90 |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1453
diff
changeset
|
91 pMapID = pMapStats->GetMapInfo(pCurrentMapName); |
1446 | 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 } | |
1312 | 99 |
100 //----- (00413126) -------------------------------------------------------- | |
101 void BookUI_Questbook_Draw() | |
1446 | 102 { |
103 int pTextHeight; // eax@19 | |
104 GUIWindow questbook_window; // [sp+Ch] [bp-54h]@9 | |
1312 | 105 |
1446 | 106 pRenderer->DrawTextureIndexed(pViewport->uViewportTL_X, pViewport->uViewportTL_Y, pTexture_CurrentBook); |
1447 | 107 if ( BtnUp_flag || !books_primary_item_per_page )//Bookmark Up(Закладка вверх) |
1453 | 108 pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 407, pViewport->uViewportTL_Y + 2, pTex_book_button1_off); |
1446 | 109 else |
1453 | 110 pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 1, pTex_book_button1_on); |
1447 | 111 |
112 if ( BtnDown_flag || books_primary_item_per_page + num_achieved_awards >= full_num_items_in_book )//Bookmark Down(Закладка вниз) | |
1453 | 113 pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 407, pViewport->uViewportTL_Y + 38, pTex_book_button2_off); |
1446 | 114 else |
1453 | 115 pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 38, pTex_book_button2_on); |
1447 | 116 |
1453 | 117 //for title |
1446 | 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" | |
1312 | 125 |
1453 | 126 //for other text |
1446 | 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; | |
1453 | 133 if ( BtnDown_flag && books_primary_item_per_page + num_achieved_awards < full_num_items_in_book )//Click Bookmark Down(нажатие закладки вниз) |
1446 | 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 } | |
1453 | 139 if ( BtnUp_flag && books_page_number )//Click Bookmark Up(Нажатие закладки вверх) |
1446 | 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; | |
1453 | 156 questbook_window.DrawText(pAutonoteFont, 1, 0, ui_book_quests_text_color, pQuestTable[achieved_awards[i]], 0, 0, 0); |
1446 | 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 } | |
1312 | 164 |
165 //----- (0041338E) -------------------------------------------------------- | |
166 void BookUI_Autonotes_Draw() | |
1446 | 167 { |
1453 | 168 int pTextHeight; // eax@65 |
169 bool change_flag; // [sp+10h] [bp-58h]@1 | |
1447 | 170 GUIWindow autonotes_window; // [sp+14h] [bp-54h]@46 |
1446 | 171 |
1453 | 172 change_flag = false; |
1446 | 173 pRenderer->DrawTextureIndexed(pViewport->uViewportTL_X, pViewport->uViewportTL_Y, pTexture_AutonotesBook); |
174 if ( BtnUp_flag || !books_primary_item_per_page ) | |
1453 | 175 pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 407, pViewport->uViewportTL_Y + 2, pTex_book_button1_off); |
1447 | 176 else |
1453 | 177 pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 1, pTex_book_button1_on); |
1447 | 178 |
179 if ( BtnDown_flag || books_primary_item_per_page + num_achieved_awards >= full_num_items_in_book ) | |
1453 | 180 pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 407, pViewport->uViewportTL_Y + 38, pTex_book_button2_off); |
1447 | 181 else |
1453 | 182 pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 38, pTex_book_button2_on); |
1447 | 183 |
184 if ( Book_PageBtn3_flag )//Potions_page_flag | |
1446 | 185 { |
1447 | 186 if (_506568_autonote_type == AUTONOTE_POTION_RECEPIE)//press again(повторное нажатие) |
1453 | 187 pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 113, pTex_book_button3_on); |
1447 | 188 else//press(нажатие) |
189 { | |
1453 | 190 change_flag = true; |
1447 | 191 pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0); |
192 _506568_autonote_type = AUTONOTE_POTION_RECEPIE; | |
1453 | 193 pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 113, pTex_book_button3_on); |
1447 | 194 } |
195 } | |
196 else | |
197 { | |
198 if (_506568_autonote_type == AUTONOTE_POTION_RECEPIE)// default(по умолчанию при запуске окна) | |
1453 | 199 pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 113, pTex_book_button3_on); |
1447 | 200 else//Potions_page not active(вкладка снадобья не активна) |
1453 | 201 pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 113, pTex_book_button3_off); |
1447 | 202 } |
203 | |
204 if ( Book_PageBtn4_flag )//Fontains_page_flag | |
205 { | |
206 if ( _506568_autonote_type == AUTONOTE_STAT_HINT ) | |
1453 | 207 pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 399, pViewport->uViewportTL_Y + 150, pTex_book_button4_on); |
1447 | 208 else |
209 { | |
1453 | 210 change_flag = true; |
1447 | 211 pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0); |
212 _506568_autonote_type = AUTONOTE_STAT_HINT; | |
1453 | 213 pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 399, pViewport->uViewportTL_Y + 150, pTex_book_button4_on); |
1447 | 214 } |
1446 | 215 } |
216 else | |
217 { | |
1447 | 218 if ( _506568_autonote_type == AUTONOTE_STAT_HINT ) |
1453 | 219 pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 399, pViewport->uViewportTL_Y + 150, pTex_book_button4_on); |
1447 | 220 else |
1453 | 221 pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 150, pTex_book_button4_off); |
1447 | 222 } |
223 | |
224 if ( Book_PageBtn5_flag )//Autonotes_Obelisks_page_flag | |
225 { | |
226 if ( _506568_autonote_type == AUTONOTE_OBELISK) | |
1453 | 227 pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 188, pTex_book_button5_on); |
1447 | 228 else |
229 { | |
1453 | 230 change_flag = true; |
1447 | 231 pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0); |
232 _506568_autonote_type = AUTONOTE_OBELISK; | |
1453 | 233 pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 188, pTex_book_button5_on); |
1447 | 234 } |
235 } | |
236 else | |
237 { | |
238 if ( _506568_autonote_type == AUTONOTE_OBELISK) | |
1453 | 239 pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 188, pTex_book_button5_on); |
1447 | 240 else |
1453 | 241 pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 188, pTex_book_button5_off); |
1446 | 242 } |
1447 | 243 |
244 if ( Book_PageBtn6_flag )//Autonotes_Seer_page_flag | |
245 { | |
246 if ( _506568_autonote_type == AUTONOTE_SEER) | |
1453 | 247 pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 226, pTex_book_button6_on); |
1447 | 248 else |
249 { | |
1453 | 250 change_flag = true; |
1447 | 251 pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0); |
252 _506568_autonote_type = AUTONOTE_SEER; | |
1453 | 253 pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 226, pTex_book_button6_on); |
1447 | 254 } |
255 } | |
256 else | |
1446 | 257 { |
1447 | 258 if ( _506568_autonote_type == AUTONOTE_SEER) |
1453 | 259 pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 226, pTex_book_button6_on); |
1447 | 260 else |
1453 | 261 pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 226, pTex_book_button6_off); |
1447 | 262 } |
263 | |
264 if ( Autonotes_Misc_page_flag ) | |
265 { | |
266 if ( _506568_autonote_type == AUTONOTE_MISC) | |
1453 | 267 pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 264, pTex_book_button7_on); |
1447 | 268 else |
269 { | |
1453 | 270 change_flag = true; |
1447 | 271 pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0); |
272 _506568_autonote_type = AUTONOTE_MISC; | |
1453 | 273 pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 264, pTex_book_button7_on); |
1447 | 274 } |
1446 | 275 } |
276 else | |
277 { | |
1447 | 278 if ( _506568_autonote_type == AUTONOTE_MISC) |
1453 | 279 pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 264, pTex_book_button7_on); |
1447 | 280 else |
1453 | 281 pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 263, pTex_book_button7_off); |
1446 | 282 } |
1447 | 283 |
284 if ( Autonotes_Instructors_page_flag ) | |
1446 | 285 { |
1447 | 286 if ( _506568_autonote_type == AUTONOTE_TEACHER) |
1453 | 287 pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 302, pTex_book_button8_on); |
1447 | 288 else |
1312 | 289 { |
1453 | 290 change_flag = true; |
1447 | 291 pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0); |
292 _506568_autonote_type = AUTONOTE_TEACHER; | |
1453 | 293 pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 302, pTex_book_button8_on); |
1447 | 294 } |
295 } | |
296 else | |
297 { | |
298 if ( _506568_autonote_type == AUTONOTE_TEACHER) | |
1453 | 299 pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 302, pTex_book_button8_on); |
1312 | 300 else |
1453 | 301 pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 302, pTex_book_button8_off); |
1447 | 302 } |
303 | |
1453 | 304 //for title |
1447 | 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 | |
1453 | 313 //for other text |
1447 | 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; | |
1453 | 320 if ( change_flag )//change bookmark(смена закладки) |
1447 | 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; | |
1453 | 326 for ( uint i = 1; i <= 195; ++i ) |
1447 | 327 { |
1453 | 328 if ( pAutonoteTxt[i].eType == _506568_autonote_type ) |
1447 | 329 { |
1453 | 330 if ( (unsigned __int16)_449B57_test_bit(pParty->_autonote_bits, i) && (char *)pAutonoteTxt[i].pText ) |
331 achieved_awards[num_achieved_awards++] = (AwardType)i; | |
1447 | 332 } |
333 } | |
334 full_num_items_in_book = num_achieved_awards; | |
335 } | |
1453 | 336 else//not change bookmark(не меняется закладка) |
1447 | 337 { |
1453 | 338 if ( BtnDown_flag )// press Down bookmark(нажатие закладки пролистать дальше) |
1447 | 339 { |
340 if ( num_achieved_awards + books_primary_item_per_page < full_num_items_in_book ) | |
341 { | |
1453 | 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; | |
1447 | 344 pAudioPlayer->PlaySound(SOUND_OpenBook, 0, 0, -1, 0, 0, 0, 0); |
345 } | |
346 } | |
1453 | 347 if ( BtnUp_flag && books_page_number )// press Up bookmark(нажатие закладки пролистать назад) |
1447 | 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); | |
1312 | 352 } |
1453 | 353 if ( !num_achieved_awards || !books_primary_item_per_page )//количество записей 0 или номер первой страницы 0 |
1447 | 354 { |
355 books_primary_item_per_page = 0; | |
356 books_page_number = 0; | |
357 } | |
358 } | |
1453 | 359 BtnUp_flag = 0; |
1447 | 360 BtnDown_flag = 0; |
1453 | 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 | |
1447 | 365 Autonotes_Misc_page_flag = 0; |
1453 | 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 ) | |
1447 | 369 { |
370 ++num_achieved_awards; | |
1453 | 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 ) | |
1447 | 374 break; |
1453 | 375 pRenderer->DrawTextureTransparent(100, (autonotes_window.uFrameY + pTextHeight) + 12, pSpellBookPagesTextr_10); |
376 autonotes_window.uFrameY = (autonotes_window.uFrameY + pTextHeight) + 24; | |
1447 | 377 } |
378 } | |
1312 | 379 |
380 //----- (00412E85) -------------------------------------------------------- | |
381 void BookUI_Journal_Draw() | |
382 { | |
1453 | 383 char *pDialogueString; // eax@21 |
384 char* pStringOnPage; // eax@22 | |
385 GUIWindow journal_window; // [sp+8h] [bp-54h]@10 | |
1312 | 386 |
387 pRenderer->DrawTextureIndexed(pViewport->uViewportTL_X, pViewport->uViewportTL_Y, pSpellBookPagesTextr_11); | |
1446 | 388 if ( BtnUp_flag || !books_primary_item_per_page ) |
1453 | 389 pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 407, pViewport->uViewportTL_Y + 2, pTex_book_button1_off); |
1312 | 390 else |
1453 | 391 pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 1, pTex_book_button1_on); |
1312 | 392 |
1446 | 393 if ( BtnDown_flag || books_primary_item_per_page + num_achieved_awards >= full_num_items_in_book ) |
1453 | 394 pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 407, pViewport->uViewportTL_Y + 38, pTex_book_button2_off); |
1312 | 395 else |
1453 | 396 pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 38, pTex_book_button2_on); |
1312 | 397 |
1453 | 398 if ( !Journal_limitation_factor[books_primary_item_per_page] )//for title |
1312 | 399 { |
1453 | 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, (const char *)pStorylineText->StoreLine[achieved_awards[books_primary_item_per_page]].pPageTitle, 3); | |
1312 | 408 } |
409 | |
1453 | 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 | |
1312 | 418 { |
419 pAudioPlayer->PlaySound(SOUND_OpenBook, 0, 0, -1, 0, 0, 0, 0); | |
1446 | 420 books_primary_item_per_page += num_achieved_awards; |
1453 | 421 books_num_items_per_page[books_page_number++] = num_achieved_awards; |
1312 | 422 } |
1453 | 423 if ( BtnUp_flag && books_page_number )//Press bookmark previous page |
1312 | 424 { |
425 pAudioPlayer->PlaySound(SOUND_OpenBook, 0, 0, -1, 0, 0, 0, 0); | |
1446 | 426 --books_page_number; |
427 books_primary_item_per_page -= (unsigned __int8)books_num_items_per_page[books_page_number]; | |
1312 | 428 } |
1446 | 429 if ( !num_achieved_awards || books_primary_item_per_page < 1 ) |
1312 | 430 { |
1446 | 431 books_primary_item_per_page = 0; |
432 books_page_number = 0; | |
1312 | 433 } |
434 BtnDown_flag = 0; | |
435 BtnUp_flag = 0; | |
436 num_achieved_awards = 0; | |
1453 | 437 if ( achieved_awards[books_primary_item_per_page] ) |
1312 | 438 { |
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
|
439 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
|
440 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
|
441 0, 0, 0, &pParty->PartyTimes.HistoryEventTimes[index]); |
1453 | 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, (const char *)pStringOnPage, 0, | |
444 journal_window.uFrameY + journal_window.uFrameHeight, ui_book_journal_text_shadow); | |
1312 | 445 ++num_achieved_awards; |
446 } | |
447 } |