예제 #1
0
        public SpriteEditor(LevelEditorControl EdControl)
        {
            InitializeComponent();
            this.EdControl = EdControl;

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

            int i = 0;

            foreach (string sprite in SpriteData.spriteNames)
            {
                spritelist[i] = i + ": " + sprite;
                i++;
            }
            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
        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();
            }
        }