Patch:High Scores (Dreams)

From KeenWiki
Jump to navigation Jump to search

This page deals with patches involving the High Scores in Keen Dreams and any messages related to them or acquiring them. Related patches are Patch:Main menu and Patch:Game over. Patches involving Keen's score itself can be found in Patch:Score.

Keen encounters the scores in two different situations; firstly in the 'demo loop' displayed when the game is first started. (Also including the title screen.) and secondly when he experiences a Game Over and can possibly enter a new high score. These two situations are actually two different screens that share code.


This patch disables the High Score table. The first line disables the table itself, preventing it appearing at all. The second line only disables entering a new high score or seeing the table at Game Over. Using only the second line allows the High Score table to be used in the title sequence, possibly as a message to players.

Disable High Scores

#Disable High Scores
%patch $16920 $CB #Table
%patch $16B40 $CB #Entering new score

No High Scores in title sequence

This patch removes the High Score table in the title sequence only. While the player can enter a new high score and see the table at a Game Over they will not see the table when first starting the game and waiting.

No High Scores in title sequence

#No High scores in title sequence
%patch $4475 $EB $09

Go to main menu after High Score table displays

This patch causes the game to go to the main menu after the high scores are displayed, even if the player doesn't press a key. By default the game continuously 'loops' between high scores and the title screen.

Go to main menu after High Score table displays

#Go to main menu after High Score table displays
%patch $4492 $EB

Time before table appears in title loop

By default the 'title sequence' loops between the titlescreen and the high score table. The first appearance of the title, when the game first loads, is especially long, while later appearances are shorter.

As such there are two times involved, the first for the special initial appearance and the second for the 'looping appearances'. Note that the first, longer, time is the sum of both times rather than a standalone value.

Titlescreen display time

#Titlescreen display time
%patch $43FA [$0118W] #First appearance extra time
%patch $4447 [$00D2W] #Loop appearances

Table screen background color

The High scores are displayed on a blue background by default. This is done by drawing a blue square 320x200 in size over the previous screen. There are two situations this occurs in, the demo loop and Game Over sequences. The color by default is $01, dark blue.

Making the square smaller will leave parts of the previous screen visible under the High Scores table. Changing the color of the background can also cause small 'flashes' or dark blue to appear sometimes. This is because the 'clear screen' code paints the screen blue after the table is removed. (It also provides the background for the Main Menu.)

High Score background color

#Titlescreen High Scores screen background
%patch $445E [$0001W] #Color
%patch $4462 [$00C8W] #Vertical size
%patch $4466 [$0140W] #Horizontal size

#Game Over High Score screen background
%patch $16C0E [$0001W] #Color
%patch $16C12 [$00C8W] #Vertical size
%patch $16C16 [$0140W] #Horizontal size

#Screen clear color
%patch $5E6D [$0001W]

Table and 'clear screen' color

As noted above, the 'clear screen' code fills the screen with dark blue. This code is run when the Main Menu is loaded, before the Title Screen is displayed and when the High Scores is cleared from the screen. While it is possible to alter the screen clear color this can make other things look odd.

This patch allows the screen clear color to be temporarily changed and allow the two different high score tables (Game Over and Title Sequence) to have different background colors. In this case the second color is 'dark red', set in the first paragraph of the patch.

The second paragraph sets the initial screen fade color when the game starts. The third makes the screen fade code use whatever color is set and the final paragraph 'resets' the screen fade color whenever the Title Screen is loaded. In this patch the 'default' color is 'dark blue'.

High Score background color

#HS tables change (and use) the clear color
%patch $445E  $B8 [$0004W]  $A3 $03A9W  $50 $9A $0CA5026BRL     $44 $44 $EB $08
%patch $16C0D $B8 [$0004W]  $A3 $03A9W  $50 $9A $0CA5026BRL     $44 $44 $EB $08

#Starting screen fade color
%patch $23E19 [$0001W]

#Screen fade uses HS color
%patch $5E6C  $A1 $03A9W

#Screen fade color resets when title loads
%patch $4397  $B8 [$0001W]  $A3 $03A9W  $E9 $0109W

Different table background color on Game Over\Winning game

