Patch:Images

From KeenWiki
Jump to navigation Jump to search

Images or "bitmaps" are graphics used in the Keen games for non-sprite non-font purposes. They are usually unmasked and used in menus, stories and such as images. In Keen Vorticons, they are mainly used in the main menu level (High Scores, ordering info, and so on), and in the ending sequence. In Dreams, they are used in the main menu. In Galaxy, they are used in the main menu, text windows and the help/story/ending texts.

There are a few things to note about patching these. The first is that the graphics themselves can be edited with ModKeen or Keengraph. Graphics can be any height, but must be a multiple of 8 pixels wide (8, 16, 24...) A single graphic can take up an entire screen if space allows. Graphics placed later appear over those placed earlier. Graphics appear over tiles or windows, but animating tiles will show through (in Keen Vorticons), as will fonts (text patches).

It is often possible to change the graphic used with a simple two-byte patch. However, bitmaps are numbered in two different ways. In Keen Vorticons, they start from zero, with the title screen image being bitmap 0 by default. (Thus it helps to have the extracted graphics in front of you when making such patches.) In Dreams and Galaxy all graphics are numbered by "chunk number", which is what graphics chunk they are in the EGAHEAD.CKx file or data. Bitmaps are not the first chunks, but Modkeen extracts them and numbers their files starting from zero. Thus, if you are using Modkeen's filenames as a guide, all bitmap values in-patch are six larger than in-filename. (E.g. if you want to use the first bitmap image, you would need to patch a value of $06 $00.)

It is also often possible to change the location of an image onscreen. This is more complex as the location will often have two components, a vertical (V or Y value, how far up/down the screen) and horizontal part (H or X value, how far left/right on the screen).

In Keen Vorticons, both work differently. The horizontal value is composed of 8x8 blocks (the smallest component of fonts), so a value of $02 $00 would be 16 pixels down from the top of the screen. The vertical value however is often in pixels. There are exceptions to this of course, which only makes things more tricky. Also, the (0,0) point is actually 32 pixels left offscreen. (This is related to how levels display and how screens are "set".) As an example, this patch places the Keen 1 title bitmap at the top left corner of the screen:

#The title bitmap will be shown at offset (0,0)
%patch $A08C   $00 $00 #Y location, in pixels
%patch $A090   $04 $00 #X location, in pixels / 8 + 4

We can see here the vertical value makes sense, 0 pixels from the top of the screen. The horizontal value however is 4, 32 pixels right, to compensate.

In Dreams/Galaxy, both H/V values are often in pixels, but are often measured from different points. Unlike Vorticons, where the point (0,0) is usually the top-left corner of the screen as a whole, in Dreams/Galaxy it can be that also, or the top-left corner of a window, or even relative to another graphic or piece of text.