Patch:Babobba

From KeenWiki
Jump to navigation Jump to search

This page covers patches relating to the Babobbas in Keen 6. These are small, red, jumping enemies that appear in some levels. They are related to the Bobba.


Sprite Type

Babobba use sprite type 13 which is used only by them and doesn't affect anything else. Its shot is type 4 or 'enemy projectile' this doesn't affect anything else either, but is the same as all other enemy shots.

Keen 6

#Babobba sprite types
%patch $12108 $0D #Babobba
%patch $121AB $04 #Babobba's shot


Sprite Actions

Babobba are quite complicated. Babobba are spawned jumping and will then go to falling. falling Babobba will remain so until they land. On landing they will wither sit, or shoot. After doing either Babobba will return to jumping.

When shot a Babobba will fly through the air then land on the ground. This happens whether it is shot while jumping\sitting or napping. Napping is a 7 frame sequence that starts randomly while the Babobba is jumping\sitting. it ends with the Babobba returning to jumping.

The Babobba spits a 'cinder' that starts 'tossed' and then enters a two frame loop when it hits the ground. After a certain number of cycles changes to another two frame loop 'dying'. After looping several more times it vanishes.

Actions:
$2F48W  #Babobba jump
$2F66W  #Babobba fall
$2F84W  #Babobba land
$2FA2W  #Babobba shoot
$2FC0W  #Babobba stunned
$2FDEW  #Babobba stunned and landed
$2FFCW  #Babobba napping 1
$301AW  #Babobba napping 2
$3038W  #Babobba napping 3
$3056W  #Babobba napping 4 (Asleep)
$3074W  #Babobba napping 5
$3092W  #Babobba napping 6
$30B0W  #Babobba napping 7 (Wake up)
$30CEW  #Babobba cinder tossed
$30ECW  #Babobba cinder landed 1
$310AW  #Babobba cinder landed 2
$3128W  #Babobba cinder dying 1
$3146W  #Babobba cinder dying 2

Keen 6

#When spawned
%patch $12151 [$2F48W]

#While jumping
%patch $33C94 [$2F66W]

#While falling
%patch $33CB2 [$2F66W]

#When falling and lands
%patch $12333 [$2F84W] #Land without shooting
%patch $12201 [$2FA2W] #Land and shoot

#While landed
%patch $33CD0 [$2F48W]

#While shooting
%patch $33CEE [$2F84W]

#When shot
%patch $122C1 [$2FC0W] #When shot while jumping
%patch $122E0 [$2FC0W] #When shot while napping

#While stunned in air
%patch $33D0C [$2FDEW]

#While stunned on ground
%patch $33D2A [$0000W]

#Nap (Randomly when jumping)
%patch $1217C [$2FFCW]

#Napping sequence
%patch $33D48 [$301AW]
%patch $33D66 [$3038W]
%patch $33D84 [$3056W]
%patch $33DA2 [$3074W]
%patch $33DC0 [$3092W]
%patch $33DDE [$30B0W]
%patch $33DFC [$2F84W]

#Babobba's shot
%patch $121E9 [$30CEW]

#Cinder while tossed
%patch $33E1A [$30ECW]

#Landed cinder loop
%patch $33E38 [$310AW]
%patch $33E56 [$30ECW]

#Babobba's shot dies (After x cycles)
%patch $12379 [$3128W]

#Babobba's shot die loop
%patch $33E74 [$3146W]
%patch $33E92 [$3128W]


Sprite Behavior

Behavior values

The Babobba has no less than three unique behaviors. The first is the behavior that dictates when the Babobba will nap, jump and shoot. This is used only by the landed Babobba. The jumping and falling Babobba uses a general 'move through the air' behavior.

The shooting Babobba has no behavior as the shot is produced in its landed behavior. The napping b=Babobba likewise has no behavior. The stunned in air and stunned landed actions use the same general 'move through the air' behavior as that used by the jumping and falling actions.

