changeset 2264:47b87aea14ba

m
author Ritor1
date Sat, 08 Mar 2014 22:23:20 +0600
parents eab43c3d7767
children f38f53397bc0
files Chest.cpp Conditions.cpp DecalBuilder.cpp DecorationList.cpp
diffstat 4 files changed, 161 insertions(+), 203 deletions(-) [+]
line wrap: on
line diff
--- a/Chest.cpp	Thu Mar 06 00:41:04 2014 +0100
+++ b/Chest.cpp	Sat Mar 08 22:23:20 2014 +0600
@@ -353,19 +353,17 @@
   item_count = 0;
   max_items = pChestWidthsByType[pChests[uChestID].uChestBitmapID] * pChestHeightsByType[pChests[uChestID].uChestBitmapID];
   if ( max_items <= 0 )
-  {
     item_count = -1;
-  }
   else
   {
     while ( pChests[uChestID].igChestItems[item_count].uItemID )
     {
       ++item_count;
       if ( item_count >= max_items )
-          {
-          item_count = -1;
-          break;
-          }
+      {
+        item_count = -1;
+        break;
+      }
     }
   }
   return item_count;
@@ -374,13 +372,12 @@
 //----- (0041FFA2) --------------------------------------------------------
 int Chest::PutItemInChest(int position, ItemGen *put_item, signed int uChestID)
 {
-  int v3; // eax@1
   ItemGen *v4; // edi@1
   int v5; // esi@1
   int result; // eax@11
   unsigned int v7; // eax@12
   int v8; // edx@12
-  Texture *v9; // ecx@12
+  Texture *texture; // ecx@12
   signed int v10; // eax@12
   signed int v11; // edi@14
   unsigned int v12; // esi@14
@@ -397,11 +394,10 @@
   int v23; // [sp+20h] [bp-4h]@19
 
   v21 = 0;
-  v3 = pChests[uChestID].uChestBitmapID;
   v4 = put_item;
-  v5 = pChestWidthsByType[v3] * pChestHeightsByType[v3];
+  v5 = pChestWidthsByType[pChests[uChestID].uChestBitmapID] * pChestHeightsByType[pChests[uChestID].uChestBitmapID];
   Src = put_item;
-  v19 = pChestWidthsByType[v3];
+  v19 = pChestWidthsByType[pChests[uChestID].uChestBitmapID];
   if ( position == -1 )
   {
     item_in_chest_count = CountChestItems(uChestID);
@@ -410,9 +406,7 @@
     for( int _i = 0; _i < v5; _i++)
 	{
       if ( Chest::CanPlaceItemAt(_i, v4->uItemID, pChestWindow->par1C) )
-      {
         v21 = _i;
-      }
     }
     if ( v21 == v5 )
     {
@@ -422,18 +416,18 @@
     }
     v7 = pIcons_LOD->LoadTexture(v4->GetIconName(), TEXTURE_16BIT_PALETTE);
     HIWORD(v8) = 0;
-    v9 = pIcons_LOD->GetTexture(v7);
-    v10 = v9->uTextureWidth;
-    if ( v10 < 14 )
+    texture = pIcons_LOD->GetTexture(v7);
+    v10 = texture->uTextureWidth;
+    if ( texture->uTextureWidth < 14 )
       v10 = 14;
-    v11 = v9->uTextureHeight;
     v12 = ((v10 - 14) >> 5) + 1;
-    if ( v11 < 14 )
+    v11 = texture->uTextureHeight;
+    if ( texture->uTextureHeight < 14 )
       v11 = 14;
     v13 = ((v11 - 14) >> 5) + 1;
     if ( !areWeLoadingTexture )
     {
-      ((Texture *)v9)->Release();
+      texture->Release();
       pIcons_LOD->SyncLoadedFilesCount();
     }
     if ( v13 > 0 )
@@ -466,62 +460,58 @@
     result = v21 + 1;
   }
   else
-  {
     result = 1;
-  }
   return result;
 }
 // 506128: using guessed type int areWeLoadingTexture;
 
 //----- (0042013E) --------------------------------------------------------
 void Chest::PlaceItemAt( unsigned int put_cell_pos, unsigned int item_at_cell, signed int uChestID )
