Patch:Wetsuit (Sprite)

From KeenWiki
Jump to navigation Jump to search

The Wetsuit is an item in Keen 4 that allows Keen to swim on water on the game map. If Keen does not have the Wetsuit then '???' will appear on his status screen and touching 'water entrance' tiles will cause a message to appear saying he can't swim. Getting the Wetsuit entails a sound playing,t he Wetsuit item being given and a message appearing. With the Wetsuit Keen can swim on map water and has 'Wetsuit' on his status screen.

This page covers the Wetsuit as a sprite in-level. Patches that affect the text window when Keen obtains the suit, or how he behaves on the map with the Wetsuit or what the status window shows can be found at Patch:Wetsuit. (This includes patches that stop the Wetsuit winning the level.)

Sprite Type

The Wetsuit uses sprite type 30, which affects nothing at all. (Getting the Wetsuit item on contact depends on the Wetsuit's sprite collision, see section below.)

Keen 4

#Wetsuit sprite type
%patch $12A05 $1E

Sprite Actions

The Wetsuit's actions could not be more basic; it is spawned using its single action of 'Sit still' and remains doing so forever.

$343AW #Sit

Keen 4

#Wetsuit  placed in-level
%patch $12A22 {$343AW} #Spawn Wetsuit

#Wetsuit sit
%patch $328C0 {$343AW} #The Wetsuit

Sprite Behavior

The Wetsuit has no behavior by default.

Keen 4

#Wetsuit sit
%patch $328B4 {$00000000L}  #Nothing

Speed and Jump Height

The Wetsuit has no animation motion by default, it just sits still. It is also given no direction on spawning, so even if it is given animation motion, it will not move. As it has no behavior it has no behavioral motion either. It is completely still.

Animation motion

#Wetsuit sit
%patch $328B0 $0000W $0000W #Speed

Sprite Collision

The Wetsuit's collision, unlike that of Lindsey or the Council Member, depends on the Wetsuit itself and reacts with Keen to give him the Wetsuit item and exit the level. If this is changed, Keen cannot get the Wetsuit.

Collision values

The Wetsuit uses its unique collision all the time.

Keen 4 collision values

#Wetsuit sit
%patch $328B8 $11A21010RL #Wetsuit

Collision code

This is the complete code for the Wetsuit's sprite collision.


The default Wetsuit collision is quite complex. Firstly it interacts only with Keen (First line) and then checks to see if he is standing on something solid ($00 $74; there is no reason for it to do this.) Once this is confirmed the Wetsuit item is set to 1 (See Patch:Game stats.) and sound $2D is played.

After this the Wetsuit window code is run and the window cleared from the screen. The level state value is then set to 2, causing the level to immediately be won and exited.

Wetsuit sprite collision

#Wetsuit sprite collision
%patch $12A30 $55 $8B $EC $56 $57 $8B $7E $06 $8B $76 $08 $83 $3C [$02] {$75} $2B
              $83 $7C $36 [$00] {$74} $25 $C7 $06 {$7A5CW}  [$0001W]  $B8 [$002DW]  $50
              $9A $187409F1RL     $83 $C4 $02 $9A $0E8F0AE2RL     $9A $16540D59RL
                      $C7 $06 {$7A70W}  [$0002W]  $83 $C7 $4C $5F $5E $5D $CB

Keen can get Wetsuit while pogoing and falling

This removes the 'Is Keen on the ground' check, meaning Keen can get the Wetsuit even while jumping through the air.

Wetsuit sprite collision - don't check if Keen is in the air

#Wetsuit sprite collision - don't check if Keen is in the air
%patch $12A30 $55 $8B $EC $56 $57 $8B $7E $06 $8B $76 $08 $83 $3C [$02] {$75} $25
              $C7 $06 {$7A5CW}  [$0001W]  $B8 [$002DW]  $50 $9A $187409F1RL     $83
              $C4 $02 $9A $0E8F0AE2RL     $9A $16540D59RL     $C7 $06 {$7A70W}
             [$0002W]  $83 $C7 $4C $5F $5E $5D $CB

Wetsuit wins game

This patch creates a new level state that automatically wins the game, then makes the Wetsuit sprite trigger it (instead of winning the level.) Nothing else is changed, the Wetsuit still brings up a window and gives the Wetsuit and Keen can still win the game by rescuing 8 Council Members.

To combine this with the above pogoing\falling patch simply include the first line and change the $0002W in the last line to $000DW.

Keen 4

#State 13 wins game
%patch $6BD9 [$0EB2W]

#Wetsuit sets level state to 13 instead of 2
%patch $12A62 $C7 $06 {$7A70W}  [$000DW]


The Wetsuit is unique in that it has no sprite cache, since it only uses on animation. Instead this one animation is cached when the sprite is spawned. This makes it a lot harder to make the Wetsuit use other animations.

Keen 4

%patch $ECE6 $01AEW #Start AND finish, 1 frame cached

#Sitting Wetsuit
%patch $328A4 $01AEW $01AEW
%patch $328AE $7530W        #Don't animate


The Wetsuit makes a sound when Keen touches it. These patches are incompatible with the complete collision code patches above.

Keen 4

#Wetsuit got sound
%patch $12A4D $2D

#Don't play Wetsuit got sound
%patch $12A4A $EB $0A

Play music when Wetsuit got

This patch causes the music to change when the Wetsuit is got. As a side-effect no sound plays when the Wetsuit is got. The blue value used here is the level who's music is used. (For example a value of 0 will play the map level's music.)

Keen 4

#Change music when Wetsuit got
%patch $12A51 $06BD20C7RL
%patch $12A4D [$0001W]      #Play this level's song

Sprite positioning and landing on the ground

The Wetsuit is spawned one tile up from her placed position, though there is no reason for this as it does not need to touch the ground.

Keen 4

#Spawn height:
%patch $12A1C [$FF00W] #1 tile up

Sprite-tile interaction

The Wetsuit uses the multi-purpose 'sit' tile collision, meaning it ignores all tiles and just sits there.

Keen 4

#Wetsuit sit
%patch $328BC $09DC176ERL

Action type

As the Wetsuit does nothing its action is type 0.

Wetsuit action type

#Wetsuit action type
%patch $322AE [$0000W]

Deprotect and stick to ground

The Wetsuit uses the 'stick to round' variable despite not moving.

Wetsuit deprotect, stick

#Wetsuit deprotect, stick
%patch $322B0 [$0000W $0001W]

Sprite spawn code

In the initiation code notice the Wetsuit cache differs from all other sprites in that only a single frame ($01AEW) is cached, this is the same as used by its animation.

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, while $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 $EEC9 [$03DEW] #Wetsuit (At $ECCE)

#Wetsuit Initiation code - Note single frame is cached
%patch $ECCE $FF $76 $FC $57 $9A {$11A20FD1RL}     $83 $C4 $04 $B8 $2A3ARW $8A
             $16 $EC $7A $8E $C0 $26 $08 $16 [$01AEW]  $E9 $0112W

#Wetsuit spawning code
%patch $129F1 $55 $8B $EC $33 $C0 $50 $9A $06BD1E11RL     $83 $C4 $02 $8B $1E
              $D8 $A7 $C7 $07 [$001EW]  $C7 $47 $02 [$0001W]  $8B $46 $06 $B1 $08
              $D3 $E0 $89 $47 $0A $8B $46 $08 $D3 $E0 $05 [$FF00W]  $89 $47 $0C
              $B8 [$3A34W]  $50 $53 $9A $09DC118CRL     $83 $C4 $04 $5D $CB