-void EntityClassFGD_parseClass( Tokeniser& tokeniser, bool fixedsize, bool isBase ){
- EntityClass* entityClass = Eclass_Alloc();
- entityClass->free = &Eclass_Free;
- entityClass->fixedsize = fixedsize;
- entityClass->inheritanceResolved = false;
- entityClass->mins = Vector3( -8, -8, -8 );
- entityClass->maxs = Vector3( 8, 8, 8 );
-
- for (;; )
- {
- const char* property = tokeniser.getToken();
- if ( string_equal( property, "=" ) ) {
- break;
- }
- else if ( string_equal( property, "base" ) ) {
- ASSERT_MESSAGE( EntityClassFGD_parseToken( tokeniser, "(" ), PARSE_ERROR );
- for (;; )
- {
- const char* base = tokeniser.getToken();
- if ( string_equal( base, ")" ) ) {
- break;
- }
- else if ( !string_equal( base, "," ) ) {
- entityClass->m_parent.push_back( base );
- }
- }
- }
- else if ( string_equal( property, "size" ) ) {
- entityClass->sizeSpecified = true;
- ASSERT_MESSAGE( EntityClassFGD_parseToken( tokeniser, "(" ), PARSE_ERROR );
- Tokeniser_getFloat( tokeniser, entityClass->mins.x() );
- Tokeniser_getFloat( tokeniser, entityClass->mins.y() );
- Tokeniser_getFloat( tokeniser, entityClass->mins.z() );
- const char* token = tokeniser.getToken();
- if ( string_equal( token, "," ) ) {
- Tokeniser_getFloat( tokeniser, entityClass->maxs.x() );
- Tokeniser_getFloat( tokeniser, entityClass->maxs.y() );
- Tokeniser_getFloat( tokeniser, entityClass->maxs.z() );
- ASSERT_MESSAGE( EntityClassFGD_parseToken( tokeniser, ")" ), PARSE_ERROR );
- }
- else
- {
- entityClass->maxs = entityClass->mins;
- vector3_negate( entityClass->mins );
- ASSERT_MESSAGE( string_equal( token, ")" ), "" );
- }
- }
- else if ( string_equal( property, "color" ) ) {
- entityClass->colorSpecified = true;
- ASSERT_MESSAGE( EntityClassFGD_parseToken( tokeniser, "(" ), PARSE_ERROR );
- Tokeniser_getFloat( tokeniser, entityClass->color.x() );
- entityClass->color.x() /= 256.0;
- Tokeniser_getFloat( tokeniser, entityClass->color.y() );
- entityClass->color.y() /= 256.0;
- Tokeniser_getFloat( tokeniser, entityClass->color.z() );
- entityClass->color.z() /= 256.0;
- ASSERT_MESSAGE( EntityClassFGD_parseToken( tokeniser, ")" ), PARSE_ERROR );
- }
- else if ( string_equal( property, "iconsprite" ) ) {
- ASSERT_MESSAGE( EntityClassFGD_parseToken( tokeniser, "(" ), PARSE_ERROR );
- StringOutputStream buffer( 256 );
- buffer << PathCleaned( tokeniser.getToken() );
- entityClass->m_modelpath = buffer.c_str();
- ASSERT_MESSAGE( EntityClassFGD_parseToken( tokeniser, ")" ), PARSE_ERROR );
- }
- else if ( string_equal( property, "sprite" )
- || string_equal( property, "decal" )
- // hl2 below
- || string_equal( property, "overlay" )
- || string_equal( property, "light" )
- || string_equal( property, "keyframe" )
- || string_equal( property, "animator" )
- || string_equal( property, "quadbounds" ) ) {
- ASSERT_MESSAGE( EntityClassFGD_parseToken( tokeniser, "(" ), PARSE_ERROR );
- ASSERT_MESSAGE( EntityClassFGD_parseToken( tokeniser, ")" ), PARSE_ERROR );
- }
- // hl2 below
- else if ( string_equal( property, "sphere" )
- || string_equal( property, "sweptplayerhull" )
- || string_equal( property, "studio" )
- || string_equal( property, "studioprop" )
- || string_equal( property, "lightprop" )
- || string_equal( property, "lightcone" )
- || string_equal( property, "sidelist" ) ) {
- ASSERT_MESSAGE( EntityClassFGD_parseToken( tokeniser, "(" ), PARSE_ERROR );
- if ( string_equal( tokeniser.getToken(), ")" ) ) {
- tokeniser.ungetToken();
- }
- ASSERT_MESSAGE( EntityClassFGD_parseToken( tokeniser, ")" ), PARSE_ERROR );
- }
- else if ( string_equal( property, "line" )
- || string_equal( property, "cylinder" ) ) {
- ASSERT_MESSAGE( EntityClassFGD_parseToken( tokeniser, "(" ), PARSE_ERROR );
- //const char* r =
- tokeniser.getToken();
- //const char* g =
- tokeniser.getToken();
- //const char* b =
- tokeniser.getToken();
- for (;; )
- {
- if ( string_equal( tokeniser.getToken(), ")" ) ) {
- tokeniser.ungetToken();
- break;
- }
- //const char* name =
- tokeniser.getToken();
- }
- ASSERT_MESSAGE( EntityClassFGD_parseToken( tokeniser, ")" ), PARSE_ERROR );
- }
- else if ( string_equal( property, "wirebox" ) ) {
- ASSERT_MESSAGE( EntityClassFGD_parseToken( tokeniser, "(" ), PARSE_ERROR );
- //const char* mins =
- tokeniser.getToken();
- ASSERT_MESSAGE( EntityClassFGD_parseToken( tokeniser, "," ), PARSE_ERROR );
- //const char* maxs =
- tokeniser.getToken();
- ASSERT_MESSAGE( EntityClassFGD_parseToken( tokeniser, ")" ), PARSE_ERROR );
- }
- else if ( string_equal( property, "halfgridsnap" ) ) {
- }
- else
- {
- ERROR_MESSAGE( PARSE_ERROR );
- }
- }
-
- entityClass->m_name = tokeniser.getToken();
-
- if ( !isBase ) {
- ASSERT_MESSAGE( EntityClassFGD_parseToken( tokeniser, ":" ), PARSE_ERROR );
-
- EntityClassFGD_parseSplitString( tokeniser, entityClass->m_comments );
- }
-
- tokeniser.nextLine();
-
- ASSERT_MESSAGE( EntityClassFGD_parseToken( tokeniser, "[" ), PARSE_ERROR );
-
- tokeniser.nextLine();
-
- for (;; )
- {
- CopiedString key = tokeniser.getToken();
- if ( string_equal( key.c_str(), "]" ) ) {
- tokeniser.nextLine();
- break;
- }
-
- if ( string_equal_nocase( key.c_str(), "input" )
- || string_equal_nocase( key.c_str(), "output" ) ) {
- const char* name = tokeniser.getToken();
- if ( !string_equal( name, "(" ) ) {
- ASSERT_MESSAGE( EntityClassFGD_parseToken( tokeniser, "(" ), PARSE_ERROR );
- //const char* type =
- tokeniser.getToken();
- ASSERT_MESSAGE( EntityClassFGD_parseToken( tokeniser, ")" ), PARSE_ERROR );
- const char* descriptionSeparator = tokeniser.getToken();
- if ( string_equal( descriptionSeparator, ":" ) ) {
- CopiedString description;
- EntityClassFGD_parseSplitString( tokeniser, description );
- }
- else
- {
- tokeniser.ungetToken();
- }
- tokeniser.nextLine();
- continue;
- }
- }
-
- ASSERT_MESSAGE( EntityClassFGD_parseToken( tokeniser, "(" ), PARSE_ERROR );
- CopiedString type = tokeniser.getToken();
- ASSERT_MESSAGE( EntityClassFGD_parseToken( tokeniser, ")" ), PARSE_ERROR );
-
- if ( string_equal_nocase( type.c_str(), "flags" ) ) {
- EntityClassAttribute attribute;
-
- ASSERT_MESSAGE( EntityClassFGD_parseToken( tokeniser, "=" ), PARSE_ERROR );
- tokeniser.nextLine();
- ASSERT_MESSAGE( EntityClassFGD_parseToken( tokeniser, "[" ), PARSE_ERROR );
- tokeniser.nextLine();
- for (;; )
- {
- const char* flag = tokeniser.getToken();
- if ( string_equal( flag, "]" ) ) {
- tokeniser.nextLine();
- break;
- }
- else
- {
- ASSERT_MESSAGE( EntityClassFGD_parseToken( tokeniser, ":" ), PARSE_ERROR );
- //const char* name =
- tokeniser.getToken();
- {
- const char* defaultSeparator = tokeniser.getToken();
- if ( string_equal( defaultSeparator, ":" ) ) {
- tokeniser.getToken();
- {
- const char* descriptionSeparator = tokeniser.getToken();
- if ( string_equal( descriptionSeparator, ":" ) ) {
- EntityClassFGD_parseSplitString( tokeniser, attribute.m_description );
- }
- else
- {
- tokeniser.ungetToken();
- }
- }
- }
- else
- {
- tokeniser.ungetToken();
- }
- }
- }
- tokeniser.nextLine();
- }
- EntityClass_insertAttribute( *entityClass, key.c_str(), attribute );
- }
- else if ( string_equal_nocase( type.c_str(), "choices" ) ) {
- EntityClassAttribute attribute;
-
- ASSERT_MESSAGE( EntityClassFGD_parseToken( tokeniser, ":" ), PARSE_ERROR );
- attribute.m_name = tokeniser.getToken();
- const char* valueSeparator = tokeniser.getToken();
- if ( string_equal( valueSeparator, ":" ) ) {
- const char* value = tokeniser.getToken();
- if ( !string_equal( value, ":" ) ) {
- attribute.m_value = value;
- }
- else
- {
- tokeniser.ungetToken();
- }
- {
- const char* descriptionSeparator = tokeniser.getToken();
- if ( string_equal( descriptionSeparator, ":" ) ) {
- EntityClassFGD_parseSplitString( tokeniser, attribute.m_description );
- }
- else
- {
- tokeniser.ungetToken();
- }
- }
- }
- else
- {
- tokeniser.ungetToken();
- }
- ASSERT_MESSAGE( EntityClassFGD_parseToken( tokeniser, "=" ), PARSE_ERROR );
- tokeniser.nextLine();
- ASSERT_MESSAGE( EntityClassFGD_parseToken( tokeniser, "[" ), PARSE_ERROR );
- tokeniser.nextLine();
-
- StringOutputStream listTypeName( 64 );
- listTypeName << entityClass->m_name.c_str() << "_" << attribute.m_name.c_str();
- attribute.m_type = listTypeName.c_str();
-
- ListAttributeType& listType = g_listTypesFGD[listTypeName.c_str()];
-
- for (;; )
- {
- const char* value = tokeniser.getToken();
- if ( string_equal( value, "]" ) ) {
- tokeniser.nextLine();
- break;
- }
- else
- {
- CopiedString tmp( value );
- ASSERT_MESSAGE( EntityClassFGD_parseToken( tokeniser, ":" ), PARSE_ERROR );
- const char* name = tokeniser.getToken();
- listType.push_back( name, tmp.c_str() );
- }
- tokeniser.nextLine();
- }
-
- for ( ListAttributeType::const_iterator i = listType.begin(); i != listType.end(); ++i )
- {
- if ( string_equal( attribute.m_value.c_str(), ( *i ).first.c_str() ) ) {
- attribute.m_value = ( *i ).second.c_str();
- }
- }
-
- EntityClass_insertAttribute( *entityClass, key.c_str(), attribute );
- }
- else if ( string_equal_nocase( type.c_str(), "decal" ) ) {
- }
- else if ( string_equal_nocase( type.c_str(), "string" )
- || string_equal_nocase( type.c_str(), "integer" )
- || string_equal_nocase( type.c_str(), "studio" )
- || string_equal_nocase( type.c_str(), "sprite" )
- || string_equal_nocase( type.c_str(), "color255" )
- || string_equal_nocase( type.c_str(), "target_source" )
- || string_equal_nocase( type.c_str(), "target_destination" )
- || string_equal_nocase( type.c_str(), "sound" )
- // hl2 below
- || string_equal_nocase( type.c_str(), "angle" )
- || string_equal_nocase( type.c_str(), "origin" )
- || string_equal_nocase( type.c_str(), "float" )
- || string_equal_nocase( type.c_str(), "node_dest" )
- || string_equal_nocase( type.c_str(), "filterclass" )
- || string_equal_nocase( type.c_str(), "vector" )
- || string_equal_nocase( type.c_str(), "sidelist" )
- || string_equal_nocase( type.c_str(), "material" )
- || string_equal_nocase( type.c_str(), "vecline" )
- || string_equal_nocase( type.c_str(), "axis" )
- || string_equal_nocase( type.c_str(), "npcclass" )
- || string_equal_nocase( type.c_str(), "target_name_or_class" )
- || string_equal_nocase( type.c_str(), "pointentityclass" )
- || string_equal_nocase( type.c_str(), "scene" ) ) {
- if ( !string_equal( tokeniser.getToken(), "readonly" ) ) {
- tokeniser.ungetToken();
- }
-
- ASSERT_MESSAGE( EntityClassFGD_parseToken( tokeniser, ":" ), PARSE_ERROR );
- const char* attributeType = "string";
- if ( string_equal_nocase( type.c_str(), "studio" ) ) {
- attributeType = "model";
- }
-
- EntityClassAttribute attribute;
- attribute.m_type = attributeType;
- attribute.m_name = tokeniser.getToken();
-
- const char* defaultSeparator = tokeniser.getToken();
- if ( string_equal( defaultSeparator, ":" ) ) {
- const char* value = tokeniser.getToken();
- if ( !string_equal( value, ":" ) ) {
- attribute.m_value = value;
- }
- else
- {
- tokeniser.ungetToken();
- }
-
- {
- const char* descriptionSeparator = tokeniser.getToken();
- if ( string_equal( descriptionSeparator, ":" ) ) {
- EntityClassFGD_parseSplitString( tokeniser, attribute.m_description );
- }
- else
- {
- tokeniser.ungetToken();
- }
- }
- }
- else
- {
- tokeniser.ungetToken();
- }
- EntityClass_insertAttribute( *entityClass, key.c_str(), attribute );
- }
- else
- {
- ERROR_MESSAGE( "unknown key type: " << makeQuoted( type.c_str() ) );
- }
- tokeniser.nextLine();
- }
-
- if ( isBase ) {
- EntityClassFGD_insertUniqueBase( entityClass );
- }
- else
- {
- EntityClassFGD_insertUnique( entityClass );
- }
+void EntityClassFGD_parseClass(Tokeniser &tokeniser, bool fixedsize, bool isBase)
+{
+ EntityClass *entityClass = Eclass_Alloc();
+ entityClass->free = &Eclass_Free;
+ entityClass->fixedsize = fixedsize;
+ entityClass->inheritanceResolved = false;
+ entityClass->mins = Vector3(-8, -8, -8);
+ entityClass->maxs = Vector3(8, 8, 8);
+
+ for (;;) {
+ const char *property = tokeniser.getToken();
+ if (string_equal(property, "=")) {
+ break;
+ } else if (string_equal(property, "base")) {
+ ASSERT_MESSAGE(EntityClassFGD_parseToken(tokeniser, "("), PARSE_ERROR);
+ for (;;) {
+ const char *base = tokeniser.getToken();
+ if (string_equal(base, ")")) {
+ break;
+ } else if (!string_equal(base, ",")) {
+ entityClass->m_parent.push_back(base);
+ }
+ }
+ } else if (string_equal(property, "size")) {
+ entityClass->sizeSpecified = true;
+ ASSERT_MESSAGE(EntityClassFGD_parseToken(tokeniser, "("), PARSE_ERROR);
+ Tokeniser_getFloat(tokeniser, entityClass->mins.x());
+ Tokeniser_getFloat(tokeniser, entityClass->mins.y());
+ Tokeniser_getFloat(tokeniser, entityClass->mins.z());
+ const char *token = tokeniser.getToken();
+ if (string_equal(token, ",")) {
+ Tokeniser_getFloat(tokeniser, entityClass->maxs.x());
+ Tokeniser_getFloat(tokeniser, entityClass->maxs.y());
+ Tokeniser_getFloat(tokeniser, entityClass->maxs.z());
+ ASSERT_MESSAGE(EntityClassFGD_parseToken(tokeniser, ")"), PARSE_ERROR);
+ } else {
+ entityClass->maxs = entityClass->mins;
+ vector3_negate(entityClass->mins);
+ ASSERT_MESSAGE(string_equal(token, ")"), "");
+ }
+ } else if (string_equal(property, "color")) {
+ entityClass->colorSpecified = true;
+ ASSERT_MESSAGE(EntityClassFGD_parseToken(tokeniser, "("), PARSE_ERROR);
+ Tokeniser_getFloat(tokeniser, entityClass->color.x());
+ entityClass->color.x() /= 256.0;
+ Tokeniser_getFloat(tokeniser, entityClass->color.y());
+ entityClass->color.y() /= 256.0;
+ Tokeniser_getFloat(tokeniser, entityClass->color.z());
+ entityClass->color.z() /= 256.0;
+ ASSERT_MESSAGE(EntityClassFGD_parseToken(tokeniser, ")"), PARSE_ERROR);
+ } else if (string_equal(property, "iconsprite")) {
+ ASSERT_MESSAGE(EntityClassFGD_parseToken(tokeniser, "("), PARSE_ERROR);
+ StringOutputStream buffer(256);
+ buffer << PathCleaned(tokeniser.getToken());
+ entityClass->m_modelpath = buffer.c_str();
+ ASSERT_MESSAGE(EntityClassFGD_parseToken(tokeniser, ")"), PARSE_ERROR);
+ } else if (string_equal(property, "sprite")
+ || string_equal(property, "decal")
+ // hl2 below
+ || string_equal(property, "overlay")
+ || string_equal(property, "light")
+ || string_equal(property, "keyframe")
+ || string_equal(property, "animator")
+ || string_equal(property, "quadbounds")) {
+ ASSERT_MESSAGE(EntityClassFGD_parseToken(tokeniser, "("), PARSE_ERROR);
+ ASSERT_MESSAGE(EntityClassFGD_parseToken(tokeniser, ")"), PARSE_ERROR);
+ }
+ // hl2 below
+ else if (string_equal(property, "sphere")
+ || string_equal(property, "sweptplayerhull")
+ || string_equal(property, "studio")
+ || string_equal(property, "studioprop")
+ || string_equal(property, "lightprop")
+ || string_equal(property, "lightcone")
+ || string_equal(property, "sidelist")) {
+ ASSERT_MESSAGE(EntityClassFGD_parseToken(tokeniser, "("), PARSE_ERROR);
+ if (string_equal(tokeniser.getToken(), ")")) {
+ tokeniser.ungetToken();
+ }
+ ASSERT_MESSAGE(EntityClassFGD_parseToken(tokeniser, ")"), PARSE_ERROR);
+ } else if (string_equal(property, "line")
+ || string_equal(property, "cylinder")) {
+ ASSERT_MESSAGE(EntityClassFGD_parseToken(tokeniser, "("), PARSE_ERROR);
+ //const char* r =
+ tokeniser.getToken();
+ //const char* g =
+ tokeniser.getToken();
+ //const char* b =
+ tokeniser.getToken();
+ for (;;) {
+ if (string_equal(tokeniser.getToken(), ")")) {
+ tokeniser.ungetToken();
+ break;
+ }
+ //const char* name =
+ tokeniser.getToken();
+ }
+ ASSERT_MESSAGE(EntityClassFGD_parseToken(tokeniser, ")"), PARSE_ERROR);
+ } else if (string_equal(property, "wirebox")) {
+ ASSERT_MESSAGE(EntityClassFGD_parseToken(tokeniser, "("), PARSE_ERROR);
+ //const char* mins =
+ tokeniser.getToken();
+ ASSERT_MESSAGE(EntityClassFGD_parseToken(tokeniser, ","), PARSE_ERROR);
+ //const char* maxs =
+ tokeniser.getToken();
+ ASSERT_MESSAGE(EntityClassFGD_parseToken(tokeniser, ")"), PARSE_ERROR);
+ } else if (string_equal(property, "halfgridsnap")) {
+ } else {
+ ERROR_MESSAGE(PARSE_ERROR);
+ }
+ }
+
+ entityClass->m_name = tokeniser.getToken();
+
+ if (!isBase) {
+ ASSERT_MESSAGE(EntityClassFGD_parseToken(tokeniser, ":"), PARSE_ERROR);
+
+ EntityClassFGD_parseSplitString(tokeniser, entityClass->m_comments);
+ }
+
+ tokeniser.nextLine();
+
+ ASSERT_MESSAGE(EntityClassFGD_parseToken(tokeniser, "["), PARSE_ERROR);
+
+ tokeniser.nextLine();
+
+ for (;;) {
+ CopiedString key = tokeniser.getToken();
+ if (string_equal(key.c_str(), "]")) {
+ tokeniser.nextLine();
+ break;
+ }
+
+ if (string_equal_nocase(key.c_str(), "input")
+ || string_equal_nocase(key.c_str(), "output")) {
+ const char *name = tokeniser.getToken();
+ if (!string_equal(name, "(")) {
+ ASSERT_MESSAGE(EntityClassFGD_parseToken(tokeniser, "("), PARSE_ERROR);
+ //const char* type =
+ tokeniser.getToken();
+ ASSERT_MESSAGE(EntityClassFGD_parseToken(tokeniser, ")"), PARSE_ERROR);
+ const char *descriptionSeparator = tokeniser.getToken();
+ if (string_equal(descriptionSeparator, ":")) {
+ CopiedString description;
+ EntityClassFGD_parseSplitString(tokeniser, description);
+ } else {
+ tokeniser.ungetToken();
+ }
+ tokeniser.nextLine();
+ continue;
+ }
+ }
+
+ ASSERT_MESSAGE(EntityClassFGD_parseToken(tokeniser, "("), PARSE_ERROR);
+ CopiedString type = tokeniser.getToken();
+ ASSERT_MESSAGE(EntityClassFGD_parseToken(tokeniser, ")"), PARSE_ERROR);
+
+ if (string_equal_nocase(type.c_str(), "flags")) {
+ EntityClassAttribute attribute;
+
+ ASSERT_MESSAGE(EntityClassFGD_parseToken(tokeniser, "="), PARSE_ERROR);
+ tokeniser.nextLine();
+ ASSERT_MESSAGE(EntityClassFGD_parseToken(tokeniser, "["), PARSE_ERROR);
+ tokeniser.nextLine();
+ for (;;) {
+ const char *flag = tokeniser.getToken();
+ if (string_equal(flag, "]")) {
+ tokeniser.nextLine();
+ break;
+ } else {
+ ASSERT_MESSAGE(EntityClassFGD_parseToken(tokeniser, ":"), PARSE_ERROR);
+ //const char* name =
+ tokeniser.getToken();
+ {
+ const char *defaultSeparator = tokeniser.getToken();
+ if (string_equal(defaultSeparator, ":")) {
+ tokeniser.getToken();
+ {
+ const char *descriptionSeparator = tokeniser.getToken();
+ if (string_equal(descriptionSeparator, ":")) {
+ EntityClassFGD_parseSplitString(tokeniser, attribute.m_description);
+ } else {
+ tokeniser.ungetToken();
+ }
+ }
+ } else {
+ tokeniser.ungetToken();
+ }
+ }
+ }
+ tokeniser.nextLine();
+ }
+ EntityClass_insertAttribute(*entityClass, key.c_str(), attribute);
+ } else if (string_equal_nocase(type.c_str(), "choices")) {
+ EntityClassAttribute attribute;
+
+ ASSERT_MESSAGE(EntityClassFGD_parseToken(tokeniser, ":"), PARSE_ERROR);
+ attribute.m_name = tokeniser.getToken();
+ const char *valueSeparator = tokeniser.getToken();
+ if (string_equal(valueSeparator, ":")) {
+ const char *value = tokeniser.getToken();
+ if (!string_equal(value, ":")) {
+ attribute.m_value = value;
+ } else {
+ tokeniser.ungetToken();
+ }
+ {
+ const char *descriptionSeparator = tokeniser.getToken();
+ if (string_equal(descriptionSeparator, ":")) {
+ EntityClassFGD_parseSplitString(tokeniser, attribute.m_description);
+ } else {
+ tokeniser.ungetToken();
+ }
+ }
+ } else {
+ tokeniser.ungetToken();
+ }
+ ASSERT_MESSAGE(EntityClassFGD_parseToken(tokeniser, "="), PARSE_ERROR);
+ tokeniser.nextLine();
+ ASSERT_MESSAGE(EntityClassFGD_parseToken(tokeniser, "["), PARSE_ERROR);
+ tokeniser.nextLine();
+
+ StringOutputStream listTypeName(64);
+ listTypeName << entityClass->m_name.c_str() << "_" << attribute.m_name.c_str();
+ attribute.m_type = listTypeName.c_str();
+
+ ListAttributeType &listType = g_listTypesFGD[listTypeName.c_str()];
+
+ for (;;) {
+ const char *value = tokeniser.getToken();
+ if (string_equal(value, "]")) {
+ tokeniser.nextLine();
+ break;
+ } else {
+ CopiedString tmp(value);
+ ASSERT_MESSAGE(EntityClassFGD_parseToken(tokeniser, ":"), PARSE_ERROR);
+ const char *name = tokeniser.getToken();
+ listType.push_back(name, tmp.c_str());
+ }
+ tokeniser.nextLine();
+ }
+
+ for (ListAttributeType::const_iterator i = listType.begin(); i != listType.end(); ++i) {
+ if (string_equal(attribute.m_value.c_str(), (*i).first.c_str())) {
+ attribute.m_value = (*i).second.c_str();
+ }
+ }
+
+ EntityClass_insertAttribute(*entityClass, key.c_str(), attribute);
+ } else if (string_equal_nocase(type.c_str(), "decal")) {
+ } else if (string_equal_nocase(type.c_str(), "string")
+ || string_equal_nocase(type.c_str(), "integer")
+ || string_equal_nocase(type.c_str(), "studio")
+ || string_equal_nocase(type.c_str(), "sprite")
+ || string_equal_nocase(type.c_str(), "color255")
+ || string_equal_nocase(type.c_str(), "target_source")
+ || string_equal_nocase(type.c_str(), "target_destination")
+ || string_equal_nocase(type.c_str(), "sound")
+ // hl2 below
+ || string_equal_nocase(type.c_str(), "angle")
+ || string_equal_nocase(type.c_str(), "origin")
+ || string_equal_nocase(type.c_str(), "float")
+ || string_equal_nocase(type.c_str(), "node_dest")
+ || string_equal_nocase(type.c_str(), "filterclass")
+ || string_equal_nocase(type.c_str(), "vector")
+ || string_equal_nocase(type.c_str(), "sidelist")
+ || string_equal_nocase(type.c_str(), "material")
+ || string_equal_nocase(type.c_str(), "vecline")
+ || string_equal_nocase(type.c_str(), "axis")
+ || string_equal_nocase(type.c_str(), "npcclass")
+ || string_equal_nocase(type.c_str(), "target_name_or_class")
+ || string_equal_nocase(type.c_str(), "pointentityclass")
+ || string_equal_nocase(type.c_str(), "scene")) {
+ if (!string_equal(tokeniser.getToken(), "readonly")) {
+ tokeniser.ungetToken();
+ }
+
+ ASSERT_MESSAGE(EntityClassFGD_parseToken(tokeniser, ":"), PARSE_ERROR);
+ const char *attributeType = "string";
+ if (string_equal_nocase(type.c_str(), "studio")) {
+ attributeType = "model";
+ }
+
+ EntityClassAttribute attribute;
+ attribute.m_type = attributeType;
+ attribute.m_name = tokeniser.getToken();
+
+ const char *defaultSeparator = tokeniser.getToken();
+ if (string_equal(defaultSeparator, ":")) {
+ const char *value = tokeniser.getToken();
+ if (!string_equal(value, ":")) {
+ attribute.m_value = value;
+ } else {
+ tokeniser.ungetToken();
+ }
+
+ {
+ const char *descriptionSeparator = tokeniser.getToken();
+ if (string_equal(descriptionSeparator, ":")) {
+ EntityClassFGD_parseSplitString(tokeniser, attribute.m_description);
+ } else {
+ tokeniser.ungetToken();
+ }
+ }
+ } else {
+ tokeniser.ungetToken();
+ }
+ EntityClass_insertAttribute(*entityClass, key.c_str(), attribute);
+ } else {
+ ERROR_MESSAGE("unknown key type: " << makeQuoted(type.c_str()));
+ }
+ tokeniser.nextLine();
+ }
+
+ if (isBase) {
+ EntityClassFGD_insertUniqueBase(entityClass);
+ } else {
+ EntityClassFGD_insertUnique(entityClass);
+ }