diff Player.cpp @ 973:ec7568e13b24

Minor code cleaning.
author Nomad
date Wed, 08 May 2013 21:37:12 +0200
parents c0d0656aa662
children a6ef7125f6e4
line wrap: on
line diff
--- a/Player.cpp	Wed May 08 19:54:19 2013 +0200
+++ b/Player.cpp	Wed May 08 21:37:12 2013 +0200
@@ -1360,20 +1360,18 @@
 //----- (00492528) --------------------------------------------------------
 bool Player::CanFitItem(unsigned int uSlot, unsigned int uItemID)
 {
-  unsigned int v3; // eax@1
+  //unsigned int v3; // eax@1
   Texture *v4; // esi@1
   unsigned int v5; // ebx@1
   signed int v6; // edi@5
   int *v7; // ecx@6
   signed int v8; // edx@7
   int *v9; // eax@8
-  Player *v11; // [sp+Ch] [bp-4h]@1
+  //Player *v11; // [sp+Ch] [bp-4h]@1
   unsigned int uItemIDa; // [sp+1Ch] [bp+Ch]@1
 
-  v11 = this;
-  v3 = pIcons_LOD->LoadTexture(pItemsTable->pItems[uItemID].pIconName, TEXTURE_16BIT_PALETTE);
-  v4 = (Texture *)(v3 != -1 ? &pIcons_LOD->pTextures[v3] : 0);
-  v5 = GetSizeInInventorySlots(v3 != -1 ? pIcons_LOD->pTextures[v3].uTextureWidth : 24);
+  v4 = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[uItemID].pIconName, TEXTURE_16BIT_PALETTE);
+  v5 = GetSizeInInventorySlots(v4->uTextureWidth);
   uItemIDa = GetSizeInInventorySlots(v4->uTextureHeight);
   if ( !areWeLoadingTexture )
   {
@@ -1385,7 +1383,7 @@
     v6 = 0;
     if ( (signed int)uItemIDa <= 0 )
       return 1;
-    v7 = &v11->pInventoryIndices[uSlot];
+    v7 = &pInventoryIndices[uSlot];
     while ( 1 )
     {
       v8 = 0;
@@ -1435,7 +1433,7 @@
   ItemGen *v4; // eax@1
   int result; // eax@8
   unsigned int v6; // ebx@10
-  unsigned int v7; // eax@10
+  //unsigned int v7; // eax@10
   Texture *v8; // esi@10
   void *v9; // esi@13
   unsigned int v10; // [sp+0h] [bp-Ch]@10
@@ -1467,9 +1465,8 @@
   else
   {
     v6 = uItemID;
-    v7 = pIcons_LOD->LoadTexture(pItemsTable->pItems[uItemID].pIconName, TEXTURE_16BIT_PALETTE);
-    v8 = (Texture *)(v7 != -1 ? (int)&pIcons_LOD->pTextures[v7] : 0);
-    v10 = GetSizeInInventorySlots(v7 != -1 ? pIcons_LOD->pTextures[v7].uTextureWidth : 24);
+    v8 = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[uItemID].pIconName, TEXTURE_16BIT_PALETTE);
+    v10 = GetSizeInInventorySlots(v8->uTextureWidth);
     uItemIDa = GetSizeInInventorySlots(v8->uTextureHeight);
     if ( !areWeLoadingTexture )
     {
@@ -1523,6 +1520,8 @@
   char *v5; // eax@6
   char *v6; // esi@6
 
+  __debugbreak(); // sub is definetly broken
+
   v2 = 0;
   v3 = this->pInventoryItems;
   while ( v3->uItemID )
@@ -1647,7 +1646,7 @@
   signed int v3; // ebx@1
   ItemGen *v4; // eax@1
   int result; // eax@6
-  unsigned int v6; // eax@7
+  //unsigned int v6; // eax@7
   Texture *v7; // esi@7
   unsigned int v8; // edx@9
   void *v9; // esi@10
@@ -1675,11 +1674,8 @@
   }
   else
   {
-    v6 = pIcons_LOD->LoadTexture(
-           pItemsTable->pItems[Src->uItemID].pIconName,
-           TEXTURE_16BIT_PALETTE);
-    v7 = (Texture *)(v6 != -1 ? (int)&pIcons_LOD->pTextures[v6] : 0);
-    v10 = GetSizeInInventorySlots(v6 != -1 ? pIcons_LOD->pTextures[v6].uTextureWidth : 24);
+    v7 = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[Src->uItemID].pIconName, TEXTURE_16BIT_PALETTE);
+    v10 = GetSizeInInventorySlots(v7->uTextureWidth);
     v11 = GetSizeInInventorySlots(v7->uTextureHeight);
     if ( !areWeLoadingTexture )
     {
@@ -1711,17 +1707,15 @@
 //----- (0049298B) --------------------------------------------------------
 bool Player::_49298B(ItemGen *a2, int a3, int a4)
 {
-  Player *v4; // ebx@1
-  unsigned int v5; // eax@1
+  //Player *v4; // ebx@1
+  //unsigned int v5; // eax@1
   Texture *v6; // esi@1
   void *v7; // esi@4
   unsigned int v9; // [sp+Ch] [bp-4h]@1
   unsigned int a2a; // [sp+18h] [bp+8h]@1
 
-  v4 = this;
-  v5 = pIcons_LOD->LoadTexture(pItemsTable->pItems[a2->uItemID].pIconName, TEXTURE_16BIT_PALETTE);
-  v6 = (Texture *)(v5 != -1 ? (int)&pIcons_LOD->pTextures[v5] : 0);
-  v9 = GetSizeInInventorySlots(v5 != -1 ? pIcons_LOD->pTextures[v5].uTextureWidth : 24);
+  v6 = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[a2->uItemID].pIconName, TEXTURE_16BIT_PALETTE);
+  v9 = GetSizeInInventorySlots(v6->uTextureWidth);
   a2a = GetSizeInInventorySlots(v6->uTextureHeight);
   if ( !areWeLoadingTexture )
   {
@@ -1730,7 +1724,7 @@
   }
   if ( (signed int)a2a > 0 )
   {
-    v7 = &v4->pInventoryIndices[a4];
+    v7 = &pInventoryIndices[a4];
     do
     {
       if ( (signed int)v9 > 0 )
@@ -1740,7 +1734,7 @@
     }
     while ( a2a );
   }
-  v4->pInventoryIndices[a4] = a3 + 1;
+  pInventoryIndices[a4] = a3 + 1;
   return 1;
 }
 
@@ -1752,7 +1746,7 @@
   int *pIndices; // edi@1
   ItemGen *v3; // ecx@1
   unsigned int v4; // esi@1
-  unsigned int v5; // eax@1
+  //unsigned int v5; // eax@1
   Texture *v6; // esi@1
   unsigned int result; // eax@1
   unsigned int v8; // ebp@1
@@ -1763,9 +1757,8 @@
   v3 = &this->pInventoryItems[*pIndices-1];
   v4 = v3->uItemID;
   v3->Reset();
-  v5 = pIcons_LOD->LoadTexture(pItemsTable->pItems[v4].pIconName, TEXTURE_16BIT_PALETTE);
-  v6 = (Texture *)(v5 != -1 ? (int)&pIcons_LOD->pTextures[v5] : 0);
-  uSlota = GetSizeInInventorySlots(v5 != -1 ? pIcons_LOD->pTextures[v5].uTextureWidth : 24);
+  v6 = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[v4].pIconName, TEXTURE_16BIT_PALETTE);
+  uSlota = GetSizeInInventorySlots(v6->uTextureWidth);
   result = GetSizeInInventorySlots(v6->uTextureHeight);
   v8 = result;
   if ( !areWeLoadingTexture )
@@ -2380,7 +2373,7 @@
   unsigned int v3; // ecx@4
   signed int v4; // edx@4
   char *v5; // eax@8
-  unsigned int v6; // eax@10
+  //unsigned int v6; // eax@10
   Texture *v7; // ebx@10
   signed int v8; // esi@10
   Player *v9; // edi@11
@@ -2422,8 +2415,7 @@
   v5 = pItemsTable->pItems[v2].pIconName;
   if ( v5 )
   {
-    v6 = pIcons_LOD->LoadTexture(v5, TEXTURE_16BIT_PALETTE);
-    v7 = (Texture *)(v6 != -1 ? &pIcons_LOD->pTextures[v6] : 0);
+    v7 = pIcons_LOD->LoadTexturePtr(v5, TEXTURE_16BIT_PALETTE);
     v21 = areWeLoadingTexture;
     v8 = 0;
     while ( 1 )