Patch:Game over (Galaxy)

From KeenWiki
Jump to navigation Jump to search

This page contains patches relating to the Game Over sequence. This is triggered in one of three different circumstances, when the player quits their game, when the player loses all of their lives and when the game is won. The sequence may differ depending on circumstances. Closely related patches can be found at Patch:High Scores (Galaxy).

Keen 5 follows a slightly different route than the other galaxy games and the bulk of the patches on this page deal with its more complex setup.

Game Over Window\Text

In Keen 4 and 6, a 'Game Over' window appears before going to the high scores.

Game Over Window

#Keen 4
%patch $5CDC  [$0003W] #Height
%patch $5CE0  [$0010W] #Width
%patch $5CEC  [$024EW] #Text called from
%patch $2F0BE "Game Over!" $00

#Keen 6
%patch $5AB0  [$0003W] #Height
%patch $5AB4  [$0010W] #Width
%patch $5AC0  [$0192W] #Text called from
%patch $30EC2 "Game Over!" $00

Complete window code

This is the complete window code for the game over window. On the first line the window's size is set and on the second line the text is called. The rest of the code waits for a response.

Game Over Window

#Game over window - Keen 4
%patch $5CD3 $55 $8B $EC $9A $23DB0999RL     $B8 [$0003W]  $50 $B8 [$0010W]  $50
             $9A $20061070RL     $83 $C4 $04 $B8 [$024EW]  $50 $9A $20060E1FRL
                 $83 $C4 $02 $9A $23DB0A9BRL     $9A $1B3508A8RL     $33 $C0
             $50 $BA $18 $01 $50 $52 $9A $1B350F92RL     $83 $C4 $06 $5D $CB

#Game over window - Keen 6
%patch $5AA7 $55 $8B $EC $9A $1CF709A3RL     $B8 [$0003W]  $50 $B8 [$0010W]  $50
             $9A $18F81070RL     $83 $C4 $04 $B8 [$0192W]  $50 $9A $18F80E1FRL
                 $83 $C4 $02 $9A $1CF70AA5RL     $9A $141308A9RL     $33 $C0
             $50 $BA $0118W  $50 $52 $9A $14130F93RL     $83 $C4 $06 $5D $CB

No window

This patch removes the Game Over window meaning that games end with a screen fade and no obvious message.

No Game Over window

#No Game Over window -Keen 4
%patch $6BA6 $90 $90 $90 $90

Keen 5 galaxy explosion sequence

This sequence differs from the other two galaxy games in being far more complex. Instead of simply pausing the game where Keen died the screen undergoes a number of changes.

Remove sequence entirely

This patch removes the exploding galaxy sequence from the Game Over sequence. There is a brief pause while the screen is black and then the GAME OVER bitmap appears. This is done by disabling a number of things such as displaying the galaxy graphic and playing the flashing sound.

Removing the first line will make Game Over play the galaxy flash sound which may be desirable.

Keen 5

#Remove galaxy explode sequence
%patch $F6E2 $EB $0A
%patch $F664 $EB $0A
%patch $F6B1 $EB $0E
%patch $F714 $EB $0A
%patch $F725 $90 $90

Graphics used

In Keen 5, a bitmap is displayed and its palette altered, to show a "galaxy" flashing. This is then replaced with a (monochrome) display of exploding pixels to make it appear that the galaxy is exploding which is obtained from another chunk. Finally, a GAME OVER bitmap is displayed. Graphics will not display if they have not been cached first.

Keen 5

%patch $F665 [$0059W] #Cache galaxy graphic
%patch $F6B2 [$0059W] #Display galaxy graphic
%patch $F671 [$133DW] #Use this for exploding galaxy pixel data
%patch $F67D [$0062W] #Cache GAME OVER
%patch $F814 [$0062W] #Display GAME OVER

Don't show galaxy graphic

This patch stops the galaxy image appearing and flashing before the explosion. (The explosion still appears, but in the meantime the screen is black.)

Keen 5

#Don't show galaxy graphic in game over sequence
%patch $F664 $EB $0A
%patch $F6B1 $EB $0E

Screen fade

After the game is lost the screen fades in to black then fades out to reveal the galaxy graphic.

Fade to white

This patch changes the fade from black to white, meaning the screen goes bright on game over.

Keen 5

#Fade to\from white after game loss
%patch $F65F $9A $1E000211RL
%patch $F6D8 $9A $1E000265RL

Fade to white palettes

There are two palettes used when the screen fades to white.

Keen 5

#Palettes called from
%patch $1E13E $43F8W
%patch $1E142 $4409W

