• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ GetClearedMemory函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中GetClearedMemory函数的典型用法代码示例。如果您正苦于以下问题:C++ GetClearedMemory函数的具体用法?C++ GetClearedMemory怎么用?C++ GetClearedMemory使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了GetClearedMemory函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: BotInitInfoEntities

//===========================================================================
//
// Parameter:			-
// Returns:				-
// Changes Globals:		-
//===========================================================================
void BotInitInfoEntities( void ) {
	char classname[MAX_EPAIRKEY];
	maplocation_t *ml;
	campspot_t *cs;
	int ent, numlocations, numcampspots;

	BotFreeInfoEntities();
	//
	numlocations = 0;
	numcampspots = 0;
	for ( ent = AAS_NextBSPEntity( 0 ); ent; ent = AAS_NextBSPEntity( ent ) )
	{
		if ( !AAS_ValueForBSPEpairKey( ent, "classname", classname, MAX_EPAIRKEY ) ) {
			continue;
		}

		//map locations
		if ( !strcmp( classname, "target_location" ) ) {
			ml = (maplocation_t *) GetClearedMemory( sizeof( maplocation_t ) );
			AAS_VectorForBSPEpairKey( ent, "origin", ml->origin );
			AAS_ValueForBSPEpairKey( ent, "message", ml->name, sizeof( ml->name ) );
			ml->areanum = AAS_PointAreaNum( ml->origin );
			ml->next = maplocations;
			maplocations = ml;
			numlocations++;
		} //end if
		  //camp spots
		else if ( !strcmp( classname, "info_camp" ) ) {
			cs = (campspot_t *) GetClearedMemory( sizeof( campspot_t ) );
			AAS_VectorForBSPEpairKey( ent, "origin", cs->origin );
			//cs->origin[2] += 16;
			AAS_ValueForBSPEpairKey( ent, "message", cs->name, sizeof( cs->name ) );
			AAS_FloatForBSPEpairKey( ent, "range", &cs->range );
			AAS_FloatForBSPEpairKey( ent, "weight", &cs->weight );
			AAS_FloatForBSPEpairKey( ent, "wait", &cs->wait );
			AAS_FloatForBSPEpairKey( ent, "random", &cs->random );
			cs->areanum = AAS_PointAreaNum( cs->origin );
			if ( !cs->areanum ) {
				botimport.Print( PRT_MESSAGE, "camp spot at %1.1f %1.1f %1.1f in solid\n", cs->origin[0], cs->origin[1], cs->origin[2] );
				FreeMemory( cs );
				continue;
			} //end if
			cs->next = campspots;
			campspots = cs;
			//AAS_DrawPermanentCross(cs->origin, 4, LINECOLOR_YELLOW);
			numcampspots++;
		} //end else if
	} //end for
	if ( bot_developer ) {
		botimport.Print( PRT_MESSAGE, "%d map locations\n", numlocations );
		botimport.Print( PRT_MESSAGE, "%d camp spots\n", numcampspots );
	} //end if
} //end of the function BotInitInfoEntities
开发者ID:JackalFrost,项目名称:RTCW-WSGF,代码行数:59,代码来源:be_ai_goal.c


示例2: GetClearedMemory

//============================================================================
//
// Parameter:			-
// Returns:				-
// Changes Globals:		-
//============================================================================
script_t *LoadScriptMemory(char *ptr, int length, char *name)
{
	void *buffer;
	script_t *script;

	buffer = GetClearedMemory(sizeof(script_t) + length + 1);
	script = (script_t *) buffer;
	Com_Memset(script, 0, sizeof(script_t));
	Q_strncpyz(script->filename, name, 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);
	//
	Com_Memcpy(script->buffer, ptr, length);
	//
	return script;
} //end of the function LoadScriptMemory
开发者ID:0culus,项目名称:ioq3,代码行数:36,代码来源:l_script.c


示例3: AAS_FloodAreas

void AAS_FloodAreas(vector3 *origin) {
	int areanum, cluster, *done;

	done = (int *) GetClearedMemory(aasworld.numareas * sizeof(int));
	areanum = AAS_PointAreaNum(origin);
	cluster = AAS_AreaCluster(areanum);
	AAS_FloodAreas_r(areanum, cluster, done);
}
开发者ID:Razish,项目名称:QtZ,代码行数:8,代码来源:be_aas_debug.c


