Patch:Ending sequence (Keen 2)

From KeenWiki
Jump to: navigation, search

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
%patch $51D3 $0024W
%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
%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
%patch $53A9 $EB $14

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
%patch $5343 $24W
%patch $5347 $11W
%patch $534B $04W
%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
%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.

The Mothership's speed is in pixels and its journey length is identical to that of the BWB. (And again near the maximum length of $7F.)

Patch: Keen 2
#Sprites shown
%patch $5326 $48
#Mothership still
%patch $53AA $48
#Mothership moving
#Ship speed
%patch $539A $0100W
%patch $53A3 $0100W
#Length of ship journey
%patch $53C5 $78

Keen's House sequence

This covers everything from when the FINALE.CK2 image is loaded to the 'to be continued' text box. All of it is shown over the finale image.

Finale and endtext level

Interestingly the level changes after the Vorticon Mothership sequence to level 81, the same level it was already changed to. However this means that a second level can be used when the Game Over\High Score window appears after the endtext.

Patch: Keen 2
#Finale level
%patch $53E4 81

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.

Patch: First textbox
%patch $53F0 $16
%patch $53F4 $1D
#Right side
%patch $53F8 $12
%patch $53FC $04
%patch $5421 $0078W
#Time visible
#Text read from:
%patch $5406 $2B77W %patch $5410 $2B8CW %patch $5418 $2BA0W
%patch $1A2F7 "Wake up, Billy. It" $00 %patch $1A30C "Snowed last night!" $00 %patch $1A320 "There's no school!" $00
#Stop first textbox appearing
%patch $53EF $EB $3B

Patch: Second textbox
%patch $532D $18
%patch $5331 $1D
#Right side
%patch $5335 $10
%patch $5339 $04
%patch $5482 $0078W
#Time visible
#Text read from:
%patch $5443 $2BB3W %patch $544C $2BCDW %patch $5455 $2BE7W %patch $545E $2BFAW %patch $5467 $2C0FW %patch $5470 $2C27W %patch $5479 $2C3DW
%patch $1A333 "Wonderful, Mother. That" $00 %patch $1A34D "will give me time to rid" $00 %patch $1A367 "the Galaxy of the" $00 %patch $1A37A "Vorticon menace and" $00 %patch $1A38F "discover the secret of" $00 %patch $1A3A7 "the mysterious Grand" $00 %patch $1A3BD "Intellect!" $00
#Stop second textbox appearing
%patch $542C $EB $5F
#Stop first AND second textbox appearing
%patch $53EF $E9 $009BW

Patch: Third textbox
%patch $548E $17
%patch $5492 $1D
#Right side
%patch $5496 $10
%patch $549A $04
%patch $54C8 $0078W
#Time visible
#Text read from:
%patch $54A4 $2C49W %patch $54AD $2C5DW %patch $54B6 $2C77W %patch $54BF $2C8FW
%patch $1A3C9 "OK, hon, but you'd" $00 %patch $1A3DD "better have a nourishing" $00 %patch $1A3F7 "vitamin fortified bowl" $00 %patch $1A40F "of Sugar Stoopies first." $00
#Stop third textbox appearing
%patch $548D $EB $44
#Stop first, second AND third textbox appearing
%patch $53EF $E9 $00E1W

Patch: Fourth textbox
%patch $54D4 $14
%patch $54D8 $10
#Right side
%patch $54DC $12
%patch $54E0 $04
%patch $54F3 $0078W
#Time visible
#Text read from:
%patch $54EA $2CA9W
%patch $1A429 "OK, mom..." $00
#Stop fourth textbox appearing
%patch $54D3 $EB $29
#Stop first to fourth textboxes appearing
%patch $53EF $E9 $010CW

Patch: Fifth textbox
%patch $54D4 $05
%patch $54D8 $20
#Right side
%patch $54DC $03
%patch $54E0 $0C
%patch $54F3 $0190W
#Time visible
#Text read from:
%patch $5515 $2CB4W
%patch $1A429 "TO BE CONTINUED...." $00
#Stop fifth textbox appearing
%patch $54FE $EB $26
#Stop ALL textboxes appearing
%patch $53EF $E9 $0134W

End text

This is the final screen, appearing over the Keen's hosue level. It is a text window and covered under Patch:Large text files. When this is exited the game over will appear and Keen can possibly enter his name into the high scores.

The end text window appears with a specific sound (which can be disabled). It stretches across the screen but does have a specific height. By default the endtext window is as high as the screen, blocking the level behind it.

Finally the endtext can be patched as an external file, like in Keen 1.

Patch: Keen 2
%patch $5545 $16 $00
#Window height when still
%patch $5566 $16 $00
#Window height when scrolling
%patch $555A $29
#Endtext window appears sound
%patch $5559 $EB $07
#Endtext window appears sound disabled
#Patch endtext
%patchfile $15844 ENDTEXT.CK2