Patch:Score

From KeenWiki
Jump to: navigation, search

This page contains patches relating to Keen's score. Related patches are Patch:Extra Keen At, Patch:High Scores Patch:Scorebox and Patch:Items. Mostly this page will deal with Keen's in-game score and unusual things happening to it.


Disable score

These patches disable the score entirely. That is, when Keen gets items he is not given any points at all. This also disables the Extra Keen At code as well.

Patch: Keen 1
#Disable score (Free $0D53-$0DAF)
%patch $0D52 $C3

Patch: Keen 2
#Disable score (Free $0D53-$0DAF)
%patch $0D52 $C3

Patch: Keen 3
#Disable score (Free $0DC6-$0E21)
%patch $0DC5 $C3


Set score to zero

These patches set Keen's score to zero when certain things happen.


On dying\exiting level

The first patch here sets keen's score to zero when he dies. changing the first two bytes to $90 will also do this when he exits the level normally. (Unless something else is done with the score, this pretty much renders the score useless.) The second patch will also set keen's ammo to zero, by changing the brown highlighted ammo value using values from Patch:Game stats you can change what else is set to zero. It is also possible to set Keen's score (And other things) to other values by changing the blue highlighted values.

Patch: Keen 3
#Set score to 0 on death (Change first two to $90 to also clear on exit)
%patch $8DFE $EB $0C $C7 $06 $9D4AW $0000W $C7 $06 $9D4CW $0000W $E9 $FC80W $90 $90 $90 $90 $90 $90
#Set score and ammo to 0 on death (Change first two to $90 to also clear on exit)
%patch $8DFE $EB $0C $C7 $06 $9D48W $0000W $C7 $06 $9D4AW $0000W $C7 $06 $9D4CW $0000W $E9 $FC80W $90 $90

Patch: Keen 4
#Reset Keen's score to 0 on dying (But not game over.)
%patch $66BB $C7 $06 $7A50W $0000W $90 $90 $90 $90 $90 %patch $672D $BF $0001W $C7 $06 $7A52W $0000W $90


Dying removes any points obtained in a level

This patch saves Keen's score when he enters a level, then, if he dies, resets the score to what it was. This means Keen can only get points on completing a level (Excluding the teleport to the secret level.) This means only a set number of points can be collected in a playthrough.

It can be seen that the variable stores is the low word of the score, this can be changed to store other things if desired.

Note that the Keen 4\5 patch uses the EGAGRAPH check skip and so is incompatible with any other patches that use this. The last two lines replace the Extra Keen At Score with the stored score for the players benefit, but are not necessary and can be removed. (Those two lines do not stop the player getting EKA bonuses.) Likewise the Keen 5 patch displays the stored score in Keen's scorebox. The Keen 6 patch disables the creature question.

Note that the Vorticons versions of the patch are incompatible with the 'Keen dies instead of recovering ' patch. There is however a tweak to make the two patches compatible. And again in Vorticons only note that the blue $0800Ws are the alignments for Keen's death sprite.

Patch: Keen 1
#Reset score on death A
%patch $427D $66 $81 $06 $E2 $6E $0800W $0000W $66 $A1 $AF00W $66 $A3 $AACAW $90 $90
#Reset score on death B
%patch $42BB $66 $81 $06 $E2 $6E $0800W $0000W $66 $A1 $AF00W $66 $A3 $AACAW $90 $90
#Save score on level load
%patch $4BAE $66 $A1 $AACAW $66 $A3 $AF00W $66 $33 $C0 $66 $A3 $5135W $66 $A3 $563EW $A3 $5B14W $90

Patch: Keen 2
#Reset score on death A
%patch $70BF $66 $81 $06 $BE $6E $0800W $0000W $66 $A1 $AF00W $66 $A3 $9AE0W $90 $90
#Reset score on death B
%patch $70FD $66 $81 $06 $BE $6E $0800W $0000W $66 $A1 $AF00W $66 $A3 $9AE0W $90 $90
#Save score on level load
%patch $7912 $66 $A1 $9AE0W $66 $A3 $AF00W $66 $33 $C0 $66 $A3 $5111W $66 $A3 $561AW $A3 $5AF0W $90

