Patch:Wilted Flower

From KeenWiki
Jump to navigation Jump to search

Wilted Flowers are what enemies turn into when they are hit with flower power in Keen Dreams. They sit on the spot and animate for a time that depends on the difficulty level of the game. When this time is up, they return to what enemy they were before being hit. The adjustments needed when transforming enemies of varying sizes into the one-sized Flower and back are controlled by the enemy's sprite type.

Interestingly the Wilted Flower actually vanishes when it recovers. Instead it spawns a new sprite that replaces it when the smoke clears.


Misc

This section contains general patches that alter the Wilted Flowers.


Wilted Flower recovery times

This patch controls the recovery times for the Wilted Flower. It is different on all three difficulty levels (Plus an inaccessibly 'zero difficulty' level.) The recovery time list is located at $23A70 + $172A = $2519A and only the last three values are of interest. Making a value very large (Say $7FFFW) will make the Flowers on that difficulty (and only that difficulty) seem to never recover.

If the recovery time is too short ($4F or less) then there is the side effect of 'oversmoking' where the stun and recovery smoke sprites interfere with each other resulting in the production of extra smoke sprites. This is harmless to game performance.

Wilted Flower recovery times

#List location
%patch $8072 [$172AW]

#Wilted Flower recovery times list
%patch $2519A $02BCW #Zero difficulty
              $02BCW #Easy
              $015EW #Medium
              $00AFW #Hard


Wilted Flowers never recover

This patch stops the Wilted Flowers ever recovering; they remain stunned for the rest of the level, much like enemies in the other Keen games.

Keen Dreams

#Wilted Flowers never recover
%patch $806A $5E $5D $CB


Wilted Flowers recover instantly

This patch causes stunned enemies to recover 'instantly.' In practice there is a slight delay, the enemies 'smoke' for a second or so as they transform and immediately revert. There is also the side effect of 'oversmoking' as the smoke sprites interfere with each other.

Keen Dreams

#Hitting enemies 'smokes' them for a short time
%patch $8074 $90 $90


Flowers move horizontally when shot

This patch causes Flowers to appear right of where the shot enemy is positioned. This means that they can be shot off platforms (And also through walls or out of the level.) The blue variable is how far the Flower will move. This can freeze the game if a Flower is shot out of the top of a level. See the sprite positioning section for details.

Keen Dreams

#Wilted flowers move horizontally not vertically
%patch $7FE5 $2A
%patch $7FE7 [$0200W]
%patch $7FEB $0A


Wilted Flowers don't fall

This patch removes gravity from the Wilted Flowers, meaning that they stun and hang in midair. This has a number of minor side-effects. (For example Carrot Couriers will always jump after recovering.)

Keen Dreams

#Wilted Flowers don't fall
%patch $8059 $EB $05


No Flowers, enemies become harmless

With this patch shooting an enemy does not make it a Flower. Instead it becomes harmless to Keen and unstunnable. This won't work for the enemy's projectiles however but it will affect those that do things like push Keen around.

Keen Dreams

#No Flowers, enemies become harmless when shot
%patch $800A $EB $0A


Sprite Actions

The Wilted Flower has a large number of actions that thankfully fall into several simple sequences. When hit by a Flower Power they become the first action in the vanishing smoke sequence. The sequence is four actions long and ends with the enemy vanishing into nothing.

