Patch:Items

From KeenWiki
(Redirected from Patch:Points)
Jump to navigation Jump to search

This page contains patches relating to the items in Keen games. These are patches that relate to items as a general class of sprites and\or tiles. Many specific items have their own pages, listed in the first section of this page. Patches that involve Keen getting items are Patch:B A T Cheat, Patch:C T Space Cheat, Patch:Cheat codes, Patch:F10 I Cheat, Patch:Game start, Patch:Score and Patch:Scorebox.

In all Keen games points are a tile based system; when Keen touches the item tile he is given something. In the Keen Galaxy (And Dreams) games, items are also sprite and based objects the player can touch to get points added to their score. Point and other items mostly work on a 'list' system; there are certain properties that all sprites share while others are read off a list. As an example the red gem is the first item in the Keen Galaxy games, therefore it uses the first animation in the animation list, the first points value in the points list and so on.

This page is divided into four sections. The first section lists items that have their own pages for various reasons. The second lists 'list properties', properties such as the amount of points given that differ for each item and are controlled by a list. The third section, for Keen Galaxy and Dreams only, lists properties common to all item sprites, such as their behavior. The final section lists miscellaneous patches and currently does not exist.


Items with their own pages

The following pages exist for individual items that are (mostly) not covered here. While some patches on this page may affect these items (Such as the patch for how many points the neural stunner gives when obtained.) in general patches pertaining to them are located elsewhere.


Changing what items give ammo, lives and gems

The complete code for what items give is held on two different types of pages. Patch:Tiles holds item code that deals with item tiles being obtained, while the sprite collision sections of Patch:Keen (Keen 4), Patch:Keen (Keen 5), Patch:Keen (Keen 6), and Patch:Keen (Keen Dreams) contain code relating to item sprites being obtained.

Such code contains most of the patches on this page as well as additional patches affecting which items give ammo, lives and gems. They are kept on their own pages due to their close relationship with tiles and sprites.


Item replacement tile

In Keen Vorticons when tile-based items are acquired they are replaced in one of two ways. In Keen 1&2 individual values are given in the tile acquisition code; if the tile's number is above a certain value then one replacement tile is used, otherwise another is. In Keen 3 the tile's number is rounded down to the nearest multiple of 13 allowing 'rows' of items on different backgrounds.

The first replacement tile is also hard-coded elsewhere for the replacement of ammo, pogo and ship part tiles.

When tile-based items are obtained in Keen Galaxy their tile is replaced with a tile taken from a reference in the data segment. By default this is tile 0, making the item appear to vanish. This does not have to be the case however and any other tile can be used. (If it is not already present in the level and thus cached however it will leave behind gibberish.)

The replacement tile is used in several distinct situations, notably when item and '100 to get 1UP' tiles are contacted.

Keen 1

#Item tile replacements
%patch $430C [$0131W] #Decider tile number
%patch $4423 [$008FW] #1st replacement tile
%patch $443B [$0114W] #2nd replacement tile

Keen 4

#Item tile calls
%patch $CF8C  [$1424W] #Items got
%patch $D054  [$1424W] #Raindrops got
%patch $11D87 [$1424W] #Items got by Smirky

#Items and lifewater replacement tile
%patch $30294 [$0000W]

Keen 6

#Item tile calls
%patch $C086  [$129CW] #Items got
%patch $C14E  [$129CW] #Viva got

#Items and Viva replacement tile
%patch $31FCC [$0000W]


List properties

This section lists patches that alter things that are unique for any individual item, such as the number of points it gives or the animation it uses. For Keen Vorticons this is almost entirely limited to the number of points given to Keen when an item is obtained. Keen galaxy and dreams however have more extensive list properties.

Notice that list properties in Keen Galaxy affect 'non-point' items, such as keygems which can therefore be made to give points as well. The lists are always the same length, defined in the player's sprite or tile collision, but the list locations vary making it possible to have a wider variety of items.

There are three situations when lists are called. The first is when obtaining item tiles, the second while obtaining tile sprites. The third also deals with obtaining sprites but only when Keen is swimming. (In Keen 4 only.)


Points Items give

These patches change the values of the point items, that is, how many points Keen gets when he grabs them. The lists following use the default values and for simplicity are presented as a single patch. Each line affects a different point value. For Keen 1–3, there are five different point types, for Keen 3.5 and 4–6, all collectibles can be given a point value.

What point items increase involves Patch:Game stats, while the 'point item list' patch is a text style patch. Related patches can be found on the Patch:Extra Keen At page.

In Keen Vorticons the item list call is unusual in being 12 bytes (6 entries) smaller than the 'proper' call. This is because it relies on tile type and the first item tile type is 6.

Keen 1 Item scores

#Call point list
%patch $43E9 {$201AW}

#Change point item scores
%patch $15076 [$01F4W] #500
              [$0064W] #100
              [$00C8W] #200
              [$03E8W] #1000
              [$1388W] #5000

#What point items add to:
%patch $0D5B {$AACAW} #Score high
%patch $0D5F {$AACCW} #Score low

Keen 2 Item scores

#Change point item scores
%patch $19FC2 [$01F4W] #500
              [$0064W] #100
              [$00C8W] #200
              [$03E8W] #1000
              [$1388W] #5000

Keen 3 Item scores

#Point list read from:
%patch $5A15 {$2852W}

#Change point item scores
%patch $1C083 [$01F4W] #500
              [$0064W] #100
              [$00C8W] #200
              [$03E8W] #1000
              [$1388W] #5000

Keen Dreams Item scores

#Location of point list
%patch $76CC {$16AAW}

#Change point item scores
%patch $2511A [$0064W] #100
              [$00C8W] #200
              [$01F4W] #500
              [$03E8W] #1000
              [$07D0W] #2000
              [$1388W] #5000

Keen 4 Item scores

#Location of point list
%patch $CD34 {$13F4W} #Item sprites
%patch $CFAD {$13F4W} #Item tiles
%patch $F9AD {$13F4W} #Item sprites (Swimming)

#Change point item scores
%patch $30264 [$0000W] #Red gem
              [$0000W] #Yellow gem
              [$0000W] #Blue gem
              [$0000W] #Green gem
              [$0064W] #100
              [$00C8W] #200
              [$01F4W] #500
              [$03E8W] #1000
              [$07D0W] #2000
              [$1388W] #5000
              [$0000W] #100 #1UP
              [$0000W] #Raygun

Keen 5 Item scores

#Change point item scores
%patch $31614 [$0000W] #Red gem
              [$0000W] #Yellow gem
              [$0000W] #Blue gem
              [$0000W] #Green gem
              [$0064W] #100
              [$00C8W] #200
              [$01F4W] #500
              [$03E8W] #1000
              [$07D0W] #2000
              [$1388W] #5000
              [$0000W] #100 #1UP
              [$0000W] #Raygun
              [$0000W] #100 1UP
              [$0000W] #V card

Keen 6 Item scores

#Points calls
%patch $BECF [$126CW] #Item sprites
%patch $C0A7 [$126CW] #Item tiles

#Change point item scores
%patch $31F9C [$0000W] #Red gem
              [$0000W] #Yellow gem
              [$0000W] #Blue gem
              [$0000W] #Green gem
              [$0064W] #100
              [$00C8W] #200
              [$01F4W] #500
              [$03E8W] #1000
              [$07D0W] #2000
              [$1388W] #5000
              [$0000W] #100 #1UP
              [$0000W] #Raygun


Item animations

In Keen galaxy and Dreams each sprite has a unique animation as well as a unique 'item got' animation. In Dreams however the 'item got' animation is not a list property and is defined elsewhere.

