当前位置: 首页>>代码示例>>C++>>正文


C++ IReader类代码示例

本文整理汇总了C++中IReader的典型用法代码示例。如果您正苦于以下问题:C++ IReader类的具体用法?C++ IReader怎么用?C++ IReader使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了IReader类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: switch

u32 STextureParams::MemoryUsage(LPCSTR base_name)
{
	u32 mem_usage	= width*height*4;
	if (flags.test(flGenerateMipMaps))	{ mem_usage*=3ul; mem_usage/=2ul; }
    switch (fmt){
    case STextureParams::tfDXT1:
    case STextureParams::tfADXT1: 	mem_usage/=6; break;
    case STextureParams::tfDXT3:
    case STextureParams::tfDXT5: 	mem_usage/=4; break;
    case STextureParams::tf4444:
    case STextureParams::tf1555:
    case STextureParams::tf565: 	mem_usage/=2; break;
    case STextureParams::tfRGBA:	break;
    }
    xr_string fn;
    FS.update_path	(fn,_game_textures_,EFS.ChangeFileExt(base_name,".seq").c_str());
    if (FS.exist(fn.c_str())){
        string128		buffer;
        IReader* F		= FS.r_open(0,fn.c_str());
        F->r_string		(buffer,sizeof(buffer));
        int cnt = 0;
        while (!F->eof()){
            F->r_string(buffer,sizeof(buffer));
            cnt++;
        }
        FS.r_close		(F);
        mem_usage *= cnt?cnt:1;
    }
    return mem_usage;
}
开发者ID:NeoAnomaly,项目名称:xray,代码行数:30,代码来源:ETextureParams.cpp

示例2: Load

void PDomain::Load(IReader& F)
{
	type		= PDomainEnum(F.r_u32());
	F.r_fvector3(v[0]);
	F.r_fvector3(v[1]);
	F.r_fvector3(v[2]);
}
开发者ID:AntonioModer,项目名称:xray-16,代码行数:7,代码来源:pDomain.cpp

示例3: strext

void CObjectAnimator::LoadMotions(LPCSTR fname)
{
	string_path			full_path;
	if (!FS.exist( full_path, "$level$", fname ))
		if (!FS.exist( full_path, "$game_anims$", fname ))
			Debug.fatal(DEBUG_INFO,"Can't find motion file '%s'.",fname);
            
    LPCSTR  ext			= strext(full_path);
    if (ext){
		Clear			();
    	if (0==xr_strcmp(ext,".anm")){
            COMotion* M	= xr_new<COMotion> ();
            if (M->LoadMotion(full_path)) m_Motions.push_back(M);
            else				FATAL("ERROR: Can't load motion. Incorrect file version.");
        }else if (0==xr_strcmp(ext,".anms")){
            IReader* F			= FS.r_open(full_path);
            u32 dwMCnt			= F->r_u32(); VERIFY(dwMCnt);
            for (u32 i=0; i<dwMCnt; i++){
                COMotion* M		= xr_new<COMotion> ();
                bool bRes		= M->Load(*F);
                if (!bRes)		FATAL("ERROR: Can't load motion. Incorrect file version.");
                m_Motions.push_back(M);
            }
            FS.r_close		(F);
        }
        std::sort(m_Motions.begin(),m_Motions.end(),motion_sort_pred);
    }
}
开发者ID:NeoAnomaly,项目名称:xray,代码行数:28,代码来源:ObjectAnimator.cpp

示例4: VERIFY

