Patch:Tater Trooper

From KeenWiki
Jump to navigation Jump to search

Tater Troopers are brown, spud-like creatures that are found in many levels in Tuberia, being the most commonly encountered enemy and appearing in nearly every level in Keen Dreams. They move back and forth partially following Keen and will slash at him with bayonets whenever he is near.

Troopers also targets for the dropping enemy bug which can crash the game if it is abused. This is because there are so many of them and through sheer luck or perseverance they can be shot off of cliffs.


Sprite Type

Troopers use type 11 which has no impact on any other sprites save for making them transform into Wilted Flowers properly. It also affects how Keen reacts to it. Specifically this type means only one of the Trooper's actions is harmful to Keen, the others are harmless.

Keen Dreams

#Trooper sprite type
%patch $8699 [$0B]


Sprite Actions

The Trooper has a simple enough set of actions. It is placed in the level in the first frame of its walking cycle. This is four actions and loops. When close enough to Keen it activates its stabbing action. The stabbing cycle is three actions long and returns the trooper to walking.

There is only one action that is lethal to Keen, the second stabbing action.

Actions:
$1D08W #Tater walk 1
$1D26W #Tater walk 2
$1D44W #Tater walk 3
$1D62W #Tater walk 4
$1D80W #Tater stab 1
$1D9EW #Tater stab 2
$1DBCW #Tater stab 3

Keen Dreams

#Place Trooper in level
%patch $86BB [$1D08W]

#Walk cycle
%patch $25794 [$1D26W]
%patch $257B2 [$1D44W]
%patch $257D0 [$1D62W]
%patch $257EE [$1D08W]

#Stab when close to Keen
%patch $8743 [$1D80W]

#Stab sequence
%patch $2580C [$1D9EW]
%patch $2582A [$1DBCW]
%patch $25848 [$1D08W]

#Actions that are deadly to Keen
%patch $781E [$1D9EW]


Sprite Behavior

The Trooper has only one unique behavior, that used when it is walking. This causes it to chase and attack Keen. When attacking it has no behavior.

Behaviors:
$08680055RL #Trooper walk

Keen Dreams

#Trooper walk
%patch $25788 $08680055RL
%patch $257A6 $08680055RL
%patch $257C4 $08680055RL
%patch $257E2 $08680055RL

#Trooper attack
%patch $25800 $00000000L
%patch $2581E $00000000L
%patch $2583C $00000000L


Trooper doesn't attack Keen

This patch prevents the Trooper from ever attacking Keen. It will instead just walk back and forth chasing him down.

Keen Dreams

#Trooper doesn't attack Keen
%patch $8735 $5F $5E $5D $CB


Speed and Jump Height

The Trooper's speed is controlled by its walking actions. It does not move while stabbing at Keen.

Keen Dreams

#Trooper walk
%patch $25784 [$0080W $0000W]
%patch $257A2 [$0080W $0000W]
%patch $257C0 [$0080W $0000W]
%patch $257DE [$0080W $0000W]

#Trooper stab
%patch $257FC [$0000W $0000W]
%patch $2581A [$0000W $0000W]
%patch $25838 [$0000W $0000W]


Animations

Troopers have only two animation cycles, walking and attacking Keen.

Keen Dreams

#Cache
%patch $23E82 $0119W #Tater Trooper cache start
%patch $23EAE $0124W #Tater Trooper cache end

#Tater walk
%patch $25778 $011FW $0119W
%patch $25782 $000AW        #Animation speed
%patch $25796 $0120W $011AW
%patch $257A0 $000AW        #Animation speed
%patch $257B4 $0121W $011BW
%patch $257BE $000AW        #Animation speed
%patch $257D2 $0122W $011CW
%patch $257DC $000AW        #Animation speed

#Tater stab
%patch $257F0 $0123W $011DW
%patch $257FA $000CW        #Animation speed
%patch $2580E $0124W $011EW
%patch $25818 $0014W        #Animation speed
%patch $2582C $0123W $011DW
%patch $25836 $0008W        #Animation speed


Sprite positioning

The Trooper spawns 15 pixels higher then where it is placed in-level.

Keen Dreams

#Spawn height:
%patch $86AB [$FF0FW] #15 pixels up


Sounds

The Trooper makes a sound when attacking Keen. This sound can be blocked.

Keen Dreams

#Tater Trooper attack sound
%patch $8736 $10

#Don't play Tater Trooper attack sound
%patch $8735 $EB $09


Sprite-tile interaction

The Trooper uses a generic 'walk back and forth' tile interaction when walking which lets it turn at platform edges and walls. When attacking its first frame uses a special tile interaction that lets it move without falling off platforms. The last two frames use a generic 'sit' tile interaction that simply displays the sprite.

Keen Dreams

#Trooper walk
%patch $25790 $07C50299RL
%patch $257AE $07C50299RL
%patch $257CC $07C50299RL
%patch $257EA $07C50299RL

#Trooper attack
%patch $25808 $086800C9RL
%patch $25826 $07C501DDRL
%patch $25844 $07C501DDRL


Action type

All of the Trooper's actions are quite basic and thus are type 0.

Sprite action types

#Trooper walk
%patch $2577C [$0000W]
%patch $2579A [$0000W]
%patch $257B8 [$0000W]
%patch $257D6 [$0000W]

#Trooper attack
%patch $257F4 [$0000W]
%patch $25812 [$0000W]
%patch $25830 [$0000W]


Deprotect and stick to ground

The Trooper needs to stick to the ground while walking and thus uses a value of 1 for this variable in its walking actions.

Sprite deprotect, stick

#Trooper walk
%patch $2577E [$0000W $0001W]
%patch $2579C [$0000W $0001W]
%patch $257BA [$0000W $0001W]
%patch $257D8 [$0000W $0001W]

#Trooper attack
%patch $257F6 [$0000W $0000W]
%patch $25814 [$0000W $0000W]
%patch $25832 [$0000W $0000W]


Sprite spawn code

There is one type of Tater Trooper. In its initiation code its cache is set in $C7 $06 $70C6W $0001W.

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. Keen always starts moving downwards. The Trooper spawns facing down and right.

Finally $D3 $E0 $05 $xxxxW 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. The Trooper spawns 15 pixels higher than where it is placed, this needs to be changed if its sprite height changes.

Keen Dreams

#Tater Trooper initiation pointer
%patch $4A39 $03DCW #Tater Trooper (At $48AC)

#Tater Trooper initiation code
%patch $48AC $FF $36 $7052W  $FF $36 $7050W  $9A $08680006RL     $83 $C4 $04
             $8B $1E $3E $70 $C7 $47 $02 $0000W  $C7 $06 $70C6W  $0001W  $E9
             $00FEW

#Tater Trooper spawn code
%patch $8686 $55 $8B $EC $33 $C0 $50 $9A $044D01C9RL     $44 $44 $8B $1E $3E
             $70 $C7 $07 [$000BW]  $8B $46 $06 $B1 $08 $D3 $E0 $89 $47 $0A $8B
             $46 $08 $D3 $E0 $05 [$FF0FW]  $89 $47 $0C $C7 $47 $0E [$0001W]  $C7
             $47 $10 [$0001W]  $B8 [$1D08W]  $50 $FF $36 $3E $70 $9A $044D1212RL
                 $83 $C4 $04 $8B $1E $3E $70 $C7 $47 $36 [$0001W]  $5D $CB