示例4: BotInterpolateCharacters

//===========================================================================
//
// Parameter:           -
// Returns:             -
// Changes Globals:     -
//===========================================================================
int BotInterpolateCharacters( int handle1, int handle2, int desiredskill )
{
    bot_character_t *ch1, *ch2, *out;
    int             i, handle;
    float           scale;

    ch1 = BotCharacterFromHandle( handle1 );
    ch2 = BotCharacterFromHandle( handle2 );

    if ( !ch1 || !ch2 )
    {
        return 0;
    }

    //find a free spot for a character
    for ( handle = 1; handle <= MAX_CLIENTS; handle++ )
    {
        if ( !botcharacters[ handle ] )
        {
            break;
        }
    } //end for

    if ( handle > MAX_CLIENTS )
    {
        return 0;
    }

    out = ( bot_character_t * ) GetClearedMemory( sizeof( bot_character_t ) + MAX_CHARACTERISTICS * sizeof( bot_characteristic_t ) );
    out->skill = desiredskill;
    strcpy( out->filename, ch1->filename );
    botcharacters[ handle ] = out;

    scale = ( float )( desiredskill - 1 ) / ( ch2->skill - ch1->skill );

    for ( i = 0; i < MAX_CHARACTERISTICS; i++ )
    {
        //
        if ( ch1->c[ i ].type == CT_FLOAT && ch2->c[ i ].type == CT_FLOAT )
        {
            out->c[ i ].type = CT_FLOAT;
            out->c[ i ].value._float = ch1->c[ i ].value._float + ( ch2->c[ i ].value._float - ch1->c[ i ].value._float ) * scale;
        } //end if
        else if ( ch1->c[ i ].type == CT_INTEGER )
        {
            out->c[ i ].type = CT_INTEGER;
            out->c[ i ].value.integer = ch1->c[ i ].value.integer;
        } //end else if
        else if ( ch1->c[ i ].type == CT_STRING )
        {
            out->c[ i ].type = CT_STRING;
            out->c[ i ].value.string = ( char * ) GetMemory( strlen( ch1->c[ i ].value.string ) + 1 );
            strcpy( out->c[ i ].value.string, ch1->c[ i ].value.string );
        } //end else if
    } //end for

    return handle;
} //end of the function BotInterpolateCharacters
开发者ID:gfx0,项目名称:Unvanquished,代码行数:64,代码来源:be_ai_char.c


示例5: unzOpen

//===========================================================================
//
// Parameter:			-
// Returns:				-
// Changes Globals:		-
//===========================================================================
quakefile_t *FindQuakeFilesInZip( char *zipfile, char *filter ) {
	unzFile uf;
	int err;
	unz_global_info gi;
	char filename_inzip[MAX_PATH];
	unz_file_info file_info;
	int i;
	quakefile_t     *qfiles, *lastqf, *qf;

	uf = unzOpen( zipfile );
	err = unzGetGlobalInfo( uf, &gi );

	if ( err != UNZ_OK ) {
		return NULL;
	}

	unzGoToFirstFile( uf );

	qfiles = NULL;
	lastqf = NULL;
	for ( i = 0; i < gi.number_entry; i++ )
	{
		err = unzGetCurrentFileInfo( uf, &file_info, filename_inzip, sizeof( filename_inzip ), NULL,0,NULL,0 );
		if ( err != UNZ_OK ) {
			break;
		}

		ConvertPath( filename_inzip );
		if ( FileFilter( filter, filename_inzip, false ) ) {
			qf = GetClearedMemory( sizeof( quakefile_t ) );
			if ( !qf ) {
				Error( "out of memory" );
			}
			memset( qf, 0, sizeof( quakefile_t ) );
			strcpy( qf->pakfile, zipfile );
			strcpy( qf->filename, zipfile );
			strcpy( qf->origname, filename_inzip );
			qf->zipfile = true;
			//memcpy( &buildBuffer[i].zipfileinfo, (unz_s*)uf, sizeof(unz_s));
			memcpy( &qf->zipinfo, (unz_s*)uf, sizeof( unz_s ) );
			qf->offset = 0;
			qf->length = file_info.uncompressed_size;
			qf->type = QuakeFileType( filename_inzip );
			//add the file ot the list
			qf->next = NULL;
			if ( lastqf ) {
				lastqf->next = qf;
			} else { qfiles = qf;}
			lastqf = qf;
		} //end if
		unzGoToNextFile( uf );
	} //end for

	unzClose( uf );

	return qfiles;
} //end of the function FindQuakeFilesInZip
开发者ID:AdrienJaguenet,项目名称:Enemy-Territory,代码行数:63,代码来源:l_qfiles.c


