void CCartridge::Load(LPCSTR section, u8 LocalAmmoType) { m_ammoSect = section; m_LocalAmmoType = LocalAmmoType; m_kDist = pSettings->r_float(section, "k_dist"); m_kDisp = pSettings->r_float(section, "k_disp"); m_kHit = pSettings->r_float(section, "k_hit"); m_kImpulse = pSettings->r_float(section, "k_impulse"); m_kPierce = pSettings->r_float(section, "k_pierce"); m_kAP = READ_IF_EXISTS(pSettings, r_float, section, "k_ap", 0.0f); m_u8ColorID = READ_IF_EXISTS(pSettings, r_u8, section, "tracer_color_ID", 0); if (pSettings->line_exist(section, "k_air_resistance")) m_kAirRes = pSettings->r_float(section, "k_air_resistance"); else m_kAirRes = pSettings->r_float(BULLET_MANAGER_SECTION, "air_resistance_k"); m_flags.set (cfTracer, pSettings->r_bool(section, "tracer")); m_buckShot = pSettings->r_s32(section, "buck_shot"); m_impair = pSettings->r_float(section, "impair"); fWallmarkSize = pSettings->r_float(section, "wm_size"); m_flags.set (cfCanBeUnlimited | cfRicochet, TRUE); if(pSettings->line_exist(section,"can_be_unlimited")) m_flags.set(cfCanBeUnlimited, pSettings->r_bool(section, "can_be_unlimited")); if(pSettings->line_exist(section,"explosive")) m_flags.set (cfExplosive, pSettings->r_bool(section, "explosive")); bullet_material_idx = GMLib.GetMaterialIdx(WEAPON_MATERIAL_NAME); VERIFY (u16(-1)!=bullet_material_idx); VERIFY (fWallmarkSize>0); m_InvShortName = CStringTable().translate( pSettings->r_string(section, "inv_name_short")); }
void CWeaponAmmo::Load(LPCSTR section) { inherited::Load (section); m_kDist = pSettings->r_float(section, "k_dist"); m_kDisp = pSettings->r_float(section, "k_disp"); m_kHit = pSettings->r_float(section, "k_hit"); m_kImpulse = pSettings->r_float(section, "k_impulse"); m_kPierce = pSettings->r_float(section, "k_pierce"); m_kAP = READ_IF_EXISTS(pSettings, r_float, section, "k_ap", 0.0f); m_u8ColorID = READ_IF_EXISTS(pSettings, r_u8, section, "tracer_color_ID", 0); if (pSettings->line_exist(section, "k_air_resistance")) m_kAirRes = pSettings->r_float(section, "k_air_resistance"); else m_kAirRes = pSettings->r_float(BULLET_MANAGER_SECTION, "air_resistance_k"); m_tracer = !!pSettings->r_bool(section, "tracer"); m_buckShot = pSettings->r_s32(section, "buck_shot"); m_impair = pSettings->r_float(section, "impair"); fWallmarkSize = pSettings->r_float(section,"wm_size"); R_ASSERT (fWallmarkSize>0); m_boxSize = (u16)pSettings->r_s32(section, "box_size"); m_boxCurr = m_boxSize; }
void CEnemyManager::reload (LPCSTR section) { m_ignore_monster_threshold = READ_IF_EXISTS(pSettings,r_float,section,"ignore_monster_threshold",1.f); m_max_ignore_distance = READ_IF_EXISTS(pSettings,r_float,section,"max_ignore_distance",0.f); m_last_enemy_time = 0; m_last_enemy = 0; m_last_enemy_change = 0; m_useful_callback.clear (); VERIFY (m_ready_to_save); }
Irect CInventoryItem::GetUpgrIconRect() const { u32 x,y,w,h; x = READ_IF_EXISTS(pSettings,r_u32,m_object->cNameSect(),"upgr_icon_x", 0); y = READ_IF_EXISTS(pSettings,r_u32,m_object->cNameSect(),"upgr_icon_y", 0); w = READ_IF_EXISTS(pSettings,r_u32,m_object->cNameSect(),"upgr_icon_width", 0); h = READ_IF_EXISTS(pSettings,r_u32,m_object->cNameSect(),"upgr_icon_height", 0); return Irect().set(x,y,w,h); }
void CWeapon::reload (LPCSTR section) { CShootingObject::reload (section); CHudItemObject::reload (section); m_can_be_strapped = true; m_strapped_mode = false; if (pSettings->line_exist(section,"strap_bone0")) m_strap_bone0 = pSettings->r_string(section,"strap_bone0"); else m_can_be_strapped = false; if (pSettings->line_exist(section,"strap_bone1")) m_strap_bone1 = pSettings->r_string(section,"strap_bone1"); else m_can_be_strapped = false; if (m_eScopeStatus == ALife::eAddonAttachable) { m_addon_holder_range_modifier = READ_IF_EXISTS(pSettings,r_float,GetScopeName(),"holder_range_modifier",m_holder_range_modifier); m_addon_holder_fov_modifier = READ_IF_EXISTS(pSettings,r_float,GetScopeName(),"holder_fov_modifier",m_holder_fov_modifier); } else { m_addon_holder_range_modifier = m_holder_range_modifier; m_addon_holder_fov_modifier = m_holder_fov_modifier; } { Fvector pos,ypr; pos = pSettings->r_fvector3 (section,"position"); ypr = pSettings->r_fvector3 (section,"orientation"); ypr.mul (PI/180.f); m_Offset.setHPB (ypr.x,ypr.y,ypr.z); m_Offset.translate_over (pos); } m_StrapOffset = m_Offset; if (pSettings->line_exist(section,"strap_position") && pSettings->line_exist(section,"strap_orientation")) { Fvector pos,ypr; pos = pSettings->r_fvector3 (section,"strap_position"); ypr = pSettings->r_fvector3 (section,"strap_orientation"); ypr.mul (PI/180.f); m_StrapOffset.setHPB (ypr.x,ypr.y,ypr.z); m_StrapOffset.translate_over (pos); } else m_can_be_strapped = false; m_ef_main_weapon_type = READ_IF_EXISTS(pSettings,r_u32,section,"ef_main_weapon_type",u32(-1)); m_ef_weapon_type = READ_IF_EXISTS(pSettings,r_u32,section,"ef_weapon_type",u32(-1)); }
Frect CInventoryItem::GetKillMsgRect() const { float x,y,w,h; x = READ_IF_EXISTS(pSettings,r_float,m_object->cNameSect(),"kill_msg_x", 0.0f); y = READ_IF_EXISTS(pSettings,r_float,m_object->cNameSect(),"kill_msg_y", 0.0f); w = READ_IF_EXISTS(pSettings,r_float,m_object->cNameSect(),"kill_msg_width", 0.0f); h = READ_IF_EXISTS(pSettings,r_float,m_object->cNameSect(),"kill_msg_height", 0.0f); return Frect().set(x,y,w,h); }
void CEatableItem::UseBy (CEntityAlive* entity_alive) { CInventoryOwner* IO = smart_cast<CInventoryOwner*>(entity_alive); R_ASSERT (IO); R_ASSERT (m_pCurrentInventory==IO->m_inventory); R_ASSERT (object().H_Parent()->ID()==entity_alive->ID()); entity_alive->conditions().ChangeHealth (m_fHealthInfluence); entity_alive->conditions().ChangePower (m_fPowerInfluence); entity_alive->conditions().ChangeSatiety (m_fSatietyInfluence); entity_alive->conditions().ChangeRadiation (m_fRadiationInfluence); entity_alive->conditions().ChangeBleeding (m_fWoundsHealPerc); entity_alive->conditions().SetMaxPower( entity_alive->conditions().GetMaxPower()+m_fMaxPowerUpInfluence ); //уменьшить количество порций if(m_iPortionsNum > 0) --(m_iPortionsNum); else m_iPortionsNum = 0; #if defined(EAT_PORTIONS_INFLUENCE) // Real Wolf: Уменьшаем вес и цену после использования. auto sect = object().cNameSect().c_str(); auto weight = READ_IF_EXISTS(pSettings, r_float, sect, "inv_weight", 0.0f); auto cost = READ_IF_EXISTS(pSettings, r_float, sect, "cost", 0.0f); m_weight -= weight / m_iStartPortionsNum; m_cost -= cost / m_iStartPortionsNum; #endif /* Real Wolf: После использования предмета, удаляем его иконку и добавляем заново. Таким образом вызовется колбек на группировку, где пользователь решит, группировать или нет предмета. 13.08.2014.*/ if (!Empty() && m_cell_item && m_cell_item->ChildsCount() ) { auto owner = m_cell_item->OwnerList(); auto itm = m_cell_item->PopChild(); owner->SetItem(itm); // TODO: После сортировки надо удалять все старые иконки и создавать новые, чтобы было отсортировано. //TIItemContainer place; //switch (this->m_eItemPlace) //{ //case eItemPlaceBelt: // place = inventory_owner().inventory().m_belt; break; //case eItemPlaceRuck: // place = inventory_owner().inventory().m_ruck; break; //default: // R_ASSERT(0); //} //std::sort(place.begin(),place.end(),InventoryUtilities::GreaterRoomInRuck); } }
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 CShootingObject::LoadFireParams (LPCSTR section, LPCSTR prefix) { string256 full_name; string32 buffer; shared_str s_sHitPower; //базовая дисперсия оружия fireDispersionBase = pSettings->r_float (section,"fire_dispersion_base" ); fireDispersionBase = deg2rad (fireDispersionBase); constDeviation.pitch = READ_IF_EXISTS (pSettings, r_float, section, "const_deviation_pitch", 0); constDeviation.yaw = READ_IF_EXISTS (pSettings, r_float, section, "const_deviation_yaw", 0); LPCSTR hit_type = READ_IF_EXISTS (pSettings, r_string, section, "hit_type", "fire_wound"); m_eHitType = ALife::g_tfString2HitType(hit_type); // поддержка произвольного хита оружия //сила выстрела и его мощьность s_sHitPower = pSettings->r_string_wb(section,strconcat(sizeof(full_name),full_name, prefix, "hit_power"));//читаем строку силы хита пули оружия fvHitPower[egdMaster] = (float)atof(_GetItem(*s_sHitPower,0,buffer));//первый параметр - это хит для уровня игры мастер fvHitPower[egdVeteran] = fvHitPower[egdMaster];//изначально параметры для других уровней fvHitPower[egdStalker] = fvHitPower[egdMaster];//сложности fvHitPower[egdNovice] = fvHitPower[egdMaster];//такие же int num_game_diff_param=_GetItemCount(*s_sHitPower);//узнаём колличество параметров для хитов if (num_game_diff_param>1)//если задан второй параметр хита { fvHitPower[egdVeteran] = (float)atof(_GetItem(*s_sHitPower,1,buffer));//то вычитываем его для уровня ветерана } if (num_game_diff_param>2)//если задан третий параметр хита { fvHitPower[egdStalker] = (float)atof(_GetItem(*s_sHitPower,2,buffer));//то вычитываем его для уровня сталкера } if (num_game_diff_param>3)//если задан четвёртый параметр хита { fvHitPower[egdNovice] = (float)atof(_GetItem(*s_sHitPower,3,buffer));//то вычитываем его для уровня новичка } //fHitPower = pSettings->r_float (section,strconcat(full_name, prefix, "hit_power")); fHitImpulse = pSettings->r_float (section,strconcat(sizeof(full_name),full_name, prefix, "hit_impulse")); //максимальное расстояние полета пули fireDistance = pSettings->r_float (section,strconcat(sizeof(full_name),full_name, prefix, "fire_distance")); //начальная скорость пули m_fStartBulletSpeed = pSettings->r_float (section,strconcat(sizeof(full_name),full_name, prefix, "bullet_speed")); m_bUseAimBullet = pSettings->r_bool (section,strconcat(sizeof(full_name),full_name, prefix, "use_aim_bullet")); if (m_bUseAimBullet) { m_fTimeToAim = pSettings->r_float (section,strconcat(sizeof(full_name),full_name, prefix, "time_to_aim")); } }
void CPda::Load(LPCSTR section) { inherited::Load(section); m_fRadius = pSettings->r_float(section,"radius"); m_functor_str = READ_IF_EXISTS(pSettings,r_string,section,"play_function",""); }
void CScriptEngine::register_script_classes() { #ifdef DBG_DISABLE_SCRIPTS return; #endif string_path S; FS.update_path(S, "$game_config$", "script.ltx"); CInifile *l_tpIniFile = xr_new<CInifile>(S); R_ASSERT(l_tpIniFile); if (!l_tpIniFile->section_exist("common")) { xr_delete(l_tpIniFile); return; } m_class_registrators = READ_IF_EXISTS(l_tpIniFile, r_string, "common", "class_registrators", ""); xr_delete(l_tpIniFile); u32 n = _GetItemCount(*m_class_registrators); string256 I; for (u32 i = 0; i < n; ++i) { _GetItem(*m_class_registrators, i, I); luabind::functor<void> result; if (!functor(I, result)) { script_log(eLuaMessageTypeError, "Cannot load class registrator %s!", I); continue; } result(const_cast<CObjectFactory*>(&object_factory())); } }
void CHangingLamp::Load (LPCSTR section) { inherited::Load (section); LPCSTR imm_sect = READ_IF_EXISTS (pSettings, r_string, section, "immunities_sect", NULL); if (imm_sect) CHitImmunity::LoadImmunities(imm_sect, pSettings); }
void CHitMemoryManager::reload (LPCSTR section) { #ifdef USE_SELECTED_HIT xr_delete (m_selected_hit); #endif m_max_hit_count = READ_IF_EXISTS(pSettings,r_s32,section,"DynamicHitCount",1); }
void CCustomMonster::reload (LPCSTR section) { sound().reload (section); CEntityAlive::reload (section); if (character_physics_support()) material().reload (section); movement().reload (section); load_killer_clsids (section); m_far_plane_factor = READ_IF_EXISTS(pSettings,r_float,section,"far_plane_factor",1.f); m_fog_density_factor = READ_IF_EXISTS(pSettings,r_float,section,"fog_density_factor",.05f); m_panic_threshold = pSettings->r_float(section,"panic_threshold"); }
void CEntity::Load (LPCSTR section) { inherited::Load (section); setVisible (FALSE); // Team params id_Team = READ_IF_EXISTS(pSettings,r_s32,section,"team",-1); id_Squad = READ_IF_EXISTS(pSettings,r_s32,section,"squad",-1); id_Group = READ_IF_EXISTS(pSettings,r_s32,section,"group",-1); #pragma todo("Jim to Dima: no specific figures or comments needed") m_fMorale = 66.f; //время убирания тела с уровня m_dwBodyRemoveTime = READ_IF_EXISTS(pSettings,r_u32,section,"body_remove_time",BODY_REMOVE_TIME); ////////////////////////////////////// }
void CPHMovementControl::Load (LPCSTR section){ //capture //strcpy(m_capture_bone,pSettings->r_string(section,"capture_bone")); Fbox bb; // m_PhysicMovementControl: BOX Fvector vBOX1_center= pSettings->r_fvector3 (section,"ph_box1_center" ); Fvector vBOX1_size = pSettings->r_fvector3 (section,"ph_box1_size" ); bb.set (vBOX1_center,vBOX1_center); bb.grow(vBOX1_size); SetBox (1,bb); // m_PhysicMovementControl: BOX Fvector vBOX0_center= pSettings->r_fvector3 (section,"ph_box0_center" ); Fvector vBOX0_size = pSettings->r_fvector3 (section,"ph_box0_size" ); bb.set (vBOX0_center,vBOX0_center); bb.grow(vBOX0_size); SetBox (0,bb); //// m_PhysicMovementControl: Foots //Fvector vFOOT_center= pSettings->r_fvector3 (section,"ph_foot_center" ); //Fvector vFOOT_size = pSettings->r_fvector3 (section,"ph_foot_size" ); //bb.set (vFOOT_center,vFOOT_center); bb.grow(vFOOT_size); //SetFoots (vFOOT_center,vFOOT_size); // m_PhysicMovementControl: Crash speed and mass float cs_min = pSettings->r_float (section,"ph_crash_speed_min" ); float cs_max = pSettings->r_float (section,"ph_crash_speed_max" ); float mass = pSettings->r_float (section,"ph_mass" ); xr_token retrictor_types[]={ { "actor", CPHCharacter::rtActor}, { "medium_monster", CPHCharacter::rtMonsterMedium}, { "stalker", CPHCharacter::rtStalker }, { "none", CPHCharacter::rtNone }, { 0, 0} }; if(pSettings->line_exist(section,"actor_restrictor")) SetRestrictionType(CPHCharacter::ERestrictionType(pSettings->r_token(section,"actor_restrictor",retrictor_types))); fCollisionDamageFactor=READ_IF_EXISTS(pSettings,r_float,section,"ph_collision_damage_factor",fCollisionDamageFactor); R_ASSERT3(fCollisionDamageFactor<=1.f,"ph_collision_damage_factor >1.",section); SetCrashSpeeds (cs_min,cs_max); SetMass (mass); // m_PhysicMovementControl: Frictions //float af, gf, wf; //af = pSettings->r_float (section,"ph_friction_air" ); //gf = pSettings->r_float (section,"ph_friction_ground"); //wf = pSettings->r_float (section,"ph_friction_wall" ); //SetFriction (af,wf,gf); // BOX activate // ActivateBox (0); }
void CCustomOutfit::Load(LPCSTR section) { inherited::Load(section); m_HitTypeProtection[ALife::eHitTypeBurn] = pSettings->r_float(section,"burn_protection"); m_HitTypeProtection[ALife::eHitTypeStrike] = pSettings->r_float(section,"strike_protection"); m_HitTypeProtection[ALife::eHitTypeShock] = pSettings->r_float(section,"shock_protection"); m_HitTypeProtection[ALife::eHitTypeWound] = pSettings->r_float(section,"wound_protection"); m_HitTypeProtection[ALife::eHitTypeRadiation] = pSettings->r_float(section,"radiation_protection"); m_HitTypeProtection[ALife::eHitTypeTelepatic] = pSettings->r_float(section,"telepatic_protection"); m_HitTypeProtection[ALife::eHitTypeChemicalBurn]= pSettings->r_float(section,"chemical_burn_protection"); m_HitTypeProtection[ALife::eHitTypeExplosion] = pSettings->r_float(section,"explosion_protection"); m_HitTypeProtection[ALife::eHitTypeFireWound] = 0.f;//pSettings->r_float(section,"fire_wound_protection"); // m_HitTypeProtection[ALife::eHitTypePhysicStrike]= pSettings->r_float(section,"physic_strike_protection"); m_HitTypeProtection[ALife::eHitTypeLightBurn] = m_HitTypeProtection[ALife::eHitTypeBurn]; m_boneProtection->m_fHitFracActor = pSettings->r_float(section, "hit_fraction_actor"); if (pSettings->line_exist(section, "nightvision_sect")) m_NightVisionSect = pSettings->r_string(section, "nightvision_sect"); else m_NightVisionSect = ""; if (pSettings->line_exist(section, "actor_visual")) m_ActorVisual = pSettings->r_string(section, "actor_visual"); else m_ActorVisual = NULL; m_ef_equipment_type = pSettings->r_u32(section,"ef_equipment_type"); m_fPowerLoss = READ_IF_EXISTS(pSettings, r_float, section, "power_loss", 1.0f ); clamp ( m_fPowerLoss, 0.0f, 1.0f ); m_additional_weight = pSettings->r_float(section,"additional_inventory_weight"); m_additional_weight2 = pSettings->r_float(section,"additional_inventory_weight2"); m_fHealthRestoreSpeed = READ_IF_EXISTS(pSettings, r_float, section, "health_restore_speed", 0.0f ); m_fRadiationRestoreSpeed = READ_IF_EXISTS(pSettings, r_float, section, "radiation_restore_speed", 0.0f ); m_fSatietyRestoreSpeed = READ_IF_EXISTS(pSettings, r_float, section, "satiety_restore_speed", 0.0f ); m_fPowerRestoreSpeed = READ_IF_EXISTS(pSettings, r_float, section, "power_restore_speed", 0.0f ); m_fBleedingRestoreSpeed = READ_IF_EXISTS(pSettings, r_float, section, "bleeding_restore_speed", 0.0f ); m_full_icon_name = pSettings->r_string( section, "full_icon_name" ); m_artefact_count = READ_IF_EXISTS( pSettings, r_u32, section, "artefact_count", 0 ); clamp( m_artefact_count, (u32)0, (u32)5 ); m_BonesProtectionSect = READ_IF_EXISTS(pSettings, r_string, section, "bones_koeff_protection", "" ); bIsHelmetAvaliable = !!READ_IF_EXISTS(pSettings, r_bool, section, "helmet_avaliable", true); }
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") ; } }
void CHitImmunity::AddImmunities(LPCSTR imm_sect, CInifile const * ini) { R_ASSERT2 (ini->section_exist(imm_sect), imm_sect); m_HitImmunityKoefs[ALife::eHitTypeBurn] += READ_IF_EXISTS(ini, r_float, imm_sect,"burn_immunity", 0.0f); m_HitImmunityKoefs[ALife::eHitTypeStrike] += READ_IF_EXISTS(ini, r_float, imm_sect,"strike_immunity", 0.0f); m_HitImmunityKoefs[ALife::eHitTypeShock] += READ_IF_EXISTS(ini, r_float, imm_sect,"shock_immunity", 0.0f); m_HitImmunityKoefs[ALife::eHitTypeWound] += READ_IF_EXISTS(ini, r_float, imm_sect,"wound_immunity", 0.0f); m_HitImmunityKoefs[ALife::eHitTypeRadiation] += READ_IF_EXISTS(ini, r_float, imm_sect,"radiation_immunity", 0.0f); m_HitImmunityKoefs[ALife::eHitTypeTelepatic] += READ_IF_EXISTS(ini, r_float, imm_sect,"telepatic_immunity", 0.0f); m_HitImmunityKoefs[ALife::eHitTypeChemicalBurn] += READ_IF_EXISTS(ini, r_float, imm_sect,"chemical_burn_immunity", 0.0f); m_HitImmunityKoefs[ALife::eHitTypeExplosion] += READ_IF_EXISTS(ini, r_float, imm_sect,"explosion_immunity", 0.0f); m_HitImmunityKoefs[ALife::eHitTypeFireWound] += READ_IF_EXISTS(ini, r_float, imm_sect,"fire_wound_immunity", 0.0f); // m_HitImmunityKoefs[ALife::eHitTypePhysicStrike] += READ_IF_EXISTS(ini, r_float, imm_sect,"physic_strike_wound_immunity", 0.0f); m_HitImmunityKoefs[ALife::eHitTypeLightBurn] = m_HitImmunityKoefs[ALife::eHitTypeBurn]; }
void CInventoryItem::Load(LPCSTR section) { CHitImmunity::LoadImmunities (pSettings->r_string(section,"immunities_sect"),pSettings); ISpatial* self = smart_cast<ISpatial*> (this); if (self) self->spatial.type |= STYPE_VISIBLEFORAI; m_name = CStringTable().translate( pSettings->r_string(section, "inv_name") ); m_nameShort = CStringTable().translate( pSettings->r_string(section, "inv_name_short")); //. NameComplex (); m_weight = pSettings->r_float(section, "inv_weight"); R_ASSERT (m_weight>=0.f); m_cost = pSettings->r_u32(section, "cost"); m_slot = READ_IF_EXISTS(pSettings,r_u32,section,"slot", NO_ACTIVE_SLOT); // Description if ( pSettings->line_exist(section, "description") ) m_Description = CStringTable().translate( pSettings->r_string(section, "description") ); m_flags.set(Fbelt, READ_IF_EXISTS(pSettings, r_bool, section, "belt", FALSE)); m_flags.set(FRuckDefault, READ_IF_EXISTS(pSettings, r_bool, section, "default_to_ruck", TRUE)); m_flags.set(FCanTake, READ_IF_EXISTS(pSettings, r_bool, section, "can_take", TRUE)); m_flags.set(FCanTrade, READ_IF_EXISTS(pSettings, r_bool, section, "can_trade", TRUE)); m_flags.set(FIsQuestItem, READ_IF_EXISTS(pSettings, r_bool, section, "quest_item", FALSE)); //время убирания объекта с уровня m_dwItemRemoveTime = READ_IF_EXISTS(pSettings, r_u32, section,"item_remove_time", ITEM_REMOVE_TIME); m_flags.set (FAllowSprint,READ_IF_EXISTS (pSettings, r_bool, section,"sprint_allowed", TRUE)); m_fControlInertionFactor = READ_IF_EXISTS(pSettings, r_float,section,"control_inertion_factor", 1.0f); m_icon_name = READ_IF_EXISTS(pSettings, r_string,section,"icon_name", NULL); }
game_cl_ArtefactHunt::game_cl_ArtefactHunt() { m_game_ui = NULL; m_bBuyEnabled = FALSE; //--------------------------------- m_Eff_Af_Spawn = ""; m_Eff_Af_Disappear = ""; //--------------------------------- LoadSndMessages(); //--------------------------------- m_iSpawn_Cost = READ_IF_EXISTS(pSettings, r_s32, "artefacthunt_gamedata", "spawn_cost", -10000); }
//////////////////////////////////////////////////////////////////////////// // CSE_ALifeItemWeapon //////////////////////////////////////////////////////////////////////////// CSE_ALifeItemWeapon::CSE_ALifeItemWeapon (LPCSTR caSection) : CSE_ALifeItem(caSection) { a_current = 90; a_elapsed = 0; wpn_flags = 0; wpn_state = 0; ammo_type = 0; m_fHitPower = pSettings->r_float(caSection,"hit_power"); m_tHitType = ALife::g_tfString2HitType(pSettings->r_string(caSection,"hit_type")); m_caAmmoSections = pSettings->r_string(caSection,"ammo_class"); if (pSettings->section_exist(caSection) && pSettings->line_exist(caSection,"visual")) set_visual (pSettings->r_string(caSection,"visual")); m_addon_flags.zero (); m_scope_status = (EWeaponAddonStatus)pSettings->r_s32(s_name,"scope_status"); m_silencer_status = (EWeaponAddonStatus)pSettings->r_s32(s_name,"silencer_status"); m_grenade_launcher_status = (EWeaponAddonStatus)pSettings->r_s32(s_name,"grenade_launcher_status"); m_ef_main_weapon_type = READ_IF_EXISTS(pSettings,r_u32,caSection,"ef_main_weapon_type",u32(-1)); m_ef_weapon_type = READ_IF_EXISTS(pSettings,r_u32,caSection,"ef_weapon_type",u32(-1)); }
void CGrenade::Load(LPCSTR section) { inherited::Load(section); CExplosive::Load(section); HUD_SOUND::LoadSound(section,"snd_checkout",sndCheckout,m_eSoundCheckout); ////////////////////////////////////// //врем¤ убирани¤ оружи¤ с уровн¤ if(pSettings->line_exist(section,"grenade_remove_time")) m_dwGrenadeRemoveTime = pSettings->r_u32(section,"grenade_remove_time"); else m_dwGrenadeRemoveTime = GRENADE_REMOVE_TIME; m_grenade_detonation_threshold_hit=READ_IF_EXISTS(pSettings,r_float,section,"detonation_threshold_hit",default_grenade_detonation_threshold_hit); }
void CHitImmunity::LoadImmunities(LPCSTR imm_sect,CInifile* ini) { R_ASSERT2 (ini->section_exist(imm_sect), imm_sect); m_HitTypeK[ALife::eHitTypeBurn] = ini->r_float(imm_sect,"burn_immunity"); m_HitTypeK[ALife::eHitTypeStrike] = ini->r_float(imm_sect,"strike_immunity"); m_HitTypeK[ALife::eHitTypeShock] = ini->r_float(imm_sect,"shock_immunity"); m_HitTypeK[ALife::eHitTypeWound] = ini->r_float(imm_sect,"wound_immunity"); m_HitTypeK[ALife::eHitTypeRadiation] = ini->r_float(imm_sect,"radiation_immunity"); m_HitTypeK[ALife::eHitTypeTelepatic] = ini->r_float(imm_sect,"telepatic_immunity"); m_HitTypeK[ALife::eHitTypeChemicalBurn] = ini->r_float(imm_sect,"chemical_burn_immunity"); m_HitTypeK[ALife::eHitTypeExplosion] = ini->r_float(imm_sect,"explosion_immunity"); m_HitTypeK[ALife::eHitTypeFireWound] = ini->r_float(imm_sect,"fire_wound_immunity"); m_HitTypeK[ALife::eHitTypePhysicStrike] = READ_IF_EXISTS(ini, r_float, imm_sect,"physic_strike_wound_immunity", 1.0f); }
void CEatableItem::Load(LPCSTR section) { inherited::Load(section); m_fHealthInfluence = pSettings->r_float(section, "eat_health"); m_fPowerInfluence = pSettings->r_float(section, "eat_power"); m_fSatietyInfluence = pSettings->r_float(section, "eat_satiety"); m_fRadiationInfluence = pSettings->r_float(section, "eat_radiation"); m_fWoundsHealPerc = pSettings->r_float(section, "wounds_heal_perc"); clamp (m_fWoundsHealPerc, 0.f, 1.f); m_iStartPortionsNum = pSettings->r_s32 (section, "eat_portions_num"); m_fMaxPowerUpInfluence = READ_IF_EXISTS (pSettings,r_float,section,"eat_max_power",0.0f); VERIFY (m_iPortionsNum<10000); }
void CInventoryItem::Load(LPCSTR section) { CHitImmunity::LoadImmunities (pSettings->r_string(section,"immunities_sect"),pSettings); ISpatial* self = smart_cast<ISpatial*> (this); if (self) self->spatial.type |= STYPE_VISIBLEFORAI; m_section_id._set ( section ); m_name = CStringTable().translate( pSettings->r_string(section, "inv_name") ); m_nameShort = CStringTable().translate( pSettings->r_string(section, "inv_name_short") ); m_weight = pSettings->r_float(section, "inv_weight"); R_ASSERT (m_weight>=0.f); m_cost = pSettings->r_u32(section, "cost"); u32 sl = pSettings->r_u32(section,"slot"); m_ItemCurrPlace.base_slot_id = (sl==-1)?0:(sl+1); m_Description = CStringTable().translate( pSettings->r_string(section, "description") ); m_flags.set(Fbelt, READ_IF_EXISTS(pSettings, r_bool, section, "belt", FALSE)); m_can_trade = READ_IF_EXISTS(pSettings, r_bool, section, "can_take", TRUE); m_flags.set(FCanTake, m_can_trade); m_flags.set(FCanTrade, READ_IF_EXISTS(pSettings, r_bool, section, "can_trade", TRUE)); m_flags.set(FIsQuestItem, READ_IF_EXISTS(pSettings, r_bool, section, "quest_item",FALSE)); if ( BaseSlot() != NO_ACTIVE_SLOT || Belt()) { m_flags.set (FRuckDefault, pSettings->r_bool(section, "default_to_ruck" )); m_flags.set (FAllowSprint, pSettings->r_bool(section, "sprint_allowed" )); m_fControlInertionFactor = pSettings->r_float(section,"control_inertion_factor"); } m_icon_name = READ_IF_EXISTS(pSettings, r_string,section,"icon_name", NULL); }
void CAI_Stalker::on_after_take (const CGameObject *object) { if (!g_Alive()) return; if (!READ_IF_EXISTS(pSettings,r_bool,cNameSect(),"use_single_item_rule",true)) return; const CWeapon *new_weapon = smart_cast<const CWeapon*>(object); if (!new_weapon) return; TIItemContainer::iterator I = inventory().m_all.begin(); TIItemContainer::iterator E = inventory().m_all.end(); for ( ; I != E; ++I) update_conflicted (*I,new_weapon); }
void CControllerAura::load(LPCSTR section) { inherited::load (pSettings->r_string(section,"aura_effector")); aura_sound.left.create (pSettings->r_string(section,"PsyAura_SoundLeftPath"),st_Effect,sg_SourceType); aura_sound.right.create (pSettings->r_string(section,"PsyAura_SoundRightPath"),st_Effect,sg_SourceType); aura_radius = READ_IF_EXISTS(pSettings,r_float,section,"PsyAura_Radius", 40.f); aura_damage = READ_IF_EXISTS(pSettings,r_float,section,"PsyAura_Damage", 0.02f); m_time_fake_aura = 0; m_time_fake_aura_duration = READ_IF_EXISTS(pSettings,r_u32,section,"PsyAura_Fake_Duration", 3000); m_time_fake_aura_delay = READ_IF_EXISTS(pSettings,r_u32,section,"PsyAura_Fake_Delay", 8000); m_fake_max_add_dist = READ_IF_EXISTS(pSettings,r_float,section,"PsyAura_Fake_MaxAddDist", 90.f); m_fake_min_add_dist = READ_IF_EXISTS(pSettings,r_float,section,"PsyAura_Fake_MinAddDist", 20.f); m_time_started = 0; m_hit_state = eNone; m_pmt_hit_delay = READ_IF_EXISTS(pSettings,r_u32,section,"PsyAura_HitDelay", 1000); m_pmt_pp_hit_delay = READ_IF_EXISTS(pSettings,r_u32,section,"PsyAura_PPHitDelay", 300); }
void CWeapon::Load (LPCSTR section) { inherited::Load (section); CShootingObject::Load (section); if(pSettings->line_exist(section, "flame_particles_2")) m_sFlameParticles2 = pSettings->r_string(section, "flame_particles_2"); // load ammo classes m_ammoTypes.clear (); LPCSTR S = pSettings->r_string(section,"ammo_class"); if (S && S[0]) { string128 _ammoItem; int count = _GetItemCount (S); for (int it=0; it<count; ++it) { _GetItem (S,it,_ammoItem); m_ammoTypes.push_back (_ammoItem); } } iAmmoElapsed = pSettings->r_s32 (section,"ammo_elapsed" ); iMagazineSize = pSettings->r_s32 (section,"ammo_mag_size" ); //////////////////////////////////////////////////// // дисперсия стрельбы //подбрасывание камеры во время отдачи u8 rm = READ_IF_EXISTS( pSettings, r_u8, section, "cam_return", 1 ); cam_recoil.ReturnMode = (rm == 1); rm = READ_IF_EXISTS( pSettings, r_u8, section, "cam_return_stop", 0 ); cam_recoil.StopReturn = (rm == 1); float temp_f = 0.0f; temp_f = pSettings->r_float( section,"cam_relax_speed" ); cam_recoil.RelaxSpeed = _abs( deg2rad( temp_f ) ); VERIFY( !fis_zero(cam_recoil.RelaxSpeed) ); if ( fis_zero(cam_recoil.RelaxSpeed) ) { cam_recoil.RelaxSpeed = EPS_L; } cam_recoil.RelaxSpeed_AI = cam_recoil.RelaxSpeed; if ( pSettings->line_exist( section, "cam_relax_speed_ai" ) ) { temp_f = pSettings->r_float( section, "cam_relax_speed_ai" ); cam_recoil.RelaxSpeed_AI = _abs( deg2rad( temp_f ) ); VERIFY( !fis_zero(cam_recoil.RelaxSpeed_AI) ); if ( fis_zero(cam_recoil.RelaxSpeed_AI) ) { cam_recoil.RelaxSpeed_AI = EPS_L; } } temp_f = pSettings->r_float( section, "cam_max_angle" ); cam_recoil.MaxAngleVert = _abs( deg2rad( temp_f ) ); VERIFY( !fis_zero(cam_recoil.MaxAngleVert) ); if ( fis_zero(cam_recoil.MaxAngleVert) ) { cam_recoil.MaxAngleVert = EPS; } temp_f = pSettings->r_float( section, "cam_max_angle_horz" ); cam_recoil.MaxAngleHorz = _abs( deg2rad( temp_f ) ); VERIFY( !fis_zero(cam_recoil.MaxAngleHorz) ); if ( fis_zero(cam_recoil.MaxAngleHorz) ) { cam_recoil.MaxAngleHorz = EPS; } temp_f = pSettings->r_float( section, "cam_step_angle_horz" ); cam_recoil.StepAngleHorz = deg2rad( temp_f ); cam_recoil.DispersionFrac = _abs( READ_IF_EXISTS( pSettings, r_float, section, "cam_dispersion_frac", 0.7f ) ); //подбрасывание камеры во время отдачи в режиме zoom ==> ironsight or scope //zoom_cam_recoil.Clone( cam_recoil ); ==== нельзя !!!!!!!!!! zoom_cam_recoil.RelaxSpeed = cam_recoil.RelaxSpeed; zoom_cam_recoil.RelaxSpeed_AI = cam_recoil.RelaxSpeed_AI; zoom_cam_recoil.DispersionFrac = cam_recoil.DispersionFrac; zoom_cam_recoil.MaxAngleVert = cam_recoil.MaxAngleVert; zoom_cam_recoil.MaxAngleHorz = cam_recoil.MaxAngleHorz; zoom_cam_recoil.StepAngleHorz = cam_recoil.StepAngleHorz; zoom_cam_recoil.ReturnMode = cam_recoil.ReturnMode; zoom_cam_recoil.StopReturn = cam_recoil.StopReturn; if ( pSettings->line_exist( section, "zoom_cam_relax_speed" ) ) { zoom_cam_recoil.RelaxSpeed = _abs( deg2rad( pSettings->r_float( section, "zoom_cam_relax_speed" ) ) ); VERIFY( !fis_zero(zoom_cam_recoil.RelaxSpeed) ); if ( fis_zero(zoom_cam_recoil.RelaxSpeed) ) { zoom_cam_recoil.RelaxSpeed = EPS_L; } } if ( pSettings->line_exist( section, "zoom_cam_relax_speed_ai" ) ) { zoom_cam_recoil.RelaxSpeed_AI = _abs( deg2rad( pSettings->r_float( section,"zoom_cam_relax_speed_ai" ) ) ); VERIFY( !fis_zero(zoom_cam_recoil.RelaxSpeed_AI) ); if ( fis_zero(zoom_cam_recoil.RelaxSpeed_AI) ) { zoom_cam_recoil.RelaxSpeed_AI = EPS_L; } } if ( pSettings->line_exist( section, "zoom_cam_max_angle" ) ) { zoom_cam_recoil.MaxAngleVert = _abs( deg2rad( pSettings->r_float( section, "zoom_cam_max_angle" ) ) ); VERIFY( !fis_zero(zoom_cam_recoil.MaxAngleVert) ); if ( fis_zero(zoom_cam_recoil.MaxAngleVert) ) { zoom_cam_recoil.MaxAngleVert = EPS; } } if ( pSettings->line_exist( section, "zoom_cam_max_angle_horz" ) ) { zoom_cam_recoil.MaxAngleHorz = _abs( deg2rad( pSettings->r_float( section, "zoom_cam_max_angle_horz" ) ) ); VERIFY( !fis_zero(zoom_cam_recoil.MaxAngleHorz) ); if ( fis_zero(zoom_cam_recoil.MaxAngleHorz) ) { zoom_cam_recoil.MaxAngleHorz = EPS; } } if ( pSettings->line_exist( section, "zoom_cam_step_angle_horz" ) ) { zoom_cam_recoil.StepAngleHorz = deg2rad( pSettings->r_float( section, "zoom_cam_step_angle_horz" ) ); } if ( pSettings->line_exist( section, "zoom_cam_dispersion_frac" ) ) { zoom_cam_recoil.DispersionFrac = _abs( pSettings->r_float( section, "zoom_cam_dispersion_frac" ) ); } m_pdm.m_fPDM_disp_base = pSettings->r_float( section, "PDM_disp_base" ); m_pdm.m_fPDM_disp_vel_factor = pSettings->r_float( section, "PDM_disp_vel_factor" ); m_pdm.m_fPDM_disp_accel_factor = pSettings->r_float( section, "PDM_disp_accel_factor" ); m_pdm.m_fPDM_disp_crouch = pSettings->r_float( section, "PDM_disp_crouch" ); m_pdm.m_fPDM_disp_crouch_no_acc = pSettings->r_float( section, "PDM_disp_crouch_no_acc" ); m_crosshair_inertion = READ_IF_EXISTS(pSettings, r_float, section, "crosshair_inertion", 5.91f); m_first_bullet_controller.load (section); fireDispersionConditionFactor = pSettings->r_float(section,"fire_dispersion_condition_factor"); // modified by Peacemaker [17.10.08] // misfireProbability = pSettings->r_float(section,"misfire_probability"); // misfireConditionK = READ_IF_EXISTS(pSettings, r_float, section, "misfire_condition_k", 1.0f); misfireStartCondition = pSettings->r_float(section, "misfire_start_condition"); misfireEndCondition = READ_IF_EXISTS(pSettings, r_float, section, "misfire_end_condition", 0.f); misfireStartProbability = READ_IF_EXISTS(pSettings, r_float, section, "misfire_start_prob", 0.f); misfireEndProbability = pSettings->r_float(section, "misfire_end_prob"); conditionDecreasePerShot = pSettings->r_float(section,"condition_shot_dec"); conditionDecreasePerQueueShot = READ_IF_EXISTS(pSettings, r_float, section, "condition_queue_shot_dec", conditionDecreasePerShot); vLoadedFirePoint = pSettings->r_fvector3 (section,"fire_point" ); if(pSettings->line_exist(section,"fire_point2")) vLoadedFirePoint2= pSettings->r_fvector3 (section,"fire_point2"); else vLoadedFirePoint2= vLoadedFirePoint; // hands eHandDependence = EHandDependence(pSettings->r_s32(section,"hand_dependence")); m_bIsSingleHanded = true; if (pSettings->line_exist(section, "single_handed")) m_bIsSingleHanded = !!pSettings->r_bool(section, "single_handed"); // m_fMinRadius = pSettings->r_float (section,"min_radius"); m_fMaxRadius = pSettings->r_float (section,"max_radius"); // информация о возможных апгрейдах и их визуализации в инвентаре m_eScopeStatus = (ALife::EWeaponAddonStatus)pSettings->r_s32(section,"scope_status"); m_eSilencerStatus = (ALife::EWeaponAddonStatus)pSettings->r_s32(section,"silencer_status"); m_eGrenadeLauncherStatus = (ALife::EWeaponAddonStatus)pSettings->r_s32(section,"grenade_launcher_status"); m_zoom_params.m_bZoomEnabled = !!pSettings->r_bool(section,"zoom_enabled"); m_zoom_params.m_fZoomRotateTime = pSettings->r_float(section,"zoom_rotate_time"); if ( m_eScopeStatus == ALife::eAddonAttachable ) { if(pSettings->line_exist(section, "scopes_sect")) { LPCSTR str = pSettings->r_string(section, "scopes_sect"); for(int i = 0, count = _GetItemCount(str); i < count; ++i ) { string128 scope_section; _GetItem (str, i, scope_section); m_scopes.push_back (scope_section); } } else { m_scopes.push_back(section); } } else if( m_eScopeStatus == ALife::eAddonPermanent ) { shared_str scope_tex_name = pSettings->r_string(cNameSect(), "scope_texture"); m_zoom_params.m_fScopeZoomFactor = pSettings->r_float( cNameSect(), "scope_zoom_factor"); if ( !g_dedicated_server ) { m_UIScope = xr_new<CUIWindow>(); if(!pWpnScopeXml) { pWpnScopeXml = xr_new<CUIXml>(); pWpnScopeXml->Load (CONFIG_PATH, UI_PATH, "scopes.xml"); } CUIXmlInit::InitWindow (*pWpnScopeXml, scope_tex_name.c_str(), 0, m_UIScope); } } if ( m_eSilencerStatus == ALife::eAddonAttachable ) { m_sSilencerName = pSettings->r_string(section,"silencer_name"); m_iSilencerX = pSettings->r_s32(section,"silencer_x"); m_iSilencerY = pSettings->r_s32(section,"silencer_y"); } if ( m_eGrenadeLauncherStatus == ALife::eAddonAttachable ) { m_sGrenadeLauncherName = pSettings->r_string(section,"grenade_launcher_name"); m_iGrenadeLauncherX = pSettings->r_s32(section,"grenade_launcher_x"); m_iGrenadeLauncherY = pSettings->r_s32(section,"grenade_launcher_y"); } InitAddons(); if(pSettings->line_exist(section,"weapon_remove_time")) m_dwWeaponRemoveTime = pSettings->r_u32(section,"weapon_remove_time"); else m_dwWeaponRemoveTime = WEAPON_REMOVE_TIME; if(pSettings->line_exist(section,"auto_spawn_ammo")) m_bAutoSpawnAmmo = pSettings->r_bool(section,"auto_spawn_ammo"); else m_bAutoSpawnAmmo = TRUE; m_zoom_params.m_bHideCrosshairInZoom = true; if(pSettings->line_exist(hud_sect, "zoom_hide_crosshair")) m_zoom_params.m_bHideCrosshairInZoom = !!pSettings->r_bool(hud_sect, "zoom_hide_crosshair"); Fvector def_dof; def_dof.set (-1,-1,-1); // m_zoom_params.m_ZoomDof = READ_IF_EXISTS(pSettings, r_fvector3, section, "zoom_dof", Fvector().set(-1,-1,-1)); // m_zoom_params.m_bZoomDofEnabled = !def_dof.similar(m_zoom_params.m_ZoomDof); // m_zoom_params.m_ReloadDof = READ_IF_EXISTS(pSettings, r_fvector4, section, "reload_dof", Fvector4().set(-1,-1,-1,-1)); m_bHasTracers = !!READ_IF_EXISTS(pSettings, r_bool, section, "tracers", true); m_u8TracerColorID = READ_IF_EXISTS(pSettings, r_u8, section, "tracers_color_ID", u8(-1)); string256 temp; for (int i=egdNovice; i<egdCount; ++i) { strconcat (sizeof(temp),temp,"hit_probability_",get_token_name(difficulty_type_token,i)); m_hit_probability[i] = READ_IF_EXISTS(pSettings,r_float,section,temp,1.f); } m_zoom_params.m_bUseDynamicZoom = READ_IF_EXISTS(pSettings,r_bool,section,"scope_dynamic_zoom",FALSE); m_zoom_params.m_sUseZoomPostprocess = 0; m_zoom_params.m_sUseBinocularVision = 0; }
LPCSTR CInventoryOwner::trade_section () const { const CGameObject *game_object = smart_cast<const CGameObject*>(this); VERIFY (game_object); return (READ_IF_EXISTS(pSettings,r_string,game_object->cNameSect(),"trade_section","trade")); }