Patch:Chain

From KeenWiki
Jump to navigation Jump to search

Chains are harmless sprites found in Keen 1, notable for producing the falling block that kills the Vorticon commander in standard playthroughs of the game.. This page lists patches relating to Chain sprites. It is divided into sections relating to the various sprite properties the patches involve. Being fluent with various sprite patch pages will help when working with these patches.

This page will also deal with the falling block produced by the chain when it is shot, this is a subsection of the sprite collision.


Sprite Type

Chains use sprite type 8 which doesn't affect Keen or any other sprites by default.

Keen 1

#Chain sprite type:
%patch $$18EE [$08]


Sprite Behavior

The Chain is interesting in that it uses for its main behavior the 'dead sprite' value used mostly by shot sprites. It sits and does nothing until it is destroyed. To compensate for this, its collision is the most complex of all sprites in Keen 1. (See below.)

Behaviors:
$3360W Sit
$22BBW Chain collision

When spawned

%patch $1911 {$3360W}

In level

%patch $1916 {$22BBW} #Chain collision


Sprite Collision

Chains have the most complex collision behavior in Keen 1. They react only with Keen's shot, but when they do so they create tile changes seen as the 'falling block', turn any Vorticon (Type 4) sprites below them into dead Vorticon sprites and themselves produce a Zap/Zot sprite. This is covered here, in separate sections.


Chain collision

The chain may produce two sprites when shot, the first is a Zap/Zot sprite produced every time a chain is destroyed. This can be considered the 'dead' chain. It vanishes quickly. The second is what any and all Vorticon (Sprite type 4) become if they are below or right of a shot chain. This relates more to Vorticon patches but is included here.

Keen 1

%patch $1916 {$22BBW}  #Chain collision
%patch $22C7 $3F [$0A] #Chain killed by Keen's shot

%patch $22D1 {$47E8W}  #Dead Chain behavior
%patch $22DA {$3360W}  #Dead Chain collision

%patch $2363 {$489DW}  #Dead Vorticon behavior
%patch $235E {$3360W}  #Dead Vorticon collision

Keen 1

#Sprite type killed by falling block:
%patch $2340 [$02] {$75}


Falling block

The falling block is a set of sequential tile replacements that make it appear as if a 2x6 block of tiles if falling downwards centered on where the chain was. This is sued by default to make it appear as if shooting the chain causes the Vorticon Commander below it to be crushed to death. The Vorticon death sequence was especially lengthened for this reason.

The falling block consists of a number of tile replacements done a certain number of times, each iteration being lower than the next. It is possible in theory to make the block move up, or sideways.


Block tiles

These are the tiles the block is composed of. The tiles the block 'leaves behind' behave the same way as the block tiles themselves and are just another tile replacement.

Change the block tiles

%patch $23CD [$01DCW] #Top left
%patch $2436 [$01DDW] #Top middle
%patch $24B6 [$01DEW] #Top right
%patch $23EF [$01E9W] #Bottom left
%patch $2458 [$01EAW] #Bottom middle
%patch $24D8 [$01EBW] #Bottom right
%patch $23AB [$009BW] #Left left behind
%patch $2414 [$009BW] #Middle left behind
%patch $2494 [$009BW] #Right left behind


Size of block and position of tiles

Width of block

The block width is given by four variables. The first and last give the horizontal position of the leftmost and rightmost columns of the block. The middle two control the left and right horizontal position of the middle columns. By default the block is 9 tiles wide going from -4 to +4. The block does not have to be symmetrical and can be moved far from the chain. Note variable 3 is a 1-byte value, not a 2-byte (word) value.

Width of block

%patch $238D [$FFFCW] #Top left tile here (-4)
%patch $23F4 [$FFFDW] #Left end of ALL middle tiles (-3)
%patch $2465 [$03]   #Right end of block middle (+3)
%patch $2476 [$0004W] #Top right tile here (+4)


Vertical position of entire block

This patch controls the vertical position of all the block's tiles together. By default it is one tile below the chain. The patches in the following section are vertical positions relative to this. (So the top of the block is 1 + 1 tiles down from the Chain in the block's first drop step.)

Vertical position of entire block relative to chain

#Vertical position of entire block relative to chain
%patch $231C [$01]


Vertical position of individual tiles

This gives the vertical position of individual block tiles in the block. The black replacement tiles have values of zero which cannot be patched. This means that problems can occur when the other block values are changed. This means that if the value is anything but default, problems will occur with the block being replaced by background unless the block is made to be 1 tile high with the top tiles being used as replacement replacement tiles.

Vertical position of tiles

%patch $23B5 [$01]   #Top left
%patch $241E [$01]   #Top middle
%patch $249E [$01]   #Top right
%patch $23D7 [$02]   #Bottom left
%patch $2440 [$02]   #Bottom middle
%patch $24C0 [$02]   #Bottom right


Remove tiles

This stops certain tiles from being changed as the block falls. This is worth keeping in mind when using these patches. For example, while deleting the bottom row of the block will not have any adverse effects, deleting the replacement tiles means as the block falls, nothing will put background tiles where it used to be, the old blocks will 'stack up'

Stop chain tiles appearing

%patch $23AA $C3 #left replacement
%patch $2413 $C3 #middle replacement
%patch $2493 $C3 #right replacement
%patch $23CC $C3 #Top left
%patch $23EE $C3 #Bottom left
%patch $2435 $C3 #Top middle
%patch $2457 $C3 #Bottom middle
%patch $24B5 $C3 #Top right
%patch $24D7 $C3 #Bottom right


How block falls

The block by default falls vertically, one tile at a time for four 'cycles' Since each cycle is 'drawn over' the previous one, changing the number of tiles from the default 1 will usually leave block tiles behind in the level, though with clever patching this can be avoided.

The block can be made to fall up. If a right moving block is used and the rightmost tiles have the door property and the block is positioned left behind Keen, the block can be made to push Keen along when 'activated'

Block falling

%patch $24E8 $04 #Number of fall cycles
%patch $24DD $01 #Distance in tiles block moves

%patch $24DC $00 #Make block fall l/r instead of u/d


Animations

The chain sticks with the sprite it was spawned with and doesn't animate. The zap\zot produced on destruction has a 50/50 chance of being either, though this ratio can be changed.

When spawned

%patch $191B [$0072W] #Start

When shot

%patch $22E8 [$006EW] #Zap
%patch $22EF [$006FW] #Zot

%patch $2359 [$0052W] #Dead Vorticon commander
%patch $2354 $06    #Frames used


Sounds

These are the sounds the sprite uses.

Keen 1

#Falling block sound
%patch $2344 $27

#Don't make falling block sound:
%patch $2347 $90 $90 $90


Misc

These are patches that do not fit into any of the above sections.


Chain doesn't kill Vorticons

Normally shooting a chain sprite causes all Vorticon (Type 4) sprites below/right of it to become dead Vorticon sprites. This patch prevents this.

Keen 1

#Chain doesn't kill Vorticons when shot
%patch $234C $5F $5E $5D $C3


No falling block

This stops the falling block being created but the Chain is still destroyed. It has the side effect of also removing the effects on Vorticons.

Keen 1

#Don't spawn falling block when chain shot
%patch $2369 $C3 $90

Play Yorp message

This will play the Yorp message for the level when the Chain is shot. To stop this happening multiple times the number of cycles has been set to 1 (Second line.) To remove the falling block entirely set this to 0.

Keen 1

#When chain is shot the Yorp message appears
%patch $24F3 $90
%patch $24E8 $01