Пример #1
0
        internal static void SerializeChrAnimationTerminator(MetroidRom rom, ref int frameIndex)
        {
            rom.SetAnimationTable_Bank0(frameIndex, 0xFF);
            rom.SetAnimationTable_Bank1(frameIndex, 0xFF);
            rom.SetAnimationTable_Bank2(frameIndex, 0xFF);
            rom.SetAnimationTable_Bank3(frameIndex, 0xFF);
            rom.SetAnimationTable_FrameTime(frameIndex, 0xFF);
            rom.SetAnimationTable_FrameLast(frameIndex, true);

            frameIndex++;
        }
Пример #2
0
        private static void AddAnimationFrames(MetroidRom rom, ref int frameIndex, int firstChrBank, int frameCount, int frameLength)
        {
            var chrBank = firstChrBank;

            while (frameCount > 0)
            {
                rom.SetAnimationTable_Bank0(frameIndex, (byte)chrBank);
                rom.SetAnimationTable_Bank1(frameIndex, (byte)(chrBank + 1));
                rom.SetAnimationTable_Bank2(frameIndex, (byte)(chrBank + 2));
                rom.SetAnimationTable_Bank3(frameIndex, (byte)(chrBank + 3));
                rom.SetAnimationTable_FrameTime(frameIndex, frameLength);
                // Set the 'last frame' flag on the last frame
                rom.SetAnimationTable_FrameLast(frameIndex, frameCount == 1);

                frameCount--;
                frameIndex++;
                chrBank += 4;
            }
        }
Пример #3
0
        /// <summary>
        /// Writes frame data to the chr animation table for the specified animations. The CHR usage table is not updated by this method.
        /// </summary>
        /// <param name="rom"></param>
        /// <param name="animationData"></param>
        /// <param name="frameIndex"></param>
        internal static void SerializeChrAnimation(MetroidRom rom, ChrAnimationLevelData animationData, ref int frameIndex)
        {
            for (int iAnimation = 0; iAnimation < animationData.Animations.Count; iAnimation++)
            {
                var animation = animationData.Animations[iAnimation];
                animation.SerializedFrameIndex = frameIndex;
                for (int iFrame = 0; iFrame < animation.Frames.Count; iFrame++)
                {
                    var frame = animation.Frames[iFrame];

                    rom.SetAnimationTable_Bank0(frameIndex, frame.Bank0);
                    rom.SetAnimationTable_Bank1(frameIndex, frame.Bank1);
                    rom.SetAnimationTable_Bank2(frameIndex, frame.Bank2);
                    rom.SetAnimationTable_Bank3(frameIndex, frame.Bank3);
                    rom.SetAnimationTable_FrameTime(frameIndex, frame.FrameTime);
                    rom.SetAnimationTable_FrameLast(frameIndex, iFrame == animation.Frames.Count - 1);

                    frameIndex++;
                }
            }
        }