Patch:Story text

From KeenWiki
Jump to navigation Jump to search

This page deals with patches relating to the story texts in Keen Vorticons that do not fit on the general Large text files page. A knowledge of that page is recommended.

Name of story text file

The story text is loaded in Keen 1 from an external file. (See Files and filenames.) In Keen 2 and 3 this is not used, but the code remains.

Name of story text file

#Story text -Keen 1
%patch $795B  [$28C8W]
%patch $15918 "STORYTXT." $00

#Story text -Keen 2 (Not used)
%patch $7D77  [$2D30W]
%patch $1A4B0 "STORYTXT." $00

#Story text -Keen 3 (Not used)
%patch $868A  [$2D6AW]
%patch $1C58A "STORYTXT." $00

Play a neat sequence for the story

This patch alters things so that when the 'story' option is selected in the main menu the player sees a neat sequence. Note that this removes the 'aware level' sequence from the Keen 3 ending sequence in order to do so.

The following sequence is a complex example of a patch that can be endlessly customized. (Or this existing patch can be tweaked.) The space freed by the patch allows for a much more complex sequence if desired. The patch and text used is taken from the mod The Fastest Gun In The Universe.

When the story is selected the game will go to the story window but not large text window will appear. Instead text will be written directly to the screen. The first blue value is the horizontal location of the first line of text on the screen in 8x8 squares. The second blue value is the horizontal location of all other lines of text on the screen. (To line up these values should be the same.) The third blue value is the vertical location of the first line on the screen; all other lines will appear below this.

The first and second brown values (on line 4 of the main code paragraph.) are where the first and second lines of text are called from. Following this is another blue value, the time between printing lines 1\2 and line 3. The call is marked in brown then there is a second pause, marked in blue.

The next two lines write the fourth, fifth and sixth lines of text (brown values) each with a brief (But unalterable) pause between them.

The eighth line draws the first bitmap to the screen. In this example it is bitmap 4 located at 16,16 on the screen. (Three blue values.) At the same time on the next line the seventh line is printed. There then follows a third adjustable pause.

After this line 8 is printed and there is another short, unpatchable pause before line 9 is printed. Following this is the fourth adjustable pause. The next line holds three blue values that print the second bitmap. (Bitmap 5 at 16,16 in this example.) At the same time line 10 is printed.

There then follows a series of pauses and line prints; all the pauses being of unpatchable length. Then there is one final pause and the game returns to the main menu.

Keen 3

#Play ending sequence when story selected in Main Menu
%patch $A58A $E9 $C8 $B4

#Change ending sequence
%patch $5A52 $E9 $9A $02
             $89 $E5 $EB $08 $68 $32 $00 $E8 $F9 $70 $59 $C3 $C7 $06 $16
             $82 [$0006W]  $C7 $06 $D4 $82 [$0006W]  $C7 $06 $86 $82 [$000AW]     #First line of text set up
             $68 {$2B4DW}  $E8 $94 $54 $59 $68 {$2B67W}  $E8 $8D $54 $59 $68    #Line 1 and 2 printed
             [$00C8W]  $E8 $D1 $70 $59 $68 {$2B7CW}  $E8 $7F $54 $59 $68 [$0064W] #Pause, line 3 printed, second pause
                 $E8 $C3 $70 $59 $68 {$2B8FW}  $E8 $71 $54 $59 $E8 $B9 $FF    #Line 4 printed
             $68 {$2B95W}  $E8 $67 $54 $59 $E8 $AF $FF $68 {$2B9BW}  $E8 $5D    #Line 5\6 printed
             $54 $59 $E8 $A5 $FF $68 [$0004W]  $68 [$0010W]  $68 [$0010W]  $E8    #Draw first bitmap
             $6C $6A $81 $C4 $06 $00 $68 {$2BA3W}  $E8 $43 $54 $59 $68 [$0064W] #Line 7 printed, third pause
%patch $5ACE     $E8 $87 $70 $59 $68 {$2BB1W}  $E8 $35 $54 $E8 $7E $FF $E8    #Line 8 printed
             $7B $FF $68 {$2BBEW}  $E8 $29 $54 $59 $68 [$012CW]  $E8 $6D $70    #Line 9 printed, fourth pause
             $59 $68 [$0005W]  $68 [$0010W]  $68 [$0010W]  $E8 $34 $6A $81 $C4    #Second bitmap
             $06 $00 $68 {$2BDDW}  $E8 $0B $54 $59 $E8 $53 $FF $68 {$2C03W}     #Line 10\11 printed
             $E8 $01 $54 $59 $E8 $49 $FF $68 {$2C29W}  $E8 $F7 $53 $59 $E8    #Line 11
             $3F $FF $68 {$2C4FW}  $E8 $ED $53 $59 $E8 $35 $FF $68 {$2C75W}     #Line 12/13
             $E8 $E3 $53 $59 $E8 $2B $FF $68 {$2C9BW}  $E8 $D9 $53 $59 $68
             [$0320W]  $E8 $1D $70 $59 $E8 $F3 $D2 $E8 $17 $FF $89 $EC $E9    #Final pause then return
             $5B $4A

#Text used by example
%patch $1C36D "Another tough situation." $0A $00
%patch $1C387 "Another space duel." $0A $00
%patch $1C39C "On count of five." $0A $00
%patch $1C3AF "One. " $00 "Two. " $00 "Three. " $00 "Four -- ZAP!" $0A $00
%patch $1C3D1 "No sweat..." $0A $00
%patch $1C3DE "Winners seldom play by rules." $0A $00
%patch $1C3FD "Stunning everyone with his behaviour" $0A $00
%patch $1C423 "and stun gun, our hero activates the" $0A $00
%patch $1C449 "ship's self-destruction and jumps" $0A $00
%patch $1C46F "out. he laughes. they weren't match" $0A $00
%patch $1C495 "for commander keen! neither will be" $0A $00
%patch $1C4BB "this planet or any other place!" $0A $00

Location of screen in Main Menu level

The story text screen is located int he same level as the Main Menu, but at a different location. This location (horizontal and vertical) is defined by four variables. The biggest two define the location in sixteens of tiles. (This a value of 5 is 5*16 or 80 tiles across the level.) The smaller two variables are in 256ths of a pixel meaning that on1 pixel is $100.

Given these rather odd units the default location of the story text is 16 tiles plus 96 pixels (= 22 tiles) horizontal and 0 + 32 pixels (= 2 tiles) vertical.

Location of screen in Main Menu level

#Location of screen in Main Menu level - Keen 3
%patch $A573 [$0001W] #Horizontal location in 16 tile units
%patch $A56D [$6000W] #Added horizontal location in pixels
%patch $A57F [$0000W] #Vertical location in 16 tile units
%patch $A579 [$2000W] #Added vertical location in pixels

Size of story textbox

The story text window will be as wide as the screen. However its height in lines of text is alterable. By default it is 16 lines high and can be as high as the screen. (An invalid value will crash the game with gibberish.)

Size of story textbox

#Height of story textbox - Keen 3
%patch $A58B [$0010W]