Patch:Keen dying (Keen 4)

From KeenWiki
Jump to: navigation, search

This page contains patches relating to Keen's death in Keen 4, its causes and effects as well as patches that affect dying Keen's sprite. Other pages relating to Keen's death in other games can be found at Patch:Dead Keen.

In Keen 4 Keen can die in a number of ways, the three most basic being: falling out of the level bottom, lethal sprites and lethal tiles. In all cases Keen will use the same 'death code' which is in itself split into two sections depending whether or not Keen is in the Well Of Wishes. If Keen is, he will die using the 'scuba deaths' otherwise (normally) he will us the 'normal deaths'

In each case Keen has a choice of two death actions, chosen at random. While dead keen can be 'killed' again changing his death action. This can result in humorous sequences where Keen 'bounces' across the screen, repeatedly hitting lethal objects.

This page is split into two sections; the first is Keen's death code itself, the second containing patches relating to dead Keen's sprites.


Death code

This section contains patches that alter Keen's death code, that is, the circumstances in which he becomes dead. Some patches in this section may contain and thus be incompatible with some Keen mooning patches.


Default death code

This is the code run each time Keen is killed. A number of things will be noticed. Firstly there are some conditions under which Keen cannot die. The first is the PlayLoop timer (which has several functions.) It is set to $1E when Keen successfully dies. The second checks if god mode is enabled and the third and final check is whether Keen is using a defunct exception action (Oddly there is no place in the game that sets this action so this check is pointless.)

Secondly a number of variables are set; clipping is turned off (So dead Keen doesn't get stuck.), foreground is set to 3 (So dead Keen always appears in front of tiles and doesn't look odd.) Keen's 'mooning value' is set to 0 so that if he dies after mooning he can do so again. Two other variables are set, one may be the sprite type, the other is the screen scroll variable (This stops the screen scrolling when Keen dies and is needed to prevent bugs.)

There are four possible actions Keen may die into, dead 'sprawled' dead 'clutched', swimming 'sprawled' and swimming 'clutched'. There is a check for what level Keen is in before this which determines which pair (Swimming or not swimming) Keen can choose from. (See Patch:Jump conditions.)

It can be seen that there is a 50% chance of Keen being either sprawled or clutched, this is controlled by a random check of value 80. (50\50) Setting the value to zero will make Keen only die using one action.

Finally near the end of the code sound 17 is played and Keen's speed is set to jump up slightly and move right.

This code contains a number of smaller patches listed on this page and may not be compatible with them if placed after them in the patch file.

Patch: Keen 4
#Kill Keen code
%patch $CBE9 $55 $8B $EC $83 $3E $C5D1W $00 $74 $03 $E9 $00B1W $83 $3E $C629W
#Check for godmode, PlayLoop timer
$00 $74 $03 $E9 $00A7W $8B $1E $A7D6W $81 $7F $1C $0CD4W $75 $03 $E9 $0099W $C7 $06 $CAB5W $0000W $C7 $06 $C5D1W $001EW
#Set mooning = 0, PlayLoop timer = 1E
$C7 $06 $A7DAW $0001W $C7 $47 $06 $0000W $C7 $47 $20 $0003W
#Set scrolling, fore = 3, clip = 0
$83 $3E $ED $A7 $11 $75 $30 $9A $1D02002ARL $3D $0080W
#If level = 17 then jump, else random check
$7D $12 $B8 $0D2EW $50 $FF $36 $D6 $A7 $9A $09DC120ARL $83
#Turn Keen into dead swim 1
$C4 $04 $EB $40 $B8 $0D4CW $50 $FF $36 $D6 $A7 $9A $09DC120ARL
#Or dead 2
$83 $C4 $04 $EB $2E $EB $2C $9A $1D02002ARL $3D $0080W
#Random check
$7D $12 $B8 $0CF2W $50 $FF $36 $D6 $A7 $9A $09DC120ARL $83
#Turn Keen into dead 1
$C4 $04 $EB $10 $B8 $0D10W $50 $FF $36 $D6 $A7 $9A $09DC120ARL
#Or 2
$83 $C4 $04 $B8 $0017W $50 $9A $187409F1RL $83 $C4 $02
#Play sound 17
$8B $1E $A7D6W $C7 $47 $18 $FFD8W $C7 $47 $16 $0010W $5D $CB
#Set speed to -24 V, 16 H


