Glimmr Automap

version 2/101030 by Erik Temple

  • Home page
  • Beginning
  • Previous
  • Next



  • Chapter - Element display rule for the map-renderer

    An element display rule for the map-renderer when the location is unmappable (this is the unmappable room rule):
        exit.

    An element display rule for the map-renderer (this is the map-renderer display rule):
        let tilesetting be the associated tileset of map-renderer;
        let scan be 0;
        let row be the win-y of the map-renderer;
        let column be the win-x of the map-renderer;
        let xx be the tile-width of the tilesetting * scaling factor of the current window as an integer;
        let yy be the tile-height of the tilesetting * scaling factor of the current window as an integer;
        unless the background tint of the map-renderer is g-placenullcol:
            dimrectdraw (color background tint of the map-renderer) in (the current window) at (column) by (row) with dimensions (map-width of map-renderer * scaling factor of the current window as an integer) by (map-height of map-renderer * scaling factor of the current window as an integer);
            #if utilizing Glimmr debugging;
            say "[>console][GLAM]Drawing background rectangle (glulx color-value [background tint of map-renderer]) from ([win-x], [win-y]) to ([win-x + (map-width of map-renderer * scaling factor of the current window as an integer)], [win-y + (map-height of map-renderer * scaling factor of the current window as an integer)]) for element [i][map-renderer][/i] in [i][current window][/i].[<]";
            #end if;
        unless the no post-processing option is active:
            follow the automap post-processing rules;
        repeat with count running from 1 to (map height * map width):
            increase scan by 1;
            if scan > map width:
                increase row by yy;
                now column is the win-x of the map-renderer;
                let scan be 1;
            let V be the map glyph of count;
            if there is a char of V in the translation-table of the tilesetting:
                choose row with a char of V in the translation-table of the tilesetting;
                let the current tile be tile entry;
                drscimage (current tile) in (current window) at (column) by (row) with dimensions (xx) by (yy);
                if the graphlink status of the map-renderer is g-active:
                    unless linked room-ID of count is 0:
                        set a graphlink in the current window identified as map-renderer from column by row to (column + xx) by (row + yy) as linked room-ID of count, ignoring redundant links;
                        #if utilizing the image-map graphlink preview option;
                        boxdraw (color graphlink preview color) in (current window) from (column) by (row) to (column + xx) by (row + yy) with 1;
                        #end if;
            increase column by xx;
        #if utilizing Glimmr debugging;
        say "[>console][GLAM]Drawing element [i]map-renderer[/i] in [i][current window][/i] at origin ([win-x of map-renderer], [win-y of map-renderer]), dimensions [map width * xx] x [map height * yy] pixels ([map width] x [map height] tiles)[if the graphlink status of the map-renderer is g-active][GLAM]Hyperlinks set for linked room-ID, as provided[end if].[<]";
        #end if.