changeset 1607:d4282f59f312

Слияние
author Ritor1
date Wed, 11 Sep 2013 00:16:58 +0600
parents 25f5c041f39b (current diff) e42073046f92 (diff)
children fb809d1891bd
files Allocator.cpp Allocator.h
diffstat 48 files changed, 694 insertions(+), 913 deletions(-) [+]
line wrap: on
line diff
--- a/Actor.cpp	Wed Sep 11 00:16:49 2013 +0600
+++ b/Actor.cpp	Wed Sep 11 00:16:58 2013 +0600
@@ -32,7 +32,6 @@
 #include "stru298.h"
 #include "Log.h"
 #include "Texts.h"
-#include "Allocator.h"
 
 
 
@@ -5401,8 +5400,7 @@
   monster_id = a1;
   x_ = x;
   v15 = a1;
-  if (uNumActors < 500
-    && ((signed int)pAllocator->uBigBufferSizeAligned >> 10) - ((signed int)pAllocator->uNextFreeOffsetInBigBuffer >> 10) >= 2000 )
+  if (uNumActors < 500)
   {
     v16 = 0;
     if ( uCurrentlyLoadedLevelType == LEVEL_Indoor )
--- a/Allocator.cpp	Wed Sep 11 00:16:49 2013 +0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,427 +0,0 @@
-#ifdef _MSC_VER
-#define _CRT_SECURE_NO_WARNINGS
-#endif
-
-#include <string.h>
-#include <stdio.h>
-
-#include "Allocator.h"
-#include "ErrorHandling.h"
-
-#include "mm7_data.h"
-
-
-
-Allocator *pAllocator; // idb
-
-int aborting_app = false; // weak
-
-
-
-
-void __fastcall CheckMemoryAccessibility(void *pBase, DWORD uSize);
-
-
-
-//----- (00426755) --------------------------------------------------------
-void *Allocator::AllocNamedChunk(const void *pPrevPtrValue, unsigned int uSize, const char *pName)
-{
-  Assert(!pPrevPtrValue, "PrevPtrValue != 0");
-
-  if (!uSize)
-	  return 0;
-  return malloc(uSize);
-/*
-  //Allocator *v4; // esi@1
-  unsigned int v5; // eax@7
-  void *result; // eax@8
- // unsigned int *pNumBuffersUsed; // ebx@12
-  unsigned int v8; // edi@15
-  char v9; // zf@15
-  int v10; // eax@16
-  void **v11; // ebx@19
-  void *v12; // eax@22
-  unsigned int Size; // [sp+14h] [bp+Ch]@16
-
-  int aligned_size; 
-
-
-  if ( pPrevPtrValue && !aborting_app )
-	  AbortWithError();
-  if ( !bBigBufferAllocated && !aborting_app )
-	  AbortWithError();
-
-  if (!uSize)
-	  return 0;
-
-  if (((uSize & 0x80000000u) != 0) && !aborting_app)
-	  AbortWithError();
-
-  if (uNumBuffersUsed == 6000 && !aborting_app)
-	  AbortWithError();
-
-  ++uNumBuffersUsed;
-
-  if (!bUseBigBuffer)
-	  {
-	  pMemoryBuffers[uNumBuffersUsed] = malloc(uSize);
-	  if (pMemoryBuffers[uNumBuffersUsed])
-		  uMemoryBuffersSizes[uNumBuffersUsed] = uSize;
-	  else
-		  {
-		  if ( !aborting_app )
-			  AbortWithError();
-		  }
-	  }
-  else
-	  {
-
-	  aligned_size =(uSize&0xFFFFFFFC) + 4;
-
-	  if ((uNextFreeOffsetInBigBuffer +aligned_size) > uBigBufferSizeAligned)
-		  {
-		  printf("Id: %s  Size: %i", pName, aligned_size);
-		  CreateFileDump( "Memory");
-		  if ( !aborting_app )
-			  AbortWithError();
-		  }
-
-	  pMemoryBuffers[uNumBuffersUsed] = (char *)pBigMemoryBuffer + uNextFreeOffsetInBigBuffer;//(char *)(pBigBufferAligned) + uNextFreeOffsetInBigBuffer;
-	  uMemoryBuffersSizes[uNumBuffersUsed] =aligned_size;
-
-	  if (pName)
-		  strncpy(pMemoryBuffersNames[uNumBuffersUsed], pName, 11);
-	  uNextFreeOffsetInBigBuffer += aligned_size;
-	  }
-  return pMemoryBuffers[uNumBuffersUsed];
-  */
-  /*
-  //v4 = this;
-  if ( pPrevPtrValue && !aborting_app )
-    AbortWithError();
-  if ( !bBigBufferAllocated && !aborting_app )
-    AbortWithError();
-  v5 = uSize;
-  if ( uSize )
-  {
-    if ( (uSize & 0x80000000u) != 0 && !aborting_app )
-    {
-      AbortWithError();
-      v5 = uSize;
-    }
-    pNumBuffersUsed = &uNumBuffersUsed;
-    if (uNumBuffersUsed == 6000 && !aborting_app)
-    {
-      AbortWithError();
-      v5 = uSize;
-    }
-    v8 = *pNumBuffersUsed;
-    v9 = bUseBigBuffer == 0;
-    ++*pNumBuffersUsed;
-    if ( v9 )
-    {
-      v12 = malloc(v5);
-      v11 = &pMemoryBuffers[v8];
-      *v11 = v12;
-      if ( v12 )
-      {
-        uMemoryBuffersSizes[v8] = uSize;
-      }
-      else
-      {
-        if ( !aborting_app )
-          AbortWithError();
-      }
-    }
-    else
-    {
-      LOBYTE(v5) = v5 & 0xFC;
-      v10 = v5 + 4;
-      Size = v10;
-      if ( v10 + uNextFreeOffsetInBigBuffer > uBigBufferSizeAligned )
-      {
-        printf("Id: %s  Size: %i\n", pName, v10);
-        CreateFileDump("Memory");
-        if ( !aborting_app )
-          AbortWithError();
-      }
-      v11 = &pMemoryBuffers[v8];
-      *v11 = (char *)pBigMemoryBuffer + uNextFreeOffsetInBigBuffer;
-      uMemoryBuffersSizes[v8] = Size;
-      if (pName)
-        strncpy(pMemoryBuffersNames[v8], pName, 11);
-      uNextFreeOffsetInBigBuffer += Size;
-    }
-    result = *v11;
-  }
-  else
-  {
-    result = 0;
-  }
-  return result;*/
-}
-// 720018: using guessed type int aborting_app;
-
-
-
-//----- (004266CD) --------------------------------------------------------
-bool Allocator::Initialize(unsigned int uNumKBytes)
-{
-  if (bBigBufferAllocated)
-    return false;
-
-  if (!uNumKBytes)
-    return false;
-
-  pBigMemoryBuffer = malloc(uNumKBytes * 1024);
-  if (!pBigMemoryBuffer)
-    return false;
-
-  pBigBufferAligned = (void *)((unsigned int)(pBigMemoryBuffer) & 0xFFFF0000 + 4096);
-  //(char *)pBigMemoryBuffer + -((unsigned __int16)pBigMemoryBuffer & 0xFFF) + 4096;
-  uBigBufferSizeAligned = (uNumKBytes * 1024) - 4096;
-
-  uNumBuffersUsed = 0;
-  uNextFreeOffsetInBigBuffer = 0;
-
-  bUseBigBuffer = true;
-  return bBigBufferAllocated = true;
-}
-
-
-//----- (00426474) --------------------------------------------------------
-void Allocator::FreeChunk(void *ptr)
-{
-	free(ptr);
-	return;
-/*  Allocator *v2; // esi@1
-  unsigned int v3; // eax@5
-  signed int i; // edi@5
-  unsigned int v5; // eax@13
-  signed int v6; // ecx@16
-  signed int j; // edx@16
-  char v8; // zf@20
-
- 
-  
-  unsigned int  uBuffindx; 
-  unsigned int indx;
-
-  if (ptr)
-	  {
-	  if ((!bBigBufferAllocated)&& (!aborting_app ))
-		  AbortWithError();
-	  for (indx = 0; indx <=uNumBuffersUsed; ++indx)
-		  if (pMemoryBuffers[indx] == ptr)	
-			  break;
-	  //if ((indx>uNumBuffersUsed)&& !aborting_app )
-		  //AbortWithError(); //to detect memory problems - uncomment
-	  if (!bUseBigBuffer)
-		  free(pMemoryBuffers[indx]);
-	  pMemoryBuffers[indx] = NULL;
-	  uMemoryBuffersSizes[indx] = 0;
-	  pMemoryBuffersNames[indx][0] = 0;
-	  if (indx == (uNumBuffersUsed-1))
-		  {
-		  if (indx>0)
-			  {
-			  uBuffindx = 0;
-			  for (j = 0; j < uNumBuffersUsed-1; ++j)
-				  {
-				  if (pMemoryBuffers[j])
-					  uBuffindx = j;
-				  }
-			  uNumBuffersUsed =  uBuffindx + 1;
-			  if (bUseBigBuffer)
-				  uNextFreeOffsetInBigBuffer = 
-				  ((long)((char*)pMemoryBuffers[uBuffindx] -(char*)pBigBufferAligned)+ uMemoryBuffersSizes[uBuffindx]);
-			  }
-		  else
-			  {
-			  uNumBuffersUsed = 0;
-			  uNextFreeOffsetInBigBuffer = 0;
-			  }
-		  }
-	  }
-	  */
-/*
-  v2 = this;
-  if ( ptr )
-  {
-    if ( !this->bBigBufferAllocated && !aborting_app )
-      AbortWithError();
-    v3 = v2->uNumBuffersUsed;
-    for ( i = 0; i < (signed int)v3; ++i )
-    {
-      if ( v2->pMemoryBuffers[i] == ptr )
-        break;
-    }
-    if ( i >= (signed int)v3 && !aborting_app )
-      AbortWithError();
-    if ( !v2->bUseBigBuffer )
-      free(v2->pMemoryBuffers[i]);
-    v2->pMemoryBuffers[i] = 0;
-    v2->uMemoryBuffersSizes[i] = 0;
-    LOBYTE(v2->pMemoryBuffers[3 * i + 12000]) = 0;
-    v5 = v2->uNumBuffersUsed;
-    if ( i == v5 - 1 )
-    {
-      if ( i )
-      {
-        v6 = 0;
-        for ( j = 0; j < (signed int)v5; ++j )
-        {
-          if ( v2->pMemoryBuffers[j] )
-            v6 = j;
-        }
-        v8 = v2->bUseBigBuffer == 0;
-        v2->uNumBuffersUsed = v6 + 1;
-        if ( !v8 )
-          v2->uNextFreeOffsetInBigBuffer = (char *)v2->pMemoryBuffers[v6]
-                                         + v2->uMemoryBuffersSizes[v6]
-                                         - v2->pBigMemoryBuffer;
-      }
-      else
-      {
-        v2->uNextFreeOffsetInBigBuffer = 0;
-        v2->uNumBuffersUsed = 0;
-      }
-    }
-  }*/
-}
-// 720018: using guessed type int aborting_app;
-
-
-
-//----- (00426429) --------------------------------------------------------
-Allocator::Allocator()
-{
-  Allocator *v1; // eax@1
-  signed int v2; // ecx@1
-  int v3; // edx@1
-
-  v1 = this;
-  v2 = 0;
-  v1->uBigBufferSizeAligned = 0;
-  v1->bBigBufferAllocated = 0;
-  v3 = (int)v1->pMemoryBuffersNames;
-  do
-  {
-    v1->pMemoryBuffers[v2] = 0;
-    v1->uMemoryBuffersSizes[v2] = 0;
-    *(char *)v3 = 0;
-    ++v2;
-    v3 += 12;
-  }
-  while ( v2 < 6000 );
-  v1->uDumpsCount = 0;
-}
-
-
-//----- (0042654C) --------------------------------------------------------
-bool Allocator::CreateFileDump(const char *a1)
-{
-  Allocator *v2; // esi@1
-  unsigned int v3; // ST44_4@1
-  FILE *v4; // eax@1
-  FILE *v5; // edi@1
-  bool result; // eax@2
-  unsigned int v7; // ecx@5
-  int v8; // edx@5
-  int v9; // eax@6
-  int v10; // eax@8
-  int v11; // ecx@8
-  signed int v12; // ebx@8
-  signed int v13; // ebx@10
-  struct _MEMORYSTATUS memstat; // [sp+8h] [bp-38h]@5
-  char Filename[20]; // [sp+28h] [bp-18h]@1
-  unsigned int *v16; // [sp+3Ch] [bp-4h]@11
-  int a1a; // [sp+48h] [bp+8h]@11
-
-  v2 = this;
-  v3 = this->uDumpsCount;
-  this->uDumpsCount = v3 + 1;
-  sprintf(Filename, "Mem%03i.txt", v3);
-  v4 = fopen(Filename, "w");
-  v5 = v4;
-  if ( v4 )
-  {
-    if ( a1 )
-      fprintf(v4, "%s\n\n", a1);
-    fprintf(v5, "Windows Memory Status");
-    GlobalMemoryStatus(&memstat);
-    fprintf(v5, "dwLength:         %d\n\n", memstat.dwLength);
-    fprintf(v5, "dwMemoryLoad:     %d\n", memstat.dwMemoryLoad);
-    fprintf(v5, "dwTotalPhys:      %d\n", memstat.dwTotalPhys);
-    fprintf(v5, "dwAvailPhys:      %d\n", memstat.dwAvailPhys);
-    fprintf(v5, "dwTotalPageFile:  %d\n", memstat.dwTotalPageFile);
-    fprintf(v5, "dwAvailPageFile:  %d\n", memstat.dwAvailPageFile);
-    fprintf(v5, "dwTotalVirtual:   %d\n", memstat.dwTotalVirtual);
-    fprintf(v5, "dwAvailVirtual:   %d\n\n\n", memstat.dwAvailVirtual);
-    v7 = v2->uNumBuffersUsed;
-    v8 = 0;
-    if ( (signed int)v7 > 0 )
-    {
-      v9 = (int)v2->uMemoryBuffersSizes;
-      do
-      {
-        v8 += *(int *)v9;
-        v9 += 4;
-        --v7;
-      }
-      while ( v7 );
-    }
-    v10 = 0;
-    v11 = (int)v2->uMemoryBuffersSizes;
-    v12 = 6000;
-    do
-    {
-      v10 += *(int *)v11;
-      v11 += 4;
-      --v12;
-    }
-    while ( v12 );
-    fprintf(v5, "Size: %i  %i  %i\n\n", v2->uNumBuffersUsed, v8, v10);
-    v13 = 0;
-    if ( (signed int)v2->uNumBuffersUsed > 0 )
-    {
-      v16 = v2->uMemoryBuffersSizes;
-      a1a = (int)v2->pMemoryBuffersNames;
-      do
-      {
-        fprintf(v5, "%10i %10i %s\n", v13, *v16, a1a);
-        a1a += 12;
-        ++v16;
-        ++v13;
-      }
-      while ( v13 < (signed int)v2->uNumBuffersUsed );
-    }
-    fclose(v5);
-    result = 0;
-  }
-  else
-  {
-    result = 1;
-  }
-  return result;
-}
-
-
-
-
-
-
-
-
-//----- (00426892) --------------------------------------------------------
-static void __fastcall CheckMemoryAccessibility(void *pBase, DWORD uSize)
-{
-  DWORD v2; // edi@1
-  DWORD i; // eax@1
-  struct _SYSTEM_INFO SystemInfo; // [sp+8h] [bp-24h]@1
-
-  v2 = uSize;
-  GetSystemInfo(&SystemInfo);
-  for ( i = 16 * SystemInfo.dwPageSize; i < v2; i += SystemInfo.dwPageSize )
-    ;
-}
--- a/Allocator.h	Wed Sep 11 00:16:49 2013 +0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-#pragma once
-
-
-#pragma pack(push, 1)
-struct Allocator
-{
-  static Allocator *Create() {static Allocator a; return &a;}
-
-  Allocator();
-  bool  Initialize(unsigned int uNumKBytes);
-  void *AllocNamedChunk(const void *pPrevPtrValue, unsigned int uSize, const char *pName);
-  void FreeChunk(void *ptr);
-  bool CreateFileDump(const char *a1);
-
-  void *pMemoryBuffers[6000];
-  unsigned int uMemoryBuffersSizes[6000];
-  char pMemoryBuffersNames[6000][12];
-  unsigned int uDumpsCount;
-  unsigned int uNumBuffersUsed;
-  void *pBigMemoryBuffer;
-  unsigned int uNextFreeOffsetInBigBuffer;
-  unsigned int uBigBufferSizeAligned;
-  unsigned int bBigBufferAllocated;
-  unsigned int bUseBigBuffer;
-  void *pBigBufferAligned;
-};
-#pragma pack(pop)
-
-
-
-extern Allocator *pAllocator; // idb
\ No newline at end of file
--- a/AudioPlayer.cpp	Wed Sep 11 00:16:49 2013 +0600
+++ b/AudioPlayer.cpp	Wed Sep 11 00:16:58 2013 +0600
@@ -7,7 +7,6 @@
 #include "mm7_data.h"
 #include "VideoPlayer.h"
 #include "AudioPlayer.h"
-#include "Allocator.h"
 #include "FrameTableInc.h"
 #include "Indoor.h"
 #include "SpriteObject.h"
@@ -399,7 +398,7 @@
   assert(sNumSounds);
   assert(!num_mm8_sounds);
 
-  pSounds = (SoundDesc *)pAllocator->AllocNamedChunk(pSounds, sNumSounds * sizeof(SoundDesc), "Snd Des.");
+  pSounds = (SoundDesc *)malloc(sNumSounds * sizeof(SoundDesc));
   memcpy(pSounds, (char *)data_mm7 + 4, num_mm7_sounds * sizeof(SoundDesc));
   for (uint i = 0; i < num_mm6_sounds; ++i)
   {
@@ -436,7 +435,7 @@
   unsigned int Argsa; // [sp+304h] [bp+8h]@3
 
   v2 = this;
-  pAllocator->FreeChunk(this->pSounds);
+  free(this->pSounds);
   v3 = 0;
   v2->pSounds = 0;
   v2->sNumSounds = 0;
@@ -461,7 +460,7 @@
     v3 = 0;
   }
   v2->sNumSounds = v5;
-  v6 = pAllocator->AllocNamedChunk(v2->pSounds, 120 * v5, "Snd Des.");
+  v6 = malloc(120 * v5);
   v2->pSounds = (SoundDesc *)v6;
   if ( v6 == (void *)v3 )
     Error("SoundListClass::load - Out of Memory!");
@@ -1873,7 +1872,7 @@
 
   ReadFile(hAudioSnd, &uNumSoundHeaders, 4u, &NumberOfBytesRead, 0);
   pSoundHeaders = nullptr;
-  pSoundHeaders = (SoundHeader *)pAllocator->AllocNamedChunk(0, 52 * uNumSoundHeaders + 2, 0);
+  pSoundHeaders = (SoundHeader *)malloc(52 * uNumSoundHeaders + 2);
   ReadFile(hAudioSnd, pSoundHeaders, 52 * uNumSoundHeaders, &NumberOfBytesRead, 0);
 }
 
