diff Indoor.cpp @ 1583:75fafd8ced59

Allocator (CMemory) bye-bye
author Nomad
date Tue, 10 Sep 2013 21:07:07 +0200
parents c44db078127d
children ccde94f02b75
line wrap: on
line diff
--- a/Indoor.cpp	Tue Sep 10 18:43:52 2013 +0200
+++ b/Indoor.cpp	Tue Sep 10 21:07:07 2013 +0200
@@ -17,7 +17,6 @@
 #include "Time.h"
 #include "Party.h"
 #include "Math.h"
-#include "Allocator.h"
 #include "LOD.h"
 #include "DecorationList.h"
 #include "ObjectList.h"
@@ -1023,15 +1022,15 @@
 
   v1 = this;
   v2 = (char *)&this->ptr_0002B4_doors_ddata;
-  pAllocator->FreeChunk(this->ptr_0002B4_doors_ddata);
+  free(this->ptr_0002B4_doors_ddata);
   *(int *)v2 = 0;
-  pAllocator->FreeChunk(v1->ptr_0002B0_sector_rdata);
+  free(v1->ptr_0002B0_sector_rdata);
   v1->ptr_0002B0_sector_rdata = 0;
-  pAllocator->FreeChunk(v1->ptr_0002B8_sector_lrdata);
+  free(v1->ptr_0002B8_sector_lrdata);
   v1->ptr_0002B8_sector_lrdata = 0;
-  pAllocator->FreeChunk(v1->pLFaces);
+  free(v1->pLFaces);
   v1->pLFaces = 0;
-  pAllocator->FreeChunk(v1->pSpawnPoints);
+  free(v1->pSpawnPoints);
   v3 = v1->pVertices;
   v1->pSpawnPoints = 0;
   v1->uNumSectors = 0;
@@ -1040,14 +1039,14 @@
   v1->uNumNodes = 0;
   v1->uNumDoors = 0;
   v1->uNumLights = 0;
-  pAllocator->FreeChunk(v3);
-  pAllocator->FreeChunk(v1->pFaces);
-  pAllocator->FreeChunk(v1->pFaceExtras);
-  pAllocator->FreeChunk(v1->pSectors);
-  pAllocator->FreeChunk(v1->pLights);
-  pAllocator->FreeChunk(v1->pDoors);
-  pAllocator->FreeChunk(v1->pNodes);
-  pAllocator->FreeChunk(v1->pMapOutlines);
+  free(v3);
+  free(v1->pFaces);
+  free(v1->pFaceExtras);
+  free(v1->pSectors);
+  free(v1->pLights);
+  free(v1->pDoors);
+  free(v1->pNodes);
+  free(v1->pMapOutlines);
   v1->pVertices = 0;
   v1->pFaces = 0;
   v1->pFaceExtras = 0;
