Jump to content
Jet Set Willy & Manic Miner Community

An Enhanced Teleport Routine for JSW


IRF

Recommended Posts

Please see the attached test file.  I've implemented a teleport routine, based on John Elliott's but in this case, each teleporter has six definition bytes, in turn:

 

Source room number

Source y-coordinate

Source x-coordinate

Destination x-coordinate

Destination y-coordinate

Destination room number

 

So, unlike in John's original routine, the exact position of the teleporter may vary between source and receiver room.  Or you could have a teleport which takes Willy from one part of a room to another part of the same room.

 

y-coordinates are specified in terms of (pixelsx2) from the top (it's probably best if these are cell -aligned i.e. a multiple of #10, although there are a couple of half-aligned examples in the test file i.e. multiples of #08, where Willy falls into or out of a teleporter); x-coordinates are specified in terms of cell-columns in from the left column.  All numbers are in hexadecimal.

 

The subroutine to implement this is at #9718-#9765 (CALLed from #8B70), and the teleporter data are stored at #9767 (number of teleporters in the game) and #9768-#97AF (12 x 6-byte definitions).

 
As part of the new code, there is a CALL to an existing subroutine at #8E9C, which is necessary to ensure that Willy's attribute coordinates remain aligned with his pixel coordinates.
 
Final technical detail: Each time Willy enters a teleporter, there is a CALL to the 'Play an intro message sound [and border] effect' at #96DE.  I haven't defined the input (A register) going into that routine, so it picks up the previous value stored in A (which happens to be the room number of the destination room).  As a result, the pitch (and duration) of the sound varies from room to room. e.g. if Willy teleports into a room with a high value for the room number, the noise has a relatively low pitch and long duration, etc.  (I recommend turning off the in-game tune to observe the variations in the noise associated with the teleporters.)

 

******

 

There are about twelve teleporters inserted into the test file.  They take Willy on a tour of all the 'Forbidden Holy Grounds' in the original game, and then he ends up on The Bow of his Yacht.

 

Enjoy!

Teleport+ Test File.z80

Edited by IRF
Link to comment
Share on other sites

'The Off Licence' is a 'special case', the room number is of course zero.  You might think that is a very low number and expect almost no noise at all (compare 'At the Foot of the MegaTree', Room 3, where there's barely a blip).

But Room 0 is effectively treated as Room #100 (256 in decimal) by the DJNZ loop that controls the pitch (via the B register) - B is decremented before a check is made for a zero value, so it goes 'all the way round' before the routine detects a value of B which is detected as zero.  Hence the lengthy 'horn' sound!
 
EDIT: I've modified the test file slightly so that Willy has to 'fall into' one teleporter, and 'fall out of' another.  However, care must be taken when a teleporter isn't cell-aligned, because if Willy jumps into one, he can emerge in the destination room mid-jump, which can lead to him 'falling through' solid platforms!

Edited by IRF
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.