@@ -2417,7 +2416,7 @@
   {
     if ( pSounds[i].pSoundData == _this )
     {
-      pAllocator->FreeChunk(_this);
+      free(_this);
       memset(&pSounds[i], 0, 0x80u);
     }
   }
@@ -2506,7 +2505,7 @@
   if ( uFindSound_BinSearch_ResultID == -1 )
     return 0;
   if ( pOutBuff == (SoundData *)-1 )
-    pOutBuff = (SoundData *)pAllocator->AllocNamedChunk(0, pAudioPlayer->pSoundHeaders[uFindSound_BinSearch_ResultID].uDecompressedSize + 4, pSoundName);
+    pOutBuff = (SoundData *)malloc(pAudioPlayer->pSoundHeaders[uFindSound_BinSearch_ResultID].uDecompressedSize + 4);
   SetFilePointer(pAudioPlayer->hAudioSnd, pAudioPlayer->pSoundHeaders[uFindSound_BinSearch_ResultID].uFileOffset, 0, 0);
   if ( (signed int)pAudioPlayer->pSoundHeaders[uFindSound_BinSearch_ResultID].uCompressedSize >= (signed int)pAudioPlayer->pSoundHeaders[uFindSound_BinSearch_ResultID].uDecompressedSize )
   {
--- a/BSPModel.cpp	Wed Sep 11 00:16:49 2013 +0600
+++ b/BSPModel.cpp	Wed Sep 11 00:16:58 2013 +0600
@@ -1,5 +1,6 @@
+#include <stdlib.h>
+
 #include "BSPModel.h"
-#include "Allocator.h"
 
 
 
@@ -12,16 +13,16 @@
   void *v4; // ST00_4@1
 
   v1 = this;
-  pAllocator->FreeChunk(*(void **)&this->pVertices.pVertices);
+  free(*(void **)&this->pVertices.pVertices);
   v2 = v1->pFaces;
   v1->pVertices.pVertices = 0;
-  pAllocator->FreeChunk(v2);
+  free(v2);
   v3 = v1->pFacesOrdering;
   v1->pFaces = 0;
-  pAllocator->FreeChunk(v3);
+  free(v3);
   v4 = v1->pNodes;
   v1->pFacesOrdering = 0;
-  pAllocator->FreeChunk(v4);
+  free(v4);
   v1->pNodes = 0;
   v1->uNumNodes = 0;
   v1->uNumFaces = 0;
--- a/Chest.cpp	Wed Sep 11 00:16:49 2013 +0600
+++ b/Chest.cpp	Wed Sep 11 00:16:58 2013 +0600
@@ -8,7 +8,6 @@
 #include "Items.h"
 #include "Chest.h"
 #include "FrameTableInc.h"
-#include "Allocator.h"
 #include "LOD.h"
 #include "MapInfo.h"
 #include "Actor.h"
@@ -635,7 +634,7 @@
   assert(uNumChests);
   assert(!num_mm8_chests);
 
-  pChests = (ChestDesc *)pAllocator->AllocNamedChunk(pChests, uNumChests * sizeof(ChestDesc), "Chest Descrip");
+  pChests = (ChestDesc *)malloc(uNumChests * sizeof(ChestDesc));
   memcpy(pChests,                                   (char *)data_mm7 + 4, num_mm7_chests * sizeof(ChestDesc));
   memcpy(pChests + num_mm7_chests,                  (char *)data_mm6 + 4, num_mm6_chests * sizeof(ChestDesc));
   memcpy(pChests + num_mm6_chests + num_mm7_chests, (char *)data_mm8 + 4, num_mm8_chests * sizeof(ChestDesc));
@@ -664,7 +663,7 @@
   unsigned int Argsa; // [sp+300h] [bp+8h]@3
 
   v2 = this;
-  pAllocator->FreeChunk(this->pChests);
+  free(this->pChests);
   v3 = 0;
   v2->pChests = 0;
   v2->uNumChests = 0;
@@ -690,7 +689,7 @@
   }
   v6 = v2->pChests;
   v2->uNumChests = v5;
-  v7 = pAllocator->AllocNamedChunk(v6, 36 * v5, "Chest Descrip");
+  v7 = malloc(36 * v5);
   v2->pChests = (ChestDesc *)v7;
   if ( v7 == (void *)v3 )
     Error("ChestDescriptionList::load - Out of Memory!");
--- a/DecorationList.cpp	Wed Sep 11 00:16:49 2013 +0600
+++ b/DecorationList.cpp	Wed Sep 11 00:16:58 2013 +0600
@@ -1,6 +1,5 @@
 #include "Sprites.h"
 #include "DecorationList.h"
-#include "Allocator.h"
 #include "MM7.h"
 #include "FrameTableInc.h"
 #include "mm7_data.h"
@@ -18,7 +17,7 @@
   Assert(uNumDecorations);
   Assert(!num_mm8_decs);
 
-  pDecorations = (DecorationDesc *)pAllocator->AllocNamedChunk(pDecorations, uNumDecorations * sizeof(DecorationDesc), "Dec Descrip");
+  pDecorations = (DecorationDesc *)malloc(uNumDecorations * sizeof(DecorationDesc));
   memcpy(pDecorations, (char *)data_mm7 + 4, num_mm7_decs * sizeof(DecorationDesc));
   for (uint i = 0; i < num_mm6_decs; ++i)
   {
@@ -104,7 +103,7 @@
     v4 = Argsa;
   }
   v2->uNumDecorations = v4;
-  v5 = pAllocator->AllocNamedChunk(v2->pDecorations, 84 * v4, "Dec Descrip");
+  v5 = malloc(84 * v4);
   v2->pDecorations = (DecorationDesc *)v5;
   if ( !v5 )
     Error("DecorationDescriptionList::load - Out of Memory!");
--- a/Events.cpp	Wed Sep 11 00:16:49 2013 +0600
+++ b/Events.cpp	Wed Sep 11 00:16:58 2013 +0600
@@ -25,7 +25,6 @@
 #include "Indoor.h"
 #include "Viewport.h"
 #include "texts.h"
-#include "Allocator.h"
 #include "stru123.h"
 #include "stru159.h"
 #include "Events.h"
@@ -84,7 +83,7 @@
     Error("File %s Size %lu - Buffer size %lu", pContainerName, uTextureSize, uBufferSize);
 
   memcpy(pBuffer, ptr, uTextureSize);
-  pAllocator->FreeChunk(ptr);
+  free(ptr);
   return uTextureSize;
   }
 
@@ -812,7 +811,7 @@
                 do
                   {
                   v49 = v48->pNext;
-                  pAllocator->FreeChunk(v48);
+                  free(v48);
                   v48 = v49;
                   }
                   while ( v49 );
--- a/GUIWindow.cpp	Wed Sep 11 00:16:49 2013 +0600
+++ b/GUIWindow.cpp	Wed Sep 11 00:16:58 2013 +0600
@@ -10,7 +10,6 @@
 #include "IndoorCamera.h"
 #include "Math.h"
 #include "VideoPlayer.h"
-#include "Allocator.h"
 #include "MapInfo.h"
 #include "Time.h"
 #include "AudioPlayer.h"
@@ -353,7 +352,7 @@
     do
     {
       pNextBtn = this->pControlsHead->pNext;
-      pAllocator->FreeChunk(this->pControlsHead);
+      free(this->pControlsHead);
       this->pControlsHead = pNextBtn;
     }
     while ( pNextBtn );
@@ -1496,7 +1495,7 @@
   GUIButton *v21; // eax@7
   va_list texturs_ptr;
 
-  pButton = (GUIButton *)pAllocator->AllocNamedChunk(0, 0xBCu, "BUTTON");
+  pButton = (GUIButton *)malloc(0xBC);
   pButton->pParent = this;
   pButton->uWidth = uWidth;
   pButton->uHeight = uHeight;
--- a/IconFrameTable.cpp	Wed Sep 11 00:16:49 2013 +0600
+++ b/IconFrameTable.cpp	Wed Sep 11 00:16:58 2013 +0600
@@ -1,7 +1,6 @@
 #include "IconFrameTable.h"
 #include "LOD.h"
 #include "mm7_data.h"
-#include "Allocator.h"
 #include "FrameTableInc.h"
 
 //----- (00494F3A) --------------------------------------------------------
@@ -122,7 +121,7 @@
   Assert(uNumIcons);
   Assert(!num_mm8_frames);
 
-  pIcons = (IconFrame *)pAllocator->AllocNamedChunk(pIcons, uNumIcons * sizeof(IconFrame), "I Frames");
+  pIcons = (IconFrame *)malloc(uNumIcons * sizeof(IconFrame));
   memcpy(pIcons,                                   (char *)data_mm7 + 4, num_mm7_frames * sizeof(IconFrame));
   memcpy(pIcons + num_mm7_frames,                  (char *)data_mm6 + 4, num_mm6_frames * sizeof(IconFrame));
   memcpy(pIcons + num_mm6_frames + num_mm7_frames, (char *)data_mm8 + 4, num_mm8_frames * sizeof(IconFrame));
@@ -182,7 +181,7 @@
     v4 = v21;
   }
   v2->uNumIcons = v4;
-  v5 = pAllocator->AllocNamedChunk(v2->pIcons, 32 * v4, "I Frames");
+  v5 = malloc(32 * v4);//, "I Frames");
   v2->pIcons = (IconFrame *)v5;
   if ( v5 )
   {
--- a/Indoor.cpp	Wed Sep 11 00:16:49 2013 +0600
+++ b/Indoor.cpp	Wed Sep 11 00:16:58 2013 +0600
@@ -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();
--- a/Items.cpp	Wed Sep 11 00:16:49 2013 +0600
+++ b/Items.cpp	Wed Sep 11 00:16:58 2013 +0600
@@ -6,7 +6,6 @@
 
 #include "Items.h"
 #include "MapInfo.h"
-#include "Allocator.h"
 #include "GUIWindow.h"
 #include "Events2D.h"
 #include "Chest.h"
@@ -281,27 +280,27 @@
 void ItemsTable::Release()
 {
   if ( pMonstersTXT_Raw )
-    pAllocator->FreeChunk(pMonstersTXT_Raw);
+    free(pMonstersTXT_Raw);
   if ( pMonsterPlacementTXT_Raw )
-    pAllocator->FreeChunk(pMonsterPlacementTXT_Raw);
+    free(pMonsterPlacementTXT_Raw);
   if ( pSkillDescTXT_Raw )
-    pAllocator->FreeChunk(pSkillDescTXT_Raw);
+    free(pSkillDescTXT_Raw);
   if (pSpcItemsTXT_Raw )
-    pAllocator->FreeChunk(pSpcItemsTXT_Raw);
+    free(pSpcItemsTXT_Raw);
   if ( pStdItemsTXT_Raw )
-    pAllocator->FreeChunk(pStdItemsTXT_Raw);
+    free(pStdItemsTXT_Raw);
   if ( pRndItemsTXT_Raw )
-    pAllocator->FreeChunk(pRndItemsTXT_Raw);
+    free(pRndItemsTXT_Raw);
   if ( pItemsTXT_Raw )
-    pAllocator->FreeChunk(pItemsTXT_Raw);
+    free(pItemsTXT_Raw);
   if ( pHostileTXT_Raw )
-    pAllocator->FreeChunk(pHostileTXT_Raw);
+    free(pHostileTXT_Raw);
   if ( pHistoryTXT_Raw )
-    pAllocator->FreeChunk(pHistoryTXT_Raw);
+    free(pHistoryTXT_Raw);
   if ( pPotionsTXT_Raw )
-    pAllocator->FreeChunk(pPotionsTXT_Raw);
+    free(pPotionsTXT_Raw);
   if ( pPotionNotesTXT_Raw )
-    pAllocator->FreeChunk(pPotionNotesTXT_Raw);
+    free(pPotionNotesTXT_Raw);
   pSpcItemsTXT_Raw = NULL;
   pSkillDescTXT_Raw = NULL;
   pStdItemsTXT_Raw = NULL;
@@ -1050,7 +1049,7 @@
 
 	if ( pRndItemsTXT_Raw )
 		{
-		pAllocator->FreeChunk(pRndItemsTXT_Raw);
+		free(pRndItemsTXT_Raw);
 		pRndItemsTXT_Raw = NULL;
 		}
 
@@ -1285,7 +1284,7 @@
 	unsigned __int8 potion_value;
 
 	if ( pPotionsTXT_Raw )
-		pAllocator->FreeChunk(pPotionsTXT_Raw);
+		free(pPotionsTXT_Raw);
 	pPotionsTXT_Raw = NULL;
 	pPotionsTXT_Raw = (char *)pEvents_LOD->LoadRaw("potion.txt", 0);
 	test_string = strtok(pPotionsTXT_Raw,"\t\r\n");
@@ -1352,7 +1351,7 @@
 		}
 	if ( pPotionsTXT_Raw )
 		{
-		pAllocator->FreeChunk(pPotionsTXT_Raw);
+		free(pPotionsTXT_Raw);
 		pPotionsTXT_Raw = 0;
 		}
 	}
@@ -1368,7 +1367,7 @@
 	unsigned __int8 potion_note;
 
 	if ( pPotionNotesTXT_Raw )
-		pAllocator->FreeChunk(pPotionNotesTXT_Raw);
+		free(pPotionNotesTXT_Raw);
 	pPotionNotesTXT_Raw = NULL;
 	pPotionNotesTXT_Raw = (char *)pEvents_LOD->LoadRaw("potnotes.txt", 0);
 	test_string = strtok(pPotionNotesTXT_Raw ,"\t\r\n");
@@ -1599,7 +1598,7 @@
 
     v5 = this;
     if (!out_item)
-        out_item = (ItemGen *)pAllocator->AllocNamedChunk(out_item, sizeof(*out_item), "newItemGen");
+        out_item = (ItemGen *)malloc(sizeof(ItemGen));
     memset(out_item, 0, sizeof(*out_item));
 
 
--- a/LOD.cpp	Wed Sep 11 00:16:49 2013 +0600
+++ b/LOD.cpp	Wed Sep 11 00:16:58 2013 +0600
@@ -4,7 +4,6 @@
 
 #include "LOD.h"
 #include "Render.h"
-#include "Allocator.h"
 #include "PaletteManager.h"
 #include "Viewport.h"
 
@@ -182,7 +181,7 @@
     fread(pSpriteHeader, 1u, 0x20u, v3);
     strcpy(pSpriteHeader->pName, pContainer);
     Sizea = pSpriteHeader->uSpriteSize;
-    v7 = (LODSprite_stru0 *)pAllocator->AllocNamedChunk(v6->pSpriteLines, 8 * v6->uHeight, v6->pName);
+    v7 = (LODSprite_stru0 *)malloc(8 * v6->uHeight);
     v8 = 8 * pSpriteHeader->uHeight;
     pSpriteHeader->pSpriteLines = v7;
     fread(v7, 1u, v8, v4);
@@ -190,19 +189,16 @@
     v10 = pSpriteHeader->uDecompressedSize;
     if ( v10 )
     {
-      pSpriteHeader->pDecompressedBytes = pAllocator->AllocNamedChunk(
-                                            pSpriteHeader->pDecompressedBytes,
-                                            v10,
-                                            pSpriteHeader->pName);
-      DstBufa = pAllocator->AllocNamedChunk(0, Sizea, pSpriteHeader->pName);
+      pSpriteHeader->pDecompressedBytes = malloc(v10);
+      DstBufa = malloc(Sizea);
       fread(DstBufa, 1u, Sizea, File);
       zlib::MemUnzip(v6->pDecompressedBytes, (unsigned int *)&v6->uDecompressedSize, DstBufa, v6->uSpriteSize);
       v6->uSpriteSize = *v9;
-      pAllocator->FreeChunk(DstBufa);
+      free(DstBufa);
     }
     else
     {
-      v11 = pAllocator->AllocNamedChunk(pSpriteHeader->pDecompressedBytes, Sizea, pSpriteHeader->pName);
+      v11 = malloc(Sizea);
       pSpriteHeader->pDecompressedBytes = v11;
       fread(v11, 1u, Sizea, File);
     }
