Patch:Sprite type

From KeenWiki
Jump to: navigation, search

This page is a tutorial page on patching sprite types. It contains information on what sprite type is, how to patch it, and a list of the possible types for all Keen games. A sprite's type is the variable the game uses to identify what 'kind' of sprite a sprite is. It has a lot of untapped potential since, while every different sprite (Yorp, Garg, etc) is usually given a different value, most of the time the value goes unused. As an example, in Keen 1 the only properties that matter are 2 (stompable), 10 (kill enemies), 11(kill enemies and Keen) and 15 (freeze Keen)

Notable however is that in Keen galaxy the sprite type is also used to determine the position of the stun stars that appear on every permanently stunned sprite. This can make changing the sprite type slightly tricky in these cases.


Patching the sprite type

Patching the sprite's type is quite simple, the type is set whenever a sprite is spawned and remains the same throughout the game. A single patch that changes the value is all that is required:

Patch: Keen 1
#Make the Yorp freeze Keen:
%patch $188B $0F

Patch: Keen 5
#Teleporter sprite types changed to 'enemy projectile'
%patch $FEB3 $04
#Upper zap
%patch $FF06 $04
#Lower zap

Sprite type itself is pretty useless when used alone, since in the end it is just setting the value that other code checks. Sprite type is used most often in Patch:Sprite collision, though (at the moment) Keen's sprite collision code is not well understood, so for things solely affecting Keen (What freezes or stuns him, etc) altering a sprite's type is the only way to change this.


Values in games

While not quite hard-coded it is difficult to change what the default values of sprite type do in games. Following is a list of all the default values in the Keen games.


Keen 1

Keen 1:
0	Don't appear
1	Keen (All sprites pass through sprite)
2	Yorp (when stood on becomes stomped Yorp)
3	Garg (Kill Keen)
4	Vorticon (Kill Keen, die when chain is shot)
5	Butler bot (Push Keen)
6	Tank bot (Push Keen, ignore enemy shot type sprite)
8	Chain (Shots hit sprite)
10	Keen's shot (Kill sprites that react to it)
11	Enemy shot (Kill enemies that react to it, and Keen.)
12	Icecubetter (Do nothing)
13	Zap-zot (Shots hit sprite)
14	Chain zap-zot (Same as 13)
15	Icecube (Freeze Keen)


Keen 2

Keen 2:
0	Don't appear
1	Keen (All sprites pass through sprite)
2	Vorticon (Kill Keen)
3	Vortikid (Stun Keen)
4	Vort Elite (Kill Keen, ignore enemy shot type sprites)
5	Scrub (Push Keen, can be stood on)
6	Robot (Same as 4)
7	Platform (Same as 5)
8	Tantalus (Shots hit sprite)
10	Keen's shot (Kill sprites that react to it)
11	Enemy shot (Kill enemies that react to it and Keen. Pass through tank bot)
13	Zap-zot (Shots hit sprite)


Keen 3

Keen 3:
0	Don't appear
1	Keen (All sprites pass through sprite)
2	Vorticon (Kill Keen)
3	Vortikid (Stun Keen)
4	Vortimom (Push Keen, ignore enemy shot type)
5	Meep (Push Keen, ignore Meep shot type)
6	Vortninja (Kill Keen)
7	Foob (Shots hit sprite)
8	Ball (Push Keen, can be stood on)
9	Jack (Same as 6)
11	Nothing
13	Heart\sparks (Do nothing)
15	Keen's shot (Kill sprites that react to it)
16	Enemy shot (Kill Keen and sprites that react to it)
17	Meep shot (Kill Keen)
18	Zap-zot (Shots hit it)
19	MM-zap-zot (Same as 18)


Keen 4

Keen 4:
$0000W #Don't appear $0001W #Misc            $0002W #Keen           $0003W #Keen's shot
$0004W #Items        $0005W #Poison slug     $0006W #Council member $0008W #Egg
$0009W #Mad Mushroom $000AW #Arachnut        $000BW #Skypest        $000CW #Wormouth
$000DW #Cloud        $000EW #Berkeloid       $000FW #Bounder        $0010W #Inchworm
$0011W #The Foot     $0012W #Lick            $0013W #Mimrock        $0014W #Platform
$0015W #Dopefish     $0016W #Schoolfish      $0017W #Sprite         $0018W #Lindsey
$0019W #Lightning    $001AW #Smirky          $001BW #Bluebird       $001EW #Wetsuit
$001FW #Enemy bullet $0020W #Mine            $0021W #Stunned sprite $0022W #Keen K flag


Keen 5

Keen 5:
$0000W #Don't appear $0001W #Misc            $0002W #Keen           $0003W #Keen's shot
$0004W #Enemy shot   $0005W #Items           $0006W #Platform       $0007W #Smashed Keen's shot
$0008W #             $0009W #Sparky/Shelley  $000AW #Mine           $000BW #Slicestar
$000CW #Robo Red     $000DW #Spirogrip       $000EW #Ampton         $000FW #Shooting gun
$0010W #Volte face   $0011W #                $0012W #Spindred       $0013W #Shikadi Master
$0014W #Shikadi      $0015W #Shocksund       $0016W #Sphereful      $0017W #Korath
$0018W #Teleporter   $0019W #Q.E.D


Keen 6

Keen 6:
$0000W #Don't appear $0001W #Misc        $0002W #Keen           $0003W #Keen's shot
$0004W #Enemy shot   $0005W #Items       $0006W #Moving Plat    $0007W #Bloog
$0008W #Blooglet     $0009W #Unused      $000AW #Fleex          $000BW #Unused
$000CW #Molly        $000DW #Babobba     $000EW #Bobba          $000FW #Unused
$0010W #Nospike      $0011W #Gik         $0012W #Enemy gun      $0013W #Orbatrix     
$0014W #Bip          $0015W #Flect       $0016W #Blorb          $0017W #Ceilick
$0018W #Blooguard    $0019W #Kshot smash $001AW #Bipship        $001BW #Sandwich
$001CW #Rope         $001DW #Card        $001EW #Grabbiter      $001FW #???     
$0020W #???          $0021W #Satellite   $0022W #Sat drop       $0023W #???   


Keen Dreams

Keen Dreams:
$0000W #Don't appear $0001W #Keen        $0002W #Keen's shot    $0003W #Door
$0004W #Items        $0005W #Broccolash  $0006W #Tomatooth      $0007W #Carrot Courier
$0008W #Unused       $0009W #Asparagusto $000AW #Sour Grape     $000BW #Tater Trooper
$000CW #Cart         $000DW #Frenchy     $000EW #Melon Lips     $000FW #Unused
$0010W #Unused       $0011W #Unused      $0012W #Unused         $0013W #Squasher    
$0014W #Apel         $0015W #Pea Pod     $0016W #Pea Brain      $0017W #Boobus Tuber
$0018W #Enemy shots  $0019W #Defeated enemies


What sprite types lose the level if they fall out of it

In Keen Galaxy the level is 'lost' if the player sprite falls out of the bottom or top of the level. What actually happens is that the level state is set to 1, which causes the level to be lost. This is an exception to the usual state of affairs which removes a sprite that leaves the level. If this was the case for the player a 'tried to remove the player' error would result.

The check involved is that of the sprite's type with payer types (Type 2) triggering level loss rather than removal. See also Patch:Jump conditions.

Patch: Keen 4
#Sprite type that triggers level loss
%patch $8FFC $02 $75

Patch: Keen 5
#Sprite type that triggers level loss
%patch $8F6E $02 $75

Patch: Keen 6
#Sprite type that triggers level loss
%patch $8DD6 $02 $75