The cinder uses the 'move through the air' behavior when tossed and two unique behaviors. The first is used by only one frame of its landed cycle and each time counts another loop. The second is used by one frame of the dying cycle and again counts loops before the shot vanishes.

Behaviors:
$08F41765RL #Move through air
$11CF046FRL #Babobba jump, nap or shoot
$11CF066FRL #Landed cinder
$11CF068ERL #Dying cinder

Keen 6

#Jump
%patch $33C88 $08F41765RL

#Fall
%patch $33CA6 $08F41765RL

#Land
%patch $33CC4 $11CF046FRL

#Shooting
%patch $33CE2 $00000000L

#Stunned in air
%patch $33D00 $08F41765RL

#Stunned landed
%patch $33D1E $08F41765RL

#Napping
%patch $33D3C $00000000L
%patch $33D5A $00000000L
%patch $33D78 $00000000L
%patch $33D96 $00000000L
%patch $33DB4 $00000000L
%patch $33DD2 $00000000L
%patch $33DF0 $00000000L

#Cinder tossed
%patch $33E0E $08F41765RL

#Cinder landed
%patch $33E2C $11CF066FRL
%patch $33E4A $00000000L

#Cinder die
%patch $33E68 $11CF068ERL
%patch $33E86 $00000000L


Misc behavior patches

Babobba doesn't nap

This simple patch stops the Babobba from napping by skipping its nap check.

Keen 6

#Babobba doesn't nap
%patch $1216A $EB $18


How often Babobba shoots

The Babobba shoots every x number of jumps (Actually landings.) This can easily be patched. If the value is 0, it will shoot each time it lands.

Keen 6

#Babobba shoots every x jumps
%patch $1218B [$0003W]


Babobba doesn't shoot

This patch stops the Babobba from randomly shooting when it lands.

Keen 6

#Babobba doesn't shoot
%patch $1218D $EB


How long cinder takes to vanish

The Babobba's shot will vanish after a certain number of animation cycles, 15 by default. (10 landed, 5 dying.) These two values can be patched to make the cinder last a shorter or longer time.

Note the the actual time is also affected by how fast the cinder animates.

Keen 6

#Number of cycles before cinder vanishes
%patch $1236D [$000AW] #Landed
%patch $1238C [$0005W] #Dying


Behavior codes

Babobba land behavior

This is the complete code for the behavior used by the landed Babobba. It controls whether the Babobba naps, shoots or jumps and as such is very extensive.

The first section deals with randomly napping; on the first line a probability check is made that, if passed, changes the Babobba's action to that of the start napping Babobba. It also resets the Babobba's 'landed variable' to zero.

The second section deals with shooting. On its first line the number of times the Babobba has landed is checked. f it is 3 then the Babobba will shoot. The rest of the section deals with the shot's properties. It has an activity value of 3 (It will continue to animate and vanish when offscreen.), a type of 4. (Enemy projectile.) It is spawned 4 pixels down from the Babobba's head ($0040W) and either 16 or 12 pixels right of its left side depending on whether the Babobba is facing right or left respectively. The shot's starting action is $30CEW and it has a foreground value of 2. After this the Babobba's action is changed to its shooting action in the last line.

The third section deals with when and how to jump. This is quite complex as it involves several checks to see whether the Babobba is near a left edge, right edge or wall. (If so it will turn around instead of jumping.) It is only on the last two lines that the Babobba's jump width and height are set. Each jump also increments the land counter by 1.

Keen 6

#Landed Babobba behavior
%patch $1215F $55 $8B $EC $83 $EC $04 $56 $57 $8B $76 $06 $9A $1CF30034RL   
              $3D [$0004W]  {$7D} $10 $C7 $44 $3E [$0000W]  $C7 $44 $1C [$2FFCW]  $5F
              $5E $8B $E5 $5D $CB