@@ -265,7 +261,7 @@
         {
         if ( !pHardwareSprites )
             {
-            pHardwareSprites = (Sprite *)pAllocator->AllocNamedChunk(0, 1500*sizeof(Sprite) , "hardSprites");//0xEA60u
+            pHardwareSprites = (Sprite *)malloc(1500*sizeof(Sprite));//0xEA60u
             for (i=0; i<1500;++i)
                 {
                 pHardwareSprites[i].pName=NULL;
@@ -317,7 +313,7 @@
 
     if ( pRenderer->pRenderD3D )
         {
-        pHardwareSprites[uNumLoadedSprites].pName = (const char *)pAllocator->AllocNamedChunk(pHardwareSprites[uNumLoadedSprites].pName, 20, pContainerName);
+        pHardwareSprites[uNumLoadedSprites].pName = (const char *)malloc(20);
         strcpy((char *)pHardwareSprites[uNumLoadedSprites].pName, pContainerName);
         pHardwareSprites[uNumLoadedSprites].uPaletteID = uPaletteID;
         pRenderer->MoveSpriteToDevice(&pHardwareSprites[uNumLoadedSprites]);
@@ -944,8 +940,8 @@
   {
     this->pContainerName[0] = 0;
     this->uCurrentIndexDir = 0;
-    pAllocator->FreeChunk(pSubIndices);
-    pAllocator->FreeChunk(pRoot);
+    free(pSubIndices);
+    free(pRoot);
     pSubIndices = NULL;
     pRoot = NULL;
     fclose(pFile);
@@ -991,7 +987,7 @@
     uOffsetToSubIndex = 0;
     uNumSubDirs = 0;
     uLODDataSize = 0;
-    pAllocator->FreeChunk(pSubIndices);
+    free(pSubIndices);
     pSubIndices = NULL;
   }
 }
@@ -1062,8 +1058,8 @@
   v1 = this;
   if ( !(HIBYTE(this->word_1A) & 4) )
   {
-    pAllocator->FreeChunk(this->pDecompressedBytes);
-    pAllocator->FreeChunk(v1->pSpriteLines);
+    free(this->pDecompressedBytes);
+    free(v1->pSpriteLines);
   }
   v1->word_1A = 0;
   v1->pDecompressedBytes = 0;
@@ -1081,7 +1077,7 @@
 void Sprite::Release()
 {
   if (pName)
-    pAllocator->FreeChunk((void *)pName);
+    free((void *)pName);
   pName = nullptr;
 
   if (pTextureSurface)
@@ -1267,8 +1263,8 @@
   v1 = this;
   if ( !(HIBYTE(this->word_1A) & 4) )
   {
-    pAllocator->FreeChunk(pDecompressedBytes);
-    pAllocator->FreeChunk(pSpriteLines);
+    free(pDecompressedBytes);
+    free(pSpriteLines);
   }
   pDecompressedBytes = NULL;
   pSpriteLines = NULL;
@@ -1693,8 +1689,8 @@
 //----- (00461A11) --------------------------------------------------------
 void LOD::File::FreeSubIndexAndIO()
 {
-  pAllocator->FreeChunk(pSubIndices);
-  pAllocator->FreeChunk(pIOBuffer);// delete [] pIOBuffer;
+  free(pSubIndices);
+  free(pIOBuffer);// delete [] pIOBuffer;
   pIOBuffer = nullptr;
   pSubIndices = nullptr;
 }
@@ -1706,20 +1702,20 @@
   if (pSubIndices)
   {
     MessageBoxA(0, "Attempt to reset a LOD subindex!", "MM6", MB_ICONEXCLAMATION);
-    pAllocator->FreeChunk(pSubIndices);
+    free(pSubIndices);
     pSubIndices = nullptr;
   }
-  pSubIndices =(LOD::Directory *)pAllocator->AllocNamedChunk( pSubIndices, 32 * uNumSubIndices,"LODsub");
+  pSubIndices =(LOD::Directory *)malloc(32 * uNumSubIndices);
   if (pIOBuffer)
   {
     MessageBoxA(0, "Attempt to reset a LOD IObuffer!", "MM6", MB_ICONEXCLAMATION);
-    pAllocator->FreeChunk(pIOBuffer);
+    free(pIOBuffer);
     pIOBuffer = NULL;
     uIOBufferSize = 0;
   }
   if ( uBufferSize )
   {
-    pIOBuffer = (unsigned __int8 *)pAllocator->AllocNamedChunk(pIOBuffer, uBufferSize, "LODio");
+    pIOBuffer = (unsigned __int8 *)malloc(uBufferSize);
     uIOBufferSize = uBufferSize;
   }
 }
@@ -1746,7 +1742,7 @@
 	  uOffsetToSubIndex =curr_index->uOfsetFromSubindicesStart ;
 	  uNumSubDirs =curr_index->uNumSubIndices;// *(_WORD *)(v8 + 28);
 	  fseek( pFile, uOffsetToSubIndex, SEEK_SET);
-	  pSubIndices = (LOD::Directory *)pAllocator->AllocNamedChunk(pSubIndices, sizeof(LOD::Directory)*(uNumSubDirs + 5), "LOD Index");
+	  pSubIndices = (LOD::Directory *)malloc(sizeof(LOD::Directory)*(uNumSubDirs + 5));
 
 	  if ( pSubIndices)
 		  fread( pSubIndices, sizeof(LOD::Directory),  uNumSubDirs,  pFile);
@@ -1773,7 +1769,7 @@
   {
     strcpy(pLODName, pFilename);
     fread(&header, sizeof(LOD::FileHeader), 1u, pFile);
-    pRoot = (LOD::Directory *)pAllocator->AllocNamedChunk(pRoot, 160, "LOD CArray");
+    pRoot = (LOD::Directory *)malloc(160);
     if ( pRoot )
     {
       fread(pRoot, sizeof(LOD::Directory), header.uNumIndices, pFile);
@@ -1800,7 +1796,7 @@
   if ( this->isFileOpened )
   {
     fclose(this->pFile);
-    pAllocator->FreeChunk(v1->pSubIndices);
+    free(v1->pSubIndices);
   }
 }
 
@@ -2091,20 +2087,20 @@
     if ( a3 )
       v6 = malloc(DstBuf.uDecompressedSize+1);
     else
-      v6 = pAllocator->AllocNamedChunk(0, DstBuf.uDecompressedSize+1, DstBuf.pName);
+      v6 = malloc(DstBuf.uDecompressedSize+1);
     v7 = v6;
-    v8 = pAllocator->AllocNamedChunk(0, DstBuf.uTextureSize+1, DstBuf.pName);
+    v8 = malloc(DstBuf.uTextureSize+1);
     fread(v8, 1u, Argsa, File);
     zlib::MemUnzip(v7, &DstBuf.uDecompressedSize, v8, DstBuf.uTextureSize);
     DstBuf.uTextureSize = DstBuf.uDecompressedSize;
-    pAllocator->FreeChunk(v8);
+    free(v8);
   }
   else
   {
     if ( a3 )
       v9 = malloc(DstBuf.uTextureSize+1);
     else
-      v9 = pAllocator->AllocNamedChunk(0, DstBuf.uTextureSize+1, DstBuf.pName);
+      v9 = malloc(DstBuf.uTextureSize+1);
     v7 = v9;
     fread(v9, 1u, Argsa, v5);
   }
@@ -2547,7 +2543,7 @@
   void *v17; // eax@27
   unsigned int v18; // ST28_4@27
   void *v19; // ST3C_4@27
-  Allocator *v20; // ebx@29
+  //Allocator *v20; // ebx@29
   void *v21; // eax@29
   size_t v22; // ST2C_4@29
   const void *v23; // ecx@29
@@ -2632,8 +2628,7 @@
   pOutTex = (Texture *)v8->uTextureSize;
   if ( !v8->uDecompressedSize || dword_011BA4 )
   {
-    v20 = pAllocator;
-    v32 = pAllocator->AllocNamedChunk(v8->pLevelOfDetail0_prolly_alpha_mask, v15, v8->pName);
+    v32 = malloc(v15);
     v8->pLevelOfDetail0_prolly_alpha_mask = (unsigned __int8 *)v32;
     fread(v32, 1u, (size_t)pOutTex, pFile);
   }
@@ -2649,11 +2644,10 @@
     free(v19);
     if ( bUseLoResSprites && v8->pBits & 2 )
     {
-      v20 = pAllocator;
       pOutTex = (Texture *)(((signed int)v8->uSizeOfMaxLevelOfDetail >> 2)
                           + ((signed int)v8->uSizeOfMaxLevelOfDetail >> 4)
                           + ((signed int)v8->uSizeOfMaxLevelOfDetail >> 6));
-      v21 = pAllocator->AllocNamedChunk(v8->pLevelOfDetail0_prolly_alpha_mask, (unsigned int)pOutTex, v8->pName);
+      v21 = malloc((unsigned int)pOutTex);
       v22 = (size_t)pOutTex;
       v23 = &pContainer[v8->uTextureWidth * v8->uTextureHeight];
       v8->pLevelOfDetail0_prolly_alpha_mask = (unsigned __int8 *)v21;
@@ -2675,19 +2669,18 @@
     else
     {
       v29 = *v16;
-      v20 = pAllocator;
-      v30 = pAllocator->AllocNamedChunk(v8->pLevelOfDetail0_prolly_alpha_mask, v29, v8->pName);
+      v30 = malloc(v29);
       v31 = v8->uDecompressedSize;
       v8->pLevelOfDetail0_prolly_alpha_mask = (unsigned __int8 *)v30;
       memcpy(v30, pContainer, v31);
     }
     free((void *)pContainer);
   }
-  pAllocator->FreeChunk(v8->pPalette16);
-  pAllocator->FreeChunk(v8->pPalette24);
+  free(v8->pPalette16);
+  free(v8->pPalette24);
   if ( eTextureType == TEXTURE_24BIT_PALETTE )
   {
-    v33 = pAllocator->AllocNamedChunk(v8->pPalette24, 0x300u, v8->pName);
+    v33 = malloc(0x300);
     v8->pPalette24 = (unsigned __int8 *)v33;
     fread(v33, 1u, 0x300u, pFile);
   }
@@ -2696,7 +2689,7 @@
     v8->pPalette24 = 0;
     if ( eTextureType == TEXTURE_16BIT_PALETTE )
     {
-      v8->pPalette16 = (unsigned __int16 *)pAllocator->AllocNamedChunk(v8->pPalette16, 0x200u, v8->pName);
+      v8->pPalette16 = (unsigned __int16 *)malloc(0x200);
       v38 = 0;
       do
       {
@@ -2933,7 +2926,7 @@
     fseek(v0, 0, 2);
     v2 = ftell(v1);
     rewind(v1);
-    ptr_6A0D08 = pAllocator->AllocNamedChunk(ptr_6A0D08, v2, "LevelLod");
+    ptr_6A0D08 = malloc(v2);
     fread(ptr_6A0D08, v2, 1u, v1);
     fseek(v1, v2 - 6, 0);
     DstBuf = 0;
@@ -2947,7 +2940,7 @@
 //----- (0046080D) --------------------------------------------------------
 void  sub_46080D()
 {
-  pAllocator->FreeChunk(ptr_6A0D08);
+  free(ptr_6A0D08);
   ptr_6A0D08 = 0;
   _6A0D0C_txt_lod_loading = 0;
 }
--- a/Monsters.cpp	Wed Sep 11 00:16:49 2013 +0600
+++ b/Monsters.cpp	Wed Sep 11 00:16:58 2013 +0600
@@ -8,7 +8,6 @@
 
 #include "Monsters.h"
 #include "FrameTableInc.h"
-#include "Allocator.h"
 #include "LOD.h"
 #include "texts.h"
 #include "mm7_data.h"
@@ -385,7 +384,7 @@
     v4 = Argsa;
   }
   v2->uNumMonsters = v4;
-  v5 = pAllocator->AllocNamedChunk(v2->pMonsters, 152 * v4, "Mon Race");
+  v5 = malloc(152 * v4);
   v2->pMonsters = (MonsterDesc *)v5;
   if ( !v5 )
     Error("MonsterRaceListStruct::load - Out of Memory!");
@@ -468,7 +467,7 @@
   Assert(uNumMonsters);
   Assert(!num_mm8_monsters);
 
-  pMonsters = (MonsterDesc *)pAllocator->AllocNamedChunk(pMonsters, sizeof(MonsterDesc) * uNumMonsters, "Mon Race");
+  pMonsters = (MonsterDesc *)malloc(sizeof(MonsterDesc) * uNumMonsters);
   memcpy(pMonsters, (char *)data_mm7 + 4, num_mm7_monsters * sizeof(MonsterDesc));
   for (uint i = 0; i < num_mm6_monsters; ++i)
   {
@@ -582,7 +581,7 @@
     FrameTableTxtLine parsed_field;
 
     if ( pMonstersTXT_Raw )
-        pAllocator->FreeChunk(pMonstersTXT_Raw);
+        free(pMonstersTXT_Raw);
     pMonstersTXT_Raw = NULL;
     pMonstersTXT_Raw = (char *)pEvents_LOD->LoadRaw("monsters.txt", 0);
     strtok(pMonstersTXT_Raw, "\r");
--- a/NPC.cpp	Wed Sep 11 00:16:49 2013 +0600
+++ b/NPC.cpp	Wed Sep 11 00:16:58 2013 +0600
@@ -2,7 +2,6 @@
 #define _CRT_SECURE_NO_WARNINGS
 #endif
 
-#include "Allocator.h"
 #include "texts.h"
 #include "LOD.h"
 #include "Autonotes.h"
@@ -248,7 +247,7 @@
 	int decode_step;
 
 	if (pNPCTextTXT_Raw)
-		pAllocator->FreeChunk(pNPCTextTXT_Raw);
+		free(pNPCTextTXT_Raw);
 	pNPCTextTXT_Raw =NULL;
 	pNPCTextTXT_Raw = (char *)pEvents_LOD->LoadRaw("npctext.txt", 0);
 	strtok(pNPCTextTXT_Raw, "\r");
@@ -286,7 +285,7 @@
 		}
 
 	if (pNPCTopicTXT_Raw)
-		pAllocator->FreeChunk(pNPCTopicTXT_Raw);
+		free(pNPCTopicTXT_Raw);
 	pNPCTopicTXT_Raw =NULL;
 	pNPCTopicTXT_Raw = (char *)pEvents_LOD->LoadRaw("npctopic.txt", 0);
 	strtok(pNPCTopicTXT_Raw, "\r");
@@ -324,7 +323,7 @@
 		}
 
 	if (pNPCDistTXT_Raw)
-		pAllocator->FreeChunk(pNPCDistTXT_Raw);
+		free(pNPCDistTXT_Raw);
 	pNPCDistTXT_Raw = NULL;
 	pNPCDistTXT_Raw = (char *)pEvents_LOD->LoadRaw("npcdist.txt", 0);
 	strtok(pNPCDistTXT_Raw, "\r");
@@ -381,7 +380,7 @@
 
 	if (pNPCDistTXT_Raw)
 		{
-		pAllocator->FreeChunk(pNPCDistTXT_Raw);
+		free(pNPCDistTXT_Raw);
 		pNPCDistTXT_Raw = NULL;
 		}
 	}
@@ -716,23 +715,23 @@
 //----- (00477266) --------------------------------------------------------
 void NPCStats::Release()
 	{
-	pAllocator->FreeChunk(pNPCTopicTXT_Raw);
+	free(pNPCTopicTXT_Raw);
 	pNPCTopicTXT_Raw = NULL;
-	pAllocator->FreeChunk(pNPCTextTXT_Raw);
+	free(pNPCTextTXT_Raw);
 	pNPCTextTXT_Raw = NULL;
-	pAllocator->FreeChunk(pNPCNewsTXT_Raw);
+	free(pNPCNewsTXT_Raw);
 	pNPCNewsTXT_Raw = NULL;
-	pAllocator->FreeChunk(pNPCProfTXT_Raw);
+	free(pNPCProfTXT_Raw);
 	pNPCProfTXT_Raw = NULL;
-	pAllocator->FreeChunk(pNPCNamesTXT_Raw);
+	free(pNPCNamesTXT_Raw);
 	pNPCNamesTXT_Raw = NULL;
-	pAllocator->FreeChunk(pNPCDataTXT_Raw);
+	free(pNPCDataTXT_Raw);
 	pNPCDataTXT_Raw = NULL;
-	pAllocator->FreeChunk(pNPCDistTXT_Raw);
+	free(pNPCDistTXT_Raw);
 	pNPCDistTXT_Raw = NULL;
-	pAllocator->FreeChunk(pNPCGreetTXT_Raw);
+	free(pNPCGreetTXT_Raw);
 	pNPCGreetTXT_Raw = NULL;
-	pAllocator->FreeChunk(pNCPGroupTXT_Raw);
+	free(pNCPGroupTXT_Raw);
 	pNCPGroupTXT_Raw = NULL;
 	}
 
@@ -936,7 +935,7 @@
 	int decode_step;
 
 	if ( pAwardsTXT_Raw )
-		pAllocator->FreeChunk(pAwardsTXT_Raw);
+		free(pAwardsTXT_Raw);
 	pAwardsTXT_Raw = NULL;
 	pAwardsTXT_Raw = (char *)pEvents_LOD->LoadRaw("awards.txt", 0);
 	strtok(pAwardsTXT_Raw, "\r");
@@ -990,7 +989,7 @@
 	int decode_step;
 
 	if ( pScrollsTXT_Raw )
-		pAllocator->FreeChunk(pScrollsTXT_Raw);
+		free(pScrollsTXT_Raw);
 	pScrollsTXT_Raw = NULL;
 	pScrollsTXT_Raw = (char *)pEvents_LOD->LoadRaw("scroll.txt", 0);
 	strtok(pScrollsTXT_Raw, "\r");
@@ -1039,7 +1038,7 @@
 	int decode_step;
 
 	if ( pMerchantsTXT_Raw )
-		pAllocator->FreeChunk(pMerchantsTXT_Raw);
+		free(pMerchantsTXT_Raw);
 	pMerchantsTXT_Raw = NULL;
 	pMerchantsTXT_Raw = (char *)pEvents_LOD->LoadRaw("merchant.txt", 0);
 	strtok(pMerchantsTXT_Raw, "\r");
@@ -1103,7 +1102,7 @@
 	int decode_step;
 
 	if ( pTransitionsTXT_Raw )
-		pAllocator->FreeChunk(pTransitionsTXT_Raw);
+		free(pTransitionsTXT_Raw);
 	pTransitionsTXT_Raw = NULL;
 	pTransitionsTXT_Raw = (char *)pEvents_LOD->LoadRaw("trans.txt", 0);
 	strtok(pTransitionsTXT_Raw, "\r");
@@ -1153,7 +1152,7 @@
 	int decode_step;
 
 	if ( pAutonoteTXT_Raw )
-		pAllocator->FreeChunk(pAutonoteTXT_Raw);
+		free(pAutonoteTXT_Raw);
 	pAutonoteTXT_Raw = 0;
 	pAutonoteTXT_Raw = (char *)pEvents_LOD->LoadRaw("autonote.txt", 0);
 	strtok(pAutonoteTXT_Raw, "\r");
@@ -1238,7 +1237,7 @@
 	int decode_step;
 
 	if ( pQuestsTXT_Raw )
-		pAllocator->FreeChunk(pQuestsTXT_Raw);
+		free(pQuestsTXT_Raw);
 	pQuestsTXT_Raw = NULL;
 	pQuestsTXT_Raw = (char *)pEvents_LOD->LoadRaw("quests.txt", 0);
 	strtok(pQuestsTXT_Raw, "\r");
--- a/ObjectList.cpp	Wed Sep 11 00:16:49 2013 +0600
+++ b/ObjectList.cpp	Wed Sep 11 00:16:58 2013 +0600
@@ -2,7 +2,6 @@
 #include "mm7_data.h"
 #include "Sprites.h"
 #include "FrameTableInc.h"
-#include "Allocator.h"
 #include "ErrorHandling.h"
 
 //----- (0042EB42) --------------------------------------------------------
@@ -67,7 +66,7 @@
   Assert(uNumObjects);
   Assert(!num_mm8_objs);
 
-  pObjects = (ObjectDesc *)pAllocator->AllocNamedChunk(pObjects, uNumObjects * sizeof(ObjectDesc), "Obj Descrip");
+  pObjects = (ObjectDesc *)malloc(uNumObjects * sizeof(ObjectDesc));
   memcpy(pObjects, (char *)data_mm7 + 4, num_mm7_objs * sizeof(ObjectDesc));
   for (uint i = 0; i < num_mm6_objs; ++i)
   {
@@ -142,7 +141,7 @@
   int Argsb; // [sp+470h] [bp+8h]@15
 
   v2 = this;
-  pAllocator->FreeChunk(this->pObjects);
+  free(this->pObjects);
   v3 = 0;
   v2->pObjects = 0;
   v2->uNumObjects = 0;
@@ -167,7 +166,7 @@
     v3 = 0;
   }
   v2->uNumObjects = v5;
-  v6 = pAllocator->AllocNamedChunk(v2->pObjects, 56 * v5, "Obj Descrip");
+  v6 = malloc(56 * v5);
   v2->pObjects = (ObjectDesc *)v6;
   if ( v6 == (void *)v3 )
     Error("ObjectDescriptionList::load - Out of Memory!");
--- a/Outdoor.cpp	Wed Sep 11 00:16:49 2013 +0600
+++ b/Outdoor.cpp	Wed Sep 11 00:16:58 2013 +0600
@@ -11,7 +11,6 @@
 #include "Party.h"
 #include "SpriteObject.h"
 #include "LOD.h"
-#include "Allocator.h"
 #include "PaletteManager.h"
 #include "GUIProgressBar.h"
 #include "AudioPlayer.h"
@@ -116,10 +115,7 @@
 
   if (bRedraw)
   {
-    Software_ResetNewEdges();
     sub_487DA9();
-    ptr_80C97C_Surfs = pSurfs;
-    ptr_80C978_Edges = pEdges;
   }
   if ( pParty->uCurrentMinute != pOutdoor->uLastSunlightUpdateMinute )
     pOutdoor->UpdateSunlightVectors();
@@ -333,14 +329,6 @@
   return result;
 }
 
-//----- (0048901B) --------------------------------------------------------
-bool OutdoorLocation::Release2()
-{
-  Release();
-  pOutdoorCamera->ReleaseSoftwareDrawBuffers();
-  return true;
-}
-
 
 
 char foot_travel_destinations[15][4] =
@@ -813,22 +801,22 @@
 {
   if (pHeightmap)
   {
-    pAllocator->FreeChunk(this->pHeightmap);
+    free(this->pHeightmap);
     pHeightmap = nullptr;
   }
   if (pTilemap)
   {
-    pAllocator->FreeChunk(pTilemap);
+    free(pTilemap);
     pTilemap = nullptr;
   }
   if (pAttributemap)
   {
-    pAllocator->FreeChunk(pAttributemap);
+    free(pAttributemap);
     pAttributemap = nullptr;
   }
   if (pDmap)
   {
-    pAllocator->FreeChunk(pDmap);
+    free(pDmap);
     pDmap = nullptr;
   }
 
@@ -1134,12 +1122,11 @@
 //----- (0047CD44) --------------------------------------------------------
 bool OutdoorLocationTerrain::Initialize()
 {
-
-  pHeightmap= (unsigned __int8 *)pAllocator->AllocNamedChunk(pHeightmap, 0x4000u, "HMAP");//height map
-  pTilemap = (unsigned __int8 *)pAllocator->AllocNamedChunk(pTilemap, 0x4000u, "TMAP");//tile map
-  pAttributemap = (unsigned __int8 *)pAllocator->AllocNamedChunk(pAttributemap, 0x4000u, "AMAP");// 
-  pDmap=(struct DMap *)pAllocator->AllocNamedChunk(pDmap, 0x8000u, "DMAP");
-  if ( pHeightmap && pTilemap && pAttributemap && pDmap )
+  pHeightmap = (unsigned __int8 *)malloc(0x4000u);//height map
+  pTilemap = (unsigned __int8 *)malloc(0x4000u);//tile map
+  pAttributemap = (unsigned __int8 *)malloc(0x4000u);// 
+  pDmap = (struct DMap *)malloc(0x8000u);
+  if (pHeightmap && pTilemap && pAttributemap && pDmap )
     return true;
   else
     return false;
@@ -1168,28 +1155,28 @@
   v1->pTileTypes[3].tileset = Tileset_RoadGrassCobble;
   v1->LoadTileGroupIds();
   v1->LoadRoadTileset();
-  pAllocator->FreeChunk(v1->pBModels);
-  pAllocator->FreeChunk(v1->pSpawnPoints);
+  free(v1->pBModels);
+  free(v1->pSpawnPoints);
   v1->pBModels = 0;
   v1->pSpawnPoints = 0;
   v1->pTerrain.Initialize();
   v1->pTerrain.ZeroLandscape();
   v1->pTerrain.FillDMap(0, 0, 128, 128);
-  pAllocator->FreeChunk(v1->pCmap);
+  free(v1->pCmap);
   v1->pCmap = 0;
-  v2 = pAllocator->AllocNamedChunk(0, 0x8000u, "CMAP");
+  v2 = malloc(0x8000u);
   v3 = v1->pOMAP;
   v1->pCmap = v2;
-  pAllocator->FreeChunk(v3);
+  free(v3);
   v1->pOMAP = 0;
-  v4 = pAllocator->AllocNamedChunk(0, 0x10000u, "OMAP");
+  v4 = malloc(0x10000u);
   v1->pOMAP = (unsigned int *)v4;
   memset(v4, 0, 0x10000u);
   v5 = v1->pFaceIDLIST;
   v1->numFaceIDListElems = 0;
-  pAllocator->FreeChunk(v5);
+  free(v5);
   v1->pFaceIDLIST = 0;
-  v6 = pAllocator->AllocNamedChunk(0, 2u, "IDLIST");
+  v6 = malloc(2);
   v1->pFaceIDLIST = (unsigned __int16 *)v6;
   *(short *)v6 = 0;
   strcpy(v1->pSkyTextureName, pDefaultSkyTexture.data());
@@ -1229,14 +1216,14 @@
     for (uint i = 0; i < uNumBModels; ++i)
       pBModels[i].Release();
 
-    pAllocator->FreeChunk(pBModels);
+    free(pBModels);
     pBModels = nullptr;
     uNumBModels = 0;
   }
 
   if (pSpawnPoints)
   {
-    pAllocator->FreeChunk(pSpawnPoints);
+    free(pSpawnPoints);
     pSpawnPoints = nullptr;
   }
   uNumSpawnPoints = 0;
@@ -1245,22 +1232,22 @@
 
   if (pCmap)
   {
-    pAllocator->FreeChunk(pCmap);
+    free(pCmap);
     pCmap = nullptr;
   }
   if (pOMAP)
   {
-    pAllocator->FreeChunk(pOMAP);
+    free(pOMAP);
     pOMAP = nullptr;
   }
   if (pFaceIDLIST)
   {
-    pAllocator->FreeChunk(pFaceIDLIST);
+    free(pFaceIDLIST);
     pFaceIDLIST = nullptr;
   }
   if (pTerrainNormals)
   {
-    pAllocator->FreeChunk(pTerrainNormals);
+    free(pTerrainNormals);
     pTerrainNormals = nullptr;
   }
 }
@@ -1479,23 +1466,23 @@
     fseek((FILE *)v7, v121, 0);
     fread(pTerrain.pAttributemap, 1u, 0x4000u, (FILE *)v7);
     pTerrain._47C80A(0, 0, 128, 128);
-    pAllocator->FreeChunk(ptr_D4);
+    free(ptr_D4);
     ptr_D4 = 0;
-    v9 = pAllocator->AllocNamedChunk(0, 0x8000u, "CMAP");
+    v9 = malloc(0, 0x8000u, "CMAP");
     v108 = (int)pOMAP;
     ptr_D4 = v9;
-    pAllocator->FreeChunk((void *)v108);
+    free((void *)v108);
     pOMAP = 0;
-    v10 = pAllocator->AllocNamedChunk(0, 0x10000u, "OMAP");
+    v10 = malloc(0, 0x10000u, "OMAP");
     v108 = 0;
     pOMAP = (unsigned int *)v10;
     fseek((FILE *)v7, v136, v108);
     fread(&uNumTerrainNormals, 4u, 1u, (FILE *)v7);
     fread(pTerrainSomeOtherData, 1u, 0x20000u, (FILE *)v7);
     fread(pTerrainNormalIndices, 1u, 0x10000u, (FILE *)v7);
-    pTerrainNormals = (Vec3_float_ *)pAllocator->AllocNamedChunk(pTerrainNormals, 12 * uNumTerrainNormals, "TerNorm");
+    pTerrainNormals = (Vec3_float_ *)malloc(pTerrainNormals, 12 * uNumTerrainNormals, "TerNorm");
     fread(pTerrainNormals, 1u, 12 * uNumTerrainNormals, (FILE *)v7);
-    v11 = pAllocator->AllocNamedChunk(pBModels, 188 * uNumBModels, "BDdata");
+    v11 = malloc(pBModels, 188 * uNumBModels, "BDdata");
     v108 = 0;
     pBModels = (BSPModel *)v11;
     fseek((FILE *)v7, v122, v108);
@@ -1516,13 +1503,13 @@
         sprintfex(FileName, "%s", v108);
         v13 = pBModels;
         v138 = 0;
-        pBModels[v12].pVertices.pVertices = (Vec3_int_ *)pAllocator->AllocNamedChunk(v13[v12].pVertices.pVertices, 12 * v13[v12].pVertices.uNumVertices,
+        pBModels[v12].pVertices.pVertices = (Vec3_int_ *)malloc(v13[v12].pVertices.pVertices, 12 * v13[v12].pVertices.uNumVertices,
                                                                FileName);
-        pBModels[v12].pFaces = (ODMFace *)pAllocator->AllocNamedChunk(pBModels[v12].pFaces, 308 * pBModels[v12].uNumFaces,
+        pBModels[v12].pFaces = (ODMFace *)malloc(pBModels[v12].pFaces, 308 * pBModels[v12].uNumFaces,
                                                 FileName);
-        pBModels[v12].pFacesOrdering = (unsigned __int16 *)pAllocator->AllocNamedChunk(pBModels[v12].pFacesOrdering,
+        pBModels[v12].pFacesOrdering = (unsigned __int16 *)malloc(pBModels[v12].pFacesOrdering,
                                                                  2 * pBModels[v12].uNumFaces, FileName);
-        v14 = pAllocator->AllocNamedChunk(pBModels[v12].pNodes, 8 * pBModels[v12].uNumNodes, FileName);
+        v14 = malloc(pBModels[v12].pNodes, 8 * pBModels[v12].uNumNodes, FileName);
         v15 = pBModels;
         v108 = (int)File;
         v15[v12].pNodes = (BSPNode *)v14;
@@ -1652,10 +1639,10 @@
     fread(pChests, 0x14CCu, uNumChests, (FILE *)v22);
     fseek((FILE *)v22, v128, 0);
     fread(&field_DC, 4u, 1u, (FILE *)v22);
-    pAllocator->FreeChunk(pFaceIDLIST);
+    free(pFaceIDLIST);
     v32 = field_DC;
     pFaceIDLIST = 0;
-    v33 = pAllocator->AllocNamedChunk(0, 2 * v32, "IDLIST");
+    v33 = malloc(0, 2 * v32, "IDLIST");
     v108 = (int)v22;
     pFaceIDLIST = (unsigned __int16 *)v33;
     fread(v33, 2u, field_DC, (FILE *)v108);
@@ -1663,7 +1650,7 @@
     fread(pOMAP, 4u, 0x4000u, (FILE *)v22);
     fseek((FILE *)v22, v130, 0);
     fread(&uNumSpawnPoints, 4u, 1u, (FILE *)v22);
-    pSpawnPoints = (SpawnPointMM7 *)pAllocator->AllocNamedChunk(pSpawnPoints, 24 * uNumSpawnPoints, "Spawn");
+    pSpawnPoints = (SpawnPointMM7 *)malloc(pSpawnPoints, 24 * uNumSpawnPoints, "Spawn");
     fseek((FILE *)v22, v131, 0);
     fread(pSpawnPoints, 0x18u, uNumSpawnPoints, (FILE *)v22);
     fseek((FILE *)v22, v132, 0);
@@ -1803,10 +1790,10 @@
   //v108 = (int)ptr_D4;
   if (pCmap)
   {
-    pAllocator->FreeChunk(pCmap);
+    free(pCmap);
     pCmap = nullptr;
   }
-  pCmap = pAllocator->AllocNamedChunk(0, 0x8000u, "CMAP");
+  pCmap = malloc(0x8000);
   pTerrain.FillDMap(0, 0, 128, 128);
 
   pGameLoadingUI_ProgressBar->Progress();
@@ -1820,7 +1807,7 @@
   //v43 = (char *)v43 + 65536;
 
   //pFilename = (char *)(12 * uNumTerrainNormals);
-  pTerrainNormals = (Vec3_float_ *)pAllocator->AllocNamedChunk(pTerrainNormals, 12 * uNumTerrainNormals, "TerNorm");
+  pTerrainNormals = (Vec3_float_ *)malloc(sizeof(Vec3_float_) * uNumTerrainNormals);
   memcpy(pTerrainNormals, pSrc, 12 * uNumTerrainNormals);
   pSrc += 12 * uNumTerrainNormals;
   //v44 = (char *)v43 + (int)pFilename;
@@ -1832,10 +1819,10 @@
 
   //v107 = 188 * v45;
   //v106 = (char *)pBModels;
-  //v46 = (BSPModel *)pAllocator->AllocNamedChunk(v106, 188 * v45, "BDdata");
+  //v46 = (BSPModel *)malloc(v106, 188 * v45, "BDdata");
   //v47 = uNumBModels;
   memcpy(&uNumBModels, pSrc, 4);
-  pBModels = (BSPModel *)pAllocator->AllocNamedChunk(pBModels, 188 * uNumBModels, "BDdata");
+  pBModels = (BSPModel *)malloc(188 * uNumBModels);
   //pFilename = (char *)(188 * v47);
   memcpy(pBModels, pSrc + 4, 188 * uNumBModels);
   pSrc += 4 + 188 * uNumBModels;
@@ -1864,7 +1851,7 @@
       //v106 = (char *)v50->pVertices.pVertices;
     assert(sizeof(Vec3_int_) == 12);
     uint verticesSize = model->pVertices.uNumVertices * sizeof(Vec3_int_);
-    model->pVertices.pVertices = (Vec3_int_ *)pAllocator->AllocNamedChunk(model->pVertices.pVertices, verticesSize, "");
+    model->pVertices.pVertices = (Vec3_int_ *)malloc(verticesSize);
     memcpy(model->pVertices.pVertices, pSrc, verticesSize);
     pSrc += verticesSize;
       //v51 = &pBModels[v48];
@@ -1873,7 +1860,7 @@
       //v106 = (char *)v51->pFaces;
     assert(sizeof(ODMFace) == 308);
     uint facesSize = model->uNumFaces * sizeof(ODMFace);
-    model->pFaces = (ODMFace *)pAllocator->AllocNamedChunk(model->pFaces, facesSize, "");
+    model->pFaces = (ODMFace *)malloc(facesSize);
     memcpy(model->pFaces, pSrc, facesSize);
     pSrc += facesSize;
       //v52 = &pBModels[v48];
@@ -1881,7 +1868,7 @@
       //v107 = 2 * v52->uNumFaces;
       //v106 = (char *)v52->pFacesOrdering;
     uint facesOrderingSize = model->uNumFaces * sizeof(short);
-    model->pFacesOrdering = (unsigned __int16 *)pAllocator->AllocNamedChunk(model->pFacesOrdering, facesOrderingSize, "");
+    model->pFacesOrdering = (unsigned __int16 *)malloc(facesOrderingSize);
     memcpy(model->pFacesOrdering, pSrc, facesOrderingSize);
     pSrc += facesOrderingSize;
       //v53 = &pBModels[v48];
@@ -1890,7 +1877,7 @@
       //v106 = (char *)v53->pNodes;
     assert(sizeof(BSPNode) == 8);
     uint nodesSize = model->uNumNodes * sizeof(BSPNode);
-    model->pNodes = (BSPNode *)pAllocator->AllocNamedChunk(model->pNodes, nodesSize, "");
+    model->pNodes = (BSPNode *)malloc(nodesSize);
     memcpy(model->pNodes, pSrc, nodesSize);
     pSrc += nodesSize;
       //v54 = &pBModels[v48];
@@ -2013,14 +2000,14 @@
   //v108 = (int)pFaceIDLIST;
   if (pFaceIDLIST)
   {
-    pAllocator->FreeChunk(pFaceIDLIST);
+    free(pFaceIDLIST);
     pFaceIDLIST = nullptr;
   }
   //v66 = field_DC;
   //pFaceIDLIST = 0;
-  //v67 = pAllocator->AllocNamedChunk(0, 2 * v66, "IDLIST");
+  //v67 = malloc(0, 2 * v66, "IDLIST");
   uint faceIDListSize = 2 * numFaceIDListElems;
-  pFaceIDLIST = (unsigned short *)pAllocator->AllocNamedChunk(0, faceIDListSize, "IDLIST");
+  pFaceIDLIST = (unsigned short *)malloc(faceIDListSize);
   //v68 = field_DC;
   //pFaceIDLIST = (unsigned __int16 *)v67;
   //pFilename = (char *)(2 * v68);
@@ -2031,15 +2018,15 @@
   pGameLoadingUI_ProgressBar->Progress();
 
   //v108 = (int)pOMAP;
-  //pAllocator->FreeChunk((void *)v108);
+  //free((void *)v108);
   //pOMAP = 0;
   if (pOMAP)
   {
-    pAllocator->FreeChunk(pOMAP);
+    free(pOMAP);
     pOMAP = nullptr;
   }
-  //v69 = pAllocator->AllocNamedChunk(0, 0x10000u, "OMAP");
-  pOMAP = (unsigned int *)pAllocator->AllocNamedChunk(0, 0x10000, "OMAP");
+  //v69 = malloc(0, 0x10000u, "OMAP");
+  pOMAP = (unsigned int *)malloc(0x10000);
   //v108 = 65536;
   //pOMAP = (unsigned int *)v69;
   memcpy(pOMAP, pSrc, 65536);
@@ -2057,7 +2044,7 @@
   //v106 = (char *)pSpawnPoints;
   assert(sizeof(SpawnPointMM7) == 24);
   uint spawnPointsSize = uNumSpawnPoints * sizeof(SpawnPointMM7);
-  pSpawnPoints = (SpawnPointMM7 *)pAllocator->AllocNamedChunk(pSpawnPoints, spawnPointsSize, "Spawn");
+  pSpawnPoints = (SpawnPointMM7 *)malloc(spawnPointsSize);
   //v72 = uNumSpawnPoints;
   //pSpawnPoints = v71;
   memcpy(pSpawnPoints, pSrc + 4, spawnPointsSize);
--- a/Outdoor.h	Wed Sep 11 00:16:49 2013 +0600
+++ b/Outdoor.h	Wed Sep 11 00:16:58 2013 +0600
@@ -156,7 +156,7 @@
   unsigned int GetTileTexture(int sX, int sZ);
   int GetHeightOnTerrain(int sX, int sZ);
   bool Initialize(const char *pFilename, int File, size_t uRespawnInterval, int thisa);
-  bool Release2();
+  //bool Release2();
   bool GetTravelDestination(signed int sPartyX, signed int sPartyZ, char *pOut, signed int a5);
   void MessWithLUN();
   void UpdateSunlightVectors();
--- a/OutdoorCamera.cpp	Wed Sep 11 00:16:49 2013 +0600
+++ b/OutdoorCamera.cpp	Wed Sep 11 00:16:58 2013 +0600
@@ -6,7 +6,6 @@
 #include "Viewport.h"
 #include "Math.h"
 #include "mm7_data.h"
-#include "Allocator.h"
 
 //----- (00481E55) --------------------------------------------------------
 void OutdoorCamera::Project(unsigned int uNumVertices)
@@ -71,33 +70,4 @@
   camera_rotation_y_int_cosine = stru_5C6E00->Cos(pIndoorCamera->sRotationY);
   camera_rotation_x_int_sine   = stru_5C6E00->Sin(pIndoorCamera->sRotationX);
   camera_rotation_x_int_cosine = stru_5C6E00->Cos(pIndoorCamera->sRotationX);
-}
-//----- (00486A28) --------------------------------------------------------
-void OutdoorCamera::AllocSoftwareDrawBuffers()
-{
-  if ( !this || !pSpans )
-  {
-    ReleaseSoftwareDrawBuffers();
-    pSpans = (Span *)pAllocator->AllocNamedChunk(pSpans, 0x493E0u, "SPANS");
-    pEdges = (Edge *)pAllocator->AllocNamedChunk(pEdges, 0x4C2C0u, "EDGES");
-    pSurfs = (Surf *)pAllocator->AllocNamedChunk(pSurfs, 0x11940u, "SURFS");
-    pNewEdges = (Edge *)pAllocator->AllocNamedChunk(pNewEdges, 0x6180u, "NEWEDGES");
-    memset(pSpans, 0, 0x493E0u);
-    memset(pEdges, 0, 0x4C2C0u);
-    memset(pSurfs, 0, 0x11940u);
-    memset(pNewEdges, 0, 0x6180u);
-  }
-}
-
-//----- (00486AFC) --------------------------------------------------------
-void OutdoorCamera::ReleaseSoftwareDrawBuffers()
-{
-  pAllocator->FreeChunk(pSpans);
-  pAllocator->FreeChunk(pEdges);
-  pAllocator->FreeChunk(pSurfs);
-  pAllocator->FreeChunk(pNewEdges);
-  pSpans = 0;
-  pEdges = 0;
-  pSurfs = 0;
-  pNewEdges = 0;
 }
\ No newline at end of file
--- a/OutdoorCamera.h	Wed Sep 11 00:16:49 2013 +0600
+++ b/OutdoorCamera.h	Wed Sep 11 00:16:58 2013 +0600
@@ -23,8 +23,8 @@
 
   void _485F64();
   void RotationToInts();
-  void AllocSoftwareDrawBuffers();
-  void ReleaseSoftwareDrawBuffers();
+  //void AllocSoftwareDrawBuffers();
+  //void ReleaseSoftwareDrawBuffers();
 
   static void Project(unsigned int uNumVertices);
   //static bool _487355();
--- a/Overlays.cpp	Wed Sep 11 00:16:49 2013 +0600
+++ b/Overlays.cpp	Wed Sep 11 00:16:58 2013 +0600
@@ -7,7 +7,6 @@
 #include "Overlays.h"
 #include "Sprites.h"
 #include "FrameTableInc.h"
-#include "Allocator.h"
 #include "IconFrameTable.h"
 #include "Time.h"
 #include "Party.h"
@@ -193,7 +192,7 @@
   Assert(uNumOverlays);
   Assert(!num_mm8_overlays);
 
-  pOverlays = (OverlayDesc *)pAllocator->AllocNamedChunk(pOverlays, uNumOverlays * sizeof(OverlayDesc), "Ovl Des.");
+  pOverlays = (OverlayDesc *)malloc(uNumOverlays * sizeof(OverlayDesc));
   memcpy(pOverlays,                                       (char *)data_mm7 + 4, num_mm7_overlays * sizeof(OverlayDesc));
   memcpy(pOverlays + num_mm7_overlays,                    (char *)data_mm6 + 4, num_mm6_overlays * sizeof(OverlayDesc));
   memcpy(pOverlays + num_mm6_overlays + num_mm7_overlays, (char *)data_mm8 + 4, num_mm8_overlays * sizeof(OverlayDesc));
@@ -223,7 +222,7 @@
   unsigned int Argsa; // [sp+308h] [bp+8h]@3
 
   v2 = this;
-  pAllocator->FreeChunk(this->pOverlays);
+  free(this->pOverlays);
   v3 = 0;
   v2->pOverlays = 0;
   v2->uNumOverlays = 0;
@@ -249,7 +248,7 @@
   }
   v6 = v2->pOverlays;
   v2->uNumOverlays = v5;
-  v7 = pAllocator->AllocNamedChunk(v6, 8 * v5, "Ovl Des.");
+  v7 = malloc(8 * v5);
   v2->pOverlays = (OverlayDesc *)v7;
   if ( v7 == (void *)v3 )
     Error("OverlayDescriptionList::load - Out of Memory!");
--- a/Render.cpp	Wed Sep 11 00:16:49 2013 +0600
+++ b/Render.cpp	Wed Sep 11 00:16:58 2013 +0600
@@ -26,7 +26,6 @@
 #include "ObjectList.h"
 #include "SpriteObject.h"
 #include "DecorationList.h"
-#include "Allocator.h"
 #include "OSInfo.h"
 #include "Actor.h"
 #include "Log.h"
@@ -2018,7 +2017,7 @@
   Render *v1; // esi@1
 
   v1 = this;
-  pAllocator->FreeChunk(this->pDefaultZBuffer);
+  free(this->pDefaultZBuffer);
   v1->pD3DBitmaps.Release();
   v1->pD3DSprites.Release();
   Release();
@@ -2318,7 +2317,7 @@
       fwrite(&header2.pitch, 2u, 1u, v6);
       fwrite(&header2.palette_info, 2u, 1u, v6);
       fwrite(v15, 0x3Au, 1u, v6);
-      ptr = pAllocator->AllocNamedChunk(0, 3 * var38 + 6, 0);
+      ptr = malloc(3 * var38 + 6);
       if ( v29 > 0 )
       {
         v7 = v30;
@@ -2391,7 +2390,7 @@
         pRenderer->EndScene();
       }
 
-      pAllocator->FreeChunk(ptr);
+      free(ptr);
       fclose(v6);
     }
   }
