# Patch:Ending sequence (Keen 2)

An ending sequence is a series of events that occur after the main game is completed. It ends with an entry or view of the high scores and a return to the main menu. Each game has its own unique ending sequence. This page lists patches relating to the ending sequence of Keen 2. This sequence starts after Keen has saved all eight cities.

Patches relating to ending sequences in general can be found at Patch:Ending sequence.

The patches on this page are organized chronologically, that is, those that affect things that happen early on in the ending sequence will appear first. Several patches may also be found on other pages.

# Ending Sequence in general

These patches affect the starting of the ending sequence and the ending sequence in general.

## What is needed to win the game

By default the game is won when 8 cities are saved. The number of cities can be altered. Changing the value to 0 wins the game when any level is exited. Note however that if Keen somehow saves more cities than this value he will never be able to win the game. (This will happen if for example it is set to 0 but Keen saves a city.)

 Patch: Keen 2 #Number of cities needed to win %patch $843E$08

### Win when exiting a specific level or with an item

This patch changes the game winning condition to simply exiting a certain level, x. If the first, brown, game variable is altered this can be changed to winning if Keen has a card or ammo or suchlike. The blue values x is the specific level needed while the second brown Patch:Jump conditions controls the range. (Here just level x)

 Patch: Keen 2 #Win game when exiting level xx %patch $8436$83 $3E$803CW $xx$90 $90$90 $90$75

## Text writing speed

This patch alters how fast text appears in text boxes in the ending sequence. by default one new letter appears every 6 ticks of game time. Thus, making this value larger slows how fast text is written. It is likely a modder would prefer a quicker writing speed, maybe even instantaneous.

 Patch: Keen 2 #Text writing speed %patch $8578$0006W

### All text appears instantly

This patch makes all text appear in text boxes instantly, like the 'What is this green thing in your room' text at Keen's house in Keen 1.

 Patch: Keen 2 #All text appears instantly %patch $8577$EB $07 # Leaving Mothership textbox sequence This is the first part of the ending sequence proper and involves Keen's rocket leaving the Vorticon Mothership and heading towards earth. ## Mothership location and level These patches affect where the Mars Map sequence of text boxes occur. By default a special level is used (level 81), but any other level can be used. The position of events is 0,0 and as such cannot be altered.  Patch: Keen 2 #Level used %patch$5181 81

### Don't change level on ending

This patch makes the textbox appear in the same level Keen won the game in. This is usually quite awkward looking.

 Patch: Keen 1 #Don't change level on ending %patch $5180$EB $07 ## Mothership textbox BWB rocket sprite Keen's BWB rocket appears alongside the textbox and the moves off to Earth. Each of these requires a different sprite. The moving rocket is considered after the first text box patches. The position of the BWB is treated rather uniquely; both x and y position, in tiles are given, however they must be worked out in a very odd way. There are two values for each, the first is a number of tiles *$10, the second a number of tiles that needs to be multiplied by $10. As an example the vertical location of$03 tiles down is $30/$10 + $00 *$10 = $03 +$00. If this is confusing, then just fiddling with the values until a desired result is obtained works.

 Patch: Keen 2 #Sprites shown %patch $51B6$84 #Rocket sprite used as window text appears %patch $52C9$84 #Rocket sprite used for rocket going to and landing on Earth #Sprite position coordinates %patch $51A5$70 #x position (x10) %patch $51AA$00 #x position (Total 0-7 = $07 tiles) %patch$51AF $30 #Y position (x10) %patch$51B4 $00 #Y position (Total 0-3 =$03 tiles)

### Don't show BWB with textbox

This patch stops any sprite appearing on the screen at the same time as the textbox. The ship heading towards Earth will still appear.

 Patch: Keen 2 #Don't show BWB while text window is visible %patch $51A1$EB $28 ## Mothership text box and text These patches relate to the size, position and content of the text box that appears at the start of the Mothership sequence. The size and location of the box are given by four variables, each defining one corner of the text box. The box contains six lines of text. (See Patch:Text patches.) There is a significant pause after the text has finished writing to allow the text to be read.  Patch: Keen 2 #Mothership textbox: %patch$51CF $0018W #Top %patch$51D3 $0024W #Bottom %patch$51D7 $0011W #Right side %patch$51DB $0004W #left side %patch$51E8 $2A21W #First line %patch$51F1 $2A42W #Second line %patch$51FA $2A62W #Third line %patch$5203 $2A80W #Fourth line %patch$520C $2A9FW #Fifth line %patch$5215 $2ABAW #Sixth line #Pause to read box %patch$521E $012CW #Text %patch$1A1A1 "After disabling the weaponry of" $00 %patch$1A1C2 "the Vorticon Mothership, Billy" $00 %patch$1A1E2 "heads for earth. Even great" $00 %patch$1A200 "space heroes need a nap after" $00 %patch$1A21F "defeating a vicious horde" $00 %patch$1A23A "of violence-bent aliens!" $00 # Flight to Earth sequence This part of the sequence deals with Keen's BWB heading from the textbox location to Earth, moving down and right. ## BWB rocket sprite and speed This works similarly to the textbox sprite and in fact starts from the same position as the still BWB.  Patch: Keen 2 #Sprites shown %patch$51B6 $84 #Rocket sprite used as window text appears %patch$52C9 $84 #Rocket sprite used for rocket going to and landing on Earth ### No BWB rocket moving to Earth This patch removes the BWB heading towards Earth, while the screen moves, nothing is shown. Combined with the patch in the section above the BWB can be totally removed from the map level.  Patch: Keen 2 #No BWB rocket moving to Earth %patch$52D8 $90$90 $90 ## BWB speed and movement By default the BWB moves at a rate of approximately 2 tiles right to every tile down. This happens over$78 ticks. There are minor speed adjustments made tot his 2:1 rate, for example the rightwards rate is 2 tiles 8.5 pixels while downwards is 1 tile 3.5 pixels. Fiddling with the 'minor speed adjustments' can help position the BWB very accurately at the end of its journey.

