コード例 #1
0
        public static Stage Read(uint offset, BinaryReader br)
        {
            Scenario = Memory.Encounters.Scenario;
            Stage s = new Stage();

            br.BaseStream.Seek(offset, SeekOrigin.Begin);
            uint sectionCounter = br.ReadUInt32();

            if (sectionCounter != 6)
            {
                Memory.Log.WriteLine($"BS_PARSER_PRE_OBJECTSECTION: Main geometry section has no 6 pointers at: {br.BaseStream.Position}");
                Module_battle_debug.battleModule++;
                return(null);
            }
            MainGeometrySection MainSection = MainGeometrySection.Read(br);

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

            s.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)
                );

            s.ReadTexture(MainSection.TexturePointer, br);

            return(s);
        }
コード例 #2
0
        private static void ReadData()
        {
            ArchiveWorker aw = new ArchiveWorker(Memory.Archives.A_BATTLE);

            string[] test = aw.GetListOfFiles();
            battlename       = test.First(x => x.ToLower().Contains(battlename));
            stageBuffer      = ArchiveWorker.GetBinaryFile(Memory.Archives.A_BATTLE, battlename);
            pbs              = new PseudoBufferedStream(stageBuffer);
            bs_cameraPointer = GetCameraPointer();
            pbs.Seek(bs_cameraPointer, 0);
            ReadCamera();
            uint sectionCounter = pbs.ReadUInt();

            if (sectionCounter != 6)
            {
                Console.WriteLine($"BS_PARSER_PRE_OBJECTSECTION: Main geometry section has no 6 pointers at: {pbs.Tell()}");
                battleModule++;
                return;
            }
            MainGeometrySection MainSection = ReadObjectGroupPointers();

            ObjectsGroup[] objectsGroups = new ObjectsGroup[4]
            {
                ReadObjectsGroup(MainSection.Group1Pointer),
                ReadObjectsGroup(MainSection.Group2Pointer),
                ReadObjectsGroup(MainSection.Group3Pointer),
                ReadObjectsGroup(MainSection.Group4Pointer)
            };

            modelGroups = new ModelGroup[4]
            {
                ReadModelGroup(objectsGroups[0].objectListPointer),
                ReadModelGroup(objectsGroups[1].objectListPointer),
                ReadModelGroup(objectsGroups[2].objectListPointer),
                ReadModelGroup(objectsGroups[3].objectListPointer)
            };

            ReadTexture(MainSection.TexturePointer);

            ReadCharacters();
            ReadMonster();

            //for frames indexes monsters are first, then after n monsters characters appear with weapons
            frame = new int[monstersData.Length + charactersData.Length * 2];

            battleModule++;
        }
コード例 #3
0
ファイル: Stage.cs プロジェクト: MaKiPL/OpenVIII-monogame
        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)
                }
            }