Simple Super Peel Out in Sonic 1

Discussion in 'Tutorials Archive' started by RetroX, Dec 10, 2010.

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

    RetroX Active Member Member

    Joined:
    Jun 15, 2012
    Messages:
    46
    Location:
    United States
    Did you ever want to port that SonicCD Super Peel Out to Sonic 1 but had no idea how and you can't find a code? Of course this isn't "the real deal" but this my version.


    Also, the real code won't be posted because it makes hacks unique.


    Let's get started, (YOU MUST NOT HAVE A SPIN DASH IN YOUR HACK TO DO THIS) or you will get so many errors you will never believe it.


    Open up your Sonic1.asm


    Now go to Obj01_MdNormal


    and add bsr.w Sonic_Peelout on top of Sonic_Jump


    Now Search for Sonic_Sloperesist and put this above it.



    ; ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ S U B R O U T I N E ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ

    Sonic_PeelOut:


    tst.b $39(a0) ; already peeling out?


    bne.s loc2_1AC8E ; if so, branch


    cmpi.b #7,$1C(a0) ; is Sonic Looking Up


    bne.s locret2_1AC8C ; if not, return


    move.b ($FFFFF603).w,d0 ; read controller


    andi.b #$70,d0 ; pressing A/B/C ?


    beq.w locret2_1AC8C ; if not, return


    lea (SonAni_Peelout).l,a1 ; use running animation


    move.w #$BE,d0 ; spin sound ($E0 in s2)


    jsr (PlaySound_Special).l ; play spin sound


    addq.l #4,sp ; increment stack ptr


    move.b #1,$39(a0) ; set Peelout flag


    move.w #0,$3A(a0) ; set charge count to 0


    cmpi.b #$C,$28(a0) ; ??? oxygen remaining?


    loc2_1AC84:


    bsr.w Sonic_LevelBound


    bsr.w Sonic_AnglePos


    locret2_1AC8C:


    rts


    ; ---------------------------------------------------------------------------


    loc2_1AC8E:


    move.b #$1F,$1C(a0)


    move.b ($FFFFF602).w,d0 ; read controller


    btst #0,d0 ; check up button


    bne.w loc2_1AD30 ; if set, branch


    move.b #$E,$16(a0) ; $16(a0) is height/2


    move.b #7,$17(a0) ; $17(a0) is width/2


    lea (SonAni_Peelout).l,a1 ; use running animation


    addq.w #5,$C(a0) ; $C(a0) is Y coordinate


    move.b #0,$39(a0) ; clear Peelout flag


    moveq #0,d0


    move.b $3A(a0),d0 ; copy charge count


    add.w d0,d0 ; double it


    move.w podsh_normal(pc,d0.w),$14(a0) ; get normal speed


    loc2_1ACD0: ; TODO: figure this out


    move.w $14(a0),d0 ; get inertia


    subi.w #$800,d0 ; subtract $800


    add.w d0,d0 ; double it


    andi.w #$1F00,d0 ; mask it against $1F00


    neg.w d0 ; negate it


    addi.w #$2000,d0 ; add $2000


    move.w d0,($FFFFEED0).w ; move to $EED0


    btst #0,$22(a0) ; is sonic facing right?


    beq.s loc2_1ACF4 ; if not, branch


    neg.w $14(a0) ; negate inertia


    loc2_1ACF4:


    move.w #$BC,d0 ; peelout release sound


    jsr (PlaySound_Special).l ; play it!


    bra.s loc2_13a9c


    ; ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ


    ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ


    podsh_normal:


    dc.w $B00 ; 0


    dc.w $B80 ; 1


    dc.w $C00 ; 2


    dc.w $C80 ; 3


    dc.w $D00 ; 4


    dc.w $D80 ; 5


    dc.w $E00 ; 6


    dc.w $E80 ; 7


    dc.w $F00 ; 8


    ; ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ


    ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ


    loc2_13a9c


    lea (SonAni_Peelout).l,a1 ; use running animation


    cmpi.w #$600,d2 ; is Sonic at running speed?


    bne.s loc2_1ad30


    jmp loc_13AB4


    loc2_1AD30: ; If still charging the dash...


    tst.w $3A(a0) ; check charge count


    beq.s loc2_1AD48 ; if zero, branch


    move.w $3A(a0),d0 ; otherwise put it in d0


    lsr.w #5,d0 ; shift right 5 (divide it by 32)


    sub.w d0,$3A(a0) ; subtract from charge count


    bcc.s loc2_1AD48 ; ??? branch if carry clear


    move.w #0,$3A(a0) ; set charge count to 0


    loc2_1AD48:


    move.b ($FFFFF603).w,d0 ; read controller


    andi.b #$70,d0 ; pressing A/B/C?


    beq.w loc2_1AD78 ; if not, branch


    move.w #$000,$1C(a0) ; reset spdsh animation


    move.w #$D1,d0 ; was $E0 in sonic 2


    jsr (PlaySound_Special).l ; play charge sound


    addi.w #$200,$3A(a0) ; increase charge count


    cmpi.w #$800,$3A(a0) ; check if it's maxed


    bcs.s loc2_1AD78 ; if not, then branch


    move.w #$800,$3A(a0) ; reset it to max


    loc2_1AD78:


    addq.l #4,sp ; increase stack ptr


    cmpi.w #$60,($FFFFEED8).w ; $EED8 only ever seems


    bcc.s loc2_1AD88


    addq.w #4,($FFFFEED8).w


    loc2_1AD88:


    lea (SonAni_Peelout).l,a1 ; use running animation


    loc2_1AD8C:


    bsr.w Sonic_LevelBound


    bsr.w Sonic_AnglePos


    move.w #$60,($FFFFF73E).w ; reset looking up/down


    rts


    ; End of function Sonic_PeelOut



    Now Open up _anim -> Sonic.asm and add this at the bottom of the first list



    dc.w SonAni_Peelout-SonicAniData; 1F



    then before the even at the bottom add this



    SonAni_Peelout: dc.b $FF, $1E, $1F, $20, $21, $FF, $FF, $FF



    Save, build, and there you go, a very simple peelout!


    PLEASE GIVE CREDIT IF USED!!
     
    Last edited by a moderator: Dec 11, 2010
Thread Status:
Not open for further replies.