Background image change for Erik Temple's Automapping

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;
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.

You could do this with a table, or a property, or a scene. The important thing is that you change the image-ID property to the figure name of the new location, before the window is redrawn. Here’s how to do it with properties (the cleanest way, in my opinion):

[code]A room has a figure name called the background-image. The background-image is usually Figure of Zork. [This is the default background and will be shown for any room where you don’t define a figure name specifically, e.g. The Round Room is a room. The background-image is Figure of Round Room.]

This is the background image updating rule: now the image-ID of the map-background is the background-image of the location.

The background image updating rule is listed before the graphic automap updating rule in the after constructing the status line rulebook.[/code]


Another question for automap & windows.

I was using Emily Short’s Simple Graphical Windows to display a small window at the bottom of the screen below the player’s input. So that the main body of game text was sandwiched between the automap window (above) and a small graphics footer window (below).

It seemed to work fine until I compiled the game and tried to SAVE and RESTORE. Then things went crazy. The automap stopped working right, and began to display in both windows simultaneously.

Here’s the code for the bottom window:

[code]The graphics window proportion is 10. The graphics window position is g-below.

Currently shown picture is Figure of Logo.[/code]

Do you know a simple way I can create a bottom footer window using Glimmr commands? One that won’t conflict with automap after SAVE and RESTORE games.

Thanks for any help or ideas with this.

This actually has nothing to do with Automap. It sounds like using Simple Graphical Window at the same time as Flexible Windows is messing with the assignment of window references. I’d remove SGW from your project and create your smaller window with Flexible Windows instead. Those two extensions aren’t really compatible, and Flexible Windows is the more powerful.