Patch:Keen dying (Keen 6)

From KeenWiki
Jump to navigation Jump to search

This page contains patches relating to Keen's death in Keen 6, 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 6 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'. 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.


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, despite the fact that Keen does not moon in Keen 6. 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 two possible actions Keen may die into, dead 'sprawled' dead 'clutched'. 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.

Keen 6

#Kill Keen code
%patch $BDEA $55 $8B $EC $83 $3E {$C75FW}  [$00] {$75} $74 $83 $3E {$C7B7W}  [$00] {$75} #Check for godmode, PlayLoop timer
             $6D $8B $1E $64 $A9 $81 $7F $1C [$0B88W]  {$74} $62 $C7 $06 {$CC1BW}  #Check action, set mooning = 0
             [$0000W]  $C7 $06 {$C75FW}  [$001EW]  $C7 $06 $A968W  [$0001W]  $C7 $47 #Set PlayLoop, scrolling
             $06 [$0000W]  $C7 $47 $20 [$0003W]  $9A $1CF30034RL     $3D [$0080W]  #Set clipping and foreground, random check
             $7D $12 $B8 [$0BA6W]  $50 $FF $36 $64 $A9 $9A $08F41297RL     $83 #Dead Keen 1
             $C4 $04 $EB $10 $B8 [$0BC4W]  $50 $FF $36 $64 $A9 $9A $08F41297RL #Dead Keen 2
                 $83 $C4 $04 $B8 [$0017W]  $50 $9A $183B09F1RL     $83 $C4 $02 #Play sound
             $8B $1E $64 $A9 $C7 $47 $18 [$FFD8W]  $C7 $47 $16 [$0010W]  $5D $CB #Set speed to -24 V, 16 H


Probability and randomness

This patch alters 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.

Keen 6

#Probability of dying sprawled
%patch $BE28 [$80]


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 only a few 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 death actions chosen at random when Keen dies. Both of these actions continue to animate to themselves, not changing action at all. (Though they can 're-die' and change actions that way.)

Actions:
$0B88W  #Defunct dead action
$0BA6W  #Keen dies clutched (Exits level if offscreen.)
$0BC4W  #Keen dies sprawled (Exits level if offscreen.)

Keen 6

#Don't die if using this action
%patch $BE02 [$0B88W]

#When dying become one of these two actions
%patch $BE2D [$0BA6W]
%patch $BE3F [$0BC4W]

#When dead sprawled
%patch $318F2 [$0BA6W]

#When dead clutched
%patch $31910 [$0BC4W]


Sprite Behavior

The defunct action has no behavior and it does not matter if it is given one. There is one unique dead Keen behavior that is used by both of Keen's dead frames. This behavior loses the level if the sprite goes offscreen.

Behaviors:
$00000000L  #Nothing
$0AA2139ARL #Lose level if offscreen

Keen 6

#Defunct action
%patch $318C8 $00000000L

#Dead Keen
%patch $318E6 $0AA2139ARL #Sprawled
%patch $31904 $0AA2139ARL #Clutched


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.

Dead Keen 'bounce' speeds

#Dead Keen 'bounce' speeds
%patch $BE61 [$FFD8W] #Up
%patch $BE66 [$0010W] #Right

Animation motion

#Defunct action
%patch $318C4 [$0000W $0000W]

#Dead Keen
%patch $318E2 [$0000W $0000W]
%patch $31900 [$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.

Keen 6

#Defunct action
%patch $318CC $00000000L

#Dead Keen
%patch $318EA $00000000L #Sprawled
%patch $31908 $00000000L #Clutched


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.

Keen 6

#Defunct action
%patch $318B8 $FFFFW $FFFFW #Invisible
%patch $318C2 $000AW        #Animation speed

#Dead Keen
%patch $318D6 $0053W $0053W #Sprawled
%patch $318E0 $0064W        #Animation speed
%patch $318F4 $0054W $0054W #Clutched
%patch $318FE $0064W        #Animation speed


Sounds

Keen makes a sound each time he dies. This is the only death related sound and it can be blocked.

Keen 6

#Keen dies sound
%patch $BE4F $17

#Don't play Keen dies sound
%patch $BE4E $EB $0A


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

Clipping

#Dead Keen clipping
%patch $BE1B  $0000W #Keen dies

Foreground

#Dead Keen foreground
%patch $BE20  $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.)

Sprite-tile interaction

#Defunct action
%patch $318D0 $08F4180ARL

#Dead Keen
%patch $318EE $08F4180ARL
%patch $3190C $08F4180ARL


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.

Keen 6

#Defunct action
%patch $318BC [$0002W]

#Dead Keen
%patch $318DA [$0002W]
%patch $318F8 [$0002W]


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.

Keen 6

#Defunct action
%patch $318BE [$0000W $0000W]

#Dead Keen
%patch $318DC [$0000W $0000W]
%patch $318FA [$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.