Adding The Air Roll - RetroKoH/S1Fixed GitHub Wiki
(Original guide by RetroKoH)
Source: See commits; Inspired by Inferno Gear's SCHG guide
Original Commit: 356736a
Additional Commit: aec7a8a
This mod can be toggled in S1Fixed by setting AirRollEnabled to 0 or 1.
A supplementary mod can toggle Drop Dash transitions by setting AirRollIntoDropDash to 0 or 1. (Assumes that Drop Dash is enabled)
Whenever Sonic hits a spring, falls from a crumbling ledge, walks off a platform, etc., he is left in a vulnerable state. This is true in all Sonic games, except for Sonic Triple Trouble. In that game, you could curl up into a ball while in the springing animation to damage enemies. This is most prevalently used to defeat one particular boss:
This guide is going to allow you to execute this anytime Sonic is in the air and vulnerable. It's also going to include an optional fix to ensure that you can't immediately trigger double jump abilities w/ the Air Roll, though if you are only including the Drop Dash, you might actually prefer being able to transition into that move. Anyways, let's get started.
Creating the Air Roll subroutine
Let's first create the actual ability subroutine. Create a new file and place it in the _incObj folder. I'm going to stick with standard conventions and call it Sonic AirRoll.asm. The code here is going to look like this (for the orange lines, only include them under noted circumstances):
; ---------------------------------------------------------------------------
; Subroutine allowing Sonic to curl up in the air
; ---------------------------------------------------------------------------
; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
Sonic_ChkAirRoll:
; Only include these two lines if you implemented the Spin Dash and/or Peelout
! tst.b obSpinDashFlag(a0) ; is Sonic charging his spin dash?
! bne.w .end ; if yes, branch
move.b (v_jpadpress2).w,d0
andi.b #btnABC,d0 ; are buttons A, B, or C being pressed?
beq.s .noAirRoll ; if not, branch
move.b #aniID_Roll,obAnim(a0) ; enter rolling animation
bset #staSpin,obStatus(a0) ; set spin status
! move.b #2,obDoubleJumpFlag(a0) ; disable shield abilities (Only include this if you have S3K Shields enabled)
! move.b #1,obJumping(a0) ; enable this only if you want to enable potential drop dash transitions
move.w #sfx_Roll,d0
jsr (PlaySound_Special).w ; play rolling sound
; truncated JumpHeight code (since we don't need the entire subroutine here; we aren't in a jump!)
.noAirRoll:
cmpi.w #-$FC0,obVelY(a0)
bge.s .end
move.w #-$FC0,obVelY(a0)
.end:
rts
; End of function Sonic_ChkAirRoll
Make sure to include the file somewhere in sonic.asm. I chose to include it (and other abilities) immediately after Sonic JumpHeight.asm like so:
include "_incObj/Sonic JumpHeight.asm"
+include "_incObj/Sonic AirRoll.asm"
Calling the new subroutine
Now we need to call the subroutine. We know that Sonic is only supposed to Air Roll if he is in the air, but not in a ball. At this point, we need at least a basic understanding of how Sonic's modes work. Sonic has 4 modes that are based on his obStatus byte:
Sonic_Modes: dc.w Sonic_MdNormal-Sonic_Modes ; on ground, not rolling
dc.w Sonic_MdJump-Sonic_Modes ; in air, not rolling (slight misnomer)
dc.w Sonic_MdRoll-Sonic_Modes ; on ground, rolling
dc.w Sonic_MdJump2-Sonic_Modes ; in air, rolling
So, it stands to reason that we need to call our new subroutine in Sonic_MdJump (renamed in S1Fixed to Sonic_MdAir). Let's call it like so:
Sonic_MdJump:
; in the air, not in a ball (thus, not jumping)
- bsr.w Sonic_JumpHeight
+ bsr.w Sonic_ChkAirRoll ; Contains truncated JumpHeight code
bsr.w Sonic_JumpDirection
bsr.w Sonic_LevelBound
jsr (ObjectFall).l
btst #staWater,obStatus(a0)
beq.s loc_12E5C
subi.w #$28,obVelY(a0)
loc_12E5C:
bsr.w Sonic_JumpAngle
bra.w Sonic_Floor
And there we have it! Not only do we have a new ability, but we also slightly optimized the start of this status mode too.