void TClipMaker::LoadClips()
{
    bool bRes=true;
	if (EFS.GetOpenName("$clips$",m_ClipFName)){
    	Clear		();
    	IReader* F	= FS.r_open(m_ClipFName.c_str()); VERIFY(F);
        m_ClipFName	= EFS.ExcludeBasePath(m_ClipFName.c_str(),FS.get_path("$clips$")->m_Path);
        if (F->find_chunk(CHUNK_ZOOM)){
        	m_Zoom	= F->r_float();
        }
        IReader* C 	= F->open_chunk(CHUNK_CLIPS);
        if(C){
            IReader* M   = C->open_chunk(0);
            for (int count=1; M; count++) {
                CUIClip* clip	= xr_new<CUIClip>(this,count);
                if (!clip->Load(*M)){
                    ELog.Msg(mtError,"Unsupported clip version. Load failed.");
                    xr_delete(clip);
                    bRes = false;
                }
                M->close();
                if (!bRes)	break;
                clips.push_back(clip);
                M = C->open_chunk(count);
            }
            C->close	();
            UpdateClips	();
        }
        FS.r_close(F);
    }
}
开发者ID:2asoft,项目名称:xray,代码行数:31,代码来源:ClipEditor.cpp

示例5: Load

bool CGlow::Load(IReader& F)
{
	u32 version = 0;

    R_ASSERT(F.r_chunk(GLOW_CHUNK_VERSION,&version));
    if((version!=0x0011)&&(version!=GLOW_VERSION)){
        ELog.DlgMsg( mtError, "CGlow: Unsupported version.");
        return false;
    }

	CCustomObject::Load(F);

    if (F.find_chunk(GLOW_CHUNK_SHADER)){
    	F.r_stringZ (m_ShaderName);
    }

    R_ASSERT(F.find_chunk(GLOW_CHUNK_TEXTURE));
	F.r_stringZ	(m_TexName);

    R_ASSERT(F.find_chunk(GLOW_CHUNK_PARAMS));
	m_fRadius  		= F.r_float();
	if (version==0x0011){
		F.r_fvector3	(FPosition);
        UpdateTransform();
    }

    if (F.find_chunk(GLOW_CHUNK_FLAGS))
    	m_Flags.assign	(F.r_u16());

    return true;
}
开发者ID:OLR-xray,项目名称:OLR-3.0,代码行数:31,代码来源:glow.cpp

示例6: _Width

int ETextureThumbnail::MemoryUsage()
{
	int mem_usage = _Width()*_Height()*4;
    switch (m_TexParams.fmt){
    case STextureParams::tfDXT1:
    case STextureParams::tfADXT1: 	mem_usage/=6; break;
    case STextureParams::tfDXT3:
    case STextureParams::tfDXT5: 	mem_usage/=4; break;
    case STextureParams::tf4444:
    case STextureParams::tf1555:
    case STextureParams::tf565: 	mem_usage/=2; break;
    case STextureParams::tfRGBA:	break;
    }
    string_path fn;
    FS.update_path	(fn,_game_textures_,EFS.ChangeFileExt(m_Name.c_str(),".seq").c_str());
    if (FS.exist(fn))
    {
        string128		buffer;
        IReader* F		= FS.r_open(0,fn);
        F->r_string		(buffer,sizeof(buffer));
        int cnt = 0;
        while (!F->eof()){
            F->r_string(buffer,sizeof(buffer));
            cnt++;
        }
        FS.r_close		(F);
        mem_usage *= cnt?cnt:1;
    }
    return mem_usage;
}
开发者ID:OLR-xray,项目名称:OLR-3.0,代码行数:30,代码来源:EThumbnailTexture.cpp

示例7: Load

bool EParticlesObject::Load(IReader& F)
{
	u32 version = 0;

    R_ASSERT(F.r_chunk(CPSOBJECT_CHUNK_VERSION,&version));
    if( version!=CPSOBJECT_VERSION ){
        ELog.DlgMsg( mtError, "PSObject: Unsupported version.");
        return false;
    }

	inherited::Load(F);

    R_ASSERT(F.find_chunk(CPSOBJECT_CHUNK_REFERENCE));
    F.r_stringZ(m_RefName);
    if (!Compile(*m_RefName)){
        ELog.DlgMsg( mtError, "EParticlesObject: '%s' not found in library", *m_RefName );
        return false;
    }

    if (F.find_chunk(CPSOBJECT_CHUNK_PARAMS)){
//.    	if (m_Particles) m_Particles->m_RT_Flags.set(F.r_u32());
    }

    return true;
}
开发者ID:NeoAnomaly,项目名称:xray,代码行数:25,代码来源:EParticlesObject.cpp

