Patch:Keen's shot (Dreams)

From KeenWiki
Jump to: navigation, search

In Keen Dreams Keen's shot is either a Flower Power or Boobus Bomb depending on circumstance. It that can be shot in four directions while Keen is standing, jumping or on a pole. Both types of projectile are identical in nearly everything but appearance. King Boobus Tuber can, for example, be defeated using Flower Power.

This page deals with the shot once it is produced as well as the process of creating it. It does not contain patches relating to the player, such patches can be found on Patch:Keen shooting (Dreams), which deals with when and how the player produces the shot. As an example, this page will contain patches for the shooting sound and shot directions, while the other page will contain patches relating to disabling shooting on poles, or the player's shooting animations.

This page does not contain patches that relate to having or needing shots. As such patches such as those that affect how many Bombs Keen needs to enter the boss level can be found on the Flower Power or Boobus Bomb pages. This page also does not deal with the collectable Flower and Bomb items, patches relating to those can be found on Patch:Items.

The first sections of the page deal with the shot being produced, while the latter sections deal with the produced shot's sprite variables.

What levels Keen can fire Boobus Bombs in

By default Keen can only fire Bombs or Flower Power, not both at the same time or in the same level. 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.)

Patch: Keen Dreams
#What levels Keen fires Boobus Bombs in instead of Flower Power
%patch $5EF8 $8F3EW $0F $75
#Show bomb tiles in scorebox
%patch $6192 $8F3EW $0F $75
#Show bomb count in scorebox
%patch $6378 $8F3EW $0F $75
#Use, decrease bomb counter when shooting
%patch $6461 $8F3EW $0F $74
#Make bomb when shooting
%patch $6934 $8F3EW $0F $75
#Landed projectile turn into bomb

Sprite Type

Keen's shots are type 2; this has no effect on anything, enemy stunning is handled by the Flower Power's sprite collision code. They do however affect how Keen reacts to them; it is possible to make Keen's shot lethal to him for example. This patch affects both Flower Power and Boobus Bombs

Patch: Keen Dreams
#Keen's shot sprite type
%patch $63DC $02

Shot item type (What Keen recovers)

When Keen's shots 'land' they become obtainable again; Flower Power give a Flower Power and Bombs give a bomb. This is controlled by the projectile's 'sprite type'. This is simply the number of item desired. (See Patch:Items for a full list.)

Patch: Keen Dreams
#Keen's shot item type
%patch $646D $08
#Flower Power
%patch $647D $0A
#Boobus Bomb

Shot direction

There are two aspects to shot direction. The first is the actual directions themselves. These are differentiated by giving different values of horizontal and vertical speed to a shot. However this code must be pointed to, and this is done with a pointer list that gets its value from what direction the player is facing.

There are eight possible directions for a shot to go (Up, up right, up left, left...) of which seven are on the list and only four are valid. (It is usually impossible to spawn an invalid shot, but it can happen.)

Shot animations speeds are treated in the speed section below. By default they do not matter at all.

Patch: Keen Dreams
#Location of pointer list (5E80 + 622 = 64A2)
%patch $6412 $0622W
#Length of list
%patch $640A $06
#Spawnshot pointer list (Origin D8F0)
%patch $64A2 $0594W
#Vertical direction of all Flower Power
%patch $6403 $FFFFW
#Flower Power up
%patch $641B $0000W
#Horizontal speed
%patch $6420 $FFC0W
#Vertical speed
#Flower Power right
%patch $642B $0040W
#Horizontal speed
%patch $6430 $FFECW
#Vertical speed
#Flower Power down
%patch $643B $0000W
#Horizontal speed
%patch $6440 $0040W
#Vertical speed
#Flower Power left
%patch $644B $FFC0W
#Horizontal speed
%patch $6450 $FFECW
#Vertical speed

Flower power move in straight lines

This patch makes Flower Power move in straight lines, like Keen's shots in galaxy. The only side effect is that those thrown up will stick to ceilings and remain there forever. To prevent this a patch stopping Keen shooting up can be included. (but is not vital.)

The speed is a product of the animation speed and h\v speed, highlighted in blue in the first and third line of the patch. This patch uses a speed of $40 and an animation speed of $6. The shot directions depend on the following lines, and can be diagonal or even sit still.

The sixth line makes the shot vanish instantly when it hits walls and floors, so the player can't get it again. If removed then the flower power will blink a bit before vanishing instead. The first four lines stop Keen shooting up, since upwards shots do not vanish when they hit ceilings.

Patch: Keen Dreams
#Stop Keen throwing Flower Power...
%patch $6D29 $1130W
%patch $71B0 $152CW
#Upwards while jumping
%patch $7275 $11A8W
#Upwards on a pole
#Vanish when hitting solid tiles
%patch $6964 $0000W
#Flower power move in straight lines
%patch $24642 $00A2W $00A2W $0001W $0000W $0000W $0006W $0040W $0040W $00000000L %patch $24660 $00A3W $00A3W $0001W $0000W $0000W $0006W $0040W $0040W $00000000L
%patch $641A $10 $FFFFW %patch $641F $0E $0000W
%patch $642A $10 $0000W %patch $642F $0E $0001W
%patch $643A $10 $0001W %patch $643F $0E $0000W
%patch $644A $10 $0000W %patch $644F $0E $FFFFW

Flower Power sit when produced

This patch makes the Flower Power Keen produces just sit in place, like mines. They will never vanish but will sit, waiting for an enemy to bump into them. Keen cannot pick them up again however.

Patch: Keen Dreams
#Flower power don't move
%patch $24652 $00000000L %patch $24670 $00000000L

Sprite Actions

The Flower Power is quite simple, it is spawned by Keen when he shoots in the first frame of its thrown cycle. It then animates between two 'thrown' actions until it hits a solid tile and lands on the ground. This causes it to change to its landed cycle. It will then remain in this cycle for a specified amount of time before vanishing.

The Boobus Bomb works similarly, however when it lands it converts into an item instead of vanishing, allowing Keen to retrieve it. It also explodes on hitting King Boobus Tuber; the explosion sequence is six frames long and ends with the explosion vanishing.

Boobus Bombs that are thrown by the player and don't hit anything will return to an item-like state so they can be picked up and reused. This is the only other case of item spawning in the game.

$0BD2W #Flower power thrown 1
$0BF0W #Flower power thrown 2
$0CFEW #Flower power thrown, blinking 1
$0D1CW #Flower power thrown, blinking 2 (Invisible)

Patch: Keen Dreams
#Make Flower Power
%patch $6472 $0BD2W
#Flower Power thrown cycle
%patch $2465E $0BF0W %patch $2467C $0BD2W
#When Flower Power lands
%patch $6964 $0CFEW
#Landed Flower Power cycle
%patch $2478A $0D1CW %patch $247A8 $0CFEW
#Make Boobus Bomb
%patch $6482 $0C0EW
#Boobus Bomb thrown cycle
%patch $2469A $0C2CW %patch $246B8 $0C0EW
#Dropped Boobus Bombs turn into items
%patch $6955 $196CW
#Boobus Bomb explode
%patch $65B2 $0C4AW
#Boobus Bomb explosion sequence
%patch $246D6 $0C68W %patch $246F4 $0C86W %patch $24712 $0C4AW %patch $24730 $0CC2W %patch $2474E $0CE0W %patch $2476C $0000W

Boobus Bombs are always dangerous to the boss

This patch alters things so that the Boobus Bombs do not revert to being items when they hit the ground. Instead they remain constantly dangerous no matter how long they sit. (Keen will still be able to re-acquire them however.)

Patch: Keen Dreams
#Boobus Bombs always dangerous
%patch $6939 $EB $3F

