Ejemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="bankIndex"></param>
        /// <param name="nrOfPatches"></param>
        private void ReadAllCombis(int bankIndex, int nrOfPatches)
        {
            if ((ContentType == PcgMemory.ContentType.All) ||
                (ContentType == PcgMemory.ContentType.AllCombis))
            {
                // Read combi data.
                CombiBank bank = (CombiBank)(CurrentPcgMemory.CombiBanks[bankIndex]);
                bank.ByteOffset = Index;
                bank.PatchSize  = 124;
                bank.IsWritable = true;
                bank.IsLoaded   = true;

                for (int index = 0; index < nrOfPatches; index++)
                {
                    // Place in PcgMemory.
                    Combi combi = (Combi)bank[index];
                    combi.ByteOffset = Index;
                    combi.ByteLength = bank.PatchSize;
                    combi.IsLoaded   = true;

                    // Skip to next.
                    Index += bank.PatchSize;
                }

                // When virtual banks are used, here needs to be checked to stop reading combi banks.
            }
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="banks"></param>
        private void ReadCombiBanks(int banks)
        {
            for (int index = 0; index < banks; index++)
            {
                // Normally the bank index should be 2 bytes, however, PRELOAD1.PCG's second bank at 0x2F3B4 has
                // value 0x0500.
                int unusedMsbBankIndex = Util.GetInt(CurrentPcgMemory.Content, _index, 1);
                Debug.Assert((unusedMsbBankIndex == 0x00) || (unusedMsbBankIndex == 0x05));
                _index += 1;

                int bankIndex = Util.GetInt(CurrentPcgMemory.Content, _index, 1);
                _index += 1;

                CombiBank bank = (CombiBank)CurrentPcgMemory.CombiBanks[bankIndex];
                // combiBank.PcgId =
                bank.ByteOffset = _index;
                bank.PatchSize  = CombiSize;
                bank.IsWritable = true;
                bank.IsLoaded   = true;

                for (int patchIndex = 0; patchIndex < 128; patchIndex++)
                {
                    // Place in PcgMemory.
                    Combi combi = (Combi)bank[patchIndex];
                    combi.ByteOffset = _index;
                    combi.ByteLength = bank.PatchSize;
                    combi.IsLoaded   = true;

                    _index += bank.PatchSize;
                }
            }
        }
Ejemplo n.º 3
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="combi"></param>
 public KronosTimbres(Combi combi)
     : base(combi, TimbresPerCombiConstant, TimbresOffsetConstant)
 {
     for (int n = 0; n < TimbresPerCombi; n++)
     {
         TimbresCollection.Add(new KronosTimbre(this, n));
     }
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Returns bank index.
        /// </summary>
        /// <returns></returns>
        private void ReadCbk1Chunk()
        {
            int chunkSize = Util.GetInt(CurrentPcgMemory.Content, Index + 4, 4);

            CurrentPcgMemory.Chunks.Collection.Add(new Chunk("CBK1", Index, chunkSize));

            int startIndex = Index;

            Index += Cbk1NumberOfCombisOffset;
            int numberOfCombisInBank = Util.GetInt(CurrentPcgMemory.Content, Index, 4);

            Index += 4;
            int sizeOfACombi = Util.GetInt(CurrentPcgMemory.Content, Index, 4);

// ReSharper disable RedundantStringFormatCall
            Console.WriteLine($" Size of a combi: {sizeOfACombi}");
// ReSharper restore RedundantStringFormatCall
            Index += 4;
            int bankId    = Util.GetInt(CurrentPcgMemory.Content, Index, 4);
            int bankIndex = CombiBankId2CombiIndex(bankId);

            Index += 4;

            CombiBank combiBank = (CombiBank)CurrentPcgMemory.CombiBanks[bankIndex];

            combiBank.ByteOffset = startIndex;
            combiBank.PatchSize  = sizeOfACombi;
            combiBank.IsWritable = true;
            combiBank.IsLoaded   = true;

            for (int index = 0; index < numberOfCombisInBank; index++)
            {
                // Place in PcgMemory.
                Combi combi = (Combi)combiBank[index];
                combi.ByteOffset = Index;
                combi.ByteLength = sizeOfACombi;
                combi.IsLoaded   = true;

                combi.Timbres.ByteOffset = combi.ByteOffset + TimbresByteOffset;

                foreach (ITimbre timbre in combi.Timbres.TimbresCollection)
                {
                    timbre.ByteOffset = combi.Timbres.ByteOffset + timbre.Index * timbre.TimbresSize;
                }

                // Skip to next.
                //for (int timbre = 0; timbre < 8; timbre++)
                //    Console.WriteLine(String.Format("Combi id {0}, timbre index  {1} bank {2} program {3}, offset {4:x}",
                //        combi.Id, combi.Timbres[timbre].Index,
                //        combi.Timbres[timbre].UsedProgramBank.Id, combi.Timbres[timbre].UsedProgram.Id,
                //        combi.ByteOffset));
                Index += sizeOfACombi;
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Some single combi files do not have their combi name filled in at the start of the combi
        /// contents, but only as file name. This method copies the file name to the correct location.
        /// </summary>
        public void SynchronizeCombiName()
        {
            Combi firstCombi = (Combi)((CombiBank)CombiBanks[0])[0];

            if (firstCombi.Name == string.Empty)
            {
                string fileName = Path.GetFileNameWithoutExtension(FileName);
                if (fileName != null)
                {
                    firstCombi.Name = fileName.Substring(0, Math.Min(fileName.Length, firstCombi.MaxNameLength));
                }
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="offset"></param>
        private void ReadSingleCombi(int offset)
        {
            CombiBank bank = (CombiBank)(CurrentPcgMemory.CombiBanks[0]);

            bank.ByteOffset = 0;
            bank.PatchSize  = 124;
            bank.IsWritable = true;
            bank.IsLoaded   = true;

            Combi combi = (Combi)bank[0];

            combi.ByteOffset = offset;
            combi.ByteLength = bank.PatchSize;
            combi.IsLoaded   = true;
        }
Ejemplo n.º 7
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="combi"></param>
 /// <param name="timbresPerCombiConstant"></param>
 /// <param name="timbresOffsetConstant"></param>
 protected KronosOasysTimbres(Combi combi, int timbresPerCombiConstant, int timbresOffsetConstant)
     : base(combi, timbresPerCombiConstant, timbresOffsetConstant)
 {
 }
Ejemplo n.º 8
0
        public Gameplay(string n1, string n2, string n3, string n4)
        {
            InitializeComponent();
            Maap.Controls.Add(Zombie);
            Maap.Controls.Add(Combi);
            Maap.Controls.Add(lightFire);
            Maap.Controls.Add(hFire1);
            Maap.Controls.Add(Tool);
            Maap.Controls.Add(Food);
            Maap.Controls.Add(Won1);
            Maap.Controls.Add(Won2);
            Maap.Controls.Add(Flu);
            Maap.Controls.Add(Food2);
            Maap.Controls.Add(Food3);
            Food2.BackColor     = Color.Transparent;
            Food3.BackColor     = Color.Transparent;
            Tool.BackColor      = Color.Transparent;
            Food.BackColor      = Color.Transparent;
            Won1.BackColor      = Color.Transparent;
            Won2.BackColor      = Color.Transparent;
            Flu.BackColor       = Color.Transparent;
            lightFire.BackColor = Color.Transparent;
            hFire1.BackColor    = Color.Transparent;
            Combi.BackColor     = Color.Transparent;
            Zombie.BackColor    = Color.Transparent;
            Zombie.Hide();
            lightFire.Hide();
            hFire1.Hide();
            Won2.Hide();
            Tool.Hide();
            Won1.Hide();
            Flu.Hide();
            Food.Hide();
            Food2.Hide();
            Food3.Hide();
            Maap.SendToBack();
            Combi.SendToBack();
            lightFire.BringToFront();
            name1              = n1;
            name2              = n2;
            name3              = n3;
            name4              = n4;
            p1.Namee           = name1;
            p2.Namee           = name2;
            p3.Namee           = name3;
            p4.Namee           = name4;
            l_P1.Text         += p1.Hp;
            l_P2.Text         += p2.Hp;
            l_P3.Text         += p3.Hp;
            l_P4.Text         += p4.Hp;
            l_Food.Text       += chombi.TotalFood;
            l_CombiHp.Text    += chombi.Hp;
            label_Player1.Text = p1.Namee;
            label_Player2.Text = p2.Namee;
            label_Player3.Text = p3.Namee;
            label_Player4.Text = p4.Namee;



            tbGameplayMessage.Text += "Empieza el juego, se encuentran en Yucatan \r\n ";
        }
Ejemplo n.º 9
0
        private void button16_Click(object sender, EventArgs e)
        {
            // clear reaction table
            combTable.Rows.Clear();

            // prepare the generic reaction
            Reaction rxn = null;
            MolBase s = MolBase.ReadFile(combiRxn.Text);
            if (s as Reaction != null)
                rxn = (Reaction)s;
            else if (s as Sketch != null)
                rxn = ((Sketch)s).AsReaction();
            if (rxn == null)
            {
                MessageBox.Show("Not a valid reaction");
                return;
            }

            // create a combi oject
            Combi combi = new Combi(rxn);

            // add reagents for each R-group reactant component
            int i = 0;
            foreach (Combi.Component c in combi.Components)
            {
                ++i;
                string f = null;
                if (i == 1)
                    f = combiComp1.Text;
                else if (i == 2)
                    f = combiComp2.Text;
                else if (i == 3)
                    f = combiComp3.Text;
                else
                    break;

                using (Scilligence.MolEngine.IO.SDFile sdf = new Scilligence.MolEngine.IO.SDFile(f, Scilligence.MolEngine.IO.MDLDBBase.OpenMode.Read))
                {
                    Scilligence.MolEngine.IO.SDFile.Record r2;
                    while ((r2 = sdf.ReadNext()) != null)
                    {
                        if (r2.m as Molecule != null)
                            c.AddReagent((Molecule)r2.m);
                    }
                }
            }

            // enumerate
            int ri = 0;
            Reaction r;
            // begin to enumerate
            combi.ResetEnum();

            // enumerate one
            while ((r = combi.EnumNext()) != null)
            {
                // display the enumerated reaction
                DataGridViewRow row = new DataGridViewRow();
                row.Height = 200;
                row.Cells.Add(new DataGridViewImageCell());

                MolDrawing md = new MolDrawing(r, new System.Drawing.Rectangle(0, 0, combTable.Columns[0].Width, row.Height), 10);
                row.Cells[0].Value = md.ToImage();
                combTable.Rows.Add(row);
                row.HeaderCell.Value = (++ri).ToString();
            }
        }