changeset 2288:406605240b0a

GetItemTextureFilename cleaned up
author Grumpy7
date Sun, 16 Mar 2014 02:59:52 +0100
parents 4e3236a4ea63
children 60293358b4b3
files Items.cpp mm7_unsorted_subs.h
diffstat 2 files changed, 92 insertions(+), 157 deletions(-) [+]
line wrap: on
line diff
--- a/Items.cpp	Sat Mar 15 23:42:51 2014 +0100
+++ b/Items.cpp	Sun Mar 16 02:59:52 2014 +0100
@@ -2115,172 +2115,107 @@
   return  elemsNeeded;
 }
 //----- (0043C91D) --------------------------------------------------------
-int __fastcall GetItemTextureFilename(char *pOut, signed int item_id, int index, int shoulder)
+int GetItemTextureFilename(char *pOut, signed int item_id, int index, int shoulder)
 {
   int result; // eax@2
-  char v5; // zf@3
 
   result = 0; //BUG   fn is void
-  if ( item_id <= 500 )
+  if ( item_id > 500 )
   {
-    //v5 = *((char *)&pBloodsplatContainer->std__vector_pBloodsplats[62].field_20 + a2 + 2) == 0;
-    v5 = party_has_equipment[(item_id - 100) + 32 + 2] == 0;
     switch ( item_id )
     {
-      case 516:
-        v5 = byte_5111F6[2] == 0;
-        break;
-      case 505:
-        v5 = byte_5111F6[1] == 0;
-        break;
-      case 504:
-        v5 = byte_5111F6[0] == 0;
-        break;
-      case 533:
-        v5 = byte_5111F6[16] == 0;
-        break;
-      case 512:
-        v5 = byte_5111F6[3] == 0;
-        break;
-      case 521:
-        v5 = byte_5111F6[4] == 0;
-        break;
-      case 522:
-        v5 = byte_5111F6[5] == 0;
-        break;
-      case 523:
-        v5 = byte_5111F6[6] == 0;
-        break;
-      case 532:
-        v5 = byte_5111F6[7] == 0;
-        break;
-      case 544:
-        v5 = byte_5111F6[8] == 0;
-        break;
-      case 524:
-        v5 = byte_5111F6[9] == 0;
-        break;
-      case 535:
-        v5 = byte_5111F6[10] == 0;
-        break;
-      case 525:
-        v5 = byte_5111F6[11] == 0;
-        break;
-      case 530:
-        v5 = byte_5111F6[12] == 0;
-        break;
-      case 547:
-        v5 = byte_5111F6[13] == 0;
-        break;
-      case 548:
-        v5 = byte_5111F6[14] == 0;
-        break;
-      case 550:
-        v5 = byte_5111F6[15] == 0;
-        break;
-      default:
-        break;
+    case 516:
+      if (byte_5111F6[2] != 0)
+        item_id = 234;
+      break;
+    case 505:
+      if (byte_5111F6[1] != 0)
+        item_id = 236;
+      break;
+    case 504:
+      if (byte_5111F6[0] != 0)
+        item_id = 235;
+      break;
+    case 533:
+      if (byte_5111F6[16] != 0)
+        item_id = 73;
+      break;
+    case 512:
+      if (byte_5111F6[3] != 0)
+        item_id = 312;
+      break;
+    case 521:
+      if (byte_5111F6[4] != 0)
+        item_id = 239;
+      break;
+    case 522:
+      if (byte_5111F6[5] != 0)
+        item_id = 240;
+      break;
+    case 523:
+      if (byte_5111F6[6] != 0)
+        item_id = 241;
+      break;
+    case 532:
+      if (byte_5111F6[7] != 0)
+        item_id = 93;
+      break;
+    case 544:
+      if (byte_5111F6[8] != 0)
+        item_id = 344;
+      break;
+    case 524:
+      if (byte_5111F6[9] != 0)
+        item_id = 324;
+      break;
+    case 535:
+      if (byte_5111F6[10] != 0)
+        item_id = 104;
+      break;
+    case 525:
+      if (byte_5111F6[11] != 0)
+        item_id = 325;
+      break;
+    case 530:
+      if (byte_5111F6[12] != 0)
+        item_id = 330;
+      break;
+    case 547:
+      if (byte_5111F6[13] != 0)
+        item_id = 347;
+      break;
+    case 548:
+      if (byte_5111F6[14] != 0)
+        item_id = 348;
+      break;
+    case 550:
+      if (byte_5111F6[15] != 0)
+        item_id = 350;
+      break;
+    default:
+      return 0;
     }
-    if ( v5 )
-      return result;
-    result = 516;
-    if ( item_id < 66 || item_id > 78 )
-    {
-      if ( item_id == 516 )
-      {
-        if ( !shoulder )
-          return sprintf(pOut, "item%3.3dv%d", 234, index);
-        if ( shoulder == 1 )
-          return sprintf(pOut, "item%3.3dv%da1", 234, index);
-        if ( shoulder == 2 )
-          return sprintf(pOut, "item%3.3dv%da2", 234, index);
-      }
-      if ( item_id != 504 && item_id != 505 && item_id != 533 )
-      {
-        if ( (item_id < 100 || item_id > 104) && item_id != 524 && item_id != 535 )
-        {
-          if ( item_id >= 115 && item_id <= 119 || item_id == 512 )
-          {
-            if ( item_id == 512 )
-              item_id = 312;
-            return sprintf(pOut, "item%3.3dv%d", item_id, index);
-          }
-          if ( (item_id < 89 || item_id > 99) && item_id != 521 && item_id != 522 && item_id != 523 && item_id != 532 && item_id != 544 )
-          {
-            result = 525;
-            if ( (item_id < 105 || item_id > 109) && item_id != 525 && item_id != 530 && item_id != 547 && item_id != 548 && item_id != 550 )
-              return result;
-            switch ( item_id )
-            {
-              case 525:
-                item_id = 325;
-                break;
-              case 530:
-                item_id = 330;
-                break;
-              case 547:
-                item_id = 347;
-                break;
-              case 548:
-                item_id = 348;
-                break;
-              case 550:
-                item_id = 350;
-                break;
-            }
-            if ( !shoulder )
-              return sprintf(pOut, "item%3.3dv%d", item_id, index);
-            return sprintf(pOut, "item%3.3dv%da1", item_id, index);
-          }
-          if ( item_id == 521 )
-            return sprintf(pOut, "item%3.3dv%d", 239, index);
-          if ( item_id == 522 )
-            return sprintf(pOut, "item%3.3dv%d", 240, index);
-          if ( item_id == 523 )
-            return sprintf(pOut, "item%3.3dv%d", 241, index);
-          if ( item_id != 532 )
-          {
-            if ( item_id == 544 )
-              item_id = 344;
-            return sprintf(pOut, "item%3.3dv%d", item_id, index);
-          }
-          return sprintf(pOut, "item%3.3dv%d", 93, index);
-        }
-        if ( item_id == 524 )
-          return sprintf(pOut, "item%3.3dv%d", 324, index);
-        if ( item_id == 535 )
-          item_id = 104;
-        return sprintf(pOut, "item%3.3dv%d", item_id, index);
-      }
-    }
-    if ( item_id != 516 )
-    {
-      switch ( item_id )
-      {
-        case 504:
-          item_id = 235;
-          break;
-        case 505:
-          item_id = 236;
-          break;
-        case 533:
-          item_id = 73;
-          break;
-      }
-      if ( !shoulder )
-        return sprintf(pOut, "item%3.3dv%d", item_id, index);
-      if ( shoulder == 1 )
-        return sprintf(pOut, "item%3.3dv%da1", item_id, index);
-      if ( shoulder == 2 )
-        return sprintf(pOut, "item%3.3dv%da2", item_id, index);
-    }
+  }
+
+  switch (pItemsTable->pItems[item_id].uEquipType)
+  {
+  case EQUIP_ARMOUR:
     if ( !shoulder )
-      return sprintf(pOut, "item%3.3dv%d", 234, index);
-    if ( shoulder == 1 )
-      return sprintf(pOut, "item%3.3dv%da1", 234, index);
-    if ( shoulder == 2 )
-      return sprintf(pOut, "item%3.3dv%da2", 234, index);
+      return sprintf(pOut, "item%3.3dv%d", item_id, index);
+    else if ( shoulder == 1 )
+      return sprintf(pOut, "item%3.3dv%da1", item_id, index);
+    else if ( shoulder == 2 )
+      return sprintf(pOut, "item%3.3dv%da2", item_id, index);
+    break;
+  case EQUIP_CLOAK:
+    if ( !shoulder )
+      return sprintf(pOut, "item%3.3dv%d", item_id, index);
+    else
+      return sprintf(pOut, "item%3.3dv%da1", item_id, index);
+  default:
+    return sprintf(pOut, "item%3.3dv%d", item_id, index);
   }
+
   result = item_id - 504;
   return result;
 }
--- a/mm7_unsorted_subs.h	Sat Mar 15 23:42:51 2014 +0100
+++ b/mm7_unsorted_subs.h	Sun Mar 16 02:59:52 2014 +0100
@@ -89,7 +89,7 @@
 void ItemDamageFromActor(unsigned int uObjID, unsigned int uActorID, struct Vec3_int_ *pVelocity);
 void ActorDamageFromMonster(signed int attacker_id, unsigned int actor_id, struct Vec3_int_ *pVelocity, signed int a4);
 void CharacterUI_LoadPaperdollTextures();
-int __fastcall GetItemTextureFilename(char *pOut, signed int item_id, int index, int shoulder);
+int GetItemTextureFilename(char *pOut, signed int item_id, int index, int shoulder);
 bool IsDwarfPresentInParty(bool b);
 bool  ShouldLoadTexturesForRaceAndGender(unsigned int _this);
 void WetsuitOn(unsigned int uPlayerID); // idb