Пример #1
0
        public void Read(OsiReader reader)
        {
            Name = reader.ReadString();
            if (Name.Length > 0)
            {
                var hasParams = reader.ReadByte();
                if (hasParams > 0)
                {
                    Parameters = new List <TypedValue>();
                    var numParams = reader.ReadByte();
                    while (numParams-- > 0)
                    {
                        TypedValue param;
                        var        type = reader.ReadByte();
                        if (type == 1)
                        {
                            param = new Variable();
                        }
                        else
                        {
                            param = new TypedValue();
                        }
                        param.Read(reader);
                        Parameters.Add(param);
                    }
                }

                Negate = reader.ReadBoolean();
            }

            GoalIdOrDebugHook = reader.ReadInt32();
        }
Пример #2
0
        public void Read(OsiReader reader)
        {
            Index = reader.ReadUInt32();
            Name  = reader.ReadString();
            SubGoalCombination = reader.ReadByte();

            ParentGoals = new List <uint>();
            var numItems = reader.ReadUInt32();

            while (numItems-- > 0)
            {
                ParentGoals.Add(reader.ReadUInt32());
            }

            SubGoals = new List <uint>();
            numItems = reader.ReadUInt32();
            while (numItems-- > 0)
            {
                SubGoals.Add(reader.ReadUInt32());
            }

            Unknown = reader.ReadByte();

            if (reader.MajorVersion > 1 || (reader.MajorVersion == 1 && reader.MinorVersion >= 1))
            {
                InitCalls = reader.ReadList <Call>();
                ExitCalls = reader.ReadList <Call>();
            }
            else
            {
                InitCalls = new List <Call>();
                ExitCalls = new List <Call>();
            }
        }
Пример #3
0
 public virtual void Read(OsiReader reader)
 {
     DatabaseRef = reader.ReadDatabaseRef();
     Name        = reader.ReadString();
     if (Name.Length > 0)
     {
         NameIndex = reader.ReadByte();
     }
 }
Пример #4
0
 public void Read(OsiReader reader)
 {
     Name = reader.ReadString();
     Type = reader.ReadByte();
     Key1 = reader.ReadUInt32();
     Key2 = reader.ReadUInt32();
     Key3 = reader.ReadUInt32();
     Key4 = reader.ReadUInt32();
 }
Пример #5
0
        public virtual void Read(OsiReader reader)
        {
            var wtf = reader.ReadByte();

            if (wtf == 49)
            {
                TypeId   = reader.ReadUInt32();
                IntValue = reader.ReadInt32();
            }
            else if (wtf == 48)
            {
                TypeId = reader.ReadUInt32();
                switch ((Type)TypeId)
                {
                case Type.Unknown:
                    break;

                case Type.Integer:
                    IntValue = reader.ReadInt32();
                    break;

                case Type.Float:
                    FloatValue = reader.ReadSingle();
                    break;

                case Type.String:
                    if (reader.ReadByte() > 0)
                    {
                        StringValue = reader.ReadString();
                    }
                    break;

                default:
                    StringValue = reader.ReadString();
                    break;
                }
            }
            else
            {
                throw new InvalidDataException("Unrecognized value type");
            }
        }
Пример #6
0
        private List <string> ReadStrings(OsiReader reader)
        {
            var stringTable = new List <string>();
            var count       = reader.ReadUInt32();

            while (count-- > 0)
            {
                stringTable.Add(reader.ReadString());
            }

            return(stringTable);
        }
Пример #7
0
        public void Read(OsiReader reader)
        {
            Name         = reader.ReadString();
            OutParamMask = new List <byte>();
            var outParamBytes = reader.ReadUInt32();

            while (outParamBytes-- > 0)
            {
                OutParamMask.Add(reader.ReadByte());
            }

            Parameters = new ParameterList();
            Parameters.Read(reader);
        }
Пример #8
0
        public void Read(OsiReader reader)
        {
            Name      = reader.ReadString();
            Index     = reader.ReadByte();
            IsBuiltin = false;

            if (reader.Ver >= OsiVersion.VerTypeAliases)
            {
                Alias = reader.ReadByte();
            }
            else
            {
                // D:OS 1 only supported string aliases
                Alias = (int)Value.Type_OS1.String;
            }
        }
