comparison UI/UICharacter.cpp @ 1460:ff2118028c71

renaming _guilds_member_bits to _achieved_awards_bits
author Gloval
date Wed, 21 Aug 2013 20:58:36 +0400
parents bfe342ae0c1f
children 845907a747d3
comparison
equal deleted inserted replaced
1457:9dc33590f93e 1460:ff2118028c71
561 } 561 }
562 562
563 //----- (0041A000) -------------------------------------------------------- 563 //----- (0041A000) --------------------------------------------------------
564 void CharacterUI_AwardsTab_Draw(Player *player) 564 void CharacterUI_AwardsTab_Draw(Player *player)
565 { 565 {
566 unsigned int result; // eax@1 566 int items_per_page; // eax@1
567 char *v6; // ebx@15 567 char *v6; // ebx@15
568 char Source[100]; // [sp+Ch] [bp-C4h]@1 568 char Source[100]; // [sp+Ch] [bp-C4h]@1
569 GUIWindow awards_window; // [sp+70h] [bp-60h]@1 569 GUIWindow awards_window; // [sp+70h] [bp-60h]@1
570 570
571 pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->LoadTexturePtr("fr_award", TEXTURE_16BIT_PALETTE)); 571 pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->LoadTexturePtr("fr_award", TEXTURE_16BIT_PALETTE));
573 sprintfex(Source, pGlobalTXT_LocalizationStrings[LOCSTR_S_THE_S], player->pName, pClassNames[player->classType]); 573 sprintfex(Source, pGlobalTXT_LocalizationStrings[LOCSTR_S_THE_S], player->pName, pClassNames[player->classType]);
574 strcat(pTmpBuf.data(), Source); 574 strcat(pTmpBuf.data(), Source);
575 strcat(pTmpBuf.data(), "\f00000"); 575 strcat(pTmpBuf.data(), "\f00000");
576 576
577 pGUIWindow_CurrentMenu->DrawText(pFontArrus, 24, 18, 0, pTmpBuf.data(), 0, 0, 0); 577 pGUIWindow_CurrentMenu->DrawText(pFontArrus, 24, 18, 0, pTmpBuf.data(), 0, 0, 0);
578 result = books_primary_item_per_page; 578 items_per_page = books_primary_item_per_page;
579 awards_window.uFrameX = 12; 579 awards_window.uFrameX = 12;
580 awards_window.uFrameY = 48; 580 awards_window.uFrameY = 48;
581 awards_window.uFrameWidth = 424; 581 awards_window.uFrameWidth = 424;
582 awards_window.uFrameHeight = 290; 582 awards_window.uFrameHeight = 290;
583 awards_window.uFrameZ = 435; 583 awards_window.uFrameZ = 435;
584 awards_window.uFrameW = 337; 584 awards_window.uFrameW = 337;
585 if (BtnDown_flag && num_achieved_awards + books_primary_item_per_page < full_num_items_in_book) 585 if (BtnDown_flag && num_achieved_awards + books_primary_item_per_page < full_num_items_in_book)
586 result = books_primary_item_per_page++ + 1; 586 items_per_page = books_primary_item_per_page++ + 1;
587 if (BtnUp_flag && result) 587 if (BtnUp_flag && items_per_page)
588 { 588 {
589 --result; 589 --items_per_page;
590 books_primary_item_per_page = result; 590 books_primary_item_per_page = items_per_page;
591 } 591 }
592 592
593 if ( books_page_number < 0 ) 593 if ( books_page_number < 0 )
594 { 594 {
595 result += num_achieved_awards; 595 items_per_page += num_achieved_awards;
596 books_primary_item_per_page = result; 596 books_primary_item_per_page = items_per_page;
597 if ( (signed int)(num_achieved_awards + result) > full_num_items_in_book ) 597 if ( (signed int)(num_achieved_awards + items_per_page) > full_num_items_in_book )
598 { 598 {
599 result = full_num_items_in_book - num_achieved_awards; 599 items_per_page = full_num_items_in_book - num_achieved_awards;
600 books_primary_item_per_page = result; 600 books_primary_item_per_page = items_per_page;
601 } 601 }
602 } 602 }
603 else if ( books_page_number > 0 ) 603 else if ( books_page_number > 0 )
604 { 604 {
605 result -= num_achieved_awards; 605 items_per_page -= num_achieved_awards;
606 books_primary_item_per_page = result; 606 books_primary_item_per_page = items_per_page;
607 if ( (result & 0x80000000u) != 0 ) 607 if ( items_per_page < 0 )
608 { 608 {
609 result = 0; 609 items_per_page = 0;
610 books_primary_item_per_page = result; 610 books_primary_item_per_page = items_per_page;
611 } 611 }
612 } 612 }
613 BtnDown_flag = 0; 613 BtnDown_flag = 0;
614 BtnUp_flag = 0; 614 BtnUp_flag = 0;
615 num_achieved_awards = 0; 615 num_achieved_awards = 0;
616 books_page_number = 0; 616 books_page_number = 0;
617 617
618 for ( int i = result; i < full_num_items_in_book; ++i) 618 for ( int i = items_per_page; i < full_num_items_in_book; ++i)
619 { 619 {
620 v6 = (char *)pAwards[achieved_awards[i]].pText;//(char *)dword_723E80_award_related[v20 / 4]; 620 v6 = (char *)pAwards[achieved_awards[i]].pText;//(char *)dword_723E80_award_related[v20 / 4];
621 pTmpBuf[0] = 0; 621 pTmpBuf[0] = 0;
622 switch (achieved_awards[i]) 622 switch (achieved_awards[i])
623 { 623 {
2343 } 2343 }
2344 2344
2345 //----- (00419100) -------------------------------------------------------- 2345 //----- (00419100) --------------------------------------------------------
2346 void FillAwardsData() 2346 void FillAwardsData()
2347 { 2347 {
2348 auto pPlayer = pPlayers[uActiveCharacter]; 2348 Player* pPlayer = pPlayers[uActiveCharacter];
2349 2349
2350 memset(achieved_awards.data(), 0, 4000); 2350 memset(achieved_awards.data(), 0, 4000);
2351 num_achieved_awards = 0; 2351 num_achieved_awards = 0;
2352 2352
2353 memset(pTmpBuf2.data(), 0, 0x7D0u); 2353 memset(pTmpBuf2.data(), 0, 0x7D0u);
2354 BtnDown_flag = 0; 2354 BtnDown_flag = 0;
2355 BtnUp_flag = 0; 2355 BtnUp_flag = 0;
2356 books_page_number = 0; 2356 books_page_number = 0;
2357 books_primary_item_per_page = 0; 2357 books_primary_item_per_page = 0;
2358 for (int i = 0; i < 105; ++i) 2358 for (int i = 1; i < 105; ++i)
2359 { 2359 {
2360 if ( _449B57_test_bit(pPlayer->_guilds_member_bits, i) && pAwards[i].pText ) 2360 if ( _449B57_test_bit(pPlayer->_achieved_awards_bits, i) && pAwards[i].pText )
2361 { 2361 {
2362 achieved_awards[num_achieved_awards++] = (AwardType)i; 2362 achieved_awards[num_achieved_awards++] = (AwardType)i;
2363 } 2363 }
2364 } 2364 }
2365 full_num_items_in_book = num_achieved_awards; 2365 full_num_items_in_book = num_achieved_awards;
2366 num_achieved_awards = 0; 2366 num_achieved_awards = 0;
2367 2367
2368 //sort awards index 2368 //sort awards index
2369 if (full_num_items_in_book > 0) 2369
2370 { 2370 if (full_num_items_in_book>0)
2371 std::stable_sort(achieved_awards.begin(), achieved_awards.end(), awardSort); 2371 {
2372 } 2372 for (int i = 0; i< full_num_items_in_book; ++i)
2373 achieved_awards[full_num_items_in_book+i] = (AwardType)(rand()%16);
2374 for (int i = 1; i< full_num_items_in_book; ++i)
2375 {
2376 for (int j = i; j< full_num_items_in_book; ++j)
2377 {
2378 AwardType tmp;
2379 if (pAwards[achieved_awards[j]].uPriority < pAwards[achieved_awards[i]].uPriority)
2380 {
2381 tmp= achieved_awards[j];
2382 achieved_awards[j] = achieved_awards[i];
2383 achieved_awards[i] = tmp;
2384 }
2385 }
2386 }
2387 }
2388
2389
2390 // if (full_num_items_in_book > 0)
2391 /* {
2392 std::stable_sort(achieved_awards.begin(), achieved_awards.end(), awardSort);
2393 }*/
2373 } 2394 }
2374 2395
2375 2396
2376 //----- (0043EF2B) -------------------------------------------------------- 2397 //----- (0043EF2B) --------------------------------------------------------
2377 void WetsuitOn( unsigned int uPlayerID ) 2398 void WetsuitOn( unsigned int uPlayerID )