Glimmr Automap

version 2/101030 by Erik Temple

  • Home page
  • Beginning
  • Previous
  • Next



  • Chapter - New window scaling rule for the map window

    For scaling a map-display window (called the viewport) (this is the select appropriate zoom level rule):
        [say "Applying zoom level...";
        say "Background color: [background tint of map-renderer].";]
        now the arbitrary scaling factor of the viewport is entry (current zoom level of the map-renderer) of the zoom-level set of the associated tileset of the map-renderer;
        #if utilizing Glimmr debugging;
        say "[>console][GLAM]Window [i][viewport][/i] is a map-display window. Arbitrary scaling factor set to [arbitrary scaling factor of the viewport], based on entry [current zoom level of the map-renderer] of the zoom-level set of the tileset [i][associated tileset of the map-renderer][/i].[<]";
        #end if;
        continue the action.
        
    For scaling a map-display window (called the viewport) (this is the resize canvas to map rule):
        let scaled tile-width be (tile-width of associated tileset of the map-renderer * arbitrary scaling factor of the viewport) as an integer;
        let scaled tile-height be (tile-height of associated tileset of the map-renderer * arbitrary scaling factor of the viewport) as an integer;
        #if utilizing Glimmr debugging;
        say "[>console][GLAM]Scaled automap tile will measure [scaled tile-width] x [scaled tile-height] pixels, based on [i]map-window[/i] scaling factor.[<]";
        #end if;
        let x-win be the width of the viewport / scaled tile-width;
        let y-win be the height of the viewport / scaled tile-height;
        #if utilizing Glimmr debugging;
        say "[>console][GLAM]Window fits [x-win] tiles wide by [y-win] tiles high.[<]";
        #end if;
        if maximum map width of the viewport > 0:
            let x-win be MIN (x-win) or (maximum map width of the viewport);
        if maximum map height of the viewport > 0:
            let y-win be MIN (y-win) or (maximum map height of the viewport);
        #if utilizing Glimmr debugging;
        if maximum map height of viewport > 0 or maximum map width of viewport > 0:
            say "[>console][GLAM]Number of displayed automap tiles set at [x-win] tiles wide by [y-win] tiles high, taking into account author limits.[<]";
        #end if;
        reserve automap memory of y-win rows by x-win columns;
        if the map is drawn and the current zoom is not map absent:
            do nothing;[Automap's map is drawn by the phrase "if the map is drawn"; hence this odd instruction.]
        now the map-width of the map-renderer is (map width * tile-width of associated tileset of the map-renderer);
        now the map-height of the map-renderer is (map height * tile-height of associated tileset of the map-renderer);
        now the canvas-width of the associated canvas of the viewport is map-width of the map-renderer;
        now the canvas-height of the associated canvas of the viewport is map-height of the map-renderer;
        #if utilizing Glimmr debugging;
        say "[>console][GLAM]Automap data calculated ([y-win * x-win] total tiles).[<]";
        #end if;
        continue the action;