Patch:Satellite

From KeenWiki
Jump to navigation Jump to search

The Satellite is a sprite found on the Keen 6 map that allows Keen to travel to an area he normally cannot reach. It works similar to Messie in that Keen can 'board' it at one point on the map and 'disembark' at another. These 'dropoff points' are themselves separate sprites that must be placed on the map.


Keen cannot ride the satellite

This patch prevents Keen from interacting with the Satellite entirely; he cannot ride it and therefore cannot disembark.

Keen 6

#Keen cannot ride the Satellite
%patch $FE2A $90 $90


Sprite Type

The Satellite uses sprite type 33, which is used only by it and has no real affect on anything. Dropoff points are type 24 and tell the Satellite where to pick up\ drop off Keen.

Keen 6

#Satellite sprite type
%patch $FD61 [$21]

#Satellite sprite type
%patch $FCDE [$22]


Sprite Actions

The Satellite has few actions and is quite simple to understand. It is spawned in the first frame of its only loop and continues using this four action loop indefinitely.

When Keen touches the Satellite one of two things may happen. Normally he will turn into 'hanging Keen' and be taken for a ride. However if he is already hanging (and a few other conditions are met) then he will drop off the Satellite as map Keen standing. As such a check is made for hanging Keen's action to decide which of these things to do.

Hanging Keen does not change his action at all. There is also an unknown check for hanging Keen's action.

The dropoff point is spawned using its action and does not change at all.

Actions:
$1C52W #Satellite dropoff point
$1C70W #Keen hang from satellite
$1C8EW #Satellite 1
$1CACW #Satellite 2
$1CCAW #Satellite 3
$1CE8W #Satellite 4

Keen 6

#Satellite spawned
%patch $FD7E [$1C8EW]

#Satellite loop
%patch $329DA [$1CACW]
%patch $329F8 [$1CCAW]
%patch $32A16 [$1CE8W]
%patch $32A24 [$1C8EW]

#Keen goes to hanging Keen
%patch $FED6 [$1C70W]

#Hanging Keen
%patch $329BC [$0000W]

#Check if Keen is not already hanging
%patch $FE6C [$1C70W]

#Keen drops off Satellite
%patch $FE94 [$130AW]

#Unknown check for hanging Keen
%patch $FEF4 [$1C70W]

#Spawn dropoff point
%patch $FD23 [$1C52W]

#Dropoff point sits
%patch $3299E [$0000W]


Sprite Behavior

The Satellite has a unique behavior it always uses that makes it move along a 'track' on the map. It is also responsible for allowing Keen to ride the Satellite, so changing it will result in Keen being unable to ride. Hanging Keen and the dropoff points have no behavior at all.

Behaviors:
$0EFC0E08RL #Satellite

Keen 6

#Satellite
%patch $329CE $0EFC0E08RL
%patch $329EC $0EFC0E08RL
%patch $32A0A $0EFC0E08RL
%patch $32A28 $0EFC0E08RL

#Hanging Keen
%patch $329B0 $00000000L

#Dropoff point
%patch $32992 $00000000L


Speed

The Satellite has no animation motion, nor does hanging Keen. The speed of both is controlled in their behavior codes.

Animation motion

#Satellite
%patch $329CA [$0000W $0000W]
%patch $329E8 [$0000W $0000W]
%patch $32A06 [$0000W $0000W]
%patch $32A24 [$0000W $0000W]

#Hanging Keen
%patch $329AC [$0000W $0000W]

#Dropoff point
%patch $3298E [$0000W $0000W]


Sprite Collision

Collision values

The Satellite has a unique collision that reacts to Keen, picking him up

Sprite collisions

#Satellite
%patch $329D2 $0EFC0E46RL
%patch $329F0 $0EFC0E46RL
%patch $32A0E $0EFC0E46RL
%patch $32A2C $0EFC0E46RL

#Hanging Keen
%patch $329B4 $00000000L

#Dropoff point
%patch $32996 $00000000L


Collision code

This is the complete collision code for the Satellite.

Keen 6