@@ -2515,7 +2514,7 @@
       fwrite(&v39, 2u, 1u, v7);
       fwrite(&v40, 2u, 1u, v7);
       fwrite(&v16, 0x3Au, 1u, v7);
-      ptr = pAllocator->AllocNamedChunk(0, 3 * v25 + 6, 0);
+      ptr = malloc(3 * v25 + 6);
       if ( (signed int)a1 > 0 )
       {
         v8 = v43;
@@ -2587,7 +2586,7 @@
       {
         pRenderer->EndScene();
       }
-      pAllocator->FreeChunk(ptr);
+      free(ptr);
       fclose(v7);
     }
   }
@@ -2682,7 +2681,7 @@
   memcpy(v8, &v18, 0x3Au);
   v9 = (char *)v8 + 58;
 
-  lineRGB = (char*)pAllocator->AllocNamedChunk(0, 3 * (wight + 2), 0);
+  lineRGB = (char*)malloc(3 * (wight + 2));
   if ( heidth > 0 )
   {
     v10 = pitch;
@@ -2743,7 +2742,7 @@
       v10 = pitch;
     }
   }
-  pAllocator->FreeChunk(lineRGB);
+  free(lineRGB);
   *(int *)packed_size = (char *)v9 - data_buff;
  
 }
@@ -2814,7 +2813,7 @@
     fwrite(&header2.pitch, 2u, 1u, v7);
     fwrite(&header2.palette_info, 2u, 1u, v7);
     fwrite(v14, 0x3Au, 1u, v7);
