Patch:Goplat (Keen 6)

From KeenWiki
Jump to: navigation, 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 Goplat or path following 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.

The Goplats are 'path following' platforms; they move in loops and paths. Platforms that move back and forth are Horizontal-Vertical Platforms.

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:Goplat (Keen 5).

Sprite Type

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

Patch: Keen 6
#Goplat sprite type
%patch $10515 $06

Sprite Actions

The Goplat has one single action and is spawned using it and does nothing else, making its actions quite simple.

$1E6EW #Goplat

Patch: Keen 6
#Spawn Goplats:
%patch $10541 $1C4EW
%patch $32BBA $0000W

Sprite Behavior

The Goplat type has its own unique behavior. This is what makes it follow Goplat paths.

$0EFC15BFRL #Goplat

Patch: Keen 6 Goplat behavior
%patch $32BAE $0EFC15BFRL


The Goplat's speeds are controlled by their behavior code and cannot yet be patched. Their animation motion is not used.

Patch: Animation motion
%patch $32BAA $0000W $0000W

Sprite Collision

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

Collision values

Goplats 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 Goplat's.) Giving the Goplat a collision can make them more interesting. (Destructible for instance.)

Patch: Keen 6 collision values
%patch $32BB2 $00000000L


The Goplats use a single animation with a differing set of 'accessory animations' depending on Platform direction. 'Their' caches are not however used only by them; instead it is used by all Platforms. This means that changing them will affect the other Platforms and cause either memory issues or an uncached sprite error. This makes editing the Goplat's animations difficult.

Interestingly the Goplat sets two caches, one of which doesn't cache any animations used by the platforms (and is therefore irrelevant.) It in fact caches the 'squished Bip'

Patch: Keen 6
%patch $32436 $01A8W
#Platform cache start
%patch $32486 $01B0W
#Platform cache end
%patch $32446 $01A7W
#Squished Bip cache start
%patch $32496 $01A7W
#Squished Bip cache end
%patch $32B9E $01A8W $01A8W %patch $32BA8 $0000W
#First Goplat accessory animation (All others based on this)
%patch $10742 $01ABW

Accessory animation location

This patch allows control over where the accessory animations appear relative to the top left of the Goplat's main animation. These values are positive (below, right) but can also be negative.

Patch: Keen 6
#Goplat accessory animation location
%patch $10749 $0100W
%patch $10750 $0100W

Don't draw accessory animations

This patch removes the accessory animations from the Goplat, leaving it a bare platform.

Patch: Keen 6
#Don't draw Goplat Bips in Keen 6
%patch $10738 $5E $5D $CB

Sitting Platform Activity

The Sitting Platform's activity is quite important, it must remain active when offscreen and so has its activity value set to 2. If this is otherwise then the Goplats can stop moving offscreen until Keen finds them, this can result in Keen get trapped when a Goplat leaves.

Patch: Keen 6
#Horizontal-Vertical Platform activity variable
%patch $1051A $0002W

Clipping and foreground

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

Patch: Keen 6
#Goplat foreground variable
%patch $1051F $0000W

Patch: Keen 6
#Goplat clipping variable
%patch $1053E $0000W

Sprite-tile interaction

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

Patch: Keen 6
%patch $32BB6 $0EFC1754RL

Action type

Goplats need to be instantly responsive. As such it uses type 2 for its action.

Patch: Keen 6
%patch $32BA2 $0002W

Deprotect and stick to ground

The Goplats needs neither of these variables and so both are set to 0 in all of their actions.

Patch: Keen 6
%patch $32BA4 $0000W $0000W

Sprite spawn code

Goplats have four types of initiation pointer. In each case all four pointers use the same initiation code. Notice that there are two different caches set, the first is the general Platform cache, the second actually has no function. The cache is set in $C7 $06 $C2x3W $0001W. The Platform guide sprites have no initiation code, they are merely special cases of 'do nothing' sprites.

The initiation codes are where the platforms' directions are set. Notice that both Red and Purple platform initiation codes use the same spawning code. They do however send a different value to it (o and 1 respectively) that let's the game change their initial action.

The spawning code is more complex. In the spawning code the third-to-last blue highlighted value is the sprite action the Goplat 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.) $C7 $47 $0E $xxxxW is the horizontal direction. All Goplats start the level moving downwards, but this is modified somehow.

Depending on their initial spawn value the Goplats will leave a certain sprite behind where they were initially spawned so there is no 'gap' in the guide loop they occupy. The start of this sprite placement is sprite $005B (Upwards guide arrow.)

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

Patch: Keen 6 sprite spawning
%patch $E998 $022EW 
#Path Platform up (At $E64E)
%patch $E99A $022EW
#Path Platform right (At $E64E)
%patch $E99C $022EW
#Path Platform down (At $E64E)
%patch $E99E $022EW
#Path Platform left (At $E64E)
%patch $EA06 $04A7W
#Platform path up (At $E8C7)
%patch $EA08 $04A7W
#Platform path right (At $E8C7)
%patch $EA0A $04A7W
#Platform path down (At $E8C7)
%patch $EA0C $04A7W
#Platform path left (At $E8C7)
%patch $EA0E $04A7W
#Platform path up-right (At $E8C7)
%patch $EA10 $04A7W
#Platform path down-right (At $E8C7)
%patch $EA12 $04A7W
#Platform path down-left (At $E8C7)
%patch $EA14 $04A7W
#Platform path down-right (At $E8C7)
#Path Following Platform initiation code
%patch $E64E $8B $46 $FA $05 $FFDCW $50 $57 $56 $9A $0EFC1539RL $83 $C4 $06 $C7 $06 $CD23W $0001W $C7 $06 $CD33W $0001W $E9 $0259W
#Path Following Platform spawn code
%patch $104F9 $55 $8B $EC $56 $57 $8B $76 $06 $8B $7E $08 $33 $C0 $50 $9A $069A1E25RL $83 $C4 $02 $8B $1E $66 $A9 $C7 $07 $0006W $C7 $47 $02 $0002W $C7 $47 $20 $0000W $8B $C6 $B1 $08 $D3 $E0 $89 $47 $0A $8B $C7 $D3 $E0 $89 $47 $0C $C7 $47 $0E $0000W $C7 $47 $10 $0001W $C7 $47 $06 $0000W $B8 $1E6EW $50 $53 $9A $08F41219RL $83 $C4 $04 $8B $46 $0A $05 $005BW $8B $DF $D1 $E3 $8B $9F $8B $CA $D1 $EB $D1 $E3 $8E $06 $79 $A9 $8B $D6 $D1 $E2 $03 $DA $26 $89 $07 $8B $1E $66 $A9 $8B $46 $0A $89 $47 $3E $C7 $47 $40 $0100W $5F $5E $5D $CB