Patch:Zap and zot

From KeenWiki
Jump to: navigation, search

Zap and Zots are sprites found in Keen Vorticons, usually produced when some sort of shot is destroyed. This page lists patches relating to Zap/Zot 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.

Each section is divided by episode since these sprites appear in three Keen games. They are very simple, but unique things can be done with them.


Identifying Zap/Zot sprites

Although only two animations are used for all zap and zot sprites, there are actually dozens of different sprites in different situations. As such it is helpful to have a shorthand for the sprites involved. For every episode each zap/zot sprite will be given a number to identify them. Each sprite has its own animations, behavior, and purpose.

Many zap/zots are created by transforming other sprites ans as such have their properties determined by that sprite. As an example, when shots hit walls they become a zap/zot, retaining all the properties of the shot that made them.

Keen 1:
 1: Keen's shot hits right wall and Keen at same time
 2: Keen's shot hits left wall and Keen at same time
 3: Keen's shot hits tiles
 4: Keen's shot hits sprites
 5: Tank's shot hits right wall and Tank
 6: Tank's shot hits left wall and Tank
 7: Tank's shot hits sprites
 8: Created when chains are shot
Keen 2:
 1: Tantalus tiles destroyed
 2: Keen's or enemy's shot hits right wall and sprite at same time
 3: Keen's or enemy's shot hits left wall and sprite at same time
 4: Keen's or enemy's shot hits tiles
 5: Keen's or enemy's shot hits sprites
 6: ???
 7: ???
 8: Keen's or enemy's shot hits another zap/zot
Keen 3:
 1: Vortimom's shot hits right wall and Vortimom at same time
 2: Vortimom's shot hits left wall and Vortimom at same time
 3: Vortimom's bullet hits tiles
 4: Vortimom's bullet hits sprites
 5: Orange gun bullet hits tiles
 6: Mangling machine bits are destroyed
 7: Keen's shot hits right wall and Keen at same time
 8: Keen's shot hits left wall and Keen at same time
 9: Keen's shot hits tiles
10: Keen's shot hits sprites
11: Unknown function
12: Unknown function
13: Unused death behavior $8013


Sprite Type

Zap/Zots use sprite type 13\14 (Keen 1) which doesn't interact with anything and is just a unique identifier. Some zap/zots have no sprite type, such as #4 in Keen 1, these are transformations, that is they are created from another sprite and continue to use that sprite's properties. The zap/zot behavior (See below) sets the sprite property twice, first to 14, which can be considered the 'proper' Zap/zot behavior, then to 0 when the zap/zot disappears. This is in fact what makes the zap/zot vanish and it is best not interfered with.

Patch: Keen 1
%patch $4754 $0D 
#Zap 1
%patch $47C5 $0D
#Zap 2
%patch $4822 $0D
#Zap 3
%patch $4971 $0D
#Zap 5
%patch $49DD $0D
#Zap 6
#Behavior sets property to:
%patch $47EF $0E
#Initial
%patch $4804 $00
#Final


Sprite Behavior

The purpose of the zap/zot is to show destruction and then disappear. As such they all use a short behavior that lets them sit for a time then vanish. Their collision is the 'do nothing' behavior so they don't interact with other sprites. The lack of collisions is notable and related to the production of zap/zots from other sprites; their brief duration means that nothing should have a chance to collide with them.

If zap/zots are given a new behavior they can quickly fill the level and crash the game unless managed wisely. The disappearing is actually a behavior change to 'nothing', which means it's possible to make zap/zots transform into things like Gargs. Again, this can cause sprite overload problems.

Patch: Keen 1 behavior pointers
#Zap\zot behavior pointers
%patch $4759 $47E8W
#Zap 1
%patch $47CA $47E8W
#Zap 2
%patch $4828 $47E8W
#Zap 3
%patch $486A $47E8W
#Zap 4
%patch $4976 $47E8W
#Zap 5
%patch $49E2 $47E8W
#Zap 6
%patch $4A21 $47E8W
#Zap 7
%patch $22D1 $47E8W
#Zap 8

