comparison GUIWindow.cpp @ 949:c0d0656aa662

Awards
author Nomad
date Wed, 01 May 2013 20:04:24 +0200
parents 5a2dbb00c399
children 9a5db2cf999a
comparison
equal deleted inserted replaced
948:5a2dbb00c399 949:c0d0656aa662
19 #include "StorylineTextTable.h" 19 #include "StorylineTextTable.h"
20 #include "Events2D.h" 20 #include "Events2D.h"
21 #include "UIHouses.h" 21 #include "UIHouses.h"
22 #include "texts.h" 22 #include "texts.h"
23 #include "Autonotes.h" 23 #include "Autonotes.h"
24 #include "Awards.h"
24 25
25 26
26 #include "mm7_data.h" 27 #include "mm7_data.h"
27 28
28 29
135 { 136 {
136 v11 = __PAIR__(v10, v9) - pParty->uTimePlayed;//!!! 137 v11 = __PAIR__(v10, v9) - pParty->uTimePlayed;//!!!
137 v12 = v20 * LOBYTE(v1->uFontHeight) + 40; 138 v12 = v20 * LOBYTE(v1->uFontHeight) + 40;
138 v13 = *v16; 139 v13 = *v16;
139 ++v20; 140 ++v20;
140 v14 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat( 141 v14 = TargetColor(
141 (unsigned __int8)*(v8 - 1), 142 (unsigned __int8)*(v8 - 1),
142 (unsigned __int8)*v8, 143 (unsigned __int8)*v8,
143 (unsigned __int8)v8[1]); 144 (unsigned __int8)v8[1]);
144 v2->DrawText(a2, 52, v12, v14, v13, 0, 0, 0); 145 v2->DrawText(a2, 52, v12, v14, v13, 0, 0, 0);
145 LOBYTE(v9) = sub_41D20D_buff_remaining_time_string(v12, v2, v11, a2); 146 LOBYTE(v9) = sub_41D20D_buff_remaining_time_string(v12, v2, v11, a2);
222 pPlayer->field_1AA2 = v15->uTextureID - 1; 223 pPlayer->field_1AA2 = v15->uTextureID - 1;
223 v13 = pTextures_PlayerFaces[(unsigned int)ptr_1C][v15->uTextureID-1]; 224 v13 = pTextures_PlayerFaces[(unsigned int)ptr_1C][v15->uTextureID-1];
224 } 225 }
225 226
226 pRenderer->DrawTextureTransparent(uFrameX + 24, uFrameY + 24, v13); 227 pRenderer->DrawTextureTransparent(uFrameX + 24, uFrameY + 24, v13);
227 v16 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu); 228 v16 = TargetColor(0xFFu, 0xFFu, 0x9Bu);
228 sprintf(pTmpBuf, "\f%05d", v16); 229 sprintf(pTmpBuf, "\f%05d", v16);
229 sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[429], pPlayer->pName, pClassNames[pPlayer->classType]); 230 sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[429], pPlayer->pName, pClassNames[pPlayer->classType]);
230 strcat(pTmpBuf, pTmpBuf2); 231 strcat(pTmpBuf, pTmpBuf2);
231 strcat(pTmpBuf, "\f00000\n"); 232 strcat(pTmpBuf, "\f00000\n");
232 v20 = UI_GetHealthManaStringColor(pPlayer->sHealth, pPlayer->GetMaxHealth()); 233 v20 = UI_GetHealthManaStringColor(pPlayer->sHealth, pPlayer->GetMaxHealth());
256 auto buff = pPlayer->pPlayerBuffs + i; 257 auto buff = pPlayer->pPlayerBuffs + i;
257 if (buff->uExpireTime > 0) 258 if (buff->uExpireTime > 0)
258 { 259 {
259 v35 = buff->uExpireTime - pParty->uTimePlayed; 260 v35 = buff->uExpireTime - pParty->uTimePlayed;
260 v36 = uFramesetIDa++ * pFontComic->uFontHeight + 134; 261 v36 = uFramesetIDa++ * pFontComic->uFontHeight + 134;
261 v38 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat( 262 v38 = TargetColor(
262 _4E2AD8_ui_colors[i * 3], 263 _4E2AD8_ui_colors[i * 3],
263 _4E2AD8_ui_colors[i * 3 + 1], 264 _4E2AD8_ui_colors[i * 3 + 1],
264 _4E2AD8_ui_colors[i * 3 + 2]); 265 _4E2AD8_ui_colors[i * 3 + 2]);
265 DrawText(pFontComic, 52, v36, v38, aSpellNames[20 + i], 0, 0, 0); 266 DrawText(pFontComic, 52, v36, v38, aSpellNames[20 + i], 0, 0, 0);
266 sub_41D20D_buff_remaining_time_string(v36, this, v35, pFontComic); 267 sub_41D20D_buff_remaining_time_string(v36, this, v35, pFontComic);
468 v1 = this; 469 v1 = this;
469 pAudioPlayer->StopChannels(-1, -1); 470 pAudioPlayer->StopChannels(-1, -1);
470 InitializeBookFonts(); 471 InitializeBookFonts();
471 v1->CreateButton(0x1DBu, 0x1BDu, 0x9Eu, 0x22u, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[79], 0); // Close 472 v1->CreateButton(0x1DBu, 0x1BDu, 0x9Eu, 0x22u, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[79], 0); // Close
472 pCurrentScreen = SCREEN_BOOKS; 473 pCurrentScreen = SCREEN_BOOKS;
473 awards_count2 = 0; 474 num_achieved_awards_2 = 0;
474 dword_506528 = 0; 475 dword_506528 = 0;
475 dword_50651C = 0; 476 dword_50651C = 0;
476 awards_count = 0; 477 num_achieved_awards = 0;
477 switch (v1->par1C) 478 switch (v1->par1C)
478 { 479 {
479 case WINDOW_Lloyd:{ 480 case WINDOW_Lloyd:{
480 byte_506360 = 0; 481 byte_506360 = 0;
481 pTexture_CurrentBook = pIcons_LOD->LoadTexturePtr("lb_bordr", TEXTURE_16BIT_PALETTE); 482 pTexture_CurrentBook = pIcons_LOD->LoadTexturePtr("lb_bordr", TEXTURE_16BIT_PALETTE);
560 pTex_tab_an_6b__zoom_on, 0); 561 pTex_tab_an_6b__zoom_on, 0);
561 pBtn_Book_2 = v1->CreateButton(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 38, 562 pBtn_Book_2 = v1->CreateButton(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 38,
562 pTex_tab_an_7b__zoot_on->uTextureHeight, pTex_tab_an_7b__zoot_on->uTextureHeight, 563 pTex_tab_an_7b__zoot_on->uTextureHeight, pTex_tab_an_7b__zoot_on->uTextureHeight,
563 1, 0, UIMSG_AutonotesBook, 0xAu, 0, pGlobalTXT_LocalizationStrings[193],// "Scroll Down" 564 1, 0, UIMSG_AutonotesBook, 0xAu, 0, pGlobalTXT_LocalizationStrings[193],// "Scroll Down"
564 pTex_tab_an_7b__zoot_on, 0); 565 pTex_tab_an_7b__zoot_on, 0);
565 awards_count = 0; 566 num_achieved_awards = 0;
566 memset(&achievedAwardsIndex, 0, 4000); 567 memset(achieved_awards, 0, 4000);
567 for ( i = dword_506528; i < 512; ++i ) 568 for ( i = dword_506528; i < 512; ++i )
568 { 569 {
569 v14 = (char *)pQuestTable[i-1];//(&dword_722F10)[4 * i]; 570 v14 = (char *)pQuestTable[i-1];//(&dword_722F10)[4 * i];
570 if ( _449B57_test_bit(pParty->_quest_bits, i) && v14 ) 571 if ( _449B57_test_bit(pParty->_quest_bits, i) && v14 )
571 { 572 {
572 v15 = awards_count++; 573 v15 = num_achieved_awards++;
573 achievedAwardsIndex[v15] = i; 574 achieved_awards[v15] = (AwardType)i;
574 } 575 }
575 } 576 }
576 v12 = awards_count; 577 v12 = num_achieved_awards;
577 awards_count = 0; 578 num_achieved_awards = 0;
578 awards_count2 = v12; 579 num_achieved_awards_2 = v12;
579 } 580 }
580 break; 581 break;
581 case WINDOW_AutonotesBook: 582 case WINDOW_AutonotesBook:
582 { 583 {
583 pTexture_AutonotesBook = pIcons_LOD->LoadTexturePtr("sbautnot", TEXTURE_16BIT_PALETTE); 584 pTexture_AutonotesBook = pIcons_LOD->LoadTexturePtr("sbautnot", TEXTURE_16BIT_PALETTE);
608 pBtn_Autonotes_Misc = v1->CreateButton(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 264, 50, 34, 1, 0, UIMSG_AutonotesBook, 6, 0, pGlobalTXT_LocalizationStrings[123], pTexture_506374, 0); // "Miscellaneous Notes" 609 pBtn_Autonotes_Misc = v1->CreateButton(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 264, 50, 34, 1, 0, UIMSG_AutonotesBook, 6, 0, pGlobalTXT_LocalizationStrings[123], pTexture_506374, 0); // "Miscellaneous Notes"
609 pBtn_Autonotes_Instructors = v1->CreateButton(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 302, 50, 34, 1, 0, UIMSG_AutonotesBook, 7, 0, pGlobalTXT_LocalizationStrings[662], pTexture_50636C, 0); // "Instructors" 610 pBtn_Autonotes_Instructors = v1->CreateButton(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 302, 50, 34, 1, 0, UIMSG_AutonotesBook, 7, 0, pGlobalTXT_LocalizationStrings[662], pTexture_50636C, 0); // "Instructors"
610 611
611 v9 = pBtn_Autonotes_Instructors; 612 v9 = pBtn_Autonotes_Instructors;
612 v10 = dword_506528; 613 v10 = dword_506528;
613 awards_count = 0; 614 num_achieved_awards = 0;
614 while ( v10 < 196 ) 615 while ( v10 < 196 )
615 { 616 {
616 if ( dword_506568 == pAutonoteTxt[v10-1].eType)//dword_72371C[2 * v10] ) 617 if ( dword_506568 == pAutonoteTxt[v10-1].eType)//dword_72371C[2 * v10] )
617 { 618 {
618 //v25 = (&dword_723718_autonote_related)[8 * (signed __int16)v10]; 619 //v25 = (&dword_723718_autonote_related)[8 * (signed __int16)v10];
619 v25 = (char *)pAutonoteTxt[v10-1].pText; 620 v25 = (char *)pAutonoteTxt[v10-1].pText;
620 if ( (short)v10 ) 621 if ( (short)v10 )
621 { 622 {
622 if ( _449B57_test_bit(pParty->_autonote_bits, v10) && v25 ) 623 if ( _449B57_test_bit(pParty->_autonote_bits, v10) && v25 )
623 { 624 {
624 v11 = awards_count++; 625 v11 = num_achieved_awards++;
625 achievedAwardsIndex[v11] = (signed __int16)v10; 626 achieved_awards[v11] = (AwardType)v10;
626 } 627 }
627 } 628 }
628 } 629 }
629 ++v10; 630 ++v10;
630 } 631 }
677 pTex_tab_an_7a__zoot_off = pIcons_LOD->LoadTexturePtr("tab-an-7a", TEXTURE_16BIT_PALETTE); 678 pTex_tab_an_7a__zoot_off = pIcons_LOD->LoadTexturePtr("tab-an-7a", TEXTURE_16BIT_PALETTE);
678 679
679 pBtn_Book_1 = v1->CreateButton(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 1, pTex_tab_an_6b__zoom_on->uTextureWidth, pTex_tab_an_6b__zoom_on->uTextureHeight, 1, 0, UIMSG_AutonotesBook, 11, 0, pGlobalTXT_LocalizationStrings[192], pTex_tab_an_6b__zoom_on, 0); 680 pBtn_Book_1 = v1->CreateButton(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 1, pTex_tab_an_6b__zoom_on->uTextureWidth, pTex_tab_an_6b__zoom_on->uTextureHeight, 1, 0, UIMSG_AutonotesBook, 11, 0, pGlobalTXT_LocalizationStrings[192], pTex_tab_an_6b__zoom_on, 0);
680 pBtn_Book_2 = v1->CreateButton(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 38, pTex_tab_an_7b__zoot_on->uTextureHeight, pTex_tab_an_7b__zoot_on->uTextureHeight, 1, 0, UIMSG_AutonotesBook, 10, 0, pGlobalTXT_LocalizationStrings[193], pTex_tab_an_7b__zoot_on, 0); 681 pBtn_Book_2 = v1->CreateButton(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 38, pTex_tab_an_7b__zoot_on->uTextureHeight, pTex_tab_an_7b__zoot_on->uTextureHeight, 1, 0, UIMSG_AutonotesBook, 10, 0, pGlobalTXT_LocalizationStrings[193], pTex_tab_an_7b__zoot_on, 0);
681 682
682 awards_count = 0; 683 num_achieved_awards = 0;
683 v26.uFrameX = 48; 684 v26.uFrameX = 48;
684 v26.uFrameY = 70; 685 v26.uFrameY = 70;
685 v26.uFrameWidth = 360; 686 v26.uFrameWidth = 360;
686 v26.uFrameHeight = 264; 687 v26.uFrameHeight = 264;
687 v2 = LOBYTE(pAutonoteFont->uFontHeight) - 3; 688 v2 = LOBYTE(pAutonoteFont->uFontHeight) - 3;
688 v26.uFrameZ = 407; 689 v26.uFrameZ = 407;
689 v26.uFrameHeight = v2 * 264 / v2; 690 v26.uFrameHeight = v2 * 264 / v2;
690 v26.uFrameW = v26.uFrameHeight + 69; 691 v26.uFrameW = v26.uFrameHeight + 69;
691 memset(&achievedAwardsIndex, 0, 4000); 692 memset(&achieved_awards, 0, 4000);
692 memset(byte_5C6D50, 0, 0x64u); 693 memset(byte_5C6D50, 0, 0x64u);
693 if ( dword_506528 < 29 ) 694 if ( dword_506528 < 29 )
694 { 695 {
695 v3 = (__int64 *)&pParty->field_3C.field_4F0[2 * dword_506528]; 696 v3 = (__int64 *)&pParty->field_3C.field_4F0[2 * dword_506528];
696 for(int i=dword_506528+1;i<dword_506528+31;i++) 697 for(int i=dword_506528+1;i<dword_506528+31;i++)
704 v6 = pAutonoteFont->CalcTextHeight(v5, &v26, 1, 0); 705 v6 = pAutonoteFont->CalcTextHeight(v5, &v26, 1, 0);
705 v7 = (v6 - 3) / (signed int)v26.uFrameHeight; 706 v7 = (v6 - 3) / (signed int)v26.uFrameHeight;
706 v8 = v7 + 1; 707 v8 = v7 + 1;
707 if ( (signed int)v7 + 1 > 0 ) 708 if ( (signed int)v7 + 1 > 0 )
708 { 709 {
709 memset32((char *)&achievedAwardsIndex + 4 * awards_count , i, v8); 710 memset32((char *)&achieved_awards + 4 * num_achieved_awards , i, v8);
710 do 711 do
711 { 712 {
712 LODWORD(v7) = awards_count++; 713 LODWORD(v7) = num_achieved_awards++;
713 byte_5C6D50[(int)v7] = BYTE4(v7); 714 byte_5C6D50[(int)v7] = BYTE4(v7);
714 ++HIDWORD(v7); 715 ++HIDWORD(v7);
715 } 716 }
716 while ( SHIDWORD(v7) < (signed int)v8 ); 717 while ( SHIDWORD(v7) < (signed int)v8 );
717 } 718 }
1003 if ( !window_SpeakInHouse ) 1004 if ( !window_SpeakInHouse )
1004 return; 1005 return;
1005 memcpy(&pWindow, this, sizeof(pWindow)); 1006 memcpy(&pWindow, this, sizeof(pWindow));
1006 pWindow.uFrameWidth -= 18; 1007 pWindow.uFrameWidth -= 18;
1007 pWindow.uFrameZ -= 18; 1008 pWindow.uFrameZ -= 18;
1008 pWhiteColor = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); 1009 pWhiteColor = TargetColor(0xFFu, 0xFFu, 0xFFu);
1009 pColor2 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0x15u, 0x99u, 0xE9u); 1010 pColor2 = TargetColor(0x15u, 0x99u, 0xE9u);
1010 pRenderer->DrawTextureIndexed(0x1DDu, 0, pTexture_Dialogue_Background); 1011 pRenderer->DrawTextureIndexed(0x1DDu, 0, pTexture_Dialogue_Background);
1011 pRenderer->DrawTextureTransparent(0x1D4u, 0, &pIcons_LOD->pTextures[uTextureID_right_panel_loop]); 1012 pRenderer->DrawTextureTransparent(0x1D4u, 0, &pIcons_LOD->pTextures[uTextureID_right_panel_loop]);
1012 if ( pDialogueNPCCount != uNumDialogueNPCPortraits || !uHouse_ExitPic ) 1013 if ( pDialogueNPCCount != uNumDialogueNPCPortraits || !uHouse_ExitPic )
1013 { 1014 {
1014 pDialogWindow.uFrameWidth = 130; 1015 pDialogWindow.uFrameWidth = 130;
1263 else 1264 else
1264 v11 = pGlobalTXT_LocalizationStrings[438]; //"Seconds" 1265 v11 = pGlobalTXT_LocalizationStrings[438]; //"Seconds"
1265 sprintf(pTmpBuf2, "%d %s ", v17, v11); 1266 sprintf(pTmpBuf2, "%d %s ", v17, v11);
1266 strcat(pTmpBuf, pTmpBuf2); 1267 strcat(pTmpBuf, pTmpBuf2);
1267 } 1268 }
1268 v12 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu); 1269 v12 = TargetColor(0xFFu, 0xFFu, 0x9Bu);
1269 v13 = pFontArrus->CalcTextHeight(pTmpBuf, v15, 0, 0); 1270 v13 = pFontArrus->CalcTextHeight(pTmpBuf, v15, 0, 0);
1270 v15->DrawTitleText(pFontArrus, 0, (212 - v13) / 2 + 101, v12, pTmpBuf, 3u); 1271 v15->DrawTitleText(pFontArrus, 0, (212 - v13) / 2 + 101, v12, pTmpBuf, 3u);
1271 } 1272 }
1272 1273
1273 1274