Patch:Keen on map (Vorticons)

From KeenWiki
Jump to navigation Jump to search

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

Other pages that contain patches related to ones here are Patch:Map Keen (Galaxy) and Patch:Teleporter. The various map level pages will also have related patches.


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.

Keen 1 map animation\direction pointer list

#List location
%patch $AB76 {$B83FW}

#List length
%patch $AB6E [$07]

#Keen 1 map animation pointer list
%patch $AE0C $AB89W #Keen moving up (At $AB89)
%patch $AE0E $AB95W #Keen moving up right (At $AB95)
%patch $AE10 $ABA6W #Keen moving right (At $ABA6)
%patch $AE12 $ABB2W #Keen moving down right (At $ABB2)
%patch $AE14 $ABC3W #Keen moving down (At $ABC3)
%patch $AE16 $ABCFW #Keen moving down left (At $ABCF)
%patch $AE18 $ABE0W #Keen moving left (At $ABE0)
%patch $AE1A $AB78W #Keen moving up left (At $AB78)

Keen 2 map animation\direction pointer list

#List location
%patch $A5F1 {$A887W}

#List length
%patch $A5E9 [$07]

#Keen 2 map animation pointer list
%patch $A887 $A604W #Keen moving up (At $A604)
%patch $A889 $A610W #Keen moving up right (At $A610)
%patch $A88B $A621W #Keen moving right (At $A621)
%patch $A88D $A62DW #Keen moving down right (At $A62D)
%patch $A88F $A63EW #Keen moving down (At $A63E)
%patch $A891 $A64AW #Keen moving down left (At $A64A)
%patch $A893 $A65BW #Keen moving left (At $A65B)
%patch $A895 $A5F3W #Keen moving up left (At $A5F3)

Keen 3 map animation\direction pointer list

#List location
%patch $B4D7 {$B83FW}

#List length
%patch $B4CF [$07]

#Keen 3 map animation pointer list
%patch $B83F $B4EAW #Keen moving up (At $B4EA)
%patch $B841 $B4F6W #Keen moving up right (At $B4F6)
%patch $B843 $B507W #Keen moving right (At $B507)
%patch $B845 $B513W #Keen moving down right (At $B513)
%patch $B847 $B524W #Keen moving down (At $B524)
%patch $B849 $B530W #Keen moving down left (At $B530)
%patch $B84B $B541W #Keen moving left (At $B541)
%patch $B84D $B4D9W #Keen moving up left (At $B4D9)


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.

Keen 1

#Enter levels by touching their squares
%patch $AAAA $EB


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.

Keen 1

#Stop the screen following Keen
%patch $AC71 $EB #Don't move screen right
%patch $ACC2 $EB #Don't move screen left
%patch $AD11 $EB #Don't move screen down
%patch $AD62 $EB #Don't move screen up


Speeds and directions

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.

Keen 1's Map speeds

#Up left
%patch $AB7B [$FC00W] #Vertical speed
%patch $AB80 [$FC00W] #Horizontal speed

#Up
%patch $AB8C [$FC00W] #Vertical speed

#Up right
%patch $AB98 [$FC00W] #Vertical speed
%patch $AB9D [$0400W] #Horizontal speed

#Right
%patch $ABA9 [$0400W] #Horizontal speed

#Down right
%patch $ABB5 [$0400W] #Vertical speed
%patch $ABBA [$0400W] #Horizontal speed

#Down
%patch $ABC6 [$0400W] #Vertical speed

#Down left
%patch $ABD2 [$0400W] #Vertical speed
%patch $ABD7 [$FC00W] #Horizontal speed

#Left
%patch $ABE3 [$FC00W] #Horizontal speed

Keen 2's Map speeds

#Up left
%patch $A5F6 [$FC00W] #Vertical speed
%patch $A5FB [$FC00W] #Horizontal speed

#Up
%patch $A607 [$FC00W] #Vertical speed

#Up right
%patch $A613 [$FC00W] #Vertical speed
%patch $A618 [$0400W] #Horizontal speed

#Right
%patch $A624 [$0400W] #Horizontal speed

