Patch:Shot sprites

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

This page contains patches that affect gameplay by altering how shot sprites act. This is by necessity Vorticons related. Stunned sprites in the Galaxy and Dreams series are treated individually and patches relating to them should be sough on their respective pages. However related patches can be found on the Wilted Flower and stunned sprite stars pages.

The primary factor affecting stunned sprite behavior is the stunned sprite behavior. This makes sprite animate a set number of frames before stopping all action entirely. They will also vanish when offscreen. Patches that are applied to this behavior will affect all sprite when they are shot.


Complete shot sprite behavior

This is the complete stunned sprite code followed by the complete (And much shorter) stopped sprite code.

The first line of the stunned code sets the sprite type to a value that will cause the sprite to vanish when offscreen. Altering this can make stunned sprites deadly for example but will also result in them remaining permanently in a level.

The other line of interest is the fourth line; it contains four highlighted values. The blue value is the sprite's horizontal speed, this is set to 0 when the sprite is stunned so that it does not slide across the floor. (Vertical speed becomes 0 when the stunned sprite hits the ground.) The first brown value is the behavior the sprite will use after it has been stunned. (By default the stopped sprite behavior.) Finally the two other brown values are sprite gravity and tile collision; replacing the first $E8 string with $90 $90 $90 will cause shot sprites to float upwards in the air until they hit the ceiling. Replacing the second will cause shot sprites to ghost through tiles, falling off the bottom of the level.

The stopped sprite behavior is much simpler; it contains two brown values with the same sprite gravity and tile collision functions. Replacing either or both $E8 $xxxxW strings with $90 $90 $90 will result in the same floating or ghost behavior, only affecting sprites after their stunning.

Keen 1

#Keen 1 stunned sprite code
%patch $489D $55 $8B $EC $C7 $06 $20 $82 [$000EW]  $A1 $4A $82 $03 $06 $14 $5B
             $A3 $4A $82 $3D $28 $00 $7E $1B $83 $2E $4A $82 $28 $FF $06 $48
             $82 $FF $0E $4C $82 $A1 $4C $82 $3D $01 $00 $75 $06 $C7 $06 $52
             $82 {$488EW}  $C7 $06 $40 $82 [$0000W]  $E8 {$E351W}  $E8 {$E391W}  $5D
             $C3

#Keen 1 stopped sprite code
%patch $488E $55 $8B $EC $FF $06 $4A $82 $E8 {$E392W}  $E8 {$E3D2W}  $5D $C3

Keen 2

#Keen 2 stunned sprite code
%patch $75FC $55 $8B $EC $C7 $06 $C0 $96 [$000DW]  $A1 $EA $96 $03 $06 $F0 $5A
             $A3 $EA $96 $3D $28 $00 $7E $1B $83 $2E $EA $96 $28 $FF $06 $E8
             $96 $FF $0E $EC $96 $A1 $EC $96 $3D $01 $00 $75 $06 $C7 $06 $F2
             $96 {$75EDW}  $C7 $06 $E0 $96 [$0000W]  $E8 {$E434W}  $E8 {$E474W}  $5D
             $C3

#Keen 2 stopped sprite code
%patch $75ED $55 $8B $EC $FF $06 $EA $96 $E8 {$E475W}  $E8 {$E4B5W}  $5D $C3


Keen 3

#Keen 3 stunned sprite code
%patch $7EC0 $55 $8B $EC $C7 $06 $10 $99 [$0013W]  $A1 $3A $99 $03 $06 $40 $5D
             $A3 $3A $99 $83 $3E $3A $99 $28 $7E $1B $83 $2E $3A $99 $28 $FF
             $06 $38 $99 $FF $0E $3C $99 $A1 $3C $99 $3D $01 $00 $75 $06 $C7
             $06 $42 $99 {$7EB1W}  $C7 $06 $30 $99 [$0000W] $E8 {$E3B6W}  $E8 {E3$F6W}
                 $5D $C3

#Keen 3 stopped sprite code
%patch $7EB1 $55 $8B $EC $FF $06 $3A $99 $E8 {$E3F9W}  $E8 {$E439W}  $5D $C3


Sprites do not vanish when offscreen

These patches alter the sprite type of shot sprites. This is the type that by default makes the sprite vanish when offscreen. This can be altered so that shot sprites harm Keen or stun\freeze him or other things, but the patches here simply make them permanent, not vanishing when offscreen.

Note that this has some side effects. Notably the shot sprites will block the Tank Robot's, Vorticon Elite's and Vortimom's shots, which shouldn't be too big a problem (Especially in Keen 1.)

Keen 1

#Shot sprites don't vanish when offscreen
%patch $48A4 [$0001W]

Keen 2

#Shot sprites don't vanish when offscreen
%patch $7603 [$0001W]

Keen 3

#Shot sprites don't vanish when offscreen
%patch $7EC7 [$0001W]


The following patches 'fix' the above noted bugs, with a side effect that the shots will not collide and be destroyed by Keen, though they will still kill him. (Note that the value in each of these patches must match that of the value in the patch above.)

Keen 1

#Tank Robot's shots don't hit permanent shot sprites
%patch $4A12 [$01]

Keen 2

#Enemy shots don't hit permanent shot sprites
%patch $7771 [$01]

Keen 3

#Vortimom's shots don't hit permanent shot sprites
%patch $46D8 [$01]

Sprite's don't change type when shot

This stops sprites changing type when they are shot. In the main this will also make them permanent, like the above patches, but it means that a sprite will do to Keen when shot what it does when alive, whether that is killing him, pushing him or anything in between.

Keen 1

