Patch:King Boobus Tuber

From KeenWiki
(Redirected from Patch:Boobus Tuber)
Jump to navigation Jump to search

King Boobus Tuber is the final boss in Keen Dreams. He is a giant potato, about ten feet tall with 12 eyes, so he can see in any direction. He will chase and jump after Keen in Boobus' Chamber and the game is won by destroying him with 12 Boobus Bombs.


Sprite Type

King Boobus' type is set in two places. Firstly when he is spawned, and it is changed when he is defeated, making him harmless and unable to kill Keen. This is necessary because Keen reacts to Boobus' type, dying if he touches type 23.

Keen Dreams

#Boobus Tuber's type
%patch $931D $0017W #When spawned
%patch $6592 $0019W #When killed


Sprite Actions

King Boobus Tuber has one of the more complex sets of actions in the game. Boobus is spawned in the first frame of his walking cycle. This cycle is four frames long and continues indefinitely.

Boobus will jump or fall (The same action is both) under three conditions. One is if Keen is higher than Boobus (Jump up to reach him) another is when Keen is lower than Boobus (Fall down to reach him.) The third is unknown. Which condition is which is currently unknown.

Jumping\falling Boobus does nothing until he hits the ground. When this happens he returns to his walking cycle.

When shot enough times Boobus will enter his death sequence. There are three death frames; the first frame animates to itself and only changes to the second after a specific period of time. The same happens with the second frame. The third frame animates to nothing. (Boobus vanishes.)

While dying Boobus emits a number of death smoke sprites, each using the same code. The smoke sequence is six actions long and ends with the smoke vanishing.

Actions:
$23D4W #Boobus walk 1
$23F2W #Boobus walk 2
$2410W #Boobus walk 3
$242EW #Boobus walk 4
$244CW #Boobus jump\fall)
$246AW #Boobus die 1
$2488W #Boobus die 2
$24A6W #Boobus die 3
$24C4W #Boobus death smoke 1
$24E2W #Boobus death smoke 2
$2500W #Boobus death smoke 3
$251EW #Boobus death smoke 4
$253CW #Boobus death smoke 5
$255AW #Boobus death smoke 6

Keen Dreams

#Boobus placed in-level
%patch $933A [$23D4W]

#Walk cycle
%patch $25E60 [$23F2W]
%patch $25E7E [$2410W]
%patch $25E9C [$242EW]
%patch $25EBA [$23D4W]

#Boobus jump\fall
%patch $9478 [$244CW]
%patch $948D [$244CW]
%patch $952A [$244CW]

#Falling Boobus does nothing
%patch $25ED8 [$0000W]

#Falling Boobus lands on ground
%patch $956D [$23D4W]

#Boobus dies when shot
%patch $6595 [$246AW]

#First death frame
%patch $25EF6 [$246AW]

#First death frame goes to second death frame
%patch $9369 [$246AW]

#Second death frame
%patch $25F14 [$2488W]

#Second death frame goes to third death frame
%patch $9386 [$24A6W]

#Third death frame
%patch $25F32 [$0000W]

#Death smoke spawned
%patch $93E2 [$24C4W]

#Death smoke sequence
%patch $25F50 [$24E2W]
%patch $25F6E [$2500W]
%patch $25F8C [$251EW]
%patch $25FAA [$253CW]
%patch $25FC8 [$255AW]
%patch $25FE6 [$0000W]


Sprite Behavior

Behaviors:
$07C501A4RL #Move through the air
$08680D92RL #Boobus Tuber chase Keen
$08680CD4RL #Boobus Tuber dying
$08680D74RL #Boobus Tuber die

Boobus Tuber has three behaviors of his own. When walking he uses a 'chase Keen' behavior that allows him to seek Keen and jump up after him. When jumping Boobus Tuber uses a generic 'move through the air' behavior. When dying Boobus Tuber has two behaviors; for the first two frames a 'dying' behavior is used; this produces a lot of smoke. The third frame wins the game.

The smoke produced on Boobus Tuber's destruction also use the generic 'move through the air' behavior.

Keen Dreams

#Boobus Tuber walk
%patch $25E54 $08680D92RL
%patch $25E72 $08680D92RL
%patch $25E90 $08680D92RL
%patch $25EAE $08680D92RL

#Boobus Tuber jump
%patch $25ECC $07C501A4RL

#Boobus dying
%patch $25EEA $08680CD4RL
%patch $25F08 $08680CD4RL
%patch $25F26 $08680D74RL