示例6: AAS_CreateAreaSettings

//===========================================================================
//
// Parameter:				-
// Returns:					-
// Changes Globals:		-
//===========================================================================
void AAS_CreateAreaSettings(void)
{
	int i, flags, side, numgrounded, numladderareas, numliquidareas;
	tmp_face_t *face;
	tmp_area_t *tmparea;

	numgrounded = 0;
	numladderareas = 0;
	numliquidareas = 0;
	Log_Write("AAS_CreateAreaSettings\r\n");
	i = 0;
	qprintf("%6d areas provided with settings", i);
	for (tmparea = tmpaasworld.areas; tmparea; tmparea = tmparea->l_next)
	{
		//if the area is invalid there no need to create settings for it
		if (tmparea->invalid) continue;

		tmparea->settings = (tmp_areasettings_t *) GetClearedMemory(sizeof(tmp_areasettings_t));
		tmparea->settings->contents = tmparea->contents;
		tmparea->settings->modelnum = tmparea->modelnum;
		flags = 0;
		for (face = tmparea->tmpfaces; face; face = face->next[side])
		{
			side = face->frontarea != tmparea;
			flags |= face->faceflags;
		} //end for
		tmparea->settings->areaflags = 0;
		if (flags & FACE_GROUND)
		{
			tmparea->settings->areaflags |= AREA_GROUNDED;
			numgrounded++;
		} //end if
		if (flags & FACE_LADDER)
		{
			tmparea->settings->areaflags |= AREA_LADDER;
			numladderareas++;
		} //end if
		if (tmparea->contents & (AREACONTENTS_WATER |
											AREACONTENTS_SLIME |
											AREACONTENTS_LAVA))
		{
			tmparea->settings->areaflags |= AREA_LIQUID;
			numliquidareas++;
		} //end if
		//presence type of the area
		tmparea->settings->presencetype = tmparea->presencetype;
		//
		qprintf("\r%6d", ++i);
	} //end for
	qprintf("\n");
#ifdef AASINFO
	Log_Print("%6d grounded areas\n", numgrounded);
	Log_Print("%6d ladder areas\n", numladderareas);
	Log_Print("%6d liquid areas\n", numliquidareas);
#endif //AASINFO
} //end of the function AAS_CreateAreaSettings
开发者ID:ArtanAhmeti,项目名称:lab,代码行数:62,代码来源:aas_create.c


示例7: BotAllocWeaponState

//========================================================================
//
// Parameter:				-
// Returns:					-
// Changes Globals:		-
//========================================================================
int BotAllocWeaponState( void ) {
	int i;

	for ( i = 1; i <= MAX_CLIENTS; i++ )
	{
		if ( !botweaponstates[i] ) {
			botweaponstates[i] = GetClearedMemory( sizeof( bot_weaponstate_t ) );
			return i;
		} //end if
	} //end for
	return 0;
} //end of the function BotAllocWeaponState
开发者ID:Justasic,项目名称:RTCW-MP,代码行数:18,代码来源:be_ai_weap.c


示例8: GetClearedMemory

int *WeaponWeightIndex(weightconfig_t *wwc, weaponconfig_t *wc) {
	int *index, i;

	//initialize item weight index
	index = (int *) GetClearedMemory(sizeof(int) * wc->numweapons);

	for (i = 0; i < wc->numweapons; i++)
	{
		index[i] = FindFuzzyWeight(wwc, wc->weaponinfo[i].name);
	}
	return index;
}
开发者ID:Razish,项目名称:QtZ,代码行数:12,代码来源:be_ai_weap.c


示例9: AAS_OptimizeAlloc

