don't click here

Roll-jumping has always bothered me

Discussion in 'Engineering & Reverse Engineering' started by MoDule, Dec 27, 2009.

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

    MoDule

    Tech Member
    327
    24
    18
    Procrastinating from writing bug-fix guides
    So has anyone else ever noticed something odd when you jump while rolling? Not the fact that you can't control your horizontal movement, that's intentional. What I mean is that sometimes upon landing Sonic jerks up slightly, delaying your ability to jump right afterward. Lets look at the relevant code:
    Code (ASM):
    1. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
    2.  
    3. ; loc_1AA38:
    4. Sonic_Jump:
    5.     move.b  (Ctrl_1_Press_Logical).w,d0
    6.     andi.b  #button_B_mask|button_C_mask|button_A_mask,d0 ; is A, B or C pressed?
    7.     beq.w   return_1AAE6    ; if not, return
    8.     ;snip
    9.     move.b  #$13,y_radius(a0)   ; set to standing height    ;<-- I mean this
    10.     move.b  #9,x_radius(a0)     ; and width
    11.     btst    #2,status(a0)   ; is Sonic rolling?
    12.     bne.s   Sonic_RollJump  ; if yes, branch
    13.     move.b  #$E,y_radius(a0)    ; set to rolling height
    14.     move.b  #7,x_radius(a0)     ; and width
    15.     move.b  #2,anim(a0) ; use "jumping" animation
    16.     bset    #2,status(a0)
    17.     addq.w  #5,y_pos(a0)
    18.  
    19. return_1AAE6:
    20.     rts
    21. ; ---------------------------------------------------------------------------
    22. ; loc_1AAE8:
    23. Sonic_RollJump:
    24.     bset    #4,status(a0)   ; set the rolling+jumping flag
    25.     rts
    26. ; End of function Sonic_Jump
    So, when Sonic is already rolling and he jumps his height is reset to standing height, even though his size shouldn't change at all. Then we have the part:

    Code (ASM):
    1. Sonic_ResetOnFloor_Part2:
    2.     ;snip
    3.     btst    #2,status(a0)
    4.     beq.s   Sonic_ResetOnFloor_Part3
    5.     bclr    #2,status(a0)
    6.     move.b  #$13,y_radius(a0) ; this increases Sonic's collision height to standing
    7.     move.b  #9,x_radius(a0)
    8.     move.b  #0,anim(a0) ; use running/walking/standing animation
    9.     subq.w  #5,y_pos(a0)    ; move Sonic up 5 pixels so the increased height doesn't push him into the ground
    This will push him up by 5 pixels whether he's roll-jumping or not.

    My question here is: which part is wrong? Is it not supposed to reset his height when he jumps, or should it check for roll-jumping before he gets moved up? I personally tend to the former. What is your stance on this? Why would Sonic need to have his height reset?
    I'd also like to point out that this was never fixed in any main-series 16-bit game. It existed all the way into s3k.
     
  2. Tidbit

    Tidbit

    Member
    Well, its seems that this lil bit:
    Code (ASM):
    1. move.b #$13,y_radius(a0)
    is also used in the bottom part for when sonic lands back on the ground. Im thinking that if you reduced the value $13 to something lower it might reduce the ammount he jumps. Or you cound try getting rid of this code :
    Code (ASM):
    1.  subq.w #5,y_pos(a0) ; move Sonic up 5 pixels
     
Thread Status:
Not open for further replies.