Added Skin Presets to ANIM Editor

This commit is contained in:
MattNL
2022-08-16 05:32:00 -04:00
parent 5dd8aed3c9
commit f037a362c7
2 changed files with 748 additions and 642 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -15,9 +15,24 @@ namespace PckStudio.Forms.Utilities.Skins
public partial class ANIMEditor : MetroFramework.Forms.MetroForm
{
public bool saved = false;
string originalANIM = "";
public string outANIM => animValue.Text;
SkinANIM anim = new SkinANIM();
string[] animPresets =
{
"0", // Steve (64x32)
"40000", // Steve (64x64)
"80000", // Alex (64x64)
"2", // Zombie Skins
"60", // Cetacean Skins
"44", // Ski Skins
"6", // Ghost Skins
"20", // Medusa (Greek Myth.)
"4", // Librarian (Halo)
"5", // Grim Reaper (Halloween)
};
void processCheckBoxes(bool set_all = false, bool value = false)
{
bobbingCheckBox.Checked = set_all ? value : anim.GetANIMFlag(eANIM_EFFECTS.HEAD_BOBBING_DISABLED);
@@ -69,6 +84,7 @@ namespace PckStudio.Forms.Utilities.Skins
DialogResult = DialogResult.Abort;
Close();
}
originalANIM = ANIM;
anim = new SkinANIM(ANIM);
bobbingCheckBox.CheckedChanged += (sender, EventArgs) => { flagChanged(sender, EventArgs, eANIM_EFFECTS.HEAD_BOBBING_DISABLED); };
@@ -124,6 +140,7 @@ namespace PckStudio.Forms.Utilities.Skins
private void closeButton_Click(object sender, EventArgs e)
{
DialogResult = DialogResult.OK;
saved = true;
Close();
}
@@ -228,5 +245,64 @@ namespace PckStudio.Forms.Utilities.Skins
skin.Save(saveFileDialog.FileName);
}
private void resetButton_Click(object sender, EventArgs e)
{
anim = new SkinANIM(originalANIM);
processCheckBoxes();
anim = new SkinANIM(originalANIM); // Runs a second time to ensure the armor flags are set properly
processCheckBoxes();
}
static ValueTuple<string, string>[] templates =
{
new ValueTuple<string, string>("Steve (64x32)", "0"),
new ValueTuple<string, string>("Steve (64x64)", "40000"),
new ValueTuple<string, string>("Alex (64x64)", "80000"),
new ValueTuple<string, string>("Zombie Skins", "2"),
new ValueTuple<string, string>("Cetacean Skins", "60"),
new ValueTuple<string, string>("Ski Skins", "44"),
new ValueTuple<string, string>("Ghost Skins", "6"),
new ValueTuple<string, string>("Medusa (Greek Myth.)", "20"),
new ValueTuple<string, string>("Librarian (Halo)", "4"),
new ValueTuple<string, string>("Grim Reaper (Halloween)", "5"),
};
private void templateButton_Click(object sender, EventArgs e)
{
// Recycling the AddCategory popup to handle the ANIM templates (:
// diag.Category will be the ANIM codes
var diag = new Forms.Additional_Popups.Audio.addCategory(templates.Select(template => template.Item1).ToArray());
diag.label2.Text = "Presets";
diag.button1.Text = "Load";
if (diag.ShowDialog() != DialogResult.OK) return;
var templateANIM = new SkinANIM("0x" + templates.ToList().Find(template => template.Item1 == diag.Category).Item2);
DialogResult prompt = MessageBox.Show(this, "Would you like to add this preset's effects to your current ANIM? Otherwise all of your effects will be cleared. Either choice can be undone by pressing \"Restore ANIM\".", "", MessageBoxButtons.YesNo);
if (prompt == DialogResult.No) anim = templateANIM;
else
{
foreach (eANIM_EFFECTS flag in (eANIM_EFFECTS[])Enum.GetValues(typeof(eANIM_EFFECTS)))
{
if (templateANIM.GetANIMFlag(flag)) anim.SetANIMFlag(flag, true);
}
if (diag.Category == templates[0].Item1)
{
anim.SetANIMFlag(eANIM_EFFECTS.RESOLUTION_64x64, false);
anim.SetANIMFlag(eANIM_EFFECTS.SLIM_MODEL, false);
}
else if (diag.Category == templates[1].Item1)
{
anim.SetANIMFlag(eANIM_EFFECTS.RESOLUTION_64x64, true);
anim.SetANIMFlag(eANIM_EFFECTS.SLIM_MODEL, false);
}
else if (diag.Category == templates[2].Item1)
{
anim.SetANIMFlag(eANIM_EFFECTS.SLIM_MODEL, true);
}
}
processCheckBoxes();
}
}
}