Patch:Keen shooting (Dreams)

From KeenWiki
Jump to: navigation, search

This page contains patches that cover Keen shooting and his firing rate, as well as his shots. Some patches will overlap other game actions, such as patches relating to Keen shooting on a pole. Keen can shoot two different kinds of projectiles depending on what level(s) he's in; Flower Power or Boobus Bombs, but these projectiles and patches relating to hem are covered on Keen's shot page.

This page also contains a section relating to the properties of Keen's shooting actions; things like how quickly they animate and the sprites they use.


Don't lose a shot when shooting

This patch prevents Keen from losing a Boobus Bomb or Flower Power when he shoots. Both patches are independent and can be used separately.

Patch: Keen Dreams
#When shooting Keen doesn't lose a...
%patch $639D $EB $2C
#...Boobus Bomb
%patch $63C7 $EB $02
#...Flower Power


What levels Keen can fire Boobus Bombs in

By default Keen can only fire Bombs or Flower Power, not both at the same time. There are two aspects to this, what counter is used to determine if Keen can shoot, and what sprite is produced, Flower Power or Bomb. (It is thus possible to let Keen shoot Boobus Bombs using Flower Power he has collected.)

By default the deciding factor is which level Keen is in; in the boss level, 15, he will shoot Boobus Bombs. If this is changed then it is possible for Keen to shoot both Flower Power and Bombs in the same level depending on circumstance.

Patch: Keen Dreams
#What levels Keen fires Boobus Bombs in instead of Flower Power
%patch $6378 $8F3EW $0F $75
#Use bomb counter
%patch $6461 $8F3EW $0F $74
#Make bomb


Stop Keen shooting

These patches stops Keen throwing Flower Power under certain circumstances.

Patch: Keen Dreams
#Stop Keen throwing Flower Power...
%patch $6D29 $1130W
#Upwards
%patch $71B0 $152CW
#Upwards while jumping
%patch $7275 $11A8W
#Upwards on a pole


Keen's shooting sprites

This section contains patches that relate to the action properties of Keen when he is shooting. These are such things as his speed, animations used and sprite collision.


Sprite Actions

Dreams Keen's shooting-related actions can be divided into three major types: shooting on the ground, shooting in the air and shooting on a pole. Each of these groups comes in two or three subgroups: shooting horizontally, shooting up and shooting down. Each shooting subgroup consists of two or three actions. The first action is 'preparatory'; it readies Keen for making a shot, setting his animation and other parameters. The second actually produces the shot and the third is a 'post shooting' action used in some cases to reset certain variables so Keen can continue doing what he was doing beforehand.

There are also 'shooting checks'; these check Keen's current action to see what kind of shot he should produce and are the second or third action of the shooting sequence. This is required because all of Keen's 'make a shot' actions use the same code. This code checks to see which actions make shots in which directions. Messing with these can do things like make Keen shoot up when he meant to shoot right.

Shooting sequences can also be aborted; if Keen is shooting in air then lands the sequence will stop on the first action. (Keen will not proceed to actually make a shot.) This allows for some very obscure glitches but can otherwise be ignored.

Actions:
$127AW #Keen pole-throw horizontally 1
$1298W #Keen pole-throw horizontally 2
$12B6W #Keen pole-throw horizontally 3
$12D4W #Keen pole-throw up 1
$12F2W #Keen pole-throw up 2
$1310W #Keen pole-throw up 3
$132EW #Keen pole-throw down 1
$134CW #Keen pole-throw down 2
$136AW #Keen pole-throw down 3
$1400W #Keen throw horizontally 1
$141EW #Keen throw horizontally 2
$143CW #Keen throw horizontally 3
$145AW #Keen throw horizontally 4
$1478W #Keen throw up 1
$1496W #Keen throw up 2
$14B4W #Keen throw up 3
$1586W #Keen air-throw horizontally 1
$15A4W #Keen air-throw horizontally 2
$15C2W #Keen air-throw horizontally 3
$15E0W #Keen air-throw up 1
$15FEW #Keen air-throw up 2
$161CW #Keen air-throw up 3
$163AW #Keen air-throw down 1
$1658W #Keen air-throw down 2
$1676W #Keen air-throw down 3

Patch: Shooting horizontally while standing
#Start shooting...
%patch $6D30 $1400W
#While standing
%patch $70AC $1400W
#While walking
#Shooting check -third action
%patch $7462 $143CW
#Shooting horizontally while standing sequence
%patch $24E8C $141EW
#Keen throw horizontally 1
%patch $24EAA $143CW
#Keen throw horizontally 2
%patch $24EC8 $145AW
#Keen throw horizontally 3
%patch $24EE6 $0ED8W
#Keen throw horizontally 4 (Go to stand)

