Patch:Frenchy

From KeenWiki
Jump to navigation Jump to search

Frenchy are harmless yellow enemies, found in several levels in Tuberia in Keen Dreams. They will chase Keen somewhat, charging him to get close, but the true danger lies in the fries that they pull from their mouths to throw at Keen. These fries will eventually vanish, but can be thrown at a similar distance to Keen's own shots.


Sprite Type

Frenchy use type 13 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. Chips use type 24 which affects how Keen reacts to it. Note that the Chip's type is the same as the Melon pip's.

Keen Dreams

#Frenchy sprite type
%patch $8874 [$0D] #Frenchy
%patch $88CE [$18] #Chips


Sprite Actions

The Frenchy has an extensive set of actions. It is spawned in the first frame of its walking cycle. As seen below the walking cycle is complex. The Frenchy can charge Keen if Keen is close left or right and start tossing a chip at Keen if Keen is further left or right.

The charging cycle is four frames long and continues until Keen is vertically out of range (see below) or when Keen is horizontally far enough for chip throwing to occur.

The chip throwing sequence is three frames long and ends with the Frenchy returning to walking. The chip itself cycles between two actions until it vanishes after a specific period of time.

Actions:
$1E16W #Frenchy walking l/r 1
$1E34W #Frenchy walking l/r 2
$1E52W #Frenchy walking l/r 3
$1E70W #Frenchy walking l/r 4
$1E8EW #Frenchy charging l/r 1
$1EACW #Frenchy charging l/r 2
$1ECAW #Frenchy charging l/r 3
$1EE8W #Frenchy charging l/r 4
$1F06W #Frenchy tossing chip 1
$1F24W #Frenchy tossing chip 2
$1F42W #Frenchy tossing chip 3
$1F60W #Frenchy's chip 1
$1F7EW #Frenchy's chip 2

Keen Dreams

#Spawn Frenchy
%patch $8896 [$1E16W]

#Walking cycle
%patch $258A2 [$1E34W]
%patch $258C0 [$1E52W]
%patch $258DE [$1E70W]
%patch $258FC [$1E16W]

#Start charging when Keen is...
%patch $89BA [$1E8EW] #Left
%patch $89A3 [$1E8EW] #Right

#Charging cycle
%patch $2591A [$1EACW]
%patch $25938 [$1ECAW]
%patch $25956 [$1EE8W]
%patch $25974 [$1E8EW]

#Frenchy return to walking when Keen is vertically out of range
%patch $88B1 [$1E16W]

#Start chip throwing when Keen is...
%patch $8993 [$1F06W] #Left
%patch $89D1 [$1F06W] #Right

#What is thrown by Frenchy
%patch $8927 [$1F60W]

#Chip throwing sequence
%patch $25992 [$1F24W]
%patch $259B0 [$1F42W]
%patch $259CE [$1E16W]

#Chip cycle
%patch $259EC [$1F7EW]
%patch $25A0A [$1F60W]


Sprite Behavior

Behavior values

The Frenchy has three unique behaviors. The first is used when walking, it makes the Frenchy randomly charge or toss chips when Keen is near. The second is used when charging and returns the Frenchy to walking. Finally the third is used when producing a chip. Note that it is used only by the middle frame of the sequence the previous and following frames have no behavior at all. The chip itself uses a general 'move through the air' behavior.

Behaviors:
$07C501A4RL #Move through the air
$086802BERL #Frenchy walk
$08680227RL #Frenchy charge
$08680236RL #Frenchy toss chip

Keen Dreams

#Frenchy walk
%patch $25896 $086802BERL
%patch $258B4 $086802BERL
%patch $258D2 $086802BERL
%patch $258F0 $086802BERL

#Frenchy charge
%patch $2590E $08680227RL
%patch $2592C $08680227RL
%patch $2594A $08680227RL
%patch $25968 $08680227RL

#Frenchy toss chip
%patch $25986 $00000000L
%patch $259A4 $08680236RL
%patch $259C2 $00000000L

#Chip
%patch $259E0 $07C501A4RL
%patch $259FE $07C501A4RL


Walking behavior code

This is the complete code for the Frenchy's walking behavior. On the second line is a vertical check, if Keen is less than $30 pixels (3 tiles.) above or below the Frenchy then it will jump to its attack code, otherwise it will go to line 3 which will make it randomly turn (With a probability of $0008W.) The fourth line onwards is the attacking code.

The first check is how far left Keen is. If Keen is very far left (8 tiles or more) the Frenchy will go to its chip tossing action. If Keen is closer (Between 8 and 4 tiles) then it will turn to face him but not toss a chip. If Keen is even closer (Less than 4 tiles) it will continue with other checks.