-    ptr = pAllocator->AllocNamedChunk(0, 3 * a4 + 6, 0);
+    ptr = malloc(3 * a4 + 6);
     if ( a5 > 0 )
     {
       v8 = v24;
@@ -2877,7 +2876,7 @@
         v8 = v24;
       }
     }
-    pAllocator->FreeChunk(ptr);
+    free(ptr);
     result = (FILE *)fclose(v7);
   }
   return result;
@@ -2982,7 +2981,7 @@
   if (!pDefaultZBuffer)
   {
     pDefaultZBuffer = pActiveZBuffer = nullptr;
-    pDefaultZBuffer = pActiveZBuffer = (int *)pAllocator->AllocNamedChunk(0, 0x12C000, "Z Buf.");
+    pDefaultZBuffer = pActiveZBuffer = (int *)malloc(0x12C000);
     memset32(pActiveZBuffer, 0xFFFF0000, 0x4B000u); //    // inlined Render::ClearActiveZBuffer  (mm8::004A085B)
   }
 }
@@ -3335,11 +3334,10 @@
   }
   bWindowMode = 0;
   pParty->uFlags |= 2u;
-  LODWORD(flt_6BE3A0) = 0x3F0CCCCDu;
+  LODWORD(flt_6BE3A0) = 0x3F0CCCCDu;  __debugbreak(); // replace with actual float
   pViewport->_4C02F8(36044);
   return v15 != 0;
 }
-// 6BE3A0: using guessed type float flt_6BE3A0;
 
 //----- (004A05F3) --------------------------------------------------------
 bool Render::SwitchToWindow(HWND hWnd)
@@ -8494,11 +8492,11 @@
 //----- (004524D8) --------------------------------------------------------
 HWLTexture *RenderHWLContainer::LoadTexture(const char *pName, int bMipMaps)
 {
-  int v11; // eax@13
-  int v12; // ecx@13
+  //int v11; // eax@13
+  //int v12; // ecx@13
   void *v13; // eax@13
-  unsigned __int8 v14; // zf@13
-  unsigned __int8 v15; // sf@13
+  //unsigned __int8 v14; // zf@13
+  //unsigned __int8 v15; // sf@13
   int v16; // esi@14
   int v17; // ecx@16
   int v18; // esi@16
@@ -8569,18 +8567,14 @@
     else
       fread(pTex->pPixels, 2, pTex->uWidth * pTex->uHeight, pFile);
 
-    if ( field_61A94_scale_hwls_to_half )     //is it even possible to ever get here? field_61A94_scale_hwls_to_half is only set to zero
-    {
-      v11 = pTex->uHeight / 2;
-      v12 = pTex->uWidth / 2;
-      pTex->uHeight = v11;
-      pTex->uWidth = v12;
-      v13 = new unsigned __int16[v12 * v11];
+    if ( scale_hwls_to_half )
+    {
+      pTex->uHeight /= 2;
+      pTex->uWidth /= 2;
+      v13 = new unsigned __int16[pTex->uWidth * pTex->uHeight];
       v28 = 0;
-      v14 = pTex->uHeight == 0;
-      v15 = (pTex->uHeight & 0x80000000u) != 0;
       v26 = (unsigned __int16 *)v13;
-      if ( !(v15 | v14) )
+      if ( pTex->uHeight > 0 )
       {
         v16 = pTex->uWidth;
         v27 = 1;
@@ -8600,7 +8594,8 @@
               LOWORD(v20) = *(unsigned short *)(v21 + 2);
               LOWORD(v21) = *(unsigned short *)v21;
               v23 = pDestb++ + v18;
-              v26[v23] = sub_452442(*(unsigned short *)v22, *(unsigned short *)(v22 + 2), v21, v20);
+              extern unsigned int __fastcall _452442_color_cvt(unsigned __int16 a1, unsigned __int16 a2, int a3, int a4);
+              v26[v23] = _452442_color_cvt(*(unsigned short *)v22, *(unsigned short *)(v22 + 2), v21, v20);
               v16 = pTex->uWidth;
             }
             while (pDestb < pTex->uWidth);
@@ -8614,13 +8609,6 @@
       pTex->pPixels = v26;
     }
     return pTex;
-    //result = pTex;
-//  }
-//  else
-//  {
-//LABEL_8:
-//    return nullptr;
-//  }
 }
 
 //----- (0045271F) --------------------------------------------------------
@@ -8668,7 +8656,7 @@
   this->uDataOffset = 0;
   memset(&this->uNumItems, 0, 0x61A84u);
   this->uNumItems = 0;
-  this->field_61A94_scale_hwls_to_half = 0;
+  this->scale_hwls_to_half = false;
 }
 
 //----- (0045237F) --------------------------------------------------------
--- a/Render.h	Wed Sep 11 00:16:49 2013 +0600
+++ b/Render.h	Wed Sep 11 00:16:58 2013 +0600
@@ -177,7 +177,7 @@
   char *pSpriteNames[50000];
   int pSpriteOffsets[50000];
   int bDumpDebug;
-  int field_61A94_scale_hwls_to_half;
+  int scale_hwls_to_half;
 };
 #pragma pack(pop)
 
--- a/SaveLoad.cpp	Wed Sep 11 00:16:49 2013 +0600
+++ b/SaveLoad.cpp	Wed Sep 11 00:16:58 2013 +0600
@@ -22,7 +22,6 @@
 #include "stru123.h"
 #include "texts.h"
 #include "Log.h"