#Palettes used for fade-in
%patch $34738  $00 $01 $02 $03 $04 $05 $06 $07  $1F $1F $1F $1F $1F $1F $1F $1F  $00 #Fading to white
%patch $34749  $1F $1F $1F $1F $1F $1F $1F $1F  $1F $1F $1F $1F $1F $1F $1F $1F  $1F #White

Disable fade

This patch disables both the fade in and fade out that occur at game over, making the transition much more abrupt.

Keen 5

#Disable fades
%patch $F65F $90 $90 $90 $90 $90
%patch $F6D8 $90 $90 $90 $90 $90

Galaxy flashes

Once the galaxy is displayed some palette changes occur that make the galaxy look like it is flashing or glowing.

Flash length

This patch controls how long each galaxy flash takes and thus how long it takes for the galaxy to explode. Importantly it controls the time between flashes which means that if this is made longer some parts of the flash will still be quite short.

The second patch removes the pause entirely which makes the whole flash sequence very quick. It overrides the flash time.

Keen 5

#Galaxy flash duration
%patch $F715 $000AW

Keen 5

#Galaxy flash is 0 tics long
%patch $F714 $EB $0A

Galaxy flashing

To achieve the flash effect the game picks two color entries in the starting palette then changes them to various colors over a period of 18 'frames' By default the 'light black' and 'dark white' (Dark grey and light grey) colors are changed.

Notice that this is achieved by altering the game's active palette itself. After this sequence the changed palette is used for the galaxy exploding sequence (but the normal palette is restored before the Game Over bitmap is displayed.) It is advised that Patch:Palette be consulted for information on how palettes work.

The 'color cycling' is interesting; it involves two lists of 18 2-byte entries giving the value of the color to change the selected color entry to each frame. It can be thought of as taking the starting palette and making 18 sets of two changes to it.

The value for the entry that is changed is slightly complex; it is the desired color + $18A2 (Black, color 0 is $18A2, white, color 15 is $18B1 and so on.) The border color (Color 16) counts as an alterable color. Any values outside this range will disable a color cycle but may cause memory corruption.

Galaxy flashing palette stuff

#Starting palette (Not standard game palette)
%patch $31BE2  $00 $01 $02 $03 $04 $05 $06 $07  $18 $19 $1A $1B $1C $1D $1E $1F  $03

#Starting palette call
%patch $F70D $18A2W

#First palette color to cycle (18AA - 18A2 = 8)
%patch $F6FB $18AAW

#Second palette color to cycle (18A9 - 18A2 = 7)
%patch $F706 $18A9W

#First index color cycle
%patch $31B9A $0008W $0008W $0007W $000FW $0007W $0008W 
              $0000W $0008W $0007W $000FW $0007W $0008W
              $0000W $0000W $0000W $0000W $0000W $0000W

#Second index color cycle
%patch $31BBE $0007W $0007W $0007W $0007W $0007W $000FW
              $0007W $0008W $0000W $0007W $000FW $0007W
              $0008W $0000W $0000W $0000W $0000W $0000W

Galaxy explosion

Here a special graphics chunk is loaded. It consists of a monochrome image of 4000 pixels (or less) where each pixel has its own X and Y velocity. The image is then animated for a number of frames. The graphic itself can be edited with K5Splode, a tool created by Lemm (also bundled with Keengraph). It is also possible to patch several things about this sequence.

The length is simple enough, it is how long the sequence takes. The actual value is half the length, in frames. (Approx 64 frames per second.) The maximum length this can be is $7F.

The star color is the entry from the palette the stars will be. They will be displayed on a background of color 0 (Default black) By default, color 15 (white) is used.