Sprite Behavior

The Flower Power has two behaviors, falling through the air (also used by many other sprites like Grapes.) and vanishing after a certain period (exclusive to the Flower Power.)

The Boobus Bombs have the exact same behavior as the Flower Power when thrown. Their explosion has no behavior.

$07C501A4RL #Fall
$05E80630RL #Vanish after a time

Patch: Keen Dreams
#Thrown Flower Power
%patch $24652 $07C501A4RL %patch $24670 $07C501A4RL
#Landed Flower Power
%patch $2477E $05E80630RL %patch $2479C $05E80630RL
#Thrown Bomb
%patch $2468E $07C501A4RL %patch $246AC $07C501A4RL
#Bomb explosion
%patch $246CA $00000000L %patch $246E8 $00000000L %patch $24706 $00000000L %patch $24724 $00000000L %patch $24742 $00000000L %patch $24760 $00000000L

Shot speed

The Flower Power gets its speeds when it is produced, and these change under the 'fall' behavior, leading it ever groundwards. Each shot direction has its own pair of horizontal and vertical speeds. These are covered in the second section on this page, 'shot speed'

All shots also have animation motion and this does not matter unless the 'fall' behavior is disabled in which case animation motion determines how fast they move in straight lines.

Patch: Keen Dreams
#Thrown Flower Power
%patch $2464E $0000W $0000W %patch $2466C $0000W $0000W
#Landed Flower Power
%patch $2477A $0000W $0000W %patch $24798 $0000W $0000W
#Thrown Bomb
%patch $2468A $0000W $0000W %patch $246A8 $0000W $0000W
#Bomb explosion
%patch $246C6 $0000W $0000W %patch $246E4 $0000W $0000W %patch $24702 $0000W $0000W %patch $24720 $0000W $0000W %patch $2473E $0000W $0000W %patch $2475C $0000W $0000W

Sprite collision

Unlike nearly all sprites in Keen Dreams the Flower Power\Boobus Bomb actually has its own sprite collision. This is used to react to all enemy sprites. (Details are covered in the code section below.)

The collision is used only by the thrown Flower Power and not those that have landed on the ground. (Though it can be if desired.) Notice that Boobus Bombs use the same collision as Flower Power

Patch: Keen Dreams
#Thrown Flower Power
%patch $24656 $05E806C7RL %patch $24674 $05E806C7RL
#Landed Flower Power
%patch $24782 $00000000L %patch $247A0 $00000000L
#Thrown Bomb
%patch $24692 $05E806C7RL %patch $246B0 $05E806C7RL
#Bomb explosion
%patch $246CE $00000000L %patch $246EC $00000000L %patch $2470A $00000000L %patch $24728 $00000000L %patch $24746 $00000000L %patch $24764 $00000000L

Sprite collision code

This is the complete code for the Flower Power and Boobus Bomb's sprite collision. It uses a list of pointers to do different things depending on the other sprite's sprite type. Flower Power interact with any sprite types between $05-$17. This excludes 'misc', Keen, Doors, items (Types $01-$04) and enemy projectiles (Type $18) There are three possible interactions; the first is to do nothing, the second to produce a Wilted Flower and the third to explode. (Used in the boss fight.) On the first line the lowest sprite type ($05) is set. On the second line the list length is given. ($12, so the highest entry is $12 + $05 = $17.)

At the end of the second line the 'stun' code begins. First the 'form Flower' sub is run then another sub which removes the Flower Power itself. Both pieces of code are located elsewhere.

At the end of line 3 the Boobus Tuber code begins. First is a check to see if Boobus has any health. If not 50'000 points is added to Keen's score twice. This is followed by Boobus' sprite type being set to $19, the same as defeated enemies. (This stops him harming Keen while dying.) His action is changed to dying and his sprite timer reset. (To time his death.) The code after this occurs whenever Boobus is hit, dying or not. Sound $15 plays and Keen's shot turns into an exploding bomb.

