Ejemplo n.º 1
0
        public override void SerializeOffsetData(SerializerObject s)
        {
            // Parse level block data
            if (OffsetTable.Offsets[PlayFieldIndex] != -1)
            {
                PlayField = s.DoAt(OffsetTable.GetPointer(PlayFieldIndex), () => s.SerializeObject <GBA_PlayField>(PlayField, name: nameof(PlayField)));
            }

            // Parse actor data
            var actors = GetAllActors(s.GameSettings).ToArray();

            for (var i = 0; i < actors.Length; i++)
            {
                if (actors[i].Type == GBA_Actor.ActorType.BoxTrigger)
                {
                    actors[i].BoxActorBlock = s.DoAt(OffsetTable.GetPointer(actors[i].BoxActorBlockOffsetIndex, isRelativeOffset: IsGCNBlock),
                                                     () => s.SerializeObject <GBA_BoxTriggerActorDataBlock>(actors[i].BoxActorBlock,
                                                                                                            onPreSerialize: bab => {
                        bab.IsGCNBlock = IsGCNBlock;
                        bab.Length     = actors[i].LinkedActorsCount;
                    }, name: $"{nameof(GBA_Actor.BoxActorBlock)}[{i}]"));
                }
                else if (actors[i].Type != GBA_Actor.ActorType.Trigger && actors[i].Type != GBA_Actor.ActorType.Unk && actors[i].GraphicsDataIndex < OffsetTable.OffsetsCount)
                {
                    actors[i].GraphicData = s.DoAt(OffsetTable.GetPointer(actors[i].GraphicsDataIndex),
                                                   () => s.SerializeObject <GBA_ActorGraphicData>(actors[i].GraphicData,
                                                                                                  name: $"{nameof(GBA_Actor.GraphicData)}[{i}]"));
                }
            }
        }
Ejemplo n.º 2
0
        public override void SerializeOffsetData(SerializerObject s)
        {
            // Parse level block data
            if (OffsetTable.Offsets[Index_PlayField] != -1)
            {
                PlayField = s.DoAt(OffsetTable.GetPointer(Index_PlayField), () => s.SerializeObject <GBA_PlayField>(PlayField, name: nameof(PlayField)));
            }

            // Parse actor data
            var actors = GetAllActors(s.GameSettings).ToArray();

            for (var i = 0; i < actors.Length; i++)
            {
                if (actors[i].Type == GBA_Actor.ActorType.Captor)
                {
                    actors[i].CaptorData = s.DoAt(OffsetTable.GetPointer(actors[i].Index_CaptorData, isRelativeOffset: IsGCNBlock),
                                                  () => s.SerializeObject <GBA_CaptorData>(actors[i].CaptorData,
                                                                                           onPreSerialize: bab => {
                        bab.IsGCNBlock = IsGCNBlock;
                        bab.Length     = actors[i].LinkedActorsCount;
                    }, name: $"{nameof(GBA_Actor.CaptorData)}[{i}]"));
                }
                else if (actors[i].Type != GBA_Actor.ActorType.Waypoint && actors[i].Type != GBA_Actor.ActorType.Unk && actors[i].Index_ActorModel < OffsetTable.OffsetsCount)
                {
                    actors[i].ActorModel = s.DoAt(OffsetTable.GetPointer(actors[i].Index_ActorModel),
                                                  () => s.SerializeObject <GBA_ActorModel>(actors[i].ActorModel,
                                                                                           name: $"{nameof(GBA_Actor.ActorModel)}[{i}]"));
                }
            }
        }
Ejemplo n.º 3
0
        public override void SerializeImpl(SerializerObject s)
        {
            // Header
            SceneBlockLength = s.Serialize <uint>(SceneBlockLength, name: nameof(SceneBlockLength));
            Scene            = s.SerializeObject <GBA_Scene>(Scene, onPreSerialize: sc => sc.IsGCNBlock = true, name: nameof(Scene));

            // Data
            s.Goto(Offset + SceneBlockLength);
            PlayFieldBlockLength = s.Serialize <uint>(PlayFieldBlockLength, name: nameof(PlayFieldBlockLength));
            PlayField            = s.SerializeObject <GBA_PlayField>(PlayField, onPreSerialize: pf => pf.IsGCNBlock = true, name: nameof(PlayField));
        }