示例8: Msg

/*
void dump	(CDetailManager::vis_list& lst)
{
	for (int i=0; i<lst.size(); i++)
	{
		Msg("%8x / %8x / %8x",	lst[i]._M_start, lst[i]._M_finish, lst[i]._M_end_of_storage._M_data);
	}
}
*/
void CDetailManager::Load		()
{
	// Open file stream
	if (!FS.exist("$level$","level.details"))
	{
		dtFS	= NULL;
		return;
	}

	string256			fn;
	FS.update_path		(fn,"$level$","level.details");
	dtFS				= FS.r_open(fn);

	// Header
	dtFS->r_chunk_safe	(0,&dtH,sizeof(dtH));
	R_ASSERT			(dtH.version == DETAIL_VERSION);
	u32 m_count			= dtH.object_count;

	// Models
	IReader* m_fs		= dtFS->open_chunk(1);
	for (u32 m_id = 0; m_id < m_count; m_id++)
	{
		CDetail*		dt	= xr_new<CDetail> ();
		IReader* S			= m_fs->open_chunk(m_id);
		dt->Load			(S);
		objects.push_back	(dt);
		S->close			();
	}
	m_fs->close		();

	// Get pointer to database (slots)
	IReader* m_slots	= dtFS->open_chunk(2);
	dtSlots				= (DetailSlot*)m_slots->pointer();
	m_slots->close		();

	// Initialize 'vis' and 'cache'
	for (u32 i=0; i<3; ++i)	visible[i].resize(objects.size());
	cache_Initialize	();

	// Make dither matrix
	bwdithermap		(2,dither);

	// Hardware specific optimizations
	if (UseVS())	hw_Load		();
	else			soft_Load	();

	// swing desc
	// normal
	swing_desc[0].amp1	= pSettings->r_float("details","swing_normal_amp1");
	swing_desc[0].amp2	= pSettings->r_float("details","swing_normal_amp2");
	swing_desc[0].rot1	= pSettings->r_float("details","swing_normal_rot1");
	swing_desc[0].rot2	= pSettings->r_float("details","swing_normal_rot2");
	swing_desc[0].speed	= pSettings->r_float("details","swing_normal_speed");
	// fast
	swing_desc[1].amp1	= pSettings->r_float("details","swing_fast_amp1");
	swing_desc[1].amp2	= pSettings->r_float("details","swing_fast_amp2");
	swing_desc[1].rot1	= pSettings->r_float("details","swing_fast_rot1");
	swing_desc[1].rot2	= pSettings->r_float("details","swing_fast_rot2");
	swing_desc[1].speed	= pSettings->r_float("details","swing_fast_speed");
}
开发者ID:OLR-xray,项目名称:XRay-NEW,代码行数:69,代码来源:DetailManager.cpp

示例9: mods_load

void CEnvironment::mods_load()
{
    Modifiers.clear_and_free();
    string_path path;
    if (FS.exist(path, "$level$", "level.env_mod"))
    {
        IReader* fs = FS.r_open(path);
        u32 id = 0;
        u32 ver = 0x0015;
        u32 sz;

        while (0 != (sz = fs->find_chunk(id)))
        {
            if (id == 0 && sz == sizeof(u32))
            {
                ver = fs->r_u32();
            }
            else
            {
                CEnvModifier E;
                E.load(fs, ver);
                Modifiers.push_back(E);
            }
            id++;
        }
        FS.r_close(fs);
    }

    load_level_specific_ambients();
}
开发者ID:denanden,项目名称:xray-16,代码行数:30,代码来源:Environment_misc.cpp

示例10: sizeof

