Patch:Keen dying (Vorticons)

From KeenWiki
Jump to navigation Jump to search

This page contains patches relating to Keen's death in Keen 1-3, its causes and effects. Other pages relating to Keen's death are listed under Patch:Dead Keen. Patches relating to hazard tiles that can kill the player are found under Patch:Deadly tiles.

In Keen Vorticons Keen can die in a number of ways, the three most basic being: falling out of the level bottom, lethal sprites and lethal tiles.


What Keen loses when dying or exiting levels

Keen gains\loses four items when dying

This patch changes the value of four things Keen has when he dies. In the example provided below it gives Keen all four keycards (Sets them to 1) when he dies. (Setting them to 0 is useless unless using the change things on level win patch.) The four variables changed are marked in brown, the four values they are set to in blue. To set less than four variables, simply delete a $C7 $06 $AAxxW} $yyyyW string. To add a variable to change simply insert a $C7 $06 $AAxxW} $yyyyW string. A maximum of 10 variables can be altered in this way.

The final 'extra' variable changed is Keen's lives, $FF $0E $AAC6W means 'decrease Keen's lives by 1'; something usually wanted when Keen dies. Removing this will in effect give Keen infinite lives.

See also Patch:Game stats. This patch, and all that are built on it is incompatible with Keen losing ship parts when dying in their levels. Using it will overwrite the relevant code, meaning Keen can get a ship part in a level, die, and still have it. It will also stop Keen losing keycards when he exits a level.

Keen 1

#When Keen dies, give keycards
%patch $8041 $E8 $CF16W  $90
%patch $4F58 $EB $46 $C7 $06 {$AA9EW}  [$0001W]  $C7 $06 {$AAA0W}  [$0001W]
             $C7 $06 {$AAA2W}  [$0001W]  $C7 $06 {$AAA4W}  [$0001W]  $FF $0E 
             {$AAC6W}  $C3


Ship Parts

In Keen 1 Keen will lose a ship part if he dies in the level he obtained it. These are the levels the parts are found in by default. If Keen dies in these levels after getting a part, the part will be removed, thus preventing Keen from getting a part and not completing the level. This can come as a shock to modders who find parts they have 'disappearing' when they die in a custom level.

It is possible to make more than one level remove a part on death by altering the brown jumps in the first set of patches, though care is required. Changing the level to something 'impossible' such as level 100 will mean that no level Keen can enter in the game will remove his ship parts. (Or there is a patch to ignore ship part removal entirely.)

This patch can be modified so that Keen loses other things in special levels, like his ammunition. It can also be altered to give Keen things. Only one thing can be changed per level. See also Patch:Ship Parts

Keen 1 parts level stuff

#Parts levels (Part removed if you die in this level)
%patch $4F69 {$0008W} [$74] #Joystick
%patch $4F70 {$0003W} [$74] #Battery
%patch $4F75 {$0004W} [$74] #Vacuum
%patch $4F7C {$0010W} [$74] #Whiskey

#What happens in special levels; set {brown} to value [blue]
%patch $4F8C {$AA94W} [$0000W] #Joystick
%patch $4F84 {$AA9CW} [$0000W] #Battery
%patch $4F94 {$AA96W} [$0000W] #Vacuum
%patch $4F9C {$AA98W} [$0000W] #Whiskey

<patch title="Keen 1>

  1. Don't ever remove Keen's ship parts

%patch $4F73 $EB</syntaxhighlight>


Keen gets\loses something when killed by lethal tiles but not enemies

This patch changes a single game stat every time Keen is killed by a lethal tile. (But not when killed by enemies.) This can do anything from set his ammo to 0 to giving him Ankh time. (Which he can then use at the level start.) If Keen has hitpoints this can be even more useful.

The default item being given in this patch is the red keycard, but anything else will work just as well. This patch also requires the C T Space Cheat to be disabled, which is what the first line does. (It can be made compatible with the C T Space cheat however.)

Hazard tiles give Keen a red card when he dies

#Hazard tiles give Keen a red card when he dies - Keen 3
%patch $114E $EB $16
%patch $7A32 $E8 $4F $94
%patch $0E84 $C7 $06  {$9D20W}  [$0001W]  $E8 $6A7CW  $C3


Sprite Behavior