Patch: Keen 2 behavior pointers
#Zap\zot behavior pointers
%patch $4803 $7547W
#Zap 1
%patch $74B8 $7547W
#Zap 2
%patch $7529 $7547W
#Zap 3
%patch $7587 $7547W
#Zap 4
%patch $75C9 $7547W
#Zap 5
%patch $7529 $7547W
#Zap 6
%patch $76D5 $7547W
#Zap 7
%patch $7741 $7547W
#Zap 8
%patch $7785 $7547W
#Zap 9

Patch: Keen 3 behavior pointers
#Zap\zot behavior pointers
%patch $45D8 $7E05W
#Zap 1
%patch $464E $7E05W
#Zap 2
%patch $46A3 $7E05W
#Zap 3
%patch $46E8 $7E05W
#Zap 4
%patch $4D11 $7E05W
#Zap 5
%patch $4F59 $7E05W
#Zap 6
%patch $7D73 $7E05W
#Zap 7
%patch $7DE5 $7E05W
#Zap 8
%patch $7E48 $7E05W
#Zap 9
%patch $7E8D $7E05W
#Zap 10
%patch $7F86 $7E05W
#Zap 11
%patch $7FF3 $7E05W
#Zap 12
%patch $8025 $7E05W
#Zap 13


Complete behavior code

This is the complete behavior code for zap\zot sprites. There are three variables marked in blue that can be edited. The first is the initial sprite type; this ensures that zap\zots are harmless and vanish when offscreen. The second variable is the length of time the zap\zot remains in existence. Finally the third variable is the final sprite type, the default value of 0 makes the sprite vanish; if this is altered then they will not disappear which can rapidly cause the game to cash.

Patch: Keen 1
#Zap\zot behavior code
%patch $47E8 $55 $8B $EC $C7 $06 $8220W $000EW $A1 $824AW $03 $06 $5B14W $A3 $824AW $3D $0014W $7E $06 $C7 $06 $8220W $0000W $5D $C3

Patch: Keen 2
#Zap\zot behavior code
%patch $7547 $55 $8B $EC $C7 $06 $96C0W $000DW $A1 $96EAW $03 $06 $5AF0W $A3 $96EAW $3D $0014W $7E $06 $C7 $06 $96C0W $0000W $5D $C3

Patch: Keen 3
#Zap\zot behavior code
%patch $7E05 $55 $8B $EC $C7 $06 $9910W $0013W $A1 $993AW $03 $06 $5D40W $A3 $993AW $83 $3E $993AW $14 $7E $06 $C7 $06 $9910W $0000W $5D $C3


Sprite Collision

Zap/Zots don't have time to and don't need to interact with many sprites. Most use the collision set for the sprite that produced them. Only zap/zots produced 'out of thin air' need to have their collisions set, and this is usually not very many of them.

Patch: Keen 1
#Collisions
%patch $486F $3360W
#Zap 4
%patch $4A2B $3360W
#Zap 7
%patch $22DA $3360W
#Zap 8


Animations

Nearly all zap/zots have a randomizer to pick one of two animations with an equal probability. This ratio can be changed by patching a custom probability subroutine and calling it, though there's really little point.

Patch: Keen 1
#Zap\zot animations
%patch $476B $006EW
#Zap 1
%patch $4772 $006FW
#Zot 1
%patch $47DC $006EW
#Zap 2
%patch $47E3 $006FW
#Zot 2
%patch $483C $006EW
#Zap 3
%patch $4844 $006FW
#Zot 3
%patch $4881 $006EW
#Zap 4
%patch $4888 $006FW
#Zot 4
%patch $4988 $006EW
#Zap 5
%patch $498F $006FW
#Zot 5
%patch $49F4 $006EW
#Zap 6
%patch $49FB $006FW
#Zot 6
%patch $4A38 $006EW
#Zap 7
%patch $4A3F $006FW
#Zot 7
%patch $22E8 $006EW
#Zap 8
%patch $22EF $006FW
#Zot 8

Patch: Keen 2
#Zap\zot animations
%patch $483C $007CW
#Zap 1 zap
%patch $4843 $007DW
#Zap 1 zot
%patch $74CA $007CW
#Zap 2 zap
%patch $74D1 $007DW
#Zap 2 zot
%patch $753B $007CW
#Zap 3 zap
%patch $7542 $007DW
#Zap 3 zot
%patch $759B $007CW
#Zap 4 zap
%patch $75A3 $007DW
#Zap 4 zot
%patch $75E0 $007CW
#Zap 5 zap
%patch $75E7 $007DW
#Zap 5 zot
%patch $76E7 $007CW
#Zap 6 zap
%patch $76EE $007DW
#Zap 6 zot
%patch $7753 $007CW
#Zap 7 zap
%patch $775A $007DW
#Zap 7 zot
%patch $779C $007CW
#Zap 8 zap
%patch $77A3 $007DW
#Zap 8 zot

