Exemplo n.º 1
0
        private void CreateNewAnimation()
        {
            if (CalculateUsedFrames() >= 255)
            {
                // Can't create new animation if there isn't enough space
                ////BeginMiscUIUpdate();
                ////cboAnimation.SelectedIndex = cboAnimation.Items.Count - 2;
                ////EndMiscUIUpdate();

                // do nothing
            }
            else
            {
                int newIndex = SelectedLevelData.Animations.Count;

                // Update data
                ChrAnimationFrame newFrame = new ChrAnimationFrame();
                newFrame.FrameTime = 0x10;
                ChrAnimationTable newAnimation = new ChrAnimationTable();
                newAnimation.Frames.Add(newFrame);
                SelectedLevelData.Animations.Add(newAnimation);

                // Update UI
                BeginMiscUIUpdate();
                cboAnimation.Items.Insert(newIndex, GetAnimationListItemName(newIndex, newAnimation));
                cboAnimation.SelectedIndex = newIndex;
                EndMiscUIUpdate();

                UpdateUI(updateMode.Animation);
            }
        }
Exemplo n.º 2
0
 private void nudFrametime_ValueChanged(object sender, EventArgs e)
 {
     if (!IsUpdatingUI)
     {
         var frameData = SelectedAnimationFrame;
         frameData.FrameTime    = 0x7F & (int)nudFrametime.Value;
         SelectedAnimationFrame = frameData;
     }
 }
Exemplo n.º 3
0
        private void ApplySelectedBgBanks()
        {
            var frameData = SelectedAnimationFrame;

            frameData.Bank0        = (byte)nudBg0.Value;
            frameData.Bank1        = (byte)nudBg1.Value;
            frameData.Bank2        = (byte)nudBg2.Value;
            frameData.Bank3        = (byte)nudBg3.Value;
            SelectedAnimationFrame = frameData;

            UpdateUI(updateMode.BackgroundGfx);
        }
Exemplo n.º 4
0
        private void RenderBgFrame(ChrAnimationFrame frame)
        {
            bgGfxLoader.BeginWrite();

            LoadGfxSlot(bgGfxLoader, 0, frame.Bank0);
            LoadGfxSlot(bgGfxLoader, 1, frame.Bank1);
            LoadGfxSlot(bgGfxLoader, 2, frame.Bank2);
            LoadGfxSlot(bgGfxLoader, 3, frame.Bank3);

            bgGfxLoader.EndWrite();

            bgGfxLoader.LoadColors((SelectedLevel ?? rom.Brinstar).BgPalette, 0);
            BgImage = bgGfxLoader.PatternImage;
        }
Exemplo n.º 5
0
        private ChrAnimationLevelData CreateDefaultAnimationsForLevel(LevelIndex level)
        {
            var defaultData  = new ChrAnimationLevelData(level);
            var defaultTable = new ChrAnimationTable();
            var defaultFrame = new ChrAnimationFrame();

            defaultTable.Frames.Add(defaultFrame);
            defaultData.Animations.Add(defaultTable);
            //if (level == LevelIndex.None) {
            //    TitleChrAnimationTable = defaultData;
            //} else {
            //    Levels[level].ChrAnimation = defaultData;
            //}
            return(defaultData);
        }
Exemplo n.º 6
0
        private void cboAnimation_SelectedIndexChanged(object sender, EventArgs e)
        {
            selectedAnimationIndex = cboAnimation.SelectedIndex;

            if (!IsUpdatingUI && cboAnimation.SelectedIndex >= 0)
            {
                if (cboAnimation.SelectedItem == NewAnimationComboboxItem)
                {
                    if (CalculateUsedFrames() >= 255)
                    {
                        // Can't create new animation if there isn't enough space
                        BeginMiscUIUpdate();
                        cboAnimation.SelectedIndex = cboAnimation.Items.Count - 2;
                        EndMiscUIUpdate();
                    }
                    else
                    {
                        int newIndex = SelectedLevelData.Animations.Count;

                        // Update data
                        ChrAnimationFrame newFrame = new ChrAnimationFrame();
                        newFrame.FrameTime = 0x10;
                        ChrAnimationTable newAnimation = new ChrAnimationTable();
                        newAnimation.Frames.Add(newFrame);
                        SelectedLevelData.Animations.Add(newAnimation);

                        // Update UI
                        BeginMiscUIUpdate();
                        cboAnimation.Items.Insert(newIndex, GetAnimationListItemName(newIndex, newAnimation));
                        cboAnimation.SelectedIndex = newIndex;
                        EndMiscUIUpdate();

                        UpdateUI(updateMode.Animation);
                    }
                }
                UpdateUI(updateMode.Animation);
            }
        }