当前位置: 首页>>代码示例>>C++>>正文


C++ ENTINDEX函数代码示例

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


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

示例1: UTIL_HostSay

void UTIL_HostSay( edict_t *pEntity, char *message )
{
   int   j;
   char  text[128];
   char *pc;
   edict_t *client;

   // make sure the text has content
   for ( pc = message; pc != NULL && *pc != 0; pc++ )
   {
      if ( isprint( *pc ) && !isspace( *pc ) )
      {
         pc = NULL;   // we've found an alphanumeric character,  so text is valid
         break;
      }
   }

   if ( pc != NULL )
      return;  // no character found, so say nothing

   // turn on color set 2  (color on,  no sound)
   sprintf( text, "%c%s: ", 2, STRING( pEntity->v.netname ) );

   j = sizeof(text) - 2 - strlen(text);  // -2 for /n and null terminator
   if ( (int)strlen(message) > j )
      message[j] = 0;

   strcat( text, message );
   strcat( text, "\n" );

   // loop through all players
   // Start with the first player.
   // This may return the world in single player if the client types something between levels or during spawn
   // so check it, or it will infinite loop

   if (gmsgSayText == 0)
      gmsgSayText = REG_USER_MSG( "SayText", -1 );

   client = NULL;
   while ( ((client = UTIL_FindEntityByClassname( client, "player" )) != NULL) &&
           (!FNullEnt(client)) ) 
   {
      if ( client == pEntity )  // skip sender of message
         continue;

      MESSAGE_BEGIN( MSG_ONE_UNRELIABLE, gmsgSayText, NULL, client );
         WRITE_BYTE( ENTINDEX(pEntity) );
         WRITE_STRING( text );
      MESSAGE_END();
   }

   // print to the sending client
   MESSAGE_BEGIN( MSG_ONE_UNRELIABLE, gmsgSayText, NULL, pEntity );
      WRITE_BYTE( ENTINDEX(pEntity) );
      WRITE_STRING( text );
   MESSAGE_END();
}
开发者ID:APGRoboCop,项目名称:RicoBot,代码行数:57,代码来源:util.cpp

示例2: ENTINDEX

// Find the next client in the game for this player to spectate
void CBasePlayer::Observer_FindNextPlayer( bool bReverse )
{
	// MOD AUTHORS: Modify the logic of this function if you want to restrict the observer to watching
	//				only a subset of the players. e.g. Make it check the target's team.

	int		iStart;
	if ( m_hObserverTarget )
		iStart = ENTINDEX( m_hObserverTarget->edict() );
	else
		iStart = ENTINDEX( edict() );
	int	    iCurrent = iStart;
	m_hObserverTarget = NULL;
	int iDir = bReverse ? -1 : 1; 

	do
	{
		iCurrent += iDir;

		// Loop through the clients
		if (iCurrent > gpGlobals->maxClients)
			iCurrent = 1;
		if (iCurrent < 1)
			iCurrent = gpGlobals->maxClients;

		CBaseEntity *pEnt = UTIL_PlayerByIndex( iCurrent );
		if ( !pEnt )
			continue;
		if ( pEnt == this )
			continue;
		// Don't spec observers or players who haven't picked a class yet
		if ( ((CBasePlayer*)pEnt)->IsObserver() || (pEnt->pev->effects & EF_NODRAW) )
			continue;

		// MOD AUTHORS: Add checks on target here.

		m_hObserverTarget = pEnt;
		break;

	} while ( iCurrent != iStart );

	// Did we find a target?
	if ( m_hObserverTarget )
	{
		// Move to the target
		UTIL_SetOrigin( pev, m_hObserverTarget->pev->origin );

		// ALERT( at_console, "Now Tracking %s\n", STRING( m_hObserverTarget->pev->netname ) );

		// Store the target in pev so the physics DLL can get to it
		if (pev->iuser1 != OBS_ROAMING)
			pev->iuser2 = ENTINDEX( m_hObserverTarget->edict() );
	
		
		
	}
}
开发者ID:6779660,项目名称:halflife,代码行数:57,代码来源:observer.cpp