bool CALifeStorageManager::load	(LPCSTR save_name_no_check)
{
	LPCSTR game_saves_path		= FS.get_path("$game_saves$")->m_Path;

	string_path					save_name;
	strncpy_s					(save_name, sizeof(save_name), save_name_no_check, sizeof(save_name)-5-xr_strlen(SAVE_EXTENSION)-xr_strlen(game_saves_path));

	CTimer						timer;
	timer.Start					();

	string_path					save;
	xr_strcpy					(save,m_save_name);
	if (!save_name) {
		if (!xr_strlen(m_save_name))
			R_ASSERT2			(false,"There is no file name specified!");
	}
	else
	{
		strconcat				(sizeof(m_save_name), m_save_name, save_name, SAVE_EXTENSION);
	}
	string_path					file_name;
	FS.update_path				(file_name,"$game_saves$",m_save_name);

	xr_strcpy					(g_last_saved_game, save_name);
	xr_strcpy					(g_bug_report_file, file_name);

	IReader						*stream;
	stream						= FS.r_open(file_name);
	if (!stream) {
		Msg						("* Cannot find saved game %s",file_name);
		xr_strcpy				(m_save_name,save);
		return					(false);
	}

	CHECK_OR_EXIT				(CSavedGameWrapper::valid_saved_game(*stream),make_string("%s\nSaved game version mismatch or saved game is corrupted",file_name));
/*
	string512					temp;
	strconcat					(sizeof(temp),temp,CStringTable().translate("st_loading_saved_game").c_str()," \"",save_name,SAVE_EXTENSION,"\"");
	g_pGamePersistent->LoadTitle(temp);
*/
	g_pGamePersistent->LoadTitle();

	unload						();
	reload						(m_section);

	u32							source_count = stream->r_u32();
	void						*source_data = xr_malloc(source_count);
	rtc_decompress				(source_data,source_count,stream->pointer(),stream->length() - 3*sizeof(u32));
	FS.r_close					(stream);
	load						(source_data, source_count, file_name);
	xr_free						(source_data);

	groups().on_after_game_load	();

	VERIFY						(graph().actor());
	
	Msg							("* Game %s is successfully loaded from file '%s' (%.3fs)",save_name, file_name,timer.GetElapsed_sec());

	return						(true);
}
开发者ID:AntonioModer,项目名称:xray-16,代码行数:60,代码来源:alife_storage_manager.cpp

示例11: load

void CActorCondition::load(IReader &input_packet)
{
	inherited::load		(input_packet);
	load_data			(m_fAlcohol, input_packet);
	load_data			(m_condition_flags, input_packet);
	load_data			(m_fSatiety, input_packet);

	load_data			(m_curr_medicine_influence.fHealth, input_packet);
	load_data			(m_curr_medicine_influence.fPower, input_packet);
	load_data			(m_curr_medicine_influence.fSatiety, input_packet);
	load_data			(m_curr_medicine_influence.fRadiation, input_packet);
	load_data			(m_curr_medicine_influence.fWoundsHeal, input_packet);
	load_data			(m_curr_medicine_influence.fMaxPowerUp, input_packet);
	load_data			(m_curr_medicine_influence.fAlcohol, input_packet);
	load_data			(m_curr_medicine_influence.fTimeTotal, input_packet);
	load_data			(m_curr_medicine_influence.fTimeCurrent, input_packet);

	u8 cntr = input_packet.r_u8();
	for(; cntr>0; cntr--)
	{
		SBooster B;
		B.m_type = (EBoostParams)input_packet.r_u8();
		B.fBoostValue = input_packet.r_float();
		B.fBoostTime = input_packet.r_float();
		m_booster_influences[B.m_type] = B;
		BoostParameters(B);
	}
}
开发者ID:zcaliptium,项目名称:xray-16,代码行数:28,代码来源:ActorCondition.cpp

示例12:

void CPatrolPathStorage::load_raw			(const CLevelGraph *level_graph, const CGameLevelCrossTable *cross, const CGameGraph *game_graph, IReader &stream)
{
	IReader						*chunk = stream.open_chunk(WAY_PATROLPATH_CHUNK);

	if (!chunk)
		return;
		
	u32							chunk_iterator;
	for (IReader *sub_chunk = chunk->open_chunk_iterator(chunk_iterator); sub_chunk; sub_chunk = chunk->open_chunk_iterator(chunk_iterator,sub_chunk)) {
		R_ASSERT				(sub_chunk->find_chunk(WAYOBJECT_CHUNK_VERSION));
		R_ASSERT				(sub_chunk->r_u16() == WAYOBJECT_VERSION);
		R_ASSERT				(sub_chunk->find_chunk(WAYOBJECT_CHUNK_NAME));

		shared_str				patrol_name;
		sub_chunk->r_stringZ	(patrol_name);
		const_iterator			I = m_registry.find(patrol_name);
		VERIFY3					(I == m_registry.end(),"Duplicated patrol path found",*patrol_name);
		m_registry.insert		(
			std::make_pair(
				patrol_name,
				&xr_new<CPatrolPath>(
					patrol_name
				)->load_raw(
					level_graph,
					cross,
					game_graph,
					*sub_chunk
				)
			)
		);
	}
	
	chunk->close				();
}
开发者ID:NeoAnomaly,项目名称:xray,代码行数:34,代码来源:patrol_path_storage.cpp

示例13: decode

	Image ImageFormat_JPEG::decode(IReader& reader) const
	{
		const int64 size = reader.size();
		
		uint8* buffer = static_cast<uint8*>(::malloc(static_cast<size_t>(size)));
		
		reader.read(buffer, size);

		int width, height;

		tjhandle tj = ::tjInitDecompress();

		::tjDecompressHeader(tj, buffer, static_cast<unsigned long>(size), &width, &height);

		Image image(width, height);

		::tjDecompress(
			tj,
			buffer,
			static_cast<unsigned long>(size),
			image.dataAsUint8(),
			image.width(),
			image.stride(),
			image.height(),
			sizeof(Color),
			0);

		::tjDestroy(tj);

		::free(buffer);

		return image;
	}
开发者ID:Siv3D,项目名称:OpenSiv3D,代码行数:33,代码来源:ImageFormat_JPEG.cpp

示例14: check_files

void recalculation::check_files( u32 check_sum )
{
	string_path						  N,L;
	FS.update_path					( L,	"$level$", "level.details" );
	FS.update_path					( N,	"$level$", "recalculation_data_slots.details" );
	if( ! FS.exist( L ) )
	{
		FS.file_delete( N );
		return;
	}

	IReader*		R	= FS.r_open	(		"$level$", "recalculation_data_slots.details" );
	if( R )
	{
		u32 check;
		R->r_chunk( 0, &check );
		if( check != check_sum )
			FS.file_delete( N );
		else
			recalculate = true;

		FS.r_close( R ) ;
	}
	
}
开发者ID:AntonioModer,项目名称:xray-16,代码行数:25,代码来源:recalculation.cpp

示例15: stream

void ppmd_initialize		()
{
	if (trained_model)
		trained_model->rewind	();

	static bool	initialized	= false;
	if (initialized)
		return;

	string_path			file_name;

	FS.update_path		(file_name,"$game_config$","mp\\!PPMd.mdl");
	if (FS.exist(file_name)) {
		IReader			*reader = FS.r_open(file_name);
		R_ASSERT		(reader);
		u32				buffer_size = reader->length();
		u8				*buffer = (u8*)xr_malloc(buffer_size);
		reader->r		(buffer,buffer_size);
		FS.r_close		(reader);
		trained_model	= new stream(buffer,buffer_size);
	}

	initialized		= true;
	if (StartSubAllocator(suballocator_size))
		return;
	
	exit			(-1);
}
开发者ID:2asoft,项目名称:xray,代码行数:28,代码来源:ppmd_compressor.cpp


注:本文中的IReader类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。