-    {
-    int uItemID; // edi@1
-    int v6; // edx@4
-    unsigned int v7; // eax@5
-    Texture *v8; // ecx@5
-    signed int v9; // eax@5
-    signed int v10; // edi@7
-    unsigned int texture_cell_width; // ebx@7
-    int textute_cell_height; // edi@9
-    int chest_cell_row_pos; // edx@12
-    int chest_cell_width; // [sp+10h] [bp-Ch]@11
+{
+  int uItemID; // edi@1
+  int v6; // edx@4
+  unsigned int v7; // eax@5
+  Texture *texture; // ecx@5
+  signed int v9; // eax@5
+  signed int v10; // edi@7
+  unsigned int texture_cell_width; // ebx@7
+  int textute_cell_height; // edi@9
+  int chest_cell_row_pos; // edx@12
+  int chest_cell_width; // [sp+10h] [bp-Ch]@11
 
-    uItemID = pChests[ uChestID].igChestItems[item_at_cell].uItemID;
-    pItemsTable->SetSpecialBonus(&pChests[ uChestID].igChestItems[item_at_cell]);
-    if ( uItemID >= 135 && uItemID <= 159 && !pChests[ uChestID].igChestItems[item_at_cell].uNumCharges)
-        {
-        v6 = rand() % 21 + 10;
-        pChests[ uChestID].igChestItems[item_at_cell].uNumCharges = v6;
-        pChests[ uChestID].igChestItems[item_at_cell].uMaxCharges = v6;
-        }
-    v7 = pIcons_LOD->LoadTexture(pItemsTable->pItems[uItemID].pIconName, TEXTURE_16BIT_PALETTE);
-    v8 = pIcons_LOD->GetTexture(v7);
-    v9 = v8->uTextureWidth;
-    if ( v9 < 14 )
-        v9 = 14;
-    v10 = v8->uTextureHeight;
-    texture_cell_width = ((v9 - 14) >> 5) + 1;
-    if ( v10 < 14 )
-        v10 = 14;
-    textute_cell_height = ((v10 - 14) >> 5) + 1;
-    if ( !areWeLoadingTexture )
-        {
-        v8->Release();
-        pIcons_LOD->SyncLoadedFilesCount();
-        }
-    chest_cell_width = pChestWidthsByType[pChests[ uChestID].uChestBitmapID];
-    chest_cell_row_pos = 0;
-    for(int i=0; i<textute_cell_height; ++i) 
-        { 
-        for (int j=0; j<texture_cell_width; ++j)
-            {
-            pChests[uChestID].pInventoryIndices[put_cell_pos + chest_cell_row_pos+j]=(signed __int16)-(put_cell_pos+1);
-            } 
-        chest_cell_row_pos += chest_cell_width;
-        }
-    pChests[uChestID].pInventoryIndices[put_cell_pos] = item_at_cell + 1;
-    }
+  uItemID = pChests[ uChestID].igChestItems[item_at_cell].uItemID;
+  pItemsTable->SetSpecialBonus(&pChests[ uChestID].igChestItems[item_at_cell]);
+  if ( uItemID >= 135 && uItemID <= 159 && !pChests[ uChestID].igChestItems[item_at_cell].uNumCharges)
+  {
+    v6 = rand() % 21 + 10;
+    pChests[ uChestID].igChestItems[item_at_cell].uNumCharges = v6;
+    pChests[ uChestID].igChestItems[item_at_cell].uMaxCharges = v6;
+  }
+  v7 = pIcons_LOD->LoadTexture(pItemsTable->pItems[uItemID].pIconName, TEXTURE_16BIT_PALETTE);
+  texture = pIcons_LOD->GetTexture(v7);
+  v9 = texture->uTextureWidth;
+  if ( texture->uTextureWidth < 14 )
+    v9 = 14;
+  texture_cell_width = ((v9 - 14) >> 5) + 1;
+  v10 = texture->uTextureHeight;
+  if ( texture->uTextureHeight < 14 )
+    v10 = 14;
+  textute_cell_height = ((v10 - 14) >> 5) + 1;
+  if ( !areWeLoadingTexture )
+  {
+    texture->Release();
+    pIcons_LOD->SyncLoadedFilesCount();
+  }
+  chest_cell_width = pChestWidthsByType[pChests[ uChestID].uChestBitmapID];
+  chest_cell_row_pos = 0;
+  for(int i = 0; i < textute_cell_height; ++i) 
+  { 
+    for (int j = 0; j < texture_cell_width; ++j)
+      pChests[uChestID].pInventoryIndices[put_cell_pos + chest_cell_row_pos+j]=(signed __int16)-(put_cell_pos+1);
+    chest_cell_row_pos += chest_cell_width;
+  }
+  pChests[uChestID].pInventoryIndices[put_cell_pos] = item_at_cell + 1;
+}
 // 506128: using guessed type int areWeLoadingTexture;
 
 //----- (00420284) --------------------------------------------------------
