Double Jump Feature =\

Discussion in 'Engineering & Reverse Engineering' started by PsychoSk8r, Sep 6, 2007.

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

    PsychoSk8r

    PsychedelAnt | Tone Turner Oldbie
    2,582
    3
    18
    Birmingham, UK
    30 Day Project: Revisited.A New Release!
    Well, I can't figure out exactly what I'm doing wrong.
    I've been taking a look at the way the code works in the SplitASM of Sonic 1, but to no avail.

    Here's the Code:
    Code (Text):
    1. Removed
    Any help will be greatly appreciated.
     
  2. drx

    drx

    mfw Researcher
    2,245
    325
    63
    :rolleyes:
    Well, first of all the second part of the code uses a1 instead of a0.
     
  3. First of all, what sort of double jump feature do you want? The bouncing animation implies something like Sonic 3k's bubble shield double jump, but the "move Sonic upwards" contradicts that.

    Secondly, where exactly have you placed your code? That could be a problem. Thirdly, as drx said, your use of a1 instead of a0 is incorrect. I'm quoting your code below with a comment above some lines:
    Code (Text):
    1. *removed by request*
     
  4. PsychoSk8r

    PsychoSk8r

    PsychedelAnt | Tone Turner Oldbie
    2,582
    3
    18
    Birmingham, UK
    30 Day Project: Revisited.A New Release!
    Code (Text):
    1. ; ===========================================================================
    2.  
    3. Obj01_MdJump:       ; XREF: Obj01_Modes
    4.         bsr.w   Sonic_DoubleJump
    5.         bsr.w   Sonic_JumpHeight
    6.         bsr.w   Sonic_ChgJumpDir
    7.         bsr.w   Sonic_LevelBound
    8.         jsr ObjectFall
    9.         btst    #6,$22(a0)
    10.         beq.s   loc_12E5C
    11.         subi.w  #$28,$12(a0)
    Put the pointer with Obj01_MdJump, and the actual code is after Sonic_JumpHeight

    EDIT:
    I've also tried here to no avail:
    Code (Text):
    1. ; ===========================================================================
    2. ; ---------------------------------------------------------------------------
    3. ; Modes for controlling Sonic
    4. ; ---------------------------------------------------------------------------
    5.  
    6. Obj01_MdNormal:         ; XREF: Obj01_Modes
    7.         bsr.w   Sonic_DoubleJump
    8.                 bsr.w   Sonic_Spindash ;S2Final
    9.         bsr.w   Sonic_Jump
    10.         bsr.w   Sonic_SlopeResist
     
  5. If Sonic 1's control subroutines are in the same position as Sonic 2's, Obj01_MdJump would be called when Sonic is in the air but he isn't rolling. Try calling your double jump routine in Obj01_MdJump2 instead, which is the routine called when Sonic is both in the air AND rolling (aka almost definitely jumping).

    EDIT: The offset table and the code for accessing it are the same in Sonic 1 and Sonic 2, so I'm pretty sure Obj01_MdJump2 is the routine you should call your double jump code in.
     
  6. JoseTB

    JoseTB

    Tech Member
    717
    59
    28
    Shobiz is right. Although both routines are essentially the same they are referenced at different times, with Obj01_MdJump2 being the one used while jumping. Something which was changed in later builds of the engine to use one routine referenced two times, and, actually, you can remove one of them and change the references accordingly and it'll work fine. This split was probably a vestige of earlier builds.
     
  7. PsychoSk8r

    PsychoSk8r

    PsychedelAnt | Tone Turner Oldbie
    2,582
    3
    18
    Birmingham, UK
    30 Day Project: Revisited.A New Release!
    Thank You loads! The modifications to the code worked Brilliantly!
     
  8. stormislandgal

    stormislandgal

    It's not a phase! Tech Member
    4,533
    10
    18
    Married life <3
    So, did the spindash work out alright? I'll still be willing to help fix that up if you need, but I'm on my new school laptop so I can't help now. D:
     
  9. Armada

    Armada

    Sometimes I do things Member
    338
    0
    0
    Just a question to all, could I use that fixed code if I gave credits to Psycho and shobiz? I had asked this on SGMC, and I got a vauge answer to a vague question.
     
  10. Aquaslash

    Aquaslash

    Emerald Dragoon Moderator
    2,818
    0
    16
    Hampton, VA
    The S Factor: Sonia and Silver
    While we are on the subject, I'm having a problem with this type of code. Any animation I use after a jump is just a still frame.

    For reference this is the simple code I have to activate an animation in midair.
    Code (Text):
    1. Sonia_AirTwirl:         ; XREF: Obj01_MdJump, Obj01_MdJump2
    2.         tst.b   ($FFFFFFBB).w       ;Is character Sonia?
    3.         bne.s   Sonia_PowerAxe      ;If not, go to the Power Axe move
    4.         cmpi.b  #2,($FFFFFFFE).w    ;Has she jumped already?
    5.         bne.s   AirTwirlEnd         ;If not, end
    6.         move.b  ($FFFFF603).w,d0    ;Move controls to D0
    7.         andi.b  #$10,d0             ;Test for B button
    8.         bne.s   AirTwirlEnd         ;If not, end
    9.         move.w  #$1F00,$1C(a0)      ;Set animation to $1F and reset animation frame
    10.         move.w  #$BE,d0             ;Set sound to play
    11.         jsr     PlaySound_Special   ;Play sound
    12.    
    13.  
    14.         jsr     Sonia_LevelBound        ;Jump to Level Boundaries routine
    15.         jsr     Sonia_AnglePos          ;Jump to Angle routine
    16.        
    17. AirTwirlEnd:
    18.         rts
     
  11. Tweaker

    Tweaker

    Misfit
    12,389
    1
    0
    Without looking at your code at all, it sounds like the routine to display the animation is constantly being called, meaning the animation will never progress past the first frame. You might want to try adding a routine to Sonic_Animate to prevent this.
     
  12. JoseTB

    JoseTB

    Tech Member
    717
    59
    28
    Either what Tweaker said or the subroutine you have there is being called constantly; and therefore resetting the animation for each frame. If you really want that code to be processed constantly, do not touch $1D(a0). It isn't need anyway to change it, since the animation code will automatically reset the animation if $1C has changed. And this, on the other side, won't make the animation to reset even if the code is run once per frame.
     
Thread Status:
Not open for further replies.