#Satellite sprite collision code
%patch $FE06 $55 $8B $EC $83 $EC $02 $56 $57 $8B $76 $08 $81 $7C $1C $1C52W
             $75 $0F $8B $44 $3E $8B $5E $06 $09 $47 $42 $5F $5E $8B $E5 $5D
             $CB
                 $83 $3C $02 $74 $03 $E9 $00EAW  $8B $5E $06 $8B $47 $42 $B1
             $08 $D3 $F8 $89 $46 $FE $83 $7E $FE $00 $75 $03 $E9 $00ACW  $8B
             $47 $44 $3B $46 $FE $75 $03 $E9 $00A1W  $B8 $0021W  $50 $9A $183B09F1RL
                         $83 $C4 $02 $8B $5E $06 $8B $46 $FE $89 $47 $44 $8B
             $1E $64 $A9 $81 $7F $1C $1C70W  $75 $4B $8B $7F $48 $EB $3C $83
             $3D $22 $75 $34 $8B $45 $3E $3B $46 $FE $75 $2C $8B $45 $0A $89
             $44 $0A $8B $45 $0C $89 $44 $0C $C7 $44 $1E $00C0W  $B8 $130AW 
             $50 $FF $36 $64 $A9 $9A $08F41297RL     $83 $C4 $04 $C7 $44 $06
             $0001W  $5F $5E $8B $E5 $5D $CB
                                             $8B $7D $48 $0B $FF $75 $C0 $5F
             $5E $8B $E5 $5D $CB
                                 $8B $5E $06 $8B $47 $0A $05 $00C0W  $89 $44
             $0A $8B $47 $0C $05 $0100W  $89 $44 $0C $C7 $44 $06 $0000W  $B8
             $1C70W  $50 $FF $36 $64 $A9 $9A $08F41297RL     $83 $C4 $04 $5F
             $5E $8B $E5 $5D $CB $5F $5E $8B $E5 $5D $CB
                                                         $81 $7C $1C $1C70W
             $75 $21 $8B $5E $06 $8B $47 $0A $05 $00C0W  $89 $44 $0A $8B $47
             $0C $05 $0100W  $89 $44 $0C $FF $74 $1C $56 $9A $08F41297RL    
             $83 $C4 $04 $5F $5E $8B $E5 $5D $CB


Animations

The Satellite has one four frame animation cycle. The dropoff point uses animation -1 (That is it is invisible.) There is no cache as all animations involved are cached with Keen when he is placed on the map.

Hanging Keen has a single animation for his action, but this isn't actually used. Instead a value defined in the code overrides it. Bu oddly this value is the exact same (It is, however, offset from where Keen actually is.)

Keen 6

#Satellite
%patch $329BE $00D5W $00D5W
%patch $329C8 $000AW        #Animation speed
%patch $329DC $00D6W $00D6W
%patch $329E6 $000AW        #Animation speed
%patch $329FA $00D7W $00D7W
%patch $32A04 $000AW        #Animation speed
%patch $32A18 $00D8W $00D8W
%patch $32A22 $000AW        #Animation speed

#Hanging Keen
%patch $329A0 $00E3W $00E3W
%patch $329AA $0000W        #Animation speed

#Hanging Keen's true animation
%patch $FF2E $00E3W

#Dropoff point
%patch $32982 $FFFFW $FFFFW
%patch $3298C $0000W        #Animation speed


Clipping and foreground

The Satellite and dropoff points have no clipping so it may pass through all map tiles and take Keen places. It has a foreground variable of 2 making it appear in front of all tiles not marked as foreground themselves. Oddly the invisible dropoff points have this value as well.

Keen's clipping is removed (Set to 0) when he boards the Satellite so that he can pass through solid tiles. It is reset when he disembarks.

Keen 6

#Satellite related clipping variables
%patch $FD53 [$0000W] #Satellite
%patch $FCD5 [$0000W] #Satellite dropoff point
%patch $FED3 [$0000W] #Keen board Satellite
%patch $FEA6 [$0001W] #Keen disembark Satellite

Keen 6

#Satellite related foreground variables
%patch $FD58 [$0002W] #Satellite
%patch $FCDA [$0002W] #Satellite dropoff point
%patch $FF27 [$0001W] #Keen hang from Satellite


Sprite-tile interaction

The Satellite uses a generic 'draw sprite' interaction code as it does not need to interact with tiles in any complex way. The dropoff point has no code as it doesn't even need to display a sprite image. Keen has a unique interaction that draws his hanging sprite offset from his actual (invisible) location..

Sprite tile interactions

#Satellite
%patch $329D6 $08F4180ARL
%patch $329F4 $08F4180ARL
%patch $32A12 $08F4180ARL
%patch $32A30 $08F4180ARL

#Hanging Keen
%patch $329B8 $0EFC0F5FRL

#Dropoff point
%patch $3299A $00000000L


Hanging Keen tile interaction

This is the complete code for Keen's hanging from Satellite tile interaction. It doesn't actually interact with tiles but instead draws Keen's sprite 8 pixels right and 4 pixels down from his actual location. The first blue value, 1, is the foreground value used.

Hanging Keen tile interaction

#Keen hanging from Satellite tile interaction
%patch $FF1F $55 $8B $EC $56 $8B $76 $06 $B8 [$0001W]  $50 $33 $C0 $50 $B8 [$00E3W]
                 $50 $8B $44 $0C $05 [$0080W]  $50 $8B $44 $0A $05 [$0040W]  $50
             $8B $C6 $05 $46 $00 $50 $9A $16081770RL     $83 $C4 $0C $5E $5D
             $CB


Action type

The Satellite needs to move smoothly and animate as well as react quickly. Its actions are type 3. Keen and the dropoff point need to react quickly, but don't animate and thus are type 2.

Sprite action types

