OurSonic.SonicManager.drawLowChunks C# (CSharp) Method

drawLowChunks() private method

private drawLowChunks ( CanvasRenderingContext2D canvas, Point localPoint, Point offs, int fyP, int fxP ) : void
canvas System.Html.Media.Graphics.CanvasRenderingContext2D
localPoint Point
offs Point
fyP int
fxP int
return void
        private void drawLowChunks(CanvasRenderingContext2D canvas, Point localPoint, Point[] offs, int fyP, int fxP)
        {
            foreach (Point off in offs)
            {
                int _xP = fxP + off.X;
                int _yP = fyP + off.Y;
                int _xPreal = fxP + off.X;
                int _yPreal = fyP + off.Y;
                //if (_xP < 0 || _xP >= SonicLevel.LevelWidth) continue;
                _xP = Help.Mod(_xP, SonicLevel.LevelWidth);
                _yP = Help.Mod(_yP, SonicLevel.LevelHeight);
                TileChunk chunk = SonicLevel.GetChunkAt(_xP, _yP);
                if (chunk == null) continue;
                localPoint.X = (_xPreal * 128) - WindowLocation.X;
                localPoint.Y = (_yPreal * 128) - WindowLocation.Y;

                if (!chunk.IsEmpty() && !chunk.OnlyForeground())
                    chunk.Draw(canvas, localPoint, ChunkLayer.Low);
            }
        }