Skip to content

Commit

Permalink
Merge changes made for Weegeepie
Browse files Browse the repository at this point in the history
  • Loading branch information
GlitchyPSIX committed Dec 23, 2020
2 parents a531c68 + 1d4967b commit 6ffd3c6
Show file tree
Hide file tree
Showing 6 changed files with 512 additions and 105 deletions.
7 changes: 4 additions & 3 deletions M64MM.Utils/Appearance/Looks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,7 @@ public static void FromColorCode(string code)
break;
}
}

}

public static void ChangeShadow(int amount, ShadowParts part)
Expand Down Expand Up @@ -358,7 +359,7 @@ public static ModelHeaderType AnalyzeHeader()
}
continue;
}
if (ModelHeader[i + 3] == 0 && ModelHeader[i + 7] == 0)
if ((ModelHeader[i + 3] == 0 || ModelHeader[i + 3] == 255) && (ModelHeader[i + 7] == 0 || ModelHeader[i + 7] == 255))
{
length++;
}
Expand All @@ -371,11 +372,11 @@ public static ModelHeaderType AnalyzeHeader()
{
return ModelHeaderType.EMPTY;
}
if (length < 18)
if (length < 13)
{
return ModelHeaderType.MOD;
}
else if (length >= 18 && length < 60)
else if (length >= 13 && length < 60)
{
return ModelHeaderType.CLASSIC;
}
Expand Down
45 changes: 44 additions & 1 deletion M64MM2/AppearanceForm.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

46 changes: 35 additions & 11 deletions M64MM2/AppearanceForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,15 @@ public partial class AppearanceForm : Form
ColorMap glovesMap = new ColorMap();
ColorMap pantsMap = new ColorMap();
ColorMap shoesMap = new ColorMap();

List<ColorCodeGS> currentSelection = new List<ColorCodeGS>();
public AppearanceForm()
{
InitializeComponent();

rand = new Random();

cbRandMode.SelectedIndex = 0;

hatMap.OldColor = Color.FromArgb(255, 0, 0);
hatMap.NewColor = BlendColors(hatColorMain.BackColor, hatColorShade.BackColor);

Expand All @@ -47,18 +49,19 @@ public AppearanceForm()
shoesMap.OldColor = Color.FromArgb(114, 28, 14);
shoesMap.NewColor = BlendColors(shoesColorMain.BackColor, shoesColorShade.BackColor);

foreach(RoutableColorPart rtc in defaultRoutableParts)
foreach (RoutableColorPart rtc in defaultRoutableParts)
{
cbRoutingSource.Items.Add(rtc.Name);
if (rtc.Address86.Length > 0 && rtc.Address88.Length > 0)
{
cbRoutingTarget.Items.Add(rtc.Name);
cbRoutingTarget.Items.Add(rtc.Name);
}
}

foreach(ColorCodeGS cc in colorCodeGamesharks)
foreach (ColorCodeGS cc in colorCodeGamesharks)
{
lbCCs.Items.Add(cc);
clbRandSel.Items.Add(cc);
}

cbRoutingSource.SelectedIndex = 0;
Expand Down Expand Up @@ -353,23 +356,37 @@ void LoadFromGame(object sender, EventArgs e)
void marioSprite_DoubleClick(object sender, EventArgs e)
{
if (!randomizerTimer.Enabled)
{
randomizerTimer.Start();
currentSelection.Clear();
currentSelection.AddRange(clbRandSel.CheckedItems.Cast<ColorCodeGS>());
}
else
randomizerTimer.Stop();
}

private void randomizerTimer_Tick(object sender, EventArgs e)
{
foreach (Control control in this.grpColor.Controls)
int mode = cbRandMode.SelectedIndex;
switch (mode)
{
if (control is Button && String.IsNullOrEmpty(control.Text))
{
control.BackColor = Color.FromArgb(rand.Next(255), rand.Next(255), rand.Next(255));
}
case 0:
foreach (Control control in grpColor.Controls)
{
if (control is Button && String.IsNullOrEmpty(control.Text))
{
control.BackColor = Color.FromArgb(rand.Next(255), rand.Next(255), rand.Next(255));
}
}
ApplyAllColors();
marioSprite.Refresh();
break;
case 1:
FromColorCode(currentSelection[rand.Next(currentSelection.Count)].Gameshark);
LoadFromGame(null, null);
break;
}

marioSprite.Refresh();
ApplyAllColors();
}

void UpdateTrackbar(object sender, EventArgs e)
Expand Down Expand Up @@ -415,9 +432,11 @@ private void btnRefresh_Click(object sender, EventArgs e)
{
LoadColorCodeRepo();
lbCCs.Items.Clear();
clbRandSel.Items.Clear();
foreach (ColorCodeGS cc in colorCodeGamesharks)
{
lbCCs.Items.Add(cc);
clbRandSel.Items.Add(cc);
}
}

Expand All @@ -430,5 +449,10 @@ private void lbCCs_DoubleClick(object sender, EventArgs e)
marioSprite.Refresh();
}
}

private void cbRandMode_SelectedIndexChanged(object sender, EventArgs e)
{

}
}
}
Loading

0 comments on commit 6ffd3c6

Please sign in to comment.