示例3: TraceLine

void TraceLine(const float *v1, const float *v2, int fNoMonsters, edict_t *shooter, TraceResult *ptr) {
	TRACE_LINE(v1, v2, fNoMonsters, shooter, ptr);
	if ( ptr->pHit && (ptr->pHit->v.flags& (FL_CLIENT | FL_FAKECLIENT))
	&& shooter && (shooter->v.flags & (FL_CLIENT | FL_FAKECLIENT)) ) {
		int shooterIndex = ENTINDEX(shooter);
		if ( !(g_bodyhits[shooterIndex][ENTINDEX(ptr->pHit)] & (1<<ptr->iHitgroup)) )
			ptr->flFraction = 1.0;
	}
	RETURN_META(MRES_SUPERCEDE);
}
开发者ID:9iky6,项目名称:amxmodx,代码行数:10,代码来源:fun.cpp

示例4: PlayerKilled

//=========================================================
// PlayerKilled - someone/something killed this player
//=========================================================
void CHalfLifeMultiplay :: PlayerKilled( CBasePlayer *pVictim, entvars_t *pKiller, entvars_t *pInflictor )
{
	DeathNotice( pVictim, pKiller, pInflictor );

	pVictim->m_iDeaths += 1;


	FireTargets( "game_playerdie", pVictim, pVictim, USE_TOGGLE, 0 );
	CBasePlayer *peKiller = NULL;
	CBaseEntity *ktmp = CBaseEntity::Instance( pKiller );
	if ( ktmp && (ktmp->Classify() == CLASS_PLAYER) )
		peKiller = (CBasePlayer*)ktmp;

	if ( pVictim->pev == pKiller )  
	{  // killed self
		pKiller->frags -= 1;
	}
	else if ( ktmp && ktmp->IsPlayer() )
	{
		// if a player dies in a deathmatch game and the killer is a client, award the killer some points
		pKiller->frags += IPointsForKill( peKiller, pVictim );
		
		FireTargets( "game_playerkill", ktmp, ktmp, USE_TOGGLE, 0 );
	}
	else
	{  // killed by the world
		pVictim->pev->frags -= 1;
	}

	// update the scores
	// killed scores
	MESSAGE_BEGIN( MSG_ALL, gmsgScoreInfo );
		WRITE_BYTE( ENTINDEX(pVictim->edict()) );
		WRITE_SHORT( pVictim->pev->frags );
		WRITE_SHORT( pVictim->m_iDeaths );
		WRITE_SHORT( pVictim->pev->team );
	MESSAGE_END();

	// killers score, if it's a player
	CBaseEntity *ep = CBaseEntity::Instance( pKiller );
	if ( ep && ep->Classify() == CLASS_PLAYER )
	{
		CBasePlayer *PK = (CBasePlayer*)ep;

		MESSAGE_BEGIN( MSG_ALL, gmsgScoreInfo );
			WRITE_BYTE( ENTINDEX(PK->edict()) );
			WRITE_SHORT( PK->pev->frags );
			WRITE_SHORT( PK->m_iDeaths );
			WRITE_SHORT( PK->pev->team );
		MESSAGE_END();

		// let the killer paint another decal as soon as he'd like.
		PK->m_flNextDecalTime = gpGlobals->time;
	}
}
开发者ID:jpiolho,项目名称:halflife,代码行数:58,代码来源:multiplay_gamerules.cpp

示例5: ClientUserInfoChanged

