public void draw(GOut og) {
        if (!Config.render_enable) {
            Coord requl = mc.add(-500, -500).div(tileSize).div(cmaps);
            Coord reqbr = mc.add(500, 500).div(tileSize).div(cmaps);
            Coord cgc = new Coord(0, 0);
            for (cgc.y = requl.y; cgc.y <= reqbr.y; cgc.y++) {
                for (cgc.x = requl.x; cgc.x <= reqbr.x; cgc.x++) {
                    if (map.grids.get(cgc) == null)
                        map.request(new Coord(cgc));
                }
            }
            map.sendreqs();
            checkplmove();
            return;
        }
        if (moveto != null) {
            wdgmsg("click", moveto, moveto, 1, 0);
            moveto = null;
        }
        hsz = MainFrame.getInnerSize();
        sz = hsz.mul(1 / getScale());
        GOut g = og.reclip(Coord.z, sz);
        g.gl.glPushMatrix();
        g.scale(getScale());
        checkmappos();
        Coord requl = mc.add(-500, -500).div(tileSize).div(cmaps);
        Coord reqbr = mc.add(500, 500).div(tileSize).div(cmaps);
        Coord cgc = new Coord(0, 0);
        for (cgc.y = requl.y; cgc.y <= reqbr.y; cgc.y++) {
            for (cgc.x = requl.x; cgc.x <= reqbr.x; cgc.x++) {
                if (map.grids.get(cgc) == null)
                    map.request(new Coord(cgc));
            }
        }
        long now = System.currentTimeMillis();
        if ((olftimer != 0) && (olftimer < now))
            unflashol();
        map.sendreqs();
        checkplmove();
        // try {
        if (((mask.amb = glob.amblight) == null) || Config.nightvision)
            mask.amb = new Color(0, 0, 0, 0);
        drawmap(g);

        // movement highlight
        try {
            if (Config.showpath) {
                Coord oc = viewoffset(sz, mc);
                Coord pc, cc;
                synchronized (glob.oc) {
                    for (Gob gob : glob.oc) {
                        if (gob == null) continue;
                        if (gob.sc == null) continue;
                        if (!(gob.isPlayer() || gob.resname().contains("boat"))) continue;
                        Moving move_attr = gob.getattr(Moving.class);
                        if (move_attr == null) continue;
                        if (move_attr instanceof LinMove) {
                            LinMove lin_move = (LinMove) move_attr;
                            pc = m2s(lin_move.t).add(oc);
                            if (gob.id == playergob)
                                g.chcolor(Color.GREEN);
                            else
                                g.chcolor(Color.ORANGE);
                            g.line(gob.sc, pc, 2);
                            if (gob.id == playergob) {
                                for (Coord c : glob.oc.movequeue) {
                                    cc = m2s(c).add(oc);
                                    g.line(pc, cc, 2);
                                    pc = cc;
                                }
                            }
                        }
                    }
                }
                g.chcolor();
            }
        } catch (Exception ignored) {

        }
        // ###############
        // PF
        if (path != null && path.size() > 1) {
            Coord oc = viewoffset(sz, mc);
            g.chcolor(Color.green);
            for (int i = 0; i < path.size() - 1; i++) {
                g.line(m2s(path.get(i)).add(oc), m2s(path.get(i + 1)).add(oc), 2);
            }
            g.chcolor();
        }
        drawarrows(g);
        g.chcolor(Color.WHITE);

        // } catch(Loading l) {
        // String text = "Loading...";
        // g.chcolor(Color.BLACK);
        // g.frect(Coord.z, sz);
        // g.chcolor(Color.WHITE);
        // g.atext(text, sz, 0.5, 0.5);
        // }
        long poldt = now - polchtm;
        if ((polownert != null) && (poldt < 6000)) {
            int a;
            if (poldt < 1000)
                a = (int) ((255 * poldt) / 1000);
            else if (poldt < 4000)
                a = 255;
            else
                a = (int) ((255 * (2000 - (poldt - 4000))) / 2000);
            g.chcolor(255, 255, 255, a);
            g.aimage(polownert.tex(), sz.div(2), 0.5, 0.5);
            g.chcolor();
        }
        g.gl.glPopMatrix();
        //Kerri. debug
        if (Config.showDebug) {
            int ay = 120;
            int margin = 15;
            g.atext("FPS: " + MainFrame.havenPanel.fps, new Coord(10, ay), 0, 1);
            ay = ay + margin;
            if (objectUnderMouse != null) {
                g.atext("Object id under mouse: " + objectUnderMouse.id + " Coords: "
                        + objectUnderMouse.position(), new Coord(10, ay), 0, 1);
                ay = ay + margin;
                g.atext("Resource name: " + objectUnderMouse.resname() +
                        " BLOB: " + objectUnderMouse.GetBlob(0), new Coord(10, ay), 0, 1);
                ay = ay + margin;
            } else {
                g.atext("Object id under mouse: NULL", new Coord(10, ay), 0, 1);
                ay = ay + margin;
            }
            if (mousepos != null) {
                g.atext("Mouse map pos: " + mousepos.toString() + " Tile: " + getTileFix(mousepos.div(tileSize)) + "TilifNS: " + tilefy_ns(mousepos).toString(), new Coord(10, ay), 0, 1);
                ay = ay + margin;
                g.atext("Tile coord: " + mouseAtTile.toString(), new Coord(10, ay), 0, 1);
                ay = ay + margin;
            }
            g.atext("Current cursor: " + UI.instance.root.cursor.name.replace("gfx/hud/curs/", ""),
                    new Coord(10, ay), 0, 1);
            ay = ay + margin;
            g.atext("Player id: " + playergob, new Coord(10, ay), 0, 1);
        }//debug
        if (Config.dbtext)
            g.atext(mc.toString(), new Coord(10, 560), 0, 1);
        super.draw(og);
    }