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