/*
========================
ClientUserInfoChanged

called after the player changes
userinfo - gives dll a chance to modify it before
it gets sent into the rest of the engine.
========================
*/
void ClientUserInfoChanged( edict_t *pEntity, char *infobuffer )
{
	// Is the client spawned yet?
	if ( !pEntity->pvPrivateData )
		return;

	// msg everyone if someone changes their name,  and it isn't the first time (changing no name to current name)
	if ( pEntity->v.netname && STRING(pEntity->v.netname)[0] != 0 && !FStrEq( STRING(pEntity->v.netname), g_engfuncs.pfnInfoKeyValue( infobuffer, "name" )) )
	{
		char sName[256];
		char *pName = g_engfuncs.pfnInfoKeyValue( infobuffer, "name" );
		strncpy( sName, pName, sizeof(sName) - 1 );
		sName[ sizeof(sName) - 1 ] = '\0';

		// First parse the name and remove any %'s
		for ( char *pApersand = sName; pApersand != NULL && *pApersand != 0; pApersand++ )
		{
			// Replace it with a space
			if ( *pApersand == '%' )
				*pApersand = ' ';
		}

		// Set the name
		g_engfuncs.pfnSetClientKeyValue( ENTINDEX(pEntity), infobuffer, "name", sName );

		char text[256];
		sprintf( text, "* %s changed name to %s\n", STRING(pEntity->v.netname), g_engfuncs.pfnInfoKeyValue( infobuffer, "name" ) );
		MESSAGE_BEGIN( MSG_ALL, gmsgSayText, NULL );
			WRITE_BYTE( ENTINDEX(pEntity) );
			WRITE_STRING( text );
		MESSAGE_END();

		// team match?
		if ( g_teamplay )
		{
			UTIL_LogPrintf( "\"%s<%i><%s><%s>\" changed name to \"%s\"\n", 
				STRING( pEntity->v.netname ), 
				GETPLAYERUSERID( pEntity ), 
				GETPLAYERAUTHID( pEntity ),
				g_engfuncs.pfnInfoKeyValue( infobuffer, "model" ), 
				g_engfuncs.pfnInfoKeyValue( infobuffer, "name" ) );
		}
		else
		{
			UTIL_LogPrintf( "\"%s<%i><%s><%i>\" changed name to \"%s\"\n", 
				STRING( pEntity->v.netname ), 
				GETPLAYERUSERID( pEntity ), 
				GETPLAYERAUTHID( pEntity ),
				GETPLAYERUSERID( pEntity ), 
				g_engfuncs.pfnInfoKeyValue( infobuffer, "name" ) );
		}
	}

	g_pGameRules->ClientUserInfoChanged( GetClassPtr((CBasePlayer *)&pEntity->v), infobuffer );
}
开发者ID:zenithght,项目名称:xash3d,代码行数:64,代码来源:client.cpp

示例6: VPROF_BUDGET

void ChasePath::RefreshPath(INextBot *nextbot, CBaseEntity *ent, const IPathCost& cost_func, Vector *vec)
{
	VPROF_BUDGET("ChasePath::RefreshPath", "NextBot");
	
	if (this->IsValid() && nextbot->GetLocomotionInterface()->IsUsingLadder()) {
		if (nextbot->IsDebugging(DEBUG_PATH)) {
			DevMsg("%3.2f: bot(#%d) ChasePath::RefreshPath failed. Bot is on a ladder.\n",
				gpGlobals->curtime, ENTINDEX(nextbot->GetEntity()));
		}
		
		this->m_ctTimer2.Start(1.0f);
		return;
	}
	
	if (ent == nullptr) {
		if (nextbot->IsDebugging(DEBUG_PATH)) {
			/* misspelling is in original */
			DevMsg("%3.2f: bot(#%d) CasePath::RefreshPath failed. No subject.\n",
				gpGlobals->curtime, ENTINDEX(nextbot->GetEntity()));
		}
	}
	
	if (this->m_ctTimer1.IsElapsed()) {
		CBaseEntity *subject = this->m_hChaseSubject();
		if (subject == nullptr || subject != ent) {
			if (nextbot->IsDebugging(DEBUG_PATH)) {
				DevMsg("%3.2f: bot(#%d) ChasePath::RefreshPath subject changed (from %p to %p).\n",
					gpGlobals->curtime, ENTINDEX(nextbot->GetEntity()),
					this->m_hChaseSubject(), ent);
			}
			
			this->Invalidate();
			this->m_ctTimer1.Invalidate();
		}
		
		if (!this->IsValid() || this->m_ctTimer2.IsElapsed()) {
			if (this->IsValid() && this->m_ctTimer3.HasStarted() &&
				this->m_ctTimer3.IsElapsed()) {
				this->Invalidate();
			}
			
			if (!this->IsValid() || this->IsRepathNeeded(nextbot, ent)) {
				// TODO
				
				
				// eventually: this->Compute(...)
			}
			
			// TODO
		}
		
		// TODO
	}
}
开发者ID:Msalinas2877,项目名称:mvm-reversed,代码行数:54,代码来源:NextBotChasePath.cpp