%patch $12184                     $FF $44 $3E $8B $44 $3E $3D [$0003W]  {$75} $7A
              $C7 $44 $3E $0000W  $B8 $0001W  $50 $9A $069A1E25RL     $83 $C4
              $02 $8B $1E $66 $A9 $C7 $47 $02 [$0003W]  $C7 $07 [$0004W]  $8B $44
              $0C $05 [$0040W]  $89 $47 $0C $8B $44 $0E $89 $47 $0E $83 $7C $0E
              $01 $75 $0B $8B $44 $0A $05 [$0100W]  $89 $47 $0A $EB $0D $8B $44
              $0A $05 [$00B0W]  $8B $1E $66 $A9 $89 $47 $0A $8B $1E $66 $A9 $8B
              $47 $0E $B1 $05 $D3 $E0 $89 $47 $16 $B8 [$30CEW]  $50 $53 $9A
           $08F41219RL    $83 $C4 $04 $8B $1E $66 $A9 $C7 $47 $20 [$0002W]  $C7
              $44 $1C [$2FA2W]  $5F $5E $8B $E5 $5D $CB
%patch $12209                                         $8B $5C $32 $43 $D1 $E3
              $8B $87 $8B $CA $D1 $E8 $D1 $E0 $8B $16 $77 $A9 $8B $5C $34 $D1
              $E3 $03 $C3 $89 $56 $FE $89 $46 $FC $33 $FF $EB $60 $C4 $5E $FC
              $26 $8B $1F $8E $06 $65 $CA $26 $8A $87 $22 $14 $B4 $00 $0B $C0
              {$75} $42 $A1 $A972W  $D1 $E0 $C4 $5E $FC $2B $D8 $26 $8B $1F $8E
              $06 $65 $CA $26 $8A $87 $22 $14 $B4 $00 $0B $C0 {$75} $26 $A1 $A972W
                  $D1 $E0 $C4 $5E $FC $03 $D8 $26 $8B $1F $8E $06 $65 $CA $26
              $8A $87 $22 $14 $B4 $00 $0B $C0 {$75} $0A $8B $44 $0E $F7 $D8 $89
              $44 $0E $EB $0E $8B $44 $0E $D1 $E0 $01 $46 $FC $47 $83 $FF $04
              $7C $9B $8B $44 $0E $BA [$0018W]  $F7 $EA $89 $44 $16 $C7 $44 $18
              [$FFE0W]  $5F $5E $8B $E5 $5D $CB


Landed cinder behavior

This is the complete code for the landed cinder. Each time it is run it increases sprite variable $3E by 1. When that value is 10 then the variable is reset to 0 and the cinder's action goes to that of the dying cinder. The end result of this is that this behavior changes the cinder's action after 10 cycles.

Keen 6

#Landed cinder behavior
%patch $1235F $55 $8B $EC $56 $8B $76 $06 $FF $44 $3E $8B $44 $3E $3D [$000AW]
              {$75} $0A $C7 $44 $3E [$0000W]  $C7 $44 $1C [$3128W]  $5E $5D $CB


Dying cinder behavior

This is the complete code for the dying cinder. Each time it is run it increases sprite variable $3E by 1. When that value is 5 then the 'remove object' code is run. The end result of this is that this behavior makes the cinder vanish after 5 cycles. Note that the $3E variable was set to 0 at the end of the landed cinder behavior.

Keen 6

#Dying cinder behavior
%patch $1237E $55 $8B $EC $56 $8B $76 $06 $FF $44 $3E $8B $44 $3E $3D [$0005W]
              {$75} $09 $56 $9A $069A1E9FRL     $83 $C4 $02 $5E $5D $CB


Speed and Jump Height

None of the Babobba's speeds are set in its animation motion, depending instead on values set in its code. These cannot yet be patched.

Animation motion

#Jump
%patch $33C84 [$0000W $0000W]

#Fall
%patch $33CA2 [$0000W $0000W]

#Land
%patch $33CC0 [$0000W $0000W]

#Shooting
%patch $33CDE [$0000W $0000W]

