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 |
Screenshots: |
And comparisons you have could use optimizations:
Code
LDA $75 ;check if mario... CMP #$01 ;is swimming BEQ swimming ;if so, branch
can be
Code
LDA $75 ;check if mario... BNE swimming ;if swimming, branch
and
Code
LDA !Trigger|!addr ;check trigger to make sure the CMP #$00 ;quiet volume sound doesn't play multiple times BNE return
can be
Code
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)