Exemplo n.º 1
0
        public override object ConvertTo(System.ComponentModel.ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, System.Type destinationType)
        {
            if ((value == null))
            {
                return(null);
            }
            EmissionType valueCasted = ((EmissionType)(value));

            if ((valueCasted == EmissionType.Chlorine))
            {
                return("chlorine");
            }
            if ((valueCasted == EmissionType.NitrogenOxide))
            {
                return("nitrogenOxide");
            }
            if ((valueCasted == EmissionType.CarbonDioxide))
            {
                return("carbonDioxide");
            }
            if ((valueCasted == EmissionType.HydrogenSulfide))
            {
                return("hydrogenSulfide");
            }
            if ((valueCasted == EmissionType.SulfurDioxide))
            {
                return("sulfurDioxide");
            }
            if ((valueCasted == EmissionType.CarbonDisulfide))
            {
                return("carbonDisulfide");
            }
            throw new ArgumentOutOfRangeException("value");
        }
Exemplo n.º 2
0
 public DataSource(DateTime timestamp, string description, double value, EmissionType type)
 {
     this.Timestamp   = timestamp;
     this.Description = description;
     this.Value       = value;
     this.Type        = type;
 }
Exemplo n.º 3
0
        /// <summary>
        /// Returns the name of the sound based on either the internal reference or the sound back definitions
        /// </summary>
        /// <param name="soundId">The id index of the sound</param>
        /// <param name="soundBank">The sound bank in which to look</param>
        /// <param name="soundType">The emission type</param>
        /// <returns>The name of the sound</returns>
        private string GetSoundString(int soundId, EffSndBnk soundBank, ref EmissionType soundType)
        {
            if (soundId == 0)
            {
                return("");
            }

            // Emit sounds
            if (soundId >= 1 && soundId < 32 && soundId < soundBank.EmitSounds.Count)
            {
                soundType = EmissionType.Emit;
                return(soundBank.EmitSounds[soundId - 1]);
            }

            // Hardcoded client sounds
            if (soundId >= 32 && soundId < 162)
            {
                soundType = EmissionType.Internal;

                if (soundId == 39)
                {
                    return("death_me");
                }
                if (soundId == 143)
                {
                    return("thunder1");
                }
                if (soundId == 144)
                {
                    return("thunder2");
                }
                if (soundId == 158)
                {
                    return("wind_lp1");
                }
                if (soundId == 159)
                {
                    return("rainloop");
                }
                if (soundId == 160)
                {
                    return("torch_lp");
                }
                if (soundId == 161)
                {
                    return("watundlp");
                }
            }

            // Loop sounds
            if (soundId >= 162 && soundId < 162 + soundBank.LoopSounds.Count)
            {
                soundType = EmissionType.Loop;

                return(soundBank.LoopSounds[soundId - 161 - 1]);
            }

            return("");
        }
Exemplo n.º 4
0
 private void EmitHeader(EmissionType type)
 {
     if (type == EmissionType.Program)
     {
         Emitter.EmitRaw(global::Compiler.Properties.Resources.CILHeader);
     }
     else if (type == EmissionType.Library)
     {
         Emitter.EmitRaw(global::Compiler.Properties.Resources.CILLibHeader);
     }
     else
     {
         throw new NotImplementedException();
     }
 }
Exemplo n.º 5
0
 private void EmitMain(EmissionType type)
 {
     if (type == EmissionType.Program)
     {
         Emitter.Emit("");
         Emitter.Emit(global::Compiler.Properties.Resources.CILMain, Main.Name);
     }
     else if (type == EmissionType.Library)
     {
         // Do nothing.
     }
     else
     {
         throw new NotImplementedException();
     }
 }
Exemplo n.º 6
0
        public void Emit(System.IO.TextWriter writer, EmissionType type)
        {
            Emitter.Writer = writer;

            EmitHeader(type);

            EmitMain(type);

            Const.Emit();

            foreach (Environment env in EnvList)
            {
                env.Emit();
            }
            foreach (Function func in FuncList)
            {
                func.Emit();
            }
        }
Exemplo n.º 7
0
 public Household()
 {
     this.Type = EmissionType.Household;
 }