The next check is whether the Frenchy is actually left of Keen . If he isn't (And it thus 0-4 tiles right of Keen) then the Frenchy will turn right and go to its charging action. (With a charge time of 8 ticks.)

After this there is a check for how far right Keen is. If he closer than 4 tiles then the Frenchy will turn to face Keen and go to its charging action (again with a charge time of 8 ticks). Following this is a check to see whether Keen is further than 8 tiles away. If he is the Frenchy will turn right and toss a chip, otherwise it will simply turn.

Keen Dreams

#Frenchy walking behavior code
%patch $893E $55 $8B $EC $56 $57 $8B $76 $06 $8B $44 $0C $8B $1E $34 $70 $2B
             $47 $0C $99 $33 $C2 $2B $C2 $3D [$0008W]  {$7E} $14 $9A $16C40026RL
                 $3D [$0008W]  {$7D} $76 $8B $44 $0E $F7 $D8 $89 $44 $0E $EB $6C
             $8B $1E $34 $70 $8B $47 $0A $2B $44 $0A $8B $F8 $81 $FF [$F800W]
             {$7D} $05 $C7 $44 $0E $FFFFW  $81 $FF [$FC00W]  {$7D} $0C $C7 $44 $0E
             [$FFFFW]  $C7 $44 $1E {$1F06W}  $EB $43 $0B [$FF] {$7D} $11 $C7 $44 $0E
             [$0001W]  $C7 $44 $1E {$1E8EW}  $C7 $44 $08 [$0008W]  $EB $2E $81 $FF
             [$0400W]  {$7D} $11 $C7 $44 $0E [$FFFFW]  $C7 $44 $1E {$1E8EW}  $C7 $44
             $08 [$0008W]  $EB $17 $81 $FF [$0800W]  {$7D} $0C $C7 $44 $0E [$0001W]
             $C7 $44 $1E {$1F06W}  $EB $05 $C7 $44 $0E [$0001W]  $5F $5E $5D $CB


Walking Frenchy doesn't charge

This behavior code removes the charging checks meaning that the Frenchy will not charge Keen, only throw chips at him. As a result of this the Frenchy will have a much wider attack range and throw more projectiles.

Keen Dreams

#Frenchy walking without charging behavior code
%patch $893E $55 $8B $EC $56 $57 $8B $76 $06 $8B $44 $0C $8B $1E $34 $70 $2B
             $47 $0C $99 $33 $C2 $2B $C2 $3D [$0008W]  {$7E} $14 $9A $16C40026RL
                 $3D [$0008W]  {$7D} $4A $8B $44 $0E $F7 $D8 $89 $44 $0E $EB $40
             $8B $1E $34 $70 $8B $47 $0A $2B $44 $0A $8B $F8 $81 $FF [$F800W]
             {$7D} $05 $C7 $44 $0E [$FFFFW]  $81 $FF [$FC00W]  {$7D} $0C $C7 $44 $0E
             [$FFFFW]  $C7 $44 $1E [$1F06W]  $EB $17 $81 $FF [$0800W]  {$7D} $0C $C7
             $44 $0E [$0001W]  $C7 $44 $1E [$1F06W]  $EB $05 $C7 $44 $0E [$0001W]
             $5F $5E $5D $CB


Charging behavior code

This is the complete Frenchy charging behavior code, it is considerably simpler than the walking code. Its sole function is to return the Frenchy to walking when its action timer runs out. (That is either when Keen is no longer level with it.)

Keen Dreams

#Frenchy charging behavior code
%patch $88A7 $55 $8B $EC $56 $8B $76 $06 $C7 $44 $1E {$1E16W}  $5E $5D $CB


Chip throwing code

This is the complete Frenchy chip throwing behavior code. In essence it simply spawns a chip sprite. The second line sets the chip's sprite type. (Deadly) On the third line the chip is moved right 1.5 tiles if the Frenchy is facing right. All chips are spawned half a tile down from the Frenchy's top on line 3.

Chips spawn facing the same way horizontally as the Frenchy but moving downwards vertically. It is given an initial horizontal speed (left and right.) of 28 in the sixth line and an upwards speed of $FFECW. (Despite facing downwards.)

The remaining lines set the chip's activity variable to 3, its action to the first frame of the chip cycle and finally it is given a pause of 2 ticks.

Keen Dreams