#Down right
%patch $A630 [$0400W] #Vertical speed
%patch $A635 [$0400W] #Horizontal speed

#Down
%patch $A641 [$0400W] #Vertical speed

#Down left
%patch $A64D [$0400W] #Vertical speed
%patch $A652 [$FC00W] #Horizontal speed

#Left
%patch $A65E [$FC00W] #Horizontal speed

Keen 3's Map speeds

#Up left
%patch $B4DC [$FC00W] #Vertical speed
%patch $B4E1 [$FC00W] #Horizontal speed

#Up
%patch $B4ED [$FC00W] #Vertical speed

#Up right
%patch $B4F9 [$FC00W] #Vertical speed
%patch $B4FE [$0400W] #Horizontal speed

#Right
%patch $B50A [$0400W] #Horizontal speed

#Down right
%patch $B516 [$0400W] #Vertical speed
%patch $B51B [$0400W] #Horizontal speed

#Down
%patch $B527 [$0400W] #Vertical speed

#Down left
%patch $B533 [$0400W] #Vertical speed
%patch $B538 [$FC00W] #Horizontal speed

#Left
%patch $B544 [$FC00W] #Horizontal speed


Animations

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.

Map Keen animations

#Map Keen walking animations - Keen 1
%patch $894D [$0024W] #Initial map animation
%patch $AB85 [$002CW] #Moving up left
%patch $AB91 [$002CW] #Moving up
%patch $ABA2 [$002CW] #Moving up right
%patch $ABAE [$0020W] #Moving right
%patch $ABBF [$0024W] #Moving down right
%patch $ABCB [$0024W] #Moving down
%patch $ABDC [$0024W] #Moving down left
%patch $ABE8 [$0028W] #Moving left
%patch $ABFF [$0003W] #Frames used by all map sprites
%patch $ABFB [$04]    #Animation speed

#Map Keen walking animations - Keen 2
%patch $A600 [$002CW] #Moving up left
%patch $A60C [$002CW] #Moving up
%patch $A61D [$002CW] #Moving up right
%patch $A629 [$0020W] #Moving right
%patch $A63A [$0024W] #Moving down right
%patch $A646 [$0024W] #Moving down
%patch $A657 [$0024W] #Moving down left
%patch $A663 [$0028W] #Moving left
%patch $A67A [$0003W] #Frames used by all map sprites
%patch $A676 [$04]    #Animation speed

#Map Keen walking animations - Keen 3
%patch $8AA9 [$0023W] #Initial map animation
%patch $B4E6 [$002BW] #Keen moving up left
%patch $B4F2 [$002BW] #Keen moving up
%patch $B503 [$002BW] #Keen moving up right
%patch $B50F [$001FW] #Keen moving right
%patch $B520 [$0023W] #Keen moving down right
%patch $B52C [$0023W] #Keen moving down
%patch $B53D [$0023W] #Keen moving down left
%patch $B549 [$0027W] #Keen moving left
%patch $B562 [$0003W] #Frames used by all map sprites
%patch $B55E [$04]    #Animation speed


Keen animates when standing still

These patches cause Keen to animate as if he were moving even when no arrow keys are being pressed.

Still Map Keen animates

#Still Map Keen animates -Keen 1
%patch $ABF5 $90 $90

#Still Map Keen animates -Keen 2
%patch $A670 $90 $90

#Still Map Keen animates -Keen 3
%patch $B558 $90 $90


Sounds

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

Teleporter sounds make an appearance in Keen 1 and 3 and Keen 3 has sounds relating to Messie.

Keen 1

#Sounds
%patch $AC60 $02     #Keen blocked on map sound
%patch $AC65 $01     #Keen walking on map sound
%patch $AF6C $12     #Teleporter sound
%patch $8F82 $29     #Keens left sound

#Don't play sounds
%patch $AC5F $EB $0C #Keen blocked on map sound disabled
%patch $AC64 $EB $07 #Keen walking on map sound disabled
%patch $AF6B $EB $07 #Teleporter sound disabled
%patch $8F81 $EB $07 #Keens left sound disabled

Keen 2

