Chaos Emeralds Giving Abilites (Revisted)

Discussion in 'Tutorials Archive' started by shadowbeasts, Jan 11, 2010.

Thread Status:
Not open for further replies.
  1. shadowbeasts

    shadowbeasts I'm Legend Member

    Joined:
    Jan 5, 2009
    Messages:
    286
    Location:
    Good 'ol USA.
    The guide is now a copy/paste guide the original can be found here. On with the guide:


    Lets say you wanted to add the jumpdash but you didn't want sonic to get that ability without having an chaos emerald. Instead you want sonic to get one Chaos emerald to use the jumpdash. Here's how to do it. first put the jumpdash code in the ASM, found here.


    Then in the beginning of the code put



    cmpi.b #1,($FFFFFE57).w ; does Sonic have 1 emerald?
    blt.s locret_134D2 ; if less than 1 emerald, branch



    Now lets say you want sonic to get the jumpdash with a different number of emeralds. To do this you need to replace the 1 with the X number of emeralds.


    EX: “I want sonic to get the jumpdash with 3 emeralds how do I do this”


    The answer is simple change 1 to 3 like this:



    cmpi.b #3,($FFFFFE57).w ; does Sonic have 3 emeralds?
    blt.s locret_134D2 ; if less than 3 emeralds, branch



    Now doing this in Sonic 2 is a little different. For this I'm using the the Sonic 2 jumpdash. Found here.


    At the beginning of the code your going to put



    cmpi.b #1,($FFFFFE57).w ; does Sonic have 1 emerald?
    blt.w return_1AB36 ; if less than 1 emerald, branch



    Now lets say you want sonic to get the jumpdash with a different number of emeralds. To do this you need to replace the 1 with the X number of emeralds.


    EX: “I want sonic to get the jumpdash with 3 emeralds how do I do this”


    The answer is simple change 1 to 3 like this:



    cmpi.b #3,($FFFFFE57).w ; does Sonic have 3 emeralds?
    blt.w return_1AB36 ; if less than 3 emeralds, branch



    Before you say this is the same as the sonic 1 version it's not, since locret_134D2 doesn't exist in sonic 2 I changed it to return_1AB36 which works the same way. I also had to change blt.s to blt.w because the jump distance was too big.
     
    Last edited by a moderator: Apr 15, 2010
  2. shadowbeasts

    shadowbeasts I'm Legend Member

    Joined:
    Jan 5, 2009
    Messages:
    286
    Location:
    Good 'ol USA.
    Sorry for the double post but I finally got the guide to work with sonic 2 (yay! :) ) So please tell me if there are any errors or if there is anything I need to change (I would also like comments).
     
    Last edited by a moderator: Jan 14, 2010
  3. EMK-20218

    EMK-20218 The Fuss Maker Exiled

    Joined:
    Aug 8, 2008
    Messages:
    1,067
    Location:
    Jardim Capelinha, São Paulo
    I should be happy if you submit the Sonic 2's code. Should be useful for people like me. Cos's if my mind doesn't fails, some memory adresses are different there.
     
    Last edited by a moderator: Jan 15, 2010
  4. Spanner

    Spanner The Tool Member

    Joined:
    Aug 9, 2007
    Messages:
    2,570
    The RAM address for the Chaos Emeralds you have is $FFFFFFB1, the equate in the 2007 disassembly is Emerald_count. That's all you'd need to do.
     
    Last edited by a moderator: Jan 15, 2010
  5. shadowbeasts

    shadowbeasts I'm Legend Member

    Joined:
    Jan 5, 2009
    Messages:
    286
    Location:
    Good 'ol USA.
    This is for the 2007 disassembly, it's just a modified version of the Sonic 1 version I did.
     
Thread Status:
Not open for further replies.