My Super Sonic porting help topic

Discussion in 'Discussion and Q&A Archive' started by Pokepunch, Apr 26, 2010.

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

    Pokepunch That guy who posts on occasion Member

    Joined:
    Aug 7, 2009
    Messages:
    270
    Location:
    UK
    Hello, I have ported super sonic as well as i can.But I've got some bugs.The main bug is when Super sonic is stopped the music keeps going.I have tried to fix this with no luck.I hope someone can help.


    Cookie
     
  2. Spanner

    Spanner The Tool Member

    Joined:
    Aug 9, 2007
    Messages:
    2,570
    Look at Sonic 2's coding.


    Alternatively, perhaps some code from the invincibility routines might help with storing music and replaying it after Super Sonic reverts back to normal.
     
  3. Pokepunch

    Pokepunch That guy who posts on occasion Member

    Joined:
    Aug 7, 2009
    Messages:
    270
    Location:
    UK
    I have looked at the invincibility coding and tried a few things but didn't succeed.
     
    Last edited by a moderator: Apr 26, 2010
  4. Selbi

    Selbi The Euphonic Mess Member

    Joined:
    Jul 20, 2008
    Messages:
    2,429
    Location:
    Northern Germany
    You might wanna tell us what you tried to fix it.
     
  5. Pokepunch

    Pokepunch That guy who posts on occasion Member

    Joined:
    Aug 7, 2009
    Messages:
    270
    Location:
    UK
    Well I found this piece of coding (I think its from the "play songs on different acts" guide)




    cmpi.b #$0,($FFFFFE11).w ; is this act 1?


    bne.s Obj01_GetBgm2 ; if not, branch


    lea (MusicList1).l,a1 ; load Music Playlist for Acts 1


    bra.s Obj01_PlayMusic ; go to PlayMusic


    Obj01_GetBgm2:


    cmpi.b #$1,($FFFFFE11).w ; is this act 2?


    bne.s Obj01_GetBgm3 ; if not, branch


    lea (MusicList2).l,a1 ; load Music Playlist for Acts 2


    bra.s Obj01_PlayMusic ; go to PlayMusic


    Obj01_GetBgm3:


    cmpi.b #$2,($FFFFFE11).w ; is this act 3?


    bne.s Obj01_GetBgm4 ; if not, branch


    lea (MusicList3).l,a1 ; load Music Playlist for Acts 3


    bra.s Obj01_PlayMusic ; go to PlayMusic


    Obj01_GetBgm4:


    cmpi.b #$3,($FFFFFE11).w ; is this act 4?


    bne.s Obj01_PlayMusic ; if not, branch


    lea (MusicList4).l,a1 ; load Music Playlist for Acts 4


    Obj01_PlayMusic:


    move.b (a1,d0.w),d0


    jsr (PlaySound).l ; play normal music



    I Changed the labels (to avoid erorrs)added it to my revert to normal code but nothing changed.
     
  6. MarkeyJester

    MarkeyJester ♡ ! Member

    Joined:
    Jun 27, 2009
    Messages:
    2,867
    what's in d0 before passing "move.b (a1,d0.w),d0"?
     
  7. Pokepunch

    Pokepunch That guy who posts on occasion Member

    Joined:
    Aug 7, 2009
    Messages:
    270
    Location:
    UK
    Well I have used sound e4. If that's not what you mean than I don't know
     
    Last edited by a moderator: Apr 29, 2010
  8. Pokepunch

    Pokepunch That guy who posts on occasion Member

    Joined:
    Aug 7, 2009
    Messages:
    270
    Location:
    UK
    Sorry for the double post I have a new problem:


    I Tried to make it so that when sonic is super it changes to super animations by doing this:



    Sonic_Animate: ; XREF: Obj01_Control; et al
    tst.b ($FFFFFE19).w ; is Sonic Super?


    bne.s SAnim_Super ; if yes, branch


    lea (SonicAniData).l,a1


    SAnim_Super:


    lea (SuperAniData).l,a1


    SAnim_Cont:


    moveq #0,d0


    move.b $1C(a0),d0


    cmp.b $1D(a0),d0 ; is animation set to restart?


    beq.s SAnim_Do ; if not, branch


    move.b d0,$1D(a0) ; set to "no restart"


    move.b #0,$1B(a0) ; reset animation


    move.b #0,$1E(a0) ; reset frame duration



    It built fine, but in game...


    Sonic goes through all his animations really fast. Does anyone know what the problem is??
     
    Last edited by a moderator: Jun 5, 2010
  9. vladikcomper

    vladikcomper Well-Known Member Member

    Joined:
    Dec 2, 2009
    Messages:
    415
    You did a mistake in your code... If Sonic isn't super, SuperAniData will be loaded anyway, because command to load it follows command to load normal animation.


    To fix it, you might add a branch to SAnim_Cont after "lea (SonicAniData).l,a1".


    But it's better to do it a bit different:



    Sonic_Animate: ; XREF: Obj01_Control; et al
    lea (SonicAniData).l,a1


    tst.b ($FFFFFE19).w ; is sonic super?


    beq.s Sonic_AnimRestart ; if no, branch


    lea (SuperSonicAniData).l,a1


    Sonic_AnimRestart:


    moveq #0,d0


    move.b $1C(a0),d0


    cmp.b $1D(a0),d0 ; is animation set to restart?


    beq.s SAnim_Do ; if not, branch


    move.b d0,$1D(a0) ; set to "no restart"


    move.b #0,$1B(a0) ; reset animation


    move.b #0,$1E(a0) ; reset frame duration



    This code loads normal animation first, but if Sonic is super, super animation will be loaded.


    As for the bug you have in game, it happens when LoadSonicDynPLC tries to load PLC for a mapping frame which doesn't exist. This may be problem with animations, to fix it, replace SAnim_Do2 with:



    SAnim_Do2:
    moveq #0,d1


    move.b $1B(a0),d1 ; load current frame number


    move.b 1(a1,d1.w),d0 ; read sprite number from script


    ;bmi.s SAnim_End_FF ; if animation is complete, branch


    cmpi.b #$F0,d0 ;++


    bcc.s SAnim_End_FF ;++if animation is complete, branch



    Also, check out if you have all sprites for Super Sonic and animation scripts are correct.


    And the last thing, if you want to have all Super Sonic animations, you'll have to port Super Sonic animation subroutines from Sonic 2.

    You know, compiler can't check if code works correctly.
     
  10. DeoxysKyogre

    DeoxysKyogre No idea what to put here .-. Member

    Joined:
    Jan 31, 2009
    Messages:
    298
    I found a code of the "music to normal" from when the invincibility time has spend and sonic becomes vulnerable again.



    Code:
    Obj01_PlayMusic:
    
    		lea	(MusicList2).l,a1
    
    		move.b	(a1,d0.w),d0
    
    		jsr	(PlaySound).l; play normal music

    Add those lines to the reverting back to normal code and i think it should work. Hope it helps =)
     
    Last edited by a moderator: Jul 10, 2010
Thread Status:
Not open for further replies.