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


C++ IReader::r_u32方法代码示例

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


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

示例1: Load

bool ESceneLightTools::Load(IReader& F)
{
	u16 version 	= 0;
    if(F.r_chunk(CHUNK_VERSION,&version))
        if( version!=LIGHT_TOOLS_VERSION ){
            ELog.DlgMsg( mtError, "%s tools: Unsupported version.",ClassDesc());
            return false;
        }

	if (!inherited::Load(F)) return false;

    if (F.find_chunk(CHUNK_FLAGS))
    	m_Flags.assign		(F.r_u32());

    if (F.find_chunk(CHUNK_SUN_SHADOW)){
     	F.r_u8				();
        F.r_fvector2		(m_SunShadowDir);
    }
    
    if (F.find_chunk(CHUNK_LCONTROLS_LAST))
		lcontrol_last_idx	= F.r_u32();
    
	IReader* R 		= F.open_chunk(CHUNK_LCONTROLS); 
    if (R){
        while (!R->eof()){
        	shared_str		l_name;
            R->r_stringZ(l_name);
            u32 l_idx	= R->r_u32();
            AppendLightControl(l_name.c_str(),&l_idx);
        }
        R->close		();
    }

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

示例2: Load

bool EDetail::Load(IReader& F)
{
	// check version
    R_ASSERT			(F.find_chunk(DETOBJ_CHUNK_VERSION));
    u32 version		= F.r_u32();
    if (version!=DETOBJ_VERSION){
    	ELog.Msg(mtError,"EDetail: unsupported version.");
        return false;
    }

	// references
	string256 buf;
    R_ASSERT			(F.find_chunk(DETOBJ_CHUNK_REFERENCE));
    F.r_stringZ			(buf,sizeof(buf));

    // scale
    R_ASSERT			(F.find_chunk(DETOBJ_CHUNK_SCALE_LIMITS));
    m_fMinScale			= F.r_float(); if (fis_zero(m_fMinScale))	m_fMinScale = 0.1f;
	m_fMaxScale			= F.r_float(); if (m_fMaxScale<m_fMinScale)	m_fMaxScale = m_fMinScale;

	// density factor
    if (F.find_chunk(DETOBJ_CHUNK_DENSITY_FACTOR))
	    m_fDensityFactor= F.r_float();

    if (F.find_chunk(DETOBJ_CHUNK_FLAGS))
    	m_Flags.assign	(F.r_u32());

    // update object
    return 				Update(buf);
}
开发者ID:OLR-xray,项目名称:OLR-3.0,代码行数:30,代码来源:EDetailModel.cpp

示例3: Load

bool ESceneObjectTools::Load(IReader& F)
{
	u16 version 	= 0;
    if(F.r_chunk(CHUNK_VERSION,&version)){
        if( version!=OBJECT_TOOLS_VERSION ){
            ELog.DlgMsg( mtError, "%s tools: Unsupported version.",ClassDesc());
            return false;
        }
    }
	if (!inherited::Load(F)) return false;
    
    if (F.find_chunk(CHUNK_FLAGS))
    	m_Flags.assign(F.r_u32());

    if (F.find_chunk(CHUNK_APPEND_RANDOM)){
        F.r_fvector3(m_AppendRandomMinScale);
        F.r_fvector3(m_AppendRandomMaxScale);
        F.r_fvector3(m_AppendRandomMinRotation);
        F.r_fvector3(m_AppendRandomMaxRotation);
        int cnt		= F.r_u32();
        if (cnt){
        	shared_str	buf;
            for (int i=0; i<cnt; i++){
                F.r_stringZ						(buf);
                m_AppendRandomObjects.push_back	(buf);
            }
        }
    };

    m_Flags.set(flAppendRandom,FALSE);
    
    return true;
}
开发者ID:OLR-xray,项目名称:OLR-3.0,代码行数:33,代码来源:ESceneObjectToolsIO.cpp

示例4: Load

void SGameMtl::Load(IReader& fs)
{
	R_ASSERT(fs.find_chunk(GAMEMTL_CHUNK_MAIN));
	ID						= fs.r_u32();
    fs.r_stringZ			(m_Name);

    if (fs.find_chunk(GAMEMTL_CHUNK_DESC)){
		fs.r_stringZ		(m_Desc);
    }
    
	R_ASSERT(fs.find_chunk(GAMEMTL_CHUNK_FLAGS));
    Flags.assign			(fs.r_u32());

	R_ASSERT(fs.find_chunk(GAMEMTL_CHUNK_PHYSICS));
    fPHFriction				= fs.r_float();
    fPHDamping				= fs.r_float();
    fPHSpring				= fs.r_float();
    fPHBounceStartVelocity 	= fs.r_float();
    fPHBouncing				= fs.r_float();

	R_ASSERT(fs.find_chunk(GAMEMTL_CHUNK_FACTORS));
    fShootFactor			= fs.r_float();
    fBounceDamageFactor		= fs.r_float();
    fVisTransparencyFactor	= fs.r_float();
    fSndOcclusionFactor		= fs.r_float();

	if(fs.find_chunk(GAMEMTL_CHUNK_FLOTATION))
	    fFlotationFactor	= fs.r_float();

    if(fs.find_chunk(GAMEMTL_CHUNK_INJURIOUS))
    	fInjuriousSpeed		= fs.r_float();
}
开发者ID:2asoft,项目名称:xray,代码行数:32,代码来源:GameMtlLib.cpp

示例5: LoadData

void CBone::LoadData(IReader& F)
{
	R_ASSERT(F.find_chunk(BONE_CHUNK_DEF));
	F.r_stringZ		(name); xr_strlwr(name);

	R_ASSERT(F.find_chunk(BONE_CHUNK_MATERIAL));
    F.r_stringZ		(game_mtl);

	R_ASSERT(F.find_chunk(BONE_CHUNK_SHAPE));
    F.r				(&shape,sizeof(SBoneShape));
    
    if (F.find_chunk(BONE_CHUNK_FLAGS))
	    IK_data.ik_flags.assign(F.r_u32());

	R_ASSERT(F.find_chunk(BONE_CHUNK_IK_JOINT));
	IK_data.type			= (EJointType)F.r_u32();
    F.r						(IK_data.limits,sizeof(SJointLimit)*3);
    IK_data.spring_factor	= F.r_float();
    IK_data.damping_factor	= F.r_float();

    if (F.find_chunk(BONE_CHUNK_IK_JOINT_BREAK)){
	    IK_data.break_force	= F.r_float();
    	IK_data.break_torque= F.r_float();
    }

    if (F.find_chunk(BONE_CHUNK_IK_JOINT_FRICTION)){
	    IK_data.friction	= F.r_float();
    }

    if (F.find_chunk(BONE_CHUNK_MASS)){
	    mass		= F.r_float();
		F.r_fvector3(center_of_mass);
    }
}
开发者ID:BeaconDev,项目名称:xray-16,代码行数:34,代码来源:bone.cpp

示例6: Load

bool CCustomMotion::Load(IReader& F)
{
	F.r_stringZ	(name);
	iFrameStart	= F.r_u32();
	iFrameEnd	= F.r_u32();
	fFPS		= F.r_float();
	return true;
}
开发者ID:OLR-xray,项目名称:XRay-NEW,代码行数:8,代码来源:motion.cpp

示例7:

void CALifeSpawnHeader::load			(IReader	&file_stream)
{
	m_version				= file_stream.r_u32();
	R_ASSERT2				(XRAI_CURRENT_VERSION == m_version,"'game.spawn' version mismatch!");
	file_stream.r			(&m_guid,sizeof(m_guid));
	file_stream.r			(&m_graph_guid,sizeof(m_graph_guid));
	m_count					= file_stream.r_u32();
	m_level_count			= file_stream.r_u32();
}
开发者ID:AntonioModer,项目名称:xray-16,代码行数:9,代码来源:alife_spawn_registry_header.cpp

示例8: LoadStream

bool ESceneAIMapTool::LoadStream(IReader& F)
{
	inherited::LoadStream	(F);

	u16 version = 0;

    R_ASSERT(F.r_chunk(AIMAP_CHUNK_VERSION,&version));
    if( version!=AIMAP_VERSION ){
        ELog.DlgMsg( mtError, "AIMap: Unsupported version.");
        return false;
    }

    R_ASSERT(F.find_chunk(AIMAP_CHUNK_FLAGS));
    F.r				(&m_Flags,sizeof(m_Flags));

    R_ASSERT(F.find_chunk(AIMAP_CHUNK_BOX));
    F.r				(&m_AIBBox,sizeof(m_AIBBox));

    R_ASSERT(F.find_chunk(AIMAP_CHUNK_PARAMS));
    F.r				(&m_Params,sizeof(m_Params));

    R_ASSERT(F.find_chunk(AIMAP_CHUNK_NODES));
    m_Nodes.resize	(F.r_u32());
	for (AINodeIt it=m_Nodes.begin(); it!=m_Nodes.end(); it++){
    	*it			= xr_new<SAINode>();
    	(*it)->LoadStream	(F,this);
    }
	DenumerateNodes	();

    if (F.find_chunk(AIMAP_CHUNK_INTERNAL_DATA)){
    	m_VisRadius	= F.r_float();
    	m_BrushSize	= F.r_u32();
    }
    if (F.find_chunk(AIMAP_CHUNK_INTERNAL_DATA2)){
    	m_SmoothHeight	= F.r_float();
    }

	// snap objects
    if (F.find_chunk(AIMAP_CHUNK_SNAP_OBJECTS)){
    	shared_str 	buf;
		int cnt 	= F.r_u32();
        if (cnt){
	        for (int i=0; i<cnt; i++){
    	    	F.r_stringZ	(buf);
        	    CCustomObject* O = Scene->FindObjectByName(buf.c_str(),OBJCLASS_SCENEOBJECT);
            	if (!O)		ELog.Msg(mtError,"AIMap: Can't find snap object '%s'.",buf.c_str());
	            else		m_SnapObjects.push_back(O);
    	    }
        }
    }

    hash_FillFromNodes		();

    return true;
}
开发者ID:2asoft,项目名称:xray,代码行数:55,代码来源:ESceneAIMapTools.cpp

示例9: Load

//------------------------------------------------------------------------------
// I/O part
//------------------------------------------------------------------------------
BOOL CPGDef::Load(IReader& F)
{
	R_ASSERT		(F.find_chunk(PGD_CHUNK_VERSION));
	u16 version		= F.r_u16();

    if (version!=PGD_VERSION){
		Log			("!Unsupported PG version. Load failed.");
    	return FALSE;
    }

	R_ASSERT		(F.find_chunk(PGD_CHUNK_NAME));
	F.r_stringZ		(m_Name);

	F.r_chunk		(PGD_CHUNK_FLAGS,&m_Flags);

    if (F.find_chunk(PGD_CHUNK_EFFECTS)){
        m_Effects.resize(F.r_u32());
        for (EffectIt it=m_Effects.begin(); it!=m_Effects.end(); it++){
        	*it				= xr_new<SEffect>();
            F.r_stringZ		((*it)->m_EffectName);
            F.r_stringZ		((*it)->m_OnPlayChildName);
        	F.r_stringZ		((*it)->m_OnBirthChildName);
        	F.r_stringZ		((*it)->m_OnDeadChildName);
            (*it)->m_Time0 	= F.r_float();
            (*it)->m_Time1 	= F.r_float();
            (*it)->m_Flags.assign	(F.r_u32());
        }
    }else{  //.??? убрать через некоторое время
        R_ASSERT		(F.find_chunk(PGD_CHUNK_EFFECTS2));
        m_Effects.resize(F.r_u32());
        for (EffectIt it=m_Effects.begin(); it!=m_Effects.end(); it++){
        	*it				= xr_new<SEffect>();
            F.r_stringZ		((*it)->m_EffectName);
            F.r_stringZ		((*it)->m_OnPlayChildName);
            (*it)->m_Time0 	= F.r_float();
            (*it)->m_Time1 	= F.r_float();
            (*it)->m_Flags.assign	(F.r_u32());
        }
    }
    
    if (F.find_chunk(PGD_CHUNK_TIME_LIMIT)){
   		m_fTimeLimit= F.r_float();
    }

#ifdef _EDITOR
    if (F.find_chunk(PGD_CHUNK_OWNER)){
	    F.r_stringZ	(m_OwnerName);
	    F.r_stringZ	(m_ModifName);
        F.r			(&m_CreateTime,sizeof(m_CreateTime));
        F.r			(&m_ModifTime,sizeof(m_ModifTime));
    }
#endif
    
    return TRUE;
}                   
开发者ID:,项目名称:,代码行数:58,代码来源:

示例10: LoadBoneData

bool CEditableObject::LoadBoneData(IReader& F)
{
	BoneVec	load_bones;
    int count=0;
	IReader* R;
    while(0!=(R=F.open_chunk(count++)))
    {
    	CBone* nBone = xr_new<CBone>();
    	load_bones.push_back(nBone);
        nBone->LoadData(*R);
        Msg("loaded bone [%s]", nBone->Name().c_str());
    }
	bool bRes = true;
    // load bones
    if (!load_bones.empty()){
		for (BoneIt b_it=m_Bones.begin(); b_it!=m_Bones.end(); b_it++){
        	CBone* B	= *b_it;
            BoneIt n_it = std::find_if(load_bones.begin(),load_bones.end(),fBoneNameEQ(B->Name()));
            if (n_it!=load_bones.end())
            {
                B->CopyData	(*n_it);
            }else{
	            ELog.Msg	(mtError,"Can't find bone: '%s'.",*(*b_it)->Name());
            	bRes		= false; 
//                break;
            }
        }
    
        for (BoneIt n_it=load_bones.begin(); n_it!=load_bones.end(); n_it++)
            xr_delete(*n_it);

        load_bones.clear();
    }else{
        ELog.Msg	(mtError,"Empty bone list.");
    	bRes 		= false;
    }
    // load bone part
    if (F.find_chunk(EOBJ_CHUNK_BONEPARTS2)){
    	shared_str 	buf;
        m_BoneParts.resize(F.r_u32());
        for (BPIt bp_it=m_BoneParts.begin(); bp_it!=m_BoneParts.end(); bp_it++){
            F.r_stringZ			(buf); bp_it->alias=buf;
            bp_it->bones.resize	(F.r_u32());
            for (RStringVecIt s_it=bp_it->bones.begin(); s_it!=bp_it->bones.end(); s_it++)
                F.r_stringZ		(*s_it);
        }
        if (!m_BoneParts.empty()&&!VerifyBoneParts())
            ELog.Msg	(mtError,"Invalid bone parts. Found missing or duplicate bone.");
    }else{
        ELog.Msg		(mtError,"Can't load bone parts. Invalid version.");
    }
    return bRes;
}
开发者ID:2asoft,项目名称:xray,代码行数:53,代码来源:EditObjectSkin.cpp

示例11: Read

void st_LevelOptions::Read(IReader& F)
{
	R_ASSERT(F.find_chunk(CHUNK_LO_VERSION));
    DWORD vers = F.r_u32( );
    if( vers < 0x00000008 )
    {
        ELog.DlgMsg( mtError, "Skipping bad version of level options." );
        return;
    }

    R_ASSERT(F.find_chunk(CHUNK_LO_NAMES));
    F.r_stringZ 	(m_FNLevelPath);

    if (F.find_chunk(CHUNK_LO_PREFIX)) F.r_stringZ 	(m_LevelPrefix);

    R_ASSERT(F.find_chunk(CHUNK_LO_BOP));
    F.r_stringZ 	(m_BOPText); 

    if (F.find_chunk(CHUNK_LO_MAP_VER))
	    F.r_stringZ	(m_map_version);

    vers = 0;
    if (F.find_chunk(CHUNK_LO_BP_VERSION))
	    vers = F.r_u32( );

    if (CURRENT_LEVELOP_BP_VERSION==vers){
	    if (F.find_chunk(CHUNK_BUILD_PARAMS)) 	
        	F.r(&m_BuildParams, sizeof(m_BuildParams));
    }else{
        ELog.DlgMsg	(mtError, "Skipping bad version of build params.");
    	m_BuildParams.Init();
    }

    if (F.find_chunk(CHUNK_LIGHT_QUALITY))
    {
	    m_LightHemiQuality 	= F.r_u8();
	    m_LightSunQuality 	= F.r_u8();
    }
    if (F.find_chunk(CHUNK_MAP_USAGE))
    {
    	if(vers > 0x00000008)
        {
          m_mapUsage.m_GameType.assign	(F.r_u16());
        }else
        {
            m_mapUsage.m_GameType.zero					();
            m_mapUsage.m_GameType.set					(eGameIDDeathmatch ,	F.r_s32());
            m_mapUsage.m_GameType.set					(eGameIDTeamDeathmatch, F.r_s32());
            m_mapUsage.m_GameType.set					(eGameIDArtefactHunt,	F.r_s32());
        }
    }
}
开发者ID:AntonioModer,项目名称:xray-16,代码行数:52,代码来源:SceneIO.cpp

示例12:

bool CSavedGameWrapper::valid_saved_game		(IReader &stream)
{
	if (stream.length() < 8)
		return					(false);

	if (stream.r_u32() != u32(-1))
		return					(false);

	if (stream.r_u32() < 0x0002)
		return					(false);

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

示例13: Load

void CLAItem::Load(IReader& F)
{
	R_ASSERT(F.find_chunk(CHUNK_ITEM_COMMON));
    F.r_stringZ		(cName);
    fFPS			= F.r_float();
    iFrameCount		= F.r_u32();

    int key_cnt,key;
	R_ASSERT(F.find_chunk(CHUNK_ITEM_KEYS));
	key_cnt			= F.r_u32();
    for (int i=0; i<key_cnt; i++){
    	key			= F.r_u32	();
        Keys[key]	= F.r_u32();
    }
}
开发者ID:NeoAnomaly,项目名称:xray,代码行数:15,代码来源:LightAnimLibrary.cpp

示例14: LoadActions

u32 CParticleManager::LoadActions(int alist_id, IReader& R)
{
	// Execute the specified action list.
	ParticleActions* pa		= GetActionListPtr(alist_id);
    pa->clear				();
    if (R.length()){
        u32 cnt					= R.r_u32();
        for (u32 k=0; k<cnt; k++){
            ParticleAction* act	= CreateAction	((PActionEnum)R.r_u32());
            act->Load			(R);
            pa->append			(act);
        }
    }
    return pa->size();
}
开发者ID:rdavydov,项目名称:XRay-NEW,代码行数:15,代码来源:particle_manager.cpp

示例15: 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


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