summaryrefslogtreecommitdiff
path: root/engine/battle/check_battle_scene.asm
diff options
context:
space:
mode:
authorRangi <remy.oukaour+rangi42@gmail.com>2018-04-04 23:56:40 -0400
committerRangi <remy.oukaour+rangi42@gmail.com>2018-04-04 23:56:40 -0400
commit81306889e33c599f8015bc4e653929bb7de00967 (patch)
tree7a812968ba565a13ef400cdcb5230e6e8185a1ec /engine/battle/check_battle_scene.asm
parent145efc13535fbc9d8ab2786d29209d97aebf0481 (diff)
parentf750d4f4185529cfb440ac7825d202ebcf160766 (diff)
Merge branch 'master' of https://github.com/pret/pokecrystal
Diffstat (limited to 'engine/battle/check_battle_scene.asm')
-rw-r--r--engine/battle/check_battle_scene.asm47
1 files changed, 47 insertions, 0 deletions
diff --git a/engine/battle/check_battle_scene.asm b/engine/battle/check_battle_scene.asm
new file mode 100644
index 000000000..577c36e33
--- /dev/null
+++ b/engine/battle/check_battle_scene.asm
@@ -0,0 +1,47 @@
+CheckBattleScene: ; 4ea44
+; Return carry if battle scene is turned off.
+
+ ld a, BANK(wLinkMode)
+ ld hl, wLinkMode
+ call GetFarWRAMByte
+ cp LINK_MOBILE
+ jr z, .mobile
+
+ ld a, [wOptions]
+ bit BATTLE_SCENE, a
+ jr nz, .off
+
+ and a
+ ret
+
+.mobile
+ ld a, [wcd2f]
+ and a
+ jr nz, .from_wram
+
+ ld a, 4 ; MBC30 bank used by JP Crystal; inaccessible by MBC3
+ call GetSRAMBank
+ ld a, [$a60c] ; address of MBC30 bank
+ ld c, a
+ call CloseSRAM
+
+ ld a, c
+ bit 0, c
+ jr z, .off
+
+ and a
+ ret
+
+.from_wram
+ ld a, BANK(w5_dc00)
+ ld hl, w5_dc00
+ call GetFarWRAMByte
+ bit 0, a
+ jr z, .off
+
+ and a
+ ret
+
+.off
+ scf
+ ret