Patch:Keen dying (Vorticons)

From KeenWiki
Jump to: navigation, 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.

Patch: 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

Patch: 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:
#Don't ever remove Keen's ship parts
%patch $4F73 $EB


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

Patch: 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.

Patch: 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.

Patch: 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.

Patch: 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.

Patch: 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.

Patch: Dead Keen's speeds
#Dead Keen's speeds: Keen 1
%patch $4214 $FF88W
#Horizontal
%patch $421D $FE70W
#Vertical
#Dead Keen's speeds: Keen 2
%patch $7056 $FF88W
#Horizontal
%patch $705F $FE70W
#Vertical
#Dead Keen's speeds: Keen 3
%patch $78BD $FF88W
#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.

Patch: 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.

Patch: 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.

Patch: 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.

Patch: 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.

Patch: 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.

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.

Patch: 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

Patch: 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.

Patch: 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


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:
#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
#Option 1: Insta-kill
%patch $3E12 $55 $8B $EC $C7 $06 $8252W $41F8W $5D $C3
#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