Example #1
0
void realise(){
	if ( --m_unrealised == 0 ) {
		globalOutputStream() << "searching vfs directory " << makeQuoted( "def" ) << " for *.def\n";
		GlobalFileSystem().forEachFile( "def/", "def", makeCallbackF(EntityClassDoom3_loadFile) );

		{
			for ( Models::iterator i = g_models.begin(); i != g_models.end(); ++i )
			{
				Model_resolveInheritance( ( *i ).first.c_str(), ( *i ).second );
			}
		}
		{
			for ( EntityClasses::iterator i = g_EntityClassDoom3_classes.begin(); i != g_EntityClassDoom3_classes.end(); ++i )
			{
				EntityClass_resolveInheritance( ( *i ).second );
				if ( !string_empty( ( *i ).second->m_modelpath.c_str() ) ) {
					Models::iterator j = g_models.find( ( *i ).second->m_modelpath );
					if ( j != g_models.end() ) {
						( *i ).second->m_modelpath = ( *j ).second.m_mesh;
						( *i ).second->m_skin = ( *j ).second.m_skin;
					}
				}
				eclass_capture_state( ( *i ).second );

				StringOutputStream usage( 256 );

				usage << "-------- NOTES --------\n";

				if ( !string_empty( ( *i ).second->m_comments.c_str() ) ) {
					usage << ( *i ).second->m_comments.c_str() << "\n";
				}

				usage << "\n-------- KEYS --------\n";

				for ( EntityClassAttributes::iterator j = ( *i ).second->m_attributes.begin(); j != ( *i ).second->m_attributes.end(); ++j )
				{
					const char* name = EntityClassAttributePair_getName( *j );
					const char* description = EntityClassAttributePair_getDescription( *j );
					if ( !string_equal( name, description ) ) {
						usage << EntityClassAttributePair_getName( *j ) << " : " << EntityClassAttributePair_getDescription( *j ) << "\n";
					}
				}

				( *i ).second->m_comments = usage.c_str();
			}
		}

		m_observers.realise();
	}
}
Example #2
0
void Model_resolveInheritance( const char* name, Model& model ){
	if ( model.m_resolved == false ) {
		model.m_resolved = true;

		if ( !string_empty( model.m_parent.c_str() ) ) {
			Models::iterator i = g_models.find( model.m_parent );
			if ( i == g_models.end() ) {
				globalErrorStream() << "model " << name << " inherits unknown model " << model.m_parent.c_str() << "\n";
			}
			else
			{
				Model_resolveInheritance( ( *i ).first.c_str(), ( *i ).second );
				model.m_mesh = ( *i ).second.m_mesh;
				model.m_skin = ( *i ).second.m_skin;
			}
		}
	}
}