private void button1_Click(object sender, EventArgs e) { if (Runtime.Moveset != null && Runtime.Moveset.Game.Scripts.ContainsKey(crc)) { // need to split into lines string[] line = richTextBox1.Text.Split('\n'); ACMDScript script = new ACMDScript(crc); int index = 0; try { foreach (string str in line) { if (str.Equals("")) { continue; } ACMDCompiler.CompileSingleCommand(str); // try to compile index++; } foreach (ACMDCommand s in ACMDCompiler.CompileCommands(line)) { script.Add(s); index++; } Runtime.Moveset.Game.Scripts[crc] = script; } catch (Exception) { HighlightLine(richTextBox1, index, Color.Red); } } }
private void button1_Click(object sender, EventArgs e) { if (Owner.MovesetManager != null && cb_section.SelectedIndex >= 0) { // need to split into lines string[] line = richTextBox1.Text.Split('\n'); ACMDScript script = new ACMDScript(crc); int index = 0; try { foreach (string str in line) { if (str.Equals("")) { continue; } ACMDCompiler.CompileSingleCommand(str); // try to compile index++; } foreach (ACMDCommand s in ACMDCompiler.CompileCommands(line)) { script.Add(s); index++; } SortedList <uint, SALT.Moveset.IScript> scriptList = null; if (cb_section.Text.Equals("GAME")) { scriptList = Owner.MovesetManager.Game.Scripts; } else if (cb_section.Text.Equals("SOUND")) { scriptList = Owner.MovesetManager.Sound.Scripts; } else if (cb_section.Text.Equals("EXPRESSION")) { scriptList = Owner.MovesetManager.Expression.Scripts; } else if (cb_section.Text.Equals("EFFECT")) { scriptList = Owner.MovesetManager.Effect.Scripts; } //Update script if it already exists if (scriptList.ContainsKey(crc)) { scriptList[crc] = script; } if (cb_section.Text.Equals("GAME")) { Owner.ACMDScript = new ForgeACMDScript(script); Owner.ACMDScript.processToFrame(0); } } catch (Exception) { HighlightLine(richTextBox1, index, Color.Red); } } }
public static void compile_acmd(string mlist, string output) { ACMDFile game = new ACMDFile(), effect = new ACMDFile(), sound = new ACMDFile(), expression = new ACMDFile(); Directory.CreateDirectory(output); Console.WriteLine($">\tCompiling ACMD.. -> \"{output}\""); List <uint> hashes = new List <uint>(); foreach (var line in File.ReadAllLines(mlist)) { if (line.StartsWith("0x")) { hashes.Add(Convert.ToUInt32(line.Substring(2), 16)); } else { hashes.Add(Crc32.Compute(line.ToLower())); } } foreach (var path in Directory.EnumerateFiles(Path.Combine(Path.GetDirectoryName(mlist), "animcmd"), "*", SearchOption.AllDirectories)) { var defs = ACMDCompiler.CompileFile(path); foreach (var move in defs) { #if DEBUG Console.WriteLine($">\tCompiling {move.AnimName}.."); #endif if (move["Main"] != null) { ACMDScript script = new ACMDScript(move.CRC); script.Commands = move["Main"].Cast <ICommand>().ToList(); game.Scripts.Add(move.CRC, script); } if (move["Sound"] != null) { ACMDScript script = new ACMDScript(move.CRC); script.Commands = move["Sound"].Cast <ICommand>().ToList(); sound.Scripts.Add(move.CRC, script); } if (move["Effect"] != null) { ACMDScript script = new ACMDScript(move.CRC); script.Commands = move["Effect"].Cast <ICommand>().ToList(); effect.Scripts.Add(move.CRC, script); } if (move["Expression"] != null) { ACMDScript script = new ACMDScript(move.CRC); script.Commands = move["Expression"].Cast <ICommand>().ToList(); expression.Scripts.Add(move.CRC, script); } } } var table = new MTable(hashes, Endian); table.Export(Path.Combine(output, "motion.mtable")); game.Export(Path.Combine(output, "game.bin"), Endian); sound.Export(Path.Combine(output, "sound.bin"), Endian); effect.Export(Path.Combine(output, "effect.bin"), Endian); expression.Export(Path.Combine(output, "expression.bin"), Endian); Console.WriteLine(">\tFinished"); }