Patch:Teleporter (Sprite)

From KeenWiki
Jump to navigation Jump to search

This page covers patches relating to the Teleporter sprites in Keen 5. These are created when Keen uses the secret teleporter. As such they are not a 'proper' sprite but rather a temporary entity. It can still be manipulated like an ordinary sprite however. There are two distinct teleporter sprites, the 'upper zap' and the 'lower zap' defined by their position relative to the teleporter.

Patches relating to tile-based teleporters in other games can be found on the Patch:Teleporter page. Turning the Miragia sprite into a teleporter is covered on Patch:Map (Keen 4).


Sprite Type

Teleporter zaps use sprite type 24, which is used only by them and does not affect anything else. The upper and lower zaps are spawned in different places and can, in principle, use different sprite types.

Keen 5

#Teleporter sprite type
%patch $FEB3 $18 #Upper zap
%patch $FF06 $18 #Lower zap


Sprite Actions

There are four actions associated with teleporter sprites; two each for the upper and lower zaps. Both are created simultaneously when Keen uses the teleporter and remain active in two frame loops until Keen wins the level.

Actions:
$1A6EW #Teleporter upper zap 1
$1A8CW #Teleporter upper zap 2
$1AAAW #Teleporter lower zap 1
$1AC8W #Teleporter lower zap 2

Keen 5

#Spawn (When Keen teleports)
%patch $FEDE [$1A6EW] #Upper zap
%patch $FF2E [$1AAAW] #Lower zap

#Upper zap loop
%patch $31DCA [$1A8CW] #Upper zap
%patch $31DE8 [$1A6EW] #Upper zap

#Lower zap loop
%patch $31E06 [$1AC8W] #Lower zap
%patch $31E24 [$1AAAW] #Lower zap


Sprite Behavior

The teleporter zaps have no behaviors at all,t hey are entirely for show. (Keen winning the level and exiting is triggered by something else.)

Keen 5

#Upper zap
%patch $31DBE $00000000L  #Nothing
%patch $31DDC $00000000L  #Nothing

#Lower zap
%patch $31DFA $00000000L  #Nothing
%patch $31E18 $00000000L  #Nothing


Speed and Jump Height

The teleporter zaps do not move in any way.

Animation motion

#Upper zap
%patch $31DBA [$0000W $0000W]
%patch $31DD8 [$0000W $0000W]

#Lower zap
%patch $31DF6 [$0000W $0000W]
%patch $31E14 [$0000W $0000W]


Sprite Collision

The teleporter zaps have no collision at all, as again, they are entirely for display purposes.

Keen 5 collision values

#Upper zap
%patch $31DC2 $00000000L  #Nothing
%patch $31DE0 $00000000L  #Nothing

#Lower zap
%patch $31DFE $00000000L  #Nothing
%patch $31E1C $00000000L  #Nothing


Animations

The teleporter zaps' animations are one of the few important properties they have as this is their primary purpose, display.

Keen 5

#Cache
%patch $31A56 [$0122W] #Teleport cache start
%patch $31AAA [$0125W] #Cache end

#Teleport upper zap
%patch $31DAE $0122W $0122W
%patch $31DB8 $0006W        #Animation speed
%patch $31DCC $0123W $0123W
%patch $31DD6 $0006W        #Animation speed

#Teleport lower zap
%patch $31DEA $0124W $0124W
%patch $31DF4 $0006W        #Animation speed
%patch $31E08 $0125W $0125W
%patch $31E12 $0006W        #Animation speed


Sounds

There are two sounds related to the teleporter, it is not currently known under what conditions they play. Both however can be blocked.

Keen 5

#Sound
%patch $D40D  $29 #Teleport 1
%patch $D645  $29 #Teleport 2

Keen 5

#Don't play Teleport 1 sound
%patch $D40C  $EB $0A

#Don't play Teleport 2 sound
%patch $D644  $EB $0A


Sprite positioning

The two zaps spawn relative to Keen. The upper zap spawns five tiles above him and 8 pixels left, while the lower one spawns 8 pixels up. Notice that all three values are 'reversed'; that is, negative even though they appear positive here.

Keen 5

#Spawn heights
%patch $FEC1 [$0080W] #Lower zap: 8 pixels left
%patch $FED4 [$0500W] #Upper zap: 5 tiles up
%patch $FF24 [$0080W] #Lower zap: 8 pixels up


Clipping and foreground

The teleporter zaps have a foreground variable of 3, meaning it appears in front of all tiles and sprites, as expected given they are used for display. They have no clipping as expected of something that can appear over solid tiles.

Keen 5

#Teleporter zaps foreground variables
%patch $FEAA [$0003W] #Upper zap
%patch $FEFD [$0003W] #Lower zap

Keen 5

#Teleporter zaps clipping variables
%patch $FEAF [$0000W] #Upper zap
%patch $FF02 [$0000W] #Lower zap


Sprite-tile interaction

The teleporter zaps have no need to interact with tiles and use a generic 'avoid solid tiles' collision

Keen 5

#Upper zap
%patch $31DC6 $090B17B5RL #Solid
%patch $31DE4 $090B17B5RL #Solid

#Lower zap
%patch $31E02 $090B17B5RL #Solid
%patch $31E20 $090B17B5RL #Solid


Action type

All actions relating to the teleporter zaps are type 0, since they do not move and simply sit in one place.

Keen 5

#Upper zap
%patch $31DB2 [$0000W]
%patch $31DD0 [$0000W]

#Lower zap
%patch $31DEE [$0000W]
%patch $31E0C [$0000W]


Deprotect and stick to ground

The teleporter zaps do not use either of these two variables.

Keen 5

#Upper zap
%patch $31DB4 [$0000W $0000W]
%patch $31DD2 [$0000W $0000W]

#Lower zap
%patch $31DF0 [$0000W $0000W]
%patch $31E0E [$0000W $0000W]


Sprite spawn code

The teleporter's spawn code is exceedingly simple. It merely sets the teleporter zap cache so that the game does not crash when Keen teleports. As such the complete spawn code is only two lines.

Keen 5

#Location of initiation code
%patch $F5BE [$651W]  #Teleporter (At $F3A1)

#Teleporter Initiation code- set cache
%patch $F3A1 $C7 $06 $C2A9W  $0001W