Patch:Blooglet

From KeenWiki
Jump to: navigation, search

This page covers patches relating to the Blooglets in Keen 6. Blooglets are small, one-eyed, harmless creatures found in most levels. related creatures are Blooguards and Bloogs. Blooglets are notable in that there are four colors, and occasionally they drop gems when shot. (See Patch:Items.)


Sprite Type

Blooglets use sprite type 13. This is not used by any other sprites and it pushes Keen. Changing the sprite type thus robs Blooglets of their ability to push Keen around. The gems they produce use type 5, the type used for all items.

Patch: Keen 6
#Blooglet sprite types
%patch $10B38 $08
#Blooglet
%patch $10C59 $05
#Blooglet gems


Sprite Actions

While each Blooglet type's actions are quite simple, there are four different Blooglets to be considered. All Blooglet types are spawned running, a four frame loop they stay in until Keen shoots them, at which point they stun.

Actions:
$208AW  #Red Blooglet running 1
$20A8W  #Red Blooglet running 2
$20C6W  #Red Blooglet running 3
$20E4W  #Red Blooglet running 4
$2102W  #Red Blooglet stunned
$2120W  #Yellow Blooglet running 1
$213EW  #Yellow Blooglet running 2
$215CW  #Yellow Blooglet running 3
$217AW  #Yellow Blooglet running 4
$2198W  #Yellow Blooglet stunned
$21B6W  #Blue Blooglet running 1
$21D4W  #Blue Blooglet running 2
$21F2W  #Blue Blooglet running 3
$2210W  #Blue Blooglet running 4
$222EW  #Blue Blooglet stunned
$224CW  #Green Blooglet running 1
$226AW  #Green Blooglet running 2
$2288W  #Green Blooglet running 3
$22A6W  #Green Blooglet running 4
$22C4W  #Green Blooglet stunned

Patch: Red Blooglet
#When spawned
%patch $10B9A $208AW
#While walking
%patch $32DD6 $20A8W %patch $32DF4 $20C6W %patch $32E12 $20E4W %patch $32E30 $208AW
#While stunned
%patch $32E4E $0000W

Patch: Yellow Blooglet
#When spawned
%patch $10BAD $2120W
#While walking
%patch $32E6C $213EW %patch $32E8A $215CW %patch $32EA8 $217AW %patch $32EC6 $2120W
#While stunned
%patch $32EE4 $0000W

Patch: Blue Blooglet
#When spawned
%patch $10BC0 $21B6W
#While walking
%patch $32F02 $21D4W %patch $32F20 $21F2W %patch $32F3E $2210W %patch $32F5C $21B6W
#While stunned
%patch $32F7A $0000W

Patch: Green Blooglet
#When spawned
%patch $10BD3 $224CW
#While walking
%patch $32F98 $226AW %patch $32FB6 $2288W %patch $32FD4 $22A6W %patch $32FF2 $224CW
#While stunned
%patch $33010 $0000W


Speed

The only speeds relevant to the Blooglets are their walking speeds, determined by their animation motion. The item (gem) they produce when stunned has its own upwards speed when created.

Patch: Keen 6
#Upwards speed of Blooglet stun-gems
%patch $10C6F $FFD8W

Patch: Animation motion
#Red Blooglet walking
%patch $32DC6 $0080W $0000W %patch $32DE4 $0080W $0000W %patch $32E02 $0080W $0000W %patch $32E20 $0080W $0000W
#Red Blooglet stunned
%patch $32E3E $0000W $0000W
#Yellow Blooglet
%patch $32E5C $0080W $0000W %patch $32E7A $0080W $0000W %patch $32E98 $0080W $0000W %patch $32EB6 $0080W $0000W
#Yellow Blooglet stunned
%patch $32ED4 $0000W $0000W
#Blue Blooglet
%patch $32EF2 $0080W $0000W %patch $32F10 $0080W $0000W %patch $32F2E $0080W $0000W %patch $32F4C $0080W $0000W
#Blue Blooglet stunned
%patch $32F6A $0000W $0000W
#Green Blooglet
%patch $32F88 $0080W $0000W %patch $32FA6 $0080W $0000W %patch $32FC4 $0080W $0000W %patch $32FE2 $0080W $0000W
#Green Blooglet stunned
%patch $33000 $0000W $0000W


Sprite Collision

Each Blooglet has a rather simple collision, being stunned if it is shot. Interestingly all Blooglets share the same collision, there is not a separate collision for each Blooglet color. Notably however Blooglets can drop gems when shot.


Collision values

Each Blooglet uses only one collision all the time, except when stunned.

