Patch:Keen dying (Dreams)

From KeenWiki
Jump to navigation Jump to search

This page contains patches relating to Keen's death in Keen Dreams, 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 Dreams 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'. When killed Keen will begin a 'death sequence' that will eventually end with the level being lost.

This page is split into three sections; the first is Keen's death code itself, the second containing patches relating to dead Keen's sprites and a third dealing with miscellaneous things that happen on dying.


Death code

Keen Dreams has a remarkably simple death code for the player. When called it first checks if god mode is enabled, if so the code is skipped. If not if plays sound $0C and changes Keen's sprite action to the first frame of his dying sequence. Nothing else is changed, the life count is not affected (here) or the game ended.

Keen Dreams

#Keen die code
%patch $7650 $83 $3E {$6FAAW}  [$00] {$75} $24 $B8 [$000CW]  $50 $9A $10BB1282RL
             $44 $44 $8B $1E $34 $70 $C7 $47 $06 [$0000W]  $B8 [$10D6W]  $50 $FF
             $36 $34 $70 $9A $07C50255RL     $83 $C4 $04 $CB


What dying sets keys to

If Keen dies his keys are set to zero by default.

Keen Dreams

#On dying set keys to 0
%patch $5DC6 {$7122W}  [$0000W]


Keen Galaxy style death

This patch allows Keen to experience a Keen Galaxy style death. When he dies he jumps up in the air then falls offscreen. There are some limitations, Keen will not 'bounce' repeatedly off of lethal hazards and the animation he uses changes between the first and second death animations. (The third remains unused.)

The patch works by altering Keen's Flower Power throwing code, which will make it incompatible with other patches that affect it.

Keen Galaxy style death in Keen Dreams

#Keen dying produces a shot
%patch $24B56 $05E815D8RL
%patch $24B50 $0001W
%patch $24B62 $1112W
%patch $24B82 $FFFFW $FFFFW

#Deathshot is unique
%patch $7643 $0001W  $50 $EB $B0

#Deathshot action -fall ofscreen
%patch $24B64 $0088W $0082W $0002W $0000W $0000W $0000W $0000W $0000W
              $07C501A4RL   $00000000L    $07C5022DRL   $10F4W

#Keen Dreams shooting code modified to handle deaths
%patch $6369 $55 $8B $EC $4C $4C $56 $57 $8B $76 $06 $8B $7E $08
             $B8 $0001W  $50 $9A $044D01C9RL     $44 $44 $8B $1E $3E
             $70 $C7 $07 $0002W  $8B $46 $0A $89 $47 $40 $89 $77 $0A $89 $7F
             $0C $8B $C6 $B1 $08 $D3 $E8 $89 $47 $30 $89 $47 $2C $8B $C7 $D3
             $E8 $89 $47 $32 $89 $47 $2E $C7 $47 $10 $FFFFW  $8B $5E $0A $83
             $FB $06 $77 $45 $D1 $E3 $2E $FF $A7 $0622W  $8B $1E $3E $70 $C7
             $47 $16 $0000W  $C7 $47 $18 $FFC0W  $EB $2E $8B $1E $3E $70 $C7
             $47 $16 $0040W  $C7 $47 $18 $FFECW  $EB $1E $8B $1E $3E $70 $C7
             $47 $16 $0000W  $C7 $47 $18 $0040W  $EB $0E $8B $1E $3E $70 $C7
             $47 $16 $FFC0W  $C7 $47 $18 $FFECW  $B8 $000EW  $83 $3E $8F3EW
             $0F $74 $1E

#Here we make shots
%patch $6407 $83 $3E $711CW  $00 $74 $39 $FF $0E $711CW  $B8 $0004W  $8B $1E
             $3E $70 $C7 $47 $3E $0008W  $C7 $46 $FE $0BD2W  $EB $27 $83 $3E
             $711EW  $00 $74 $1B $FF $0E $7120W  $FF $0E $711EW  $B8 $0014W
             $8B $1E $3E $70 $C7 $47 $3E $000AW  $C7 $46 $FE $0C0EW  $EB $05
             $C7 $46 $FE $0000W  $50 $9A $10BB1282RL     $44 $44
             $8B $1E $3E $70 $C7 $47 $02 $0003W  $FF $76 $FE $FF $36 $3E $70
             $9A $044D1212RL     $83 $C4 $04 $5F $5E $8B $E5 $5D $CB

