Patch:Volte-face
Volte-faces are enemies found in Keen 5. They are dangerous, electric creatures that move in preset routes through air, often with great speed. Volte-faces have large pair of eyes. They can be stunned only temporarily.
Sprite Type
Volte-faces use sprite type 16 which is used only by the Volte-face and doesn't affect anything else.
Keen 5
#Volte-face sprite type
%patch $10AF0 $10
Sprite Actions
Volte-faces are quite simple. They are spawned moving, a four frame loop that they remain in unless Keen shoots and stuns them. When stunned a Volte-face will quickly recover, returning to moving again.
Actions: $1CCCW #Volte-face 1 $1CEAW #Volte-face 2 $1D08W #Volte-face 3 $1D26W #Volte-face 4 $1D44W #Volte-face stunned
Keen 5
#When spawned
%patch $10B13 [$1CCCW]
#Moving cycle
%patch $32028 [$1CEAW]
%patch $32046 [$1D08W]
%patch $32064 [$1D26W]
%patch $32082 [$1CCCW]
#When shot
%patch $10DE0 [$1D44W]
#While stunned
%patch $320A0 [$1CCCW]
Sprite Behavior
The Volte-faces have only one behavior, that of moving. Unsurprisingly it is used when the Volte-face is moving, but not when it is stunned.
Behaviors: $0F92127ERL #Volte-face moving
Keen 5
#Moving
%patch $3201C $0F92127ERL #Volte-face moving
%patch $3203A $0F92127ERL #Volte-face moving
%patch $32058 $0F92127ERL #Volte-face moving
%patch $32076 $0F92127ERL #Volte-face moving
#Stunned
%patch $32094 $00000000L #Nothing
Volte-face behavior code
This is the complete behavior for the Volte-face's movement. It is currently unknown how it functions.
Keen 5
#Volte-face movement behavior code
%patch $10B9E $55 $8B $EC $83 $EC $48 $56 $57 $8B $76 $06 $83 $3E $B785W [$00]
{$74} $03 $E9 $0204W $83 $3E $BF83W [$00] {$74} $03 $E9 $01FAW $A1
$B4 $9B $B1 $05 $D3 $E0 $89 $46 $FE $8B $44 $40 $3B $46 $FE $76
$73 $2B $46 $FE $89 $44 $40 $8B $5C $3E $D1 $E3 $8B $BF $26 $19
$83 $FF [$01] {$75} $0B $A1 $B785W $03 $46 $FE $A3 $B785W $EB $14
$83 $FF [$FF] {$75} $0F $8B $46 $FE $F7 $D8 $8B $16 $B785W $03 $D0
$89 $16 $B785W $8B $5C $3E $D1 $E3 $8B $BF $36 $19 $83 $FF [$01]
{$75} $0F $A1 $BF83W $03 $46 $FE $A3 $BF83W $5F $5E $8B $E5 $5D
$CB
$83 $FF [$FF] {$74} $03 $E9 $0190W $8B $46 $FE $F7 $D8 $8B $16
$BF83W $03 $D0 $89 $16 $BF83W $5F $5E $8B $E5 $5D $CB $5F $5E
$8B $E5 $5D $CB
$8B $5C $3E $D1 $E3 $8B $BF $26 $19 $83 $FF [$01]
{$75} $09 $8B $44 $40 $01 $06 $B785W $EB $0E $83 $FF $FF $75 $09
$8B $44 $40 $F7 $D8 $01 $06 $B785W $8B $5C $3E $D1 $E3 $8B $BF
$36 $19 $83 $FF [$01] {$75} $09 $8B $44 $40 $01 $06 $BF83W $EB $0E
$83 $FF [$FF] {$75} $09 $8B $44 $40 $F7 $D8 $01 $06 $BF83W $8B $44
$0A $03 $06 $B785W $B1 $08 $D3 $E8 $4689W $FC $8B $44 $0C $03
$06 $BF83W $D3 $E8 $89 $46 $FA $8B $5E $FA $D1 $E3 $8B $9F $87
$BF $D1 $EB $D1 $E3 $8E $06 $53 $9E $8B $46 $FC $D1 $E0 $03 $D8
$26 $8B $07 $2D [$005BW] $89 $44 $3E $83 $7C $3E [$00] {$7C} $09 $83
$7C $3E [$08] {$7F} $03 $E9 $0080W $16 $8D $46 $B8 [$1E50W] $B8 [$1D62W]
$50 $B9 [$003CW] $9A $000032E5RL $16 $8D $46 $F4 $50 $1E
$B8 [$1D9EW] $50 $B9 [$0005W] $9A $000032E5RL $B8 [$0010W] $50
$8D $46 $F4 $50 $FF $74 $0A $9A $00001C6FRL $83 $C4 $06 $50
$8D $46 $B8 $50 $9A $00002281RL $83 $C4 $04 $B8 [$1EEEW] $50
$8D $46 $B8 $50 $9A $00002281RL $83 $C4 $04 $B8 [$0010W] $50
$8D $46 $F4 $50 $FF $74 $0C $9A $00001C6FRL $83 $C4 $06 $50
$8D $46 $B8 $50 $9A $00002281RL $83 $C4 $04 $8D $46 $B8 $50
$9A $037D022FRL $83 $C4 $02 $8B $44 $40 $29 $46 $FE $B8 [$0100W]
$2B $46 $FE $89 $44 $40 $8B $5C $3E $D1 $E3 $8B $BF $26 $19
$83 $FF [$01] {$75} $0B $A1 $B785W $03 $46 $FE $A3 $B785W $EB $0E
$83 $FF [$FF] {$75} $09 $A1 $B785W $2B $46 $FE $A3 $B785W $8B $5C
$3E $D1 $E3 $8B $BF $36 $19 $83 $FF [$01] {$75} $0F $A1 $BF83W $03
$46 $FE $A3 $BF83W $5F $5E $8B $E5 $5D $CB
$83 $FF [$FF] {$75} $09
$A1 $BF83W $2B $46 $FE $A3 $BF83W $5F $5E $8B $E5 $5D $CB
Volte-face moves like a Slicestar
This patch makes the Volte-face move horizontally\vertically like a Platform or Slicestar. It will have its own independent horizontal\Vertical speeds when doing so however. Using this patch all Volte-faces will spawn moving right.
In this patch the Volte-face has two animation frames that are different depending on its direction. (E.g. Left\right.) Its speeds are $000CW and are marked in blue.
Keen 5
#Initial Volte-face direction: Right
%patch $10B93 $C7 $47 $0E [$0001W]
%patch $10B10 $0001W
#New Volte-face actions, act like a horizontal platform
%patch $3200C $01A1W $01A3W $0003W $0000W $0000W $0006W $0000W $0000W
$0F92127ERL $0F92149DRL $090B17B5RL $1CEAW
%patch $3202A $01A2W $01A4W $0003W $0000W $0000W $0006W $0000W $0000W
$0F92127ERL $0F92149DRL $090B17B5RL $1CCCW
#Stunned Volte-face stuns permanently
%patch $32084 $01A5W $01A5W $0002W $0000W $0000W $0000W $0000W $0000W
$090B1710RL $00000000L $090B195ARL $0000W
#Custom Volte-face speed
%patch $10B9E $55 $8B $EC $83 $EC $04 $56 $57 $8B $7E $06 $83 $3E $85 $BF $00
$75 $1F $83 $3E $83 $BF $00 $75 $18 $8B $45 $0E $BA [$000CW] $F7
$EA $F7 $2E $B4 $9B $A3 $85 $BF $8B $45 $10 $BA [$000CW] $E9
$F721W $5F $5E $8B $E5 $5D $CB
Speed
The Volte-face's motion is defined in its code and cannot yet be patched. Its animation motion is not used.
Animation motion
#Volte-face moving
%patch $32018 [$0000W $0000W]
%patch $32036 [$0000W $0000W]
%patch $32054 [$0000W $0000W]
%patch $32072 [$0000W $0000W]
#Stunned
%patch $32090 [$0000W $0000W]
Sprite Collision
The Volte-face's collision is quite simple, it is deadly to Keen and ca be stunned. However it is not permanently stunned.
Collision values
The Volte-face uses its own special collision when moving, but not when stunned. This makes stunned Volte-faces harmless, but also means that Keen cannot 'reset' a stunned Volte-face by shooting it before it recovers.
Keen 5 collision values
#Moving
%patch $32020 $0F92149DRL #Volte-face
%patch $3203E $0F92149DRL #Volte-face
%patch $3205C $0F92149DRL #Volte-face
%patch $3207A $0F92149DRL #Volte-face
#Stunned
%patch $32098 $00000000L #Nothing
Animations
The Volt-face's animations are quite simple; four are used when moving and one when stunned. The stunned action's animation speed determines how long the Volte-face remains stunned for.
Keen 5
#Cache
%patch $31A42 [$01A1W] #Volte-face cache start
%patch $31A96 [$01A5W] #Cache end
#Volte-face moving
%patch $3200C $01A1W $01A1W
%patch $32016 $0006W #Animation speed
%patch $3202A $01A2W $01A2W
%patch $32034 $0006W #Animation speed
%patch $32048 $01A3W $01A3W
%patch $32052 $0006W #Animation speed
%patch $32066 $01A4W $01A4W
%patch $32070 $0006W #Animation speed
#Volte-face stunned
%patch $32084 $01A5W $01A5W
%patch $3208E $012CW #Recovery time
Clipping and foreground
The Volte-face has a foreground variable of 2, meaning it appears in front of normal fore tiles and most sprites. It has no clipping meaning it can pass through any tiles it wishes to.
Keen 5
#Volte-face foreground variable
%patch $10AFA [$0002W]
#Volte-face clipping variable
%patch $10B10 [$0000W]
Sprite-tile interaction
The Volte-face does not have ts own tile interaction, instead using a generic 'avoid solid tiles' interaction.
Keen 5
#Moving
%patch $32024 $090B17B5RL #Solid
%patch $32042 $090B17B5RL #Solid
%patch $32060 $090B17B5RL #Solid
%patch $3207E $090B17B5RL #Solid
#Stunned
%patch $3209C $090B17B5RL #Solid
Action type
The moving Volte-face uses an action type of 3, allowing it to move smoothly through the air but react instantly. The stunned Volte-face uses type 0, not having to move.
Keen 5
#Moving
%patch $32010 [$0003W]
%patch $3202E [$0003W]
%patch $3204C [$0003W]
%patch $3206A [$0003W]
#Stunned
%patch $32088 [$0000W]
Deprotect and stick to ground
The Volte-face does not use either of these two variables, both being 0 for all its actions.
Keen 5
#Move
%patch $32012 [$0000W $0000W]
%patch $32030 [$0000W $0000W]
%patch $3204E [$0000W $0000W]
%patch $3206C [$0000W $0000W]
#Stunned
%patch $3208A [$0000W $0000W]
Sprite spawn code
There are three difficulties of Volte-face possible. The Volte-face's cache is set in $C7 $06 $C295W $0001W
$1CCCW is the sprite action the Volte-face uses as it proceeds to act in-level. $C7 $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., 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.
$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. Some sprites have a probability check to determine which way they face this is always 50:50 (Though it needn't be.) and the code responsible for this is $9A $1D02002ARL $3D $0080W
Volte-face are notable for having a rather complex end to their spawn code. This sets up their initial movement direction an dis of little consequence for the basic modder. (The highlighted values are the initial directions, 0, 1,2 and 3 and $005BW relates to the sprite set as sprite 0.)
Keen 5
#Location of initiation code
%patch $F552 [$51CW] #Easy Volte-face (At $F26C)
%patch $F554 [$512W] #Normal Volte-face (At $F262)
%patch $F556 [$508W] #Hard Volte-face (At $F258)
#Volte-face Initiation code
%patch $F258 $83 $3E [$6F6CW] {$03 $7D} $03 $E9 $0145W $83 $3E [$6F6CW] {$02 $7D}
$03 $E9 $013BW $57 $56 $9A {$0F9211B4RL} $83 $C4 $04 $C7 $06 $C295W
$0001W $E9 $0128W
#Volte-face spawn code
%patch $10AD4 $55 $8B $EC $83 $EC $04 $56 $57 $8B $7E $06 $33 $C0 $50 $9A $06B91DCDRL
$83 $C4 $02 $8B $1E $40 $9E $C7 $07 [$0010W] $C7 $47
$02 [$0002W] $C7 $47 $20 [$0002W] $8B $C7 $B1 $08 $D3 $E0 $89 $47
$0A $8B $46 $08 $D3 $E0 $89 $47 $0C $C7 $47 $06 [$0000W] $B8 [$1CCCW]
$50 $53 $9A $090B11C4RL $83 $C4 $04 $8B $5E $08 $D1 $E3
$8B $87 $87 $BF $D1 $E8 $E0D1W $8B $16 $53 $9E $8B $DF $D1 $E3
$03 $C3 $89 $56 $FE $89 $46 $FC $C4 $5E $FC $26 $83 $7F $FE $5C
$75 $05 $BE [$0001W] $EB $36 $C4 $5E $FC $26 $83 $7F $02 $5E $75
$05 $BE [$0003W] $EB $27 $A1 $4C $9E $D1 $E0 $C4 $5E $FC $2B $D8
$26 $83 $3F $5D $75 $05 $BE [$0002W] $EB $12 $A1 $4C $9E $D1 $E0
$C4 $5E $FC $03 $D8 $26 $83 $3F $5B $75 $02 $33 $F6 $8B $C6 $05
[$005BW] $C4 $5E $FC $26 $89 $07 $8B $1E $40 $9E $89 $77 $3E $C7
$47 $40 [$0100W] $5F $5E $8B $E5 $5D $CB