comparison UI/Books/UINotesBooks.cpp @ 1312:ae435824ac4d

books code splitted to separate files
author Gloval
date Wed, 26 Jun 2013 00:22:57 +0400
parents
children 38df78aba732
comparison
equal deleted inserted replaced
1311:1dee26137a92 1312:ae435824ac4d
1
2 #ifdef _MSC_VER
3 #define _CRT_SECURE_NO_WARNINGS
4 #endif
5
6 #include <assert.h>
7
8 #include "..\..\MM7.h"
9 #include "..\..\Render.h"
10 #include "..\..\Mouse.h"
11 #include "..\UIBooks.h"
12 #include "..\..\MapInfo.h"
13 #include "..\..\GUIWindow.h"
14 #include "..\..\GUIFont.h"
15 #include "..\..\Party.h"
16 #include "..\..\AudioPlayer.h"
17 //#include "..\Outdoor.h"
18 #include "..\..\LOD.h"
19 #include "..\..\Allocator.h"
20 #include "..\..\Viewport.h"
21 //#include "..\Math.h"
22 #include "..\..\Awards.h"
23 #include "..\..\Autonotes.h"
24 #include "..\..\StorylineTextTable.h"
25 #include "..\..\texts.h"
26 //
27 #include "..\..\mm7_data.h"
28
29
30
31
32 //----- (00413D3C) --------------------------------------------------------
33 static const char *GetDayPart()
34 {
35 if (pParty->uCurrentHour <= 4)
36 return pGlobalTXT_LocalizationStrings[567]; // "Night"
37 else if (pParty->uCurrentHour == 5)
38 return pGlobalTXT_LocalizationStrings[55]; // "Dawn"
39 else if (pParty->uCurrentHour == 20)
40 return pGlobalTXT_LocalizationStrings[566]; // "Dusk"
41 else
42 return pGlobalTXT_LocalizationStrings[56]; // "Day"
43 }
44
45
46
47
48
49 //----- (00413D6F) --------------------------------------------------------
50 void BookUI_Calendar_Draw()
51 {
52 unsigned int v0; // esi@1
53 //char *v1; // eax@5
54 int v2; // ecx@5
55 char *v3; // eax@6
56 GUIWindow a1; // [sp+Ch] [bp-60h]@5
57 unsigned int v6; // [sp+60h] [bp-Ch]@1
58 //int v7; // [sp+64h] [bp-8h]@1
59 //int a5; // [sp+68h] [bp-4h]@1
60
61
62 static unsigned int pDayMoonPhase[28] = // 4E1B18
63 {
64 0, 0, 0,
65 1, 1, 1, 1,
66 2, 2, 2,
67 3, 3, 3, 3,
68 4, 4, 4,
69 3, 3, 3, 3,
70 2, 2, 2,
71 1, 1, 1, 1
72 };
73
74
75 v0 = pParty->uCurrentHour;
76 pRenderer->DrawTextureIndexed(pViewport->uViewportTL_X, pViewport->uViewportTL_Y, pSpellBookPagesTextr_13);
77 if ( (signed int)v0 <= 12 )
78 {
79 if ( !v0 )
80 v0 = 12;
81 }
82 else
83 {
84 v0 -= 12;
85 }
86 a1.uFrameX = game_viewport_x;
87 a1.uFrameY = game_viewport_y;
88 a1.uFrameWidth = game_viewport_width;
89 a1.uFrameHeight = game_viewport_height;
90 a1.uFrameZ = game_viewport_z;
91 a1.uFrameW = game_viewport_w;
92 a1.DrawTitleText(pBook2Font, 0, 0x16u, ui_book_calendar_title_color, pGlobalTXT_LocalizationStrings[186], 3); // "Time in Erathia"
93
94 v2 = 0;
95 if ( pParty->uCurrentHour >= 12 )
96 {
97 if ( pParty->uCurrentHour >= 24 )
98 v2=0;
99 else
100 v2=1;
101 }
102
103 sprintf(pTmpBuf.data(), "%s\t100:\t110%d:%02d %s - %s",
104 pGlobalTXT_LocalizationStrings[526], // "Time"
105 v0,
106 pParty->uCurrentMinute,
107 aAMPMNames[v2],
108 GetDayPart());
109 a1.DrawText(pBookFont, 70, 55, ui_book_calendar_time_color, pTmpBuf.data(), 0, 0, 0);
110
111 sprintf(pTmpBuf.data(), "%s\t100:\t110%d - %s",
112 pGlobalTXT_LocalizationStrings[56], // "Day"
113 pParty->uDaysPlayed + 1,
114 aDayNames[pParty->uDaysPlayed % 7]);
115 a1.DrawText(pBookFont, 70, 2 * LOBYTE(pBookFont->uFontHeight) + 49, ui_book_calendar_day_color, pTmpBuf.data(), 0, 0, 0);
116
117 sprintf(pTmpBuf.data(), "%s\t100:\t110%d - %s",
118 pGlobalTXT_LocalizationStrings[146], // "Month"
119 pParty->uCurrentMonth + 1,
120 aMonthNames[pParty->uCurrentMonth]);
121 a1.DrawText(pBookFont, 70, 4 * LOBYTE(pBookFont->uFontHeight) + 43, ui_book_calendar_month_color, pTmpBuf.data(), 0, 0, 0);
122
123 sprintf(pTmpBuf.data(), "%s\t100:\t110%d", pGlobalTXT_LocalizationStrings[245], pParty->uCurrentYear); // "Year"
124 a1.DrawText(pBookFont, 70, 6 * LOBYTE(pBookFont->uFontHeight) + 37, ui_book_calendar_year_color, pTmpBuf.data(), 0, 0, 0);
125
126 sprintf(pTmpBuf.data(), "%s\t100:\t110%s", pGlobalTXT_LocalizationStrings[530], aMoonPhaseNames[pDayMoonPhase[pParty->uDaysPlayed]]); // "Moon"
127 a1.DrawText(pBookFont, 70, 8 * LOBYTE(pBookFont->uFontHeight) + 31, ui_book_calendar_moon_color, pTmpBuf.data(), 0, 0, 0);
128
129 v6 = pMapStats->GetMapInfo(pCurrentMapName.data());
130 if ( v6 )
131 v3 = pMapStats->pInfos[v6].pName;
132 else
133 v3 = "Unknown";
134 sprintf(pTmpBuf.data(), "%s\t100:\t110%s", pGlobalTXT_LocalizationStrings[531], v3); // "Location"
135 a1.DrawText(pBookFont, 70, 10 * LOBYTE(pBookFont->uFontHeight) + 25, ui_book_calendar_location_color, pTmpBuf.data(), 0, 0, 0);
136 }
137
138
139
140
141
142 //----- (00413126) --------------------------------------------------------
143 void BookUI_Questbook_Draw()
144 {
145 unsigned int v0; // eax@3
146 unsigned int v1; // eax@7
147 int v2; // ecx@11
148 int v3; // ebx@16
149 int v4; // eax@19
150 const char *v5; // edi@19
151 int v6; // eax@19
152 unsigned int v7; // edi@19
153 unsigned int v8; // [sp-8h] [bp-68h]@3
154 unsigned int v9; // [sp-8h] [bp-68h]@7
155 Texture *v10; // [sp-4h] [bp-64h]@3
156 Texture *v11; // [sp-4h] [bp-64h]@7
157 GUIWindow a1; // [sp+Ch] [bp-54h]@9
158
159 pRenderer->DrawTextureIndexed(pViewport->uViewportTL_X, pViewport->uViewportTL_Y, pTexture_CurrentBook);
160 if ( BtnUp_flag || !dword_506528 )
161 {
162 v10 = pTex_tab_an_6a__zoom_off;
163 v8 = pViewport->uViewportTL_Y + 2;
164 v0 = pViewport->uViewportTL_X + 407;
165 }
166 else
167 {
168 v10 = pTex_tab_an_6b__zoom_on;
169 v8 = pViewport->uViewportTL_Y + 1;
170 v0 = pViewport->uViewportTL_X + 398;
171 }
172 pRenderer->DrawTextureTransparent(v0, v8, v10);
173 if ( BtnDown_flag || dword_506528 + num_achieved_awards >= num_achieved_awards_2 )
174 {
175 v11 = pTex_tab_an_7a__zoot_off;
176 v9 = pViewport->uViewportTL_Y + 38;
177 v1 = pViewport->uViewportTL_X + 407;
178 }
179 else
180 {
181 v11 = pTex_tab_an_7b__zoot_on;
182 v9 = pViewport->uViewportTL_Y + 38;
183 v1 = pViewport->uViewportTL_X + 398;
184 }
185 pRenderer->DrawTextureTransparent(v1, v9, v11);
186 a1.uFrameWidth = game_viewport_width;
187 a1.uFrameHeight = game_viewport_height;
188 a1.uFrameX = game_viewport_x;
189 a1.uFrameY = game_viewport_y;
190 a1.uFrameZ = game_viewport_z;
191 a1.uFrameW = game_viewport_w;
192 a1.DrawTitleText(pBook2Font, 0, 22, ui_book_quests_title_color, pGlobalTXT_LocalizationStrings[174], 3); //"Current Quests"
193
194 a1.uFrameX = 48;
195 a1.uFrameY = 70;
196 a1.uFrameWidth = 360;
197 a1.uFrameHeight = 264;
198 a1.uFrameZ = 407;
199 a1.uFrameW = 333;
200 if ( BtnDown_flag && dword_506528 + num_achieved_awards < num_achieved_awards_2 )
201 {
202 pAudioPlayer->PlaySound(SOUND_OpenBook, 0, 0, -1, 0, 0, 0, 0);
203 v2 = dword_50651C++;
204 dword_506528 += num_achieved_awards;
205 byte_506130[v2] = num_achieved_awards;
206 }
207 if ( BtnUp_flag && dword_50651C )
208 {
209 pAudioPlayer->PlaySound(SOUND_OpenBook, 0, 0, -1, 0, 0, 0, 0);
210 --dword_50651C;
211 dword_506528 -= (unsigned __int8)byte_506130[dword_50651C];
212 }
213 if ( !num_achieved_awards || (v3 = dword_506528, dword_506528 < 1) )
214 {
215 v3 = 0;
216 dword_50651C = 0;
217 dword_506528 = 0;
218 }
219 BtnDown_flag = 0;
220 BtnUp_flag = 0;
221 num_achieved_awards = 0;
222 while ( v3 < num_achieved_awards_2 )
223 {
224 v4 = achieved_awards[v3];
225 ++num_achieved_awards;
226 v5 = pQuestTable[v4];//(&dword_722F10)[4 * v4];
227 a1.DrawText(pAutonoteFont, 1, 0, ui_book_quests_text_color, pQuestTable[v4], 0, 0, 0);//(&dword_722F10)[4 * v4], 0, 0, 0);
228 v6 = pAutonoteFont->CalcTextHeight(v5, &a1, 1, 0);
229 v7 = a1.uFrameY + v6;
230 if ( (signed int)(a1.uFrameY + v6) > (signed int)a1.uFrameHeight )
231 break;
232 pRenderer->DrawTextureTransparent(100, v7 + 12, pSpellBookPagesTextr_10);
233 ++v3;
234 a1.uFrameY = v7 + 24;
235 }
236 }
237
238
239 //----- (0041338E) --------------------------------------------------------
240 void BookUI_Autonotes_Draw()
241 {
242 unsigned int v0; // eax@3
243 unsigned int v1; // eax@7
244 signed int v2; // ebp@11
245 unsigned int v3; // eax@18
246 unsigned int v4; // eax@24
247 unsigned int v5; // eax@30
248 unsigned int v6; // eax@36
249 unsigned int v7; // eax@42
250 signed int v8; // ebp@47
251 int v9; // eax@52
252 int v10; // eax@56
253 int v11; // edx@57
254 int v12; // ebp@64
255 int v13; // eax@65
256 const char *v14; // edi@65
257 int v15; // eax@65
258 unsigned int v16; // edi@65
259 unsigned int v17; // [sp-8h] [bp-70h]@3
260 unsigned int v18; // [sp-8h] [bp-70h]@7
261 unsigned int v19; // [sp-8h] [bp-70h]@18
262 unsigned int v20; // [sp-8h] [bp-70h]@24
263 unsigned int v21; // [sp-8h] [bp-70h]@30
264 unsigned int v22; // [sp-8h] [bp-70h]@36
265 unsigned int v23; // [sp-8h] [bp-70h]@42
266 Texture *v24; // [sp-4h] [bp-6Ch]@3
267 Texture *v25; // [sp-4h] [bp-6Ch]@7
268 Texture *v26; // [sp-4h] [bp-6Ch]@18
269 Texture *v27; // [sp-4h] [bp-6Ch]@24
270 Texture *v28; // [sp-4h] [bp-6Ch]@30
271 Texture *v29; // [sp-4h] [bp-6Ch]@36
272 Texture *v30; // [sp-4h] [bp-6Ch]@42
273 signed __int16 v31; // [sp+10h] [bp-58h]@1
274 char *v32; // [sp+10h] [bp-58h]@49
275 GUIWindow a1; // [sp+14h] [bp-54h]@46
276
277 v31 = 0;
278 pRenderer->DrawTextureIndexed(pViewport->uViewportTL_X, pViewport->uViewportTL_Y, pTexture_AutonotesBook);
279 if ( BtnUp_flag || !dword_506528 )
280 {
281 v24 = pTex_tab_an_6a__zoom_off;
282 v17 = pViewport->uViewportTL_Y + 2;
283 v0 = pViewport->uViewportTL_X + 407;
284 }
285 else
286 {
287 v24 = pTex_tab_an_6b__zoom_on;
288 v17 = pViewport->uViewportTL_Y + 1;
289 v0 = pViewport->uViewportTL_X + 398;
290 }
291 pRenderer->DrawTextureTransparent(v0, v17, v24);
292 if ( BtnDown_flag || dword_506528 + num_achieved_awards >= num_achieved_awards_2 )
293 {
294 v25 = pTex_tab_an_7a__zoot_off;
295 v18 = pViewport->uViewportTL_Y + 38;
296 v1 = pViewport->uViewportTL_X + 407;
297 }
298 else
299 {
300 v25 = pTex_tab_an_7b__zoot_on;
301 v18 = pViewport->uViewportTL_Y + 38;
302 v1 = pViewport->uViewportTL_X + 398;
303 }
304 pRenderer->DrawTextureTransparent(v1, v18, v25);
305 if ( !Book_PageBtn3_flag )//Potions_page_flag
306 {
307 if (_506568_autonote_type != AUTONOTE_POTION_RECEPIE)
308 {
309 pRenderer->DrawTextureTransparent(
310 pViewport->uViewportTL_X + 408,
311 pViewport->uViewportTL_Y + 113,
312 pTexture_506390);
313 v2 = 1;
314 goto LABEL_16;
315 }
316 goto LABEL_14;
317 }
318 if (_506568_autonote_type == AUTONOTE_POTION_RECEPIE)
319 {
320 LABEL_14:
321 v2 = 1;
322 goto LABEL_15;
323 }
324 v2 = 1;
325 v31 = 1;
326 pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0);
327 LABEL_15:
328 _506568_autonote_type = AUTONOTE_POTION_RECEPIE;
329 pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 113, pTexture_506394);
330 LABEL_16:
331 if ( Book_PageBtn4_flag )//Fontains_page_flag
332 {
333 if ( _506568_autonote_type != v2 )
334 {
335 v31 = v2;
336 pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0);
337 }
338 }
339 else
340 {
341 if ( _506568_autonote_type != v2 )
342 {
343 v26 = pTexture_506388;
344 v19 = pViewport->uViewportTL_Y + 150;
345 v3 = pViewport->uViewportTL_X + 408;
346 goto LABEL_22;
347 }
348 }
349 v26 = pTexture_50638C;
350 _506568_autonote_type = v2;
351 v19 = pViewport->uViewportTL_Y + 150;
352 v3 = pViewport->uViewportTL_X + 399;
353 LABEL_22:
354 pRenderer->DrawTextureTransparent(v3, v19, v26);
355 if ( Book_PageBtn5_flag )//Autonotes_Obelisks_page_flag
356 {
357 if ( _506568_autonote_type != AUTONOTE_OBELISK)
358 {
359 v31 = v2;
360 pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0);
361 }
362 }
363 else
364 {
365 if ( _506568_autonote_type != AUTONOTE_OBELISK)
366 {
367 v27 = pTexture_506380;
368 v20 = pViewport->uViewportTL_Y + 188;
369 v4 = pViewport->uViewportTL_X + 408;
370 goto LABEL_28;
371 }
372 }
373 v27 = pTexture_506384;
374 _506568_autonote_type = AUTONOTE_OBELISK;
375 v20 = pViewport->uViewportTL_Y + 188;
376 v4 = pViewport->uViewportTL_X + 397;
377 LABEL_28:
378 pRenderer->DrawTextureTransparent(v4, v20, v27);
379 if ( Book_PageBtn6_flag )//Autonotes_Seer_page_flag
380 {
381 if ( _506568_autonote_type != AUTONOTE_SEER)
382 {
383 v31 = v2;
384 pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0);
385 }
386 }
387 else
388 {
389 if ( _506568_autonote_type != AUTONOTE_SEER)
390 {
391 v28 = pTexture_506378;
392 v21 = pViewport->uViewportTL_Y + 226;
393 v5 = pViewport->uViewportTL_X + 408;
394 goto LABEL_34;
395 }
396 }
397 v28 = pTexture_50637C;
398 _506568_autonote_type = AUTONOTE_SEER;
399 v21 = pViewport->uViewportTL_Y + 226;
400 v5 = pViewport->uViewportTL_X + 397;
401 LABEL_34:
402 pRenderer->DrawTextureTransparent(v5, v21, v28);
403 if ( Autonotes_Misc_page_flag )
404 {
405 if ( _506568_autonote_type != AUTONOTE_MISC)
406 {
407 v31 = v2;
408 pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0);
409 }
410 }
411 else
412 {
413 if ( _506568_autonote_type != AUTONOTE_MISC)
414 {
415 v29 = pTexture_506370;
416 v22 = pViewport->uViewportTL_Y + 263;
417 v6 = pViewport->uViewportTL_X + 408;
418 goto LABEL_40;
419 }
420 }
421 v29 = pTexture_506374;
422 _506568_autonote_type = AUTONOTE_MISC;
423 v22 = pViewport->uViewportTL_Y + 264;
424 v6 = pViewport->uViewportTL_X + 397;
425 LABEL_40:
426 pRenderer->DrawTextureTransparent(v6, v22, v29);
427 if ( Autonotes_Instructors_page_flag )
428 {
429 if ( _506568_autonote_type != AUTONOTE_TEACHER)
430 {
431 v31 = v2;
432 pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0);
433 }
434 }
435 else
436 {
437 if ( _506568_autonote_type != AUTONOTE_TEACHER)
438 {
439 v30 = pTexture_506368;
440 v23 = pViewport->uViewportTL_Y + 302;
441 v7 = pViewport->uViewportTL_X + 408;
442 goto LABEL_46;
443 }
444 }
445 v30 = pTexture_50636C;
446 _506568_autonote_type = AUTONOTE_TEACHER;
447 v23 = pViewport->uViewportTL_Y + 302;
448 v7 = pViewport->uViewportTL_X + 397;
449 LABEL_46:
450 pRenderer->DrawTextureTransparent(v7, v23, v30);
451 a1.uFrameWidth = game_viewport_width;
452 a1.uFrameHeight = game_viewport_height;
453 a1.uFrameX = game_viewport_x;
454 a1.uFrameY = game_viewport_y;
455 a1.uFrameZ = game_viewport_z;
456 a1.uFrameW = game_viewport_w;
457 a1.DrawTitleText(pBook2Font, 0, 22, ui_book_autonotes_title_color, pGlobalTXT_LocalizationStrings[154], 3); // "Auto notes"
458
459 a1.uFrameX = 48;
460 a1.uFrameY = 70;
461 a1.uFrameWidth = 360;
462 a1.uFrameHeight = 264;
463 a1.uFrameZ = 407;
464 a1.uFrameW = 333;
465 if ( v31 )
466 {
467 num_achieved_awards_2 = 0;
468 dword_506528 = 0;
469 dword_50651C = 0;
470 num_achieved_awards = 0;
471 v8 = 0;
472 do
473 {
474 //if ( dword_72371C[2 * v8] == dword_506568 )
475 if ( pAutonoteTxt[v8].eType == _506568_autonote_type )
476 {
477 //v32 = (&dword_723718_autonote_related)[8 * (signed __int16)v8];
478 v32 = (char *)pAutonoteTxt[v8].pText;
479 if ( (short)v8 )
480 {
481 if ( (unsigned __int16)_449B57_test_bit(pParty->_autonote_bits, v8) && v32 )
482 {
483 v9 = num_achieved_awards++;
484 achieved_awards[v9] = (AwardType)v8;
485 }
486 }
487 }
488 ++v8;
489 }
490 while ( v8 < 196 );
491 num_achieved_awards_2 = num_achieved_awards;
492 }
493 else
494 {
495 if ( BtnDown_flag )
496 {
497 v10 = num_achieved_awards + dword_506528;
498 if ( num_achieved_awards + dword_506528 < num_achieved_awards_2 )
499 {
500 v11 = dword_50651C++;
501 byte_506130[v11] = num_achieved_awards;
502 dword_506528 = v10;
503 pAudioPlayer->PlaySound(SOUND_OpenBook, 0, 0, -1, 0, 0, 0, 0);
504 }
505 }
506 if ( BtnUp_flag && dword_50651C )
507 {
508 --dword_50651C;
509 dword_506528 -= (unsigned __int8)byte_506130[dword_50651C];
510 pAudioPlayer->PlaySound(SOUND_OpenBook, 0, 0, -1, 0, 0, 0, 0);
511 }
512 if ( !num_achieved_awards || dword_506528 < 1 )
513 {
514 dword_506528 = 0;
515 dword_50651C = 0;
516 }
517 }
518 v12 = dword_506528;
519 Autonotes_Instructors_page_flag = 0;
520 BtnDown_flag = 0;
521 BtnUp_flag = 0;
522 num_achieved_awards = 0;
523 Autonotes_Misc_page_flag = 0;
524 Book_PageBtn6_flag = 0;//Autonotes_Seer_page_flag
525 Book_PageBtn5_flag = 0;//Autonotes_Obelisks_page_flag
526 Book_PageBtn4_flag = 0;//Fontains_page_flag
527 Book_PageBtn3_flag = 0;//Potions_page_flag
528 while ( v12 < num_achieved_awards_2 )
529 {
530 v13 = achieved_awards[v12];
531 ++num_achieved_awards;
532 //v14 = (&dword_723718_autonote_related)[8 * v13];
533 v14 = pAutonoteTxt[v13].pText;
534 //a1.DrawText(pAutonoteFont, 1, 0, 0, (&dword_723718_autonote_related)[8 * v13], 0, 0, 0);
535 a1.DrawText(pAutonoteFont, 1, 0, ui_book_autonotes_text_color, pAutonoteTxt[v13].pText, 0, 0, 0);
536 v15 = pAutonoteFont->CalcTextHeight(v14, &a1, 1, 0);
537 v16 = a1.uFrameY + v15;
538 if ( (signed int)(a1.uFrameY + v15) > (signed int)a1.uFrameHeight )
539 break;
540 pRenderer->DrawTextureTransparent(0x64u, v16 + 12, pSpellBookPagesTextr_10);
541 ++v12;
542 a1.uFrameY = v16 + 24;
543 }
544 }
545
546 //----- (00412E85) --------------------------------------------------------
547 void BookUI_Journal_Draw()
548 {
549 unsigned int v0; // eax@3
550 unsigned int v1; // eax@7
551 int v2; // eax@10
552 const char *v3; // eax@10
553 signed int v4; // ecx@12
554 int v5; // ecx@14
555 int v6; // eax@21
556 int v7; // esi@21
557 char *v8; // eax@21
558 char* v9; // eax@22
559 unsigned int v11; // [sp-8h] [bp-64h]@3
560 unsigned int v12; // [sp-8h] [bp-64h]@7
561 Texture *v13; // [sp-4h] [bp-60h]@3
562 Texture *v14; // [sp-4h] [bp-60h]@7
563 GUIWindow a1; // [sp+8h] [bp-54h]@10
564
565 pRenderer->DrawTextureIndexed(pViewport->uViewportTL_X, pViewport->uViewportTL_Y, pSpellBookPagesTextr_11);
566 if ( BtnUp_flag || !dword_506528 )
567 {
568 v13 = pTex_tab_an_6a__zoom_off;
569 v11 = pViewport->uViewportTL_Y + 2;
570 v0 = pViewport->uViewportTL_X + 407;
571 }
572 else
573 {
574 v13 = pTex_tab_an_6b__zoom_on;
575 v11 = pViewport->uViewportTL_Y + 1;
576 v0 = pViewport->uViewportTL_X + 398;
577 }
578 pRenderer->DrawTextureTransparent(v0, v11, v13);
579
580 if ( BtnDown_flag || dword_506528 + num_achieved_awards >= num_achieved_awards_2 )
581 {
582 v14 = pTex_tab_an_7a__zoot_off;
583 v12 = pViewport->uViewportTL_Y + 38;
584 v1 = pViewport->uViewportTL_X + 407;
585 }
586 else
587 {
588 v14 = pTex_tab_an_7b__zoot_on;
589 v12 = pViewport->uViewportTL_Y + 38;
590 v1 = pViewport->uViewportTL_X + 398;
591 }
592 pRenderer->DrawTextureTransparent(v1, v12, v14);
593
594 if ( !byte_5C6D50[dword_506528] )
595 {
596 v2 = achieved_awards[dword_506528];
597 a1.uFrameWidth = game_viewport_width;
598 a1.uFrameX = game_viewport_x;
599 a1.uFrameY = game_viewport_y;
600 a1.uFrameHeight = game_viewport_height;
601 v3 = (const char *)pStorylineText->StoreLine[v2].pPageTitle;//field_4[];
602 a1.uFrameZ = game_viewport_z;
603 a1.uFrameW = game_viewport_w;
604 if ( v3 )
605 a1.DrawTitleText(pBook2Font, 0, 22, ui_book_journal_title_color, v3, 3);
606 }
607
608 a1.uFrameX = 48;
609 a1.uFrameY = 70;
610 a1.uFrameWidth = 360;
611 a1.uFrameHeight = 264;
612 v4 = LOBYTE(pAutonoteFont->uFontHeight) - 3;
613 a1.uFrameZ = 407;
614 a1.uFrameHeight = v4 * 264 / v4;
615 a1.uFrameW = a1.uFrameHeight + 69;
616 if ( BtnDown_flag && dword_506528 + num_achieved_awards < num_achieved_awards_2 )
617 {
618 pAudioPlayer->PlaySound(SOUND_OpenBook, 0, 0, -1, 0, 0, 0, 0);
619 v5 = dword_50651C++;
620 dword_506528 += num_achieved_awards;
621 byte_506130[v5] = num_achieved_awards;
622 }
623 if ( BtnUp_flag && dword_50651C )
624 {
625 pAudioPlayer->PlaySound(SOUND_OpenBook, 0, 0, -1, 0, 0, 0, 0);
626 --dword_50651C;
627 dword_506528 -= (unsigned __int8)byte_506130[dword_50651C];
628 }
629 if ( !num_achieved_awards || dword_506528 < 1 )
630 {
631 dword_506528 = 0;
632 dword_50651C = 0;
633 }
634 BtnDown_flag = 0;
635 v6 = achieved_awards[dword_506528];
636 BtnUp_flag = 0;
637 num_achieved_awards = 0;
638 //v7 = *pStorylineText->StoreLine[v6].pText;//*(&pStorylineText->field_0 + 3 * v6);
639 v7 = (int)pStorylineText->StoreLine[v6].pText;//*(&pStorylineText->field_0 + 3 * v6);
640 v8 = BuilDialogueString(
641 pStorylineText->StoreLine[v6].pText,
642 uActiveCharacter - 1,
643 0,
644 0,
645 0,
646 (__int64 *)&pParty->field_3C._s_times[ v6 + 21]);
647 if ( v7 )
648 {
649 v9 = pAutonoteFont->_44C6C2(v8, &a1, 1u, (unsigned __int8)byte_5C6D50[dword_506528]);
650 a1.DrawText(pAutonoteFont, 1, 0, ui_book_journal_text_color, (const char *)v9, 0, a1.uFrameY + a1.uFrameHeight, ui_book_journal_text_shadow);
651 ++num_achieved_awards;
652 }
653 }
654