Patch: Shooting up while standing
#Start shooting while standing
%patch $6D29 $1478W
#Shooting check -second action
%patch $74E4 $1496W
#Shooting up while standing sequence
%patch $24F04 $1496W
#Keen throw up 1
%patch $24F22 $14B4W
#Keen throw up 2
%patch $24F40 $0ED8W
#Keen throw up 3 (Go to stand)

Patch: Shooting horizontally in air
#Start shooting in air
%patch $71B7 $1586W
#Shooting check
%patch $754B $15A4W
#Shooting up in air sequence
%patch $25012 $15A4W
#Keen air-throw horizontally 1
%patch $25030 $15C2W
#Keen air-throw horizontally 2
%patch $2504E $150EW
#Keen air-throw horizontally 3 (Go to fall)

Patch: Shooting up while in air
#Start shooting while in air sequence
%patch $71B0 $15E0W
#Shooting check
%patch $7599 $15FEW
#Shooting up while in air sequence
%patch $2506C $15FEW
#Keen air-throw up 1
%patch $2508A $161CW
#Keen air-throw up 2
%patch $250A8 $150EW
#Keen air-throw up 3 (Go to fall)

Patch: Shooting down while in air
#Start shooting while in air
%patch $71BE $163AW
#Shooting check
%patch $75EA $1658W
#Shooting down while in air sequence
%patch $250C6 $1658W
#Keen air-throw down 1
%patch $250E4 $1676W
#Keen air-throw down 2
%patch $25102 $150EW
#Keen air-throw down 3 (Go to fall)

Patch: Shooting horizontally on a pole
#Start shooting
%patch $727C $127AW
#Shooting check
%patch $74A7 $1298W
#Shooting horizontally on a pole sequence
%patch $24D06 $1298W
#Keen pole-throw horizontally 1
%patch $24D24 $12B6W
#Keen pole-throw horizontally 2
%patch $24D42 $118AW
#Keen pole-throw horizontally 3 (Go to pole sit)

Patch: Shooting up on a pole
#Start shooting
%patch $7275 $12F2W
#Shooting check
%patch $7506 $12F2W
#Shooting up on a pole sequence
%patch $24D60 $12F2W
#Keen pole-throw up 1
%patch $24D7E $1310W
#Keen pole-throw up 2
%patch $24D9C $118AW
#Keen pole-throw up 3 (Go to pole sit)

Patch: Shooting down on a pole
#Start shooting
%patch $7283 $132EW
#Shooting check
%patch $7528 $134CW
#Shooting down on a pole sequence
%patch $24DBA $134CW
#Keen pole-throw down 1
%patch $24DD8 $136AW
#Keen pole-throw down 2
%patch $24DF6 $118AW
#Keen pole-throw down 3 (Go to pole sit)


Sprite Behavior

Keen's shooting sequence can be divided into two kinds of action, 'active' and 'inactive'. Active actions produce the shot, there is one of these per shooting sequence and they all use the same behavior. Inactive actions, as mentioned above, change various variables when starting or stopping shooting.

All actions where a shot is actually created use the 'spawnshot' behavior; the same behavior is used whether Keen is shooting in the air, on the ground or on poles. This behavior creates a shot (Or no ammo sound) at a certain position relative to Keen depending on his action and direction. This behavior must be used at least once in each shooting sequence. If it is replaced Keen cannot shoot using that sequence.

For ground and pole based shooting the 'inactive' shooting actions (those where a shot is not created) use no behavior at all. This means the player cannot 'interrupt' the shooting sequence by pressing other keys. For air-based shooting the general 'move through the air' behavior is used that causes Keen to fall under gravity. This stops Keen from 'floating' in the air while his shooting sequence runs.


Behaviors:
$00000000L  #Do nothing
$07C501A4RL #Move through the air
$05E815D8RL #Shooting (Spawn Keen's shot in arrow direction)