Patch: Keen 3
#Zap\zot animations
%patch $45EA $0069W
#1st Zap/zot Zap
%patch $45F1 $006AW
#1st Zap/zot Zot
%patch $4667 $006AW
#2nd Zap/zot Zap
%patch $4660 $0069W
#2nd Zap/zot Zot
%patch $46B7 $0069W
#3rd Zap/zot Zap
%patch $46BF $006AW
#3rd Zap/zot Zot
%patch $46FF $0069W
#4th Zap/zot Zap
%patch $4706 $006AW
#4th Zap/zot Zot
%patch $4D25 $0069W
#5th Zap/zot Zap
%patch $4D2D $006AW
#5th Zap/zot Zot
%patch $4F92 $0069W
#6th Zap/zot Zap
%patch $4F99 $006AW
#6th Zap/zot Zot
%patch $7D85 $0069W
#7th Zap/zot Zap
%patch $7D8C $006AW
#7th Zap/zot Zot
%patch $7DF7 $0069W
#8th Zap/zot Zap
%patch $7DFE $006AW
#8th Zap/zot Zot
%patch $7E5C $0069W
#9th Zap/zot Zap
%patch $7E64 $006AW
#9th Zap/zot Zot
%patch $7EA4 $0069W
#10th Zap/zot Zap
%patch $7EAB $006AW
#10th Zap/zot Zot
%patch $7F98 $0069W
#11th Zap/zot Zap
%patch $7F9F $006AW
#11th Zap/zot Zot
%patch $8005 $0069W
#12th Zap/zot Zap
%patch $800C $006AW
#12th Zap/zot Zot
%patch $803C $0069W
#13th Zap/zot Zap
%patch $8043 $006AW
#13th Zap/zot Zot


Chance of using either animation

The choice between the two animations that any given zap/zot uses is a random one with a 50:50 chance of using either animation. This can be changed (See Patch:Probability.) It is even possible to make them use only one animation.

Patch: Keen 1
#Zap\zot animation probability
%patch $4764 $80
#Zap 1
%patch $47D5 $80
#Zap 2
%patch $4835 $80
#Zap 3
%patch $487A $80
#Zap 4
%patch $4981 $80
#Zap 5
%patch $49ED $80
#Zap 6
%patch $4A31 $80
#Zap 7
%patch $22E1 $80
#Zap 8

Patch: Keen 2
#Zap\zot animation probability
%patch $4835 $007CW
#Zap 1
%patch $74C3 $007CW
#Zap 2
%patch $7534 $007CW
#Zap 3
%patch $7594 $007CW
#Zap 4
%patch $75D9 $007CW
#Zap 5
%patch $76E0 $007CW
#Zap 6
%patch $774C $007CW
#Zap 7
%patch $7795 $007CW
#Zap 8

Patch: Keen 3
#Zap\zot animation probability
%patch $45E3 $80
#Zap 1
%patch $4660 $80
#Zap 2
%patch $46B0 $80
#Zap 3
%patch $46F8 $80
#Zap 4
%patch $4D1E $80
#Zap 5
%patch $4F8B $80
#Zap 6
%patch $7D7E $80
#Zap 7
%patch $7DF0 $80
#Zap 8
%patch $7E55 $80
#Zap 9
%patch $7E9D $80
#Zap 10
%patch $7F91 $80
#Zap 11
%patch $7FFE $80
#Zap 12
%patch $8035 $80
#Zap 13


Misc

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


Lifetime

This is how long the Zap/Zots exist for before disappearing. If it is extended the zap/zots are more visible. Note that in Keen 3 zap/zots can exist for a maximum of $7F ticks while in Keen 1 and 2 they may last $7FFF ticks.

Patch: Keen 1
#How long the Zaps/zots remain before dissipating
%patch $47FC $0014W

Patch: Keen 3
#How long the Zaps/zots remain before dissipating
%patch $7E1C $14