/*
=======================================================================================================================================
AAS_OptimizeAlloc
=======================================================================================================================================
*/
void AAS_OptimizeAlloc(optimized_t *optimized) {

	optimized->vertexes = (aas_vertex_t *)GetClearedMemory(aasworld.numvertexes * sizeof(aas_vertex_t));
	optimized->numvertexes = 0;
	optimized->edges = (aas_edge_t *)GetClearedMemory(aasworld.numedges * sizeof(aas_edge_t));
	optimized->numedges = 1; // edge zero is a dummy
	optimized->edgeindex = (aas_edgeindex_t *)GetClearedMemory(aasworld.edgeindexsize * sizeof(aas_edgeindex_t));
	optimized->edgeindexsize = 0;
	optimized->faces = (aas_face_t *)GetClearedMemory(aasworld.numfaces * sizeof(aas_face_t));
	optimized->numfaces = 1; // face zero is a dummy
	optimized->faceindex = (aas_faceindex_t *)GetClearedMemory(aasworld.faceindexsize * sizeof(aas_faceindex_t));
	optimized->faceindexsize = 0;
	optimized->areas = (aas_area_t *)GetClearedMemory(aasworld.numareas * sizeof(aas_area_t));
	optimized->numareas = aasworld.numareas;
	optimized->vertexoptimizeindex = (int *)GetClearedMemory(aasworld.numvertexes * sizeof(int));
	optimized->edgeoptimizeindex = (int *)GetClearedMemory(aasworld.numedges * sizeof(int));
	optimized->faceoptimizeindex = (int *)GetClearedMemory(aasworld.numfaces * sizeof(int));
}
开发者ID:KuehnhammerTobias,项目名称:ioqw,代码行数:23,代码来源:be_aas_optimize.c


示例10: GetClearedMemory

//===========================================================================
//
// Parameter:				-
// Returns:					-
// Changes Globals:		-
//===========================================================================
tmp_face_t *AAS_AllocTmpFace(void)
{
	tmp_face_t *tmpface;

	tmpface = (tmp_face_t *) GetClearedMemory(sizeof(tmp_face_t));
	tmpface->num = tmpaasworld.facenum++;
	tmpface->l_prev = NULL;
	tmpface->l_next = tmpaasworld.faces;
	if (tmpaasworld.faces) tmpaasworld.faces->l_prev = tmpface;
	tmpaasworld.faces = tmpface;
	tmpaasworld.numfaces++;
	return tmpface;
} //end of the function AAS_AllocTmpFace
开发者ID:ArtanAhmeti,项目名称:lab,代码行数:19,代码来源:aas_create.c


示例11: GetClearedMemory

//===========================================================================
//
// Parameter:				-
// Returns:					-
// Changes Globals:		-
//===========================================================================
tmp_node_t *AAS_AllocTmpNode( void ) {
	tmp_nodebuf_t *nodebuf;

	if ( !tmpaasworld.nodebuffer ||
		 tmpaasworld.nodebuffer->numnodes >= NODEBUF_SIZE ) {
		nodebuf = (tmp_nodebuf_t *) GetClearedMemory( sizeof( tmp_nodebuf_t ) );
		nodebuf->next = tmpaasworld.nodebuffer;
		nodebuf->numnodes = 0;
		tmpaasworld.nodebuffer = nodebuf;
	} //end if
	tmpaasworld.numnodes++;
	return &tmpaasworld.nodebuffer->nodes[tmpaasworld.nodebuffer->numnodes++];
} //end of the function AAS_AllocTmpNode
开发者ID:chegestar,项目名称:omni-bot,代码行数:19,代码来源:aas_create.c


示例12: BotAllocGoalState

//===========================================================================
//
// Parameter:				-
// Returns:					-
// Changes Globals:		-
//===========================================================================
int BotAllocGoalState( int client ) {
	int i;

	for ( i = 1; i <= MAX_CLIENTS; i++ )
	{
		if ( !botgoalstates[i] ) {
			botgoalstates[i] = GetClearedMemory( sizeof( bot_goalstate_t ) );
			botgoalstates[i]->client = client;
			return i;
		} //end if
	} //end for
	return 0;
} //end of the function BotAllocGoalState
开发者ID:JackalFrost,项目名称:RTCW-WSGF,代码行数:19,代码来源:be_ai_goal.c


示例13: GetClearedMemory