@@ -597,18 +587,16 @@
 //----- (00458B03) --------------------------------------------------------
 void ChestList::ToFile()
 {
-  ChestList *v1; // esi@1
   FILE *v2; // eax@1
   FILE *v3; // edi@1
 
-  v1 = this;
   v2 = fopen("data\\dchest.bin", "wb");
   v3 = v2;
   if ( !v2 )
     Error("Unable to save dchest.bin!");
 
-  fwrite(v1, 4u, 1u, v2);
-  fwrite(v1->pChests, 0x24u, v1->uNumChests, v3);
+  fwrite(this, 4, 1, v2);
+  fwrite(this->pChests, 36, this->uNumChests, v3);
   fclose(v3);
 }
 
@@ -634,7 +622,7 @@
 //----- (00458B9C) --------------------------------------------------------
 int ChestList::FromFileTxt(const char *Args)
 {
-  ChestList *v2; // ebx@1
+  //ChestList *v2; // ebx@1
   __int32 v3; // edi@1
   FILE *v4; // eax@1
   unsigned int v5; // esi@3
@@ -652,11 +640,11 @@
   FILE *File; // [sp+2F4h] [bp-4h]@1
   unsigned int Argsa; // [sp+300h] [bp+8h]@3
 
-  v2 = this;
+  //v2 = this;
   free(this->pChests);
   v3 = 0;
-  v2->pChests = 0;
-  v2->uNumChests = 0;
+  this->pChests = 0;
+  this->uNumChests = 0;
   v4 = fopen(Args, "r");
   File = v4;
   if ( !v4 )
@@ -677,16 +665,16 @@
     v5 = Argsa;
     v3 = 0;
   }
-  v6 = v2->pChests;
-  v2->uNumChests = v5;
+  v6 = this->pChests;
+  this->uNumChests = v5;
   v7 = malloc(36 * v5);
-  v2->pChests = (ChestDesc *)v7;
+  this->pChests = (ChestDesc *)v7;
   if ( v7 == (void *)v3 )
     Error("ChestDescriptionList::load - Out of Memory!");
 
-  memset(v7, v3, 36 * v2->uNumChests);
+  memset(v7, v3, 36 * this->uNumChests);
   v8 = File;
-  v2->uNumChests = v3;
+  this->uNumChests = v3;
   fseek(v8, v3, v3);
   for ( i = fgets(&Buf, 490, File); i; i = fgets(&Buf, 490, File) )
   {
@@ -694,14 +682,14 @@
     memcpy(&v17, txt_file_frametable_parser(&Buf, &v16), sizeof(v17));
 	if ( v17.uPropCount && *v17.pProperties[0] != 47 )
     {
-      strcpy(v2->pChests[v2->uNumChests].pName, v17.pProperties[0]);
+      strcpy(this->pChests[this->uNumChests].pName, v17.pProperties[0]);
       v10 = atoi(v17.pProperties[1]);
       v11 = v17.pProperties[2];
-      v2->pChests[v2->uNumChests].uWidth = v10;
+      this->pChests[this->uNumChests].uWidth = v10;
       v12 = atoi(v11);
       v13 = v17.pProperties[3];
-      v2->pChests[v2->uNumChests].uHeight = v12;
-      v2->pChests[v2->uNumChests++].uTextureID = atoi(v13);
+      this->pChests[this->uNumChests].uHeight = v12;
+      this->pChests[this->uNumChests++].uTextureID = atoi(v13);
     }
   }
   fclose(File);
@@ -714,7 +702,7 @@
     void *v2; // eax@1
     ItemGen *v3; // ebx@1
     unsigned int v4; // eax@1
-    Texture *v5; // ecx@1
+    Texture *texture; // ecx@1
     signed int v6; // eax@1
     signed int v7; // edi@3
     signed int v8; // eax@3
@@ -742,21 +730,23 @@
     //v17 = pChestWidthsByType[*(short *)((char *)v2 + (int)pChests)];
 	v17 = pChestWidthsByType[pChests[v20].uChestBitmapID];
     v4 = pIcons_LOD->LoadTexture(v3->GetIconName(), TEXTURE_16BIT_PALETTE);
-    v5 = pIcons_LOD->GetTexture(v4);
-    v6 = v5->uTextureWidth;
-    if ( v6 < 14 )
-        v6 = 14;
+    texture = pIcons_LOD->GetTexture(v4);
+
+    v6 = texture->uTextureWidth;
+    if ( texture->uTextureWidth < 14 )
+      v6 = 14;
     v7 = v6 - 14;
-    v8 = v5->uTextureHeight;
     v9 = (v7 >> 5) + 1;
     v18 = v9;
-    if ( v8 < 14 )
-        v8 = 14;
+
+    v8 = texture->uTextureHeight;
+    if ( texture->uTextureHeight < 14 )
+      v8 = 14;
     v10 = ((v8 - 14) >> 5) + 1;
     v21 = v10;
     if ( !areWeLoadingTexture )
     {
-        v5->Release();
+        texture->Release();
         pIcons_LOD->SyncLoadedFilesCount();
         v10 = v21;
     }
@@ -829,9 +819,7 @@
         viewparams->bRedrawGameUI = 1;
       }
       else
-      {
         pParty->SetHoldingItem(&pChests[chest_id].igChestItems[v4]);
-      }
       sub_420B13(v4, v3);
     }
   }
--- a/Conditions.cpp	Thu Mar 06 00:41:04 2014 +0100
+++ b/Conditions.cpp	Sat Mar 08 22:23:20 2014 +0600
@@ -28,16 +28,14 @@
 bool ConditionProcessor::IsPlayerAffected( Player* inPlayer, int condToCheck, int blockable)
 {
   if ( !blockable )
-  {
     return true;
-  }
   ConditionProcessor* thisProc = &conditionArray[condToCheck];
   if (thisProc->m_IsBlockedByProtFromMagic && pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uExpireTime > 0)
   {
     if (!(thisProc->m_DoesNeedGmProtFromMagic && pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uSkill < 4))
     {
       --pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uPower;
-      if ( pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uPower < 1u )
+      if ( pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uPower < 1 )
         pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].Reset();
       return false;
     }
@@ -50,24 +48,18 @@
   for (unsigned int i = 0; i < thisProc->m_equipmentPairs.size() / 2; i++)
   {
     if (thisProc->m_equipmentPairs[i * 2].m_ItemId == (ITEM_TYPE)0)
-    {
       return true;
-    }
     ITEM_TYPE itemId = thisProc->m_equipmentPairs[i * 2].m_ItemId;
     ITEM_EQUIP_TYPE slot = thisProc->m_equipmentPairs[i * 2 + 1].m_EquipSlot;
     if (slot == EQIUP_ANY)
     {
       if (inPlayer->WearsItemAnyWhere(itemId))
-      {
         return false;
-      }
     }
     else
     {
       if (inPlayer->WearsItem(itemId, slot))
-      {
         return false;
-      }
     }
   }
   return true;
--- a/DecalBuilder.cpp	Thu Mar 06 00:41:04 2014 +0100
+++ b/DecalBuilder.cpp	Sat Mar 08 22:23:20 2014 +0600
@@ -32,16 +32,10 @@
       result = 0.0;
   }
   else
-  {
     result = 1.0;
-  }
   return result;
 }
 
