Ejemplo n.º 1
0
        // TODO: Water reflections
        public unsafe void Draw(uint *bmpAddress, int bmpWidth, int bmpHeight, int blockX, int blockY, int startBlockPixelX, int startBlockPixelY)
        {
            int baseX = (blockX * Overworld.Block_NumPixelsX) + ProgressX + startBlockPixelX;
            int baseY = (blockY * Overworld.Block_NumPixelsY) + ProgressY + startBlockPixelY;
            // Calc img coords
            ImageSheet s = _sheet;
            int        w = s.ImageWidth;
            int        h = s.ImageHeight;
            int        x = baseX - ((w - Overworld.Block_NumPixelsX) / 2); // Center align
            int        y = baseY - (h - Overworld.Block_NumPixelsY);       // Bottom align
            // Calc shadow coords
            Image shadow = s.ShadowImage;
            int   sw     = shadow.Width;
            int   sh     = shadow.Height;
            int   sx     = baseX + s.ShadowXOffset;                              // Left align
            int   sy     = baseY + Overworld.Block_NumPixelsY + s.ShadowYOffset; // Bottom align (starts in block under)

            // Draw shadow image
            if (RenderUtils.IsInsideBitmap(bmpWidth, bmpHeight, sx, sy, sw, sh))
            {
                shadow.DrawOn(bmpAddress, bmpWidth, bmpHeight, sx, sy);
            }
            // Draw obj image
            if (RenderUtils.IsInsideBitmap(bmpWidth, bmpHeight, x, y, w, h))
            {
                float t          = MovementTimer;
                bool  showMoving = t != 1 && t >= 0.6f;
                int   imgNum     = GetImage(showMoving);
                s.Images[imgNum].DrawOn(bmpAddress, bmpWidth, bmpHeight, x, y);
            }
        }
Ejemplo n.º 2
0
 protected VisualObj(ushort id, string imageId, Position pos)
     : base(id, pos)
 {
     _sheet = ImageSheet.LoadOrGet(imageId);
 }
Ejemplo n.º 3
0
 protected VisualObj(ushort id, string imageId)
     : base(id)
 {
     _sheet = ImageSheet.LoadOrGet(imageId);
 }