Patch:Sitting Platform (Keen 5)

From KeenWiki
Jump to navigation Jump to search

Platforms in Keen 5 are sprites that Keen can stand on and sometimes be carried places on. This page lists patches relating to a specific Platform sprite, the Sitting Platform. The page is divided into sections relating to the various sprite properties the patches involved. Being fluent with various sprite patch pages will help when working with these patches.

Patches relating to other Keen 5 platforms can be found at Patch:Platform (Keen 5). Patches relating to the sitting platform in other Keen games can be found at Patch:Sitting Platform (Keen 6).


Sprite Type

Sitting Platforms use type 6, one of the types that lets Keen stand on a sprite. Changing this may make it impossible for Keen to stand on the platforms. The Sitting Platform uses the same value as other platforms.

Keen 5

#Sitting Platform sprite type
%patch $10620 $06


Sprite Actions

The Sitting Platform's actions are quite simple; it only has one. It is spawned using this action and continues to use it indefinitely.

Actions:
$1C12W #Sitting Red Platform

Keen 5

#Spawn
%patch $10651 {$1C12W}

#Sitting Platform
%patch $31F6E {$1C12W}


Sprite Behavior

The Sitting Platform has no behavior at all and does not need one by default.

Keen 5 Platform behaviors

#Sitting Platform
%patch $31F62 $00000000L  #Nothing


Speed

The Sitting Platform has no speed as it does not move.

Animation motion

#Sitting Platform
%patch $31F5E [$0000W $0000W]


Sprite Collision

Sitting Platforms have no sprite collision.


Collision values

Platforms have no collision at all. They do not interact with any sprites. (Keen being able to stand on them is part of his collision, not the platform's.) Giving the platform a collision can make them more interesting. (Destructible for instance.)

Keen 5 collision values

#Sitting Platform
%patch $31F66 $00000000L  #Nothing


Animations

The Sitting Platform uses only one animation by default for its frame. 'It's' cache is not however used only by itself; instead it is used by all red platforms. This means that changing it will affect the other red platforms and cause either memory issues or an uncached sprite error. This makes editing the Sitting Platform's animation difficult.

Interestingly the Sitting Platform's animation speed is unusually long. There is no real need for this, but possibly it prevents excessive use of game resources by preventing the Platform from changing actions too often.

Keen 5

#Cache
%patch $31A4A {$01BEW} #Red platforms cache start
%patch $31A9E {$01BEW} #Cache end

#Sitting Platform
%patch $31F52 $01BEW $01BEW #Red plat
%patch $31F5C $7D00W        #Animation speed


Sitting Platform Activity

The Sitting Platform's activity does not really matter as it never has to move offscreen and then back. As such it is set to 1.

Keen 5

#Horizontal-Vertical Platform activity variable
%patch $10625 $0001W


Clipping and foreground

The Sitting Platforms have a foreground variable of 0, meaning they appear behind all sprites and foreground tiles. The clipping cannot be patched by default; having no clipping allowing them to fall through solid tiles.

Keen 5

#Sitting Platform foreground variable
%patch $1062A $0000W


Sprite-tile interaction

The Sitting Platform does not interact with tiles at all, it can pass right through them. Its tile interaction is simply to ensure it stays visible.

Keen 5

#Sitting Platform
%patch $31F6A $090B17B5RL


Action type

As it does not need to move the Sitting Platform's action is type 0.

Keen 5

#Sitting Platform
%patch $31F56 [$0000W]


Deprotect and stick to ground

The Sitting Platform needs neither of these variables and so both are set to 0.

Keen 5

#Sitting Platform
%patch $31EFE [$0000W $0000W]


Sprite spawn code

There are three initiation codes for the Sitting Platform, one for each difficulty. Note however that less Sitting Platforms appear on each difficulty instead of more. This makes things more complicated since the way the code was compiled means this takes three' different initiation codes instead of one. The cache is set in $C7 $06 $C29DW $0001W All three initiation codes refer to the same spawn code.

The spawning code is more complex. In the spawning code the last blue highlighted value is the sprite action the Platform uses as it proceeds to act in-level. $C7 $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 $02 $xxxxW sets the sprite activity, $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. The Sitting Platform always starts the level moving down but with no horizontal direction.

The spawn code contains and is thus incompatible with a number of patches elsewhere on this page.

Keen 5 spawn code

#Location of initiation codes
%patch $F506 [$36AW] #Easy still Platform (At $F0BA)
%patch $F508 [$34DW] #Normal Still Platform (At $F09D)
%patch $F50A [$33AW] #Hard still Platform (At $F08A)

#Sitting Platform initiation -hard
%patch $F08A $57 $56 $9A {$0F920CECRL}    $83 $C4 $04 $C7 $06 $C29DW  $0001W  $E9 $030AW

#Sitting Platform initiation - normal
%patch $F09D $83 $3E [$6F6CW]  {$02 $7E} $03 $E9 $0300W  $57 $56 $9A {$0F920CECRL}
                 $83 $C4 $04 $C7 $06 $C29DW  $0001W  $E9 $02EDW

#Sitting Platform initiation - easy
%patch $F0BA $83 $3E [$6F6CW]  {$01 $7E} $03 $E9 $02E3W  $57 $56 $9A {$0F920CECRL}
                 $83 $C4 $04 $C7 $06 $C29DW  $0001W  $E9 $02D0W

#Sitting platform spawn code
%patch $1060C $55 $8B $EC $33 $C0 $50 $9A $06B91DCDRL     $83 $C4 $02 $8B $1E
              $40 $9E $C7 $07 [$0006W]  $C7 $47 $02 [$0001W]  $C7 $47 $20 [$0000W]
              $8B $46 $06 $B1 $08 $D3 $E0 $89 $47 $0A $8B $46 $08 $D3 $E0 $89
              $47 $3E $89 $47 $0C $C7 $47 $0E [$0000W]  $C7 $47 $10 [$0001W]  $C7
              $47 $06 [$0000W] $B8 [$1C12W]  $50 $53 $9A $090B11C4RL      $83 $C4
              $04 $5D $CB