示例7: ClientUserInfoChanged

/*
========================
ClientUserInfoChanged

called after the player changes
userinfo - gives dll a chance to modify it before
it gets sent into the rest of the engine.
========================
*/
void ClientUserInfoChanged( edict_t *pEntity, char *infobuffer )
{
	// Is the client spawned yet?
	if ( !pEntity->pvPrivateData )
		return;

	// msg everyone if someone changes their name,  and it isn't the first time (changing no name to current name)
	if ( pEntity->v.netname && STRING(pEntity->v.netname)[0] != 0 && !FStrEq( STRING(pEntity->v.netname), g_engfuncs.pfnInfoKeyValue( infobuffer, "name" )) )
	{
		char sName[256];
		char *pName = g_engfuncs.pfnInfoKeyValue( infobuffer, "name" );
		strncpy( sName, pName, sizeof(sName) - 1 );
		sName[ sizeof(sName) - 1 ] = '\0';

		// First parse the name and remove any %'s
		for ( char *pApersand = sName; pApersand != NULL && *pApersand != 0; pApersand++ )
		{
			// Replace it with a space
			if ( *pApersand == '%' )
				*pApersand = ' ';
		}

		// Set the name
		g_engfuncs.pfnSetClientKeyValue( ENTINDEX(pEntity), infobuffer, "name", sName );

		char text[256];
		sprintf( text, "* %s changed name to %s\n", STRING(pEntity->v.netname), g_engfuncs.pfnInfoKeyValue( infobuffer, "name" ) );
		MESSAGE_BEGIN( MSG_ALL, gmsgSayText, NULL );
			WRITE_BYTE( ENTINDEX(pEntity) );
			WRITE_STRING( text );
		MESSAGE_END();

		UTIL_LogPrintf( "\"%s<%i><%s><%i>\" changed name to \"%s\"\n", 
			STRING( pEntity->v.netname ), 
			GETPLAYERUSERID( pEntity ), 
			GETPLAYERAUTHID( pEntity ),
			GETPLAYERUSERID( pEntity ), 
			g_engfuncs.pfnInfoKeyValue( infobuffer, "name" ) );
	}

	g_pGameRules->ClientUserInfoChanged( GetClassPtr((CBasePlayer *)&pEntity->v), infobuffer );

	// Override model
	if ( (!strcmp( "models/player/female/female.mdl", g_engfuncs.pfnInfoKeyValue( infobuffer, "model" ) )) )//&& (!strcmp( "models/player/hgrunt/hgrunt.mdl" )) )
		SET_MODEL( pEntity, "models/player/male/male.mdl" );
	g_engfuncs.pfnSetClientKeyValue( ENTINDEX( pEntity ), infobuffer, "model", "male" );

	// Set colors
	int iHue = GetHueFromRGB( g_iaDiscColors[ pEntity->v.team][0] / 255, g_iaDiscColors[pEntity->v.team][1] / 255, g_iaDiscColors[pEntity->v.team][2] / 255 );
	g_engfuncs.pfnSetClientKeyValue( ENTINDEX( pEntity ), infobuffer, "topcolor", UTIL_VarArgs("%d", iHue) );
	g_engfuncs.pfnSetClientKeyValue( ENTINDEX( pEntity ), infobuffer, "bottomcolor", UTIL_VarArgs("%d", iHue - 10) );
}
开发者ID:devkin021,项目名称:ricochet,代码行数:61,代码来源:client.cpp

示例8: StartFrame

