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

C++ ALERT函数代码示例

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

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



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

示例1: SERVER_COMMAND

CGameRules *InstallGameRules( void )
{
	SERVER_COMMAND( "exec game.rc\n" );
	g_engfuncs.pfnServerExecute();

	ALERT( at_aiconsole, "InstallGameRules\n" );

	if ( !gpGlobals->deathmatch )
	{
		// generic half-life
		g_teamplay = 0;
		return new CHalfLifeRules;
	}
	else
	{
		if( CVAR_GET_FLOAT( "mp_teamplay" ) > 0 )
		{
			// teamplay

			g_teamplay = 1;
			return new CHalfLifeTeamplay;
		}
		if ((int)gpGlobals->deathmatch == 1)
		{
			// vanilla deathmatch
			g_teamplay = 0;
			return new CHalfLifeMultiplay;
		}
		else
		{
			// vanilla deathmatch??
			g_teamplay = 0;
			return new CHalfLifeMultiplay;
		}
	}
}
开发者ID:a1batross,项目名称:Xash3D_ancient,代码行数:36,代码来源:gamerules.cpp


示例2: ALERT

// sets the round state
// ben notes : bSkipAutoRoundThink will avoid calling the round think function
// ben notes : after updating the status
void CBaseRoundRules::SetRoundState(ROUND_STATE iRoundState, bool bSkipAutoRoundThink)
{
	// check validity of what we have been sent
	if((iRoundState < ROUND_NOTSTARTED) || (iRoundState > ROUND_NOPLAYERS))
	{
		// - report the error
		ALERT(at_console, "Bad Round State being set - (%i)\n", (int)iRoundState);
		UTIL_LogPrintf(ROUND_LOGGING, "World triggered \"Bad Round State\" (round_state \"%i\") (old_round_state \"%i\")\n", (int)iRoundState, (int)m_iRoundState);

		// - give the round state a dummy value to keep it going
		iRoundState = ROUND_WAITING_FOR_PLAYERS;
	}
	// - log the change
	UTIL_LogPrintf(ALL_LOGGING, "World triggered \"Round State Change\" (round_state \"%i\") (old_round_state \"%i\")\n", (int)iRoundState, (int)m_iRoundState);

	// - set the round state
	m_iRoundState = iRoundState;

	// - call round think to update the round progress.
	// ben notes : after set round state is called we should leave the round think
	// ben notes : function or wierd bugs could creep in
	if(GetRoundState() != ROUND_NOPLAYERS && bSkipAutoRoundThink == false)
		this->RoundThink();
}
开发者ID:BackupTheBerlios,项目名称:battlegrounds-svn,代码行数:27,代码来源:bg_round.cpp


示例3: Spawn

//=========================================================
// ********** DeadGenericMonster SPAWN **********
//=========================================================
void CDeadGenericMonster :: Spawn( void )
{
	Precache();
	SET_MODEL(ENT(pev), STRING(pev->model));

	pev->effects		= 0;
	pev->yaw_speed		= 8; //LRC -- what?
	pev->sequence		= 0;

	if (pev->netname)
	{
		pev->sequence = LookupSequence( STRING(pev->netname) );

		if (pev->sequence == -1)
		{
			ALERT ( at_debug, "Invalid sequence name \"%s\" in monster_generic_dead\n", STRING(pev->netname) );
		}
	}
	else
	{
		pev->sequence = LookupActivity( pev->frags );
//		if (pev->sequence == -1)
//		{
//			ALERT ( at_error, "monster_generic_dead - specify a sequence name or choose a different death type: model \"%s\" has no available death sequences.\n", STRING(pev->model) );
//		}
		//...and if that doesn't work, forget it.
	}

	// Corpses have less health
	pev->health			= 8;

	MonsterInitDead();

	ResetSequenceInfo( );
	pev->frame = 255; // pose at the _end_ of its death sequence.
}
开发者ID:mittorn,项目名称:SoHL-1.2,代码行数:39,代码来源:genericmonster.cpp


示例4: ALERT