Probability and randomness

Both of these patches alter the probability that Keen will die using one death frame as opposed to the other. By default this is 50:50, meaning that each time Keen dies he has an equal chance of dying in either of two possible death frames.

Patch: Keen 4
%patch $CC37 $80 
#Probability of dying sprawled, swimming
%patch $CC67 $80
#Probability of dying sprawled


Dead Keen uses only one animation (Also no scuba death)

This patch substantially reduces the size of the kill Keen code, making it far easier to copy and thus allow multiple Keen deaths. It also ensures Keen dies the same way every time, useful if something novel is to be done with dead Keen. Here Keen dies and only uses the 'normal sprawled' frame. The first patch makes keen just fall offscreen, the second makes him 'bounce' like he does by default.

Patch: Keen 4
#Kill Keen code, die only one way - no bounce
%patch $CBE9 $55 $8B $EC $83 $3E $C5D1W $00 $74 $03 $E9 $0054W $83 $3E $C629W
#Check for godmode, PlayLoop timer
$00 $74 $03 $E9 $004AW $8B $1E $A7D6W $81 $7F $1C $0CD4W $75 $03 $E9 $003CW $C7 $06 $CAB5W $0000W $C7 $06 $C5D1W $001EW
#Set mooning = 0, PlayLoop timer = 1E
$C7 $06 $A7DAW $0001W $C7 $47 $06 $0000W $C7 $47 $20 $0003W
#Set scrolling, fore = 3, clip = 0
$B8 $0CF2W $50 $FF $36 $D6 $A7 $9A $09DC120ARL $83
#Turn Keen into dead 1
$C4 $04 $B8 $0017W $50 $9A $187409F1RL $83 $C4 $02
#Play sound 17
$8B $1E $A7D6W $5D $CB

Patch: Keen 4
#Kill Keen code, die only one way - bounce
%patch $CBE9 $55 $8B $EC $83 $3E $C5D1W $00 $74 $03 $E9 $005EW $83 $3E $C629W
#Check for godmode, PlayLoop timer
$00 $74 $03 $E9 $0054W $8B $1E $A7D6W $81 $7F $1C $0CD4W $75 $03 $E9 $0046W $C7 $06 $CAB5W $0000W $C7 $06 $C5D1W $001EW
#Set mooning = 0, PlayLoop timer = 1E
$C7 $06 $A7DAW $0001W $C7 $47 $06 $0000W $C7 $47 $20 $0003W
#Set scrolling, fore = 3, clip = 0
$B8 $0CF2W $50 $FF $36 $D6 $A7 $9A $09DC120ARL $83
#Turn Keen into dead 1
$C4 $04 $B8 $0017W $50 $9A $187409F1RL $83 $C4 $02
#Play sound 17
$8B $1E $A7D6W $C7 $47 $18 $FFD8W $C7 $47 $16 $0010W $5D $CB
#Set speed to -24 V, 16 H


Hit points (health)

This patch allows Keen to have hit points health) with two main side effects. Firstly keen will not gain extra lives from collecting lifewater drops and secondly Keen will not have a 'scuba death' in the Well Of Wishes. The drops counter is used to keep track of hit points.