The color planes enabled are best not messed with, but are the color planes that can be used. (Value is blue +1, green +2, red +4, light +8, by default all planes are enabled (15) so color 15 (which uses all four planes) can be displayed.) This is a tricky field to use, but can allow some neat effects like a starburst background pattern and stars that change color as they move. Literally, this field defines the video planes to which you will write the star pixels. Planes that are not enabled (and are therefore disabled) are not altered by the `burst pattern write to video memory. If you had a solid white pattern and you disabled the RED plane (plane 2), then you would see light cyan (i.e. cyan is all planes but red) stars fly over a dark red and black pattern. You would notice the stars change colors depending on if they were over black or dark red. By combining this patch with all the other color patches, we can get a cool shimmery effect.

Galaxy explosion stuff

#Starburst sequence length
%patch $F7D7 $1E 

#Star color
%patch $F626 $0F

#Color planes to enable for starburst segment
%patch $F73F $0F

Shimmer effect example

This patch example makes used of the shimmering effect, having dark red stars shimmering to bright red. First, one color plane which gives the shimmer effect when our stars cross over it is chosen. Here it is plane 0 (Dark blue) because it makes things easiest. Essentially, we are telling the game NOT to erase any plane0 (Blue) components of the Pre-explosion bitmap upon transition to starburst.

Dark red star shimmer patch

#Star color
%patch $F626 $04 #dark red stars (technically only write to plane 2 for burst)

#Color planes to enable for starburst segment
%patch $F73F $0E #because planes 1+2+3 = g+r+i = 2+4+8 = 14 = $E

#Pre-explosion palette:
%patch $31BE2  $00 $00 $02 $03 $04 $1C $06 $07  $18 $19 $1A $1B $1C $1D $1E $1F  $03
#                   ^^              ^^
#               do not want!       shimmer color

We want BRIGHT RED (COLOR $1C) to be displayed when PLANE 2 (our stars, red) and PLANE 0 (leftover from bitmap, blue) overlap, so we patch PALETTE ENTRY 5 (= plane0 + plane2 = 4+1) to $1C.

Conversely, we DON'T want to see any residual dark blue, so we patch PALETTE entry 1 (= plane0 =1) to be BLACK (COLOR $00)

What if you don't want to use any colors containing blue, but you still want to do the shimmer effect? Well, you can just patch the palette so that all the ODD indices (except for index #5) mimic a color that you are using. Unfortunately, there is a brief interval after after fade in from black when the game's default palette is active, so if you radically alter the palette, it might look weird. You can counteract that somewhat by disabling fade in from black, or perhaps by using fade from white it won't look so noticeable.

Write mode 0

This patch changes the write mode used for the starburst from 2 to 0. This gives a nifty shimmer effect but causes the star color patch to be ignored.

Dark red star shimmer patch

#Use write mode 0 instead of 2
%patch $F736 $00


Two sounds play in the Keen 5 Game Over sequence. The first plays when the galaxy is flashing, before it explodes. Then there is a pause and the galaxy explodes along with a second sound playing. Both sounds can be blocked.

Keen 5

%patch $F6E3 $36     #Galaxy flash sound
%patch $F743 $35     #Galaxy explode sound

#Don't play sounds
%patch $F6E2 $EB $0A #Galaxy flash sound
%patch $F742 $EB $0A #Galaxy explode sound


Music plays when the GAME OVER image appears. This is not a song reference but a level reference, that is, the same music plays as the level whose value is listed.

Keen 5

#GAME OVER music
%patch $F808 $0013W

Don't play music during GAME OVER

This patch removes music from the GAME OVER sequence.

Keen 5

#No GAME OVER music
%patch $F807 $EB $0A


These patches relate to the game over in Keen Galaxy generally.

What decreases when Keen dies

A Game over is trigger when Keen's life counter reaches a certain value (By default when he has -1 lives.) It is possible to change the life counter so it tracks other things or, say, removes Keen's pogo when he dies. This can be done by changing the brown colored bytes. See Patch:Game stats

Changing the $0E to $06 will cause the variable to increase; acting more like a 'death counter'.

What decreases when Keen dies

#Decrease lives by one when Keen dies -Keen 4
%patch $667E $FF $0E {$7A6AW}

#Decrease lives by one when Keen dies -Keen 5
%patch $6639 $FF $0E {$6F6AW}

#Decrease lives by one when Keen dies -Keen 6
%patch $644E $FF $0E {$75A6W}

Don't decrease lives

This patch works by not decreasing the life counter when Keen dies. As such he will always have the number of lives he started with and can try as many times as he wants to complete the game. (Note that the F10-Z cheat is made useless.)

Infinite lives - Don't decrease lives

#Infinite lives - Don't decrease lives -Keen 4
%patch $667E $90 $90 $90 $90

#Infinite lives - Don't decrease lives -Keen 5
%patch $6639 $90 $90 $90 $90

#Infinite lives - Don't decrease lives -Keen 6
%patch $644E $90 $90 $90 $90

No game over

This patch doesn't decrease lives and skips the Game Over entirely. Thus the only way to have a Game Over is to quit the game.

No game over

#Infinite lives - Skip G.O. check -Keen 4
%patch $667E $EB $0C
%patch $6BA1 $90 $90

No game over at 0 lives

This patch is useful if the lives counter is going to be used as a death counter or something similar. It allows the player to keep track of their deaths. Used by itself however it can have odd consequences.

Keen 4

#No Game Over even with 0 lives
%patch $6687 $EB
%patch $6BA1 $90 $90

External links