#Sounds
%patch $A6DB $02     #Keen blocked on map sound
%patch $A6E0 $01     #Keen walking on map sound
%patch $8A10 $29     #Keens left sound

#Don't play sounds
%patch $A6DF $EB $07 #Keen walking on map sound disabled
%patch $A6DA $EB $0C #Keen blocked on map sound disabled
%patch $8A0F $EB $07 #Keens left sound disabled

Keen 3

#Sounds
%patch $B5C2 $02     #Keen blocked on map sound
%patch $B5CC $01     #Walk on map sound
%patch $B800 $1A     #Get on Messie sound
%patch $B988 $12     #Teleport go sound
%patch $BAEC $12     #Teleport arrive sound
%patch $9865 $29     #Appear on map sound

#Don't play sounds
%patch $B5C1 $EB $06 #Keen blocked on map sound disabled
%patch $B5CB $EB $06 #Walk on map sound disabled
%patch $B7FF $EB $06 #Get on Messie sound disabled
%patch $B987 $EB $06 #Teleport go sound disabled
%patch $BAEB $EB $06 #Teleport arrive sound disabled
%patch $9864 $EB $06 #Appear on map sound disabled


Misc

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.

Map Keen acts more like regular Keen

#Change pointers to new codes
%patch $B83F $B540W #Keen moving up
%patch $B841 $B538W #Keen moving up right
%patch $B843 $B545W #Keen moving right
%patch $B845 $B545W #Keen moving down right (Right)
%patch $B847 $B54DW #Keen moving down (Nothing)
%patch $B849 $B54AW #Keen moving down left (Left)
%patch $B84B $B54AW #Keen moving left
%patch $B84D $B53DW #Keen moving up left

#Calls: \upright-B538\upleft-B53D\up-B540\right-B545\left-B54A\
%patch $B538 $E8 $FFAAW  $EB $03 $E8 $FF99W  $E8 $FFAEW  $EB $08 $E8 $FF9DW
             $EB $03 $E8 $FF8CW
%patch $B4C2 $C7 $44 $1C $0000W  $E8 $9542W				     #Call basic behavior

#Number of animation frames of Map Keen still
%patch $B734 [$00]

#Move left\right\jump code
%patch $B4D9 $C7 $06 $9D24W  $0001W  $C7 $44 $1C [$FCE0W]  $C3 $C7 $06 $9D24W
             $0000W  $C7 $44 $1C [$0320W]  $C3 $81 $7C $1E $0190W  $75 $13 $81
             $3E $9D22W  $0000W  $75 $0B $C7 $06 $9D22W  [$0008W]  $C7 $44 $1E
             [$FCE0W]  $C3

#Basic behavior
%patch $4A0C $81 $7C $1E $0000W  $75 $0E $81 $3E $9D22W  $0000W  $74 $2D $C7
             $06 $9D22W  $0000W  $C7 $44 $28 [$0022W]  $81 $3E $9D22W  $0000W
             $74 $13 $C7 $44 $1E [$FB50W]  $A1 $9D22W  $01 $C0 $29 $44 $1E $0EFFW
                 $9D22W  $EB $51 $C7 $44 $1E [$04B0W]  $EB $4A $C7 $44 $1E $0190W
                 $C7 $44 $28 [$001FW]  $81 $3E $9D24W  {$0002W}  $7D $18 $A1 $61
             $53 $B1 {$05} $D3 $E8 $25 [$0001W]  $05 [$0020W]  $89 $44 $28 $81 $06
             $9D24W  $0002W  $EB $20 $81 $06 $9D20W  $0002W  $81 $3E $9D20W
             $01F4W  $72 $18 $A1 $61 $53 $B1 {$05} $D3 $E8 $25 [$0003W]  $05 [$0027W]
                 $89 $44 $28 $EB $18 $C7 $06 $9D20W  $0000W  $A1 $9D24W  $3D
             $0000W  $74 $0A $3D $0002W  $74 $05 $81 $44 $28 [$0004W]  $C3

#Optional patches
%patch $AF77 $EB #Clipping on map with GOD mode
%patch $B5CB $EB $06 #Walk on map sound disabled
%patch $B5C1 $EB $06 #Keen blocked on map sound disabled