Пример #1
0
        //Loads the script from GameData
        public TableScript GetScript()
        {
            if (CF == null)
            {
                return(null);
            }

            IList <CFItem> Lst = CF.GetAllNamedEntries("GameData");

            foreach (CFItem Itm in Lst)
            {
                BIFFFile    F    = GetBIFF(Itm);
                string      Code = Encoding.ASCII.GetString(F.GetChunk("CODE"));
                TableScript TS   = new TableScript();
                TS.Script = Code;
                return(TS);
            }

            return(null);
        }
Пример #2
0
        public GameItem(int TableID, VisualPinballTable Tbl)
        {
            ID    = TableID;
            Table = Tbl;

            //Load Name...
            BIFFFile Fl = Table.GetBIFFFile("GameItem" + ID.ToString());

            if (Fl == null)
            {
                Name = "[UNKNOWN]";
                return;
            }

            //First, there's a LONG identifying the TYPE of game object...
            int Typ = BitConverter.ToInt32(Fl.Buffer, 0);

            TypeID = Typ;
            switch (Typ)
            {
            case 1:
                Type = TypeName.Flipper;
                break;

            case 9:
                Type = TypeName.Decal;
                break;

            case 0:
                Type = TypeName.Wall;
                break;

            case 10:
                Type = TypeName.Gate;
                break;

            case 7:
                Type = TypeName.Light;
                break;

            case 5:
                Type = TypeName.Bumper;
                break;

            case 8:
                Type = TypeName.Kicker;
                break;

            case 4:
                Type = TypeName.Text;
                break;

            case 3:
                Type = TypeName.Plunger;
                break;

            case 2:
                Type = TypeName.Timer;
                break;

            case 12:
                Type = TypeName.Ramp;
                break;
            }

            byte[] tmp = new byte[Fl.Buffer.Length - 4];
            Buffer.BlockCopy(Fl.Buffer, 4, tmp, 0, tmp.Length);
            Fl.Buffer = tmp;

            byte[] Contents = Fl.GetChunk("NAME");
            Name = Encoding.Unicode.GetString(Contents, 4, Contents.Length - 4);
            Fl   = null;
        }