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

C++ ENTINDEX函数代码示例

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

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



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


示例16: UTIL_PlayerDecalTrace

/*
==============
UTIL_PlayerDecalTrace

A player is trying to apply his custom decal for the spray can.
Tell connected clients to display it, or use the default spray can decal
if the custom can't be loaded.
==============
*/
void UTIL_PlayerDecalTrace( TraceResult *pTrace, int playernum, int decalNumber, const bool bIsCustom )
{
	int index;
	
	if (!bIsCustom)
	{
		if ( decalNumber < 0 )
			return;

		index = gDecals[ decalNumber ].index;
		if ( index < 0 )
			return;
	}
	else
		index = decalNumber;

	if (pTrace->flFraction == 1.0)
		return;

	MESSAGE_BEGIN( MSG_BROADCAST, SVC_TEMPENTITY );
		WRITE_BYTE( TE_PLAYERDECAL );
		WRITE_BYTE ( playernum );
		WRITE_COORD( pTrace->vecEndPos.x );
		WRITE_COORD( pTrace->vecEndPos.y );
		WRITE_COORD( pTrace->vecEndPos.z );
		WRITE_SHORT( (short)ENTINDEX(pTrace->pHit) );
		WRITE_BYTE( index );
	MESSAGE_END();
}
开发者ID:CryoKeen,项目名称:HLEnhanced,代码行数:38,代码来源:util.cpp


示例17: find_ent_by_owner

static cell AMX_NATIVE_CALL find_ent_by_owner(AMX *amx, cell *params)  // native find_ent_by_owner(start_from_ent, classname[], owner_index); = 3 params
{
	int iEnt = params[1];
	int oEnt = params[3];
	// Check index to start searching at, 0 must be possible for iEnt.
	CHECK_ENTITY_SIMPLE(oEnt);

	edict_t *pEnt = INDEXENT2(iEnt);
	edict_t *entOwner = INDEXENT2(oEnt);

	//optional fourth parameter is for jghg2 compatibility
	const char* sCategory = NULL; 
	switch(params[4]){ 
		case 1: sCategory = "target"; break; 
		case 2: sCategory = "targetname"; break; 
		default: sCategory = "classname"; 
	}

	// No need to check if there is a real ent where entOwner points at since we don't access it anyway.

	int len;
	char* classname = MF_GetAmxString(amx, params[2], 0, &len);

	while (true) {
		pEnt = FIND_ENTITY_BY_STRING(pEnt, sCategory, classname);
		if (FNullEnt(pEnt)) // break and return 0 if bad
			break;
		else if (pEnt->v.owner == entOwner) // compare pointers
			return ENTINDEX(pEnt);
	}

	// If it comes here, the while loop ended because an ent failed (FNullEnt() == true)
	return 0;
}
开发者ID:Chuvi-w,项目名称:amxmodx,代码行数:34,代码来源:entity.cpp


示例18: executeForwards

void CPlayer::Disconnect()
{
	ingame = false;
	initialized = false;
	authorized = false;
	teamIdsInitialized = false;

	if (newmenu != -1)
	{
		Menu *pMenu = g_NewMenus[newmenu];
		if (pMenu)
		{
			//prevent recursion
			newmenu = -1;
			menu = 0;
			executeForwards(pMenu->func, 
				static_cast<cell>(ENTINDEX(pEdict)),
				static_cast<cell>(pMenu->thisId),
				static_cast<cell>(MENU_EXIT));
		}
	}

	List<ClientCvarQuery_Info *>::iterator iter, end=queries.end();
	for (iter=queries.begin(); iter!=end; iter++)
	{
		unregisterSPForward((*iter)->resultFwd);
		delete [] (*iter)->params;
		delete (*iter);
	}
	queries.clear();

	menu = 0;
	newmenu = -1;
}
开发者ID:9iky6,项目名称:amxmodx,代码行数:34,代码来源:CMisc.cpp


示例19: ClientConnect

int ClientConnect(edict_t *pPlayer, const char *pszName, const char *pszAddress, char szRejectReason[128])
{
	// Reset stuff:
	FUNUTIL_ResetPlayer(ENTINDEX(pPlayer));

	RETURN_META_VALUE(MRES_IGNORED, 0);
}
开发者ID:9iky6,项目名称:amxmodx,代码行数:7,代码来源:fun.cpp


示例20: ParaGiveChute

void ParaGiveChute( edict_t *pEntity )
{

	// Gives this person a parachute
	ChuteState[ ENTINDEX( pEntity ) ] = 1;

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



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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