Пример #1
0
                public temp_unk(BinaryReader reader, int num)
                {
                    buffer = null;
                    data   = null;

                    bufferType = (ActorTypes)reader.ReadInt32();

                    uint bufferLength = reader.ReadUInt32();

                    if (bufferType == ActorTypes.Pinup && bufferLength == 4)
                    {
                        data = new ActorPinup(reader);
                    }
                    else if (bufferType == ActorTypes.ScriptEntity && bufferLength == 100)
                    {
                        data = new ActorScriptEntity(reader);
                    }
                    else if (bufferType == ActorTypes.Radio && bufferLength == 1028)
                    {
                        data = new ActorRadio(reader);
                    }
                    else if (bufferType == ActorTypes.Sound && bufferLength == 592)
                    {
                        //long pos = reader.BaseStream.Position;
                        //data = new ActorSoundEntity(reader);
                        //reader.BaseStream.Position = pos;
                        buffer = reader.ReadBytes((int)bufferLength);
                    }
                    else
                    {
                        buffer = reader.ReadBytes((int)bufferLength);
                    }
                }
Пример #2
0
 public ActorExtraData(BinaryReader reader)
 {
     buffer     = null;
     data       = null;
     bufferType = 0;
     ReadFromFile(reader);
 }
Пример #3
0
 public temp_unk(BinaryReader reader)
 {
     buffer     = null;
     data       = null;
     bufferType = 0;
     ReadFromFile(reader);
 }
Пример #4
0
        private void Paste()
        {
            if (clipboard is ActorExtraData)
            {
                ActorExtraData           ExtraData    = (clipboard as ActorExtraData);
                IActorExtraDataInterface NewExtraData = ActorFactory.CreateDuplicateExtraData(ExtraData.BufferType, ExtraData.Data);

                TreeNode SelectedNode = ActorTreeView.SelectedNode;
                if (ActorTreeView.SelectedNode.Text.Equals("Extra Data"))
                {
                    ActorExtraData ExistingExtraData = (SelectedNode.Tag as ActorExtraData);
                    if (ExtraData.BufferType == ExistingExtraData.BufferType)
                    {
                        ExistingExtraData.Data = NewExtraData;
                    }
                }
            }
        }
Пример #5
0
        public void ReadFromFile(BinaryReader reader)
        {
            buffer = null;
            data   = null;

            bufferType = (ActorTypes)reader.ReadInt32();

            uint bufferLength = reader.ReadUInt32();

            buffer = reader.ReadBytes((int)bufferLength);
            using (MemoryStream stream = new MemoryStream(buffer))
            {
                bool isBigEndian = false; //we'll change this once console parsing is complete.
                data = ActorFactory.LoadExtraData(bufferType, stream, isBigEndian);
                Debug.Assert(bufferLength == stream.Length);
            }

            buffer = (data == null ? buffer : null);
        }
Пример #6
0
        private void Paste()
        {
            if (clipboard is ActorExtraData)
            {
                ActorExtraData           ExtraData    = (clipboard as ActorExtraData);
                IActorExtraDataInterface NewExtraData = ActorFactory.CreateDuplicateExtraData(ExtraData.BufferType, ExtraData.Data);

                TreeNode SelectedNode = ActorTreeView.SelectedNode;
                if (ActorTreeView.SelectedNode.Text.Equals("Extra Data"))
                {
                    ActorExtraData ExistingExtraData = (SelectedNode.Tag as ActorExtraData);
                    if (ExtraData.BufferType == ExistingExtraData.BufferType)
                    {
                        ExistingExtraData.Data = NewExtraData;
                    }
                }

                Text          = Language.GetString("$ACTOR_EDITOR_TITLE") + "*";
                bIsFileEdited = true;
            }
        }
Пример #7
0
        public static IActorExtraDataInterface CreateDuplicateExtraData(ActorTypes type, IActorExtraDataInterface extraData)
        {
            switch (type)
            {
            case ActorTypes.C_Sound:
                return(new ActorSoundEntity(extraData));

            default:
                return(null);
            }
        }
Пример #8
0
        public void ReadFromFile(BinaryReader reader)
        {
            buffer = null;
            data   = null;

            bufferType = (ActorTypes)reader.ReadInt32();

            uint bufferLength = reader.ReadUInt32();

            buffer = reader.ReadBytes((int)bufferLength);
            bool parsed = false;

            using (MemoryStream stream = new MemoryStream(buffer))
            {
                bool isBigEndian = false; //we'll change this once console parsing is complete.
                if (bufferType == ActorTypes.Pinup && bufferLength == 4)
                {
                    data   = new ActorPinup(stream, isBigEndian);
                    parsed = true;
                }
                else if (bufferType == ActorTypes.ScriptEntity && bufferLength == 100)
                {
                    data   = new ActorScriptEntity(stream, isBigEndian);
                    parsed = true;
                }
                //else if (bufferType == ActorTypes.Radio && bufferLength == 1028)
                //{
                //    data = new ActorRadio(stream, isBigEndian);
                //}
                else if (bufferType == ActorTypes.Airplane && bufferLength == 4)
                {
                    data   = new ActorAircraft(stream, isBigEndian);
                    parsed = true;
                }
                else if (bufferType == ActorTypes.SpikeStrip && bufferLength == 4)
                {
                    data   = new ActorSpikeStrip(stream, isBigEndian);
                    parsed = true;
                }
                else if (bufferType == ActorTypes.Door && bufferLength == 364)
                {
                    data   = new ActorDoor(stream, isBigEndian);
                    parsed = true;
                }
                else if (bufferType == ActorTypes.Wardrobe && bufferLength == 208)
                {
                    data   = new ActorWardrobe(stream, isBigEndian);
                    parsed = true;
                }
                else if (bufferType == ActorTypes.TrafficTrain && bufferLength == 180)
                {
                    data   = new ActorTrafficTrain(stream, isBigEndian);
                    parsed = true;
                }
                else if (bufferType == ActorTypes.TrafficHuman && bufferLength == 160)
                {
                    data   = new ActorTrafficHuman(stream, isBigEndian);
                    parsed = true;
                }
                else if (bufferType == ActorTypes.TrafficCar && bufferLength == 220)
                {
                    data   = new ActorTrafficCar(stream, isBigEndian);
                    parsed = true;
                }
                else if (bufferType == ActorTypes.LightEntity && bufferLength == 2316)
                {
                    data   = new ActorLight(stream, isBigEndian);
                    parsed = true;
                }
                else if (bufferType == ActorTypes.Item && bufferLength == 152)
                {
                    data   = new ActorItem(stream, isBigEndian);
                    parsed = true;
                }
                else if (bufferType == ActorTypes.Sound && bufferLength == 592)
                {
                    data   = new ActorSoundEntity(stream, isBigEndian);
                    parsed = true;
                }
                else if (bufferType == ActorTypes.CleanEntity && bufferLength == 20)
                {
                    data   = new ActorCleanEntity(stream, isBigEndian);
                    parsed = true;
                }
            }

            if (parsed)
            {
                buffer = null;
            }
        }