Patch:Keen on map (Vorticons)
This page contains patches relating to the player sprite on the map. This is different from the player sprite in levels. The map sprite does not feel gravity and can enter levels, as well as do a number of more specialized things (Such as teleport) in certain games. Patches on this page relate only to the map sprite, its appearance and behavior. patches relating to the map level are located at Patch:Map (Keen 1), Patch:Map (Keen 2) and Patch:Map (Keen 3).
How Map Keen sprites work
For the most part the Map Keen sprite is much like other sprites, albeit with a unique behavior. Rather than have a whole slew of actions for each direction of movement, including diagonals, there is a single behavior for Map Keen both standing still and moving in any direction. The animations however are read not from the behavior itself, but from a 'direction list' that has an entry for each direction Keen can move. This greatly simplifies things, but makes them harder to understand. Following is the pointer lists that controls these sort of 'list patches'.
Movement pointer list
This list controls where in the code map Keen goes to when moving in certain directions. This controls his animations and direction.
|Patch: Keen 1 map animation\direction pointer list|
|Patch: Keen 2 map animation\direction pointer list|
|Patch: Keen 3 map animation\direction pointer list|
Enter levels just by touching their entrances
This patch alters Keen's behavior so that he doesn't need to press Alt or Ctrl to enter a level, merely touching a level entrance will work. A side effect of this is that Keen will immediately reenter a level if he dies and exits to the map.
|Patch: Keen 1|
Stop the screen following Keen
These patches stop the screen moving with Map Keen in various directions. The screen position will reset when Keen leaves a level or is teleported somewhere but not when he moves near a screen edge.
|Patch: Keen 1|
Keen's speeds on the map are in 256ths of a pixel per cycle. Thus the default speed of 4 pixels is $0400W (Right, leftwards is -4 or $FC00W). Speeds determine direction as well.
|Patch: Keen 1's Map speeds|
|Patch: Keen 2's Map speeds|
|Patch: Keen 3's Map speeds|
See the first section of this page for a description of how some of the Map Keen's animations work differently from normal. Note that map sprites, like all sprites have an initial animation set that will only appear when Keen first appears on the map, before he moves in any direction.
The animations used by moving Map Keen are read from a list. The value in the list is the first animation of that sequence, and the number of frames used for all sequences is controlled by a single variable. Thus the first Keen 3 entry, $002BW means 'Use frames $2B, $2C, $2D and $2E.' Note that if Keen stops moving he will use, (while standing still) the animation given in the direction list for that direction. In our previous example, if Map Keen stops walking upwards, he will sit still and use animation $2B.
The number of animation frames must be either an odd number or zero; even numbers cause bugs.
|Patch: Map Keen animations|
Keen animates when standing still
These patches cause Keen to animate as if he were moving even when no arrow keys are being pressed.
|Patch: Still Map Keen animates|
There are several sounds related to the map. The two most basic are Keen's map walking sound (played whenever he moves on the map.) and Keen's map blocked sound. (Played whenever Keen tries to walk into a solid tile on the map.) There is also the 'appear on map' sound that is triggered when Keen starts a game, loads a game or exits a level. (It is related to the Keens Left Window.)
|Patch: Keen 1|
|Patch: Keen 2|
|Patch: Keen 3|
These patches do not fit in any of the above sections.
Map Keen acts more like regular Keen
This patch alters Map Keen's behavior so that he behaves more like Keen in normal levels. Map Keen can jump by pressing the up key (And jump diagonally by pressing the home and pgup keys.), walk left and right and will fall under gravity. Otherwise things remain unaltered; Map Keen can enter levels and teleport. (And notably using the G O D Cheat will cause Map Keen to loose clipping and fall out of the level.)
The patch is quite complex and currently works only for Keen 3. Following is a line-by-line dissection of the patch. Note that this patch will disable the Foob's walking behavior, making it unusable.
The first section changes the Map Keen pointer list to use the new pointer codes. This is best left untouched. The same goes for the second section which contains calls to Map Keen's new movement code. The third section is simply the number of animation frames of Map Keen standing still. In this example it is 0 so that Keen does not animate when standing still; but this can be changed.
The fourth section is Map Keen's movement speeds. The first blue value is Keen's leftwards walking speed, the second his rightwards walking speed, the third is his jump time (How long Keen jumps for, this affects its height, but see next section.) and the third should be the same as the leftwards speed.
The fifth section is Keen's animation behavior. The first blue value is Keen's moving upwards animation (This includes jumping left and right.) The second blue value is Keen's jump speed. Keen's jump height is this value multiplied by his jump time. Increasing this value makes Keen jump higher, increasing his jump time makes him jump higher too, but does not increase his rising speed and the player must press the jump key for longer to get that high. (If jump speed is low and jump time high the jump ends up resembling a jetpack.)
The third blue value is the 'gravity' Keen feels; it is how fast he falls. If this is made low Keen will float downwards. By default it is the exact opposite of the jump speed. The fourth blue value is Keen's standing right animation. This will use the next animation as his standing left animation after Keen has finished walking left. The fifth blue value is how many animation frames walking left or right uses.
The first brown value is how long Keen will keep animating after walking while standing still. By default this is 2 cycles, or pretty much immediately after he stops moving. The second brown value is the animation speed of walking Keen.
The remaining blue\brown values are for an animation sequence (Dying on the map?) that doesn't appear to be used in this patch. The final blue value however is how many frames different walking right is from walking left.
Some other patches are included with this patch. They are not vital but likely wanted. The first stops God Mode turning off the map clipping, so Keen won't fall off the level and break the game. The next two mute the walking on map and blocked on map sounds which will otherwise play continuously.
|Patch: Map Keen acts more like regular Keen|