public GameItemCollection(VisualPinballTable BPF) { int Unnamed = 1; int Ttl = Int32.Parse(BPF.Properties["Total Objects"]); for (int x = 1; x < Ttl; x++) { GameItem GI = new GameItem(x, BPF); if (GI.Name == "") { GI.Name = "Unnamed" + Unnamed; Unnamed++; } GameItems.Add(GI.Name, GI); } }
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; }