Patch:Slicestar

From KeenWiki
Jump to navigation Jump to search

The Slicestars in Keen 5 are two kinds of identical looking crystalline ('snowflake' enemies that move either horizontally or bounce diagonally, are lethal and very hard to destroy. Due to their similarities these two, technically different, enemies will be treated on the same page.


Sprite Type

Both Slicestars are type 12, which has no real effect on anything in-game.

Keen 5

#Sprite type
%patch $11741 $0B #Diagonal Slicestar
%patch $117E0 $0B #Horizontal Slicestar


Sprite Actions

There are three actions to the Slicestar, one for horizontal Slicestars, one for diagonal Slicestars and one used for both kinds when they are destroyed. Their actions never change and the two types cannot interconvert.

Both enemies are spawned via different code. The hoizontal Slicestar behaves like a moving platform, not chaning its action. Diagonal Slicestars constantly change their action to the same one they are using. Both spawn a smashed star if shot enough times. The smashed star will vanish in short order.

Actions:
$23BCW #Horizontal Slicestar
$23DAW #Diagonal Slicestar
$23F8W #Slicestar smashed

Keen 5

#Place Slicestars in level
%patch $117B2 $23BCW} #Horizontal Slicestar
%patch $11860 $23DAW} #Diagonal Slicestar

#While moving horizontally
%patch $32718 {$0000W} #Don't change

#While moving diagonally
%patch $32736 {$23DAW} #Remain a diagonal Slicestar

#When shot
%patch $11A87 {$23F8W} #Smashed Slicestar

#Smashed Slicestar
%patch $32754 {$0000W} #Vanish


Sprite Behavior

Only the horizontal Slicestar has a behavior, and not its own but that of the Horizontal-Vertical Red Platform. Diagonal Slicestars owe their behavior to tile collision.

Behaviors:
$0F920776RL #Horizontal-Vertical Red Platform

Keen 5

#Horizontal
%patch $3270C $0F920776RL #Move u/d - l/r Red Platform

#Diagonal
%patch $3272A $00000000L  #Nothing

#Smashed
%patch $32748 $00000000L  #Nothing


Speed and Jump Height

The horizontal Slicestar's speed will be the same as the Horizontal-Vertical Red Platform's. As such altering it will also alter the Platform's speed.

The Diagonal Slicestar's speed is defined in its animation motion. By default it moves at 45 degree angles,t he same speed vertically as horizontally. Disrupting this will make them far, far more unpredictable.

Motion

#Red Platform\Slicestar's speeds
%patch $100B9 [$000CW] #Horizontal speed
%patch $100C8 [$000CW] #Vertical speed

Animation motion

#Horizontal Slicestar
%patch $32708 [$0000W $0000W]

#Diagonal Slicestar
%patch $32726 [$0018W $0018W]

#Slicestar smashed
%patch $32744 [$0000W $0000W]


Sprite Collision

Both Slicestars use the same collision, kill Keen and be destroyed after a number of shots. The strength of both types of Slicestar is different and is set outside the collision code.


Collision values and strength

Keen 5 collision values

#Horizontal
%patch $32710 $1102085ARL #Slicestar

#Diagonal
%patch $3272E $1102085ARL #Slicestar

#Shattered
%patch $3274C $00000000L  #Nothing

Slicestar strength

#Slicestar strength
%patch $11762 [$0014W] #Horizontal
%patch $11806 [$0032W] #Diagonal


Collision code

This is the complete collision code for the Slicestars. It is remarkably simple and a good illustration of a multi-health collision. On the first line it checks for Keen's sprite type and if detected Keen is killed on the second line. The second line also checks for Keen's shot type and if this is detected it first runs the 'turn colliding sprite into a smashed shot' subroutine ($56 $9A $0CCB10B3RL $83 $C4 $02.) to remove the sprite. It then decreases the sprite's health by 1 and if health is 0 ($FF $4D $44 $75 $0D.) runs the death code. The death code simply alters the Slicestar's action to that of the smashed Slicestar.

Keen 5

#Slicestar collision
%patch $1187A $55 $8B $EC $56 $57 $8B $7E $06 $8B $76 $08 $83 $3C [$02] {$75 $09}
              $9A $0AAF1517RL     $5F $5E $5D $CB $83 $3C [$03] {$75 $1B} $56 $9A
              $0CCB10B3RL     $83 $C4 $02 $FF $4D $44 $75 $0D $B8 [$23F8W]  $50
              $57 $9A $090B1242RL     $83 $C4 $04 $5F $5E $5D $CB


