Patch:Ending sequence (Keen 4)
The ending sequence in Keen 4 occurs after Keen has saved eight Council Members, the screen goes dark, the ending sequence of text and images plays, followed by the high scores level. The ending sequence is mostly due to a loaded text chunk that allows the game to load images and text in a defined sequence. This chunk is handled completely uniquely, not allowing the player just to scroll through it as fast as they wish, but making them wait until the page is 'ready.'
Two possible ending sequences
This patch allows Keen 4 to have two possible ending sequences depending on how the game is played. The first (default ending) is triggered by saving all 8 Council Members. The second is triggered by completing level 2.
The brown values are the chunk number and memory offset for each ending. When using a different graphics chunk for the ending the memory offset must be changed by twice that amount. Here the chunk is changed by 1 and the offset by 2. (The chunk used is the unused 'Level not available in demo' chunk.)
As a side note, since the variables are not reset here the second ending will always occur after the player accesses it for the first time. A 'reset patch' would be needed to prevent this when a new game is started or loaded. Some code is also located over the Wetsuit collision, making that item unusable with this default patch.
Keen 4
#GAME HAS TWO ENDINGS
#Memory offset and ending document to use (Default values)
%patch $2F474 {$1287W $9FFBW}
#End sequence calls variables
%patch $9CB7 $A1 $0604W
%patch $9D7C $A1 $0606W
#MAKE GAME END AFTER LEVEL X
#Check level 2 is done, if so change variables
%patch $6B4B $A7EDW [$02] $75 $4C $B8 {$9FFDW} $A3 $0606W $B8 {$1288W} $A3 $0604W $EB $94
#Call right memory address call
%patch $9CC3 $9A $11A21010RL $90 $90 $90 $90
#Call the right memory address code
%patch $12A30 $55 $8B $EC $56 $8B $76 $06 $8B $44 $0A $A1 {$9FFBW} $81 $3E $0604W
{$1287W} $74 $03 $A1 {$9FFDW} $89 $46 $FE $A3 $C8B3W $5E $5D $CB
No ending sequence
This patch skips the ending sequence entirely; instead the game simply goes straight to the highscores (Or entering a new score.) when Keen wins.
Keen 4
#No ending sequence, go straight to high scores
%patch $9C7D $CB
EGAGRAPH text chunk
This is the EGAGRAPH chunk used for the ending sequence. Everything that happens after Keen wins the game is dependent on this chunk. Note that when altering this value an associated variable has to be altered by twice the amount. (As an example, changing the chunk to $1286, or one less means changing the variable to $9FF9 or two less.)
Keen 4
#Ending sequence document
%patch $9CB8 $1287W #Text
%patch $9CC4 $9FFBW #Memory variable 1
%patch $9D7D $9FFBW #Memory variable 2
Background color
The background color of the ending sequence is the same as that of the help sections and so cannot be changed without also altering the help section. By default it is $04, or red. The next two lines of the patch give the area of the screen affected by the color. (This makes it possible to display a color plus black as a background.
Keen 4
#Help\Ending pages background color
%patch $95FB [$0004W] #Color dark red used for screen background
%patch $95FF [$00C8W] #200x...
%patch $9603 [$0140W] #320...
Page border images
Like the help section the ending sequence screen is bordered by four images, top, bottom, left and right. This screen and its images are separate from the main Computerwrist screen that first appears when F1 is pressed.
However, this screen is not separate from the help options screens; a total of five images are stored and both screens use the same code with a different bottom border image.
Keen 4
#Store images for display:
%patch $9822 [$0050W] #Top of help option screens
%patch $9829 [$0051W] #Left of help option screens
%patch $9830 [$0052W] #Right of help option screens
%patch $9837 [$0053W] #Right of help option screens
%patch $983E [$0054W] #Bottom of ending screen
#Top of help screen (At 0,0)
%patch $9613 [$0050W] #Bitmap
#Left of help screen (At 0,8)
%patch $9623 [$0051W] #Bitmap
%patch $9627 [$0008W] #Vertical position
#Right of help screen (At 312,8)
%patch $9636 [$0052W] #Bitmap
%patch $963A [$0008W] #Vertical position
%patch $963E [$0138W] #Horizontal position
#Bottom of help screen(At 8, 176)
%patch $964E [$0053W] #Bitmap
%patch $9652 [$00B0W] #Vertical position
%patch $9656 [$0008W] #Horizontal position
#Bottom of ending screen
%patch $9664 [$0054W] #Bitmap
%patch $9668 [$00C0W] #Vertical position
%patch $966C [$0008W] #Horizontal position
#Don't show...
%patch $9612 $EB $0E #Top help image
%patch $9622 $EB $11 #Left help image
%patch $9635 $EB $12 #Right help image
%patch $964D $EB $12 #Bottom help image
%patch $9663 $EB $12 #Bottom ending image
%patch $9612 $EB $63 #All images
Ending sequence doesn't have border images
This patch rearranges the screen code so that the ending sequence has no border images while the help screens do. This can help distinguish both kinds of screen. As a side effect the location and image values are shifted slightly from those in the section above, rendering all above patches dealing with them incompatible. Instead alterations must be made to the blue values in this patch.
As another note this means that the end sequence's bottom border image is not used and can be used for something else. There are modifications to this patch that allow one or more help border images to appear in the ending sequence.
Ending sequence 'Ending sequence doesn't have border images
#Ending sequence doesn't have border images
%patch $9612 $0B $FF $74 $4D $B8 [$0050W] $50 $33 $C0 $50 $50 $9A $1D060C79RL
$83 $C4 $06 $B8 [$0051W] $50 $B8 {$0008W} $50 $33 $C0 $50 $9A
$1D060C79RL $83 $C4 $06 $B8 [$0052W] $50 $B8 {$0008W} $50 $B8
{$0138W} $50 $9A $1D060C79RL $83 $C4 $06 $B8 [$0053W] $50 $B8
{$00B0W} $50 $B8 {$0008W} $50 $9A $1D060C79RL $83 $C4 $06 $EB
$14
Ending sequence 'Patch modifiers, use ONE
#End sequence pages also display...
%patch $9616 $37 #...bottom border
%patch $9616 $23 #...bottom and right borders
%patch $9616 $10 #...bottom, right and left borders
Ready for next page images
When the current page of graphics and text has loaded and is ready for the player to press a key to move to the next page, a flashing animation of two images appears in the lower right of the page indicating this. By default this animation is of a dark\light green arrow. Both of these images and their location can be altered.
Both images must be cached first before being displayed.
Ending sequence 'page ready' animation
#Cache images for display
%patch $9CA0 [$0030W] #Dark green arrow
%patch $9CAC [$002FW] #Light green arrow
#Display dark green arrow at 184,298
%patch $9D04 [$002FW] #Image
%patch $9D08 [$00B8W] #Vertical location
%patch $9D0C [$012AW] #Horizontal location
#Display light green arrow at 184,298
%patch $9D37 [$0030W] #Image
%patch $9D3B [$00B8W] #Vertical location
%patch $9D3F [$012AW] #Horizontal location
Animation speed
The arrow switching speed can be controlled to an extent. By default it is the quickest it can be, and this can be doubled, tripled, etc. Doing this will create a slight lag between when a key can be pressed and when the page will change, but since this will generally only be a few cycles it will be unnoticeable unless the animation speed is lengthened to ridiculous levels.
In general the values given here are in seconds, so the default switch happens once every second for both arrows.
Arrow animation speed
#Seconds each arrow displays
%patch $9D25 [$0001W] #Dark
%patch $9D58 [$0001W] #Light
Don't show animation
This patch stops both images being displayed when the page is ready. This can make it difficult for the player to tell when they can press a key, however in some situations it may be desirable. Using just one line of the patch will make only one image appear, which is more subtle.
Don't show ending sequence 'page ready' animation
#Don't show ending sequence 'page ready' animation
%patch $9D0F $90 $90 $90 $90 $90
%patch $9D42 $90 $90 $90 $90 $90
Ending sequence doesn't wait for keypresses
This patch skips the animation and waiting when a page has loaded. This means that the player can do nothing once the ending sequence starts except wait for it to end. However this can be easily altered to make the ending sequence 'automatic'. By the use of timed bitmaps and texts a page can be lingered on for any desired amount of time.
Ending sequence doesn't wait for keypresses
#Ending sequence doesn't wait for keypresses
%patch $9D03 $EB $66
Ending sequence doesn't wait for keypresses for first x pages
This patch skips the animation and waiting when a page has loaded, but only for the first few pages. The value highlighted in blue is the number of pages that will pass on 'automatic' before the player is required to press a key to progress. As a side effect the 'ready for next page' animation sequence does not appear, though a replacement can be added into the ending chunk.
This value uses a stat in brown that can be changed during the game, changing how much of the ending sequence is automated.
Ending sequence doesn't wait for keypresses
#Ending sequence doesn't wait for keypresses for first 6 pages
%patch $9D03 $FF $06 {$7A1EW} $83 $3E {$7A1EW} [$08] $72 $5D $9A $14600F43RL
$0B $C0 $75 $54 $EB $F5
Music played during ending sequence
This is the song played in the ending sequence. Due to the way music works it is actually the level whose music is played. See Patch:Music.
Keen 4
#Ending Sequence (Slug Village)
%patch $9CD7 $0007W
No music in ending sequence
This patch prevents any music being played in the ending sequence. Using a value of $FFFFW (-1) in the above patch will achieve the same goal.
Keen 4
#Don't play E.S. music
%patch $9CDA $90 $90 $90 $90 $90
Don't change music for ending sequence
This requires two patches, one to keep the same music playing after the Council Member is got, the second to stop the music changing in the ending sequence. The side effect is the member's background music will be the same as the levels. (If the first line is removed then the E.S. music will be the same as the member's music.)
Keen 4
#Ending sequence has same music as last level
%patch $F4CD $90 $90 $90 $90 $90 #Don't change music for member
%patch $F5E7 $90 $90 $90 $90 $90 #Don't change music after member rescued
%patch $9CDA $90 $90 $90 $90 $90 #Don't play E.S. music