This patch is a modification of the one above. It alters things so that when the player receives a Game Over the high score table's background is red ($0004W) but when they beat the game it is green ($0002W). This change can apply just to the game ending table or also to the one appearing in the titlescreen cycle.

The patch works by checking Keen's life variable; if it is less than zero (as it will be if he has died and lost the game) then it sets red as the background color. Otherwise (if the player gets a Game Over while still having lives -that is, beating the game) then green is set.

High Score background color

#HS tables change (and use) the clear color
%patch $445E  $B8 [$0004W]  $83 $3E {$7126W}  [$00] {$7C} $03 $B8 [$0002W]  $A3 $03A9W
              $50 $9A $0CA5026BRL     $44 $44
%patch $16C0D $B8 [$0004W]  $83 $3E {$7126W}  [$00] {$7C} $03 $B8 [$0002W]  $A3 $03A9W
              $50 $9A $0CA5026BRL     $44 $44

#Starting screen fade color
%patch $23E19 [$0001W]

#Screen fade uses HS color
%patch $5E6C  $A1 $03A9W

#Screen fade color resets when title loads
%patch $4397  $B8 [$0001W]  $A3 $03A9W  $E9 $0109W

High Scores appear over Titlescreen\levels

This patch prevents the High Scores recoloring the screen so that the High Score table appears over the previous screen. For the title sequence this is the title screen, for the Game over sequence this is the level Keen was in (Including the ending sequence text windows.)

High Scores appear over Titlescreen\levels

#High Scores appear over title screen
%patch $445D $EB $16

#High Scores  appear over game screen
%patch $16C0D $EB $16

Table size and setup

The high score table's size is a simple enough matter, having a height and width in 8x8 blocks.

The window also contains a 'bar' going across the top to separate the scores from the table texts. This bar has a specific vertical location, as well as a tile it consists of. There are also two tiles on the left and right side of the window at the same height as the bar that allow the bar to 'merge' with the window sides. These have their own tiles and vertical positions, but only the left tile's horizontal position can be patched. (The right tile just appears on the right edge of the window.) It is possible to eliminate the bar entirely.

High Score window bar

#High Score window bar
%patch $16983 [$000AW] #Tile used for bar
%patch $1698A [$0008W] #Bar vertical position

#Left bar tile
%patch $169A9 [$0009W] #Tile
%patch $169B0 [$0008W] #Vertical position
%patch $169B7 [$0008W] #Horizontal position

#Right bar tile
%patch $169C3 [$000BW] #Tile
%patch $169CA [$0008W] #Vertical position

Don't show High Score window bar

#Don't show High Score window bar
%patch $16982 $EB $14 #Bar
%patch $169A8 $EB $18 #Left tile
%patch $169D5 $EB $03 #Right tile

Table column texts

There are three pieces of text used in the Keen Dreams High Score screen. Notice the last line moves the text down three lines. As with most text patches they consist of a 'text call' and a string of text.

Interestingly the 'done' and 'score' texts are positioned horizontally relative to the middle of the table. The values for this position come in two parts. The first, $05 by default, means 'position right' Changing this to $2D will cause the text to be positions left. The second part (Marked in blue) is the actual position, in pixels.

High Score table texts

#Name text
%patch $16946 [$5C75W]
%patch $296E5 " Name" $00

#Score text
%patch $16959 [$5C7BW]
%patch $296EB "Score" $00

#Done text
%patch $1696C [$5C81W]
%patch $296F1 "Done" $0A $0A $00

#Score\Done text positions
%patch $16952 $05 [$0014W] #'Score'
%patch $16965 $05 [$003CW] #'Done'

Table columns

The High Score table contains three columns, Name, Score and levels Done. The Score column is the centerpiece of the table around which everything else is built. The Name column starts at the window's left edge and has a specific width. The Done column is a certain number of pixels right of the Score column.

The Name and Done columns can be removed if desired.

High Score table columns

#Width of name column
%patch $16A36 [$0038W]

#Done number position, right of score column
%patch $16A8D [$003CW]

#Don't show
%patch $16A92 $EB $1D #Done
%patch $16A15 $EB $1B #Name