//===========================================================================
// index to find the weight function of an iteminfo
//
// Parameter:				-
// Returns:					-
// Changes Globals:		-
//===========================================================================
int *ItemWeightIndex( weightconfig_t *iwc, itemconfig_t *ic ) {
	int *index, i;

	//initialize item weight index
	index = (int *) GetClearedMemory( sizeof( int ) * ic->numiteminfo );

	for ( i = 0; i < ic->numiteminfo; i++ )
	{
		index[i] = FindFuzzyWeight( iwc, ic->iteminfo[i].classname );
		if ( index[i] < 0 ) {
			Log_Write( "item info %d \"%s\" has no fuzzy weight\r\n", i, ic->iteminfo[i].classname );
		} //end if
	} //end for
	return index;
} //end of the function ItemWeightIndex
开发者ID:JackalFrost,项目名称:RTCW-WSGF,代码行数:22,代码来源:be_ai_goal.c


示例14: Com_sprintf

script_t *LoadScriptFile(const char *filename)
{
	fileHandle_t fp;
	char         pathname[MAX_QPATH];
	int          length;
	void         *buffer;
	script_t     *script;

	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;
	}

	buffer = GetClearedMemory(sizeof(script_t) + length + 1);
	script = (script_t *) buffer;
	memset(script, 0, sizeof(script_t));
	strcpy(script->filename, 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);

	botimport.FS_Read(script->buffer, length, fp);
	botimport.FS_FCloseFile(fp);

	return script;
} //end of the function LoadScriptFile
开发者ID:Mailaender,项目名称:etlegacy,代码行数:48,代码来源:l_script.c


示例15: Q3_CreatePlanarSurfacePlanes

void Q3_CreatePlanarSurfacePlanes(void)
{
    int i;
    dsurface_t *surface;

    Log_Print("creating planar surface planes...\n");
    q3_surfaceplanes = (dplane_t *) GetClearedMemory(q3_numDrawSurfaces * sizeof(dplane_t));

    for (i = 0; i < q3_numDrawSurfaces; i++)
    {
        surface = &drawSurfaces[i];
        if (surface->surfaceType != MST_PLANAR) continue;
        Q3_SurfacePlane(surface, q3_surfaceplanes[i].normal, &q3_surfaceplanes[i].dist);
        //Log_Print("normal = %f %f %f, dist = %f\n", q3_surfaceplanes[i].normal[0],
        //											q3_surfaceplanes[i].normal[1],
        //											q3_surfaceplanes[i].normal[2], q3_surfaceplanes[i].dist);
    } //end for
} //end of the function Q3_CreatePlanarSurfacePlanes
开发者ID:tkmorris,项目名称:OpenMOHAA,代码行数:18,代码来源:l_bsp_q3.c


示例16: AAS_RemoveNonReachabilityAlloc

//===========================================================================
//
// Parameter:               -
// Returns:                 -
// Changes Globals:     -
//===========================================================================
void AAS_RemoveNonReachabilityAlloc(optimized_t * optimized)
{
	optimized->areas = (aas_area_t *) GetClearedMemory((*aasworld).numareas * sizeof(aas_area_t));
	//
	optimized->areasettings = (aas_areasettings_t *) GetClearedMemory((*aasworld).numareas * sizeof(aas_areasettings_t));
	//
	optimized->reachability = (aas_reachability_t *) GetClearedMemory((*aasworld).reachabilitysize * sizeof(aas_reachability_t));
	optimized->reachabilitysize = (*aasworld).reachabilitysize;
/*	//
	optimized->nodes = (aas_node_t *) GetClearedMemory((*aasworld).numnodes * sizeof(aas_node_t));
	optimized->numnodes = (*aasworld).numnodes;
	//
	optimized->portals = (aas_portals_t *) GetClearedMemory((*aasworld).numportals * sizeof(aas_portal_t));
	optimized->numportals = (*aasworld).numportals;
	//
	optimized->clusters = (aas_cluster_t *) GetClearedMemory((*aasworld).numclusters * sizeof(aas_cluster_t));
						optimized->numclusters = (*aasworld).numclusters;
*///
	optimized->areakeep = (int *)GetClearedMemory((*aasworld).numareas * sizeof(int));
	optimized->arearemap = (int *)GetClearedMemory((*aasworld).numareas * sizeof(int));
	optimized->removedareas = (int *)GetClearedMemory((*aasworld).numareas * sizeof(int));
	optimized->reachabilityremap = (int *)GetClearedMemory((*aasworld).reachabilitysize * sizeof(int));
}								//end of the function AAS_OptimizeAlloc
开发者ID:DerSaidin,项目名称:OpenWolf,代码行数:29,代码来源:be_aas_optimize.cpp


