Enabling and disabling the Spike Behavior in the Title Screen

Discussion in 'Tutorials Archive' started by Selbi, Feb 2, 2009.

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

    Selbi The Euphonic Mess Member

    Joined:
    Jul 20, 2008
    Messages:
    2,429
    Location:
    Northern Germany
    Enabling and disabling the Spike Behavior in the Title Screen


    Sofia Mirror: http://www.sonicringnetwork.co.uk/sofia/show.php?p=10


    EDIT: Since this is more copy and paste, I decided to move this to Source Code Exchange. The guide itself is for about 90% still the same.


    =====Starts here=====


    This is big problem: The Spike Behavior! Many people remove it from their hack, because it's really anoying.


    But some people are still using it (I don't know why). So, I decided to create a code, on how to enable and disable it, without creating multiple versions of a hack.


    Want it? Simply do this:


    1: Open up your sonic1.asm and go to "loc_3230:". You should see this:



    loc_3230:
    tst.w ($FFFFF614).w


    beq.w Demo


    andi.b #$80,($FFFFF605).w ; check if Start is pressed


    beq.w loc_317C ; if not, branch



    2: Replace it with this:



    loc_3230:
    tst.w ($FFFFF614).w ; is there time left before the demo starts?


    beq.w Demo ; if not, run demo


    andi.b #$80,($FFFFF605).w ; has Start been pressed?


    beq.w StartCheck ; if not, branch


    cmpi.b #$40,($FFFFF605) ; has A been pressed?


    bne.s StartCheck ; if not, branch


    tst.b ($FFFFFFE0).w ; is level select enabled?


    bne.w Title_ChkLevSel ; if yes, branch


    tst.b ($FFFFFFFD).w ; was the Spike Behavior already enabled?


    bne.s Disable_SB ; if yes, branch


    move.b #1,($FFFFFFFD).w ; enable the Spike Behavior


    move.b #$A6,d0 ; set spike death sound


    jsr PlaySound_Special ; play spike death sound


    bra.s StartCheck ; jskip Disable_SB


    Disable_SB:


    subi.b #1,($FFFFFFFD).w ; disable the spike behavior again


    move.b #$C7,d0 ; set chain sound


    bsr.w PlaySound_Special ; play chain sound


    StartCheck:


    andi.b #$80,($FFFFF605).w ; check if Start is pressed


    beq.w loc_317C ; if not, branch



    This code will check, if A is pressed and if yes, play a Spike Death sound and enable the Spike Behavior. If you press it again, you will hear another sound (the MZ Chain sound) and the Behavior is disabled again.


    There is also a check for the Level Select, because you enable the behavior with A, and you'll need A for the Level Select. If you press A+Start, you will enable the Spike bug with the Level Select! So I made this. Also, if you want to use B or C instead of A, than replace in the third line the #$40 with:

    You can delete the Level Select check if you are changing the button after that.


    Note: If you added new characters (with the Tutorial on Sonic Retro), then replace every "Title_ChkLevSel" with "Title_CheckForB".


    3: Now go to "Obj36_Hurt:". If you already disabled the Spike Behavior with the Tutorial on SR, you should see this:



    Obj36_Hurt: ; XREF: Obj36_SideWays; Obj36_Upright
    tst.b ($FFFFFE2D).w ; is Sonic invincible?


    bne.s Obj36_Display ; if yes, branch


    tst.w ($FFFFD030).w ; +++ is Sonic invulnerable?


    bne.s Obj36_Display ; +++ if yes, branch


    move.l a0,-(sp)


    movea.l a0,a2


    .


    .


    .



    Otherwise, this:



    Obj36_Hurt: ; XREF: Obj36_SideWays; Obj36_Upright
    tst.b ($FFFFFE2D).w ; is Sonic invincible?


    bne.s Obj36_Display ; if yes, branch


    move.l a0,-(sp)


    movea.l a0,a2


    .


    .


    .



    4: Replace everthing to "move.l a0,-(sp)" with this:



    Obj36_Hurt: ; XREF: Obj36_SideWays; Obj36_Upright
    tst.b ($FFFFFE2D).w ; is Sonic invincible?


    bne.s Obj36_Display ; if yes, branch


    tst.b ($FFFFFFFD).w ; was the Spike Behavior enabled?


    bne.s Obj36_Hurt_Rest ; if yes, branch


    tst.w ($FFFFD030).w ; +++ is Sonic invulnerable? (Spike Behavior check)


    bne.s Obj36_Display ; +++ if yes, branch


    Obj36_Hurt_Rest:



    This will check, if the Spike Behavior is enabled. If yes, branch to "Obj36_Hurt_Rest:" (the other code). If not disable Spike Behavior.


    Note: Spike Behavior is now disabled by default. If you want to enable it by default, then change:



    beq.s Obj36_Hurt_Rest ; if yes, branch



    To:



    bne.s Obj36_Hurt_Rest ; if not, branch



    Also you should switch the sounds.


    5: That's it! Save and Build your ROM. In the Title Screen press A. You should here the Spike death sound. Start the game and search for some spike's to die! And? You are dead! Play it again, this time without pressing A. Search for the Spikes again and now? Not dead! And now, start it again and press A 2x. You should here a chain sound and you will not die again. Understand?


    However, I hope you can do something with this! :)


    Credits:


    Me (Selbi) for everything (coding, guide)


    FraGag for the Tutorial on SR, how to fix the Spike Behavior


    The Add new characters tutorial at Sonic Retro, because this guide is based on it.


    Version:


    v1.1 (Found a huge bug and fixed it. Code updated a bit.)
     
    Last edited by a moderator: May 19, 2009
  2. UtopiaUK

    UtopiaUK Well-Known Member Member

    Joined:
    Feb 2, 2009
    Messages:
    92
    Thank you Selbi, that was helpful.
     
  3. bareirito

    bareirito Well-Known Member Member

    Joined:
    Nov 17, 2008
    Messages:
    87
    Location:
    Argentina
    Pretty cool your tutorials. Thanks again, but I prefer to remove it definately. =P Once more, thanks.
     
  4. Selbi

    Selbi The Euphonic Mess Member

    Joined:
    Jul 20, 2008
    Messages:
    2,429
    Location:
    Northern Germany
    Update: The guide is now in the Sourcecode Exchange forum, because this was actually just a copy/paste guide with my code. :)
     
  5. theocas

    theocas #! Member

    Joined:
    Apr 10, 2010
    Messages:
    375
    IS there a way to add in an Options menu to Sonic 1 like in Sonic 1 MegaMix where you can choose to enable or disable the spike bug?
     
  6. MarkeyJester

    MarkeyJester ♡ ! Member

    Joined:
    Jun 27, 2009
    Messages:
    2,867
    Yes, Magic


    Though it seems it's not as simple as flicking a lightswitch, or changing a lightbulb, or bumping a year old topic =P
     
Thread Status:
Not open for further replies.