Exemplo n.º 8
0
        public override void Read(AssetReader reader)
        {
            base.Read(reader);

            if (IsReadType(reader.Version))
            {
                EmissionType type = (EmissionType)reader.ReadInt32();
                if (type == EmissionType.Time)
                {
                    RateOverTime.Read(reader);
                    RateOverDistance = new MinMaxCurve(0.0f);
                }
                else
                {
                    RateOverTime = new MinMaxCurve(0.0f);
                    RateOverDistance.Read(reader);
                }
            }
            else
            {
                RateOverTime.Read(reader);
                RateOverDistance.Read(reader);
            }

            if (IsReadCnt(reader.Version))
            {
                int cnt0 = IsIntCount(reader.Version) ? reader.ReadInt32() : reader.ReadUInt16();
                int cnt1 = IsIntCount(reader.Version) ? reader.ReadInt32() : reader.ReadUInt16();
                int cnt2 = IsIntCount(reader.Version) ? reader.ReadInt32() : reader.ReadUInt16();
                int cnt3 = IsIntCount(reader.Version) ? reader.ReadInt32() : reader.ReadUInt16();

                int cntMax0 = cnt0;
                int cntMax1 = cnt1;
                int cntMax2 = cnt2;
                int cntMax3 = cnt3;
                if (IsReadCntMax(reader.Version))
                {
                    cntMax0 = IsIntCount(reader.Version) ? reader.ReadInt32() : reader.ReadUInt16();
                    cntMax1 = IsIntCount(reader.Version) ? reader.ReadInt32() : reader.ReadUInt16();
                    cntMax2 = IsIntCount(reader.Version) ? reader.ReadInt32() : reader.ReadUInt16();
                    cntMax3 = IsIntCount(reader.Version) ? reader.ReadInt32() : reader.ReadUInt16();
                }

                float time0 = reader.ReadSingle();
                float time1 = reader.ReadSingle();
                float time2 = reader.ReadSingle();
                float time3 = reader.ReadSingle();

                BurstCount = IsIntCount(reader.Version) ? reader.ReadInt32() : reader.ReadByte();
                reader.AlignStream(AlignType.Align4);

                m_bursts = new ParticleSystemEmissionBurst[BurstCount];
                if (BurstCount > 0)
                {
                    m_bursts[0] = new ParticleSystemEmissionBurst(time0, cnt0, cntMax0);
                    if (BurstCount > 1)
                    {
                        m_bursts[1] = new ParticleSystemEmissionBurst(time1, cnt1, cntMax1);
                        if (BurstCount > 2)
                        {
                            m_bursts[2] = new ParticleSystemEmissionBurst(time2, cnt2, cntMax2);
                            if (BurstCount > 3)
                            {
                                m_bursts[3] = new ParticleSystemEmissionBurst(time3, cnt3, cntMax3);
                            }
                        }
                    }
                }
            }
            else
            {
                BurstCount = reader.ReadInt32();
                reader.AlignStream(AlignType.Align4);

                m_bursts = reader.ReadAssetArray <ParticleSystemEmissionBurst>();
            }
        }
Exemplo n.º 9
0
 protected Emission(EmissionType type)
 {
     Type = type;
 }
Exemplo n.º 10
0
        /// <summary>
        /// Initializes the sound entry list
        /// </summary>
        public void Initialize()
        {
            if (_soundBank == null || !File.Exists(_soundFilePath))
            {
                return;
            }

            FileStream file = File.Open(_soundFilePath, FileMode.Open);

            string zoneShortName = Path.GetFileNameWithoutExtension(_soundFilePath).Split('_')[0];

            LoadMusicTrackNames(zoneShortName);

            var reader = new BinaryReader(file);

            int fileLength = (int)reader.BaseStream.Length;

            if (fileLength % EntryLengthInBytes != 0)
            {
                return;
            }

            int entryCount = fileLength / EntryLengthInBytes;

            for (int i = 0; i < entryCount; ++i)
            {
                var newSound = new SoundEntry();
                newSound.UnkRef00 = reader.ReadInt32();
                newSound.UnkRef04 = reader.ReadInt32();
                newSound.Reserved = reader.ReadInt32();
                newSound.Sequence = reader.ReadInt32();

                newSound.PosX   = reader.ReadSingle();
                newSound.PosY   = reader.ReadSingle();
                newSound.PosZ   = reader.ReadSingle();
                newSound.Radius = reader.ReadSingle();

                newSound.CooldownDay   = reader.ReadInt32();
                newSound.CooldownNight = reader.ReadInt32();
                newSound.RandomDelay   = reader.ReadInt32();

                newSound.Unk44 = reader.ReadInt32();
                int soundId1 = reader.ReadInt32();
                int soundId2 = reader.ReadInt32();

                byte soundType = reader.ReadByte();
                newSound.SoundType = (SoundType)soundType;

                if (soundType == 0 || soundType == 2 || soundType == 3)
                {
                    // Find the sound names
                    EmissionType newSoundEmissionType = newSound.EmissionType;
                    newSound.SoundIdDay = GetSoundString(soundId1, _soundBank, ref newSoundEmissionType);
                    EmissionType soundEmissionType = newSound.EmissionType;
                    newSound.SoundIdNight = GetSoundString(soundId2, _soundBank, ref soundEmissionType);
                }
                else
                {
                    newSound.SoundIdDay   = GetMusicTrackName(zoneShortName, soundId1);
                    newSound.SoundIdNight = GetMusicTrackName(zoneShortName, soundId1);
                }

                newSound.UnkPad57 = reader.ReadByte();
                newSound.UnkPad58 = reader.ReadByte();
                newSound.UnkPad59 = reader.ReadByte();

                newSound.AsDistance   = reader.ReadInt32();
                newSound.UnkRange64   = reader.ReadInt32();
                newSound.FadeOutMs    = reader.ReadInt32();
                newSound.UnkRange72   = reader.ReadInt32();
                newSound.FullVolRange = reader.ReadInt32();
                newSound.UnkRange80   = reader.ReadInt32();

                if (newSound.SoundIdDay != "" || newSound.SoundIdNight != "")
                {
                    _soundEntries.Add(newSound);
                }
            }
        }
        private double flightDistance;              // [km]


        // Constructor
        public Flight()
        {
            this.Type = EmissionType.Flight;
        }