Some changes and fixes for Sonic 2

Discussion in 'Engineering & Reverse Engineering' started by Esrael, Jun 7, 2012.

  1. E-122-Psi

    E-122-Psi

    Member
    1,985
    111
    43
    Has the bug in VS mode concerning the power up music changes staying on if the utilising player loses a life got a fix?
     
  2. MoDule

    MoDule

    Tech Member
    322
    5
    18
    Procrastinating from writing bug-fix guides
    I could've sworn I made a fix for this at some point, but I can't find it anymore. Anyway, here's the fix:

    Code (Text):
    1. ; loc_3F926: KillSonic:
    2. KillCharacter:
    3.     tst.w    (Debug_placement_mode).w
    4.     bne.s    .return
    5.  
    6. ;-------- bugfix --------
    7. ; reset stats and music upon death
    8.     move.w    #1,invincibility_time(a0)    ; make invincibility run out
    9.     move.w    #1,speedshoes_time(a0)        ; make speed shoes run out
    10.     cmpa.w    #MainCharacter,a0
    11.     bne.s    .p2
    12.  
    13.     tst.b    (Super_Sonic_flag).w
    14.     beq.s    .notSuper
    15.  
    16.     move.b    #0,(Super_Sonic_flag).w        ; remove super status
    17.     move.b    #2,(Super_Sonic_palette).w
    18.     move.w    #$28,(Palette_frame).w
    19.  
    20. .notSuper:
    21.     jsr    (Obj01_ChkInvin).l    ; remove player 1's power ups
    22.     bra.s    .kill
    23.  
    24. .p2:
    25.     jsr    (Obj02_ChkInvinc).l    ; remove player 2's power ups
    26. ;---- end bugfix --------
    27.  
    28.  
    29. .kill:
    30.     clr.b    status_secondary(a0)
    31.     move.b    #6,routine(a0)
    32.     jsrto    (Sonic_ResetOnFloor_Part2).l, JmpTo_Sonic_ResetOnFloor_Part2
    33.     bset    #1,status(a0)
    34.     move.w    #-$700,y_vel(a0)
    35.     move.w    #0,x_vel(a0)
    36.     move.w    #0,inertia(a0)
    37.     move.b    #AniIDSonAni_Death,anim(a0)
    38.     bset    #high_priority_bit,art_tile(a0)
    39.     move.w    #SndID_Hurt,d0
    40.     cmpi.b    #ObjID_Spikes,id(a2)
    41.     bne.s    .playSound
    42.     move.w    #SndID_HurtBySpikes,d0
    43.  
    44. .playSound:
    45.     jsr    (PlaySound).l
    46.  
    47. .return:
    48.     moveq    #-1,d0
    49.     rts
    The changes are between the two bugfix comments. The only other thing I changes was replace the nameless temporary symbols with named local symbols. As a bonus, I threw in a Super Sonic detransformation.
     
  3. E-122-Psi

    E-122-Psi

    Member
    1,985
    111
    43
    You probably did, but this is a hard to track gold mine of fixes now. :P
     
  4. MoDule

    MoDule

    Tech Member
    322
    5
    18
    Procrastinating from writing bug-fix guides
    If anything, it's hidden away on an old hard drive somewhere. I have at least one old disassembly somewhere with a bunch of bugfixes that I never published.
     
  5. Hitaxas

    Hitaxas

    Retro 80's themed Paladins Twich streamer Member
    Here is one more design choice change that can be made.
    Extending the limit to how many frames Sonic, Tails or Knuckles can have!

    Now, this is a bit limited due to how the animation subroutine for player characters works, but it does allow for more frames than what the game normally allows.
    In this example, I will be using Sonic. However, this can be applied to Tails or Knuckles as well.

    For Sonic, locate the label
    Code (Text):
    1. SAnim_Do2
    now, look for a line that reads
    Code (Text):
    1. cmpi.b    #$F0,d0
    Change this to
    Code (Text):
    1. cmpi.b    #$FD,d0
    This will allow for 12 more frames of animation!

    Edit: Actually, change it to $FD, as this is supposed to be the number AFTER the max amount of frames. Therefore, setting to $FD allows for $FC amount of frames to be usable.
     
    Last edited: Jul 26, 2020