Spike SFX Fix - RetroKoH/S1Fixed GitHub Wiki

(Original guide by Mercury)
Source: ReadySonic
Commit: 5863b26
(NOTE: This fix is handled in Sonic Retro's s1disasm by FixBugs)

In Sonic 2, there's a distinct sound effect for being harmed by spikes, as opposed to any other kind of hazard. This sound effect also exists in Sonic 1, and there IS code that tries to achieve the same effect, but it doesn't work due to improper branching. Here's how to fix it:

In _incObj\sub ReactToItem.asm, look for HurtSonic, and find the section .isleft and remove these lines:

.isleft:
	move.w	#0,obInertia(a0)
	move.b	#aniID_Hurt,obAnim(a0)
	move.w	#120,obInvuln(a0)	; set temp invincible time to 2 seconds

	cmpi.b	#id_Spikes,obID(a2)	; was damage caused by spikes?
	bne.s	.sound			; if not, branch
-	cmpi.b	#id_Harpoon,obID(a2)	; was damage caused by LZ harpoon?
-	bne.s	.sound			; if not, branch
	move.w	#sfx_HitSpikes,d0	; load spikes damage sound

This will ensure that spikes always play the desired sound. Based on the initial code, however, it seems Sonic Team wanted the Harpoons to also use this sound. If you wish to do the same thing, replace the code from .isleft: up to .sound with this:

.isleft:
	move.w	#0,obInertia(a0)
	move.b	#aniID_Hurt,obAnim(a0)
	move.w	#120,obInvuln(a0)	; set temp invincible time to 2 seconds

!	move.w	#sfx_Death,d0		; load normal damage sound
!	cmpi.b	#id_Spikes,obID(a2)	; was damage caused by spikes?
!	beq.s	.setspikesound		; if so, branch
!	cmpi.b	#id_Harpoon,obID(a2)	; was damage caused by LZ harpoon?
!	bne.s	.sound			; if not, branch
!.setspikesound:
	move.w	#sfx_HitSpikes,d0	; load spikes damage sound