diff Player.cpp @ 508:00ce82758c72

Слияние
author Ritor1
date Wed, 27 Feb 2013 23:24:17 +0600
parents 9b4bdf6089af 4bd56919f075
children 7c86030324a5
line wrap: on
line diff
--- a/Player.cpp	Wed Feb 27 23:23:56 2013 +0600
+++ b/Player.cpp	Wed Feb 27 23:24:17 2013 +0600
@@ -756,7 +756,7 @@
         v7 = 1;
         goto LABEL_4;
       case 1u:
-        if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->field_152, 17)
+        if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 17)
           || _49327B(2u, a3) )
           goto LABEL_84;
         v8 = a3;
@@ -773,7 +773,7 @@
         v7 = 5;
         goto LABEL_4;
       case 5u:
-        if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->field_152, 11)
+        if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 11)
           || _49327B(6u, a3) )
           goto LABEL_84;
         v8 = a3;
@@ -794,7 +794,7 @@
         v7 = 9;
         goto LABEL_4;
       case 9u:
-        if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->field_152, 23)
+        if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 23)
           || _49327B(0xAu, a3) )
           goto LABEL_84;
         v8 = a3;
@@ -815,7 +815,7 @@
         v7 = 13;
         goto LABEL_4;
       case 0xDu:
-        if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->field_152, 41)
+        if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 41)
           || _49327B(0xEu, a3) )
           goto LABEL_84;
         v8 = a3;
@@ -836,7 +836,7 @@
         v7 = 17;
         goto LABEL_4;
       case 0x11u:
-        if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->field_152, 35)
+        if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 35)
           || _49327B(0x12u, a3) )
           goto LABEL_84;
         v8 = a3;
@@ -855,7 +855,7 @@
         v7 = 21;
         goto LABEL_4;
       case 0x15u:
-        if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->field_152, 29)
+        if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 29)
           || _49327B(0x16u, a3) )
           goto LABEL_84;
         v8 = a3;
@@ -877,7 +877,7 @@
         break;
       case 0x19u:
 LABEL_56:
-        if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)v3->field_152, 63)
+        if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)v3->_guilds_member_bits, 63)
           || _49327B(0x1Au, a3) )
           goto LABEL_84;
         v8 = a3;
@@ -898,7 +898,7 @@
         v7 = 29;
         goto LABEL_4;
       case 0x1Du:
-        if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->field_152, 69)
+        if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 69)
           || _49327B(0x1Eu, a3) )
           goto LABEL_84;
         v8 = a3;
@@ -919,7 +919,7 @@
         v7 = 33;
         goto LABEL_4;
       case 0x21u:
-        if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->field_152, 73)
+        if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 73)
           || _49327B(0x22u, a3) )
           goto LABEL_84;
         v8 = a3;