Patch: Keen 6
#Red Blooglet
%patch $32DCE $0EFC1C2DRL
#Blooglet
%patch $32DEC $0EFC1C2DRL
#Blooglet
%patch $32E0A $0EFC1C2DRL
#Blooglet
%patch $32E28 $0EFC1C2DRL
#Blooglet
%patch $32E46 $00000000L
#Nothing (Stunned)
#Yellow Blooglet
%patch $32E64 $0EFC1C2DRL
#Blooglet
%patch $32E82 $0EFC1C2DRL
#Blooglet
%patch $32EA0 $0EFC1C2DRL
#Blooglet
%patch $32EBE $0EFC1C2DRL
#Blooglet
%patch $32EDC $00000000L
#Nothing (Stunned)
#Blue Blooglet
%patch $32EFA $0EFC1C2DRL
#Blooglet
%patch $32F18 $0EFC1C2DRL
#Blooglet
%patch $32F36 $0EFC1C2DRL
#Blooglet
%patch $32F54 $0EFC1C2DRL
#Blooglet
%patch $32F72 $00000000L
#Nothing (Stunned)
#Green Blooglet
%patch $32F90 $0EFC1C2DRL
#Blooglet
%patch $32FAE $0EFC1C2DRL
#Blooglet
%patch $32FCC $0EFC1C2DRL
#Blooglet
%patch $32FEA $0EFC1C2DRL
#Blooglet
%patch $33008 $00000000L
#Nothing (Stunned)


Collision code

This is the complete collision code for the Blooglets. As noted above all four Blooglets use the same collision code. On the second line Keen's sprite type is checked for. If found another check is made to see if Keen is in front of the Blooglet. If so 'push sprite' code is called. (Note that this involves setting a variable to 1, calling the code then setting the variable to 0.)

In the second section Keen's shot is checked for, if found a lot of code is run. The result depends on the Blooglet's misc variable, which is set when it is spawned. The first thing done is for the result to depend on he variable mod 4 (3 + 1). That is the red Blooglet with keygem (Variety 5) has the same result as the normal red Blooglet. (Variety 1 since 5 = 4 + 1)

Later on the same line a check is made to see whether the variable is greater than 4. If it is then the Blooglet is a keygem Blooglet and more code is run. This spawns another sprite. Its clipping is 1, foreground is 2 and sprite type is 5 (Notably this is the item type.) This produces an item.

The sprite's vertical direction is set to 'upwards' ($FFFFW) and it is given an upwards speed which makes it 'pop up' Its misc variable is set to that of the Blooglet's less four (So type 5 Blooglets (Red Blooglet with gem) produce type 1 items (red gems) and so on.)

On line 7 of the second section a call is made to the item animation list is made to give the new sprite the correct animation. On the following line the number of animations it uses is set. (All items usually use two animations.) as well as its action. (Item of course.) Finally sound 5 is played.

The final two lines are used by all shot Blooglets, not just key-producing ones. It calls a list at $33012 ($22E2W) that determines which stunned action the Blooglet goes to.

Patch: Keen 6
#Blooglet collision
%patch $10BED $55 $8B $EC $83 $EC $02 $56 $57 $8B $76 $06 $8B $7E $08 $83 $3D $02 $75 $27 $8B $5D $1C $8B $47 $14 $0B $47 $16 $74 $1C $C7 $06 $CA85W $0001W $56 $57 $9A $08F40D27RL $83 $C4 $04 $C7 $06 $CA85W $0000W $5F $5E $8B $E5 $5D $CB %patch $10C27 $83 $3D $03 $74 $03 $E9 $0090W $8B $44 $3E $25 $0003W $89 $46 $FE $83 $7C $3E $03 $7E $6E $33 $C0 $50 $9A $069A1E25RL $83 $C4 $02 $8B $1E $66 $A9 $C7 $47 $06 $0001W $C7 $47 $20 $0002W $C7 $07 $0005W $8B $44 $0A $89 $47 $0A $8B $44 $0C $89 $47 $0C $C7 $47 $10 $FFFFW $C7 $47 $18 $FFD8W $8B $46 $FE $89 $47 $3E $8B $5E $FE $D1 $E3 $8B $87 $1A78W $8B $1E $66 $A9 $89 $47 $1E $89 $47 $40 $8B $47 $40 $05 $0002W $89 $47 $42 $B8 $19A6W $50 $53 $9A $08F41219RL $83 $C4 $04 $B8 $0005W $50 $9A $183B09F1RL $83 $C4 $02 $8B $5E $FE $D1 $E3 $FF $B7 $22E2W $57 $56 $9A $08F41722RL $83 $C4 $06 $5F $5E $8B $E5 $5D $CB
#Stun list
%patch $33012 $2102W
#Red Blooglet (At $10B99)
%patch $33014 $2198W
#Yellow Blooglet (At $10BAC)
%patch $33016 $222EW
#Blue Blooglet (At $10BBF)
%patch $33018 $22C$W
#Green Blooglet (At $10BD2)


