public BasicGunsFromFile(IGunner owner, World world, string weaponName) : base(owner, 0, 0, 0, 0, FireMode.Single, 0, 0, 0, 0, 0, world, weaponName, GunType.Pistol) { #if WINDOWS IniFile data = new IniFile(@"main\specs\gunspecs.txt"); this.damage = int.Parse(data.IniReadValue(weaponName, "damage")); this.range = float.Parse(data.IniReadValue(weaponName, "range")); this.fireRate = int.Parse(data.IniReadValue(weaponName, "fireRate")); this.bulletSpeed = float.Parse(data.IniReadValue(weaponName, "bulletSpeed")); this.fireMode = (FAZEngine.Weapons.FireMode)int.Parse(data.IniReadValue(weaponName, "fireMode")); this.recoilPerShot = float.Parse(data.IniReadValue(weaponName, "recoilPerShot")); this.maxRecoil = float.Parse(data.IniReadValue(weaponName, "maxRecoil")); this.clipSize = int.Parse(data.IniReadValue(weaponName, "clipSize")); this.reserveSize = int.Parse(data.IniReadValue(weaponName, "reserveSize")); this.reloadTime = int.Parse(data.IniReadValue(weaponName, "reloadTime")); this.gunType = (FAZEngine.Weapons.GunType)int.Parse(data.IniReadValue(weaponName, "gunType")); #else if (weaponName == "M1911") { this.damage = 40; this.range = 850; this.fireRate = 500; this.bulletSpeed = 50; this.fireMode = FAZEngine.Weapons.FireMode.Single; this.recoilPerShot = 0.038f; this.maxRecoil = 0.25f; this.clipSize = 8; this.reserveSize = 120; this.reloadTime = 1600; this.gunType = FAZEngine.Weapons.GunType.Pistol; } else if (weaponName == "AK74u") { this.damage = 45; this.range = 1100; this.fireRate = 750; this.bulletSpeed = 50; this.fireMode = FAZEngine.Weapons.FireMode.Auto; this.recoilPerShot = 0.040f; this.maxRecoil = 0.12f; this.clipSize = 30; this.reserveSize = 240; this.reloadTime = 2500; this.gunType = FAZEngine.Weapons.GunType.SMG; } else if (weaponName == "M4A1") { this.damage = 55; this.range = 1300; this.fireRate = 700; this.bulletSpeed = 50; this.fireMode = FAZEngine.Weapons.FireMode.Auto; this.recoilPerShot = 0.035f; this.maxRecoil = 0.16f; this.clipSize = 30; this.reserveSize = 240; this.reloadTime = 3000; this.gunType = FAZEngine.Weapons.GunType.AssultRifle; } else if (weaponName == "M60") { this.damage = 63; this.range = 1300; this.fireRate = 535; this.bulletSpeed = 50; this.fireMode = FAZEngine.Weapons.FireMode.Auto; this.recoilPerShot = 0.055f; this.maxRecoil = 0.16f; this.clipSize = 100; this.reserveSize = 300; this.reloadTime = 9100; this.gunType = FAZEngine.Weapons.GunType.LMG; } #endif clipAmmo = clipSize; reserveAmmo = reserveSize; }
void graphics_PreparingDeviceSettings(object sender, PreparingDeviceSettingsEventArgs e) { #if WINDOWS FAZEngine.IniFile settingsIni = new FAZEngine.IniFile(@".\configs\settings.ini"); e.GraphicsDeviceInformation.PresentationParameters.MultiSampleCount = int.Parse(settingsIni.IniReadValue("Options", "MSAA")); #else e.GraphicsDeviceInformation.PresentationParameters.MultiSampleCount = 8; #endif }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { // Applying graphics settings #if WINDOWS // ini settings file FAZEngine.IniFile settingsIni = new FAZEngine.IniFile(@".\configs\settings.ini"); // fullscreen graphics.IsFullScreen = bool.Parse(settingsIni.IniReadValue("Options", "Fullscreen")); // resolution settings int sWidth = 0, sHeight = 0; if (int.TryParse(settingsIni.IniReadValue("Resolution", "Width"), out sWidth) && int.TryParse(settingsIni.IniReadValue("Resolution", "Height"), out sHeight)) { GlobalHelper.WindowWidth = sWidth; GlobalHelper.WindowHeight = sHeight; } else { GlobalHelper.WindowWidth = graphics.GraphicsDevice.Adapter.CurrentDisplayMode.Width; GlobalHelper.WindowHeight = graphics.GraphicsDevice.Adapter.CurrentDisplayMode.Height; } // use gamepad settings GlobalHelper.UseGamePad = bool.Parse(settingsIni.IniReadValue("Options", "UseGamePad")); IsMouseVisible = !GlobalHelper.UseGamePad; #else // START UP SETTINGS FOR XBOX GlobalHelper.UseGamePad = true; GlobalHelper.WindowWidth = GraphicsDevice.DisplayMode.Width; GlobalHelper.WindowHeight = GraphicsDevice.DisplayMode.Height; // if it's in 4:3 but "widescreen" at the same time, just use a fake 16:9 resolution if (GraphicsDevice.DisplayMode.AspectRatio == (float)4 / 3 && GraphicsDevice.Adapter.IsWideScreen) { GlobalHelper.WindowWidth = 1280; GlobalHelper.WindowHeight = 720; } #endif // msaa settings is done when preparing graphics.PreparingDeviceSettings += new EventHandler<PreparingDeviceSettingsEventArgs>(graphics_PreparingDeviceSettings); graphics.PreferredBackBufferWidth = GlobalHelper.WindowWidth; graphics.PreferredBackBufferHeight = GlobalHelper.WindowHeight; //graphics.PreferMultiSampling = true; //GraphicsDevice.PresentationParameters.MultiSampleCount = 8; //graphics.SynchronizeWithVerticalRetrace = true; graphics.ApplyChanges(); // After loading graphics settings, load audio engine manager audioEM = new AudioEM(this); base.Initialize(); }
public ShotgunsFromFile(IGunner owner, World world, string weaponName) : base(owner, 0, 0, 0, 0, FireMode.Single, 0, 0, 0, 0, 0, 0, 0, true, world, weaponName) { #if WINDOWS IniFile data = new IniFile(@"main\specs\gunspecs.txt"); this.damage = int.Parse(data.IniReadValue(weaponName, "damage")); this.range = float.Parse(data.IniReadValue(weaponName, "range")); this.fireRate = int.Parse(data.IniReadValue(weaponName, "fireRate")); this.bulletSpeed = float.Parse(data.IniReadValue(weaponName, "bulletSpeed")); this.fireMode = (FAZEngine.Weapons.FireMode)int.Parse(data.IniReadValue(weaponName, "fireMode")); this.recoilPerShot = float.Parse(data.IniReadValue(weaponName, "recoilPerShot")); this.maxRecoil = float.Parse(data.IniReadValue(weaponName, "maxRecoil")); this.clipSize = int.Parse(data.IniReadValue(weaponName, "clipSize")); this.reserveSize = int.Parse(data.IniReadValue(weaponName, "reserveSize")); this.reloadTime = int.Parse(data.IniReadValue(weaponName, "reloadTime")); this.subShells = int.Parse(data.IniReadValue(weaponName, "subShells")); this.shellSpread = float.Parse(data.IniReadValue(weaponName, "shellSpread")); this.clipReload = bool.Parse(data.IniReadValue(weaponName, "clipReload")); #else if (weaponName == "R870MCS") { this.damage = 83; this.range = 800; this.fireRate = 80; this.bulletSpeed = 50; this.fireMode = FAZEngine.Weapons.FireMode.Single; this.recoilPerShot = 0; this.maxRecoil = 10; this.clipSize = 8; this.reserveSize = 64; this.reloadTime = 400; this.subShells = 8; this.shellSpread = 0.26f; this.clipReload = false; } #endif clipAmmo = clipSize; reserveAmmo = reserveSize; singleReloadTime = reloadTime; }