@@ -937,7 +937,7 @@
         {
           v5 = 79;
 LABEL_82:
-          v4 = (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->field_152, v5) == 0;
+          v4 = (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, v5) == 0;
 LABEL_83:
           if ( !v4 )
             goto LABEL_84;
@@ -1062,7 +1062,7 @@
 LABEL_13:
           v4 = 99;
 LABEL_15:
-          v5 = (unsigned __int16)_449B57_test_bit(pParty->_award_bits, v4) == 0;
+          v5 = (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, v4) == 0;
 LABEL_23:
           if ( !v5 )
             return 1;
@@ -6486,7 +6486,7 @@
   uExperience = 251 + rand() % 100;
   uBirthYear = 1147 - rand() % 6;
   memset(pActiveSkills, 0, sizeof(pActiveSkills));
-  memset(field_152, 0, 64);
+  memset(_guilds_member_bits, 0, 64);
   memset(&spellbook, 0, sizeof(PlayerSpells));
 
   for (uint i = 0; i < 37; ++i)
@@ -7701,8 +7701,8 @@
 
 
 //----- (00449BB4) --------------------------------------------------------
-char Player::CompareVariable(enum VariableType VarNum, signed int pValue)
-{
+bool Player::CompareVariable( enum VariableType VarNum, signed int pValue )
+	{
   Player *v3; // esi@1
   signed int v4; // edi@1
   unsigned int v5; // eax@8
@@ -7713,8 +7713,8 @@
   unsigned __int8 v10; // of@17
   int v11; // eax@19
   unsigned int v12; // eax@20
-  unsigned int v13; // eax@25
-  unsigned __int8 v14; // cl@25
+  unsigned int test_bit_value; // eax@25
+  unsigned __int8 our_bit_value; // cl@25
   signed int v15; // ecx@28
   ItemGen *v16; // eax@28
   char v17; // zf@31
@@ -7739,10 +7739,9 @@
     switch ( VarNum )
     {
       case VAR_Invisible:
-        if ( SHIDWORD(pParty->pPartyBuffs[11].uExpireTime) >= 0
-          && (SHIDWORD(pParty->pPartyBuffs[11].uExpireTime) > 0 || LODWORD(pParty->pPartyBuffs[11].uExpireTime) > 0) )
+        if ( pParty->pPartyBuffs[11].uExpireTime >0 )
           return true;
-        return v4 >= pValue;
+        return false;
       case VAR_NumDeaths:
         v4 = pParty->uNumDeaths;
         return v4 >= pValue;
@@ -7829,8 +7828,7 @@
         return v6;
       case VAR_IsFlying:
         if ( pParty->bFlying
-          && SHIDWORD(pParty->pPartyBuffs[7].uExpireTime) >= 0
-          && (SHIDWORD(pParty->pPartyBuffs[7].uExpireTime) > 0 || LODWORD(pParty->pPartyBuffs[7].uExpireTime) > 0) )
+          && (pParty->pPartyBuffs[7].uExpireTime> 0) )
           return true;
         return false;
       case VAR_HiredNPCHasSpeciality:
@@ -7839,9 +7837,9 @@
       case VAR_NPCs2:
         return pNPCStats->pNewNPCData[pValue].Hired();
       case VAR_MonthEquals|VAR_CurrentSP:
-        v13 = 0x80u >> ((signed __int16)a1 - 1) % 8;
-        v14 = this->field_1A50[((signed __int16)a1 - 1) >> 3];
-        if ( !((unsigned __int8)v13 & v14) )
+        test_bit_value = 0x80u >> ((signed __int16)a1 - 1) % 8;
+        our_bit_value = this->field_1A50[((signed __int16)a1 - 1)/8];
+        if ( !((unsigned __int8)test_bit_value & our_bit_value) )
           return v4 >= pValue;
         v4 = pValue;
         return v4 >= pValue;
@@ -7901,12 +7899,11 @@
   }
   if ( VarNum == VAR_AutoNotes )
   {
-    v13 = 0x80u >> ((signed __int16)(a1 - 1) - 1) % 8;
-    v14 = pParty->_autonote_bits[((signed __int16)(a1 - 1) - 1) >> 3];
-    if ( !((unsigned __int8)v13 & v14) )
-      return v4 >= pValue;
-    v4 = pValue;
-    return v4 >= pValue;
+    test_bit_value = 0x80u >> ((signed __int16)(a1 - 1) - 1) % 8;
+    our_bit_value = pParty->_autonote_bits[((signed __int16)(a1 - 1) - 1) /8];
+    if ( !((unsigned __int8)test_bit_value & our_bit_value) )
+      return false;
+    return true;
   }
   if ( VarNum <= VAR_BaseLuck )
   {
@@ -7972,19 +7969,18 @@
           v12 = GetActualAge();
           goto _j_cmp_against_arg;
         case VAR_Award:
-          v13 = 0x80u >> ((signed __int16)a1 - 1) % 8;
-          v14 = this->field_152[((signed __int16)a1 - 1) >> 3];
-          if ( !((unsigned __int8)v13 & v14) )
-            return v4 >= pValue;
-          v4 = pValue;
-          return v4 >= pValue;
+          test_bit_value = 0x80u >> ((signed __int16)a1 - 1) % 8;
+          our_bit_value = this->_guilds_member_bits[((signed __int16)a1 - 1) /8];
+          if ( !((unsigned __int8)test_bit_value & our_bit_value) )
+            return true;
+          return false;
         case VAR_Experience:
           v4 = LODWORD(this->uExperience);
           return v4 >= pValue;
         case VAR_QBits_QuestsDone:
-          v13 = 0x80u >> (pValue - 1) % 8;
-          v14 = pParty->_award_bits[(pValue - 1) >> 3];
-          if ( v13 & v14 )
+          test_bit_value = 0x80u >> (pValue - 1) % 8;
+          our_bit_value = pParty->_quest_bits[(pValue - 1)/8];
+          if ( test_bit_value & our_bit_value )
             return true;
           return false;
         case VAR_PlayerItemInHands:
@@ -8441,7 +8437,7 @@
           this->sAgeModifier = a3;
           return;
         case VAR_Award:
-          if ( !((unsigned __int8)(0x80u >> ((signed __int16)a3 - 1) % 8) & pPlayers[v3 + 1]->field_152[((signed __int16)a3 - 1) >> 3])
+          if ( !((unsigned __int8)(0x80u >> ((signed __int16)a3 - 1) % 8) & pPlayers[v3 + 1]->_guilds_member_bits[((signed __int16)a3 - 1) >> 3])
             //&& dword_723E80_award_related[2 * a3] )
 			&& pAwards[a3-1].pText )
           {
@@ -8450,13 +8446,13 @@
             v31 = 1;
             v12->PlaySound(SPEECH_96, 0);
           }
-          v13 = v4->field_152;
+          v13 = v4->_guilds_member_bits;
           goto LABEL_51;
         case VAR_Experience:
           this->uExperience = a3;
           goto LABEL_124;
         case VAR_QBits_QuestsDone:
-          if ( !((unsigned __int8)(0x80u >> ((signed __int16)a3 - 1) % 8) & pParty->_award_bits[((signed __int16)a3 - 1) >> 3])
+          if ( !((unsigned __int8)(0x80u >> ((signed __int16)a3 - 1) % 8) & pParty->_quest_bits[((signed __int16)a3 - 1) >> 3])
            // && (&dword_722F10)[4 * a3] )
 		   && pQuestTable[a3-1] )
           {
@@ -8466,7 +8462,7 @@
             v31 = 1;
             v14->PlaySound(SPEECH_93, 0);
           }
-          v13 = (char *)pParty->_award_bits;
+          v13 = (char *)pParty->_quest_bits;
 LABEL_51:
           _449B7E_toggle_bit((unsigned char *)v13, a3, 1u);
           goto LABEL_168;
@@ -8477,7 +8473,7 @@
           item.uAttributes = 1;
           pParty->SetHoldingItem(&item);
           if ( a3 >= ITEM_ARTIFACT_PUCK && a3 <= ITEM_RELIC_MEKORIGS_HAMMER )
-            pParty->field_3C.pIsArtifactFound[a3] = 1;
+            pParty->pIsArtifactFound[a3-500] = 1;
           return;
         case VAR_FixedGold:
           Party::SetGold(a3);
@@ -8860,7 +8856,7 @@
             case VAR_Award:
               v13 = pPlayers[uPlayerIdx + 1];
               v33 = 0x80u >> ((signed __int16)val - 1) % 8;
-              if ( !((unsigned __int8)(0x80u >> ((signed __int16)val - 1) % 8) & v13->field_152[((signed __int16)val - 1) >> 3])
+              if ( !((unsigned __int8)(0x80u >> ((signed __int16)val - 1) % 8) & v13->_guilds_member_bits[((signed __int16)val - 1) >> 3])
                 //&& dword_723E80_award_related[2 * val] )
 				&& pAwards[val-1].pText )
               {
@@ -8869,7 +8865,7 @@
                 v3 = 1;
                 v14->PlaySound(SPEECH_96, 0);
               }
-              v15 = v4->field_152;
+              v15 = v4->_guilds_member_bits;
               goto LABEL_44;
             case VAR_Experience:
               v16 = __CFADD__(val, LODWORD(Dst->uExperience));
@@ -8879,7 +8875,7 @@
                 Dst->uExperience = 4000000000i64;
               goto _play_anim_and_exit;
             case VAR_QBits_QuestsDone:
-              if ( !((unsigned __int8)(0x80u >> ((signed __int16)val - 1) % 8) & pParty->_award_bits[((signed __int16)val - 1) >> 3])
+              if ( !((unsigned __int8)(0x80u >> ((signed __int16)val - 1) % 8) & pParty->_quest_bits[((signed __int16)val - 1) >> 3])
                 //&& (&dword_722F10)[4 * val] )
 				&& pQuestTable[val-1] )
               {
@@ -8889,7 +8885,7 @@
                 v3 = 1;
                 v17->PlaySound(SPEECH_93, 0);
               }
-              v15 = (char *)pParty->_award_bits;
+              v15 = (char *)pParty->_quest_bits;
 LABEL_44:
               _449B7E_toggle_bit((unsigned char *)v15, val, 1u);
               goto LABEL_173;
@@ -8899,7 +8895,7 @@
               item.uAttributes = 1;
               item.uItemID = val;
               if ( val >= ITEM_ARTIFACT_PUCK && val <= ITEM_RELIC_MEKORIGS_HAMMER )
-                pParty->field_3C.pIsArtifactFound[val] = 1;
+                pParty->pIsArtifactFound[val-500] = 1;
               if ( val >= ITEM_WAND_FIRE && val <= ITEM_WAND_INCENERATION )
               {
                 item.uNumCharges = rand() % 6 + pItemsTable->pItems[item.uItemID].uDamageMod + 1;
@@ -9487,7 +9483,7 @@
           this->sAgeModifier -= (signed __int16)a3;
           return;
         case VAR_Award:
-          v11 = this->field_152;
+          v11 = this->_guilds_member_bits;
           goto LABEL_112;
         case VAR_Experience:
           v12 = (char *)&this->uExperience;
@@ -9497,7 +9493,7 @@
           *((int *)v12 + 1) -= v14 + HIDWORD(v13);
           goto LABEL_17;
         case VAR_QBits_QuestsDone:
-          _449B7E_toggle_bit(pParty->_award_bits, (__int16)a3, 0);
+          _449B7E_toggle_bit(pParty->_quest_bits, (__int16)a3, 0);
           pPlayers[v4 + 1]->PlaySound(SPEECH_96, 0);
           return;
         case VAR_PlayerItemInHands: