Beispiel #1
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);
    }
}
Beispiel #2
0
void TDB_packer::_load_(const xr_string& fname)
{
    	lbIncludeFolders->Items->Clear		();
    	lbIncludeFiles->Items->Clear		();

     	CInifile ini						(fname.c_str());

        if(ini.section_exist("include_folders"))
        {
           CInifile::Sect S 		= ini.r_section("include_folders");
           CInifile::SectCIt it 		= S.Data.begin();
           CInifile::SectCIt it_e 	= S.Data.end();
           for( ;it!=it_e; ++it)
           {
           		WideString 					ws;
                ws 							= (*it).first.c_str();
               lbIncludeFolders->Items->Add	(ws);
           }
        }
        if(ini.section_exist("include_files"))
        {
           CInifile::Sect S 		= ini.r_section("include_files");
           CInifile::SectCIt it 	= S.Data.begin();
           CInifile::SectCIt it_e 	= S.Data.end();
           for( ;it!=it_e; ++it)
           {
           		WideString 					ws;
                ws 							= (*it).first.c_str();
               lbIncludeFiles->Items->Add	(ws);
           }
        }
        Caption	=	fname.c_str();
}
Beispiel #3
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);
}
void manager::load			()
{
	string_path				file_name;
	CInifile*				config =
		new CInifile(
			FS.update_path(
				file_name,
				"$game_config$",
				"environment\\sound_channels.ltx"
			),
			TRUE,
			TRUE,
			FALSE
		);

	VERIFY					(m_channels.empty());

	typedef CInifile::Root	sections_type;
	sections_type&			sections = config->sections();
	m_channels.reserve		(sections.size());
	sections_type::const_iterator	i = sections.begin();
	sections_type::const_iterator	e = sections.end();
	for ( ; i != e; ++i) {
		channel*			object = new channel(*this, (*i)->Name);
		object->load		(*config);
		object->fill		(m_collection);
		m_channels.push_back(object);
	}

	xr_delete				(config);
}
Beispiel #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;
}
Beispiel #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);
                }
            }

        }
    }
}
void Weapon_Statistic::WriteLtx(CInifile& ini, LPCSTR sect)
{
	ini.w_string(sect,"wpn_name",WName.c_str());

	ini.w_string(sect,"wpn_inv_name",InvName.c_str());

	ini.w_u32(sect,"wpn_dwNumBought",NumBought);

	ini.w_u32(sect,"wpn_dwRoundsFired",m_dwRoundsFired);

	ini.w_u32(sect,"wpn_dwBulletsFired",m_dwBulletsFired);

	ini.w_u32(sect,"wpn_dwHitsScored",m_dwHitsScored);

	ini.w_u32(sect,"wpn_dwKillsScored",m_dwKillsScored);

	ini.w_u16(sect,"wpn_dwExplosionKills", m_explosion_kills);

	ini.w_u16(sect,"wpn_dwBleedKills", m_bleed_kills);

	//----------------------------------------------
	u32 NumHits = 0;
	u32 i = 0;
	for (i=0; i<m_Hits.size(); i++)
	{
		HitData& Hit = m_Hits[i];
		if (Hit.Completed && Hit.count) NumHits++;
	};

	ini.w_u32(sect,"NumHits",NumHits);

	u32 hits_size = m_Hits.size();
	i = 0;
	u32 hit_number = 0;
	u8 hit_index = 0;
	while (i < hits_size)
	{
		HitData& Hit		= m_Hits[i];
		if (!Hit.Completed)
		{
			++i;
			hit_index = 0;
			continue;
		}
		
		string512				save_prefix;
		xr_sprintf				(save_prefix,"hit_%d_", hit_number);

		Hit.WriteLtx			(ini, sect, save_prefix);
		
		++hit_index;
		if (hit_index >= Hit.count)
		{
			hit_index = 0;
			++i;
		}
		++hit_number;
	};
};
void ESceneSpawnTool::SaveLTX(CInifile& ini, int id)
{
	inherited::SaveLTX	(ini, id);

	ini.w_u32		("main", "version", SPAWN_TOOLS_VERSION);

    ini.w_u32		("main", "flags", m_Flags.get());
}
Beispiel #9
0
void ESceneSectorTool::SaveLTX(CInifile& ini)
{
	inherited::SaveLTX	(ini);

	ini.w_u32		("main", "version", SECTOR_TOOLS_VERSION);

    ini.w_u32		("main", "flags", m_Flags.get());
}
Beispiel #10
0
void ESoundEnvironment::SaveLTX(CInifile& ini, LPCSTR sect_name)
{
	inherited::SaveLTX	(ini, sect_name);

	ini.w_u32		(sect_name, "version", SOUND_ENV_VERSION);

    ini.w_string	(sect_name, "env_inner", m_EnvInner.c_str());
    ini.w_string	(sect_name, "env_outer", m_EnvOuter.c_str());
}
Beispiel #11
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);
}
Beispiel #12
0
bool CLog::IsWrite()
{
	CInifile ini;
	ini.ReadInifile( "argument", "Log", "false" );
	std::string contents = ini.GetContents();
	transform( contents.begin(), contents.end(), contents.begin(), ::tolower );

	return !contents.compare( "true" );
}
Beispiel #13
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;
}
Beispiel #14
0
///////////////////////////////
// Iniファイルから値を取得する
bool CArgBase::ReadInifile( const _TCHAR *sContents, const _TCHAR *sKey )
{
	m_sReadedIniData = "";

	CInifile ini;
	ini.ReadInifile( sContents, sKey, "" );
	if( strlen( ini.GetContents() )	<= 0 )	return false;

	m_sReadedIniData = ini.GetContents();
	return true;
}
Beispiel #15
0
void CCar::SWheelBreak::Load(LPCSTR section)
{
	CKinematics		*K			=PKinematics(pwheel->car->Visual())												;
	CInifile		*ini		=K->LL_UserData()																;
	VERIFY						(ini)																			;
	break_torque		=		ini->r_float("car_definition","break_torque")									;
	hand_break_torque	=		READ_IF_EXISTS(ini,r_float,"car_definition","hand_break_torque",break_torque)	;
	if(ini->section_exist(section))
	{	
		break_torque					=READ_IF_EXISTS(ini,r_float,section,"break_torque",break_torque);
		hand_break_torque				=READ_IF_EXISTS(ini,r_float,section,"hand_break_torque",hand_break_torque);
	}
}
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);
}
Beispiel #17
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);
			}
		}			
	}

}
Beispiel #18
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"));
	
}
void HitData::WriteLtx(CInifile& ini, LPCSTR sect, LPCSTR prefix)
{
	string512		buff;
	
	ini.w_fvector3(sect,strconcat(sizeof(buff), buff, prefix ,"pos_0"),Pos0);
	ini.w_fvector3(sect,strconcat(sizeof(buff), buff, prefix ,"pos_1"),Pos1);
	
	ini.w_u16(sect,strconcat(sizeof(buff), buff, prefix ,"BoneID"),BoneID);

	ini.w_bool(sect,strconcat(sizeof(buff), buff, prefix ,"Deadly"),Deadly);

	ini.w_string(sect,strconcat(sizeof(buff), buff, prefix ,"TargetName"),TargetName.c_str());

	ini.w_string(sect,strconcat(sizeof(buff), buff, prefix ,"BoneName"),BoneName.c_str());
};
//----------------------------------------------------
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;
}
void ambient::save			(CInifile& config)
{
	u32						count = 1;
	LPSTR					temp = 0;
	{
		sound_container_type::const_iterator	b = m_sound_channels_ids.begin(), i = b;
		sound_container_type::const_iterator	e = m_sound_channels_ids.end();
		for ( ; i != e; ++i)
			count			+= (*i)->id().size() + 2;

		temp				= (LPSTR)_alloca(count*sizeof(char));
		*temp				= 0;
		for (i = b; i != e; ++i) {
			if (i == b) {
				strcpy_s	(temp, count, (*i)->id().c_str());
				continue;
			}

			strcat_s		(temp, count, ", ");
			strcat_s		(temp, count, (*i)->id().c_str());
		}
	}

	config.w_string			(m_load_section.c_str(), "sound_channels",	  temp);
	config.w_float			(m_load_section.c_str(), "min_effect_period", float(m_effect_period.x)/1000.f);
	config.w_float			(m_load_section.c_str(), "max_effect_period", float(m_effect_period.y)/1000.f);

	{
		count				= 1;
		effect_container_type::const_iterator	b = m_effects_ids.begin(), i = b;
		effect_container_type::const_iterator	e = m_effects_ids.end();
		for ( ; i != e; ++i)
			count			+= (*i)->id().size() + 2;

		temp				= (LPSTR)_alloca(count*sizeof(char));
		*temp				= 0;
		for (i = b; i != e; ++i) {
			if (i == b) {
				strcpy_s	(temp, count, (*i)->id().c_str());
				continue;
			}

			strcat_s		(temp, count, ", ");
			strcat_s		(temp, count, (*i)->id().c_str());
		}
	}
	config.w_string			(m_load_section.c_str(), "effects", temp);
}
Beispiel #22
0
void CUILevelMap::Init	(shared_str name, CInifile& gameLtx, LPCSTR sh_name)
{
	inherited::Init(name, gameLtx, sh_name);
	Fvector4 tmp = gameLtx.r_fvector4(MapName(),"global_rect");
	m_GlobalRect.set(tmp.x, tmp.y, tmp.z, tmp.w);

#ifdef DEBUG
	float kw = m_GlobalRect.width	()	/	BoundRect().width		();
	float kh = m_GlobalRect.height	()	/	BoundRect().height	();

	if(FALSE==fsimilar(kw,kh,EPS_L)){
		Msg(" --incorrect global rect definition for map [%s]  kw=%f kh=%f",*MapName(),kw,kh);
		Msg(" --try x2=%f or  y2=%f",m_GlobalRect.x1+kh*BoundRect().width(), m_GlobalRect.y1+kw*BoundRect().height());
	}
#endif
//	Msg("Succesfully loaded map %s. Zoom=%f",*name, kw);
/*	
	if(gameLtx.line_exist(MapName(),"anomalies_texture")){
		LPCSTR texture						= gameLtx.r_string	(MapName(),"anomalies_texture");
		Fvector4 tmp						= gameLtx.r_fvector4(MapName(),"anomalies_texture_rect"); //lt,wh
		Frect rect; rect.set				(tmp.x,tmp.y,tmp.x+tmp.z,tmp.y+tmp.w);
		m_anomalies_map						= xr_new<CUIStatic>();
		m_anomalies_map->Init				(texture,0.0f,0.0f,0.0f,0.0f);
		m_anomalies_map->GetUIStaticItem().SetOriginalRect(rect);
		m_anomalies_map->SetStretchTexture	(true);
		m_anomalies_map->SetAutoDelete		(false);
	}
*/
}
Beispiel #23
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;
}
Beispiel #24
0
bool IsFolderAccepted(CInifile& ltx, LPCSTR path, BOOL& recurse)
{
	// exclude folders
	if( ltx.section_exist("exclude_folders") )
	{
		CInifile::Sect& ef_sect	= ltx.r_section("exclude_folders");
		for (CInifile::SectCIt ef_it=ef_sect.Data.begin(); ef_it!=ef_sect.Data.end(); ef_it++){
			recurse	= CInifile::IsBOOL(ef_it->second.c_str());
			if (recurse)	{
				if (path==strstr(path,ef_it->first.c_str()))	return false;
			}else{
				if (0==xr_strcmp(path,ef_it->first.c_str()))	return false;
			}
		}
	}
	return true;
}
Beispiel #25
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);
}
Beispiel #26
0
void __fastcall TDB_packer::btnSaveClick(TObject *Sender)
{
   	CInifile ini						(m_cfgFileName.c_str(), FALSE, FALSE, TRUE);

   	for(int i=0; i<lbIncludeFolders->Items->Count; ++i)
    {
    	AnsiString astr = lbIncludeFolders->Items->Strings[i];
    	ini.w_bool("include_folders",astr.c_str(), TRUE);
    }

   	for(int j=0; j<lbIncludeFiles->Items->Count; ++j)
    {
    	AnsiString astr = lbIncludeFiles->Items->Strings[j];
    	ini.w_bool("include_files",astr.c_str(), TRUE);
    }

}
Beispiel #27
0
void SAINode::SaveLTX(CInifile& ini, LPCSTR sect_name, ESceneAIMapTool* tools)
{
	R_ASSERT2		(0, "dont use it !!!");
	u32 			id;
    u16 			pl;
	NodePosition 	np;

    id 				= n1?(u32)n1->idx:InvalidNode;
    ini.w_u32		(sect_name,"n1", id);

    id 				= n2?(u32)n2->idx:InvalidNode;
    ini.w_u32		(sect_name,"n2", id);

    id 				= n3?(u32)n3->idx:InvalidNode;
    ini.w_u32		(sect_name,"n3", id);

    id 				= n4?(u32)n4->idx:InvalidNode;
    ini.w_u32		(sect_name,"n4", id);

    pl 				= pvCompress (Plane.n);
    ini.w_u16		(sect_name, "plane", pl);

	tools->PackPosition(np,Pos,tools->m_AIBBox,tools->m_Params);
    string256		buff;

	s16				x;
	u16				y;
	s16				z;

    sprintf			(buff,"%i,%u,%i",np.x,np.y,np.z);
    ini.w_string	(sect_name, "np", buff);
    ini.w_u8		(sect_name, "flag", flags.get());
}
void WeaponUsageStatistic::WriteLtx(CInifile& ini)
{
	LPCSTR sect = "wpn_usage";

	ini.w_u32(sect, "dwTotalPlayersAliveTime_0_sec",m_dwTotalPlayersAliveTime[0]/1000);
	ini.w_u32(sect, "dwTotalPlayersAliveTime_1_sec",m_dwTotalPlayersAliveTime[1]/1000);
	ini.w_u32(sect, "dwTotalPlayersAliveTime_2_sec",m_dwTotalPlayersAliveTime[2]/1000);

	ini.w_u32(sect, "dwTotalPlayersMoneyRound_0",m_dwTotalPlayersMoneyRound[0]);
	ini.w_u32(sect, "dwTotalPlayersMoneyRound_1",m_dwTotalPlayersMoneyRound[1]);
	ini.w_u32(sect, "dwTotalPlayersMoneyRound_2",m_dwTotalPlayersMoneyRound[2]);

	ini.w_u32(sect, "dwTotalNumRespawns_0",m_dwTotalNumRespawns[0]);
	ini.w_u32(sect, "dwTotalNumRespawns_1",m_dwTotalNumRespawns[1]);
	ini.w_u32(sect, "dwTotalNumRespawns_2",m_dwTotalNumRespawns[2]);

	u32 NumPlayers = aPlayersStatistic.size();

	ini.w_u32(sect, "NumPlayers",NumPlayers);

	for (u32 i=0; i<NumPlayers; i++)
	{
		Player_Statistic& PS = aPlayersStatistic[i];
		string512			save_sect;
		sprintf_s			(save_sect,"%s_player_%d",sect,i);
		PS.WriteLtx			(ini,save_sect);
	}
}
Beispiel #29
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;
}
Beispiel #30
0
void CGroupObject::SaveLTX(CInifile& ini, LPCSTR sect_name)
{
	CCustomObject::SaveLTX(ini, sect_name);

	ini.w_u32			(sect_name, "version", GROUPOBJ_CURRENT_VERSION);

    ObjectList		grp_lst;
    GetObjects		(grp_lst);
    ObjectList::iterator it;
    for(it=grp_lst.begin(); it!=grp_lst.end(); ++it)
        (*it)->m_CO_Flags.set(CCustomObject::flObjectInGroup, FALSE);
        
    Scene->SaveObjectsLTX(grp_lst, sect_name, "ingroup", ini);

    for(it=grp_lst.begin(); it!=grp_lst.end(); ++it)
        (*it)->m_CO_Flags.set(CCustomObject::flObjectInGroup, TRUE);

    ini.w_string		(sect_name, "ref_name", m_ReferenceName_.c_str());
}