示例17: defined


//.........这里部分代码省略.........
			strcat( pakfile, filedata.cFileName );
			_stat( pakfile, &statbuf );
#else
		glob( pakfilter, 0, NULL, &globbuf );
		for ( j = 0; j < globbuf.gl_pathc; j++ )
		{
			strcpy( pakfile, globbuf.gl_pathv[j] );
			stat( pakfile, &statbuf );
#endif
			//if the file with .pak or .pk3 is a folder
			if ( statbuf.st_mode & S_IFDIR ) {
				strcpy( filename, pakfilter );
				AppendPathSeperator( filename, _MAX_PATH );
				strcat( filename, filter );
				qf = FindQuakeFilesWithPakFilter( NULL, filename );
				if ( lastqf ) {
					lastqf->next = qf;
				} else { qfiles = qf;}
				lastqf = qf;
				while ( lastqf->next ) lastqf = lastqf->next;
			} //end if
			else
			{
#if defined( WIN32 ) | defined( _WIN32 )
				str = StringContains( pakfile, ".pk3", false );
#else
				str = StringContains( pakfile, ".pk3", true );
#endif
				if ( str && str == pakfile + strlen( pakfile ) - strlen( ".pk3" ) ) {
					qf = FindQuakeFilesInZip( pakfile, filter );
				} //end if
				else
				{
					qf = FindQuakeFilesInPak( pakfile, filter );
				} //end else
				  //
				if ( qf ) {
					if ( lastqf ) {
						lastqf->next = qf;
					} else { qfiles = qf;}
					lastqf = qf;
					while ( lastqf->next ) lastqf = lastqf->next;
				} //end if
			} //end else
			  //
#if defined( WIN32 ) | defined( _WIN32 )
			//find the next file
			done = !FindNextFile( handle, &filedata );
		} //end while
#else
		} //end for
		globfree( &globbuf );
#endif
	} //end if
	else
	{
#if defined( WIN32 ) | defined( _WIN32 )
		handle = FindFirstFile( filter, &filedata );
		done = ( handle == INVALID_HANDLE_VALUE );
		while ( !done )
		{
			_splitpath( filter, filename, NULL, NULL, NULL );
			_splitpath( filter, NULL, &filename[strlen( filename )], NULL, NULL );
			AppendPathSeperator( filename, _MAX_PATH );
			strcat( filename, filedata.cFileName );
#else
		glob( filter, 0, NULL, &globbuf );
		for ( j = 0; j < globbuf.gl_pathc; j++ )
		{
			strcpy( filename, globbuf.gl_pathv[j] );
#endif
			//
			qf = GetClearedMemory( sizeof( quakefile_t ) );
			if ( !qf ) {
				Error( "out of memory" );
			}
			memset( qf, 0, sizeof( quakefile_t ) );
			strcpy( qf->pakfile, "" );
			strcpy( qf->filename, filename );
			strcpy( qf->origname, filename );
			qf->offset = 0;
			qf->length = 0;
			qf->type = QuakeFileType( filename );
			//add the file ot the list
			qf->next = NULL;
			if ( lastqf ) {
				lastqf->next = qf;
			} else { qfiles = qf;}
			lastqf = qf;
#if defined( WIN32 ) | defined( _WIN32 )
			//find the next file
			done = !FindNextFile( handle, &filedata );
		} //end while
#else
		} //end for
		globfree( &globbuf );
#endif
	} //end else
	return qfiles;
} //end of the function FindQuakeFilesWithPakFilter
开发者ID:AdrienJaguenet,项目名称:Enemy-Territory,代码行数:101,代码来源:l_qfiles.c


示例18: AAS_AllocMaxAAS

//===========================================================================
//
// 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
开发者ID:D4edalus,项目名称:CoD4x_Server,代码行数:84,代码来源:aas_store.c


示例19: AAS_InitClustering