Score entries

By default the score entries are highlighted black, (unless a new name is being entered.) but this can be changed. Although hard to see, a single blank space appears before each entry. This text can be changed to something of any length, but the default space is also used elsewhere in the game.

If a name is blank or the number of levels completed is zero, then that column will contain a '-'. This character too can be changed and it is possible to prevent the 'Done' column from using it (By changing the 'trigger value' to an unreachably large value like $40.)

High Score table entries

#Normal color of entries
%patch $169F5 $0F #Score\done

#Character before names
%patch $16A02 [$5225W]
%patch $28C95 " " $00

#Character for blank names\done
%patch $16A21 [$5C88W] #Name
%patch $16AA8 [$5C88W] #Done
%patch $296F8 "-" $00

#Value of 'Done' that turns to '-'
%patch $16A95 $00

Number of score entries

By default 10 score entries are visible on the table.

Number of score entries

#Number of score entries
%patch $16AC4 [$0A]

Default High Score entries

By default there are ten scores whose data is stored in the executable and extracted if no configuration file can be found. By default each has no name, a 20'000 score and no levels done. Names can be up to twenty characters long. Score entries are actually 64 characters total but for simplicity the game just dumps a chunk of memory into the config file instead of maximizing efficiency.

Default High Scores\Names

#Default High Score data location
%patch $1216F [$4720W]
%patch $1222B [$4720W]
%patch $169E3 [$4720W]
%patch $16AF7 [$4720W]
%patch $16B1E [$4720W]
%patch $16BBF [$4720W]
%patch $16BC9 [$4720W]
%patch $16BE3 [$4720W]

#Default High Score data
%patch $28190 "High Score 1" $00
%patch $281CA [$00002710L]
%patch $281CE [$0000W]

%patch $281D0 "High Score 2" $00
%patch $2820A [$00002710L]
%patch $2820E [$0000W]

%patch $28210 "High Score 3" $00
%patch $2824A [$00002710L]
%patch $2824E [$0000W]

%patch $28250 "High Score 4" $00
%patch $2828A [$00002710L]
%patch $2828E [$0000W]

%patch $28290 "High Score 5" $00
%patch $282CA [$00002710L]
%patch $282CE [$0000W]

%patch $282D0 "High Score 6" $00
%patch $2830A [$00002710L]
%patch $2830E [$0000W]

%patch $28310 "High Score 7" $00
%patch $2834A [$00002710L]
%patch $2834E [$0000W]

%patch $28350 "High Score 8" $00
%patch $2838A [$00002710L]
%patch $2838E [$0000W]

%patch $28390 "High Score 9" $00
%patch $283CA [$00002710L]
%patch $283CE [$0000W]

%patch $283D0 "High Score 10" $00
%patch $2840A [$00002710L]
%patch $2840E [$0000W]

Entering a new High Score

When a new high score entry is being named the row will be highlighted in light red. This can be changed; the name and score\done part of the row can even be different colors.

As with all other entries a single blank space appears before the edited name, this text string can be changed.

The length of name that can be entered has two possible limitations. The first is the number of characters it can consist of, which is limited by the game's memory and is relatively straightforward to understand. It will likely not need to be modified as there is essentially no situation where this generous limit will be reached.

The second limit is how wide the letter string is, limited by screen space. It is also a bit odd, it is defined by how many pixels can remain between the end of the entry name and the start of the Scores column. By default the name cannot get any longer if an extra character will move the string closer than 8 pixels from the left edge of the scores column. As such making this value bigger will make the possible name length smaller.

Entering a new High Score

#Enter name text color
%patch $16AD4 [$03] #Name
%patch $169F1 [$03] #Score\done

#Character before edited name
%patch $16A02 [$5225W]
%patch $28C95 " " $00

#Name length limit
%patch $16B0C [$39] #In characters
%patch $16B08 [$08] #In pixels from score column

Time score table is visible

These patches control how long the High Scores table is visible before the title screen appears. There are two different situations, Game Over and title sequence, with different times.

High Score display time

#High Scores display time
%patch $16C32 [$015EW] #Game Over table
%patch $4484  [$01A4W] #Titlescreen table