void CGrappleHook::Killed(entvars_t *pev, int gib)
{
	ALERT( at_console, "^2HLU -> ^3weapon_grapple ^2-> Tongue was killed.\n");

	// Fograin92: Clear player
	myowner->pev->movetype = MOVETYPE_WALK; //Re-apply gravity
	myowner->m_afPhysicsFlags &= ~PFLAG_ON_GRAPPLE; //Remove "on grapple" flag
	myowner->m_iGrappleExists = 0;
	myowner->m_flNextAttack = UTIL_WeaponTimeBase() + 1.0;

	// Fograin92: Clear monster
	if( (m_iHitMonster == 2) && (myHitMonster->IsAlive()) )
		myHitMonster->pev->movetype = MOVETYPE_STEP;	// Re-apply gravity to the pulled monster, if it's alive
	
	// Fograin92: Clear tongue leftovers
	bPullBack = false;
	UTIL_Remove( m_pTongue );
	m_pTongue = NULL;

	m_iHitMonster = 0;
	SetThink(NULL);
	SetTouch(NULL);
	SUB_Remove( ); 
}
开发者ID:Fograin,项目名称:hl-subsmod-ex,代码行数:24,代码来源:weapon_grapple.cpp


示例5: R_AllocateCinematicTexture

int R_AllocateCinematicTexture( unsigned int txFlags )
{
	int i = tr.num_cin_used;

	if( i >= MAX_MOVIE_TEXTURES )
	{
		ALERT( at_error, "R_AllocateCinematicTexture: cine textures limit exceeded!\n" );
		return 0; // disable
	}
	tr.num_cin_used++;

	if( !tr.cinTextures[i] )
	{
		char txName[16];

		Q_snprintf( txName, sizeof( txName ), "*cinematic%i", i );

		// create new cinematic texture
		// NOTE: dimension of texture is no matter because CIN_UPLOAD_FRAME will be rescale texture
		tr.cinTextures[i] = CREATE_TEXTURE( txName, 256, 256, NULL, txFlags ); 
	}

	return (i+1);
}
开发者ID:FWGS,项目名称:XashXT,代码行数:24,代码来源:r_movie.cpp


示例6: eeReadAll

void eeReadAll()
{
  fill_file_index() ;

  if (!eeLoadGeneral() )
  {
    generalDefault();
    modelDefault(0);

    ALERT(STR_EEPROMWARN, STR_BADEEPROMDATA, AU_BAD_EEPROM);

    MESSAGE(STR_EEPROMWARN, STR_EEPROMFORMATTING, NULL, AU_EEPROM_FORMATTING);

    /* we remove all models */
    for (uint32_t i=0; i<MAX_MODELS; i++)
      eeDeleteModel(i);

    eeDirty(EE_GENERAL);
    eeDirty(EE_MODEL);
  }
  else {
    eeLoadModelHeaders() ;
  }

  // TODO common!
  stickMode = g_eeGeneral.stickMode;

#if defined(CPUARM)
  for (uint8_t i=0; languagePacks[i]!=NULL; i++) {
    if (!strncmp(g_eeGeneral.ttsLanguage, languagePacks[i]->id, 2)) {
      currentLanguagePackIdx = i;
      currentLanguagePack = languagePacks[i];
    }
  }
#endif
}
开发者ID:CoyotteDundee,项目名称:opentx,代码行数:36,代码来源:eeprom_raw.cpp


示例7: DispatchSave

void DispatchSave( edict_t *pent, SAVERESTOREDATA *pSaveData )
{
	CBaseEntity *pEntity = (CBaseEntity *)GET_PRIVATE(pent);
	
	if( pEntity && pSaveData )
	{
		// ALERT( at_console, "DispatchSave( %s, %i )\n", STRING( pent->v.classname ), pent->serialnumber );
		ENTITYTABLE *pTable = &pSaveData->pTable[ pSaveData->currentIndex ];

		if( pTable->pent != pent )
			ALERT( at_error, "ENTITY TABLE OR INDEX IS WRONG!!!!\n" );

		if( pEntity->ObjectCaps() & FCAP_DONT_SAVE ) return;

		// These don't use ltime & nextthink as times really, but we'll fudge around it.
		if( pEntity->pev->movetype == MOVETYPE_PUSH )
		{
			float delta = gpGlobals->time - pEntity->pev->ltime;
			pEntity->pev->ltime += delta;
			pEntity->pev->nextthink += delta;
			pEntity->m_fPevNextThink = pEntity->pev->nextthink;
			pEntity->m_fNextThink += delta;
		}

		if( gpGlobals->changelevel )
			pEntity->ClearPointers();

		pTable->location = pSaveData->size;		// Remember entity position for file I/O
		pTable->classname = pEntity->pev->classname;	// Remember entity class for respawn

		CSave saveHelper( pSaveData );
		pEntity->Save( saveHelper );

		pTable->size = pSaveData->size - pTable->location;// Size of entity block is data size written to block
	}
}
开发者ID:a1batross,项目名称:Xash3D_ancient,代码行数:36,代码来源:dll_int.cpp


