Esempio n. 1
0
        public void EnableMechanicalPlunger()
        {
            if (GIC == null)
            {
                GIC = VP.GetGameItems();
            }

            bool any = false;

            foreach (KeyValuePair <string, GameItem> KV in GIC.GameItems)
            {
                if (KV.Value.Type == GameItem.TypeName.Plunger)
                {
                    any = true;
                    Console.WriteLine("GameItem #" + KV.Value.ID + " is a Plunger!");
                    BIFFFile B   = KV.Value.GetFile();
                    byte[]   buf = B.GetChunk("MECH");
                    if (buf == null)
                    {
                        Log.Add("WARNING: Unable to enable mechanical plunger - please upgrade this table to VP9+");
                    }
                    else
                    {
                        B.SetChunk("MECH", BitConverter.GetBytes((int)1));
                        KV.Value.Save(B);
                        m_ChangesMade = true;
                        Log.Add("Mechanical Plunger Enabled");
                    }
                }
            }

            if (any == false)
            {
                Log.Add("This table does not include a plunger.");
            }
        }
Esempio n. 2
0
        public bool ConvertTable(VisualPinballTable VP)
        {
            //Get existing table inclination...

            BIFFFile F = VP.GetGameDataFile();

            if (F == null)
            {
                return(false);
            }

            byte[] buf = F.GetChunk("INCL");
            if (buf != null)
            {
                float f = BitConverter.ToSingle(buf, 0);
                Log.Add("Table Incline: " + f);
                if (Math.Abs(f) < 0.1)
                {
                    Log.Add("Table is ALREADY Full-Screen!");
                    return(false);
                }
            }

            buf = BitConverter.GetBytes((float)270);
            F.SetChunk("ROTA", buf);

            buf = BitConverter.GetBytes((float)11);
            F.SetChunk("INCL", buf);

            buf = BitConverter.GetBytes((float)50);
            F.SetChunk("FOVX", buf);

            buf = BitConverter.GetBytes((float)70);
            F.SetChunk("LAYB", buf);

            buf = BitConverter.GetBytes((float)1.3);
            F.SetChunk("SCLX", buf);

            buf = BitConverter.GetBytes((float)1.9);
            F.SetChunk("SCLY", buf);

            buf = BitConverter.GetBytes((float)-450);
            F.SetChunk("OFFX", buf);

            buf = BitConverter.GetBytes((float)230);
            F.SetChunk("OFFY", buf);

            Log.Add("Set Rotation, Incline and FOV");

            float Width  = BitConverter.ToSingle(F.GetChunk("RGHT"), 0);
            float Height = BitConverter.ToSingle(F.GetChunk("BOTM"), 0);

            Log.Add("Table Width / Height = " + Width + " x " + Height);

            VP.WriteFile(F.Buffer, "GameData");

            //OK - find me a GO.

            GameItemCollection GIC = VP.GetGameItems();
            BIFFFile           B   = GIC.GameItems["ScoreText"].GetFile();

            byte[] bxa = B.GetChunk("VER1");
            float  V1A = BitConverter.ToSingle(bxa, 0);
            float  V2A = BitConverter.ToSingle(bxa, 4);

            byte[] bxb = B.GetChunk("VER2");
            float  V1B = BitConverter.ToSingle(bxb, 0);
            float  V2B = BitConverter.ToSingle(bxb, 4);

            B.SetChunk("VER2", bxa);

            Log.Add("Feature Not Complete");

            return(true);
        }