Patch:Keen (Keen 5)

From KeenWiki
Jump to: navigation, search

This page contains patches relating to Keen as a sprite in Keen 5. That is, such things as the sprites used, the speeds and sounds. It does not cover patches relating to gameplay such as those that make levels scroll or change keys. Those can be found at Patch:Gameplay (Keen Galaxy). It is divided into sections relating to the various sprite properties the patches involved. Being fluent with various sprite patch pages will help when working with these patches.

As little is known about Keen, there is less information here than for most sprites.

Keen behaviors with their own pages

The following pages have been created for specific Keen actions that have a significant number of patches, necessitating them being kept separate for clarity:

Sprite Actions

This is a complete list of Keen's actions, both in-level and on the map. t provides links to some pages that discuss specific actions in further detail but a discussion of all of Keen's actions is too complex to host on this page.

$0888W #Keen standing
$08A6W #Keen on Platforms
$08C4W #Keen looks up (Bored)
$08E2W #Keen shrugs 1 (Bored more)
$0900W #Keen shrugs 2
$091EW #Keen shrugs 3
$093CW #Keen shrugs 4
$095AW #Keen shrugs 5
$0978W #Keen shrugs 6
$0996W #Keen starts reading book 1
$09B4W #Keen starts reading book 2
$09D2W #Keen starts reading book 3
$09F0W #Keen starts reading book 4
$0A0EW #Keen reads book 1
$0A2CW #Keen reads book 2
$0A4AW #Keen reads book 3
$0A68W #Keen stops reading book 1
$0A86W #Keen stops reading book 2
$0AA4W #Keen stops reading book 3
$0AC2W #Keen looking up
$0AE0W #Keen keep looking up
$0AFEW #Keen looks down start
$0B1CW #Keen looks down
$0B3AW #Keen keep looking down
$0B58W #Keen stops looking down
$0B76W #Keen stops looking down start (Screen has moved)
$0B94W #Defunct dead action
$0BB2W #Keen dies sprawled (Restarts level if offscreen.)
$0BD0W #Keen dies clutched (Restarts level if offscreen.)
$0BEEW #Keen shooting horizontally start
$0C0CW #Keen shooting horizontally
$0C2AW #Keen shooting up start
$0C48W #Keen shooting up
$0C66W #Keen flicking switches
$0C84W #Keen flicking switches
$0CA2W #Keen places gem
$0CC0W #Keen start interaction with gem holders/ walk-in doors
$0CDEW #Keen walks into doors
$0CFCW #Keen walks into doors
$0D1AW #Keen walks into doors
$0D38W #Keen walks into doors
$0D56W #Keen walks into doors
$0D74W #Keen walks into doors
$0D92W #Keen walks into doors
$0DB0W #Keen walks into doors
$0DCEW #Keen still on a pole
$0DECW #Keen going up a pole
$0E0AW #Keen going up a pole
$0E28W #Keen going up a pole
$0E46W #Keen going down a pole
$0E64W #Keen going down a pole
$0E82W #Keen going down a pole
$0EA0W #Keen going down a pole
$0EBEW #Keen shooting horizontally on a pole start
$0EDCW #Keen shooting horizontally on a pole
$0EFAW #Keen shoots up on pole start
$0F18W #Keen shoots up on pole
$0F36W #Keen shooting down on a pole start
$0F54W #Keen shooting down on a pole
$0F72W #Keen walking
$0F90W #Keen walking
$0FAEW #Keen walking
$0FCCW #Keen walking
$0FEAW #Keen start pogoing
$1008W #Keen pogoing
$1026W #Keen pogoing
$1044W #Keen jumping 1
$1062W #Keen jumping 2
$1080W #Keen falling 1
$109EW #Keen falling 2
$10BCW #Keen shoot horizontally in air start
$10DAW #Keen shoot horizontally in air (Make shot)
$10F8W #Keen shoot horizontally in air
$1116W #Keen shoot up in air start
$1134W #Keen shoot up in air (Make shot)
$1152W #Keen shoot up in air
$1170W #Keen shoot down in air start
$118EW #Keen shoot down in air (Make shot)
$11ACW #Keen shoot down in air
$11CAW #Keen gripping ledge start
$11E8W #Keen gripping ledge
$1206W #Keen pulls himself up from ledgegripping 1
$1224W #Keen pulls himself up from ledgegripping 2
$1242W #Keen pulls himself up from ledgegripping 3
$1260W #Keen pulls himself up from ledgegripping 4
$127EW #Keen stands back up
$137AW #Map Keen standing (clear walking animations)
$1398W #Map Keen wait (Maintain existing animation until keypress)
$13B6W #Map Keen wave 1
$13D4W #Map Keen wave 2
$13F2W #Map Keen wave 3
$1410W #Map Keen wave 4
$142EW #Map Keen wave 5
$144CW #Map Keen moving

