Patch:Keen (Keen 1)

From KeenWiki
Jump to navigation Jump to search

This page contains patches relating to Keen as a sprite in Keen 1. That is, such things as the sprites used, the speeds and sounds. It does not cover patches relating to gameplay such as those that make levels scroll or change keys. Those can be found at Patch:Gameplay (Keen 1). It 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.


Behaviors with their own pages

Some behaviors are complex enough to have their own pages. The following pages relate to a single behavior of Keen in Keen Vorticons in general:


Keen's spawn height

Keen spawns 8 pixels lower than where he is placed, because he is not quite two tiles tall. If Keen's sprite height is changed this should also be changed by the same amount.

Keen 1

#Keen's spawn height
%patch $16E3 [$0800W] #Eight pixels down


Lose level a certain time after Keen dies

This patch exits and loses the level a certain time after Keen is killed. The time is defined by the first line in the patch. As a side effect Keen doesn't go whizzing off the screen.

Dead Keen's loses level after dying

#Level is lost $xxxxW after Keen dies
%patch $4206 [$00C8W]
%patch $420A $C7 $06 $20 $82 $0000W


Speed and Jump Height

The speeds of Keen are complex and poorly understood, since he has the most complex movement in the game, being able to move a single pixel at a time sometimes. However some basic speed patches have been discovered. There are some interesting notes relating to his speeds. Note that many speeds may be found on other pages for individual Keen behaviors, such as shooting.

Exiting: The speed here only affects how long it takes Keen to exit, since what controls the exit time is distance, not speed (Keen must move two tiles by default.)

In level

#Exiting
%patch $410D [$003CW] #How fast Keen walks when exiting levels


Sprite Collision

Keen's collision is especially complex since he must react with nearly all sprite types. As such this is not handled in the way most sprites handle it, but instead what Keen does is read off a list, depending on what the colliding sprite's type is. These are locations in the code to go to. The list starts with the value for type 2 and goes to type 15. This allows you to change what certain sprite types do to Keen, even make up your own code for a sprite. (See last section.)

Each pointer points to a different 'collision' for Keen, so there are multiple collisions, each of which can be patched.

Keen 1

#Where sprite pointer list is
%patch $45E0 {$469EW}

#Keen-sprite pointer list
%patch $469E {$45E2W} #Push Keen - Used by Yorps
%patch $46A0 {$4662W} #Kill Keen - Used by Gargs
%patch $46A2 {$4662W} #Kill Keen - Used by Vorticons
%patch $46A4 {$4646W} #Push Keen bot-style
%patch $46A6 {$4646W} #Push Keen bot-style
%patch $46A8 {$4699W} #Nothing
%patch $46AA {$4699W} #Nothing
%patch $46AC {$4699W} #Nothing
%patch $46AE {$4699W} #Nothing - Used by Keen's shot
%patch $46B0 {$4662W} #Kill
%patch $46B2 {$4699W} #Nothing - Used by Icecube Fragments
%patch $46B4 {$4699W} #Nothing - Used by Zap\Zot
%patch $46B6 {$4699W} #Nothing - Used by Zap\Zot
%patch $46B8 {$467AW} #Freeze Keen - Used by Icecubes


Collision with Yorp

The following is how the Yorp (Sprite type 2) stun\push affects Keen. The pointer above leading to it is $45E2W. It is possible using these patches to Make Keen jump when a Yorp hits him (or he stuns a Yorp, using them like trampolines. If the Yorp's behavior isn't set to stunned (See below) but say, search, then Keen can bounce on the still Yorp over and over.)

It is possible to mute the stunned sound, but not the pushed sound, for it affects other sounds too.

Keen 1

#Keen can stomp Yorp if...
%patch $4601 [$0A] $7C   #Less than 10 pixels above it and
%patch $4608 [$08] $76   #Less than 8 pixels either side of it (Else get  pushed)

#How far right of Yorp left side Keen must be to be pushed right:
%patch $4612 [$0020W] $7E #20 pixels or more

#When Keen is bumped by a Yorp he:
%patch $460E [$0000W] #Jumps this high (Not at all)
%patch $4619 [$00F0W] #Is pushed right this much or
%patch $4620 [$FF10W] #Left this much

#When Keen stuns a Yorp he:
%patch $4634 [$0000W] #Jumps this high (Not at all)

#Play this sound
%patch $463C $1F    #Stunned
%patch $4623 $1D    #Pushed

#Don't play stunned sound
%patch $463F $90 $90 $90


Collision with bots

These patches affect the 'bot' collision, pointer $4646W. The bot push is a simpler version of the Yorp push. Although used by bots by default, anything can use it. It is not possible to stop the push sound from playing without affecting other collision sounds, like the Yorp push.

Keen 1

#How far right of Yorp left side Keen must be to be pushed right:
%patch $464D [$0020W] $7E #20 pixels or more

#When Keen is bumped by a Bot he:
%patch $4649 [$0000W] #Jumps this high (Not at all)
%patch $4654 [$00F0W] #Is pushed right this much or
%patch $465B [$FF10W] #Left this much

#Play this sound
%patch $465E $1D


Bots push smoothly

This patch changes the collision above so the bots push Keen smoothly, like the Meep in Keen 3. It is not compatible with the above sound\speed patches, so the sound is defined here. To not play the sound change $EB $41 to $EB $47.

Keen 1

#Smooth bot pushing
%patch $4646 $57 $56 $E8 $EB92W $59 $59 $B8 [$0002W]  $EB $41


Kill Keen collision

This collision is used by any sprites that kill Keen. A special case is sprite type 11, the Tank's shot type, which is also destroyed in the process. (See Patch:Jump conditions.) It is unknown what the code pointed to does. It is possible to remove the kill Keen sound (See below.)

