Beispiel #1
0
        private void ReadSceneryInstances(BinaryReader br, uint size)
        {
            while (br.ReadUInt32() == 0x11111111)
            {
                size -= 4;
            }

            br.BaseStream.Position -= 4;

            Debug.Assert(size % 0x60 == 0);
            var count = (int)size / 0x60;

            _scenerySection.Instances = new List <SceneryInstance>(count);

            for (int i = 0; i < count; ++i)
            {
                var instance         = new SceneryInstance();
                var internalInstance = BinaryUtil.ReadUnmanagedStruct <SceneryInstanceInternal>(br);

                instance.InfoIndex = internalInstance.SceneryInfoNumber;
                instance.Transform = Matrix4x4.Multiply(internalInstance.Rotation,
                                                        Matrix4x4.CreateTranslation(internalInstance.Position));

                _scenerySection.Instances.Add(instance);
            }
            //Debug.Log($"Loaded {_scenerySection.SceneryInstances.Count} scenery instances for ScenerySection {_scenerySection.SectionNumber}");
        }
        private void ReadSceneryInstances(BinaryReader br, uint size)
        {
            size -= BinaryUtil.AlignReader(br, 0x10);
            Debug.Assert(size % 0x40 == 0);
            var count = (int)size / 0x40;

            _scenerySection.Instances = new List <SceneryInstance>(count);

            for (int i = 0; i < count; ++i)
            {
                var instance         = new SceneryInstance();
                var internalInstance = BinaryUtil.ReadUnmanagedStruct <SceneryInstanceInternal>(br);

                instance.InfoIndex = internalInstance.SceneryInfoNumber;
                instance.Transform = Matrix4x4.Multiply(internalInstance.Rotation,
                                                        Matrix4x4.CreateTranslation(internalInstance.Position));

                _scenerySection.Instances.Add(instance);
            }
        }
Beispiel #3
0
            private void AddRespawnPoint(RealPoint3d position, RealEulerAngles3d rotation)
            {
                var instance = new SceneryInstance();

                instance.PaletteIndex = (short)Scnr.SceneryPalette.Count;
                instance.NameIndex    = -1;
                instance.Position     = position;
                instance.Rotation     = rotation;
                instance.ObjectType   = new ScenarioObjectType()
                {
                    Halo3ODST = GameObjectTypeHalo3ODST.Scenery
                };
                instance.Source          = ScenarioInstance.SourceValue.Editor;
                instance.BspPolicy       = ScenarioInstance.BspPolicyValue.Default;
                instance.OriginBspIndex  = 0;
                instance.AllowedZoneSets = (1 << 0);
                instance.Team            = SceneryInstance.TeamValue.Neutral;
                Scnr.Scenery.Add(instance);

                Scnr.SceneryPalette.Add(new ScenarioPaletteEntry()
                {
                    Object = CacheContext.GetTag(@"objects\multi\spawning\respawn_point_invisible.scenery")
                });
            }