示例8: ioctl_unload_vmm

static long
ioctl_unload_vmm(void)
{
    int i;
    int64_t ret;
    long status = BF_IOCTL_SUCCESS;

    ret = common_unload_vmm();
    if (ret != BF_SUCCESS)
    {
        ALERT("IOCTL_UNLOAD_VMM: failed to unload vmm: %lld\n", ret);
        status = BF_IOCTL_FAILURE;
    }

    for (i = 0; i < g_num_files; i++)
        platform_free(files[i], files_sizes[i]);

    g_num_files = 0;

    if (status == BF_IOCTL_SUCCESS)
        DEBUG("IOCTL_UNLOAD_VMM: succeeded\n");

    return status;
}
开发者ID:kallolpar,项目名称:hypervisor,代码行数:24,代码来源:entry.cpp


示例9: FIND_ENTITY_BY_TARGETNAME

void CBigMomma::NodeStart( int iszNextNode )
{
	pev->netname = iszNextNode;

	CBaseEntity *pTarget = NULL;

	if ( pev->netname )
	{
		edict_t *pentTarget = FIND_ENTITY_BY_TARGETNAME ( NULL, STRING(pev->netname) );

		if ( !FNullEnt(pentTarget) )
			pTarget = Instance( pentTarget );
	}


	if ( !pTarget )
	{
		ALERT( at_aiconsole, "BM: Finished the path!!\n" );
		Remember( bits_MEMORY_PATH_FINISHED );
		return;
	}
	Remember( bits_MEMORY_ON_PATH );
	m_hTargetEnt = pTarget;
}
开发者ID:FaucetDC,项目名称:HLDC_SDK,代码行数:24,代码来源:bigmomma.cpp


示例10: CallForHelp

void CISlave :: CallForHelp( char *szClassname, float flDist, EHANDLE hEnemy, Vector &vecLocation )
{
	 ALERT( at_aiconsole, "help " );

	// skip ones not on my netname
	if ( FStringNull( pev->netname ))
		return;

	CBaseEntity *pEntity = NULL;

	while ((pEntity = UTIL_FindEntityByString( pEntity, "netname", STRING( pev->netname ))) != NULL)
	{
		float d = (pev->origin - pEntity->pev->origin).Length();
		if (d < flDist)
		{
			CBaseMonster *pMonster = pEntity->MyMonsterPointer( );
			if (pMonster)
			{
				pMonster->m_afMemory |= bits_MEMORY_PROVOKED;
				pMonster->PushEnemy( hEnemy, vecLocation );
			}
		}
	}
}
开发者ID:JoelTroch,项目名称:am_src_30jan2011,代码行数:24,代码来源:islave.cpp


示例11: IAllocSound

//=========================================================
// IAllocSound - moves a sound from the Free list to the 
// Active list returns the index of the alloc'd sound
//=========================================================
int CSoundEnt :: IAllocSound( void )
{
	int iNewSound;

	if ( m_iFreeSound == SOUNDLIST_EMPTY )
	{
		// no free sound!
		ALERT ( at_console, "Free Sound List is full!\n" );
		return SOUNDLIST_EMPTY;
	}

	// there is at least one sound available, so move it to the
	// Active sound list, and return its SoundPool index.
	
	iNewSound = m_iFreeSound;// copy the index of the next free sound

	m_iFreeSound = m_SoundPool[ m_iFreeSound ].m_iNext;// move the index down into the free list. 

	m_SoundPool[ iNewSound ].m_iNext = m_iActiveSound;// point the new sound at the top of the active list.

	m_iActiveSound = iNewSound;// now make the new sound the top of the active list. You're done.

	return iNewSound;
}
开发者ID:HoLyCoWzOrZ,项目名称:sing-engine,代码行数:28,代码来源:soundent.cpp


示例12: Nearest

// Assumes this is ALWAYS enabled
CPathTrack *CPathTrack :: Nearest( Vector origin )
{
	int			deadCount;
	float		minDist, dist;
	Vector		delta;
	CPathTrack	*ppath, *pnearest;


	delta = origin - pev->origin;
	delta.z = 0;
	minDist = delta.Length();
	pnearest = this;
	ppath = GetNext();

	// Hey, I could use the old 2 racing pointers solution to this, but I'm lazy :)
	deadCount = 0;
	while ( ppath && ppath != this )
	{
		deadCount++;
		if ( deadCount > 9999 )
		{
			ALERT( at_error, "Bad sequence of path_tracks from %s", STRING(pev->targetname) );
			return NULL;
		}
		delta = origin - ppath->pev->origin;
		delta.z = 0;
		dist = delta.Length();
		if ( dist < minDist )
		{
			minDist = dist;
			pnearest = ppath;
		}
		ppath = ppath->GetNext();
	}
	return pnearest;
}
开发者ID:6779660,项目名称:halflife,代码行数:37,代码来源:pathcorner.cpp