void StartFrame()
{
	edict_t* ent = NULL;
	while( !FNullEnt( ent = FIND_ENTITY_BY_STRING( ent, "classname", "player" ) ) )
	{
		if( esfmodels[ENTINDEX(ent)-1].bSet )
		{
			ent->v.modelindex = MODEL_INDEX( esfmodels[ENTINDEX(ent)-1].szModel );
			ent->v.model = MAKE_STRING( esfmodels[ENTINDEX(ent)-1].szModel );
		}
	}
	RETURN_META( MRES_HANDLED );
}
开发者ID:tutyamxx,项目名称:ESFX-Module,代码行数:13,代码来源:esfx.cpp

示例9: ClientPutInServer

/*
===========
ClientPutInServer

called when the player is first put in the server
============
*/
void ClientPutInServer( edict_t *pEntity )
{
	CBasePlayer *pPlayer;

	entvars_t *pev = &pEntity->v;

	pPlayer = GetClassPtr((CBasePlayer *)pev);
	pPlayer->SetCustomDecalFrames(-1); // Assume none;

	// Allocate a CBasePlayer for pev, and call spawn
	pPlayer->Spawn();

	pPlayer->m_bHasDisconnected = FALSE;

	// Reset interpolation during first frame
	pPlayer->pev->effects |= EF_NOINTERP;
	pPlayer->m_pCurrentArena = NULL;
	pPlayer->m_flKnownItemTime = gpGlobals->time + 0.3;
	pPlayer->m_iLastGameResult = GAME_DIDNTPLAY;	

	// Add to an Arena (1 maxplayer allows mapmakers to run around their map)
	if ( InArenaMode() )
	{
		AddClientToArena( pPlayer );
	}
	else
	{
		// Put everyone on different teams
		pPlayer->pev->team = ENTINDEX( pEntity );
		pPlayer->pev->iuser4 = pPlayer->pev->team;

		// Set colors
		int iHue = GetHueFromRGB( g_iaDiscColors[ pPlayer->pev->team][0] / 255, g_iaDiscColors[pPlayer->pev->team][1] / 255, g_iaDiscColors[pPlayer->pev->team][2] / 255 );
		g_engfuncs.pfnSetClientKeyValue( ENTINDEX( pEntity ), g_engfuncs.pfnGetInfoKeyBuffer( pPlayer->edict() ), "topcolor", UTIL_VarArgs("%d", iHue) );
		g_engfuncs.pfnSetClientKeyValue( ENTINDEX( pEntity ), g_engfuncs.pfnGetInfoKeyBuffer( pPlayer->edict() ), "bottomcolor", UTIL_VarArgs("%d", iHue - 10) );
	}

	static char sName[128];
	strcpy(sName,STRING(pPlayer->pev->netname));
	
	// First parse the name and remove any %'s
	for ( char *pApersand = sName; pApersand != NULL && *pApersand != 0; pApersand++ )
	{
		// Replace it with a space
		if ( *pApersand == '%' )
				*pApersand = ' ';
	}

	// notify other clients of player joining the game
	UTIL_ClientPrintAll( HUD_PRINTNOTIFY, "#Game_connected", sName[0] != 0 ? sName : "<unconnected>" );
}
开发者ID:devkin021,项目名称:ricochet,代码行数:58,代码来源:client.cpp