Patch: Keen Dreams
#Shooting horizontally while standing
%patch $24E80 $00000000L %patch $24E9E $00000000L %patch $24EBC $05E815D8RL %patch $24EDA $00000000L
#Shooting up while standing
%patch $24EF8 $00000000L %patch $24F16 $05E815D8RL %patch $24F34 $00000000L
#Shooting horizontally on poles
%patch $24CFA $00000000L %patch $24D18 $05E815D8RL %patch $24D36 $00000000L
#Shooting up on poles
%patch $24D54 $00000000L %patch $24D72 $05E815D8RL %patch $24D90 $00000000L
#Shooting down on poles
%patch $24DAE $00000000L %patch $24DCC $05E815D8RL %patch $24DEA $00000000L
#Shooting horizontally while in air
%patch $25006 $07C501A4RL %patch $25024 $05E815D8RL %patch $25042 $07C501A4RL
#Shooting up while in air
%patch $25060 $07C501A4RL %patch $2507E $05E815D8RL %patch $2509C $07C501A4RL
#Shooting down while in air
%patch $250BA $07C501A4RL %patch $250D8 $05E815D8RL %patch $250F6 $07C501A4RL


Keen's shooting behavior code

This is the complete behavior code for Keen shooting. On the first line the game checks what level Keen is in. If he is in level 15 (the boss level) then it will check for Boobus Bombs, otherwise it will check for Flower Power.

In both cases the game then checks to see if Keen has any ammunition. If he doesn't then sound $14 is played and the code ends. If he does however then his ammunition counter is decremented 1 (For Boobus bombs this is in fact two counters.) and a firing sound is played.

After this the game goes to producing a sprite. The first part of the code is common code for Bombs and Flowers.This sprite has a type of 2, indicating it as Keen's shots, and a vertical direction of -1.

At this point the shot's horizontal and vertical speeds are set. To do this it refers to a list 6 + 1 entries long at $64A2 ($5E80 + $0622). The entry number read here is set when Keen's shots are positioned. Three entries are invalid, crashing the game if used. (This should never happen.) The four remaining pointers point to code that sets the vertical and horizontal speeds. All four codes then jump over the error code (Error $16B9W) to a second check of the level.

