Patch:Foot

From KeenWiki
Jump to navigation Jump to search

This page covers patches relating to the Foot in Keen 4. The foot appears in-level and on the map. It is created from inchworms and can also be placed in levels. This page covers two sections, the foot on the map and the foot in-level (as a sprite.)


Foot on map

When Keen exits a level by touching the foot, he will appear on the map as the 'riding the foot' sprite. Depending on what level he just left he will then move to one of two locations.


Disable

This disables the foot entirely so that Keen appears on the map as normal if he wins a level with the foot.

Keen 4

#Totally disable foot
%patch $DE02 $90 $90


What triggers Foot-on-Map Keen

This is what determines whether Map Keen or Keen-on-Foot is created when a level is completed. By default this is level state 7, that is, Keen has exited the previous level via the Foot.

Making the last byte $EB means Keen will always exit on the Foot, making it $90 $90 disables the Foot completely (See above.)

Keen 4

#What triggers Keen-on-Foot sequence
%patch $DDFF {$7A70W}  [$07] {$74}


Foot destinations

What destination is used

Whether or not one destination or another is chosen depends entirely on the player's position on the map. If the player is at or below a certain height in the level then destination 2 is chosen, otherwise destination is. (See Game stats and Patch:Jump conditions.

The default value is whether Keen is $14 tiles or lower (20 tiles or lower in decimal.) This can be changed to all sorts of other values and checks. To make only one destination ever be used simply replace the last byte with $EB

Keen 4

#What picks the Foot destination to use
%patch $DE36 {$7A1AW}  [$1400W] {$73}


Destination depends on what level is done

By default the destination used depends on where Keen is located on the map. However things can be altered so that the destination depends on what level(s) have been done. In this patch, which has the exact same result as the default setup, Keen will use destination 2 if he has completed level 14 (Pyramid Of The Forbidden.)

Keen 4

#What picks the Foot destination to use
%patch $DE36 {$7A3AW}  [$0000W] {$75}


Location of destinations

These are the two Foot destinations, that is, where Keen is dropped off by the Foot. Note that if Keen's start position relative to his end position requires him to move in the opposite direction to default the Foot will fly off the map and kill Keen.

Keen 4

#Foot location 1:
%patch $DE43 $1E #Horizontal location on map in tiles
%patch $DE58 $37 #Vertical location on map in tiles

#Location 2: (When exiting POTF)
%patch $DE78 $10 #Horizontal location on map in tiles
%patch $DE8C $2F #Vertical location on map in tiles


Foot destination is relative

This is a patch that makes the foot take Keen to a relative location, but it may have undesirable side effects. (It is unstable.)

Keen 4

#When foot got, moves Keen 10 tiles right from whatever level entrance
#he was in (Instead of always to the same location)
%patch $DE65 $10


Foot in level

This is the foot as it appears in levels, and how it acts as a sprite. See also Patch:Inchworm


Sprite Type

Foot use type 17 which is used only by them and doesn't affect anything else. This type reacts specifically with Keen to trigger an end to the level and map Foot sequence; if this is changed Foot will no longer interact with Keen.

Keen 4

#Foot sprite type
%patch $10F40 $11


Sprite Actions

The Foot has only one action of its own that simply sits in the level and does nothing. There are other associated actions but these mostly have to do with Inchworms. The only time in the default game a Foot appears by itself is in the Pyramid of the Forbidden, near the end.

Foot can also be produced by bringing 12 Inchworms together. This Foot behaves identically.

Actions:
$2E22W #Foot appearing smoke 1
$2E40W #Foot appearing smoke 2
$2E5EW #Foot appearing smoke 3
$2E7CW #Foot appearing smoke 4
$2E9AW #Inchworm 1
$2EB8W #Inchworm 2
$2ED6W #Invisible Foot (Spawned by Inchworms)
$2EF4W #Foot

Keen 4

#Foot placed in-level
%patch $10F62 {$2EF4W}

#What is produced from Inchworms meeting
%patch $10FDE {$2EF4W}

#What Foot does (No change)
%patch $31D80 [$0000W]


Sprite Behavior

The Foot has no behavior, it does nothing but sit.

Keen 4

#Foot behavior
%patch $31D74 {$00000000L}  #Nothing


Speed and Jump Height

The Foot does not move, nor does it change action which is required for some movements.

Keen 4

#Foot
%patch $31D70 [$0000W] [$0000W]


Sprite Collision

Collision values

The Foot's sprite collision is the simplest in the game; it does nothing at all. Only the visible foot has this collision, it is not known why. (Possibly the foot itself was to activate the foot-on-map sequence but this was later abandoned.)

Keen 4 collision values

#Foot
%patch $31D5A $00000000L  #Invisible Foot
%patch $31D78 $108008D9RL #Foot

#Smoke puffs
%patch $31CA6 $00000000L  #No collision (Top)
%patch $31CC4 $00000000L  #No collision (left)
%patch $31CE2 $00000000L  #No collision (right)
%patch $31D00 $00000000L  #No collision (bottom)


Collision code

The Foot's sprite collision does nothing at all, reacting to no sprite types and calling no code. Any non-Foot type sprite that uses it will not interact with anything.

