Jump to content


Photo

An Enhanced Teleport Routine for JSW


  • Please log in to reply
3 replies to this topic

#1 IRF

IRF

    Advanced Member

  • Contributor
  • 3,841 posts

Posted 18 September 2017 - 11:28 PM

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 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!

Attached Files


Edited by IRF, 19 September 2017 - 07:25 AM.


#2 Spider

Spider

    DEC (HL)

  • Administrator
  • 3,424 posts

Posted 19 September 2017 - 12:07 AM

hehe that's great. :)

 

I did notice the 'journeys locations' and the changing sound effect. The effect from Master Bedroom to Off Licence has a pleasing almost 'horn' like tone to it. I tried that at double speed too and it still sounded good.


  • IRF likes this
Changing order to chaos since 1984

#3 IRF

IRF

    Advanced Member

  • Contributor
  • 3,841 posts

Posted 19 September 2017 - 06:54 AM

'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, 19 September 2017 - 01:06 PM.


#4 jetsetdanny

jetsetdanny

    Advanced Member

  • Contributor
  • 1,922 posts

Posted 20 September 2017 - 07:51 PM

Good stuff, Ian! Congratulations on creating this solution  :) .






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users