Example #1
0
static inline bool match_shader_id	( LPCSTR const debug_shader_id, LPCSTR const full_shader_id, FS_FileSet const& file_set, string_path& result )
{
#if 0
	strcpy_s					( result, "" );
	return						false;
#else // #if 1
#ifdef DEBUG
	LPCSTR temp					= "";
	bool found					= false;
	FS_FileSet::const_iterator	i = file_set.begin();
	FS_FileSet::const_iterator	const e = file_set.end();
	for ( ; i != e; ++i ) {
		if ( match_shader(debug_shader_id, full_shader_id, (*i).name.c_str(), (*i).name.size() ) ) {
			VERIFY				( !found );
			found				= true;
			temp				= (*i).name.c_str();
		}
	}

	xr_strcpy					( result, temp );
	return						found;
#else // #ifdef DEBUG
	FS_FileSet::const_iterator	i = file_set.begin();
	FS_FileSet::const_iterator	const e = file_set.end();
	for ( ; i != e; ++i ) {
		if ( match_shader(debug_shader_id, full_shader_id, (*i).name.c_str(), (*i).name.size() ) ) {
			xr_strcpy			( result, (*i).name.c_str() );
			return				true;
		}
	}

	return						false;
#endif // #ifdef DEBUG
#endif// #if 1
}
Example #2
0
void __fastcall TfraLeftBar::SyncTHM1Click(TObject *Sender)
{
        FS_FileSet      files;
        FS.file_list    (files,_textures_,FS_ListFiles,"*.thm");
        FS_FileSet::iterator I = files.begin();
        FS_FileSet::iterator E = files.end();

        for(; I!=E; ++I)
        {
                ETextureThumbnail* TH = xr_new<ETextureThumbnail>( (*I).name.c_str(), false);
                TH->Load((*I).name.c_str(),_textures_);
                TH->Save();
                xr_delete(TH);
        }
}
Example #3
0
void CMainMenu::ReadTextureInfo()
{
	FS_FileSet fset;
	FS.file_list(fset, "$game_config$", FS_ListFiles,"ui\\textures_descr\\*.xml");
	FS_FileSetIt fit	= fset.begin();
	FS_FileSetIt fit_e	= fset.end();

	for( ;fit!=fit_e; ++fit)
	{
    	string_path	fn1, fn2,fn3;
        _splitpath	((*fit).name.c_str(),fn1,fn2,fn3,0);
		xr_strcat(fn3,".xml");

		CUITextureMaster::ParseShTexInfo(fn3);
	}

}
Example #4
0
void __fastcall TfrmImageLib::UpdateLib()
{
    VERIFY			(!bReadonlyMode);
    RegisterModifiedTHM	        ();
    SaveUsedTHM			();
    if (bImportMode && !texture_map.empty())
    {
    	AStringVec modif;
        LockForm();
        ImageLib.SafeCopyLocalToServer(texture_map);
		// rename with folder
        FS_FileSet files        = texture_map;
        texture_map.clear       ();
        xr_string               fn;
        FS_FileSetIt it         = files.begin();
        FS_FileSetIt _E         = files.end();

        for (;it!=_E; it++)
        {
            fn                  = EFS.ChangeFileExt(it->name.c_str(),"");
            ImageLib.UpdateFileName(fn);
            FS_File		F(*it);
            F.name		= fn;
            texture_map.insert  (F);
        }
        // sync
	ImageLib.SynchronizeTextures(true,true,true,&texture_map,&modif);
        UnlockForm              ();
    	ImageLib.RefreshTextures(&modif);
    }else
    {
    // save game textures
        if (modif_map.size())
        {
            AStringVec modif;
	    LockForm();
            ImageLib.SynchronizeTextures(true,true,true,&modif_map,&modif);
            UnlockForm();
            ImageLib.RefreshTextures(&modif);
        }
    }
}
Example #5
0
void CMapListHelper::Load()
{
	string_path					fn;
	FS.update_path				(fn, "$game_config$", "mp\\map_list.ltx");
	CInifile map_list_cfg		(fn);

	//read weathers set
	CInifile::Sect w			= map_list_cfg.r_section("weather");
	CInifile::SectCIt wi		= w.Data.begin();
	CInifile::SectCIt wi_e		= w.Data.end();
	for( ;wi!=wi_e; ++wi)
	{
		m_weathers.resize		(m_weathers.size()+1);
		SGameWeathers& gw		= m_weathers.back();
		gw.m_weather_name		= (*wi).first;
		gw.m_start_time			= (*wi).second;
	}

	// scan for additional maps
	FS_FileSet			fset;
	FS.file_list		(fset,"$game_levels$",FS_ListFiles,"*level.ltx");

	FS_FileSetIt fit	= fset.begin();
	FS_FileSetIt fit_e	= fset.end();

	for( ;fit!=fit_e; ++fit)
	{
		string_path					map_cfg_fn;
		FS.update_path				(map_cfg_fn, "$game_levels$", (*fit).name.c_str());
		LoadMapInfo					(map_cfg_fn, (*fit).name);
	}
	//scan all not laoded archieves
	LPCSTR tmp_entrypoint			= "temporary_gamedata\\";
	FS_Path* game_levels			= FS.get_path("$game_levels$");
	xr_string prev_root				= game_levels->m_Root;
	game_levels->_set_root			(tmp_entrypoint);

	CLocatorAPI::archives_it it		= FS.m_archives.begin();
	CLocatorAPI::archives_it it_e	= FS.m_archives.end();

	for(;it!=it_e;++it)
	{
		CLocatorAPI::archive& A		= *it;
		if(A.hSrcFile)				continue;

		LPCSTR ln					= A.header->r_string("header", "level_name");
		LPCSTR lv					= A.header->r_string("header", "level_ver");
		FS.LoadArchive				(A, tmp_entrypoint);

		string_path					map_cfg_fn;
		FS.update_path				(map_cfg_fn, "$game_levels$", ln);

		
		xr_strcat					(map_cfg_fn,"\\level.ltx");
		LoadMapInfo					(map_cfg_fn, ln, lv);
		FS.unload_archive			(A);
	}
	game_levels->_set_root			(prev_root.c_str());


	R_ASSERT2	(m_storage.size(), "unable to fill map list");
	R_ASSERT2	(m_weathers.size(), "unable to fill weathers list");
}
Example #6
0
void CTextureDescrMngr::LoadTHM()
{
	FS_FileSet				flist;
	FS.file_list			(flist,"$game_textures$",FS_ListFiles,"*.thm");
	Msg						("count of .thm files=%d", flist.size());
	FS_FileSetIt It			= flist.begin();
	FS_FileSetIt It_e		= flist.end();
	STextureParams			tp;
	string_path				fn;
	for(;It!=It_e;++It)
	{
		
		FS.update_path		(fn,"$game_textures$", (*It).name.c_str());
		IReader* F			= FS.r_open(fn);
		strcpy_s				(fn,(*It).name.c_str());
		fix_texture_thm_name(fn);

		R_ASSERT			(F->find_chunk(THM_CHUNK_TYPE));
		F->r_u32			();
		tp.Clear			();
		tp.Load				(*F);
		FS.r_close			(F);
#ifdef _EDITOR
		texture_desc& desc		= m_texture_details[fn];
                desc.m_type                     = tp.type;
#endif
		if (STextureParams::ttImage		== tp.fmt ||
			STextureParams::ttTerrain	== tp.fmt ||
			STextureParams::ttNormalMap	== tp.fmt	)
		{
#ifndef _EDITOR
		texture_desc& desc		 = m_texture_details[fn];
#endif

			if( tp.detail_name.size() &&
				tp.flags.is_any(STextureParams::flDiffuseDetail|STextureParams::flBumpDetail) )
			{
				if(desc.m_assoc)
					xr_delete				(desc.m_assoc);

				desc.m_assoc				= xr_new<texture_assoc>();
				desc.m_assoc->detail_name	= tp.detail_name;
				desc.m_assoc->cs			= xr_new<cl_dt_scaler>(tp.detail_scale);
				desc.m_assoc->usage			= 0;
				
				if( tp.flags.is(STextureParams::flDiffuseDetail) )
					desc.m_assoc->usage		|= (1<<0);
				
				if( tp.flags.is(STextureParams::flBumpDetail) )
					desc.m_assoc->usage		|= (1<<1);

			}
			if(desc.m_spec)
				xr_delete				(desc.m_spec);

			desc.m_spec					= xr_new<texture_spec>();
			desc.m_spec->m_material		= tp.material+tp.material_weight;
			
			if(tp.bump_mode==STextureParams::tbmUse)
				desc.m_spec->m_bump_name	= tp.bump_name;
		}
	}
}