diff Player.cpp @ 281:ccf14ac29caf

Слияние
author Ritor1
date Sun, 17 Feb 2013 20:41:39 +0600
parents f66106b5d144 c879446b4a22
children 87ab1603c937
line wrap: on
line diff
--- a/Player.cpp	Sun Feb 17 20:41:11 2013 +0600
+++ b/Player.cpp	Sun Feb 17 20:41:39 2013 +0600
@@ -257,7 +257,7 @@
     result = v2->uOffHand;
     if ( v2->uOffHand )
     {
-      result = *(int *)&this->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * result + 5];
+      result = *(int *)&this->pInventoryItems[result-1];
       if ( result )
       {
         if ( result != 64 && result != 65 )
@@ -1763,8 +1763,7 @@
 
   pIndices = &this->pInventoryIndices[uSlot];
 
-  __debugbreak();  // the following indexing is invalid
-  v3 = (ItemGen *)&this->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * *pIndices + 5];
+  v3 = &this->pInventoryItems[*pIndices-1];
   v4 = v3->uItemID;
   v3->Reset();
   v5 = pIcons_LOD->LoadTexture(pItemsTable->pItems[v4].pIconName, TEXTURE_16BIT_PALETTE);
@@ -2393,7 +2392,7 @@
         goto LABEL_15;
       }
     }
-    memcpy(&v9->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * v10 + 5], pItem, 0x24u);
+    memcpy(&v9->pInventoryItems[v10-1], pItem, 0x24u);
     pItem->Reset();
     pAudioPlayer->PlaySound(SOUND_GoldReceived, 0, 0, -1, 0, 0, 0, 0);
     v19->PlaySound(SPEECH_60, 0);
@@ -2788,7 +2787,7 @@
   }
   if ( HasItemEquipped(EQUIP_TWO_HANDED) )
   {
-    v6 = (ItemGen *)&v5->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * v5->pEquipment.uMainHand + 5];
+    v6 = (ItemGen *)&v5->pInventoryItems[v5->pEquipment.uMainHand-1];
     v7 = v6->uItemID;
     v8 = v6->uItemID;
     v9 = pItemsTable->pItems[v8].uDamageDice;
@@ -2860,7 +2859,7 @@
   {
     if ( v5->HasItemEquipped((ITEM_EQUIP_TYPE)0) )
     {
-      v15 = (ItemGen *)&v5->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * v5->pEquipment.uOffHand + 5];
+      v15 = (ItemGen *)&v5->pInventoryItems[v5->pEquipment.uOffHand-1];
       v16 = v15->uItemID;
       v17 = v15->uItemID;
       if ( pItemsTable->pItems[v17].uEquipType != 4 )
@@ -2953,7 +2952,7 @@
   int v7; // edi@4
 
   v1 = this;
-  v2 = *(int *)&this->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * this->pEquipment.uMainHand + 5];
+  v2 = *(int *)&this->pInventoryItems[this->pEquipment.uMainHand-1];
   if ( v2 < 64 || v2 > 65 )
   {
     v4 = GetActualAccuracy();
@@ -3043,7 +3042,7 @@
   result = HasItemEquipped(EQUIP_BOW);
   if ( !result )
     return result;
-  v4 = (ItemGen *)&v2->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * v2->pEquipment.uBow + 5];
+  v4 = (ItemGen *)&v2->pInventoryItems[v2->pEquipment.uBow-1];
   v5 = v4->uItemID;
   v6 = v4->uItemID;
   v15 = pItemsTable->pItems[v6].uDamageRoll;
@@ -3114,7 +3113,7 @@
   static char player__getmeleedamagestring_static_buff[40]; // idb
 
   v1 = this;