#Satellite
%patch $329C2 [$0003W]
%patch $329E0 [$0003W]
%patch $329FE [$0003W]
%patch $32A1C [$0003W]

#Hanging Keen
%patch $329A4 [$0002W]

#Dropoff point
%patch $32986 [$0002W]


Deprotect and stick to ground

The Satellite has no need for either of these variables and so has a value of 0 for both in all of its actions. Keen and the dropoff point are the same.

Sprite deprotect, stick

#Satellite
%patch $329C4 [$0000W $0000W]
%patch $329E2 [$0000W $0000W]
%patch $32A00 [$0000W $0000W]
%patch $32A1E [$0000W $0000W]

#Hanging Keen
%patch $329A6 [$0000W $0000W]

#Dropoff point
%patch $32988 [$0000W $0000W]


Sprite spawn code

Only partial spawn code is available for the Satellite. There are three relevant sprites, two dropoff points and the Satellite itself. The two dropoff points use the same initiation code which according to what pointer used it passes along a 'variety' to the spawning code.

Neither initiation code sets a cache

In the spawning code $1C8EW is the sprite action the Satellite uses as it proceeds to act in-level. $C7 $02 $xxxxW sets the sprite activity, $C7 $07 $xxxxW sets the sprite type, $C7 $06 $xxxxW sets the clipping value, $C7 $20 $xxxxW sets the foreground value. Finally $D3 $E0 $05 $xxxx 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 Satellite always starts the level moving down but not horizontally. $C7 $47 $10 $xxxxW is the vertical direction the Satellite starts moving in, either $0001W (Facing down), $FFFFW (Facing up) or $0000W (Neither, seldom used.) $C7 $47 $0E $xxxxW is the horizontal direction.

A number of other variables are also set, these have unknown functions at the present time.

The dropoff point's spawn code is quite similar, setting a number of similar values. It also does two different things depending on which variety called it.

Keen 6

%patch $E9A8 [$0288W] #Satellite dropoff up (At $E6A8)
%patch $E9AA [$0288W] #Satellite dropoff right (At $E6A8)
%patch $EA02 [$0434W] #Satellite (At $E854)

#Satellite dropoff point initiation code
%patch $E6A8 $8B $46 $FA $05 [$FFD4W]  $50 $57 $56 $9A {$0EFC0CF3RL}     $83 $C4
             $06 $E9 $020BW

#Satellite initiation code
%patch $E854 $57 $56 $9A {$0EFC0D73RL}     $83 $C4 $04 $EB $67

#Satellite dropoff point spawn code
%patch $FCB3 $55 $8B $EC $56 $57 $8B $76 $06 $8B $7E $08 $33 $C0 $50 $9A
         $069A1E25RL     $83 $C4 $02 $8B $1E $66 $A9 $C7 $47 $02 [$0002W]  $C7
             $47 $06 [$0000W]  $C7 $47 $20 [$0002W]  $C7 $07 [$0022W]  $8B $C6 $89
             $47 $30 $89 $47 $2C $8B $C7 $89 $47 $32 $89 $47 $2E $8B $46 $0A
             $35 [$0001W]  $40 $89 $47 $3E $8B $C6 $B1 $08 $D3 $E0 $89 $47 $22
             $89 $47 $0A $8B $47 $22 $05 [$0100W]  $89 $47 $26 $8B $C7 $D3 $E0
             $89 $47 $24 $89 $47 $0C $8B $47 $24 $05 [$0100W]  $89 $47 $28 $B8
             [$1C52W]  $50 $53 $9A $08F41219RL     $83 $C4 $04 $5F $5E $5D $CB

#Satellite spawning code
%patch $FD33 $55 $8B $EC $83 $EC $02 $56 $57 $8B $76 $06 $8B $7E $08 $33 $C0
             $50 $9A $069A1E25RL     $83 $C4 $02 $8B $1E $66 $A9 $C7 $47 $06
             [$0000W]  $C7 $47 $20 [$0002W]  $C7 $47 $02 [$0002W]  $C7 $07 [$0021W]
             $8B $C6 $B1 $08 $D3 $E0 $89 $47 $0A $8B $C7 $D3 $E0 $89 $47 $0C
             $C7 $47 $0E [$0000W]  $C7 $47 $10 [$0001W]  $B8 [$1C8EW]  $50 $53 $9A
             $08F41219RL     $83 $C4 $04 $C7 $46 $FE [$0003W]  $8B $46 $FE $05
             [$005BW]  $8B $DF $D1 $E3 $8B $9F $8B $CA $D1 $EB $D1 $E3 $8E $06
             $79 $A9 $8B $D6 $D1 $E2 $03 $DA $26 $89 $07 $8B $1E $66 $A9 $8B
             $46 $FE $89 $47 $3E $C7 $47 $40 [$0100W]  $C7 $47 $44 [$0002W]  $5F
             $5E $8B $E5 $5D $CB