The first section of the patch alters the status window to accommodate a 3-digit HP counter in place of the drops counter. (If Keen's HP are not allowed to rise above 99 then the first section of 5 lines is totally unnecessary.) The details are slightly obscure and shouldn't be altered unless the modder wants to customize the status window.

The second section sets Keen's health when a new game starts. In this patch his health is set to 100 ($0064W). The third section gives the maximum amount of lifewater drops Keen can acquire, that is, the maximum health he can get in a level by collecting drops. In this patch it is 200 ($00C8W), or twice the default health, but a modder may wish to make this 100, the same as default health. If Keen collects a drop while at maximum health, he will get no benefit from it, though the drop will be taken.

The third section is Keen's death code; the last part of this section is very similar to the default code, with highlighted variables doing identical things. However at the start of the section there is an additional check before the player dies; HP are decreased by 1, and if they are less than 1 the player is allowed to die (Otherwise nothing happens.) On dying HP is reset to full health (To avoid the player restarting the level with 0 HP.)

The first patch has no indication Keen is hurt, the second plays a 'hit sound' to alert the player.

Patch: Keen has hit points, Keen 4
#Display HP in status window
%patch $2F4CB "HP" $00 %patch $8028 $0018W
#Width
%patch $8030 $00D8W
#Horizontal position (Box)
%patch $804E $00D8W
#Horizontal position (Counter)
%patch $8046 $0003W
#Number of digits
#Keen's starting health
%patch $5CB9 $C7 $06 $7A5AW $0064W
#Max health obtainable by getting drops (SIDE EFFECT: No 100 drops-> extra life)
%patch $D075 $A1 $7A5AW $3D $00C8W $73 $04 $FF $06 $7A5AW $5F $5E $5D $CB
#Kill Keen code
%patch $CBE9 $55 $8B $EC $83 $3E $C5D1W $00 $74 $03 $E9 $008BW $83 $3E $C629W
#Check for godmode, PlayLoop timer
$00 $74 $03 $E9 $0081W $8B $1E $A7D6W $81 $7F $1C $0CD4W $75 $03 $E9 $0073W $FF $0E $7A5AW $83 $3E $7A5AW $01 $7D $68
#Check to see if HP < 1
$C7 $06 $7A5AW $0064W
#On death set HP=100
$C7 $06 $CAB5W $0000W $C7 $06 $C5D1W $001EW
#Set mooning = 0, PlayLoop timer = 1E
$C7 $06 $A7DAW $0001W $C7 $47 $06 $0000W $C7 $47 $20 $0003W
#Set scrolling, fore = 3, clip = 0
$9A $1D02002ARL $3D $0080W
#Random check
$7D $12 $B8 $0CF2W $50 $FF $36 $D6 $A7 $9A $09DC120ARL $83
#Turn Keen into dead 1
$C4 $04 $EB $10 $B8 $0D10W $50 $FF $36 $D6 $A7 $9A $09DC120ARL
#Or dead 2
$83 $C4 $04 $B8 $0017W $50 $9A $187409F1RL $83 $C4 $02
#Play sound 17
$8B $1E $A7D6W $C7 $47 $18 $FFD8W $C7 $47 $16 $0010W $5D $CB
#Set speed to -24 V, 16 H

Patch: Keen has hit points, Keen 4, play hurt sound
#Display HP in status window
%patch $2F4CB "HP" $00 %patch $8028 $0018W
#Width
%patch $8030 $00D8W
#Horizontal position (Box)
%patch $804E $00D8W
#Horizontal position (Counter)
%patch $8046 $0003W
#Number of digits
#Keen's starting health
%patch $5CB9 $C7 $06 $7A5AW $0064W
#Max health obtainable by getting drops (SIDE EFFECT: No 100 drops-> extra life)
%patch $D075 $A1 $7A5AW $3D $00C8W $73 $04 $FF $06 $7A5AW $5F $5E $5D $CB
#Kill Keen code
%patch $CBE9 $55 $8B $EC $83 $3E $C5D1W $00 $74 $03 $E9 $008BW $83 $3E $C629W
#Check for godmode, PlayLoop timer
$00 $74 $03 $E9 $0081W $8B $1E $A7D6W $81 $7F $1C $0CD4W $75 $03 $E9 $0073W $FF $0E $7A5AW $83 $3E $7A5AW $01 $7D $6A $C7 $06 $7A5AW $0064W
#On death set HP=100
$C7 $06 $CAB5W $0000W $C7 $06 $C5D1W $001EW
#Set mooning = 0, PlayLoop timer = 1E
$C7 $06 $A7DAW $0001W $C7 $47 $06 $0000W $C7 $47 $20 $0003W
#Set scrolling, fore = 3, clip = 0
$9A $1D02002ARL $3D $0080W
#Random check
$7D $12 $B8 $0CF2W $50 $FF $36 $D6 $A7 $9A $09DC120ARL $83
#Turn Keen into dead 1
$C4 $04 $EB $10 $B8 $0D10W $50 $FF $36 $D6 $A7 $9A $09DC120ARL
#Or dead 2
$83 $C4 $04 $B8 $0017W $50 $9A $187409F1RL $83 $C4 $02
#Play sound 17
$8B $1E $A7D6W $C7 $47 $18 $FFD8W $C7 $47 $16 $0010W $5D $CB
#Set speed to -24 V, 16 H
$B8 $0020W $50 $9A $187409F1RL $83 $C4 $02 $5D $CB
#Hurt sound played


Dying in WoW and scuba death

There are two possible ways for Keen to die, swimming or not. Which one is chosen depends on what level he is in. The patch below has three parts, first what is checked for in brown (The current level), second the value in blue ($11 = 17, that is, level 17) and thirdly, the jump, again in brown ($74, only jump if...) The net result is that if the current level is 17, Keen dies using the swimming frames.

To make Keen die normally in WoW, simply replace the jump with $90 $90.

Patch: Keen 4
#The level that produces dead swimming Keen
%patch $CC2A $83 $3E $A7EDW $11 $75 $30


Keen does not die differently in WoW

This patch removes the unique WoW death, meaning Keen will use the same actions dying in any level. If Keen is swimming when he dies this may well cause an uncached sprite error, so Keen's death actions will have to be carefully coded.

It is of course possible to make this patch into a 'Keen always uses scuba death' patch with a simple animation frame switch.

Patch: Keen 4
#Keen doesn't die differently in WoW
%patch $CBE9 $55 $8B $EC $83 $3E $C5D1W $00 $74 $03 $E9 $007AW $83 $3E $C629W
#Check for godmode, PlayLoop timer
$00 $74 $03 $E9 $0070W $8B $1E $A7D6W $81 $7F $1C $0CD4W $75 $03 $E9 $0062W $C7 $06 $CAB5W $0000W $C7 $06 $C5D1W $001EW
#Set mooning = 0, PlayLoop timer = 1E
$C7 $06 $A7DAW $0001W $C7 $47 $06 $0000W $C7 $47 $20 $0003W
#Set scrolling, fore = 3, clip = 0
$9A $1D02002ARL $3D $0080W
#Random check
$7D $12 $B8 $0CF2W $50 $FF $36 $D6 $A7 $9A $09DC120ARL $83
#Turn Keen into dead 1
$C4 $04 $EB $10 $B8 $0D10W $50 $FF $36 $D6 $A7 $9A $09DC120ARL
#Or dead 2
$83 $C4 $04 $B8 $0017W $50 $9A $187409F1RL $83 $C4 $02
#Play sound 17
$8B $1E $A7D6W $C7 $47 $18 $FFD8W $C7 $47 $16 $0010W $5D $CB
#Set speed to -24 V, 16 H


Keen has three death frames instead of two

This patch gives Keen an extra death frame; it does this in this patch by stealing from Keen's mooning sequence, but this is not mandatory. It relies on using the EGAGRAPH check skip and so is incompatible with any other patches that use this. Note that Keen's underwater death is not affected. (But not given three frames either!)

The first line of the patch alters the probability Keen will die in a certain frame. Now he has a 1/3 chance of dying in one action and 2/3 in the other. This second action will itself split in two, resulting in 1/3 + 1/3 + 1/3 for each of the three death frames.

The next part is the two new death frames. Notice one is a copy of the second death frame, but the other uses the first Keen mooning frame. (If this is changed, Keen's mooning sequence can be left alone.) The third part of the patch is the 'split' action that splits one of Keen's original death frames into two new ones.

The fourth part of the patch is the splitting behavior, it performs a random check then changes Keen's frame to either one of the new death frames. Finally the fourth part of the patch caches the first (and only the first) mooning animation when Keen spawns in a level. (This must be changed if the animations of the new death frame are changed.)

Patch: Keen 4
#Change probability to 2/3 chance of split action
%patch $CC67 $C0
#New dead frames
%patch $2EFDA $00A2W $00A2W $0002W $0000W $0000W $0064W $0000W $0000W $0B8013B9RL $00000000L $09DC176ERL $0CF2W %patch $2EFF8 $0207W $0207W $0002W $0000W $0000W $0064W $0000W $0000W $0B8013B9RL $00000000L $09DC176ERL $0D10W
#Second Keen death can split into two new frames
%patch $2FB62 $00A2W $00A2W $0002W $0000W $0000W $0064W $0000W $0000W $037D0526RL $00000000L $09DC176ERL $0D10W
#Disable EGAGRAPH check in Keen 4 (Frees 389 bytes at $3CF6)
%patch $3CE5 $90 $90
#New Keen death behavior (Split action) = $037D0526RL
%patch $3CF6 $55 $8B $EC $56 $8B $76 $06 $83 $7C $0080W $90 $90 $8B $47 $0C $9A $1D02002ARL $3D $0080W $7D $07 $C7 $44 $1C $016AW $EB $05 $C7 $44 $1C $0188W $5E $5D $CB
#Mooning Keen now part of normal Keen
%patch $E97B $0207W $EB $44
#Cache 1st mooning and scoreboard for right Keen
%patch $E9A7 $0207W $EB $18
#Cache 1st mooning and scoreboard for left Keen


Being eaten wins the game

This patch makes Keen win the game when he is eaten by a Dopefish. It works by making a new level state that wins the game and then changing the level state in eaten Keen's behavior to that instead of 1.

Patch: Keen 4
#Being eaten wins the game
%patch $6BD9 $0EB2W %patch $12120 $000DW


Dead Keen's sprite frames

This section contains patches that relate to Keen after he has died, his death animations and how they act.


Sprite Actions

There are a surprising number of actions associated with Keen's death. One of these is the 'defunct' action originally meant to stop Keen 're-dying' when already dead. This was dropped however and although the action exists there is no way for Keen to use it. It is checked for however in keen's death code.

There are two possible 'normal' and 'scuba' death actions for a total of four actions. Keen can die into all four in his death code randomly picking one or the other normal\swim deaths depending on what level he is in.

Each of these four actions continues to animate to itself, not changing its action at all. (Though they can 're-die' and change actions that way.)

When Keen is eaten by a Dopefish he is converted to a special dead action that does not act the same way the other death actions do. (For example if it falls offscreen the level doesn't restart.) This action in theory goes to the 'invisible dead' Keen but it doesn't animate. Instead the Dopefish 're-eats' dead Keen converting him into the invisible dead action.

The invisible dead action animates to itself, ending the level when it does so.

Actions:
$0CD4W #Defunct action (Not used)
$0CF2W #Keen dies sprawled (Exits level if offscreen.)
$0D10W #Keen dies clutched (Exits level if offscreen.)
$0D2EW #Keen die swimming sprawled (Exits level if offscreen.)
$0D4CW #Keen die swimming clutched (Exits level if offscreen.)
$36B0W #Eaten by Dopefish Keen
$36CEW #Eaten by Dopefish Keen - invisible

Patch: Keen 4
#Don't die if using this action
%patch $CC07 $0CD4W
#When dying normally become one of these two actions
%patch $CC6C $0CF2W %patch $CC7E $0D10W
#When dying in WoW become one of these two actions
%patch $CC3C $0D2EW %patch $CC4E $0D4CW
#When dead sprawled
%patch $2FB7E $0CF2W
#When dead clutched
%patch $2FB9C $0D10W
#When dead scuba sprawled
%patch $2FBBA $0D2EW
#When dead scuba clutched
%patch $2FBD8 $0D4CW
#When eaten by Dopefish
%patch $12411 $36B0W
#What to do when eaten
%patch $3253C $36CEW
#Dead Keen is re-eaten by Dopefish
%patch $12112 $36CEW
#What to do when re-eaten
%patch $3255A $36CEW


Sprite Behavior

There are two dead Keen behaviors in use. The defunct action has no behavior and it does not matter if it is given one.

All four of Keen's 'usual' dead frames use the same behavior, one that loses the level if the sprite goes offscreen. Eaten Keen has no behavior but invisible dead Keen uses a different behavior; one that loses the level when it animates. (That is, after sitting around for a period of time.)

Behaviors:
$00000000L  #Nothing
$0B8013B9RL #Lose level if offscreen
$11A20700RL #Keen dead invisible

Patch: Keen 4
#Defunct action
%patch $2FB54 $00000000L
#Normal dead
%patch $2FB72 $0B8013B9RL
#Dead sprawled
%patch $2FB90 $0B8013B9RL
#Dead clutched
#Scuba dead
%patch $2FBAE $0B8013B9RL
#Dead swimming sprawled
%patch $2FBCC $0B8013B9RL
#Dead swimming clutched
#Eaten Keen
%patch $32530 $00000000L %patch $3254E $11A20700RL
#Keen dead invisible


Dead Keen's behavior

This behavior is used by Keen's normal and scuba dead actions. It is quite simple; when Keen starts to go offscreen in any direction the level is lost. This is done by simply changing the level state to 1 when the game detects Keen's position relative to a screen edge is 0.

On the first line code is also called to make Keen fall; $56 $9A $09DC1315RL $83 $C4 $02. If this is removed then dead Keen will not fall at all, making it harder for him to go offscreen.

Patch: Keen 4
#Dead Keen's behavior
%patch $CBB9 $55 $8B $EC $56 $8B $76 $06 $56 $9A $09DC1315RL $83 $C4 $02 $8B $44 $16 $F7 $2E $4C $A5 $A3 $C923W $56 $9A $09DC1260RL $83 $C4 $02 $0B $C0 $75 $06 $C7 $06 $7A70W $0001W $5E $5D $CB


Dead Keen doesn't fall

This patch will stop Keen from responding to gravity, that is falling offscreen when he dies. Since however the level can only be restarted when he leaves the screen, some other form of movement must be implemented. By default he will move sideways off the screen if this patch is used.

Patch: Keen 4
#Dead Keen doesn't fall
%patch $CBC1 $90 $90 $90 $90 $90


Eaten Keen's behavior

This behavior is used by the invisible frame of Keen after he has been eaten by a Dopefish. It is quite simple; when its animation timer runs out the level is lost. This is done by simply changing the level state to 1. This can be changed to another value so that being eaten by the Dopefish actually wins the level or even the game.

Patch: Keen 4
#Eaten dead Keen's behavior
%patch $12120 $55 $8B $EC $8B $46 $06 $05 $4C $00 $C7 $06 $7A70W $0001W $5D $CB


Speed

There are two main sets of speeds relating to dead Keen. The first is the 'bounce' Keen gets when killed. This is both upwards and rightwards to ensure that Keen will quickly move off of any hazard he is touching and not get stuck in an 'infinite death loop'

The other set of speeds involve animation motion. None of dead keen's actions use these speeds at all.

Patch: Dead Keen 'bounce' speeds
#Dead Keen 'bounce' speeds
%patch $CCA0 $FFD8W
#Up
%patch $CCA5 $0010W
#Right

Patch: Animation motion
#Defunct action
%patch $2FB50 $0000W $0000W
#Dead normal
%patch $2FB6E $0000W $0000W %patch $2FB8C $0000W $0000W
#Dead swimming
%patch $2FBAA $0000W $0000W %patch $2FBC8 $0000W $0000W
#Eaten
%patch $3250E $0000W $0000W %patch $3254A $0000W $0000W


Sprite Collision

None of Keen's dead actions have any collision. They do not interact with sprites, though they may still trigger the 'Keen die' code when sprites react to them.

Patch: Keen 4
#Defunct action
%patch $2FB58 $00000000L
#Dead normal
%patch $2FB76 $00000000L
#Keen dies
%patch $2FB92 $00000000L
#Keen dies
#Dead swimming
%patch $2FBB2 $00000000L
#Keen swimming dies
%patch $2FBD0 $00000000L
#Keen swimming dies
#Eaten Keen
%patch $32534 $00000000L
#No collision
%patch $32552 $00000000L
#No collision


Animations

There are two animations each for Keen dying normally, or underwater. There is also a separate, invisible frame that brings up the 'Didn't make it past window'. Finally when Keen is eaten by a Dopefish there is a two frame sequence that results in an invisible dead Keen similar to the 'restart level' action.

Patch: Keen 4
#Defunct action
%patch $2FB44 $FFFFW $FFFFW
#Invisible
%patch $2FB4E $000AW
#Animation speed
#Dead Keen
%patch $2FB62 $00A2W $00A2W
#Sprawled
%patch $2FB6C $0064W
#Animation speed
%patch $2FB80 $00A3W $00A3W
#Clutched
%patch $2FB8A $0064W
#Animation speed
#Dead swimming Keen
%patch $2FB9E $0139W $0139W %patch $2FBA8 $0064W
#Animation speed
%patch $2FBBC $013AW $013AW %patch $2FBC6 $0064W
#Animation speed
#Eaten by Dopefish Keen
%patch $32520 $0139W $0139W %patch $3252A $0000W
#Animation speed
%patch $3253E $FFFFW $FFFFW
#Invisible, wait a bit before level restart
%patch $32548 $00B4W
#Animation speed


Sounds

Keen makes a sound each time he dies. This is the only death related sound and it can be blocked. The Dopefish also makes a sound when eating Keen but this is not strictly Keen's sound.

Patch: Keen 4
#Sounds
%patch $CC8E $17
#Keen dies sound
%patch $12405 $17
#Dopefish eat Keen
#Don't play sounds
%patch $CC8D $EB $0A
#Don't play Keen dies sound
%patch $12404 $EB $0A
#Don't play Dopefish eat Keen


Clipping and foreground

When Keen dies his clipping is set to 0 (So he can pass through tiles offscreen and doesn't get stuck in a block.) and foreground is set to 3 (So he appears in front of all tiles and most sprites, making him appear very prominent.) When Keen is eaten by a Dopefish his clipping is also removed; this also affects the Schoolfish when it is eaten.

Patch: Clipping
#Dead Keen clipping
%patch $CC23 $0000W
#Keen dies
%patch $12402 $0000W
#Stuff eaten by Dopefish (Keen or Schoolfish)

Patch: Foreground
#Dead Keen foreground
%patch $CC28 $0003W
#Keen dies


Sprite-tile interaction

All of dead Keen's actions use the basic 'draw' tile collision that doesn't interact with any tiles in any way. (Though if their clipping is 1 or higher tiles will still bock them.)

Patch: Sprite-tile interaction
#Defunct action
%patch $2FB4A $09DC176ERL
#Dead normal
%patch $2FB68 $09DC176ERL %patch $2FB86 $09DC176ERL
#Dead swimming
%patch $2FBA4 $09DC176ERL %patch $2FBC2 $09DC176ERL
#Eaten
%patch $32538 $09DC176ERL %patch $32556 $09DC176ERL


Action type

All of dead Keen's actions are type 2 meaning they ignore their animation timer but react instantly to outside influences. The exception is invisible dead Keen which is type 0, allowing it to wait until its animation timer runs out before losing the level.

Patch: Keen 4
#Defunct action
%patch $2FB48 $0002W
#Dead Keen
%patch $2FB66 $0002W %patch $2FB84 $0002W
#Dead swimming Keen
%patch $2FBA2 $0002W %patch $2FBC0 $0002W
#Eaten by Dopefish Keen
%patch $32524 $0002W %patch $32542 $0000W


Deprotect and stick to ground

None of Dead Keen's actions need to stick to the ground and so neither of these variables is used by any of the actions.

Patch: Keen 4
#Defunct action
%patch $2FB4A $0000W $0000W
#Dead Keen
%patch $2FB68 $0000W $0000W %patch $2FB86 $0000W $0000W
#Dead swimming Keen
%patch $2FBA4 $0000W $0000W %patch $2FBC2 $0000W $0000W
#Eaten by Dopefish Keen
%patch $32526 $0000W $0000W %patch $32544 $0000W $0000W


Probability and randomness

See above in the first section of this page for patches relating to the probability of Keen dying with a certain action.