static void __attribute__ ((destructor)) libEnd(void) { CloseDebugFiles(); FreeMemory(); }
FileCollection::~FileCollection() { FreeMemory(); }
CGUIListItem::~CGUIListItem(void) { FreeMemory(); }
void StoredTerrainLandscape::SetValues(unsigned int terrainLandscapeSize, float* heightData, unsigned int splatTextureDimension, uint8_t* splatTexture0Data, uint8_t* splatTexture1Data, const std::string& diffuse0Path, const std::string& normal0Path, const std::string& diffuse1Path, const std::string& normal1Path, const std::string& diffuse2Path, const std::string& normal2Path, const std::string& diffuse3Path, const std::string& normal3Path, const std::string& diffuse4Path, const std::string& normal4Path, const std::string& diffuse5Path, const std::string& normal5Path, const std::string& diffuse6Path, const std::string& normal6Path, const std::string& diffuse7Path, const std::string& normal7Path) { FreeMemory(); numBinaryBlobs = totalAttributes; blobArray = new AttributedBinaryBlob[numBinaryBlobs]; // Store the terrain height data. { const unsigned int blobIndex = 0; terrainLandscapeSize = static_cast<uint32_t>(terrainLandscapeSize); unsigned long compressedSize; unsigned long targetSize = terrainLandscapeSize * terrainLandscapeSize * sizeof(float); blobArray[blobIndex].attribute = TerrainHeightData; if (CompressionLib::Compression::CompressByteArray(reinterpret_cast<const uint8_t*>(heightData), targetSize, &blobArray[blobIndex].data, &compressedSize)) { blobArray[blobIndex].compressed = true; blobArray[blobIndex].blobSize = static_cast<uint32_t>(compressedSize); std::cout << "StoredTerrainLandscape::Compressed height size from " << targetSize << " bytes to " << compressedSize << " bytes." << std::endl; } else { blobArray[blobIndex].compressed = false; unsigned int numHeights = terrainLandscapeSize * terrainLandscapeSize; float* heightArrayCopy = new float[numHeights]; for (unsigned int i = 0; i < numHeights; i++) { heightArrayCopy[i] = heightData[i]; } blobArray[blobIndex].blobSize = targetSize; blobArray[blobIndex].data = reinterpret_cast<uint8_t*>(heightArrayCopy); } } // Splat textures. splatTextureSize = static_cast<uint32_t>(splatTextureDimension); // Store splat texture 0 data. { const unsigned int blobIndex = 1; unsigned long compressedSize; unsigned long targetSize = splatTextureSize * splatTextureSize * 4; /// 4 bytes per splat pixel. blobArray[blobIndex].attribute = TerrainSplat0Data; if (CompressionLib::Compression::CompressByteArray(reinterpret_cast<const uint8_t*>(splatTexture0Data), targetSize, &blobArray[blobIndex].data, &compressedSize)) { blobArray[blobIndex].compressed = true; blobArray[blobIndex].blobSize = static_cast<uint32_t>(compressedSize); std::cout << "StoredTerrainLandscape::Compressed splat texture 0 size from " << targetSize << " bytes to " << compressedSize << " bytes." << std::endl; } else { blobArray[blobIndex].compressed = false; unsigned int numElements = splatTextureSize * splatTextureSize * 4; uint8_t* textureSplatCopy = new uint8_t[numElements]; for (unsigned int i = 0; i < numElements; i++) { textureSplatCopy[i] = splatTexture0Data[i]; } blobArray[blobIndex].blobSize = numElements; blobArray[blobIndex].data = reinterpret_cast<uint8_t*>(textureSplatCopy); } } // Store splat texture 1 data. { const unsigned int blobIndex = 2; unsigned long compressedSize; unsigned long targetSize = splatTextureSize * splatTextureSize * 4; /// 4 bytes per splat pixel. blobArray[blobIndex].attribute = TerrainSplat1Data; if (CompressionLib::Compression::CompressByteArray(reinterpret_cast<const uint8_t*>(splatTexture1Data), targetSize, &blobArray[blobIndex].data, &compressedSize)) { blobArray[blobIndex].compressed = true; blobArray[blobIndex].blobSize = static_cast<uint32_t>(compressedSize); std::cout << "StoredTerrainLandscape::Compressed splat texture 1 size from " << targetSize << " bytes to " << compressedSize << " bytes." << std::endl; } else { blobArray[blobIndex].compressed = false; unsigned int numElements = splatTextureSize * splatTextureSize * 4; uint8_t* textureSplatCopy = new uint8_t[numElements]; for (unsigned int i = 0; i < numElements; i++) { textureSplatCopy[i] = splatTexture1Data[i]; } blobArray[blobIndex].blobSize = numElements; blobArray[blobIndex].data = reinterpret_cast<uint8_t*>(textureSplatCopy); } } // Texture 0 Diffuse path. { const unsigned int blobIndex = 3; blobArray[blobIndex].attribute = TerrainDiffuse0Data; blobArray[blobIndex].compressed = false; blobArray[blobIndex].blobSize = (uint32_t)(diffuse0Path.length() + 1); char* value = new char[blobArray[blobIndex].blobSize]; std::strcpy(value, diffuse0Path.c_str()); blobArray[blobIndex].data = reinterpret_cast<uint8_t*>(value); } // Texture 0 Normal path. { const unsigned int blobIndex = 4; blobArray[blobIndex].attribute = TerrainNormal0Data; blobArray[blobIndex].compressed = false; blobArray[blobIndex].blobSize = (uint32_t)(normal0Path.length() + 1); char* value = new char[blobArray[blobIndex].blobSize]; std::strcpy(value, normal0Path.c_str()); blobArray[blobIndex].data = reinterpret_cast<uint8_t*>(value); } // Texture 1 Diffuse path. { const unsigned int blobIndex = 5; blobArray[blobIndex].attribute = TerrainDiffuse1Data; blobArray[blobIndex].compressed = false; blobArray[blobIndex].blobSize = (uint32_t)(diffuse1Path.length() + 1); char* value = new char[blobArray[blobIndex].blobSize]; std::strcpy(value, diffuse1Path.c_str()); blobArray[blobIndex].data = reinterpret_cast<uint8_t*>(value); } // Texture 1 Normal path. { const unsigned int blobIndex = 6; blobArray[blobIndex].attribute = TerrainNormal1Data; blobArray[blobIndex].compressed = false; blobArray[blobIndex].blobSize = (uint32_t)(normal1Path.length() + 1); char* value = new char[blobArray[blobIndex].blobSize]; std::strcpy(value, normal1Path.c_str()); blobArray[blobIndex].data = reinterpret_cast<uint8_t*>(value); } // Texture 2 Diffuse path. { const unsigned int blobIndex = 7; blobArray[blobIndex].attribute = TerrainDiffuse2Data; blobArray[blobIndex].compressed = false; blobArray[blobIndex].blobSize = (uint32_t)(diffuse2Path.length() + 1); char* value = new char[blobArray[blobIndex].blobSize]; std::strcpy(value, diffuse2Path.c_str()); blobArray[blobIndex].data = reinterpret_cast<uint8_t*>(value); } // Texture 2 Normal path. { const unsigned int blobIndex = 8; blobArray[blobIndex].attribute = TerrainNormal2Data; blobArray[blobIndex].compressed = false; blobArray[blobIndex].blobSize = (uint32_t)(normal2Path.length() + 1); char* value = new char[blobArray[blobIndex].blobSize]; std::strcpy(value, normal2Path.c_str()); blobArray[blobIndex].data = reinterpret_cast<uint8_t*>(value); } // Texture 3 Diffuse path. { const unsigned int blobIndex = 9; blobArray[blobIndex].attribute = TerrainDiffuse3Data; blobArray[blobIndex].compressed = false; blobArray[blobIndex].blobSize = (uint32_t)(diffuse3Path.length() + 1); char* value = new char[blobArray[blobIndex].blobSize]; std::strcpy(value, diffuse3Path.c_str()); blobArray[blobIndex].data = reinterpret_cast<uint8_t*>(value); } // Texture 3 Normal path. { const unsigned int blobIndex = 10; blobArray[blobIndex].attribute = TerrainNormal3Data; blobArray[blobIndex].compressed = false; blobArray[blobIndex].blobSize = (uint32_t)(normal3Path.length() + 1); char* value = new char[blobArray[blobIndex].blobSize]; std::strcpy(value, normal3Path.c_str()); blobArray[blobIndex].data = reinterpret_cast<uint8_t*>(value); } // Texture 4 Diffuse path. { const unsigned int blobIndex = 11; blobArray[blobIndex].attribute = TerrainDiffuse4Data; blobArray[blobIndex].compressed = false; blobArray[blobIndex].blobSize = (uint32_t)(diffuse4Path.length() + 1); char* value = new char[blobArray[blobIndex].blobSize]; std::strcpy(value, diffuse4Path.c_str()); blobArray[blobIndex].data = reinterpret_cast<uint8_t*>(value); } // Texture 4 Normal path. { const unsigned int blobIndex = 12; blobArray[blobIndex].attribute = TerrainNormal4Data; blobArray[blobIndex].compressed = false; blobArray[blobIndex].blobSize = (uint32_t)(normal4Path.length() + 1); char* value = new char[blobArray[blobIndex].blobSize]; std::strcpy(value, normal4Path.c_str()); blobArray[blobIndex].data = reinterpret_cast<uint8_t*>(value); } // Texture 5 Diffuse path. { const unsigned int blobIndex = 13; blobArray[blobIndex].attribute = TerrainDiffuse5Data; blobArray[blobIndex].compressed = false; blobArray[blobIndex].blobSize = (uint32_t)(diffuse5Path.length() + 1); char* value = new char[blobArray[blobIndex].blobSize]; std::strcpy(value, diffuse5Path.c_str()); blobArray[blobIndex].data = reinterpret_cast<uint8_t*>(value); } // Texture 5 Normal path. { const unsigned int blobIndex = 14; blobArray[blobIndex].attribute = TerrainNormal5Data; blobArray[blobIndex].compressed = false; blobArray[blobIndex].blobSize = (uint32_t)(normal5Path.length() + 1); char* value = new char[blobArray[blobIndex].blobSize]; std::strcpy(value, normal5Path.c_str()); blobArray[blobIndex].data = reinterpret_cast<uint8_t*>(value); } // Texture 6 Diffuse path. { const unsigned int blobIndex = 15; blobArray[blobIndex].attribute = TerrainDiffuse6Data; blobArray[blobIndex].compressed = false; blobArray[blobIndex].blobSize = (uint32_t)(diffuse6Path.length() + 1); char* value = new char[blobArray[blobIndex].blobSize]; std::strcpy(value, diffuse6Path.c_str()); blobArray[blobIndex].data = reinterpret_cast<uint8_t*>(value); } // Texture 6 Normal path. { const unsigned int blobIndex = 16; blobArray[blobIndex].attribute = TerrainNormal6Data; blobArray[blobIndex].compressed = false; blobArray[blobIndex].blobSize = (uint32_t)(normal6Path.length() + 1); char* value = new char[blobArray[blobIndex].blobSize]; std::strcpy(value, normal6Path.c_str()); blobArray[blobIndex].data = reinterpret_cast<uint8_t*>(value); } // Texture 7 Diffuse path. { const unsigned int blobIndex = 17; blobArray[blobIndex].attribute = TerrainDiffuse7Data; blobArray[blobIndex].compressed = false; blobArray[blobIndex].blobSize = (uint32_t)(diffuse7Path.length() + 1); char* value = new char[blobArray[blobIndex].blobSize]; std::strcpy(value, diffuse7Path.c_str()); blobArray[blobIndex].data = reinterpret_cast<uint8_t*>(value); } // Texture 7 Normal path. { const unsigned int blobIndex = 18; blobArray[blobIndex].attribute = TerrainNormal7Data; blobArray[blobIndex].compressed = false; blobArray[blobIndex].blobSize = (uint32_t)(normal7Path.length() + 1); char* value = new char[blobArray[blobIndex].blobSize]; std::strcpy(value, normal7Path.c_str()); blobArray[blobIndex].data = reinterpret_cast<uint8_t*>(value); } }
D3D10Texture::~D3D10Texture() { FreeMemory(); }
void readerror (char *err, struct svx_info *info) { printf("ERROR: %s\n",err); FreeMemory(); }
StoredTerrainLandscape::~StoredTerrainLandscape() { FreeMemory(); }
//=========================================================================== // // Parameter: - // Returns: - // Changes Globals: - //=========================================================================== void AAS_FreeAASLinkHeap(void) { if (aasworld.linkheap) FreeMemory(aasworld.linkheap); aasworld.linkheap = NULL; aasworld.linkheapsize = 0; } //end of the function AAS_FreeAASLinkHeap
//=========================================================================== // // Parameter: - // Returns: - // Changes Globals: - //=========================================================================== void AAS_FreeAASLinkedEntities(void) { if (aasworld.arealinkedentities) FreeMemory(aasworld.arealinkedentities); aasworld.arealinkedentities = NULL; } //end of the function AAS_InitAASLinkedEntities
ArpDocumentButton::~ArpDocumentButton() { FreeMemory(); }
//=========================================================================== // // Parameter: - // Returns: - // Changes Globals: - //=========================================================================== void EA_Shutdown( void ) { FreeMemory( botinputs ); botinputs = NULL; } //end of the function EA_Shutdown
void CGUIBaseContainer::Process(unsigned int currentTime, CDirtyRegionList &dirtyregions) { // update our auto-scrolling as necessary UpdateAutoScrolling(currentTime); ValidateOffset(); if (m_bInvalidated) UpdateLayout(); if (!m_layout || !m_focusedLayout) return; UpdateScrollOffset(currentTime); int offset = (int)floorf(m_scroller.GetValue() / m_layout->Size(m_orientation)); int cacheBefore, cacheAfter; GetCacheOffsets(cacheBefore, cacheAfter); // Free memory not used on screen if ((int)m_items.size() > m_itemsPerPage + cacheBefore + cacheAfter) FreeMemory(CorrectOffset(offset - cacheBefore, 0), CorrectOffset(offset + m_itemsPerPage + 1 + cacheAfter, 0)); CPoint origin = CPoint(m_posX, m_posY) + m_renderOffset; float pos = (m_orientation == VERTICAL) ? origin.y : origin.x; float end = (m_orientation == VERTICAL) ? m_posY + m_height : m_posX + m_width; // we offset our draw position to take into account scrolling and whether or not our focused // item is offscreen "above" the list. float drawOffset = (offset - cacheBefore) * m_layout->Size(m_orientation) - m_scroller.GetValue(); if (GetOffset() + GetCursor() < offset) drawOffset += m_focusedLayout->Size(m_orientation) - m_layout->Size(m_orientation); pos += drawOffset; end += cacheAfter * m_layout->Size(m_orientation); int current = offset - cacheBefore; while (pos < end && m_items.size()) { int itemNo = CorrectOffset(current, 0); if (itemNo >= (int)m_items.size()) break; bool focused = (current == GetOffset() + GetCursor()); if (itemNo >= 0) { CGUIListItemPtr item = m_items[itemNo]; // render our item if (m_orientation == VERTICAL) ProcessItem(origin.x, pos, item, focused, currentTime, dirtyregions); else ProcessItem(pos, origin.y, item, focused, currentTime, dirtyregions); } // increment our position pos += focused ? m_focusedLayout->Size(m_orientation) : m_layout->Size(m_orientation); current++; } // when we are scrolling up, offset will become lower (integer division, see offset calc) // to have same behaviour when scrolling down, we need to set page control to offset+1 UpdatePageControl(offset + (m_scroller.IsScrollingDown() ? 1 : 0)); m_lastRenderTime = currentTime; CGUIControl::Process(currentTime, dirtyregions); }
void SoftwareGraphicsDevice::Init3D(WindowObjects &O, const GraphicsDeviceParameters &Parameters) { //the beginning of this function is identical to the OpenGL version FreeMemory(); unsigned int PixelFormat; hWnd = O.GetWindowManager().CastWindows().GetHWND(); _FullScreen = O.GetWindowManager().GetFullScreen(); UINT Width = O.GetWindowManager().GetWidth(); UINT Height = O.GetWindowManager().GetHeight(); if(_FullScreen) { DEVMODE dmScreenSettings; memset(&dmScreenSettings, 0, sizeof(dmScreenSettings)); dmScreenSettings.dmSize=sizeof(dmScreenSettings); dmScreenSettings.dmPelsWidth = Width; dmScreenSettings.dmPelsHeight = Height; dmScreenSettings.dmBitsPerPel = 32; dmScreenSettings.dmFields=DM_BITSPERPEL|DM_PELSWIDTH|DM_PELSHEIGHT; LONG Result = ChangeDisplaySettings(&dmScreenSettings,CDS_FULLSCREEN); Assert(Result == DISP_CHANGE_SUCCESSFUL, "Failed to change display resolution"); } static PIXELFORMATDESCRIPTOR pfd= // pfd Tells Windows How We Want Things To Be { sizeof(PIXELFORMATDESCRIPTOR), // Size Of This Pixel Format Descriptor 1, // Version Number PFD_DRAW_TO_WINDOW | // Format Must Support Window PFD_SUPPORT_OPENGL | // Format Must Support OpenGL PFD_DOUBLEBUFFER, // Must Support Double Buffering PFD_TYPE_RGBA, // Request An RGBA Format 32, // Select Our Color Depth 0, 0, 0, 0, 0, 0, // Color Bits Ignored 0, // No Alpha Buffer 0, // Shift Bit Ignored 0, // No Accumulation Buffer 0, 0, 0, 0, // Accumulation Bits Ignored 32, // 16Bit Z-Buffer (Depth Buffer) 0, // No Stencil Buffer 0, // No Auxiliary Buffer PFD_MAIN_PLANE, // Main Drawing Layer 0, // Reserved 0, 0, 0 // Layer Masks Ignored }; hDC = GetDC(O.GetWindowManager().CastWindows().GetHWND()); PixelFormat = ChoosePixelFormat(hDC, &pfd); SetPixelFormat(hDC, PixelFormat, &pfd); Bmp.Allocate(Width, Height); Bmp.Clear(_Parameters.ScreenColor); Z.Allocate(Width, Height); Z.Clear(FLT_MAX); Viewport = Matrix4::Scaling(Vec3f(float(Width), float(Height), 1.0f)); Info.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); Info.bmiHeader.biPlanes = 1; Info.bmiHeader.biBitCount = 32; Info.bmiHeader.biCompression = BI_RGB; Info.bmiHeader.biSizeImage = 0; Info.bmiHeader.biXPelsPerMeter = 3800; Info.bmiHeader.biYPelsPerMeter = 3800; Info.bmiHeader.biClrUsed = 0; Info.bmiHeader.biClrImportant = 0; }
SoftwareGraphicsDevice::~SoftwareGraphicsDevice() { FreeMemory(); }
//============================================================================ // // Parameter: - // Returns: - // Changes Globals: - //============================================================================ script_t *LoadScriptFile(const char *filename) { #ifdef BOTLIB fileHandle_t fp; char pathname[MAX_QPATH]; #else FILE *fp; #endif int length; void *buffer; script_t *script; #ifdef BOTLIB if (strlen(basefolder)) Com_sprintf(pathname, sizeof(pathname), "%s/%s", basefolder, filename); else Com_sprintf(pathname, sizeof(pathname), "%s", filename); length = botimport.FS_FOpenFile( pathname, &fp, FS_READ ); if (!fp) return NULL; #else fp = fopen(filename, "rb"); if (!fp) return NULL; length = FileLength(fp); #endif buffer = GetClearedMemory(sizeof(script_t) + length + 1); script = (script_t *) buffer; Com_Memset(script, 0, sizeof(script_t)); Q_strncpyz(script->filename, filename, sizeof(script->filename)); script->buffer = (char *) buffer + sizeof(script_t); script->buffer[length] = 0; script->length = length; //pointer in script buffer script->script_p = script->buffer; //pointer in script buffer before reading token script->lastscript_p = script->buffer; //pointer to end of script buffer script->end_p = &script->buffer[length]; //set if there's a token available in script->token script->tokenavailable = 0; // script->line = 1; script->lastline = 1; // SetScriptPunctuations(script, NULL); // #ifdef BOTLIB botimport.FS_Read(script->buffer, length, fp); botimport.FS_FCloseFile(fp); #else if (fread(script->buffer, length, 1, fp) != 1) { FreeMemory(buffer); script = NULL; } //end if fclose(fp); #endif // script->length = COM_Compress(script->buffer); return script; } //end of the function LoadScriptFile
HRESULT CAVIFileReader::Initialize(IN char *pszFileName) { HRESULT hr = S_OK; // // would do better argument checking in a real-life application // _ASSERTE(pszFileName); // // log file name and requested wave format // LogMessage("CAVIFileReader::Initialize started. file [%s]", pszFileName); // // initialize avi file library. AVIFileExit should be called on the same // thread when AVI library is no longer needed // // AVIFileExit is called in the destructor. // // Assuption: instances of CAVIFileReader are initialized and destroyed on // the same thread // AVIFileInit(); // // open the first audio stream in the file // hr = AVIStreamOpenFromFile(&m_pAudioStream, pszFileName, streamtypeAUDIO, 0, OF_READ | OF_SHARE_DENY_WRITE, NULL); if (FAILED(hr)) { LogError("CAVIFileReader::Initialize " "Failed to open stream from the file"); m_pAudioStream = NULL; return hr; } // // read the size of the stream's format // LONG nFormatSize = 0; hr = AVIStreamReadFormat(m_pAudioStream, 0, NULL, &nFormatSize); if ( FAILED(hr) || (0 == nFormatSize) ) { LogError("CAVIFileReader::Initialize" "Failed to get stream format's size"); m_pAudioStream->Release(); m_pAudioStream = NULL; return E_FAIL; } // // allocate memory for audio format. keep it in a waveformatex structure. // if the structure returned is waveformat, still allocate waveformatex // nFormatSize = max((LONG)sizeof(WAVEFORMATEX), nFormatSize); m_pWaveFormat = (WAVEFORMATEX*)AllocateMemory(nFormatSize); if (NULL == m_pWaveFormat) { LogError("CAVIFileReader::Initialize " "Failed to allocate memory for wave format, size %ld", nFormatSize); m_pAudioStream->Release(); m_pAudioStream = NULL; return E_OUTOFMEMORY; } // // read stream format into allocated structure // hr = AVIStreamReadFormat(m_pAudioStream, 0, m_pWaveFormat, &nFormatSize); if (FAILED(hr)) { LogError("CAVIFileReader::Initialize " "Failed to read stream format"); m_pAudioStream->Release(); m_pAudioStream = NULL; FreeMemory(m_pWaveFormat); m_pWaveFormat = NULL; return hr; } // // log stream's format // LogMessage("CAVIFileReader::CAVIFileReader stream opened"); LogFormat(m_pWaveFormat); LogMessage("CAVIFileReader::CAVIFileReader finished"); return S_OK; }
//=========================================================================== // // Parameter: - // Returns: - // Changes Globals: - //=========================================================================== void Q3_FreeMaxBSP( void ) { if ( q3_dmodels ) { FreeMemory( q3_dmodels ); } q3_dmodels = NULL; q3_nummodels = 0; if ( q3_dshaders ) { FreeMemory( q3_dshaders ); } q3_dshaders = NULL; q3_numShaders = 0; if ( q3_dentdata ) { FreeMemory( q3_dentdata ); } q3_dentdata = NULL; q3_entdatasize = 0; if ( q3_dleafs ) { FreeMemory( q3_dleafs ); } q3_dleafs = NULL; q3_numleafs = 0; if ( q3_dplanes ) { FreeMemory( q3_dplanes ); } q3_dplanes = NULL; q3_numplanes = 0; if ( q3_dnodes ) { FreeMemory( q3_dnodes ); } q3_dnodes = NULL; q3_numnodes = 0; if ( q3_dleafsurfaces ) { FreeMemory( q3_dleafsurfaces ); } q3_dleafsurfaces = NULL; q3_numleafsurfaces = 0; if ( q3_dleafbrushes ) { FreeMemory( q3_dleafbrushes ); } q3_dleafbrushes = NULL; q3_numleafbrushes = 0; if ( q3_dbrushes ) { FreeMemory( q3_dbrushes ); } q3_dbrushes = NULL; q3_numbrushes = 0; if ( q3_dbrushsides ) { FreeMemory( q3_dbrushsides ); } q3_dbrushsides = NULL; q3_numbrushsides = 0; if ( q3_lightBytes ) { FreeMemory( q3_lightBytes ); } q3_lightBytes = NULL; q3_numLightBytes = 0; if ( q3_gridData ) { FreeMemory( q3_gridData ); } q3_gridData = NULL; q3_numGridPoints = 0; if ( q3_visBytes ) { FreeMemory( q3_visBytes ); } q3_visBytes = NULL; q3_numVisBytes = 0; if ( q3_drawVerts ) { FreeMemory( q3_drawVerts ); } q3_drawVerts = NULL; q3_numDrawVerts = 0; if ( q3_drawIndexes ) { FreeMemory( q3_drawIndexes ); } q3_drawIndexes = NULL; q3_numDrawIndexes = 0; if ( q3_drawSurfaces ) { FreeMemory( q3_drawSurfaces ); } q3_drawSurfaces = NULL; q3_numDrawSurfaces = 0; if ( q3_dfogs ) { FreeMemory( q3_dfogs ); } q3_dfogs = NULL; q3_numFogs = 0; } //end of the function Q3_FreeMaxBSP
//=========================================================================== // // Parameter: - // Returns: - // Changes Globals: - //=========================================================================== void AAS_FreeMaxAAS( void ) { //bounding boxes if ( ( *aasworld ).bboxes ) { FreeMemory( ( *aasworld ).bboxes ); } ( *aasworld ).bboxes = NULL; ( *aasworld ).numbboxes = 0; //vertexes if ( ( *aasworld ).vertexes ) { FreeMemory( ( *aasworld ).vertexes ); } ( *aasworld ).vertexes = NULL; ( *aasworld ).numvertexes = 0; //planes if ( ( *aasworld ).planes ) { FreeMemory( ( *aasworld ).planes ); } ( *aasworld ).planes = NULL; ( *aasworld ).numplanes = 0; //edges if ( ( *aasworld ).edges ) { FreeMemory( ( *aasworld ).edges ); } ( *aasworld ).edges = NULL; ( *aasworld ).numedges = 0; //edge index if ( ( *aasworld ).edgeindex ) { FreeMemory( ( *aasworld ).edgeindex ); } ( *aasworld ).edgeindex = NULL; ( *aasworld ).edgeindexsize = 0; //faces if ( ( *aasworld ).faces ) { FreeMemory( ( *aasworld ).faces ); } ( *aasworld ).faces = NULL; ( *aasworld ).numfaces = 0; //face index if ( ( *aasworld ).faceindex ) { FreeMemory( ( *aasworld ).faceindex ); } ( *aasworld ).faceindex = NULL; ( *aasworld ).faceindexsize = 0; //convex areas if ( ( *aasworld ).areas ) { FreeMemory( ( *aasworld ).areas ); } ( *aasworld ).areas = NULL; ( *aasworld ).numareas = 0; //convex area settings if ( ( *aasworld ).areasettings ) { FreeMemory( ( *aasworld ).areasettings ); } ( *aasworld ).areasettings = NULL; ( *aasworld ).numareasettings = 0; //reachablity list if ( ( *aasworld ).reachability ) { FreeMemory( ( *aasworld ).reachability ); } ( *aasworld ).reachability = NULL; ( *aasworld ).reachabilitysize = 0; //nodes of the bsp tree if ( ( *aasworld ).nodes ) { FreeMemory( ( *aasworld ).nodes ); } ( *aasworld ).nodes = NULL; ( *aasworld ).numnodes = 0; //cluster portals if ( ( *aasworld ).portals ) { FreeMemory( ( *aasworld ).portals ); } ( *aasworld ).portals = NULL; ( *aasworld ).numportals = 0; //cluster portal index if ( ( *aasworld ).portalindex ) { FreeMemory( ( *aasworld ).portalindex ); } ( *aasworld ).portalindex = NULL; ( *aasworld ).portalindexsize = 0; //clusters if ( ( *aasworld ).clusters ) { FreeMemory( ( *aasworld ).clusters ); } ( *aasworld ).clusters = NULL; ( *aasworld ).numclusters = 0; Log_Print( "freed " ); PrintMemorySize( allocatedaasmem ); Log_Print( " of AAS memory\n" ); allocatedaasmem = 0; // if ( aas_vertexchain ) { FreeMemory( aas_vertexchain ); } aas_vertexchain = NULL; if ( aas_planechain ) { FreeMemory( aas_planechain ); } aas_planechain = NULL; if ( aas_edgechain ) { FreeMemory( aas_edgechain ); } aas_edgechain = NULL; } //end of the function AAS_FreeMaxAAS