@@ -1062,14 +1061,14 @@
 //----- (00498C45) --------------------------------------------------------
 bool IndoorLocation::Alloc()
     {
-  pVertices   = (Vec3_short_ *)   pAllocator->AllocNamedChunk(pVertices, 15000*sizeof(Vec3_short_),  "L.V");//0x15F90u
-  pFaces      = (BLVFace *)       pAllocator->AllocNamedChunk(pFaces,    10000*sizeof(BLVFace),      "L.F");//0xEA600u
-  pFaceExtras = (BLVFaceExtra *)  pAllocator->AllocNamedChunk(pFaceExtras,5000*sizeof(BLVFaceExtra), "L.FX"); //0x2BF20u
-  pSectors =    (BLVSector *)     pAllocator->AllocNamedChunk(pSectors,    512*sizeof(BLVSector),     "L.R");//0xE800u
-  pLights =     (BLVLightMM7 *)   pAllocator->AllocNamedChunk(pLights,     400*sizeof(BLVLightMM7),   "L.L");//0x1900u
-  pDoors =      (BLVDoor *)       pAllocator->AllocNamedChunk(pDoors,      200*sizeof(BLVDoor),       "L.D");//0x3E80u
-  pNodes =      (BSPNode *)       pAllocator->AllocNamedChunk(pNodes,     5000*sizeof(BSPNode),       "L.BSP");//0x9C40u
-  pMapOutlines =(BLVMapOutlines *)pAllocator->AllocNamedChunk(pMapOutlines,   sizeof(BLVMapOutlines), "L.Map");//0x14824u
+  pVertices   = (Vec3_short_ *)   malloc(15000 * sizeof(Vec3_short_));//0x15F90u
+  pFaces      = (BLVFace *)       malloc(10000 * sizeof(BLVFace));//0xEA600u
+  pFaceExtras = (BLVFaceExtra *)  malloc(5000 * sizeof(BLVFaceExtra)); //0x2BF20u
+  pSectors =    (BLVSector *)     malloc(512 * sizeof(BLVSector));//0xE800u
+  pLights =     (BLVLightMM7 *)   malloc(400 * sizeof(BLVLightMM7));//0x1900u
+  pDoors =      (BLVDoor *)       malloc(200 * sizeof(BLVDoor));//0x3E80u
+  pNodes =      (BSPNode *)       malloc(5000 * sizeof(BSPNode));//0x9C40u
+  pMapOutlines =(BLVMapOutlines *)malloc(sizeof(BLVMapOutlines));//0x14824u
   if (pVertices && pFaces && pFaceExtras && pSectors && pLights && pDoors && pNodes && pMapOutlines )
   {
     memset(pVertices,  0, 15000*sizeof(Vec3_short_));
@@ -1345,7 +1344,7 @@
       fread(&uNumFaces, 4u, 1u, v7);
       fseek(v7, v210, 0);
       fread(pFaces, 0x60u, uNumFaces, v7);
-      v10 = pAllocator->AllocNamedChunk(ptr_2AC, blv.uFaces_fdata_Size, "L.FData");
+      v10 = malloc(ptr_2AC, blv.uFaces_fdata_Size, "L.FData");
       v202 = (int)v7;
       ptr_2AC = (unsigned __int16 *)v10;
       fread(v10, 1u, blv.uFaces_fdata_Size, (FILE *)v202);
@@ -1466,7 +1465,7 @@
       fread(&uNumSectors, 4u, 1u, v7);
       fseek(v7, v214, 0);
       fread(pSectors, 0x74u, uNumSectors, v7);
-      v32 = pAllocator->AllocNamedChunk(ptr_0002B0_sector_rdata, blv.uSector_rdata_Size, "L.RData");
+      v32 = malloc(ptr_0002B0_sector_rdata, blv.uSector_rdata_Size, "L.RData");
       v202 = (int)v7;
       ptr_0002B0_sector_rdata = (unsigned __int16 *)v32;
       fread(v32, 1u, blv.uSector_rdata_Size, (FILE *)v202);
@@ -1523,7 +1522,7 @@
         }
         while ( Argse < uNumSectors );
       }
