public static void loadMap(String filename, ImageViewer imViewer, ImageMapper imMapper)
    		throws CantImportException
    	{
        FileReader fstream = null;
        try {
			fstream = new FileReader(filename);
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		}
        BufferedReader in = new BufferedReader(fstream);
        try {
        		String s = null;
        		boolean loadMap = false;
        		Vector<String[]> elements = new Vector<String[]>();
        		int width = 32;
        		int height = 32;
			while((s = in.readLine()) != null) {
				if (s.matches(""))
					loadMap = false;
				if (s.matches("#define [0-9A-Za-z]+_MAP_W.*")) {
					s = s.substring(s.length()-2);
					width = Integer.parseInt(s);
					continue;
				}
				if (s.matches("#define [0-9A-Za-z]+_MAP_H.*")) {
					s = s.substring(s.length()-2);
					height = Integer.parseInt(s);
					continue;
				}
				if (loadMap) {
					s = s.replace("0x", "");
					s = s.replace(".db ", "");
					elements.add(s.split(","));
				}
				if (s.matches("_[a-z0-9A-Z_]+tilemap:"))
					loadMap = true;
			}
	    		Vector<Integer> elementsInt = new Vector<Integer>();
	    		for (int i = 0; i < elements.size(); ++i) {
	    			for (int j = 0; j < elements.get(i).length; ++j) {
	    				elementsInt.add(Integer.parseInt(elements.get(i)[j], 16));
	    			}
	    		}
	    		imMapper.setMap(elementsInt, width, height);
		} catch (IOException e) {
			throw new CantImportException();
		}
    }