The third type of interaction 'do nothing' has no code. By default $06E3W is 'stun', $06F5W is 'Boobus' and $073EW 'do nothing'.

Patch: Keen Dreams
#Flower Power sprite collision
%patch $6547 $55 $8B $EC $56 $57 $8B $7E $06 $8B $76 $08 $8B $1C $83 $EB $05 $83 $FB $12 $77 $62 $D1 $E3 $2E $FF $A7 $0742W $56 $9A $07C50381RL $44 $44 $57 $9A $044D0240RL $44 $44 $EB $49 $FF $4C $44 $75 $2C $B8 $C350W $50 $9A $044D090ERL $44 $44 $B8 $C350W $50 $9A $044D090ERL $44 $44 $C7 $04 $0019W $B8 $246AW $50 $56 $9A $07C50255RL $83 $C4 $04 $C7 $44 $3E $0000W $B8 $0015W $50 $9A $10BB1282RL $44 $44 $B8 $0C4AW $50 $57 $9A $07C50255RL $83 $C4 $04 $5F $5E $5D $CB
#Flower Power pointer list
%patch $65C2 $06E3W
%patch $65C4 $06E3W
%patch $65C6 $06E3W
%patch $65C8 $06E3W
%patch $65CA $06E3W
%patch $65CC $073EW
%patch $65CE $06E3W
#Tater Trooper
%patch $65D0 $073EW
%patch $65D2 $06E3W
%patch $65D4 $073EW
%patch $65D6 $073EW
%patch $65D8 $073EW
%patch $65DA $073EW
%patch $65DC $073EW
%patch $65DE $06E3W
%patch $65E0 $06E3W
%patch $65E2 $06E3W
#Pea Pod
%patch $65E4 $06E3W
#Pea brain
%patch $65E6 $06F5W
#Boobus Tuber


Flower Power do not have their own cache, being cached with Keen himself. As well as an item animation (which automatically uses the next animation as well.) they have two animation cycles which cover the two different types, the sitting collectables and the thrown pellet. The second frame of the thrown pellet is $FFFFW, or invisible.

Bombs are similar, they have an item animation and there are two frames used for a thrown Bomb. Bombs that hit King Boobus Tuber explode in a six animation sequence (using only two different animations.) There is a unique 'dropped bomb' animation however that determines what a Boobus Bomb looks like when shot and landed on the ground. This should match the item animation.

Patch: Keen Dreams
#Flower power item
%patch $25428 $00A4W
#Thrown Flower Power
%patch $24642 $00A2W $00A2W %patch $2464C $000AW
#Animation speed
%patch $24660 $00A3W $00A3W %patch $2466A $000AW
#Animation speed
#Flower power (Thrown, going to vanish)
%patch $2476E $00A2W $00A2W %patch $24778 $0005W
#Animation speed
%patch $2478C $FFFFW $FFFFW %patch $24796 $0005W
#Animation speed
#Bomb item
%patch $2542C $00C0W
%patch $693F $00C0W
#Dropped bomb
#Bomb thrown
%patch $2467E $00C0W $00C0W %patch $24688 $0005W
#Animation speed
%patch $2469C $00C2W $00C2W %patch $246A6 $0005W
#Animation speed
#Bomb explode
%patch $246BA $00C3W $00C3W %patch $246C4 $0005W
#Animation speed
%patch $246D8 $00C4W $00C4W %patch $246E2 $0005W
#Animation speed
%patch $246F6 $00C3W $00C3W %patch $24700 $0005W
#Animation speed
%patch $24714 $00C4W $00C4W %patch $2471E $0005W
#Animation speed
%patch $24732 $00C3W $00C3W %patch $2473C $0005W
#Animation speed
%patch $24750 $00C4W $00C4W %patch $2475A $0005W
#Animation speed


See Patch:Keen shooting (Dreams)