Skip to content

Instantly share code, notes, and snippets.

@lf94
Created July 24, 2015 06:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lf94/10c64c9ec70ea6e111e9 to your computer and use it in GitHub Desktop.
Save lf94/10c64c9ec70ea6e111e9 to your computer and use it in GitHub Desktop.
MusicSelectData:
.db WaterMusic, GroundMusic, UndergroundMusic, CastleMusic
.db CloudMusic, PipeIntroMusic
GetAreaMusic:
lda OperMode ;if in title screen mode, leave
beq ExitGetM
lda AltEntranceControl ;check for specific alternate mode of entry
cmp #$02 ;if found, branch without checking starting position
beq ChkAreaType ;from area object data header
ldy #$05 ;select music for pipe intro scene by default
lda PlayerEntranceCtrl ;check value from level header for certain values
cmp #$06
beq StoreMusic ;load music for pipe intro scene if header
cmp #$07 ;start position either value $06 or $07
beq StoreMusic
ChkAreaType: ldy AreaType ;load area type as offset for music bit
lda CloudTypeOverride
beq StoreMusic ;check for cloud type override
ldy #$04 ;select music for cloud type level if found
StoreMusic: lda MusicSelectData,y ;otherwise select appropriate music for level type
sta AreaMusicQueue ;store in queue and leave
ExitGetM: rts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment