コード例 #1
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));
                    }
                }
            }
        }
コード例 #2
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;
                }
            }
        }