Ejemplo n.º 1
0
void ETextureThumbnail::Save(int age, LPCSTR path)
{
	if (!Valid()) 	return;

    CMemoryWriter F;
	F.open_chunk	(THM_CHUNK_VERSION);
	F.w_u16			(THM_TEXTURE_VERSION);
	F.close_chunk	();

/*
	F.w_chunk		(THM_CHUNK_DATA | CFS_CompressMark,m_Pixels.begin(),m_Pixels.size()*sizeof(u32));
*/        

    F.open_chunk	(THM_CHUNK_TYPE);
    F.w_u32			(m_Type);
	F.close_chunk	();

	m_TexParams.Save(F);

    string_path		fn;
    if (path)
        FS.update_path(fn, path, m_Name.c_str());
    else
    	FS.update_path(fn, _game_textures_, m_Name.c_str());

    if (F.save_to(fn))
    {
	    FS.set_file_age	(fn,age?age:m_Age);
    }else{
        Log			("!Can't save thumbnail:",fn);
    }
}
Ejemplo n.º 2
0
bool CPSLibrary::Save(const char* nm)
{
    CMemoryWriter F;

    F.open_chunk	(PS_CHUNK_VERSION);
    F.w_u16		(PS_VERSION);
    F.close_chunk	();

    F.open_chunk	(PS_CHUNK_SECONDGEN);
    u32 chunk_id = 0;
    for (PS::PEDIt it=m_PEDs.begin(); it!=m_PEDs.end(); ++it,++chunk_id)
    {
        F.open_chunk	(chunk_id);
        (*it)->Save	(F);
        F.close_chunk	();
    }
    F.close_chunk	();

    
    F.open_chunk	(PS_CHUNK_THIRDGEN);
    chunk_id = 0;
    for (PS::PGDIt g_it=m_PGDs.begin(); g_it!=m_PGDs.end(); ++g_it,++chunk_id)
    {
        F.open_chunk	(chunk_id);
        (*g_it)->Save	(F);
        F.close_chunk	();
    }
    F.close_chunk	();

    return F.save_to(nm);
}
Ejemplo n.º 3
0
void ELightAnimLibrary::Save()
{
	CMemoryWriter F;
    F.open_chunk	(CHUNK_VERSION);
    F.w_u16			(LANIM_VERSION);
	F.close_chunk	();
    F.open_chunk	(CHUNK_ITEM_LIST);
    int count = 0;
	for (LAItemIt it=Items.begin(); it!=Items.end(); it++){
        F.open_chunk(count++);
		(*it)->Save		(F);
        F.close_chunk();
    }
	F.close_chunk	();

	string_path		fn;
    FS.update_path	(fn,_game_data_,"lanims.xr");

    if (!F.save_to(fn))
        Log			("!Can't save color animations:",fn);
}
Ejemplo n.º 4
0
bool CGameMtlLibrary::Save()
{
	R_ASSERT			(FALSE==UpdateMtlPairs());
	// save
	CMemoryWriter fs;
    fs.open_chunk		(GAMEMTLS_CHUNK_VERSION);
    fs.w_u16			(GAMEMTL_CURRENT_VERSION);
	fs.close_chunk		();

    fs.open_chunk		(GAMEMTLS_CHUNK_AUTOINC);
    fs.w_u32			(material_index);
    fs.w_u32			(material_pair_index);
	fs.close_chunk		();
    
    fs.open_chunk		(GAMEMTLS_CHUNK_MTLS);
    int count = 0;
    for(GameMtlIt m_it=materials.begin(); m_it!=materials.end(); m_it++){
        fs.open_chunk	(count++);
        (*m_it)->Save	(fs);
        fs.close_chunk	();
    }
	fs.close_chunk		();
                                                    
    fs.open_chunk		(GAMEMTLS_CHUNK_MTLS_PAIR);
    count = 0;
    for(GameMtlPairIt p_it=material_pairs.begin(); p_it!=material_pairs.end(); p_it++){
        fs.open_chunk	(count++);
        (*p_it)->Save	(fs);
        fs.close_chunk	();
    }
	fs.close_chunk		();

	string_path fn;
    FS.update_path		(fn,_game_data_,GAMEMTL_FILENAME);
    return fs.save_to	(fn);
}