Patch:Melon Lips

From KeenWiki
Jump to navigation Jump to search

Melon Lips are harmless green creatures that are found in dark, usually underground areas in several levels in Tuberia in Keen Dreams. They do not move but are dangerous as they will spit a deadly melon seed every five seconds. They can fire down, left and right, so there are three kinds.


Sprite Type

Melons use type 14 which has no impact on any other sprites. Pips use type 24 which affects how Keen reacts to it.

Keen Dreams

#Broccolash sprite type
%patch $89F5 [$0E] #Melons
%patch $8A62 [$18] #Pips


Sprite Actions

The Melon has a simple, if extensive, set of actions. It is spawned in-level in its 'waiting' action which will, after a time go to its spitting action, where it will make a pip. After that it will go to a 'return' action that basically allows it to hold its spitting animations for a little while without making more pips. There are two types of melon, horizontal and vertical. The horizontal melons can be either left or right facing.

The pips have two actions in a perpetual cycle that lasts until a certain amount of time is up, when they vanish.

Actions:
$1F9CW #Horizontal melon wait
$1FBAW #Horizontal melon spit
$1FD8W #Horizontal melon return
$1FF6W #Down melon wait
$2014W #Down melon spit
$2032W #Down melon return
$2050W #Horizontal pip 1
$206EW #Horizontal pip 2
$208CW #Down pip 1
$20AAW #Down pip 2

Keen Dreams

#Place Melon in level
%patch $8A23 [$1F9CW] #Horizontal
%patch $8A28 [$1FF6W] #Vertical

#Melons make:
%patch $8AB4 [$2050W] #Horizontal pip
%patch $8B14 [$208CW] #Vertical pip

#Horizontal melon wait
%patch $25A28 [$1FBAW]

#Horizontal melon make pip
%patch $25A46 [$1FD8W]

#Horizontal melon return
%patch $25A64 [$1F9CW]

#Down melon wait
%patch $25A82 [$2014W]

#Down melon make pip
%patch $25AA0 [$2032W]

#Down melon return
%patch $25ABE [$1FF6W]

#Horizontal pip
%patch $25ADC [$206EW]
%patch $25AFA [$2050W]

#Down pip
%patch $25B18 [$20AAW]
%patch $25B36 [$208CW]


Sprite Behavior

Behaviors:
$07C501A4RL #Move through the air
$086803CBRL #Melon spit pip

The Melon and pips have only one unique behavior; that used by Melons to produce pips (both horizontal and vertical.) The pips themselves use a general 'move through the air' behavior. Note that only one frame of the horizontal\vertical Melons use the behavior. Melons have no behavior while waiting to shoot or just after shooting.

Keen Dreams

#Horizontal Melon
%patch $25A1C $00000000L
%patch $25A3A $086803CBRL
%patch $25A58 $00000000L

#Down Melon
%patch $25A76 $00000000L
%patch $25A94 $086803CBRL
%patch $25AB2 $00000000L

#Horizontal pip
%patch $25AD0 $07C501A4RL
%patch $25AEE $07C501A4RL

#Down pip
%patch $25B0C $07C501A4RL
%patch $25B2A $07C501A4RL


Speeds

The Melon's animation speeds are not used for anything, the sprite speeds are all set in game code.

Sprite speeds

#Horizontal Melon
%patch $25A18 [$0000W $0000W]
%patch $25A36 [$0000W $0000W]
%patch $25A54 [$0000W $0000W]

#Down Melon
%patch $25A72 [$0000W $0000W]
%patch $25A90 [$0000W $0000W]
%patch $25AAE [$0000W $0000W]

#Horizontal pip
%patch $25ACC [$0000W $0000W]
%patch $25AEA [$0000W $0000W]

#Down pip
%patch $25B08 [$0000W $0000W]
%patch $25B26 [$0000W $0000W]


Sprite collision

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

Keen Dreams

#Horizontal Melon
%patch $25A20 $00000000L
%patch $25A3E $00000000L
%patch $25A5C $00000000L

#Down Melon
%patch $25A7A $00000000L
%patch $25A98 $00000000L
%patch $25AB6 $00000000L

#Horizontal pip
%patch $25AD4 $00000000L
%patch $25AF2 $00000000L

#Down pip
%patch $25B10 $00000000L
%patch $25B2E $00000000L


Animations

Melon Lips come in two different types, each with their own animations. The pips come in two different types, again with their own animations. Each animation is quite simple.

Keen Dreams

#Cache
%patch $23E88 $0135W #Melon cache start
%patch $23EB4 $0140W #Melon cache end

#left/right melon
%patch $25A0C $0137W $0135W
%patch $25A16 $00C8W        #Animation speed
%patch $25A2A $0138W $0136W
%patch $25A34 $0006W        #Animation speed
%patch $25A48 $0138W $0136W
%patch $25A52 $0006W        #Animation speed