#Death smoke
%patch $25F44 $07C501A4RL
%patch $25F62 $07C501A4RL
%patch $25F80 $07C501A4RL
%patch $25F9E $07C501A4RL
%patch $25FBC $07C501A4RL
%patch $25FDA $07C501A4RL


Walking behavior code

This is the complete code for Boobus walking. The first line checks Boobus' horizontal position relative to Keen and changes his direction so that he will always walk towards the player.

On the fourth line something similar is done with Boobus' vertical position. On line 7 Boobus will drop $80 game units (8 pixels) to fall down to reach Keen while on lines 8-9 Boobus will jump up to reach Keen. (Both jumping and falling are the same action.)

Keen Dreams

#Boobus walking behavior
%patch $9412 $55 $8B $EC $56 $57 $8B $76 $06 $33 $D2 $8B $44 $22 $8B $1E $34
             $70 $3B $47 $26 {$76} $07 $C7 $44 $0E [$FFFFW]  $EB $16 $8B $44 $26
             $8B $1E $34 $70 $3B $47 $22 {$73} $07 $C7 $44 $0E [$0001W]  $EB $03
             $BA $0001W  $8B $1E $34 $70 $8B $47 $24 $3B $44 $28 {$73} $08 $8B
             $47 $28 $3B $44 $24 {$77} $40 $0B $D2 {$74} $3C $8B $44 $0C $8B $1E
             $34 $70 $3B $47 $0C {$73} $21 $BF [$0080W]  $FF $44 $32 $01 $7C $28
             $01 $7C $0C $C7 $44 $1E [$244CW]  $33 $C0 $89 $44 $14 $89 $44 $16
             $89 $44 $12 $89 $44 $18 $EB $0F $C7 $44 $1E [$244CW]  $C7 $44 $18
             [$FFC4W]  $C7 $44 $16 [$0000W]  $5F $5E $5D $CB


Smoking behavior code

This is the complete code for Boobus producing smoke before dying. It is rather complex. The first two lines contain two counters that determine how long King Boobus takes to smoke. The first counter, changing Boobus to his second dying frame is trivial and doesn't actually do anything. The second counter will change him to his third dying frame when it runs out. It also runs code to remove his sprite image.

On line four, after the counter codes sound $15 is played. Line 6 controls the horizontal spread of the smoke produced (5 tiles by default.) followed by its horizontal position (8 pixels of half a tile left of Boobus by default.) The next two lines do the same for the smoke's vertical spread and positioning.

On the second to last line Boobus' horizontal and vertical speeds are set to zero, stopping his movement. It also sets the death smoke's action before finally placing the sprite.

Keen Dreams

#Boobus smoking behavior code
%patch $9354 $55 $8B $EC $56 $8B $76 $06 $FF $44 $3E $8B $44 $3E $3D [$003CW]
             $75 $05 $C7 $44 $1E [$2488W]  $FF $44 $3E $8B $44 $3E $3D [$003CW]
             $75 $12 $8B $C6 $05 $0046W  $50 $9A $0E450F7ARL     $44 $44 $C7
             $44 $1E [$24A6W]  $B8 [$0015W]  $50 $9A $10BB1282RL     $44 $44 $B8
             $0001W  $50 $9A $044D01C9RL     $44 $44 $9A $16C40026RL     $BA
             [$0005W]  $F7 $EA $8B $54 $0A $81 $EA [$0080W]  $03 $D0 $8B $1E $3E
             $70 $89 $57 $0A $9A $16C40026RL     $BA [$0005W]  $F7 $EA $8B $54
             $0C $81 $EA [$0080W]  $03 $D0 $8B $1E $3E $70 $89 $57 $0C $C7 $47
             $16 [$0000W]  $C7 $47 $18 [$0000W]  $9A $16C40026RL     $B8 [$24C4W]
             $50 $FF $36 $3E $70 $9A $07C50255RL     $83 $C4 $04 $5E $5D $CB


Spread of smoke

The smoke produced by King Boobus has a horizontal and vertical spread of 5 tiles down and right of the top left of Boobus' sprite. The larger these values the larger an area is covered with smoke.

Keen Dreams

#Spread of Boobus smoke
%patch $93A4 [$0005W] #Horizontal
%patch $93BE [$0005W] #Vertical


Location of smoke relative to Boobus

The death smoke is also positioned relative to King Boobus. By default it is 8 pixels or half a tile left and above Boobus' sprite's top left corner.

Keen Dreams

#Position of Boobus smoke
%patch $93AD [$0080W] #Horizontal - 0.5 tiles
%patch $93C7 [$0080W] #Vertical - 0.5 tiles


