diff UI/UICharacter.cpp @ 1465:090ff42290c4

Слияние
author Ritor1
date Mon, 26 Aug 2013 10:39:24 +0600
parents b870630761df 845907a747d3
children ec79ee6d44ce
line wrap: on
line diff
--- a/UI/UICharacter.cpp	Mon Aug 26 10:39:10 2013 +0600
+++ b/UI/UICharacter.cpp	Mon Aug 26 10:39:24 2013 +0600
@@ -43,6 +43,10 @@
 unsigned int ui_character_skillinfo_can_learn;
 unsigned int ui_character_skillinfo_can_learn_gm;
 unsigned int ui_character_skillinfo_cant_learn;
+unsigned int ui_character_condition_normal_color;
+unsigned int ui_character_condition_light_color;
+unsigned int ui_character_condition_moderate_color;
+unsigned int ui_character_condition_severe_color;
 std::array<unsigned int, 6> ui_character_award_color;
 
 unsigned int ui_game_minimap_outline_color;
@@ -107,6 +111,11 @@
   ui_character_skillinfo_can_learn = TargetColor(255, 255, 255);
   ui_character_skillinfo_can_learn_gm = TargetColor(255, 255, 0);
   ui_character_skillinfo_cant_learn = TargetColor(255, 0, 0);
+  
+  ui_character_condition_normal_color = TargetColor(255, 255, 255);
+  ui_character_condition_light_color = TargetColor(0, 255, 0);
+  ui_character_condition_moderate_color = TargetColor(225, 205, 35);
+  ui_character_condition_severe_color = TargetColor(255, 35, 0);
 
   ui_character_award_color[0] = TargetColor(248, 108, 160);
   ui_character_award_color[1] = TargetColor(112, 220, 248);