#Stunned in air
%patch $33CFC [$0000W $0000W]

#Stunned on ground
%patch $33D1A [$0000W $0000W]

#Napping
%patch $33D38 [$0000W $0000W]
%patch $33D56 [$0000W $0000W]
%patch $33D74 [$0000W $0000W]
%patch $33D92 [$0000W $0000W]
%patch $33DB0 [$0000W $0000W]
%patch $33DCE [$0000W $0000W]
%patch $33DEC [$0000W $0000W]

#Cinder tossed
%patch $33E0A [$0000W $0000W]

#Cinder landed
%patch $33E28 [$0000W $0000W]
%patch $33E46 [$0000W $0000W]

#Cinder dying
%patch $33E64 [$0000W $0000W]
%patch $33E82 [$0000W $0000W]


Sprite Collision

The Babobba has two collisions, being harmless to Keen when napping. it's shot is of course deadly.


Collision values

The Babobba and its shot have several simple collisions. When napping the Babobba uses a simple collision that lets Keen stun it, being harmless. However when awake or moving it uses a collision that makes it deadly to Keen as well as stunnable. The Babobba's shot uses a general 'deadly to Keen' collision, except when it is dying and invisible, when it is harmless.

Keen 6

#Jumping
%patch $33C8C $11CF05B7RL #Babobba moving

#Falling
%patch $33CAA $11CF05B7RL #Babobba moving

#Landed
%patch $33CC8 $11CF05B7RL #Babobba moving

#Shooting
%patch $33CE6 $11CF05B7RL #Babobba moving

#Shot, in air
%patch $33D04 $00000000L  #Nothing

#Shot, landed
%patch $33D22 $00000000L  #Nothing

#Napping
%patch $33D40 $11CF05E3RL #Sleeping Babobba
%patch $33D5E $11CF05E3RL #Sleeping Babobba
%patch $33D7C $11CF05E3RL #Sleeping Babobba
%patch $33D9A $11CF05E3RL #Sleeping Babobba
%patch $33DB8 $11CF05E3RL #Sleeping Babobba (Waking up)
%patch $33DD6 $11CF05E3RL #Sleeping Babobba
%patch $33DF4 $11CF05E3RL #Sleeping Babobba

#Cinder tossed
%patch $33E12 $08F417EERL #Kill Keen 

#Cinder landed
%patch $33E30 $08F417EERL #Kill Keen
%patch $33E4E $08F417EERL #Kill Keen

#Cinder dying
%patch $33E6C $08F417EERL #Kill Keen
%patch $33E8A $00000000L  #Nothing (Cinder is invisible)


Animations

The Babobba's animations can be slightly confusing. Six different animations are used for the Babobba jumping, falling and landing (Two each.); the shooting action uses the same animations as the ordinary, landed action. The animation speed of the landed frame dictates how long the Babobba takes to start a jump, that of the shooting frame how long it waits after shooting before jumping again.

The stunned and int he air action uses the same animations as the falling action, while the stunned action has its own animation. The napping sequence uses only four animations, three to go to napping, one to nap and the same three in reverse order to wake up. The animation speeds in the sequence determine both how fast the Babobba goes to sleep and wakes up, and also how long it naps for.

The cinder has two animations, the tossed cinder uses the same animation as the second landed cinder action. When dying the second dying action uses animation -1, meaning it is invisible for that action. The animation speed controls the blinking frequency, but not how long the Cinder lasts.

Keen 6

#Cache
%patch $3243E [$011DW] #Babobba cache start
%patch $3248E [$0129W] #Babobba cache end

#Jumping
%patch $33C78 $011EW $0121W
%patch $33C82 $0008W        #Animation speed

#Falling
%patch $33C96 $011FW $0122W
%patch $33CA0 $0008W        #Animation speed

#Landed
%patch $33CB4 $011DW $0120W
%patch $33CBE $0014W        #Animation speed

