Exemple #1
0
//------------------------------------------------------------------------------
bool CGroupObject::LoadLTX(CInifile& ini, LPCSTR sect_name)
{
    u32 version = ini.r_u32(sect_name, "version");
    if (version<0x0011)
    {
        ELog.DlgMsg( mtError, "CGroupObject: unsupported file version. Object can't load.");
        return false;
    }
	CCustomObject::LoadLTX(ini, sect_name);

    Flags32 tmp_flags;tmp_flags.zero();
    if(version<0x0012)
    	tmp_flags.assign(ini.r_u32(sect_name, "flags") );

	// objects
    if(/*IsOpened()*/ tmp_flags.test((1<<0)))
    {    //old opened group save format
        ELog.DlgMsg( mtError, "old opened group save format");
        return false;
/*      
        u32 cnt 	= ini.r_u32			(sect_name, "objects_in_group_count");
        shared_str 		tmp;
    	string128		buff;

        for (u32 k=0; k<cnt; ++k)
        {
			m_ObjectsInGroup.resize				(m_ObjectsInGroup.size()+1);
        	sprintf								(buff,"objects_in_group_%d",k);
        	m_ObjectsInGroup.back().ObjectName	= ini.r_string(sect_name, buff);
        }
*/        
    }else
    {
	    Scene->ReadObjectsLTX			(ini, sect_name, "ingroup", AppendObjectLoadCB, 0);
    }
    VERIFY(m_ObjectsInGroup.size());

   	SetRefName(ini.r_string	(sect_name, "ref_name")) ;
	if (!m_ReferenceName_.size())
        ELog.Msg			(mtError,"ERROR: group '%s' - has empty reference. Corrupted file?", Name);
    

    if(version<0x0012)
    {
        for (ObjectsInGroup::iterator it=m_ObjectsInGroup.begin(); it!=m_ObjectsInGroup.end(); ++it)
            if(it->pObject)
            {
            	it->pObject->m_CO_Flags.set(flObjectInGroup, TRUE);
            	it->pObject->m_CO_Flags.set(flObjectInGroupUnique, TRUE);
            }
    }

    return 			true;
}
//----------------------------------------------------
bool ESceneSpawnTool::LoadLTX(CInifile& ini)
{
	u32 version 	= ini.r_u32("main","version");
    if( version!=SPAWN_TOOLS_VERSION )
    {
        ELog.DlgMsg( mtError, "%s tools: Unsupported version.",ClassDesc());
        return false;
    }

	inherited::LoadLTX	(ini);

   	m_Flags.assign	(ini.r_u32("main","flags"));

    return true;
}
Exemple #3
0
void PDomain::Load2(CInifile& ini, const shared_str& sect)
{
	type		= PDomainEnum(ini.r_u32(sect,"type"));
	v[0]		= ini.r_fvector3(sect,"v0");
	v[1]		= ini.r_fvector3(sect,"v1");
	v[2]		= ini.r_fvector3(sect,"v2");
}
Exemple #4
0
bool CEditShape::LoadLTX(CInifile& ini, LPCSTR sect_name)
{
    u32 vers		= ini.r_u32(sect_name, "version");

 	inherited::LoadLTX	(ini, sect_name);

    u32 count 			= ini.r_u32			(sect_name, "shapes_count");
    if(vers>0x0001)
    	m_shape_type	= ini.r_u8			(sect_name, "shape_type");
        
    string128			buff;
    shapes.resize		(count);
    for(u32 i=0; i<count; ++i)
    {
       sprintf			(buff,"shape_type_%d", i);
       shapes[i].type	= ini.r_u8(sect_name, buff);
       if(shapes[i].type==CShapeData::cfSphere)
       {
       	sprintf			(buff,"shape_center_%d", i);
		shapes[i].data.sphere.P = ini.r_fvector3	(sect_name, buff);

       	sprintf			(buff,"shape_radius_%d", i);
		shapes[i].data.sphere.R = ini.r_float		(sect_name, buff);
       }else
       {
       	 R_ASSERT		(shapes[i].type==CShapeData::cfBox);
         sprintf			(buff,"shape_matrix_i_%d", i);
         shapes[i].data.box.i = ini.r_fvector3	(sect_name, buff);

         sprintf			(buff,"shape_matrix_j_%d", i);
         shapes[i].data.box.j = ini.r_fvector3	(sect_name, buff);

         sprintf			(buff,"shape_matrix_k_%d", i);
         shapes[i].data.box.k = ini.r_fvector3	(sect_name, buff);

         sprintf			(buff,"shape_matrix_c_%d", i);
         shapes[i].data.box.c = ini.r_fvector3	(sect_name, buff);
       }
    }


	ComputeBounds();
	return true;
}
Exemple #5
0
//----------------------------------------------------
bool ESoundSource::LoadLTX(CInifile& ini, LPCSTR sect_name)
{
	u32 version =  ini.r_u32(sect_name, "version");

    if(version!=SOUND_SOURCE_VERSION)
    {
        ELog.Msg( mtError, "ESoundSource: Unsupported version.");
        return false;
    }

	inherited::LoadLTX	(ini, sect_name);

    m_Type				= ini.r_u32			(sect_name, "snd_type");

    m_WAVName			= ini.r_string		(sect_name, "snd_name");

    m_Flags.assign		(ini.r_u32			(sect_name, "flags"));

    m_Params.position	= ini.r_fvector3		(sect_name, "snd_position");
    m_Params.volume		= ini.r_float			(sect_name, "volume");
    m_Params.freq		= ini.r_float			(sect_name, "freq");
    m_Params.min_distance=ini.r_float			(sect_name, "min_dist");
    m_Params.max_distance= ini.r_float			(sect_name, "max_dist");
    m_Params.max_ai_distance=ini.r_float			(sect_name, "max_ai_dist");

    m_RandomPause		= ini.r_fvector2		(sect_name, "random_pause");
    m_ActiveTime		= ini.r_fvector2		(sect_name, "active_time");
    m_PlayTime			= ini.r_fvector2		(sect_name, "play_time");

    ResetSource		();

    switch (m_Type)
    {
    case stStaticSource:
    	if (m_Flags.is(flPlaying)) 		Play();
//.    	if (m_Flags.is(flSimulating)) 	Simulate();
    break;
    default: THROW;
    }
    return true;
}
//----------------------------------------------------
bool ESceneWayTool::LoadLTX(CInifile& ini)
{
	u32 version 	= ini.r_u32("main","version");
    if( version!=WAY_TOOLS_VERSION )
    {
            ELog.DlgMsg( mtError, "%s tools: Unsupported version.",ClassDesc());
            return false;
    }

	inherited::LoadLTX(ini);
	return true;
}
Exemple #7
0
//----------------------------------------------------
bool ESoundEnvironment::LoadLTX(CInifile& ini, LPCSTR sect_name)
{
	u32 version 	= ini.r_u32(sect_name, "version");

    if(version!=SOUND_ENV_VERSION)
    {
        ELog.DlgMsg	(mtError, "ESoundSource: Unsupported version.");
        return 		false;
    }
	inherited::LoadLTX			(ini, sect_name);

	return 			true;
}
Exemple #8
0
//----------------------------------------------------
bool EScene::ReadObjectLTX(CInifile& ini, LPCSTR sect_name, CCustomObject*& O)
{
    ObjClassID clsid		= OBJCLASS_DUMMY;
    clsid 					= ObjClassID(ini.r_u32(sect_name,"clsid"));
	O 						= GetOTool(clsid)->CreateObject(0,0);

    bool bRes 				= O->LoadLTX(ini, sect_name);

	if (!bRes)
    	xr_delete			(O);

	return bRes;
}
Exemple #9
0
void st_LevelOptions::ReadLTX(CInifile& ini)
{
	LPCSTR section 	= "level_options";

    u32 vers_op 		= ini.r_u32(section, "version");
    if( vers_op < 0x00000008 )
    {
        ELog.DlgMsg( mtError, "Skipping bad version of level options." );
        return;
    }

    m_FNLevelPath		= ini.r_string 		(section, "level_path");
    m_LevelPrefix		= ini.r_string 		(section, "level_prefix");
    m_BOPText			= ini.r_string_wb	(section, "bop");

    if(vers_op > 0x0000000B)
    	m_map_version		= ini.r_string		(section, "map_version");

    m_BuildParams.LoadLTX(ini);

    m_LightHemiQuality 				= ini.r_u8(section, "light_hemi_quality" );
    m_LightSunQuality 				= ini.r_u8(section, "light_sun_quality" );

    m_mapUsage.SetDefaults			();
    if(vers_op > 0x0000000A)
	{
     m_mapUsage.LoadLTX				(ini,section,false);
    }else
    {

    m_mapUsage.m_GameType.set		(eGameIDDeathmatch ,	ini.r_s32(section, "usage_deathmatch"));
    m_mapUsage.m_GameType.set		(eGameIDTeamDeathmatch, ini.r_s32(section, "usage_teamdeathmatch"));
    m_mapUsage.m_GameType.set		(eGameIDArtefactHunt,	ini.r_s32(section, "usage_artefacthunt"));


	if(vers_op > 0x00000008)
    {
        m_mapUsage.m_GameType.set	(eGameIDCaptureTheArtefact,	ini.r_s32(section, "usage_captretheartefact"));

        m_mapUsage.m_GameType.set	(eGameIDTeamDominationZone,	ini.r_s32(section, "usage_team_domination_zone"));
        if(vers_op==0x00000009)
        	m_mapUsage.m_GameType.set(eGameIDDominationZone,		ini.r_s32(section, "domination_zone"));
        else
        	m_mapUsage.m_GameType.set(eGameIDDominationZone,		ini.r_s32(section, "usage_domination_zone"));
     }
    }
}
Exemple #10
0
bool EScene::ReadObjectsLTX(CInifile& ini,  LPCSTR sect_name_parent, LPCSTR sect_name_prefix, TAppendObject on_append, SPBItem* pb)
{
	string128			buff;
	R_ASSERT			(on_append);
	sprintf				(buff, "%s_count", sect_name_prefix);
    u32 count			= ini.r_u32(sect_name_parent, buff);
	bool bRes 			= true;

	for(u32 i=0; i<count; ++i)
    {
    	sprintf				(buff, "%s_%s_%d", sect_name_parent, sect_name_prefix, i);
        CCustomObject* obj	= NULL;

		if(ReadObjectLTX(ini, buff, obj))
        {
            LPCSTR obj_name = obj->Name;
            CCustomObject* existing = FindObjectByName(obj_name,obj->ClassID);
            if(existing)
            {

                if(g_frmConflictLoadObject->m_result!=2 && g_frmConflictLoadObject->m_result!=4 && g_frmConflictLoadObject->m_result!=6)
                {
                    g_frmConflictLoadObject->m_existing_object 	= existing;
                    g_frmConflictLoadObject->m_new_object 		= obj;
                    g_frmConflictLoadObject->Prepare			();
                    g_frmConflictLoadObject->ShowModal			();
                }
                switch(g_frmConflictLoadObject->m_result)
                {
                    case 1: //Overwrite
                    case 2: //Overwrite All
                    {
                       bool res = RemoveObject		(existing, true, true);
                        if(!res)
                            Msg("! RemoveObject [%s] failed", existing->Name);
                         else
                            xr_delete(existing);
                    }break;
                    case 3: //Insert new
                    case 4: //Insert new All
                    {
                        string256 				buf;
                        GenObjectName			(obj->ClassID, buf, obj->Name);
                        obj->Name				= buf;
                    }break;
                    case 0: //Cancel
                    case 5: //Skip
                    case 6: //Skip All
                    {
                        xr_delete(obj);
                    }break;
                } //switch
            } //if exist
            if (obj && !on_append(obj))
                xr_delete(obj);}
        
        else
        	bRes = false;

        if (pb)
			pb->Inc();
    }
    return bRes;
}
Exemple #11
0
BOOL CPEDef::Load2(CInifile& ini)
{
//.	u16 version		= ini.r_u16("_effect", "version");
	m_MaxParticles	= ini.r_u32("_effect", "max_particles");
	m_Flags.assign	(ini.r_u32("_effect", "flags"));

	if (m_Flags.is(dfSprite))
	{
		m_ShaderName	= ini.r_string	("sprite", "shader");
		m_TextureName	= ini.r_string	("sprite", "texture");
	}

	if (m_Flags.is(dfFramed))
	{
		m_Frame.m_fTexSize		= ini.r_fvector2		("frame",	"tex_size");
		m_Frame.reserved		= ini.r_fvector2		("frame",	"reserved");
		m_Frame.m_iFrameDimX	= ini.r_s32				("frame",	"dim_x");
		m_Frame.m_iFrameCount	= ini.r_s32				("frame",	"frame_count");
		m_Frame.m_fSpeed		= ini.r_float			("frame",	"speed");
	}

	if (m_Flags.is(dfTimeLimit))
	{
		m_fTimeLimit			= ini.r_float			("timelimit", "value");
	}

	if (m_Flags.is(dfCollision))
	{
		m_fCollideOneMinusFriction	= ini.r_float		("collision", "one_minus_friction");
		m_fCollideResilience		= ini.r_float		("collision", "collide_resilence");
		m_fCollideSqrCutoff			= ini.r_float		("collision", "collide_sqr_cutoff");
	}

	if (m_Flags.is(dfVelocityScale))
	{
		m_VelocityScale				= ini.r_fvector3	("velocity_scale", "value");
	}

	if (m_Flags.is(dfAlignToPath))
	{
		m_APDefaultRotation			= ini.r_fvector3	("align_to_path", "default_rotation");
	}
#ifdef _EDITOR
	if(pCreateEAction)
	{
		u32 count		= ini.r_u32("_effect", "action_count");
        m_EActionList.resize(count);
		u32 action_id	= 0;
        for (EPAVecIt it=m_EActionList.begin(); it!=m_EActionList.end(); ++it,++action_id)
		{
			string256					sect;
			xr_sprintf					(sect, sizeof(sect), "action_%04d", action_id);
            PAPI::PActionEnum type		= (PAPI::PActionEnum)(ini.r_u32(sect,"action_type"));
            (*it)						= pCreateEAction(type);
            (*it)->Load2				(ini, sect);
        }
		Compile							(m_EActionList);
    }
#endif

	return TRUE;
}
bool ESceneToolBase::LoadLTX(CInifile& ini)
{
    m_ModifName 	= ini.r_string("modif", "name");
    m_ModifTime 	= ini.r_u32("modif", "time");
	return 			true;
}