//----------------------------------------------------------------------------- // 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); } }
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); }
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")); } } }
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; }
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++) TCMap[i].set ((i%cpl)*width,(i/cpl)*fHeight,width); } } fCurrentHeight = fHeight; CInifile::Destroy (ini); // Shading pFontRender->Initialize(cShader, cTexture); }