#Shot sprites don't vanish when offscreen
%patch $48A0 $EB $04

Keen 2

#Shot sprites don't vanish when offscreen
%patch $75FF $EB $04

Keen 3

#Shot sprites don't vanish when offscreen
%patch $7EC3 $EB $04


Sprite jump height when shot

When shot many sprites 'jump' or get an upwards kick. In Vorticons the upwards speed of a shot sprite depends on the sprite's collision and as such is different for each sprite. These speeds are treated on the relevant sprite's page. In Keen Dreams all sprites stun to the same thing the Wilted Flower. In Keen Galaxy all sprites stun the same way and as such can be given the same 'kick' when stunned. (This doesn't apply to Keen 4 is seems however.)

As such only Keen 5 and Keen 6 have code here. The code does two major things. On the third line the stunning sprite's type is changed to that used for smashed Keen's shot. (The stunning sprite is always Keen's shot by default.) On the fourth line a check is made of the stunned sprite's vertical speed, if it is less than $FFD0W then it is set to $FFD0W, the upwards 'jump'.

Stunned sprite upwards kick

#Complete stun code - Keen 5
%patch $A77D $55 $8B $EC $56 $8B $76 $06 $FF $76 $08 $9A $0CCB10B3RL     $83
             $C4 $02 $33 $C0 $89 $44 $42 $89 $44 $40 $89 $44 $3E $8B $04 $89
             $44 $44 $FF $76 $0A $56 $0E $E8 $FB4BW  $83 $C4 $04 $C7 $04 [$0007W]
                 $83 $6C $18 $18 $83 $7C {$18} [$D0] {$7D} $05 $C7 $44 $18 [$FFD0W]
             $5E $5D $CB

#Complete stun code - Keen 6
%patch $A662 $55 $8B $EC $56 $8B $76 $06 $FF $76 $08 $9A $0CA60EC2RL     $83
             $C4 $02 $33 $C0 $89 $44 $42 $89 $44 $40 $89 $44 $3E $8B $04 $89
             $44 $44 $FF $76 $0A $56 $0E $E8 $FB4BW  $83 $C4 $04 $C7 $04 [$0019W]
                 $83 $6C $18 $18 $83 $7C {$18} [$D0] {$7D} $05 $C7 $44 $18 [$FFD0W]
             $5E $5D $CB


Shot sprites drop items\enemies

It is possible to patch shot sprites so that when a certain type of sprite is shot it leaves not only a body but a second, new sprite. This could be another enemy or an item such as a keycard. In this example patch the Vorticon drops a red card item when shot.

The first two lines alter the behavior of the shot and 'chain-crushed' Vorticons to use a special 'shooting' behavior. While the Vorticon is affected here it is a simple matter to make any other destructible sprite use this behavior by replacing their shot sprite behavior ($489DW) with $0AF2W.

The next section is the 'shooting' behavior; it calls the 'make card' code then switches the shot sprite's behavior to that of the shot sprite proper ($489DW; this is to stop the shot sprite making infinite new things and to allow it to act like a shot sprite again.)

The 'make card' code in the following section is a modified shooting code. It makes a sprite of type 1 (harmless, unshootable.) at location 0,0 relative to the Vorticon using behavior $0B51W, collision $0B5CW and sprite $0072 (The same as the falling block Chain, though others can be used.)

The card's behavior causes it to fall to the ground and sit there. If the 'make card' code instead sets the card's behavior to $3360W (Nothing.) then the card will just sit where it was created.

The final section is the new sprite's collision; it responds only to type 1 sprites (Like Keen.) by doing several things. Firstly its type is set to 0, making it vanish immediately after. Next its collision is set to 'nothing' ($3360W) as a precaution against overreacting. Sound $22 is played (The 'get card' sound.) Finally variable $AAA0W (Number of red keycards) is increased by 1.

Through alterations in this patch the spawned object can be an enemy (Setting its behavior to something like the Garg's.) a hazard (Setting its type to something like $02, deadly to Keen.) or any number of items.

Keen 1

#Dead Vorticon drops card sprite
%patch $1DAD {$0AF2W} #When shot
%patch $2363 {$0AF2W} #When falling-blocked

#Produce card sprite behavior
%patch $0AF2 $55 $8B $EC $FF $36 $2A $82 $FF $36 $28 $82 $FF $36 $26 $82 $FF
             $36 $24 $82 $E8 $000BW  $83 $C4 $08 $C7 $06 $52 $82 {$489DW}  $5D $C3

#Make card code -sets card properties (Animation used is chain sprite's, $72)
%patch $0B13 $55 $8B $EC $56 $E8 $1E1BW  $8B $F0 $C7 $04 [$0001W]  $8B $46 $06
             $8B $56 $04 $89 $54 $04 $89 $44 $06 $8B $46 $0A $8B $56 $08 $81
             $C2 [$00] $09 $15 [$0000W]  $89 $54 $08 $89 $44 $0A $C7 $44 $32 {$0B51W}
                 $C7 $44 $34 {$0B5CW}  $C7 $44 $28 [$0072W]  $5E $5D $C3

#Card behavior: fall, clip
%patch $0B51 $55 $8B $EC $E8 $20D3W  $E8 $2113W  $5D $C3

#Card collision, if Keen give red card, play sound, vanish
%patch $0B5C $55 $8B $EC $56 $57 $8B $76 $04 $8B $7E $06 $83 $3D [$01] {$75} $16
             $C7 $04 [$0000W]  $C7 $44 $34 {$3360W}  $B8 [$0020W]  $50 $E8 $B377W
             $44 $44 $FF $06 {$AAA0W}  $5F $5E $5D $C3