Patch:Bipship

From KeenWiki
Jump to navigation Jump to search

This page covers patches relating to the Bipships in Keen 6. Bipships are mostly black flying enemies found ina few levels. They are notable for spawning Bips when shot.


Sprite Type

There are several sprite types used by Bips and related sprites. Bipships when spawned use type 26 and Bips use sprite type 20 when produced by a crashed ship. These two types aren't used by anything else, nor do they affect any other sprite type. The crashed ship also makes smoke, which uses type 1, used by any 'misc sprite'. Finally the Bipship's shot is type 4, used for enemy projectiles. Note that the 'as-is' Bip does not have a sprite type set.

Keen 6

#Bip sprite type
%patch $11A71 $14 #Spawned from Bipship

#Bipship sprite types
%patch $117D7 $1A #Bipship
%patch $11A37 $01 #Bipship crash smoke
%patch $11918 $04 #Bipship's shot


Sprite Actions

Bipships are relatively straightforward. They are spawned moving and continue to do so until they reach the edges of platforms, where they will turn. Turning is a four frame sequence that ends in the Bipship returning to moving. Bipships will also fire at Keen if he is in range.

When shot a Bipship will go to falling, then to crashing and finally to wreckage, which will do nothing. The crash also produces a Bip and some smoke. The Bip has its own page while the Smoke simply vanishes after a short time.

Bipship's shots are produced when the Bipship shoots. They do nothing until they hit a tile and are destroyed.

Actions:
$2A5CW  #Bipship moving l/r
$2A7AW  #Bipship's shot
$2A98W  #Bipship turning 1
$2AB6W  #Bipship turning 2
$2AD4W  #Bipship turning 3
$2AF2W  #Bipship turning 4
$2B10W  #Bipship falling
$2B2EW  #Bipship crashing
$2B4CW  #Bipship wreckage
$2B6AW  #Bipship smoke 1
$2B88W  #Bipship smoke 2

Keen 6

#When spawned
%patch $11821 [$2A5CW]

#While moving
%patch $337A8 [$2A5CW]

#Turning (At edge of platforms)
%patch $11A00 [$2A98W]

#While turning
%patch $337E4 [$2AB6W]
%patch $33802 [$2AD4W]
%patch $33820 [$2AF2W]
%patch $3383E [$2A5CW]

#When shot
%patch $11AD3 [$2B10W]

#When falling
%patch $3385C [$2B2EW]

#When crashing
%patch $3387A [$2B4CW]

#Wreckage
%patch $33898 [$2B4CW]

#What else is produced when Bipship crashes
%patch $11A53 [$2B6AW] #Bipship smoke
%patch $11AAB [$29A8W] #Bip

#Smoke
%patch $338B6 [$2B88W]
%patch $338D4 [$0000W]

#What is produced when Bipship shoots
%patch $1195C [$2A7AW]

#Bipship's shot
%patch $337C6 [$0000W]


Sprite Behavior

These are the values the Bipship uses for its behavior. The Bipship has three unique behaviors. The first is that which allows it to move and shoot Keen. This is used when the Bipship is moving. The second is used when the Bipship is turning. The third is used when the Bipship crashes, producing smoke, wreckage and the Bip.

Keen 6

#Moving
%patch $3379C $10CC0BD4RL

#Bipship's shot
%patch $337BA $08F4179DRL

#Turning
%patch $337D8 $10CC0BBARL
%patch $337F6 $10CC0BBARL
%patch $33814 $10CC0BBARL
%patch $33832 $10CC0BBARL

#Falling
%patch $33850 $08F41765RL

#Crashing
%patch $3386E $10CC0D52RL

#Wreckage
%patch $3388C $00000000L

#Smoke
%patch $338AA $00000000L 
%patch $338C8 $00000000L


Increase Bipship's shooting frequency

This increases the Bipship's shooting frequency.

Keen 6

#Increase Bip shooting frequency
%patch $118F7 $20


Bipship doesn't shoot

This patch prevents the Bipship from shooting Keen entirely.

Keen 6

#Bipship doesn't shoot
%patch $118E4 $90 $90


Bipship can't shoot, runs from Keen

This patch stops the Bipship from attacking Keen and also makes it run away from him. It may have unforeseen consequences however.

Keen 6

#Bipship can't shoot, runs from Keen
%patch $10D35 $0005W


Speed and Jump Height

The Bipship's speed is defined in its code and cannot yet be patched. It does not use its animation motion.

Keen 6 Animation motion

#Moving
%patch $33798 [$0000W $0000W]

#Bipship's shot
%patch $337B6 [$0000W $0000W]