Impossible bullet in Keen 5

This patch allows Keen to perform the impossible bullet glitch in Keen 5. Note that Keen will take his platform stance when performing this trick, which looks even more unusual than in Keen 6. It works by making Keen's shot acquire the Platform sprite property when it hits tiles.

Patch: Keen 4
#Keen can 'impossible bullet' in Keen 5
%patch $DD6C $0006W

Sprite Collision

Keen has several sprite collisions used in a variety of circumstances. As such this section does not list the collision values of Keen's actions but instead deals with the more general collision codes.

For patches that affect what collision a specific action uses, see that action's page. (For example Patch:Keen on poles.)

Collision 1 code

This collision, often known as KeenSpriteCollision is used under a variety of circumstances. Keen uses this collision when doing such things as being bored, looking up or down and mooning the player. The collision is exceedingly complex and is notable for using a pointer list that is utterly pointless.

The first section is the 'hub' separating the two basic sprite types Keen reacts to. The first is platforms (Type 6) and the second items (Type 5). Interestingly though the item jump is last, its code is section 2.

The second, largest, section deals with the various kinds of items Keen encounters. The first part deals with how many kinds of items there are; it skips the item code if an item's 'kind' is larger than 12 (Giving a total of 13 different types of item.) It calls a list at $C155 ($AAF0 + $1665W) which in this case is a trivial list pointing to $C0B2 ($AAF0 + $15C2W).

What is done to all item sprites is covered right after the list setup (Line 3 and onwards). First a 'got item' sound is played based on the list located at $30340 + $12BAW = $315FA. Then the sprite's sprite type is set to 1, the 'misc sprite' type. Then its foreground variable is set to 3 so it appears in front of all tiles. (So the player can see all the items they get.) After this the sprite's animation changes based on the 'got item animation list' at $30340 + $12EE = $3162E and the player's score increases by an amount given in the list located at $30340 + $12D4 = $31614. This is the same basic code for all items.

After this code more specific to various types of items is run. On line 6 a check is made for the keygems which adds a gem to the player's gem counter (The first counter is shown, depending on gem this or the next three counters will be affected.) After this a check is made for the 1UP item type which increases the player's life counter by 1. Following that is the ammo type check which increases the player's ammo counter ($6F6CW) by an amount that depends on the difficulty ($6F56W) using a list of values found at dataseg $12B2W. Finally there is a check for the V card item, which if contacted sets the card variable to 1. Following this the last thing done is for the sprite's action to be changed to that of the got item.

The third section deals with platforms. Platforms have no effect if an unknown variable is 0 but otherwise allow Keen to stand on them.