示例10: DrawOverlay_Ownership

	/* show team ownership of nav areas based on flag position and owner capture
	 * points */
	void DrawOverlay_Ownership(long frame)
	{
		if (frame % 3 != 0) return;
		
		// TODO: default ownership when there's no bomb is wrong
		// TODO: handle areas that have incursion value of -1.0f
		
		float flag_inc = 0.0f;
		
		CCaptureFlag *flag = TheFlagTracker.GetFrontFlag();
		if (flag != nullptr) {
			auto area = static_cast<CTFNavArea *>(TheNavMesh->GetNearestNavArea(flag));
			if (area != nullptr) {
				flag_inc = area->GetIncursionDistance(TF_TEAM_RED);
			}
		}
		
		for (auto area : (CUtlVector<CTFNavArea *>&)TheNavAreas) {
			float inc = area->GetIncursionDistance(TF_TEAM_RED);
			
			if (inc < 0.0f || area->HasTFAttributes(BLUE_SPAWN_ROOM)) {
				/* gray */
			//	area->DrawFilled(0x80, 0x80, 0x80, 0x00, 3 * gpGlobals->interval_per_tick, true, 0.0f);
				area->DrawFilled(0x80, 0x80, 0x80, 0x80, 3 * gpGlobals->interval_per_tick, true, 3.0f);
			} else {
				if (flag_inc > 0.0f && inc > flag_inc) {
					/* blue */
				//	area->DrawFilled(0x20, 0x20, 0xff, 0x00, 3 * gpGlobals->interval_per_tick, true, 0.0f);
					area->DrawFilled(0x20, 0x20, 0xff, 0x80, 3 * gpGlobals->interval_per_tick, true, 3.0f);
				} else {
					/* red */
				//	area->DrawFilled(0xff, 0x20, 0x20, 0x00, 3 * gpGlobals->interval_per_tick, true, 0.0f);
					area->DrawFilled(0xff, 0x20, 0x20, 0x80, 3 * gpGlobals->interval_per_tick, true, 3.0f);
				}
			}
		}
		
#if 0
		for (const auto& pair : TheFlagTracker.GetFlagInfos()) {
			CCaptureFlag *flag   = pair.first;
			const FlagInfo& info = pair.second;
			
			NDebugOverlay::EntityText(ENTINDEX(flag), 0, "FLAG", 3 * gpGlobals->interval_per_tick, 0xff, 0xff, 0xff, 0xff);
			NDebugOverlay::EntityText(ENTINDEX(flag), 2, "Hatch path dist:", 3 * gpGlobals->interval_per_tick, 0xff, 0xff, 0xff, 0xff);
			NDebugOverlay::EntityText(ENTINDEX(flag), 3, CFmtStrN<256>("%.0f HU", info.hatch_path_dist), 3 * gpGlobals->interval_per_tick, 0xff, 0xff, 0xff, 0xff);
		}
#endif
		
		// TODO: draw gates
	}
开发者ID:sigsegv-mvm,项目名称:sigsegv-mvm,代码行数:52,代码来源:mvm_defender_bots.cpp

示例11: ParaEnable

void ParaEnable( edict_t *pEntity )
{
	
	if (ChuteState[ ENTINDEX( pEntity ) ] != 1) {
		ClientPrint( VARS(pEntity), HUD_PRINTTALK, "* You don't have a parachute! Go pick one up!\n");
		return;
	}
	// cant use the parachute when you are on the ground

	if (pEntity->v.flags & FL_ONGROUND) {
		ClientPrint( VARS(pEntity), HUD_PRINTTALK, "* Parachutes only work in the air!\n");
		return;
	}
	
	// turns on the parachute
	ChuteState[ ENTINDEX( pEntity ) ] = 2;
	entvars_t *pev = VARS( pEntity );

	// set initial vars
	pev->gravity = 0.1;
	pev->speed = 0;
	pev->velocity = g_vecZero;

	// give them the parachute model

	int i = 1;
	edict_t *frontEnt;
	entvars_t *pModelPev;

	int mdlfound = 0;

	for (i; i < 1025; i++) {

		frontEnt = INDEXENT ( i );
		if (frontEnt) {
			pModelPev =  VARS(frontEnt);
			if (FStrEq((char *)STRING(pModelPev->netname), "para")) {
				// Touch this ent.
				(*other_gFunctionTable.pfnTouch)(frontEnt, pEntity);
			}
		}
	}

	// The parachute has been given to em
	// Now, we just wait for em to hit the ground then we take the chute again


}
开发者ID:Landokane,项目名称:avc,代码行数:48,代码来源:avpara.cpp

示例12: FakespawnPlayer

