Patch:Raygun
This page deals with the raygun\'single bullet' tiles in Keen Vorticons. For Keen Galaxy see Patch:Neural stunner as well as Patch:Flower Power. Related patches that can affect the ammo counter are Patch:Level exit and Patch:Game start
Many of the patches here, especially the giving of ammunition rely on game stat values.
Ammo at game start
Taken from the game start patches page. This is the amount of shots Keen has when he starts a new game.
Keen 1
#Shots Keen has at game start
%patch $9008 [$0000W]
Keen 2
#Shots Keen has at game start
%patch $8AA2 [$0005W]
Keen 3
#Shots Keen has at game start
%patch $98F8 [$0005W]
Amount of ammo per gun
Simply put, this is how many shots Keen gets every raygun he picks up. See also Patch:Game stats for the meaning of the brown values. By default it is 5 shots.
The single bullet is similar, but it can only increase something by 1 by default.
Keen 1
#What raygun gives Keen
%patch $44A2 {$AAC8W} [$05]
Keen 2
#What raygun gives Keen
%patch $728A {$9ADEW} [$05]
Keen 3
#What raygun gives Keen
%patch $7ACD {$9D48W} [$05]
#What single bullet gives Keen (Increase this by 1)
%patch $7BD2 $FF $06 {$9D48W}
Single bullet gives 5 shots
This patch modifies the single bullet in Keen 3 to give as many shots as the raygun. Altering the brown value can alter what it gives, as seen below.
Keen 3
#Single bullet gives 5 shots
%patch $7BD2 $81 $06 {$9946W} [$0005W] $EB $CB
Single bullet gives 10 seconds Ankh time
This modification of the above patch allows the single bullet to give Keen 10 seconds of Ankh power.
Keen 3
#Single bullet gives 10s ankh time
%patch $7BD2 $81 $06 {$9946W} [$06C0W] $EB $CB
Single bullet gives extra life
This makes the single bullet tile into a 1UP or extra Keen.
Keen 3
#Single bullet gives extra life
%patch $7BD4 {$9D46W}
Keen has an ammo limit
This patch sets a limit as to how many shots Keen can have. This patch, and the following is incompatible with all other $0AF2 using patches.
If Keen has equal or more ammo than the limit then the raygun tile will be taken, but no ammo added to Keen. The first blue value is the limit, the second how many shots are given per raygun tile. Note that using this patch means that there is no need to use the above patches altering what the raygun gives (They will in fact break this patch.)
Keen 1
#Keen has ammo limit of 100
#If ammo tile, go to new ammo code
%patch $44A0 $E9 $C650W
#New ammo code
%patch $0AF2 $C3 $83 $3E {$AAC8W} [$64] $7D $05 $83 $06 {$AAC8W} [$05] $E9 $39A3W
Ammo limit and unique sound
This patch is similar to the above. However getting the raygun can have a different sound from the pogo (see sound section.) and the raygun will not make a sound if Keen is above the ammo limit. (To make the raygun make a sound even when not giving Keen ammo change $7D $0E to $7D $05.) The unique sound is the third blue value and in this patch is unchanged from the default sound (same as the pogo.)
Note that using this patch means that there is no need to use the above patches altering what the raygun gives (They will in fact break this patch.)
Keen 1
#Keen has ammo limit of 100
#If ammo tile, go to new ammo code
%patch $44A0 $E9 $C650W
%patch $0AF2 $C3 $83 $3E {$AAC8W} [$64] $7D $0E $83 $06 {$AAC8W} [$05] $B8 [$000AW]
$50 $E8 $B3EDW $44 $44 $E9 $39AFW
Sounds
The following patches alter the sound played when the raygun (or in Keen 3 also the single bullet.) tiles are obtained. Note that the sound played when getting the Raygun is the same sound as used by the pogo. All sounds can be disabled.
Keen 1
#Keen gets ammo (or pogo)
%patch $44B2 [$0A]
#Pogo\raygun tiles got sound disabled
%patch $44B1 $EB $07
Keen 3
#Keen gets ammo (or pogo)
%patch $729A [$0A]
#Pogo\raygun tiles got sound disabled
%patch $7299 $EB $07
Keen 3
#Sounds
%patch $7ADD [$0A] #Get gun sound
%patch $7BFA [$0A] #Get single bullet sound
#Disable sounds
%patch $7ADC $EB $06 #Get gun\pogo sound disabled
%patch $7BF9 $EB $06 #Get ammo sound disabled
Pogo and raygun use different sounds
In Keen Vorticons the pogo and raygun use the same sound code. This patch alters things so that they now use different sounds. (In this case the pogo's sound is set to $0020W, the same as the keycard.) This allows the two items to be differentiated. This reorganizes the code however and is incompatible with the above sound patches as well as any patch that alters how many ammo\pogo the raygun and pogo tiles give.
The first brown value is the ammo variable, the blue $05 is how many are given. The second brown\blue values are for the pogo. The final blue value is the pogo got sound. The raygun got sound code is not affected.
Keen 1
#Raygun and Pogo have different sounds
%patch $45AC $449AW $44A1W
#Change code for two sounds
%patch $449A $83 $06 {$AAC8W} [$05] $EB $10 $C7 $06 {$AA9AW} [$01] $B8 [$0020W] $50 $EB $09
Collect ammo for bonus
Each of these patches gives Keen a bonus of some kind after he has collected. This is rather like the raindrops in Keen 4. Often a side effect is Keen cannot shoot, but this does not always have to be the case.
This first patch stops Keen shooting and it is noticeable when the bonus is got. There are three stat-amount pairs. The first is the number of shots needed, the second is what is given as a bonus. ($FF = 1 life.) and the third is a 'reset', which sets the ammo back to zero when the bonus is got. All three are independent, so it can be made such that when a life is gained the pogo is removed or what have you.
Keen 1
#Get an extra life every [100] {ammo}
#SIDE EFFECT: Level dims when life is got
#SIDE EFFECT: Keen can't shoot
%patch $44A0 $E8 $17 $02 $90 $90
%patch $46BA $FF $06 {$AAC8W} $83 $3E {$AAC8W} [$64]
$74 $01 $C3 [$FF] $06 {$AAC6W} $C7 $06
{$AAC8W} [$0000W] $E8 $BA $25 $E8 $73
$25 $C3
Improved ammo\bonus patch
This patch is better. If Keen collects 5 ammo then he gets 1000 points (5 is then taken from the ammo counter.) You can see ammo occurs three times, in line 2, 3 and 5, the first adding 1 (ammo) when Keen gets a raygun, the second checking if Keen has at least 5 (ammo) In the last line 5 is taken from the (ammo) counter ($FC = -5)
Two sound will play in this patch, $0A $00 if Keen is just getting ammo and $1C $00 if Keen is getting the bonus.
Due to the location of the patch, the points must be broken up, 1000 is $04E8 in hex and is written to the stat $CA $AA. This is split into $04 and $E8 written to $CB and $CA instead.
This patch is quite versatile, but it pays to be careful when altering things. Points are simple enough if it is kept in mind which byte goes where. The amount of ammo given in line 2 should not be larger than the bonus amount, and the amount taken should be the same as the bonus amount, but this is not so vital.
Keen 1
#If Keen gets 5 ammo he gets 1000 points
%patch $44A0 $E8 $50 $C6 $90 $90 $83 $7E $F6 $10 $75 $0D
%patch $0AF2 $C3 $83 $06 {$AAC8W} [$01] $83
$3E {$AAC8W} [$05] $73 $0A $B8 [$000AW] $50 $E8 $ED $B3 $44 $44 $C3
$C7 $07 $8F $00 $83 $06 {$AACBW} [$04] $83 $06 {$AACAW} [$E8] $83 $06
{$AAC8W} [$FC] $B8 {$001CW} $50 $E8 $D0 $B3 $44 $44 $C3
Tile left when raygun got
When Keen touches a pogo or raygun tile, it is replaced with another tile, to stop Keen getting infinite ammo\pogo from one tile (see below.) The specific tile used can be altered, as while it is the same for the pogo and raygun, it differs from other items such as keys or points. By default it is a grey background square.
Keen 1
#Tile left when raygun\pogo obtained
%patch $44CD [$008FW]
Tiles not replaced
This patch stops the pogo and raygun tiles being replaced. This has two consequences, firstly Keen can get infinite ammo from a single raygun tile and secondly the raygun sound plays constantly when Keen is touching the tile. As noted above this will also affect the pogo.
The best way to use this patch is in combination with something that limits Keen's ammo, such as the ammo limit patches above, the second of which will also cut out the sound when Keen has obtained maximum ammo.
Keen 1
#Raygun and pogo tiles not replaced
%patch $44CB $5F $5E $8B $E5 $5D $C3