Animations

Neither Slicestar animates and both use only one animation frame no matter what they do. The smashed Slicestar uses another frame, and last for $14 ticks before vanishing. The cache holds only two animations.

Keen 5

#Cache
%patch $31A3A $0181W #Slicestar cache start
%patch $31A8E $0182W #Cache end

#u/d/l/r Slicestar
%patch $326FC $0181W $0181W #Slicestar
%patch $32706 $0000W        #Animation speed

#Bouncy Slicestar
%patch $3271A $0181W $0181W #Slicestar
%patch $32724 $0000W        #Animation speed

#Slicestar smashed
%patch $32738 $0182W $0182W #Slicestar smashed
%patch $32742 $0014W        #Animation speed


Sounds

The diagonal Slicestar makes the same noise when it bounces off different things.

Keen 5

%patch $118CA $06 #Slicestar bounce off floor
%patch $118E3 $06 #Slicestar bounce off ceiling
%patch $118FA $06 #Slicestar bounce off right wall
%patch $11913 $06 #Slicestar bounce left wall


Sprite-tile interaction

Both the horizontal and smashed Slicestar use the 'solid' tile collision, staying out of solid tiles. The diagonal Slicestar has its own special tile collision that lets it bounce off tiles.

Keen 5

#Horizontal
%patch $32714 $090B17B5RL

#Diagonal
%patch $32732 $11020897RL

#Smashed
%patch $32750 $090B17B5RL


Diagonal Slicestar interaction code

This is the complete code for the Diagonal Slicestar's unique tile interaction. In short it consists of four checks, for floors, ceilings, right walls and left walls. For each, if it's found the Slicestar's appropriate direction is reversed and sound $06 is played.

Keen 5

#Diagonal Slicestar tile interaction code
%patch $118B7 $55 $8B $EC $56 $8B $76 $06 $83 $7C {$36} [$00] {$74} $13 $C7 $44 $10
              [$FFFFW]  $B8 [$0006W]  $50 $9A $241809EFRL     $83 $C4 $02 $EB $17
              $83 $7C {$3A} [$00] {$74} $11 $C7 $44 $10 [$0001W]  $B8 [$0006W]  $50 $9A
              $241809EFRL     $83 $C4 $02 $83 $7C {$3C} [$00] {$74} $13 $C7 $44 $0E
              [$FFFFW]  $B8 [$0006W]  $50 $9A $241809EFRL     $83 $C4 $02 $EB $17
              $83 $7C {$38} [$00] {$74} $11 $C7 $44 $0E [$0001W]  $B8 [$0006W]  $50 $9A
              $241809EFRL     $83 $C4 $02 $FF $74 $20 $33 $C0 $50 $FF $74 $1E
              $FF $74 $0C $FF $74 $0A $8B $C6 $05 $46 $00 $50 $9A $21F8163ERL
                  $83 $C4 $0C $5E $5D $CB


Action type

Horizontal Slicestars are type 2, the same as the platforms whose behavior they emulate, allowing them to react instantly to platform B blocks. Diagonal Slicestars are type 1, allowing them smooth movement. Smashed Slicestars are type 0.

Keen 5

#Horizontal
%patch $32700 $0002W

#Diagonal
%patch $3271E $0001W

#Smashed
%patch $3273C $0000W


Deprotect and stick to ground

The Slicestars do not use either of these values since they have no interaction with sloped tiles at all.

Keen 5

#Horizontal
%patch $32702 [$0000W $0000W] #Stand

#Diagonal
%patch $32720 [$0000W $0000W] #Stand

#Smashed
%patch $3273E [$0000W $0000W] #Stand


Sprite spawn code

Only incomplete spawn code is available for the Slicestars. Notice that there are three different kinds of Slicestar, vertical, horizontal and bouncy. Notice also that each type has three different subtypes, one for each difficulty. The cache is set in $C7 $06 $C28DW $0001W.

The last blue highlighted value is the sprite action the sprite uses as it proceeds to act in-level. $C7 $47 $02 $xxxxW sets the sprite activity, $C7 $47 $06 $xxxxW sets the clipping, $C7 $07 $xxxxW sets the sprite type, $C7 $20 $xxxxW sets the foreground value. Interestingly $C7 $47 $14 $xxxxW sets the horizontal speed of the Slicestar, something that seems to set the initial speed of all Slicestars in any direction.

$C7 $47 $0E $xxxxW is the horizontal direction the sprite starts moving in, either $0001W (Facing right), $FFFFW (Facing left) or $0000W (Neither, never used.) $C7 $47 $10 $xxxxW is the vertical direction and works similarly. Note that the different directions of Slicestar are controlled by a 'direction list' (The address is given at $07A4W or $117C4.) There are 3 + 1 = 4 different directions possible. Each direction independently sets the horizontal and vertical direction of the sprite then jumps t the end of the spawn code. This explains the large number of direction variables in the code.

Keen 5

#Location of initiation codes
%patch $F4D8 [$243W] #Easy up Slicestar (At $EF93)
%patch $F4DA [$239W] #Normal up Slicestar (At $EF89)
%patch $F4DC [$22FW] #Hard up Slicestar (At $EF7F)

%patch $F4EA [$2BBW] #Easy bouncy Slicestar (At $F00B)
%patch $F4EC [$2B1W] #Normal bouncy Slicestar (At $F001)
%patch $F4EE [$2A7W] #Hard bouncy Slicestar (At $EFF7)

%patch $F4F0 [$2E2W] #Easy right Slicestar (At $F032)
%patch $F4F2 [$2D8W] #Normal right Slicestar (At $F028)
%patch $F4F4 [$2CEW] #Hard right Slicestar (At $F01E)

#Up Slicestar Initiation code
%patch $EF7F $83 $3E [$6F6CW]  {$03 $7D} $03 $E9 $041EW  $83 $3E [$6F6CW]  {$02 $7D}
             $03 $E9 $0414W  $33 $C0 $50 $57 $56 $9A {$1102070DRL}    $83 $C4
             $06 $C7 $06 $C28DW  $0001W  $E9 $03FEW

#Bouncy Slicestar Initiation code
%patch $EFF7 $83 $3E [$6F6CW]  {$03 $7D} $03 $E9 $03A6W  $83 $3E [$6F6CW]  {$02 $7D}
             $03 $E9 $039CW  $57 $56 $9A {$110207ACRL} $83 $C4 $04 $C7 $06
             $C28DW  $0001W  $E9 $0389W

#Right Slicestar Initiation code
%patch $F01E $83 $3E [$6F6CW]  {$03 $7D} $03 $E9 $037FW  $83 $3E [$6F6CW]  {$02 $7D}
             $03 $E9 $0375W  $B8 [$0001W]  $50 $57 $56 $9A {$1102070DRL}    $83
             $C4 $06 $C7 $06 $C28DW  $0001W  $E9 $035EW

#Horizontal\Vertical Slicestar spawning code
%patch $1172D $55 $8B $EC $33 $C0 $50 $9A $06B91DCDRL     $83 $C4 $02 $8B $1E
              $40 $9E $C7 $07 [$000BW]  $C7 $47 $02 [$0001W]  $C7 $47 $20 [$0002W]
              $8B $46 $06 $B1 $08 $D3 $E0 $89 $47 $0A $8B $46 $08 $D3 $E0 $89
              $47 $0C $C7 $47 $44 [$0014W]  $8B $5E $0A $83 $FB [$03] $77 $45 $D1
              $E3 $2E $FF $A7 [$07A4W]  $8B $1E $40 $9E $C7 $47 $0E [$0000W]  $C7
              $47 $10 [$FFFFW]  $EB $2E $8B $1E $40 $9E $C7 $47 $0E [$0001W]  $C7
              $47 $10 [$0000W]  $EB $1E $8B $1E $40 $9E $C7 $47 $0E [$0000W]  $C7
              $47 $10 [$0001W]  $EB $0E $8B $1E $40 $9E $C7 $47 $0E [$FFFFW]  $C7
              $47 $10 [$0000W]  $B8 [$23BCW]  $50 $FF $36 $40 $9E $9A $090B11C4RL
                  $83 $C4 $04 $5D $CB

#Slicestar direction list
%patch $117C4 [$0753W] #Down (At $11773)
%patch $117C6 [$0763W] #Right (At $11783)
%patch $117C8 [$0773W] #Left (At $11793)
%patch $117CA [$0783W] #Up (At $117A3)