There are four references to the dead Keen behavior code. The first stops the camera following dead Keen to the top of the level, this makes Keen's death much quicker. The second changes Keen's code to dead when he dies. The third changes Keen's code when he falls out of the bottom of the level. The fourth stops Keen from 're-dying' on deadly things once dead, this stops him being stuck in an infinite loop of dying over and over.

The last three references are important. If the death behavior is changed then they too must be changed and they must all be the same to avoid any bugs. It is possible to make more than one behavior 'unkillable', though this is difficult.

Dead Keen's behavior

#Dead Keen's behavior: Keen 1
%patch $4275 {$41F8W}       #Keen uses this behavior when killed by sprites or tiles
%patch $42B3 {$41F8W}       #Keen uses this behavior when killed by falling out of the level
%patch $42F6 {$41F8W} [$75] #Dead Keen can't 're-die'

#Dead Keen's behavior: Keen 2
%patch $70B7 {$703AW}       #Keen uses this behavior when killed by sprites or tiles
%patch $70F5 {$703AW}       #Keen uses this behavior when killed by falling out of the level
%patch $7138 {$703AW} [$75] #Dead Keen can't 're-die'

#Dead Keen's behavior: Keen 3
%patch $7920 {$789EW}       #Keen uses this behavior when killed by sprites or tiles
%patch $795D {$789EW}       #Keen uses this behavior when killed by falling out of the level
%patch $799F {$789EW} [$75] #Dead Keen can't 're-die'


Keen loses level while onscreen

This patch alters things so that the level is lost while Keen is still onscreen, instead of when he flies offscreen. The blue value is the pause before the level is lost.

Keen loses level while onscreen

#Lose level after pause -Keen 1
%patch $4206 [$00C8W]
%patch $420A $C7 $06 $8220W  $0000W  $5D $C3


Screen doesn't follow dead Keen

By default the screen does not follow Keen when he has died; instead the level restarts when he moves offscreen. It is possible to make the screen follow Keen even when he is dead and\or not when he is doing other things. See also Patch:Jump conditions.

Screen doesn't follow dead Keen

#Camera don't follow player if using this behavior: Keen 1
%patch $342F {$41F8W} [$75]

#Camera don't follow player if using this behavior: Keen 2
%patch $6271 {$703AW} [$75]

#Camera don't follow player if using this behavior: Keen 3
%patch $6AD4 {$789EW} [$75]


Screen follows dead Keen

This patch makes the screen always follow Keen, dead or not. When dead Keen will head to the top of the level by default, only exiting to the map when he reaches the level top.

Screen follows dead Keen

#Screen follows dead Keen: Keen 1
%patch $342B $EB $09

#Screen follows dead Keen: Keen 2
%patch $626D $EB $09

#Screen follows dead Keen: Keen 3
%patch $6AD0 $EB $09


Speed

When Keen is killed all his vertical and horizontal motion stops and he hovers in the air for a short time. After this he moves up and left offscreen. By default this is necessary as the level will only restart when he disappears off the top of the screen. His horizontal speed is randomly left or right and doesn't really add much.

Dead Keen's speeds

#Dead Keen's speeds: Keen 1
%patch $4214 [$FF80W] #Horizontal
%patch $421D [$FE70W] #Vertical

#Dead Keen's speeds: Keen 2
%patch $7056 [$FF80W] #Horizontal
%patch $705F [$FE70W] #Vertical

#Dead Keen's speeds: Keen 3
%patch $78BD [$FF80W] #Horizontal
%patch $78C6 [$FE70W] #Vertical


Keen doesn't stop moving when killed

These patches stop Keen coming to a halt when killed. This means that whatever speed he has when killed he will keep, even moving offscreen in directions other than up. (Keen will not restart the level if he exits via the bottom of the screen.) Once again there are two situations this happens, when killed in-level and when falling out of the level bottom.

Keen doesn't stop moving when killed

#Keen doesn't stop moving when killed: Keen 1
%patch $428A $EB $0C #Killed in level
%patch $42C8 $EB $0C #Killed by falling out of level

#Keen doesn't stop moving when killed: Keen 2
%patch $70CC $EB $0C #Killed in level
%patch $710A $EB $0C #Killed by falling out of level

#Keen doesn't stop moving when killed: Keen 3
%patch $7935 $EB $0C #Killed in level
%patch $7972 $EB $0C #Killed by falling out of level


Pause before dead Keen flies up offscreen