Keen 1

#These sprite types are destroyed
%patch $4664 $0B $75

#Destroyed sprites do:
%patch $466A {$26FEW} #???

#Other sprites:
%patch $467D {$26FEW} #???
%patch $4691 $28    #Play kill Keen sound

#Don't kill Keen (Not destroyed sprites)
%patch $4675 $90 $90 $90


Freeze Keen collision

Keen can ride icecubes

This patch changes the icecubes so that Keen can ride the icecubes. There are two versions; one that plays a sound when Keen touches the cubes and one that is silent. The blue variable is the sound played.

Keen 1

#Keen can ride icecubes - sound on contact
%patch $467A $57 $56 $E8 $E9BDW $59 $59 $B8 [$0002W] $EB $0D

Keen 1

#Keen can ride icecubes - no sound on contact
%patch $467A $57 $56 $E8 $E9BDW $59 $59 $5F $5E $5D $C3


Custom collisions

These collisions do not exist in the game by default.


Ride on sprites

This creates a custom collision that lets Keen ride on a sprite. When the sprite touches him he'll hop on it and ride along with it. To apply it to a sprite simply use the collision list above and give the type a value of $55F1W (This example patches the Yorp.)

Keen 1

#Keen can ride sprites:
%patch $55EF $EB $4A     #Make space
%patch $55F1 $66 $8B $5D $10 $66 $8B $C3 $66 $05 $00 $EE $FF $FF $66 $89 $44
             $08 $66 $8B $C3 $66 $05 $00 $EF $FF $FF $66 $89 $44 $10 $66 $8B
             $C3 $66 $05 $00 $0B $00 $00 $66 $89 $44 $10 $66 $31 $C0 $66 $31
             $DB $89 $44 $1E $90 $90 $90 $89 $44 $22 $8B $45 $20 $89 $44 $20
%patch $5631 $E9 $F065W

#Here make this what the Yorp does:
%patch $469E {$55F1W} #Type 2 use custom collision


Animations

Some animations of Keens don't need to be specified, since they're animation 0. Sadly these can't easily be patched. Keen does not seem to have a starting animation specified for example. In other cases the number of animation frames used seems to be defined in some manner different to other sprites. Keen's exiting sprite cannot be redefined as it is sprite 0.

In level

#Standing
%patch $39D4 [$0000W] #Keen facing right
%patch $39DC [$0004W] #Keen facing left

#Walking
%patch $39EB [$0000W] #Walking right
%patch $39FA $03    #And next 3 frames
%patch $39F6 $04    #Animation speed

%patch $3A0E [$0008W] #Walking left
%patch $3A1D $03    #And next 3 frames
%patch $3A19 $04    #Animation speed

#Falling
%patch $3D2A [$000DW] #Falling right
%patch $3D32 [$0013W] #Falling left

#Jumping
%patch $3905 [$0008W] #Jumping right start
%patch $390D [$000EW] #Jumping left start
%patch $3ADA [$0008W] #Jumping right
%patch $3AE2 [$000EW] #Jumping left
%patch $3B92 [$0006W] #Animation speed

#Exiting (Uses sprite 0)
%patch $411C $03    #And next 3 frames
%patch $4118 $04    #Animation speed


Sounds

These are the sounds the sprite uses. Since almost all of the sounds in the game can be said to be made by or related to Keen, only the sounds the player sprite makes are listed here. Others should be found on their own patch pages such as Patch:Doors (Vorticons) for the door opening sound. Some sounds are missing here.

Keen 1

%patch $3A54 $1E #Keen walking 1
%patch $3A59 $04 #Keen walking 2
%patch $3A88 $05 #Keen blocked by wall
%patch $3AA5 $1B #Keen plummets off edges
%patch $3D60 $05 #Keen jumping blocked by wall
%patch $3D75 $02 #Keen lands
%patch $3D87 $15 #Keen jumping bump head
%patch $474A $25 #Keen's shot hits wall and Keen
%patch $47BB $25 #Keen's shot hits wall and Keen
%patch $485F $25 #Keen's shots hit sprites
%patch $AC65 $01 #Keen walking on map

#Don't make sounds:
%patch $3A5C $90 $90 $90 #Keen walking
%patch $3A8B $90 $90 $90 #Keen blocked by wall
%patch $3AA8 $90 $90 $90 #Keen plummets off edges
%patch $3D63 $90 $90 $90 #Keen jumping blocked by wall
%patch $3D78 $90 $90 $90 #Keen lands
%patch $3D8A $90 $90 $90 #Keen jumping bump head
%patch $474D $90 $90 $90 #Keen's shot hits wall and Keen
%patch $47BE $90 $90 $90 #Keen's shot hits wall and Keen
%patch $4862 $90 $90 $90 #Keen's shots hit sprites
%patch $AC68 $90 $90 $90 #Keen walking on map


How closely the screen follows Keen

The screen follows the player by moving when the player is a certain distance from the screen boundary. That is, these patches control how close to the edge of the screen the player can get when not at a level edge. The values are in 256ths of a pixel, which is astonishingly precise. (It is best to round values to the nearest pixels, though all default values are rounded to the nearest tile.) Thus the player must be $3000 or $30 pixels (48 pixels, = 3 tiles) from the top of the screen before the screen moves up.

Keen 1

#How closely the screen follows Keen
%patch $3472 $B000W #Scroll Right lag
%patch $34C0 $9000W #Scroll Left lag
%patch $350C $7000W #Scroll Down lag
%patch $355A $3000W #Scroll Up lag