Wind tunels in Labyrinth Zone (Sonic 1)

Discussion in 'Discussion and Q&A Archive' started by Psycho RFG, Oct 5, 2011.

Thread Status:
Not open for further replies.
  1. Psycho RFG

    Psycho RFG Well-Known Member Member

    Joined:
    Feb 22, 2011
    Messages:
    234
    I have looked about it but I still didn't find the answer, so here is the question: How could I add another wind tunels in Labyrinth Zone?
     
  2. DanielHall

    DanielHall Well-Known Member Member

    Joined:
    Jan 18, 2010
    Messages:
    860
    Location:
    North Wales
    I think it's activated by Obj0C, the door object.
     
  3. Hwd405

    Hwd405 Newcomer In Limbo

    Joined:
    Sep 13, 2011
    Messages:
    19
    I'm sure there's a tunnel somewhere in Labyrinth Zone that doesn't force you through. I don't think this tunnel has a door, unlike the other wind tunnels.
     
  4. SpirituInsanum

    SpirituInsanum Well-Known Member Member

    Joined:
    Feb 11, 2010
    Messages:
    642
    Adding a wind tunnel is kind of tricky.


    I won't detail much but here are some infos you'll need:


    - Each level in labyrinth has 1 wind tunnel excepted for the first one (level 0) which has two. Each wind tunnel data is made of 4 words (left, top, right, bottom).


    - The address of the data in the array is calculated by multiplying the level number by 8 and adding it to the address of the array.


    - The wind tunnel array begins 8 bytes (4 words) before the "LZWind_Data:" label. This is a trick used to have two wind tunnels in act 1. That trick is the subq.w #8,a2 before loc_3E56.


    - The number (minus one) of wind tunnels in the level is moved in d1 in the routine, this is used for the loop so in level 1, it checks two positions rather than one.


    - The LZWind_Loop routine compares Sonic's position with the coordinates given in the array.


    So, in order to add a wind tunnel in a level, you have to modify this system so rather than using only one wind tunnel per level, it can use as many as you want.


    For example, you could add an array with the number of wind tunnels in every level minus one (eg: NbOfWindTunnels: dc.b 1,2,0,0 ; for 2, 3, 1 and 1 wind tunnels), move that value to d1 to make the game loop as many times as necessary for the given level, then use this array to calculate and modify the address of the data to use.


    It should be simple enough, you only have to modify things from LZWindTunnels to loc_3E56 to use an array for the number of wind tunnels and modify the LZWind_Data array accordingly.


    edit: corrected a mistake (bytes/words)
     
    Last edited by a moderator: Oct 6, 2011
  5. Psycho RFG

    Psycho RFG Well-Known Member Member

    Joined:
    Feb 22, 2011
    Messages:
    234
    Interesting information. Let's see if I can do something with this.


    Thanks a lot SpirituInsanum!
     
Thread Status:
Not open for further replies.