comparison UIBooks.cpp @ 956:e9292c58644a

Слияние
author Ritor1
date Thu, 02 May 2013 11:03:26 +0600
parents c0d0656aa662
children 9a5db2cf999a
comparison
equal deleted inserted replaced
955:21cc2b274220 956:e9292c58644a
31 #include "Time.h" 31 #include "Time.h"
32 #include "IconFrameTable.h" 32 #include "IconFrameTable.h"
33 #include "Awards.h" 33 #include "Awards.h"
34 #include "Autonotes.h" 34 #include "Autonotes.h"
35 #include "stru160.h" 35 #include "stru160.h"
36 #include "stru279.h"
37 #include "TurnEngine.h" 36 #include "TurnEngine.h"
38 #include "stru277.h" 37 #include "CastSpellInfo.h"
39 #include "Weather.h" 38 #include "Weather.h"
40 #include "stru272.h"
41 #include "stru298.h" 39 #include "stru298.h"
42 #include "StorylineTextTable.h" 40 #include "StorylineTextTable.h"
43 #include "Events2D.h" 41 #include "Events2D.h"
44 #include "texts.h" 42 #include "texts.h"
45 #include "stru351.h"
46 43
47 #include "mm7_data.h" 44 #include "mm7_data.h"
48 45
49 46
50 47
410 v13 = pTex_tab_an_6b__zoom_on; 407 v13 = pTex_tab_an_6b__zoom_on;
411 v11 = pViewport->uViewportTL_Y + 1; 408 v11 = pViewport->uViewportTL_Y + 1;
412 v0 = pViewport->uViewportTL_X + 398; 409 v0 = pViewport->uViewportTL_X + 398;
413 } 410 }
414 pRenderer->DrawTextureTransparent(v0, v11, v13); 411 pRenderer->DrawTextureTransparent(v0, v11, v13);
415 if ( dword_506544 || dword_506528 + awards_count >= awards_count2 ) 412 if ( dword_506544 || dword_506528 + num_achieved_awards >= num_achieved_awards_2 )
416 { 413 {
417 v14 = pTex_tab_an_7a__zoot_off; 414 v14 = pTex_tab_an_7a__zoot_off;
418 v12 = pViewport->uViewportTL_Y + 38; 415 v12 = pViewport->uViewportTL_Y + 38;
419 v1 = pViewport->uViewportTL_X + 407; 416 v1 = pViewport->uViewportTL_X + 407;
420 } 417 }
425 v1 = pViewport->uViewportTL_X + 398; 422 v1 = pViewport->uViewportTL_X + 398;
426 } 423 }
427 pRenderer->DrawTextureTransparent(v1, v12, v14); 424 pRenderer->DrawTextureTransparent(v1, v12, v14);
428 if ( !byte_5C6D50[dword_506528] ) 425 if ( !byte_5C6D50[dword_506528] )
429 { 426 {
430 v2 = achievedAwardsIndex[dword_506528]; 427 v2 = achieved_awards[dword_506528];
431 a1.uFrameWidth = game_viewport_width; 428 a1.uFrameWidth = game_viewport_width;
432 a1.uFrameX = game_viewport_x; 429 a1.uFrameX = game_viewport_x;
433 a1.uFrameY = game_viewport_y; 430 a1.uFrameY = game_viewport_y;
434 a1.uFrameHeight = game_viewport_height; 431 a1.uFrameHeight = game_viewport_height;
435 v3 = (const char *)pStorylineText->StoreLine[v2].pPageTitle;//field_4[]; 432 v3 = (const char *)pStorylineText->StoreLine[v2].pPageTitle;//field_4[];
444 a1.uFrameHeight = 264; 441 a1.uFrameHeight = 264;
445 v4 = LOBYTE(pAutonoteFont->uFontHeight) - 3; 442 v4 = LOBYTE(pAutonoteFont->uFontHeight) - 3;
446 a1.uFrameZ = 407; 443 a1.uFrameZ = 407;
447 a1.uFrameHeight = v4 * 264 / v4; 444 a1.uFrameHeight = v4 * 264 / v4;
448 a1.uFrameW = a1.uFrameHeight + 69; 445 a1.uFrameW = a1.uFrameHeight + 69;
449 if ( dword_506544 && dword_506528 + awards_count < awards_count2 ) 446 if ( dword_506544 && dword_506528 + num_achieved_awards < num_achieved_awards_2 )
450 { 447 {
451 pAudioPlayer->PlaySound((SoundID)230, 0, 0, -1, 0, 0, 0, 0); 448 pAudioPlayer->PlaySound((SoundID)230, 0, 0, -1, 0, 0, 0, 0);
452 v5 = dword_50651C++; 449 v5 = dword_50651C++;
453 dword_506528 += awards_count; 450 dword_506528 += num_achieved_awards;
454 byte_506130[v5] = awards_count; 451 byte_506130[v5] = num_achieved_awards;
455 } 452 }
456 if ( dword_506548 && dword_50651C ) 453 if ( dword_506548 && dword_50651C )
457 { 454 {
458 pAudioPlayer->PlaySound((SoundID)230, 0, 0, -1, 0, 0, 0, 0); 455 pAudioPlayer->PlaySound((SoundID)230, 0, 0, -1, 0, 0, 0, 0);
459 --dword_50651C; 456 --dword_50651C;
460 dword_506528 -= (unsigned __int8)byte_506130[dword_50651C]; 457 dword_506528 -= (unsigned __int8)byte_506130[dword_50651C];
461 } 458 }
462 if ( !awards_count || dword_506528 < 1 ) 459 if ( !num_achieved_awards || dword_506528 < 1 )
463 { 460 {
464 dword_506528 = 0; 461 dword_506528 = 0;
465 dword_50651C = 0; 462 dword_50651C = 0;
466 } 463 }
467 dword_506544 = 0; 464 dword_506544 = 0;
468 v6 = achievedAwardsIndex[dword_506528]; 465 v6 = achieved_awards[dword_506528];
469 dword_506548 = 0; 466 dword_506548 = 0;
470 awards_count = 0; 467 num_achieved_awards = 0;
471 //v7 = *pStorylineText->StoreLine[v6].pText;//*(&pStorylineText->field_0 + 3 * v6); 468 //v7 = *pStorylineText->StoreLine[v6].pText;//*(&pStorylineText->field_0 + 3 * v6);
472 v7 = (int)pStorylineText->StoreLine[v6].pText;//*(&pStorylineText->field_0 + 3 * v6); 469 v7 = (int)pStorylineText->StoreLine[v6].pText;//*(&pStorylineText->field_0 + 3 * v6);
473 v8 = BuilDialogueString( 470 v8 = BuilDialogueString(
474 pStorylineText->StoreLine[v6].pText, 471 pStorylineText->StoreLine[v6].pText,
475 uActiveCharacter - 1, 472 uActiveCharacter - 1,
479 (__int64 *)&pParty->field_3C._s_times[ v6 + 21]); 476 (__int64 *)&pParty->field_3C._s_times[ v6 + 21]);
480 if ( v7 ) 477 if ( v7 )
481 { 478 {
482 v9 = pAutonoteFont->_44C6C2(v8, &a1, 1u, (unsigned __int8)byte_5C6D50[dword_506528]); 479 v9 = pAutonoteFont->_44C6C2(v8, &a1, 1u, (unsigned __int8)byte_5C6D50[dword_506528]);
483 LOBYTE(v8) = a1.DrawText(pAutonoteFont, 1, 0, 0, (const char *)v9, 0, a1.uFrameY + a1.uFrameHeight, 0); 480 LOBYTE(v8) = a1.DrawText(pAutonoteFont, 1, 0, 0, (const char *)v9, 0, a1.uFrameY + a1.uFrameHeight, 0);
484 ++awards_count; 481 ++num_achieved_awards;
485 } 482 }
486 return (char)v8; 483 return (char)v8;
487 } 484 }
488 485
489 486
516 v10 = pTex_tab_an_6b__zoom_on; 513 v10 = pTex_tab_an_6b__zoom_on;
517 v8 = pViewport->uViewportTL_Y + 1; 514 v8 = pViewport->uViewportTL_Y + 1;
518 v0 = pViewport->uViewportTL_X + 398; 515 v0 = pViewport->uViewportTL_X + 398;
519 } 516 }
520 pRenderer->DrawTextureTransparent(v0, v8, v10); 517 pRenderer->DrawTextureTransparent(v0, v8, v10);
521 if ( dword_506544 || dword_506528 + awards_count >= awards_count2 ) 518 if ( dword_506544 || dword_506528 + num_achieved_awards >= num_achieved_awards_2 )
522 { 519 {
523 v11 = pTex_tab_an_7a__zoot_off; 520 v11 = pTex_tab_an_7a__zoot_off;
524 v9 = pViewport->uViewportTL_Y + 38; 521 v9 = pViewport->uViewportTL_Y + 38;
525 v1 = pViewport->uViewportTL_X + 407; 522 v1 = pViewport->uViewportTL_X + 407;
526 } 523 }
542 a1.uFrameY = 70; 539 a1.uFrameY = 70;
543 a1.uFrameWidth = 360; 540 a1.uFrameWidth = 360;
544 a1.uFrameHeight = 264; 541 a1.uFrameHeight = 264;
545 a1.uFrameZ = 407; 542 a1.uFrameZ = 407;
546 a1.uFrameW = 333; 543 a1.uFrameW = 333;
547 if ( dword_506544 && dword_506528 + awards_count < awards_count2 ) 544 if ( dword_506544 && dword_506528 + num_achieved_awards < num_achieved_awards_2 )
548 { 545 {
549 pAudioPlayer->PlaySound((SoundID)230, 0, 0, -1, 0, 0, 0, 0); 546 pAudioPlayer->PlaySound((SoundID)230, 0, 0, -1, 0, 0, 0, 0);
550 v2 = dword_50651C++; 547 v2 = dword_50651C++;
551 dword_506528 += awards_count; 548 dword_506528 += num_achieved_awards;
552 byte_506130[v2] = awards_count; 549 byte_506130[v2] = num_achieved_awards;
553 } 550 }
554 if ( dword_506548 && dword_50651C ) 551 if ( dword_506548 && dword_50651C )
555 { 552 {
556 pAudioPlayer->PlaySound((SoundID)230, 0, 0, -1, 0, 0, 0, 0); 553 pAudioPlayer->PlaySound((SoundID)230, 0, 0, -1, 0, 0, 0, 0);
557 --dword_50651C; 554 --dword_50651C;
558 dword_506528 -= (unsigned __int8)byte_506130[dword_50651C]; 555 dword_506528 -= (unsigned __int8)byte_506130[dword_50651C];
559 } 556 }
560 if ( !awards_count || (v3 = dword_506528, dword_506528 < 1) ) 557 if ( !num_achieved_awards || (v3 = dword_506528, dword_506528 < 1) )
561 { 558 {
562 v3 = 0; 559 v3 = 0;
563 dword_50651C = 0; 560 dword_50651C = 0;
564 dword_506528 = 0; 561 dword_506528 = 0;
565 } 562 }
566 dword_506544 = 0; 563 dword_506544 = 0;
567 dword_506548 = 0; 564 dword_506548 = 0;
568 awards_count = 0; 565 num_achieved_awards = 0;
569 while ( v3 < awards_count2 ) 566 while ( v3 < num_achieved_awards_2 )
570 { 567 {
571 v4 = achievedAwardsIndex[v3]; 568 v4 = achieved_awards[v3];
572 ++awards_count; 569 ++num_achieved_awards;
573 v5 = pQuestTable[v4-1];//(&dword_722F10)[4 * v4]; 570 v5 = pQuestTable[v4-1];//(&dword_722F10)[4 * v4];
574 a1.DrawText(pAutonoteFont, 1, 0, 0, pQuestTable[v4-1], 0, 0, 0);//(&dword_722F10)[4 * v4], 0, 0, 0); 571 a1.DrawText(pAutonoteFont, 1, 0, 0, pQuestTable[v4-1], 0, 0, 0);//(&dword_722F10)[4 * v4], 0, 0, 0);
575 v6 = pAutonoteFont->CalcTextHeight(v5, &a1, 1, 0); 572 v6 = pAutonoteFont->CalcTextHeight(v5, &a1, 1, 0);
576 v7 = a1.uFrameY + v6; 573 v7 = a1.uFrameY + v6;
577 if ( (signed int)(a1.uFrameY + v6) > (signed int)a1.uFrameHeight ) 574 if ( (signed int)(a1.uFrameY + v6) > (signed int)a1.uFrameHeight )
634 v24 = pTex_tab_an_6b__zoom_on; 631 v24 = pTex_tab_an_6b__zoom_on;
635 v17 = pViewport->uViewportTL_Y + 1; 632 v17 = pViewport->uViewportTL_Y + 1;
636 v0 = pViewport->uViewportTL_X + 398; 633 v0 = pViewport->uViewportTL_X + 398;
637 } 634 }
638 pRenderer->DrawTextureTransparent(v0, v17, v24); 635 pRenderer->DrawTextureTransparent(v0, v17, v24);
639 if ( dword_506544 || dword_506528 + awards_count >= awards_count2 ) 636 if ( dword_506544 || dword_506528 + num_achieved_awards >= num_achieved_awards_2 )
640 { 637 {
641 v25 = pTex_tab_an_7a__zoot_off; 638 v25 = pTex_tab_an_7a__zoot_off;
642 v18 = pViewport->uViewportTL_Y + 38; 639 v18 = pViewport->uViewportTL_Y + 38;
643 v1 = pViewport->uViewportTL_X + 407; 640 v1 = pViewport->uViewportTL_X + 407;
644 } 641 }
808 a1.uFrameHeight = 264; 805 a1.uFrameHeight = 264;
809 a1.uFrameZ = 407; 806 a1.uFrameZ = 407;
810 a1.uFrameW = 333; 807 a1.uFrameW = 333;
811 if ( v31 ) 808 if ( v31 )
812 { 809 {
813 awards_count2 = 0; 810 num_achieved_awards_2 = 0;
814 dword_506528 = 0; 811 dword_506528 = 0;
815 dword_50651C = 0; 812 dword_50651C = 0;
816 awards_count = 0; 813 num_achieved_awards = 0;
817 v8 = 0; 814 v8 = 0;
818 do 815 do
819 { 816 {
820 //if ( dword_72371C[2 * v8] == dword_506568 ) 817 //if ( dword_72371C[2 * v8] == dword_506568 )
821 if ( pAutonoteTxt[v8-1].eType == dword_506568 ) 818 if ( pAutonoteTxt[v8-1].eType == dword_506568 )
824 v32 = (char *)pAutonoteTxt[v8-1].pText; 821 v32 = (char *)pAutonoteTxt[v8-1].pText;
825 if ( (short)v8 ) 822 if ( (short)v8 )
826 { 823 {
827 if ( (unsigned __int16)_449B57_test_bit(pParty->_autonote_bits, v8) && v32 ) 824 if ( (unsigned __int16)_449B57_test_bit(pParty->_autonote_bits, v8) && v32 )
828 { 825 {
829 v9 = awards_count++; 826 v9 = num_achieved_awards++;
830 achievedAwardsIndex[v9] = (signed __int16)v8; 827 achieved_awards[v9] = (AwardType)v8;
831 } 828 }
832 } 829 }
833 } 830 }
834 ++v8; 831 ++v8;
835 } 832 }
836 while ( v8 < 196 ); 833 while ( v8 < 196 );
837 awards_count2 = awards_count; 834 num_achieved_awards_2 = num_achieved_awards;
838 } 835 }
839 else 836 else
840 { 837 {
841 if ( dword_506544 ) 838 if ( dword_506544 )
842 { 839 {
843 v10 = awards_count + dword_506528; 840 v10 = num_achieved_awards + dword_506528;
844 if ( awards_count + dword_506528 < awards_count2 ) 841 if ( num_achieved_awards + dword_506528 < num_achieved_awards_2 )
845 { 842 {
846 v11 = dword_50651C++; 843 v11 = dword_50651C++;
847 byte_506130[v11] = awards_count; 844 byte_506130[v11] = num_achieved_awards;
848 dword_506528 = v10; 845 dword_506528 = v10;
849 pAudioPlayer->PlaySound((SoundID)230, 0, 0, -1, 0, 0, 0, 0); 846 pAudioPlayer->PlaySound((SoundID)230, 0, 0, -1, 0, 0, 0, 0);
850 } 847 }
851 } 848 }
852 if ( dword_506548 && dword_50651C ) 849 if ( dword_506548 && dword_50651C )
853 { 850 {
854 --dword_50651C; 851 --dword_50651C;
855 dword_506528 -= (unsigned __int8)byte_506130[dword_50651C]; 852 dword_506528 -= (unsigned __int8)byte_506130[dword_50651C];
856 pAudioPlayer->PlaySound((SoundID)230, 0, 0, -1, 0, 0, 0, 0); 853 pAudioPlayer->PlaySound((SoundID)230, 0, 0, -1, 0, 0, 0, 0);
857 } 854 }
858 if ( !awards_count || dword_506528 < 1 ) 855 if ( !num_achieved_awards || dword_506528 < 1 )
859 { 856 {
860 dword_506528 = 0; 857 dword_506528 = 0;
861 dword_50651C = 0; 858 dword_50651C = 0;
862 } 859 }
863 } 860 }
864 v12 = dword_506528; 861 v12 = dword_506528;
865 dword_50652C = 0; 862 dword_50652C = 0;
866 dword_506544 = 0; 863 dword_506544 = 0;
867 dword_506548 = 0; 864 dword_506548 = 0;
868 awards_count = 0; 865 num_achieved_awards = 0;
869 dword_506530 = 0; 866 dword_506530 = 0;
870 dword_506534 = 0; 867 dword_506534 = 0;
871 dword_506538 = 0; 868 dword_506538 = 0;
872 dword_50653C = 0; 869 dword_50653C = 0;
873 dword_506540 = 0; 870 dword_506540 = 0;
874 while ( v12 < awards_count2 ) 871 while ( v12 < num_achieved_awards_2 )
875 { 872 {
876 v13 = achievedAwardsIndex[v12]; 873 v13 = achieved_awards[v12];
877 ++awards_count; 874 ++num_achieved_awards;
878 //v14 = (&dword_723718_autonote_related)[8 * v13]; 875 //v14 = (&dword_723718_autonote_related)[8 * v13];
879 v14 = pAutonoteTxt[v13-1].pText; 876 v14 = pAutonoteTxt[v13-1].pText;
880 //a1.DrawText(pAutonoteFont, 1, 0, 0, (&dword_723718_autonote_related)[8 * v13], 0, 0, 0); 877 //a1.DrawText(pAutonoteFont, 1, 0, 0, (&dword_723718_autonote_related)[8 * v13], 0, 0, 0);
881 a1.DrawText(pAutonoteFont, 1, 0, 0, pAutonoteTxt[v13-1].pText, 0, 0, 0); 878 a1.DrawText(pAutonoteFont, 1, 0, 0, pAutonoteTxt[v13-1].pText, 0, 0, 0);
882 v15 = pAutonoteFont->CalcTextHeight(v14, &a1, 1, 0); 879 v15 = pAutonoteFont->CalcTextHeight(v14, &a1, 1, 0);
1200 } 1197 }
1201 } 1198 }
1202 } 1199 }
1203 else 1200 else
1204 { 1201 {
1205 black = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0, 0, 0); 1202 black = TargetColor(0, 0, 0);
1206 teal = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0, 0xFFu, 0xFFu); 1203 teal = TargetColor(0, 0xFFu, 0xFFu);
1207 v7 = pIndoor->pMapOutlines; 1204 v7 = pIndoor->pMapOutlines;
1208 uNumBlueFacesInBLVMinimap = 0; 1205 uNumBlueFacesInBLVMinimap = 0;
1209 v8 = pIndoor->pMapOutlines->uNumOutlines == 0; 1206 v8 = pIndoor->pMapOutlines->uNumOutlines == 0;
1210 v9 = pIndoor->pMapOutlines->uNumOutlines < 0; 1207 v9 = pIndoor->pMapOutlines->uNumOutlines < 0;
1211 screenWidth = 0; 1208 screenWidth = 0;
1382 else 1379 else
1383 v50 = 1; 1380 v50 = 1;
1384 } 1381 }
1385 pRenderer->DrawTransparentRedShade(v47, v49, (Texture *)(pTextureIDs_pMapDirs[v50] != -1 ? (int)&pIcons_LOD->pTextures[pTextureIDs_pMapDirs[v50]] : 0)); 1382 pRenderer->DrawTransparentRedShade(v47, v49, (Texture *)(pTextureIDs_pMapDirs[v50] != -1 ? (int)&pIcons_LOD->pTextures[pTextureIDs_pMapDirs[v50]] : 0));
1386 } 1383 }
1387 result = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); 1384 result = TargetColor(0xFFu, 0xFFu, 0xFFu);
1388 v95 = 0; 1385 v95 = 0;
1389 v86 = result; 1386 v86 = result;
1390 if ( (signed int)uNumLevelDecorations > 0 ) 1387 if ( (signed int)uNumLevelDecorations > 0 )
1391 { 1388 {
1392 screenWidth = (unsigned int)&pLevelDecorations[0].vPosition; 1389 screenWidth = (unsigned int)&pLevelDecorations[0].vPosition;
1449 pPalette_16 = (unsigned __int16 *)(v60 >> 16); 1446 pPalette_16 = (unsigned __int16 *)(v60 >> 16);
1450 v62 = (int)v61 << 16; 1447 v62 = (int)v61 << 16;
1451 teal = v60 >> 16; 1448 teal = v60 >> 16;
1452 v63 = (signed __int16)v61; 1449 v63 = (signed __int16)v61;
1453 a4a = map_texture_16; 1450 a4a = map_texture_16;
1454 result = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xCu, 0xCu, 0xCu); 1451 result = TargetColor(0xCu, 0xCu, 0xCu);
1455 screenCenter_X = 0; 1452 screenCenter_X = 0;
1456 for ( i = result; screenCenter_X < (signed int)v95; result = screenCenter_X ) 1453 for ( i = result; screenCenter_X < (signed int)v95; result = screenCenter_X )
1457 { 1454 {
1458 a5a = 0; 1455 a5a = 0;
1459 if ( screenCenterY > 0 ) 1456 if ( screenCenterY > 0 )
1521 1518
1522 1519
1523 1520
1524 1521
1525 //----- (00413CC6) -------------------------------------------------------- 1522 //----- (00413CC6) --------------------------------------------------------
1526 void __thiscall SellectDrawBook(unsigned int uBook) 1523 void DrawCurrentBook(unsigned int uBook)
1527 { 1524 {
1528 enum WindowType pWindowType; // esi@1 1525 pRenderer->DrawTextureIndexed(471, 445, pIcons_LOD->GetTexture(uExitCancelTextureId));
1529 1526 switch ((enum WindowType)uBook)
1530 pWindowType = (enum WindowType)uBook; 1527 {
1531 pRenderer->DrawTextureIndexed(471u, 445u, (Texture *)(uExitCancelTextureId != -1 ? (int)&pIcons_LOD->pTextures[uExitCancelTextureId] : 0)); 1528 case WINDOW_Lloyd: DrawLloydBeaconsScreen(); break;
1532 switch ( pWindowType ) 1529 case WINDOW_TownPortal: DrawTownPortalScreen(); break;
1533 { 1530 case WINDOW_QuestBook: DrawBook_Quests(); break;
1534 case WINDOW_Lloyd: // 177 1531 case WINDOW_AutonotesBook: DrawBook_Autonotes(); break;
1535 DrawLloydBeaconsScreen(); 1532 case WINDOW_MapsBook: DrawBook_Maps(); break;
1536 break; 1533 case WINDOW_CalendarBook: DrawBook_Calendar(); break;
1537 case WINDOW_TownPortal: //195 1534 case WINDOW_HistoryBook: DrawBook_History(); break;
1538 DrawTownPortalScreen();
1539 break;
1540 case WINDOW_QuestBook: //200
1541 DrawBook_Quests();
1542 break;
1543 case WINDOW_AutonotesBook: //201
1544 DrawBook_Autonotes();
1545 break;
1546 case WINDOW_MapsBook://202
1547 DrawBook_Maps();
1548 break;
1549 case WINDOW_CalendarBook://203
1550 DrawBook_Calendar();
1551 break;
1552 case WINDOW_HistoryBook://224
1553 DrawBook_History();
1554 break;
1555 } 1535 }
1556 } 1536 }