How to add a Winning Pose, like in Sonic 3 in Sonic 1 (Hivebrain 2005 Disassembly)

Discussion in 'Tutorials' started by EddyTF, May 9, 2022.

  1. EddyTF

    EddyTF #romhacker Member

    Joined:
    Jan 9, 2022
    Messages:
    43
    Location:
    Russia
    So, dear people, members of the site, for a long time I could not understand what to publish here on such a large scale and finally decided. I present to your attention my first full-fledged guide for adding a Winning Pose, as in Sonic 3 in Sonic 1! So, I won't say much, let's get started!
    Step One - The Main Part

    To begin with, we look for Obj0D_Index and see:

    Code:
    Obj0D_Index:    dc.w Obj0D_Main-Obj0D_Index
            dc.w Obj0D_Touch-Obj0D_Index
            dc.w Obj0D_Spin-Obj0D_Index
            dc.w Obj0D_SonicRun-Obj0D_Index
            dc.w locret_ED1A-Obj0D_Index
    Replacing dc.w Obj0D_SonicRun-Obj0D_Index with dc.w Obj0D_VictoryPose-Obj0D_Index, we get:

    Code:
    Obj0D_Index:    dc.w Obj0D_Main-Obj0D_Index
            dc.w Obj0D_Touch-Obj0D_Index
            dc.w Obj0D_Spin-Obj0D_Index
            dc.w Obj0D_VictoryPose-Obj0D_Index
            dc.w locret_ED1A-Obj0D_Index
    Next, we look for the label Obj0D_SonicRun and replace all the code with a new one:

    Code:
    Obj0D_VictoryPose:               ; XREF: Obj0D_Index
            tst.b   ($FFFFF7CD).w   ; has Sonic jumped into   a giant   ring?
           beq.s   Obj0D_VictoryPose2 ; if not branch
           jsr GotThroughAct ; if yes GotThroughAct
    Obj0D_VictoryPose2: 
           tst.w   ($FFFFFE08).w   ; is debug mode   on?
           bne.w   locret_ECEE   ; if yes, branch
           btst   #1,($FFFFD022).w
            bne.w   locret_ECEE        ; If player is not standing on the ground, wait until he is
            move.b  #$20,($FFFFD01C).w ; "Winning Pose" animation
            move.b  #$81,($FFFFF7C8).w ; lock controls
           addq.b   #2,$24(a0)
    
    Then we look for the label Obj0D_Touch and after these lines:

    Code:
    bcs.s    locret_EBBA
            cmpi.w    #$20,d0        ; is Sonic within $20 pixels of    the signpost?
            bcc.s    locret_EBBA    ; if not, branch
    Insert:

    Code:
    move.b  #1,($FFFFF7AA).w ; Lock the screen
    And then we need to port the victory pose sprites, because there are none in the first Sonic. And I personally did it with Flex 2:)

    When the necessary sprites are added, open the _anim folder, and then the Sonic.asm file and after dc.w SonAni_Float4-SonicAniData, insert:

    Code:
    dc.w SonAni_Victory-SonicAniData
    Next, until even we insert:

    Code:
    SonAni_Victory: dc.b 5,  $59, $5A, $FF, 0

    We save, compile and test. Everything works. Simple, isn't it?^3

    P.s. if there are any errors, write;)

    Step Two (Final) - Fix Bugs (The controls are not unlocked when switching to the SBZ2 cutscene)

    We are looking for the label Obj3E_FindObj28 and replace these two lines:

    Code:
    jsr    GotThroughAct
    jmp    DeleteObject
    By this:

    Code:
    tst.w    ($FFFFFE08).w    ; is debug mode    on?
            bne.w    Obj3E_Obj28Found    ; if yes, branch
            btst    #1,($FFFFD022).w
            bne.w   Obj3E_Obj28Found        ; If player is not standing on the ground, wait until he is
            move.b  #$20,($FFFFD01C).w ; "Winning Pose" animation
            move.b  #$81,($FFFFF7C8).w ; lock controls
            jsr    GotThroughAct
            jmp    DeleteObject
    And there is very little left. In Obj3A_SBZ2: just change clr.b ($FFFFF7CC).w to clr.b ($FFFFF7C8).w

    Bonus: Correction of the Spin Dash dust animation during the passage of the act

    All we need is to add this:
    Code:
    move.b  #0,($FFFFD1DC).w        ; clear Spin Dash dust animation
    Before tst.b ($FFFFF7CD).w ; has Sonic jumped into a giant ring? in Obj0D_VictoryPose:

    Phew, I think I've told you everything:)

    EDIT: Completely redesigned code by @Dewar; Added bonus from me and @ReZZ; Minor corrections in the text
     
    Last edited: Sep 1, 2022
    Samey and Dark Shamil Khan like this.