Exemplo n.º 1
0
        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);
            }

            Color color = colorOrig;

            if (Settings.FoxEnabled)
            {
                Color colorFox;
                if (index % 2 == 0)
                {
                    colorFox = Settings.FoxColorLight;
                    color    = new Color(
                        (color.R / 255f) * 0.1f + (colorFox.R / 255f) * 0.9f,
                        (color.G / 255f) * 0.05f + (colorFox.G / 255f) * 0.95f,
                        (color.B / 255f) * 0.2f + (colorFox.B / 255f) * 0.8f,
                        color.A
                        );
                }
                else
                {
                    colorFox = Settings.FoxColorDark;
                    color    = new Color(
                        (color.R / 255f) * 0.1f + (colorFox.R / 255f) * 0.7f,
                        (color.G / 255f) * 0.1f + (colorFox.G / 255f) * 0.7f,
                        (color.B / 255f) * 0.1f + (colorFox.B / 255f) * 0.7f,
                        color.A
                        );
                }
            }

            if (Settings.RainbowEnabled)
            {
                float wave = self.GetWave() * 60f;
                wave *= Settings.RainbowSpeedFactor;
                Color colorRainbow = ColorFromHSV((index / (float)self.GetSprite().HairCount) * 180f + wave, 0.6f, 1.0f);
                color = new Color(
                    (color.R / 255f) * 0.3f + (colorRainbow.R / 255f) * 0.7f,
                    (color.G / 255f) * 0.3f + (colorRainbow.G / 255f) * 0.7f,
                    (color.B / 255f) * 0.3f + (colorRainbow.B / 255f) * 0.7f,
                    color.A
                    );
            }

            color.A = colorOrig.A;
            return(color);
        }
Exemplo n.º 2
0
        public static MTexture GetHairTexture(On.Celeste.PlayerHair.orig_GetHairTexture orig, PlayerHair self, int index)
        {
            if (!(self.Entity is Player) || !Settings.Enabled)
            {
                return(orig(self, index));
            }
            Player player = self.Entity as Player;

            if (player.Dashes >= MAX_DASH_COUNT || player.Dashes < 0)
            {
                return(orig(self, index));
            }

            if (index == 0)  //bangs
            {
                if (Settings.hairBangs[player.Dashes] == null || Settings.hairBangs[player.Dashes].Count == 0)
                {
                    return(orig(self, index));
                }
                return(Settings.hairBangs[player.Dashes][self.GetSprite().HairFrame % Settings.hairBangs[player.Dashes].Count]);
            }
            if (Settings.hairTextures[player.Dashes] == null || Settings.hairTextures[player.Dashes].Count == 0)
            {
                return(orig(self, index));
            }
            return(Settings.hairTextures[player.Dashes][index % Settings.hairTextures[player.Dashes].Count]);
        }
Exemplo n.º 3
0
        private static void RenderHairPlayerOutline(PlayerHair self)
        {
            PlayerSprite sprite = self.GetSprite();

            if (!self.DrawPlayerSpriteOutline)
            {
                return;
            }

            Vector2 origin = sprite.Position;
            Color   color  = sprite.Color;

            sprite.Color = self.Border * self.Alpha;

            sprite.Position = origin + new Vector2(0f, -1f);
            sprite.Render();
            sprite.Position = origin + new Vector2(0f, 1f);
            sprite.Render();
            sprite.Position = origin + new Vector2(-1f, 0f);
            sprite.Render();
            sprite.Position = origin + new Vector2(1f, 0f);
            sprite.Render();

            sprite.Color    = color;
            sprite.Position = origin;
        }
