예제 #1
0
파일: g_bot.c 프로젝트: GenaSG/ET
void bot_seek_cover_sequence_init( gentity_t *ent )
{
	g_serverEntity_t *trav, *lastTrav;
	//
	if (!ent->target || !ent->target[0])
	{
		return;
	}
	// find our list of spots
	trav = NULL;

	// the first one is different, since we're getting the sequence (a gentity_t) to point at the first spot (a g_serverEntity_t)
	trav = FindServerEntity( trav, SE_FOFS(name), ent->target);
	ent->serverEntity = trav;

	// now we just want serverentities pointing at each other
	lastTrav = trav;
	while ((trav = FindServerEntity( trav, SE_FOFS(name), ent->target)))
	{
		lastTrav->nextServerEntity = trav;
		lastTrav = trav;
	}
	//
	// we didn't find anything
	if (ent->serverEntity == NULL)
	{
		G_Error( "bot_seek_cover_sequence has no matching spots (\"target\" = \"%s\"", ent->target );
	}
	//
	lastTrav->nextServerEntity = NULL;
}
예제 #2
0
void bot_seek_cover_spot_think(g_serverEntity_t * ent)
{
	g_serverEntity_t *trav, *lastTrav;

	//
	if(ent->name)
	{
		// find our parent
		trav = NULL;
		while((trav = FindServerEntity(trav, SE_FOFS(target), ent->name)))
		{
			if(!Q_stricmp(trav->classname, ent->classname))
			{
				ent->parent = trav;
				break;
			}
		}
	}
	// Don't bother looking for a target if none is specified.  Mad Doctor I
	if(ent->target && (ent->target[0] != 0))
	{
		//
		// now find our ->target_ent, if we have multiple targets, then use ->chain
		trav = NULL;
		lastTrav = NULL;
		while((trav = FindServerEntity(trav, SE_FOFS(name), ent->target)))
		{
			if(Q_stricmp(trav->classname, ent->classname))
			{
				G_Error("bot_seek_cover_spot at %s is targetting a %s", vtos(ent->origin), trav->classname);
			}

			if(!ent->target_ent)
			{
				ent->target_ent = trav;
				//VectorSubtract( trav->s.origin, ent->s.origin, ent->movedir );
				//VectorNormalize( ent->movedir );
			}

			if(lastTrav)
			{
				lastTrav->chain = trav;
			}

			lastTrav = trav;
		}

	}							// if (ent->target[0] != 0)...
}