示例13: snd_init

int snd_init(void)
{
    char info_buf[256];

    PaError p_err;
    if((p_err = Pa_Initialize()) != paNoError)
    {
        snprintf(info_buf, sizeof(info_buf),
				_("PortAudio init failed:\n%s\n"),
				Pa_GetErrorText(p_err));

        ALERT(info_buf);
        return 1;
    }

    srconv_stream.data_in = (float*)malloc(pa_frames*2 * sizeof(float));
    srconv_stream.data_out = (float*)malloc(pa_frames*2 * 10 * sizeof(float));
    srconv_record.data_in = (float*)malloc(pa_frames*2 * sizeof(float));
    srconv_record.data_out = (float*)malloc(pa_frames*2 * 10 * sizeof(float));

    reconnect = 0;
    buf_index = 0;
    return 0;
}
开发者ID:melchor629,项目名称:butt,代码行数:24,代码来源:port_audio.cpp


示例14: CHalfLifeMultiplay

CHalfLifeMultiplay :: CHalfLifeMultiplay()
{
	g_VoiceGameMgr.Init(&g_GameMgrHelper, gpGlobals->maxClients);

	RefreshSkillData();
	m_flIntermissionEndTime = 0;
	g_flIntermissionStartTime = 0;
	
	// 11/8/98
	// Modified by YWB:  Server .cfg file is now a cvar, so that 
	//  server ops can run multiple game servers, with different server .cfg files,
	//  from a single installed directory.
	// Mapcyclefile is already a cvar.

	// 3/31/99
	// Added lservercfg file cvar, since listen and dedicated servers should not
	// share a single config file. (sjb)
	if ( IS_DEDICATED_SERVER() )
	{
		// this code has been moved into engine, to only run server.cfg once
	}
	else
	{
		// listen server
		char *lservercfgfile = (char *)CVAR_GET_STRING( "lservercfgfile" );

		if ( lservercfgfile && lservercfgfile[0] )
		{
			char szCommand[256];
			
			ALERT( at_console, "Executing listen server config file\n" );
			sprintf( szCommand, "exec %s\n", lservercfgfile );
			SERVER_COMMAND( szCommand );
		}
	}
}
开发者ID:Hammermaps-DEV,项目名称:SOHL-V1.0-Refresh,代码行数:36,代码来源:multiplay_gamerules.cpp


示例15: TakeDamage

