Fixing the top-right corner reloading glitch in S1

Discussion in 'Tutorials Archive' started by SpirituInsanum, Sep 3, 2012.

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

    SpirituInsanum Well-Known Member Member

    Joined:
    Feb 11, 2010
    Messages:
    642
    You may have noticed this minor glitch in Sonic 1:

    [​IMG]



    It can happen anywhere, but most of the time when going right and up or down, and it will get worse if you remove the speed cap.


    To summarize MarkeyJester's explanation on the matter, the 68k is too slow to transfer all the blocks soon enough if that transfer happens too long after the v-blank interruption.


    Among the possible fixes proposed, rewriting the routine to make the block/tiles loading faster or making the transfer happen sooner seemed too technical and long for me. So rather than doing that, I decided to give the map plane redrawing some advance, one column should be enough after all.


    This fix is far from being complicated: we have 5 lines to change.


    Go in Draw_FG and Draw_BG1, and find this:




    move.w #$140,d5



    You'll find it twice in Draw_FG and twice in Draw_BG1. Replace those lines with:




    move.w #$150,d5



    If you do only this, there will be holes in the planes when going up or down, one block per line.


    In order to fix this, we have to load one more block per line.


    Go in DrawTiles_LR (this routine is used to redraw a line of blocks) and replace




    moveq #$15,d6



    with




    moveq #$16,d6



    That's it, the problem should be gone.


    Thanks to Vladikcomper for his commented version of the redrawing routine which helped me a lot.
     
    Nat The Porcupine likes this.
  2. redhotsonic

    redhotsonic Also known as RHS Member

    Joined:
    Aug 10, 2007
    Messages:
    2,969
    Location:
    England
    I will look into fixing this for my Sonic 2 hack, but isn't this due to the camera manager? I believe it's practically the same in Sonic 1 and 2, but in S3K, it had a new manager, fixing this problem.


    Either way, nice fix. This was something that always bugged me in Sonic 2.


    EDIT: Tried this for my Sonic 2 hack. Tried reproducing the bug in my Great Gate Zone and in Gem Runway Zone (my fastest level) and even with water, can't reproduce the glitch. I'm glad you shared this with us.
     
    Last edited by a moderator: Sep 3, 2012
  3. SpirituInsanum

    SpirituInsanum Well-Known Member Member

    Joined:
    Feb 11, 2010
    Messages:
    642
    It doesn't happen in S2, I don't really know why, but maybe the blocks are redrawn earlier as Markey suggested, since the routine itself is essentially the same.
     
  4. redhotsonic

    redhotsonic Also known as RHS Member

    Joined:
    Aug 10, 2007
    Messages:
    2,969
    Location:
    England
    Eh? Yes it does. Try CPZ, it's there all the time =P
     
  5. SpirituInsanum

    SpirituInsanum Well-Known Member Member

    Joined:
    Feb 11, 2010
    Messages:
    642
    Really? I never managed to see it there xD


    Well, this could/should fix it in s2 as well then, thanks for the info.
     
  6. redhotsonic

    redhotsonic Also known as RHS Member

    Joined:
    Aug 10, 2007
    Messages:
    2,969
    Location:
    England
    Yeah, it's quite common in CPZ. To be honest, I've never noticed this bug in Sonic 1 =P


    But your fix here works for both Sonic 1 and 2.
     
  7. Psycho RFG

    Psycho RFG Well-Known Member Member

    Joined:
    Feb 22, 2011
    Messages:
    234
    Well done! It's good to see another bug finally fixed. Thanks for this guide.
     
Thread Status:
Not open for further replies.