Blooglet items don't just give gems

This patch allows the items produced by all the Blooglets when stunned to be something other than gems. As a side effect all the items will give the same thing. (In the above collision code this replaces the string $8B $46 $FE $89 $47 $3E.) In the example given here the items will give 200 points. Making this larger than 12 ($000CW) may cause the game to crash as there are only 12 item types by default.

Patch: Keen 6
#Blooglet gems have custom item property
%patch $10C71 $C7 $47 $3E $0005W $90


Animations

The animations for each Blooglet are quite simple, with eight frames used for walking and one frame when stunned. Each Blooglet's cache is separate.

Patch: Red Blooglet
#Cache
%patch $3242E $015FW
#Red Blooglet cache start
%patch $3247E $0167W
#Red Blooglet cache end
#Red Blooglet running
%patch $32DBA $0163W $015FW %patch $32DC4 $0005W
#Animation speed
%patch $32DD8 $0164W $0160W %patch $32DE2 $0005W
#Animation speed
%patch $32DF6 $0165W $0161W %patch $32E00 $0005W
#Animation speed
%patch $32E14 $0166W $0162W %patch $32E1E $0005W
#Animation speed
#Stunned
%patch $32E32 $0167W $0167W %patch $32E3C $0000W
#Animation speed

Patch: Yellow Blooglet
%patch $32430 $0168W 
#Yellow Blooglet cache start
%patch $32480 $0170W
#Yellow Blooglet cache end
#Yellow Blooglet running
%patch $32E50 $016CW $0168W %patch $32E5A $0005W
#Animation speed
%patch $32E6E $016DW $0169W %patch $32E78 $0005W
#Animation speed
%patch $32E8C $016EW $016AW %patch $32E96 $0005W
#Animation speed
%patch $32EAA $016FW $016BW %patch $32EB4 $0005W
#Animation speed
#Yellow Blooglet stunned
%patch $32EC8 $0170W $0170W %patch $32ED2 $0000W
#Animation speed

Patch: Blue Blooglet
%patch $32432 $0171W 
#Blue Blooglet cache start
%patch $32482 $0179W
#Blue Blooglet cache end
#Blue Blooglet running
%patch $32EE6 $0175W $0171W %patch $32EF0 $0005W
#Animation speed
%patch $32F04 $0176W $0172W %patch $32F0E $0005W
#Animation speed
%patch $32F22 $0177W $0173W %patch $32F2C $0005W
#Animation speed
%patch $32F40 $0178W $0174W %patch $32F4A $0005W
#Animation speed
#Stunned
%patch $32F5E $0179W $0179W %patch $32F68 $0000W
#Animation speed

Patch: Green Blooglet
%patch $32434 $017AW 
#Green Blooglet cache start
%patch $32484 $0182W
#Green Blooglet cache end
#Green Blooglet running
%patch $32F7C $017EW $017AW %patch $32F86 $0005W
#Animation speed
%patch $32F9A $017FW $017BW %patch $32FA4 $0005W
#Animation speed
%patch $32FB8 $0180W $017CW %patch $32FC2 $0005W
#Animation speed
%patch $32FD6 $0181W $017DW %patch $32FE0 $0005W
#Animation speed
#Stunned
%patch $32FF4 $0182W $0182W %patch $32FFE $0005W
#Animation speed


Sprite positioning

All Blooglets spawn the same height off the ground, 8 pixels higher than where they are placed. This is needed so that they may walk on the ground and must be altered if the sprite's heights are changed.

Patch: Keen 6
%patch $10B54 $FF80W 
#8 pixels up


Sounds

The only sound made by Blooglets is that when a gem-Blooglet is stunned. This can be blocked.

Patch: Keen 6
#Blooglet produce item when shot sound
%patch $10CA1 $05
#Don't play Blooglet produce item when shot sound
%patch $10CA0 $EB $0A


Clipping and foreground

All Blooglets have the same value for their foreground variable, it is 0, making them appear behind all foreground tiles. The items they produce when shot use a value of 2, making them much more prominent. The stun-gems also have their own clipping value, 1 by default.

Patch: Keen 6
#Blooglet's foreground variable
%patch $10B42 $0000W
#Blooglet's stun-gem foreground variable
%patch $10C55 $0002W

Patch: Keen 6
#Blooglet's stun-gem clipping variable
%patch $10C50 $0001W


Sprite spawn code

In the initiation code notice the Blooglet cache being set ($C7 $06 $CD1BW $0001W.) The gem cache is also set ($C7 $06 $CD11W $0001W.) since some Blooglets carry gems. There are eight types of Blooglet divided into two sets of four, one with gems and one without.

