ASM to Sega Genesis Platform

All about assembly programming in the Sega Genesis console.


    Homing Attack in Sonic 1 - Step 5 - Robotnik Very Easy

    Share

    OuricoDoido
    Admin

    Mensagens : 46
    Data de inscrição : 2011-01-09
    Current Project : Sonic Open Source Project

    Homing Attack in Sonic 1 - Step 5 - Robotnik Very Easy

    Post  OuricoDoido on Tue Jan 25, 2011 7:12 pm

    For the bosses are not very easy as stands now, We have two ways to fix it, removing the Robotnik of enemy list or cancel the Homing Attack in each hit.

    A way: Modify the enemy list

    The easiest way is remove the Robotnik of enemy list, as we saw in step 2.

    Modify this:
    Code:
          cmpi.b   #$F,$20(a1)      ; is some enemy of the list above?
          bls.s   HA_calcdistance ; if yes, branch
    To this:
    Code:
          cmpi.b   #$E,$20(a1)      ; is some enemy of the list above?
          bls.s   HA_calcdistance ; if yes, branch
    Why modify $F to $E?
    As you can see in the list, $F is the Eggman.

    BLS = branch low or same (Unsigned)
    As is "low or same", if it is low than or same to $F, Homing Attack works against Eggman. But we do not want to work against Eggman, then, modify it to $E, because if low than or same to $E, Homing Attack does not work against Eggman, because $F is not equal or low than $E. ($E < $F)


    Other way: Cancel the Homing Attack in each hit

    For the Homing Attack works against Eggman, and Sonic not attacking Eggman until the Homing Attack's time is over, we need reset the time's value when Sonic hits Eggman, and this goes for every boss.


    GHZ BOSS

    Search for loc_177E6, and at the end of it, you will see:
    Code:
          bne.s   Obj3D_ShipFlash
          move.b   #$20,$3E(a0)   ; set number of   times for ship to flash
          move.w   #$AC,d0
          jsr   (PlaySound_Special).l ;   play boss damage sound

    Between this two lines:
    Code:
          bne.s   Obj3D_ShipFlash
          move.b   #$20,$3E(a0)   ; set number of   times for ship to flash
    Add this:
    Code:
          clr.b   ($FFFFFFD1).w    ; cancel the Homing Attack, clearing the number of frames Sonic can chasing the object


    LZ BOSS

    Search for loc_17F48, and at the end of it, you will see:
    Code:
          bne.s   loc_17F70
          move.b   #$20,$3E(a0)
          move.w   #$AC,d0
          jsr   (PlaySound_Special).l

    Between this two lines:
    Code:
          bne.s   loc_17F70
          move.b   #$20,$3E(a0)
    Add this:
    Code:
          clr.b   ($FFFFFFD1).w    ; cancel the Homing Attack, clearing the number of frames Sonic can chasing the object


    MZ BOSS

    Again, search for loc_1833E, and at the end of it, you will see:
    Code:
          bne.s   loc_18374
          move.b   #$28,$3E(a0)
          move.w   #$AC,d0
          jsr   (PlaySound_Special).l ;   play boss damage sound

    Between this two lines:
    Code:
          bne.s   loc_18374
          move.b   #$28,$3E(a0)
    Add this:
    Code:
          clr.b   ($FFFFFFD1).w    ; cancel the Homing Attack, clearing the number of frames Sonic can chasing the object

    SLZ BOSS

    Again, search for loc_189FE, and at the end of it, you will see:
    Code:
          bne.s   loc_18A28
          move.b   #$20,$3E(a0)
          move.w   #$AC,d0
          jsr   (PlaySound_Special).l ;   play boss damage sound

    Between this two lines:
    Code:
          bne.s   loc_18A28
          move.b   #$20,$3E(a0)
    Add this:
    Code:
          clr.b   ($FFFFFFD1).w    ; cancel the Homing Attack, clearing the number of frames Sonic can chasing the object

    SYZ BOSS

    Once again, search for loc_19202, and at the end of it, you will see:
    Code:
          bne.s   loc_1923A
          move.b   #$20,$3E(a0)
          move.w   #$AC,d0
          jsr   (PlaySound_Special).l ;   play boss damage sound

    Between this two lines:
    Code:
          bne.s   loc_1923A
          move.b   #$20,$3E(a0)
    Add this:
    Code:
          clr.b   ($FFFFFFD1).w    ; cancel the Homing Attack, clearing the number of frames Sonic can chasing the object


    FZ BOSS

    The Eggman's ship only appears when he tries to escape, and as we did in all other bosses, search for loc_1A1D4, and at the end of it, you will see:
    Code:
          bne.s   loc_1A216
          move.w   #$1E,$30(a0)
          move.w   #$AC,d0
          jsr   (PlaySound_Special).l ;   play boss damage sound

    Between this two lines:
    Code:
          bne.s   loc_1A216
          move.w   #$1E,$30(a0)
    Add this:
    Code:
          clr.b   ($FFFFFFD1).w    ; cancel the Homing Attack, clearing the number of frames Sonic can chasing the object


    Cancel the Homing Attack in final hit

    An bug still continues, the last hit on the boss leaves the Sonic stopped for a time in air, this is done because in the last hit, the "normal code" is not read, but the code of the boss defeated "BossDefeated" is read.

    So, to fix this, search for BossDefeated and you will see this:
    Code:
    BossDefeated:
          move.b   ($FFFFFE0F).w,d0
          andi.b   #7,d0
          bne.s   locret_178A2
          jsr   SingleObjLoad
          bne.s   locret_178A2
          move.b   #$3F,0(a1)   ; load explosion object
          move.w   8(a0),8(a1)
          move.w   $C(a0),$C(a1)
          jsr   (RandomNumber).l
          move.w   d0,d1
          moveq   #0,d1
          move.b   d0,d1
          lsr.b   #2,d1
          subi.w   #$20,d1
          add.w   d1,8(a1)
          lsr.w   #8,d0
          lsr.b   #3,d0
          add.w   d0,$C(a1)

    locret_178A2:
          rts   
    ; End of function BossDefeated
    Below the text "BossDefeated:" add this line:
    Code:
          clr.b   ($FFFFFFD1).w    ; cancel the Homing Attack, clearing the number of frames Sonic can chasing the object
    avatar
    Green Snake

    Mensagens : 2094
    Data de inscrição : 2012-04-07
    Localização : I do not even know
    Current Project : nope

    Re: Homing Attack in Sonic 1 - Step 5 - Robotnik Very Easy

    Post  Green Snake on Sun May 19, 2013 11:36 am


      Current date/time is Sat Oct 21, 2017 7:48 am