Example #1
0
        private Stage(BinaryReader br)
        {
            var mainSection = MainGeometrySection.Read(br);

            ObjectsGroup[] objectsGroups =
            {
                ObjectsGroup.Read(mainSection.Group1Pointer, br),
                ObjectsGroup.Read(mainSection.Group2Pointer, br),
                ObjectsGroup.Read(mainSection.Group3Pointer, br),
                ObjectsGroup.Read(mainSection.Group4Pointer, br)
            };

            _modelGroups = new ModelGroups(
                ModelGroup.Read(objectsGroups[0].objectListPointer, br),
                ModelGroup.Read(objectsGroups[1].objectListPointer, br),
                ModelGroup.Read(objectsGroups[2].objectListPointer, br),
                ModelGroup.Read(objectsGroups[3].objectListPointer, br)
                );

            (Textures, UsingTexturePages, Width, Height) = ReadTexture(mainSection.TexturePointer, br);
            Scenario = Memory.Encounters.Scenario;

            if (Textures == null || Textures.All(x => x.Value == null))
            {
                return;
            }

            //TextureHandler t = Textures.First(x => x.Value != null).Value;
            //Width = t.Width;
            //Height = t.Height;

            //Seems most animations skip the first frame. Can override with skip:0
            //Count defaults to rows * cols. Can override this to be less than that.
            //public Animation(int width, int height, byte clut, byte texturePage, byte cols, byte rows, ModelGroups _mg, int Count = 0, int x = 0, int y =0, int skip =1)
            if (Scenario == 8)//need to update the source texture with the animation frames or add new vertices and uvs because first frame is 3x larger
            {
                _textureAnimations = new List <TextureAnimation>
                {
                    new TextureAnimation(Textures[1], 32, 96, 2, 6, 1, skip: 3, y: 128)
                }
            }