Пример #1
0
void SThunderboltDesc::load						(CInifile& pIni, shared_str const& sect)
{
	create_top_gradient			(pIni, sect);
	create_center_gradient		(pIni, sect);

	name						= sect;
	color_anim					= LALib.FindItem (pIni.r_string ( sect,"color_anim" ));
	VERIFY						(color_anim);
	color_anim->fFPS			= (float)color_anim->iFrameCount;

    // models
	LPCSTR m_name;
	m_name						= pIni.r_string(sect,"lightning_model");
	m_pRender->CreateModel		(m_name);

	/*
    IReader* F			= 0;
	F					= FS.r_open("$game_meshes$",m_name); R_ASSERT2(F,"Empty 'lightning_model'.");
	l_model				= ::Render->model_CreateDM(F);
    FS.r_close			(F);
	*/

    // sound
	m_name				= pIni.r_string(sect,"sound");
    if (m_name&&m_name[0]) snd.create(m_name,st_Effect,sg_Undefined);
}
Пример #2
0
void SCarLight::ParseDefinitions(LPCSTR section)
{

	light_render			= ::Render->light_create();
	light_render->set_type	(IRender_Light::SPOT);
	light_render->set_shadow(true);
	glow_render				= ::Render->glow_create();
	//	lanim					= 0;
	//	time2hide				= 0;

	// set bone id
	IKinematics*			pKinematics=smart_cast<IKinematics*>(m_holder->PCar()->Visual());
	CInifile* ini		=	pKinematics->LL_UserData();
	
	Fcolor					clr;
	clr.set					(ini->r_fcolor(section,"color"));
	//clr.mul_rgb				(torch->spot_brightness);
	//fBrightness				= torch->spot_brightness;
	light_render->set_range	(ini->r_float(section,"range"));
	light_render->set_color	(clr);
	light_render->set_cone	(deg2rad(ini->r_float(section,"cone_angle")));
	light_render->set_texture(ini->r_string(section,"spot_texture"));

	glow_render->set_texture(ini->r_string(section,"glow_texture"));
	glow_render->set_color	(clr);
	glow_render->set_radius	(ini->r_float(section,"glow_radius"));
	
	bone_id	= pKinematics->LL_BoneID(ini->r_string(section,"bone"));
	glow_render ->set_active(false);
	light_render->set_active(false);
	pKinematics->LL_SetBoneVisible(bone_id,FALSE,TRUE);

	//lanim					= LALib.FindItem(ini->r_string(section,"animator"));
	
}
Пример #3
0
void SThunderboltDesc::create_center_gradient	(CInifile& pIni, shared_str const& sect)
{
	m_GradientCenter			= new SFlare();
    m_GradientCenter->shader 	= pIni.r_string		( sect,"gradient_center_shader" );
    m_GradientCenter->texture	= pIni.r_string		( sect,"gradient_center_texture" );
    m_GradientCenter->fRadius	= pIni.r_fvector2	(sect,"gradient_center_radius"  );
    m_GradientCenter->fOpacity 	= pIni.r_float		( sect,"gradient_center_opacity" );
	m_GradientCenter->m_pFlare->CreateShader		(*m_GradientCenter->shader,*m_GradientCenter->texture);
}
void time::load				(CInifile& config)
{
//	Ivector3 tm					={0,0,0};
//	sscanf						(m_identifier.c_str(),"%d:%d:%d",&tm.x,&tm.y,&tm.z);
//	R_ASSERT3					((tm.x>=0)&&(tm.x<24)&&(tm.y>=0)&&(tm.y<60)&&(tm.z>=0)&&(tm.z<60),"Incorrect weather time",m_identifier.c_str());
//	exec_time					= tm.x*3600.f+tm.y*60.f+tm.z;
//	exec_time_loaded			= exec_time;

	m_ambient					= config.r_string(m_identifier, "ambient");
//	ambient						= config.r_fvector3(m_identifier, "ambient_color");
//	clouds_texture_name			= config.r_string(m_identifier, "clouds_texture");
//	far_plane					= config.r_float(m_identifier, 	"far_plane");
//	fog_distance				= config.r_float(m_identifier, 	"fog_distance");
//	fog_density					= config.r_float(m_identifier, 	"fog_density");
//	fog_color					= config.r_fvector3(m_identifier, "fog_color");
//	rain_color					= config.r_fvector3(m_identifier, "rain_color");
//	rain_density				= config.r_float(m_identifier,	"rain_density");
//	sky_color					= config.r_fvector3(m_identifier, "sky_color");
//	sky_rotation				= config.r_float(m_identifier,	"sky_rotation");
	
//	sky_texture_name			= config.r_string(m_identifier, "sky_texture");
//	string_path					st_env;
//	strconcat					(sizeof(st_env), st_env, sky_texture_name.c_str(), "#small");
//	sky_texture_env_name		= st_env;

//	sun_color					= config.r_fvector3(m_identifier, "sun_color");
//	m_fSunShaftsIntensity		= config.r_float(m_identifier,	"sun_shafts_intensity");
	m_sun						= config.r_string(m_identifier, "sun");
	m_thunderbolt_collection	= config.r_string(m_identifier, "thunderbolt_collection");
//	bolt_duration				= config.r_float(m_identifier, 	"bolt_duration");
//	bolt_period					= config.r_float(m_identifier, 	"bolt_period");
//	m_fWaterIntensity			= config.r_float(m_identifier, 	"water_intensity");
//	wind_direction				= config.r_float(m_identifier, 	"wind_direction");
//	wind_velocity				= config.r_float(m_identifier, 	"wind_velocity");

//	hemi_color					= config.r_fvector4(m_identifier, "hemi_color");

//	Fvector2					coords = config.r_fvector2(m_identifier, "sun_dir");
//	sun_dir.setHP				(deg2rad(coords.y), deg2rad(coords.x));

//	clouds_color				= config.r_fvector4(m_identifier, "clouds_color");

//	LPCSTR						clouds = config.r_string(m_identifier, "clouds_color");
//	VERIFY						(_GetItemCount(clouds) == 5);
//	string256					temp;
//	((Fvector&)clouds_color).mul(.5f*(float)atof(_GetItem(clouds,4,temp)));

//	on_device_create			();
	inherited::load				(m_manager, config);
}
Пример #5
0
bool CCar::attach_Actor(CGameObject* actor)
{
	if(Owner()||CPHDestroyable::Destroyed()) return false;
	CHolderCustom::attach_Actor(actor);

	IKinematics* K	= smart_cast<IKinematics*>(Visual());
	CInifile* ini	= K->LL_UserData();
	int id;
	if(ini->line_exist("car_definition","driver_place"))
		id=K->LL_BoneID(ini->r_string("car_definition","driver_place"));
	else
	{	
		Owner()->setVisible(0);
		id=K->LL_GetBoneRoot();
	}
	CBoneInstance& instance=K->LL_GetBoneInstance				(u16(id));
	m_sits_transforms.push_back(instance.mTransform);
	OnCameraChange(ectFirst);
	PPhysicsShell()->Enable();
	PPhysicsShell()->add_ObjectContactCallback(ActorObstacleCallback);
//	VisualUpdate();
	processing_activate();
	ReleaseHandBreak();
//	CurrentGameUI()->UIMainIngameWnd->CarPanel().Show(true);
//	CurrentGameUI()->UIMainIngameWnd->CarPanel().SetCarHealth(fEntityHealth/100.f);
	//CurrentGameUI()->UIMainIngameWnd.ShowBattery(true);
	//CBoneData&	bone_data=K->LL_GetData(id);
	//Fmatrix driver_pos_tranform;
	//driver_pos_tranform.setHPB(bone_data.bind_hpb.x,bone_data.bind_hpb.y,bone_data.bind_hpb.z);
	//driver_pos_tranform.c.set(bone_data.bind_translate);
	//m_sits_transforms.push_back(driver_pos_tranform);
	//H_SetParent(actor);

	return true;
}
Пример #6
0
void __fastcall TfrmBonePart::ebLoadFromClick(TObject *Sender)
{
//.
    xr_string temp_fn;
    if (EFS.GetOpenName	( _import_, temp_fn, false, NULL, 0))
    {
        ebClearClick	(Sender);
        CInifile ini	(temp_fn.c_str(), TRUE, TRUE, FALSE);
        string64		buff;
        for(int i=0; i<4; ++i)
        {
            sprintf	(buff,"part_%d",i);
            LPCSTR part_name = ini.r_string(buff, "partition_name");
            E[i]->Text = part_name;
            CInifile::Sect& S 	= ini.r_section(buff);
            CInifile::SectCIt it = S.Data.begin();
            CInifile::SectCIt e = S.Data.end();
            for (; it!=e; ++it)
            {
                if( 0!= stricmp(it->first.c_str(), "partition_name") )
                {
                    FHelper.AppendObject(T[i], it->first.c_str(), false, true);
                }
            }

        }
    }
}
Пример #7
0
//-----------------------------------------------------------------------------
// Environment ambient
//-----------------------------------------------------------------------------
void CEnvAmbient::SSndChannel::load(CInifile& config, LPCSTR sect)
{
    m_load_section = sect;

    m_sound_dist.x = config.r_float(m_load_section, "min_distance");
    m_sound_dist.y = config.r_float(m_load_section, "max_distance");
    m_sound_period.x = config.r_s32(m_load_section, "period0");
    m_sound_period.y = config.r_s32(m_load_section, "period1");
    m_sound_period.z = config.r_s32(m_load_section, "period2");
    m_sound_period.w = config.r_s32(m_load_section, "period3");

    // m_sound_period = config.r_ivector4(sect,"sound_period");
    R_ASSERT(m_sound_period.x <= m_sound_period.y && m_sound_period.z <= m_sound_period.w);
    // m_sound_period.mul (1000);// now in ms
    // m_sound_dist = config.r_fvector2(sect,"sound_dist");
    R_ASSERT2(m_sound_dist.y > m_sound_dist.x, sect);

    LPCSTR snds = config.r_string(sect, "sounds");
    u32 cnt = _GetItemCount(snds);
    string_path tmp;
    R_ASSERT3(cnt, "sounds empty", sect);

    m_sounds.resize(cnt);

    for (u32 k = 0; k < cnt; ++k)
    {
        _GetItem(snds, k, tmp);
        m_sounds[k].create(tmp, st_Effect, sg_SourceType);
    }
}
Пример #8
0
BOOL CWeaponStatMgun::net_Spawn(CSE_Abstract* DC)
{
	if(!inheritedPH::net_Spawn	(DC)) return FALSE;



	IKinematics* K			= smart_cast<IKinematics*>(Visual());
	CInifile* pUserData		= K->LL_UserData(); 

	R_ASSERT2				(pUserData,"Empty WeaponStatMgun user data!");

	m_rotate_x_bone			= K->LL_BoneID	(pUserData->r_string("mounted_weapon_definition","rotate_x_bone"));
	m_rotate_y_bone			= K->LL_BoneID	(pUserData->r_string("mounted_weapon_definition","rotate_y_bone"));
	m_fire_bone				= K->LL_BoneID	(pUserData->r_string("mounted_weapon_definition","fire_bone"));
	m_camera_bone			= K->LL_BoneID	(pUserData->r_string("mounted_weapon_definition","camera_bone"));

	U16Vec fixed_bones;
	fixed_bones.push_back	(K->LL_GetBoneRoot());
	PPhysicsShell()			= P_build_Shell(this,false,fixed_bones);

	CBoneData& bdX			= K->LL_GetData(m_rotate_x_bone); VERIFY(bdX.IK_data.type==jtJoint);
	m_lim_x_rot.set			(bdX.IK_data.limits[0].limit.x,bdX.IK_data.limits[0].limit.y);
	CBoneData& bdY			= K->LL_GetData(m_rotate_y_bone); VERIFY(bdY.IK_data.type==jtJoint);
	m_lim_y_rot.set			(bdY.IK_data.limits[1].limit.x,bdY.IK_data.limits[1].limit.y);
	

	xr_vector<Fmatrix> matrices;
	K->LL_GetBindTransform	(matrices);
	m_i_bind_x_xform.invert	(matrices[m_rotate_x_bone]);
	m_i_bind_y_xform.invert	(matrices[m_rotate_y_bone]);
	m_bind_x_rot			= matrices[m_rotate_x_bone].k.getP();
	m_bind_y_rot			= matrices[m_rotate_y_bone].k.getH();
	m_bind_x.set			(matrices[m_rotate_x_bone].c);
	m_bind_y.set			(matrices[m_rotate_y_bone].c);

	m_cur_x_rot				= m_bind_x_rot;
	m_cur_y_rot				= m_bind_y_rot;
	m_destEnemyDir.setHP	(m_bind_y_rot,m_bind_x_rot);
	XFORM().transform_dir	(m_destEnemyDir);

	inheritedShooting::Light_Create();

	processing_activate		();
	setVisible				(TRUE);
	setEnabled				(TRUE);
	return					TRUE;
}
Пример #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"));
     }
    }
}
Пример #10
0
CCarWeapon::CCarWeapon(CPhysicsShellHolder* obj)
{
	m_bActive	= false;
	m_bAutoFire	= false;
	m_object	= obj;
	m_Ammo		= xr_new<CCartridge>();

	CKinematics* K			= smart_cast<CKinematics*>(m_object->Visual());
	CInifile* pUserData		= K->LL_UserData(); 

	m_rotate_x_bone			= K->LL_BoneID	(pUserData->r_string("mounted_weapon_definition","rotate_x_bone"));
	m_rotate_y_bone			= K->LL_BoneID	(pUserData->r_string("mounted_weapon_definition","rotate_y_bone"));
	m_fire_bone				= K->LL_BoneID	(pUserData->r_string("mounted_weapon_definition","fire_bone"));
	m_min_gun_speed			= pUserData->r_float("mounted_weapon_definition","min_gun_speed");
	m_max_gun_speed			= pUserData->r_float("mounted_weapon_definition","max_gun_speed");
	CBoneData& bdX			= K->LL_GetData(m_rotate_x_bone); //VERIFY(bdX.IK_data.type==jtJoint);
	m_lim_x_rot.set			(bdX.IK_data.limits[0].limit.x,bdX.IK_data.limits[0].limit.y);
	CBoneData& bdY			= K->LL_GetData(m_rotate_y_bone); //VERIFY(bdY.IK_data.type==jtJoint);
	m_lim_y_rot.set			(bdY.IK_data.limits[1].limit.x,bdY.IK_data.limits[1].limit.y);
	

	xr_vector<Fmatrix>					matrices;
	K->LL_GetBindTransform				(matrices);
	m_i_bind_x_xform.invert				(matrices[m_rotate_x_bone]);
	m_i_bind_y_xform.invert				(matrices[m_rotate_y_bone]);
	m_bind_x_rot						= matrices[m_rotate_x_bone].k.getP();
	m_bind_y_rot						= matrices[m_rotate_y_bone].k.getH();
	m_bind_x.set						(matrices[m_rotate_x_bone].c);
	m_bind_y.set						(matrices[m_rotate_y_bone].c);

	m_cur_x_rot							= m_bind_x_rot;
	m_cur_y_rot							= m_bind_y_rot;
	m_destEnemyDir.setHP				(m_bind_y_rot,m_bind_x_rot);
	m_object->XFORM().transform_dir		(m_destEnemyDir);


	inheritedShooting::Light_Create		();
	Load								(pUserData->r_string("mounted_weapon_definition","wpn_section"));
	SetBoneCallbacks					();
	m_object->processing_activate		();

	m_weapon_h							= matrices[m_rotate_y_bone].c.y;
	m_fire_norm.set						(0,1,0);
	m_fire_dir.set						(0,0,1);
	m_fire_pos.set						(0,0,0);
}
Пример #11
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;
}
Пример #12
0
void CEnvAmbient::load(
    CInifile& ambients_config,
    CInifile& sound_channels_config,
    CInifile& effects_config,
    const shared_str& sect
    )
{
    m_ambients_config_filename = ambients_config.fname();
    m_load_section = sect;
    string_path tmp;

    // sounds
    LPCSTR channels = ambients_config.r_string(sect, "sound_channels");
    u32 cnt = _GetItemCount(channels);
    // R_ASSERT3 (cnt,"sound_channels empty", sect.c_str());
    m_sound_channels.resize(cnt);

    for (u32 i = 0; i < cnt; ++i)
        m_sound_channels[i] = create_sound_channel(sound_channels_config, _GetItem(channels, i, tmp));

    // effects
    m_effect_period.set(
        iFloor(
        ambients_config.r_float(sect, "min_effect_period")*1000.f
        ),
        iFloor(
        ambients_config.r_float(sect, "max_effect_period")*1000.f
        )
        );
    LPCSTR effs = ambients_config.r_string(sect, "effects");
    cnt = _GetItemCount(effs);
    // R_ASSERT3 (cnt,"effects empty", sect.c_str());

    m_effects.resize(cnt);
    for (u32 k = 0; k < cnt; ++k)
        m_effects[k] = create_effect(effects_config, _GetItem(effs, k, tmp));

    R_ASSERT(!m_sound_channels.empty() || !m_effects.empty());
}
Пример #13
0
void CMapListHelper::LoadMapInfo(LPCSTR map_cfg_fn, const xr_string& map_name, LPCSTR map_ver)
{
	CInifile	ini				(map_cfg_fn);

	shared_str _map_name		= map_name.substr(0,map_name.find('\\')).c_str();
	shared_str _map_ver			= map_ver;

	if(ini.section_exist("map_usage"))
	{
		if(ini.line_exist("map_usage","ver") && !map_ver)
			_map_ver				= ini.r_string("map_usage", "ver");

		CInifile::Sect S			= ini.r_section("map_usage");
		CInifile::SectCIt si		= S.Data.begin();
		CInifile::SectCIt si_e		= S.Data.end();
		for( ;si!=si_e; ++si)
		{
			const shared_str& game_type = (*si).first;
			
			if(game_type=="ver")		continue;

			SGameTypeMaps* M			= GetMapListInt(game_type);
			if(!M)
			{
				Msg						("--unknown game type-%s",game_type.c_str());
				m_storage.resize		(m_storage.size()+1);
				SGameTypeMaps&	Itm		= m_storage.back();
				Itm.m_game_type_name	= game_type;
				Itm.m_game_type_id		= ParseStringToGameType(game_type.c_str());
				M						= &m_storage.back();
			}
			
			SGameTypeMaps::SMapItm	Itm;
			Itm.map_name				= _map_name;
			Itm.map_ver					= _map_ver;
			
			if(M->m_map_names.end()!=std::find(M->m_map_names.begin(),M->m_map_names.end(),Itm))
			{
				Msg("! duplicate map found [%s] [%s]", _map_name.c_str(), _map_ver.c_str());
			}else
			{
#ifndef MASTER_GOLD
				Msg("added map [%s] [%s]", _map_name.c_str(), _map_ver.c_str());
#endif // #ifndef MASTER_GOLD
				M->m_map_names.push_back	(Itm);
			}
		}			
	}

}
Пример #14
0
void CUICustomMap::Init	(shared_str name, CInifile& gameLtx, LPCSTR sh_name)
{

	m_name				= name;
	LPCSTR tex;
	Fvector4 tmp;
	if( gameLtx.line_exist(m_name,"texture") ){
		tex			= gameLtx.r_string(m_name,"texture");
		tmp		= gameLtx.r_fvector4(m_name,"bound_rect");
	}else{
		tex = "ui\\ui_nomap2";
		tmp.set(-10000.0f,-10000.0f,10000.0f,10000.0f);
	}
	m_BoundRect.set		(tmp.x, tmp.y, tmp.z, tmp.w);
	CUIStatic::InitEx	(tex, sh_name, 0, 0, m_BoundRect.width(), m_BoundRect.height() );
	
	SetStretchTexture	(true);
	ClipperOn			();
}
Пример #15
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;
}
Пример #16
0
BOOL	CCar::net_Spawn				(CSE_Abstract* DC)
{
#ifdef DEBUG
	InitDebug();
#endif
	CSE_Abstract					*e = (CSE_Abstract*)(DC);
	CSE_ALifeCar					*co=smart_cast<CSE_ALifeCar*>(e);
	BOOL							R = inherited::net_Spawn(DC);

	PKinematics(Visual())->CalculateBones_Invalidate();
	PKinematics(Visual())->CalculateBones(TRUE);

	CPHSkeleton::Spawn(e);
	setEnabled						(TRUE);
	setVisible						(TRUE);
	PKinematics(Visual())->CalculateBones_Invalidate();
	PKinematics(Visual())->CalculateBones(TRUE);
	m_fSaveMaxRPM					= m_max_rpm;
	SetfHealth						(co->health);

	if(!g_Alive())					b_exploded=true;
	else							b_exploded=false;
									
	CDamagableItem::RestoreEffect();
	
	
	CInifile* pUserData		= PKinematics(Visual())->LL_UserData(); 
	if(pUserData->section_exist("destroyed"))
		CPHDestroyable::Load(pUserData,"destroyed");
	if(pUserData->section_exist("mounted_weapon_definition"))
		m_car_weapon = xr_new<CCarWeapon>(this);

	if(pUserData->section_exist("visual_memory_definition"))
	{
		m_memory			= xr_new<car_memory>(this);
		m_memory->reload	(pUserData->r_string("visual_memory_definition", "section"));
	}

	return							(CScriptEntity::net_Spawn(DC) && R);
	
}
Пример #17
0
BOOL CAI_Stalker::net_Spawn			(CSE_Abstract* DC)
{
#ifdef DEBUG_MEMORY_MANAGER
	u32								start = 0;
	if (g_bMEMO)
		start						= Memory.mem_usage();
#endif // DEBUG_MEMORY_MANAGER

	CSE_Abstract					*e	= (CSE_Abstract*)(DC);
	CSE_ALifeHumanStalker			*tpHuman = smart_cast<CSE_ALifeHumanStalker*>(e);
	R_ASSERT						(tpHuman);
	m_group_behaviour				= !!tpHuman->m_flags.test(CSE_ALifeObject::flGroupBehaviour);

	if (!CObjectHandler::net_Spawn(DC) || !inherited::net_Spawn(DC))
		return						(FALSE);
	
	set_money						(tpHuman->m_dwMoney, false);

#ifdef DEBUG_MEMORY_MANAGER
	u32									_start = 0;
	if (g_bMEMO)
		_start							= Memory.mem_usage();
#endif // DEBUG_MEMORY_MANAGER

	animation().reload				();

#ifdef DEBUG_MEMORY_MANAGER
	if (g_bMEMO)
		Msg					("CStalkerAnimationManager::reload() : %d",Memory.mem_usage() - _start);
#endif // DEBUG_MEMORY_MANAGER

	movement().m_head.current.yaw	= movement().m_head.target.yaw = movement().m_body.current.yaw = movement().m_body.target.yaw	= angle_normalize_signed(-tpHuman->o_torso.yaw);
	movement().m_body.current.pitch	= movement().m_body.target.pitch	= 0;

	if (ai().game_graph().valid_vertex_id(tpHuman->m_tGraphID))
		ai_location().game_vertex		(tpHuman->m_tGraphID);

	if (ai().game_graph().valid_vertex_id(tpHuman->m_tNextGraphID) && movement().restrictions().accessible(ai().game_graph().vertex(tpHuman->m_tNextGraphID)->level_point()))
		movement().set_game_dest_vertex	(tpHuman->m_tNextGraphID);

	R_ASSERT2					(
		ai().get_game_graph() && 
		ai().get_level_graph() && 
		ai().get_cross_table() && 
		(ai().level_graph().level_id() != u32(-1)),
		"There is no AI-Map, level graph, cross table, or graph is not compiled into the game graph!"
	);

	setEnabled						(TRUE);


	if (!Level().CurrentViewEntity())
		Level().SetEntity(this);

	if (!g_Alive())
		sound().set_sound_mask(u32(eStalkerSoundMaskDie));

	//загрузить иммунитеты из модельки сталкера
	IKinematics* pKinematics = smart_cast<IKinematics*>(Visual()); VERIFY(pKinematics);
	CInifile* ini = pKinematics->LL_UserData();
	if(ini)
	{
		if(ini->section_exist("immunities"))
		{
			LPCSTR imm_sect = ini->r_string("immunities", "immunities_sect");
			conditions().LoadImmunities(imm_sect,pSettings);
		}

		if(ini->line_exist("bone_protection","bones_protection_sect")){
			m_boneHitProtection			= new SBoneProtections();
			m_boneHitProtection->reload	(ini->r_string("bone_protection","bones_protection_sect"), pKinematics );
		}
	}

	//вычислить иммунета в зависимости от ранга
	static float novice_rank_immunity			= pSettings->r_float("ranks_properties", "immunities_novice_k");
	static float expirienced_rank_immunity		= pSettings->r_float("ranks_properties", "immunities_experienced_k");

	static float novice_rank_visibility			= pSettings->r_float("ranks_properties", "visibility_novice_k");
	static float expirienced_rank_visibility	= pSettings->r_float("ranks_properties", "visibility_experienced_k");

	static float novice_rank_dispersion			= pSettings->r_float("ranks_properties", "dispersion_novice_k");
	static float expirienced_rank_dispersion	= pSettings->r_float("ranks_properties", "dispersion_experienced_k");

	
	CHARACTER_RANK_VALUE rank = Rank();
	clamp(rank, 0, 100);
	float rank_k = float(rank)/100.f;
	m_fRankImmunity = novice_rank_immunity + (expirienced_rank_immunity - novice_rank_immunity) * rank_k;
	m_fRankVisibility = novice_rank_visibility + (expirienced_rank_visibility - novice_rank_visibility) * rank_k;
	m_fRankDisperison = expirienced_rank_dispersion + (expirienced_rank_dispersion - novice_rank_dispersion) * (1-rank_k);

	if (!fis_zero(SpecificCharacter().panic_threshold()))
		m_panic_threshold						= SpecificCharacter().panic_threshold();

	sight().setup					(CSightAction(SightManager::eSightTypeCurrentDirection));

#ifdef _DEBUG
	if (ai().get_alife() && !Level().MapManager().HasMapLocation("debug_stalker",ID())) {
		CMapLocation				*map_location = 
			Level().MapManager().AddMapLocation(
				"debug_stalker",
				ID()
			);

		map_location->SetHint		(cName());
	}
#endif // _DEBUG

#ifdef DEBUG_MEMORY_MANAGER
	if (g_bMEMO) {
		Msg							("CAI_Stalker::net_Spawn() : %d",Memory.mem_usage() - start);
	}
#endif // DEBUG_MEMORY_MANAGER

	if(SpecificCharacter().terrain_sect().size())
	{
		movement().locations().Load(*SpecificCharacter().terrain_sect());
	}

	sight().update					();
	Exec_Look						(.001f);
	
	m_pPhysics_support->in_NetSpawn	(e);

	return							(TRUE);
}
Пример #18
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;
}
Пример #19
0
void CCar::ParseDefinitions()
{
	 
	
	bone_map.clear();

	IKinematics* pKinematics=smart_cast<IKinematics*>(Visual());
	bone_map.insert(mk_pair(pKinematics->LL_GetBoneRoot(),physicsBone()));
	CInifile* ini = pKinematics->LL_UserData();
	R_ASSERT2(ini,"Car has no description !!! See ActorEditor Object - UserData");
	CExplosive::Load(ini,"explosion");
	//CExplosive::SetInitiator(ID());
	m_camera_position			= ini->r_fvector3("car_definition","camera_pos");
	///////////////////////////car definition///////////////////////////////////////////////////
	fill_wheel_vector			(ini->r_string	("car_definition","driving_wheels"),m_driving_wheels);
	fill_wheel_vector			(ini->r_string	("car_definition","steering_wheels"),m_steering_wheels);
	fill_wheel_vector			(ini->r_string	("car_definition","breaking_wheels"),m_breaking_wheels);
	fill_exhaust_vector			(ini->r_string	("car_definition","exhausts"),m_exhausts);
	fill_doors_map				(ini->r_string	("car_definition","doors"),m_doors);

	///////////////////////////car properties///////////////////////////////


	m_max_power			=		ini->r_float("car_definition","engine_power");
	m_max_power			*=		(0.8f*1000.f);

	m_max_rpm			=		ini->r_float("car_definition","max_engine_rpm");
	m_max_rpm			*=		(1.f/60.f*2.f*M_PI);


	m_min_rpm					=		ini->r_float("car_definition","idling_engine_rpm");
	m_min_rpm					*=		(1.f/60.f*2.f*M_PI);

	m_power_rpm					=		ini->r_float("car_definition","max_power_rpm");
	m_power_rpm					*=		(1.f/60.f*2.f*M_PI);//

	m_torque_rpm				=		ini->r_float("car_definition","max_torque_rpm");
	m_torque_rpm				*=		(1.f/60.f*2.f*M_PI);//

	m_power_increment_factor	=		READ_IF_EXISTS(ini,r_float,"car_definition","power_increment_factor",m_power_increment_factor);
	m_rpm_increment_factor		=		READ_IF_EXISTS(ini,r_float,"car_definition","rpm_increment_factor",m_rpm_increment_factor);
	m_power_decrement_factor	=		READ_IF_EXISTS(ini,r_float,"car_definition","power_decrement_factor",m_power_increment_factor);
	m_rpm_decrement_factor		=		READ_IF_EXISTS(ini,r_float,"car_definition","rpm_decrement_factor",m_rpm_increment_factor);
	m_power_neutral_factor		=		READ_IF_EXISTS(ini,r_float,"car_definition","power_neutral_factor",m_power_neutral_factor);
	R_ASSERT2(m_power_neutral_factor>0.1f&&m_power_neutral_factor<1.f,"power_neutral_factor must be 0 - 1 !!");
	if(ini->line_exist("car_definition","exhaust_particles"))
	{
		m_exhaust_particles =ini->r_string("car_definition","exhaust_particles");
	}
			
	b_auto_switch_transmission= !!ini->r_bool("car_definition","auto_transmission");

	InitParabola		();

	m_axle_friction		=		ini->r_float("car_definition","axle_friction");
	m_steering_speed	=		ini->r_float("car_definition","steering_speed");

	if(ini->line_exist("car_definition","break_time"))
	{
		m_break_time=ini->r_float("car_definition","break_time");
	}
	/////////////////////////transmission////////////////////////////////////////////////////////////////////////
	float main_gear_ratio=ini->r_float("car_definition","main_gear_ratio");

	R_ASSERT2(ini->section_exist("transmission_gear_ratio"),"no section transmission_gear_ratio");
	m_gear_ratious.push_back(ini->r_fvector3("transmission_gear_ratio","R"));
	m_gear_ratious[0][0]=-m_gear_ratious[0][0]*main_gear_ratio;
	string32 rat_num;
	for(int i=1;true;++i)
	{
		xr_sprintf(rat_num,"N%d",i);
		if(!ini->line_exist("transmission_gear_ratio",rat_num)) break;
		Fvector gear_rat=ini->r_fvector3("transmission_gear_ratio",rat_num);
		gear_rat[0]*=main_gear_ratio;
		gear_rat[1]*=(1.f/60.f*2.f*M_PI);
		gear_rat[2]*=(1.f/60.f*2.f*M_PI);
		m_gear_ratious.push_back(gear_rat);
	}

	///////////////////////////////sound///////////////////////////////////////////////////////
	m_car_sound->Init();
	///////////////////////////////fuel///////////////////////////////////////////////////
	m_fuel_tank=ini->r_float("car_definition","fuel_tank");
	m_fuel=m_fuel_tank;
	m_fuel_consumption=ini->r_float("car_definition","fuel_consumption");
	m_fuel_consumption/=100000.f;
	if(ini->line_exist("car_definition","exhaust_particles"))
		m_exhaust_particles = ini->r_string("car_definition","exhaust_particles");
	///////////////////////////////lights///////////////////////////////////////////////////
	m_lights.Init(this);
	m_lights.ParseDefinitions();


	
	if(ini->section_exist("animations"))
	{
		m_driver_anim_type=ini->r_u16("animations","driver_animation_type");
	}

	
	if(ini->section_exist("doors"))
	{
		m_doors_torque_factor=ini->r_u16("doors","open_torque_factor");
	}

	m_damage_particles.Init(this);
}
Пример #20
0
void xrCompressor::ProcessLTX(CInifile& ltx)
{
	config_ltx	=&ltx;

	if (ltx.line_exist("options","exclude_exts"))
		_SequenceToList(exclude_exts, ltx.r_string("options","exclude_exts"));

	files_list				= xr_new< xr_vector<char*> >();
	folders_list			= xr_new< xr_vector<char*> >();

	if(ltx.section_exist("include_folders"))
	{
		CInifile::Sect& if_sect	= ltx.r_section("include_folders");

		for (CInifile::SectCIt if_it=if_sect.Data.begin(); if_it!=if_sect.Data.end(); ++if_it)
		{
			BOOL ifRecurse		= CInifile::IsBOOL(if_it->second.c_str());
			u32 folder_mask		= FS_ListFolders | (ifRecurse?0:FS_RootOnly);

			string_path path;
			LPCSTR _path		= 0==xr_strcmp(if_it->first.c_str(),".\\")?"":if_it->first.c_str();
			xr_strcpy			(path,_path);
			u32 path_len		= xr_strlen(path);
			if ((0!=path_len)&&(path[path_len-1]!='\\')) xr_strcat(path,"\\");

			Msg					("");
			Msg					("Processing folder: '%s'",path);
			BOOL efRecurse;
			BOOL val			= IsFolderAccepted(ltx,path,efRecurse);
			if (val || (!val&&!efRecurse))
			{ 
				if (val)		
					GatherFiles	(path);

				xr_vector<char*>*	i_fl_list	= FS.file_list_open	("$target_folder$",path,folder_mask);
				if (!i_fl_list)
				{
					Msg			("ERROR: Unable to open folder list:", path);
					continue;
				}

				xr_vector<char*>::iterator it	= i_fl_list->begin();
				xr_vector<char*>::iterator itE	= i_fl_list->end();
				for (;it!=itE;++it)
				{ 
					xr_string tmp_path	= xr_string(path)+xr_string(*it);
					bool val		= IsFolderAccepted(ltx,tmp_path.c_str(),efRecurse);
					if (val)
					{
						folders_list->push_back(xr_strdup(tmp_path.c_str()));
						Msg			("+F: %s",tmp_path.c_str());
						// collect files
						if (ifRecurse) 
							GatherFiles (tmp_path.c_str());
					}else
					{
						Msg			("-F: %s",tmp_path.c_str());
					}
				}
				FS.file_list_close	(i_fl_list);
			}else
			{
				Msg					("-F: %s",path);
			}
		}
	}//if(ltx.section_exist("include_folders"))
	
	if(ltx.section_exist("include_files"))
	{
		CInifile::Sect& if_sect	= ltx.r_section("include_files");
		for (CInifile::SectCIt if_it=if_sect.Data.begin(); if_it!=if_sect.Data.end(); ++if_it)
		{
		  files_list->push_back	(xr_strdup(if_it->first.c_str()));
		}	
	}

	PerformWork	();

	// free
	xr_vector<char*>::iterator it	= files_list->begin();
	xr_vector<char*>::iterator itE	= files_list->end();
	for (;it!=itE;++it) 
		xr_free(*it);
	xr_delete(files_list);

	it				= folders_list->begin();
	itE				= folders_list->end();
	for (;it!=itE;++it) 
		xr_free(*it);
	xr_delete(folders_list);

	exclude_exts.clear_and_free();
}
Пример #21
0
void CCar::Init()
{

	CPHCollisionDamageReceiver::Init();

	//get reference wheel radius
	IKinematics* pKinematics=smart_cast<IKinematics*>(Visual());
	CInifile* ini = pKinematics->LL_UserData();
	R_ASSERT2(ini,"Car has no description !!! See ActorEditor Object - UserData");
	///SWheel& ref_wheel=m_wheels_map.find(pKinematics->LL_BoneID(ini->r_string("car_definition","reference_wheel")))->second;

	if(ini->section_exist("air_resistance"))
	{
		PPhysicsShell()->SetAirResistance(default_k_l*ini->r_float("air_resistance","linear_factor"),default_k_w*ini->r_float("air_resistance","angular_factor"));
	}
	if(ini->line_exist("car_definition","steer"))
	{
		
		
		m_bone_steer=pKinematics->LL_BoneID(ini->r_string("car_definition","steer"));
		VERIFY2(fsimilar(DET(pKinematics->LL_GetTransform(m_bone_steer)),1.f,EPS_L),"BBADD MTX");
		pKinematics->LL_GetBoneInstance(m_bone_steer).set_callback(bctPhysics,cb_Steer,this);
	}
	m_steer_angle=0.f;
	//ref_wheel.Init();
	m_ref_radius=ini->r_float("car_definition","reference_radius");//ref_wheel.radius;
	b_exploded						=false;
	b_engine_on						=false;
	b_clutch						=false;
	b_starting						=false;
	b_stalling						=false;
	b_transmission_switching		=false;
	m_root_transform.set(bone_map.find(pKinematics->LL_GetBoneRoot())->second.element->mXFORM);
	m_current_transmission_num=0;
	m_pPhysicsShell->set_DynamicScales(1.f,1.f);
	CDamagableItem::Init(GetfHealth(),3);
	float l_time_to_explosion=READ_IF_EXISTS(ini,r_float,"car_definition","time_to_explosion",120.f);
	CDelayedActionFuse::Initialize(l_time_to_explosion,CDamagableItem::DamageLevelToHealth(2));
	{
		xr_map<u16,SWheel>::iterator i,e;
		i=m_wheels_map.begin();
		e=m_wheels_map.end();
		for(;i!=e;++i)
		{
			i->second.Init();
			i->second.CDamagableHealthItem::Init(100.f,2);
		}
	}

	{
		xr_vector<SWheelDrive>::iterator i,e;
		i=m_driving_wheels.begin();
		e=m_driving_wheels.end();
		for(;i!=e;++i)
			i->Init();
	}

	{
		xr_vector<SWheelBreak>::iterator i,e;
		i=m_breaking_wheels.begin();
		e=m_breaking_wheels.end();
		for(;i!=e;++i)
			i->Init();
	}

	{
		xr_vector<SWheelSteer>::iterator i,e;
		i=m_steering_wheels.begin();
		e=m_steering_wheels.end();
		for(;i!=e;++i)
			i->Init();
	}

	{
		xr_vector<SExhaust>::iterator i,e;
		i=m_exhausts.begin();
		e=m_exhausts.end();
		for(;i!=e;++i)
			i->Init();
	}

	{
		xr_map<u16,SDoor>::iterator i,e;
		i=m_doors.begin();
		e=m_doors.end();
		for(;i!=e;++i)
		{
			i->second.Init();
			i->second.CDamagableHealthItem::Init(100,1);
		}
			
	}

	if(ini->section_exist("damage_items"))
	{
		CInifile::Sect& data		= ini->r_section("damage_items");
		for (CInifile::SectCIt		I=data.Data.begin(); I!=data.Data.end(); I++){
			const CInifile::Item& item	= *I;
			u16 index				= pKinematics->LL_BoneID(*item.first); 
			R_ASSERT3(index != BI_NONE, "Wrong bone name", *item.first);
			xr_map   <u16,SWheel>::iterator i=m_wheels_map.find(index);
			
			if(i!=m_wheels_map.end())
					i->second.CDamagableHealthItem::Init(float(atof(*item.second)),2);
			else 
			{
				xr_map   <u16,SDoor>::iterator i=m_doors.find(index);
				R_ASSERT3(i!=m_doors.end(),"only wheel and doors bones allowed for damage defs",*item.first);
				i->second.CDamagableHealthItem::Init(float(atof(*item.second)),1);
			}

		}
	}
	

	if(ini->section_exist("immunities"))
	{
		LoadImmunities("immunities",ini);
	}

	CDamageManager::reload("car_definition","damage",ini);
	
	HandBreak();
	Transmission(1);

}
Пример #22
0
void ProcessLTX(LPCSTR tgt_name, LPCSTR params, BOOL bFast)
{
	xr_string		ltx_name;
	LPCSTR ltx_nm	= strstr(params,".ltx");				VERIFY(ltx_nm!=0);
	string_path		ltx_fn;
	string_path		tmp;
	strncpy			(tmp,params,ltx_nm-params); tmp[ltx_nm-params]=0;
	_Trim			(tmp);
	strcat			(tmp,".ltx");
	strcpy			(ltx_fn,tmp);

	// append ltx path (if exist)
	string_path		fn,dr,di;
	_splitpath		(ltx_fn,dr,di,0,0);
	strconcat		(sizeof(fn),fn,dr,di);  
	if (0!=fn[0])
		FS.append_path	("ltx_path",fn,0,false);
	
	if (!FS.exist(ltx_fn)&&!FS.exist(ltx_fn,"$app_root$",tmp)) 
		Debug.fatal	(DEBUG_INFO,"ERROR: Can't find ltx file: '%s'",ltx_fn);

	CInifile ltx	(ltx_fn);
	printf			("Processing LTX...\n");

	BOOL make_pack	= ltx.line_exist("options","make_pack") ? ltx.r_bool("options","make_pack") : true;
	LPCSTR copy_path= ltx.line_exist("options","copy_path") ? ltx.r_string("options","copy_path") : 0;
	if (ltx.line_exist("options","exclude_exts"))
		_SequenceToList(exclude_exts,ltx.r_string("options","exclude_exts"));

	xr_vector<char*> list;
	xr_vector<char*> fl_list;
	if(ltx.section_exist("include_folders"))
	{
	CInifile::Sect& if_sect	= ltx.r_section("include_folders");
	for (CInifile::SectCIt if_it=if_sect.Data.begin(); if_it!=if_sect.Data.end(); if_it++)
	{
		BOOL ifRecurse		= CInifile::IsBOOL(if_it->second.c_str());
		u32 folder_mask		= FS_ListFolders | (ifRecurse?0:FS_RootOnly);

		string_path path;
		LPCSTR _path		= 0==xr_strcmp(if_it->first.c_str(),".\\")?"":if_it->first.c_str();
		strcpy				(path,_path);
		u32 path_len		= xr_strlen(path);
		if ((0!=path_len)&&(path[path_len-1]!='\\')) strcat(path,"\\");

		Log					("");
		OUT_LOG				("Processing folder: '%s'",path);
		BOOL efRecurse;
		BOOL val			= IsFolderAccepted(ltx,path,efRecurse);
		if (val || (!val&&!efRecurse))
		{ 
			if (val)		ProcessFolder	(list,path);

			xr_vector<char*>*	i_fl_list	= FS.file_list_open	("$target_folder$",path,folder_mask);
			if (!i_fl_list)
			{
				Log			("ERROR: Unable to open folder list:", path);
				continue;
			}

			xr_vector<char*>::iterator it	= i_fl_list->begin();
			xr_vector<char*>::iterator itE	= i_fl_list->end();
			for (;it!=itE;++it){ 
				xr_string tmp_path	= xr_string(path)+xr_string(*it);
				bool val		= IsFolderAccepted(ltx,tmp_path.c_str(),efRecurse);
				if (val)
				{
					fl_list.push_back(xr_strdup(tmp_path.c_str()));
					Msg			("+F: %s",tmp_path.c_str());
					// collect files
					if (ifRecurse) 
						ProcessFolder (list,tmp_path.c_str());
				}else
				{
					Msg			("-F: %s",tmp_path.c_str());
				}
			}
			FS.file_list_close	(i_fl_list);
		}else
		{
			Msg					("-F: %s",path);
		}
	}
}//if(ltx.section_exist("include_folders"))
	// compress
	{
		if(ltx.section_exist("include_files"))
		{
		CInifile::Sect& if_sect	= ltx.r_section("include_files");
		for (CInifile::SectCIt if_it=if_sect.Data.begin(); if_it!=if_sect.Data.end(); if_it++)
			{
				  list.push_back	(xr_strdup(if_it->first.c_str()));
			}	
		}
	
	}
	CompressList	(tgt_name,&list,&fl_list,bFast,make_pack,copy_path);

	// free
	xr_vector<char*>::iterator it	= list.begin();
	xr_vector<char*>::iterator itE	= list.end();
	for (;it!=itE;++it) xr_free(*it);
	it				= fl_list.begin();
	itE				= fl_list.end();
	for (;it!=itE;++it) xr_free(*it);

	exclude_exts.clear_and_free();
}
Пример #23
0
LPCSTR configs_verifyer::get_section_diff(CInifile::Sect* sect_ptr, CInifile & active_params, string256 & dst_diff)
{
	LPCSTR diff_str = NULL;
	bool	tmp_active_param = false;
	if (!strncmp(sect_ptr->Name.c_str(), "ap_", 3))
	{
		tmp_active_param = true;
	}

	for (CInifile::SectCIt cit = sect_ptr->Data.begin(),
			ciet = sect_ptr->Data.end(); cit != ciet; ++cit)
	{
		shared_str const &	tmp_value = cit->second;
		shared_str			real_value;
		if (tmp_active_param)
		{
			if (active_params.line_exist(sect_ptr->Name.c_str(), cit->first))
			{
				real_value = active_params.r_string(sect_ptr->Name.c_str(), cit->first.c_str());
				if (tmp_value != real_value)
				{
					LPCSTR	tmp_key_str = NULL;
					STRCONCAT(tmp_key_str,
						sect_ptr->Name.c_str(), "::", cit->first.c_str());
					STRCONCAT(diff_str,
						tmp_key_str,
						" = ",
						tmp_value.c_str(),
						",right = ",
						real_value.c_str());
					strncpy_s(dst_diff, diff_str, sizeof(dst_diff) - 1);
					dst_diff[sizeof(dst_diff) - 1] = 0;
					return dst_diff;
				}
				continue;
			}
		}
		if (!pSettings->line_exist(sect_ptr->Name, cit->first))
		{
			STRCONCAT(diff_str,
				"line ",
				sect_ptr->Name.c_str(),
				"::",
				cit->first.c_str(),
				" not found");
			strncpy_s(dst_diff, diff_str, sizeof(dst_diff) - 1);
			dst_diff[sizeof(dst_diff) - 1] = 0;
			return dst_diff;
		}
		real_value = pSettings->r_string(sect_ptr->Name.c_str(), cit->first.c_str());
		if (tmp_value != real_value)
		{
			LPCSTR	tmp_key_str = NULL;
			STRCONCAT(tmp_key_str,
				sect_ptr->Name.c_str(), "::", cit->first.c_str());
			STRCONCAT(diff_str,
				tmp_key_str,
				" = ",
				tmp_value.c_str(),
				",right = ",
				real_value.c_str());
			strncpy_s(dst_diff, diff_str, sizeof(dst_diff) - 1);
			dst_diff[sizeof(dst_diff) - 1] = 0;
			return dst_diff;
		}
	}
	return NULL;
}
Пример #24
0
BOOL CHelicopter::net_Spawn(CSE_Abstract*	DC)
{

    SetfHealth(100.0f);
    setState(CHelicopter::eAlive);
    m_flame_started					=false;
    m_light_started					=false;
    m_exploded						=false;
    m_ready_explode					=false;
    m_dead							=false;

    if (!inherited::net_Spawn(DC))
        return			(FALSE);

    CPHSkeleton::Spawn((CSE_Abstract*)(DC));
    for(u32 i=0; i<4; ++i)
        CRocketLauncher::SpawnRocket(*m_sRocketSection, smart_cast<CGameObject*>(this));

    // assigning m_animator here
    CSE_Abstract		*abstract	=(CSE_Abstract*)(DC);
    CSE_ALifeHelicopter	*heli		= smart_cast<CSE_ALifeHelicopter*>(abstract);
    VERIFY				(heli);

    R_ASSERT						(Visual()&&smart_cast<IKinematics*>(Visual()));
    IKinematics* K					= smart_cast<IKinematics*>(Visual());
    CInifile* pUserData				= K->LL_UserData();

    m_rotate_x_bone			= K->LL_BoneID	(pUserData->r_string("helicopter_definition","wpn_rotate_x_bone"));
    m_rotate_y_bone			= K->LL_BoneID	(pUserData->r_string("helicopter_definition","wpn_rotate_y_bone"));
    m_fire_bone				= K->LL_BoneID	(pUserData->r_string("helicopter_definition","wpn_fire_bone"));
    m_death_bones_to_hide	= pUserData->r_string("on_death_mode","scale_bone");
    m_left_rocket_bone		= K->LL_BoneID	(pUserData->r_string("helicopter_definition","left_rocket_bone"));
    m_right_rocket_bone		= K->LL_BoneID	(pUserData->r_string("helicopter_definition","right_rocket_bone"));

    m_smoke_bone 			= K->LL_BoneID	(pUserData->r_string("helicopter_definition","smoke_bone"));
    m_light_bone 			= K->LL_BoneID	(pUserData->r_string("helicopter_definition","light_bone"));

    CExplosive::Load		(pUserData,"explosion");
    CExplosive::SetInitiator(ID());

    LPCSTR s = pUserData->r_string("helicopter_definition","hit_section");

    if( pUserData->section_exist(s) ) {
        int lc = pUserData->line_count(s);
        LPCSTR name;
        LPCSTR value;
        s16 boneID;
        for (int i=0 ; i<lc; ++i) {
            pUserData->r_line( s, i, &name, &value);
            boneID	=K->LL_BoneID(name);
            m_hitBones.insert( std::make_pair(boneID, (float)atof(value)) );
        }
    }

    CBoneInstance& biX		= smart_cast<IKinematics*>(Visual())->LL_GetBoneInstance(m_rotate_x_bone);
    biX.set_callback		(bctCustom,BoneMGunCallbackX,this);
    CBoneInstance& biY		= smart_cast<IKinematics*>(Visual())->LL_GetBoneInstance(m_rotate_y_bone);
    biY.set_callback		(bctCustom,BoneMGunCallbackY,this);
    CBoneData& bdX			= K->LL_GetData(m_rotate_x_bone);
    VERIFY(bdX.IK_data.type==jtJoint);
    m_lim_x_rot.set			(bdX.IK_data.limits[0].limit.x,bdX.IK_data.limits[0].limit.y);
    CBoneData& bdY			= K->LL_GetData(m_rotate_y_bone);
    VERIFY(bdY.IK_data.type==jtJoint);
    m_lim_y_rot.set			(bdY.IK_data.limits[1].limit.x,bdY.IK_data.limits[1].limit.y);

    xr_vector<Fmatrix> matrices;
    K->LL_GetBindTransform	(matrices);
    m_i_bind_x_xform.invert	(matrices[m_rotate_x_bone]);
    m_i_bind_y_xform.invert	(matrices[m_rotate_y_bone]);
    m_bind_rot.x			= matrices[m_rotate_x_bone].k.getP();
    m_bind_rot.y			= matrices[m_rotate_y_bone].k.getH();
    m_bind_x.set			(matrices[m_rotate_x_bone].c);
    m_bind_y.set			(matrices[m_rotate_y_bone].c);

    IKinematicsAnimated	*A	= smart_cast<IKinematicsAnimated*>(Visual());
    if (A) {
        A->PlayCycle		(*heli->startup_animation);
        K->CalculateBones	(TRUE);
    }

    m_engineSound.create			(*heli->engine_sound,st_Effect,sg_SourceType);
    m_engineSound.play_at_pos		(0,XFORM().c,sm_Looped);

    CShootingObject::Light_Create	();


    setVisible						(TRUE);
    setEnabled						(TRUE);



    m_stepRemains						= 0.0f;

//lighting
    m_light_render						= ::Render->light_create();
    m_light_render->set_shadow			(false);
    m_light_render->set_type			(IRender_Light::POINT);
    m_light_render->set_range			(m_light_range);
    m_light_render->set_color			(m_light_color);

    if(g_Alive())processing_activate	();
    TurnEngineSound(false);
    if(pUserData->section_exist("destroyed"))
        CPHDestroyable::Load(pUserData,"destroyed");
#ifdef DEBUG
    Device.seqRender.Add(this,REG_PRIORITY_LOW-1);
#endif

    return TRUE;
}
Пример #25
0
bool ESceneToolBase::LoadLTX(CInifile& ini)
{
    m_ModifName 	= ini.r_string("modif", "name");
    m_ModifTime 	= ini.r_u32("modif", "time");
	return 			true;
}
Пример #26
0
void CEnvDescriptor::load(CEnvironment& environment, CInifile& config)
{
    Ivector3 tm = {0, 0, 0};
    sscanf(m_identifier.c_str(), "%d:%d:%d", &tm.x, &tm.y, &tm.z);
    R_ASSERT3((tm.x >= 0) && (tm.x < 24) && (tm.y >= 0) && (tm.y < 60) && (tm.z >= 0) && (tm.z < 60), "Incorrect weather time", m_identifier.c_str());
    exec_time = tm.x*3600.f + tm.y*60.f + tm.z;
    exec_time_loaded = exec_time;
    string_path st, st_env;
    xr_strcpy(st, config.r_string(m_identifier.c_str(), "sky_texture"));
    strconcat(sizeof(st_env), st_env, st, "#small");
    sky_texture_name = st;
    sky_texture_env_name = st_env;
    clouds_texture_name = config.r_string(m_identifier.c_str(), "clouds_texture");
    LPCSTR cldclr = config.r_string(m_identifier.c_str(), "clouds_color");
    float multiplier = 0, save = 0;
    sscanf(cldclr, "%f,%f,%f,%f,%f", &clouds_color.x, &clouds_color.y, &clouds_color.z, &clouds_color.w, &multiplier);
    save = clouds_color.w;
    clouds_color.mul(.5f*multiplier);
    clouds_color.w = save;

    sky_color = config.r_fvector3(m_identifier.c_str(), "sky_color");

    if (config.line_exist(m_identifier.c_str(), "sky_rotation")) sky_rotation = deg2rad(config.r_float(m_identifier.c_str(), "sky_rotation"));
    else sky_rotation = 0;
    far_plane = config.r_float(m_identifier.c_str(), "far_plane");
    fog_color = config.r_fvector3(m_identifier.c_str(), "fog_color");
    fog_density = config.r_float(m_identifier.c_str(), "fog_density");
    fog_distance = config.r_float(m_identifier.c_str(), "fog_distance");
    rain_density = config.r_float(m_identifier.c_str(), "rain_density");
    clamp(rain_density, 0.f, 1.f);
    rain_color = config.r_fvector3(m_identifier.c_str(), "rain_color");
    wind_velocity = config.r_float(m_identifier.c_str(), "wind_velocity");
    wind_direction = deg2rad(config.r_float(m_identifier.c_str(), "wind_direction"));
    ambient = config.r_fvector3(m_identifier.c_str(), "ambient_color");
    hemi_color = config.r_fvector4(m_identifier.c_str(), "hemisphere_color");
    sun_color = config.r_fvector3(m_identifier.c_str(), "sun_color");
    // if (config.line_exist(m_identifier.c_str(),"sun_altitude"))
    sun_dir.setHP(
        deg2rad(config.r_float(m_identifier.c_str(), "sun_altitude")),
        deg2rad(config.r_float(m_identifier.c_str(), "sun_longitude"))
        );
    R_ASSERT(_valid(sun_dir));
    // else
    // sun_dir.setHP (
    // deg2rad(config.r_fvector2(m_identifier.c_str(),"sun_dir").y),
    // deg2rad(config.r_fvector2(m_identifier.c_str(),"sun_dir").x)
    // );
    //AVO: commented to allow COC run in debug. I belive Cromm set longtitude to negative value in AF3 and that's why it is failing here
    //VERIFY2(sun_dir.y < 0, "Invalid sun direction settings while loading");

    lens_flare_id = environment.eff_LensFlare->AppendDef(environment, environment.m_suns_config, config.r_string(m_identifier.c_str(), "sun"));
    tb_id = environment.eff_Thunderbolt->AppendDef(environment, environment.m_thunderbolt_collections_config, environment.m_thunderbolts_config, config.r_string(m_identifier.c_str(), "thunderbolt_collection"));
    bolt_period = (tb_id.size()) ? config.r_float(m_identifier.c_str(), "thunderbolt_period") : 0.f;
    bolt_duration = (tb_id.size()) ? config.r_float(m_identifier.c_str(), "thunderbolt_duration") : 0.f;
    env_ambient = config.line_exist(m_identifier.c_str(), "ambient") ? environment.AppendEnvAmb(config.r_string(m_identifier.c_str(), "ambient")) : 0;

    if (config.line_exist(m_identifier.c_str(), "sun_shafts_intensity"))
        m_fSunShaftsIntensity = config.r_float(m_identifier.c_str(), "sun_shafts_intensity");

    if (config.line_exist(m_identifier.c_str(), "water_intensity"))
        m_fWaterIntensity = config.r_float(m_identifier.c_str(), "water_intensity");

#ifdef TREE_WIND_EFFECT
    if (config.line_exist(m_identifier.c_str(), "tree_amplitude_intensity"))
        m_fTreeAmplitudeIntensity = config.r_float(m_identifier.c_str(), "tree_amplitude_intensity");
#endif

    C_CHECK(clouds_color);
    C_CHECK(sky_color);
    C_CHECK(fog_color);
    C_CHECK(rain_color);
    C_CHECK(ambient);
    C_CHECK(hemi_color);
    C_CHECK(sun_color);
    on_device_create();
}