Patch:Dropping 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 Dropping or Falling 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 Dropping Platform in other Keen games can be found at Patch:Dropping Platform (Keen 4) and Patch:Dropping Platform (Keen 6).

Sprite Type

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

Keen 5

#Dropping Platform sprite type
%patch $104FC $06

Sprite Actions

The Dropping Platform's actions are quite simple. The Dropping Platform is spawned sitting. This action waits until Keen disturbs it by standing on it too long. When this happens it goes to the falling action.

When falling the Dropping Platform waits to hit a [B] sprite, then it stops moving. If at any time Keen jumps off the Dropping Platform it will go to its rising action. The rising action will go to the sitting action when the Dropping Platform is back in its original location.

There are two oddities to be noted here. Firstly it appears as if the rising Dropping Platform's action should go to the Sitting Platform's action, however this appears to be a programming mistake and the action actually has no impact on the game at all by default. The second thing to note is that if Keen lands on a rising Dropping Platform it will return to falling.

$1BB8W #Drop/rise Red Platform sit
$1BD6W #Drop/rise Red Platform fall
$1BF4W #Drop/rise Red Platform rise

Keen 5

#Spawn Dropping Platform
%patch $1052D {$1BB8W}

#Dropping Platform sit - waits for Keen
%patch $31F14 {$0000W}

#Keen stands too long on sitting Dropping Platform
%patch $10569 {$1BD6W}

#Keen falls onto a rising Dropping Platform
%patch $105EE {$1BD6W}

#Dropping Dropping Platform is allowed to rise
%patch $105D1 {$1BF4W}

#Dropping Platform fall - waits for Keen
%patch $31F32 {$0000W}

#Rising Platform reaches its original location
%patch $10607 {$1BF4W}

#Dropping Platform rising - Not used
%patch $31F50 {$1C12W}

Sprite Behavior

The Dropping Platform has three behaviors, one for each of its actions. They are quite self-explanatory.

$0F920C1BRL #Platform sit
$0F920C4ERL #Platform fall
$0F920CB9RL #Platform rise

Keen 5 Platform behaviors

#Platform sit
%patch $31F08 $0F920C1BRL

#Platform fall
%patch $31F26 $0F920C4ERL

#Platform rise
%patch $31F44 $0F920CB9RL


The only patchable speeds currently are animation motion. The only relevant speed of that kind is that which controls how fast the rising Platform rises.

Animation motion

#Platform sit
%patch $31F04 [$0000W $0000W]

#Platform fall
%patch $31F22 [$0000W $0000W]

#Platform rise
%patch $31F40 [$0000W $FFE0W]

Sprite Collision

Platforms have no sprite collision. They do not interact with any sprites.

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

#Platform sit
%patch $31F0C $00000000L

#Platform fall
%patch $31F2A $00000000L

#Platform rise
%patch $31F48 $00000000L


The Dropping Platform uses only one animation by default for all of its frames. '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 Dropping Platform's animations difficult.

Keen 5

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

#Platform sit
%patch $31EF8 $01BEW $01BEW
%patch $31F02 $0000W        #Wait

#Platform fall
%patch $31F16 $01BEW $01BEW
%patch $31F20 $0000W        #Wait

#Platform rise
%patch $31F34 $01BEW $01BE
%patch $31F3E $0000W        #Wait

Dropping Platform Activity

The Dropping Platform must be active when offscreen, so it specifically has its activity variable set to 2. If it is any other value the Platform will stop moving when Keen cannot see it, meaning that they are much, much harder to use. (If for example Keen drops a Platform offscreen it will not come back up until he goes down after it.)

Keen 5

#Horizontal-Vertical Platform activity variable
%patch $10501 $0002W

Clipping and foreground

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

Keen 5

#Foreground variable
%patch $10506 $0000W

Keen 5

#Clipping variable
%patch $1052A $0000W

Sprite-tile interaction

The Dropping 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

#Platform sit
%patch $31F10 $090B17B5RL

#Platform fall
%patch $31F2E $090B17B5RL

#Platform rise
%patch $31F4C $090B17B5RL

Action type

The Dropping Platform must be instantly responsive, so it uses type 2 for its actions. The exception is the rising action which must also move smoothly upwards. This thus uses type 4. As a side effect of this all of the Platform's next actions are defined in its code.

Keen 5

#Platform sit
%patch $31EFC [$0002W]

#Platform fall
%patch $31F1A [$0002W]

#Platform rise
%patch $31F38 [$0004W]

Deprotect and stick to ground

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

Keen 5

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

#Platform fall
%patch $31F1C [$0000W $0000W]

#Platform rise
%patch $31F3A [$0000W $0000W]

Sprite spawn code

There is one initiation code for the Dropping Platform. The cache is set in $C7 $06 $C29DW $0001W

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 Dropping Platform always starts the level moving down but with no horizontal direction. (As expected.)

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

Keen 5 spawn code

#Location of initiation code
%patch $F504 [$327W] #Dropping Platform (At $F077)

#Dropping Platform initiation code
%patch $F077 $57 $56 $9A {$0F920BC8RL}    $83 $C4 $04 $C7 $06 $C29DW  $0001W  $E9 $031DW

#Dropping Platform spawn code
%patch $104E8 $55 $8B $EC $33 $C0 $50 $9A $06B91DCDRL     $83 $C4 $02 $8B $1E
              $40 $9E $C7 $07 [$0006W]  $C7 $47 $02 [$0002W]  $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 {$1BB8W}  $50 $53 $9A $090B11C4RL     $83 $C4
              $04 $5D $CB