Patch:Keen's shot (Galaxy)
In Keen Galaxy Keen's shot is a green ball of energy that can be shot in four directions while Keen is standing, jumping or on a pole. Its behavior is near identical across all three Galaxy episodes and so all three are treated here. Patches for individual episodes that relate to the player can be found at Patch:Keen (Keen 4), Patch:Keen (Keen 5) and Patch:Keen (Keen 6).
This page deals only with the shot once it is produced, as well as the process of creating it. It does not contain patches relating to the player, such patches can be found on Patch:Keen shooting (Galaxy), which deals with when and how the player produces the shot. (Including the famous 'impossible bullet' bug.) As an example, this page will contain patches for the shooting sound and shot directions, while the other page will contain patches relating to disabling shooting on poles, having a machine gun or the player's shooting animations.
The first sections of the page deal with the shot being produced, while the latter sections deal with the produced shot's sprite variables.
Shot direction
There are two aspects to shot direction. The first is the actual directions themselves. These are differentiated by giving different values of horizontal and vertical direction to a shot. However this code must be pointed to, and this is done with a pointer list that gets its value from what direction the player is facing.
There are eight possible directions for a shot to go (Up, up right, up left, left...) of which seven are on the list and only four are valid. (It is usually impossible to spawn an invalid shot, but it can happen.) These patches relate to the following section also, which passes a direction value to the game for the directions list.
Keen 4
#Location of pointer list (D8F0 + D35 = E625)
%patch $E5C5 $0D35W
#Length of list
%patch $E5BD $06
#Spawnshot pointer list (Origin D8F0)
%patch $E625 $0CD7W #Upwards
$0D17W #INVALID
$0CE7W #Rightwards
$0D17W #INVALID
$0CF7W #Downwards
$0D17W #INVALID
$0D07W #Leftwards
#Shot directions:
#Up
%patch $E5CE [$0000W] #Horizontal
%patch $E5D3 [$FFFFW] #Vertical
#Right
%patch $E5DE [$0001W] #Horizontal
%patch $E5E3 [$0000W] #Vertical
#Down
%patch $E5ED [$0000W] #Horizontal
%patch $E5F3 [$0001W] #Vertical
#Left
%patch $E5FD [$FFFFW] #Horizontal
%patch $E603 [$0000W] #Vertical
Keen 5
#Location of pointer list (D8F0 + D35 = E625)
%patch $DCF4 $10A5W
#Length of list
%patch $DCEC $06
#Spawnshot pointer list (Origin D8F0)
%patch $DD55 $1046W #Upwards
$1086W #INVALID
$1056W #Rightwards
$1086W #INVALID
$1066W #Downwards
$1086W #INVALID
$1076W #Leftwards
#Shot directions:
#Up
%patch $DCFD [$0000W] #Horizontal
%patch $DD02 [$FFFFW] #Vertical
#Right
%patch $DD0D [$0001W] #Horizontal
%patch $DD12 [$0000W] #Vertical
#Down
%patch $DD1C [$0000W] #Horizontal
%patch $DD22 [$0001W] #Vertical
#Left
%patch $DD2C [$FFFFW] #Horizontal
%patch $DD32 [$0000W] #Vertical
Shot destruction
The destruction of Keen's shot is caused by many things, such as colliding with enemies and solid tiles. Patches in this section deal with both causes and effects of destruction.
Shot smashes on pole-going-through tiles
By default Keen can shoot up through ceilings and down through floors if they also have a pole going through them. This patch alters (And significantly shortens) the shot's tile interaction so that it will also smash on such tiles, preventing Keen from performing such 'pole tricks'.
Keen 4
#Keen's shots smash on pole ground
%patch $E722 $55 $8B $EC $83 $EC $02 $56 $57 $8B $7E $06
$83 $7D $36 $00 $75 $12 $83 $7D $3A $00 $75 $0C $83 $7D $38 $00
$75 $06 $83 $7D $3C $00 $74 $08 $57 $0E $E8 $FEE9W $83 $C4 $02
$FF $75 $20 $33 $C0 $50 $FF $75 $1E $FF $75 $0C $FF $75 $0A $8B
$C7 $05 $46 $00 $50 $9A $16541641RL $83 $C4 $0C $5F $5E $8B
$E5 $5D $CB
Destroyed shots can still stun
See the section 'sprite type' for this patch.
Shot spawn position relative to Keen
Depending on what action is being used when shooting and sometimes on what direction Keen is facing, Keen's shot will spawn at different positions relative to him. This is because different animations are different sizes and different appearances. A single shot position would look exceedingly awkward.
In essence the game checks every possible shooting action individually, shooting left\right, shooting up, shooting up while jumping... In the case of shooting left\right the game also checks what direction Keen is facing, as those actions have different animations for Keen facing either way, each of which needs a unique shot position and direction.
To understand the following patches it is helpful to have some knowledge of Sprite positioning and jump conditions. Note that two of the sprite positions are negative, despite having positive values. (They are reversed.) A knowledge of galaxy sprite parameters will assist in making unique patches by altering the action\direction checks to something more complex.
And of course, when in doubt, simply tweak the relevant patch until the desired result is obtained.
The following patches are given by episode, in each section of patches are subsections for each different shooting action. There are a total of 15 unique positions in the following order: Shoot left, Shoot right, Jump Shoot left, Jump Shoot right, Jump Shoot down, Jump Shoot up, Shoot up, Shoot left on poles, Shoot right on poles, Shoot up on poles, and Shoot down on poles.
Note that shot direction is also included in the position; this is actually based in the Spawn_Shot code at another location, but the upshot is that no patchable value is up, 2 is right, 4 down and 6 left. Other values will cause an error and crash. (Bad dir.)
Keen 4 shot positions
#Check direction and action - Shoot left\right
%patch $C99D $7C {$1C} [$0D6AW] {$75} $3C $83 $7C {$0E} [$01] {$75}
#Right Keen - Right 256,64
%patch $C9AA [$0002W] #Direction
%patch $C9B1 [$0040W] #Vertical position
%patch $C9B8 [$0100W] #Horizontal position
#Left Keen - Left -128,64
%patch $C9C6 [$0006W] #Direction
%patch $C9CD [$0040W] #Vertical position
%patch $C9D4 [$0080W] #Horizontal position
#Check direction and action - Shoot left\right jumping
%patch $C9E0 $7C {$1C} [$11FCW] {$75} $38 $83 $7C {$0E} [$01] {$75}
#Right Keen - Right 32,256
%patch $C9ED [$0002W] #Direction
%patch $C9F4 [$0020W] #Vertical position
%patch $C9FB [$0100W] #Horizontal position
#Left Keen - Left 32,0
%patch $CA09 [$0006W] #Direction
%patch $CA10 [$0020W] #Vertical position
#Check action - Shoot down jumping
%patch $CA1F $7C {$1C} [$12B0W] {$75}
#Keen - Down 288,128
%patch $CA26 [$0004W] #Direction
%patch $CA2D [$0120W] #Vertical position
%patch $CA34 [$0080W] #Horizontal position
#Check action - Shoot up jumping
%patch $CA40 $7C {$1C} [$1256W] {$75}
#Keen - Up 160,80
%patch $CA4D [$00A0W] #Vertical position
%patch $CA54 [$0050W] #Horizontal position
#Check action - Shoot up
%patch $CA60 $7C {$1C} [$0DA6W] {$75}
#Keen - Up 160,80
%patch $CA6D [$00A0W] #Vertical position
%patch $CA74 [$0050W] #Horizontal position
#Check direction and action - Shoot left\right on poles
%patch $CA80 $7C {$1C} [$0FE0W] {$75} $3C $83 $7C {$0E} [$01] {$75}
#Right Keen - Right 64,256
%patch $CA8D [$0002W] #Direction
%patch $CA94 [$0040W] #Vertical position
%patch $CA9B [$0100W] #Horizontal position
#Left Keen - Left 64,128
%patch $CAA9 [$0002W] #Direction
%patch $CAB0 [$0040W] #Vertical position
%patch $CAB7 [$0080W] #Horizontal position
#Check direction and action - Shoot up on poles
%patch $CAC3 $7C {$1C} [$101CW] {$75} $3A $83 $7C {$0E} [$01] {$75}
#Right Keen - Up 64,96
%patch $CAD6 [$0040W] #Vertical position
%patch $CADD [$0060W] #Horizontal position
#Left Keen - Up 64,192
%patch $CAF1 [$0040W] #Vertical position
%patch $CAF8 [$00C0W] #Horizontal position
#Check direction and action - Shoot down on poles
%patch $CB04 $7C {$1C} [$1058W] {$75} $3D $83 $7C {$0E} [$01] {$75}
#Right Keen - Down 384,96
%patch $CB11 [$0004W] #Direction
%patch $CB18 [$0180W] #Vertical position
%patch $CB1F [$0060W] #Horizontal position
#Left Keen - Down 384,192
%patch $CB2E [$0004W] #Direction
%patch $CB35 [$0180W] #Vertical position
%patch $CB3C [$00C0W] #Horizontal position
Keen 5 shot positions
#Check direction and action - Shoot left\right
%patch $BDBB $7C {$1C} [$0BEEW] {$75} $3C $83 $7C {$0E} [$01] {$75}
#Right Keen - Right 256,64
%patch $BDC8 [$0002W] #Direction
%patch $BDCF [$0040W] #Vertical position
%patch $BDD6 [$0100W] #Horizontal position
#Left Keen - Left -128,64
%patch $BDE4 [$0006W] #Direction
%patch $BDEB [$0040W] #Vertical position
%patch $BDF2 [$0080W] #Horizontal position
#Check direction and action - Shoot left\right jumping
%patch $BDFE $7C {$1C} [$10DAW] {$75} $38 $83 $7C {$0E} [$01] {$75}
#Right Keen - Right 32,256
%patch $BE0B [$0002W] #Direction
%patch $BE12 [$0020W] #Vertical position
%patch $BE19 [$0100W] #Horizontal position
#Left Keen - Left 32,0
%patch $BE27 [$0006W] #Direction
%patch $BE2E [$0020W] #Vertical position
#Check action - Shoot down jumping
%patch $BE3D $7C {$1C} [$118EW] {$75}
#Keen - Down 288,128
%patch $BE44 [$0004W] #Direction
%patch $BE4B [$0120W] #Vertical position
%patch $BE52 [$0080W] #Horizontal position
#Check action - Shoot up jumping
%patch $BE5E $7C {$1C} [$1134W] {$75}
#Keen - Up 160,80
%patch $BE6B [$00A0W] #Vertical position
%patch $BE72 [$0050W] #Horizontal position
#Check action - Shoot up
%patch $BE7E $7C {$1C} [$0C2AW] {$75}
#Keen - Up 160,80
%patch $BE8B [$00A0W] #Vertical position
%patch $BE92 [$0050W] #Horizontal position
#Check direction and action - Shoot left\right on poles
%patch $BE9E $7C {$1C} [$0EBEW] {$75} $3C $83 $7C {$0E} [$01] {$75}
#Right Keen - Right 64,256
%patch $BEAB [$0002W] #Direction
%patch $BEB2 [$0040W] #Vertical position
%patch $BEB9 [$0100W] #Horizontal position
#Left Keen - Left 64,128
%patch $BEC7 [$0002W] #Direction
%patch $BECE [$0040W] #Vertical position
%patch $BED5 [$0080W] #Horizontal position
#Check direction and action - Shoot up on poles
%patch $BEE1 $7C {$1C} [$0EFAW] {$75} $3A $83 $7C {$0E} [$01] {$75}
#Right Keen - Up 64,96
%patch $BEF4 [$0040W] #Vertical position
%patch $BEFB [$0060W] #Horizontal position
#Left Keen - Up 64,192
%patch $BF0F [$0040W] #Vertical position
%patch $BF16 [$00C0W] #Horizontal position
#Check direction and action - Shoot down on poles
%patch $BF22 $7C {$1C} [$0F36W] {$75} $3D $83 $7C {$0E} [$01] {$75}
#Right Keen - Down 384,96
%patch $BF2F [$0004W] #Direction
%patch $BF36 [$0180W] #Vertical position
%patch $BF3D [$0060W] #Horizontal position
#Left Keen - Down 384,192
%patch $BF4C [$0004W] #Direction
%patch $BF53 [$0180W] #Vertical position
%patch $BF5A [$00C0W] #Horizontal position
Keen 6 shot positions
#Check direction and action - Shoot left\right
%patch $BB9E $7C {$1C} [$0BE2W] {$75} $3C $83 $7C {$0E} [$01] {$75}
#Right Keen - Right 256,64
%patch $BBAB [$0002W] #Direction
%patch $BBB2 [$0040W] #Vertical position
%patch $BBB9 [$0100W] #Horizontal position
#Left Keen - Left -128,64
%patch $BBC7 [$0006W] #Direction
%patch $BBCE [$0040W] #Vertical position
%patch $BBD5 [$0080W] #Horizontal position
#Check direction and action - Shoot left\right jumping
%patch $BBE1 $7C {$1C} [$1074W] {$75} $38 $83 $7C {$0E} [$01] {$75}
#Right Keen - Right 32,256
%patch $BBEE [$0002W] #Direction
%patch $BBF5 [$0020W] #Vertical position
%patch $BBFC [$0100W] #Horizontal position
#Left Keen - Left 32,0
%patch $BC0A [$0006W] #Direction
%patch $BC11 [$0020W] #Vertical position
#Check action - Shoot down jumping
%patch $BC20 $7C {$1C} [$1128W] {$75}
#Right Keen - Down 288,128
%patch $BC27 [$0004W] #Direction
%patch $BC2E [$0120W] #Vertical position
%patch $BC35 [$0080W] #Horizontal position
#Check action - Shoot up jumping
%patch $BC41 $7C {$1C} [$10CEW] {$75}
#Keen - Up 160,80
%patch $BC4E [$00A0W] #Vertical position
%patch $BC55 [$0050W] #Horizontal position
#Check action - Shoot up
%patch $BC61 $7C {$1C} [$0C1EW] {$75}
#Keen - Up 160,80
%patch $BC6E [$00A0W] #Vertical position
%patch $BC75 [$0050W] #Horizontal position
#Check direction and action - Shoot left\right on poles
%patch $BC81 $7C {$1C} [$0E58W] {$75} $3C $83 $7C {$0E} [$01] {$75}
#Right Keen - Right 64,256
%patch $BC8E [$0002W] #Direction
%patch $BC95 [$0040W] #Vertical position
%patch $BC9C [$0100W] #Horizontal position
#Left Keen - Left 64,128
%patch $BCAA [$0002W] #Direction
%patch $BCB1 [$0040W] #Vertical position
%patch $BCB8 [$0080W] #Horizontal position
#Check direction and action - Shoot up on poles
%patch $BCC4 $7C {$1C} [$0E94W] {$75} $3A $83 $7C {$0E} [$01] {$75}
#Right Keen - Up 64,96
%patch $BCD7 [$0040W] #Vertical position
%patch $BCDE [$0060W] #Horizontal position
#Left Keen - Up 64,192
%patch $BCF2 [$0040W] #Vertical position
%patch $BCF9 [$00C0W] #Horizontal position
#Check direction and action - Shoot down on poles
%patch $BD05 $7C {$1C} [$0ED0W] {$75} $3D $83 $7C {$0E} [$01] {$75}
#Right Keen - Down 384,96
%patch $BD12 [$0004W] #Direction
%patch $BD19 [$0180W] #Vertical position
%patch $BD20 [$0060W] #Horizontal position
#Left Keen - Down 384,192
%patch $BD2F [$0004W] #Direction
%patch $BD36 [$0180W] #Vertical position
%patch $BD3D [$00C0W] #Horizontal position
Sprite Type
The shot's sprite type is 3, the second most important type in the game, as this is what nearly all enemies respond to when they are shot. Changing this will make most enemies indestructible. It is one of the few sprite types that really matters.
The destroyed shot's sprite type is also important; if it is 3 problems occur, and if it is the same as the moving Platform, Keen can stand on it and perform the impossible bullet trick
Keen's shot sprite type
#Keen 4
%patch $E5A5 $0003W #Shot
%patch $E63C $0001W #Changes to this when destroyed
#Keen 5
%patch $DCD4 $0003W #Shot
%patch $DD6C $0001W #Changes to this when destroyed
#Keen 6
%patch $D83F $0003W #Shot
%patch $D92B $0001W #Changes to this when destroyed
Don't change type on smashing
These patches prevent the shot from changing its type to 'misc' when it is destroyed. This means it can still stun enemies (And thus be 're-destroyed' when smashed which may lead to an infinite loop if it happens to hit an indestructible enemy.
Keen's shot sprite type doesn't change when it smashes
#Keen's shot sprite type doesn't change when it smashes -Keen 4
%patch $E63A $EB $02
#Keen's shot sprite type doesn't change when it smashes -Keen 5
%patch $DD6A $EB $02
#Keen's shot sprite type doesn't change when it smashes -Keen 6
%patch $D929 $EB $02
Sprite Actions
The shot is quite simple, it is produced by Keen when he shoots, loops constantly between four actions, and is destroyed when it hits sprites or tiles, the destroyed shot having two actions before going to nothing.
Keen 4
Actions: $1738W #Keen's bullet 1 $1756W #Keen's bullet 2 $1774W #Keen's bullet 3 $1792W #Keen's bullet 4 $17B0W #Keen's bullets zaps 1 $17CEW #Keen's bullets zaps 2
Keen 4
#Spawn shot
%patch $E614 [$1738W]
#Shot destroyed
%patch $E63F [$17B0W]
#Shot moving
%patch $305C4 [$1756W] #Keen's bullet 1
%patch $305E2 [$1774W] #Keen's bullet 2
%patch $30600 [$1792W] #Keen's bullet 3
%patch $3061E [$1738W] #Keen's bullet 4
#Smashed shot
%patch $3063C [$17CEW] #Keen's bullets zaps 1
%patch $3065A [$0000W] #Keen's bullets zaps 2
Keen 5
Actions: $1502W #Keen's shot 1 $1520W #Keen's shot 2 $153EW #Keen's shot 3 $155CW #Keen's shot 4 $157AW #Keen's shot smash 1 $1598W #Keen's shot smash 2
Keen 5
#Spawn shot
%patch $DD43 [$1502W]
#Shot moving
%patch $3185E [$1520W] #Keen's shot
%patch $3187C [$153EW] #Keen's shot
%patch $3189A [$155CW] #Keen's shot
%patch $318B8 [$1502W] #Keen's shot
#What shot becomes on colliding
%patch $DD6F [$157AW]
#Smashed shot
%patch $318D6 [$1598W] #Keen's shot smash
%patch $318F4 [$0000W] #Keen's shot smash
Keen 6
Actions: $153EW #Keen's shot 1 $155CW #Keen's shot 2 $157AW #Keen's shot 3 $1598W #Keen's shot 4 $15B6W #Keen's shot hits 1 $15D4W #Keen's shot hits 2
Keen 6
#Spawn shot
%patch $D8AE [$153EW]
#Shot destroyed
%patch $D92E [$15B6W]
#Shot moving
%patch $3228A [$155CW] #Keen's bullet 1
%patch $322A8 [$157AW] #Keen's bullet 2
%patch $322C6 [$1598W] #Keen's bullet 3
%patch $322E4 [$153EW] #Keen's bullet 4
#Smashed shot
%patch $32302 [$15D4W] #Keen's bullets zaps 1
%patch $32320 [$0000W] #Keen's bullets zaps 2
Sprite Behavior
Keen's shot's behavior is quite complex though its function remains unknown. All of the shot frames use the same behavior and the two smashed frames have no behavior.
Keen 4
#Keen's shot's behavior
%patch $305B8 $0D8F0D6ARL
%patch $305D6 $0D8F0D6ARL
%patch $305F4 $0D8F0D6ARL
%patch $30612 $0D8F0D6ARL
#Keen's shot's smash behavior
%patch $30630 $00000000L
%patch $3064E $00000000L
Keen 5
#Keen's shot's behavior
%patch $31852 $0CCB10DARL
%patch $31870 $0CCB10DARL
%patch $3188D $0CCB10DARL
%patch $318AC $0CCB10DARL
#Keen's shot's smash behavior
%patch $318CA $00000000L
%patch $318E8 $00000000L
Keen 6
#Keen's shot's behavior
%patch $3227E $0CA60EE9RL
%patch $3229C $0CA60EE9RL
%patch $322BA $0CA60EE9RL
%patch $322D8 $0CA60EE9RL
#Keen's shot's smash behavior
%patch $322F6 $00000000L
%patch $32314 $00000000L
Speed of Keen's shots
Keen's shots move via animation motion; the faster they animate the faster they move. Keen's smashed shots do not move by default but can be made to do so.
Keen 4
#Keen's bullet speeds
%patch $305B4 $0040W $0040W #Speed 1
%patch $305D2 $0040W $0040W #Speed 2
%patch $305F0 $0040W $0040W #Speed 3
%patch $3060E $0040W $0040W #Speed 4
#Smashed shot speeds
%patch $3062C $0000W $0000W #Speed 1
%patch $3064A $0000W $0000W #Speed 2
Keen 5
#Keen's bullet speeds
%patch $3184E $0040W $0040W #Speed 1
%patch $3186C $0040W $0040W #Speed 2
%patch $3188A $0040W $0040W #Speed 3
%patch $318A8 $0040W $0040W #Speed 4
#Smashed shot speeds
%patch $318C6 $0000W $0000W #Speed 1
%patch $318E4 $0000W $0000W #Speed 2
Keen 6
#Keen's bullet speeds
%patch $3227A $0040W $0040W #Speed 1
%patch $32298 $0040W $0040W #Speed 2
%patch $322B6 $0040W $0040W #Speed 3
%patch $322D4 $0040W $0040W #Speed 4
#Smashed shot speeds
%patch $322F2 $0000W $0000W #Speed 1
%patch $32310 $0000W $0000W #Speed 2
Sprite Collision
Keen's shots have no sprite collision, they affect no sprites at all, instead other sprites respond to them.
Keen 4
#Keen's shot's sprite collision
%patch $333BC $00000000L #Keen's shot
%patch $333DA $00000000L #Keen's shot
%patch $333F8 $00000000L #Keen's shot
%patch $33416 $00000000L #Keen's shot
%patch $33434 $00000000L #Keen's shot smash
%patch $33452 $00000000L #Keen's shot smash
Keen 5
#Keen's shot's sprite collision
%patch $31856 $00000000L #Keen's shot
%patch $31874 $00000000L #Keen's shot
%patch $31892 $00000000L #Keen's shot
%patch $318B0 $00000000L #Keen's shot
%patch $318CE $00000000L #Keen's shot smash
%patch $318EC $00000000L #Keen's shot smash
Keen 6
#Keen's shot's sprite collision
%patch $32282 $00000000L #Keen's shot
%patch $322A0 $00000000L #Keen's shot
%patch $322BE $00000000L #Keen's shot
%patch $322DC $00000000L #Keen's shot
%patch $322FA $00000000L #Keen's shot smash
%patch $32318 $00000000L #Keen's shot smash
Clipping and foreground
Keen's shot has the foreground value of 0, meaning it appears behind all sprites and foreground tiles. This is useful as it often needs to appear behind Keen or tiles when produced or destroyed.
Keen 4
#Foreground value
%patch $E5A1 $0000W
Keen 5
#Foreground value
%patch $DCD0 $0000W
Keen 6
#Foreground value
%patch $D83B $0000W
Shot Activity
The shot must be active when offscreen, so it specifically has its activity variable set to 2. If it is any other value the shots will stop moving when Keen cannot see them, meaning that they are much, much harder to use. (Keen will often find himself running into shots that went offscreen and froze, only to reactivate later.)
Keen 4
#Shot activity variable
%patch $E5AA $0002W
Keen 5
#Shot activity variable
%patch $DCD9 $0002W
Keen 6
#Shot activity variable
%patch $D844 $0002W
Sounds
There is only one sound used for Keen shooting, which can be easily blocked. Keen's shot also makes a sound when destroyed.
Keen 4
#Keen shoots sound
%patch $E5AD $04
#Don't play Keen shoots sound
%patch $E5AC $EB $0A
#Keen's shot smashes sound
%patch $E64C $19
#Don't play Keen's shot smashes sound
%patch $E64B $EB $0A
Keen 5
#Keen shoot sound
%patch $DCDC $04
#Don't play Keen shoot sound
%patch $DCDB $EB $0A
#Keen's shot smashes sound
%patch $DD7C $19
#Don't play Keen's shot smashes sound
%patch $DD7B $EB $0A
Keen 6
#Keen shoot sound
%patch $D847 $04
#Don't play Keen shoot sound
%patch $D846 $EB $0A
#Keen's shot smashes sound
%patch $D93B $19
#Don't play Keen's shot smashes sound
%patch $D93A $EB $0A
Animations
The animation speed of Keen's shots also controls their speed. (See speed section.) The animation speed of the smashed shot controls how long it takes before it vanishes.
Keen 4
#Keen's shot
%patch $305A8 $00AEW $00AEW
%patch $305B2 $0006W #Animation speed
%patch $305C6 $00AFW $00AFW
%patch $305D0 $0006W #Animation speed
%patch $305E4 $00B0W $00B0W
%patch $305EE $0006W #Animation speed
%patch $30602 $00B1W $00B1W
%patch $3060C $0006W #Animation speed
#Keen's shot smash
%patch $30620 $00B2W $00B2W
%patch $3062A $000CW #Animation speed
%patch $3063E $00B3W $00B3W
%patch $30648 $000CW #Animation speed
Keen 5
#Keen's shot
%patch $31842 $0099W $0099W
%patch $3184C $0006W #Animation speed
%patch $31860 $009AW $009AW
%patch $3186A $0006W #Animation speed
%patch $3187E $009BW $009BW
%patch $31888 $0006W #Animation speed
%patch $3189C $009CW $009CW
%patch $318A6 $0006W #Animation speed
#Keen's shot smash
%patch $318BA $009DW $009DW
%patch $318C4 $000CW #Animation speed
%patch $318D8 $009EW $009EW
%patch $318E2 $000CW #Animation speed
Keen 6
#Keen's shot
%patch $3226E $0060W $0060W
%patch $32278 $0006W #Animation speed
%patch $3228C $0061W $0061W
%patch $32296 $0006W #Animation speed
%patch $322AA $0062W $0062W
%patch $322B4 $0006W #Animation speed
%patch $322C8 $0063W $0063W
%patch $322D2 $0006W #Animation speed
#Keen's shot smash
%patch $322E6 $0064W $0064W
%patch $322F0 $000CW #Animation speed
%patch $32304 $0065W $0065W
%patch $3230E $000CW #Animation speed
Sprite-tile interaction
There are two tile interactions used by Keen's shots in each game. The first is used by Keen's shot itself. This makes it smash on solid tiles and slopes as well as having other, unknown, functions. The second simply draws the sprite, this is used by the smashed shot since it no longer needs to interact with tiles.
Keen 4
Keen 4: $0D8F0E32RL #Keen's shot (Hit walls, floors, ceilings and go zap.) $09DC176ERL #Draw sprite
Keen 4
#Keen's shot
%patch $305C0 $0D8F0E32RL
%patch $305DE $0D8F0E32RL
%patch $305FC $0D8F0E32RL
%patch $3061A $0D8F0E32RL
#Keen's shot smash
%patch $30638 $09DC176ERL
%patch $30656 $09DC176ERL
Keen 5
Keen 5: $0CCB11A2RL #Keen's shot (Hit walls, floors, ceilings and go zap.) $090B17B5RL #Draw sprite
Keen 5
#Keen's shot
%patch $3185A $0CCB11A2RL
%patch $31878 $0CCB11A2RL
%patch $31896 $0CCB11A2RL
%patch $318B4 $0CCB11A2RL
#Keen's shot smash
%patch $318D2 $090B17B5RL
%patch $318F0 $090B17B5RL
Keen 6
Keen 6: $0CA60FB1RL #Keen's shot (Hit walls, floors, ceilings and go zap.) $08F4180ARL #Draw sprite
Keen 6
#Keen's shot
%patch $32286 $0CA60FB1RL
%patch $322A4 $0CA60FB1RL
%patch $322C2 $0CA60FB1RL
%patch $322E0 $0CA60FB1RL
#Keen's shot smash
%patch $322FE $08F4180ARL
%patch $3231C $08F4180ARL
Action type
Keen's shot uses type 1 for its actions allowing sooth movement through the air. The smashed shot uses type 0 as it doesn't need to move.
Keen 4
#Keen's shot
%patch $305AC [$0001W]
%patch $305CA [$0001W]
%patch $305E8 [$0001W]
%patch $30606 [$0001W]
#Keen's shot smash
%patch $30624 [$0000W]
%patch $30642 [$0000W]
Keen 5
#Keen's shot
%patch $31846 [$0001W]
%patch $31864 [$0001W]
%patch $31882 [$0001W]
%patch $318A0 [$0001W]
#Keen's shot smash
%patch $318BE [$0000W]
%patch $318DC [$0000W]
Keen 6
#Keen's shot
%patch $32272 [$0001W]
%patch $32290 [$0001W]
%patch $322AE [$0001W]
%patch $322CC [$0001W]
#Keen's shot smash
%patch $322EA [$0000W]
%patch $32308 [$0000W]
Deprotect and stick to ground
Keen's shot has no need for either of these variables and so has a value of 0 for both in all its actions. If its 'stick to ground' value is changed to 1 then Keen's shots can climb slopes.
Keen 4
#Keen's shot
%patch $305AE [$0000W $0000W]
%patch $305CC [$0000W $0000W]
%patch $305EA [$0000W $0000W]
%patch $30608 [$0000W $0000W]
#Keen's shot smash
%patch $30626 [$0000W $0000W]
%patch $30644 [$0000W $0000W]
Keen 5
#Keen's shot
%patch $31848 [$0000W $0000W]
%patch $31866 [$0000W $0000W]
%patch $31884 [$0000W $0000W]
%patch $318A2 [$0000W $0000W]
#Keen's shot smash
%patch $318C0 [$0000W $0000W]
%patch $318DE [$0000W $0000W]
Keen 6
#Keen's shot
%patch $32274 [$0001W $0000W]
%patch $32292 [$0001W $0000W]
%patch $322B0 [$0001W $0000W]
%patch $322CE [$0001W $0000W]
#Keen's shot smash
%patch $322EC [$0000W $0000W]
%patch $3230A [$0000W $0000W]
Shot destroyed code
The destruction of Keen's shot is trigger by both sprites and tiles. (It is called as $0D8F0D43RL.) It does three things; the first is to change the shot's sprite type to 1, or 'Misc' so it doesn't interfere with anything else. Next it changes the shot's action to $17B0W, so the shot stops and vanishes, finally it plays sound $19. Two of these things can be removed, singularly or in combination.
Keen 4
#Complete Keen's shot smashes code
%patch $E633 $55 $8B $EC $56 $8B $76 $06 $C7 $04 [$0001W] $B8 [$17B0W] $50 $56
$9A $09DC120ARL $83 $C4 $04 $B8 [$0019W] $50 $9A $187409F1RL
$83 $C4 $02 $5E $5D $CB
Keen 5
#Complete Keen's shot smashes code
%patch $DD63 $55 $8B $EC $56 $8B $76 $06 $C7 $04 [$0001W] $B8 [$157AW] $50 $56
$9A $090B1242RL $83 $C4 $04 $B8 [$0019W] $50 $9A $196E09EFRL
$83 $C4 $02 $5E $5D $CB
No sound when shot destroyed
If the sound is removed, little else changes.
Keen 4
#Keen's shot smashes code - no sound
%patch $E633 $55 $8B $EC $56 $8B $76 $06 $C7 $04 [$0001W] $B8 [$17B0W] $50 $56
$9A $09DC120ARL $83 $C4 $04 $5E $5D $CB
Keen 5
#Keen's shot smashes code - no sound
%patch $DD63 $55 $8B $EC $56 $8B $76 $06 $C7 $04 [$0001W] $B8 [$157AW] $50 $56
$9A $090B1242RL $83 $C4 $04 $5E $5D $CB
Don't destroy shot on collision
With the 'change action' code removed the Shot will keep on moving, this can cause problems when it hits tiles, as this will not longer destroy the shot. Another patch should be added to remove the shot in some way.
Keen 4
#Keen's shot smashes code - no shot destruction
%patch $E633 $55 $8B $EC $56 $8B $76 $06 $C7 $04 [$0001W] $B8 [$0019W] $50 $9A
$187409F1RL $83 $C4 $02 $5E $5D $CB
Keen 5
#Complete Keen's shot smashes code
%patch $DD63 $55 $8B $EC $56 $8B $76 $06 $C7 $04 [$0001W] $B8 [$0019W] $50 $9A
$196E09EFRL $83 $C4 $02 $5E $5D $CB
Misc
Patches in this section do not fit neatly into the above sections.
Keen can teleport to where his shots smash near [B] sprites
This patch will teleport Keen to wherever his shot smashes IF that shot is on a [B] sprite when it does so. (You can have as many [B] sprites in a level as you want.) The [B] sprite must be *outside* the solid tile that causes the shot smash (So for floors above the floor, ceilings below the ceiling, left of left walls and right of right walls.) Keen's head will appear where the shot zap was (This can be adjusted by altering $2D $0000W, larger moves Keen down, negative moves Keen up.) and trying to teleport to another place before the 'old' (invisible!) teleport target has vanished will cause him to return to the old target. If for some odd reason the target vanishes before Keen can teleport he will 'teleport' to the same place he's standing. Keen can teleport off of poles with no problems. (Keen can also teleport after being killed, this will save him.)
The screen will not move instantly to where Keen is at, instead it will 'slide' from his old position to his current one. During this slide Keen can move, die, etc. The screen cannot 'slide' past scrollbars so Keen can teleport to an area offscreen and stay offscreen. [B] sprites will not affect Keen's shots moving through the air, only those that have hit tiles.
This patch uses the EGAGRAPH check skip which is the first line of the patch. it is thus incompatible with any other patches using this. it also utilizes some space for the new actions used which may also cause problems with other patches.
Keen 4
#Disable EGAGRAPH check in Keen 4 (Frees 389 bytes at $3CF6)
%patch $3CE5 $90 $90
#Custom behavior: Force Keen to search = $037D0526RL
%patch $3CF6 $55 $8B $EC $56 $57 $8B $76 $06 $8B $7E $08
$9A $037D053ARL $5F $5E $5D $CB
#Custom player effect: goto searching Keen = $037D053ARL
%patch $3D0A $55 $8B $EC $8B $1E $A7D6W $81 $7F $1C $D4 $0C $74 $19 $C7 $47 #Set clipping = 1
{$06} [$0001W] $B8 [$015BW] $50 $FF $36 $D6 $A7 $9A $09DC120ARL #Turn Keen into searching
$83 $C4 $04 $8B $1E $A7D6W $5D $CB
#Player search for target sprite behavior = $037D0563RL
%patch $3D33 $55 $8B $EC $56 $57 $8B $7E $06 $C7 $45 $3E $0000W $8B $1E $D6
$A7 $8B $77 $48 $EB $28 $83 $3C [$22] $75 $20 $8B $44 $0A $2D [$0000W] #Keen's teleport height
$89 $45 $0A $8B $44 $0C $89 $45 $0C $B8 $11A2W $50 $57 $9A
$09DC118CRL $83 $C4 $04 $5F $5E $5D $CB
$8B $74 $48 $0B $F6
$75 $D4 $57 $9A $06BD1E8BRL $83 $C4 $02 $5F $5E $5D $CB
#Shot smash behavior = $037D05B2RL
%patch $3D82 $55 $8B $EC $83 $EC $04 $56 $57 $8B $7E $06 $8B $45 $0E $BA $0000W
$F7 $EA $F7 $2E $4C $A5 $A3 $23 $C9 $8B $45 $10 $BA $0000W
$F7 $EA $F7 $2E $4C $A5 $A3 $21 $C9 $8B $45 $26 $03 $06 $23 $C9
$89 $46 $FE $B1 $08 $D3 $E8 $89 $46 $FC $8B $5D $2E $D1 $E3 $8B
$9F $25 $C9 $D1 $EB $D1 $E3 $8E $06 $EB $A7 $8B $46 $FC $D1 $E0
$03 $D8 $26 $83 $3F $1F $75 $07 $C7 $45 $1C [$011FW] $EB $05 $C7
$45 $1C [$0000W] $8B $46 $FE $25 $FF $00 $8B $16 $23 $C9 $2B $D0
$89 $16 $23 $C9 $5F $5E $8B $E5 $5D $CB
#Adjust destroyed shot type to target type
%patch $E63C [$0022W]
#Tweak Keen's shot smash so that it spends time as an invisible target sprite
%patch $3063E $00B3W $00B3W $0000W $0000W $0000W $000CW $0000W $0000W #Check for [B]
$037D05B2RL $00000000L $09DC176ERL $0000W
%patch $2EF8F $00B3W $00B3W $0000W $0000W $0000W $0004W $0000W $0000W #Force player search
$037D0526RL $00000000L $09DC176ERL $013DW
%patch $2EFAD $FFFFW $FFFFW $0000W $0000W $0000W $00A0W $0000W $0000W #Invisible target
$00000000L $00000000L $09DC176ERL $0000W
#Keen searching action = $015BW
%patch $2EFCB $008AW $0082W $0000W $0000W $0000W $0004W $0000W $0000W
$037D0563RL $0B8014A9RL $09DC176ERL $098CW
Keen can teleport to where his shots smash anywhere
This patch works identically to the above except that it does not matter how Keen's shots smash. Whether they collide with any tile or an enemy Keen will teleport to them.
Keen 4
#Disable EGAGRAPH check in Keen 4 (Frees 389 bytes at $3CF6)
%patch $3CE5 $90 $90
#Custom behavior: Kill Keen = $037D0526RL
%patch $3CF6 $55 $8B $EC $56 $57 $8B $76 $06 $8B $7E $08
$9A $037D053ARL $5F $5E $5D $CB
#Custom player effect: goto searching Keen = $037D053ARL
%patch $3D0A $55 $8B $EC $8B $1E $A7D6W $81 $7F $1C $D4 $0C $74 $19 $C7 $47 #Set clip = 0
{$06} [$0001W] $B8 [$013DW] $50 $FF $36 $D6 $A7 $9A $09DC120ARL #Turn Keen into searching
$83 $C4 $04 $8B $1E $A7D6W $5D $CB
#Player search for target sprite behavior = $037D0563RL
%patch $3D33 $55 $8B $EC $56 $57 $8B $7E $06 $C7 $45 $3E $0000W $8B $1E $D6
$A7 $8B $77 $48 $EB $28 $83 $3C [$22] $75 $20 $8B $44 $0A $2D [$0000W]
$89 $45 $0A $8B $44 $0C $89 $45 $0C $B8 $11A2W $50 $57 $9A
$09DC118CRL $83 $C4 $04 $5F $5E $5D $CB
$8B $74 $48 $0B $F6
$75 $D4 $57 $9A $06BD1E8BRL $83 $C4 $02 $5F $5E $5D $CB
#Adjust destroyed shot type to target type
%patch $E63C [$0022W]
#Tweak Keen's shot smash so that it spends time as an invisible target sprite
%patch $3063E $00B3W $00B3W $0000W $0000W $0000W $000CW $0000W $0000W #Player search
$037D0526RL $00000000L $09DC176ERL $011FW
%patch $2EF8F $FFFFW $FFFFW $0000W $0000W $0000W $00A0W $0000W $0000W #Invisible target
$00000000L $00000000L $09DC176ERL $0000W
#Keen searching action = $013DW
%patch $2EFAD $008AW $0082W $0000W $0000W $0000W $0004W $0000W $0000W
$037D0563RL $0B8014A9RL $09DC176ERL $098CW