#Turning
%patch $337D4 [$0000W $0000W]
%patch $337F2 [$0000W $0000W]
%patch $33810 [$0000W $0000W]
%patch $3382E [$0000W $0000W]

#Falling
%patch $3384C [$0000W $0000W]

#Crashing
%patch $3386A [$0000W $0000W]

#Wreckage
%patch $33888 [$0000W $0000W]

#Smoke
%patch $338A6 [$0000W $0000W]
%patch $338C4 [$0000W $0000W]


Sprite Collision

The Bipship and its related sprites have a number of interesting collisions.


Collision values

The main Bipship collision is that which results in it crashing. This is used by all the Bipship frames except the crashing ones (Which predictably have no collision.) The crash smoke also has no collision, but the Bipship's shot uses a generic 'deadly to Keen' collision.

Keen 6 collision values

#Moving
%patch $337A0 $10CC0DFDRL

#Bipship's shot
%patch $337BE $08F417EERL

#Turning
%patch $337DC $10CC0DFDRL
%patch $337FA $10CC0DFDRL
%patch $33818 $10CC0DFDRL
%patch $33836 $10CC0DFDRL

#Falling
%patch $33854 $00000000L

#Crashing
%patch $33872 $00000000L

#Wreckage
%patch $33890 $00000000L

#Smoke
%patch $338AE $00000000L
%patch $338CC $00000000L


Collision code

Complete collision code

This is the complete sprite collision code for the Bipship. It is simple responding to Keen's shot type in the first line and changing its action to that of a crashing Bipship in the second.

Keen 6

#Bipship collision code
%patch $11ABD $55 $8B $EC $56 $8B $76 $08 $83 $3C [$03] {$75} $18 $56 $9A $0CA60EC2RL
                      $83 $C4 $02 $B8 [$2B10W]  $50 $FF $76 $06 $9A $08F41297RL
                  $83 $C4 $04 $5E $5D $CB


Bipship can kill Keen on contact

This patch makes the Bipship lethal to Keen as well as shootable while using the original patch space. This does have the side effect of making the Bipship's collision dependent on two other sprite collisions however which makes it easy to corrupt when patching other enemies. As such care should be used when using this patch.

Keen 6

#Bipship is lethal to Keen and shootable
%patch $11ABD $55 $8B $EC $56 $8B $76 $08 $83 $3C [$03] {$75} $0F $56 $9A $0CA60EC2RL
                      $83 $C4 $02 $B8 [$2B10W]  $E9 $F99FW  $83 $3C [$02] {$75} $03
              $E9 $07D3W  $5E $5D $CB


Crashed Ship doesn't spawn a Bip

This patch changes things so that when the Bipship crashes it does not produce a Bip.

Keen 6

#Crashed Bipship doesn't spawn a Bip
%patch $11AAA $5E $5D $CB


Animations

The Bipship has an interesting set of animations. The same animation is used when moving as when falling and crashing. Eight different animations are used in the turning sequences. The Bipship's shot uses only one animation, as does its wreckage, but the smoke uses two animations. Animation speed is important when turning, as it controls how long a turn takes, and also when crashing as it controls the time taken for the smoke an Bip to appear.

The smoke will vanish after a short time, controlled by its animation speed, but the Wreckage will remain forever, using a unique (and large) value for its animation speed.

Keen 6 Animations

#Cache
%patch $32448 [$010DW] #Bipship cache start
%patch $32498 [$011CW] #Bipship cache end

#Bipship moving l/r
%patch $3378C $0112W $010DW
%patch $33796 $0000W        #Animation speed

#Bipship's shot
%patch $337AA $011CW $011CW
%patch $337B4 $0000W        #Animation speed

#Bipship turning
%patch $337C8 $010EW $0113W
%patch $337D2 $000AW        #Animation speed
%patch $337E6 $010FW $0114W
%patch $337F0 $000AW        #Animation speed
%patch $33804 $0110W $0115W
%patch $3380E $000AW        #Animation speed
%patch $33822 $0111W $0116W
%patch $3382C $000AW        #Animation speed

#Falling
%patch $33840 $0118W $0117W
%patch $3384A $0000W        #Wait until hits ground

#Crashing
%patch $3385E $0118W $0117W
%patch $33868 $0001W        #Time taken to make wreckage, smoke Bip

#Wreckage
%patch $3387C $011BW $011BW
%patch $33886 $7530W        #Stay forever

#Smoke
%patch $3389A $0119W $0119W
%patch $338A4 $000AW        #Animation speed
%patch $338B8 $011AW $011AW
%patch $338C2 $000AW        #Time before vanishing


Sprite positioning