This check again looks for the boss level, this time to change the shot into a Flower Power or Boobus Bomb accordingly. This simply sets different 'item-type' values (For when the projectile is picked up again by Keen.) and actions (Which controls the projectile's appearance among other things.) Finally the shot's activity is set to 3. (The activity is especially important, allowing Keen's shot to act offscreen.)

Patch: Keen Dreams shooting code
#Keen Dreams shooting code -check level
%patch $6369 $55 $8B $EC $4C $4C $56 $57 $8B $76 $06 $8B $7E $08 $83 $3E $8F3EW $0F $75 $2A
#Check for Boobus Bomb ammo
$83 $3E $711EW $00 $75 $0E $B8 $000EW $50 $9A $10BB1282RL $44 $44 $E9 $010AW $B8 $0014W $50 $9A $10BB1282RL $44 $44 $FF $0E $7120W $FF $0E $711EW $EB $24
#Check for Flower Power ammo
$83 $3E $711CW $00 $75 $0E $B8 $000EW $50 $9A $10BB1282RL $44 $44 $E9 $00E0W $B8 $0004W $50 $9A $10BB1282RL $44 $44 $FF $0E $711CW
#Make shot -common code
%patch $63CB $B8 $0001W $50 $9A $044D01C9RL $44 $44 $8B $1E $3E $70 $C7 $07 $0002W $8B $46 $0A $89 $47 $40 $89 $77 $0A $89 $7F $0C $8B $C6 $B1 $08 $D3 $E8 $89 $47 $30 $89 $47 $2C $8B $C7 $D3 $E8 $89 $47 $32 $89 $47 $2E $C7 $47 $10 $FFFFW $8B $5E $0A $83 $FB $06 $77 $47 $D1 $E3 $2E $FF $A7 $0622W
#Make shot -speeds
$8B $1E $3E $70 $C7 $47 $16 $0000W $C7 $47 $18 $FFC0W $EB $3B $8B $1E $3E $70 $C7 $47 $16 $0040W $C7 $47 $18 $FFECW $EB $2B $8B $1E $3E $70 $C7 $47 $16 $0000W $C7 $47 $18 $0040W $EB $1B $8B $1E $3E $70 $C7 $47 $16 $FFC0W $C7 $47 $18 $FFECW $EB $0B $B8 $16B9W $50 $9A $037B0205RL $44 $44
#Make shot -differentiate Flowers and Bombs
$83 $3E $8F3EW $0F $74 $10 $8B $1E $3E $70 $C7 $47 $3E $0008W $C7 $46 $FE $0BD2W $EB $0E $8B $1E $3E $70 $C7 $47 $3E $000AW $C7 $46 $FE $0C0EW $8B $1E $3E $70 $C7 $47 $02 $0003W $FF $76 $FE $FF $36 $3E $70 $9A $044D1212RL $83 $C4 $04 $5F $5E $8B $E5 $5D $CB
#Spawnshot pointer list
%patch $64A2 $0594W
#Upwards
$05D4W
#INVALID
$05A4W
#Rightwards
$05D4W
#INVALID
$05B4W
#Downwards
$05D4W
#INVALID
$05C4W
#Leftwards


Sprite Collision

These are the values of the sprite collisions uses when shooting. As Keen has only one sprite collision no matter what he does, this is the only collision used when shooting too.

Patch: Keen Dreams
#Shooting horizontally while standing
%patch $24E84 $05E817FCRL %patch $24EA2 $05E817FCRL %patch $24EC0 $05E817FCRL %patch $24EDE $05E817FCRL
#Shooting up while standing
%patch $24EFC $05E817FCRL %patch $24F1A $05E817FCRL %patch $24F38 $05E817FCRL
#Shooting horizontally on poles
%patch $24CFE $05E817FCRL %patch $24D1C $05E817FCRL %patch $24D3A $05E817FCRL
#Shooting up on poles
%patch $24D58 $05E817FCRL %patch $24D76 $05E817FCRL %patch $24D94 $05E817FCRL
#Shooting down on poles
%patch $24DB2 $05E817FCRL %patch $24DD0 $05E817FCRL %patch $24DEE $05E817FCRL
#Shooting horizontally while in air
%patch $2500A $05E817FCRL %patch $25028 $05E817FCRL %patch $25046 $05E817FCRL
#Shooting up while in air
%patch $25064 $05E817FCRL %patch $25082 $05E817FCRL %patch $250A0 $05E817FCRL
#Shooting down while in air
%patch $250BE $05E817FCRL %patch $250DC $05E817FCRL %patch $250FA $05E817FCRL


Animations

These are the animations Keen uses when shooting. Notice that actions shooting horizontally have two animations, one for left and one for right, while those shooting vertically have two identical animations.

Each sequence has a start, a middle and an end. The start lets the player animate without making a shot. The middle produces a shot (taking only one tick of game time to do this.) The end is a further animation after the shot has appeared but before the player returns to what they were doing before shooting.

Patch: Keen Dreams shooting animations
#Keen shooting l/r
%patch $24E70 $006CW $0075W %patch $24E7A $0004W
#Pause before making a shot 1
%patch $24E8E $006DW $0076W %patch $24E98 $0004W
#Pause before making a shot 2
%patch $24EAC $006EW $0077W %patch $24EB6 $0001W
#Make a shot here
%patch $24ECA $006EW $0077W %patch $24ED4 $000AW
#Pause before returning
#Keen shooting up
%patch $24EE8 $006FW $006FW %patch $24EF2 $0008W
#Pause before making a shot
%patch $24F06 $0070W $0070W %patch $24F10 $0001W
#Make a shot here
%patch $24F24 $0070W $0070W %patch $24F2E $000AW
#Pause before returning
#Keen shooting l/r on a pole
%patch $24CEA $0094W $0096W %patch $24CF4 $0008W
#Pause before making a shot
%patch $24D08 $0095W $0097W %patch $24D12 $0001W
#Make a shot here
%patch $24D26 $0095W $0097W %patch $24D30 $000AW
#Pause before returning
#Keen shooting up on pole
%patch $24D44 $0098W $009DW %patch $24D4E $0008W
#Pause before making a shot
%patch $24D62 $0099W $009EW %patch $24D6C $0001W
#Make a shot here
%patch $24D80 $0099W $009EW %patch $24D8A $000AW
#Pause before returning
#Keen shooting down on a pole
%patch $24D9E $009FW $009AW %patch $24DA8 $0008W
#Pause before making a shot
%patch $24DBC $00A0W $009BW %patch $24DC6 $0001W
#Make a shot here
%patch $24DDA $00A0W $009BW %patch $24DE4 $000AW
#Pause before returning
#Keen shooting l/r in air
%patch $24FF6 $007BW $0081W %patch $25000 $0008W
#Pause before making a shot
%patch $25014 $007CW $0082W %patch $2501E $0001W
#Make a shot here
%patch $25032 $007CW $0082W %patch $2503C $000AW
#Pause before returning
#Keen shooting up in air
%patch $25050 $007DW $0083W %patch $2505A $0008W
#Pause before making a shot
%patch $2506E $007EW $0084W %patch $25078 $0001W
#Make a shot here
%patch $2508C $007EW $0084W %patch $25096 $000AW
#Pause before returning
#Keen shooting down in air
%patch $250AA $007FW $0085W %patch $250B4 $0008W
#Pause before making a shot
%patch $250C8 $0080W $0086W %patch $250D2 $0001W
#Make a shot here
%patch $250E6 $0080W $0086W %patch $250F0 $000AW
#Pause before returning


Sounds

Keen has four distinct shooting related sounds, though the two 'no ammo' sounds. are identical by default.

The first sound is played when he has no Flower Power to shoot, the second when he throws a Flower Power, the third is when he has no Boobus Bombs to shoot and the fourth when shooting Boobus Bombs. All four sounds can be disabled.

Patch: Keen Dreams
#Sounds
%patch $6385 $0E
#No Boobus Bombs sound
%patch $6393 $14
#Throw Boobus Bombs sound
%patch $63AF $0E
#No Flower Power sound
%patch $63BD $04
#Throw Flower Power sound

Patch: Keen Dreams
#Don't play sounds
%patch $6384 $EB $09
#Don't play No Boobus Bombs sound
%patch $6392 $EB $09
#Don't play Throw Boobus Bombs sound
%patch $63AE $EB $09
#Don't play No Flower Power sound
%patch $63BC $EB $09
#Don't play Throw Flower Power sound


Sprite-tile interaction

The tile interactions of Keen shooting are broadly the same as those for him not. For example shooting on the ground uses Keen's standing tile interaction. There are some subtleties; when shooting down on poles Keen uses the 'sit on poles' interaction rather than the 'go down poles' one.

Patch: Keen Dreams
#Shoot horizontal
%patch $24E88 $05E81AE2RL %patch $24EA6 $05E81AE2RL %patch $24EC4 $05E81AE2RL %patch $24EE2 $05E81AE2RL
#Shoot up
%patch $24F00 $05E81AE2RL %patch $24F1E $05E81AE2RL %patch $24F3C $05E81AE2RL
#Shoot horizontal on poles
%patch $24D02 $05E81ABARL %patch $24D20 $05E81ABARL %patch $24D3E $05E81ABARL
#Shoot up on poles
%patch $24D5C $05E81ABARL %patch $24D7A $05E81ABARL %patch $24D98 $05E81ABARL
#Shoot down on poles
%patch $24DB6 $05E81ABARL %patch $24DD4 $05E81ABARL %patch $24DF2 $05E81ABARL
#Shoot horizontal in air
%patch $2500E $05E81BEDRL %patch $2502C $05E81BEDRL %patch $2504A $05E81BEDRL
#Shoot up in air
%patch $25068 $05E81BEDRL %patch $25086 $05E81BEDRL %patch $250A4 $05E81BEDRL
#Shoot down in air
%patch $250C2 $05E81BEDRL %patch $250E0 $05E81BEDRL %patch $250FE $05E81BEDRL


Action type

In the air Keen uses action type 3 which which allows him to fall smoothly while shooting. The actual shot creation action (that lasts 1 game cycle) is type 0, which creates a short, imperceptible break in his fall. All other situations also use type 0, since they don't have to move.

Patch: Keen Dreams
#Shooting left/right
%patch $24E74 $0000W %patch $24E92 $0000W %patch $24EB0 $0000W %patch $24ECE $0000W
#Keen shooting up
%patch $24EEC $0000W %patch $24F0A $0000W %patch $24F28 $0000W
#Keen shoot left/right in air
%patch $24FFA $0003W %patch $25018 $0000W %patch $25036 $0003W
#Keen shoot up in air
%patch $25054 $0003W %patch $25072 $0000W %patch $25090 $0003W
#Keen shoot down in air
%patch $250AE $0003W %patch $250CC $0000W %patch $250EA $0003W
#Shooting up/down on pole
%patch $24CEE $0000W %patch $24D0C $0000W %patch $24D2A $0000W
#Keen shoo up on pole
%patch $24D48 $0000W %patch $24D66 $0000W %patch $24D84 $0000W
#Keen shoot down on pole
%patch $24DA2 $0000W %patch $24DC0 $0000W %patch $24DDE $0000W


Bad State error

If Keen's shooting behavior doesn't recognize the shooting action (Which sets up what kind of shot to produce) then it will crash the game with a 'bad state' error.

Patch: Keen Dreams
#Bad State call
%patch $7643 $1713W
#Text
%patch $25183 "KeenThrow: Bad state!" $00


Disable

This patch disables the error; instead of crashing the game Keen's shot will just fall to the ground..

Patch: Keen Dreams
#Prevent bad state error
%patch $7642 $EB $09