Difference between revisions of "Add a Homing Attack in Sonic 3 and Knuckles"
From Sonic Retro
Sonic Pro1 (talk | contribs) |
Sonic Pro1 (talk | contribs) |
||
Line 21: | Line 21: | ||
Sonic_InstaShield: | Sonic_InstaShield: | ||
btst #Status_Shield,status_secondary(a0) ; does Sonic have an S2 shield (The Elementals were already filtered out at this point)? | btst #Status_Shield,status_secondary(a0) ; does Sonic have an S2 shield (The Elementals were already filtered out at this point)? | ||
+ | |||
bne.w locret_11A14 ; if yes, branch | bne.w locret_11A14 ; if yes, branch | ||
+ | |||
btst #Status_FireShield,status_secondary(a0) ; does Sonic have a Homing Attack? | btst #Status_FireShield,status_secondary(a0) ; does Sonic have a Homing Attack? | ||
+ | |||
move.b #0,(Shield+anim).w | move.b #0,(Shield+anim).w | ||
+ | |||
move.b #1,double_jump_flag(a0) | move.b #1,double_jump_flag(a0) | ||
+ | |||
move.w $650.d0 | move.w $650.d0 | ||
+ | |||
btst #Status_Facing,status(a0) ; is Sonic facing left? | btst #Status_Facing,status(a0) ; is Sonic facing left? | ||
+ | |||
beq.s loc_11958 ; if not, branch | beq.s loc_11958 ; if not, branch | ||
+ | |||
neg.w d0 ; reverse speed value, moving Sonic left | neg.w d0 ; reverse speed value, moving Sonic left | ||
+ | |||
loc_11958: | loc_11958: | ||
+ | |||
move.w d0,x_vel(a0) ; apply velocity... | move.w d0,x_vel(a0) ; apply velocity... | ||
+ | |||
move.w d0,ground_vel(a0) ; ... both ground and air | move.w d0,ground_vel(a0) ; ... both ground and air | ||
+ | |||
move.w #0.y_vel(a0) ; kill y-velocity | move.w #0.y_vel(a0) ; kill y-velocity | ||
+ | |||
move.w .$2000,(H_scroll_frame_offset).w | move.w .$2000,(H_scroll_frame_offset).w | ||
+ | |||
bsr.w Reset_Player_Position_Array | bsr.w Reset_Player_Position_Array | ||
+ | |||
move.w '-$4A,d0; play homing-attack sound | move.w '-$4A,d0; play homing-attack sound | ||
+ | |||
jmp (Play_Sound_2).l | jmp (Play_Sound_2).l | ||
+ | |||
; --------------------------------------------------------------------------- | ; --------------------------------------------------------------------------- | ||
'''And go higher where this is:''' | '''And go higher where this is:''' | ||
+ | |||
; ---------------------------------------------------------------------------; | ; ---------------------------------------------------------------------------; | ||
+ | |||
loc_1192C: | loc_1192C: | ||
+ | |||
Sonic_FireShield: | Sonic_FireShield: | ||
+ | |||
'''and replace that with this:''' | '''and replace that with this:''' | ||
Line 48: | Line 69: | ||
; loc_1192C: | ; loc_1192C: | ||
+ | |||
Sonic_FireShield: | Sonic_FireShield: | ||
+ | |||
btst #Status_Invincible,status_secondary(a0) ; first, does Sonic have invincibility? | btst #Status_Invincible,status_secondary(a0) ; first, does Sonic have invincibility? | ||
+ | |||
bne.w locret_11A14 ; if yes, branch | bne.w locret_11A14 ; if yes, branch | ||
+ | |||
btst #Status_FireShield,status_secondary(a0) ; does Sonic have a Fire Shield? | btst #Status_FireShield,status_secondary(a0) ; does Sonic have a Fire Shield? | ||
+ | |||
beq.s Sonic_LightningShield ; if not, branch | beq.s Sonic_LightningShield ; if not, branch | ||
+ | |||
move.b #1,(Shield+anim).w | move.b #1,(Shield+anim).w | ||
+ | |||
move.b #1,double_jump_flag(a0) | move.b #1,double_jump_flag(a0) | ||
+ | |||
move.w #$800,d0 | move.w #$800,d0 | ||
+ | |||
btst #Status_Facing,status(a0) ; is Sonic facing left? | btst #Status_Facing,status(a0) ; is Sonic facing left? | ||
+ | |||
beq.s loc_8CB09 ; if not, branch | beq.s loc_8CB09 ; if not, branch | ||
+ | |||
neg.w d0 ; reverse speed value, moving Sonic left | neg.w d0 ; reverse speed value, moving Sonic left | ||
+ | |||
loc_8CB09: | loc_8CB09: | ||
+ | |||
move.w d0,x_vel(a0) ; apply velocity... | move.w d0,x_vel(a0) ; apply velocity... | ||
+ | |||
move.w d0,ground_vel(a0) ; ...both ground and air | move.w d0,ground_vel(a0) ; ...both ground and air | ||
+ | |||
move.w #0,y_vel(a0) ; kill y-velocity | move.w #0,y_vel(a0) ; kill y-velocity | ||
+ | |||
move.w #$2000,(H_scroll_frame_offset).w | move.w #$2000,(H_scroll_frame_offset).w | ||
+ | |||
bsr.w Reset_Player_Position_Array | bsr.w Reset_Player_Position_Array | ||
+ | |||
move.w #$43,d0 ; play Fire Shield attack sound | move.w #$43,d0 ; play Fire Shield attack sound | ||
+ | |||
jmp (Play_Sound_2).l | jmp (Play_Sound_2).l | ||
+ | |||
; --------------------------------------------------------------------------- | ; --------------------------------------------------------------------------- | ||
'''ready you already have a semi-homing attack in sonic 3 I hope you have fun and that you are happy''' | '''ready you already have a semi-homing attack in sonic 3 I hope you have fun and that you are happy''' |
Revision as of 17:34, 26 January 2021
(Original guide by Sonic Pro1)
first you must have a code editor and the dissambly: sonic 3 & knuckles
I recommend context
well you should go to sonic3k.asm
then go to ; loc_119F6: Sonic_InstaShield:
and sticks
- loc_119F6
Sonic_InstaShield: btst #Status_Shield,status_secondary(a0) ; does Sonic have an S2 shield (The Elementals were already filtered out at this point)?
bne.w locret_11A14 ; if yes, branch
btst #Status_FireShield,status_secondary(a0) ; does Sonic have a Homing Attack?
move.b #0,(Shield+anim).w
move.b #1,double_jump_flag(a0)
move.w $650.d0
btst #Status_Facing,status(a0) ; is Sonic facing left?
beq.s loc_11958 ; if not, branch
neg.w d0 ; reverse speed value, moving Sonic left
loc_11958:
move.w d0,x_vel(a0) ; apply velocity...
move.w d0,ground_vel(a0) ; ... both ground and air
move.w #0.y_vel(a0) ; kill y-velocity
move.w .$2000,(H_scroll_frame_offset).w
bsr.w Reset_Player_Position_Array
move.w '-$4A,d0; play homing-attack sound
jmp (Play_Sound_2).l
- ---------------------------------------------------------------------------
And go higher where this is:
- ---------------------------------------------------------------------------;
loc_1192C:
Sonic_FireShield:
and replace that with this:
- loc_1192C
Sonic_FireShield:
btst #Status_Invincible,status_secondary(a0) ; first, does Sonic have invincibility?
bne.w locret_11A14 ; if yes, branch
btst #Status_FireShield,status_secondary(a0) ; does Sonic have a Fire Shield?
beq.s Sonic_LightningShield ; if not, branch
move.b #1,(Shield+anim).w
move.b #1,double_jump_flag(a0)
move.w #$800,d0
btst #Status_Facing,status(a0) ; is Sonic facing left?
beq.s loc_8CB09 ; if not, branch
neg.w d0 ; reverse speed value, moving Sonic left
loc_8CB09:
move.w d0,x_vel(a0) ; apply velocity...
move.w d0,ground_vel(a0) ; ...both ground and air
move.w #0,y_vel(a0) ; kill y-velocity
move.w #$2000,(H_scroll_frame_offset).w
bsr.w Reset_Player_Position_Array
move.w #$43,d0 ; play Fire Shield attack sound
jmp (Play_Sound_2).l
- ---------------------------------------------------------------------------
ready you already have a semi-homing attack in sonic 3 I hope you have fun and that you are happy