don't click here

Here is a guide I want to see used

Discussion in 'Engineering & Reverse Engineering' started by Hitaxas, Apr 10, 2012.

  1. Hitaxas

    Hitaxas

    Retro 80's themed Twitch streamer ( on hiatus) Member
    Tl;dr
    So today I come here with a short guide to fix a "bug" that is present all 3 of the original trillogy that I am sure most people could care less about, but it bothers me.
    The "bug" is that, when jumping and landing, even without any horizontal movement, the character will display a single frame of the walking animation.

    This glich remains in all popular hacks as well.
    those I tested were:
    Pana Der HejHog
    Sonic 2 Heroes
    Sonic 2 Retro Remix
    The S Factor
    Sonic Extended Edition
    Sonic 1 Megamix

    This is rather simple to fix, and I would like to see it corrected in future hacks. So I now present you with a short guide, written to explain this "bug" and correct it. Keep in mind this guide was written as if you were to never have made changes to Sonic's animations, so this does not cover the guide that adds spindash to Sonic 1.

    Interestingly enough, the standing frame is not in an animation of it's own, but is in the waiting animation. When jumping, then landing, the Sonic_ResetOnFloor routine calls for animation 0, which is the walking animation. This is what causes this bug.

    The fix? It is as simple as making a few changes to the Sonic_ResetOnFloor routine.

    As always, anything I write a guide for will be written based off my work with Sonic 2, and as such, behaves differently when compared to Sonic 1 (in fact, this guide might not work at all for it. If that is the case let me know, and I will try to look into it, but I am lazy currently). I normally work with the 2007 version of Sonic 2, but I will also try to cover the newer HG versions of Sonic 1 and 2 (Not Sonic 3, because I am lazy). However, there is a huge difference in the Sonic_ResetOnFloor routine from Sonic 1 to Sonic 2, which I will be covering as well.

    So, let us get down to work!

    we will need to visit the routine I mentioned before:
    Code (ASM):
    1. Sonic_ResetOnFloor:
    Once there we will have to do some moddification to this routine. But first, I will cover Sonic 1, and how to make this routine behave like it does in S2.

    As you can see, in Sonic 1, this routine contains far less code than it's Sonic 2 equivalent. Seeing as how this is not the original focus of this guide, I have decided to post an already finished modification of this routine. I have also gone through the effort to comment this routine as well as possible, to help explain exactly what it does
    Code (ASM):
    1.  
    2. Sonic_ResetOnFloor:         ; XREF: PlatformObject; et al
    3. ; handles the part when sonic lands from a jump, resets his radius size and clears spinning status
    4.     btst    #2,status(a0)                    ; is sonic's status set to spinning?
    5.     beq.s   Sonic_ResetOnFloor_Part2         ; if the check comes up equal, let part2 handle the rest
    6.     bclr    #2,ObStatus(a0)                  ; clear spinning status
    7.     move.b  #$13,obHeight(a0)                ; this increases Sonic's collision height to standing
    8.     move.b  #9,obWidth(a0)                   ; fix Sonic's x radius to match normal
    9.     subq.w  #5,obY(a0)                   ; move Sonic up 5 pixels so the increased height doesn't push him into the ground
    10.     move.b  #id_Walk,obAnim(a0)              ; use running/walking animation
    11.  
    12. ; loc_1B0DA:
    13. Sonic_ResetOnFloor_Part2:
    14.     bclr    #1,ObStatus(a0)                  ; clear inair status
    15.     bclr    #5,ObStatus(a0)                  ; clear pushing status
    16.     bclr    #4,ObStatus(a0)                  ; clear rolljumping status
    17.     move.b  #0,$3C(a0)                       ; move 0 into $3C/ clear the jumping flag
    18.     move.w  #0,(v_itembonus).w               ; clear the chain hit counter, to avoid Sonic getting an insane score for no reason
    19.     move.b  #0,$27(a0)                       ; flip_angle, this clears the angle Sonic is facing
    20.     move.b  #0,$29(a0)                       ; flip_turned, supposedly resets the direction Sonic is flipped in, however seemingly does nothing as he will face the direction he landed in
    21.     move.b  #0,$2C(a0)                       ; flips remaining, this clears the number of flip revolutions remaining
    22.     move.w  #0,($FFFFF66C).w                 ; Sonic_Look_delay_counter, resets the look delay for the camera. Might be useless unless you ported over the lookingup/ducking delays from S2
    23.     move.b  #id_Walk,obAnim(a0)              ; use running/walking animation
    24.  
    25. Sonic_ResetOnFloor_END:
    26.     rts
    27.  
    As you can see, we still have work to do, as this still only calls for the walk animation.
    We will need to check for certain conditions for this however, because if left/right is being pressed, we do not want Sonic to slide around on the floor in Standing animation.

    How do we do this? first we will need to check for Sonic's inertia:
    Code (ASM):
    1.         tst.w   inertia(a0) ; is Sonic moving? ; Sonic 2007 and HG
    or:
    Code (ASM):
    1.         tst.w   obInertia(a0)   ; is Sonic moving? ; S1 HG

    we will need to place this above the line that loads Sonic's walking animation

    then we will need to branch if it is not equal (or higher than 0, in a sense). So place this under the line

    we just added:
    Code (ASM):
    1.         bne.w   Sonic_ResetonFloor_Part2Sub1    ; if yes, branch ; S2 2007/HG version
    2.  
    Or:
    Code (ASM):
    1.         bne.w   Sonic_ResetonFloorSub1  ; if yes, branch ; S1 HG version
    2.  
    Now we will add a line to load the waiting animation, which contains the standing frame, we will need to

    also add a branch and create the tiny subroutine I just told you to branch to:
    Code (ASM):
    1.  
    2. ; S2 2007 and HG version
    3.         move.b  #$5,anim(a0)                      ; use standing/waiting animation
    4.         bra.s   Sonic_ResetOnFloor_Part2
    5.  
    6. +
    7.         move.b  #0,anim(a0)                      ; use running/walking/standing animation
    8.  
    Or:

    Code (ASM):
    1. ; Sonic 1 HG version
    2.     move.b  #id_Wait,obAnim(a0)              ; use "standing" animation
    3.     bra.s   Sonic_ResetOnFloor_Part2
    4.  
    5. Sonic_ResetOnFloorSub1:
    6.     move.b  #id_Walk,obAnim(a0)              ; use running/walking animation

    We will then make the same moddification to Sonic_ResetOnFloor_Part2 (and for Sonic_ResetOnFloor_Part3 for

    those hacking S2), just copy the last few lines you added, and place them before the call for the walking

    animation for each following part of the code. And change the lines branched to accordingly.

    If you followed these steps, then you are ready to build and test the game.

    Seems to work well, except for one tiny issue. When you stand at the very bottom of a slope, and jump... Sonic slides backwards in his standing frame! Ok, this is a simple fix.

    Go to this routine:
    Code (ASM):
    1. Sonic_SlopeResist:
    2.  
    Before the line that reads:
    Code (ASM):
    1.     add.w   d0,inertia(a0)  ; change Sonic's $14
    2.  
    add this line:
    Code (ASM):
    1.     move.b  #0,anim(a0) ; S2 2002/HG
    2.  
    Or:
    Code (ASM):
    1.     move.b  #id_Walk,obAnim(a0)              ; use running/walking animation
    And that should fix that issue. Which also concludes this guide.
     
  2. SegaLoco

    SegaLoco

    W)(at did you say? Misfit
    While reading this I have to ask, is there a conglomeration of all bugfixes for the original games somewhere? Like strictly bugfixes, no added features, just things that make the games run better?
     
  3. Hitaxas

    Hitaxas

    Retro 80's themed Twitch streamer ( on hiatus) Member
    There is a section of the SCHG How-To Guide that covers just bug fixes for both Sonic 1 and 2.
     
  4. Jayextee

    Jayextee

    Monochrome Cat Game Guy™ Member
    3,219
    5
    18
    Atro City
    I DONE MAKED GAMES.
    I appreciate your efforts, but no. Seriously, no. That one frame looks good and natural. You try jumping on the spot; you'll find that landing right into your standing position is unnatural. At the very least you brace your landing impact slightly. Maybe you land one foot first and then the other to stable yourself - exactly like the current Sonic animation.

    There's a reason it never gets 'fixed' - it isn't broken.
     
  5. Mercury

    Mercury

    His Name Is Sonic Tech Member
    I don't think this is necessarily a bug - if Sonic lands, he uncurls and settles into place. Without the one "walking" frame, he'd just be immediately standing, and it would look kind of weird.
     
  6. Hitaxas

    Hitaxas

    Retro 80's themed Twitch streamer ( on hiatus) Member
    I still stand by my opinion. Try jumping in place, you should land back on two feet at the same time, unless you are severely unbalanced. Sonic is obviously a pro at jumping, so landing with balance should be of no problem to him.

    The topic description DID say "Or: a guide to fix a bug nobody cares about". When I put that there, it meant opinions would differ. =P
     
  7. Jumping in place? Can you curl into a ball while you jump in mid air? I don't really think this is a bug either but whatever :v Nicely done either way.
     
  8. jbr

    jbr

    Member
    59
    20
    8
    Apologies if these is already well-known (first post after all :) ) but by far the most extensive list of Sonic 1 bugfixes I've seen is on Mecury's site. He's even released the source, called ReadySonic. There's stuff on there I'd never even noticed.

    I'm also on the fence as to whether this particular 'bug' was intentional, although I'm leaning towards bug. I suppose it's conceivable that it was done on purpose as a sort of landing frame, but if you were going to do that wouldn't you do like a bended-knees sprite or something? I guess it's very rare that you perform a standing jump during normal play, so it could easily have been missed.
     
  9. dsrb

    dsrb

    Member
    3,149
    0
    0
    It isn't restricted to standing jumps:
    “even without” does not equal “only without”.

    Now that I think of it, this'll be why I always see Sonic doing the same step after jumps in S1. I never specifically noticed it in any of the others; perhaps they are just different enough for me to miss it.

    But despite having said all of that, I too am not sure that it's a bug. The whole “Try jumping in place, you should land back on two feet at the same time, unless you are severely unbalanced” thing is totally irrelevant (and not even a good effort), since we don't spin while jumping (as Irixion said); if we did, we'd need a bit of time (a.k.a. a frame) to get back to standing as normal.

    Edit—Also:
    [​IMG]
     
  10. jbr

    jbr

    Member
    59
    20
    8
    My implicit assumption which I kinda forgot to write is that it doesn't matter so much when you move in-air, since you would expect to have some momentum when you land and therefore a walking animation doesn't look wrong. Unlike a standing jump, when it does look (in my opinion) a bit weird. But that assumption is probably wrong in some cases too.
     
  11. Hitaxas

    Hitaxas

    Retro 80's themed Twitch streamer ( on hiatus) Member
    I want to mention this guide is purely based in my personal opinion, so I suppose it is more of a design choice rather than a bug fix, for the most part.

    I might go further as to make a guide to make it behave more like the advanced series, so that the character uncurls before they hit the ground, which would look better.

    Edit: fixed the post, which was fucked up and was made from my phone while drunk.
     
  12. RetroKoH

    RetroKoH

    Member
    1,661
    18
    18
    Project Sonic 8x16
    Please don't do this... Modern Sonic is an argument against this... :(

    EDIT: Let's all keep in mind, in videogames, realism be damned... and that is for the best. We need to make the gameplay playable with the most fun, and few bugs as possible that will hinder our gameplay. Realism in what is really an abstract game (Anthropomorphic animals that spin into pinballs beating up a fat man that contructs mechanical monstrosities faster than you can blink) is really not that necessary in the grand scheme of things. I get that it's your opinion, and it's a completely optional design change... but I think such effort could be put towards a better design concept. If you want to go for something that at least looks better... take an earlier suggestion, and change the code so that instead of the first frame of the walking animation, you see a new, 1 frame animation of Sonic landing with bent knees bracing himself.
     
  13. amphobius

    amphobius

    doing more important things with my life Member
    2,120
    0
    16
    life
    Uh, no. It looks natural to uncurl from a ball.

    What isn't cool is Sonic 4's uncurling, which is what you're thinking of (and why people still argue over a fucking design which has been in use for far less time is beyond me). This is talking about Sonic uncurling as he hits the ground from a jump. This looks natural and is a good aesthetic change.
     
  14. RetroKoH

    RetroKoH

    Member
    1,661
    18
    18
    Project Sonic 8x16
    Then I'm fine with that... But if its anything like Sonic 4, or Modern Sonic in Generations... Not so much....

    Perhaps this is the fix we should see.