#Special death coding
%patch $6472 $8B $1E $3E $70 $C7 $47 $16 $0020W  $C7 $47 $18 $FFB0W  $C7 $47
             $06 $0000W  $C7 $47 $10 $FFFFW  $C7 $07 $000FW  $C7 $46 $FE $10F4W
             $83 $36 $10F4W  $01 $EB $BA

#Shot direction list
%patch $64A2 $053FW #Upwards
             $05F2W #Death
             $054FW #Rightwards
             $057FW #INVALID
             $055FW #Downwards
             $057FW #INVALID
             $056FW #Leftwards


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

Keen's dying in Dreams is quite simple. There are three actions, each of which is part of a simple sequence that is triggered when Keen is killed and ends with the Didn't make it past window. Note that the last action goes to itself; this keeps Keen doing the same thing and doesn't matter because the level is paused when the window appears.

Actions:
$10D6W #Keen die 1
$10F4W #Keen die 2
$1112W #Keen die 3

Keen Dreams

#Keen killed
%patch $766C [$10D6W]

#Death sequence
%patch $24B62 [$10F4W]
%patch $24B80 [$1112W]
%patch $24B9E [$1112W]


Sprite Behavior

Keen's dying sequence has only one behavior used by the very last action of the sequence. This behavior loses the level and it is losing the level that changes everything else. (Such as decreasing Keen's life count.)

Keen Dreams

#Keen dying behaviors
%patch $24B56 $00000000L
%patch $24B74 $00000000L
%patch $24B92 $05E81079RL


Dead Keen's behavior code

The behavior of dead Keen is very simple; it sets the level state to 4, that is, it loses the level.

Keen Dreams

#Keen dead behavior
%patch $6EF9 $55 $8B $EC $56 $8B $76 $06 $83 $C6 $4C $C7 $06 {$705AW}  [$0004W]
             $5E $5D $CB


Speed

When dying Keen doesn't move by default.

Sprite speeds

#Keen dead animation motion
%patch $24B52 [$0000W $0000W]
%patch $24B70 [$0000W $0000W]
%patch $24B8E [$0000W $0000W]


Sprite Collision

Dead Keen has no sprite collision. This is needed to prevent him getting stuck in a 'death loop'.

Keen Dreams

#Keen dead sprite collision
%patch $24B5A $00000000L
%patch $24B78 $00000000L
%patch $24B96 $00000000L


Animations

Keen's death sequence involves three separate frames, each with a different animation. The animation is the same no matter which way Keen is facing. The first two frames are quite rapid while the last takes considerable time. When it's animation is up the Didn't make it past window will appear.

Keen Dreams

#Keen die
%patch $24B46 $0087W $0087W
%patch $24B50 $0014W        #Animation speed
%patch $24B64 $0088W $0088W
%patch $24B6E $0014W        #Animation speed
%patch $24B82 $0089W $0089W
%patch $24B8C $0078W        #Animation speed


Sounds

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

Keen Dreams

#Sounds
%patch $7658 $0C     #Keen die sound

#Don't play sounds
%patch $7657 $EB $09 #Don't play Keen die sound


Sprite-tile interaction

Dying Keen uses a special tile interaction also used when doing things like napping. This stops Keen going to falling or other such distractions and lets him complete his death sequence.

Keen Dreams

#Keen dead tile collision
%patch $24B5E $05E81ABARL
%patch $24B7C $05E81ABARL
%patch $24B9A $05E81ABARL


Action type

As the death sequence is quite basic, Keen uses type 0 actions.

Sprite action types

#Keen dead
%patch $24B4A [$0000W]
%patch $24B68 [$0000W]
%patch $24B86 [$0000W]


Deprotect and stick to ground

Keen has no need for either of these variables and so has a value of 0 for both in all of his death actions.

Sprite deprotect, stick

#Keen dead
%patch $24B4C [$0000W $0000W]
%patch $24B6A [$0000W $0000W]
%patch $24B88 [$0000W $0000W]