@@ -563,7 +572,7 @@
 //----- (0041A000) --------------------------------------------------------
 void CharacterUI_AwardsTab_Draw(Player *player)
 {
-  unsigned int result; // eax@1
+  int items_per_page; // eax@1
   char *v6; // ebx@15
   char Source[100]; // [sp+Ch] [bp-C4h]@1
   GUIWindow awards_window; // [sp+70h] [bp-60h]@1
@@ -575,7 +584,7 @@
   strcat(pTmpBuf.data(), "\f00000");
 
   pGUIWindow_CurrentMenu->DrawText(pFontArrus, 24, 18, 0, pTmpBuf.data(), 0, 0, 0);
-  result = books_primary_item_per_page;
+  items_per_page = books_primary_item_per_page;
   awards_window.uFrameX = 12;
   awards_window.uFrameY = 48;
   awards_window.uFrameWidth = 424;
@@ -583,31 +592,31 @@
   awards_window.uFrameZ = 435;
   awards_window.uFrameW = 337;
   if (BtnDown_flag && num_achieved_awards + books_primary_item_per_page < full_num_items_in_book)
-    result = books_primary_item_per_page++ + 1;
-  if (BtnUp_flag && result)
+    items_per_page = books_primary_item_per_page++ + 1;
+  if (BtnUp_flag && items_per_page)
   {
-    --result;
-    books_primary_item_per_page = result;
+    --items_per_page;
+    books_primary_item_per_page = items_per_page;
   }
 
   if ( books_page_number < 0 )
   {
-    result += num_achieved_awards;
-    books_primary_item_per_page = result;
-    if ( (signed int)(num_achieved_awards + result) > full_num_items_in_book )
+    items_per_page += num_achieved_awards;
+    books_primary_item_per_page = items_per_page;
+    if ( (signed int)(num_achieved_awards + items_per_page) > full_num_items_in_book )
     {
-      result = full_num_items_in_book - num_achieved_awards;
-      books_primary_item_per_page = result;
+      items_per_page = full_num_items_in_book - num_achieved_awards;
+      books_primary_item_per_page = items_per_page;
     }
   }
   else if ( books_page_number > 0 )
   {
-    result -= num_achieved_awards;
-    books_primary_item_per_page = result;
-    if ( (result & 0x80000000u) != 0 )
+    items_per_page -= num_achieved_awards;
+    books_primary_item_per_page = items_per_page;
+    if ( items_per_page < 0 )
     {
-      result = 0;
-      books_primary_item_per_page = result;
+      items_per_page = 0;
+      books_primary_item_per_page = items_per_page;
     }
   }
   BtnDown_flag = 0;
@@ -615,7 +624,7 @@
   num_achieved_awards = 0;
   books_page_number = 0;
 
-  for ( int i = result; i < full_num_items_in_book; ++i)
+  for ( int i = items_per_page; i < full_num_items_in_book; ++i)
   {
     v6 = (char *)pAwards[achieved_awards[i]].pText;//(char *)dword_723E80_award_related[v20 / 4];
     pTmpBuf[0] = 0;
@@ -667,7 +676,7 @@
   {
     case WINDOW_CharacterWindow_Stats:                                // stats
       CharacterUI_ReleaseButtons();
-      sub_419379();
+      ReleaseAwardsScrollBar();
       CharacterUI_StatsTab_Draw(player);
       pRenderer->DrawTextureIndexed(pCharacterScreen_StatsBtn->uX,
                                     pCharacterScreen_StatsBtn->uY,
@@ -680,7 +689,7 @@
         CharacterUI_ReleaseButtons();
         CharacterUI_SkillsTab_CreateButtons();
       }
-      sub_419379();
+      ReleaseAwardsScrollBar();
       CharacterUI_SkillsTab_Draw(player);
       pRenderer->DrawTextureIndexed(pCharacterScreen_SkillsBtn->uX,
                                     pCharacterScreen_SkillsBtn->uY,
@@ -689,7 +698,7 @@
 
     case WINDOW_CharacterWindow_Awards:                                // awards
       CharacterUI_ReleaseButtons();
-      sub_419379();
+      ReleaseAwardsScrollBar();
       CreateAwardsScrollBar();
       CharacterUI_AwardsTab_Draw(player);
       pRenderer->DrawTextureIndexed(pCharacterScreen_AwardsBtn->uX,
@@ -699,7 +708,7 @@
 
     case WINDOW_CharacterWindow_Inventory:                             // inventory and other
       CharacterUI_ReleaseButtons();
-      sub_419379();
+      ReleaseAwardsScrollBar();
       CharacterUI_InventoryTab_Draw(player, false);
       pRenderer->DrawTextureIndexed(pCharacterScreen_InventoryBtn->uX,
                                     pCharacterScreen_InventoryBtn->uY,
@@ -2345,31 +2354,52 @@
 //----- (00419100) --------------------------------------------------------
 void FillAwardsData()
 {
-        auto pPlayer = pPlayers[uActiveCharacter];
+    Player* pPlayer = pPlayers[uActiveCharacter];
 
-        memset(achieved_awards.data(), 0, 4000);
-        num_achieved_awards = 0;
+    memset(achieved_awards.data(), 0, 4000);
+    num_achieved_awards = 0;
 
-        memset(pTmpBuf2.data(), 0, 0x7D0u);
-        BtnDown_flag = 0;
-        BtnUp_flag = 0;
-        books_page_number = 0;
-        books_primary_item_per_page = 0;
-        for (int i = 0; i < 105; ++i)
+    memset(pTmpBuf2.data(), 0, 0x7D0u);
+    BtnDown_flag = 0;
+    BtnUp_flag = 0;
+    books_page_number = 0;
+    books_primary_item_per_page = 0;
+    for (int i = 1; i < 105; ++i)
+    {
+        if ( _449B57_test_bit(pPlayer->_achieved_awards_bits, i) && pAwards[i].pText )
         {
-            if ( _449B57_test_bit(pPlayer->_guilds_member_bits, i) && pAwards[i].pText )
-            {
-                achieved_awards[num_achieved_awards++] = (AwardType)i;
-            }
+            achieved_awards[num_achieved_awards++] = (AwardType)i;
         }
-        full_num_items_in_book = num_achieved_awards;
-        num_achieved_awards = 0;
+    }
+    full_num_items_in_book = num_achieved_awards;
+    num_achieved_awards = 0;
+
+    //sort awards index 
 
-        //sort awards index 
-        if (full_num_items_in_book > 0)
+    if (full_num_items_in_book>0)
         {
-            std::stable_sort(achieved_awards.begin(), achieved_awards.end(), awardSort);
+            for (int i = 0; i< full_num_items_in_book; ++i)
+                achieved_awards[full_num_items_in_book+i] = (AwardType)(rand()%16);
+            for (int i = 1; i< full_num_items_in_book; ++i)
+                {
+                for (int j = i; j< full_num_items_in_book; ++j)
+                    {
+                    AwardType tmp;
+                    if (pAwards[achieved_awards[j]].uPriority < pAwards[achieved_awards[i]].uPriority)
+                        {
+                        tmp= achieved_awards[j];
+                        achieved_awards[j] = achieved_awards[i];
+                        achieved_awards[i] = tmp;
+                        }
+                    }
+                }
         }
+
+
+    //  if (full_num_items_in_book > 0)
+    /* {
+        std::stable_sort(achieved_awards.begin(), achieved_awards.end(), awardSort);
+    }*/
     }
 
 
@@ -2435,7 +2465,7 @@
         }
     }
 //----- (00468F8A) --------------------------------------------------------
-void __cdecl OnPaperdollLeftClick()
+void  OnPaperdollLeftClick()
 {
   int v1; // ecx@1
   unsigned int v2; // edi@1