Patch: Keen 3
#Reset score on death A
%patch $7928 $66 $81 $06 $0E $71 $0800W $0000W $66 $A1 $AF00W $66 $A3 $9D4AW $90 $90
#Reset score on death B
%patch $7965 $66 $81 $06 $0E $71 $0800W $0000W $66 $A1 $AF00W $66 $A3 $9D4AW $90 $90
#Save score on level load
%patch $81B7 $66 $A1 $9D4AW $66 $A3 $AF00W $66 $33 $C0 $66 $A3 $5361W $66 $A3 $586AW $A3 $5D40W $90

Patch: Keen 4
#Disable EGAGRAPH check (Frees 389 bytes at $3CF6)
%patch $3CE5 $90 $90
#Reset Keen's score when he dies
%patch $3CF6 $55 $8B $EC $56 $8B $76 $06 $A1 $7A4CW $A3 $7A50W $A1 $7A4EW $A3 $7A52W $5E $5D $CB
#Store Keen's score on level load
%patch $69E8 $A1 $7A50W $A3 $7A4CW $A1 $7A52W $A3 $7A4EW $EB $3D
#Call reset Keen's score on death
%patch $6727 $9A $037D0526RL $BF $0001W $EB $06
#Track stored score
%patch $7DFF $7A4EW
#Track stored score 1
%patch $7E03 $7A4CW
#Track stored score 2

Patch: Keen 5
#Disable EGAGRAPH check in Keen 5 (Frees 389 bytes at $3CF0)
%patch $3CDF $90 $90
#Reset Keen's score when he dies
%patch $3CF0 $55 $8B $EC $56 $8B $76 $06 $A1 $6F1EW $A3 $6F4EW $A1 $6F20W $A3 $6F50W $5E $5D $CB
#Store Keen's score on level load
%patch $699E $A1 $6F4EW $A3 $6F1EW $A1 $6F50W $A3 $6F20W $EB $42
#Call reset Keen's score on death
%patch $66E2 $9A $037D0520RL $BF $0001W $EB $06
#Track stored score in scorebox
%patch $CE56 $6F1EW
#Score (low)
%patch $CE9A $6F20W
#Score (high)

Patch: Keen 6
#Skip creature question
%patch $1CC88 $90 $90
#Reset Keen's score when he dies
%patch $1CC93 $55 $8B $EC $56 $8B $76 $06 $A1 $7584W $A3 $7588W $A1 $7586W $A3 $758AW $5E $5D $CB
#Store Keen's score on level load
%patch $67D9 $A1 $7588W $A3 $7584W $A1 $758AW $A3 $7586W $EB $3D
#Call reset Keen's score on death
%patch $64F7 $9A $1A502793RL $BF $0001W $EB $06


Dying removes points and ammo obtained in a level

This is a slightly more complex and robust version of the patch above that also resets the player's ammo. As a side effect the Extra Keen At mechanism is disabled (Instead EKA tracks the 'secured score') and no sprites appear in the Keens left window. (Because of this an addition to the patch, infinite lives, has been added.)

The patch works as follows; the first patch sets the stored_ammo variable to 0, just as a precaution.

The second section deals with resetting the score to what it was when the level was started. This is done when the 'keens left' window appears when Keen is sent to the map level. This overwrites the lives sprite in the window. On the first line the game checks to see if the stored_score is 0, this happens when a game is restored for example. If this is so then the reset code is skipped and instead the current score is stored at the end of line 2. Otherwise the player has died and first their score then their ammo are reset at the end of line 1\start of line 2 and the score storing code skipped.

The third section rearranges the level loading code so that a call to the score saving code can be added. It is not important how this section functions.

The fourth section is the actual score storing code. It replaces the Extra Keen At code and simply takes the values in score and ammo and stores them in the EKA variable and stored_ammo variable respectively.

The fifth section changes the EKA in the status window so that it now displays the stored score, that is, the score the player will get if they die. Finally the last patch enables infinite lives. This si because of how the rest of the patch changes gameplay, but is not itself necessary.

