コード例 #1
0
ファイル: SpriteEditor.cs プロジェクト: poudink/NSMB-Editor
        public SpriteEditor(LevelEditorControl EdControl)
        {
            InitializeComponent();
            this.EdControl = EdControl;

            SSTable = ROM.GetInlineFile(ROM.Data.File_Modifiers);

            for (int i = 0; i < SpriteData.spriteNames.Count; i++)
            {
                int    ActorID = (int)ROM.GetClassIDFromTable(i);
                string sprite  = SpriteData.spriteNames[ActorID];
                spritelist[i] = i + ": " + sprite;
            }
            if (SpriteData.spriteNames.Count == 0)
            {
                string spriteText = LanguageManager.Get("SpriteEditor", "sprite");
                for (int s = 0; s < ROM.SpriteCount; s++)
                {
                    spritelist[s] = String.Format(spriteText, s);
                }
            }

            for (int l = 0; l < ROM.SpriteCount; l++)
            {
                curSprites.Add(l);
            }
            categoryList.Items.Add(LanguageManager.Get("SpriteEditor", "All"));
            categoryList.Items.Add(LanguageManager.Get("SpriteEditor", "InLevel"));
            categoryList.Items.Add(LanguageManager.Get("SpriteEditor", "InSpriteSets"));
            foreach (string cat in SpriteData.categories)
            {
                categoryList.Items.Add(cat);
            }
            categoryList.SelectedIndex = 0;

            UpdateDataEditor();
            UpdateInfo();

            LanguageManager.ApplyToContainer(this, "SpriteEditor");
            spriteTypeUpDown.Maximum = ROM.SpriteCount - 1;
        }
コード例 #2
0
ファイル: NSMBLevel.cs プロジェクト: poudink/NSMB-Editor
        public void CalculateSpriteModifiers()
        {
            ValidSprites = new bool[ROM.SpriteCount];
            byte[] ModifierTable = ROM.GetInlineFile(ROM.Data.File_Modifiers);

            for (int idx = 0; idx < ROM.SpriteCount; idx++)
            {
                int ModifierOffset = ModifierTable[idx << 1];
                int ModifierValue  = ModifierTable[(idx << 1) + 1];
                if (ModifierValue == 0)
                {
                    ValidSprites[idx] = true;
                }
                else
                {
                    // works around levels like 1-4 area 2 which have a blank modifier block
                    if (Blocks[13].Length > 0 && Blocks[13][ModifierOffset] == ModifierValue)
                    {
                        ValidSprites[idx] = true;
                    }
                }
            }
        }
コード例 #3
0
        private void loadTileBehaviors()
        {
            byte[] x = null;

            if (TilesetNumber == 0)
            {
                x = ROM.GetInlineFile(ROM.Data.File_Jyotyu_CHK);
            }
            else if (TilesetNumber == 1 || TilesetNumber == 2)
            {
                x = TileBehaviorFile.getContents();
            }

            ByteArrayInputStream inp = new ByteArrayInputStream(x);

            int len = inp.available / 4;

            TileBehaviors = new uint[len];

            for (int i = 0; i < len; i++)
            {
                TileBehaviors[i] = inp.readUInt();
            }
        }