int CFuncCollideWall :: TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType )
{
	ALERT ( at_notice, "TakeDamage()\n");

	TraceResult trace = UTIL_GetGlobalTrace( );

//== 1) //metal
//== 5) //wood
//== 5) //water
//== -1/0) //not defined (default concrete)

	float flVolume = RANDOM_FLOAT ( 0.7 , 1.0 );//random volume range
	BOOL	b_CanMakeParticles = TRUE;

	if ( CVAR_GET_FLOAT( "r_paintball" ) == 0 )
	if ( CVAR_GET_FLOAT( "cl_wallpuff" ) >= 1 )
	{			
		if (pev->frags == 1) //metal
		{								
			UTIL_Ricochet( trace.vecEndPos, 0.5 );

			switch ( RANDOM_LONG(0,2) )
			{
				case 0: UTIL_EmitAmbientSound(ENT(0), trace.vecEndPos, "weapons/bulletimpact/metal1.wav", flVolume, ATTN_NORM, 0, 100); break;
				case 1: UTIL_EmitAmbientSound(ENT(0), trace.vecEndPos, "weapons/bulletimpact/metal2.wav", flVolume, ATTN_NORM, 0, 100); break;
				case 2: UTIL_EmitAmbientSound(ENT(0), trace.vecEndPos, "weapons/bulletimpact/metal3.wav", flVolume, ATTN_NORM, 0, 100); break;
			}

			if (RANDOM_LONG( 0, 99 ) < 40)
			UTIL_WhiteSparks( trace.vecEndPos, trace.vecPlaneNormal, 0, 5, 500, 500 );//chispas

			UTIL_WhiteSparks( trace.vecEndPos, trace.vecPlaneNormal, 9, 5, 5, 100 );//puntos
			UTIL_WhiteSparks( trace.vecEndPos, trace.vecPlaneNormal, 0, 5, 500, 20 );//chispas
												
			b_CanMakeParticles = FALSE;
		}
		if (pev->frags == 5) //wood
		{
			switch ( RANDOM_LONG(0,2) )
			{
				case 0: UTIL_EmitAmbientSound(ENT(0), trace.vecEndPos, "weapons/bulletimpact/wood1.wav", flVolume, ATTN_NORM, 0, 100); break;
				case 1: UTIL_EmitAmbientSound(ENT(0), trace.vecEndPos, "weapons/bulletimpact/wood2.wav", flVolume, ATTN_NORM, 0, 100); break;
				case 2: UTIL_EmitAmbientSound(ENT(0), trace.vecEndPos, "weapons/bulletimpact/wood3.wav", flVolume, ATTN_NORM, 0, 100); break;
			}
		}
		else if (pev->frags == 6) //water
		{
			switch ( RANDOM_LONG(0,2) )
			{
				case 0: UTIL_EmitAmbientSound(ENT(0), trace.vecEndPos, "weapons/bulletimpact/water1.wav", flVolume, ATTN_NORM, 0, 100); break;
				case 1: UTIL_EmitAmbientSound(ENT(0), trace.vecEndPos, "weapons/bulletimpact/water2.wav", flVolume, ATTN_NORM, 0, 100); break;
				case 2: UTIL_EmitAmbientSound(ENT(0), trace.vecEndPos, "weapons/bulletimpact/water3.wav", flVolume, ATTN_NORM, 0, 100); break;
			}
		}
		else if (pev->frags == 7) //gas canister
		{
			switch ( RANDOM_LONG(0,1) )
			{
				case 0: UTIL_EmitAmbientSound(ENT(0), trace.vecEndPos, "weapons/bulletimpact/gascan1.wav", flVolume, ATTN_NORM, 0, 100); break;
				case 1: UTIL_EmitAmbientSound(ENT(0), trace.vecEndPos, "weapons/bulletimpact/gascan2.wav", flVolume, ATTN_NORM, 0, 100); break;
			}
		}

		else
		{
			switch ( RANDOM_LONG(0,2) )
			{
				case 0: UTIL_EmitAmbientSound(ENT(0), trace.vecEndPos, "weapons/bulletimpact/concrete1.wav", flVolume, ATTN_NORM, 0, 100); break;
				case 1: UTIL_EmitAmbientSound(ENT(0), trace.vecEndPos, "weapons/bulletimpact/concrete2.wav", flVolume, ATTN_NORM, 0, 100); break;
				case 2: UTIL_EmitAmbientSound(ENT(0), trace.vecEndPos, "weapons/bulletimpact/concrete3.wav", flVolume, ATTN_NORM, 0, 100); break;
			}
		}	
		
		if (b_CanMakeParticles)
		{
			if ( CVAR_GET_FLOAT("r_particles" ) != 0 )			
			{
				MESSAGE_BEGIN(MSG_ALL, gmsgParticles);
					WRITE_SHORT(0);
					WRITE_BYTE(0);
					WRITE_COORD( trace.vecEndPos.x );
					WRITE_COORD( trace.vecEndPos.y );
					WRITE_COORD( trace.vecEndPos.z );
					WRITE_COORD( 0 );
					WRITE_COORD( 0 );
					WRITE_COORD( 0 );
					if (pev->frags == 5) //wood
					WRITE_SHORT(iDefaultHitWood1);
					else if (pev->frags == 6) //water
					WRITE_SHORT(iDefaultWaterSplash);
					else if (pev->frags == 7) //gas canister
					WRITE_SHORT(iDefaultGasCanister);
					else
					WRITE_SHORT(iDefaultWallSmoke);
				MESSAGE_END();
			}
		}
	}//eo cvar check
	return 1;
}
开发者ID:JoelTroch,项目名称:am_src_rebirth,代码行数:100,代码来源:bmodels.cpp


示例16: ALERT

void CCyclerSprite::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
{
	m_animate = !m_animate;
	ALERT( at_console, "Sprite: %s\n", STRING(pev->model) );
}
开发者ID:Hammermaps-DEV,项目名称:SOHL-V1.0-Refresh,代码行数:5,代码来源:h_cycler.cpp


示例17: ChangeLevel

