Пример #1
0
eclass_t *Eclass_ForName (char *name, qboolean has_brushes)
{
	eclass_t	*e;
	char		init[1024];

#ifdef _DEBUG
	// grouping stuff, not an eclass
	if (strcmp(name, "group_info")==0)
		Sys_Printf("WARNING: unexpected group_info entity in Eclass_ForName\n");
#endif

	if (!name)
		return eclass_bad;

	for (e=eclass ; e ; e=e->next)
		if (!strcmp (name, e->name))
			return e;

	// create a new class for it
	if (has_brushes)
	{
		sprintf (init, "/*QUAKED %s (0 0.5 0) ?\nNot found in source.\n", name);
		e = Eclass_InitFromText (init);
	}
	else
	{
		sprintf (init, "/*QUAKED %s (0 0.5 0) (-8 -8 -8) (8 8 8)\nNot found in source.\n", name);
		e = Eclass_InitFromText (init);
	}

	Eclass_InsertAlphabetized (e);

	return e;
}
Пример #2
0
eclass_t *Eclass_ForName (const char *name, bool has_brushes)
{
	eclass_t	*e;
	char buff[1024];

	if (!name) {
		return eclass_bad;
	}

	for ( e = eclass; e; e = e->next ) {
		if ( !strcmp( name, e->name ) ) {
			return e;
		}
	}

	e = EClass_Alloc();
	if ( !e ) {
		return NULL;
	}
	e->name = Mem_CopyString( name );
	sprintf(buff, "%s not found in def/*.def\n", name);
	e->comments = Mem_CopyString( buff );
	e->color.x = 0.0f;
	e->color.y = 0.5f;
	e->color.z = 0.0f;
	e->fixedsize = !has_brushes;
	e->mins.x = e->mins.y = e->mins.z = -8.0f;
	e->maxs.x = e->maxs.y = e->maxs.z = 8.0f;
	Eclass_InsertAlphabetized( e );

	return e;
}
Пример #3
0
eclass_t *Eclass_ForName (const char *name, qboolean has_brushes)
{
	eclass_t	*e;

  if (!name || *name == '\0')
    return eclass_bad;

#ifdef _DEBUG
  // grouping stuff, not an eclass
  if (strcmp(name, "group_info")==0)
    Sys_Printf("WARNING: unexpected group_info entity in Eclass_ForName\n");
#endif

	if (!name)
		return eclass_bad;

	for (e=eclass ; e ; e=e->next)
		if (!strcmp (name, e->name))
			return e;

	// create a new class for it
	if (has_brushes)
	{
    e = EClass_Create(name , 0, 0.5, 0,NULL,NULL,"Not found in source.");
	}
	else
	{
    e = EClass_Create(name , 0, 0.5, 0,&smallbox[0],&smallbox[1],"Not found in source.");
	}

	Eclass_InsertAlphabetized (e);

	return e;
}
Пример #4
0
eclass_t *Eclass_ForName (char *name, qboolean has_brushes)
{
	eclass_t	*e;
	char		init[1024];

	if (!name)
		return eclass_bad;

	for (e=eclass ; e ; e=e->next)
		if (!strcmp (name, e->name))
			return e;

	// create a new class for it
	if (has_brushes)
	{
		sprintf (init, "/*QUAKED %s (0 0.5 0) ?\nNot found in source.\n", name);
		e = Eclass_InitFromText (init);
	}
	else
	{
		sprintf (init, "/*QUAKED %s (0 0.5 0) (-8 -8 -8) (8 8 8)\nNot found in source.\n", name);
		e = Eclass_InitFromText (init);
	}

	Eclass_InsertAlphabetized (e);

	return e;
}
Пример #5
0
/*
=================
Eclass_ScanFile
=================
*/
void Eclass_ScanFile (char *filename)
{
	int		size;
	char	*data;
	eclass_t	*e;
	int		i;
	char    temp[1024];

	QE_ConvertDOSToUnixName( temp, filename );

	Sys_Printf ("ScanFile: %s\n", temp);

	size = LoadFile (filename, (void *)&data);

	for (i=0 ; i<size ; i++)
		if (!strncmp(data+i, "/*QUAKED",8))
		{
			e = Eclass_InitFromText (data+i);
			if (e)
				Eclass_InsertAlphabetized (e);
			else
				printf ("Error parsing: %s in %s\n",debugname, filename);
		}

	free (data);
}
Пример #6
0
/*!
   create the eclass_t structures and add to the global list.
 */