Exemplo n.º 4
0
        public void RenderHair(On.Celeste.PlayerHair.orig_Render orig, PlayerHair self)
        {
            Player player = self.Entity as Player;

            if (player == null || self.GetSprite().Mode == PlayerSpriteMode.Badeline || Character == null)
            {
                orig(self);
                return;
            }
            if (Character.HasHair)
            {
                if (self.Sprite.HasHair)
                {
                    Vector2 origin = new Vector2(5f, 5f);
                    Color   color  = self.Border * self.Alpha;

                    Vector2 offset = new Vector2(Character.HairOffset.X * (self.GetHairScale(0).X > 0 ? 1 : -1), Character.HairOffset.Y);

                    if (self.DrawPlayerSpriteOutline)
                    {
                        Color   color2   = self.Sprite.Color;
                        Vector2 position = self.Sprite.Position;
                        self.Sprite.Color = color;

                        self.Sprite.Position = position + new Vector2(0f, -1f) + offset;
                        self.Sprite.Render();
                        self.Sprite.Position = position + new Vector2(0f, 1f) + offset;
                        self.Sprite.Render();
                        self.Sprite.Position = position + new Vector2(-1f, 0f) + offset;
                        self.Sprite.Render();
                        self.Sprite.Position = position + new Vector2(1f, 0f) + offset;
                        self.Sprite.Render();
                        self.Sprite.Color    = color2;
                        self.Sprite.Position = position;
                    }
                    self.Nodes[0] = self.Nodes[0].Floor();
                    if (color.A > 0)
                    {
                        for (int i = 0; i < self.Sprite.HairCount; i++)
                        {
                            MTexture hairTexture = self.GetHairTexture(i);
                            Vector2  hairScale   = self.GetHairScale(i);
                            hairTexture.Draw(self.Nodes[i] + new Vector2(-1f, 0f) + offset, origin, color, hairScale);
                            hairTexture.Draw(self.Nodes[i] + new Vector2(1f, 0f) + offset, origin, color, hairScale);
                            hairTexture.Draw(self.Nodes[i] + new Vector2(0f, -1f) + offset, origin, color, hairScale);
                            hairTexture.Draw(self.Nodes[i] + new Vector2(0f, 1f) + offset, origin, color, hairScale);
                        }
                    }
                    for (int num = self.Sprite.HairCount - 1; num >= 0; num--)
                    {
                        self.GetHairTexture(num).Draw(self.Nodes[num] + offset, origin, self.GetHairColor(num), self.GetHairScale(num));
                    }
                    if (Character.SpriteName.Contains("baldemonika"))
                    {
                        GFX.Game["characters/player/baldemonikaribbon"].Draw(self.Nodes[0] + offset - new Vector2(self.GetHairScale(0).X > 0 ? 1 : -1, 2), origin, Color.White, self.GetHairScale(0));
                    }
                }
            }
        }
Exemplo n.º 5
0
        public static MTexture GetHairTexture(On.Celeste.PlayerHair.orig_GetHairTexture orig, PlayerHair self, int index)
        {
            if (!(self.Entity is Player) || self.GetSprite().Mode == PlayerSpriteMode.Badeline)
            {
                return(orig(self, index));
            }

            if (Settings.FoxEnabled)
            {
                if (index == 0)
                {
                    return(FoxBangs[self.GetSprite().HairFrame]);
                }
                return(FoxHair[index % FoxHair.Count]);
            }

            return(orig(self, index));
        }
