PATCH (beta): Teleporting within a level

Completed patches for Keen1.
User avatar
adurdin
Site Founder
Posts: 549
Joined: Fri Aug 29, 2003 11:27 pm
Location: Edinburgh, Scotland
Contact:

PATCH (beta): Teleporting within a level

Post by adurdin »

This patch changes the secret-level teleporter in Keen 1 so that it works only for teleporting within a level.

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
In order to use this, you must work out the x and y coordinates of the destination relative to the location of the teleporter, then set the sprite number on the teleporter to yyxx, where yy and xx are the hex values of the relative y and x coordinates (note that this sprite number is calculated the same way as that for a bridge switch).

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!
Last edited by adurdin on Thu Sep 25, 2003 7:18 am, edited 2 times in total.
User avatar
adurdin
Site Founder
Posts: 549
Joined: Fri Aug 29, 2003 11:27 pm
Location: Edinburgh, Scotland
Contact:

Post by adurdin »

Something worth noting with this patch is that it will free up about 350 bytes of code, which can then potentially be used for lots of other patches. (For comparison, this patch has the longest single block of code out of any of the patches I've written so far, and it's only 98 bytes long)
xtraverse
Patch Crafter
Posts: 290
Joined: Tue Sep 02, 2003 6:42 pm
Location: Easter Island
Contact:

Post by xtraverse »

:droooooooool

You are my god adurdin.
Matze82
Posts: 25
Joined: Tue Sep 02, 2003 11:46 am
Location: Germany
Contact:

Post by Matze82 »

:D Wow!
That's fabolous. You're the best!

Thanks, Matze82
Scizor CT
Posts: 67
Joined: Sun Sep 07, 2003 6:12 pm

Post by Scizor CT »

Andrew, at the rate you're going, we'll never even need the source code to make changes. Great job.
KeenRush
Patch Maker
Posts: 1988
Joined: Sun Aug 31, 2003 2:52 pm
Location: Sand Yego
Contact:

Post by KeenRush »

WOW!!!!!!!!!111!!
This is so GREAT!!! I can't hardly sit on my chair without falling down!
AWESOME!!!!!!!!!!!!!! This makes possible so many cool things, ah, can't wait to get using it! Perfect in CKCM too..
Yowza
Posts: 153
Joined: Tue Sep 02, 2003 11:21 am

Post by Yowza »

*Drooool*
User avatar
CommanderSpleen
Posts: 1017
Joined: Sun Aug 31, 2003 12:11 pm
Location: The Land of Sparkly Things
Contact:

Uhh... there are no words to describe this...

Post by CommanderSpleen »

Woah... Sorry to use your name in vain, but MY GOD THIS ROCKS!

Woo. 30 whacked out insane patched-up levels, here I come!

:D:D:D:D:D

>Commander Spleen
User avatar
adurdin
Site Founder
Posts: 549
Joined: Fri Aug 29, 2003 11:27 pm
Location: Edinburgh, Scotland
Contact:

Post by adurdin »

OK, there was a bug in the initial patch file, but I've fixed it now. The patch in the first message is now the latest, correct version.

But there still could be other issues -- those mod makers who are using this, please let me know how you're going with it.
AutomaticGarg
Posts: 32
Joined: Sat Sep 20, 2003 8:21 pm
Contact:

Post by AutomaticGarg »

i tried it out and it works very well... could you maybe make a patch so that by setting to a certain value u can teleport to somewhere on the map? not that i'd use it, but others might.
User avatar
adurdin
Site Founder
Posts: 549
Joined: Fri Aug 29, 2003 11:27 pm
Location: Edinburgh, Scotland
Contact:

Post by adurdin »

Teleporting onto the map is *much* more complicated. That's what the original teleport code used to do; in fact this code is taking the place of the original code.
I could make a patch so that you can specify in the level where on the map you'd like to go, but I'm not sure how useful it would be...
KeenRush
Patch Maker
Posts: 1988
Joined: Sun Aug 31, 2003 2:52 pm
Location: Sand Yego
Contact:

Post by KeenRush »

Hmmm, I think it could be pretty useful; if making different looking places for map. I bet community mod will have use for it.
User avatar
grelphy
Posts: 219
Joined: Fri Sep 05, 2003 12:41 am
Location: the Armageddon Machine

Post by grelphy »

*klunk*

You may be sure that i'll be making a new mod by the time i pick my jaw up off the floor just to use this patch...
User avatar
ckguy
Posts: 465
Joined: Tue Oct 14, 2003 11:20 am
Location: Wakefield, RI, US
Contact:

Post by ckguy »

Would it be possible to go through the teleport when the player pressed a certain key ... like Alt, say?
KeenRush
Patch Maker
Posts: 1988
Joined: Sun Aug 31, 2003 2:52 pm
Location: Sand Yego
Contact:

Post by KeenRush »

I have thought the exactly same question, with the alt-button too! :)
That would be pretty neat, it could add more "choice" for the player, for example there could be something corridor full of teleports and player would need to choose. "The problem is choice."
Post Reply