Note that in Keen Dreams more is involved, 'item got' animations are set individually in Keen's collision and some items can have differing numbers of animations. See the relevant section for details.

Animations also relate to the next section, item caches.

Keen Dreams

#Location of item animation list
%patch $813F {$19A8W}

#Sprites used for each item:
%patch $25418 [$00ACW] #100
              [$00AEW] #200
              [$00B0W] #500
              [$00B2W] #1000
              [$00B4W] #2000
              [$00B6W] #5000
              [$00B8W] #1UP
              [$00BAW] #Eye
              [$00A2W] #Flower Power
              [$00BEW] #Flower Pot
              [$00C0W] #Boobus Bomb
              [$00C5W] #Key

Keen 4

#Location of 'item got' animation list
%patch $CD28 {$140CW} #Item sprites
%patch $D019 {$140CW} #Item tiles
%patch $F9A1 {$140CW} #Item sprites (Swimming)

#Sprites used for each item:
%patch $3027C [$00FAW] #Red gem got
              [$00FAW] #Yellow gem got
              [$00FAW] #Blue  gem got
              [$00FAW] #Green gem got
              [$00DBW] #100 got
              [$00DCW] #200 got
              [$00DDW] #500 got
              [$00DEW] #1000 got
              [$00DFW] #2000 got
              [$00E0W] #5000 got
              [$00E1W] #1UP got
              [$00E2W] #Raygun got
%patch $30E10 [$00F2W] #Red gem
              [$00F4W] #Yellow gem
              [$00F6W] #Blue  gem
              [$00F8W] #Green gem
              [$00E3W] #100
              [$00E5W] #200
              [$00E7W] #500
              [$00E9W] #1000
              [$00EBW] #2000
              [$00EDW] #5000
              [$00EFW] #1UP
              [$00FBW] #Raygun

Keen 5

#Items list
%patch $FDE3 {$1A54W} #Item sprites

#Location of 'item got' animation list
%patch $C0D3 {$12EEW} #Item sprites
%patch $C32C {$12EEW} #Item tiles

#Sprites used for each item:
%patch $3162E [$00E8W] #Red gem got
              [$00E8W] #Yellow gem got
              [$00E8W] #Blue  gem got
              [$00E8W] #Green gem got
              [$0C03W] #100 got
              [$00C4W] #200 got
              [$00C5W] #500 got
              [$00C6W] #1000 got
              [$00C7W] #2000 got
              [$00C8W] #5000 got
              [$00C9W] #1UP got
              [$00CAW] #Raygun got
              [$00D1W] #V card got
%patch $31D94 [$00E0W] #Red gem
              [$00E2W] #Yellow gem
              [$00E4W] #Blue  gem
              [$00E6W] #Green gem
              [$00D2W] #100
              [$00D4W] #200
              [$00D6W] #500
              [$00D8W] #1000
              [$00DAW] #2000
              [$00DCW] #5000
              [$00DEW] #1UP
              [$00E9W] #Ammo
              [$00CFW] #V card

Keen 6

#Location of item animation list
%patch $F424  {$1A78W} #Items
%patch $10C7E {$1A78W} #Blooglet spawned items

#Location of items got animation list
%patch $BEC3 {$1286W} #Item sprites
%patch $C113 {$1286W} #Item tiles

#Sprites used for each item:
%patch $31FB4 [$00ACW] #Red gem got
%patch $31FB6 [$00ACW] #Yellow gem got
%patch $31FB8 [$00ACW] #Blue gem got
%patch $31FBA [$00ACW] #Green gem got
%patch $31FBC [$008AW] #Soda got
%patch $31FBE [$008BW] #Iceblock got
%patch $31FC0 [$008CW] #Sundae got
%patch $31FC2 [$008DW] #Cola got
%patch $31FC4 [$008EW] #Split got
%patch $31FC6 [$008FW] #Pizza got
%patch $31FC8 [$0090W] #Viva Queen got
%patch $31FCA [$0091W] #Raygun got

%patch $327A8 [$00A4W] #Red gem
%patch $327AA [$00A6W] #Yellow gem
%patch $327AC [$00A8W] #Blue gem
%patch $327AE [$00AAW] #Green gem
%patch $327B0 [$0096W] #Soda
%patch $327B2 [$0098W] #Iceblock
%patch $327B4 [$009AW] #Sundae
%patch $327B6 [$009CW] #Cola
%patch $327B8 [$009EW] #Split
%patch $327BA [$00A0W] #Pizza
%patch $327BC [$00A2W] #Viva Queen
%patch $327BE [$00ADW] #Raygun


Item caches used

Items do not set their own caches when spawned, as most sprites do, but instead have yet another list of values that govern which cache from the 'cache list' For example, in Keen 4 the Soda uses the second cache on the list. Normally this list shouldn't need to be altered, since each item's individual cache start\end can be patched instead.

Notice that the four gems all share the same cache, this is probably because they share the same 'item got' animation.

The location of the list is a very complicated issue that depends on the items initiations. Some 'odd' items like Keen 4's 'IF ammo' will use the correct value of their cache entry. (In the case of the IF ammo it's $2EE70 + $19D2 = $30842, which is the last entry in the list.) But most will use a value and an offset. The offset must be flipped, then doubled, then added to the value.

As an example the two variables in Keen 4 are $FFC7W and $194AW. To find the actual location of the list we have to flip the offset. (This can be done by taking it away from $10000; $10000 - $FFC7 = $39.) Then it is doubled (To get $72) and added to the location. ($194A + $72 = $19BC.) That value in the text segment is the item list location. ($19BC + $2EE70 = $3082C.)

Fortunately, if you have to change the list location it can usually be done by changing the item location values by as much as you've moved the list, avoiding the tedious offset calculations entirely.

Keen 4

#Cache list location
%patch $ED98 [$FFC7W] #Item offset
%patch $EDAE {$194AW} #Item location
%patch $ECBE {$19D2W} #IF ammo location

#Item cache list
%patch $3082C [$001EW] #Red gem
              [$001EW] #Yellow gem
              [$001EW] #Blue gem
              [$001EW] #Green gem
              [$0002W] #100
              [$0003W] #200
              [$0004W] #500
              [$0005W] #1000
              [$0006W] #2000
              [$0007W] #5000
              [$0008W] #1Up
              [$0009W] #Raygun

Keen 5

#Cache list location
%patch $F212 [$FFC7W] #Item offset
%patch $F237 [$FFC6W] #V card offset
%patch $F226 {$17CAW} #Item location

#Item cache list
%patch $31B7C [$000DW] #Red gem
              [$000DW] #Yellow gem
              [$000DW] #Blue gem
              [$000DW] #Green gem
              [$0006W] #100
              [$0007W] #200
              [$0008W] #500
              [$0009W] #1000
              [$000AW] #2000
              [$000BW] #5000
              [$000CW] #Vitalin keg
              [$000EW] #Raygun
              [$0021W] #V card

Keen 6

#Cache list location
%patch $E737 [$FFC7W] #Item offset
%patch $E74B {$17D8W} #Item location

#Item cache list
%patch $3257A [$0009W] #Red gem
              [$0009W] #Yellow gem
              [$0009W] #Blue gem
              [$0009W] #Green gem
              [$0002W] #100
              [$0003W] #200
              [$0004W] #500
              [$0005W] #1000
              [$0006W] #2000
              [$0007W] #5000
              [$0008W] #Viva Queen
              [$000AW] #Raygun
              [$000AW] #IF Raygun


Sounds items make when got

Items also make different sounds when acquired. In Keen Vorticons the sounds are pretty limited and tile-based. In Keen Galaxy and Dreams by contrast the sounds are a list property. In Keen Dreams a mixed approach is taken; most items use sprite-based coded sounds. They are included here for completeness.

Keen Dreams

#Sounds items make when got:
%patch $76B2 [$07]     #Get points sound
%patch $76E6 [$12]     #1Up got sound
%patch $770A [$12]     #Eye got sound
%patch $773F [$06]     #Flower Power got sound
%patch $7763 [$06]     #Flower Pot got sound
%patch $7788 [$08]     #Boobus Bombs got sound
%patch $77B0 [$17]     #Key got sound

Keen 4

#Location of sound list
%patch $CD0E {$13DCW} #Item sprites
%patch $CF9D {$13DCW} #Item tiles
%patch $F987 {$13DCW} #Item sprites (Swimming)

#Sounds items make when got:
%patch $3024C [$0013W] #Red gem
%patch $3024E [$0013W] #Yellow gem
%patch $30250 [$0013W] #Blue gem
%patch $30252 [$0013W] #Green gem
%patch $30254 [$0008W] #100 item
%patch $30256 [$0008W] #200 item
%patch $30258 [$0008W] #500 item
%patch $3025A [$0008W] #1000 item
%patch $3025C [$0008W] #2000 item
%patch $3025E [$0008W] #5000 item
%patch $30260 [$0011W] #1UP bottle
%patch $30262 [$0009W] #Raygun

Keen 5

#Sounds items make when got:
%patch $315FA [$0013W] #Red gem
%patch $315FC [$0013W] #Yellow gem
%patch $315FE [$0013W] #Blue gem
%patch $31600 [$0013W] #Green gem
%patch $31602 [$0008W] #100
%patch $31604 [$0008W] #200
%patch $31606 [$0008W] #500
%patch $31608 [$0008W] #1000
%patch $3160A [$0008W] #2000
%patch $3160C [$0008W] #5000
%patch $3160E [$0011W] #100 1UP
%patch $31610 [$0009W] #Raygun
%patch $31612 [$0037W] #V card

Keen 6

#Sounds items make when got:
%patch $31F84 [$0013W] #Red gem
%patch $31F86 [$0013W] #Yellow gem
%patch $31F88 [$0013W] #Blue gem
%patch $31F8A [$0013W] #Green gem
%patch $31F8C [$0008W] #100
%patch $31F8E [$0008W] #200
%patch $31F90 [$0008W] #500
%patch $31F92 [$0008W] #1000
%patch $31F94 [$0008W] #2000
%patch $31F96 [$0008W] #5000
%patch $31F98 [$0011W] #100 1UP
%patch $31F9A [$0009W] #Raygun


Don't play item sounds

These patches stop all item sprites or tiles (or both) sound being played. This means that all items of all types will be silent when obtained. As a list property there is no way to block individual item sounds. (Except giving them a very quiet sound.)

In Keen Dreams however individual sounds can be blocked without affecting others.

Keen Dreams

%patch $76B1 $EB $09 #Don't play Get points sound
%patch $76E5 $EB $09 #Don't play 1Up got sound
%patch $7709 $EB $09 #Don't play Eye got sound
%patch $773E $EB $09 #Don't play Flower Power got sound
%patch $7762 $EB $09 #Don't play Flower Pot got sound
%patch $7787 $EB $09 #Don't play Boobus Bombs got sound
%patch $77AF $EB $09 #Don't play Key got sound

Keen 5

#Don't play item sounds
%patch $C0BB $EB $03 #Don't play item sprites got sounds
%patch $C2B2 $EB $03 #Don't play item tiles got sounds

Keen 6

#Don't play item sounds
%patch $BEAB $EB $03 #Don't play item sprites got sounds
%patch $C099 $EB $03 #Don't play item tiles got sounds


Amount of shots given by Neural Stunners

This changes the amount of shots a raygun gives Keen on easy, medium and hard. This is controlled by a list which is called several times potentially allowing the creation of several kinds of ammunition. See also Patch:Neural stunner.

Keen 4

#Call ammo list
%patch $CD69 {$13D4W} #Ammo sprites got
%patch $CFDE {$13D4W} #Ammo tiles got
%patch $F9E2 {$13D4W} #Keen swimming related?

#Ammo stunners give Keen
%patch $30246 [$0008W] #Easy
              [$0005W]  #Medium
              [$0005W]  #Hard

Keen 5

#Ammo stunners give Keen
%patch $315F4 [$0008W]  #Easy
              [$0005W]  #Medium
              [$0005W]  #Hard

Keen 6

#Ammo stunners give Keen
%patch $31F7E [$0008W]  #Easy
              [$0005W]  #Medium
              [$0005W]  #Hard


Sprite Properties

In the Keen Galaxy and Dreams games all item sprites are controlled by a single sprite structure. This involves something that sits still and uses two animation frames. Item sprites tend to be used rarely in levels, when a tile-based item cannot be placed. (They use up far more memory than tile based items.)

By altering their properties it is possible to change many aspects of their behavior. However any changes will affect all sprites in the game.


Sprite Type

Items use sprite type 4 or 5 (depending on game) which is used only by items. This is listed as the 'gem' property, but in fact is responsible for all items being collectable (Their specific sprite value determines what is given to Keen.) This severely limits what these patches can do.

As well as items themselves there are a few 'associate sprites' related to items, items got, collectables got and so on. These have property 1, designed for sprites that do not last long.

Item sprite types

#Keen 4
%patch $FC45  [$04] #Items
%patch $CD1A  [$01] #Item sprites got
%patch $F993  [$01] #Item sprites got by swimming Keen
%patch $CFF6  [$01] #Item tiles got
%patch $D0A9  [$01] #100 drop 1UP
%patch $FCAB  [$01] #Raindrop got

#Keen 5
%patch $FDC1  [$05] #Items
%patch $C0C5  [$01] #Item sprites got
%patch $C309  [$01] #Item tiles got
%patch $C3BC  [$01] #100 Vitalin 1UP
%patch $FE27  [$01] #Vitalin v

#Keen 6
%patch $F402  [$05] #Items
%patch $10C59 [$05] #Blooglet gems
%patch $BEB5  [$01] #Item sprites got
%patch $C0F0  [$01] #Item tiles got
%patch $C1A3  [$01] #100 Viva 1UP
%patch $F468  [$01] #Viva splash

#Keen Dreams
%patch $810F [$04] #Items
%patch $7EDB [$01] #Items got


Sprite Actions

Keen Galaxy games are largely the same, item-wise. Items are spawned in a level in the first of their two animating actions. They will then sit and cycle in this two-action loop indefinitely. When Keen touches an item it will change to the 'obtained' action before vanishing.

The same action is generated when Keen acquires tile-based based items, and also in an interesting case when he obtains 100 'collectable' items (Such as raindrops in Keen 4). This produces an extra '1UP' sprite to show the player an extra life has been gained.

When collectable item tiles are obtained a different 'got' sprite appears. This leads to a three-action sequence before vanishing.


Keen 4

Note that in Keen 4 there is a little extra; Keen swimming has his own sprite interaction separate from regular Keen. This means that items sprites (but not tiles) he interacts with produce a 'got' sprite that is nominally different.

Keen 4 Actions:
$1EECW #Items 1
$1F0AW #Items 2
$1F28W #Items got
$1F46W #Raindrop splash 1
$1F64W #Raindrop splash 2
$1F82W #Raindrop splash 3

Keen 4

#Spawn items
%patch $FC7D  [$1EECW]

#Items loop
%patch $30D78 [$1F0AW]
%patch $30D96 [$1EECW]

#When item sprites are got
%patch $CD70  [$1F28W]

#When item sprites are got by swimming Keen
%patch $F9E9  [$1F28W]

#Sprite produced when item tiles are got
%patch $D026  [$1F28W]

#Extra sprite shown when player gets 100 drops 1UP
%patch $D0D0  [$1F28W]

#'Got' item vanishes
%patch $30D96 [$0000W]

#Sprite produced when raindrops are got
%patch $FCC0  [$1F46W]

#Raindrop splash sequence
%patch $30DD2 [$1F64W]
%patch $30DF0 [$1F82W]
%patch $30E0E [$0000W]


Keen 5

Keen 5 contains unused code for an item that works like the Blooglets gems in Keen 6. This is an item that is spawned from a defeated enemy and falls to the ground, at which point it becomes a regular item. However the game contains no enemies to produce this kind of item, making it invalid.

Keen 5 Actions:
$1946W #Items 1
$1964W #Items 2
$1982W #Blooglet gem-type item 1
$19A0W #Blooglet gem-type item 2
$19BEW #Items got
$19DCW #Vitalin got 1
$19FAW #Vitalin got 2
$1A18W #Vitalin got 3
$1A36W #Vitalin got 4

Keen 5

#Spawn items
%patch $FDF9  [$1946W]

#Items loop
%patch $31CA2 [$1964W]
%patch $31CC0 [$1946W]

#When item sprites are got
%patch $C129  [$19BEW]

#Sprite produced when item tiles are got
%patch $C339  [$19BEW]

#Extra sprite shown when player gets 100 Vitalin 1UP
%patch $C3E3  [$19BEW]

#'Got' item vanishes
%patch $31D1A [$0000W]

#Sprite produced when Vitalin are got
%patch $FE3C  [$19DCW]

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

#Blooglet gem-type item hits ground (Not used)
%patch $FE75  [$1946W]

#Blooglet gem-type item loop (Not used)
%patch $31CDE [$19A0W]
%patch $31CFC [$1982W]


Keen 6

Keen 6 has an additional type of item, the gems dropped by Blooglets. When produced this item has its own two-action loop while it flies through the air. On hitting the ground it transforms into a regular item.

Keen 6 Actions:
$196AW #Items 1
$1988W #Items 2
$19A6W #Blooglet gem 1
$19C4W #Blooglet gem 2
$19E2W #Items got
$1A00W #Viva got 1
$1A1EW #Viva got 2
$1A3CW #Viva got 3
$1A5AW #Viva got 4

Keen 6

#Spawn items
%patch $F43A  [$196AW]

#Items loop
%patch $326B6 [$1988W]
%patch $326D4 [$196AW]

#When item sprites are got
%patch $BF0B  [$19E2W]

#Sprite produced when item tiles are got
%patch $C120  [$19E2W]

#Extra sprite shown when player gets 100 drops 1UP
%patch $C1CA  [$19E2W]

#'Got' item vanishes
%patch $3272E [$0000W]

#Sprite produced when Viva are got
%patch $F47D  [$1A00W]

#Viva splash sequence
%patch $3274C [$1A1EW]
%patch $3276A [$1A3CW]
%patch $32788 [$1A5AW]
%patch $327A6 [$0000W]

#Spawn Blooglet gem
%patch $10C94 [$19A6W]

#Blooglet gem airborne loop
%patch $326F2 [$19C4W]
%patch $32710 [$19A6W]

#Blooglet gem hits ground
%patch $F4B6 [$196AW]


Keen Dreams

Keen Dreams uses a prototype system of items and as such has only one item action as well as an item got action. All items of all kinds are sprites and spawned using the same code. However items interact with Keen in many different ways instead of a single generic manner. As such the item got actions occur in many different manners dictated by Keen's sprite collision.

Notice that items, though they have two animations, have a single action in this game.

Boobus Bombs that are thrown by the player and don't hit anything will return to an item-like state so they can be picked up and reused. This is the only other case of item spawning in the game.

Keen Dreams Actions:
$196CW #Items
$198AW #Items got

Keen Dreams

#Dropped Boobus Bombs turn into items
%patch $6955 [$196CW]

#Spawn items
%patch $8169 [$196CW]

#Items keep being items
%patch $253F8 [$196CW]

#Get items
%patch $76D6 [$198AW] #Point items
%patch $76FA [$198AW] #1UP
%patch $772F [$198AW] #Eye
%patch $7753 [$198AW] #Flower Power
%patch $7778 [$198AW] #Flower Pot
%patch $77A0 [$198AW] #Boobus Bomb
%patch $77C4 [$198AW] #Key

#Got items vanish
%patch $25416 [$0000W]


Sprite Behavior

The item's behavior switches the item's animation between its two frames and nothing else. It is used only by items and not the various 'got actions'. In Keen Dreams there is only one item action using this behavior which operates slightly differently.

In Keen 5 and 6 there are 'Blooglet gem' type items whose behavior makes them fly through the air when produced. This code is present in both games despite the fact that Keen 5 has no enemies that drop items.

Keen 4

#Items
%patch $30D6C $0FA8024ERL #Item
%patch $30D8A $0FA8024ERL #Item

#Items got
%patch $30DA8 $00000000L

#Raindrops got
%patch $30DC6 $00000000L
%patch $30DE4 $00000000L
%patch $30E02 $00000000L

Keen 5

#Items
%patch $31C96 $0F92052ARL #Item
%patch $31CB4 $0F92052ARL #Item

#Unused Blooglet gem-type item
%patch $31CD2 $0F920545RL #Fall
%patch $31CF0 $0F920545RL #Fall

#Items got
%patch $31D0E $00000000L

#Vitalin got
%patch $31D2C $00000000L
%patch $31D4A $00000000L
%patch $31D68 $00000000L
%patch $31D86 $00000000L

Keen 6

#Items
%patch $326AA $0EFC04CBRL #Item
%patch $326C8 $0EFC04CBRL #Item

#Blooglet gems
%patch $326E6 $0EFC04E6RL #Fall
%patch $32704 $0EFC04E6RL #Fall

#Items got
%patch $32722 $00000000L

#Viva got
%patch $32740 $00000000L
%patch $3275E $00000000L
%patch $3277C $00000000L
%patch $3279A $00000000L

Keen Dreams

#Items
%patch $253EC $07C5052BRL

#Items got
%patch $2540A $00000000L


Speed and Jump Height

Items do not move by default either in their code or animation motion. The got items action rises and this rising speed is controlled by its animation motion.

Keen 4

#Items
%patch $30D68 [$0000W $0000W]
%patch $30D86 [$0000W $0000W]

#Items got
%patch $30DA4 [$0000W $0008W]

#Drop splash
%patch $30DC2 [$0000W $0000W]
%patch $30DE0 [$0000W $0000W]
%patch $30DFE [$0000W $0000W]

Keen 5

#Items
%patch $31C92 [$0000W $0000W]
%patch $31CB0 [$0000W $0000W]

#Unused Blooglet gem-type item
%patch $31CCE [$0000W $0000W]
%patch $31CEC [$0000W $0000W]

#Items got
%patch $31D0A [$0000W $0008W]

#Vitalin got
%patch $31D28 [$0000W $0000W]
%patch $31D46 [$0000W $0000W]
%patch $31D64 [$0000W $0000W]
%patch $31D82 [$0000W $0000W]

Keen 6

#Items
%patch $326A6 [$0000W $0000W]
%patch $326C4 [$0000W $0000W]

#Blooglet gems
%patch $326E2 [$0000W $0000W]
%patch $32700 [$0000W $0000W]

#Items got
%patch $3271E [$0000W $0008W]

#Viva got
%patch $3273C [$0000W $0000W]
%patch $3275A [$0000W $0000W]
%patch $32778 [$0000W $0000W]
%patch $32796 [$0000W $0000W]

Keen Dreams

#Items
%patch $24630 [$0000W $0000W]

#Items got
%patch $25406 [$0000 $0008W]


Sprite Collision

Items, and all actions associated with them, are not meant to interact with other sprites. As such they have no sprite interaction at all.

item sprite collisions -Keen 4

#Items
%patch $30D70 $00000000L
%patch $30D8E $00000000L

#Items got
%patch $30DAC $00000000L

#Raindrop splash
%patch $30DCA $00000000L
%patch $30DE8 $00000000L
%patch $30E06 $00000000L

item sprite collisions -Keen 5

#Items
%patch $31C9A $00000000L
%patch $31CB8 $00000000L

#Unused Blooglet gem-type item
%patch $31CD6 $00000000L
%patch $31CF4 $00000000L

#Items got
%patch $31D12 $00000000L

#Vitalin got
%patch $31D30 $00000000L
%patch $31D4E $00000000L
%patch $31D6C $00000000L
%patch $31D8A $00000000L

item sprite collisions -Keen 6

#Items
%patch $326AE $00000000L
%patch $326CC $00000000L

#Blooglet gems
%patch $326EA $00000000L
%patch $32708 $00000000L

#Items got
%patch $32726 $00000000L

#Viva got
%patch $32744 $00000000L
%patch $32762 $00000000L
%patch $32780 $00000000L
%patch $3279E $00000000L

item sprite collisions -Keen Dreams

#Items
%patch $253F0 $00000000L

#Items got
%patch $2540E $00000000L


Animations

By default sprite actions have no animations as these would interfere with the list of animations used to make sprites appear different. These are listed in the 'list properties' section above. If an actual value is given, then all item sprites will look exactly the same. In Galaxy the animation speed controls the animation speed of all items, or in the case of item got sprites, how long the sprite remains before vanishing.

In Keen 5 and 6 there are also Blooglet gem-type items. These also have no animations for the same reason as regular items.

In Keen Dreams things are slightly different. While item animations are given by a list the 'item got' animations are set individually when an item is obtained, except for the point items which do use a list. By default there is also a single item (the 'eye' item) that has four frames of animation instead of two. It is item type 7 by default, but other, even all, of the items may be given this many animation frames.

Keen 4

#Item animations
%patch $30D5C $0000W $0000W
%patch $30D66 $0014W        #Animation speed
%patch $30D7A $0000W $0000W
%patch $30D84 $0014W        #Animation speed

#Items got animations
%patch $30D98 $0000W $0000W
%patch $30DA2 $0028W        #Time before vanishing

#Raindrops got animations
%patch $30DB6 $00D7W $00D7W
%patch $30DC0 $000AW        #Animation speed
%patch $30DD4 $00D8W $00D8W
%patch $30DDE $000AW        #Animation speed
%patch $30DF2 $00D9W $00D9W
%patch $30DFC $000AW        #Time before vanishing

Keen 5

#Item animations
%patch $31C86 $0000W $0000W
%patch $31C90 $0014W        #Animation speed
%patch $31CA4 $0000W $0000W
%patch $31CAE $0014W        #Animation speed

#Unused Blooglet gem-type item
%patch $31CC2 $0000W $0000W
%patch $31CCC $0014W        #Animation speed
%patch $31CE0 $0000W $0000W
%patch $31CEA $0014W        #Animation speed

#Items got animations
%patch $31CFE $0000W $0000W
%patch $31D08 $0028W        #Time before vanishing

#Vitalin got
%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        #Time before vanishing

Keen 6

#Item animations
%patch $326D6 $0000W $0000W
%patch $326E0 $0014W        #Animation speed
%patch $326F4 $0000W $0000W
%patch $326FE $0014W        #Animation speed

#Blooglet gem animations
%patch $326D6 $0000W $0000W
%patch $326E0 $0014W        #Animation speed
%patch $326F4 $0000W $0000W
%patch $326FE $0014W        #Animation speed

#Item got animation
%patch $32712 $0000W $0000W
%patch $3271C $0028W        #Time before vanishing

#Viva got animations
%patch $32730 $0092W $0092W
%patch $3273A $0008W        #Animation speed
%patch $3274E $0093W $0093W
%patch $32758 $0008W        #Animation speed
%patch $3276C $0094W $0094W
%patch $32776 $0008W        #Animation speed
%patch $3278A $0095W $0095W
%patch $32794 $0008W        #Time before vanishing

Keen Dreams

#Item animations
%patch $253DC $0000W $0000W
%patch $253E6 $0014W        #Animation speed

#Got item animations
%patch $253FA $0000W $0000W
%patch $25404 $0028W        #Time before vanishing

#Got item animations set
%patch $76F3 [$00CDW] #1UP
%patch $7717 [$00CEW] #Eye
%patch $774C [$00CFW] #Flower Power
%patch $7770 [$00D0W] #Flower Pot
%patch $7795 [$00D1W] #Boobus Bomb
%patch $77BD [$00D2W] #Key

#Item(s) that are special
%patch $814D [$07] {$74}

#Number of animation frames special items have
%patch $815F [$0004W]

#No special items
%patch $814B $EB $03


Sounds items make when got

These are a list property, see the first section of this page.


Clipping and foreground

Not only do items have their own values for clipping and foreground, but these are changed when the items are acquired. (Or in the case of item tiles, when a sprite is made when the tile is acquired.) Items themselves have no clipping and a foreground value of 2. This places them in front of 'background' sprites and allows them to be placed in or near solid tiles without any issue.

When items are got their foreground value is set to 3, so that they appear in front of all tiles and the player can always see when they have been collected. (Such as in secret areas.)

An exception to this is the Blooglet gems, which have a clipping of 1 since they must land on the ground. Keen Dreams items also have a clipping of 1 and their foreground is not set. They differ significantly from Galaxy items however.

In Keen Dreams the 'items got' foreground value also affects the King Boobus destroyed smoke, due to the very unique way the game handles foreground values.

Keen 4 item variables

#Item sprites
%patch $FC3C $0000W #Clipping
%patch $FC41 $0002W #Foreground

#Items got
%patch $CD1F $0003W #Item sprite got by regular Keen foreground
%patch $F998 $0003W #Item sprite got by swimming Keen foreground
%patch $CFFB $0003W #Item tiles got foreground
%patch $D039 $0000W #Item tiles got clipping
%patch $D0AE $0003W #Drops 1UP foreground
%patch $D0E3 $0000W #Drops 1UP clipping
%patch $FCA7 $0003W #Drop splash foreground
%patch $FCA2 $0000W #Drop splash clipping

Keen 5 item variables

#Item sprites
%patch $FDB8 $0000W #Clipping
%patch $FDBD $0002W #Foreground

#Items got
%patch $C0CA $0003W #Item sprite got foreground
%patch $C30E $0003W #Item tiles got foreground
%patch $C34C $0000W #Item tiles got clipping
%patch $C3C1 $0003W #Vitalin 1UP foreground
%patch $C3F6 $0000W #Vitalin 1UP clipping
%patch $FE23 $0003W #Vitalin V foreground
%patch $FE1E $0000W #Vitalin V clipping

Keen 6 item variables

#Item sprites
%patch $F3F9 $0000W #Clipping
%patch $F3FE $0002W #Foreground

#Blooglet gems
%patch $10C50 $0001W #Clipping
%patch $10C55 $0002W #Foreground

#Items got
%patch $BEBA $0003W #Item sprite got foreground
%patch $C0F5 $0003W #Item tiles got foreground
%patch $C133 $0000W #Item tiles got clipping
%patch $C1A8 $0003W #Viva 1UP foreground
%patch $C1DD $0000W #Viva 1UP clipping
%patch $F464 $0003W #Viva splash foreground
%patch $F45F $0000W #Viva splash clipping

Keen dreams item variables

#Items
%patch $810B $0001W #Clipping

#Items got\Boobus smoke
%patch $7E85 $0003W #Foreground


Sprite-tile interaction

In Galaxy items of all kinds do not need to interact with tiles and so use a basic tile collision that simply ensures they stay visible. In Dreams items have their own special tile interaction.

In Keen 5 and 6 Blooglet gem-type items also don't interact with tiles; their 'land on the ground' code is actually covered by their behavior, which is most unusual.

Keen 4

#Items
%patch $30D74 $09DC176ERL
%patch $30D92 $09DC176ERL

#Items got
%patch $30DB0 $09DC176ERL

#Raindrop splash
%patch $30DCE $09DC176ERL
%patch $30DEC $09DC176ERL
%patch $30E0A $09DC176ERL

Keen 5

#Items
%patch $31C9E $090B17B5RL
%patch $31CBC $090B17B5RL

#Unused Blooglet gem-type item
%patch $31CDA $090B17B5RL
%patch $31CF8 $090B17B5RL

#Items got
%patch $31D16 $090B17B5RL

#Vitalin got
%patch $31D34 $090B17B5RL
%patch $31D52 $090B17B5RL
%patch $31D70 $090B17B5RL
%patch $31D8E $090B17B5RL

Keen 6

#Items
%patch $326B2 $08F4180ARL
%patch $326D0 $08F4180ARL

#Blooglet gems
%patch $326EE $08F4180ARL
%patch $3270C $08F4180ARL

#Items got
%patch $3272A $08F4180ARL

#Viva got
%patch $32748 $08F4180ARL
%patch $32766 $08F4180ARL
%patch $32784 $08F4180ARL
%patch $327A2 $08F4180ARL

Keen Dreams

#Items
%patch $253F4 $07C50205RL

#Items got
%patch $25412 $07C5022DRL


Action type

Most item actions are quite basic and so are type 0. The exception is the 'item got' action, which must rise smoothly upwards and so it type 1. Blooglet gem-type items must fall smoothly and animate, as well as reacting to the ground. These complex actions are type 3.

Sprite action types -Keen 4

#Items
%patch $30D60 [$0000W]
%patch $30D7E [$0000W]

#Items got
%patch $30D9C [$0001W]

#Raindrop splash
%patch $30DBA [$0000W]
%patch $30DD8 [$0000W]
%patch $30DF6 [$0000W]

Sprite action types -Keen 5

#Items
%patch $31C8A [$0000W]
%patch $31CA8 [$0000W]

#Unused Blooglet gem-type item
%patch $31CC6 [$0003W]
%patch $31CE4 [$0003W]

#Items got
%patch $31D02 [$0001W]

#Vitalin got
%patch $31D20 [$0000W]
%patch $31D3E [$0000W]
%patch $31D5C [$0000W]
%patch $31D7A [$0000W]

Sprite action types -Keen 6

#Items
%patch $3269E [$0000W]
%patch $326BC [$0000W]

#Blooglet gems
%patch $326DA [$0003W]
%patch $326F8 [$0003W]

#Items got
%patch $32716 [$0001W]

#Viva got
%patch $32734 [$0000W]
%patch $32752 [$0000W]
%patch $32770 [$0000W]
%patch $3278E [$0000W]

Sprite action types -Keen Dreams

#Items
%patch $253E0 [$0000W]

#Items got
%patch $253FE [$0001W]


Deprotect and stick to ground

Items 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 4

#Items
%patch $30D62 [$0000W $0000W]
%patch $30D80 [$0000W $0000W]

#Items got
%patch $30D9E [$0000W $0000W]
%patch $30DBC [$0000W $0000W]
%patch $30DDA [$0000W $0000W]
%patch $30DF8 [$0000W $0000W]

Sprite deprotect, stick -Keen 5

#Items
%patch $31C8C [$0000W $0000W]
%patch $31CAA [$0000W $0000W]

#Unused Blooglet gem-type item
%patch $31CC8 [$0000W $0000W]
%patch $31CE6 [$0000W $0000W]

#Items got
%patch $31D04 [$0000W $0000W]

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

Sprite deprotect, stick -Keen 6

#Items
%patch $326A0 [$0000W $0000W]
%patch $326BE [$0000W $0000W]

#Blooglet gems
%patch $326DC [$0000W $0000W]
%patch $326FA [$0000W $0000W]

#Items got
%patch $32718 [$0000W $0000W]

#Viva got
%patch $32736 [$0000W $0000W]
%patch $32754 [$0000W $0000W]
%patch $32772 [$0000W $0000W]
%patch $32790 [$0000W $0000W]

Sprite deprotect, stick -Keen Dreams

#Items
%patch $253E2 [$0000W $0000W]

#Items got
%patch $25400 [$0000W $0000W]


Sprite spawn code

The item spawn code is perhaps the most complex attribute of an item. As such this section is divided up by game as well as providing a section on how item spawning works in general.


General principles

Only in Keen Galaxy and Dreams are items sprites and therefore only in those games do they have a spawning code. All sprites in a game use the same spawning code and usually the same initiation code (with some small exceptions discussed below.) The initiation codes in turn all start with a 'first item value' that gives each item its 'number'

The value is in fact a negative number (highlighted in brown in this section.) equal to the infoplane value of the first item. Thus if right facing Keen (Infoplane value 1) were the first item this value would be -1 or $FFFF. The Item's number is its infoplane value minus the first item value. Thus the first item will have a number of 0. Any items not spawned when the level is started must have their number explicitly set or they too will be number 0. (So a sprite that shoots items for example will produce red gems, item 0, by default.)

The first item value can be different for different initialization codes. This is seen for example in Keen 5 where the V Card has a FIV one less than the other items. (This means the V Card is a type 14 item, since the V card's infoplane value is 13 higher than the first Item.) This means that it is possible to have several sprites spawn as the same type of item under different circumstances. (For example easy, medium or hard items.)

The Item's 'cache' that is set in the initialization code is not a proper cache as such and is used when the item's more specific number-based cache is set later on. each item has its own cache, usually of two animations.

All Items use the same spawning code which insures that they do not appear in front of tiles, have no clipping and use the generic item action.


Keen 4

There are a large number of item initiation pointers. These point to two different initiation codes. The 'normal' item initiation defines the item type by taking the pointer value, subtracting $FFFFW and adding $FFC7W. (The net result here is to subtract $38 or 56 from the pointer value. This basically just sets the first item type in the infoplane tileset.) Note that if this is adjusted the second blue value, $194AW will also need to be adjusted by twice the amount, otherwise a caching error will occur.

The alternative 'IF ammo' initiation checks to see if Keen has less than five shots and, if so, spawns a type $0B (12) item. (The raygun.) Both initiation codes set the cache in $C7 $06 $CB3BW $0001W. This caches all items and item got bitmaps.

The spawning code is more complex. In the spawning code the last blue highlighted value is the sprite action the Item uses as it proceeds to act in-level. $C7 $07 $xxxxW sets the sprite type and $C7 $20 $xxxxW sets the foreground value.

$C7 $47 $10 $xxxxW is the vertical direction the sprite starts moving in, either $0001W (Facing down), $FFFFW (Facing up) or $0000W (Neither, never used.) $C7 $47 $0E $xxxxW is the horizontal direction. The Items always start the level moving up, the direction that is passed on to their got actions. If this is changed the got items will either sit still or sink instead of rising.

The spawn code contains and is thus incompatible with a number of patches elsewhere on this page.

Keen 4

#Location of initiation codes
%patch $EEC7 [$03B2W] #IF Ammo (At $ECA2)
%patch $EEF5 [$04A4W] #Red Gem (At $ED94)
%patch $EEF7 [$04A4W] #Yellow Gem (At $ED94)
%patch $EEF9 [$04A4W] #Blue Gem (At $ED94)
%patch $EEFB [$04A4W] #Green Gem (At $ED94)
%patch $EEFD [$04A4W] #100 Pts (At $ED94)
%patch $EEFF [$04A4W] #200 pts (At $ED94)
%patch $EF01 [$04A4W] #500 Pts (At $ED94)
%patch $EF03 [$04A4W] #1000 Pts (At $ED94)
%patch $EF05 [$04A4W] #2000 Pts (At $ED94)
%patch $EF07 [$04A4W] #5000 Pts (At $ED94)
%patch $EF09 [$04A4W] #1UP (At $ED94)
%patch $EF0B [$04A4W] #Raygun (At $ED94)

#IF Ammo initiation code
%patch $ECA2 $83 $3E {$7A58W}  [$05] {$7C }$03 $E9 $0151W  $B8 [$000BW]  $50 $FF $76 #Here check Keen's ammo < 5, ammo is 12th item kind
             $FC $57 $9A $0FA801A3RL     $83 $C4 $06 $8B $1E [$19D2W]  $D1 $E3
             $C7 $87 $CB3BW  $0001W  $E9 $0132W  $E9 $012FW

#Items initiation code
%patch $ED94 $8B $46 $F8 $05 [$FFC7W]  $50 $FF $76 $FC $57 $9A $0FA801A3RL
             $83 $C4 $06 $8B $5E $F8 $D1 $E3 $8B $9F [$194AW]  $D1 $E3 $C7 $87
             $CB3BW  $0001W  $EB $43

#Items spawn code (Includes low-ammo)
%patch $FC23 $55 $8B $EC $56 $8B $76 $0A $33 $C0 $50 $9A $06BD1E11RL     $83
             $C4 $02 $8B $1E $D8 $A7 $C7 $47 $06 [$0000W]  $C7 $47 $20 [$0002W]
             $C7 $07 [$0004W]  $8B $46 $06 $B1 $08 $D3 $E0 $89 $47 $0A $8B $46
             $08 $D3 $E0 $89 $47 $0C $C7 $47 $10 [$FFFFW]  $89 $77 $3E $8B $DE
             $D1 $E3 $8B $87 [$1FA0W]  $8B $1E $D8 $A7 $89 $47 $1E $89 $47 $40
             $8B $47 $40 $05 [$0002W]  $89 $47 $42 $B8 [$1EECW]  $50 $53 $9A
         $09DC118CRL     $83 $C4 $04 $5E $5D $CB


Keen 5

There are a large number of item initiation pointers. These point to three different initiation codes. The 'normal' item initiation defines the item type by taking the pointer value, subtracting $FFFFW and adding $FFC6W. (The net result here is to subtract $39 or 57 from the pointer value. This basically just sets the first item type in the infoplane tileset.) Note that if this is adjusted the second blue value, $17CAW will also need to be adjusted by twice the amount, otherwise a caching error will occur.

The alternative 'IF ammo' initiation checks to see if Keen has less than five shots and, if so, set's the item's offset to $44 before going to the standard item spawn code. This offset, once the item offset is subtracted from it, will spawn a type 12 item (Raygun.)

Finally there's the V card initiation. This is essentially identical to the standard item initiation except it has an offset of $FFC6W, putting the V card at the head of all item lists. Both initiation codes set the cache in $C7 $06 $C25FW $0001W. This caches all items and item got bitmaps.

The spawning code is more complex. In the spawning code the last blue highlighted value is the sprite action the Item uses as it proceeds to act in-level. $C7 $02 $xxxxW sets the sprite activity, $C7 $07 $xxxxW sets the sprite type, $C7 $20 $xxxxW sets the foreground value. Finally $D3 $E0 $05 $xxxx is how far down (Or more usually up) the sprite is spawned from where it is placed. This is necessary for sprites that walk on the ground as they can only be placed in the level at multiples of 16 pixels high while their actual height can be anything.

$C7 $47 $10 $xxxxW is the vertical direction the sprite starts moving in, either $0001W (Facing down), $FFFFW (Facing up) or $0000W (Neither, never used.) $C7 $47 $0E $xxxxW is the horizontal direction. The Items always start the level moving down, possibly this relates to how the item got sprites move upwards.

The spawn codes contain and is thus incompatible with a number of patches elsewhere on this page.

Keen 5

#Location of initiation codes
%patch $F536 [$04BEW] #Red gem (At $F20E)
%patch $F538 [$04BEW] #Yellow gem (At $F20E)
%patch $F53A [$04BEW] #Green gem (At $F20E)
%patch $F53C [$04BEW] #Blue gem (At $F20E)
%patch $F53E [$04BEW] #100 points (At $F20E)
%patch $F540 [$04BEW] #200 points (At $F20E)
%patch $F542 [$04BEW] #500 points (At $F20E)
%patch $F544 [$04BEW] #1000 points (At $F20E)
%patch $F546 [$04BEW] #2000 points (At $F20E)
%patch $F548 [$04BEW] #5000 points (At $F20E)
%patch $F54A [$04BEW] #1UP (At $F20E)
%patch $F54C [$04BEW] #Raygun (At $F20E)
%patch $F54E [$04AFW] #Low ammo raygun (At $F1FF)
%patch $F550 [$04E3W] #V card (At $F233)

#Low ammo raygun (Uses following item initiation)
%patch $F1FF $83 $3E [$6F56W] {$05 $7C} $03 $E9 $019EW  $C7 $46 $FA [$0044W]

#Items
%patch $F20E $8B $46 $FA $05 [$FFC7W]  $50 $57 $56 $9A {$0F92047FRL}     $83 $C4
             $06 $8B $5E $FA $D1 $E3 $8B $9F [$17CAW]  $D1 $E3 $C7 $87 $C25FW
             $0001W  $E9 $0174W

#V card
%patch $F233 $8B $46 $FA $05 [$FFC6W]  $50 $57 $56 $9A {$0F92047FRL}     $83 $C4
             $06 $8B $5E $FA $D1 $E3 $8B $9F [$17C8W]  $D1 $E3 $C7 $87 $C25FW
             $0001W  $E9 $014FW

#Item spawning code (Includes V card and low ammo)
%patch $FD9F $55 $8B $EC $56 $8B $76 $0A $33 $C0 $50 $9A $06B91DCDRL     $83
             $C4 $02 $8B $1E $40 $9E $C7 $47 $06 [$0000W]  $C7 $47 $20 [$0002W]
             $C7 $07 [$0005W]  $8B $46 $06 $B1 $08 $D3 $E0 $89 $47 $0A $8B $46
             $08 $D3 $E0 $89 $47 $0C $C7 $47 $10 [$FFFFW]  $89 $77 $3E $8B $DE
             $D1 $E3 $8B $87 [$1A54W]  $8B $1E $40 $9E $89 $47 $1E $89 $47 $40
             $8B $47 $40 $05 [$0002W]  $89 $47 $42 $B8 [$1946W]  $50 $53 $9A $090B11C4RL
                     $83 $C4 $04 $5E $5D $CB


Keen 6

There are a large number of item initiation pointers. These point to three different initiation codes. The 'normal' item initiation defines the item type by taking the pointer value, subtracting $FFFFW and adding $FFC6W. (The net result here is to subtract $39 or 57 from the pointer value. This basically just sets the first item type in the infoplane tileset.) Note that if this is adjusted the second blue value, $17D8W will also need to be adjusted by twice the amount, otherwise a caching error will occur.

The alternative 'IF ammo' initiation checks to see if Keen has less than five shots and, if so, set's the item's offset to $44 before going to the standard item spawn code. This offset, once the item offset is subtracted from it, will spawn a type 12 item (Raygun.)

The main initiation code sets the cache in $C7 $06 $CCFFW $0001W. This caches all items and item got bitmaps.

The spawning code is more complex. In the spawning code the last blue highlighted value is the sprite action the Item uses as it proceeds to act in-level. $C7 $02 $xxxxW sets the sprite activity, $C7 $07 $xxxxW sets the sprite type, $C7 $20 $xxxxW sets the foreground value. Finally $D3 $E0 $05 $xxxx is how far down (Or more usually up) the sprite is spawned from where it is placed. This is necessary for sprites that walk on the ground as they can only be placed in the level at multiples of 16 pixels high while their actual height can be anything.

$C7 $47 $10 $xxxxW is the vertical direction the sprite starts moving in, either $0001W (Facing down), $FFFFW (Facing up) or $0000W (Neither, never used.) $C7 $47 $0E $xxxxW is the horizontal direction. The Items always start the level moving down, possibly this relates to how the item got sprites move upwards.

The spawn codes contain and is thus incompatible with a number of patches elsewhere on this page.

Keen 6

#Location of initiation codes
%patch $E9C2 [$0313W] #Red gem (At $E733)
%patch $E9C4 [$0313W] #Yellow gem (At $E733)
%patch $E9C6 [$0313W] #Green gem (At $E733)
%patch $E9C8 [$0313W] #Blue gem (At $E733)
%patch $E9CA [$0313W] #100 points (At $E733)
%patch $E9CC [$0313W] #200 points (At $E733)
%patch $E9CE [$0313W] #500 points (At $E733)
%patch $E9D0 [$0313W] #1000 points (At $E733)
%patch $E9D2 [$0313W] #2000 points (At $E733)
%patch $E9D4 [$0313W] #5000 points (At $E733)
%patch $E9D6 [$0313W] #1UP (At $E733)
%patch $E9D8 [$0313W] #Ammo (At $E733)
%patch $E9DA [$0304W] #IF ammo (At $E724)

#Low ammo raygun (Uses following item initiation)
%patch $E724 $83 $3E {$7590W}  [$05] {$7C} $03 $E9 $0199W  $C7 $46 $FA [$0044W]

#Item initiation code
%patch $E733 $8B $46 $FA $05 [$FFC7W]  $50 $57 $56 $9A $0EFC0420RL     $83 $C4
             $06 $8B $5E $FA $D1 $E3 $8B $9F [$17D8W]  $D1 $E3 $C7 $87 $CCFFW
             $0001W  $E9 $016FW 

#Item spawn code
%patch $F3E0 $55 $8B $EC $56 $8B $76 $0A $33 $C0 $50 $9A $069A1E25RL     $83
             $C4 $02 $8B $1E $66 $A9 $C7 $47 $06 [$0000W]  $C7 $47 $20 [$0002W]
             $C7 $07 [$0005W]  $8B $46 $06 $B1 $08 $D3 $E0 $89 $47 $0A $8B $46
             $08 $D3 $E0 $89 $47 $0C $C7 $47 $10 [$FFFFW]  $89 $77 $3E $8B $DE
             $D1 $E3 $8B $87 [$1A78W]  $8B $1E $66 $A9 $89 $47 $1E $89 $47 $40
             $8B $47 $40 $05 [$0002W]  $89 $47 $42 $B8 [$196AW]  $50 $53 $9A 
     $08F41219RL     $83 $C4 $04 $5E $5D $CB


Keen Dreams

There are twelve types of item, each giving the player something different. Notice that the Boobus Bomb uses a slightly different segment of initiation code; this does nothing more than set a variable so that Keen is warned there are bombs when entering a level, it then proceeds to use the item initiation code. In the initiation codes no cache is set; items share Keen's cache which is always loaded. Finally note the blue value, this sets the item's 'type' (100, 200, life, etc.) as the item's infoplane value minus $15.

The last blue highlighted value is the sprite action the sprite uses as it proceeds to act in-level. $C7 $07 $xxxxW sets the sprite type, $C7 $47 $06 $xxxxW sets the |clipping, and $C7 $47 $0E $xxxxW is the horizontal direction the sprite starts moving in, either $0001W (Facing right), $FFFFW (Facing left) or $0000W (Neither, seldom used.) $C7 $47 $10 $xxxxW is the vertical direction and works similarly.

Clipping is set to 'none' on the second line, this allows items and their got sprites to pass through solid tiles unimpeded. The item's type is set on the same line. On line 4 type 9 items are checked for (That is the Flower Pot.) and their vertical location is adjusted.

On line 5 the item's animation is read from the item animation list. On the next line type 7 items (That is the eye.) is checked for, instead of two animation frames it has four.

Keen Dreams

#Item initiation pointers
%patch $4A05 $02F3W #100 Pts (At $47C3)
%patch $4A07 $02F3W #200 Pts (At $47C3)
%patch $4A09 $02F3W #500 Pts (At $47C3)
%patch $4A0B $02F3W #1000 Pts (At $47C3)
%patch $4A0D $02F3W #2000 Pts (At $47C3)
%patch $4A0F $02F3W #5000 Pts (At $47C3)
%patch $4A11 $02F3W #1UP (At $47C3)
%patch $4A13 $02F3W #Eye (At $47C3)
%patch $4A15 $02F3W #Flower Power (At $47C3)
%patch $4A17 $02F3W #Flower Pot (At $47C3)
%patch $4A19 $02EDW #Boobus Bomb (At $47BD)
%patch $4A1B $02F3W #Key (At $47C3)

#Boobus Bomb (Uses following item initiation code)
%patch $47BD $C7 $06 $704CW  $0001W 

#Items initiation code
%patch $47C3 $A1 {$70ACW}  $2D [$0015W]  $50 $FF $36 $7052W  $FF $36 $7050W  $9A
             $07C504A3RL     $83 $C4 $06 $8B $1E $3E $70 $C7 $47 $02 [$0000W]
             $E9 $01E6W

#Item spawn code
%patch $80F3 $55 $8B $EC $56 $8B $76 $0A $33 $C0 $50 $9A $044D01C9RL     $44
             $44 $8B $1E $3E $70 $C7 $47 $06 [$0000W]  $C7 $07 [$0004W]  $8B $46
             $06 $B1 $08 $D3 $E0 $89 $47 $0A $8B $46 $08 $D3 $E0 $89 $47 $0C
             $83 $FE [$09] {$75} $05 $81 {$0C6FW}  [$0080W]  $8B $1E $3E $70 $C7 $47
             $10 [$FFFFW]  $89 $77 $3E $8B $DE $D1 $E3 $8B $87 [$19A8W]  $8B $1E
             $3E $70 $89 $47 $20 $89 $47 $40 $83 $FE [$07] {$74} $07 $8B $47 $40
             $40 $40 $EB $0A $8B $1E $3E $70 $8B $47 $40 $05 [$0004W]  $8B $1E
             $3E $70 $89 $47 $42 $B8 [$196CW]  $50 $FF $36 $3E $70 $9A $044D1212RL
                     $83 $C4 $04 $5E $5D $CB