-      v47 = pAllocator->AllocNamedChunk(
+      v47 = malloc(
               ptr_0002B8_sector_lrdata,
               blv.uSector_lrdata_Size,
               "L.RLData");
@@ -1554,7 +1553,7 @@
       fread(&uNumDoors, 4u, 1u, v7);
       fseek(v7, v216, 0);
       fread(pDoors, 0x50u, 0xC8u, v7);
-      v51 = pAllocator->AllocNamedChunk(ptr_0002B4_doors_ddata, blv.uDoors_ddata_Size, "L.DData");
+      v51 = malloc(ptr_0002B4_doors_ddata, blv.uDoors_ddata_Size, "L.DData");
       v202 = (int)v7;
       ptr_0002B4_doors_ddata = (unsigned __int16 *)v51;
       fread(v51, 1u, blv.uDoors_ddata_Size, (FILE *)v202);
@@ -1718,7 +1717,7 @@
       fread(pNodes, 8u, uNumNodes, v7);
       fseek(v7, v230, 0);
       fread(&uNumSpawnPoints, 4u, 1u, v7);
-      v79 = pAllocator->AllocNamedChunk(pSpawnPoints, 24 * uNumSpawnPoints, "Spawn");
+      v79 = malloc(pSpawnPoints, 24 * uNumSpawnPoints, "Spawn");
       v202 = 0;
       pSpawnPoints = (SpawnPointMM7 *)v79;
       fseek(v7, v231, v202);
@@ -1823,7 +1822,7 @@
   pGameLoadingUI_ProgressBar->Progress();
 
   memcpy(pFaces, pData += 4, uNumFaces * sizeof (BLVFace));
-  pLFaces = (unsigned __int16 *)pAllocator->AllocNamedChunk(pLFaces, blv.uFaces_fdata_Size, "L.FData");
+  pLFaces = (unsigned __int16 *)malloc(blv.uFaces_fdata_Size);
 
   memcpy(pLFaces, pData += uNumFaces * sizeof (BLVFace), blv.uFaces_fdata_Size);
 
@@ -1951,7 +1950,7 @@
 
   pGameLoadingUI_ProgressBar->Progress();
 
-  ptr_0002B0_sector_rdata = (unsigned short *)pAllocator->AllocNamedChunk(ptr_0002B0_sector_rdata, blv.uSector_rdata_Size, "L.RData");
+  ptr_0002B0_sector_rdata = (unsigned short *)malloc(blv.uSector_rdata_Size);//, "L.RData");
   memcpy(ptr_0002B0_sector_rdata, pData, blv.uSector_rdata_Size);
   pData += blv.uSector_rdata_Size;
 
@@ -2034,7 +2033,7 @@
     //while ( v245 < uNumSectors );
   }
 
-  ptr_0002B8_sector_lrdata = (unsigned __int16 *)pAllocator->AllocNamedChunk(ptr_0002B8_sector_lrdata, blv.uSector_lrdata_Size, "L.RLData");
+  ptr_0002B8_sector_lrdata = (unsigned __int16 *)malloc(blv.uSector_lrdata_Size);//, "L.RLData");
   memcpy(ptr_0002B8_sector_lrdata, pData, blv.uSector_lrdata_Size);
   pData += blv.uSector_lrdata_Size;
 
@@ -2082,7 +2081,7 @@
   pGameLoadingUI_ProgressBar->Progress();
 
   memcpy(&uNumSpawnPoints, pData, 4);
-  pSpawnPoints = (SpawnPointMM7 *)pAllocator->AllocNamedChunk(pSpawnPoints, uNumSpawnPoints * sizeof(SpawnPointMM7), "Spawn");
+  pSpawnPoints = (SpawnPointMM7 *)malloc(uNumSpawnPoints * sizeof(SpawnPointMM7));
   memcpy(pSpawnPoints, pData + 4, uNumSpawnPoints * sizeof(SpawnPointMM7));
   pData += 4 + uNumSpawnPoints * sizeof(SpawnPointMM7);
   
@@ -2294,9 +2293,9 @@
 
   //v201 = (const char *)blv.uDoors_ddata_Size;
   //v200 = (size_t)ptr_0002B4_doors_ddata;
-  //v170 = pAllocator->AllocNamedChunk(ptr_0002B4_doors_ddata, blv.uDoors_ddata_Size, "L.DData");
+  //v170 = malloc(ptr_0002B4_doors_ddata, blv.uDoors_ddata_Size, "L.DData");
   //v171 = blv.uDoors_ddata_Size;
-  ptr_0002B4_doors_ddata = (unsigned __int16 *)pAllocator->AllocNamedChunk(ptr_0002B4_doors_ddata, blv.uDoors_ddata_Size, "L.DData");
+  ptr_0002B4_doors_ddata = (unsigned __int16 *)malloc(blv.uDoors_ddata_Size);//, "L.DData");
   memcpy(ptr_0002B4_doors_ddata, pData, blv.uDoors_ddata_Size);
   pData += blv.uDoors_ddata_Size;
 
@@ -3690,7 +3689,7 @@
     v3 = v37;
   }
   dword_6BE13C_uCurrentlyLoadedLocationID = v39;
-  pAllocator->FreeChunk(ptr_6A0D08);
+  free(ptr_6A0D08);
   ptr_6A0D08 = 0;
   _6A0D0C_txt_lod_loading = 0;
   TryLoadLevelFromLOD();