Patch:Keen (Keen 6)

From KeenWiki
Jump to: navigation, search

This page contains patches relating to Keen as a sprite in Keen 6. 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. Specific actions may be detailed further on other pages, but this is a resource for those pages.

Actions:
$089AW  #Keen standing
$08B8W  #Keen look up (Bored)
$08D6W  #Keen bored, hands on hips, looks at player
$08F4W  #Keen hands on hips, blinks
$0912W  #Keen hands on hips, looks at player 2
$0930W  #Keen hands on hips, blinks 2
$094EW  #Keen hands on hips, looks at player 3
$096CW  #Keen shrugs
$098AW  #Keen gets out book 1
$09A8W  #Keen gets out book 2
$09C6W  #Keen gets out book 3
$09E4W  #Keen gets out book 4
$0A02W  #Keen reads book
$0A20W  #Keen bored, looks up from book 1
$0A3EW  #Keen bored, looks up from book 2
$0A5CW  #Keen stops reading book 1
$0A7AW  #Keen stops reading book 2
$0A98W  #Keen stops reading book 3
$0AB6W  #Keen looks up
$0AD4W  #Keen looks up (Screen moves)
$0AF2W  #Keen looking down
$0B10W  #Keen looks down (Screen moves)
$0B2EW  #Keen stops looking down
$0B4CW  #Keen stops looking down
$0B6AW  #Keen stops looking up/down (Screen moves back)
$0B88W  #Defunct dead action
$0BA6W  #Keen dies clutched (Exits level if offscreen.)
$0BC4W  #Keen dies sprawled (Exits level if offscreen.)
$0BE2W  #Keen shoots horizontally 1
$0C00W  #Keen shoots horizontally 2
$0C1EW  #Keen shoots up 1
$0C3CW  #Keen shoots up 2
$0C5AW  #Keen places gem
$0C78W  #Keen places gem
$0C96W  #Keen places gem and opens door
$0CB4W  #Keen walks into doors
$0CD2W  #Keen walks into doors
$0CF0W  #Keen walks into doors
$0D0EW  #Keen walks into doors
$0D2CW  #Keen walks into doors
$0D4AW  #Keen walks into doors
$0D68W  #Keen sit on a pole
$0D86W  #Keen moving up a pole
$0DA4W  #Keen moving up a pole
$0DC2W  #Keen moving up a pole
$0DE0W  #Keen moving down a pole
$0DFEW  #Keen moving down a pole
$0E1CW  #Keen moving down a pole
$0E3AW  #Keen moving down a pole
$0E58W  #Keen shoot horizontally on a pole 1
$0E76W  #Keen shoot horizontally on a pole 2
$0E94W  #Keen shoot up on a pole 1
$0EB2W  #Keen shoot up on a pole 2
$0ED0W  #Keen shoot down on a pole 1
$0EEEW  #Keen shoot down on a pole 2
$0F0CW  #Keen walking 1
$0F2AW  #Keen walking 2
$0F48W  #Keen walking 3
$0F66W  #Keen walking 4
$0F84W  #Keen starts pogoing
$0FA2W  #Keen pogoing
$0FC0W  #Keen pogoing hits ground
$0FDEW  #Keen jumping 1
$0FFCW  #Keen jumping 2
$101AW  #Keen falling 1
$1038W  #Keen falling 2
$1056W  #Keen shoots horizontally in air 1
$1074W  #Keen shoots horizontally in air 2
$1092W  #Keen shoots horizontally in air 3
$10B0W  #Keen shoots up in air 1
$10CEW  #Keen shoots up in air 2
$10ECW  #Keen shoots up in air 3
$110AW  #Keen shoots down in air 1
$1128W  #Keen shoots down in air 2
$1146W  #Keen shoots down in air 3
$1164W  #Keen gripping ledge start
$1182W  #Keen gripping ledge
$11A0W  #Keen pulls himself up from ledges
$11BEW  #Keen pulls himself up from ledges
$11DCW  #Keen pulls himself up from ledges
$11FAW  #Keen pulls himself up from ledges
$1218W  #Keen standing after ledgegrip
$130AW  #Map Keen stand
$1328W  #Map Keen waves
$1346W  #Map Keen waves
$1364W  #Map Keen waves
$1382W  #Map Keen waves
$13A0W  #Map Keen waves
$13BEW  #Map Keen moving


Sprite collision

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 deals with 'exceptional' sprite types. On the first line the Keen's shot's sprite type is checked for; this causes the 'impossible bullet' bug by jumping to $BF1F. If not then the following checks are made; Items followed by Platforms. These checks cause the game to jump to $BE90 (Items) and $BF3B (Platforms), which are covered later.

