ThomasSpeedrunner icon

Super Peel-Out Code

ThomasSpeedrunner | PRO | 05/26/13 11:00:41 PM UTC | 0 ⭐ | 478 👁️ | Never ⏰ | []
text |

4.71 KB

|

None

|

0 👍

/

0 👎

; ---------------------------------------------------------------------------
; Subroutine to check for starting a Super Peel-Out
; ---------------------------------------------------------------------------
Sonic_CheckSuperPeelOut:
	tst.b	superpeelout_flag(a0)
	bne.s	Sonic_UpdateSuperPeelOut
	cmpi.b	#AniIDSonAni_Lookup,anim(a0)
	bne.w	return_1AC8C
	move.b	(Ctrl_1_Press_Logical).w,d0
	andi.b	#button_B_mask|button_C_mask,d0
	beq.w	return_1AC8C
	move.b  #AniIDSonAni_Walk,anim(a0)
	move.w	#$E0,d0
	jsr	(PlaySound).l
	addq.l	#4,sp
	move.b	#1,superpeelout_flag(a0)
	move.b	#0,superpeelout_counter(a0)
	cmpi.b	#$C,air_left(a0)
	bcs.s	+
	move.b  #2,(Sonic_Dust+anim).w
+
	bsr.w	Sonic_LevelBound
	jsr	(AnglePos).l
; End of subroutine Sonic_CheckSuperPeelOut
  ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
  Sonic_UpdateSuperPeelOut:
	move.b	(Ctrl_1_Held_Logical).w,d0
	btst	#button_up,d0
	bne.w	Sonic_ChargingSuperPeelOut
 	; unleash the charged Super Peel-Out and start running quickly:
	move.b	#AniIDSonAni_Run,anim(a0)
	move.b	#0,superpeelout_flag(a0)
	moveq	#0,d0
	move.b	superpeelout_counter(a0),d0
	add.b	d0,d0
	move.w	SuperPeelOutSpeeds(pc,d0.w),inertia(a0)
	tst.b	(Super_Sonic_flag).w
	beq.s	+
	move.w	SuperPeelOutSpeedsSuper(pc,d0.w),inertia(a0)
+
	move.w	inertia(a0),d0
	subi.w	#$800,d0
	add.w	d0,d0
	andi.w	#$1F00,d0
	neg.w	d0
	addi.w	#$2000,d0
	move.w	d0,(Horiz_scroll_delay_val).w
	btst	#0,status(a0)
	beq.s	+
	neg.w	inertia(a0)
+
	bset	#0,status(a0)
	move.w	#$BC,d0	; spindash zoom sound
	jsr	(PlaySound).l
	move.b	angle(a0),d0
	jsr	(CalcSine).l
	muls.w	inertia(a0),d1
	asr.l	#8,d1
	move.w	d1,x_vel(a0)
	muls.w	inertia(a0),d0
	asr.l	#8,d0
	move.w	d0,y_vel(a0)
 	bra.w	Obj01_SuperPeelOut_ResetScr
; ===========================================================================
 SuperPeelOutSpeeds:
	dc.w  $0	; 0
	dc.w  $0	; 1
	dc.w  $0	; 2
	dc.w  $0	; 3
	dc.w  $0	; 4
	dc.w  $0	; 5
	dc.w  $0	; 6
	dc.w  $0	; 7
	dc.w  $B00	; 8
 SuperPeelOutSpeedsSuper:
	dc.w  $0	; 0
	dc.w  $0	; 1
	dc.w  $0	; 2
	dc.w  $0	; 3
	dc.w  $0	; 4
	dc.w  $0	; 5
	dc.w  $0	; 6
	dc.w  $0	; 7
	dc.w  $1000	; 8
; ===========================================================================
; loc_1AD30:
Sonic_ChargingSuperPeelOut:			; If still charging the Super Peel-Out...
	tst.b	superpeelout_counter(a0)
	beq.s	Display_SuperPeelOut_Init
	move.b	superpeelout_counter(a0),d0
	lsr.b	#5,d0
	sub.b	d0,superpeelout_counter(a0)
	bcc.s	Display_SuperPeelOut_Init
	move.b	#0,superpeelout_counter(a0)
 Display_SuperPeelOut_Init:
	tst.b	(Super_Sonic_flag).w	; is Sonic in his Super form?
	bne.s	Display_SuperPeelOut_Super	; if so, display the Super Sonic Super Peel-Out animation set
	btst	#6,status(a0)	; is Sonic underwater?
	beq.s	Display_SuperPeelOut_Normal	; if not, display the normal Super Peel-Out animation set
	bne.s	Display_SuperPeelOut_Underwater	; if so, display the underwater Super Peel-Out animation set
 Display_SuperPeelOut_Normal:
;	move.b	#AniIDSonAni_HaulAss,anim(a0)	; use figure-eight animation
;	cmpi.b	#6,superpeelout_counter(a0)	; is Sonic supposed to be using the figure-eight animation?
;	bge.w	+			; if yes, branch
	move.w	#(AniIDSonAni_Run<<8),anim(a0)	; use running animation
	cmpi.b	#3,superpeelout_counter(a0)	; is Sonic supposed to be using the running animation?
	bge.w	+			; if yes, branch
	move.b	#(AniIDSonAni_Walk<<8),anim(a0)	; use walking animation
+
	bra.w	PlayChargeSound
	rts
 Display_SuperPeelOut_Underwater:
	move.w	#(AniIDSonAni_Run<<8),anim(a0)	; use running animation
	cmpi.b	#5,superpeelout_counter(a0)	; is Sonic supposed to be using the running animation?
	bge.w	+				; if yes, branch
	move.b	#(AniIDSonAni_Walk<<8),anim(a0)	; use walking animation
+
	bra.w	PlayChargeSound
	rts
 Display_SuperPeelOut_Super:
	move.w	#(AniIDSupSonAni_Run<<8),anim(a0)	; use running animation
	cmpi.b	#4,superpeelout_counter(a0)		; is Super Sonic supposed to be using the running animation?
	bge.w	PlayChargeSound				; if yes, branch
	move.b	#(AniIDSupSonAni_Walk<<8),anim(a0)	; use walking animation
 PlayChargeSound:
	cmpi.b	#$E0,d0
	bne.s	Charge_SuperPeelOut_Main
	move.w	#$E0,d0
	jsr	(PlaySound).l
 Charge_SuperPeelOut_Main:
	move.b	($FFFFFE05).w,d0
	andi.b	#5,d0
	bne.s	Obj01_SuperPeelOut_ResetScr
	addi.b	#1,superpeelout_counter(a0)
	cmpi.b	#8,superpeelout_counter(a0)
	bcs.s	Obj01_SuperPeelOut_ResetScr
	move.b	#8,superpeelout_counter(a0)
	bra.s	Obj01_SuperPeelOut_ResetScr
	move.b	#8,superpeelout_counter(a0)
 Obj01_SuperPeelOut_ResetScr:
	addq.l	#4,sp
	cmpi.w	#$60,(Camera_Y_pos_bias).w
	beq.w	loc_1AD8C
	bhs.s	+
	addq.w	#4,(Camera_Y_pos_bias).w
+	subq.w	#2,(Camera_Y_pos_bias).w
; End of subroutine Sonic_UpdateSuperPeelOut

Comments