Patch: Keen 1
#Blank ammo variable
%patch $13054 $0000W
#Don't display lives in Keens Left window, instead reset score (Appears only on death)
%patch $8F4A $81 $3E $6EC2W $0000W $74 $10 $66 $A1 $6EC2W $66 $A3 $AACAW $A1 $0004W $A3 $AAC8W $EB $08 $66 $A1 $AACAW $66 $A3 $6EC2W $EB $10
#Call score-ammo store code on level load
%patch $4B91 $B8 $0001W $50 $A3 $6EDCW $A3 $5DB4W $A3 $604CW $C7 $06 $8216W $0000W $C7 $46 $FE $0001W $E8 $C1CAW $90 $90
#Store score, ammo on level load (Disables EKA)
%patch $0D74 $5D $C3 $55 $8B $EC $83 $EC $04 $56 $66 $A1 $AACAW $66 $A3 $6EC2W $A1 $AAC8W $A3 $0004W $5E $8B $E5 $5D $C3
#Status window displays secured score
%patch $14E52 " SCORE SECURED SCORE " $0A $00 %patch $0FB0 $0000W
#Infinite lives
%patch $8041 $90 $90 $90 $90

Patch: Keen 2
#Blank ammo variable
%patch $17784 $0000W
#Don't display lives in Keens Left window, instead reset score (Appears only on death)
%patch $89E8 $81 $3E $6E9EW $0000W $74 $10 $66 $A1 $6E9EW $66 $A3 $9AE0W $A1 $0004W $A3 $9ADEW $EB $08 $66 $A1 $9AE0W $66 $A3 $6E9EW
#Call score-ammo store code on level load
%patch $78F5 $B8 $0001W $50 $A3 $6EB8W $A3 $5D90W $A3 $6028W $C7 $06 $96B6W $0000W $C7 $46 $FE $0001W $E8 $9466W $90 $90
#Store score, ammo on level load (Disables EKA)
%patch $0D74 $5D $C3 $55 $8B $EC $83 $EC $04 $56 $66 $A1 $9AE0W $66 $A3 $6E9EW $A1 $9ADEW $A3 $0004W $5E $8B $E5 $5D $C3
#Status window displays secured score
%patch $1991C " SCORE SECURED SCORE " $0A $00 %patch $0F5E $0000W
#Infinite lives
%patch $8E00 $90 $90 $90 $90

Patch: Keen 3
#Blank ammo variable
%patch $19824 $0000W
#Don't display lives in Keens Left window, instead reset score (Appears only on death)
%patch $983D $81 $3E $70EEW $0000W $74 $10 $66 $A1 $70EEW $66 $A3 $9D4AW $A1 $0004W $A3 $9D48W $EB $08 $66 $A1 $9D48W $66 $A3 $70EEW
#Call score-ammo store code on level load
%patch $819A $B8 $0001W $50 $A3 $7108W $A3 $5FE0W $A3 $6278W $C7 $06 $9906W $0000W $C7 $46 $FE $0001W $E8 $8C34W $90 $90
#Store score, ammo on level load (Disables EKA)
%patch $0DE7 $5D $C3 $55 $8B $EC $83 $EC $04 $56 $66 $A1 $9D4AW $66 $A3 $70EEW $A1 $9D48W $A3 $0004W $5E $8B $E5 $5D $C3
#Status window displays secured score
%patch $1BAF4 " SCORE SECURED SCORE " $0A $00 %patch $0FAC $0000W
#Infinite lives
%patch $8E00 $90 $90 $90 $90


Score at game start

When a new game is started the score is zero by default. This can be patched to any desired value.

Patch: Keen 4
#Starting score:
%patch $8A10 $9D4AW $0000W
#Score low
%patch $8A16 $9D4CW $0000W
#Score high


Track Score

This is a list of all the times the score value is referenced in Keen games. That is, all of the things the score variable is used for.

Patch: Keen 4
%patch $6B0B $7A52W $FF $36 $7A50W
%patch $6BB0 $7A52W $FF $36 $7A50W 
#Check if score can enter Keenest
%patch $7DA7 $7A52W $FF $36 $7A50W
#Status window
%patch $8ACA $7A50W $83 $16 $7A52W %patch $8AD9 $7A52W $8B $16 $7A50W %patch $DA7A $7A52W
#Scorebox related 1?
%patch $DA86 $7A50W
#Scorebox related 2?
%patch $DAD6 $7A52W $FF $36 $7A50W
#Scorebox
%patch $DB57 $7A52W %patch $DB5E $7A50W