Patch:Doors (Vorticons)
This page covers patches relating to the doors in Keen Vorticons, how they open and interact with sprites (including Keen). For patches relating to the keycards that are needed to open them, see Patch:Keycard (Vorticons).
What is needed to open doors
By default a key of the right color is needed to open a door of a given color. The game checks this by using the first keycard variable as its start point. (Keys are thus not checked individually.) This means that all four keycard variables must be after each other. See also Jump conditions.
Notice something unusual,t his variable is in fact the pogo; not the yellow keycard. Because of the way the game checks tile types it treats this as '0' with the yellow doors being type 2. In short this means the value given here must be 4 less than the first keycard value.
Keen 1
#First keycard variable checked when touching doors:
%patch $4394 {$9AAAW} [$00] {$74}
Doors open if Keen has the pogo, ammo, etc
This patch makes various doors open if Keen has something other than a keycard. (Here the pogo is used.) The first four blue values affect what doors specifically are affected. (Here all four are affected. Replacing $0AF2 with $43AD will restore a door to normal, keys only behavior.)
The first brown\blue value pair is the check for Keen's keycards, starting with the first keycard variable. The second pair checks Keen's special item. (Here the pogo.) s such keys are checked for first, then the special item; opening doors will cause Keen to lose that key if he has it, special item or not.
Notice, as noted in the above section, that the first check is actually for Keen's pogo too.This is explained in the previous section and is an odd quirk.
This patch is incompatible with other $0AF2 using patches.
Keen 1
#Doors always open if pogo got
%patch $4592 [$0AF2W] #Yellow
[$0AF2W] #Red
[$0AF2W] #Green
[$0AF2W] #Blue
#Door check for keys or pogo code
%patch $0AF2 $8B $5E $F6 $D1 $E3 $83 $BF {$AA9AW} [$00] $74 $0B $56 $57 $E8 $1CF5W
$83 $C4 $04 $E9 $3A6FW $83 $3E {$AA9AW} [$00] $75 $EE $E9 $3891W
Doors on map
This patch allows you to place doors on the map level. These doors do not "push" Keen like doors in-level, they simply act like blocks unless Keen has the right keycard, in which case he can walk over them. Because keycards are used by default you may want the "do not remove keycards" patch. Note that the keycard is not removed by the map door and the map door does not "open". In-level doors are unaffected.
This patch works by hijacking the map blocking code, so in order to act as a door the door tiles must be blocking on the relevant side(s) or Keen will pass straight through them even without a keycard. This is the exact opposite of in-level doors which cannot be blocking.
The map door checking function uses game stats, it checks for a value of 1 for yellow cards and the three variables after it and responds accordingly. Changing this to $AA94W will make the ship parts act like keys (for map doors only!) Other values can be used too. The blue $03 is the number of possible keys (Default is 3 + 1 = 4). The blue $02 is the first tile property affected by the patch. (In this case $02, the yellow door.) The blue $01 is the value the game checks for.
The map doors patch is not compatible with the v2 patch.
Keen 1
#Our map-door-checking function
%patch $6884 $3D $0000W $9F $88
$E0 $8B $9F $6E $05 $83 $EB [$02] $7C $0F $83 $FB [$03] $7F $0A $D1
$E3 $83 $BF {$AA9EW} [$01] $9F $08 $C4 $9E $74 $05 $58 $05 [$001AW]
$50 $C3
#Call the map-door-checking function from appropriate spots
%patch $A71B $8B $87 $34 $0A $E8 $C162W
%patch $A808 $8B $87 $C0 $13 $E8 $C075W
%patch $A933 $8B $87 $86 $18 $E8 $BF4AW
%patch $AA20 $8B $87 $FA $0E $E8 $BE5DW
Door "bouncing"
By default doors will "bounce" Keen back when he walks into them. It is possible to change, or even remove the bouncing. It's even possible to reverse the bounce, making doors suck Keen.
Keen 1
#How much door bounces Keen
%patch $43B4 [$F000W] #From left?
%patch $43CC [$1000W] #From right
Keen 2
#How much door bounces Keen
%patch $71F6 [$F000W] #From left?
%patch $720E [$1000W] #From right
Doors do not "bounce" Keen
This patch makes the doors act like normal walls instead of "bouncing" Keen — pushing him away from them when he tries to open one without the right key. It is a small, but annoying effect. This patch requires the Status Window patch to work, otherwise the game will crash.
Doors do not "bounce" Keen
#Call Keen-door interaction
%patch $2F31 $E8 $9D $E1 $90 $90 #Moving right
%patch $2FE6 $E8 $0B $E1 $90 $90 #Moving left
#Keen-door interaction code
%patch $10D1 $81 $3E $54 $82 $C4 $45 $75 $15
$8B $87 $6E $05 $48 $48 $3D $04
$00 $73 $0A $89 $C3 $D1 $E3 $83
$BF $9E $AA $01 $C3 $83 $BF $86
$18 $00 $C3 $81 $3E $54 $82 $C4
$45 $75 $15 $8B $87 $6E $05 $48
$48 $3D $04 $00 $73 $0A $89 $C3
$D1 $E3 $83 $BF $9E $AA $01 $C3
$83 $BF $FA $0E $00 $C3
#Ignore default bouncing code
%patch $43A4 $E9 $D1 $01
Door replacement tiles
These patches cover what tiles are left behind when the doors are opened. By default, in Keen 1/2, when a door is opened, 3 tiles are copied, the door top, and the two tiles the door is standing on. The door top and the tile next to it in the tileset then move down, while the other 2 tiles become foreground so you cannot see the door sink into the ground. The door is replaced by two tiles, by default tile 143.
In the patch below vertical locations are in blue, the first two control the two ground tiles that are below the door, the third is the doortop tile (and thus the door bottom tile too). If you patch it right, you can make a door's opening animation use different tiles from the door itself. (But these will have to be in-level!) The last two red values are the vertical locations of the door's replacement tiles. The two brown values are the top and bottom replacement tiles.
Keen 1
#Adjust door opening sequence
%patch $2889 [$03 $00]
%patch $28A1 $C7 $05 [$02 $00] $F7 $2E $08 $6C $03 $46 $04 $D1 $E0 $C4 $1E $48
$6C $03 $D8 $26 $8B $07 $89 $44 $0E $8B $C7 $05 [$00 $00] $F7 $2E
%patch $28C1 $08 $6C $03 $46 $04 $D1 $E0 $C4 $1E $48 $6C $03 $D8 $26 $8B $07
$89 $44 $10 $8B $5E $FE $D1 $E3 $C7 $87 $9A $AA $00 $00 $8B $C7
%patch $28E1 $05 [$00 $00] $F7 $2E $08 $6C $03 $46 $04 $D1 $E0 $C4 $1E $48 $6C
$03 $D8 $26 $C7 $07 {$8F $00} $8B $C7 $05 [$01 $00] $F7 $2E $08 $6C
%patch $2901 $03 $46 $04 $D1 $E0 $C4 $1E $48 $6C $03 $D8 $26 $C7 $07 {$8F $00}
$5F $5E $8B $E5 $5D $C3 $90 $90
This patch, a part of Patch:Background tiles, makes a door use the first tile in its row (in the tileset) as its replacement tiles when it is opened. See that page for details.
Keen 1
#Change doors to use first tile in tileset row when opened
%patch $28EC $26 $8B $07 $B6
%patch $28F0 [$0D] $F6 $FE $F6 $EE $26 $89 $07
%patch $28F8 $03 $1E $08 $6C $03 $1E $08 $6C
%patch $2900 $26 $89 $07 $90 $90 $90 $90 $90
Finally, this is a simple patch to change the door's replacement tiles. By default, they are tile 143 (grey background).
Keen 1
#Tiles door leaves behind when opened
%patch $28EF {$8F $00} #Top
%patch $2906 {$8F $00} #Bottom
Sounds
These are the sounds doors use in the game. A single sound is played when a door is opened. This can be blocked.
Keen 1
#Door opening sound
%patch $2801 $21
#Don't play opening sound
%patch $2800 $EB $07
Keen 2
#Door opening sound
%patch $5643 $21
#Don't play opening sound
%patch $5642 $EB $07
Keen 3
#Door opening sound
%patch $5E6D $21
#Don't play opening sound
%patch $5E6C $EB $06
Doors vanish instantly
These patches make the door simply vanish instantly, instead of sliding down into the ground.
Keen 1
#Doors vanish instantly -Keen 1
%patch $273D $C3
#Doors vanish instantly -Keen 2
%patch $557F $C3
#Doors vanish instantly -Keen 3
%patch $5DA9 $C3
Misc
Keen 1
#Doors do not take keys when opened
%patch $28D7 $00
#Doors do not open, Keen can just walk right through them
#If he has the right key — over and over. (Does not take Keen's key.)
%patch $27F8 $C3
Keen 3
#Doors do not open, Keen can just walk right through them
#If he has the right key — over and over. (Does not take Keen's key.)
%patch $5E64 $C3