//===========================================================================
//
// Parameter:				-
// Returns:					-
// Changes Globals:		-
//===========================================================================
void AAS_InitClustering(void)
{
	int i, removedPortalAreas;
	int n, total, numreachabilityareas;

	if (!aasworld.loaded) return;
	//if there are clusters
	if (aasworld.numclusters >= 1)
	{
#ifndef BSPC
		//if clustering isn't forced
		if (!((int)LibVarGetValue("forceclustering")) &&
			!((int)LibVarGetValue("forcereachability"))) return;
#endif
	} //end if
	//set all view portals as cluster portals in case we re-calculate the reachabilities and clusters (with -reach)
	AAS_SetViewPortalsAsClusterPortals();
	//count the number of forced cluster portals
	AAS_CountForcedClusterPortals();
	//remove all area cluster marks
	AAS_RemoveClusterAreas();
	//find possible cluster portals
	AAS_FindPossiblePortals();
	//craete portals to for the bot view
	AAS_CreateViewPortals();
	//remove all portals that are not closing a cluster
	//AAS_RemoveNotClusterClosingPortals();
	//initialize portal memory
	if (aasworld.portals) FreeMemory(aasworld.portals);
	aasworld.portals = (aas_portal_t *) GetClearedMemory(AAS_MAX_PORTALS * sizeof(aas_portal_t));
	//initialize portal index memory
	if (aasworld.portalindex) FreeMemory(aasworld.portalindex);
	aasworld.portalindex = (aas_portalindex_t *) GetClearedMemory(AAS_MAX_PORTALINDEXSIZE * sizeof(aas_portalindex_t));
	//initialize cluster memory
	if (aasworld.clusters) FreeMemory(aasworld.clusters);
	aasworld.clusters = (aas_cluster_t *) GetClearedMemory(AAS_MAX_CLUSTERS * sizeof(aas_cluster_t));
	//
	removedPortalAreas = 0;
	botimport.Print(PRT_MESSAGE, "\r%6d removed portal areas", removedPortalAreas);
	while(1)
	{
		botimport.Print(PRT_MESSAGE, "\r%6d", removedPortalAreas);
		//initialize the number of portals and clusters
		aasworld.numportals = 1;		//portal 0 is a dummy
		aasworld.portalindexsize = 0;
		aasworld.numclusters = 1;		//cluster 0 is a dummy
		//create the portals from the portal areas
		AAS_CreatePortals();
		//
		removedPortalAreas++;
		//find the clusters
		if (!AAS_FindClusters())
			continue;
		//test the portals
		if (!AAS_TestPortals())
			continue;
		//
		break;
	} //end while
	botimport.Print(PRT_MESSAGE, "\n");
	//the AAS file should be saved
	aasworld.savefile = qtrue;
	//write the portal areas to the log file
	for (i = 1; i < aasworld.numportals; i++)
	{
		Log_Write("portal %d: area %d\r\n", i, aasworld.portals[i].areanum);
	} //end for
	// report cluster info
	botimport.Print(PRT_MESSAGE, "%6d portals created\n", aasworld.numportals);
	botimport.Print(PRT_MESSAGE, "%6d clusters created\n", aasworld.numclusters);
	for (i = 1; i < aasworld.numclusters; i++)
	{
		botimport.Print(PRT_MESSAGE, "cluster %d has %d reachability areas\n", i,
				aasworld.clusters[i].numreachabilityareas);
	} //end for
	// report AAS file efficiency
	numreachabilityareas = 0;
	total = 0;
	for (i = 0; i < aasworld.numclusters; i++) {
		n = aasworld.clusters[i].numreachabilityareas;
		numreachabilityareas += n;
		total += n * n;
	}
	total += numreachabilityareas * aasworld.numportals;
	//
	botimport.Print(PRT_MESSAGE, "%6i total reachability areas\n", numreachabilityareas);
	botimport.Print(PRT_MESSAGE, "%6i AAS memory/CPU usage (the lower the better)\n", total * 3);
} //end of the function AAS_InitClustering
开发者ID:OADoctor,项目名称:SmokinGuns,代码行数:94,代码来源:be_aas_cluster.c


示例20: Q2_AllocMaxBSP

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
开发者ID:ArtanAhmeti,项目名称:lab,代码行数:82,代码来源:l_bsp_q2.c



注:本文中的GetClearedMemory函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ GetClientName函数代码示例发布时间:2022-05-30
下一篇:
C++ GetClassname函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap