Patch:Vitalin

From KeenWiki
Jump to navigation Jump to search

Vitalin is the system used in Keen 5 to allow the player to collect extra lives. There are two collectables that can be acquired; the first is Vitalin, which are tiles that can be collected, 100 giving the player an extra life, the second collectable is the Keg of Vitalin, both a tile and sprite that can be collected to give an extra life directly.

This page covers patches relating to both collectables in three sections, Vitalin, Tank of Vitalin tiles and Tank of Vitalin sprites. Vitalin is an item and its patches relate to item patches. It may also pay to check Patch:Jump conditions and Patch:Game stats to assist in using these patches.


Vitalin

These are 16x16 foreground tiles with a specific property allowing the player to get them. When 100 are obtained an extra life is gained. The following patches relate to both getting a single Vitalin and an extra life.


What the Vitalin give

This is what is increased when the player obtains a Vitalin or Keg. For Vitalin by default the Vitalin counter is incremented by 1, while for the Keg Keen's life counter is increased by 1.

Keen 5

#What Vitalin increase
%patch $C38A {$6F58W}

#What Kegs increase
%patch $C102 {$6F6AW}


What is needed to get 1UP

This is what is required to obtain an extra life. By default this is exactly 100 Vitalin. The game code is set up so that it is impossible for the player to get more than one Vitalin at a time, but if this happened the player might not get an extra life and continue obtaining more Vitalin.

Replacing the $75 with $EB will mean the player never gets an extra life (And can accumulate Vitalin in perpetuity.) Replacing it with $90 $90 will mean the player gets an extra life with every Vitalin.

Keen 5

#What is needed needed (100 Vitalin)
%patch $C38D {$6F58W}  $3D [$0064W]  {$75}


Can only get a maximum of x Vitalin, no 1UP

This patch changes the game so that the player can only get a certain number of Vitalin. After this their Vitalin counter does not increase anymore. This effectively puts a 'cap' on Vitalin. (And renders them useless, unless other patches make use of them.)

Keen 5

#Can only get a maximum of x Vitalin, no 1UP
%patch $C388 $A1 {$6F58W}  $3D [$xxxxW]  {$73} $04 $FF $06 {$6F58W}  $5F $5E $5D $CB


What is changed when 1UP obtained

Two things are changed when an extra life is obtained, firstly the player's life counter is incremented by 1, and secondly the Vitalin counter is set to zero, requiring them to obtain another 100 Vitalin.

Keen 5

#What to change
%patch $C396 {$6F58W}  [$0000W] #Set Vitalin to 0
%patch $C3A6 $FF $06 {$6F6AW} #Increase Keen's life count


Sounds played

There are two sounds played, one when the Vitalin is got, the other when an extra life is gained.

Keen 5

#Play sounds
%patch $C373 $000AW #Get Vitalin
%patch $C39B $0011W #Get 1UP

Keen 5

#Don't play sounds
%patch $C376 $90 $90 $90 $90 $90 #Get Vitalin
%patch $C39E $90 $90 $90 $90 $90 #Get 1UP


Keg of Vitalin

These are either 16x16 foreground tiles with a specific property allowing the player to get them (which are not used in the default game) or item sprites that gives the player an extra life when the player touches them. As items proper, patches relating to Vitalin are covered on the items page.


1UP and 'V' sprites

There are four Vitalin-related sprites. The first is the 1UP produced when a 1UP item sprite is taken, patches relating to that sprite can be found on the items page. The second is the 1UP produced when a 1UP tile is obtained. These too are treated on the items page. The last two relate to Vitalin tiles; the first is the 'V' that appears when any Vitalin is taken while the second is the 1UP produced when the 100th Vitalin is taken.


Sprite Type

Both the 'V' and 1UP sprites are type 1 or 'misc', not affecting anything in particular.

Keen 5

#Vitalin stuff sprite types
%patch $FE27 [$0001W] #'V'
%patch $C3BC [$0001W] #1UP


Sprite Actions

Actions relating to these sprites are quite simple. Both are produced in only one situation. The 'V' is produced when Vitalin tiles are obtained and proceeds to a four action sequence that then vanishes. The 1UP is a variation of the standard 'item got' sprite so altering what it becomes will alter other item got sprites.

Actions:
$19BEW #Stuff got
$19DCW #Vitalin got 1
$19FAW #Vitalin got 2
$1A18W #Vitalin got 3
$1A36W #Vitalin got 4

Keen 5

#Produce 'V'
%patch $FE3C [$19DCW]

#'V' sequence
%patch $31D38 [$19FAW]
%patch $31D56 [$1A18W]
%patch $31D74 [$1A36W]
%patch $31D92 [$0000W]

#Produce 1UP
%patch $C3E3 [$19BEW]

#1UP sequence
%patch $31D1A [$0000W]


Sprite Behavior

None of these sprite actions have any behavior. Changing the 1UP's behavior will also change the behavior of other 'items got' sprites.

Keen 5

#1UP
%patch $31D0E $00000000L

#'V'
%patch $31D2C $00000000L
%patch $31D4A $00000000L
%patch $31D68 $00000000L
%patch $31D86 $00000000L


Speed and Jump Height

The 'V' sprite does not move. However the 1UP does. Since its direction is set as upwards its speed is reversed. Altering this speed will alter the speed of all 'item got' sprites. In the main this will alter how far up the sprite gets before vanishing.

Keen 5

#1UP initial direction
%patch $C3D7 [$FFFFW]

#1UP speed
%patch $31D0A $0000W $0008W

#'V' speeds
%patch $31D28 $0000W $0000W
%patch $31D46 $0000W $0000W
%patch $31D64 $0000W $0000W
%patch $31D82 $0000W $0000W


Sprite Collision

None of the sprite actions have any sprite collision.

Keen 5

#1UP
%patch $31D12 $00000000L

#'V'
%patch $31D30 $00000000L
%patch $31D4E $00000000L
%patch $31D6C $00000000L
%patch $31D8A $00000000L


Animations

The 'V' and 1UP sprites are cached with in-level Keen when he spawns. The 1UP sprite's specific animation is set when it is created, its action itself has no animation of its own. (If one is given then it will change the animations of all other 'item got' sprites.) The 'V' however has its own animations, a different one for each action.

The animation speeds of the 'V' control how long it appears onscreen before vanishing. That of the 1UP controls how long it moves upwards before vanishing. (Changing it will change all other 'item got' sprites.)

Keen 5

#1UP sprite set
%patch $C3DA [$00C2W]

#1UP action has no animations
%patch $31CFE $0000W $0000W
%patch $31D08 $0028W        #Animation speed

#'V'
%patch $31D1C $00CBW $00CBW
%patch $31D26 $0008W        #Animation speed
%patch $31D3A $00CCW $00CCW
%patch $31D44 $0008W        #Animation speed
%patch $31D58 $00CDW $00CDW
%patch $31D62 $0008W        #Animation speed
%patch $31D76 $00CEW $00CEW
%patch $31D80 $0008W        #Animation speed


Sounds

There are two relevant sounds, one played when a drop is obtained and another when 100 Vitalin are obtained. For patches relating to these sounds see the sounds section near the top of this page.


Clipping and foreground

Both the 'V' and 1UP sprites have a foreground value of 3 so that they will appear in front of all other sprites and tiles. (So the player can see what has happened.) and no clipping. (So they are not pushed about by tiles.) These can be altered without affecting the properties of the usual 'item got' sprites.

Keen 5

#1UP
%patch $C3C1 [$0003W] #Foreground
%patch $C3F6 [$0000W] #Clipping

#'V'
%patch $FE23 [$0003W] #Foreground
%patch $FE1E [$0000W] #Clipping


Sprite-tile interaction

All the sprites use the 'sit' tile interaction; this means they do not specifically interact with tiles. Since they have no clipping they will not even be stopped by solid tiles. Altering the 1UPs collision will affect other 'item got' sprites.

Keen 5

#1UP
%patch $31D16 $090B17B5RL

#'V'
%patch $31D34 $090B17B5RL
%patch $31D52 $090B17B5RL
%patch $31D70 $090B17B5RL
%patch $31D8E $090B17B5RL


Action type

The 1UP uses type 1 for its action; this allows it to move smoothly. The 'V' by contrast uses type 0 since they do not have to move or use a behavior.

Keen 5

#'V'
%patch $31D20 [$0000W]
%patch $31D3E [$0000W]
%patch $31D5C [$0000W]
%patch $31D7A [$0000W]

#1UP
%patch $31D02 [$0001W]


Deprotect and stick to ground

These sprites have no need for either of these variables and so have a value of 0 for both in all of their actions.

Sprite deprotect, stick -Keen 5

#1UP
%patch $31D04 [$0000W $0000W]

#Vitalin got
%patch $31D22 [$0000W $0000W]
%patch $31D40 [$0000W $0000W]
%patch $31D5E [$0000W $0000W]
%patch $31D7C [$0000W $0000W]