Example #1
0
        public void DisplayScript(CommandList list)
        {

            StringBuilder sb = new StringBuilder();
            foreach (Command cmd in list)
                sb.Append(cmd + "\n");

            if (list.Empty)
                sb.Append("//    Empty list    //");

            ITSCodeBox box = (ITSCodeBox)tabControl1.SelectedTab.Controls[0];
            box.Text = sb.ToString();
            box.CommandList = list;
        }
        public CommandListGroup(Fighter fighter, uint CRC)
        {

            ContextMenuStrip = _menu;
            base.Fighter = fighter;
            base.CRC = CRC;
            Text = $"[{CRC:X8}]";

            for (int i = 0; i < 4; i++)
            {
                if (fighter[(ACMDType)i].EventLists.ContainsKey(CRC))
                    lists.Add(fighter[(ACMDType)i].EventLists[CRC]);
                else
                {
                    CommandList cml = new CommandList(CRC, fighter[(ACMDType)i]);
                    cml.Initialize();
                    lists.Add(cml);
                }
            }
        }
Example #3
0
        public CommandListGroup(Fighter fighter, uint CRC)
        {
            _fighter = fighter;
            _crc = CRC;
            Text = $"[{CRC:X8}]";

            for (int i = 0; i < 4; i++)
            {
                if (fighter[i].EventLists.ContainsKey(CRC))
                    lists.Add(fighter[i].EventLists[CRC]);
                else
                {
                    CommandList cml = new CommandList(CRC, fighter[i]);
                    cml.Initialize();
                    lists.Add(cml);
                }
            }
        }
Example #4
0
 public CommandListNode(CommandList list) { _list = list; _crc = list.AnimationCRC; }
Example #5
0
 public CommandListNode(string name, CommandList list) { Text = name; _list = list; _crc = list.AnimationCRC; }
Example #6
0
        private CommandList ParseEventList(uint CRC, int Offset)
        {
            CommandList _list = new CommandList(CRC, this);

            Command c;
            UnknownCommand unkC = null;

            VoidPtr addr = (_workingSource.Address + Offset);

            // Loop through Event List.
            while (Util.GetWordUnsafe(addr, Endian) != Runtime._endingCommand.Identifier)
            {
                // Try to get command definition
                uint ident = (uint)Util.GetWordUnsafe(addr, Endian);
                CommandInfo info = Runtime.commandDictionary.FirstOrDefault(e => e.Identifier == ident);

                // If a command definition exists, use that info to deserialize.
                if (info != null)
                {
                    // If previous commands were unknown, add them here.
                    if (unkC != null)
                    {
                        _list.Add(unkC);
                        unkC = null;
                    }

                    // Get command parameters and add the command to the event list.
                    c = new Command(info);
                    for (int i = 0; i < info.ParamSpecifiers.Count; i++)
                    {
                        switch (info.ParamSpecifiers[i])
                        {
                            case 0:
                                c.parameters.Add(Util.GetWordUnsafe(0x04 + (addr + (i * 4)), Endian));
                                break;
                            case 1:
                                c.parameters.Add(Util.GetFloatUnsafe(0x04 + (addr + (i * 4)), Endian));
                                break;
                            case 2:
                                c.parameters.Add((decimal)Util.GetWordUnsafe(0x04 + (addr + (i * 4)), Endian));
                                break;
                            default:
                                goto case 0;
                        }
                    }

                    _list.Add(c);
                    addr += c.CalcSize();
                }

                // If there is no command definition, this is unknown data.
                // Add the current word to the unk command and continue adding
                // until we hit a known command
                else
                {
                    if (unkC == null)
                        unkC = new UnknownCommand();
                    unkC.data.Add(Util.GetWordUnsafe(addr, Endian));
                    addr += 0x04;
                }
            }

            if (unkC != null)
                _list.Add(unkC);


            // If we hit a script_end command, add it to the the Event List and terminate looping.
            if (Util.GetWordUnsafe(addr, Endian) == Runtime._endingCommand.Identifier)
            {
                CommandInfo info = Runtime.commandDictionary.FirstOrDefault(e => e.Identifier == Runtime._endingCommand.Identifier);

                c = new Command(info);
                _list.Add(c);
            }

            _list.Initialize();
            return _list;
        }
Example #7
0
 public ITSCodeBox(CommandList list)
 {
     Init();
     DisplayScript(list);
 }
Example #8
0
        public void DisplayScript(CommandList list)
        {
            curIndent = 0;
            StringBuilder sb = new StringBuilder();
            foreach (Command cmd in list)
            {

                if (cmd._commandInfo?.IndentLevel < 0)
                    curIndent--;

                var str = cmd + "\n";
                for (int i = 0; i < curIndent; i++)
                    str = str.Insert(0, "\t");
                sb.Append(str);
                if (cmd._commandInfo?.IndentLevel > 0)
                    curIndent++;
            }

            if (list.Empty)
                sb.Append("//    Empty list    //");
            Text = sb.ToString();
            CommandList = list;
            BeginUpdate();
            ProcessAllLines();
            EndUpdate();
        }