Dying behavior code

This is the complete code for Boobus dying. It does two things; on the first line it sets the level state variable to 5, winning the game. On the second line it plays sound $16.

Keen Dreams

#Boobus dying behavior code
%patch $93F4 $55 $8B $EC $56 $8B $76 $06 $C7 $06 {$705AW}  [$0005W]  $83 $C6 $4C
             $B8 [$0016W]  $50 $9A $10BB1282RL     $44 $44 $5E $5D $CB


Speed and Jump Height

Boobus' animations speeds set his walking left\right speed. All other actions have no horizontal or vertical speed. Boobus' jump height is set in his code.

Sprite speeds

#Boobus walk
%patch $25E50 [$0080W $0000W]
%patch $25E6E [$0080W $0000W]
%patch $25E8C [$0080W $0000W]
%patch $25EAA [$0080W $0000W]

#Boobus jump
%patch $25EC8 [$0000W $0000W]

#Boobus die
%patch $25EE6 [$0000W $0000W]
%patch $25F04 [$0000W $0000W]
%patch $25F22 [$0000W $0000W]

#Boobus death smoke
%patch $25F40 [$0000W $0000W]
%patch $25F5E [$0000W $0000W]
%patch $25F7C [$0000W $0000W]
%patch $25F9A [$0000W $0000W]
%patch $25FB8 [$0000W $0000W]
%patch $25FD6 [$0000W $0000W]


Animations

Boobus has four animation cycles. The first two are walking and jumping up (and down) after Keen. The third is his main death animation, one visible frame and two 'empty' frames where he vanishes behind a lot of smoke sprites. The smoke cycle is the fourth. The animation speed of Boobus' last death frame is how long before the won game text appears.

Keen Dreams

#Cache
%patch $23E90 $0167W #Boobus Tuber cache start
%patch $23EBC $016FW #Boobus Tuber cache end

#Boobus walk
%patch $25E44 $0167W $016BW
%patch $25E4E $000AW        #Animation speed
%patch $25E62 $0168W $016CW
%patch $25E6C $000AW        #Animation speed
%patch $25E80 $0169W $016DW
%patch $25E8A $000AW        #Animation speed
%patch $25E9E $016AW $016EW
%patch $25EA8 $000AW        #Animation speed

#Boobus jump
%patch $25EBC $016FW $016FW
%patch $25EC6 $0000W        #Animation speed

#Boobus die
%patch $25EDA $016FW $016FW
%patch $25EE4 $0004W        #Animation speed
%patch $25EF8 $0000W $0000W
%patch $25F02 $0004W        #Animation speed
%patch $25F16 $0000W $0000W
%patch $25F20 $00FAW        #Time before winning game

#Boobus death smoke
%patch $25F34 $00C3W $00C3W
%patch $25F3E $0014W        #Animation speed
%patch $25F52 $00C4W $00C4W
%patch $25F5C $0014W        #Animation speed
%patch $25F70 $00A8W $00A8W
%patch $25F7A $0028W        #Animation speed
%patch $25F8E $00A9W $00A9W
%patch $25F98 $001EW        #Animation speed
%patch $25FAC $00AAW $00AAW
%patch $25FB6 $001EW        #Animation speed
%patch $25FCA $00ABW $00ABW
%patch $25FD4 $001EW        #Animation speed


Sprite Collision

Collision values

Like nearly all sprites in Keen Dreams King Boobus does not have a sprite collision. Instead Keen and his shots react to them and their sprite types.

Keen Dreams

#Boobus Tuber walk
%patch $25E58 $00000000L
%patch $25E76 $00000000L
%patch $25E94 $00000000L
%patch $25EB2 $00000000L

#Boobus Tuber jump
%patch $25ED0 $00000000L

#Boobus dying
%patch $25EEE $00000000L
%patch $25F0C $00000000L
%patch $25F2A $00000000L

#Death smoke
%patch $25F48 $00000000L
%patch $25F66 $00000000L
%patch $25F84 $00000000L
%patch $25FA2 $00000000L
%patch $25FC0 $00000000L
%patch $25FDE $00000000L


King Boobus' strength

By default King Boobus takes 12 hits to defeat. These can be either Boobus bombs or Flower Power.

Keen Dreams

#Boobus Tuber's strength
%patch $9350 [$000CW]


Points given for defeating Boobus

By default Keen is given 100'000 points for defeating Boobus. However due to the limitations of the game this is done as two 50'000 point lots. As such the total amount of points given is a sum of two variables.