Пример #9
0
        public void Read(OsiReader reader)
        {
            Index = reader.ReadUInt32();
            Name  = reader.ReadString();
            SubGoalCombination = reader.ReadByte();

            ParentGoals = reader.ReadRefList <GoalReference, Goal>();
            SubGoals    = reader.ReadRefList <GoalReference, Goal>();

            Flags = reader.ReadByte();

            if (reader.Ver >= OsiVersion.VerAddInitExitCalls)
            {
                InitCalls = reader.ReadList <Call>();
                ExitCalls = reader.ReadList <Call>();
            }
            else
            {
                InitCalls = new List <Call>();
                ExitCalls = new List <Call>();
            }
        }
Пример #10
0
        public void Read(OsiReader reader)
        {
            reader.ReadByte();
            Version      = reader.ReadString();
            MajorVersion = reader.ReadByte();
            MinorVersion = reader.ReadByte();
            BigEndian    = reader.ReadBoolean();
            Unused       = reader.ReadByte();

            if (Ver >= OsiVersion.VerAddVersionString)
            {
                reader.ReadBytes(0x80); // Version string buffer
            }
            if (Ver >= OsiVersion.VerAddDebugFlags)
            {
                DebugFlags = reader.ReadUInt32();
            }
            else
            {
                DebugFlags = 0;
            }
        }
Пример #11
0
        public void Read(OsiReader reader)
        {
            reader.ReadByte();
            Version      = reader.ReadString();
            MajorVersion = reader.ReadByte();
            MinorVersion = reader.ReadByte();
            BigEndian    = reader.ReadBoolean();
            Unused       = reader.ReadByte();

            if (MajorVersion > 1 || (MajorVersion == 1 && MinorVersion >= 2))
            {
                reader.ReadBytes(0x80); // Version string buffer
            }
            if (MajorVersion > 1 || (MajorVersion == 1 && MinorVersion >= 3))
            {
                DebugFlags = reader.ReadUInt32();
            }
            else
            {
                DebugFlags = 0;
            }
        }
Пример #12
0
        public virtual void Read(OsiReader reader)
        {
            // possibly isReference?
            var wtf = reader.ReadByte();

            if (wtf == '1')
            {
                TypeId   = reader.ReadUInt32();
                IntValue = reader.ReadInt32();
            }
            else if (wtf == '0')
            {
                TypeId = reader.ReadUInt32();
                uint writtenTypeId = TypeId;

                uint alias;
                bool dos1alias = false;
                if (reader.TypeAliases.TryGetValue(writtenTypeId, out alias))
                {
                    writtenTypeId = alias;
                    if (reader.Ver < OsiVersion.VerEnhancedTypes)
                    {
                        dos1alias = true;
                    }
                }

                if (reader.Ver < OsiVersion.VerEnhancedTypes)
                {
                    // Convert D:OS 1 type ID to D:OS 2 type ID
                    writtenTypeId = ConvertOS1ToOS2Type(writtenTypeId);
                }

                switch ((Type)writtenTypeId)
                {
                case Type.Unknown:
                    break;

                case Type.Integer:
                    IntValue = reader.ReadInt32();
                    break;

                case Type.Integer64:
                    Int64Value = reader.ReadInt64();
                    break;

                case Type.Float:
                    FloatValue = reader.ReadSingle();
                    break;

                case Type.GuidString:
                case Type.String:
                    // D:OS 1 aliased strings didn't have a flag byte
                    if (dos1alias)
                    {
                        StringValue = reader.ReadString();
                    }
                    else if (reader.ReadByte() > 0)
                    {
                        StringValue = reader.ReadString();
                    }
                    break;

                default:
                    StringValue = reader.ReadString();
                    break;
                }
            }
            else
            {
                throw new InvalidDataException("Unrecognized value type");
            }
        }
Пример #13
0
 public void Read(OsiReader reader)
 {
     Name  = reader.ReadString();
     Index = reader.ReadByte();
 }