In the spawning code the last four blue highlighted values are the sprite actions the four different colors of Blooglet use as they proceeds to act in-level. $C7 $02 $xxxxW sets the sprite activity, $C7 $07 $xxxxW sets the sprite type, $C7 $20 $xxxxW sets the foreground value. Finally $D3 $E0 $05 $xxxx is how far down (Or more usually up) the sprite is spawned from where it is placed. This is necessary for sprites that walk on the ground as they can only be placed in the level at multiples of 16 pixels high while their actual height can be anything.

The Bloogletsalways starts the level moving down but there is a probability check to determine which way they face. This is 50:50 (Though it needn't be.) and the code responsible for this is $9A $1CF30034RL $3D $0080W. $C7 $47 $10 $xxxxW is the vertical direction the sprite starts moving in, either $0001W (Facing down), $FFFFW (Facing up) or $0000W (Neither, never used.) $C7 $47 $0E $xxxxW is the horizontal direction.

There are $03 + 1 = 4 different Blooglet spawns that use a list after the spawn code. They differ only in which action they use.

Patch: Keen 5
#Location of initiation codes
%patch $E95E $0109W
#Red Blooglet (At $E529)
%patch $E960 $0109W
#Yellow Blooglet (At $E529)
%patch $E962 $0109W
#Blue Blooglet (At $E529)
%patch $E964 $0109W
#Green Blooglet (At $E529)
%patch $E966 $0109W
#Red keygem Blooglet (At $E529)
%patch $E968 $0109W
#Yellow keygem Blooglet (At $E529)
%patch $E96A $0109W
#Green keygem Blooglet (At $E529)
%patch $E96C $0109W
#Blue keygem Blooglet (At $E529)
#Blooglet initiation code
%patch $E529 $8B $46 $FA $05 $FFF9W $50 $57 $56 $9A $0EFC1B60RL $83 $C4 $06 $8B $46 $FA $05 $FFF9W $BB $0004W $99 $F7 $FB $D1 $E2 $8B $DA $C7 $87 $CD1BW $0001W $83 $7E $FA $0A $7F $03 $E9 $036EW $C7 $06 $CD11W $0001W $E9 $0365W $E9 $0362W
#Blooglet spawn code
%patch $10B20 $55 $8B $EC $56 $8B $76 $0A $33 $C0 $50 $9A $069A1E25RL $83 $C4 $02 $8B $1E $66 $A9 $C7 $07 $0008W $C7 $47 $02 $0001W $C7 $47 $20 $0000W $8B $46 $06 $B1 $08 $D3 $E0 $89 $47 $0A $8B $46 $08 $D3 $E0 $05 $FF80W $89 $47 $0C $9A $1CF30034RL $3D $0080W $7D $0B $8B $1E $66 $A9 $C7 $47 $0E $0001W $EB $09 $8B $1E $66 $A9 $C7 $47 $0E $FFFFW $8B $1E $66 $A9 $C7 $47 $10 $0001W $89 $77 $3E $8B $C6 $BB $0004W $99 $F7 $FB $8B $DA $83 $FB $03 $77 $50 $D1 $E3 $2E $FF $A7 $1C25W $B8 $208AW $50 $FF $36 $66 $A9 $9A $08F41219RL $83 $C4 $04 $5E $5D $CB $B8 $2120W $50 $FF $36 $66 $A9 $9A $08F41219RL $83 $C4 $04 $5E $5D $CB $B8 $21B6W $50 $FF $36 $66 $A9 $9A $08F41219RL $83 $C4 $04 $5E $5D $CB $B8 $224CW $50 $FF $36 $66 $A9 $9A $08F41219RL $83 $C4 $04 $5E $5D $CB
#Blooglet spawn list
%patch $10BE5 $1BD9W
#Red Blooglet (At $10B99)
%patch $10BE7 $1BECW
#Yellow Blooglet (At $10BAC)
%patch $10BE9 $1BFFW
#Blue Blooglet (At $10BBF)
%patch $10BEB $1C12W
#Green Blooglet (At $10BD2)


Compact spawning code

This patch compacts the Blooglet spawning code, possibly allowing more kinds of Blooglet. This is done by removing duplicate sections of code near the end of the spawning code block. It is compatible with most patches on this page except the initial spawning sprite actions. Notice too the revamped spawn list.

Patch: Keen 5
#More compact Blooglet spawn code
%patch $10B91 $08 %patch $10B99 $B8 $208AW $EB $0D $B8 $2120W $EB $08 $B8 $21B6W $EB $03 $B8 $224CW $50 $FF $36 $66 $A9 $9A $08F41219RL $83 $C4 $04 $5E $5D $CB %patch $10BE5 $1BD9W $1BDEW $1BE3W $1BE8W