/*
==============
ChangeLevel

Server is changing to a new level, check mapcycle.txt for map name and setup info
==============
*/
void CHalfLifeMultiplay :: ChangeLevel( void )
{
	static char szPreviousMapCycleFile[ 256 ];
	static mapcycle_t mapcycle;

	char szNextMap[32];
	char szFirstMapInList[32];
	char szCommands[ 1500 ];
	char szRules[ 1500 ];
	int minplayers = 0, maxplayers = 0;
	strcpy( szFirstMapInList, "hldm1" );  // the absolute default level is hldm1

	int	curplayers;
	BOOL do_cycle = TRUE;

	// find the map to change to
	char *mapcfile = (char*)CVAR_GET_STRING( "mapcyclefile" );
	ASSERT( mapcfile != NULL );

	szCommands[ 0 ] = '\0';
	szRules[ 0 ] = '\0';

	curplayers = CountPlayers();

	// Has the map cycle filename changed?
	if ( stricmp( mapcfile, szPreviousMapCycleFile ) )
	{
		strcpy( szPreviousMapCycleFile, mapcfile );

		DestroyMapCycle( &mapcycle );

		if ( !ReloadMapCycleFile( mapcfile, &mapcycle ) || ( !mapcycle.items ) )
		{
			ALERT( at_console, "Unable to load map cycle file %s\n", mapcfile );
			do_cycle = FALSE;
		}
	}

	if ( do_cycle && mapcycle.items )
	{
		BOOL keeplooking = FALSE;
		BOOL found = FALSE;
		mapcycle_item_s *item;

		// Assume current map
		strcpy( szNextMap, STRING(gpGlobals->mapname) );
		strcpy( szFirstMapInList, STRING(gpGlobals->mapname) );

		// Traverse list
		for ( item = mapcycle.next_item; item->next != mapcycle.next_item; item = item->next )
		{
			keeplooking = FALSE;

			ASSERT( item != NULL );

			if ( item->minplayers != 0 )
			{
				if ( curplayers >= item->minplayers )
				{
					found = TRUE;
					minplayers = item->minplayers;
				}
				else
				{
					keeplooking = TRUE;
				}
			}

			if ( item->maxplayers != 0 )
			{
				if ( curplayers <= item->maxplayers )
				{
					found = TRUE;
					maxplayers = item->maxplayers;
				}
				else
				{
					keeplooking = TRUE;
				}
			}

			if ( keeplooking )
				continue;

			found = TRUE;
			break;
		}

		if ( !found )
		{
			item = mapcycle.next_item;
		}			
		
//.........这里部分代码省略.........
开发者ID:Skumek,项目名称:hlsdk,代码行数:101,代码来源:multiplay_gamerules.cpp


示例18: ReloadMapCycleFile

/*
==============
ReloadMapCycleFile


Parses mapcycle.txt file into mapcycle_t structure
==============
*/
int ReloadMapCycleFile( char *filename, mapcycle_t *cycle )
{
	char szBuffer[ MAX_RULE_BUFFER ];
	char szMap[ 32 ];
	int length;
	char *pFileList;
	char *aFileList = pFileList = (char*)LOAD_FILE_FOR_ME( filename, &length );
	int hasbuffer;
	mapcycle_item_s *item, *newlist = NULL, *next;

	if ( pFileList && length )
	{
		// the first map name in the file becomes the default
		while ( 1 )
		{
			hasbuffer = 0;
			memset( szBuffer, 0, MAX_RULE_BUFFER );

			pFileList = COM_Parse( pFileList );
			if ( strlen( com_token ) <= 0 )
				break;

			strcpy( szMap, com_token );

			// Any more tokens on this line?
			if ( COM_TokenWaiting( pFileList ) )
			{
				pFileList = COM_Parse( pFileList );
				if ( strlen( com_token ) > 0 )
				{
					hasbuffer = 1;
					strcpy( szBuffer, com_token );
				}
			}

			// Check map
			if ( IS_MAP_VALID( szMap ) )
			{
				// Create entry
				char *s;

				item = new mapcycle_item_s;

				strcpy( item->mapname, szMap );

				item->minplayers = 0;
				item->maxplayers = 0;

				memset( item->rulebuffer, 0, MAX_RULE_BUFFER );

				if ( hasbuffer )
				{
					s = g_engfuncs.pfnInfoKeyValue( szBuffer, "minplayers" );
					if ( s && s[0] )
					{
						item->minplayers = atoi( s );
						item->minplayers = max( item->minplayers, 0 );
						item->minplayers = min( item->minplayers, gpGlobals->maxClients );
					}
					s = g_engfuncs.pfnInfoKeyValue( szBuffer, "maxplayers" );
					if ( s && s[0] )
					{
						item->maxplayers = atoi( s );
						item->maxplayers = max( item->maxplayers, 0 );
						item->maxplayers = min( item->maxplayers, gpGlobals->maxClients );
					}

					// Remove keys
					//
					g_engfuncs.pfnInfo_RemoveKey( szBuffer, "minplayers" );
					g_engfuncs.pfnInfo_RemoveKey( szBuffer, "maxplayers" );

					strcpy( item->rulebuffer, szBuffer );
				}

				item->next = cycle->items;
				cycle->items = item;
			}
			else
			{
				ALERT( at_console, "Skipping %s from mapcycle, not a valid map\n", szMap );
			}


		}

		FREE_FILE( aFileList );
	}

	// Fixup circular list pointer
	item = cycle->items;

//.........这里部分代码省略.........
开发者ID:Skumek,项目名称:hlsdk,代码行数:101,代码来源:multiplay_gamerules.cpp


示例19: ALERT

// make the entity carry out the scripted sequence instructions, but without
// destroying the monster's state.
void CCineAI::PossessEntity(void)
{
	Schedule_t *pNewSchedule;

	CBaseEntity * pEntity = m_hTargetEnt;
	CBaseMonster *pTarget = NULL;
	if(pEntity)
		pTarget = pEntity->MyMonsterPointer();

	if(pTarget)
	{
		if(!pTarget->CanPlaySequence(FCanOverrideState(), SS_INTERRUPT_AI))
		{
			ALERT(at_aiconsole, "(AI)Can't possess entity %s\n", STRING(pTarget->pev->classname));
			return;
		}

		pTarget->m_pGoalEnt   = this;
		pTarget->m_pCine      = this;
		pTarget->m_hTargetEnt = this;

		m_saved_movetype = pTarget->pev->movetype;
		m_saved_solid    = pTarget->pev->solid;
		m_saved_effects  = pTarget->pev->effects;
		pTarget->pev->effects |= pev->effects;

		switch(m_fMoveTo)
		{
		case 0:
		case 5:
			pTarget->m_scriptState = SCRIPT_WAIT;
			break;

		case 1:
			pTarget->m_scriptState = SCRIPT_WALK_TO_MARK;
			break;

		case 2:
			pTarget->m_scriptState = SCRIPT_RUN_TO_MARK;
			break;

		case 4:
			// zap the monster instantly to the site of the script entity.
			UTIL_SetOrigin(pTarget->pev, pev->origin);
			pTarget->pev->ideal_yaw = pev->angles.y;
			pTarget->pev->avelocity = Vector(0, 0, 0);
			pTarget->pev->velocity  = Vector(0, 0, 0);
			pTarget->pev->effects |= EF_NOINTERP;
			pTarget->pev->angles.y = pev->angles.y;
			pTarget->m_scriptState = SCRIPT_WAIT;
			m_startTime            = gpGlobals->time + 1E6;
			// UNDONE: Add a flag to do this so people can fixup physics after teleporting monsters
			pTarget->pev->flags &= ~FL_ONGROUND;
			break;
		default:
			ALERT(at_aiconsole, "aiscript:  invalid Move To Position value!");
			break;
		}

		ALERT(at_aiconsole, "\"%s\" found and used\n", STRING(pTarget->pev->targetname));

		pTarget->m_IdealMonsterState = MONSTERSTATE_SCRIPT;

		/*
		if (m_iszIdle)
		{
			StartSequence( pTarget, m_iszIdle, FALSE );
			if (FStrEq( STRING(m_iszIdle), STRING(m_iszPlay)))
			{
				pTarget->pev->framerate = 0;
			}
		}
*/
		// Already in a scripted state?
		if(pTarget->m_MonsterState == MONSTERSTATE_SCRIPT)
		{
			pNewSchedule = pTarget->GetScheduleOfType(SCHED_AISCRIPT);
			pTarget->ChangeSchedule(pNewSchedule);
		}
	}
}
开发者ID:Sh1ft0x0EF,项目名称:HLSDKRevamp,代码行数:83,代码来源:Scripted.cpp


示例20: AvHGetDefaultOrderType

// Used for context sensitive mouse and for processing right-click
// Must be shared, uses prediction code
// Fill in target index or target point, depending on type of order decided upon
AvHOrderType AvHGetDefaultOrderType(AvHTeamNumber inTeam, const vec3_t& inOrigin, const vec3_t& inNormRay, int& outTargetIndex, vec3_t& outTargetPoint, AvHUser3& outUser3, AvHOrderTargetType& outTargetType)
{
	vec3_t			theTraceStart;
	vec3_t			theTraceEnd;
	AvHOrderType	theOrderType = ORDERTYPE_UNDEFINED;

//	// Look for a player order
//	if(!AvHOrderTracePlayers(inTeam, inOrigin, inNormRay, theOrderType, outTargetIndex))
//	{
//		// If couldn't find one, create a non-player order if possible
//		//AvHOrderTraceNonPlayers(inTeam, inOrigin, inNormRay, theOrderType, outTargetIndex, outTargetPoint);
//	}

	
	// Offset a little so we don't hit the commander
	VectorMA(inOrigin, kSelectionStartRange, inNormRay, theTraceStart);
	VectorMA(inOrigin, kSelectionEndRange, inNormRay, theTraceEnd);
	int theFoundIndex = -1;
	vec3_t theFoundLocation;
	AvHTeamNumber theTeamOfThingHit;
	bool thePlayerHit = false;
	int theUserThree = 0;
	int theUserFour = 0;
	
	if(AvHSHUTraceTangible(theTraceStart, theTraceEnd, theFoundIndex, theFoundLocation, theTeamOfThingHit, thePlayerHit, theUserThree, theUserFour))
	{
		float theHealthPercentage=100.0f;
		float theArmorPercentage=100.0f;
		bool theSighted=false;
#ifdef AVH_SERVER
		CBaseEntity *theEntity=AvHSUGetEntityFromIndex(theFoundIndex);
		if ( theEntity ) 
		{
			theHealthPercentage=theEntity->pev->health/theEntity->pev->max_health;
		}
		else 
		{
			ALERT(at_console, "Not a buildable\n");
		}
		
        theArmorPercentage = theEntity->pev->armorvalue/AvHPlayerUpgrade::GetMaxArmorLevel(theEntity->pev->iuser4, (AvHUser3)theEntity->pev->iuser3);
		theSighted=GetHasUpgrade(theEntity->pev->iuser4, MASK_VIS_SIGHTED);
#endif

		// Did we hit an enemy?  If so, issue an attack order on him, then we're done, it's highest priority
		if(thePlayerHit ) 
		{
			// Did we hit a player on our team?  If so check for welding, if not guard
			if((theTeamOfThingHit == inTeam ) && (theTeamOfThingHit != TEAM_IND) )
			{
				theOrderType = ORDERTYPET_GUARD;
				if (  theArmorPercentage < 0.90f ) {
					theOrderType = ORDERTYPET_WELD;
					outTargetType = ORDERTARGETTYPE_TARGET;
				}
				outTargetIndex = theFoundIndex;
				outUser3 = (AvHUser3)theUserThree;
			}
		}
		// Something to pick up?
		if(!thePlayerHit ) 
		{
//			if ( ( theTeamOfThingHit ) != inTeam && (theTeamOfThingHit != TEAM_IND) && theSighted )
//			{
//				// Use it's center for the height
//				VectorCopy(theFoundLocation, outTargetPoint);
//				theOrderType = ORDERTYPET_ATTACK;
//				outTargetIndex = theFoundIndex;
//				outUser3 = (AvHUser3)theUserThree;
//				outTargetType = ORDERTARGETTYPE_LOCATION;
//			}
//			else 
			if ( theUserThree == AVH_USER3_MARINEITEM) 
			{
				// Use it's center for the height
				VectorCopy(theFoundLocation, outTargetPoint);
				outTargetIndex = theFoundIndex;
				outUser3 = (AvHUser3)theUserThree;
				
				// We're done
				theOrderType = ORDERTYPET_GET;
			}
			// Buildable?
			else if(GetHasUpgrade(theUserFour, MASK_BUILDABLE) && (theTeamOfThingHit == inTeam) && (theTeamOfThingHit != TEAM_IND))
			{
				// Use it's center for the height
				VectorCopy(theFoundLocation, outTargetPoint);
				outTargetIndex = theFoundIndex;
				outUser3 = (AvHUser3)theUserThree;
				
				// We're done
				theOrderType = ORDERTYPET_BUILD;
			}
			// Weldable?
			else if(theUserThree == AVH_USER3_WELD )
			{
				// Use it's center for the height
//.........这里部分代码省略.........
开发者ID:Arkshine,项目名称:NS,代码行数:101,代码来源:AvHOrder.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ ALIGN函数代码示例发布时间:2022-05-30
下一篇:
C++ ALEMBIC_ABC_SAFE_CALL_END函数代码示例发布时间: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