void Create_EClasses( GSList *l_classes ){
	int count = 0;
	// loop through the loaded structures finding all the non BaseClasses
	for ( GSList *clst = l_classes; clst != NULL; clst = clst->next )
	{
		class_t *c = (class_t *)clst->data;

		if ( c->classtype == CLASS_BASECLASS ) { // not looking for these.
			continue;
		}

		eclass_t *e = (eclass_t *) malloc( sizeof( eclass_s ) );
		memset( e,0,sizeof( eclass_s ) );

		EClass_ImportFromClass( e, l_classes, c );

		// radiant will crash if this is null, and it still could be at this point.
		if ( !e->comments ) {
			e->comments = strdup( "No description available, check documentation\n" );
		}

		// dump the spawnflags to the end of the comments.
		int i;
		bool havespawnflags;

		havespawnflags = false;
		for ( i = 0 ; i < MAX_FLAGS ; i++ )
		{
			if ( *e->flagnames[i] ) {
				havespawnflags = true;
			}
		}

		if ( havespawnflags ) {
			char spawnline[80];
			e->comments = addstr( e->comments,"Spawnflags\n" );
			for ( i = 0 ; i < MAX_FLAGS ; i++ )
			{
				if ( *e->flagnames[i] ) {
					sprintf( spawnline,"  %d - %s\n", 1 << i, e->flagnames[i] );
					e->comments = addstr( e->comments,spawnline );
				}
			}
		}

		Eclass_InsertAlphabetized( e );
		count++;
		// Hydra: ttimo, I don't think this code is required...
		// single ?
		*Get_Eclass_E() = e;
		Set_Eclass_Found( true );
		if ( Get_Parsing_Single() ) {
			break;
		}
	}

	Sys_Printf( "FGD Loaded %d entities.\n", count );
}
Пример #7
0
//#endif
void Eclass_ScanFile (char *filename)
{
	int		size;
	char	*data;
	eclass_t	*e;
	int		i;
	char    temp[1024];

	QE_ConvertDOSToUnixName( temp, filename );

	Sys_Printf ("ScanFile: %s\n", temp);

	// BUG
	size = LoadFile (filename, (void**)&data);
	eclass_found = false;
	for (i=0 ; i<size ; i++)
		if (!strncmp(data+i, "/*QUAKED",8))
		{

			//#ifdef BUILD_LIST
			if (g_bBuildList)
			{
				CString strDef = "";
				int j = i;
				while (1)
				{
					strDef += *(data+j);
					if (*(data+j) == '/' && *(data+j-1) == '*')
						break;
					j++;
				}
				strDef += "\r\n\r\n\r\n";
				strDefFile += strDef;
			}
			//#endif
			e = Eclass_InitFromText (data+i);
			if (e)
				Eclass_InsertAlphabetized (e);
			else
				printf ("Error parsing: %s in %s\n",debugname, filename);

			// single ?
			eclass_e = e;
			eclass_found = true;
			if ( parsing_single )
				break;
		}

		free (data);		
}
Пример #8
0
EntityClass *Eclass_ForName(const char *name, bool has_brushes)
{
	ASSERT_NOTNULL(name);

  if(string_empty(name))
  {
    return eclass_bad;
  }

  EntityClasses::iterator i = g_entityClasses.find(name);
  if(i != g_entityClasses.end() && string_equal((*i).first, name))
  {
    return (*i).second;
  }

	EntityClass* e = EntityClass_Create_Default(name, has_brushes);
	return Eclass_InsertAlphabetized(e);
}
Пример #9
0
void Eclass_InitForSourceDirectory( const char *path ) {
	int c = declManager->GetNumDecls( DECL_ENTITYDEF );
	for( int i = 0; i < c; i++ ) {
		const idDeclEntityDef *def = static_cast<const idDeclEntityDef *>( declManager->DeclByIndex( DECL_ENTITYDEF, i ) );
		if( def ) {
			eclass_t *e = EClass_InitFromDict( &def->dict, def->GetName() );
			if( e ) {
				Eclass_InsertAlphabetized( e );
			}
		}
	}
	eclass_bad = EClass_Alloc();
	if( !eclass_bad ) {
		return;
	}
	eclass_bad->color.x = 0.0f;
	eclass_bad->color.y = 0.5f;
	eclass_bad->color.z = 0.0f;
	eclass_bad->fixedsize = false;
	eclass_bad->name = Mem_CopyString( "UKNOWN ENTITY CLASS" );
}
Пример #10
0
 void insert(EntityClass* eclass)
 {
   Eclass_InsertAlphabetized(eclass);
 }