diff mm7_2.cpp @ 232:c879446b4a22

inventory indexing fixed
author zipi
date Sun, 17 Feb 2013 15:04:56 +0100
parents 0c64754c7fd4
children 47e06334c564
line wrap: on
line diff
--- a/mm7_2.cpp	Sun Feb 17 14:47:34 2013 +0100
+++ b/mm7_2.cpp	Sun Feb 17 15:04:56 2013 +0100
@@ -2869,7 +2869,7 @@
     v124 = 0;
     v122 = 3;
     v120 = ptr_507BC0->ptr_1C;
-    v116 = (ItemGen *)&v0->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * v10 + 5];
+    v116 = (ItemGen *)&v0->pInventoryItems[v10-1];
     v12 = (int)ptr_507BC0->ptr_1C;
     uPlayerID = uActiveCharacter - 1;
     v13 = v0->_490EEE(v116, 2, v12, 3);
@@ -2893,7 +2893,7 @@
           v2 = v0->GetItemIDAtInventoryIndex((int *)&v149);
           if ( v2 )
           {
-            v3 = (ItemGen *)&v0->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * v2 + 5];
+            v3 = (ItemGen *)&v0->pInventoryItems[v2-1];
             if ( v3->uAttributes & 1 )
             {
               v118 = ptr_507BC0->ptr_1C;
@@ -4596,7 +4596,7 @@
     {
       v26 = 1;
       v20->uAttributes |= 1u;
-      memcpy(&v0->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * v25 + 5], v20, 0x24u);
+      memcpy(&v0->pInventoryItems[v25-1], v20, 0x24u);
       goto LABEL_42;
     }
     v0->PlaySound(SPEECH_NoRoom, 0);
@@ -4707,7 +4707,7 @@
       || (v15 = v0->GetItemIDAtInventoryIndex((int *)&v79), (v77 = (Player *)v15) == 0) )
       return;
     v16 = ptr_507BC0;
-    if ( sub_4BDAAF((ItemGen *)&v0->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * v15 + 5], (int)ptr_507BC0->ptr_1C) )
+    if ( sub_4BDAAF((ItemGen *)&v0->pInventoryItems[v15-1], (int)ptr_507BC0->ptr_1C) )
     {
       dword_F8B1E4 = 1;
       v0->_4BE2DD(v79, (int)((char *)v77 - 1), (int)v16->ptr_1C);
@@ -4742,7 +4742,7 @@
         {
           //v80 = v0->_4B8179(p2DEvents_minus1__20[13 * (unsigned int)ptr_507BC0->ptr_1C]);
           v80 = v0->_4B8179(p2DEvents[(unsigned int)ptr_507BC0->ptr_1C - 1].fPriceMultiplier);
-          v12 = (int)&v0->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * v11 + 5];
+          v12 = (int)&v0->pInventoryItems[v11-1];
           if ( !(*(char *)(v12 + 20) & 1) )
           {
             _this = (ItemGen *)ptr_507BC0->ptr_1C;
@@ -4784,11 +4784,11 @@
           v2 = v0->GetItemIDAtInventoryIndex((int *)&v79);
           if ( v2 )
           {
-            v3 = (int)&v0->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * v2 + 5];
+            v3 = (int)&v0->pInventoryItems[v2-1];
             //v4 = p2DEvents_minus1__20[13 * (unsigned int)ptr_507BC0->ptr_1C];
             v4 = p2DEvents[(unsigned int)ptr_507BC0->ptr_1C - 1].fPriceMultiplier;
 
-            auto _v = (ItemGen *)&v0->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * v2 + 5];
+            auto _v = (ItemGen *)&v0->pInventoryItems[v2-1];
             v5 = _v->GetValue();
 
             v6 = v0->_4B81C3(v5, v4);
@@ -14768,7 +14768,7 @@
   v2 = v0->pEquipment.uOffHand;
   v54 = v0->pEquipment.uOffHand;
   v53 = v1;
-  if ( v1 && pItemsTable->pItems[*(int *)&v0->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * v1 + 5]].uEquipType == 1 )
+  if ( v1 && pItemsTable->pItems[*(int *)&v0->pInventoryItems[v1-1]].uEquipType == 1 )
     v51 = v1;
   v3 = pParty->pPickedItem.uItemID;
   if ( pParty->pPickedItem.uItemID )
@@ -14795,7 +14795,7 @@
     {
       if ( (v4 == 8 || v4 == 1 || v4 == 2)
         && v1
-        && pItemsTable->pItems[*(int *)&v0->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * v1 + 5]].uSkillType == 4 )
+        && pItemsTable->pItems[*(int *)&v0->pInventoryItems[v1-1]].uSkillType == 4 )
         goto LABEL_7;
     }
 LABEL_16:
@@ -15140,7 +15140,7 @@
     v35 = v0->pEquipment.uBow;
     if ( v35 )
     {
-      auto _a = (ItemGen *)&v0->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * v35 + 5];
+      auto _a = (ItemGen *)&v0->pInventoryItems[v35-1];
       pParty->SetHoldingItem(_a);
       _a->Reset();
       v0->pEquipment.uBow = 0;