    public void Draw()
    {
        Paint pa = new Paint();
        RMR.c.save();
        {
            int mapW = this.width * 32;
            int mapH = this.height * 32;
            Player p = this.p0;
            double mapRotation = Math.toDegrees(Math.asin(Math.abs(p.posY - p.prevPosY) / Math.sqrt(Math.pow(p.posX - p.prevPosX, 2) + Math.pow(p.posY - p.prevPosY, 2))));
            if ((p.posX - p.prevPosX) >= 0)
            {
                if ((p.posY - p.prevPosY) >= 0)
                {
                    mapRotation = 180 - mapRotation;
                }
                else
                {
                    mapRotation = 180 + mapRotation;
                }
            }
            else
            {
                if ((p.posY - p.prevPosY) < 0)
                {
                    mapRotation = 360 - mapRotation;
                }
            }
            RMR.c.scale(((float) RMR.sw.getWidth() / (float) mapH), ((float) RMR.sw.getWidth() / (float) mapH));
            Rect src = new Rect();
            Rect dst = new Rect();
            float α = 0.9f;
            RMR.c.save();
            {
                RMR.c.translate(RMR.mapSideLength * 32 / 2, RMR.mapSideLength * 32 / 2);
                double delta = prevFilteredCompass + Math.toDegrees(RMR.compass.orientationData[0]);
                Log.d("compass", delta + " " + prevFilteredCompass + " " + (Math.abs(delta) > 180));
                delta = (delta > 180) ? (delta - 360) : ((delta < -180) ? (delta + 360) : delta);
                prevFilteredCompass = (float) (α * delta - Math.toDegrees(RMR.compass.orientationData[0]));
                if (this.corner1fixed && this.corner2fixed)
                {
                    RMR.c.rotate((!Double.isNaN(mapRotation) ? (float) mapRotation : 0) + prevFilteredCompass, 0, 0);
                }
                RMR.c.translate(-this.p0.posY, -this.p0.posX);
                pa.setColor(Color.DKGRAY);
                RMR.c.save();
                {
                    RMR.c.drawLine(0, 0, 32 * this.width, 0, pa);
                    RMR.c.drawLine(0, 0, 0, 32 * this.height, pa);
                    RMR.c.drawLine(32 * this.width, 32 * this.height, 32 * this.width, 0, pa);
                    RMR.c.drawLine(32 * this.width, 32 * this.height, 0, 32 * this.height, pa);
                }
                RMR.c.restore();
                pa = new Paint();
                RMR.c.save();
                {
                    if((System.currentTimeMillis() / 30) % 2 == 0) RMGR.tile_0_iterator++;
                    if(RMGR.tile_0_iterator == RMGR.TILE_0.length) RMGR.tile_0_iterator = 0;
                    if((System.currentTimeMillis() / 30) % 2 == 0) RMGR.tile_1_iterator++;
                    if(RMGR.tile_1_iterator == RMGR.TILE_1.length) RMGR.tile_1_iterator = 0;
                    for (int i = 0; i < this.height; i++)
                    {
                        for (int j = 0; j < this.width; j++)
                        {
                            switch (this.tiles[j][i])
                            {
                                default:
                                    continue;
                                case 1:
                                    RMR.c.save();
                                    {
                                        int it =  RMGR.tile_0_iterator + i + j;
                                        it %= RMGR.TILE_0.length;
                                        RMR.c.translate(i * 32, j * 32);
                                        src.set(0, 0, RMGR.TILE_0[it].getWidth(), RMGR.TILE_0[it].getHeight());
                                        dst.set(0, 0, 32, 32);
                                        pa.setColor(Color.WHITE);
                                        RMR.c.drawBitmap(RMGR.TILE_0[it], src, dst, pa);
                                    }
                                    RMR.c.restore();
                                    break;
                                case 2:
                                    RMR.c.save();
                                    {
                                        int it =  RMGR.tile_1_iterator + i + j;
                                        it %= RMGR.TILE_1.length;
                                        RMR.c.translate(i * 32, j * 32);
                                        src.set(0, 0, RMGR.TILE_1[it].getWidth(), RMGR.TILE_1[it].getHeight());
                                        dst.set(0, 0, 32, 32);
                                        pa.setColor(Color.WHITE);
                                        RMR.c.drawBitmap(RMGR.TILE_1[it], src, dst, pa);
                                    }
                                    RMR.c.restore();
                                    break;
                            }
                        }
                    }
                }
                RMR.c.restore();
                RMR.c.save();
                {
                    if((System.currentTimeMillis() / 30) % 2 == 0) RMGR.pickup_0_iterator++;
                    if(RMGR.pickup_0_iterator == RMGR.PICKUP_0.length) RMGR.pickup_0_iterator = 0;
                    if((System.currentTimeMillis() / 30) % 2 == 0) RMGR.pickup_1_iterator++;
                    if(RMGR.pickup_1_iterator == RMGR.PICKUP_1.length) RMGR.pickup_1_iterator = 0;
                    for (int i = 0; i < this.pickups.size(); i++)
                    {
                        RMR.c.save();
                        {
                            RMR.c.translate(this.pickups.get(i)[1] * 32, this.pickups.get(i)[0] * 32);
                            pa.setAlpha((int) Math.floor(100 / ((float)this.pickups.get(i)[3] / ((float)this.pickups.get(i)[2] != 0 ? (float)this.pickups.get(i)[2] : 1))));
                            switch (this.pickups.get(i)[4])
                            {
                                default:
                                case 1:
                                    int it = (RMGR.pickup_0_iterator + this.pickups.get(i)[0] + this.pickups.get(i)[1]);
                                    it %= RMGR.PICKUP_0.length;
                                    src.set(0, 0, RMGR.PICKUP_0[it].getWidth(), RMGR.PICKUP_0[it].getHeight());
                                    dst.set(4, 4, 28, 28);
                                    RMR.c.drawBitmap(RMGR.PICKUP_0[it], src, dst, pa);
                                    break;
                                case 2:
                                    int it1 = (RMGR.pickup_1_iterator + this.pickups.get(i)[0] + this.pickups.get(i)[1]);
                                    it1 %= RMGR.PICKUP_1.length;
                                    src.set(0, 0, RMGR.PICKUP_1[it1].getWidth(), RMGR.PICKUP_1[it1].getHeight());
                                    dst.set(4, 4, 28, 28);
                                    RMR.c.drawBitmap(RMGR.PICKUP_1[it1], src, dst, pa);
                                    break;
                            }
                        }
                        RMR.c.restore();
                    }
                }
                RMR.c.restore();
                pa = new Paint();
                if (this.state == MapState.Suspended)
                {
                    RMR.c.save();
                    {
                        pa.setColor(Color.BLACK);
                        pa.setAlpha(80);
                        RMR.c.drawRect(0, 0, RMR.mapSideLength * 32, this.suspendTile.x * 32, pa);
                        RMR.c.drawRect((this.suspendTile.y + 1) * 32, this.suspendTile.x * 32, RMR.mapSideLength * 32, (this.suspendTile.x + 1) * 32, pa);
                        RMR.c.drawRect(0, this.suspendTile.x * 32, this.suspendTile.y * 32, (this.suspendTile.x + 1) * 32, pa);
                        RMR.c.drawRect(0, (this.suspendTile.x + 1) * 32, RMR.mapSideLength * 32, RMR.mapSideLength * 32, pa);
                        pa.setColor(Color.YELLOW);
                        pa.setAlpha((int) Math.floor((Math.sin(System.currentTimeMillis() / 100) + 2) * 30));
                        RMR.c.drawRect(this.suspendTile.y * 32, this.suspendTile.x * 32, (this.suspendTile.y + 1) * 32, (this.suspendTile.x + 1) * 32, pa);
                    }
                    RMR.c.restore();
                }
                RMR.c.save();
                {
                    pa.setColor(Color.WHITE);
                    RMR.c.translate(p1.posY, p1.posX);
                    src.set(0, 0, RMGR.CHAR_0.getWidth(), RMGR.CHAR_0.getHeight());
                    dst.set(-12, -12, 12, 12);
                    RMR.c.drawBitmap(RMGR.CHAR_0, src, dst, pa);
                }
                RMR.c.restore();
            }
            RMR.c.restore();
            RMR.c.save();
            {
                pa.setColor(Color.WHITE);
                RMR.c.translate(RMR.mapSideLength * 32 / 2, RMR.mapSideLength * 32 / 2);
                src.set(0, 0, RMGR.CHAR_0.getWidth(), RMGR.CHAR_0.getHeight());
                dst.set(-12, -12, 12, 12);
                RMR.c.drawBitmap(RMGR.CHAR_0, src, dst, pa);
            }
            RMR.c.restore();
        }
        RMR.c.restore();
    }

    public void Draw()
    {
        Paint pa = new Paint();
        RMR.c.save();
        {
            int mapW = this.width * 32;
            int mapH = this.height * 32;
            Player p = this.p0;
            double mapRotation = Math.toDegrees(Math.asin(Math.abs(p.posY - p.prevPosY) / Math.sqrt(Math.pow(p.posX - p.prevPosX, 2) + Math.pow(p.posY - p.prevPosY, 2))));
            if ((p.posX - p.prevPosX) >= 0)
            {
                if ((p.posY - p.prevPosY) >= 0)
                {
                    mapRotation = 180 - mapRotation;
                }
                else
                {
                    mapRotation = 180 + mapRotation;
                }
            }
            else
            {
                if ((p.posY - p.prevPosY) < 0)
                {
                    mapRotation = 360 - mapRotation;
                }
            }
            RMR.c.scale(((float) RMR.sw.getWidth() / (float) mapH), ((float) RMR.sw.getWidth() / (float) mapH));
            Rect src = new Rect();
            Rect dst = new Rect();
            float α = 0.9f;
            RMR.c.save();
            {
                RMR.c.translate(RMR.mapSideLength * 32 / 2, RMR.mapSideLength * 32 / 2);
                double delta = prevFilteredCompass + Math.toDegrees(RMR.compass.orientationData[0]);
                Log.d("compass", delta + " " + prevFilteredCompass + " " + (Math.abs(delta) > 180));
                delta = (delta > 180) ? (delta - 360) : ((delta < -180) ? (delta + 360) : delta);
                prevFilteredCompass = (float) (α * delta - Math.toDegrees(RMR.compass.orientationData[0]));
                if (this.corner1fixed && this.corner2fixed)
                {
                    RMR.c.rotate(prevFilteredCompass, 0, 0);
                }
                RMR.c.translate(-this.p0.posY, -this.p0.posX);
                pa.setColor(Color.DKGRAY);
                RMR.c.save();
                {
                    RMR.c.drawLine(0, 0, 32 * this.width, 0, pa);
                    RMR.c.drawLine(0, 0, 0, 32 * this.height, pa);
                    RMR.c.drawLine(32 * this.width, 32 * this.height, 32 * this.width, 0, pa);
                    RMR.c.drawLine(32 * this.width, 32 * this.height, 0, 32 * this.height, pa);
                }
                RMR.c.restore();
                pa = new Paint();
                RMR.c.save();
                {
                    if((System.currentTimeMillis() / 30) % 2 == 0) RMGR.tile_0_iterator++;
                    if(RMGR.tile_0_iterator == RMGR.TILE_0.length) RMGR.tile_0_iterator = 0;
                    if((System.currentTimeMillis() / 30) % 2 == 0) RMGR.tile_1_iterator++;
                    if(RMGR.tile_1_iterator == RMGR.TILE_1.length) RMGR.tile_1_iterator = 0;
                    for (int i = 0; i < this.height; i++)
                    {
                        for (int j = 0; j < this.width; j++)
                        {
                            switch (this.tiles[j][i])
                            {
                                default:
                                    continue;
                                case 1:
                                    RMR.c.save();
                                    {
                                        int it =  RMGR.tile_0_iterator + i + j;
                                        it %= RMGR.TILE_0.length;
                                        RMR.c.translate(i * 32, j * 32);
                                        src.set(0, 0, RMGR.TILE_0[it].getWidth(), RMGR.TILE_0[it].getHeight());
                                        dst.set(0, 0, 32, 32);
                                        pa.setColor(Color.WHITE);
                                        RMR.c.drawBitmap(RMGR.TILE_0[it], src, dst, pa);
                                    }
                                    RMR.c.restore();
                                    break;
                                case 2:
                                    RMR.c.save();
                                    {
                                        int it =  RMGR.tile_1_iterator + i + j;
                                        it %= RMGR.TILE_1.length;
                                        RMR.c.translate(i * 32, j * 32);
                                        src.set(0, 0, RMGR.TILE_1[it].getWidth(), RMGR.TILE_1[it].getHeight());
                                        dst.set(0, 0, 32, 32);
                                        pa.setColor(Color.WHITE);
                                        RMR.c.drawBitmap(RMGR.TILE_1[it], src, dst, pa);
                                    }
                                    RMR.c.restore();
                                    break;
                            }
                        }
                    }
                }
                RMR.c.restore();
                RMR.c.save();
                {
                    if((System.currentTimeMillis() / 30) % 2 == 0) RMGR.pickup_0_iterator++;
                    if(RMGR.pickup_0_iterator == RMGR.PICKUP_0.length) RMGR.pickup_0_iterator = 0;
                    if((System.currentTimeMillis() / 30) % 2 == 0) RMGR.pickup_1_iterator++;
                    if(RMGR.pickup_1_iterator == RMGR.PICKUP_1.length) RMGR.pickup_1_iterator = 0;
                    for (int i = 0; i < this.pickups.size(); i++)
                    {
                        RMR.c.save();
                        {
                            RMR.c.translate(this.pickups.get(i)[1] * 32, this.pickups.get(i)[0] * 32);
                            pa.setAlpha((int) Math.floor(100 / ((float)this.pickups.get(i)[3] / ((float)this.pickups.get(i)[2] != 0 ? (float)this.pickups.get(i)[2] : 1))));
                            switch (this.pickups.get(i)[4])
                            {
                                default:
                                case 1:
                                    int it = (RMGR.pickup_0_iterator + this.pickups.get(i)[0] + this.pickups.get(i)[1]);
                                    it %= RMGR.PICKUP_0.length;
                                    src.set(0, 0, RMGR.PICKUP_0[it].getWidth(), RMGR.PICKUP_0[it].getHeight());
                                    dst.set(4, 4, 28, 28);
                                    RMR.c.drawBitmap(RMGR.PICKUP_0[it], src, dst, pa);
                                    break;
                                case 2:
                                    int it1 = (RMGR.pickup_1_iterator + this.pickups.get(i)[0] + this.pickups.get(i)[1]);
                                    it1 %= RMGR.PICKUP_1.length;
                                    src.set(0, 0, RMGR.PICKUP_1[it1].getWidth(), RMGR.PICKUP_1[it1].getHeight());
                                    dst.set(4, 4, 28, 28);
                                    RMR.c.drawBitmap(RMGR.PICKUP_1[it1], src, dst, pa);
                                    break;
                            }
                        }
                        RMR.c.restore();
                    }
                }
                RMR.c.restore();
                pa = new Paint();
                if (this.state == MapState.Suspended)
                {
                    RMR.c.save();
                    {
                        pa.setColor(Color.BLACK);
                        pa.setAlpha(80);
                        RMR.c.drawRect(0, 0, RMR.mapSideLength * 32, this.suspendTile.x * 32, pa);
                        RMR.c.drawRect((this.suspendTile.y + 1) * 32, this.suspendTile.x * 32, RMR.mapSideLength * 32, (this.suspendTile.x + 1) * 32, pa);
                        RMR.c.drawRect(0, this.suspendTile.x * 32, this.suspendTile.y * 32, (this.suspendTile.x + 1) * 32, pa);
                        RMR.c.drawRect(0, (this.suspendTile.x + 1) * 32, RMR.mapSideLength * 32, RMR.mapSideLength * 32, pa);
                        pa.setColor(Color.YELLOW);
                        pa.setAlpha((int) Math.floor((Math.sin(System.currentTimeMillis() / 100) + 2) * 30));
                        RMR.c.drawRect(this.suspendTile.y * 32, this.suspendTile.x * 32, (this.suspendTile.y + 1) * 32, (this.suspendTile.x + 1) * 32, pa);
                    }
                    RMR.c.restore();
                }
                RMR.c.save();
                {
                    pa.setColor(Color.WHITE);
                    RMR.c.translate(p1.posY, p1.posX);
                    src.set(0, 0, RMGR.CHAR_0.getWidth(), RMGR.CHAR_0.getHeight());
                    dst.set(-12, -12, 12, 12);
                    RMR.c.drawBitmap(RMGR.CHAR_0, src, dst, pa);
                }
                RMR.c.restore();
            }
            RMR.c.restore();
            RMR.c.save();
            {
                pa.setColor(Color.WHITE);
                RMR.c.translate(RMR.mapSideLength * 32 / 2, RMR.mapSideLength * 32 / 2);
                src.set(0, 0, RMGR.CHAR_0.getWidth(), RMGR.CHAR_0.getHeight());
                dst.set(-12, -12, 12, 12);
                RMR.c.drawBitmap(RMGR.CHAR_0, src, dst, pa);
            }
            RMR.c.restore();
        }
        RMR.c.restore();
    }
