protected override void ReadObjectData(BinaryReader xReader)
        {
            // Object name. No names in Defiance :(
            //xReader.BaseStream.Position = _dataStart + 0x00000024;
            //xReader.BaseStream.Position = _dataStart + xReader.ReadUInt32();
            //String strModelName = new String(xReader.ReadChars(8));
            //_name = Utility.CleanName(strModelName);

            // Texture type
            //xReader.BaseStream.Position = m_uDataStart + 0x44;
            //if (xReader.ReadUInt64() != 0xFFFFFFFFFFFFFFFF)
            //{
            //    m_ePlatform = Platform.PSX;
            //}
            //else
            //{
            _platform = Platform.PC;
            //}

            // Model data
            xReader.BaseStream.Position = _dataStart + 0x0000001C;
            //xReader.BaseStream.Position = _dataStart + xReader.ReadUInt32();
            _modelCount = 1; //xReader.ReadUInt16();
            _animCount  = 0; //xReader.ReadUInt16();
            _modelStart = _dataStart + xReader.ReadUInt32();
            _animStart  = 0; //m_uDataStart + xReader.ReadUInt32();

            _models = new DefianceModel[_modelCount];
            for (UInt16 m = 0; m < _modelCount; m++)
            {
                _models[m] = DefianceObjectModel.Load(xReader, _dataStart, _modelStart, _name, _platform, m, _version);
            }
        }
예제 #2
0
        protected override void ReadObjectData(BinaryReader reader, ExportOptions options)
        {
            // Object name. No names in Defiance :(
            //reader.BaseStream.Position = _dataStart + 0x00000024;
            //reader.BaseStream.Position = _dataStart + reader.ReadUInt32();
            //String strModelName = new String(reader.ReadChars(8));
            //_name = Utility.CleanObjectName(strModelName);

            // Texture type
            //reader.BaseStream.Position = _dataStart + 0x44;
            //if (reader.ReadUInt64() != 0xFFFFFFFFFFFFFFFF)
            //{
            //    _platform = Platform.PSX;
            //}
            //else
            //{
            if (options.ForcedPlatform == CDC.Platform.None)
            {
                _platform = Platform.PC;
            }
            else
            {
                _platform = options.ForcedPlatform;
            }
            //}

            // Model data
            reader.BaseStream.Position = _dataStart + 0x00000028;
            _modelCount = reader.ReadUInt16();
            _modelCount = 1;            // There are multiple models, but Defiance might have too many. Override for now.
            _animCount  = 0;            //reader.ReadUInt16();
            reader.BaseStream.Position += 0x02;
            _modelStart = _dataStart + reader.ReadUInt32();
            _animStart  = 0;            //_dataStart + reader.ReadUInt32();

            _models = new DefianceModel[_modelCount];
            for (UInt16 m = 0; m < _modelCount; m++)
            {
                _models[m] = DefianceObjectModel.Load(reader, _dataStart, _modelStart, _name, _platform, m, _version, options);
            }
        }
        protected override void ReadUnitData(BinaryReader xReader, CDC.Objects.ExportOptions options)
        {
            // Adjacent units are seperate from portals.
            // There can be multiple portals to the same unit.
            // Portals
            xReader.BaseStream.Position = _dataStart + 0x10;
            UInt32 m_uConnectionData = _dataStart + xReader.ReadUInt32();             // Same as m_uModelData?

            xReader.BaseStream.Position = m_uConnectionData + 0x24;
            portalCount = xReader.ReadUInt32();
            xReader.BaseStream.Position = _dataStart + xReader.ReadUInt32();
            _portalNames = new String[portalCount];
            for (int i = 0; i < portalCount; i++)
            {
                String strUnitName = new String(xReader.ReadChars(16));
                _portalNames[i]              = Utility.CleanName(strUnitName);
                xReader.BaseStream.Position += 0x90;
            }

            // Instances
            //xReader.BaseStream.Position = _dataStart + 0x44;
            //_instanceCount = xReader.ReadUInt32();
            //_instanceStart = _dataStart + xReader.ReadUInt32();
            //_instanceNames = new String[_instanceCount];
            //for (int i = 0; i < _instanceCount; i++)
            //{
            //    xReader.BaseStream.Position = _instanceStart + 0x60 * i;
            //    String strInstanceName = new String(xReader.ReadChars(8));
            //    _instanceNames[i] = Utility.CleanName(strInstanceName);
            //}

            // Instance types
            //xReader.BaseStream.Position = _dataStart + 0x4C;
            //_instanceTypeStart = _dataStart + xReader.ReadUInt32();
            //xReader.BaseStream.Position = _instanceTypeStart;
            //List<String> xInstanceList = new List<String>();
            //while (xReader.ReadByte() != 0xFF)
            //{
            //    xReader.BaseStream.Position--;
            //    String strInstanceTypeName = new String(xReader.ReadChars(8));
            //    xInstanceList.Add(Utility.CleanName(strInstanceTypeName));
            //    xReader.BaseStream.Position += 0x08;
            //}
            //_instanceTypeNames = xInstanceList.ToArray();

            // Unit name
            xReader.BaseStream.Position = _dataStart + 0x84;
            xReader.BaseStream.Position = _dataStart + xReader.ReadUInt32();
            String strModelName = new String(xReader.ReadChars(10));             // Need to check

            _name = Utility.CleanName(strModelName);

            // Texture type
            //xReader.BaseStream.Position = m_uDataStart + 0x9C;
            //if (xReader.ReadUInt64() != 0xFFFFFFFFFFFFFFFF)
            //{
            //    m_ePlatform = Platform.PSX;
            //}
            //else
            //{
            if (options.ForcedPlatform == CDC.Platform.None)
            {
                _platform = Platform.PC;
            }
            else
            {
                _platform = options.ForcedPlatform;
            }
            //}

            // Model data
            xReader.BaseStream.Position = _dataStart + 0x10;
            _modelCount = 1;
            _modelStart = _dataStart + 0x10;
            _models     = new DefianceModel[_modelCount];
            xReader.BaseStream.Position = _modelStart;
            UInt32 m_uModelData = _dataStart + xReader.ReadUInt32();

            // Material data
            Console.WriteLine("Debug: reading area model 0");
            _models[0] = DefianceUnitModel.Load(xReader, _dataStart, m_uModelData, _name, _platform, _version, options);

            //if (m_axModels[0].Platform == Platform.Dreamcast ||
            //    m_axModels[1].Platform == Platform.Dreamcast)
            //{
            //    m_ePlatform = Platform.Dreamcast;
            //}
        }