-#include "Allocator.h"
 #include "VideoPlayer.h"
 
 #include "mm7_data.h"
@@ -617,7 +616,7 @@
 
   if ( pVideoPlayer->AnyMovieLoaded() )
     pVideoPlayer->Unload();
-  pSave = pAllocator->AllocNamedChunk(0, 1000000, 0);
+  pSave = malloc(1000000);
   pNew_LOD->CloseWriteFile();
   remove("data\\new.lod");
 
@@ -666,7 +665,7 @@
     pParty->sRotationY = 512;
     SaveGame(1, 1);
   }
-  pAllocator->FreeChunk(pSave);
+  free(pSave);
 }
 //----- (0045E03A) --------------------------------------------------------
 unsigned short * MakeScreenshot( signed int width, signed int height )
--- a/Spells.cpp	Wed Sep 11 00:16:49 2013 +0600
+++ b/Spells.cpp	Wed Sep 11 00:16:58 2013 +0600
@@ -6,7 +6,6 @@
 
 #include "Spells.h"
 #include "Overlays.h"
-#include "Allocator.h"
 #include "LOD.h"
 #include "texts.h"
 
@@ -301,7 +300,7 @@
 	char* tmp_pos;
 
 	if ( pSpellsTXT_Raw )
-		pAllocator->FreeChunk(pSpellsTXT_Raw);
+		free(pSpellsTXT_Raw);
 	pSpellsTXT_Raw = NULL;
 
 	pSpellsTXT_Raw = (char *)pEvents_LOD->LoadRaw("spells.txt", 0);
--- a/Sprites.cpp	Wed Sep 11 00:16:49 2013 +0600
+++ b/Sprites.cpp	Wed Sep 11 00:16:58 2013 +0600
@@ -5,7 +5,6 @@
 #include <string.h>
 #include <algorithm>
 
-#include "Allocator.h"
 #include "Sprites.h"
 #include "PaletteManager.h"
 #include "LOD.h"
@@ -33,7 +32,7 @@
   v1 = this;
   if ( this->pSpriteSFrames )
   {
-    pAllocator->FreeChunk(this->pSpriteSFrames);
+    free(this->pSpriteSFrames);
     v1->pSpriteSFrames = 0;
   }
   v1->uNumSpriteFrames = 0;
@@ -389,10 +388,10 @@
   uNumSpriteFrames = num_mm6_frames + num_mm7_frames + num_mm8_frames;
   uNumEFrames = num_mm6_eframes + num_mm7_eframes + num_mm8_eframes;
 
-  pSpriteSFrames = (SpriteFrame *)pAllocator->AllocNamedChunk(pSpriteSFrames, uNumSpriteFrames * sizeof(SpriteFrame), "S Frames");
-  pSpriteEFrames = (__int16 *)pAllocator->AllocNamedChunk(pSpriteEFrames,     uNumSpriteFrames * sizeof(short), "E Frames");
+  pSpriteSFrames = (SpriteFrame *)malloc(uNumSpriteFrames * sizeof(SpriteFrame));
+  pSpriteEFrames = (__int16 *)malloc(uNumSpriteFrames * sizeof(short));
 
-  pSpritePFrames = (SpriteFrame **)pAllocator->AllocNamedChunk(pSpritePFrames, 4 * uNumSpriteFrames, "P Frames");
+  pSpritePFrames = (SpriteFrame **)malloc(4 * uNumSpriteFrames);
 
   auto mm7_frames_size = num_mm7_frames * sizeof(SpriteFrame);
   memcpy(pSpriteSFrames, (char *)data_mm7 + 8, mm7_frames_size);
@@ -495,9 +494,9 @@
     v4 = Argsa;
   }
   v2->uNumSpriteFrames = v4;
-  v2->pSpriteSFrames = (SpriteFrame *)pAllocator->AllocNamedChunk(v2->pSpriteSFrames, 60 * v4, "S Frames");
-  v2->pSpriteEFrames = (__int16 *)pAllocator->AllocNamedChunk(  v2->pSpriteEFrames, 2 * v2->uNumSpriteFrames,   "E Frames");
-  v2->pSpritePFrames = (SpriteFrame **)pAllocator->AllocNamedChunk(  v2->pSpritePFrames, 4 * v2->uNumSpriteFrames, "P Frames");
+  v2->pSpriteSFrames = (SpriteFrame *)malloc(60 * v4);
+  v2->pSpriteEFrames = (__int16 *)malloc(2 * v2->uNumSpriteFrames);
+  v2->pSpritePFrames = (SpriteFrame **)malloc(4 * v2->uNumSpriteFrames);
   if ( v2->pSpriteSFrames )
   {
     v6 = File;
--- a/StorylineTextTable.cpp	Wed Sep 11 00:16:49 2013 +0600
+++ b/StorylineTextTable.cpp	Wed Sep 11 00:16:58 2013 +0600
@@ -6,7 +6,6 @@
 #include <string.h>
 
 #include "LOD.h"
-#include "allocator.h"
 #include "texts.h"
 #include "StorylineTextTable.h"
 
@@ -26,7 +25,7 @@
 	int decode_step;
 
 	if ( pHistoryTXT_Raw )
-		pAllocator->FreeChunk(pHistoryTXT_Raw);
+		free(pHistoryTXT_Raw);
 	pHistoryTXT_Raw = NULL;
 	pHistoryTXT_Raw = (char *)pEvents_LOD->LoadRaw("history.txt", 0);
 	strtok(pHistoryTXT_Raw, "\r");
--- a/Texture.cpp	Wed Sep 11 00:16:49 2013 +0600
+++ b/Texture.cpp	Wed Sep 11 00:16:58 2013 +0600
@@ -6,7 +6,6 @@
 
 #include "Texture.h"
 #include "FrameTableInc.h"
-#include "Allocator.h"
 #include "LOD.h"
 #include "PaletteManager.h"
 #include "Render.h"
@@ -274,7 +273,7 @@
   Assert(sNumTextures);
   Assert(!num_mm8_frames);
 
-  pTextures = (TextureFrame *)pAllocator->AllocNamedChunk(pTextures, sNumTextures * sizeof(TextureFrame), "Txt Frames");
+  pTextures = (TextureFrame *)malloc(sNumTextures * sizeof(TextureFrame));
 
   memcpy(pTextures,                                   (char *)data_mm7 + 4, num_mm7_frames * sizeof(TextureFrame));
   memcpy(pTextures + num_mm7_frames,                  (char *)data_mm6 + 4, num_mm6_frames * sizeof(TextureFrame));
@@ -402,9 +401,9 @@
 		__debugbreak();
 	}
 	
-	  pAllocator->FreeChunk(pLevelOfDetail0_prolly_alpha_mask);
-      pAllocator->FreeChunk(pPalette16);
-      pAllocator->FreeChunk(pPalette24);
+	  free(pLevelOfDetail0_prolly_alpha_mask);
+      free(pPalette16);
+      free(pPalette24);
     
 
     pLevelOfDetail0_prolly_alpha_mask = nullptr;
@@ -460,11 +459,11 @@
   if ( DstBuf.uDecompressedSize )
   {
     v5 = malloc(DstBuf.uDecompressedSize);
-    uSourceLena = pAllocator->AllocNamedChunk(0, DstBuf.uTextureSize, DstBuf.pName);
+    uSourceLena = malloc(DstBuf.uTextureSize);
     fread(uSourceLena, 1u, Count, File);
     zlib::MemUnzip(v5, &DstBuf.uDecompressedSize, uSourceLena, DstBuf.uTextureSize);
     DstBuf.uTextureSize = DstBuf.uDecompressedSize;
-    pAllocator->FreeChunk(uSourceLena);
+    free(uSourceLena);
   }
   else
   {
@@ -548,11 +547,11 @@
   if ( DstBuf.uDecompressedSize )
   {
     Str1a = (char *)malloc(DstBuf.uDecompressedSize);
-    v6 = pAllocator->AllocNamedChunk(0, DstBuf.uTextureSize, DstBuf.pName);
+    v6 = malloc(DstBuf.uTextureSize);
     fread(v6, 1u, Count, File);
     zlib::MemUnzip(Str1a, &DstBuf.uDecompressedSize, v6, DstBuf.uTextureSize);
     DstBuf.uTextureSize = DstBuf.uDecompressedSize;
-    pAllocator->FreeChunk(v6);
+    free(v6);
   }
   else
   {
@@ -575,18 +574,18 @@
   {
     if ( mode )
       goto LABEL_14;
-    pAllocator->FreeChunk(v10);
+    free(v10);
   }
   if ( !mode )
   {
-    v11 = pAllocator->AllocNamedChunk(v3->pPixels, 2 * v3->uNumPixels + 4, "16bit PCX");
+    v11 = malloc(2 * v3->uNumPixels + 4);
     goto LABEL_16;
   }
 LABEL_14:
   if ( mode != 2 )
     goto LABEL_17;
   v11 = malloc(2 * v3->uNumPixels + 4);
-  *(unsigned int *)&v3->field_20 |= 1u;
+  v3->_allocation_flags |= 1u;
 LABEL_16:
   v3->pPixels = (unsigned __int16 *)v11;
 LABEL_17:
@@ -1147,20 +1146,17 @@
       {
         if ( pPixels )
         {
-          pAllocator->FreeChunk(pPixels);
+          free(pPixels);
           pPixels = 0;
         }
-        pPixels = (unsigned __int16 *)pAllocator->AllocNamedChunk(
-                                            pPixels,
-                                            2 * uNumPixels + 4,
-                                            pName);
+        pPixels = (unsigned __int16 *)malloc(2 * uNumPixels + 4);
       }
       else
       {
         if ( mode != 1 && mode == 2 )
         {
           pPixels = (unsigned __int16 *)malloc((uNumPixels + 2) * sizeof(unsigned __int16));
-          field_20 |= 1;
+          _allocation_flags |= 1;
         }
       }
 
@@ -1310,14 +1306,14 @@
   void *v3; // [sp-4h] [bp-Ch]@1
 
   v1 = this;
-  v2 = (this->field_20 & 1) == 0;
+  v2 = (this->_allocation_flags & 1) == 0;
   v3 = this->pPixels;
   this->pName[0] = 0;
   if ( v2 )
-    pAllocator->FreeChunk(v3);
+    free(v3);
   else
     free(v3);
-  *(unsigned int *)&v1->field_20 = 0;
+  v1->_allocation_flags = 0;
   v1->pPixels = 0;
   v1->uNumPixels = 0;
   v1->uHeight = 0;
@@ -1394,14 +1390,14 @@
   if ( v12 )
   {
     if ( v3->pPixels )
-      pAllocator->FreeChunk(v3->pPixels);
-    v13 = pAllocator->AllocNamedChunk(v3->pPixels, 2 * v3->uNumPixels + 4, v3->pName);
+      free(v3->pPixels);
+    v13 = malloc(2 * v3->uNumPixels + 4);
     goto LABEL_16;
   }
   if ( a3 != 1 && a3 == 2 )
   {
-    v13 = operator new(4 * v11 + 8);
-    *(unsigned int *)&v3->field_20 |= 1u;
+    v13 = malloc(4 * v11 + 8);
+    v3->_allocation_flags |= 1u;
 LABEL_16:
     v3->pPixels = (unsigned __int16 *)v13;
   }
@@ -1641,8 +1637,7 @@
   uWidth = 0;
   field_1A = 0;
   field_18 = 0;
-  field_20 = 0;
-  field_22 = 0;
+  _allocation_flags = 0;
 }
 //----- (0044E1EC) --------------------------------------------------------
 int TextureFrameTable::FromFileTxt(const char *Args)
@@ -1702,7 +1697,7 @@
   }
   v5 = v2->pTextures;
   v2->sNumTextures = v4;
-  v6 = pAllocator->AllocNamedChunk(v5, 20 * v4, "Txt Frames");
+  v6 = malloc(20 * v4);
   v2->pTextures = (TextureFrame *)v6;
   if ( !v6 )
     Error("CTextureFrameTable::load - Out of Memory!");
--- a/Texture.h	Wed Sep 11 00:16:49 2013 +0600
+++ b/Texture.h	Wed Sep 11 00:16:58 2013 +0600
@@ -24,8 +24,7 @@
   __int16 field_1A;
   __int16 field_1C;
   __int16 field_1E;
-  __int16 field_20;
-  __int16 field_22;
+  int _allocation_flags; // & 1 - malloc, else custom allocator
   unsigned __int16 *pPixels;
 };
 #pragma pack(pop)
--- a/TileTable.cpp	Wed Sep 11 00:16:49 2013 +0600
+++ b/TileTable.cpp	Wed Sep 11 00:16:58 2013 +0600
@@ -8,7 +8,6 @@
 
 #include "TileFrameTable.h"
 #include "FrameTableInc.h"
-#include "Allocator.h"
 #include "PaletteManager.h"
 #include "LOD.h"
 
@@ -20,7 +19,7 @@
 {
   if ( pTiles )
   {
-    pAllocator->FreeChunk(pTiles);
+    free(pTiles);
     pTiles = nullptr;
   }
   sNumTiles = 0;
@@ -119,7 +118,7 @@
   Assert(sNumTiles);
   Assert(!num_mm8_tiles);
 
-  pTiles = (TileDesc *)pAllocator->AllocNamedChunk(pTiles, sNumTiles * sizeof(TileDesc), "Tile Descrip");
+  pTiles = (TileDesc *)malloc(sNumTiles * sizeof(TileDesc));
   memcpy(pTiles,                                 (char *)data_mm7 + 4, num_mm7_tiles * sizeof(TileDesc));
   memcpy(pTiles + num_mm7_tiles,                 (char *)data_mm6 + 4, num_mm6_tiles * sizeof(TileDesc));
   memcpy(pTiles + num_mm6_tiles + num_mm7_tiles, (char *)data_mm8 + 4, num_mm8_tiles * sizeof(TileDesc));
@@ -227,7 +226,7 @@
       ++v4;
   }
   v2->sNumTiles = v4;
-  v5 = pAllocator->AllocNamedChunk(v2->pTiles, 26 * v4, "Tile Descrip");
+  v5 = malloc(26 * v4);
   v2->pTiles = (TileDesc *)v5;
   if ( !v5 )
     Error("TileTable::Load - Out of Memory!");
--- a/UI/Books/UIMapBook.cpp	Wed Sep 11 00:16:49 2013 +0600
+++ b/UI/Books/UIMapBook.cpp	Wed Sep 11 00:16:58 2013 +0600
@@ -13,7 +13,6 @@
 #include "..\..\AudioPlayer.h"
 #include "..\..\Outdoor.h"
 #include "..\..\LOD.h"
-#include "..\..\Allocator.h"
 #include "..\..\Viewport.h"
 #include "..\..\Math.h"
 #include "..\..\texts.h"
--- a/UI/Books/UINotesBooks.cpp	Wed Sep 11 00:16:49 2013 +0600
+++ b/UI/Books/UINotesBooks.cpp	Wed Sep 11 00:16:58 2013 +0600
@@ -12,7 +12,6 @@
 #include "..\..\Party.h"
 #include "..\..\AudioPlayer.h"
 #include "..\..\LOD.h"
-#include "..\..\Allocator.h"
 #include "..\..\Viewport.h"
 #include "..\..\Awards.h"
 #include "..\..\Autonotes.h"
--- a/UI/Books/UISpellBook.cpp	Wed Sep 11 00:16:49 2013 +0600
+++ b/UI/Books/UISpellBook.cpp	Wed Sep 11 00:16:58 2013 +0600
@@ -11,7 +11,6 @@
 #include "..\..\Party.h"
 #include "..\..\AudioPlayer.h"
 #include "..\..\LOD.h"
-#include "..\..\Allocator.h"
 #include "..\..\Viewport.h"
 #include "..\..\texts.h"
 #include "..\..\mm7_data.h"
@@ -45,13 +44,13 @@
 //----- (00411597) --------------------------------------------------------
 void OnCloseBook()
 {
-  pAllocator->FreeChunk(pSpellFont);
+  free(pSpellFont);
   pSpellFont = nullptr;
-  pAllocator->FreeChunk(pBookFont);
+  free(pBookFont);
   pBookFont = nullptr;
-  pAllocator->FreeChunk(pBook2Font);
+  free(pBook2Font);
   pBook2Font = nullptr;
-  pAllocator->FreeChunk(pAutonoteFont);
+  free(pAutonoteFont);
   pAutonoteFont = nullptr;
   pTexture_mapbordr->Release();
   pAudioPlayer->PlaySound(SOUND_CloseBook, 0, 0, -1, 0, 0, 0, 0);
--- a/UI/UIBooks.cpp	Wed Sep 11 00:16:49 2013 +0600
+++ b/UI/UIBooks.cpp	Wed Sep 11 00:16:58 2013 +0600
@@ -9,7 +9,7 @@
 #include "..\GUIFont.h"
 #include "..\AudioPlayer.h"
 #include "..\LOD.h"
-#include "..\Allocator.h"
+
 #include "..\mm7_data.h"
 
 //----- (00413CC6) --------------------------------------------------------
@@ -90,7 +90,7 @@
     do
     {
       pNextButton = pGUIWindow_CurrentMenu->pControlsHead->pNext;
-      pAllocator->FreeChunk(pGUIWindow_CurrentMenu->pControlsHead);
+      free(pGUIWindow_CurrentMenu->pControlsHead);
       pGUIWindow_CurrentMenu->pControlsHead = pNextButton;
     }
     while ( pNextButton );
--- a/UI/UICharacter.cpp	Wed Sep 11 00:16:49 2013 +0600
+++ b/UI/UICharacter.cpp	Wed Sep 11 00:16:58 2013 +0600
@@ -19,10 +19,9 @@
 #include "..\Awards.h"
 #include "..\CastSpellInfo.h"
 #include "..\texts.h"
+#include "..\Mouse.h"
+
 #include "..\mm7_data.h"
-#include "..\Mouse.h"
-#include "..\Allocator.h"
-
 
 int bRingsShownInCharScreen; // 5118E0
 
@@ -2736,7 +2735,7 @@
       if ( BYTE1(i->field_1C) & 0x80 )
       {
         i->Release();
-        pAllocator->FreeChunk(i);
+        free(i);
       }
     }
     for ( j = pGUIWindow_CurrentMenu->pControlsHead; j; j = j->pNext )
