コード例 #1
0
ファイル: tree.c プロジェクト: AdrienJaguenet/Enemy-Territory
//===========================================================================
//
// Parameter:			-
// Returns:				-
// Changes Globals:		-
//===========================================================================
void Tree_Free( tree_t *tree ) {
	//if no tree just return
	if ( !tree ) {
		return;
	}
	//
	freedtreemem = 0;
	//
	Tree_FreePortals_r( tree->headnode );
	Tree_Free_r( tree->headnode );
#ifdef ME
	freedtreemem += MemorySize( tree );
#endif //ME
	FreeMemory( tree );
#ifdef ME
	Log_Print( "freed " );
	PrintMemorySize( freedtreemem );
	Log_Print( " of tree memory\n" );
#endif //ME
} //end of the function Tree_Free
コード例 #2
0
ファイル: l_bsp_hl.c プロジェクト: ArtanAhmeti/lab
void HL_FreeMaxBSP(void)
{
	//models
	hl_nummodels = 0;
	FreeMemory(hl_dmodels);
	hl_dmodels = NULL;
	//visibility
	hl_visdatasize = 0;
	FreeMemory(hl_dvisdata);
	hl_dvisdata = NULL;
	//light data
	hl_lightdatasize = 0;
	FreeMemory(hl_dlightdata);
	hl_dlightdata = NULL;
	//texture data
	hl_texdatasize = 0;
	FreeMemory(hl_dtexdata);
	hl_dtexdata = NULL;
	//entities
	hl_entdatasize = 0;
	FreeMemory(hl_dentdata);
	hl_dentdata = NULL;
	//leaves
	hl_numleafs = 0;
	FreeMemory(hl_dleafs);
	hl_dleafs = NULL;
	//planes
	hl_numplanes = 0;
	FreeMemory(hl_dplanes);
	hl_dplanes = NULL;
	//vertexes
	hl_numvertexes = 0;
	FreeMemory(hl_dvertexes);
	hl_dvertexes = NULL;
	//nodes
	hl_numnodes = 0;
	FreeMemory(hl_dnodes);
	hl_dnodes = NULL;
	//texture info
	hl_numtexinfo = 0;
	FreeMemory(hl_texinfo);
	hl_texinfo = NULL;
	//faces
	hl_numfaces = 0;
	FreeMemory(hl_dfaces);
	hl_dfaces = NULL;
	//clip nodes
	hl_numclipnodes = 0;
	FreeMemory(hl_dclipnodes);
	hl_dclipnodes = NULL;
	//edges
	hl_numedges = 0;
	FreeMemory(hl_dedges);
	hl_dedges = NULL;
	//mark surfaces
	hl_nummarksurfaces = 0;
	FreeMemory(hl_dmarksurfaces);
	hl_dmarksurfaces = NULL;
	//surface edges
	hl_numsurfedges = 0;
	FreeMemory(hl_dsurfedges);
	hl_dsurfedges = NULL;
	//
	Log_Print("freed ");
	PrintMemorySize(hl_allocatedbspmem);
	Log_Print(" of BSP memory\n");
	hl_allocatedbspmem = 0;
} //end of the function HL_FreeMaxBSP
コード例 #3
0
ファイル: l_bsp_hl.c プロジェクト: ArtanAhmeti/lab
void HL_AllocMaxBSP(void)
{
	//models
	hl_nummodels = 0;
	hl_dmodels = (hl_dmodel_t *) GetMemory(HL_MAX_MAP_MODELS * sizeof(hl_dmodel_t));
	hl_allocatedbspmem = HL_MAX_MAP_MODELS * sizeof(hl_dmodel_t);
	//visibility
	hl_visdatasize = 0;
	hl_dvisdata = (byte *) GetMemory(HL_MAX_MAP_VISIBILITY * sizeof(byte));
	hl_allocatedbspmem += HL_MAX_MAP_VISIBILITY * sizeof(byte);
	//light data
	hl_lightdatasize = 0;
	hl_dlightdata = (byte *) GetMemory(HL_MAX_MAP_LIGHTING * sizeof(byte));
	hl_allocatedbspmem += HL_MAX_MAP_LIGHTING * sizeof(byte);
	//texture data
	hl_texdatasize = 0;
	hl_dtexdata = (byte *) GetMemory(HL_MAX_MAP_MIPTEX * sizeof(byte)); // (dmiptexlump_t)
	hl_allocatedbspmem += HL_MAX_MAP_MIPTEX * sizeof(byte);
	//entities
	hl_entdatasize = 0;
	hl_dentdata = (char *) GetMemory(HL_MAX_MAP_ENTSTRING * sizeof(char));
	hl_allocatedbspmem += HL_MAX_MAP_ENTSTRING * sizeof(char);
	//leaves
	hl_numleafs = 0;
	hl_dleafs = (hl_dleaf_t *) GetMemory(HL_MAX_MAP_LEAFS * sizeof(hl_dleaf_t));
	hl_allocatedbspmem += HL_MAX_MAP_LEAFS * sizeof(hl_dleaf_t);
	//planes
	hl_numplanes = 0;
	hl_dplanes = (hl_dplane_t *) GetMemory(HL_MAX_MAP_PLANES * sizeof(hl_dplane_t));
	hl_allocatedbspmem += HL_MAX_MAP_PLANES * sizeof(hl_dplane_t);
	//vertexes
	hl_numvertexes = 0;
	hl_dvertexes = (hl_dvertex_t *) GetMemory(HL_MAX_MAP_VERTS * sizeof(hl_dvertex_t));
	hl_allocatedbspmem += HL_MAX_MAP_VERTS * sizeof(hl_dvertex_t);
	//nodes
	hl_numnodes = 0;
	hl_dnodes = (hl_dnode_t *) GetMemory(HL_MAX_MAP_NODES * sizeof(hl_dnode_t));
	hl_allocatedbspmem += HL_MAX_MAP_NODES * sizeof(hl_dnode_t);
	//texture info
	hl_numtexinfo = 0;
	hl_texinfo = (hl_texinfo_t *) GetMemory(HL_MAX_MAP_TEXINFO * sizeof(hl_texinfo_t));
	hl_allocatedbspmem += HL_MAX_MAP_TEXINFO * sizeof(hl_texinfo_t);
	//faces
	hl_numfaces = 0;
	hl_dfaces = (hl_dface_t *) GetMemory(HL_MAX_MAP_FACES * sizeof(hl_dface_t));
	hl_allocatedbspmem += HL_MAX_MAP_FACES * sizeof(hl_dface_t);
	//clip nodes
	hl_numclipnodes = 0;
	hl_dclipnodes = (hl_dclipnode_t *) GetMemory(HL_MAX_MAP_CLIPNODES * sizeof(hl_dclipnode_t));
	hl_allocatedbspmem += HL_MAX_MAP_CLIPNODES * sizeof(hl_dclipnode_t);
	//edges
	hl_numedges = 0;
	hl_dedges = (hl_dedge_t *) GetMemory(HL_MAX_MAP_EDGES * sizeof(hl_dedge_t));
	hl_allocatedbspmem += HL_MAX_MAP_EDGES * sizeof(hl_dedge_t);
	//mark surfaces
	hl_nummarksurfaces = 0;
	hl_dmarksurfaces = (unsigned short *) GetMemory(HL_MAX_MAP_MARKSURFACES * sizeof(unsigned short));
	hl_allocatedbspmem += HL_MAX_MAP_MARKSURFACES * sizeof(unsigned short);
	//surface edges
	hl_numsurfedges = 0;
	hl_dsurfedges = (int *) GetMemory(HL_MAX_MAP_SURFEDGES * sizeof(int));
	hl_allocatedbspmem += HL_MAX_MAP_SURFEDGES * sizeof(int);
	//print allocated memory
	Log_Print("allocated ");
	PrintMemorySize(hl_allocatedbspmem);
	Log_Print(" of BSP memory\n");
} //end of the function HL_AllocMaxBSP
コード例 #4
0
ファイル: aas_store.c プロジェクト: D4edalus/CoD4x_Server
//===========================================================================
//
// 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
コード例 #5
0
ファイル: aas_store.c プロジェクト: D4edalus/CoD4x_Server
//===========================================================================
//
// Parameter:				-
// Returns:					-
// Changes Globals:		-
//===========================================================================
void AAS_AllocMaxAAS( void ) {
	int i;

	AAS_InitMaxAAS();
	//bounding boxes
	( *aasworld ).numbboxes = 0;
	( *aasworld ).bboxes = (aas_bbox_t *) GetClearedMemory( max_aas.max_bboxes * sizeof( aas_bbox_t ) );
	allocatedaasmem += max_aas.max_bboxes * sizeof( aas_bbox_t );
	//vertexes
	( *aasworld ).numvertexes = 0;
	( *aasworld ).vertexes = (aas_vertex_t *) GetClearedMemory( max_aas.max_vertexes * sizeof( aas_vertex_t ) );
	allocatedaasmem += max_aas.max_vertexes * sizeof( aas_vertex_t );
	//planes
	( *aasworld ).numplanes = 0;
	( *aasworld ).planes = (aas_plane_t *) GetClearedMemory( max_aas.max_planes * sizeof( aas_plane_t ) );
	allocatedaasmem += max_aas.max_planes * sizeof( aas_plane_t );
	//edges
	( *aasworld ).numedges = 0;
	( *aasworld ).edges = (aas_edge_t *) GetClearedMemory( max_aas.max_edges * sizeof( aas_edge_t ) );
	allocatedaasmem += max_aas.max_edges * sizeof( aas_edge_t );
	//edge index
	( *aasworld ).edgeindexsize = 0;
	( *aasworld ).edgeindex = (aas_edgeindex_t *) GetClearedMemory( max_aas.max_edgeindexsize * sizeof( aas_edgeindex_t ) );
	allocatedaasmem += max_aas.max_edgeindexsize * sizeof( aas_edgeindex_t );
	//faces
	( *aasworld ).numfaces = 0;
	( *aasworld ).faces = (aas_face_t *) GetClearedMemory( max_aas.max_faces * sizeof( aas_face_t ) );
	allocatedaasmem += max_aas.max_faces * sizeof( aas_face_t );
	//face index
	( *aasworld ).faceindexsize = 0;
	( *aasworld ).faceindex = (aas_faceindex_t *) GetClearedMemory( max_aas.max_faceindexsize * sizeof( aas_faceindex_t ) );
	allocatedaasmem += max_aas.max_faceindexsize * sizeof( aas_faceindex_t );
	//convex areas
	( *aasworld ).numareas = 0;
	( *aasworld ).areas = (aas_area_t *) GetClearedMemory( max_aas.max_areas * sizeof( aas_area_t ) );
	allocatedaasmem += max_aas.max_areas * sizeof( aas_area_t );
	//convex area settings
	( *aasworld ).numareasettings = 0;
	( *aasworld ).areasettings = (aas_areasettings_t *) GetClearedMemory( max_aas.max_areasettings * sizeof( aas_areasettings_t ) );
	allocatedaasmem += max_aas.max_areasettings * sizeof( aas_areasettings_t );
	//reachablity list
	( *aasworld ).reachabilitysize = 0;
	( *aasworld ).reachability = (aas_reachability_t *) GetClearedMemory( max_aas.max_reachabilitysize * sizeof( aas_reachability_t ) );
	allocatedaasmem += max_aas.max_reachabilitysize * sizeof( aas_reachability_t );
	//nodes of the bsp tree
	( *aasworld ).numnodes = 0;
	( *aasworld ).nodes = (aas_node_t *) GetClearedMemory( max_aas.max_nodes * sizeof( aas_node_t ) );
	allocatedaasmem += max_aas.max_nodes * sizeof( aas_node_t );
	//cluster portals
	( *aasworld ).numportals = 0;
	( *aasworld ).portals = (aas_portal_t *) GetClearedMemory( max_aas.max_portals * sizeof( aas_portal_t ) );
	allocatedaasmem += max_aas.max_portals * sizeof( aas_portal_t );
	//cluster portal index
	( *aasworld ).portalindexsize = 0;
	( *aasworld ).portalindex = (aas_portalindex_t *) GetClearedMemory( max_aas.max_portalindexsize * sizeof( aas_portalindex_t ) );
	allocatedaasmem += max_aas.max_portalindexsize * sizeof( aas_portalindex_t );
	//cluster
	( *aasworld ).numclusters = 0;
	( *aasworld ).clusters = (aas_cluster_t *) GetClearedMemory( max_aas.max_clusters * sizeof( aas_cluster_t ) );
	allocatedaasmem += max_aas.max_clusters * sizeof( aas_cluster_t );
	//
	Log_Print( "allocated " );
	PrintMemorySize( allocatedaasmem );
	Log_Print( " of AAS memory\n" );
	//reset the has stuff
	aas_vertexchain = (int *) GetClearedMemory( max_aas.max_vertexes * sizeof( int ) );
	aas_planechain = (int *) GetClearedMemory( max_aas.max_planes * sizeof( int ) );
	aas_edgechain = (int *) GetClearedMemory( max_aas.max_edges * sizeof( int ) );
	//
	for ( i = 0; i < max_aas.max_vertexes; i++ ) aas_vertexchain[i] = -1;
	for ( i = 0; i < VERTEX_HASH_SIZE * VERTEX_HASH_SIZE; i++ ) aas_hashverts[i] = -1;
	//
	for ( i = 0; i < max_aas.max_planes; i++ ) aas_planechain[i] = -1;
	for ( i = 0; i < PLANE_HASH_SIZE; i++ ) aas_hashplanes[i] = -1;
	//
	for ( i = 0; i < max_aas.max_edges; i++ ) aas_edgechain[i] = -1;
	for ( i = 0; i < EDGE_HASH_SIZE; i++ ) aas_hashedges[i] = -1;
} //end of the function AAS_AllocMaxAAS
コード例 #6
0
void Sin_FreeMaxBSP( void ) {
	//models
	sin_nummodels = 0;
	FreeMemory( sin_dmodels );
	sin_dmodels = NULL;
	//vis data
	sin_visdatasize = 0;
	FreeMemory( sin_dvisdata );
	sin_dvisdata = NULL;
	sin_dvis = NULL;
	//light data
	sin_lightdatasize = 0;
	FreeMemory( sin_dlightdata );
	sin_dlightdata = NULL;
	//entity data
	sin_entdatasize = 0;
	FreeMemory( sin_dentdata );
	sin_dentdata = NULL;
	//leafs
	sin_numleafs = 0;
	FreeMemory( sin_dleafs );
	sin_dleafs = NULL;
	//planes
	sin_numplanes = 0;
	FreeMemory( sin_dplanes );
	sin_dplanes = NULL;
	//vertexes
	sin_numvertexes = 0;
	FreeMemory( sin_dvertexes );
	sin_dvertexes = NULL;
	//nodes
	sin_numnodes = 0;
	FreeMemory( sin_dnodes );
	sin_dnodes = NULL;
	//texture info
	sin_numtexinfo = 0;
	FreeMemory( sin_texinfo );
	sin_texinfo = NULL;
	//faces
	sin_numfaces = 0;
	FreeMemory( sin_dfaces );
	sin_dfaces = NULL;
	//edges
	sin_numedges = 0;
	FreeMemory( sin_dedges );
	sin_dedges = NULL;
	//leaf faces
	sin_numleaffaces = 0;
	FreeMemory( sin_dleaffaces );
	sin_dleaffaces = NULL;
	//leaf brushes
	sin_numleafbrushes = 0;
	FreeMemory( sin_dleafbrushes );
	sin_dleafbrushes = NULL;
	//surface edges
	sin_numsurfedges = 0;
	FreeMemory( sin_dsurfedges );
	sin_dsurfedges = NULL;
	//brushes
	sin_numbrushes = 0;
	FreeMemory( sin_dbrushes );
	sin_dbrushes = NULL;
	//brushsides
	sin_numbrushsides = 0;
	FreeMemory( sin_dbrushsides );
	sin_dbrushsides = NULL;
	//areas
	sin_numareas = 0;
	FreeMemory( sin_dareas );
	sin_dareas = NULL;
	//area portals
	sin_numareaportals = 0;
	FreeMemory( sin_dareaportals );
	sin_dareaportals = NULL;
	//light info
	sin_numlightinfo = 0;
	FreeMemory( sin_lightinfo );
	sin_lightinfo = NULL;
	//
	Log_Print( "freed " );
	PrintMemorySize( sin_allocatedbspmem );
	Log_Print( " of BSP memory\n" );
	sin_allocatedbspmem = 0;
} //end of the function Sin_FreeMaxBSP
コード例 #7
0
void Sin_AllocMaxBSP( void ) {
	//models
	sin_nummodels = 0;
	sin_dmodels = (sin_dmodel_t *) GetClearedMemory( SIN_MAX_MAP_MODELS * sizeof( sin_dmodel_t ) );
	sin_allocatedbspmem += SIN_MAX_MAP_MODELS * sizeof( sin_dmodel_t );
	//vis data
	sin_visdatasize = 0;
	sin_dvisdata = (byte *) GetClearedMemory( SIN_MAX_MAP_VISIBILITY * sizeof( byte ) );
	sin_dvis = (sin_dvis_t *) sin_dvisdata;
	sin_allocatedbspmem += SIN_MAX_MAP_VISIBILITY * sizeof( byte );
	//light data
	sin_lightdatasize = 0;
	sin_dlightdata = (byte *) GetClearedMemory( SIN_MAX_MAP_LIGHTING * sizeof( byte ) );
	sin_allocatedbspmem += SIN_MAX_MAP_LIGHTING * sizeof( byte );
	//entity data
	sin_entdatasize = 0;
	sin_dentdata = (char *) GetClearedMemory( SIN_MAX_MAP_ENTSTRING * sizeof( char ) );
	sin_allocatedbspmem += SIN_MAX_MAP_ENTSTRING * sizeof( char );
	//leafs
	sin_numleafs = 0;
	sin_dleafs = (sin_dleaf_t *) GetClearedMemory( SIN_MAX_MAP_LEAFS * sizeof( sin_dleaf_t ) );
	sin_allocatedbspmem += SIN_MAX_MAP_LEAFS * sizeof( sin_dleaf_t );
	//planes
	sin_numplanes = 0;
	sin_dplanes = (sin_dplane_t *) GetClearedMemory( SIN_MAX_MAP_PLANES * sizeof( sin_dplane_t ) );
	sin_allocatedbspmem += SIN_MAX_MAP_PLANES * sizeof( sin_dplane_t );
	//vertexes
	sin_numvertexes = 0;
	sin_dvertexes = (sin_dvertex_t *) GetClearedMemory( SIN_MAX_MAP_VERTS * sizeof( sin_dvertex_t ) );
	sin_allocatedbspmem += SIN_MAX_MAP_VERTS * sizeof( sin_dvertex_t );
	//nodes
	sin_numnodes = 0;
	sin_dnodes = (sin_dnode_t *) GetClearedMemory( SIN_MAX_MAP_NODES * sizeof( sin_dnode_t ) );
	sin_allocatedbspmem += SIN_MAX_MAP_NODES * sizeof( sin_dnode_t );
	//texture info
	sin_numtexinfo = 0;
	sin_texinfo = (sin_texinfo_t *) GetClearedMemory( SIN_MAX_MAP_TEXINFO * sizeof( sin_texinfo_t ) );
	sin_allocatedbspmem += SIN_MAX_MAP_TEXINFO * sizeof( sin_texinfo_t );
	//faces
	sin_numfaces = 0;
	sin_dfaces = (sin_dface_t *) GetClearedMemory( SIN_MAX_MAP_FACES * sizeof( sin_dface_t ) );
	sin_allocatedbspmem += SIN_MAX_MAP_FACES * sizeof( sin_dface_t );
	//edges
	sin_numedges = 0;
	sin_dedges = (sin_dedge_t *) GetClearedMemory( SIN_MAX_MAP_EDGES * sizeof( sin_dedge_t ) );
	sin_allocatedbspmem += SIN_MAX_MAP_EDGES * sizeof( sin_dedge_t );
	//leaf faces
	sin_numleaffaces = 0;
	sin_dleaffaces = (unsigned short *) GetClearedMemory( SIN_MAX_MAP_LEAFFACES * sizeof( unsigned short ) );
	sin_allocatedbspmem += SIN_MAX_MAP_LEAFFACES * sizeof( unsigned short );
	//leaf brushes
	sin_numleafbrushes = 0;
	sin_dleafbrushes = (unsigned short *) GetClearedMemory( SIN_MAX_MAP_LEAFBRUSHES * sizeof( unsigned short ) );
	sin_allocatedbspmem += SIN_MAX_MAP_LEAFBRUSHES * sizeof( unsigned short );
	//surface edges
	sin_numsurfedges = 0;
	sin_dsurfedges = (int *) GetClearedMemory( SIN_MAX_MAP_SURFEDGES * sizeof( int ) );
	sin_allocatedbspmem += SIN_MAX_MAP_SURFEDGES * sizeof( int );
	//brushes
	sin_numbrushes = 0;
	sin_dbrushes = (sin_dbrush_t *) GetClearedMemory( SIN_MAX_MAP_BRUSHES * sizeof( sin_dbrush_t ) );
	sin_allocatedbspmem += SIN_MAX_MAP_BRUSHES * sizeof( sin_dbrush_t );
	//brushsides
	sin_numbrushsides = 0;
	sin_dbrushsides = (sin_dbrushside_t *) GetClearedMemory( SIN_MAX_MAP_BRUSHSIDES * sizeof( sin_dbrushside_t ) );
	sin_allocatedbspmem += SIN_MAX_MAP_BRUSHSIDES * sizeof( sin_dbrushside_t );
	//areas
	sin_numareas = 0;
	sin_dareas = (sin_darea_t *) GetClearedMemory( SIN_MAX_MAP_AREAS * sizeof( sin_darea_t ) );
	sin_allocatedbspmem += SIN_MAX_MAP_AREAS * sizeof( sin_darea_t );
	//area portals
	sin_numareaportals = 0;
	sin_dareaportals = (sin_dareaportal_t *) GetClearedMemory( SIN_MAX_MAP_AREAPORTALS * sizeof( sin_dareaportal_t ) );
	sin_allocatedbspmem += SIN_MAX_MAP_AREAPORTALS * sizeof( sin_dareaportal_t );
	//light info
	sin_numlightinfo = 0;
	sin_lightinfo = (sin_lightvalue_t *) GetClearedMemory( SIN_MAX_MAP_LIGHTINFO * sizeof( sin_lightvalue_t ) );
	sin_allocatedbspmem += SIN_MAX_MAP_LIGHTINFO * sizeof( sin_lightvalue_t );
	//print allocated memory
	Log_Print( "allocated " );
	PrintMemorySize( sin_allocatedbspmem );
	Log_Print( " of BSP memory\n" );
} //end of the function Sin_AllocMaxBSP
コード例 #8
0
ファイル: l_bsp_q2.c プロジェクト: ArtanAhmeti/lab
void Q2_FreeMaxBSP(void)
{
	//models
	nummodels = 0;
	FreeMemory(dmodels);
	dmodels = NULL;
	//vis data
	visdatasize = 0;
	FreeMemory(dvisdata);
	dvisdata = NULL;
	dvis = NULL;
	//light data
	lightdatasize = 0;
	FreeMemory(dlightdata);
	dlightdata = NULL;
	//entity data
	entdatasize = 0;
	FreeMemory(dentdata);
	dentdata = NULL;
	//leafs
	numleafs = 0;
	FreeMemory(dleafs);
	dleafs = NULL;
	//planes
	numplanes = 0;
	FreeMemory(dplanes);
	dplanes = NULL;
	//vertexes
	numvertexes = 0;
	FreeMemory(dvertexes);
	dvertexes = NULL;
	//nodes
	numnodes = 0;
	FreeMemory(dnodes);
	dnodes = NULL;
	/*
	//texture info
	numtexinfo = 0;
	FreeMemory(texinfo);
	texinfo = NULL;
	//*/
	//faces
	numfaces = 0;
	FreeMemory(dfaces);
	dfaces = NULL;
	//edges
	numedges = 0;
	FreeMemory(dedges);
	dedges = NULL;
	//leaf faces
	numleaffaces = 0;
	FreeMemory(dleaffaces);
	dleaffaces = NULL;
	//leaf brushes
	numleafbrushes = 0;
	FreeMemory(dleafbrushes);
	dleafbrushes = NULL;
	//surface edges
	numsurfedges = 0;
	FreeMemory(dsurfedges);
	dsurfedges = NULL;
	//brushes
	numbrushes = 0;
	FreeMemory(dbrushes);
	dbrushes = NULL;
	//brushsides
	numbrushsides = 0;
	FreeMemory(dbrushsides);
	dbrushsides = NULL;
	//areas
	numareas = 0;
	FreeMemory(dareas);
	dareas = NULL;
	//area portals
	numareaportals = 0;
	FreeMemory(dareaportals);
	dareaportals = NULL;
	//
	Log_Print("freed ");
	PrintMemorySize(allocatedbspmem);
	Log_Print(" of BSP memory\n");
	allocatedbspmem = 0;
} //end of the function Q2_FreeMaxBSP
コード例 #9
0
ファイル: l_bsp_q2.c プロジェクト: ArtanAhmeti/lab
void Q2_AllocMaxBSP(void)
{
	//models
	nummodels = 0;
	dmodels = (dmodel_t *) GetClearedMemory(MAX_MAP_MODELS * sizeof(dmodel_t));
	allocatedbspmem += MAX_MAP_MODELS * sizeof(dmodel_t);
	//vis data
	visdatasize = 0;
	dvisdata = (byte *) GetClearedMemory(MAX_MAP_VISIBILITY * sizeof(byte));
	dvis = (dvis_t *) dvisdata;
	allocatedbspmem += MAX_MAP_VISIBILITY * sizeof(byte);
	//light data
	lightdatasize = 0;
	dlightdata = (byte *) GetClearedMemory(MAX_MAP_LIGHTING * sizeof(byte));
	allocatedbspmem += MAX_MAP_LIGHTING * sizeof(byte);
	//entity data
	entdatasize = 0;
	dentdata = (char *) GetClearedMemory(MAX_MAP_ENTSTRING * sizeof(char));
	allocatedbspmem += MAX_MAP_ENTSTRING * sizeof(char);
	//leafs
	numleafs = 0;
	dleafs = (dleaf_t *) GetClearedMemory(MAX_MAP_LEAFS * sizeof(dleaf_t));
	allocatedbspmem += MAX_MAP_LEAFS * sizeof(dleaf_t);
	//planes
	numplanes = 0;
	dplanes = (dplane_t *) GetClearedMemory(MAX_MAP_PLANES * sizeof(dplane_t));
	allocatedbspmem += MAX_MAP_PLANES * sizeof(dplane_t);
	//vertexes
	numvertexes = 0;
	dvertexes = (dvertex_t *) GetClearedMemory(MAX_MAP_VERTS * sizeof(dvertex_t));
	allocatedbspmem += MAX_MAP_VERTS * sizeof(dvertex_t);
	//nodes
	numnodes = 0;
	dnodes = (dnode_t *) GetClearedMemory(MAX_MAP_NODES * sizeof(dnode_t));
	allocatedbspmem += MAX_MAP_NODES * sizeof(dnode_t);
	/*
	//texture info
	numtexinfo = 0;
	texinfo = (texinfo_t *) GetClearedMemory(MAX_MAP_TEXINFO * sizeof(texinfo_t));
	allocatedbspmem += MAX_MAP_TEXINFO * sizeof(texinfo_t);
	//*/
	//faces
	numfaces = 0;
	dfaces = (dface_t *) GetClearedMemory(MAX_MAP_FACES * sizeof(dface_t));
	allocatedbspmem += MAX_MAP_FACES * sizeof(dface_t);
	//edges
	numedges = 0;
	dedges = (dedge_t *) GetClearedMemory(MAX_MAP_EDGES * sizeof(dedge_t));
	allocatedbspmem += MAX_MAP_EDGES * sizeof(dedge_t);
	//leaf faces
	numleaffaces = 0;
	dleaffaces = (unsigned short *) GetClearedMemory(MAX_MAP_LEAFFACES * sizeof(unsigned short));
	allocatedbspmem += MAX_MAP_LEAFFACES * sizeof(unsigned short);
	//leaf brushes
	numleafbrushes = 0;
	dleafbrushes = (unsigned short *) GetClearedMemory(MAX_MAP_LEAFBRUSHES * sizeof(unsigned short));
	allocatedbspmem += MAX_MAP_LEAFBRUSHES * sizeof(unsigned short);
	//surface edges
	numsurfedges = 0;
	dsurfedges = (int *) GetClearedMemory(MAX_MAP_SURFEDGES * sizeof(int));
	allocatedbspmem += MAX_MAP_SURFEDGES * sizeof(int);
	//brushes
	numbrushes = 0;
	dbrushes = (dbrush_t *) GetClearedMemory(MAX_MAP_BRUSHES * sizeof(dbrush_t));
	allocatedbspmem += MAX_MAP_BRUSHES * sizeof(dbrush_t);
	//brushsides
	numbrushsides = 0;
	dbrushsides = (dbrushside_t *) GetClearedMemory(MAX_MAP_BRUSHSIDES * sizeof(dbrushside_t));
	allocatedbspmem += MAX_MAP_BRUSHSIDES * sizeof(dbrushside_t);
	//areas
	numareas = 0;
	dareas = (darea_t *) GetClearedMemory(MAX_MAP_AREAS * sizeof(darea_t));
	allocatedbspmem += MAX_MAP_AREAS * sizeof(darea_t);
	//area portals
	numareaportals = 0;
	dareaportals = (dareaportal_t *) GetClearedMemory(MAX_MAP_AREAPORTALS * sizeof(dareaportal_t));
	allocatedbspmem += MAX_MAP_AREAPORTALS * sizeof(dareaportal_t);
	//print allocated memory
	Log_Print("allocated ");
	PrintMemorySize(allocatedbspmem);
	Log_Print(" of BSP memory\n");
} //end of the function Q2_AllocMaxBSP