Patch:Sitting Platform (Keen 6)

From KeenWiki
Jump to navigation Jump to search

Platforms in Keen 6 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 6 platforms can be found at Patch:Platform (Keen 6). Patches relating to the sitting platform in other Keen games can be found at Patch:Sitting Platform (Keen 5).


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 6

#Sitting Platform sprite type
%patch $104BA $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:
$1E50W #Sitting Red Platform

Keen 6

#Spawn
%patch $104EB {$1E50W}

#Sitting Platform
%patch $$32B9C {$1E50W}


Sprite Behavior

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

Keen 6 Platform behaviors

#Sitting Platform
%patch $32B90 $00000000L  #Nothing


Speed

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

Animation motion

#Sitting Platform
%patch $32B8C [$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 6 collision values

#Sitting Platform
%patch $32B94 $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 Platforms. This means that changing it will affect the other 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 6

#Cache
%patch $32436 {$01A8W} #Platforms cache start
%patch $32486 {$01B0W} #Cache end

#Sitting Platform
%patch $32B80 $01A8W $01A8W
%patch $32B8A $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 6

#Horizontal-Vertical Platform activity variable
%patch $104BF $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 6

#Sitting Platform foreground variable
%patch $104C4 $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 6

#Sitting Platform
%patch $32B94 $08F4180ARL


Action type

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

Keen 6

#Sitting Platform
%patch $32B84 [$0000W]


Deprotect and stick to ground

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

Keen 6

#Sitting Platform
%patch $32B86 [$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 $CD23W $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 6 spawn code

#Location of initiation codes
%patch $E992 [$0211W] #Only-Easy sitting Platform (At $E631)
%patch $E994 [$01F4W] #Easy\Medium sitting Platform (At $E614)
%patch $E996 [$01E1W] #Easy\Medium\Hard sitting Platform (At $E601)

#Easy\Medium\Hard Platform initiation code
%patch $E601 $57 $56 $9A {$0EFC14E6RL}     $83 $C4 $04 $C7 $06 CD23W  $0001W 
             $E9 $02B3W

#Easy\Medium Platform initiation code
%patch $E614 $83 $3E {$75A8W}  [$02] {$7E} $03 $E9 $02A9W  $57 $56 $9A {$0EFC14E6RL}
                 $83 $C4 $04 $C7 $06 $CD23W  $0001W  $E9 $0296W 

#Only-Easy Platform initiation code
%patch $E631 $83 $3E {$75A8W}  [$01] {$7E} $03 $E9 $028CW  $57 $56 $9A {$0EFC14E6RL}
                 $83 $C4 $04 $C7 $06 $CD23W  $0001W  $E9 $0279W

#Sitting Platforms spawn code
%patch $104A6 $55 $8B $EC $33 $C0 $50 $9A $069A1E25RL    $83 $C4 $02 $8B $1E
              $66 $A9 $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 [$1E50W]  $50 $53 $9A $08F41219RL    $83 $C4
              $04 $5D $CB