#Frenchy chip throwing code
%patch $88B6 $55 $8B $EC $56 $8B $76 $06 $B8 [$0001W]  $50 $9A $044D01C9RL   
             $44 $44 $8B $1E $3E $70 $C7 $07 [$0018W]  $83 $7C {$0E} [$01] {$75} $08
             $8B $44 $0A $05 [$0180W]  $EB $03 $8B $44 $0A $8B $1E $3E $70 $89
             $47 $0A $8B $44 $0C $05 [$0080W]  $89 $47 $0C $8B $44 $0E $8B $1E
             $3E $70 $89 $47 $0E $C7 $47 $10 [$0001W]  $9A $16C40026RL     $B1
             $04 $D3 $F8 $50 $8B $44 $0E $BA $0028W  $F7 $EA $5A $2B $C2 $8B
             $1E $3E $70 $89 $47 $16 $C7 $47 $18 [$FFECW]  $C7 $47 $02 [$0003W]
             $B8 [$1F60W]  $50 $FF $36 $3E $70 $9A $044D1212RL     $83 $C4 $04
             $C7 $44 $08 [$0002W]  $5E $5D $CB


Frenchy and chip speeds

The Frenchy's chip has an initial horizontal speed of $0028W and an initial upwards speed of $FFECW, these are the only non-animation speeds relating to the Frenchy.

While walking and charging the Frenchy has a speed of $0080W, but charging animates faster and thus moves faster. The only other animation speed is that of the third chip tossing frame, where the Frenchy recoils slightly for unknown reasons.

<patch title=Sprite speed">

  1. Chip initial speeds

%patch $890E [$0028W] #Horizontal %patch $891F [$FFECW] #Vertical</syntaxhighlight>

Animation motion

#Frenchy walking
%patch $25892 [$0080W $0000W]
%patch $258B0 [$0080W $0000W]
%patch $258CE [$0080W $0000W]
%patch $258EC [$0080W $0000W]

#Frenchy charging
%patch $2590A [$0080W $0000W]
%patch $25928 [$0080W $0000W]
%patch $25946 [$0080W $0000W]
%patch $25964 [$0080W $0000W]

#Frenchy tossing chip
%patch $25982 [$0000W $0000W]
%patch $259A0 [$0000W $0000W]
%patch $259BE [$FF80W $0000W]

#Frenchy's chip
%patch $259DC [$0000W $0000W]
%patch $259FA [$0000W $0000W]


Sprite collision

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

Keen Dreams

#Frenchy walk
%patch $2589A $00000000L
%patch $258B8 $00000000L
%patch $258D6 $00000000L
%patch $258F4 $00000000L

#Frenchy charge
%patch $25912 $00000000L
%patch $25930 $00000000L
%patch $2594E $00000000L
%patch $2596C $00000000L

#Frenchy toss chip
%patch $2598A $00000000L
%patch $259A8 $00000000L
%patch $259C6 $00000000L

#Chip
%patch $259E4 $00000000L
%patch $25A02 $00000000L


Animations

The Frenchy has four animation cycles, walking, charging (The same as walking but moving faster.), tossing chips and the chip itself.

Keen Dreams

#Cache
%patch $23E86 $0127W #Frenchy cache start
%patch $23EB2 $0134W #Frenchy cache end

#Frenchy walking l/r
%patch $25886 $012DW $0127W
%patch $25890 $000AW        #Animation speed
%patch $258A4 $012EW $0128W
%patch $258AE $000AW        #Animation speed
%patch $258C2 $012FW $0129W
%patch $258CC $000AW        #Animation speed
%patch $258E0 $0130W $012AW
%patch $258EA $000AW        #Animation speed

#Frenchy charging l/r
%patch $258FE $012DW $0127W
%patch $25908 $0005W        #Animation speed
%patch $2591C $012EW $0128W
%patch $25926 $0005W        #Animation speed
%patch $2593A $012FW $0129W
%patch $25944 $0005W        #Animation speed
%patch $25958 $0130W $012AW
%patch $25962 $0005W        #Animation speed

#Frenchy tossing chips
%patch $25976 $0131W $012BW
%patch $25980 $000AW        #Animation speed
%patch $25994 $0132W $012CW
%patch $2599E $0001W        #Animation speed
%patch $259B2 $0132W $012CW
%patch $259BC $000AW        #Animation speed

#Frenchy's chip
%patch $259D0 $0133W $0133W
%patch $259DA $0004W        #Animation speed
%patch $259EE $0134W $0134W
%patch $259F8 $0004W        #Animation speed


Sprite positioning

These patches relate to the position of sprites relating to the Frenchy.


Spawn height

The Frenchy spawns 16 pixels (1 tile) higher then where it is placed in-level. This must be changed with its sprite height as it is used to make the Frenchy move along the ground.

Keen Dreams

#Frenchy spawn height
%patch $8886 [$FF00W] #16 pixels upwards


Attack ranges

The Frenchy will charge or toss a chip if Keen is less than $30 pixels (3 tiles.) above or below the Frenchy by default. Whether it turns, charges or tosses depends on how close Keen is to it. If Keen is far it will toss a chip, closer and it will turn in his direction, closer still and it will charge at him.

