I’m using Erik’s automapping in a test demo which is pictured below. I’d like to see if there is a way that I could change the automap’s background image, depending on what location you’re in, or even call up an new image during some part of the story. Admittedly, figuring out a way to do this is pretty much beyond my limited knowledge of Inform7 at this point, so I’m not even sure where I would start. Or how I would fold it into the existing code.
Could a simple Table be made, which would call up a background image to replace the current one, depending on what location you were in–and/or could a scene also be triggered to replace the current background image using a Table or some other method?
Any ideas, suggestions or help would be greatly appreciated. Thanks.
[code]Section - Automapping
Figure of Map is the file “Figure of Map.jpeg”.
The measurement of the map-window is 300.[This sets the window split to 310 pixels. You might want to use a different value, of course.]
The initial zoom level of the Glimmr Automap Tileset is 1.
Element scaling the map-background:
let coords be the center-point of the map-canvas;
now entry 1 of the origin of map-background is entry 1 of the coords;
now entry 2 of the origin of map-background is entry 2 of the coords.
map-background is a sprite. The display-layer is 0. The image-ID is Figure of Map.
Element scaling rule for the map-background:
rule succeeds.[We don’t need to do the standard scaling, so skip it to save time.]
Element display rule for the map-background:
let win_width be the width of the map-window;
let win_height be the height of the map-window;
let img_width be the image-width of the image-ID of map-background;
let img_height be the image-height of the image-ID of map-background;
let scale_factor be 200;
let width_factor be (win_width * 200) / img_width;
let height_factor be (win_height * 200) / img_height;
if width_factor is greater than height_factor:
let scale_factor be height_factor;
otherwise:
let scale_factor be width_factor;
let img_width be (img_width * scale_factor) / 200;
let img_height be (img_height * scale_factor) / 200;
let offset_width be the greater of 0 or (win_width - img_width) / 2;
let offset_height be the greater of 0 or (win_height - img_height) / 2;
display the image-ID of map-background in the map-window at (offset_width) by (offset_height) with dimensions (img_width) by (img_height).
The background tint of the bitmap automap label is g-Black. The tint of the bitmap automap label is g-White.
[/code]