void FakespawnPlayer(edict_t *pEdict)
{
	int team = GetPlayerTeam(pEdict);

	if (team != TEAM_T && team != TEAM_CT)
	{
		return;
	}

	int index = ENTINDEX(pEdict);

	player_states *pPlayer = GET_PLAYER(index);

	if (pPlayer->spawning)
		return;

	pPlayer->spawning = true;

	if (g_PreSpawn > 0  && MF_ExecuteForward(g_PreSpawn, (cell)index, (cell)1) > 0)
	{
		pPlayer->spawning = false;
		return;
	}

	SpawnHandler(index, true);
	pPlayer->spawning = false;
}
开发者ID:Arkshine,项目名称:CSDM,代码行数:27,代码来源:csdm_util.cpp

示例13: DispatchThink

void DispatchThink( edict_t *pent )
{
	CBaseEntity *pEntity = (CBaseEntity *)GET_PRIVATE(pent);
	if (pEntity)
	{
		if ( FBitSet( pEntity->pev->flags, FL_DORMANT ) )
			ALERT( at_error, "Dormant entity %s is thinking!!\n", STRING(pEntity->pev->classname) );

		//LLAPb begin
		if (!pEntity->scripted || !ScriptsActive())
		{
			pEntity->Think();

			return;
		}

		GenericFunction *pfn = pEntity->my_script->funcs->GetFn(M_THINK);

		if (!pfn)
		{
			pEntity->Think();

			return;
		}

		if (NoErrors())
		{
			pfn->PreExecute();

			int i = ENTINDEX(pent);
			double f = gpGlobals->frametime;

			if (pfn->argc > 0)
				pfn->PassArg(0, Type(&i, _INT));

			if (pfn->argc > 1)
				pfn->PassArg(1, Type(&f, DOUBLE));

			switch (pfn->specification)
			{
			case SPECIFICATION_BEFORE:
				pfn->Execute();
				pEntity->Think();
				break;

			case SPECIFICATION_INSTEAD:
				pfn->Execute();
				break;

			default:
				pEntity->Think();
				pfn->Execute();
				break;
			}
		}
		else
			//LLAPb end
			pEntity->Think();
	}
}
开发者ID:mittorn,项目名称:hlwe_src,代码行数:60,代码来源:cbase.cpp

示例14: GetTeam

int GetTeam (edict_t *ent)
{
	// SyPB Pro P.1
	// new get team off set, return player true team
	int client = ENTINDEX (ent) - 1, player_team;
	
	 // SyPB Pro P.5
	if (!IsValidPlayer (ent))
	{
		player_team = 0;
		edict_t *entity = null;
		ITERATE_ARRAY (g_entityName, j)
		{
			while (!FNullEnt (entity = FIND_ENTITY_BY_CLASSNAME (entity, g_entityName[j])))
			{
				if (ent == entity)
				{
					player_team = g_entityTeam[j];
					break;
				}
			}
		}
		player_team--;
		
		if (GetGameMod () == 99 && g_DelayTimer > engine->GetTime ())
			player_team = 2;
		
		return player_team;
	}
开发者ID:n1992d,项目名称:SyPB,代码行数:29,代码来源:support.cpp

示例15: CreateFakeClient

void CServer::BotCreate(struct bot_profile_s *profile)
{
   edict_t *BotEnt = CreateFakeClient(profile->name);

   if (!FNullEnt(BotEnt)) {
      char *infobuffer = GET_INFOBUFFER(BotEnt);
      int clientIndex = ENTINDEX(BotEnt);

      CBaseBot *pBot = NewBotInstance();
      pBot->pev = &BotEnt->v;
      pBot->m_pProfile = profile;

      if (!IsTeamplay()) {
         SET_CLIENT_KEY_VALUE(clientIndex, infobuffer, "model", profile->skin);

         // use random colors
         SET_CLIENT_KEY_VALUE(clientIndex, infobuffer, "topcolor", va("%d", RandomLong(0, 255)));
         SET_CLIENT_KEY_VALUE(clientIndex, infobuffer, "bottomcolor", va("%d", RandomLong(0, 255)));
      }

      AddBot(pBot);

      pBot->m_pProfile->is_used = true;
   }
}
开发者ID:CecilHarvey,项目名称:gina,代码行数:25,代码来源:server.cpp


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