예제 #4
0
        protected override void ReadUnitData(BinaryReader reader, ExportOptions options)
        {
            // Adjacent units are seperate from portals.
            // There can be multiple portals to the same unit.
            // Portals
            reader.BaseStream.Position = _dataStart + 0x10;
            UInt32 m_uConnectionData = _dataStart + reader.ReadUInt32();             // Same as m_uModelData?

            reader.BaseStream.Position = m_uConnectionData + 0x24;
            portalCount = reader.ReadUInt32();
            reader.BaseStream.Position = _dataStart + reader.ReadUInt32();
            _portalNames = new String[portalCount];
            for (int i = 0; i < portalCount; i++)
            {
                String strUnitName = new String(reader.ReadChars(16));
                _portalNames[i]             = Utility.CleanName(strUnitName);
                reader.BaseStream.Position += 0x90;
            }

            // Intros
            reader.BaseStream.Position = _dataStart + 0x78;
            _introCount = reader.ReadUInt32();
            _introStart = _dataStart + reader.ReadUInt32();
            _intros     = new Intro[_introCount];
            for (int i = 0; i < _introCount; i++)
            {
                reader.BaseStream.Position  = _introStart + 0x60 * i;
                _intros[i].rotation.x       = reader.ReadSingle();
                _intros[i].rotation.y       = reader.ReadSingle();
                _intros[i].rotation.z       = reader.ReadSingle();
                reader.BaseStream.Position += 0x04;
                _intros[i].position.x       = reader.ReadSingle();
                _intros[i].position.y       = reader.ReadSingle();
                _intros[i].position.z       = reader.ReadSingle();
                reader.BaseStream.Position += 0x04;
                reader.BaseStream.Position += 0x20;
                _intros[i].objectID         = reader.ReadInt16();
                _intros[i].introNum         = reader.ReadInt16();
                _intros[i].uniqueID         = reader.ReadInt32();
                _intros[i].name             = "Intro(" + _intros[i].objectID + ")-" + _intros[i].uniqueID;
                _intros[i].fileName         = "";
            }

            // Object Names
            reader.BaseStream.Position = _dataStart + 0x80;
            _objectNameStart           = _dataStart + reader.ReadUInt32();
            reader.BaseStream.Position = _objectNameStart;
            List <Int16> objectIDs = new List <Int16>();

            while (true)
            {
                Int16 objectID = reader.ReadInt16();
                if (objectID == 0)
                {
                    break;
                }
                objectIDs.Add(objectID);
            }
            _objectNames = new string[objectIDs.Count];
            _objectIDs   = objectIDs.ToArray();

            // Unit name
            reader.BaseStream.Position = _dataStart + 0x84;
            reader.BaseStream.Position = _dataStart + reader.ReadUInt32();
            String strModelName = new String(reader.ReadChars(10));             // Need to check

            _name = Utility.CleanName(strModelName);

            // Texture type
            //reader.BaseStream.Position = _dataStart + 0x9C;
            //if (reader.ReadUInt64() != 0xFFFFFFFFFFFFFFFF)
            //{
            //    _platform = Platform.PSX;
            //}
            //else
            //{
            if (options.ForcedPlatform == CDC.Platform.None)
            {
                _platform = Platform.PC;
            }
            else
            {
                _platform = options.ForcedPlatform;
            }
            //}

            // Model data
            reader.BaseStream.Position = _dataStart + 0x10;
            _modelCount = 1;
            _modelStart = _dataStart + 0x10;
            _models     = new DefianceModel[_modelCount];
            reader.BaseStream.Position = _modelStart;
            UInt32 m_uModelData = _dataStart + reader.ReadUInt32();

            // Material data
            Console.WriteLine("Debug: reading area model 0");
            _models[0] = DefianceUnitModel.Load(reader, _dataStart, m_uModelData, _name, _platform, _version, options);

            //if (m_axModels[0].Platform == Platform.Dreamcast ||
            //    m_axModels[1].Platform == Platform.Dreamcast)
            //{
            //    _platform = Platform.Dreamcast;
            //}
        }