13 users online:  Anorakun, crocodileman94, Donald1111, GangsterJerby, Green, Heitor Porfirio,  Hooded Edge, IcyFruit, Isikoro, Jolpengammler, LPDGhost, UTF,  xHF01x - Guests: 94 - Bots: 187
Users: 62,817 (2,618 active)
Latest user: Kaputon

Quiet Water by Meirdent

File Name: Quiet Water
Submitted: by Meirdent
Authors: Meirdent
Type: Level, Game Mode
Includes GFX: No
Includes Hijack: No
Featured: No
Description: This code will make the current music's volume quieter while Mario is in water, and reverts back to normal when he's not.

AddmusicK is needed to insert the two included sound effects. This code will not work without them!

Demonstration Video
Exiting level while underwater doesn't resume volume. And it doesn't matter if in water or not anymore.

And comparisons you have could use optimizations:

	LDA $75			;check if mario...
	CMP #$01		;is swimming
	BEQ swimming		;if so, branch

can be

	LDA $75			;check if mario...
	BNE swimming		;if swimming, branch


	LDA !Trigger|!addr	;check trigger to make sure the
	CMP #$00		;quiet volume sound doesn't play multiple times
	BNE return

can be

	LDA !Trigger|!addr	;check trigger to make sure the	
	BNE return		;quiet volume sound doesn't play multiple times

since you're checking flags, they can be either 0 or anything else. if you want to check if flag is zero, just having BEQ after LDA is enough (branches on zero), and if non-zero - use BNE (branches on non-zero value)