#Shooting
%patch $33CD2 $011DW $0120W
%patch $33CDC $0046W        #Animation speed

#Stunned, in air
%patch $33CF0 $011EW $0121W
%patch $33CFA $0000W        #Animation speed

#Stunned, landed
%patch $33D0E $0125W $0125W
%patch $33D18 $0000W        #Animation speed

#Napping
%patch $33D2C $0126W $0126W
%patch $33D36 $000FW        #Animation speed
%patch $33D4A $0127W $0127W
%patch $33D54 $000FW        #Animation speed
%patch $33D68 $0128W $0128W
%patch $33D72 $000FW        #Animation speed
%patch $33D86 $0129W $0129W
%patch $33D90 $01F4W        #Napping time
%patch $33DA4 $0128W $0128W
%patch $33DAE $000FW        #Animation speed
%patch $33DC2 $0127W $0127W
%patch $33DCC $000FW        #Animation speed
%patch $33DE0 $0126W $0126W
%patch $33DEA $000FW        #Animation speed

#Tossed cinder
%patch $33DFE $0123W $0123W
%patch $33E08 $0008W        #Animation speed

#Landed cinder
%patch $33E1C $0124W $0124W
%patch $33E26 $0008W        #Animation speed
%patch $33E3A $0123W $0123W
%patch $33E44 $0008W        #Animation speed

#Cinder dying
%patch $33E58 $0124W $0124W
%patch $33E62 $0008W        #Animation speed
%patch $33E76 $FFFFW $FFFFW #Babobba cinder invisible
%patch $33E80 $0008W        #Animation speed


Sprite positioning

The Babobba spawns two tiles higher than where it is placed, leaving it falling through the air.

The Babobba's shot is spawned 4 pixels down from the top of its head. Depending on whether the Babobba is shooting left or right it spawns 16 or 12 pixels right of its left side respectively.

Keen 6

#Babobba spawn height
%patch $12124 [$FE00W] #2 tiles up

#Babobba shot position
%patch $121B1 [$0040W] #4 pixels down
%patch $121C6 [$0100W] #16 pixels right (Shooting right)
%patch $121D1 [$00B0W] #12 pixels right (Shooting left)


Clipping and foreground

The Babobba has a value of 0 for its foreground variable, possibly because this places it behind all foreground tiles and it must jump against walls and floors. Its shot however has a value of 2, placing it in front of many sprites and foreground tiles, making it more obvious in-game.

Foreground variables

#Foreground variables
%patch $12112 [$0000W] #Babobba
%patch $121FC [$0002W] #Babobba's cinder


Sprite-tile interaction

The Babobba uses several tile interactions. Its only unique interaction is used when it is jumping and falling, this is the interaction that allows it to land on ground. The tossed cinder uses a more generic 'wait until hitting the ground' collision that causes it to only change when it hits floors. All other frames use a general 'draw sprite' interaction. (That is they do not interact with tiles at all.)

Keen 6

#Jumping
%patch $33C90 $11CF0602RL

#Falling
%patch $33CAE $11CF0602RL

#Landed
%patch $33CCC $08F4180ARL

#Shooting
%patch $33CEA $08F4180ARL

#Shot, in air
%patch $33D08 $08F419AFRL

#Shot, landed
%patch $33D26 $08F419AFRL

#Napping
%patch $33D44 $08F4180ARL
%patch $33D62 $08F4180ARL
%patch $33D80 $08F4180ARL
%patch $33D9E $08F4180ARL
%patch $33DBC $08F4180ARL
%patch $33DDA $08F4180ARL
%patch $33DF8 $08F4180ARL

#Cinder tossed
%patch $33E16 $0EFC00B9RL

#Cinder landed
%patch $33E34 $08F4180ARL
%patch $33E52 $08F4180ARL

#Cinder dying
%patch $33E70 $08F4180ARL
%patch $33E8E $08F4180ARL


Falling Babobba interaction code