--- a/UI/UIMainMenu.cpp	Wed Sep 11 00:16:49 2013 +0600
+++ b/UI/UIMainMenu.cpp	Wed Sep 11 00:16:58 2013 +0600
@@ -10,7 +10,6 @@
 #include "..\AudioPlayer.h"
 #include "..\Render.h"
 #include "..\LOD.h"
-#include "..\Allocator.h"
 #include "..\PaletteManager.h"
 #include "..\IconFrameTable.h"
 #include "..\texts.h"
@@ -290,13 +289,12 @@
         pHeight = pFont2->GetStringHeight2(pFont, v1, &a2, 0, 1);
         pTexture2.uHeight = pHeight + 2 * a2.uFrameHeight;
         pTexture2.uNumPixels = (signed __int16)pTexture2.uWidth * (signed __int16)pTexture2.uHeight;
-        v7 = pAllocator->AllocNamedChunk(pTexture2.pPixels, 2 * pTexture2.uNumPixels, "scrollermap");
+        v7 = malloc(2 * pTexture2.uNumPixels);//, "scrollermap");
         pNumPixels = pTexture2.uNumPixels;
         pTexture2.pPixels = (unsigned __int16 *)v7;
         teal = TargetColor(0, 0xFFu, 0xFFu);
         fill_pixels_fast(teal, pTexture2.pPixels, pNumPixels);
-        pTexture2.field_20 = 0;
-        pTexture2.field_22 = 0;
+        pTexture2._allocation_flags = 0;
         pColor1 = TargetColor(0x70u, 0x8Fu, 0xFEu);
         pColor2 = TargetColor(0xECu, 0xE6u, 0x9Cu);
         pString = (char *)operator new(2 * pSize);
@@ -340,9 +338,9 @@
             }
             while ( GetCurrentMenuID() == MENU_CREDITSPROC );
             pAudioPlayer->_4AA258(1);
-            pAllocator->FreeChunk(ptr);
-            pAllocator->FreeChunk(pFontQuick);
-            pAllocator->FreeChunk(pFontCChar);
+            free(ptr);
+            free(pFontQuick);
+            free(pFontCChar);
             pWindow_MainMenu->Release();
             pIcons_LOD->RemoveTexturesPackFromTextureList();
             pTexture.Release();
--- a/UI/UIPartyCreation.cpp	Wed Sep 11 00:16:49 2013 +0600
+++ b/UI/UIPartyCreation.cpp	Wed Sep 11 00:16:58 2013 +0600
@@ -12,7 +12,6 @@
 #include "..\AudioPlayer.h"
 #include "..\Render.h"
 #include "..\LOD.h"
-#include "..\Allocator.h"
 #include "..\Time.h"
 #include "..\IconFrameTable.h"
 #include "..\texts.h"
@@ -631,7 +630,7 @@
 //----- (0049750E) --------------------------------------------------------
 void DeleteCCharFont()
 {
-  pAllocator->FreeChunk(pFontCChar);
+  free(pFontCChar);
   pFontCChar = 0;
 }
 //----- (00497526) --------------------------------------------------------
--- a/UI/UISaveLoad.cpp	Wed Sep 11 00:16:49 2013 +0600
+++ b/UI/UISaveLoad.cpp	Wed Sep 11 00:16:58 2013 +0600
@@ -13,7 +13,6 @@
 #include "..\Render.h"
 #include "..\IndoorCamera.h"
 #include "..\LOD.h"
-#include "..\Allocator.h"
 #include "..\SaveLoad.h"
 #include "..\texts.h"
 
--- a/VideoPlayer.cpp	Wed Sep 11 00:16:49 2013 +0600
+++ b/VideoPlayer.cpp	Wed Sep 11 00:16:58 2013 +0600
@@ -16,7 +16,6 @@
 #include "Render.h"
 #include "Party.h"
 #include "GUIWindow.h"
-#include "Allocator.h"
 #include "Time.h"
 #include "Log.h"
 #include "texts.h"
@@ -516,8 +515,8 @@
   ReadFile(hMagicVid, &uNumMagicVideoHeaders, 4, &NumberOfBytesRead, 0);
   pMagicVideoHeaders = 0;
   pMightVideoHeaders = 0;
-  pMightVideoHeaders = (MovieHeader *)pAllocator->AllocNamedChunk(0, 44 * uNumMightVideoHeaders + 2, 0);
-  pMagicVideoHeaders = (MovieHeader *)pAllocator->AllocNamedChunk(pMagicVideoHeaders, 44 * uNumMagicVideoHeaders + 2, 0);
+  pMightVideoHeaders = (MovieHeader *)malloc(sizeof(MovieHeader) * uNumMightVideoHeaders + 2);
+  pMagicVideoHeaders = (MovieHeader *)malloc(sizeof(MovieHeader) * uNumMagicVideoHeaders + 2);
   ReadFile(hMightVid, pMightVideoHeaders, 44 * uNumMightVideoHeaders, &NumberOfBytesRead, 0);
   ReadFile(hMagicVid, pMagicVideoHeaders, 44 * uNumMagicVideoHeaders, &NumberOfBytesRead, 0);
 }
--- a/Viewport.cpp	Wed Sep 11 00:16:49 2013 +0600
+++ b/Viewport.cpp	Wed Sep 11 00:16:58 2013 +0600
@@ -62,10 +62,10 @@
 
 //----- (004C02F8) --------------------------------------------------------
 void Viewport::_4C02F8(int a2)
-    {
+{
     this->field_30 = a2;
     SetScreen(this->uScreen_TL_X, this->uScreen_TL_Y, this->uScreen_BR_X, this->uScreen_BR_Y);
-    }
+}
 
 //----- (004C0312) --------------------------------------------------------
 void Viewport::SetViewport( signed int sTL_X, signed int sTL_Y, signed int sBR_X, signed int sBR_Y )
--- a/_deleted.cpp	Wed Sep 11 00:16:49 2013 +0600
+++ b/_deleted.cpp	Wed Sep 11 00:16:58 2013 +0600
@@ -12374,6 +12374,400 @@
   LOWORD(v2) = (a1 >> 5) & 0x7E0;
   return ((unsigned __int8)a1 >> 3) | v2 | v1;
 }
+//----- (00487DBE) --------------------------------------------------------
+void Software_ResetNewEdges()
+{
+  int v0; // ecx@1
+  Edge **v1; // eax@1
+  signed int v2; // eax@3
+
+  v0 = 0;
+  v1 = ptr_80CA10.data();
+  do
+  {
+    ++v0;
+    *((int *)&pNewEdges[v0] - 9) = (int)&defaultEdge;
+    *v1 = 0;
+    ++v1;
+  }
+  while ( (signed int)v1 < (signed int)&unk_80D190 );
+  v2 = 2000;
+  do
+  {
+    pSurfs->field_22 = 0;
+    --v2;
+  }
+  while ( v2 );
+}
+//----- (00486A28) --------------------------------------------------------
+void OutdoorCamera::AllocSoftwareDrawBuffers()
+{
+  if ( !this || !pSpans )
+  {
+    ReleaseSoftwareDrawBuffers();
+    pSpans = (Span *)malloc(pSpans, 0x493E0u, "SPANS");
+    pEdges = (Edge *)malloc(pEdges, 0x4C2C0u, "EDGES");
+    pSurfs = (Surf *)malloc(pSurfs, 0x11940u, "SURFS");
+    pNewEdges = (Edge *)malloc(pNewEdges, 0x6180u, "NEWEDGES");
+    memset(pSpans, 0, 0x493E0u);
+    memset(pEdges, 0, 0x4C2C0u);
+    memset(pSurfs, 0, 0x11940u);
+    memset(pNewEdges, 0, 0x6180u);
+  }
+}
+//----- (00486AFC) --------------------------------------------------------
+void OutdoorCamera::ReleaseSoftwareDrawBuffers()
+{
+  free(pSpans);
+  free(pEdges);
+  free(pSurfs);
+  free(pNewEdges);
+  pSpans = 0;
+  pEdges = 0;
+  pSurfs = 0;
+  pNewEdges = 0;
+}
+//----- (0048901B) --------------------------------------------------------
+bool OutdoorLocation::Release2()
+{
+  Release();
+  pOutdoorCamera->ReleaseSoftwareDrawBuffers();
+  return true;
+}
+
+struct Allocator
+{
+  static Allocator *Create() {static Allocator a; return &a;}
+
+  Allocator();
+  bool  Initialize(unsigned int uNumKBytes);
+  void *AllocNamedChunk(const void *pPrevPtrValue, unsigned int uSize, const char *pName);
+  void FreeChunk(void *ptr);
+  bool CreateFileDump(const char *a1);
+
+  void *pMemoryBuffers[6000];
+  unsigned int uMemoryBuffersSizes[6000];
+  char pMemoryBuffersNames[6000][12];
+  unsigned int uDumpsCount;
+  unsigned int uNumBuffersUsed;
+  void *pBigMemoryBuffer;
+  unsigned int uNextFreeOffsetInBigBuffer;
+  unsigned int uBigBufferSizeAligned;
+  unsigned int bBigBufferAllocated;
+  unsigned int bUseBigBuffer;
+  void *pBigBufferAligned;
+};
+#ifdef _MSC_VER
+#define _CRT_SECURE_NO_WARNINGS
+#endif
+
+#include <string.h>
+#include <stdio.h>
+
+#include "Allocator.h"
+#include "ErrorHandling.h"
+
+#include "mm7_data.h"
+
+
+
+Allocator *pAllocator; // idb
+
+int aborting_app = false; // weak
+
+
+
+
+void __fastcall CheckMemoryAccessibility(void *pBase, DWORD uSize);
+
+
+
+//----- (00426755) --------------------------------------------------------
+void *Allocator::AllocNamedChunk(const void *pPrevPtrValue, unsigned int uSize, const char *pName)
+{
+  //Allocator *v4; // esi@1
+  unsigned int v5; // eax@7
+  void *result; // eax@8
+ // unsigned int *pNumBuffersUsed; // ebx@12
+  unsigned int v8; // edi@15
+  char v9; // zf@15
+  int v10; // eax@16
+  void **v11; // ebx@19
+  void *v12; // eax@22
+  unsigned int Size; // [sp+14h] [bp+Ch]@16
+
+  int aligned_size; 
+
+
+  if ( pPrevPtrValue && !aborting_app )
+	  AbortWithError();
+  if ( !bBigBufferAllocated && !aborting_app )
+	  AbortWithError();
+
+  if (!uSize)
+	  return 0;
+
+  if (((uSize & 0x80000000u) != 0) && !aborting_app)
+	  AbortWithError();
+
+  if (uNumBuffersUsed == 6000 && !aborting_app)
+	  AbortWithError();
+
+  ++uNumBuffersUsed;
+
+  if (!bUseBigBuffer)
+	  {
+	  pMemoryBuffers[uNumBuffersUsed] = malloc(uSize);
+	  if (pMemoryBuffers[uNumBuffersUsed])
+		  uMemoryBuffersSizes[uNumBuffersUsed] = uSize;
+	  else
+		  {
+		  if ( !aborting_app )
+			  AbortWithError();
+		  }
+	  }
+  else
+	  {
+
+	  aligned_size =(uSize&0xFFFFFFFC) + 4;
+
+	  if ((uNextFreeOffsetInBigBuffer +aligned_size) > uBigBufferSizeAligned)
+		  {
+		  printf("Id: %s  Size: %i", pName, aligned_size);
+		  CreateFileDump( "Memory");
+		  if ( !aborting_app )
+			  AbortWithError();
+		  }
+
+	  pMemoryBuffers[uNumBuffersUsed] = (char *)pBigMemoryBuffer + uNextFreeOffsetInBigBuffer;//(char *)(pBigBufferAligned) + uNextFreeOffsetInBigBuffer;
+	  uMemoryBuffersSizes[uNumBuffersUsed] =aligned_size;
+
+	  if (pName)
+		  strncpy(pMemoryBuffersNames[uNumBuffersUsed], pName, 11);
+	  uNextFreeOffsetInBigBuffer += aligned_size;
+	  }
+  return pMemoryBuffers[uNumBuffersUsed];
+}
+// 720018: using guessed type int aborting_app;
+
+
+
+//----- (004266CD) --------------------------------------------------------
+bool Allocator::Initialize(unsigned int uNumKBytes)
+{
+  if (bBigBufferAllocated)
+    return false;
+
+  if (!uNumKBytes)
+    return false;
+
+  pBigMemoryBuffer = malloc(uNumKBytes * 1024);
+  if (!pBigMemoryBuffer)
+    return false;
+
+  pBigBufferAligned = (void *)((unsigned int)(pBigMemoryBuffer) & 0xFFFF0000 + 4096);
+  //(char *)pBigMemoryBuffer + -((unsigned __int16)pBigMemoryBuffer & 0xFFF) + 4096;
+  uBigBufferSizeAligned = (uNumKBytes * 1024) - 4096;
+
+  uNumBuffersUsed = 0;
+  uNextFreeOffsetInBigBuffer = 0;
+
+  bUseBigBuffer = true;
+  return bBigBufferAllocated = true;
+}
+
+
+//----- (00426474) --------------------------------------------------------
+void Allocator::FreeChunk(void *ptr)
+{
+  Allocator *v2; // esi@1
+  unsigned int v3; // eax@5
+  signed int i; // edi@5
+  unsigned int v5; // eax@13
+  signed int v6; // ecx@16
+  signed int j; // edx@16
+  char v8; // zf@20
+
+ 
+  
+  unsigned int  uBuffindx; 
+  unsigned int indx;
+
+  if (ptr)
+	  {
+	  if ((!bBigBufferAllocated)&& (!aborting_app ))
+		  AbortWithError();
+	  for (indx = 0; indx <=uNumBuffersUsed; ++indx)
+		  if (pMemoryBuffers[indx] == ptr)	
+			  break;
+	  //if ((indx>uNumBuffersUsed)&& !aborting_app )
+		  //AbortWithError(); //to detect memory problems - uncomment
+	  if (!bUseBigBuffer)
+		  free(pMemoryBuffers[indx]);
+	  pMemoryBuffers[indx] = NULL;
+	  uMemoryBuffersSizes[indx] = 0;
+	  pMemoryBuffersNames[indx][0] = 0;
+	  if (indx == (uNumBuffersUsed-1))
+		  {
+		  if (indx>0)
+			  {
+			  uBuffindx = 0;
+			  for (j = 0; j < uNumBuffersUsed-1; ++j)
+				  {
+				  if (pMemoryBuffers[j])
+					  uBuffindx = j;
+				  }
+			  uNumBuffersUsed =  uBuffindx + 1;
+			  if (bUseBigBuffer)
+				  uNextFreeOffsetInBigBuffer = 
+				  ((long)((char*)pMemoryBuffers[uBuffindx] -(char*)pBigBufferAligned)+ uMemoryBuffersSizes[uBuffindx]);
+			  }
+		  else
+			  {
+			  uNumBuffersUsed = 0;
+			  uNextFreeOffsetInBigBuffer = 0;
+			  }
+		  }
+	  }
+}
+// 720018: using guessed type int aborting_app;
+
+
+
+//----- (00426429) --------------------------------------------------------
+Allocator::Allocator()
+{
+  Allocator *v1; // eax@1
+  signed int v2; // ecx@1
+  int v3; // edx@1
+
+  v1 = this;
+  v2 = 0;
+  v1->uBigBufferSizeAligned = 0;
+  v1->bBigBufferAllocated = 0;
+  v3 = (int)v1->pMemoryBuffersNames;
+  do
+  {
+    v1->pMemoryBuffers[v2] = 0;
+    v1->uMemoryBuffersSizes[v2] = 0;
+    *(char *)v3 = 0;
+    ++v2;
+    v3 += 12;
+  }
+  while ( v2 < 6000 );
+  v1->uDumpsCount = 0;
+}
+
+
+//----- (0042654C) --------------------------------------------------------
+bool Allocator::CreateFileDump(const char *a1)
+{
+  Allocator *v2; // esi@1
+  unsigned int v3; // ST44_4@1
+  FILE *v4; // eax@1
+  FILE *v5; // edi@1
+  bool result; // eax@2
+  unsigned int v7; // ecx@5
+  int v8; // edx@5
+  int v9; // eax@6
+  int v10; // eax@8
+  int v11; // ecx@8
+  signed int v12; // ebx@8
+  signed int v13; // ebx@10
+  struct _MEMORYSTATUS memstat; // [sp+8h] [bp-38h]@5
+  char Filename[20]; // [sp+28h] [bp-18h]@1
+  unsigned int *v16; // [sp+3Ch] [bp-4h]@11
+  int a1a; // [sp+48h] [bp+8h]@11
+
+  v2 = this;
+  v3 = this->uDumpsCount;
+  this->uDumpsCount = v3 + 1;
+  sprintf(Filename, "Mem%03i.txt", v3);
+  v4 = fopen(Filename, "w");
+  v5 = v4;
+  if ( v4 )
+  {
+    if ( a1 )
+      fprintf(v4, "%s\n\n", a1);
+    fprintf(v5, "Windows Memory Status");
+    GlobalMemoryStatus(&memstat);
+    fprintf(v5, "dwLength:         %d\n\n", memstat.dwLength);
+    fprintf(v5, "dwMemoryLoad:     %d\n", memstat.dwMemoryLoad);
+    fprintf(v5, "dwTotalPhys:      %d\n", memstat.dwTotalPhys);
+    fprintf(v5, "dwAvailPhys:      %d\n", memstat.dwAvailPhys);
+    fprintf(v5, "dwTotalPageFile:  %d\n", memstat.dwTotalPageFile);
+    fprintf(v5, "dwAvailPageFile:  %d\n", memstat.dwAvailPageFile);
+    fprintf(v5, "dwTotalVirtual:   %d\n", memstat.dwTotalVirtual);
+    fprintf(v5, "dwAvailVirtual:   %d\n\n\n", memstat.dwAvailVirtual);
+    v7 = v2->uNumBuffersUsed;
+    v8 = 0;
+    if ( (signed int)v7 > 0 )
+    {
+      v9 = (int)v2->uMemoryBuffersSizes;
+      do
+      {
+        v8 += *(int *)v9;
+        v9 += 4;
+        --v7;
+      }
+      while ( v7 );
+    }
+    v10 = 0;
+    v11 = (int)v2->uMemoryBuffersSizes;
+    v12 = 6000;
+    do
+    {
+      v10 += *(int *)v11;
+      v11 += 4;
+      --v12;
+    }
+    while ( v12 );
+    fprintf(v5, "Size: %i  %i  %i\n\n", v2->uNumBuffersUsed, v8, v10);
+    v13 = 0;
+    if ( (signed int)v2->uNumBuffersUsed > 0 )
+    {
+      v16 = v2->uMemoryBuffersSizes;
+      a1a = (int)v2->pMemoryBuffersNames;
+      do
+      {
+        fprintf(v5, "%10i %10i %s\n", v13, *v16, a1a);
+        a1a += 12;
+        ++v16;
+        ++v13;
+      }
+      while ( v13 < (signed int)v2->uNumBuffersUsed );
+    }
+    fclose(v5);
+    result = 0;
+  }
+  else
+  {
+    result = 1;
+  }
+  return result;
+}
+
+
+
+
+
+
+
+
+//----- (00426892) --------------------------------------------------------
+static void __fastcall CheckMemoryAccessibility(void *pBase, DWORD uSize)
+{
+  DWORD v2; // edi@1
+  DWORD i; // eax@1
+  struct _SYSTEM_INFO SystemInfo; // [sp+8h] [bp-24h]@1
+
+  v2 = uSize;
+  GetSystemInfo(&SystemInfo);
+  for ( i = 16 * SystemInfo.dwPageSize; i < v2; i += SystemInfo.dwPageSize )
+    ;
+}
+
+
 
 const wchar_t *UIMessage2String(UIMessageType msg)
 {
--- a/mm7_1.cpp	Wed Sep 11 00:16:49 2013 +0600
+++ b/mm7_1.cpp	Wed Sep 11 00:16:58 2013 +0600
@@ -26,7 +26,6 @@
 #include "Overlays.h"
 #include "LOD.h"
 #include "Actor.h"
-#include "Allocator.h"
 #include "Events.h"
 #include "Viewport.h"
 #include "SpriteObject.h"
--- a/mm7_2.cpp	Wed Sep 11 00:16:49 2013 +0600
+++ b/mm7_2.cpp	Wed Sep 11 00:16:58 2013 +0600
@@ -36,7 +36,6 @@
 #include "Arcomage.h"
 #include "LOD.h"
 #include "Actor.h"
-#include "Allocator.h"
 #include "Events.h"
 #include "Viewport.h"
 #include "FrameTableInc.h"
@@ -345,7 +344,7 @@
       do
       {
         v6 = v5->pNext;
-        pAllocator->FreeChunk(v5);
+        free(v5);
         v5 = v6;
       }
       while ( v6 );
@@ -792,7 +791,7 @@
   if ( pRenderer->pRenderD3D )
     pRenderer->pBeforePresentFunction();
   pRenderer->_49F1BC("MM7_Win.Pcx");
-  pAllocator->FreeChunk(pFont);
+  free(pFont);
   window_SpeakInHouse->Release();
   window_SpeakInHouse = 0;
   if ( v15 == (void *)2 )
@@ -2076,7 +2075,7 @@
 }
 
 //----- (00452442) --------------------------------------------------------