This is the time Keen spends 'standing still' when killed, before he flies up offscreen. This is by default to take advantage of the long death sound, but modders may not want to wait so long before being able to restart the level.

Pause before dead Keen flies up offscreen

#Pause before dead Keen flies up offscreen: Keen 1
%patch $4206 [$00C8W]

#Pause before dead Keen flies up offscreen: Keen 2
%patch $7048 [$00C8W]

#Pause before dead Keen flies up offscreen: Keen 3
%patch $78AF [$00C8W]


Sprite Collision

When Keen dies his collision is set to 'nothing' which means he can't be pushed, stunned, etc when dead. This stops bugs where dead Keen could be 'resurrected' by interacting with other sprites. This happens in two occasions, firstly when Keen is killed in-level and secondly when he falls out of the level bottom.

Dead Keen's collision

#Dead Keen's collision: Keen 1
%patch $427B {$3360W} #Killed in-level
%patch $42B9 {$3360W} #Falls out of level

#Dead Keen's collision: Keen 2
%patch $70BD {$61A2W} #Killed in-level
%patch $70FB {$61A2W} #Falls out of level

#Dead Keen's collision: Keen 3
%patch $7926 {$6A00W} #Killed in-level
%patch $7963 {$6A00W} #Falls out of level


Don't change Keen's collision

This patch stops Keen's collision being changed when he dies. As noted above this means he can still collide with other sprites, which causes a number of possible 'escapes' from death.

Dead Keen's collision

#Dead Keen's collision: Keen 1
%patch $4277 $EB $04 #Killed in-level
%patch $42B5 $EB $04 #Falls out of level

#Dead Keen's collision: Keen 2
%patch $70B9 $EB $04 #Killed in-level
%patch $70F7 $EB $04 #Falls out of level

#Dead Keen's collision: Keen 3
%patch $7922 $EB $04 #Killed in-level
%patch $795F $EB $04 #Falls out of level


Animations

Keen uses two frames when dead, looping continuously until the level restarts. The animation speed is $04, larger values give slower animation.

Dead Keen's animations

#Dead Keen's animations: Keen 1
%patch $422A [$16] #Dying
%patch $4227 [$01] #Frames used -1
%patch $4223 [$04] #Animation speed

#Dead Keen's animations: Keen 2
%patch $706C [$16] #Dying
%patch $7069 [$01] #Frames used -1
%patch $7065 [$04] #Animation speed

#Dead Keen's animations: Keen 3
%patch $78D3 [$16] #Dying
%patch $78D0 [$01] #Frames used -1
%patch $78CC [$04] #Animation speed


Difference between dead and standing frames: alignment

Since Keen's dead animations are a different height to his normal animations and when he dies Keen's feet stay in the same position, Keen must move down a number of pixels when he dies. By default this is simply the difference in height between the two sprites. As such this may need to be adjusted if graphics are changed. Alternatively this can be exploited for neat effects.

The value here is in 100ths of a pixels, so the default amount is 8 pixels down. (The maximum amount, $7FFFW is 8 tiles down.)

Note that these patches will interfere with and\or be overwritten by the 'Dying removes any points got in level' patch. However that patch contains the value patched below meaning it can be edited directly and have the same effect as this patch.

Amount dead Keen is kicked down

#Amount dead Keen is kicked down: Keen 1
%patch $4281 [$0800W]

#Amount dead Keen is kicked down: Keen 2
%patch $70C3 [$0800W]

#Amount dead Keen is kicked down: Keen 3
%patch $792C [$0800W]


Sounds

There are two 'death sounds'; the first is played when Keen dies in-level and the second when he dies by falling out of the level. When he falls out of the level his 'plummet sound' is also played.

Keen death sounds

#Keen death sounds: Keen 1
%patch $42A2 $08 #Keen dies in-level sound
%patch $42E0 $08 #Keen dies falling out of level sound
%patch $3408 $1B #Keen fall out of level sound

#Keen death sounds: Keen 2
%patch $70E4 $08 #Keen die in-level sound
%patch $7122 $08 #Keen die falling out of level sound
%patch $68E7 $1B #Keen fall out of level sound

#Keen death sounds: Keen 3
%patch $794D $08 #Keen die in-level sound
%patch $798A $08 #Keen die falling out of level sound
%patch $6AAF $1B #Keen fall out of level sound

Disable Keen death sounds

