Fix Speed Shoes music in different acts in Sonic 1

Discussion in 'Tutorials Archive' started by EditChris, Sep 22, 2013.

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

    EditChris STH:DB - Someday... Member

    Joined:
    Jul 31, 2013
    Messages:
    41
    Location:
    somewhere
    Hi, this is a special guide that only can be used when you have these things in your hack:

    If you have the 2 codes in the same hack, you must have a problem. When you take a Speed Shoes monitor, and the song starts to playing, all good, but when the music wears off, and if you are in any act 2 or act 3, the game plays the act 1's music.

    If you have this problem, this is the solution.

    First, in sonic1.asm, search this: (Obj01_ChkShoes:) and you must see this:


    Obj01_ChkShoes:
    tst.b ($FFFFFE2E).w ; does Sonic have speed shoes?
    beq.s Obj01_ExitChk ; if not, branch
    tst.w $34(a0) ; check time remaining
    beq.s Obj01_ExitChk
    subq.w #1,$34(a0) ; subtract 1 from time
    bne.s Obj01_ExitChk
    move.w #$600,($FFFFF760).w ; restore Sonic's speed
    move.w #$C,($FFFFF762).w ; restore Sonic's acceleration
    move.w #$80,($FFFFF764).w ; restore Sonic's deceleration
    move.b #0,($FFFFFE2E).w ; cancel speed shoes
    tst.b ($FFFFFE2D).w ; does Sonic have invincibility?
    moveq #0,d0
    move.b ($FFFFFE10).w,d0
    cmpi.w #$103,($FFFFFE10).w ; check if level is SBZ3
    bne.s playthemusic
    moveq #5,d0 ; play SBZ music
    playthemusic:
    lea (MusicList).l,a1 ; load music playlist
    move.b (a1,d0.w),d0 ; add d0 to a1
    jsr (PlaySound).l ; play normal music

    Well, to fix the error, replace everything with this:


    ; Speed Shoes Music fixed

    Obj01_ChkShoes:
    tst.b ($FFFFFE2E).w ; does Sonic have speed shoes?
    tst.w Obj01_ExitChk ; if not, branch
    tst.w $34(a0) ; check time remaining
    beq.s Obj01_ExitChk
    subq.w #1,$34(a0) ; subtract 1 from time
    bne.s Obj01_ExitChk
    move.w #$600,($FFFFF760).w ; restore Sonic's speed
    move.w #$C,($FFFFF762).w ; restore Sonic's acceleration
    move.w #$80,($FFFFF764).w ; restore Sonic's deceleration
    move.b #0,($FFFFFE2E).w ; cancel speed shoes
    tst.b ($FFFFFE2D).w ; does Sonic have invincibility?
    bne.s Obj01_ExitChk
    moveq #0,d0
    move.b ($FFFFFE10).w,d0
    cmpi.w #$103,($FFFFFE10).w ; check if level is SBZ3
    bne.s playthemusic
    moveq #5,d0 ; play SBZ music
    playthemusic:
    cmpi.b #$0,($FFFFFE11).w ; is this act 1?
    bne.s Obj01_SpSGetBgm2 ; if not, branch
    lea (MusicList1).l,a1 ; load Music Playlist for Acts 1
    bra.s Obj01_SpSPlayMusic ; go to PlayMusic

    Obj01_SpSGetBgm2:
    cmpi.b #$1,($FFFFFE11).w ; is this act 2?
    bne.s Obj01_SpSGetBgm3 ; if not, branch
    lea (MusicList2).l,a1 ; load Music Playlist for Acts 2
    bra.s Obj01_SpSPlayMusic ; go to PlayMusic

    Obj01_SpSGetBgm3:
    cmpi.b #$2,($FFFFFE11).w ; is this act 3?
    bne.s Obj01_SpSGetBgm4 ; if not, branch
    lea (MusicList3).l,a1 ; load Music Playlist for Acts 3
    bra.s Obj01_SpSPlayMusic ; go to PlayMusic

    Obj01_SpSGetBgm4:
    cmpi.b #$3,($FFFFFE11).w ; is this act 4?
    bne.s Obj01_SpSPlayMusic ; if not, branch
    lea (MusicList4).l,a1 ; load Music Playlist for Acts 4

    Obj01_SpSPlayMusic:
    move.b (a1,d0.w),d0
    jsr (PlaySound).l ; play normal music

    ; End of Speed Shoes music.

    That's it. If you have problems, please, say it.
     
  2. nineko

    nineko I am the Holy Cat Member

    Joined:
    Mar 24, 2008
    Messages:
    1,902
    Location:
    italy
    You know, whenever I look back at that "different songs in different acts" guide I wrote years ago, I realise how bad it is. I should really release the updated code I ended up to use in my hack, since I improved it a lot, and it already fixes the issues you're addressing here.
     
  3. SuperEgg

    SuperEgg I'm a guy that knows that you know that I know Member

    Joined:
    Oct 17, 2009
    Messages:
    Location:
    THE BEST GOD DAMN STATE OF TEXAS
    Edit: nvm. Misread your code. carry on.
     
    Last edited by a moderator: Sep 23, 2013
Thread Status:
Not open for further replies.