Patch:Canteloupe Cart

From KeenWiki
Jump to navigation Jump to search

Canteloupe Carts are rainbow colored fast-moving carts, somewhat resembling roller-coaster carts, found in several levels in Tuberia in Keen Dreams, notably Melon Mines. They will move back and forth allowing Keen to stand on them to avoid ground-level hazards.

Carts are the cause of the climb up nothing glitch as they are the only sprites capable of pushing Keen also found near poles.


Sprite Type

Carts use type 12 which has no impact on any other sprites but does allow Keen to stand on them. Changing this thus means Keen cannot ride them anymore.

Keen Dreams

#Carts sprite type
%patch $8793 $0C


Sprite Actions

The Cart has a simple set of actions. It is spawned in the first frame of its moving cycle and continues moving indefinitely.

Actions:
$1DDAW Cart 1
$1DF8W Cart 2

Keen Dreams

#Place Cart in level
%patch $87BA [$1DDAW]

#Moving cycle
%patch $25866 [$1DF8W]
%patch $25884 [$1DDAW]


Sprite Behavior

The Cart does not have any behavior of its own at all.

Keen Dreams

#Moving Cart
%patch $2585A $00000000L
%patch $25878 $00000000L


Speed

Carts' speed is determined entirely by their animation motion.

Animation motion

#Walking
%patch $25856 [$0020W $0000W]
%patch $25874 [$0020W $0000W]


Sprite collision

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

Keen Dreams

#Cart move
%patch $2585E $00000000L
%patch $2587C $00000000L


Animations

The Cart is very simple, it has only two, very similar animations as it moves back and forth.

Keen Dreams

#Cache
%patch $23E84 $0125W #Cart cache start
%patch $23EB0 $0126W #Cart cache end

#Cart move
%patch $2584A $0125W $0125W
%patch $25854 $0005W        #Animation speed
%patch $25868 $0126W $0126W
%patch $25872 $0005W        #Animation speed


Sprite positioning

The Cart spawns 3 pixels higher then where it is placed in-level. This must be changed with its sprite height as it is used to make the Cart move along the ground.

Keen Dreams

#Cart spawn height
%patch $87A5 [$FFD0W] #3 pixels upwards


Sprite-tile interaction

The Cart has its own tile interaction that does not appear to be used by any other sprite. This makes it turn around when it hits walls or comes to the end of a platform.

Keen Dreams

#Cart moving
%patch $25862 $0868014BRL
%patch $25880 $0868014BRL


Cart can fly back and forth

This patch alters the tile collision so that the Cart doesn't turn when reaching the left or right edges of platforms. This means it can fly back and forth turning when it hits walls.

Keen Dreams

#Carts move in air, not on ground
%patch $87DF $75
%patch $87F2 $75


Action type

The Cart needs to move smoothly back and forth but do little else. As such it uses type 1 for both its actions.

Sprite action types

%patch $2584E [$0001W]
%patch $2586C [$0001W]


Deprotect and stick to ground

The Cart does not stick to ground, which is unusual among sprites that behave as it does. It does deprotect its animations, which is curious.

Sprite deprotect, stick

%patch $25850 [$0001W $0000W]
%patch $2586E [$0001W $0000W]


Sprite spawn code

There is only one type of Cart; in its initiation code its cache is set in $C7 $06 $70C8W $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 and $C7 $47 $0E $xxxxW is the horizontal direction the sprite starts moving in, either $0001W (Facing right), $FFFFW (Facing left) or $0000W (Neither, never used.) $C7 $47 $10 $xxxxW is the vertical direction and works similarly. The Cart spawns moving right and down.

Finally $D3 $E0 $05 $FF80W is how far up the Cart 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.

Keen Dreams

#Cart initiation pointer
%patch $4A3B [$03FEW] #Cart (At $48CE)

#Cart initiation code
%patch $48CE $FF $36 $7052W  $FF $36 $7050W  $9A $08680100RL     $83 $C4 $04
             $C7 $06 $70C8W  $0001W  $E9 $00E5W

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