Exemplo n.º 1
0
 public void SwitchObjects(PatternTable table, BlockDefinition definition, PaletteInfo palette)
 {
     BlsSelector.HaltRendering = true;
     BlsSelector.CurrentTable = table;
     BlsSelector.CurrentDefiniton = definition;
     BlsSelector.HaltRendering = false;
     BlsSelector.CurrentPalette = palette;
 }
Exemplo n.º 2
0
        public bool LoadDefinitions(string filename)
        {
            if (!File.Exists(filename))
            {
                return(false);
            }

            lookupTable.Clear();
            FileStream fs = new FileStream(filename, FileMode.OpenOrCreate, FileAccess.Read);

            byte[] data = new byte[0x6000];

            fs.Read(data, 0, (int)fs.Length);
            fs.Close();


            for (int i = 0; i < 16; i++)
            {
                BlockDefinition bd         = new BlockDefinition();
                int             bankOffset = i * 0x400;
                for (int j = 0; j < 256; j++)
                {
                    bd[j][0, 0] = data[bankOffset + j];
                    bd[j][0, 1] = data[bankOffset + 0x100 + j];
                    bd[j][1, 0] = data[bankOffset + 0x200 + j];
                    bd[j][1, 1] = data[bankOffset + 0x300 + j];
                }
                lookupTable[i] = bd;
            }

            var l = 0x4000;

            for (int i = 0; i < 16; i++)
            {
                for (int j = 0; j < 256; j++)
                {
                    lookupTable[i][j].BlockProperty = (BlockProperty)data[l++];
                }
            }


            for (int i = 0; i < 16; i++)
            {
                lookupTable[i].FireBallTransitions.Clear();
                for (int k = 0; k < 8; k++)
                {
                    lookupTable[i].FireBallTransitions.Add(data[l++]);
                }

                lookupTable[i].IceBallTransitions.Clear();
                for (int k = 0; k < 8; k++)
                {
                    lookupTable[i].IceBallTransitions.Add(data[l++]);
                }

                lookupTable[i].PSwitchTransitions.Clear();
                for (int k = 0; k < 8; k++)
                {
                    lookupTable[i].PSwitchTransitions.Add(new BlockTransition(data[l++], data[l++]));
                }

                lookupTable[i].VineTile    = data[l++];
                lookupTable[i].PSwitchTile = data[l++];
            }

            return(true);
        }
Exemplo n.º 3
0
        public void ResetTSA(int levelType)
        {
            lookupTable.Clear();
            byte[] data = Resource.default_tsa;

            BlockDefinition bd = new BlockDefinition();
            int bankOffset = levelType * 0x400;
            for (int j = 0; j < 256; j++)
            {
                bd[j][0, 0] = data[bankOffset + j];
                bd[j][0, 1] = data[bankOffset + 0x100 + j];
                bd[j][1, 0] = data[bankOffset + 0x200 + j];
                bd[j][1, 1] = data[bankOffset + 0x300 + j];
            }
            lookupTable[levelType] = bd;
        }
Exemplo n.º 4
0
        public void LoadDefault()
        {
            lookupTable.Clear();
            byte[] data = Resource.default_tsa;

            for (int i = 0; i < 16; i++)
            {
                BlockDefinition bd = new BlockDefinition();
                int bankOffset = i * 0x400;
                for (int j = 0; j < 256; j++)
                {
                    bd[j][0, 0] = data[bankOffset + j];
                    bd[j][0, 1] = data[bankOffset + 0x100 + j];
                    bd[j][1, 0] = data[bankOffset + 0x200 + j];
                    bd[j][1, 1] = data[bankOffset + 0x300 + j];
                }
                lookupTable.Add(i, bd);
            }
        }
Exemplo n.º 5
0
        public bool LoadDefinitions(string filename)
        {
            if (!File.Exists(filename)) return false;

            lookupTable.Clear();
            FileStream fs = new FileStream(filename, FileMode.OpenOrCreate, FileAccess.Read);
            byte[] data = new byte[0x6000];

            fs.Read(data, 0, (int)fs.Length);
            fs.Close();


            for (int i = 0; i < 16; i++)
            {
                BlockDefinition bd = new BlockDefinition();
                int bankOffset = i * 0x400;
                for (int j = 0; j < 256; j++)
                {
                    bd[j][0, 0] = data[bankOffset + j];
                    bd[j][0, 1] = data[bankOffset + 0x100 + j];
                    bd[j][1, 0] = data[bankOffset + 0x200 + j];
                    bd[j][1, 1] = data[bankOffset + 0x300 + j];
                }
                lookupTable[i] = bd;
            }

            var l = 0x4000;
            for (int i = 0; i < 16; i++)
            {
                for (int j = 0; j < 256; j++)
                {
                    lookupTable[i][j].BlockProperty = (BlockProperty)data[l++];
                }
            }

            
            for (int i = 0; i < 16; i++)
            {
                lookupTable[i].FireBallTransitions.Clear();
                for (int k = 0; k < 4; k++)
                {
                    lookupTable[i].FireBallTransitions.Add(new BlockTransition(data[l++], data[l++]));
                }

                lookupTable[i].IceBallTransitions.Clear();
                for (int k = 0; k < 4; k++)
                {
                    lookupTable[i].IceBallTransitions.Add(new BlockTransition(data[l++], data[l++]));
                }

                lookupTable[i].PSwitchTransitions.Clear();
                for (int k = 0; k < 8; k++)
                {
                    lookupTable[i].PSwitchTransitions.Add(new BlockTransition(data[l++], data[l++]));
                }

                lookupTable[i].VineTile = data[l++];
                lookupTable[i].PSwitchTile = data[l++];
            }

            return true;
        }