IRF Posted September 18, 2017 Report Share Posted September 18, 2017 (edited) 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 January 14, 2019 by IRF jetsetdanny and Spider 2 Quote Link to comment Share on other sites More sharing options...
Spider Posted September 19, 2017 Report Share Posted September 19, 2017 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 1 Quote Link to comment Share on other sites More sharing options...
IRF Posted September 19, 2017 Author Report Share Posted September 19, 2017 (edited) '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 September 19, 2017 by IRF Spider and jetsetdanny 2 Quote Link to comment Share on other sites More sharing options...
jetsetdanny Posted September 20, 2017 Report Share Posted September 20, 2017 Good stuff, Ian! Congratulations on creating this solution :) . IRF and Spider 2 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.