The screen also moves when the BWB is at a certain location. By default this is when the BWB is at or below-right of 9,13 tiles from the top left of the screen. Each position value comes in two parts; the first sets the sign; $0001W is 'below' and$FFFFW is 'above'. (Only the latter really works.) The second part controls the position in pixels. For example $90 is 144 pixels or 9 16-pixel tiles. Finally the length of the rocket's journey is controlled by a single variable. It is very nearly as long as possible by default ($7F is the maximum length of journey allowed.)

 Patch: Keen 2 #How Keen's rocket moves %patch $5253$0078W #How often Keen's rocket moves right %patch $525D$0002W #How much the rocket moves right each time (Tiles) %patch $5261$88 #Minor speed adjustment %patch $527B$0078W #How often Keen's rocket moves down %patch $5285$0001W #How much the rocket moves right each time (Tiles) %patch $5289$38 #Minor speed adjustment #Where screen is relative to BwB (Default $FFFF90 :$FFFFB0) %patch $52A9$90 #H (Left of ship by $70) %patch$52AB $FFFFW %patch$52BD $D0 #H (Above ship by ) %patch$52BF $FFFFW #Journey length %patch$52E4 $78 # Mothership leaving sequence These patches relate to the Vorticon Mothership leaving. This includes moving the screen to a new location in the level, a textbox and a sprite moving. Following this is the 'Keen's house' sequence. ## Mothership sequence location While using the same level as the 'flight to Earth' sequence the screen is relocated. The position of both the screen and the Mothership are controlled by four variables, two each for horizontal (x) and vertical (y) position. (A total of 8 variables.) The first variable controls the position in pixels, the second in 256ths of a pixel. (Making the second variables near useless.)$10 is thus one tile (16 pixels).

Thus the screen's position is $00,$C0 pixels, $0,$C tiles or at 0,12 in the level. The 'maximum' location is thus 15, 15. (Note the position is for the top left of the screen.) The same considerations apply to the Mothership's start location, without the h position adjustment.

 Patch: Keen 2 #Screen location %patch $52FE$00 #x position (Pixels) %patch $5304$00 #x position adjustment %patch $530A$C0 #y position (Pixels) %patch $5310$00 #y position adjustment #Mothership start location) %patch $5315$00 #x position (Pixels) %patch $531A$00 #x position adjustment %patch $531F$C0 #y position (Pixels)

### No Mothership

These patches stop the Mothership appearing when still or moving or both. Both patches are needed to remove the Mothership entirely.

 Patch: Keen 2 #No Mothership: %patch $5325$EB $14 #Still %patch$53A9 $EB$14 #Moving

## Mothership textbox

These patches relate to the size, position and content of the text box that appears at the end of the Mothership sequence. The size and location of the box are given by four variables, each defining one corner of the text box. The box contains five lines of text. (See Patch:Text patches.) There is a significant pause after the text has finished writing to allow the text to be read.

 Patch: Keen 2 #Mothership textbox %patch $533F$18W #Bottom %patch $5343$24W #Right %patch $5347$11W #Top %patch $534B$04W #Left %patch $5385$0078W #Pause to read box (Then Mothership leaves) %patch $5358$2AD3W #First line read from %patch $5361$2AF1W #Second line read from %patch $536A$2B12W #Third line read from %patch $5373$2B30W #Fourth line read from %patch $537C$2B4CW #Fifth line read from #Text %patch $1A253 "The Vorticon ship limps back"$00 %patch $1A271 "toward Vorticon IV to tell of "$00 %patch $1A292 "their defeat at the hands of"$00 %patch $1A2B0 "Commander Keen. The Grand"$00 %patch $1A2CC "Intellect will not be pleased."$00

## Mothership sprite, speed and journey length

This works similarly to the BWB sprites. There are two sprites shown; the first when the textbox is onscreen, still. The second when it is moving offscreen.

## Finale file

This is the file that contains the fullscreen image displayed during this entire sequence. The game calls a line of text, then attempts to open that file. Note that the file extension can be whatever is desired. This is also similar to a text patch.

 Patch: Keen 2 #At Keen's house... %patch $53DB$2B6CW #Finale file name called from %patch $15CB2$1A2EC "finale.ck2" $00 ## Text boxes Text boxes appear during the sequence. Each one needs its four corners defined, where its text is read from, the text itself and the time visible before it is removed. When a textbox is removed it leaves behind a white space. Values for the locations of corners are in 8x8 blocks. A textbox must be wide enough to contain the text in it and its bottom\right values must be larger than its top\left values. The width\height in letters\8x8 blocks is obviously (top\left) - (right\bottom) Text boxes evidently involve Text patches If a value of$2B76W is used for the 'text read from' value will result in no text being displayed for that line. This is useful if you want to reduce all the text in one window into a single line, as occurs in Keen 4-6. (This makes patches easier, since you don't have to alter all the read from values and text patches just to fix one line.)

Finally textboxes can be removed, either individual boxes or several at once.