Skip to content

Commit

Permalink
leo you bonehead
Browse files Browse the repository at this point in the history
  • Loading branch information
PenguinOwl committed Jan 29, 2019
1 parent cdbf791 commit 2f45a5b
Show file tree
Hide file tree
Showing 7 changed files with 61 additions and 36 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*.dll
*.pdb
obj/
2 changes: 1 addition & 1 deletion .vs/SolidMod/xs/UserPrefs.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Properties StartupConfiguration="{B6A08C1E-96FA-4C66-81C3-F2B73DFC349D}|Default">
<MonoDevelop.Ide.ItemProperties.SolidMod PreferredExecutionTarget="MonoDevelop.Default" />
<MonoDevelop.Ide.Workbench>
<MonoDevelop.Ide.Workbench ActiveDocument="SolidModule.cs">
<Files>
<File FileName="SolidModule.cs" Line="192" Column="21" />
<File FileName="SolidSettings.cs" Line="29" Column="34" />
Expand Down
86 changes: 51 additions & 35 deletions SolidModule.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Globalization;
using System.Reflection;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Input;
using Monocle;
Expand All @@ -15,6 +16,10 @@ public class SolidModule : EverestModule

private static Color permcolor;

private static FieldInfo UsedHairColor = typeof(Player).GetField("UsedHairColor");
private static FieldInfo NormalHairColor = typeof(Player).GetField("NormalHairColor");
private static FieldInfo TwoDashesHairColor = typeof(Player).GetField("TwoDashesHairColor");

private static bool Badeline;

private static int HairCount;
Expand All @@ -38,10 +43,10 @@ public SolidModule()
public override void Load()
{
On.Celeste.Player.GetTrailColor += GetTrailColor;
On.Celeste.PlayerHair.GetHairColor += GetHairColor;
//On.Celeste.PlayerHair.GetHairColor += GetHairColor;
On.Celeste.TrailManager.Add_Entity_Color_float += AddTrail;
On.Celeste.DeathEffect.Draw += Death;
On.Celeste.Player.IntroRespawnBegin += Respawn;
On.Celeste.Player.IntroRespawnBegin += Player_Respawn;
On.Celeste.Player.Update += Player_Update;
On.Monocle.Sprite.Play += Sprite_Play;
On.Celeste.PlayerHair.Render += PlayerHair_Render;
Expand Down Expand Up @@ -120,20 +125,31 @@ private void Player_Update(On.Celeste.Player.orig_Update orig, Player self)
//Logger.Log("w", self.GetType().ToString());
if (self.GetType().Name == "Ghost")
{
Logger.Log("a", self.GetType().Name);
orig(self);
return;
}
if (((Entity)self as BadelineOldsite) != null) {
self.Sprite.HairCount = Settings.HairLength;
if (Settings.Enabled)
{
UsedHairColor.SetValue(null, Calc.HexToColor(Settings.Dash0Color));
NormalHairColor.SetValue(null, Calc.HexToColor(Settings.Dash1Color));
TwoDashesHairColor.SetValue(null, Calc.HexToColor(Settings.Dash2Color));
}
else
{
NormalHairColor.SetValue(null, Calc.HexToColor("AC3232"));
TwoDashesHairColor.SetValue(null, Calc.HexToColor("FF6DEF"));
UsedHairColor.SetValue(null, Calc.HexToColor("44B7FF"));
if (((Entity)self as BadelineOldsite) != null)
{
self.Sprite.HairCount = Settings.HairLength;
}
}
if ((Settings.Badeline) != (self.Sprite.Mode == PlayerSpriteMode.Badeline))
{
PlayerSpriteMode mode = self.Sprite.Mode;
self.Remove(self.Sprite);
if (Settings.Badeline)
{
Logger.Log("a",self.GetType().Name);
self.Sprite = new PlayerSprite(PlayerSpriteMode.Badeline);
}
else
Expand Down Expand Up @@ -218,7 +234,7 @@ private void Player_Update(On.Celeste.Player.orig_Update orig, Player self)
}


private void Respawn(On.Celeste.Player.orig_IntroRespawnBegin orig, Player self)
private void Player_Respawn(On.Celeste.Player.orig_IntroRespawnBegin orig, Player self)
{
int dashes = (self).MaxDashes;

Expand Down Expand Up @@ -256,51 +272,51 @@ public override void Initialize()
// Unload the entirety of your mod's content, remove any event listeners and undo all hooks.
public override void Unload()
{
On.Celeste.PlayerHair.GetHairColor -= GetHairColor;
//On.Celeste.PlayerHair.GetHairColor -= GetHairColor;
On.Celeste.Player.GetTrailColor -= GetTrailColor;
On.Celeste.TrailManager.Add_Entity_Color_float -= AddTrail;
On.Celeste.DeathEffect.Draw -= Death;
On.Celeste.Player.IntroRespawnBegin -= Respawn;
On.Celeste.Player.IntroRespawnBegin -= Player_Respawn;
On.Celeste.Player.Update -= Player_Update;
On.Monocle.Sprite.Play -= Sprite_Play;
On.Celeste.PlayerHair.Render -= PlayerHair_Render;
On.Celeste.PlayerHair.Update -= PlayerHair_Update;
}

public static Color GetHairColor(On.Celeste.PlayerHair.orig_GetHairColor orig, PlayerHair self, int index)
{
Color colorOrig = orig(self, index);
if (!(self.Entity is Player) || self.GetSprite().Mode == PlayerSpriteMode.Badeline)
return colorOrig;
//public static Color GetHairColor(On.Celeste.PlayerHair.orig_GetHairColor orig, PlayerHair self, int index)
//{
// Color colorOrig = orig(self, index);
// if (!(self.Entity is Player) || self.GetSprite().Mode == PlayerSpriteMode.Badeline)
// return colorOrig;

if ((self.Entity as Player).StateMachine.State == 19)
return colorOrig;
// if ((self.Entity as Player).StateMachine.State == 19)
// return colorOrig;

Color color = colorOrig;
// Color color = colorOrig;

int dashes = ((Player)self.Entity).Dashes;
// int dashes = ((Player)self.Entity).Dashes;

if (dashes == 0)
color = ColorFromHex(Settings.Dash0Color);
// if (dashes == 0)
// color = ColorFromHex(Settings.Dash0Color);

if (dashes == 1)
color = ColorFromHex(Settings.Dash1Color);
// if (dashes == 1)
// color = ColorFromHex(Settings.Dash1Color);

if (dashes == 2)
color = ColorFromHex(Settings.Dash2Color);
// if (dashes == 2)
// color = ColorFromHex(Settings.Dash2Color);

permcolor = color;
// permcolor = color;

color.A = colorOrig.A;
if (Settings.Enabled)
{
return color;
}
else
{
return colorOrig;
}
}
// color.A = colorOrig.A;
// if (Settings.Enabled)
// {
// return color;
// }
// else
// {
// return colorOrig;
// }
//}

public static void AddTrail(On.Celeste.TrailManager.orig_Add_Entity_Color_float orig, Entity self, Color color, float duration)
{
Expand Down
6 changes: 6 additions & 0 deletions everest.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
- Name: SolidMod
Version: 2.0.0
DLL: SolidMod.dll
Dependencies:
- Name: Everest
Version: 1.0.0
Binary file modified obj/Debug/SolidMod.csprojAssemblyReference.cache
Binary file not shown.
Binary file modified obj/Debug/SolidMod.dll
Binary file not shown.
Binary file modified obj/Debug/SolidMod.pdb
Binary file not shown.

0 comments on commit 2f45a5b

Please sign in to comment.