Patch:Keen stunned (Vorticons)

From KeenWiki
Jump to: navigation, search

This page contains patches that cover Keen being stunned\frozen and recovering, as well as his shots in Keen games. Patches for individual episodes that relate to the player can be found at Patch:Keen (Keen 1), Patch:Keen (Keen 2) and Patch:Keen (Keen 3).

The only difference between Keen being frozen in Keen 1 and stunned in Keen 2\3 is his appearance. As such frozen Keen is covered on this page and all references to Keen being frozen instead refer to him being stunned.


How stunning works

In Keen Vorticons stunning relates to player-sprite collision. When Keen touches a sprite of any type various code is run. In the case of certain types that code will stun Keen. once stunned keen will use a unique behavior that prevents the player controlling him until a specified amount of time runs out; after which he will execute a 'recover' sequence, still not under the player's control.

Sprites that induce stunning are the Vortikid (Vorticon Youth) in Keen 2 and Keen 3.


Stun\recovery time

This is how long the player is stunned for. There is also an additional time, the 'recovery time' when the player cannot control Keen, but Keen's animation is different.

Patch: Keen 1
#Frozen time
%patch $468E $0300W
#Keen defrosting time
%patch $271C $C0

Patch: Keen 2
#Stun time
%patch $73FA $0190W
#Keen unstunning time
%patch $4A54 $D8

Patch: Keen 3
#Stun time
%patch $7CA2 $0190W
#Keen unstunning time
%patch $5581 $D8


Keen dies instead of recovering

This patch causes Keen to die instead of recovering when his stun time is up. It has two parts, the first line stops Keen from re-stunning or interacting with any other sprites until the level is reloaded. The second line runs his death code instead of his recover code.

Patch: Keen 3
#Keen dies instead of recovering from stunning
%patch $557D $C7 $06 $44 $99 $6A00W $90 %patch $5588 $789EW


Keen dies instead of recovering - reset score tweak

The above patch is incompatible however with the 'dying removes any points got in level' patch in that if Keen dies after being stunned his score will not be reset. The following patch includes the score reset patch with the side effect that Keen will move slightly differently when stunned. (His motion will stop entirely.)

Removing the two other score resets will make only Keen's stun-death resetting the score. Note that the blue $0800Ws are the alignments for Keen's death sprite.

Patch: Keen 3
#Save score on level load
%patch $81B7 $66 $A1 $9D4AW $66 $A3 $AF00W $66 $33 $C0 $66 $A3 $5361W $66 $A3 $586AW $A3 $5D40W $90
#Reset score on death A
%patch $7928 $66 $81 $06 $0E $71 $0800W $0000W $66 $A1 $AF00W $66 $A3 $9D4AW $90 $90
#Reset score on death B
%patch $7965 $66 $81 $06 $0E $71 $0800W $0000W $66 $A1 $AF00W $66 $A3 $9D4AW $90 $90
#Keen dies instead of recovering from stunning -reset score C
%patch $5576 $1D $C7 $06 $44 $99 $6A00W $C7 $06 $42 $99 $789EW $66 $81 $06 $0E $71 $0800W $0000W $66 $A1 $AF00W $66 $A3 $9D4AW $C7 $06 $9930W $0000W $E8 $0D17W $E8 $0D57W $E8 $1462W $5D $C3


Stunning, freezing and sounds

When Keen is frozen in Keen 1 a sound is played. This is not the case for the other two episodes.

Patch: Keen 1
#Keen frozen sound
%patch $4691 $28


Don't play a sound when Keen is frozen

This patch for Keen 1 stops the freeze sound being played.

Patch: Keen 1
#Keen frozen sound disabled
%patch $4690 $EB $07


Play a sound when Keen is stunned

This patch plays a sound every time keen is stunned. it may have some side effects as it overwrites some of the stunning code. The brown value is Keen's stun behavior, the first blue value his stunned time and the second the sound to play.

Patch: Keen 3
#Play a sound when Keen is stunned
%patch $7C8E $C7 $44 $32 $5553W $C7 $44 $2A $0190W $B8 $0003W $50 $E8 $4CCAW $59 $EB $12


Complete Keen being stunned codes