-
-
-
-
 //----- (0043B6EF) --------------------------------------------------------
 void BloodsplatContainer::AddBloodsplat(float x, float y, float z, float radius, char r, char g, char b)
 {
@@ -53,7 +47,7 @@
   if ( this->uNumBloodsplats == 64 )
     v8 = 0;
   v9 = 5 * (v8 + 1);
-  v10 = &this->std__vector_pBloodsplats[8 * v9 / 0x28u];
+  v10 = &this->std__vector_pBloodsplats[8 * v9 / 40];
   v10->x = x;
   v10->y = y;
   v10->z = z;
@@ -469,12 +463,12 @@
 char DecalBuilder::ApplyDecals_OutdoorFace(ODMFace *pFace)
 {
 	double v8; // st7@12
-	unsigned int v10; // [sp+20h] [bp-1Ch]@1
+	//unsigned int v10; // [sp+20h] [bp-1Ch]@1
 
 	Bloodsplat *pBloodsplat;
 
 	this->uNumDecals = 0;
-	v10 = pBloodsplatContainer->std__vector_pBloodsplats_size;
+	//v10 = pBloodsplatContainer->std__vector_pBloodsplats_size;
 	if ( !pFace->Indoor_sky() && !pFace->Fluid() )
 	{
 		for(int i = 0; i < pBloodsplatContainer->std__vector_pBloodsplats_size; i++ )
@@ -506,28 +500,28 @@
 bool DecalBuilder::_49BE8A(struct Polygon *a2, Vec3_float_ *_a3, float *a4, RenderVertexSoft *a5, unsigned int uStripType, char a7)
 {
   bool result; // eax@1
-  RenderVertexSoft *v8; // edi@3
-  Vec3_float_ *v9; // ebx@3
-  Bloodsplat *v10; // esi@3
-  float v11; // eax@5
+  //RenderVertexSoft *v8; // edi@3
+  //Vec3_float_ *v9; // ebx@3
+  //Bloodsplat *v10; // esi@3
+  //float v11; // eax@5
   float v12; // eax@6
-  double v13; // st7@13
+  //double v13; // st7@13
   double v14; // st7@19
-  short v15; // eax@20
+  //short v15; // eax@20
   int v16; // eax@22
-  int v17; // edx@24
-  DecalBuilder *v18; // eax@24
+  //int v17; // edx@24
+  //DecalBuilder *v18; // eax@24
   std::string v19; // [sp-18h] [bp-54h]@12
   const char *v20; // [sp-8h] [bp-44h]@12
-  int v21; // [sp-4h] [bp-40h]@12
+  //int v21; // [sp-4h] [bp-40h]@12
   double v22; // [sp+Ch] [bp-30h]@19
   unsigned int v23; // [sp+14h] [bp-28h]@1
-  DecalBuilder *v24; // [sp+18h] [bp-24h]@1
-  int v25; // [sp+1Ch] [bp-20h]@19
+  //DecalBuilder *v24; // [sp+18h] [bp-24h]@1
+  //int v25; // [sp+1Ch] [bp-20h]@19
   float v26; // [sp+20h] [bp-1Ch]@12
   int v27; // [sp+24h] [bp-18h]@12
   float v28; // [sp+28h] [bp-14h]@13
-  float v29; // [sp+2Ch] [bp-10h]@7
+  //float v29; // [sp+2Ch] [bp-10h]@7
   float v30; // [sp+30h] [bp-Ch]@6
   float v31; // [sp+34h] [bp-8h]@6
   bool v32; // [sp+38h] [bp-4h]@2
@@ -535,92 +529,91 @@
 
   this->uNumDecals = 0;
   result = pBloodsplatContainer->std__vector_pBloodsplats_size != 0;
-  v24 = this;
+ // v24 = this;
   v23 = pBloodsplatContainer->std__vector_pBloodsplats_size;
   if ( pBloodsplatContainer->std__vector_pBloodsplats_size )
   {
-    v32 = 0;
+    
     if ( (signed int)pBloodsplatContainer->std__vector_pBloodsplats_size > 0 )
     {
-      v8 = a5;
-      v9 = _a3;
-	  v10 = pBloodsplatContainer->std__vector_pBloodsplats;
-      while ( v32 < (signed int)v23)
+      //v8 = a5;
+      //v9 = _a3;
+	  for ( v32 = 0; v32 < (signed int)v23; ++v32 )
       {
-		if ( uStripType == 4 )
-		{
-		  a3 = v8->vWorldPosition.x;
-		  v11 = v8[3].vWorldPosition.x;
-		  v31 = v11;
-		  v30 = v8[1].vWorldPosition.y;
-		  v12 = v8->vWorldPosition.y;
-		  v29 = v12;
-		}
-		else if ( uStripType == 3 )
+        if ( uStripType == 4 )
+        {
+          a3 = a5->vWorldPosition.x;
+          //v11 = v8[3].vWorldPosition.x;
+          v31 = a5[3].vWorldPosition.x;
+          v30 = a5[1].vWorldPosition.y;
+          v12 = a5->vWorldPosition.y;
+          //v29 = v12;
+        }
+        else if ( uStripType == 3 )
         {
           if ( a7 )
           {
-            a3 = v8->vWorldPosition.x;
-            v31 = v8[2].vWorldPosition.x;
-            v30 = v8[1].vWorldPosition.y;
-            v12 = v8[2].vWorldPosition.y;
-            v29 = v12;
+            a3 = a5->vWorldPosition.x;
+            v31 = a5[2].vWorldPosition.x;
+            v30 = a5[1].vWorldPosition.y;
+            v12 = a5[2].vWorldPosition.y;
+            //v29 = v12;
           }
 		  else
 		  {
-			  a3 = v8[1].vWorldPosition.x;
-			  v11 = v8[2].vWorldPosition.x;
-			  v31 = v11;
-			  v30 = v8[1].vWorldPosition.y;
-			  v12 = v8->vWorldPosition.y;
-			  v29 = v12;
+			  a3 = a5[1].vWorldPosition.x;
+			  //v11 = v8[2].vWorldPosition.x;
+			  v31 = a5[2].vWorldPosition.x;
+			  v30 = a5[1].vWorldPosition.y;
+			  v12 = a5->vWorldPosition.y;
+			  //v29 = v12;
 		  }
         }
 		else
 			MessageBoxW(nullptr, L"Uknown strip type detected!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\PolyProjector.cpp:434", 0);
-        v21 = uStripType;
-        v13 = pGame->pIndoorCameraD3D->GetPolygonMinZ(v8, uStripType);
-        v21 = uStripType;
-        v28 = v13;
-        v26 = pGame->pIndoorCameraD3D->GetPolygonMaxZ(v8, uStripType);
-		if ( a3 - v10->radius < v10->x &&
-			v31 + v10->radius > v10->x &&
-			v30 - v10->radius < v10->y &&
-            v29 + v10->radius > v10->y &&
-            v28 - v10->radius < v10->z &&
-            v26 + v10->radius > v10->z )
+        //v21 = uStripType;
+        //v13 = pGame->pIndoorCameraD3D->GetPolygonMinZ(v8, uStripType);
+        //v21 = uStripType;
+        v28 = pGame->pIndoorCameraD3D->GetPolygonMinZ(a5, uStripType);
+        v26 = pGame->pIndoorCameraD3D->GetPolygonMaxZ(a5, uStripType);
+		if ( a3 - pBloodsplatContainer->std__vector_pBloodsplats[v32].radius < pBloodsplatContainer->std__vector_pBloodsplats[v32].x &&
+			v31 + pBloodsplatContainer->std__vector_pBloodsplats[v32].radius > pBloodsplatContainer->std__vector_pBloodsplats[v32].x &&
+			v30 - pBloodsplatContainer->std__vector_pBloodsplats[v32].radius < pBloodsplatContainer->std__vector_pBloodsplats[v32].y &&
+            v12 + pBloodsplatContainer->std__vector_pBloodsplats[v32].radius > pBloodsplatContainer->std__vector_pBloodsplats[v32].y &&
+            v28 - pBloodsplatContainer->std__vector_pBloodsplats[v32].radius < pBloodsplatContainer->std__vector_pBloodsplats[v32].z &&
+            v26 + pBloodsplatContainer->std__vector_pBloodsplats[v32].radius > pBloodsplatContainer->std__vector_pBloodsplats[v32].z )
         {
-			Vec3_float_::NegDot(&v8->vWorldPosition, v9, a4);
-			v26 = v9->y * v10->y
-				+ v9->z * v10->z
-				+ v9->x * v10->x
+			Vec3_float_::NegDot(&a5->vWorldPosition, _a3, a4);
+			v26 = _a3->y * pBloodsplatContainer->std__vector_pBloodsplats[v32].y
+				+ _a3->z * pBloodsplatContainer->std__vector_pBloodsplats[v32].z
+				+ _a3->x * pBloodsplatContainer->std__vector_pBloodsplats[v32].x
 				+ *a4;
 			v22 = v26 + 6.7553994e15;
-			v25 = LODWORD(v22);
+			//v25 = LODWORD(v22);
 			v14 = (double)SLODWORD(v22);
 			v28 = v14;
-			if ( v14 <= v10->radius )
+			if ( v14 <= pBloodsplatContainer->std__vector_pBloodsplats[v32].radius )
 			{
-				v15 = a2->flags;
+				//v15 = a2->flags;
 				if ( a2->flags & 2 || a2->flags & 0x100 )
 				{
-					v16 = v10->field_1C;
-					if ( !(v16 & 1) )
+					v16 = pBloodsplatContainer->std__vector_pBloodsplats[v32].field_1C;
+					if ( !(pBloodsplatContainer->std__vector_pBloodsplats[v32].field_1C & 1) )
 					{
 						LOBYTE(v16) = v16 | 1;
-						v10->field_1C = v16;
-						v10->field_20 = pEventTimer->Time();
+						pBloodsplatContainer->std__vector_pBloodsplats[v32].field_1C = v16;
+						pBloodsplatContainer->std__vector_pBloodsplats[v32].field_20 = pEventTimer->Time();
 					}
 				}
-				v17 = v32;
-				v10->dot_dist = LODWORD(v28);
-				v18 = v24;
-				v24->std__vector_30B00C[v24->uNumDecals] = v17;
-				++v18->uNumDecals;
+				//v17 = v32;
+				pBloodsplatContainer->std__vector_pBloodsplats[v32].dot_dist = LODWORD(v28);
+				//v18 = this;
+				this->std__vector_30B00C[this->uNumDecals] = v32;
+				++this->uNumDecals;
 			}
         }
-        ++v32;
-        ++v10;
+        //++v32;
+        //++v10;
         result = v32;
       }
     }
--- a/DecorationList.cpp	Thu Mar 06 00:41:04 2014 +0100
+++ b/DecorationList.cpp	Sat Mar 08 22:23:20 2014 +0600
@@ -239,44 +239,29 @@
 //----- (00458600) --------------------------------------------------------
 void DecorationList::ToFile()
 {
-  DecorationList *v1; // esi@1
   FILE *v2; // eax@1
   FILE *v3; // edi@1
 
-  v1 = this;
   v2 = fopen("data\\ddeclist.bin", "wb");
   v3 = v2;
   if ( !v2 )
     Error("Unable to save ddeclist.bin!");
 
-  fwrite(v1, 4u, 1u, v2);
-  fwrite(v1->pDecorations, 0x54u, v1->uNumDecorations, v3);
+  fwrite(this, 4, 1, v2);
+  fwrite(this->pDecorations, 84, this->uNumDecorations, v3);
   fclose(v3);
 }
 //----- (004488B6) --------------------------------------------------------
 unsigned __int16 DecorationList::GetDecorIdByName(const char *pName)
 {
-  DecorationList *v2; // esi@1
-  signed int uID; // edi@2
-  signed int v4; // ebx@3
-  unsigned __int16 result; // ax@6
 
-  v2 = this;
-  if ( pName && (uID = 1, (signed int)this->uNumDecorations > 1) )
+  if ( pName &&  (signed int)this->uNumDecorations > 1 )
   {
-    v4 = 1;
-    while ( _stricmp(pName, v2->pDecorations[v4].pName) )
+    for ( uint uID = 1; uID < (signed int)this->uNumDecorations; ++uID )
     {
-      ++uID;
-      ++v4;
-      if ( uID >= (signed int)v2->uNumDecorations )
-        return 0;
+      if ( !_stricmp(pName, this->pDecorations[uID].pName) )
+        return uID;
     }
-    result = uID;
   }
-  else
-  {
-    result = 0;
-  }
-  return result;
+  return 0;
 }
\ No newline at end of file