void CVehicleModificationParams::InitModification( XmlNodeRef xmlModificationData ) { assert( xmlModificationData ); bool hasParentModification = xmlModificationData->haveAttr( "parent" ); if ( hasParentModification ) { XmlNodeRef xmlModificationsGroup = xmlModificationData->getParent(); const char* parentModificationName = xmlModificationData->getAttr( "parent" ); XmlNodeRef xmlParentModificationData = FindModificationNodeByName( parentModificationName, xmlModificationsGroup ); if ( xmlParentModificationData && ( xmlParentModificationData != xmlModificationData ) ) { InitModification( xmlParentModificationData ); } } XmlNodeRef xmlElemsGroup = xmlModificationData->findChild( "Elems" ); if ( ! xmlElemsGroup ) { return; } for ( int i = 0; i < xmlElemsGroup->getChildCount(); ++i ) { XmlNodeRef xmlElem = xmlElemsGroup->getChild( i ); InitModificationElem( xmlElem ); } }
void SFireParams::Reset(const XmlNodeRef& paramsNode, bool defaultInit/*=true*/) { CryFixedStringT<32> ammo_type = ""; CryFixedStringT<32> ammo_spawn_type = ""; if (defaultInit) { suffix = ""; suffixAG = ""; tag = ""; rate = 400; fake_fire_rate = 0; minimum_ammo_count = 0; clip_size = 30; max_clips = 20; hit_type = "bullet"; hitTypeId = 0; changeFMFireDelayFraction = 0.0f; endReloadFraction = 1.0f; fillAmmoReloadFraction = 1.0f; useLowAmmoWarning = true; autoReload = true; autoSwitch = true; lowAmmoWarningFraction = 0.1f; offset = 0.15f; stabilization = 0.2f; speed_override = 0.0f; stealthEnergyDrainMultiplier = 1.0f; bullet_chamber = 0; hasEmptyReload = false; damage = 32; damage_drop_per_meter = 0.0f; damage_drop_min_distance = 0.0f; damage_drop_min_damage = 0.0f; point_blank_amount = 1.0f; point_blank_distance = 0.0f; point_blank_falloff_distance = 0.0f; secondary_damage = false; ai_infiniteAmmo = false; ai_vs_player_damage = 32; ai_reload_time = 2.5f; crosshair = eHCH_Normal; no_cock = true; helper[0] = ""; helper[1] = ""; barrel_count = 1; spin_up_time = 0.0f; spin_down_time = 0.0f; fire_anim_damp = 1.0f; ironsight_fire_anim_damp = 1.0f; holdbreath_fire_anim_damp = 0.5f; holdbreath_ffeedback_damp = 0.5f; knocks_target = false; min_damage_for_knockDown = 0; knockdown_chance_leg = 0; min_damage_for_knockDown_leg = 0; bullet_pierceability_modifier = 0; is_silenced = false; ignore_damage_falloff = false; laser_beam_uses_spread = false; muzzleFromFiringLocator = false; } if (paramsNode) { CGameXmlParamReader reader(paramsNode); suffix = reader.ReadParamValue("suffix", suffix.c_str()); suffixAG = reader.ReadParamValue("suffixAG", suffixAG.c_str()); tag = reader.ReadParamValue("tag", tag.c_str()); reader.ReadParamValue<short>("rate", rate); reader.ReadParamValue<short>("fake_fire_rate", fake_fire_rate); reader.ReadParamValue<short>("minimum_ammo_count", minimum_ammo_count); reader.ReadParamValue<short>("clip_size", clip_size); reader.ReadParamValue<short>("max_clips", max_clips); hit_type = reader.ReadParamValue("hit_type", hit_type.c_str()); ammo_type = reader.ReadParamValue("ammo_type", ammo_type.c_str()); ammo_spawn_type = reader.ReadParamValue("ammo_spawn_type", ammo_spawn_type.c_str()); reader.ReadParamValue<float>("changeFMFireDelayFraction", changeFMFireDelayFraction); reader.ReadParamValue<float>("endReloadFraction", endReloadFraction); reader.ReadParamValue<float>("fillAmmoReloadFraction", fillAmmoReloadFraction); reader.ReadParamValue<bool>("useLowAmmoWarning", useLowAmmoWarning); reader.ReadParamValue<bool>("autoReload", autoReload); reader.ReadParamValue<bool>("autoSwitch", autoSwitch); reader.ReadParamValue<float>("lowAmmoWarningFraction", lowAmmoWarningFraction); reader.ReadParamValue<float>("offset", offset); reader.ReadParamValue<float>("stabilization", stabilization); reader.ReadParamValue<float>("speed_override", speed_override); reader.ReadParamValue<float>("stealthEnergyDrainMultiplier", stealthEnergyDrainMultiplier); #ifndef _RELEASE if (!defaultInit && endReloadFraction < fillAmmoReloadFraction) { const char* weaponName = ""; for (XmlNodeRef currentNode = paramsNode;;currentNode=currentNode->getParent()) { if (currentNode->getParent()) continue; weaponName = currentNode->getAttr("name"); break; } XmlNodeRef fireModeNode = paramsNode->getParent(); const char* fireModeName = fireModeNode->getAttr("name"); gEnv->pLog->LogWarning( "endReloadFraction is smaller than fillAmmoReloadFraction on '%s' at '%s'", weaponName, fireModeName); } #endif endReloadFraction = max(endReloadFraction, fillAmmoReloadFraction); int bulletChamber = 0; if (reader.ReadParamValue<int>("bullet_chamber", bulletChamber)) { bullet_chamber = (uint8)bulletChamber; } reader.ReadParamValue<bool>("hasEmptyReload", hasEmptyReload); reader.ReadParamValue<int>("damage", damage); reader.ReadParamValue<float>("damage_drop_per_meter", damage_drop_per_meter); reader.ReadParamValue<float>("damage_drop_min_distance", damage_drop_min_distance); reader.ReadParamValue<float>("damage_drop_min_damage", damage_drop_min_damage); reader.ReadParamValue<float>("point_blank_amount", point_blank_amount); reader.ReadParamValue<float>("point_blank_distance", point_blank_distance); reader.ReadParamValue<float>("point_blank_falloff_distance", point_blank_falloff_distance); reader.ReadParamValue<bool>("secondary_damage", secondary_damage); reader.ReadParamValue<bool>("ai_infiniteAmmo", ai_infiniteAmmo); reader.ReadParamValue<int>("ai_vs_player_damage", ai_vs_player_damage); reader.ReadParamValue<float>("ai_reload_time", ai_reload_time); int crosshairType = (ECrosshairTypes)eHCH_Normal; if (reader.ReadParamValue<int>("crosshair", crosshairType)) { crosshair = (ECrosshairTypes)crosshairType; } reader.ReadParamValue<bool>("no_cock", no_cock); helper[0] = reader.ReadParamValue("helper_fp", helper[0].c_str()); helper[1] = reader.ReadParamValue("helper_tp", helper[1].c_str()); reader.ReadParamValue<short>("barrel_count", barrel_count); reader.ReadParamValue<float>("spin_up_time", spin_up_time); reader.ReadParamValue<float>("spin_down_time", spin_down_time); reader.ReadParamValue<float>("fire_anim_damp", fire_anim_damp); reader.ReadParamValue<float>("ironsight_fire_anim_damp", ironsight_fire_anim_damp); reader.ReadParamValue<float>("holdbreath_fire_anim_damp", holdbreath_fire_anim_damp); reader.ReadParamValue<float>("holdbreath_ffeedback_damp", holdbreath_ffeedback_damp); reader.ReadParamValue<bool>("knocks_target", knocks_target); reader.ReadParamValue<float>("min_damage_for_knockDown", min_damage_for_knockDown); reader.ReadParamValue<int>("knockdown_chance_leg", knockdown_chance_leg); reader.ReadParamValue<float>("min_damage_for_knockDown_leg", min_damage_for_knockDown_leg); int pierceabilityMod = 0; reader.ReadParamValue<int>("bullet_pierceability_modifier", pierceabilityMod); bullet_pierceability_modifier = (int8)pierceabilityMod; reader.ReadParamValue<bool>("is_silenced", is_silenced); reader.ReadParamValue<bool>("muzzleFromFiringLocator", muzzleFromFiringLocator); reader.ReadParamValue<bool>("ignore_damage_falloff", ignore_damage_falloff); reader.ReadParamValue<bool>("laser_beam_uses_spread", laser_beam_uses_spread); } if (defaultInit || !ammo_type.empty()) { ammo_type_class = gEnv->pEntitySystem->GetClassRegistry()->FindClass(ammo_type.c_str()); } spawn_ammo_class = 0; if (defaultInit || !ammo_spawn_type.empty()) { spawn_ammo_class = gEnv->pEntitySystem->GetClassRegistry()->FindClass(ammo_spawn_type.c_str()); } if (spawn_ammo_class == 0) { spawn_ammo_class = ammo_type_class; } }