Keen Dreams

#Points given for defeating Boobus
%patch $657B [$C350W] #50'000
%patch $6586 [$C350W] #50'000


How long Boobus spends dying

There are several steps to Boobus dying. The first is how long he spends producing death smoke before vanishing and the second is how long after vanishing the game ends.

Keen Dreams

#How long Boobus spends smoking
%patch $9362 [$003CW]
%patch $9372 [$003CW]


Sprite positioning

King Boobus spawns 88 pixels (5.5 tiles) higher then where it is placed in-level. This should be changed with its sprite height as it is used to make the King Boobus level with the ground when he first spawns.

Boobus' death smoke 'group' is also positioned relative to King Boobus. By default it is 8 pixels or half a tile left and above Boobus' sprite's top left corner.

Keen Dreams

#Boobus spawn height
%patch $932F [$FA80W] #88 pixels upwards

#Position of Boobus smoke
%patch $93AD [$0080W] #Horizontal - 0.5 tiles
%patch $93C7 [$0080W] #Vertical - 0.5 tiles


Sounds

There are two sounds relating to King Boobus, the explosion sounds made as he dies and the 'win game' sound.

Keen 4

#Boobus sounds
%patch $9389 [$15]    #King Boobus Tuber death explosion sound
%patch $9405 [$16]    #Win game sound

#Don't play sounds
%patch $9388 $EB $09 #Don't play King Boobus Tuber death explosion sound
%patch $9404 $EB $09 #Don't play Win game sound


Sprite-tile interaction

King Boobus has two unique tile interactions; the first is used when walking and the second when jumping or falling. When dying King Boobus uses a generic 'show sprite' interaction that does nothing, as does his death smoke.

Keen Dreams

#Boobus Walk
%patch $25E5C $08680E1DRL
%patch $25E7A $08680E1DRL
%patch $25E98 $08680E1DRL
%patch $25EB6 $08680E1DRL

#Boobus jump\fall
%patch $25ED4 $08680ED4RL

#Boobus die
%patch $25EF2 $07C501DDRL
%patch $25F10 $00000000L
%patch $25F2E $00000000L

#Boobus death smoke
%patch $25F4C $07C5022DRL
%patch $25F6A $07C5022DRL
%patch $25F88 $07C5022DRL
%patch $25FA6 $07C5022DRL
%patch $25FC4 $07C5022DRL
%patch $25FE2 $07C5022DRL


Action type

Boobus' actions are quite basic and thus type 0. The only exception to this is his jumping\falling action, which needs to react quickly and move through the air smoothly. It is type 2.

Sprite action types

#Boobus Walk
%patch $25E48 [$0000W]
%patch $25E66 [$0000W]
%patch $25E84 [$0000W]
%patch $25EA2 [$0000W]

#Boobus jump\fall
%patch $25EC0 [$0002W]

#Boobus die
%patch $25EDE [$0000W]
%patch $25EFC [$0000W]
%patch $25F1A [$0000W]

#Boobus death smoke
%patch $25F38 [$0000W]
%patch $25F56 [$0000W]
%patch $25F74 [$0000W]
%patch $25F92 [$0000W]
%patch $25FB0 [$0000W]
%patch $25FCE [$0000W]


Deprotect and stick to ground

Boobus Tuber needs to stick to the ground while walking and thus uses a value of 1 for this variable in his walking actions.

Sprite deprotect, stick

#Boobus Walk
%patch $25E4A [$0000W $0001W]
%patch $25E68 [$0000W $0001W]
%patch $25E86 [$0000W $0001W]
%patch $25EA4 [$0000W $0001W]

#Boobus jump\fall
%patch $25EC2 [$0000W $0000W]

#Boobus die
%patch $25EE0 [$0000W $0000W]
%patch $25EFE [$0000W $0000W]
%patch $25F1C [$0000W $0000W]

#Boobus death smoke
%patch $25F3A [$0000W $0000W]
%patch $25F58 [$0000W $0000W]
%patch $25F76 [$0000W $0000W]
%patch $25F94 [$0000W $0000W]
%patch $25FB2 [$0000W $0000W]
%patch $25FD0 [$0000W $0000W]


Sprite spawn code

There is one type of Boobus Tuber. In his initiation code his cache is set in $C7 $06 $70D4W $0001W.

The second-to-last blue highlighted value is the sprite action the sprite uses as it proceeds to act in-level. $C7 $07 $xxxxW sets the sprite type and $C7 $47 $0E $xxxxW is the horizontal direction the sprite starts moving in, either $0001W (Facing right), $FFFFW (Facing left) or $0000W (Neither, seldom used.) $C7 $47 $10 $xxxxW is the vertical direction and works similarly. King Boobus spawns facing left, towards Keen in the original level setup.

