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


Sprite Type

Dropping 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 Dropping Platform uses the same value as all other platforms.

Keen 6

#Dropping Platform sprite type
%patch $10396 $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.

Something to note is that if Keen lands on a rising Dropping Platform it will return to falling.

Actions:
$1DF6W #Drop/rise Platform sit
$1E14W #Drop/rise Platform fall
$1E32W #Drop/rise Platform rise

Keen 6

#Spawn Dropping Platform
%patch $103C7 {$1DF6W}

#Dropping Platform sit - waits for Keen
%patch $32B42 {$0000W}

#Keen stands too long on sitting Dropping Platform
%patch $10403 {$1E14W}

#Keen falls onto a rising Dropping Platform
%patch $10488 {$1E14W}

#Dropping Dropping Platform is allowed to rise
%patch $1046B {$1E32W}

#Dropping Platform fall - waits for Keen
%patch $32B60 {$0000W}

#Rising Platform reaches its original location
%patch $104A1 {$1DF6W}

#Dropping Platform rising
%patch $32B7E {$0000W}


Sprite Behavior

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

Behaviors:
$0EFC1415RL #Platform sit
$0EFC1448RL #Platform fall
$0EFC14B3RL #Platform rise

Keen 6 Platform behaviors

#Platform sit
%patch $32B36 $0EFC1415RL

#Platform fall
%patch $32B54 $0EFC1448RL

#Platform rise
%patch $32B72 $0EFC141B3L


Speed

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 $32B32 [$0000W $0000W]

#Platform fall
%patch $32B50 [$0000W $0000W]

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

#Platform sit
%patch $32B3A $00000000L

#Platform fall
%patch $32B58 $00000000L

#Platform rise
%patch $32B76 $00000000L


Animations

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 other 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 Dropping Platform's animations difficult.

Keen 6

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

#Platform sit
%patch $32B26 $01A8W $01A8W
%patch $32B30 $0000W        #Wait

#Platform fall
%patch $32B44 $01A8W $01A8W
%patch $32B4E $0000W        #Wait

#Platform rise
%patch $32B62 $01A8W $01A8W
%patch $32B6C $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 6

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

#Foreground variable
%patch $103A0 $0000W

Keen 6

#Clipping variable
%patch $103C4 $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 6

#Platform sit
%patch $32B3E $08F4180ARL

#Platform fall
%patch $32B5C $08F4180ARL

#Platform rise
%patch $32B7A $08F4180ARL


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 6

#Platform sit
%patch $32B2A [$0002W]

#Platform fall
%patch $32B48 [$0002W]

#Platform rise
%patch $32B66 [$0004W]


Deprotect and stick to ground

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

Keen 6

#Platform sit
%patch $32B2C [$0000W $0000W]

#Platform fall
%patch $32B4A [$0000W $0000W]

#Platform rise
%patch $32B68 [$0000W $0000W]


Sprite spawn code

There is one initiation code for the Dropping Platform. The cache is set in $C7 $06 $CD23W $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 6 spawn code

#Location of initiation code
%patch $E990 [$01CEW] #Falling Platform (At $E5EE)

#Dropping Platform initiation code
%patch $E5EE $57 $56 $9A {$0EFC13C2RL}    $83 $C4 $04 $C7 $06 $CD23W  $0001W  $E9 $02C6W

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