finish PlayBattleMusic

This commit is contained in:
yenatch 2013-04-29 16:46:32 -04:00
parent 94cdb091c9
commit e8fb1bc632
1 changed files with 56 additions and 24 deletions

View File

@ -6364,88 +6364,120 @@ TrainerClassNames: ; 2c1ef
db "ROCKET@" db "ROCKET@"
db "MYSTICALMAN@" db "MYSTICALMAN@"
INCBIN "baserom.gbc", $2C41a, $2ee8f - $2C41a
; XXX this is not the start of the routine INCBIN "baserom.gbc", $2c41a, $2ee6c - $2c41a
; determine what music plays in battle
ld a, [OtherTrainerClass] ; are we fighting a trainer?
PlayBattleMusic: ; 2ee6c
push hl
push de
push bc
xor a
ld [MusicFade], a
ld de, MUSIC_NONE
call StartMusic
call DelayFrame
call MaxVolume
ld a, [BattleType]
cp BATTLETYPE_SUICUNE
ld de, MUSIC_SUICUNE_BATTLE
jp z, .done
cp BATTLETYPE_ROAMING
jp z, .done
; Are we fighting a trainer?
ld a, [OtherTrainerClass]
and a and a
jr nz, .trainermusic jr nz, .trainermusic
ld a, BANK(RegionCheck) ld a, BANK(RegionCheck)
ld hl, RegionCheck ld hl, RegionCheck
rst FarCall rst FarCall
ld a, e ld a, e
and a and a
jr nz, .kantowild jr nz, .kantowild
ld de, $0029 ; johto daytime wild battle music
ld a, [TimeOfDay] ; check time of day ld de, MUSIC_JOHTO_WILD_BATTLE
cp $2 ; nighttime? ld a, [TimeOfDay]
jr nz, .done ; if no, then done cp NITE
ld de, $004a ; johto nighttime wild battle music jr nz, .done
ld de, MUSIC_JOHTO_WILD_BATTLE_NIGHT
jr .done jr .done
.kantowild .kantowild
ld de, $0008 ; kanto wild battle music ld de, MUSIC_KANTO_WILD_BATTLE
jr .done jr .done
.trainermusic .trainermusic
ld de, $002f ; lance battle music ld de, MUSIC_CHAMPION_BATTLE
cp CHAMPION cp CHAMPION
jr z, .done jr z, .done
cp RED cp RED
jr z, .done jr z, .done
; really, they should have included admins and scientists here too... ; really, they should have included admins and scientists here too...
ld de, $0031 ; rocket battle music ld de, MUSIC_ROCKET_BATTLE
cp GRUNTM cp GRUNTM
jr z, .done jr z, .done
cp GRUNTF cp GRUNTF
jr z, .done jr z, .done
ld de, $0006 ; kanto gym leader battle music ld de, MUSIC_KANTO_GYM_LEADER_BATTLE
ld a, BANK(IsKantoGymLeader) ld a, BANK(IsKantoGymLeader)
ld hl, IsKantoGymLeader ld hl, IsKantoGymLeader
rst FarCall rst FarCall
jr c, .done jr c, .done
ld de, $002e ; johto gym leader battle music ld de, MUSIC_JOHTO_GYM_LEADER_BATTLE
ld a, BANK(IsJohtoGymLeader) ld a, BANK(IsJohtoGymLeader)
ld hl, IsJohtoGymLeader ld hl, IsJohtoGymLeader
rst FarCall rst FarCall
jr c, .done jr c, .done
ld de, $0030 ; rival battle music ld de, MUSIC_RIVAL_BATTLE
ld a, [OtherTrainerClass] ld a, [OtherTrainerClass]
cp RIVAL1 cp RIVAL1
jr z, .done jr z, .done
cp RIVAL2 cp RIVAL2
jr nz, .othertrainer jr nz, .othertrainer
ld a, [OtherTrainerID] ; which rival are we fighting?
cp $4 ld a, [OtherTrainerID]
jr c, .done ; if it's not the fight inside Indigo Plateau, we're done cp 4 ; Rival in Indigo Plateau
ld de, $002f ; rival indigo plateau battle music jr c, .done
ld de, MUSIC_CHAMPION_BATTLE
jr .done jr .done
.othertrainer .othertrainer
ld a, [InLinkBattle] ld a, [InLinkBattle]
and a and a
jr nz, .linkbattle jr nz, .johtotrainer
ld a, BANK(RegionCheck) ld a, BANK(RegionCheck)
ld hl, RegionCheck ld hl, RegionCheck
rst FarCall rst FarCall
ld a, e ld a, e
and a and a
jr nz, .kantotrainer jr nz, .kantotrainer
.linkbattle
ld de, $002a ; johto trainer battle music .johtotrainer
ld de, MUSIC_JOHTO_TRAINER_BATTLE
jr .done jr .done
.kantotrainer .kantotrainer
ld de, $0007 ; kanto trainer battle music ld de, MUSIC_KANTO_TRAINER_BATTLE
.done .done
call $3b97 call StartMusic
pop bc pop bc
pop de pop de
pop hl pop hl
ret ret
; 2ef18
INCBIN "baserom.gbc", $2ef18, $2ef9f - $2ef18 INCBIN "baserom.gbc", $2ef18, $2ef9f - $2ef18