Keen 4

#Foot sprite collision
%patch $110D9 $55 $8B $EC $8B $46 $06 $8B $56 $08 $05 $4C $00 $83 $C2 $4C $5D
              $CB


Animations

The Foot and Inchworms are inextricably linked, they both share the same cache for example. The Foot produced from Inchworms is temporarily invisible, but quickly reverts to the same Foot as one placed in-level.

The Foot and the Inchworm also independently cache the clouds of smoke used by the Smirky when teleporting, used by the Inchworms when transforming into the Foot. (For the Foot then this is not actually necessary.)

Keen 4

#Cache
%patch $306EC $014DW #Inchworm\Foot Cache start
%patch $30738 $0151W #Inchworm\Foot cache end

#Cache Smirky clouds - Foot
%patch $EAD0 $015EW #Cloud Cache start
%patch $EAE5 $0151W #Cloud cache end

#Foot appears clouds of smoke
%patch $31C92 $015EW $015EW
%patch $31C9C $000CW        #Animation speed
%patch $31CB0 $015FW $015FW
%patch $31CBA $000CW        #Animation speed
%patch $31CCE $0160W $0160W
%patch $31CD8 $000CW        #Animation speed
%patch $31CEC $0161W $0161W
%patch $31CF6 $000CW        #Animation speed

#Foot formed from worms
%patch $31D46 $FFFFW $FFFFW #Erase inchworm sprite
%patch $31D50 $0030W        #Pause before foot appears

#Foot placed in-level
%patch $31D64 $0151W $0151W
%patch $31D6E $7530W        #Animation speed (Don't do anything)


Sounds

The only notable sound relating to Inchworms is that played when 12 Inchworms make a Foot.

Keen 4

#Sound
%patch $10FC9 [$2D] #Foot formed sound

#Don't make sound:
%patch $10FCC $90 $90 $90 $90 $90 #Foot formed


Sprite positioning and landing on the ground

Feet are spawned 5 tiles down from their placed position, because they are so large. This is perhaps the largest sprite positioning value in the series.

The foot smoke refers to the smoke produced when twelve Inchworms combine and is more related to Inchworms.

Keen 4

#Spawn height:
%patch $1053E $0500W #5 tiles down

#Foot smoke
%patch $10FF8 {$0A $2D} [$0080W] #Upper puff h
%patch $11005 {$0C $05} [$0180W] #v
%patch $1102C {$0A $05} [$0100W] #Left puff h
%patch $11039 {$0C $05} [$0180W] #v
%patch $11060 {$0A $05} [$0280W] #Right puff h
%patch $1106D {$0C $05} [$0100W] #v
%patch $1109E {$0C $2D} [$0080W] #Lower puff v (No h value.)


Sprite-tile interaction

None of the Foot's actions need to interact with tiles. As such they use a generic 'sit' tile interaction that simply displays the sprite.

Keen 4 collision values

#Foot
%patch $31D5E $09DC176ERL #Invisible Foot
%patch $31D7C $09DC176ERL #Foot

#Smoke puffs
%patch $31CAA $09DC176ERL
%patch $31CC8 $09DC176ERL
%patch $31CE6 $09DC176ERL
%patch $31D04 $09DC176ERL


Action type

As the Foot needs to respond quickly to Keen is action is type 2.

Sprite action type

#Foot
%patch $31D68 [$0002W]


Deprotect and stick to ground

The Foot has no need for either of these variables and so has a value of 0 for both in its action.

Sprite deprotect, stick

#Foot
%patch $31D6A [$0000W $0000W]


Sprite spawn code

In the initiation code notice the Inchworm cache being set ($C7 $06 $59 $CB $0001W.) Indeed, the Foot's imitation code is almost identical to that of the Inchworm due to how closely related they are. (The cache includes both Foot and Inchworm frames.)

In the spawning code the last blue highlighted value is the sprite action the sprite uses as it proceeds to act in-level. $C7 $02 $xxxxW sets the sprite activity, $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.

Keen 4

#Location of initiation code
%patch $EE97 [$019EW] #Foot (At $EA8E)

#Foot Initiation code
%patch $EA8E $FF $76 $FC $57 $9A {$1080072CRL}     $83 $C4 $04 $C7 $06 $59 $CB
             $0001W  $BE $5E $01 $EB $0F $B8 $3A $2A $8A $16 $EC $7A $8E $C0
             $26 $08 $94 $00 $00 $46 $81 $FE $61 $01 $76 $EB $E9 $0340W

#Foot spawning code
%patch $10F2C $55 $8B $EC $33 $C0 $50 $9A $06BD1E11RL     $83 $C4 $02 $8B $1E
              $D8 $A7 $C7 $07 [$0011W]  $C7 $47 $02 [$0001W]  $C7 $47 $20 [$0000W]
              $8B $46 $06 $B1 $08 $D3 $E0 $89 $47 $0A $8B $46 $08 $05 [$FFFDW]
              $D3 $E0 $89 $47 $0C $B8 [$2EF4W]  $50 $53 $9A $09DC118CRL     $83
              $C4 $04 $5D $CB