Spring Jump in the works

Discussion in 'Discussion and Q&A Archive' started by warr1or2, Feb 19, 2011.

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

    warr1or2 I AM CLG Member

    Joined:
    Apr 7, 2008
    Messages:
    417
    Location:
    Town Creek, AL
    http://www.4shared.com/account/document/Qo...jPLEwHITReTu4Vz this is coding for a JUMPDADH. I want to change it to use UP+a, b, or c as button presses, and use the animation as seen on signature ( [​IMG] <- this one )


    everytime I try to change coding I somehow cause the game to crash. How can i add this and not mess anything up? (I have spindash and jumpdash in the game via S1Hacking studio as seen here



    and yes it's the ninja gaiden running theme, i want a speedy level and to use this)
     
  2. SpirituInsanum

    SpirituInsanum Well-Known Member Member

    Joined:
    Feb 11, 2010
    Messages:
    642
    I'm not sure I understood what you want... You want something like the "walk-jump" bug when Sonic is on the ground, and the player presses up+A/B/C? Or do you want it to be like a replacement for the jump dash, jump+up+A/B/C?


    From your comment on the video, I'd say you want the first one, but since you're using the jump dash code to do this... :/


    If you want the walk-jump, the best would be to change the sonic_jump routine. If you don't want anything different in the jump other than the animation, just add a check for the up button after the line that sets animation to rolling, and branch accordingly to set the spring animation. Something like that:




    move.b #2,$1C(a0) ; use "jumping" animation


    bset #2,$22(a0) ; set the "jumping or rolling" flag


    btst #0,($FFFFF603).w ; test up button


    bne.s @nowalkjump ; if not pressed, skip next line


    move.b #$10,$1C(a0) ; use "spring" animation


    bset #2,$22(a0) ; clear the "jumping or rolling" flag


    ; add more changes before the next line if necessary


    @nowalkjump:



    That's the idea. You may also need to set Sonic's height and width back to their defaults, but I don't have their values in mind. Other fixes might be required, and if you want, for example, the jump speeds to be different, you can also increase/decrease the speeds there.
     
  3. vladikcomper

    vladikcomper Well-Known Member Member

    Joined:
    Dec 2, 2009
    Messages:
    415
    I can't understand exactly what you want as well. If you only want to modify Jump Dash code, then try something like this:



    ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||

    if _JUMPDASH_


    Sonic_JumpDash:


    cmpi.b #2,$1C(a0) ; is Sonic rolling?


    bne.s Sonic_JD_Rts ; if no, branch


    btst #7,$22(a0) ; was Jump Dash flag set?


    bne.s Sonic_JD_Rts ; if yes, branch


    btst #iUp,(SonicControl|Held) ; ++ is Up being held?


    beq Sonic_JD_Rts ; ++ if not, branch


    tpress A+B+C,(SonicControl) ; is A, B or C pressed?


    beq.w Sonic_JD_Rts ; if not, branch


    bset #7,$22(a0) ; set Jump Dash flag


    move.w #$BC,d0 ; play JD sound


    jsr (PlaySound_Special).l ;


    move.w #$900,$10(a0) ; set Jump Dash speed


    move.b #$10,$1C(a0) ; ++ use the spring animation


    bset #2,$22(a0) ; ++ clear the "jumping or rolling" flag


    move.w #0,$12(a0) ; clear Y-velocity


    btst #6,$22(a0) ; is Sonic underwater?


    beq.s Sonic_JD_ChkShoes


    subi.w #$300,$10(a0) ; set speed to $600


    Sonic_JD_ChkShoes:


    tst.b ($FFFFFE2E).w ; does Sonic have speed shoes?


    beq.s Sonic_JD_ChkOrientation ; if not, branch


    addi.w #$200,$10(a0) ; set speed to $B00 or $500 if underwater


    Sonic_JD_ChkOrientation:


    btst #0,$22(a0)


    beq.s Sonic_JD_Rts


    neg.w $10(a0)


    Sonic_JD_Rts:


    rts


    endc


    ; End of function Sonic_JumpDash



    Note that this code is for S1 Hacking Studio 2's disassembly, if you want to use it in normal disassembly, you'll have to replace the lines where button presses are being checked with ordinar commands.


    EDIT: And yes, like SpirituInsanum has already said, to make it work perfectly, you should change Sonic's width and height (because in his rolling state, he has different sizes, not sure about width though)


    Also, could you explain how you were trying to change that code and how it didn't work?
     
    Last edited by a moderator: Feb 20, 2011
  4. warr1or2

    warr1or2 I AM CLG Member

    Joined:
    Apr 7, 2008
    Messages:
    417
    Location:
    Town Creek, AL
    actually the sprite i want to use is the one when he bounces off a spring, and when he falls using the rolling animation, using the UP and a, b, or c in air to do so, and the sound to use is the spring sound. I also am trying to add add the wall jump (found in another person's dissassembly hack), In doing this i can easily make a SECRET 1-up spot in GHZ (example - a huge wall with a tunnel leading through the area, no diagonal springs, 1-up at the top in which no other way to get it but wall jump, spring jump <wall jumps alone wouldn't do it, too wide> sort of like on Ninja Gaiden where there are areas to jump from wall to wall to advance through stage 1)
     
    Last edited by a moderator: Feb 21, 2011
  5. warr1or2

    warr1or2 I AM CLG Member

    Joined:
    Apr 7, 2008
    Messages:
    417
    Location:
    Town Creek, AL
    part 1 done thanks to you, but i need to change sound to a spring sound, and make sonic go up. the buttons and animation are correct now.


    thanks for that part


    UPDATE: found sound and changed it, need velocity change (to make sonic bounce up)


    the preview -
     
    Last edited by a moderator: Feb 21, 2011
  6. Animemaster

    Animemaster Lets get to work! Member

    Joined:
    Mar 20, 2009
    Messages:
    1,229
    Location:
    UK
    I'll help out, $10 is the x velocity, $12 is the y velocity. Hopefuly by looking at the code, you now know what you need to do =P.
     
  7. warr1or2

    warr1or2 I AM CLG Member

    Joined:
    Apr 7, 2008
    Messages:
    417
    Location:
    Town Creek, AL
    that's basically what it was

    thanks for the help with velocity, but i made the code go " move.w #-$600,$12(a0) " since this makes him bounce up, but now another prob, but i can sort it out
     
  8. warr1or2

    warr1or2 I AM CLG Member

    Joined:
    Apr 7, 2008
    Messages:
    417
    Location:
    Town Creek, AL
    Great. I modified it, Changed names except " if _JUMPDASH_ " but i tried changing the name and it came up some errors.


    with this change i want to add back the jumpdash. i add the code but it won't work. is there anything to change?
     
  9. vladikcomper

    vladikcomper Well-Known Member Member

    Joined:
    Dec 2, 2009
    Messages:
    415
    if _JUMPDASH_
    <...> ; Jump Dash code


    endc



    This construction is actually a directive for the compiler to assembly Jump Dash code if this ability is enabled via S1 Hacking Studio 2, i.e. if the "Jump Dash" Option in Tweaking tab is on.


    Look at config.asm file in SourceCode folder, you'll see something like this:



    ; ===========================================================================
    ; * S1HS - Hack configuration file *


    ; ===========================================================================


    ; This file is generated by S1HS to configure the hack.


    ; Note: this file is getting overriten every time you press Save button in


    ; S1HS until you disable Tweaking in Options tab.


    ; ===========================================================================


    _DEBUG_ equ 1


    ; Sonic Tweaking


    _SPINDASH_ equ 1


    _JUMPDASH_ equ 1


    _SPEEDCAPFIX_ equ 1


    _SPIKEBUGFIX_ equ 0


    ; Boss Hits


    var_BHits_GHZ = 8


    var_BHits_MZ = 8


    var_BHits_SYZ = 8


    var_BHits_LZ = 8


    var_BHits_SLZ = 8


    var_BHits_FZ = 1



    This file basically configures your hack, it disables or enables some features.


    Constants declared here are used in 'if ... endc' constructions, just like in your case. If you change 'if _JUMPDASH_' to another name, it won't work, because the name must be declared. You better just to remove this this line, as well as 'endc' in the very end of Jump Dash code. They don't do anything in game.


    Also, do you want to have both Jump Dash and new Spring Jump in you hack? I can't get it clearly, I have problems with understanding your post, maybe due to my weak English.


    Anyway, if you want to do so, then rename all the labels in your new code, then add original Jump Dash code. After this, go to "Obj01_MdJump2" and add



    bsr Sonic_SpringJump



    somewhere in the beginning. 'Sonic_SpringJump' is an example name for the label where your code starts.
     
  10. warr1or2

    warr1or2 I AM CLG Member

    Joined:
    Apr 7, 2008
    Messages:
    417
    Location:
    Town Creek, AL
    I figured it out. but one prob now. I can Spring Jump right, but when i try to Spring Jump left it bounces sonic to the right. (maybe I need to add a "is sonic facing left/right" code)
     
  11. Animemaster

    Animemaster Lets get to work! Member

    Joined:
    Mar 20, 2009
    Messages:
    1,229
    Location:
    UK
    Now thats an idea :).
     
Thread Status:
Not open for further replies.