This is the complete code for the falling Babobba tile interaction. On the first line left walls are checked for and, if found, the Babobba's direction is set to right. (It turns.) At the end of line 2 the same is done for right walls. The sum total of this is to make the falling Babobba turn when it hits walls.

At the start of line 4 ceilings are checked for. If found the Babobba's vertical speed is set to 0, that is, it stops moving upwards. At the end of line 4 floors are checked for. If found then the Babobba's action changes to landed. The remaining three lines of code simply draw the sprite.

Keen 6

#Babobba tile collision
%patch $122F2 $55 $8B $EC $56 $8B $76 $06 $83 $7C {$38} [$00] {$74} $0F $C7 $44 $0E
              [$0001W]  $8B $44 $16 $F7 $D8 $89 $44 $16 $EB $13 $83 $7C {$3C} [$00]
              {$74} $0D $C7 $44 $0E [$FFFFW]  $8B $44 $16 $F7 $D8 $89 $44 $16 $83
              $7C {$3A} [$00] {$74} $05 $C7 $44 $18 [$0000W]  $83 $7C {$36} [$00] {$74} $0D
              $B8 [$2F84W]  $50 $56 $9A $08F41297RL     $83 $C4 $04 $FF $74 $20
              $33 $C0 $50 $FF $74 $1E $FF $74 $0C $FF $74 $0A $8B $C6 $05 $46
              $00 $50 $9A $16081770RL     $83 $C4 $0C $5E $5D $CB


Probability and randomness

There is only one random event relating to the Babobba and that is how often it naps. By default this is not very often at all.

Keen 6

#Chance of Babobba napping
%patch $12170 $04


Action type

When jumping the Babobba needs to move smoothly and react quickly, so it uses action type 3. When falling it needs to respond quickly and so uses type 2. This type is also used by its tossed cinder and both of its stunned actions. All other actions are basic and thus type 0.

Sprite action types

#Jumping
%patch $33C7C [$0003W]

#Falling
%patch $33C9A [$0002W]

#Landed
%patch $33CB8 [$0000W]

#Shooting
%patch $33CD6 [$0000W]

#Shot, in air
%patch $33CF4 [$0002W]

#Shot, landed
%patch $33D12 [$0002W]

#Napping
%patch $33D30 [$0000W]
%patch $33D4E [$0000W]
%patch $33D6C [$0000W]
%patch $33D8A [$0000W]
%patch $33DA8 [$0000W]
%patch $33DC6 [$0000W]
%patch $33DE4 [$0000W]

#Cinder tossed
%patch $33E02 [$0002W]

#Cinder landed
%patch $33E20 [$0000W]
%patch $33E3E [$0000W]

#Cinder dying
%patch $33E5C [$0000W]
%patch $33E7A [$0000W]


Deprotect and stick to ground

The Babobba has no need for either of these variables and so has a value of 0 for both in all of its actions.

Sprite deprotect, stick

#Jumping
%patch $33C7E [$0000W $0000W]

#Falling
%patch $33C9C [$0000W $0000W]

#Landed
%patch $33CBA [$0000W $0000W]

#Shooting
%patch $33CD8 [$0000W $0000W]

#Shot, in air
%patch $33CF6 [$0000W $0000W]

#Shot, landed
%patch $33D14 [$0000W $0000W]

#Napping
%patch $33D32 [$0000W $0000W]
%patch $33D50 [$0000W $0000W]
%patch $33D6E [$0000W $0000W]
%patch $33D8C [$0000W $0000W]
%patch $33DAA [$0000W $0000W]
%patch $33DC8 [$0000W $0000W]
%patch $33DE6 [$0000W $0000W]

#Cinder tossed
%patch $33E04 [$0000W $0000W]

#Cinder landed
%patch $33E22 [$0000W $0000W]
%patch $33E40 [$0000W $0000W]

#Cinder dying
%patch $33E5E [$0000W $0000W]
%patch $33E7C [$0000W $0000W]