#down melon
%patch $25A66 $0139W $0139W
%patch $25A70 $00C8W        #Animation speed
%patch $25A84 $013AW $013AW
%patch $25A8E $0006W        #Animation speed
%patch $25AA2 $013AW $013AW
%patch $25AAC $0006W        #Animation speed

#left/right pip
%patch $25AC0 $013DW $013BW
%patch $25ACA $0004W        #Animation speed
%patch $25ADE $013EW $013CW
%patch $25AE8 $0004W        #Animation speed

#down pip
%patch $25AFC $013FW $013FW
%patch $25B06 $0004W        #Animation speed
%patch $25B1A $0140W $0140W
%patch $25B24 $0004W        #Animation speed


Sprite-tile interaction

The Melons do not interact with tiles in any way, their interaction code merely displays their sprites. The pips on the other hand will bounce off of floors an walls and both horizontal and vertical pips use the same code.

Keen Dreams

#Horizontal melon
%patch $25A24 $07C501DDRL
%patch $25A42 $07C501DDRL
%patch $25A60 $07C501DDRL

#Vertical melon
%patch $25A7E $07C501DDRL
%patch $25A9C $07C501DDRL
%patch $25ABA $07C501DDRL

#Horizontal pip
%patch $25AD8 $086804AFRL
%patch $25AF6 $086804AFRL

#Vertical pip
%patch $25B14 $086804AFRL
%patch $25B32 $086804AFRL


Action type

While the melons themselves just sit and thus use type 0 actions, the pips are different. Horizontal pips don't animate but move smoothly and so are type 2. Vertical pips animate as well and so are type 3.

Sprite action types

#Horizontal melon
%patch $25A10 [$0000W]
%patch $25A2E [$0000W]
%patch $25A4C [$0000W]

#Vertical melon
%patch $25A6A [$0000W]
%patch $25A88 [$0000W]
%patch $25AA6 [$0000W]

#Horizontal pip
%patch $25AC4 [$0002W]
%patch $25AE2 [$0002W]

#Vertical pip
%patch $25B00 [$0003W]
%patch $25B1E [$0003W]


Deprotect and stick to ground

The Melons and their pips have no need for either of these variables and so have a value of 0 for both in all their actions.

Keen Dreams

#Horizontal melon
%patch $25A18 [$0000W $0000W]
%patch $25A36 [$0000W $0000W]
%patch $25A54 [$0000W $0000W]

#Vertical melon
%patch $25A72 [$0000W $0000W]
%patch $25A90 [$0000W $0000W]
%patch $25AAE [$0000W $0000W]

#Horizontal pip
%patch $25ACC [$0000W $0000W]
%patch $25AEA [$0000W $0000W]

#Vertical pip
%patch $25B08 [$0000W $0000W]
%patch $25B26 [$0000W $0000W]


Sprite spawn code

There are three types of Melon lips. In their initiation code their cache is set in $C7 $06 $70CCW $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. The Broccolash spawns facing right.

Note that on line 5 a check is made of what type the melon is; if it is type 2 then the melon uses the vertical action. On line 3 a similar check is made that decides whether the horizontal melons will be left or right facing.

Keen Dreams

#Melon lips initiation pointers
%patch $4A3F [$0439W] #Melon Lips left (At $4909)
%patch $4A41 [$0439W] #Melon Lips right (At $4909)
%patch $4A43 [$0439W] #Melon Lips down (At $4909)

#Melon initiation code
%patch $4909 $A1 $70ACW  $2D $0032W  $50 $FF $36 $7052W  $FF $36 $7050W  $9A
             $0868035ERL     $83 $C4 $06 $8B $1E $3E $70 $C7 $47 $02 $0000W
             $C7 $06 $70CCW  $0001W  $E9 $009AW

#Melon spawn code
%patch $89DE $55 $8B $EC $56 $8B $76 $0A $33 $C0 $50 $9A $044D01C9RL     $44
             $44 $8B $1E $3E $70 $C7 $07 [$000EW] $8B $46 $06 $B1 $08 $D3 $E0
             $89 $47 $0A $8B $46 $08 $D3 $E0 $89 $47 $0C $0B $F6 $74 $07 $C7
             $47 $0E [$0001W]  $EB $09 $8B $1E $3E $70 $C7 $47 $0E [$FFFFW]  $83
             $FE [$02] {$7D} $05 $B8 [$1F9CW]  $EB $03 $B8 [$1FF6W]  $50 $FF $36 $3E
             $70 $9A $044D1212RL     $83 $C4 $04 $9A $16C40026RL     $D1 $F8
             $8B $1E $3E $70 $89 $47 $1A $89 $77 $3E $5E $5D $CB