The Bipship spawns 8 pixels or 0.5 tiles higher then where it is placed in-level. This must be changed with its sprite height as it is used to make the Bipship move along the ground.

Keen 6

#Bipship spawn height
%patch $117EE [$FF80W] #0.5 tiles upwards


Sounds

The Bipship produces a number of sound. At present the only one patchable is that made when it crashes into the ground after being shot.

Ceilick sounds

%patch $11A1A $18     #Bipship crash sound
%patch $11A19 $EB $0A #Don't play Bipship crash sound


Clipping and foreground

The Bipship itself does not have a foreground value set, though its shot uses a value of 1. The ship's wreckage has its foreground value set to 0 (appear behind all foreground tiles) possibly because it needs to sit on a floor. The Bipship's smoke however uses a value of 2, appearing in front of most foreground tiles and sprites.

Keen 6 Foreground

#Foreground
%patch $11922 [$0001W] #Bipship's shot
%patch $11A41 [$0002W] #Bip crash smoke
%patch $11A7B [$0000W] #Bip crashed ship


Probability, randomness and initial directions

The Bipship can start a level moving either right or left, with a 50:50 chance of doing either.

Keen 6

#Chance of initially moving right
%patch $117F6 $80


Sprite-tile interaction

When turning or moving the Bipship uses a general 'stay on platforms' interaction, as does its smoke. When crashing it uses a unique interaction to land on the ground. The Bipship's shot also uses a unique interaction to vanish when hitting any solid tiles.

Sprite tile interactions

#Bipship moving l/r
%patch $337A4 $08F4180ARL

#Bipship's shot
%patch $337C2 $10CC0B6FRL

#Bipship turning
%patch $337E0 $08F4180ARL
%patch $337FE $08F4180ARL
%patch $3381C $08F4180ARL
%patch $3383A $08F4180ARL

#Falling
%patch $33858 $0EFC0048RL

#Crashing
%patch $33876 $0EFC0048RL

#Wreckage
%patch $33894 $0EFC0048RL

#Smoke
%patch $338B2 $08F4180ARL
%patch $338D0 $08F4180ARL


Action type

When moving Bipships need to do so smoothly and react quickly. They use action type 2. When turning animation is required as well so these actions are type 3. Shots and falling Bipships need to move smoothly and react fast too, also using type 2. All other actions are type 0.

Sprite action types

#Bipship moving l/r
%patch $33790 [$0002W]

#Bipship's shot
%patch $337AE [$0002W]

#Bipship turning
%patch $337CC [$0003W]
%patch $337EA [$0003W]
%patch $33808 [$0003W]
%patch $33826 [$0003W]

#Falling
%patch $33844 [$0002W]

#Crashing
%patch $33862 [$0000W]

#Wreckage
%patch $33880 [$0000W]

#Smoke
%patch $3389E [$0000W]
%patch $338BC [$0000W]


Deprotect and stick to ground

The Bipship doesn't follow the ground in the same way normal sprites do. However a lot of its actions have their animations deprotected for unknown reasons.

Sprite deprotect, stick

#Bipship moving l/r
%patch $33792 [$0000W $0001W]

#Bipship's shot
%patch $337B0 [$0000W $0000W]

#Bipship turning
%patch $337CE [$0000W $0001W]
%patch $337EC [$0000W $0001W]
%patch $3380A [$0000W $0001W]
%patch $33828 [$0000W $0001W]

#Falling
%patch $33846 [$0000W $0000W]

#Crashing
%patch $33864 [$0001W $0000W]

#Wreckage
%patch $33882 [$0001W $0000W]

#Smoke
%patch $338A0 [$0001W $0000W]
%patch $338BE [$0001W $0000W]


Sprite spawn code

Only partial spawn code for the Bipship is available.

In the spawning code the last blue highlighted value is the sprite action the sprite uses as it proceeds to act in-level. $C7 $02 $xxxxW sets the sprite activity, $C7 $07 $xxxxW sets the sprite type. 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 Bipship starts the level moving either left or right with a 50:50 chance of either. $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.

Keen 6

#Bipship spawn code
%patch $117C3 $55 $8B $EC $33 $C0 $50 $9A $069A1E25RL     $83 $C4 $02 $8B $1E
              $66 $A9 $C7 $07 [$001AW]  $C7 $47 $02 [$0001W]  $8B $46 $06 $B1 $08
              $D3 $E0 $89 $47 $0A $8B $46 $08 $D3 $E0 $05 [$FE80W]  $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 $8B $47 $0E $BA $0014W  $F7 $EA $89 $47 $16 $B8 [$2A5CW]
              $50 $53 $9A $08F41219RL     $83 $C4 $04 $5D $CB