Exemple #1
0
        protected void ChangeObjectBank(ObjectBankData oldObd, ObjectBankData newObd)
        {
            // Remove old commands
            if (oldObd is object)
            {
                foreach (ObjectBankDataCommand obdCmd in oldObd.Commands)
                {
                    foreach (var cmd in Levelscript.Where(n => General.CompareTwoByteArrays(n.ToArray(), obdCmd.Command)).ToArray())
                    {
                        cmd.Close();
                        Levelscript.Remove(cmd);
                    }
                }
            }

            // Add new commands
            if (newObd is object)
            {
                foreach (ObjectBankDataCommand obdCmd in newObd.Commands)
                {
                    int startIndex = Levelscript.IndexOfFirst(LevelscriptCommandTypes.x1D);
                    if (!(obdCmd.CommandType == 0x1A || obdCmd.CommandType == 0x17))
                    {
                        startIndex += 1;
                    }

                    var cmd = new LevelscriptCommand(obdCmd.Command);
                    Levelscript.Insert(startIndex, cmd);
                    startIndex += 1;
                }
            }
        }
Exemple #2
0
        protected ObjectBankData FindObjectBankData(byte bankID)
        {
            var list  = General.ObjectBankData[bankID];
            var Found = new List <bool>();

            foreach (ObjectBankData obd in list)
            {
                foreach (ObjectBankDataCommand obdCmd in obd.Commands)
                {
                    Found.Add(Levelscript.Where(n => General.CompareTwoByteArrays(n.ToArray(), obdCmd.Command)).Any());
                }
                if (!Found.Contains(false))
                {
                    return(obd);
                }

                Found.Clear();
            }

            return(null);
        }