Example #1
0
 public FurnitureItem(Furniture furniture)
 {
     this.furniture = furniture;
 }
Example #2
0
        public override void render(Screen screen)
        {
            int xt = 0;
            int yt = 14;

            int flip1 = (walkDist >> 3) & 1;
            int flip2 = (walkDist >> 3) & 1;

            if (dir == 1)
            {
                xt += 2;
            }
            if (dir > 1)
            {
                flip1 = 0;
                flip2 = ((walkDist >> 4) & 1);
                if (dir == 2)
                {
                    flip1 = 1;
                }
                xt += 4 + ((walkDist >> 3) & 1) * 2;
            }

            int xo = x - 8;
            int yo = y - 11;

            if (isSwimming())
            {
                yo += 4;
                int waterColor = ColorHelper.get(-1, -1, 115, 335);
                if (tickTime / 8 % 2 == 0)
                {
                    waterColor = ColorHelper.get(-1, 335, 5, 115);
                }
                screen.render(xo + 0, yo + 3, 5 + 13 * 32, waterColor, 0);
                screen.render(xo + 8, yo + 3, 5 + 13 * 32, waterColor, 1);
            }

            if (attackTime > 0 && attackDir == 1)
            {
                screen.render(xo + 0, yo - 4, 6 + 13 * 32, ColorHelper.get(-1, 555, 555, 555), 0);
                screen.render(xo + 8, yo - 4, 6 + 13 * 32, ColorHelper.get(-1, 555, 555, 555), 1);
                if (attackItem != null)
                {
                    attackItem.renderIcon(screen, xo + 4, yo - 4);
                }
            }
            int col = ColorHelper.get(-1, 100, 220, 532);

            if (hurtTime > 0)
            {
                col = ColorHelper.get(-1, 555, 555, 555);
            }

            if (activeItem is FurnitureItem)
            {
                yt += 2;
            }
            screen.render(xo + 8 * flip1, yo + 0, xt + yt * 32, col, flip1);
            screen.render(xo + 8 - 8 * flip1, yo + 0, xt + 1 + yt * 32, col, flip1);
            if (!isSwimming())
            {
                screen.render(xo + 8 * flip2, yo + 8, xt + (yt + 1) * 32, col, flip2);
                screen.render(xo + 8 - 8 * flip2, yo + 8, xt + 1 + (yt + 1) * 32, col, flip2);
            }

            if (attackTime > 0 && attackDir == 2)
            {
                screen.render(xo - 4, yo, 7 + 13 * 32, ColorHelper.get(-1, 555, 555, 555), 1);
                screen.render(xo - 4, yo + 8, 7 + 13 * 32, ColorHelper.get(-1, 555, 555, 555), 3);
                if (attackItem != null)
                {
                    attackItem.renderIcon(screen, xo - 4, yo + 4, Screen.BIT_MIRROR_X);
                }
            }
            if (attackTime > 0 && attackDir == 3)
            {
                screen.render(xo + 8 + 4, yo, 7 + 13 * 32, ColorHelper.get(-1, 555, 555, 555), 0);
                screen.render(xo + 8 + 4, yo + 8, 7 + 13 * 32, ColorHelper.get(-1, 555, 555, 555), 2);
                if (attackItem != null)
                {
                    attackItem.renderIcon(screen, xo + 8 + 4, yo + 4);
                }
            }
            if (attackTime > 0 && attackDir == 0)
            {
                screen.render(xo + 0, yo + 8 + 4, 6 + 13 * 32, ColorHelper.get(-1, 555, 555, 555), 2);
                screen.render(xo + 8, yo + 8 + 4, 6 + 13 * 32, ColorHelper.get(-1, 555, 555, 555), 3);
                if (attackItem != null)
                {
                    attackItem.renderIcon(screen, xo + 4, yo + 8 + 4, Screen.BIT_MIRROR_X | Screen.BIT_MIRROR_Y);
                }
            }

            if (activeItem is FurnitureItem)
            {
                Furniture furniture = ((FurnitureItem)activeItem).furniture;
                furniture.x = x;
                furniture.y = yo;
                furniture.render(screen);
            }
        }