Patch: Keen Collision 1 code
#Keen sprite collision: First section, jumps
%patch $C087 $55 $8B $EC $56 $8B $76 $08 $8B $04 $3D $0005W $74 $0B $3D $0006W $75 $03 $E9 $009EW $5E $5D $CB
#Second section, items
$8B $5C $3E $83 $FB $0C $76 $03 $E9 $00A6W $D1 $E3 $2E $FF $A7 $1665W $8B $5C $3E $D1 $E3 $FF $B7 $12BAW $9A $196E09EFRL $83 $C4 $02 $C7 $04 $0001W $C7 $44 $20 $0003W $8B $5C $3E $D1 $E3 $8B $87 $12EEW $89 $44 $1E $8B $5C $3E $D1 $E3 $FF $B7 $12D4W $9A $06B91EAERL $83 $C4 $02 $83 $7C $3E $04 $7D $0B $8B $5C $3E $D1 $E3 $FF $87 $6F60W $EB $2E $83 $7C $3E $0A $75 $06 $FF $06 $6F6AW $EB $22 $83 $7C $3E $0B $75 $10 $8B $1E $6F6CW $D1 $E3 $8B $87 $12B2W $01 $06 $6F56W $EB $0C $83 $7C $3E $0C $75 $06 $C7 $06 $6F5AW $0001W $B8 $19BEW $50 $56 $9A $090B1242RL $83 $C4 $04 $5E $5D $CB $5E $5D $CB
#Third section, Platforms
$83 $3E $6F6EW $00 $75 $0F $56 $FF $76 $06 $9A $090B0D6BRL $83 $C4 $04 $5E $5D $CB $5E $5D $CB
#Pointless Keen-item collision list
%patch $C155 $15C2W
#Red Gem (At $C0B2)
%patch $C157 $15C2W
#Yellow Gem (At $C0B2)
%patch $C159 $15C2W
#Blue Gem (At $C0B2)
%patch $C15B $15C2W
#Green Gem (At $C0B2)
%patch $C15D $15C2W
#100 points (At $C0B2)
%patch $C15F $15C2W
#200 points (At $C0B2)
%patch $C161 $15C2W
#500 points (At $C0B2)
%patch $C163 $15C2W
#1000 points (At $C0B2)
%patch $C165 $15C2W
#2000 points (At $C0B2)
%patch $C167 $15C2W
#5000 points (At $C0B2)
%patch $C169 $15C2W
#1UP (At $C0B2)
%patch $C16B $15C2W
#Ammo (At $C0B2)
%patch $C16D $15C2W
#V card (At $C0B2)

Collision 2 code

This collision, often known as KeenOnPolesSpriteCollision is actually used under a variety of circumstances. Keen uses this collision when looking up or down, climbing poles and gripping ledges. The collision is far simpler than the first sprite collision, ignoring many sprite types. Unlike Keen's first sprite collision it doesn't use a pointer list.

The first thing checked for is sprites of type 6, Moving Platforms. If this type is found then the code jumps the next two checks and goes to line 3. The next two checks check for types $0E and $17; types that push Keen around. (The Little Ampton and Korath respectively.) If found then the code jumps to the second section, otherwise the collision ends.

The second section, starting on line 3, is the 'platform section' Keen's clipping is set to 1 and he is knocked back to his standing or falling action depending on whether he is in the air or not. $090B0D6BRL 'Push Keen vertically' is also run so that Keen will be picked up by a passing Platform.

The last section deals with Keen being pushed about by Koraths and Amptons; it is similar to the code dealing with Platforms except Keen's foreground variable is set to 1 and 'Push Keen vertically' is not run.

Patch: Keen Collision 2 code
#Keen sprite collision code:
%patch $C16F $55 $8B $EC $56 $57 $8B $76 $06 $8B $7E $08 $8B $05 $3D $0006W $74 $0E $3D $000EW $74 $34 $3D $0017W $74 $2F $5F $5E $5D $CB $C7 $44 $06 $0001W $B8 $1080W $50 $56 $9A $090B1242RL $83 $C4 $04 $33 $C0 $89 $44 $18 $89 $44 $16 $A3 $C181W $57 $56 $9A $090B0D6BRL $83 $C4 $04 $5F $5E $5D $CB $C7 $44 $20 $0001W $C7 $44 $06 $0001W $B8 $1080W $50 $56 $9A $090B1242RL $83 $C4 $04 $33 $C0 $89 $44 $18 $89 $44 $16 $A3 $C181W $5F $5E $5D $CB

Sprite-tile interaction

The player's tile interaction, the game tile code is not in fact part of Keen's tile interaction. Instead it is run by the designated player sprite whatever its current tile interaction may be. Keen in fact has several tile interactions depending on what he is doing.

Move switches one tile down

This patch for Keen 5 moves switches one tile down; that is, instead of working at the height of Keen's head they are located by his feet. (Unless Keen is made taller than 2 tiles.) However the patch is not 'complete'; only the animation is moved down, a switch tile is still required at Keen's head height (One tile above where the tile will animate.) However if this tile is made invisible and nonanimating, it will at least appear that the switch has been moved down a tile.

Patch: Keen 5
#Move switches one tile down (Almost)
%patch $B4AA $C8 $0016W $00 $56 $57 $8B $5E $06 $8B $5F $2E $43 $53 %patch $B51D $59 $B8 $0001W $50 $50 $8B $5E $06 $51 $90