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); } */ }
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 (); }
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(); }