本文整理汇总了C++中CInifile::r_float方法的典型用法代码示例。如果您正苦于以下问题:C++ CInifile::r_float方法的具体用法?C++ CInifile::r_float怎么用?C++ CInifile::r_float使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CInifile
的用法示例。
在下文中一共展示了CInifile::r_float方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ParseDefinitions
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"));
}
示例2: strstr
void CGameFont::Initialize (LPCSTR cShader, LPCSTR cTextureName)
{
string_path cTexture;
LPCSTR _lang = pSettings->r_string("string_table", "font_prefix");
bool is_di = strstr(cTextureName, "ui_font_hud_01") ||
strstr(cTextureName, "ui_font_hud_02") ||
strstr(cTextureName, "ui_font_console_02");
if(_lang && !is_di)
strconcat (cTexture, cTextureName, _lang);
else
strcpy (cTexture, cTextureName);
uFlags &=~fsValid;
vTS.set (1.f,1.f); // обязательно !!!
eCurrentAlignment = alLeft;
vInterval.set (1.f,1.f);
for (int i=0; i<256; i++) CharMap[i] = i;
strings.reserve (128);
// check ini exist
string256 fn,buf;
strcpy (buf,cTexture); if (strext(buf)) *strext(buf)=0;
R_ASSERT2 (FS.exist(fn,"$game_textures$",buf,".ini"),fn);
CInifile* ini = CInifile::Create(fn);
if (ini->section_exist("symbol_coords")){
for (int i=0; i<256; i++){
sprintf (buf,"%03d",i);
Fvector v = ini->r_fvector3("symbol_coords",buf);
TCMap[i].set (v.x,v.y,v[2]-v[0]);
}
fHeight = ini->r_float("symbol_coords","height");
}else{
if (ini->section_exist("char widths")){
fHeight = ini->r_float("char widths","height");
int cpl = 16;
for (int i=0; i<256; i++){
sprintf (buf,"%d",i);
float w = ini->r_float("char widths",buf);
TCMap[i].set ((i%cpl)*fHeight,(i/cpl)*fHeight,w);
}
}else{
R_ASSERT(ini->section_exist("font_size"));
fHeight = ini->r_float("font_size","height");
float width = ini->r_float("font_size","width");
const int cpl = ini->r_s32 ("font_size","cpl");
for (int i=0; i<256; i++)
TCMap[i].set ((i%cpl)*width,(i/cpl)*fHeight,width);
}
}
fCurrentHeight = fHeight;
CInifile::Destroy (ini);
// Shading
pShader.create (cShader,cTexture);
pGeom.create (FVF::F_TL, RCache.Vertex.Buffer(), RCache.QuadIB);
}
示例3:
//-----------------------------------------------------------------------------
// 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);
}
}
示例4: SFlare
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);
}
示例5: if
void CCar::SWheel::Load(LPCSTR section)
{
CKinematics *K =PKinematics(car->Visual()) ;
CInifile *ini =K->LL_UserData() ;
VERIFY (ini) ;
if(ini->section_exist(section))
{
collision_params.damping_factor =READ_IF_EXISTS(ini,r_float,section,"damping_factor",collision_params.damping_factor);
collision_params.spring_factor =READ_IF_EXISTS(ini,r_float,section,"spring_factor",collision_params.spring_factor);
collision_params.mu_factor =READ_IF_EXISTS(ini,r_float,section,"friction_factor",collision_params.mu_factor);
}
else if(ini->section_exist("wheels_params"))
{
collision_params.damping_factor =ini->r_float("wheels_params","damping_factor") ;
collision_params.spring_factor =ini->r_float("wheels_params","spring_factor") ;
collision_params.mu_factor =ini->r_float("wheels_params","friction_factor") ;
}
}
示例6: LoadLTX
//----------------------------------------------------
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;
}
示例7:
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);
}
}
示例8: load
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());
}
示例9:
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);
}
示例10: LoadLTX
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;
}
示例11:
//.........这里部分代码省略.........
// perlin noise
PerlinNoise1D = xr_new<CPerlinNoise1D>(Random.randI(0,0xFFFF));
PerlinNoise1D->SetOctaves(2);
PerlinNoise1D->SetAmplitude(0.66666f);
// tsky0 = Device.Resources->_CreateTexture("$user$sky0");
// tsky1 = Device.Resources->_CreateTexture("$user$sky1");
string_path file_name;
m_ambients_config =
xr_new<CInifile>(
FS.update_path(
file_name,
"$game_config$",
"environment\\ambients.ltx"
),
TRUE,
TRUE,
FALSE
);
m_sound_channels_config =
xr_new<CInifile>(
FS.update_path(
file_name,
"$game_config$",
"environment\\sound_channels.ltx"
),
TRUE,
TRUE,
FALSE
);
m_effects_config =
xr_new<CInifile>(
FS.update_path(
file_name,
"$game_config$",
"environment\\effects.ltx"
),
TRUE,
TRUE,
FALSE
);
m_suns_config =
xr_new<CInifile>(
FS.update_path(
file_name,
"$game_config$",
"environment\\suns.ltx"
),
TRUE,
TRUE,
FALSE
);
m_thunderbolt_collections_config =
xr_new<CInifile>(
FS.update_path(
file_name,
"$game_config$",
"environment\\thunderbolt_collections.ltx"
),
TRUE,
TRUE,
FALSE
);
m_thunderbolts_config =
xr_new<CInifile>(
FS.update_path(
file_name,
"$game_config$",
"environment\\thunderbolts.ltx"
),
TRUE,
TRUE,
FALSE
);
CInifile* config =
xr_new<CInifile>(
FS.update_path(
file_name,
"$game_config$",
"environment\\environment.ltx"
),
TRUE,
TRUE,
FALSE
);
// params
p_var_alt = deg2rad(config->r_float ( "environment","altitude" ));
p_var_long = deg2rad (config->r_float ( "environment","delta_longitude" ));
p_min_dist = _min (.95f,config->r_float ( "environment","min_dist_factor" ));
p_tilt = deg2rad (config->r_float ( "environment","tilt" ));
p_second_prop = config->r_float ( "environment","second_propability" );
clamp (p_second_prop,0.f,1.f);
p_sky_color = config->r_float ( "environment","sky_color" );
p_sun_color = config->r_float ( "environment","sun_color" );
p_fog_color = config->r_float ( "environment","fog_color" );
xr_delete (config);
}
示例12: Init
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);
//.........这里部分代码省略.........
示例13:
void CUIGlobalMap::Init (shared_str name, CInifile& gameLtx, LPCSTR sh_name)
{
inherited::Init (name, gameLtx, sh_name);
SetMaxZoom (gameLtx.r_float(m_name,"max_zoom"));
}
示例14: strstr
void CGameFont::Initialize (LPCSTR cShader, LPCSTR cTextureName)
{
string_path cTexture;
LPCSTR _lang = pSettings->r_string("string_table", "font_prefix");
bool is_di = strstr(cTextureName, "ui_font_hud_01") ||
strstr(cTextureName, "ui_font_hud_02") ||
strstr(cTextureName, "ui_font_console_02");
if(_lang && !is_di)
strconcat (sizeof(cTexture),cTexture, cTextureName, _lang);
else
strcpy_s (cTexture, sizeof(cTexture), cTextureName);
uFlags &=~fsValid;
vTS.set (1.f,1.f); // обязательно !!!
eCurrentAlignment = alLeft;
vInterval.set (1.f,1.f);
strings.reserve (128);
// check ini exist
string_path fn,buf;
strcpy_s (buf,cTexture); if (strext(buf)) *strext(buf)=0;
R_ASSERT2 (FS.exist(fn,"$game_textures$",buf,".ini"),fn);
CInifile* ini = CInifile::Create(fn);
nNumChars = 0x100;
TCMap = ( Fvector* ) xr_realloc( ( void* ) TCMap , nNumChars * sizeof( Fvector ) );
if ( ini->section_exist( "mb_symbol_coords" ) ) {
nNumChars = 0x10000;
TCMap = ( Fvector* ) xr_realloc( ( void* ) TCMap , nNumChars * sizeof( Fvector ) );
uFlags |= fsMultibyte;
fHeight = ini->r_float( "mb_symbol_coords" , "height" );
fXStep = ceil( fHeight / 2.0f );
// Searching for the first valid character
Fvector vFirstValid = {0,0,0};
if ( ini->line_exist( "mb_symbol_coords" , "09608" ) ) {
Fvector v = ini->r_fvector3( "mb_symbol_coords" , "09608" );
vFirstValid.set( v.x , v.y , 1 + v[2] - v[0] );
} else
for ( u32 i=0 ; i < nNumChars ; i++ ) {
sprintf_s( buf ,sizeof(buf), "%05d" , i );
if ( ini->line_exist( "mb_symbol_coords" , buf ) ) {
Fvector v = ini->r_fvector3( "mb_symbol_coords" , buf );
vFirstValid.set( v.x , v.y , 1 + v[2] - v[0] );
break;
}
}
// Filling entire character table
for ( u32 i=0 ; i < nNumChars ; i++ ) {
sprintf_s( buf ,sizeof(buf), "%05d" , i );
if ( ini->line_exist( "mb_symbol_coords" , buf ) ) {
Fvector v = ini->r_fvector3( "mb_symbol_coords" , buf );
TCMap[i].set( v.x , v.y , 1 + v[2] - v[0] );
} else
TCMap[i] = vFirstValid; // "unassigned" unprintable characters
}
// Special case for space
TCMap[ 0x0020 ].set( 0 , 0 , 0 );
// Special case for ideographic space
TCMap[ 0x3000 ].set( 0 , 0 , 0 );
}else
if (ini->section_exist("symbol_coords"))
{
float d = 0.0f;
//. if(ini->section_exist("width_correction"))
//. d = ini->r_float("width_correction", "value");
fHeight = ini->r_float("symbol_coords","height");
for (u32 i=0; i<nNumChars; i++){
sprintf_s (buf,sizeof(buf),"%03d",i);
Fvector v = ini->r_fvector3("symbol_coords",buf);
TCMap[i].set (v.x,v.y,v[2]-v[0]+d);
}
}else{
if (ini->section_exist("char widths")){
fHeight = ini->r_float("char widths","height");
int cpl = 16;
for (u32 i=0; i<nNumChars; i++){
sprintf_s (buf,sizeof(buf),"%d",i);
float w = ini->r_float("char widths",buf);
TCMap[i].set ((i%cpl)*fHeight,(i/cpl)*fHeight,w);
}
}else{
R_ASSERT(ini->section_exist("font_size"));
fHeight = ini->r_float("font_size","height");
float width = ini->r_float("font_size","width");
const int cpl = ini->r_s32 ("font_size","cpl");
for (u32 i=0; i<nNumChars; i++)
//.........这里部分代码省略.........
示例15: sizeof
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;
}