Exemplo n.º 6
0
        public static void RenderHair(On.Celeste.PlayerHair.orig_Render orig, PlayerHair self)
        {
            if (Settings.BaldelineEnabled)
            {
                return;
            }
            Player player = self.Entity as Player;

            if (player == null || self.GetSprite().Mode == PlayerSpriteMode.Badeline)
            {
                orig(self);
                return;
            }

            if (Settings.SkateboardEnabled)
            {
                for (int i = 0; i < self.Nodes.Count; i++)
                {
                    self.Nodes[i] = self.Nodes[i] + SkateboardPlayerOffset;
                }
            }
            if (Settings.DuckToDabEnabled && player.Ducking)
            {
                for (int i = 0; i < self.Nodes.Count; i++)
                {
                    self.Nodes[i] = self.Nodes[i] + DabPlayerOffset;
                }
            }

            if (Settings.WoomyEnabled)
            {
                PlayerSprite sprite = self.GetSprite();
                if (!sprite.HasHair)
                {
                    return;
                }

                const float woomyOffs      = 3f;
                Vector2     woomyScaleMul  = new Vector2(0.7f, 0.7f);
                Vector2     woomyScaleOffs = new Vector2(-0.2f, -0.2f);

                Vector2 origin      = new Vector2(5f, 5f);
                Color   colorBorder = self.Border * self.Alpha;

                RenderHairPlayerOutline(self);

                Vector2  pos;
                MTexture tex;
                Color    color;
                Vector2  scale;

                self.Nodes[0] = self.Nodes[0].Floor();

                if (colorBorder.A > 0)
                {
                    tex   = self.GetHairTexture(0);
                    scale = self.GetHairScale(0);
                    pos   = self.Nodes[0];
                    tex.Draw(pos + new Vector2(-1f, 0f), origin, colorBorder, scale);
                    tex.Draw(pos + new Vector2(1f, 0f), origin, colorBorder, scale);
                    tex.Draw(pos + new Vector2(0f, -1f), origin, colorBorder, scale);
                    tex.Draw(pos + new Vector2(0f, 1f), origin, colorBorder, scale);

                    tex   = self.GetHairTexture(2);
                    scale = self.GetHairScale(sprite.HairCount - 2) * woomyScaleMul + woomyScaleOffs;
                    pos   = self.Nodes[0];
                    tex.Draw(pos + new Vector2(-1f - woomyOffs, 0f), origin, colorBorder, scale);
                    tex.Draw(pos + new Vector2(1f - woomyOffs, 0f), origin, colorBorder, scale);
                    tex.Draw(pos + new Vector2(0f - woomyOffs, -1f), origin, colorBorder, scale);
                    tex.Draw(pos + new Vector2(0f - woomyOffs, 1f), origin, colorBorder, scale);
                    tex.Draw(pos + new Vector2(-1f + woomyOffs, 0f), origin, colorBorder, scale);
                    tex.Draw(pos + new Vector2(1f + woomyOffs, 0f), origin, colorBorder, scale);
                    tex.Draw(pos + new Vector2(0f + woomyOffs, -1f), origin, colorBorder, scale);
                    tex.Draw(pos + new Vector2(0f + woomyOffs, 1f), origin, colorBorder, scale);

                    for (int i = 1; i < sprite.HairCount; i++)
                    {
                        tex   = self.GetHairTexture(i);
                        scale = self.GetHairScale(sprite.HairCount - i - 1) * woomyScaleMul + woomyScaleOffs;
                        pos   = self.Nodes[i];
                        tex.Draw(pos + new Vector2(-1f - woomyOffs, 0f), origin, colorBorder, scale);
                        tex.Draw(pos + new Vector2(1f - woomyOffs, 0f), origin, colorBorder, scale);
                        tex.Draw(pos + new Vector2(0f - woomyOffs, -1f), origin, colorBorder, scale);
                        tex.Draw(pos + new Vector2(0f - woomyOffs, 1f), origin, colorBorder, scale);
                        tex.Draw(pos + new Vector2(-1f + woomyOffs, 0f), origin, colorBorder, scale);
                        tex.Draw(pos + new Vector2(1f + woomyOffs, 0f), origin, colorBorder, scale);
                        tex.Draw(pos + new Vector2(0f + woomyOffs, -1f), origin, colorBorder, scale);
                        tex.Draw(pos + new Vector2(0f + woomyOffs, 1f), origin, colorBorder, scale);
                    }
                }

                tex   = self.GetHairTexture(0);
                color = self.GetHairColor(0);
                scale = self.GetHairScale(0);
                tex.Draw(self.Nodes[0], origin, color, scale);

                tex   = self.GetHairTexture(2);
                color = self.GetHairColor(0);
                scale = self.GetHairScale(sprite.HairCount - 2) * woomyScaleMul + woomyScaleOffs;
                tex.Draw(self.Nodes[0] + new Vector2(-woomyOffs, 0f), origin, color, scale);
                tex.Draw(self.Nodes[0] + new Vector2(woomyOffs, 0f), origin, color, scale);

                for (int i = sprite.HairCount - 1; i >= 1; i--)
                {
                    tex   = self.GetHairTexture(i);
                    color = self.GetHairColor(i);
                    scale = self.GetHairScale(sprite.HairCount - i - 1) * woomyScaleMul + woomyScaleOffs;
                    tex.Draw(self.Nodes[i] + new Vector2(-woomyOffs, 0f), origin, color, scale);
                    tex.Draw(self.Nodes[i] + new Vector2(woomyOffs, 0f), origin, color, scale);
                }

                goto End;
            }

            orig(self);

End:
            if (Settings.SkateboardEnabled)
            {
                for (int i = 0; i < self.Nodes.Count; i++)
                {
                    self.Nodes[i] = self.Nodes[i] - SkateboardPlayerOffset;
                }
            }
            if (Settings.DuckToDabEnabled && player.Ducking)
            {
                for (int i = 0; i < self.Nodes.Count; i++)
                {
                    self.Nodes[i] = self.Nodes[i] - DabPlayerOffset;
                }
            }
        }