The second section starts at $BE90 and deals with the item sprite type (Type 5) This section first calls the pointless list at the end of the code. The list is 12 items long located at $AA20 + $1534 = $BF54. All items do the same thing (At $BEA2) regardless of what item kind they are which renders the list pointless.

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 $30D30 + $1254W = $31F84. 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 $30D30 + $1284W = $31FB4 and the player's score increases by an amount given in the list located at $30D30 + $126CW = $31F9C. 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 ($7590W) by an amount that depends on the difficulty ($75A8W). Finally the sprite's action is changed to that of the got item, $19E2W.

The third and final section starting at $BF1F deals with all of the 'exceptional' sprite types and is called by the first section of the collision. It is a collection of short segments of code that deal with individual special sprite types Keen can interact with.

The first is Keen's shot code. This is dysfunctional and is intended to let Keen stun himself with his own shots when they are reflected by the Flect. The shot's Misc Variable C is checked, if it is 0 then code is skipped and the sprite is treated like a Platform. Otherwise the 'smash shot' code is called and Keen's action is changed to 'stunned' the Platform code is also then run. It is this 'Platform run-on' that causes issues.

Last are Platforms. An unknown variable is checked for; if not zero then Keen can stand on the sprite, otherwise nothing happens.

Patch: Keen Collision 1 code
#Keen sprite collision: First section, jumps
%patch $BE6A $55 $8B $EC $56 $57 $8B $7E $06 $8B $76 $08 $8B $04 $3D $0003W $75 $03 $E9 $00A0W $3D $0005W $74 $0C $3D $0006W $75 $03 $E9 $00AFW $5F $5E $5D $CB
#Second section, items
%patch $BE90 $8B $5C $3E $83 $FB $0B $76 $03 $E9 $00B5W $D1 $E3 $2E $FF $A7 $1534W $8B $5C $3E $D1 $E3 $FF $B7 $1254W $9A $183B09F1RL $83 $C4 $02 $C7 $04 $0001W $C7 $44 $20 $0003W $8B $5C $3E $D1 $E3 $8B $87 $1284W $89 $44 $1E $8B $5C $3E $D1 $E3 $FF $B7 $126CW $9A $069A1F06RL $83 $C4 $02 $83 $7C $3E $04 $7D $0B $8B $5C $3E $D1 $E3 $FF $87 $759CW $EB $20 $83 $7C $3E $0A $75 $06 $FF $06 $75A6W $EB $14 $83 $7C $3E $0B $75 $0E $8B $1E $75A8W $D1 $E3 $8B $87 $124CW $01 $06 $7590W $B8 $19E2W $50 $56 $9A $08F41297RL $83 $C4 $04 $5F $5E $5D $CB $5F $5E $5D $CB
#Third section, other
%patch $BF1F $83 $7C $44 $00 $74 $16 $56 $9A $0CA60EC2RL $83 $C4 $02 $B8 $1868W $50 $57 $9A $08F41297RL $83 $C4 $04 $83 $3E $75AAW $00 $75 $0E $56 $57 $9A $08F40DC0RL $83 $C4 $04 $5F $5E $5D $CB $5F $5E $5D $CB
#Pointless Keen-item collision list
%patch $BF54 $1482W
#Red Gem (At $BEA2)
%patch $BF56 $1482W
#Yellow Gem (At $BEA2)
%patch $BF58 $1482W
#Blue Gem (At $BEA2)
%patch $BF5A $1482W
#Green Gem (At $BEA2)
%patch $BF5C $1482W
#100 points (At $BEA2)
%patch $BF5E $1482W
#200 points (At $BEA2)
%patch $BF60 $1482W
#500 points (At $BEA2)
%patch $BF62 $1482W
#1000 points (At $BEA2)
%patch $BF64 $1482W
#2000 points (At $BEA2)
%patch $BF66 $1482W
#5000 points (At $BEA2)
%patch $BF68 $1482W
#1UP (At $BEA2)
%patch $BF6A $1482W
#Ammo (At $BEA2)


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.


Keen's spawn height and changing Keen's height

This simple patch alters how high Keen spawns above where he is placed in a level. By default this is 16 pixels up,suitable for a Keen sprite 32 pixels high. If Keen's height is changed, this should be changed to reflect that. It is part of the above spawning code patch and shouldn't be used in conjunction with it.

Patch: Keen 4
#Keen's spawn height
%patch $AA49 $FF0FW
#16 pixels up