-  v2 = *(int *)&this->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * this->pEquipment.uMainHand + 5];
+  v2 = *(int *)&this->pInventoryItems[this->pEquipment.uMainHand-1];
   if ( v2 < 64 || v2 > 65 )
   {
     v3 = GetMeleeDamageMinimal();
@@ -3140,7 +3139,7 @@
   v8 = v1->pEquipment.uMainHand;
   if ( v8 )
   {
-    v9 = *(int *)&v1->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * v8 + 5];
+    v9 = *(int *)&v1->pInventoryItems[v8-1];
     if ( v9 >= 135 )
     {
       if ( v9 <= 159 )
@@ -3166,7 +3165,7 @@
   static char player__getrangeddamagestring_static_buff[40]; // idb
 
   v1 = this;
-  v2 = *(int *)&this->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * this->pEquipment.uMainHand + 5];
+  v2 = *(int *)&this->pInventoryItems[this->pEquipment.uMainHand-1];
   if ( v2 < 64 || v2 > 65 )
   {
     v3 = GetRangedDamageMin();
@@ -3200,7 +3199,7 @@
   v8 = v1->pEquipment.uMainHand;
   if ( v8 )
   {
-    v9 = *(int *)&v1->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * v8 + 5];
+    v9 = *(int *)&v1->pInventoryItems[v8-1];
     if ( v9 >= 135 )
     {
       if ( v9 <= 159 )
@@ -3864,7 +3863,7 @@
       {
         if ( *v20 > 0 )
         {
-          v21 = *(int *)&v5->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * *v20 + 5];
+          v21 = *(int *)&v5->pInventoryItems[*v20-1];
           if ( v21 > 0 )
           {
             if ( v21 <= 134 )
@@ -4144,7 +4143,7 @@
   {
     if ( !HasItemEquipped(EQUIP_BOW) )
       goto LABEL_17;
-    v5 = (int)&v4->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * v4->pEquipment.uBow + 5];
+    v5 = (int)&v4->pInventoryItems[v4->pEquipment.uBow-1];
     v46 = v5;
     v3 = (char *)&pItemsTable->pItems[*(int *)v5].pIconName;
     v6 = (unsigned __int16)word_4EDED8[(unsigned __int8)v3[29]];
@@ -4163,7 +4162,7 @@
   }
   if ( HasItemEquipped(EQUIP_TWO_HANDED) )
   {
-    v8 = (int)&v4->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * v4->pEquipment.uMainHand + 5];
+    v8 = (int)&v4->pInventoryItems[v4->pEquipment.uMainHand-1];
     v46 = v8;
     v9 = *(int *)v8;
     v3 = (char *)&pItemsTable->pItems[v9].pIconName;
@@ -4175,7 +4174,7 @@
   }
   if ( HasItemEquipped((ITEM_EQUIP_TYPE)0) )
   {
-    v12 = (int)&v4->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * v4->pEquipment.uOffHand + 5];
+    v12 = (int)&v4->pInventoryItems[v4->pEquipment.uOffHand-1];
     v42 = (unsigned __int16)word_4EDED8[pItemsTable->pItems[*(int *)v12].uSkillType];
     if ( (signed int)v42 > v47 )
     {
@@ -4189,7 +4188,7 @@
 LABEL_17:
   if ( HasItemEquipped(EQUIP_ARMOUR) )
   {
-    v14 = pItemsTable->pItems[*(int *)&v4->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * v4->pEquipment.uBody + 5]].uSkillType;
+    v14 = pItemsTable->pItems[*(int *)&v4->pInventoryItems[v4->pEquipment.uBody-1]].uSkillType;
     SkillToMastery(v4->pActiveSkills[9]);
     v15 = (unsigned __int16)word_4EDED8[v14];
     v35 = 1.0;
@@ -4872,14 +4871,14 @@
     if ( (signed int)attr <= 30 )
     {
       if ( HasItemEquipped(EQUIP_BOW) )
-        v5 = pItemsTable->pItems[*(int *)&v6->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * v6->pEquipment.uBow + 5]].uDamageMod;
+        v5 = pItemsTable->pItems[*(int *)&v6->pInventoryItems[v6->pEquipment.uBow-1]].uDamageMod;
       return v5 + v62 + v61;
     }
     if ( attr == 31 )
     {
       if ( !HasItemEquipped(EQUIP_BOW) )
         return v5 + v62 + v61;
-      v57 = *(int *)&v6->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * v6->pEquipment.uBow + 5];
+      v57 = *(int *)&v6->pInventoryItems[v6->pEquipment.uBow-1];
       v5 = pItemsTable->pItems[v57].uDamageMod;
       v56 = pItemsTable->pItems[v57].uDamageDice;
       goto LABEL_366;
@@ -4888,7 +4887,7 @@
     {
       if ( !HasItemEquipped(EQUIP_BOW) )
         return v5 + v62 + v61;
-      v20 = *(int *)&v6->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * v6->pEquipment.uBow + 5];
+      v20 = *(int *)&v6->pInventoryItems[v6->pEquipment.uBow-1];
       v5 = pItemsTable->pItems[v20].uDamageDice * pItemsTable->pItems[v20].uDamageRoll;
 LABEL_365:
       v56 = pItemsTable->pItems[v20].uDamageMod;
@@ -5521,12 +5520,12 @@
       if ( v17 >= 0 )
       {
         if ( v17 <= 2 )
-          v5 = pItemsTable->pItems[*(int *)&v6->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * v6->pEquipment.uMainHand + 5]].uDamageMod;
+          v5 = pItemsTable->pItems[*(int *)&v6->pInventoryItems[v6->pEquipment.uMainHand-1]].uDamageMod;
       }
     }
     if ( a3 || !v6->HasItemEquipped((ITEM_EQUIP_TYPE)0) || (v19 = v18->GetEquippedItemEquipType(0), v19 < 0) || v19 > 2 )
       return v5 + v62 + v61;
-    v20 = *(int *)&v6->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * v6->pEquipment.uOffHand + 5];
+    v20 = *(int *)&v6->pInventoryItems[v6->pEquipment.uOffHand-1];
     goto LABEL_365;
   }
   if ( attr == 27 )