This is the complete code run when Keen contacts a sprite of a stunning type. (See the relevant game's Keen page for details.) The two details of interest are the brown variable, which is the new behavior Keen uses (Being stunned) while the blue variable is how log he will be stunned for. It is not known what the rest of the code does.

These patches contain, and are thus incompatible with, other patches on this page.


Keen 1

This is the complete code run when Keen is frozen in Keen 1. The first thing done is to set Keen's behavior is to $4A29W and his stun time set at $0320W. After this sound $28 is played.

Patch: Keen 1
#Keen be stunned code
%patch $467A $C7 $44 $32 $26FEW $8B $45 $20 $89 $44 $20 $8B $45 $22 $89 $44 $22 $C7 $44 $2A $0320W $B8 $0028W $50 $E8 $785CW $44 $44


Keen 2

The code for Keen 2 is the simplest of all Vorticons codes. The first thing done is to check Keen's behavior, if it is $4A29W, that is, if Keen is already stunned, then the stun code is skipped. Otherwise Keen's behavior is set to $4A29W and his stun time set at $0190W, along with some code to give Keen the speed of the sprite that stunned him.

Patch: Keen 2
#Keen be stunned code
%patch $73DF $81 $7C $32 $4A29W $74 $1B $C7 $44 $32 $4A29W $8B $45 $20 $89 $44 $20 $8B $45 $22 $89 $44 $22 $C7 $44 $2A $0190W


Keen 3

The code for Keen 3 is quite simple. On the first line Keen's behavior is checked. (The brown $32 is the sprite parameter to check.) If he is using the stunned behavior $5553W then the entire code is skipped (Stunned Keen cannot be re-stunned.) The next thing checked is the GOD mode status. (If Keen has god mode on he will not stun. See Patch:Game stats.)

The third thing checked is the Ankh time; if Keen has anything but 0 Ankh time he will not stun. Finally the stun code itself is reached. Keen's behavior is set to $5553W and his stun time is set to $0190W.

Patch: Keen 3
#Keen be stunned code
%patch $7C77 $81 $7C $32 $5553W $74 $0E $83 $3E $5FD6W $00 $75 $07 $83 $3E $9946W $00 $74 $02 $EB $26 $C7 $44 $32 $5553W $8B $45 $20 $89 $44 $20 $8B $45 $22 $89 $44 $22 $C7 $44 $2A $0190W


Complete Keen stunned codes

These patches contain the complete stunned code (the code run when Keen is uncontrollable) for various games.


Keen 1

Frozen Keen's behavior sets his frozen and unfreezing animations as well as the code that is used when Keen returns to normal ($3867W, normal Keen behavior, highlighted in brown.) The last three $E8 $xxxxW code segments call gravity, clipping and movement code. Replacing the first with $90 $90 $90 will stop frozen Keen from falling (he will float.), the second will make him fall through tiles like a ghost (And likely die.) and the third will stop him moving completely.

Patch: Keen 1
#Frozen Keen behavior
%patch $26FE $55 $8B $EC $A1 $35 $51 $B1 $05 $D3 $E8 $25 $01 $00 $05 $001CW
#Frozen sprite animation speed, frames and sprite
$A3 $48 $82 $A1 $4A $82 $2B $06 $14 $5B $A3 $4A $82 $0B $C0 $7D
#Check time remaining
$13 $C7 $06 $48 $82 $001FW $83 $3E $4A $82 $CE $7D $06 $C7 $06
#Unfreezing sprite
$52 $82 $3867W $E8 $04F5W $E8 $0535W $E8 $0C2AW $5D $C3
#Unfreeze. Call gravity, stand on tiles and movement


Keen 2

This is the complete Keen 2 stunned code. Is is rather complex. On the first line Keen's stunned animation and number of stunned frames are set (Marked in blue.) On the second line the amount of time remaining is checked, on the third line if it is below a certain value Keen's animation changes to that of recovering. A second check sets the recovery time ($D8 by default.) On the fourth line Keen will recover if the recovery time is up by changing his sprite behavior. On the same line Keen's speed is checked, if it is rightwards he will receive a small leftwards kick and have his speed set to zero. If it is left he will receive a small positive kick and have his speed set to zero. Finally the two brown $E8 $xxxxWs in the last row are the gravity tile collision and movement checks, replacing the first with $90 $90 $90 will make stunned Keen float, replacing the second will make him ghost through tiles (And likely fall offscreen and die.) and replacing the third will stop him moving completely when stunned.

Patch: Keen 2
#Complete Keen 2 stunned code
%patch $4A29 $55 $8B $EC $A1 $11 $51 $B1 $05 $D3 $E8 $25 $0001W $05 $001CW
#Stunned animation
$A3 $E8 $96 $A1 $EA $96 $2B $06 $F0 $5A $A3 $96EAW $0B $C0 $7D
#Check time remaining
$13 $C7 $06 $E8 $96 $001CW $83 $3E $96EAW $D8 $7D $06 $C7 $06
#If 0, go to recovering stunned animation
$F2 $96 $66A9W $83 $3E $96E0W $00 $7E $18 $B8 $FFFDW $50 $E8
#If recovered change behavior, check movement direction
$71 $0F $44 $44 $83 $3E $96E0W $00 $7D $25 $C7 $06 $96E0W $0000W
#If moving right set speed = 0
$EB $1D $83 $3E $96E0W $00 $7D $16 $B8 $0003W $50 $E8 $0F52W $44 $44 $83 $3E $96E0W $00 $7E $06 $C7 $06 $96E0W $0000W
#If moving left set speed = 0
$E8 $0FD0W $E8 $1010W $E8 $1705W $5D $C3
#Unstun. Call gravity, stand on tiles and movement


Keen 3

This is the complete Keen 3 stunned code. Is is rather complex. On the first line Keen's stunned animation and number of stunned frames are set (Marked in blue.) On the second line the amount of time remaining is checked, on the third line if it is zero Keen's animation changes to that of recovering. A second check sets the recovery time ($D8 by default.) On the fourth line Keen will recover if the recoery time is up by changing his sprite behavior. On the same line Keen's speed is checked, if it is rightwards he will receive a small leftwards kick and have his speed set to zero. If it is left he will receive a small positive kick and have his speed set to zero. Finally the two brown $E8 $xxxxWs in the last row are the gravity and tile collision checks, replacing the first with $90 $90 $90 will make stunned Keen float, replacing the second will make him ghost through tiles (And likely fall offscreen and die.) and replacing the third will stop him moving completely when stunned.

Patch: Keen 3
#Complete Keen 3 stunned code
%patch $5553 $55 $8B $EC $A1 $61 $53 $B1 $05 $D3 $E8 $25 $0001W $05 $001CW
#Stunned animation
$A3 $38 $99 $A1 $3A $99 $2B $06 $40 $5D $A3 $3A $99 $83 $3E $993AW
#Check time remaining
$00 $7D $13 $C7 $06 $38 $99 $001EW $83 $3E $993AW $D8 $7D
#If 0, go to recovering stunned animation
$06 $C7 $06 $42 $99 $6F07W $83 $3E $9930W $00 $7E $17 $B8 $FFFDW
#If recovered change behavior, check movement direction
$50 $E8 $0C90W $59 $83 $3E $9930W $00 $7D $06 $C7 $06 $9930W
#If moving right set speed = 0
$0000W $EB $1C $83 $3E $9930W $00 $7D $15 $B8 $0003W $50
#If moving left set speed = 0
$E8 $0C72W $59 $83 $3E $9930W $00 $7E $06 $C7 $06 $9930W $0000W $E8 $0CEDW $E8 $0D2DW $E8 $1438W $5D $C3
#Unstun. Call gravity, stand on tiles and movement


Stunned Keen can be 're-stunned'

These patch remove the behavior checks. This means that when Keen is stunned\frozen he can be 're-stunned'; resetting his stun time. This makes stunning even more aggravating as enemies can continually re-stun Keen, possibly trapping the player in an infinite loop. This does not apply to Keen 1, where frozen Keen can be re-frozen, resetting his stun time to 0.

Patch: Stunned Keen can be 're-stunned'
#Stunned Keen can be 're-stunned' - Keen 2
%patch $7407 $73E6W
#Stunned Keen can be 're-stunned' - Keen 3
%patch $7CBA $7C7EW


Still be stunned with GOD mode

This patch allows Keen to always be stunned by the Vortikid (Vorticon Youth) in Keen 3, even if he has GOD mode enabled. In Keen 1 and 2 Keen can always be frozen\stunned whether or not he has GOD mode.

Patch: Keen can still be stunned by Youths with GOD mode
#Keen can still be stunned by Youths with GOD mode - Keen 3
%patch $7C83 $90 $90


Youths stun Keen even with Ankh

As expected this patch allows the Youths to stun Keen even if he has Ankh time remaining. There is no equivalent patch for Icecubes. or Youths in Keen 2.

Patch: Keen 3
#Youths stun Keen even with Ankh
%patch $7C8A $EB


Keen's animations

Keen has a two animation loop when stunned that continues until recovery. The recovery frame does not animate but quickly changes when the player recovers.

Patch: Keen stunned\frozen animations
#Keen 1
%patch $270C $1C
#Frozen
%patch $2709 $01
#Frames used -1
%patch $2705 $05
#Animation speed
%patch $2723 $1F
#Keen unfreezing
#Keen 2
%patch $4A37 $1C
#Keen stunned
%patch $4A34 $01
#Frames used -1
%patch $4A30 $05
#Animation speed
%patch $4A4E $1F
#Keen recovering
#Keen 3
%patch $5561 $1C
#Keen stunned
%patch $555E $01
#Frames used
%patch $555A $05
#Animation speed
%patch $557B $1E
#Keen recovering


Keen wins the level instead of stunning

This patch makes Keen win the level instead of being stunned. The level is exited instantly. This code replaces Keen's behavior so all the restrictions relating to ankh time and god mode are still in place. (Keen cannot win the level this was if cheating, by default.)

Patch: Keen wins the level instead of stunning
#Keen wins the level instead of stunning - Keen 3
%patch $7C93 $C7 $06 $8C $6E $0001W


Keen wins the level instead of recovering from stunning

This patch is similar to the above, except keen wins the level when he recovers.

Patch: Keen wins the level instead of recovering from stunning
#Keen wins the level instead of recovering from stunning - Keen 3
%patch $5577 $C7 $06 $8C $6E $0001W