#Disable Keen death sounds: Keen 1
%patch $42A1 $EB $07 #Keen dies in-level sound disabled
%patch $42DF $EB $07 #Keen dies falling out of level sound disabled
%patch $3407 $EB $07 #Fall out of level sound disabled

#Disable Keen death sounds: Keen 2
%patch $70E3 $EB $07 #Keen die in-level sound disabled
%patch $7121 $EB $07 #Keen die falling out of level sound disabled
%patch $68E6 $EB $07 #Fall out of level sound disabled

#Disable Keen death sounds: Keen 3
%patch $794C $EB $06 #Keen die in-level sound disabled
%patch $7989 $EB $06 #Keen die falling out of level sound disabled
%patch $6AAE $EB $06 #Fall out of level sound disabled


Keen has hitpoints (health)

This patch alters things such that Keen has hitpoints or health. This means that when Keen touches an enemy (but not tile!) that should kill him he instead loses 1 hitpoint. When he is out of hitpoints he dies.

The way this patch is set up lives serve as hitpoints and Keen is given temporary invincibility via the Ankh timer. This means the patch is only feasible for Keen 3. This patch also requires the C T Space Cheat to be disabled, which is what the first line does. (It can be made compatible with the C T Space cheat however.)

On the second line the game checks if Keen has a red keycard; if he does he will die instantly no matter how many hitpoints he has. (The card thus acts as a 'kill switch'.) See Patch:Game stats to alter the brown value that controls this. Setting it and the following blue value to $9D46W $0000W will disable this requirement. (But see end of description.)

On the third line the first set of brown-blue-brown values check to see if Keen has any Ankh time. If he does the code is exited and Keen is unaffected. If he does not however the second set of brown-blue-brown values check to see if he has 1 or less lives. If he does then Keen will exit the code and die. (This must be so because when Keen dies he will lose an additional life.)

On the fourth and final line the 'hurt' code is run. This decreases Keen's life count by 1 (marked in brown) and sets his Ankh time to $0120, giving him about a second of invincibility.

Note that using this patch rapidly reduces to normal gameplay unless there is some way to replenish Keen's lives. A good way of doing this is to use the 'reset Keen's lives on level entry' patch in this link.

After the first segment is an optional 'kill switch' patch. This gives Keen the red keycard when he touches a hazard tile which is the same thing that the first segment uses as a 'kill switch'. With this added to the patch Keen will die instantly when touching hazard tiles. With it absent hazard tiles will work with hitpoints.

Keen has hitpoints (health)

#Keen has hit points (lives) - Keen 3
%patch $114E $EB $16
%patch $790C $81 $3E {$9D20W}  [$0001W]  $0F $84 $06 $00 $E9 $954BW
%patch $0E64 $81 $3E {$9946W}  [$0000W]  {$7F} $12 $81 $3E {$9D46W}  [$0001W]  {$7E} $0D
             $FF $0E {$9D46W}  $C7 $06 {$9946W}  [$0120W]  $E9 $6AD3W  $E9 $6A98W

#Hazard tile is insta-kill
%patch $7A32 $E8 $4F $94
%patch $0E84 $C7 $06  {$9D20W}  [$0001W]  $E8 $6A7CW  $C3


Hitpoints and flinching

This is a modification of the above patch that causes lives to be used as health, with the player dying when this reaches zero. As an addition Keen will 'flinch' (Show a stunned animation) when hit.

There are several side-effects; pogo tiles are now lethal when got, C-T-Space and God Mode are disabled and useless. It's possible to alter what variable stores Keen's health or triggers death, as well as alter the stunned animations used.

Keen 3

#Lives now act as health; Keen dies when hit with 1 health
%patch $114E $EB $16  
#Pogo count triggers kill switch, used by hazard tiles
%patch $790C $81 $3E {$9D1AW}  [$0001W]  $0F $84 $06 $00 $E9 $954BW

#Main health code
%patch $0E64 $81 $3E {$9946W}  [$0000W]  $7F $28 $81 $3E {$9D46W}  [$0001W]  $7E $23    #Skips to points in code based on Ankh timer and lives
             $FF $0E {$9D46W}  $C7 $06 {$9946W}  [$0100W]  $C7 $44 $32 {$7F03W}  $8B    #Lose a life, Ankh timer set to 160 ($0100W), behavior set to 7F03
             $45 $20 $89 $44 $20 $8B $45 $22 $89 $44 $22 $C7 $44 $2A [$0018W]     #Flinch timer set to 24 ($0018W)
             $E9 $6ABDW  $E9 $6A82W                                             #End call for ankh time and 2+ lives, death call for 1 life

