Code: Select all
%ext ck1
%version 1.31
# Change the teleporter so it works within the level (updated 24/09/03)
%patch $8919 $89 $F0 $F7 $2E $08 $6C $01
$F8 $D1 $E0 $C4 $1E $4C $6C $01 $C3 $26 $8B $07 $50 $88 $E0 $98
$99 $01 $F0 $83 $D2 $00 $B1 $0C $E8 $16 $58 $89 $16 $E4 $6E $A3
$E2 $6E $05 $00 $B0 $83 $D2 $FF $A3 $D4 $6E $89 $16 $D6 $6E $58
$98 $99 $01 $F8 $83 $D2 $00 $B1 $0C $E8 $F5 $57 $89 $16 $E0 $6E
$A3 $DE $6E $05 $00 $70 $83 $D2 $FF $A3 $D0 $6E $89 $16 $D2 $6E
$C3
%patch $4572 $E8 $A4 $43 $EB $13 $90
%end
For example, if I want a teleporter at (132, 6) to take Keen to (54, 41), then the relative coordinates are x:(54-132)=-78, y:(41-6)=35, and in hex these become xx:$B2, yy:$23, giving a sprite number $23B2, or 9138.
The only thing to be aware of when using this is that the teleporter destination must be at least 10 tiles away from the sides of the level, and at least 6 tiles away from the top and bottom of the level.
If you are using TileInfo, and your teleporter is made up of more than one tile, then you'd be best off setting only one of the tiles of it to the "teleporter" behaviour, so that you only need to calculate and put sprite numbers on one of its tiles in the levels.
Update: The bug I mentioned earlier has been fixed. And consequently (though unexpectedly), the resulting code is 10 bytes shorter!