Finally $D3 $E0 $05 $xxxxW 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. King Boobus spawns 88 pixels or 5.5 tiles higher than where it is placed, this should be changed if its sprite height changes.

Keen Dreams

#Boobus Tuber initiation pointer
%patch $4A55 [$04E6W] #Boobus Tuber (At $49B6

#Boobus Tuber initiation code
%patch $49B6 $FF $36 $7052W  $FF $36 $7050W  $9A $08680C8ARL     $83 $C4 $04
             $C7 $06 $70D4W  $0001W

#King Boobus Tuber spawn code
%patch $930A $55 $8B $EC $33 $C0 $50 $9A $044D01C9RL     $44 $44 $8B $1E $3E
             $70 $C7 $07 [$0017W]  $8B $46 $06 $B1 $08 $D3 $E0 $89 $47 $0A $8B
             $46 $08 $D3 $E0 $05 [$FA80W]  $89 $47 $0C $C7 $47 $0E [$FFFFW]  $B8
             [$23D4W]  $50 $FF $36 $3E $70 $9A $044D1212RL     $83 $C4 $04 $8B
             $1E $3E $70 $C7 $47 $44 [$000CW]  $5D $CB


Misc

Other enemies can be killed like Boobus

This patch allows other enemies to be killed in the same way as Boobus Tuber. (That is, they take twelve hits with Flower Power or Boobus Bombs before dying in a cloud of smoke.) The patch here works for the Tater Trooper, but it can be adapted to other enemies.

The patch tweaks the Flower Power's sprite collision so that there two unique deaths producing two unique 'dying actions'. Boobus' 'make smoke' behavior is also altered so that what happens after the dying counter runs out depends on the sprite's animation. (Here, if it is greater than the Trooper's last animation then the sprite turns to Boobus' game-winning action, otherwise it simply turns to smoke.)

Finally the enemy's spawn code needs to be tweaked to give it an appropriate amount of health.

Keen Dreams

#Dying Trooper action, makes smoke
%patch $25EF8 $011CW $011CW $0000W $0000W $0000W $0004W $0000W $0000W
              $08680CD4RL   $00000000L    $07C501DDRL   $2488W

#Tater trooper has Boobus-like death
%patch $65CE $06F5W #Tater Trooper
%patch $65E6 $06FFW #Boobus Tuber
%patch $6575 $FF $4C $44 $75 $2E $B8 [$2488W]  $EB $08
             $FF $4C $44 $75 $24 $B8 [$246AW]  $50 $56 $9A $07C50255RL     $B8
             [$C350W]  $50 $9A $044D090ERL     $9A $044D090ERL     $83 $C4 $06
             $C7 $04 [$0019W]  $C7 $44 $3E [$0000W]  $B8 [$0015W]  $50 $9A
             $10BB1282RL     $B8 [$0C4AW]  $50 $57 $9A $07C50255RL     $83 $C4
             $06 $5F $5E $5D $CB

#Tater Trooper's health (12)
%patch $86D0 $44 [$000CW]

#Boobus and Trooper share a death, Boobus wins game
%patch $9354 $55 $8B $EC $56 $8B $76 $06 $FF $44 $3E $8B $44 $3E $3D [$003CW]
             $7E $22 $8B $44 $20 $3D [$0125W]  {$7D} $07 $C7 $44 $1E [$24C4W]  $EB
             $05 $C7 $44 $1E [$24A6W]  $8B $C6 $05 [$0046W]  $50 $9A $0E450F7ARL
             $44 $44 $90


Boobus Tuber attacks Keen on contact

This patch causes King Boobus to change his action when he touches Keen. That is, he will attack Keen on contact. This is done by compressing some of Keen's collision code and using the extra space to give Boobus his own collision that kills Keen and changes his action. In this case the action is just his fourth walking frame but a custom action can be created.

Keen Dreams

#Flower Pot code - shrunk for efficiency
%patch $7762 $B8 [$0006W]  $50 $9A $10BB1282RL     $44 $44 $C7 $44 $20 [$00D0W]
             $83 $06 {$711CW}  [$05] $EB $D9

#Boobus collision, kill and go to attack
%patch $7779 $0E $E8 $FED3W $B8 [$242EW]  $50 $EB $D3

#Tuber uses new attack
%patch $7936 [$18F9W]