#Hazard tile gives pogo, triggering kill switch
%patch $7A32 $E8 $9465W 
%patch $0E9A $C7 $06  {$9D1AW}  [$0001W]  $E8 $6A66W  $C3

#Flinching behavior
%patch $7F03 $55 $8B $EC $83 $3E $6278W $00 $7C $08 $C7 $06 $38 $99 [$001CW]      #Checks direction, flinch left frame set to 28 ($001C)
             $EB $06 $C7 $06 $38 $99 [$001DW]  $A1 $993AW  $2B $06 $5D40W  $A3    #Flinch right frame set to 29 ($001D), time check
             $993AW  $83 $3E $993AW  $00 $7D $06 $C7 $06 $9942W  $6F07W  $83    #Time check, switch to 6F07 when timer hits 0
             $3E $9930W  $00 $7E $17 $B8 $FFFDW  $50 $E8 $E2E8W  $59 $83 $3E    #Check movement direction, alter l/r response
             $9930W  $00 $7D $06 $C7 $06 $9930W  $0000W  $EB $1C $83 $3E $9930W #Speed-related stuff (7F43-7F52)
                 $00 $7D $15 $B8 $0003W  $50 $E8 $E2CAW  $59 $83 $3E $9930W     #Speed-related stuff, alter l/r response
             $00 $7E $06 $C7 $06 $9930W  $0000W  $E8 $E345W  $E8 $E385W $E8     #Speed-related stuff, call gravity/tiles
             $EA90W  $5D $C3                                                    #Call movement (7F72-7F7A)

#Pogo count starts at 0 to avoid instant death
%patch $98F2 $0000W

#Keen doesn't need item to pogo
%patch $71BC $EB $05
%patch $744D $EB $0C


Shooting is suicide

It is possible to make it so that when Keen attempts to shoot, he instead dies. This removes a major gameplay mechanic (shooting.) and can lead to accidental deaths. It is incompatible with many shooting related patches. There are three sections to the patch. The first section is optional, it causes Keen to only be able to suicide if he has ammunition. This acts as a check on when Keen can suicide.

The second section causes Keen to die instantly when he shoots. The second section introduces a delay (here of $44 ticks), plays the shooting sound ($0C) and also changes Keen's animation to the first frozen frame ($1C). (Useful since the first section can inhibit animation change.)

<patch title=" Shooting is suicide -Keen 1>

  1. Optional section: Don't do anything if Keen has no pogo

%patch $3B3F $83 $3E {$AAC8W} [$00] {$74} $25 $33 $C0 $A3 $823CW $A3 $824CW $A3

            $824AW  $C7 $06 $8252W  {$3E12W}  $EB $12

%patch $3C5C $83 $3E {$AAC8W} [$00] {$74} $25 $33 $C0 $A3 $823CW $A3 $824CW $A3

            $824AW  $C7 $06 $8252W  {$3E12W}  $5D $C3

%patch $3DD5 $83 $3E {$AAC8W} [$00] {$74} $25 $33 $C0 $A3 $823CW $A3 $824CW $A3

            $824AW  $C7 $06 $8252W  {$3E12W}  $5E $5D $C3

%patch $400A $83 $3E {$AAC8W} [$00] {$74} $25 $33 $C0 $A3 $823CW $A3 $824CW $A3

            $824AW  $C7 $06 $8252W  {$3E12W}  $EB $12
  1. Option 1: Insta-kill

%patch $3E12 $55 $8B $EC $C7 $06 $8252W {$41F8W} $5D $C3

  1. Option 2: Delay, animation and sound

%patch $3E12 $55 $8B $EC $B8 [$000CW] $50 $E8 $80D7W $44 $44 $C7 $06 $8248W

            [$001CW]  $C7 $06 $8252W  {$3E2CW}  $5D $C3

%patch $3E2C $55 $8B $EC $A1 $824AW $03 $06 $5B14W $A3 $824AW $3D [$0044W]

            $7E $06 $C7 $06 $8252W  {$41F8W}  $5D $C3</syntaxhighlight>