-unsigned int __fastcall sub_452442(unsigned __int16 a1, unsigned __int16 a2, int a3, int a4)
+unsigned int __fastcall _452442_color_cvt(unsigned __int16 a1, unsigned __int16 a2, int a3, int a4)
 {
   int v4; // ebx@0
   __int16 v5; // ST14_2@1
@@ -2369,7 +2368,7 @@
   int item_counter;
 
   if ( pMapStatsTXT_Raw )
-    pAllocator->FreeChunk(pMapStatsTXT_Raw);
+    free(pMapStatsTXT_Raw);
   pMapStatsTXT_Raw = NULL;
   pMapStatsTXT_Raw = (char *)pEvents_LOD->LoadRaw("MapStats.txt", 0);
   strtok(pMapStatsTXT_Raw, "\r");
@@ -2706,7 +2705,7 @@
   int item_counter;
 
   if ( pHostileTXT_Raw )
-    pAllocator->FreeChunk(pHostileTXT_Raw);
+    free(pHostileTXT_Raw);
   pHostileTXT_Raw = NULL;
   pHostileTXT_Raw = (char *)pEvents_LOD->LoadRaw("hostile.txt", 0);
   strtok(pHostileTXT_Raw, "\r");
@@ -2743,7 +2742,7 @@
 	  }
   if ( pHostileTXT_Raw)
   {
-    pAllocator->FreeChunk(pHostileTXT_Raw);
+    free(pHostileTXT_Raw);
     pHostileTXT_Raw = NULL;
   }
 }
@@ -3768,7 +3767,7 @@
 }
 
 //----- (00464479) --------------------------------------------------------
-void  ResetCursor_Palettes_LODs_Level_Audio_SFT_Windows()
+void ResetCursor_Palettes_LODs_Level_Audio_SFT_Windows()
 {
   int v0; // esi@9
 
@@ -3788,7 +3787,7 @@
   if (uCurrentlyLoadedLevelType == LEVEL_Indoor)
     pIndoor->Release();
   else if (uCurrentlyLoadedLevelType == LEVEL_Outdoor)
-    pOutdoor->Release2();
+    pOutdoor->Release();
 
   pAudioPlayer->StopChannels(-1, -1);
   pSoundList->_4A9D79(0);
@@ -3816,21 +3815,16 @@
 }
 
 //----- (00464761) --------------------------------------------------------
-void  Game_DeinitializeAndTerminate(int exitCode)
+void Game_DeinitializeAndTerminate(int exitCode)
 {
-  int v1; // esi@1
-  HANDLE v2; // eax@1
-
-  v1 = exitCode;
-  v2 = GetCurrentProcess();
-  SetPriorityClass(v2, 0x20u);
+  SetPriorityClass(GetCurrentProcess(), 0x20u);
   ResetCursor_Palettes_LODs_Level_Audio_SFT_Windows();
   pGame->Deinitialize();
   pRenderer->Release2();
   if ( !DestroyWindow(hWnd) )
     GetLastError();
   hWnd = 0;
-  exit(v1);
+  exit(exitCode);
 }
 
 //----- (004647AB) --------------------------------------------------------
@@ -3851,13 +3845,13 @@
 // 6BE3A0: using guessed type float flt_6BE3A0;
 
 //----- (00464839) --------------------------------------------------------
-char  Is_out15odm_underwater()
+char Is_out15odm_underwater()
 {
   return _stricmp(pCurrentMapName, "out15.odm") == 0;
 }
 
 //----- (00464851) --------------------------------------------------------
-void  SetUnderwaterFog()
+void SetUnderwaterFog()
 {
   day_fogrange_1 = 50;
   day_fogrange_2 = 5000;
@@ -3900,7 +3894,7 @@
   if ( !_stricmp(pCurrentMapName, "out15.odm") )
   {
     bUnderwater = true;
-    pGame->uFlags2 |= 8u;
+    pGame->uFlags2 |= GAME_FLAGS_2_ALTER_GRAVITY;
   }
   pParty->floor_face_pid = 0;
   if ( _stricmp(Str1, "blv") )
@@ -3911,7 +3905,7 @@
   _461103_load_level_sub();
   if ( !_stricmp(pCurrentMapName, "d11.blv") || !_stricmp(pCurrentMapName, "d10.blv") )
   {
-    //spawning grounds & good analogue - no loot & exp from monsters
+    //spawning grounds & walls of mist - no loot & exp from monsters
 
     for (uint i = 0; i < uNumActors; ++i)
     {
@@ -4527,15 +4521,6 @@
       return false;
     }
   }
-  
-  pAllocator = Allocator::Create();
-  if (!pAllocator->Initialize(48 * 1024))
-  {
-    MessageBoxW(nullptr,
-                L"Unable to Allocate 48Mb of RAM",
-                L"More RAM Memory Required", MB_ICONEXCLAMATION);
-    return false;
-  }
 
   game_starting_year = 1168;
 
@@ -4992,6 +4977,7 @@
 
 void IntegrityTest()
 {
+  assert(sizeof(MovieHeader) == 44);
   assert(sizeof(SoundDesc_mm6) == 112);
   assert(sizeof(SoundDesc) == 120);
   assert(sizeof(OverlayDesc) == 8);
--- a/mm7_3.cpp	Wed Sep 11 00:16:49 2013 +0600
+++ b/mm7_3.cpp	Wed Sep 11 00:16:58 2013 +0600
@@ -28,7 +28,6 @@
 #include "Overlays.h"
 #include "LOD.h"
 #include "Actor.h"
-#include "Allocator.h"
 #include "Events.h"
 #include "Viewport.h"
 #include "Math.h"
@@ -5505,14 +5504,14 @@
   //int v13; // [sp+8Ch] [bp-4h]@11
 
   pFilename = pLevelFilename;
-  thisa->AllocSoftwareDrawBuffers();
+  //thisa->AllocSoftwareDrawBuffers();
   pOutdoorCamera->_485F64();
   pWeather->bRenderSnow = false;
   pRenderer->ClearZBuffer(0, 479);
   thisa = (OutdoorCamera *)1;
   GetAlertStatus();
   if ( qword_A750D8 )
-    qword_A750D8 = 0i64;
+    qword_A750D8 = 0;
   v2 = pMapStats->GetMapInfo(pCurrentMapName);
   v3 = 0;
   if ( v2 )
@@ -6322,7 +6321,7 @@
 	int decode_step;
 
 	if ( p2DEventsTXT_Raw )
-		pAllocator->FreeChunk(p2DEventsTXT_Raw);
+		free(p2DEventsTXT_Raw);
 	p2DEventsTXT_Raw = NULL;
 	p2DEventsTXT_Raw = (char *)pEvents_LOD->LoadRaw("2dEvents.txt", 0);
 	strtok(p2DEventsTXT_Raw, "\r");
--- a/mm7_4.cpp	Wed Sep 11 00:16:49 2013 +0600
+++ b/mm7_4.cpp	Wed Sep 11 00:16:58 2013 +0600
@@ -24,7 +24,6 @@
 #include "IndoorCamera.h"
 #include "LOD.h"
 #include "Actor.h"
-#include "Allocator.h"
 #include "Events.h"
 #include "Viewport.h"
 #include "FrameTableInc.h"
@@ -397,38 +396,12 @@
 }
 
 //----- (00487DA9) --------------------------------------------------------
-void  sub_487DA9()
+void sub_487DA9()
 {
   for (int i = 0; i < 20000; ++i)
     array_77EC08[i].field_108 = 0;
 }
 
-//----- (00487DBE) --------------------------------------------------------
-void Software_ResetNewEdges()
-{
-  int v0; // ecx@1
-  Edge **v1; // eax@1
-  signed int v2; // eax@3
-
-  v0 = 0;
-  v1 = ptr_80CA10.data();
-  do
-  {
-    ++v0;
-    *((int *)&pNewEdges[v0] - 9) = (int)&defaultEdge;
-    *v1 = 0;
-    ++v1;
-  }
-  while ( (signed int)v1 < (signed int)&unk_80D190 );
-  v2 = 2000;
-  do
-  {
-    pSurfs->field_22 = 0;
-    --v2;
-  }
-  while ( v2 );
-}
-
 //----- (0048A959) --------------------------------------------------------
 unsigned int ReplaceHSV(unsigned int uColor, float h_replace, float s_replace, float v_replace)
 {
@@ -1571,7 +1544,7 @@
   assert(uNumFrames);
   assert(!num_mm8_frames);
 
-  pFrames = (PlayerFrame *)pAllocator->AllocNamedChunk(pFrames, uNumFrames * sizeof(PlayerFrame), "P Frames");
+  pFrames = (PlayerFrame *)malloc(uNumFrames * sizeof(PlayerFrame));
   memcpy(pFrames,                                   (char *)data_mm7 + 4, num_mm7_frames * sizeof(PlayerFrame));
   memcpy(pFrames + num_mm7_frames,                  (char *)data_mm6 + 4, num_mm6_frames * sizeof(PlayerFrame));
   memcpy(pFrames + num_mm6_frames + num_mm7_frames, (char *)data_mm8 + 4, num_mm8_frames * sizeof(PlayerFrame));
@@ -1634,7 +1607,7 @@
     v4 = v25;
   }
   v2->uNumFrames = v4;
-  v5 = pAllocator->AllocNamedChunk(v2->pFrames, 10 * v4, "P Frames");
+  v5 = malloc(10 * v4);
   v2->pFrames = (PlayerFrame *)v5;
   if ( !v5 )
     Error("PlayerFrameTable::load - Out of Memory!");
--- a/mm7_data.cpp	Wed Sep 11 00:16:49 2013 +0600
+++ b/mm7_data.cpp	Wed Sep 11 00:16:58 2013 +0600
@@ -1309,13 +1309,6 @@
 int dword_80AA20; // weak
 unsigned int uNumElementsIn80AA28;
 std::array<struct Polygon *, 2000> ptr_80AA28;
-struct Edge *pNewEdges;
-struct Surf *pSurfs;
-struct Edge *pEdges;
-struct Span *pSpans;
-struct Edge *ptr_80C978_Edges;
-struct Surf *ptr_80C97C_Surfs;
-std::array<struct Edge *, 480> ptr_80CA10;
 _UNKNOWN unk_80D190; // weak
 int dword_A74C88; // weak
 unsigned int uPlayerCreationUI_SkySliderPos;
--- a/mm7_data.h	Wed Sep 11 00:16:49 2013 +0600
+++ b/mm7_data.h	Wed Sep 11 00:16:58 2013 +0600
@@ -969,13 +969,6 @@
 extern int dword_80AA20; // weak
 extern unsigned int uNumElementsIn80AA28;
 extern std::array<struct Polygon *, 2000> ptr_80AA28;
-extern struct Edge *pNewEdges;
-extern struct Surf *pSurfs;
-extern struct Edge *pEdges;
-extern struct Span *pSpans;
-extern struct Edge *ptr_80C978_Edges;
-extern struct Surf *ptr_80C97C_Surfs;
-extern std::array<struct Edge *, 480> ptr_80CA10;
 extern _UNKNOWN unk_80D190; // weak
 extern int dword_A74C88; // weak
 extern unsigned int uPlayerCreationUI_SkySliderPos;
@@ -1147,7 +1140,6 @@
 int __fastcall _43AFE3_calc_spell_damage(int a1, int a2, signed int a3, int a4);
 void __fastcall sub_43B057(unsigned int uObjID, unsigned int uActorID, struct Vec3_int_ *pVelocity);
 void sub_43B1B0(signed int a1, unsigned int a2, struct Vec3_int_ *pVelocity, signed int a4);
-void Software_ResetNewEdges();
 void CharacterUI_LoadPaperdollTextures();
 int __fastcall GetItemTextureFilename(char *pOut, signed int item_id, int index, int shoulder);
 bool _43ED6F_check_party_races(bool b);
@@ -1372,7 +1364,6 @@
 void RespawnGlobalDecorations();
 bool __fastcall SpawnActor(unsigned int uMonsterID);
 int GetAlertStatus();
-unsigned int __fastcall sub_452442(unsigned __int16 a1, unsigned __int16 a2, int a3, int a4);
 int integer_sqrt(int val);
 int __fastcall MakeColorMaskFromBitDepth(int a1);
 void __fastcall fill_pixels_fast(unsigned int a1, unsigned __int16 *pPixels, unsigned int uNumPixels);
--- a/texts.cpp	Wed Sep 11 00:16:49 2013 +0600
+++ b/texts.cpp	Wed Sep 11 00:16:58 2013 +0600
@@ -3,7 +3,6 @@
 #endif
 
 #include <string.h>
-#include "Allocator.h"
 #include "LOD.h"
 #include "mm7_data.h"
 #include "texts.h"
@@ -80,7 +79,7 @@
 	bool string_end; // [sp+14h] [bp-4h]@4
 	//v0 = 0;
 	if (pGlobalTXT_Raw)
-		pAllocator->FreeChunk(pGlobalTXT_Raw);
+		free(pGlobalTXT_Raw);
 	pGlobalTXT_Raw = (char *)pEvents_LOD->LoadRaw("global.txt", 0);
 
 /*	strtok(pGlobalTXT_Raw, "\r");