Example #1
0
void Firearm::LoadFromXMLNode( XMLNode& reader )
{
	CGI_Weapon::LoadFromXMLNode( reader );

	m_PrimaryCaliber = GetCaliberFromName( reader.GetChild( "Caliber" ).GetTextContent().c_str() );

//	reader.GetChildElementTextContent( "FireInterval",             m_fFireInterval );
	reader.GetChildElementTextContent( "StandardMagazineCapacity", m_StandardMagazineCapacity );
	reader.GetChildElementTextContent( "Grouping",                 m_fGrouping ); // grouping in 10[m]
//	reader.GetChildElementTextContent( "MuzzleSpeedFactor",        m_fMuzzleSpeedFactor );
//	reader.GetChildElementTextContent( "LocalRecoilForce",         m_vLocalRecoilForce );
	reader.GetChildElementTextContent( "LocalHammerPivot",         m_vLocalHammerPivot );

	vector<XMLNode> mags = reader.GetChild( "CompliantMagazines" ).GetImmediateChildren( "Magazine" );
	m_ComplientMagazineNames.resize( mags.size() );
	for( size_t i=0; i<mags.size(); i++ )
		m_ComplientMagazineNames[i] = mags[i].GetTextContent();


/*	string fire_sound_name;
	reader.GetChildElementTextContent( "FireSound",          fire_sound_name );
	m_FireSound.SetResourceName( fire_sound_name );

	reader.GetChildElementTextContent( "NumBursts",          m_iNumBursts );

//	reader.GetChildElementTextContent( "fBurstInterval;", m_fBurstInterval );

	reader.GetChildElementTextContent( "MuzzleEndLocalPos", m_MuzzleEndLocalPose.vPosition );
*/	
}
void SubsetRenderMethod::LoadFromXMLNode( XMLNode& reader )
{
	reader.GetChildElementTextContent( "ShaderFilepath", m_ShaderDesc.ResourcePath );

	string tech_name;
	reader.GetChildElementTextContent( "Technique", tech_name );
	m_Technique.SetTechniqueName( tech_name.c_str() );
}
Example #3
0
void GravityGun::LoadFromXMLNode( XMLNode& reader )
{
    CGI_Weapon::LoadFromXMLNode( reader );

    reader.GetChildElementTextContent( "PosGain",   m_fPosGain );
    reader.GetChildElementTextContent( "SpeedGain", m_fSpeedGain );

    reader.GetChildElementTextContent( "MaxRange",   m_fMaxRange );
    reader.GetChildElementTextContent( "GraspRange", m_fGraspRange );
    reader.GetChildElementTextContent( "Power",      m_fPower );
}
Example #4
0
void CRotatableTurret::LoadFromXMLNode( XMLNode& reader )
{
	GameItem::LoadFromXMLNode( reader );

	string ammo_name, ammo_quantity;

	reader.GetChildElementTextContent( "Weapon",      m_WeaponName );

	vector<XMLNode> vecAmmo = reader.GetImmediateChildren( "Ammunition" );
//	m_vecpAmmunition.resize( vecAmmo.size() );
	m_vecAmmunition.resize( vecAmmo.size() );
	for( size_t i=0; i<vecAmmo.size(); i++ )
	{
		// name
		m_vecAmmunition[i].m_AmmunitionName = vecAmmo[i].GetTextContent();

		// quantity
		ammo_quantity = vecAmmo[i].GetAttributeText( "quantity" );
		if( ammo_quantity == "" )
			ammo_quantity = "infinite";
		if( ammo_quantity == "infinite" )
		{
			// TODO: set infinite
			ammo_quantity = "100000000";
		}
		m_vecAmmunition[i].m_InitQuantity = to_int(ammo_quantity);

//		m_vecpAmmunition[i] = GetItemDatabaseManager().GetItem<CGI_Ammunition>( ammo_name, to_int(ammo_quantity) );
	}
/*
	vector<XMLNode> vecAmmoLoading = reader.GetChildElementTextContent( "AmmunitionLoading/Name",  ammo_name );
	const size_t num_loadings = vecAmmoLoading.size();
	m_vecpAmmunitionLoading.reserve( 8 );
	for( size_t i=0; i<num_loadings; i++ )
	{
		ammo_name = vecAmmoLoading[i].GetTextContent();
		num_loads = vecAmmoLoading[i].GetAttributeText();
		shared_ptr<CGI_Ammunition> pAmmunition = get_ammo( ammo_name );
		for( int j=0; j<num_loads; j++ )
			m_vecpAmmunitionLoading.push_back( pAmmunition );
	}
*/
	amorphous::LoadFromXMLNode( reader.GetChild( "Mount/LocalPose" ), m_MountLocalPose );
	amorphous::LoadFromXMLNode( reader.GetChild( "Gun/LocalPose" ),   m_GunLocalPose );

	m_MountMeshTransform = m_MeshTransform * m_MountLocalPose.GetInverseROT();
	m_GunMeshTransform   = m_MeshTransform * m_GunLocalPose.GetInverseROT();
}
void GraphicsResourceDesc::LoadFromXMLNode( XMLNode& reader )
{
	reader.GetChildElementTextContent( "Path", ResourcePath );
	reader.GetChildElementTextContent( "File", ResourcePath );
}
Example #6
0
void CGI_Aircraft::LoadFromXMLNode( XMLNode& reader )
{
	GameItem::LoadFromXMLNode( reader );

	reader.GetChildElementTextContent( "Armor",           m_fArmor );
	reader.GetChildElementTextContent( "RCS",             m_fRCS );
	reader.GetChildElementTextContent( "Ceiling",         m_fCeiling );
	reader.GetChildElementTextContent( "CockpitLocalPos", m_CockpitLocalPose.vPosition );

	reader.GetChildElementTextContent( "ThirdPersonView/CameraPosition", m_vThirdPersonViewOffset );

//	reader.GetChildElementTextContent( m_vecNozzleFlameParams,  );

	XMLNode accels_reader = reader.GetChild( "Accel" );
	accels_reader.GetChildElementTextContent( "Default",    m_fAccel );
	accels_reader.GetChildElementTextContent( "Boost",      m_fBoostAccel );
	accels_reader.GetChildElementTextContent( "Brake",      m_fBrakeAccel );

//	reader.m_PitchRange reader.m_RollRange;

	reader.GetChildElementTextContent(  "MaxPitchAccel",  m_fMaxPitchAccel );
	reader.GetChildElementTextContent(  "MaxRollAccel",   m_fMaxRollAccel );
	reader.GetChildElementTextContent(  "MaxYawAccel",    m_fMaxYawAccel );

	reader.GetChildElementTextContent( "GunMuzzleEndPos", m_vGunMuzzleEndLocalPos );

	std::vector<XMLNode> payloads = reader.GetImmediateChildren( "AmmoPayload" );

	const size_t num_payload_info = payloads.size();
	m_vecSupportedAmmo.resize( num_payload_info );
	for( size_t i = 0; i<num_payload_info; i++ )
	{
		m_vecSupportedAmmo[i].LoadFromXMLNode( payloads[i] );
	}

	XMLNode components_reader = reader.GetChild( "Components" );
	std::vector<XMLNode> components = components_reader.GetImmediateChildren();
//	std::vector<XMLNode> components = reader.GetImmediateChildren( "Components" );
	for( size_t i = 0; i<components.size(); i++ )
	{
		XMLNode& component_reader = components[i];
		shared_ptr<MeshBoneController_AircraftBase> pComponent;
		if( component_reader.GetName() == "Flap" )
		{
			pComponent = shared_ptr<MeshBoneController_AircraftBase>( new MeshBoneController_Flap() );
		}
		else if( component_reader.GetName() == "VFlap" )
		{
			pComponent = shared_ptr<MeshBoneController_AircraftBase>( new MeshBoneController_VFlap() );
		}
		else if( component_reader.GetName() == "Rotor" )
		{
			pComponent = shared_ptr<MeshBoneController_AircraftBase>( new MeshBoneController_Rotor() );
		}
		else if( component_reader.GetName() == "GearUnit" )
		{
			// store to the gear unit array to open/close the gear box(es)
			shared_ptr<MeshBoneController_GearUnit> pGearUnit;
			pGearUnit = shared_ptr<MeshBoneController_GearUnit>( new MeshBoneController_GearUnit() );
			m_vecpGear.push_back( pGearUnit );

			pComponent = pGearUnit;
		}

		if( pComponent )
		{
			pComponent->LoadFromXMLNode( component_reader );

			m_vecpMeshController.push_back( pComponent );
		}
	}

}
Example #7
0
void CGI_Aircraft::AmmoPayload::LoadFromXMLNode( XMLNode& reader )
{
	reader.GetChildElementTextContent( "AmmoName",        AmmoName );
	reader.GetChildElementTextContent( "WeaponSlotIndex", WeaponSlot );
	reader.GetChildElementTextContent( "MaxQuantity",     MaxQuantity );
}