However at the same time a second sprite is produced using the first action in the Flower loop. (While storing the enemy's last action.) The Flower loop is six actions long and continues until the Flower's stun time expires.

On 'recovering' the Wilted Flower produces a third sprite, the recovery smoke. The recovery smoke sequence is seven actions long and ends with the smoke vanishing into nothing. However before it vanishes it alters the second sprite (The Wilted Flower) changing it into something identical with the enemy that had been stunned.

The end result of all this is that an enemy appears to be stunned in a cloud of smoke, then recover in a second cloud of smoke. It also means that the sequence can be very difficult to alter.

Actions:
$176EW #Wilted flower 1
$178CW #Wilted flower 2
$17AAW #Wilted flower 3
$17C8W #Wilted flower 4
$17E6W #Wilted flower 5
$1804W #Wilted flower 6
$1822W #Wilting smoke 1
$1840W #Wilting smoke 2
$185EW #Wilting smoke 3
$187CW #Wilting smoke 4
$189AW #Recovery smoke 1
$18B8W #Recovery smoke 2
$18D6W #Recovery smoke 3
$18F4W #Recovery smoke 4
$1912W #Recovery smoke 5
$1930W #Recovery smoke 6
$194EW #Recovery smoke 7

Keen Dreams

#Enemies turn into vanishing smoke
%patch $8037 [$176EW]

#Smoke disappear sequence
%patch $252AE [$1840W]
%patch $252CC [$185EW]
%patch $252EA [$187CW]
%patch $25308 [$0000W]

#Wilted Flower appears behind smoke
%patch $800B [$176EW]

#Flower sequence
%patch $251FA [$178CW]
%patch $25218 [$17AAW]
%patch $25236 [$17C8W]
%patch $25254 [$17E6W]
%patch $25272 [$1804W]
%patch $25290 [$176EW]

#Wilted Flower produces recovery smoke
%patch $809A [$189AW]

#Recovery smoke
%patch $25326 [$18B8W]
%patch $25344 [$18D6W]
%patch $25362 [$18F4W]
%patch $25380 [$1912W]
%patch $2539E [$1930W]
%patch $253BC [$194EW]
%patch $253DA [$0000W]


Sprite Behavior

The Flower has two unique behaviors. The first is used by the Wilted Flower itself. The second is the recovery behavior. This causes a copy of the original stunned sprite to appear behind the recovery smoke (The old sprite.) The smoke then vanishes and the new sprite acts as a replacement. This occurs in frame four of the recovery sequence. The rest of the forming\recovery sequences use no behavior at all.

Behaviors:
$07C50402RL #Wilted Flower
$07C50461RL #Wilted Flower recover

Keen Dreams

#Wilted Flower
%patch $251EE $07C50402RL
%patch $2520C $07C50402RL
%patch $2522A $07C50402RL
%patch $25248 $07C50402RL
%patch $25266 $07C50402RL
%patch $25284 $07C50402RL

#Flower formed sequence
%patch $252A2 $00000000L
%patch $252C0 $00000000L
%patch $252DE $00000000L
%patch $252FC $00000000L

#Flower recover sequence
%patch $2531A $00000000L
%patch $25338 $00000000L
%patch $25356 $00000000L
%patch $25374 $07C50461RL
%patch $25392 $00000000L
%patch $253B0 $00000000L
%patch $253CE $00000000L


Wilted Flower behavior code

This is the complete behavior code for the Wilted Flower. The first line calls the gravity code, making the Flower fall. On the third line the recovery time is checked. The recovery time list is located at $23A70 + $172A = $2519A and if the time is up then the rest of the code runs.

The rest of the code produces the recovery smoke and tweaks a few sprite variables as well as producing the recovery smoke. Smoke is a type 1 sprite creation with a foreground variable of 2. (Putting it in front of the enemy.) On the last line the Enemy's misc variable C is set to 0, this acts as a recovery timer.

Keen Dreams

#Wilted Flower behavior code
%patch $8052 $55 $8B $EC $56 $8B $76 $06 $56 $0E $E8 $FD96W  $44 $44 $8B $44
             $42 $03 $06 $D4 $BD $89 $44 $42 $8B $1E $28 $71 $D1 $E3 $3B $87
             [$172AW]  {$7C} $38 $B8 [$0001W]  $50 $9A $044D01C9RL     $44 $44 $8B
             $1E $3E $70 $C7 $47 $02 [$0002W]  $89 $77 $3E $8B $44 $0A $89 $47
             $0A $8B $44 $0C $89 $47 $0C $B8 [$189AW]  $50 $FF $36 $3E $70 $9A
             $044D1212RL     $83 $C4 $04 $C7 $44 $42 [$0000W]  $5E $5D $CB


Flower recover behavior code

This is the complete behavior code for the recovering Flower. On the first line sound $0A is played. On the last line the Flower's clipping is reset. The rest of the code reset's the Flower's properties to that of the original enemy. Note that on the last line the enemy's foreground variable is set to 1 (Normal.)

Line 3 calls the 'return smoke production code'.

Keen Dreams

#Flower recover behavior
%patch $80B1 $55 $8B $EC $4C $4C $56 $57 $8B $7E $06 $B8 [$000AW]  $50 $9A
         $10BB1282RL     $44 $44 $8B $75 $3E $8B $44 $28 $89 $46 $FE $FF $74
             $40 $56 $0E $E8 $FDCEW  $83 $C4 $04 $8B $46 $FE $2B $44 $28 $01
             $44 $0C $8B $44 $3E $89 $04 $C7 $44 $02 [$0001W]  $5F $5E $8B $E5
             $5D $CB


Return smoke code

This code is called in line 3 of the above behavior; it sets the smoke's properties. On the first line the smoke's variable is set to $0000W. On line 2 two checks are made; it is unknown what these are for, but they may position the smoke appropriately depending on which way the enemy is facing.

Line 3 sets the smoke's horizontal and vertical movement to 0 and its type to 1 (Misc.)

Keen Dreams

#Smoke return code
%patch $7EA5 $55 $8B $EC $56 $57 $8B $76 $06 $8B $7E $08 $89 $7C $1E $C7 $44
             $1A [$0000W]  $83 $7D {$02} [$00] {$74} $10 $83 $7C {$0E} [$00] {$7E} $05 $8B
             $45 $02 $EB $02 $8B $05 $89 $44 $20 $C7 $44 $12 [$0000W]  $C7 $44
             $14 [$0000W]  $C7 $44 $04 [$0001W]  $56 $9A $044D0C57RL     $44 $44
             $5F $5E $5D $CB


Speed and Jump Height

Neither the Flower nor its smoke move so their animations speeds are zero.

Sprite speeds

#Wilted Flower
%patch $251EA [$0000W $0000W]
%patch $25208 [$0000W $0000W]
%patch $25226 [$0000W $0000W]
%patch $25244 [$0000W $0000W]
%patch $25262 [$0000W $0000W]
%patch $25280 [$0000W $0000W]

#Flower formed sequence
%patch $2529E [$0000W $0000W]
%patch $252BC [$0000W $0000W]
%patch $252DA [$0000W $0000W]
%patch $252F8 [$0000W $0000W]

#Flower recover sequence
%patch $25316 [$0000W $0000W]
%patch $25334 [$0000W $0000W]
%patch $25352 [$0000W $0000W]
%patch $25370 [$0000W $0000W]
%patch $2538E [$0000W $0000W]
%patch $253AC [$0000W $0000W]
%patch $253CA [$0000W $0000W]


Sprite collision

Like nearly all sprites in Keen Dreams the does not have a sprite collision. Instead Keen and his shots react to them and their sprite types.

Keen Dreams

#Wilted Flower
%patch $251F2 $00000000L
%patch $25210 $00000000L
%patch $2522E $00000000L
%patch $2524C $00000000L
%patch $2526A $00000000L
%patch $25288 $00000000L

#Flower formed sequence
%patch $252A6 $00000000L
%patch $252C4 $00000000L
%patch $252E2 $00000000L
%patch $25300 $00000000L

#Flower recover sequence
%patch $2531E $00000000L
%patch $2533C $00000000L
%patch $2535A $00000000L
%patch $25378 $00000000L
%patch $25396 $00000000L
%patch $253B4 $00000000L
%patch $253D2 $00000000L


Animations

Wilted flowers do not have their own cache, being cached with Keen himself. They have three animation cycles, the Flower proper, the smoke as an enemy is transformed into a Flower and finally the smoke as a Flower recovers.

Keen Dreams

#Wilted flower
%patch $251DE $00A4W $00A4W
%patch $251E8 $0014W        #Animation speed
%patch $251FC $00A5W $00A5W
%patch $25206 $0014W        #Animation speed
%patch $2521A $00A6W $00A6W
%patch $25224 $0014W        #Animation speed
%patch $25238 $00A7W $00A7W
%patch $25242 $0014W        #Animation speed
%patch $25256 $00A6W $00A6W
%patch $25260 $0014W        #Animation speed
%patch $25274 $00A5W $00A5W
%patch $2527E $0014W        #Animation speed

#Stunned smoke
%patch $25292 $00A8W $00A8W
%patch $2529C $000AW        #Animation speed
%patch $252B0 $00A9W $00A9W
%patch $252BA $000AW        #Animation speed
%patch $252CE $00AAW $00AAW
%patch $252D8 $000AW        #Animation speed
%patch $252EC $00ABW $00ABW
%patch $252F6 $000AW        #Animation speed

#Recovery smoke
%patch $2530A $00ABW $00ABW
%patch $25314 $000AW        #Animation speed
%patch $25328 $00AAW $00AAW
%patch $25332 $000AW        #Animation speed
%patch $25346 $00A9W $00A9W
%patch $25350 $000AW        #Animation speed
%patch $25364 $00A8W $00A8W
%patch $2536E $0014W        #Animation speed
%patch $25382 $00A9W $00A9W
%patch $2538C $000AW        #Animation speed
%patch $253A0 $00AAW $00AAW
%patch $253AA $000AW        #Animation speed
%patch $253BE $00ABW $00ABW
%patch $253C8 $000AW        #Animation speed


Sounds

The Wilted Flower makes two sounds, one when being stunned and another when recovering. Both can currently be patched.

Keen Dreams

#Sounds
%patch $7FD9 $09     #Enemy stunned sound
%patch $80BC $0A     #Wilted Flower recover sound

#Don't make sounds
%patch $7FD8 $EB $09 #Don't play Enemy stunned sound
%patch $80BB $EB $09 #Don't play Wilted Flower recover sound


Sprite positioning

When stunned the Wilted Flower is moved up two tiles. This helps with enemies of varying heights. Note that the Flower doesn't move this height, it appears at the new height instantly, allowing it to move through solid tiles. If this is made large it is possible to freeze the game by making a Flower appear above the top of the level.

Keen Dreams

#Stun height:
%patch $7FE7 [$0200W] #2 tiles up


Sprite-tile interaction

The Flower uses a tile interaction that lets it land on the ground. Its smoke uses a generic interaction that merely draws the sprite.

Sprite tile interactions

#Wilted Flower
%patch $251F6 $07C501DDRL
%patch $25214 $07C501DDRL
%patch $25232 $07C501DDRL
%patch $25250 $07C501DDRL
%patch $2526E $07C501DDRL
%patch $2528C $07C501DDRL

#Flower formed sequence
%patch $252AA $07C50205RL
%patch $252C8 $07C50205RL
%patch $252E6 $07C50205RL
%patch $25304 $07C50205RL

#Flower recover sequence
%patch $25322 $07C50205RL
%patch $25340 $07C50205RL
%patch $2535E $07C50205RL
%patch $2537C $07C50205RL
%patch $2539A $07C50205RL
%patch $253B8 $07C50205RL
%patch $253D6 $07C50205RL


Action type

Smoke actions are simple and thus type 0. The wilted flower needs to be able to fall smoothly through the air while animating and is thus type 3 in its actions.

Sprite action types

#Wilted Flower
%patch $251E2 [$0003W]
%patch $25200 [$0003W]
%patch $2521E [$0003W]
%patch $2523C [$0003W]
%patch $2525A [$0003W]
%patch $25278 [$0003W]

#Flower formed sequence
%patch $25296 [$0000W]
%patch $252B4 [$0000W]
%patch $252D2 [$0000W]
%patch $252F0 [$0000W]

#Flower recover sequence
%patch $2530E [$0000W]
%patch $2532C [$0000W]
%patch $2534A [$0000W]
%patch $25368 [$0000W]
%patch $25386 [$0000W]
%patch $253A4 [$0000W]
%patch $253C2 [$0000W]


Deprotect and stick to ground

The Flower has no need for either of these variables and so has a value of 0 for both in all of its actions.

Sprite deprotect, stick

#Wilted Flower
%patch $251E4 [$0000W $0000W]
%patch $25202 [$0000W $0000W]
%patch $25220 [$0000W $0000W]
%patch $2523E [$0000W $0000W]
%patch $2525C [$0000W $0000W]
%patch $2527A [$0000W $0000W]

#Flower formed sequence
%patch $25298 [$0000W $0000W]
%patch $252B6 [$0000W $0000W]
%patch $252D4 [$0000W $0000W]
%patch $252F2 [$0000W $0000W]

#Flower recover sequence
%patch $25310 [$0000W $0000W]
%patch $2532E [$0000W $0000W]
%patch $2534C [$0000W $0000W]
%patch $2536A [$0000W $0000W]
%patch $25388 [$0000W $0000W]
%patch $253A6 [$0000W $0000W]
%patch $253C4 [$0000W $0000W]