The first check is how far left Keen is. If Keen is very far left (8 tiles or more) the Frenchy will go to its chip tossing action. If Keen is closer (Between 8 and 4 tiles) then it will turn to face him but not toss a chip. If Keen is even closer (Less than 4 tiles) it will continue with other checks that result in it charging Keen if Keen is left of it.

After this there is a check for how far right Keen is. If he closer than 4 tiles then the Frenchy will turn to face Keen and go to its charging action. Following this is a check to see whether Keen is further than 8 tiles away. If he is the Frenchy will turn right and toss a chip, otherwise it will simply turn.

Keen Dreams

#Vertical attack range
%patch $8956 [$0300W]  {$7E} #3 tiles u\d

#Left turn\toss range
%patch $897C [$F800W]  {$7D} #8 tiles left
%patch $8987 [$FC00W]  {$7D} #4 tiles left

#Right turn\toss range
%patch $89AE [$0400W]  {$7D} #8 tiles right
%patch $89C5 [$0800W]  {$7D} #4 tiles right


Chip shooting position

All chips spawn 8 pixels of half a tile lower than the top of the Frenchy's head. If the Frenchy is shooting right then the chip will also spawn 24 pixels (1.5 tiles) right of the Frenchy's left side.

Keen Dreams

#Chip spawn position
%patch $88EC [$0080W] #Vertical
%patch $88DA [$0180W] #Right if Frenchy shooting right


Sprite-tile interaction

All three of the Frenchy's tile interactions are generic and used by many sprites. That used when walking and charging lets it turn when hitting walls or the edges of platforms, but won't let it move down slopes. That used when shooting is unknown and that used by the chips lets them bounce on the ground.

Keen Dreams

#Walking Frenchy
%patch $2589E $07C50299RL
%patch $258BC $07C50299RL
%patch $258DA $07C50299RL
%patch $258F8 $07C50299RL

#Charging Frenchy
%patch $25916 $07C50299RL
%patch $25934 $07C50299RL
%patch $25952 $07C50299RL
%patch $25970 $07C50299RL

#Frenchy tossing chip
%patch $2598E $07C501DDRL
%patch $259AC $07C501DDRL
%patch $259CA $07C501DDRL

#Chip
%patch $259E8 $086804AFRL
%patch $25A06 $086804AFRL


Probability and randomness

There is only one random event Frenchy do, that is to randomly turn around when Keen is not attackable. If this is set to maximum ($00FFW) then the Frenchy will do nothing but turn around until Keen gets too close.

Keen Dreams

#Chance of turning
%patch $8960 $0008W


Action type

The Frenchy's actions are quite basic and thus are type 0, with the exception of its thrown chip, which needs to fly smoothly through the air and animate. Its actions are type 3.

Sprite action types

#Frenchy walk
%patch $2588A [$0000W]
%patch $258A8 [$0000W]
%patch $258C6 [$0000W]
%patch $258E4 [$0000W]

#Frenchy charge
%patch $25902 [$0000W]
%patch $25920 [$0000W]
%patch $2593E [$0000W]
%patch $2595C [$0000W]

#Frenchy toss chip
%patch $2597A [$0000W]
%patch $25998 [$0000W]
%patch $259B6 [$0000W]

#Chip
%patch $259D4 [$0003W]
%patch $259F2 [$0003W]


Deprotect and stick to ground

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

Sprite deprotect, stick

#Frenchy walk
%patch $2588C [$0000W $0001W]
%patch $258AA [$0000W $0001W]
%patch $258C8 [$0000W $0001W]
%patch $258E6 [$0000W $0001W]

#Frenchy charge
%patch $25904 [$0001W $0001W]
%patch $25922 [$0001W $0001W]
%patch $25940 [$0001W $0001W]
%patch $2595E [$0001W $0001W]

#Frenchy toss chip
%patch $2597C [$0000W $0000W]
%patch $2599A [$0000W $0000W]
%patch $259B8 [$0000W $0000W]

#Chip
%patch $259D6 [$0000W $0000W]
%patch $259F4 [$0000W $0000W]


Sprite spawn code

There is one type of Frenchy. In its initiation code its cache is set in $C7 $06 $70CAW $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 Frenchy 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 Frenchy spawns 16 pixels or 1 tile higher than where it is placed, this needs to be changed if its sprite height changes.

Keen Dreams

#Frenchy initiation pointer
%patch $4A3D $0417W #Frenchy (At $48E7)

#Frenchy initiation code
%patch $48E7 $FF $36 $7052W  $FF $36 $7050W  $9A $086801E1RL     $83 $C4 $04
             $8B $1E $3E $70 $C7 $47 $02 $0000W  $C7 $06 $70CAW  $0001W  $E9
             $00C3W

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