First, we should examine the Super Sonic routine so go to this routine.
- Code:
Sonic_CheckGoSuper:
The whole code should look a bit like this.
- Code:
Sonic_CheckGoSuper:
tst.b (Super_Sonic_flag).w; is Sonic already Super?
bne.w return_1ABA4;return_1ABA4; if yes, branch
cmpi.b #7,(Emerald_count).w; does Sonic have exactly 7 emeralds?
bne.s return_1ABA4; if not, branch
cmpi.w #50,(Ring_count).w; does Sonic have at least 50 rings?
bcs.s return_1ABA4; if not, branch
move.b #1,(Super_Sonic_palette).w
move.b #$F,(Palette_frame_count).w
move.b #1,(Super_Sonic_flag).w
move.b #$81,obj_control(a0)
move.b #$1F,anim(a0); use transformation animation
bset #4,status(a0); set doublejump flag
move.b #$7E,(Object_RAM+$2040).w; load Obj7E (super sonic stars object) at $FFFFD040
move.w #$A00,(Sonic_top_speed).w
move.w #$30,(Sonic_acceleration).w
move.w #$100,(Sonic_deceleration).w
move.w #0,invincibility_time(a0)
bset #1,status_secondary(a0); make Sonic invincible
move.w #$5F+$80,d0
jsr (PlaySound).l; Play transformation sound effect.
move.w #$16+$80,d0
jmp (PlayMusic).l; load the Super Sonic song and return
As we can see, the code checks for three things before letting sonic go to his super form.
1. It checks for if Sonic is already Super, and branches to an RTS if he is.
2. It checks If Sonic has 7 emeralds, and if he does not, it branches to the RTS.
3. It also checks if Sonic has 50 rings, and if he doesn't, it branches to the RTS.
- Code:
tst.b (Super_Sonic_flag).w; is Sonic already Super?
bne.w return_1ABA4;return_1ABA4; if yes, branch
cmpi.b #7,(Emerald_count).w; does Sonic have exactly 7 emeralds?
bne.s return_1ABA4; if not, branch
cmpi.w #50,(Ring_count).w; does Sonic have at least 50 rings?
bcs.s return_1ABA4; if not, branch
For the item box, those lines are not needed, copy and paste the entire Sonic_CheckGoSuper code into a text editor, and remove those lines.
Now, we need to make sure this box will not affect Tails, So in your text editor, the code should look like this.
- Code:
addq.w #1,(a2)
cmpi.w #2,(Player_mode).w; is player Tails?
bls +; if not, branch
rts
+
move.b #1,(Super_Sonic_palette).w; set the super form palette
move.b #$F,(Palette_frame_count).w
move.b #1,(Super_Sonic_flag).w; switch on the super sonic flag
move.b #$81,obj_control(a0)
move.b #$1F,anim(a0); use roll/transformation animation;1F for transform slot
move.b #$7E,(Object_RAM+$2040).w; load Obj7E (super sonic stars object) at $FFFFD040
move.w #$A00,(Tails_top_speed).w
move.w #$30,(Tails_acceleration).w
move.w #$100,(Tails_deceleration).w
move.w #$A00,(Sonic_top_speed).w
move.w #$30,(Sonic_acceleration).w
move.w #$100,(Sonic_deceleration).w
move.w #0,invincibility_time(a0)
bset #1,status_secondary(a0); make Sonic invincible
move.w #$5F+$80,d0
jsr (PlaySound).l; Play transformation sound effect.
move.w #$16+$80,d0
jsr (PlayMusic).l; load the Super Sonic song and return
Next, we need to make it so that the box will GIVE Sonic 50 rings, so he can transform when he breaks the monitor. So add...
You will need to add a LEA to (Ring_Count).
As well as this...
- Code:
addi.w #$32,(a2)
Right under the Ring_Count as well.
The code should now look like.
- Code:
addq.w #1,(a2)
cmpi.w #2,(Player_mode).w; is player Tails?
bls +; if not, branch
rts
+
lea (Ring_count).w,a2
addi.w #$32,(a2)
move.b #1,(Super_Sonic_palette).w; set the super form palette
move.b #$F,(Palette_frame_count).w
move.b #1,(Super_Sonic_flag).w; switch on the super sonic flag
move.b #$81,obj_control(a0)
move.b #$1F,anim(a0); use roll/transformation animation;1F for transform slot
move.b #$7E,(Object_RAM+$2040).w; load Obj7E (super sonic stars object) at $FFFFD040
move.w #$A00,(Sonic_top_speed).w
move.w #$30,(Sonic_acceleration).w
move.w #$100,(Sonic_deceleration).w
move.w #0,invincibility_time(a0)
bset #1,status_secondary(a0); make Sonic invincible
move.w #$5F+$80,d0
jsr (PlaySound).l; Play transformation sound effect.
move.w #$16+$80,d0
jsr (PlayMusic).l; load the Super Sonic song and return
So far, so good. BUT now you need to make it so that the counter will update so add this line just under the code that adds 50 rings.
- Code:
ori.b #$80,(Update_HUD_rings).w
The code should now look like.
- Code:
addq.w #1,(a2)
cmpi.w #2,(Player_mode).w; is player Tails?
bls +; if not, branch
rts
+
lea (Ring_count).w,a2
addi.w #$32,(a2)
ori.b #$80,(Update_HUD_rings).w
move.b #1,(Super_Sonic_palette).w; set the super form palette
move.b #$F,(Palette_frame_count).w
move.b #1,(Super_Sonic_flag).w; switch on the super sonic flag
move.b #$81,obj_control(a0)
move.b #$1F,anim(a0); use roll/transformation animation;1F for transform slot
move.b #$7E,(Object_RAM+$2040).w; load Obj7E (super sonic stars object) at $FFFFD040
move.w #$A00,(Sonic_top_speed).w
move.w #$30,(Sonic_acceleration).w
move.w #$100,(Sonic_deceleration).w
move.w #0,invincibility_time(a0)
bset #1,status_secondary(a0); make Sonic invincible
move.w #$5F+$80,d0
jsr (PlaySound).l; Play transformation sound effect.
move.w #$16+$80,d0
jsr (PlayMusic).l; load the Super Sonic song and return
This should work perfectly now, so it is time to insert it into the ASM.
Go to off_12924 and replace the first line with this.
- Code:
dc.w super_monitor-off_12924; 0 - Super/ Turns character to their super form
Then paste the code after the code for robotnik_monitor like this.
- Code:
; ============== END RELATIVE POINTER LIST ==================================
; badnik_monitor:
robotnik_monitor:
addq.w #1,(a2)
jmp Touch_ChkHurt2
; ===========================================================================
Super_Monitor:
addq.w #1,(a2)
cmpi.w #2,(Player_mode).w; is player Tails?
bls +; if not, branch
rts
+
lea (Ring_count).w,a2
addq.w #32,($FFFFFE20).w; add 50 to rings
ori.b #$80,(Update_HUD_rings).w
move.b #1,(Super_Sonic_palette).w; set the super form palette
move.b #$F,(Palette_frame_count).w
move.b #1,(Super_Sonic_flag).w; switch on the super sonic flag
move.b #$81,obj_control(a0)
move.b #$1F,anim(a0); use roll/transformation animation;1F for transform slot
move.b #$7E,(Object_RAM+$2040).w; load Obj7E (super sonic stars object) at $FFFFD040
move.w #$A00,(Sonic_top_speed).w
move.w #$30,(Sonic_acceleration).w
move.w #$100,(Sonic_deceleration).w
move.w #0,invincibility_time(a0)
bset #1,status_secondary(a0); make Sonic invincible
move.w #$5F+$80,d0
jsr (PlaySound).l; Play transformation sound effect.
move.w #$16+$80,d0
jsr (PlayMusic).l; load the Super Sonic song and return
; ============================================================================
Now, save, build, jack off. Then set in your level of choice and test it out.
Keep in mind, the code will make use of the blank/static monitor. You will have to add new art and mappings if you want otherwise.
Credits:
Original guide from SMPS Archive (RIP).
Guide written by Hitaxas Icaria.
Mispelled mistakes in guide fixed by me (Karate Cat).