this.tileheight, this);*/ g.drawImage(this.tile_images[tile_set][tile_tile][tile_pal], this.startx + (i2 * this.tilewidth), this.starty + (i * this.tileheight), this.tilewidth, this.tileheight, this);
this.tileheight, this);
        protected void drawMap(Graphics g, Graphics2D g2d)        {            Font test_font = new Font("Arial", Font.PLAIN, 12);            if (this.modeprops[this.mode][1] == 1)            {                g2d.setPaint(Color.black);                g2d.setFont(test_font);                for (int i = 0; i < maparray.length; i++)                {                    int[] row2draw = maparray[i];                    for (int i2 = 0; i2 < row2draw.length; i2++)                    {                        // System.out.println("Row " + i + ", Column " + i2 + ";                        // " + maparray[i][i2]);                        g2d.drawString(addZeros(Integer                            .toHexString(row2draw[i2]), 2), this.startx                            + (i2 * this.tilewidth) + (this.tilewidth / 2),                            this.starty + (i * this.tileheight)                                + (this.tileheight / 2));                        g2d.draw(new Rectangle2D.Double(this.startx                            + (i2 * this.tilewidth), this.starty                            + (i * this.tileheight), tilewidth, tileheight));                    }                }            }            else if (this.modeprops[this.mode][1] == 2)            {		int tile_set, tile_tile, tile_pal;                for (int i = 0; i < maparray.length; i++)                {                    int[] row2draw = maparray[i];                    for (int i2 = 0; i2 < row2draw.length; i2++)                    {                        int[] tsetPal = mapcontrol.getTsetPal(getSectorXorY(i2                            + x, this.sector_width), getSectorXorY(i + y,                            this.sector_height));//                        System.out.println("Local tileset: "//                            + mapcontrol.getLocalTileset(i2 + x, i + y));                        // this.loadTsetImages(mapcontrol.getDrawTileset(tsetPal[0]));			tile_set = mapcontrol.getDrawTileset(tsetPal[0]);			tile_tile = row2draw[i2] | (mapcontrol.getLocalTileset(i2 + x, i + y) << 8);			// tile_pal = tsetPal[1]; // TileEditor.tilesets[mapcontrol.getDrawTileset(tsetPal[0])].getPaletteNum(tsetPal[0], tsetPal[1]);			tile_pal = TileEditor.tilesets[mapcontrol.getDrawTileset(tsetPal[0])].getPaletteNum(tsetPal[0], tsetPal[1]);			// System.out.println("Tileset: " + tile_set + " Tile: " + tile_tile + " Palette: " + tile_pal);			this.loadTileImage(tile_set, tile_tile, tile_pal);                        /*g.drawImage(TileEditor.tilesets[mapcontrol                            .getDrawTileset(tsetPal[0])]                            .getArrangementImage(                                row2draw[i2]                                    | (mapcontrol                                        .getLocalTileset(i2 + x, i + y) << 8),                                TileEditor.tilesets[mapcontrol                                    .getDrawTileset(tsetPal[0])].getPaletteNum(                                    tsetPal[0], tsetPal[1]), false),                            this.startx + (i2 * this.tilewidth), this.starty                                + (i * this.tileheight), this.tilewidth,                            this.tileheight, this);*/			g.drawImage(this.tile_images[tile_set][tile_tile][tile_pal], this.startx + (i2 * this.tilewidth), this.starty + (i * this.tileheight), this.tilewidth, this.tileheight, this);                        g2d.draw(new Rectangle2D.Double(this.startx                            + (i2 * this.tilewidth), this.starty                            + (i * this.tileheight), tilewidth, tileheight));                    }                }					            }            if ((this.modeprops[this.mode][0] >= 1) && this.knowssector)            {                g2d.setPaint(Color.yellow);                /*                 * int draw_sector_x, draw_sector_y, draw_sector_w,                 * draw_sector_h;                 *                  * if (this.sectorx == 0) { draw_sector_x = this.startx;                 * draw_sector_w = (this.sector_width - this.x) *                 * this.tilewidth; } else { draw_sector_x = this.startx +                 * (this.sectorx * this.tilewidth * this.sector_width) -                 * (this.tilewidth * this.x); if ((draw_sector_x +                 * (this.sector_width * this.tilewidth)) > (this.width *                 * this.tilewidth)) { System.out.println("The sector being drawn                 * DOES extend horizontally past the border.");                 * System.out.println("Expected end of sector: " +                 * (draw_sector_x + (this.sector_width * this.tilewidth)) + ";                 * Width of screen: " + (this.width * this.tilewidth) + ";");                 * draw_sector_w = (this.sector_width * this.tilewidth) -                 * ((draw_sector_x + (this.sector_width * this.tilewidth)) -                 * (this.width * this.tilewidth)); System.out.println("New width                 * of sector: " + draw_sector_w + ";"); } else {                 * System.out.println("The sector being drawn DOES NOT extend                 * horizontally past the border."); draw_sector_w =                 * this.sector_width * this.tilewidth; } }                 */                /*                 * g2d.draw(new Rectangle2D.Double(this.startx + (this.sectorx *                 * this.tilewidth * this.sector_width), this.starty +                 * (this.sectory * this.tileheight * this.sector_height),                 * this.tilewidth * sectorDisplayWoH(this.sectorx,                 * this.sector_width, this.width), this.tileheight *                 * sectorDisplayWoH(this.sectory, this.sector_height,                 * this.height)));                 */                int[] draw_sector_xw = sectorDisplayWoH(this.sectorx,                    this.sector_width, this.width, this.startx, this.x,                    this.tilewidth);                int[] draw_sector_yh = sectorDisplayWoH(this.sectory,                    this.sector_height, this.height, this.starty, this.y,                    this.tileheight);                g2d.draw(new Rectangle2D.Double(draw_sector_xw[0],                    draw_sector_yh[0], draw_sector_xw[1], draw_sector_yh[1]));            }		if (this.modeprops[this.mode][2] == 1) {			this.drawEditGUI(g, g2d);		}        }