summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpfero <ohpee@loves.dicksinhisan.us>2018-06-04 23:56:05 +0200
committerpfero <ohpee@loves.dicksinhisan.us>2018-06-04 23:56:05 +0200
commit4f87e62feddaed6b2ede988289abbf3fc43a8614 (patch)
treee3fd7395cd1ce8d00702144bfd1e3af7703e1c45
parent17fb962a85448abcb714331c005a2c83b9db0c52 (diff)
parent193cf0265d3f45a3d339dc656f3abcca72de6850 (diff)
Merge branch 'PikalaxALT-battle_bg_effects'
-rw-r--r--constants.asm2
-rw-r--r--constants/battle_anim_constants.asm837
-rw-r--r--data/predef_pointers.inc2
-rw-r--r--engine/battle_anims/bg_effects.asm2376
-rw-r--r--hram.asm7
-rw-r--r--shim.sym5
-rw-r--r--wram.asm62
7 files changed, 3284 insertions, 7 deletions
diff --git a/constants.asm b/constants.asm
index d758d4b..6a93ce6 100644
--- a/constants.asm
+++ b/constants.asm
@@ -23,3 +23,5 @@ INCLUDE "constants/music_constants.asm"
INCLUDE "constants/serial_constants.asm"
INCLUDE "constants/misc_constants.asm"
+
+INCLUDE "constants/battle_anim_constants.asm"
diff --git a/constants/battle_anim_constants.asm b/constants/battle_anim_constants.asm
new file mode 100644
index 0000000..0fbd83a
--- /dev/null
+++ b/constants/battle_anim_constants.asm
@@ -0,0 +1,837 @@
+; battle_anim_struct members (see macros/wram.asm)
+ const_def
+ const BATTLEANIMSTRUCT_INDEX
+ const BATTLEANIMSTRUCT_01
+ const BATTLEANIMSTRUCT_02
+ const BATTLEANIMSTRUCT_FRAMESET_ID
+ const BATTLEANIMSTRUCT_FUNCTION
+ const BATTLEANIMSTRUCT_PALETTE
+ const BATTLEANIMSTRUCT_TILEID
+ const BATTLEANIMSTRUCT_XCOORD
+ const BATTLEANIMSTRUCT_YCOORD
+ const BATTLEANIMSTRUCT_XOFFSET
+ const BATTLEANIMSTRUCT_YOFFSET
+ const BATTLEANIMSTRUCT_0B
+ const BATTLEANIMSTRUCT_DURATION
+ const BATTLEANIMSTRUCT_FRAME
+ const BATTLEANIMSTRUCT_ANON_JT_INDEX
+ const BATTLEANIMSTRUCT_0F
+ const BATTLEANIMSTRUCT_10
+ const BATTLEANIMSTRUCT_11
+ const BATTLEANIMSTRUCT_12
+ const BATTLEANIMSTRUCT_13
+ const BATTLEANIMSTRUCT_14
+ const BATTLEANIMSTRUCT_15
+ const BATTLEANIMSTRUCT_16
+ const BATTLEANIMSTRUCT_17
+BATTLEANIMSTRUCT_LENGTH EQU const_value
+
+; BattleAnimObjects indexes (see data/battle_anims/objects.asm)
+ const_def
+ const ANIM_OBJ_00
+ const ANIM_OBJ_01
+ const ANIM_OBJ_02
+ const ANIM_OBJ_03
+ const ANIM_OBJ_04
+ const ANIM_OBJ_05
+ const ANIM_OBJ_06
+ const ANIM_OBJ_07
+ const ANIM_OBJ_08
+ const ANIM_OBJ_FANG
+ const ANIM_OBJ_0A
+ const ANIM_OBJ_EMBER
+ const ANIM_OBJ_DRAGON_RAGE
+ const ANIM_OBJ_FLAMETHROWER
+ const ANIM_OBJ_FIRE_SPIN
+ const ANIM_OBJ_FIRE_BLAST
+ const ANIM_OBJ_BURNED
+ const ANIM_OBJ_BLIZZARD
+ const ANIM_OBJ_12
+ const ANIM_OBJ_ICE_BEAM
+ const ANIM_OBJ_RAZOR_LEAF
+ const ANIM_OBJ_POKE_BALL
+ const ANIM_OBJ_POKE_BALL_BLOCKED
+ const ANIM_OBJ_17
+ const ANIM_OBJ_18
+ const ANIM_OBJ_19
+ const ANIM_OBJ_1A
+ const ANIM_OBJ_1B
+ const ANIM_OBJ_BALL_POOF
+ const ANIM_OBJ_BIG_ROCK
+ const ANIM_OBJ_SMALL_ROCK
+ const ANIM_OBJ_STRENGTH
+ const ANIM_OBJ_SEISMIC_TOSS
+ const ANIM_OBJ_BUBBLE
+ const ANIM_OBJ_SURF
+ const ANIM_OBJ_SING
+ const ANIM_OBJ_WATER_GUN
+ const ANIM_OBJ_HYDRO_PUMP
+ const ANIM_OBJ_POWDER
+ const ANIM_OBJ_27
+ const ANIM_OBJ_28
+ const ANIM_OBJ_ICE_BUILDUP
+ const ANIM_OBJ_FROZEN
+ const ANIM_OBJ_MASTER_BALL_SPARKLE
+ const ANIM_OBJ_RECOVER
+ const ANIM_OBJ_2D
+ const ANIM_OBJ_2E
+ const ANIM_OBJ_2F
+ const ANIM_OBJ_THUNDER_WAVE
+ const ANIM_OBJ_31
+ const ANIM_OBJ_LIGHTNING_BOLT
+ const ANIM_OBJ_33
+ const ANIM_OBJ_34
+ const ANIM_OBJ_CLAMP
+ const ANIM_OBJ_BITE
+ const ANIM_OBJ_37
+ const ANIM_OBJ_38
+ const ANIM_OBJ_39
+ const ANIM_OBJ_3A
+ const ANIM_OBJ_3B
+ const ANIM_OBJ_3C
+ const ANIM_OBJ_3D
+ const ANIM_OBJ_GUST
+ const ANIM_OBJ_3F
+ const ANIM_OBJ_40
+ const ANIM_OBJ_41
+ const ANIM_OBJ_42
+ const ANIM_OBJ_SONICBOOM_JP
+ const ANIM_OBJ_44
+ const ANIM_OBJ_ABSORB
+ const ANIM_OBJ_EGG
+ const ANIM_OBJ_47
+ const ANIM_OBJ_48
+ const ANIM_OBJ_49
+ const ANIM_OBJ_LEECH_SEED
+ const ANIM_OBJ_4B
+ const ANIM_OBJ_WAVE
+ const ANIM_OBJ_CONFUSE_RAY
+ const ANIM_OBJ_4E
+ const ANIM_OBJ_4F
+ const ANIM_OBJ_SCREEN
+ const ANIM_OBJ_HARDEN
+ const ANIM_OBJ_CHICK
+ const ANIM_OBJ_AMNESIA
+ const ANIM_OBJ_ASLEEP
+ const ANIM_OBJ_SKULL
+ const ANIM_OBJ_56
+ const ANIM_OBJ_57
+ const ANIM_OBJ_58
+ const ANIM_OBJ_PARALYZED
+ const ANIM_OBJ_STRING_SHOT
+ const ANIM_OBJ_HAZE
+ const ANIM_OBJ_MIST
+ const ANIM_OBJ_SMOG
+ const ANIM_OBJ_POISON_GAS
+ const ANIM_OBJ_HORN
+ const ANIM_OBJ_60
+ const ANIM_OBJ_PETAL_DANCE
+ const ANIM_OBJ_SLUDGE_BOMB
+ const ANIM_OBJ_PAY_DAY
+ const ANIM_OBJ_64
+ const ANIM_OBJ_MIMIC
+ const ANIM_OBJ_ATTRACT
+ const ANIM_OBJ_BONEMERANG
+ const ANIM_OBJ_BONE_CLUB
+ const ANIM_OBJ_BONE_RUSH
+ const ANIM_OBJ_SWIFT
+ const ANIM_OBJ_KINESIS
+ const ANIM_OBJ_FLASH
+ const ANIM_OBJ_SHINY
+ const ANIM_OBJ_SKY_ATTACK
+ const ANIM_OBJ_LICK
+ const ANIM_OBJ_WITHDRAW
+ const ANIM_OBJ_71
+ const ANIM_OBJ_GROWTH
+ const ANIM_OBJ_CONVERSION2
+ const ANIM_OBJ_SMOKE
+ const ANIM_OBJ_SMOKESCREEN
+ const ANIM_OBJ_SWORDS_DANCE
+ const ANIM_OBJ_SPEED_LINE
+ const ANIM_OBJ_SHARPEN
+ const ANIM_OBJ_DEFENSE_CURL
+ const ANIM_OBJ_7A
+ const ANIM_OBJ_7B
+ const ANIM_OBJ_DISABLE
+ const ANIM_OBJ_AGILITY
+ const ANIM_OBJ_HEART
+ const ANIM_OBJ_FLAME_WHEEL
+ const ANIM_OBJ_SACRED_FIRE
+ const ANIM_OBJ_COTTON_SPORE
+ const ANIM_OBJ_MILK_DRINK
+ const ANIM_OBJ_ANGER
+ const ANIM_OBJ_84
+ const ANIM_OBJ_85
+ const ANIM_OBJ_BATON_PASS
+ const ANIM_OBJ_LOCK_ON
+ const ANIM_OBJ_MIND_READER
+ const ANIM_OBJ_SAFEGUARD
+ const ANIM_OBJ_PROTECT
+ const ANIM_OBJ_THIEF
+ const ANIM_OBJ_OCTAZOOKA
+ const ANIM_OBJ_PRESENT
+ const ANIM_OBJ_SPIKES
+ const ANIM_OBJ_POWDER_SNOW
+ const ANIM_OBJ_DRAGONBREATH
+ const ANIM_OBJ_CONVERSION
+ const ANIM_OBJ_SPIDER_WEB
+ const ANIM_OBJ_93
+ const ANIM_OBJ_NIGHTMARE
+ const ANIM_OBJ_IN_NIGHTMARE
+ const ANIM_OBJ_LOVELY_KISS
+ const ANIM_OBJ_SWEET_KISS
+ const ANIM_OBJ_SKETCH
+ const ANIM_OBJ_99
+ const ANIM_OBJ_9A
+ const ANIM_OBJ_DESTINY_BOND
+ const ANIM_OBJ_MORNING_SUN
+ const ANIM_OBJ_GLIMMER
+ const ANIM_OBJ_MOONLIGHT
+ const ANIM_OBJ_HIDDEN_POWER
+ const ANIM_OBJ_A0
+ const ANIM_OBJ_A1
+ const ANIM_OBJ_SANDSTORM
+ const ANIM_OBJ_ZAP_CANNON
+ const ANIM_OBJ_SPITE
+ const ANIM_OBJ_CURSE
+ const ANIM_OBJ_PERISH_SONG
+ const ANIM_OBJ_FORESIGHT
+ const ANIM_OBJ_RAPID_SPIN
+ const ANIM_OBJ_SWAGGER
+ const ANIM_OBJ_AA
+ const ANIM_OBJ_AB
+ const ANIM_OBJ_MEAN_LOOK
+ const ANIM_OBJ_AD
+ const ANIM_OBJ_AE
+ const ANIM_OBJ_RAIN
+ const ANIM_OBJ_B0
+ const ANIM_OBJ_PSYCH_UP
+ const ANIM_OBJ_ANCIENTPOWER
+ const ANIM_OBJ_AEROBLAST
+ const ANIM_OBJ_SHADOW_BALL
+ const ANIM_OBJ_ROCK_SMASH
+ const ANIM_OBJ_FLOWER
+ const ANIM_OBJ_COTTON
+
+const_value SET $b1
+ const ANIM_OBJ_PLAYERFEETFOLLOW
+ const ANIM_OBJ_ENEMYFEETFOLLOW
+ const ANIM_OBJ_PLAYERHEADFOLLOW
+ const ANIM_OBJ_ENEMYHEADFOLLOW
+
+; DoBattleAnimFrame arguments (see engine/battle_anims/functions.asm)
+ const_def
+ const BATTLEANIMFUNC_00
+ const BATTLEANIMFUNC_01
+ const BATTLEANIMFUNC_02
+ const BATTLEANIMFUNC_03
+ const BATTLEANIMFUNC_04
+ const BATTLEANIMFUNC_05
+ const BATTLEANIMFUNC_06
+ const BATTLEANIMFUNC_07
+ const BATTLEANIMFUNC_08
+ const BATTLEANIMFUNC_09
+ const BATTLEANIMFUNC_0A
+ const BATTLEANIMFUNC_RAZOR_LEAF
+ const BATTLEANIMFUNC_0C
+ const BATTLEANIMFUNC_0D
+ const BATTLEANIMFUNC_0E
+ const BATTLEANIMFUNC_0F
+ const BATTLEANIMFUNC_10
+ const BATTLEANIMFUNC_11
+ const BATTLEANIMFUNC_12
+ const BATTLEANIMFUNC_13
+ const BATTLEANIMFUNC_14
+ const BATTLEANIMFUNC_15
+ const BATTLEANIMFUNC_16
+ const BATTLEANIMFUNC_17
+ const BATTLEANIMFUNC_18
+ const BATTLEANIMFUNC_19
+ const BATTLEANIMFUNC_1A
+ const BATTLEANIMFUNC_1B
+ const BATTLEANIMFUNC_1C
+ const BATTLEANIMFUNC_1D
+ const BATTLEANIMFUNC_1E
+ const BATTLEANIMFUNC_1F
+ const BATTLEANIMFUNC_LEECH_SEED
+ const BATTLEANIMFUNC_21
+ const BATTLEANIMFUNC_22
+ const BATTLEANIMFUNC_23
+ const BATTLEANIMFUNC_24
+ const BATTLEANIMFUNC_25
+ const BATTLEANIMFUNC_26
+ const BATTLEANIMFUNC_27
+ const BATTLEANIMFUNC_28
+ const BATTLEANIMFUNC_SPRIAL_DESCENT
+ const BATTLEANIMFUNC_POISON_GAS
+ const BATTLEANIMFUNC_HORN
+ const BATTLEANIMFUNC_2C
+ const BATTLEANIMFUNC_2D
+ const BATTLEANIMFUNC_2E
+ const BATTLEANIMFUNC_2F
+ const BATTLEANIMFUNC_30
+ const BATTLEANIMFUNC_31
+ const BATTLEANIMFUNC_32
+ const BATTLEANIMFUNC_33
+ const BATTLEANIMFUNC_34
+ const BATTLEANIMFUNC_35
+ const BATTLEANIMFUNC_36
+ const BATTLEANIMFUNC_37
+ const BATTLEANIMFUNC_38
+ const BATTLEANIMFUNC_39
+ const BATTLEANIMFUNC_3A
+ const BATTLEANIMFUNC_3B
+ const BATTLEANIMFUNC_3C
+ const BATTLEANIMFUNC_3D
+ const BATTLEANIMFUNC_3E
+ const BATTLEANIMFUNC_3F
+ const BATTLEANIMFUNC_40
+ const BATTLEANIMFUNC_41
+ const BATTLEANIMFUNC_42
+ const BATTLEANIMFUNC_43
+ const BATTLEANIMFUNC_44
+ const BATTLEANIMFUNC_45
+ const BATTLEANIMFUNC_46
+ const BATTLEANIMFUNC_47
+ const BATTLEANIMFUNC_48
+ const BATTLEANIMFUNC_49
+ const BATTLEANIMFUNC_4A
+ const BATTLEANIMFUNC_4B
+ const BATTLEANIMFUNC_4C
+ const BATTLEANIMFUNC_4D
+ const BATTLEANIMFUNC_4E
+ const BATTLEANIMFUNC_4F
+
+; BattleAnimFrameData indexes (see data/battle_anims/framesets.asm)
+ const_def
+ const BATTLEANIMFRAMESET_00
+ const BATTLEANIMFRAMESET_01
+ const BATTLEANIMFRAMESET_02
+ const BATTLEANIMFRAMESET_03
+ const BATTLEANIMFRAMESET_04
+ const BATTLEANIMFRAMESET_05
+ const BATTLEANIMFRAMESET_06
+ const BATTLEANIMFRAMESET_07
+ const BATTLEANIMFRAMESET_08
+ const BATTLEANIMFRAMESET_09
+ const BATTLEANIMFRAMESET_0A
+ const BATTLEANIMFRAMESET_0B
+ const BATTLEANIMFRAMESET_0C
+ const BATTLEANIMFRAMESET_0D
+ const BATTLEANIMFRAMESET_0E
+ const BATTLEANIMFRAMESET_0F
+ const BATTLEANIMFRAMESET_10
+ const BATTLEANIMFRAMESET_11
+ const BATTLEANIMFRAMESET_12
+ const BATTLEANIMFRAMESET_13
+ const BATTLEANIMFRAMESET_14
+ const BATTLEANIMFRAMESET_15
+ const BATTLEANIMFRAMESET_16
+ const BATTLEANIMFRAMESET_17
+ const BATTLEANIMFRAMESET_18
+ const BATTLEANIMFRAMESET_19
+ const BATTLEANIMFRAMESET_1A
+ const BATTLEANIMFRAMESET_1B
+ const BATTLEANIMFRAMESET_1C
+ const BATTLEANIMFRAMESET_1D
+ const BATTLEANIMFRAMESET_1E
+ const BATTLEANIMFRAMESET_1F
+ const BATTLEANIMFRAMESET_20
+ const BATTLEANIMFRAMESET_21
+ const BATTLEANIMFRAMESET_22
+ const BATTLEANIMFRAMESET_23
+ const BATTLEANIMFRAMESET_24
+ const BATTLEANIMFRAMESET_25
+ const BATTLEANIMFRAMESET_26
+ const BATTLEANIMFRAMESET_27
+ const BATTLEANIMFRAMESET_28
+ const BATTLEANIMFRAMESET_29
+ const BATTLEANIMFRAMESET_2A
+ const BATTLEANIMFRAMESET_2B
+ const BATTLEANIMFRAMESET_2C
+ const BATTLEANIMFRAMESET_2D
+ const BATTLEANIMFRAMESET_2E
+ const BATTLEANIMFRAMESET_2F
+ const BATTLEANIMFRAMESET_30
+ const BATTLEANIMFRAMESET_31
+ const BATTLEANIMFRAMESET_32
+ const BATTLEANIMFRAMESET_33
+ const BATTLEANIMFRAMESET_34
+ const BATTLEANIMFRAMESET_35
+ const BATTLEANIMFRAMESET_36
+ const BATTLEANIMFRAMESET_37
+ const BATTLEANIMFRAMESET_38
+ const BATTLEANIMFRAMESET_39
+ const BATTLEANIMFRAMESET_3A
+ const BATTLEANIMFRAMESET_3B
+ const BATTLEANIMFRAMESET_3C
+ const BATTLEANIMFRAMESET_3D
+ const BATTLEANIMFRAMESET_3E
+ const BATTLEANIMFRAMESET_3F
+ const BATTLEANIMFRAMESET_40
+ const BATTLEANIMFRAMESET_41
+ const BATTLEANIMFRAMESET_42
+ const BATTLEANIMFRAMESET_43
+ const BATTLEANIMFRAMESET_44
+ const BATTLEANIMFRAMESET_45
+ const BATTLEANIMFRAMESET_46
+ const BATTLEANIMFRAMESET_47
+ const BATTLEANIMFRAMESET_48
+ const BATTLEANIMFRAMESET_49
+ const BATTLEANIMFRAMESET_4A
+ const BATTLEANIMFRAMESET_4B
+ const BATTLEANIMFRAMESET_4C
+ const BATTLEANIMFRAMESET_4D
+ const BATTLEANIMFRAMESET_4E
+ const BATTLEANIMFRAMESET_4F
+ const BATTLEANIMFRAMESET_50
+ const BATTLEANIMFRAMESET_51
+ const BATTLEANIMFRAMESET_52
+ const BATTLEANIMFRAMESET_53
+ const BATTLEANIMFRAMESET_54
+ const BATTLEANIMFRAMESET_55
+ const BATTLEANIMFRAMESET_56
+ const BATTLEANIMFRAMESET_57
+ const BATTLEANIMFRAMESET_58
+ const BATTLEANIMFRAMESET_59
+ const BATTLEANIMFRAMESET_5A
+ const BATTLEANIMFRAMESET_5B
+ const BATTLEANIMFRAMESET_5C
+ const BATTLEANIMFRAMESET_5D
+ const BATTLEANIMFRAMESET_5E
+ const BATTLEANIMFRAMESET_5F
+ const BATTLEANIMFRAMESET_60
+ const BATTLEANIMFRAMESET_61
+ const BATTLEANIMFRAMESET_62
+ const BATTLEANIMFRAMESET_63
+ const BATTLEANIMFRAMESET_64
+ const BATTLEANIMFRAMESET_65
+ const BATTLEANIMFRAMESET_66
+ const BATTLEANIMFRAMESET_67
+ const BATTLEANIMFRAMESET_68
+ const BATTLEANIMFRAMESET_69
+ const BATTLEANIMFRAMESET_6A
+ const BATTLEANIMFRAMESET_6B
+ const BATTLEANIMFRAMESET_6C
+ const BATTLEANIMFRAMESET_6D
+ const BATTLEANIMFRAMESET_6E
+ const BATTLEANIMFRAMESET_6F
+ const BATTLEANIMFRAMESET_70
+ const BATTLEANIMFRAMESET_71
+ const BATTLEANIMFRAMESET_72
+ const BATTLEANIMFRAMESET_73
+ const BATTLEANIMFRAMESET_74
+ const BATTLEANIMFRAMESET_75
+ const BATTLEANIMFRAMESET_76
+ const BATTLEANIMFRAMESET_77
+ const BATTLEANIMFRAMESET_78
+ const BATTLEANIMFRAMESET_79
+ const BATTLEANIMFRAMESET_7A
+ const BATTLEANIMFRAMESET_7B
+ const BATTLEANIMFRAMESET_7C
+ const BATTLEANIMFRAMESET_7D
+ const BATTLEANIMFRAMESET_7E
+ const BATTLEANIMFRAMESET_7F
+ const BATTLEANIMFRAMESET_80
+ const BATTLEANIMFRAMESET_81
+ const BATTLEANIMFRAMESET_82
+ const BATTLEANIMFRAMESET_83
+ const BATTLEANIMFRAMESET_84
+ const BATTLEANIMFRAMESET_85
+ const BATTLEANIMFRAMESET_86
+ const BATTLEANIMFRAMESET_87
+ const BATTLEANIMFRAMESET_88
+ const BATTLEANIMFRAMESET_89
+ const BATTLEANIMFRAMESET_8A
+ const BATTLEANIMFRAMESET_8B
+ const BATTLEANIMFRAMESET_8C
+ const BATTLEANIMFRAMESET_8D
+ const BATTLEANIMFRAMESET_8E
+ const BATTLEANIMFRAMESET_8F
+ const BATTLEANIMFRAMESET_90
+ const BATTLEANIMFRAMESET_91
+ const BATTLEANIMFRAMESET_92
+ const BATTLEANIMFRAMESET_93
+ const BATTLEANIMFRAMESET_94
+ const BATTLEANIMFRAMESET_95
+ const BATTLEANIMFRAMESET_96
+ const BATTLEANIMFRAMESET_97
+ const BATTLEANIMFRAMESET_98
+ const BATTLEANIMFRAMESET_99
+ const BATTLEANIMFRAMESET_9A
+ const BATTLEANIMFRAMESET_9B
+ const BATTLEANIMFRAMESET_9C
+ const BATTLEANIMFRAMESET_9D
+ const BATTLEANIMFRAMESET_9E
+ const BATTLEANIMFRAMESET_9F
+ const BATTLEANIMFRAMESET_A0
+ const BATTLEANIMFRAMESET_A1
+ const BATTLEANIMFRAMESET_A2
+ const BATTLEANIMFRAMESET_A3
+ const BATTLEANIMFRAMESET_A4
+ const BATTLEANIMFRAMESET_A5
+ const BATTLEANIMFRAMESET_A6
+ const BATTLEANIMFRAMESET_A7
+ const BATTLEANIMFRAMESET_A8
+ const BATTLEANIMFRAMESET_A9
+ const BATTLEANIMFRAMESET_AA
+ const BATTLEANIMFRAMESET_AB
+ const BATTLEANIMFRAMESET_AC
+ const BATTLEANIMFRAMESET_AD
+ const BATTLEANIMFRAMESET_AE
+ const BATTLEANIMFRAMESET_AF
+ const BATTLEANIMFRAMESET_B0
+ const BATTLEANIMFRAMESET_B1
+ const BATTLEANIMFRAMESET_B2
+ const BATTLEANIMFRAMESET_B3
+ const BATTLEANIMFRAMESET_B4
+ const BATTLEANIMFRAMESET_B5
+ const BATTLEANIMFRAMESET_B6
+ const BATTLEANIMFRAMESET_B7
+ const BATTLEANIMFRAMESET_B8
+
+; BattleAnimOAMData indexes (see data/battle_anims/oam.asm)
+ const_def
+ const BATTLEANIMOAMSET_00
+ const BATTLEANIMOAMSET_01
+ const BATTLEANIMOAMSET_02
+ const BATTLEANIMOAMSET_03
+ const BATTLEANIMOAMSET_04
+ const BATTLEANIMOAMSET_05
+ const BATTLEANIMOAMSET_06
+ const BATTLEANIMOAMSET_07
+ const BATTLEANIMOAMSET_08
+ const BATTLEANIMOAMSET_09
+ const BATTLEANIMOAMSET_0A
+ const BATTLEANIMOAMSET_0B
+ const BATTLEANIMOAMSET_0C
+ const BATTLEANIMOAMSET_0D
+ const BATTLEANIMOAMSET_0E
+ const BATTLEANIMOAMSET_0F
+ const BATTLEANIMOAMSET_10
+ const BATTLEANIMOAMSET_11
+ const BATTLEANIMOAMSET_12
+ const BATTLEANIMOAMSET_13
+ const BATTLEANIMOAMSET_14
+ const BATTLEANIMOAMSET_15
+ const BATTLEANIMOAMSET_16
+ const BATTLEANIMOAMSET_17
+ const BATTLEANIMOAMSET_18
+ const BATTLEANIMOAMSET_19
+ const BATTLEANIMOAMSET_1A
+ const BATTLEANIMOAMSET_1B
+ const BATTLEANIMOAMSET_1C
+ const BATTLEANIMOAMSET_1D
+ const BATTLEANIMOAMSET_1E
+ const BATTLEANIMOAMSET_1F
+ const BATTLEANIMOAMSET_20
+ const BATTLEANIMOAMSET_21
+ const BATTLEANIMOAMSET_22
+ const BATTLEANIMOAMSET_23
+ const BATTLEANIMOAMSET_24
+ const BATTLEANIMOAMSET_25
+ const BATTLEANIMOAMSET_26
+ const BATTLEANIMOAMSET_27
+ const BATTLEANIMOAMSET_28
+ const BATTLEANIMOAMSET_29
+ const BATTLEANIMOAMSET_2A
+ const BATTLEANIMOAMSET_2B
+ const BATTLEANIMOAMSET_2C
+ const BATTLEANIMOAMSET_2D
+ const BATTLEANIMOAMSET_2E
+ const BATTLEANIMOAMSET_2F
+ const BATTLEANIMOAMSET_30
+ const BATTLEANIMOAMSET_31
+ const BATTLEANIMOAMSET_32
+ const BATTLEANIMOAMSET_33
+ const BATTLEANIMOAMSET_34
+ const BATTLEANIMOAMSET_35
+ const BATTLEANIMOAMSET_36
+ const BATTLEANIMOAMSET_37
+ const BATTLEANIMOAMSET_38
+ const BATTLEANIMOAMSET_39
+ const BATTLEANIMOAMSET_3A
+ const BATTLEANIMOAMSET_3B
+ const BATTLEANIMOAMSET_3C
+ const BATTLEANIMOAMSET_3D
+ const BATTLEANIMOAMSET_3E
+ const BATTLEANIMOAMSET_3F
+ const BATTLEANIMOAMSET_40
+ const BATTLEANIMOAMSET_41
+ const BATTLEANIMOAMSET_42
+ const BATTLEANIMOAMSET_43
+ const BATTLEANIMOAMSET_44
+ const BATTLEANIMOAMSET_45
+ const BATTLEANIMOAMSET_46
+ const BATTLEANIMOAMSET_47
+ const BATTLEANIMOAMSET_48
+ const BATTLEANIMOAMSET_49
+ const BATTLEANIMOAMSET_4A
+ const BATTLEANIMOAMSET_4B
+ const BATTLEANIMOAMSET_4C
+ const BATTLEANIMOAMSET_4D
+ const BATTLEANIMOAMSET_4E
+ const BATTLEANIMOAMSET_4F
+ const BATTLEANIMOAMSET_50
+ const BATTLEANIMOAMSET_51
+ const BATTLEANIMOAMSET_52
+ const BATTLEANIMOAMSET_53
+ const BATTLEANIMOAMSET_54
+ const BATTLEANIMOAMSET_55
+ const BATTLEANIMOAMSET_56
+ const BATTLEANIMOAMSET_57
+ const BATTLEANIMOAMSET_58
+ const BATTLEANIMOAMSET_59
+ const BATTLEANIMOAMSET_5A
+ const BATTLEANIMOAMSET_5B
+ const BATTLEANIMOAMSET_5C
+ const BATTLEANIMOAMSET_5D
+ const BATTLEANIMOAMSET_5E
+ const BATTLEANIMOAMSET_5F
+ const BATTLEANIMOAMSET_60
+ const BATTLEANIMOAMSET_61
+ const BATTLEANIMOAMSET_62
+ const BATTLEANIMOAMSET_63
+ const BATTLEANIMOAMSET_64
+ const BATTLEANIMOAMSET_65
+ const BATTLEANIMOAMSET_66
+ const BATTLEANIMOAMSET_67
+ const BATTLEANIMOAMSET_68
+ const BATTLEANIMOAMSET_69
+ const BATTLEANIMOAMSET_6A
+ const BATTLEANIMOAMSET_6B
+ const BATTLEANIMOAMSET_6C
+ const BATTLEANIMOAMSET_6D
+ const BATTLEANIMOAMSET_6E
+ const BATTLEANIMOAMSET_6F
+ const BATTLEANIMOAMSET_70
+ const BATTLEANIMOAMSET_71
+ const BATTLEANIMOAMSET_72
+ const BATTLEANIMOAMSET_73
+ const BATTLEANIMOAMSET_74
+ const BATTLEANIMOAMSET_75
+ const BATTLEANIMOAMSET_76
+ const BATTLEANIMOAMSET_77
+ const BATTLEANIMOAMSET_78
+ const BATTLEANIMOAMSET_79
+ const BATTLEANIMOAMSET_7A
+ const BATTLEANIMOAMSET_7B
+ const BATTLEANIMOAMSET_7C
+ const BATTLEANIMOAMSET_7D
+ const BATTLEANIMOAMSET_7E
+ const BATTLEANIMOAMSET_7F
+ const BATTLEANIMOAMSET_80
+ const BATTLEANIMOAMSET_81
+ const BATTLEANIMOAMSET_82
+ const BATTLEANIMOAMSET_83
+ const BATTLEANIMOAMSET_84
+ const BATTLEANIMOAMSET_85
+ const BATTLEANIMOAMSET_86
+ const BATTLEANIMOAMSET_87
+ const BATTLEANIMOAMSET_88
+ const BATTLEANIMOAMSET_89
+ const BATTLEANIMOAMSET_8A
+ const BATTLEANIMOAMSET_8B
+ const BATTLEANIMOAMSET_8C
+ const BATTLEANIMOAMSET_8D
+ const BATTLEANIMOAMSET_8E
+ const BATTLEANIMOAMSET_8F
+ const BATTLEANIMOAMSET_90
+ const BATTLEANIMOAMSET_91
+ const BATTLEANIMOAMSET_92
+ const BATTLEANIMOAMSET_93
+ const BATTLEANIMOAMSET_94
+ const BATTLEANIMOAMSET_95
+ const BATTLEANIMOAMSET_96
+ const BATTLEANIMOAMSET_97
+ const BATTLEANIMOAMSET_98
+ const BATTLEANIMOAMSET_99
+ const BATTLEANIMOAMSET_9A
+ const BATTLEANIMOAMSET_9B
+ const BATTLEANIMOAMSET_9C
+ const BATTLEANIMOAMSET_9D
+ const BATTLEANIMOAMSET_9E
+ const BATTLEANIMOAMSET_9F
+ const BATTLEANIMOAMSET_A0
+ const BATTLEANIMOAMSET_A1
+ const BATTLEANIMOAMSET_A2
+ const BATTLEANIMOAMSET_A3
+ const BATTLEANIMOAMSET_A4
+ const BATTLEANIMOAMSET_A5
+ const BATTLEANIMOAMSET_A6
+ const BATTLEANIMOAMSET_A7
+ const BATTLEANIMOAMSET_A8
+ const BATTLEANIMOAMSET_A9
+ const BATTLEANIMOAMSET_AA
+ const BATTLEANIMOAMSET_AB
+ const BATTLEANIMOAMSET_AC
+ const BATTLEANIMOAMSET_AD
+ const BATTLEANIMOAMSET_AE
+ const BATTLEANIMOAMSET_AF
+ const BATTLEANIMOAMSET_B0
+ const BATTLEANIMOAMSET_B1
+ const BATTLEANIMOAMSET_B2
+ const BATTLEANIMOAMSET_B3
+ const BATTLEANIMOAMSET_B4
+ const BATTLEANIMOAMSET_B5
+ const BATTLEANIMOAMSET_B6
+ const BATTLEANIMOAMSET_B7
+ const BATTLEANIMOAMSET_B8
+ const BATTLEANIMOAMSET_B9
+ const BATTLEANIMOAMSET_BA
+ const BATTLEANIMOAMSET_BB
+ const BATTLEANIMOAMSET_BC
+ const BATTLEANIMOAMSET_BD
+ const BATTLEANIMOAMSET_BE
+ const BATTLEANIMOAMSET_BF
+ const BATTLEANIMOAMSET_C0
+ const BATTLEANIMOAMSET_C1
+ const BATTLEANIMOAMSET_C2
+ const BATTLEANIMOAMSET_C3
+ const BATTLEANIMOAMSET_C4
+ const BATTLEANIMOAMSET_C5
+ const BATTLEANIMOAMSET_C6
+ const BATTLEANIMOAMSET_C7
+ const BATTLEANIMOAMSET_C8
+ const BATTLEANIMOAMSET_C9
+ const BATTLEANIMOAMSET_CA
+ const BATTLEANIMOAMSET_CB
+ const BATTLEANIMOAMSET_CC
+ const BATTLEANIMOAMSET_CD
+ const BATTLEANIMOAMSET_CE
+ const BATTLEANIMOAMSET_CF
+ const BATTLEANIMOAMSET_D0
+ const BATTLEANIMOAMSET_D1
+ const BATTLEANIMOAMSET_D2
+ const BATTLEANIMOAMSET_D3
+ const BATTLEANIMOAMSET_D4
+ const BATTLEANIMOAMSET_D5
+ const BATTLEANIMOAMSET_D6
+ const BATTLEANIMOAMSET_D7
+
+; BattleBGEffects indexes (see engine/battle_anims/bg_effects.asm)
+ const_def 1
+ const ANIM_BG_FLASH_INVERTED
+ const ANIM_BG_FLASH_WHITE
+ const ANIM_BG_WHITE_HUES
+ const ANIM_BG_BLACK_HUES
+ const ANIM_BG_ALTERNATE_HUES
+ const ANIM_BG_06
+ const ANIM_BG_07
+ const ANIM_BG_08
+ const ANIM_BG_HIDE_MON
+ const ANIM_BG_SHOW_MON
+ const ANIM_BG_ENTER_MON
+ const ANIM_BG_RETURN_MON
+ const ANIM_BG_SURF
+ ;const ANIM_BG_WHIRLPOOL
+ const ANIM_BG_TELEPORT
+ const ANIM_BG_NIGHT_SHADE
+ const ANIM_BG_FEET_FOLLOW
+ const ANIM_BG_HEAD_FOLLOW
+ const ANIM_BG_DOUBLE_TEAM
+ const ANIM_BG_ACID_ARMOR
+ const ANIM_BG_RAPID_FLASH
+ const ANIM_BG_16
+ const ANIM_BG_17
+ const ANIM_BG_18
+ const ANIM_BG_19
+ const ANIM_BG_1A
+ const ANIM_BG_1B
+ const ANIM_BG_1C
+ const ANIM_BG_1D
+ const ANIM_BG_1E
+ const ANIM_BG_1F
+ const ANIM_BG_20
+ const ANIM_BG_WITHDRAW
+ const ANIM_BG_BOUNCE_DOWN
+ const ANIM_BG_DIG
+ const ANIM_BG_TACKLE
+ ;const ANIM_BG_25
+ const ANIM_BG_26
+ const ANIM_BG_27
+ const ANIM_BG_WAVE_DEFORM_USER
+ const ANIM_BG_PSYCHIC
+ const ANIM_BG_2A
+ const ANIM_BG_2B
+ const ANIM_BG_2C
+ const ANIM_BG_2D
+ const ANIM_BG_2E
+ const ANIM_BG_2F
+ ;const ANIM_BG_30
+ ;const ANIM_BG_31
+ ;const ANIM_BG_32
+ ;const ANIM_BG_VIBRATE_MON
+ ;const ANIM_BG_WOBBLE_MON
+ ;const ANIM_BG_35
+
+; AnimObjGFX indexes (see data/battle_anims/object_gfx.asm)
+ const_def 1
+ const ANIM_GFX_HIT
+ const ANIM_GFX_CUT
+ const ANIM_GFX_FIRE
+ const ANIM_GFX_WATER
+ const ANIM_GFX_LIGHTNING
+ const ANIM_GFX_PLANT
+ const ANIM_GFX_SMOKE
+ const ANIM_GFX_EXPLOSION
+ const ANIM_GFX_ROCKS
+ const ANIM_GFX_ICE
+ const ANIM_GFX_POKE_BALL
+ const ANIM_GFX_POISON
+ const ANIM_GFX_BUBBLE
+ const ANIM_GFX_NOISE
+ const ANIM_GFX_POWDER
+ const ANIM_GFX_BEAM
+ const ANIM_GFX_SPEED
+ const ANIM_GFX_CHARGE
+ const ANIM_GFX_WIND
+ const ANIM_GFX_WHIP
+ const ANIM_GFX_EGG
+ const ANIM_GFX_ROPE
+ const ANIM_GFX_PSYCHIC
+ const ANIM_GFX_REFLECT
+ const ANIM_GFX_STATUS
+ const ANIM_GFX_SAND
+ const ANIM_GFX_WEB
+ const ANIM_GFX_HAZE
+ const ANIM_GFX_HORN
+ const ANIM_GFX_FLOWER
+ const ANIM_GFX_MISC
+ const ANIM_GFX_SKY_ATTACK
+ const ANIM_GFX_GLOBE
+ const ANIM_GFX_SHAPES
+ const ANIM_GFX_OBJECTS
+ const ANIM_GFX_SHINE
+ const ANIM_GFX_ANGELS
+ const ANIM_GFX_WAVE
+ const ANIM_GFX_AEROBLAST
+
+; battle_bg_effect struct members (see macros/wram.asm)
+ const_def
+ const BG_EFFECT_STRUCT_FUNCTION
+ const BG_EFFECT_STRUCT_JT_INDEX
+ const BG_EFFECT_STRUCT_BATTLE_TURN
+ const BG_EFFECT_STRUCT_03
+
+; battle palettes
+ const_def
+ const PAL_BATTLE_BG_PLAYER ; 0
+ const PAL_BATTLE_BG_ENEMY ; 1
+ const PAL_BATTLE_BG_ENEMY_HP ; 2
+ const PAL_BATTLE_BG_PLAYER_HP ; 3
+ const PAL_BATTLE_BG_EXP ; 4
+ const PAL_BATTLE_BG_5 ; 5
+ const PAL_BATTLE_BG_6 ; 6
+ const PAL_BATTLE_BG_TEXT ; 7
+
+; animation object palettes
+ const_def
+ const PAL_BATTLE_OB_ENEMY ; 0
+ const PAL_BATTLE_OB_PLAYER ; 1
+ const PAL_BATTLE_OB_GRAY ; 2
+ const PAL_BATTLE_OB_YELLOW ; 3
+ const PAL_BATTLE_OB_RED ; 4
+ const PAL_BATTLE_OB_GREEN ; 5
+ const PAL_BATTLE_OB_BLUE ; 6
+ const PAL_BATTLE_OB_BROWN ; 7
diff --git a/data/predef_pointers.inc b/data/predef_pointers.inc
index f987419..691a072 100644
--- a/data/predef_pointers.inc
+++ b/data/predef_pointers.inc
@@ -84,7 +84,7 @@ GiveItemPredef::
add_predef Function_145b8
add_predef Function_146dc
add_predef Function_145de
- add_predef Function_c8000
+ add_predef ExecuteBGEffects
add_predef Function_1457a
add_predef Function_143e0
add_predef CheckSGB
diff --git a/engine/battle_anims/bg_effects.asm b/engine/battle_anims/bg_effects.asm
new file mode 100644
index 0000000..c8e42f2
--- /dev/null
+++ b/engine/battle_anims/bg_effects.asm
@@ -0,0 +1,2376 @@
+include "constants.asm"
+
+SECTION "Battle Anims BG Effects", ROMX [$4000], BANK [$32]
+
+ const_def
+ const BGSQUARE_SIX
+ const BGSQUARE_FOUR
+ const BGSQUARE_TWO
+ const BGSQUARE_SEVEN
+ const BGSQUARE_FIVE
+ const BGSQUARE_THREE
+
+; BG effects for use in battle animations.
+
+ExecuteBGEffects: ; c8000 (32:4000)
+ ld hl, wActiveBGEffects
+ ld e, 5
+.loop
+ ld a, [hl]
+ and a
+ jr z, .next
+ ld c, l
+ ld b, h
+ push hl
+ push de
+ call DoBattleBGEffectFunction
+ pop de
+ pop hl
+.next
+ ld bc, 4
+ add hl, bc
+ dec e
+ jr nz, .loop
+ ret
+
+QueueBGEffect: ; c801a (32:401a)
+ ld hl, wActiveBGEffects
+ ld e, 5
+.loop
+ ld a, [hl]
+ and a
+ jr z, .load
+ ld bc, 4
+ add hl, bc
+ dec e
+ jr nz, .loop
+ scf
+ ret
+
+.load
+ ld c, l
+ ld b, h
+ ld hl, BG_EFFECT_STRUCT_FUNCTION
+ add hl, bc
+ ld a, [wBattleAnimTemp0]
+ ld [hli], a
+ ld a, [wBattleAnimTemp1]
+ ld [hli], a
+ ld a, [wBattleAnimTemp2]
+ ld [hli], a
+ ld a, [wBattleAnimTemp3]
+ ld [hl], a
+ ret
+
+EndBattleBGEffect: ; c8043 (32:4043)
+ ld hl, BG_EFFECT_STRUCT_FUNCTION
+ add hl, bc
+ ld [hl], 0
+ ret
+
+DoBattleBGEffectFunction: ; c804a (32:404a)
+ ld hl, BG_EFFECT_STRUCT_FUNCTION
+ add hl, bc
+ ld e, [hl]
+ ld d, 0
+ ld hl, BattleBGEffects
+ add hl, de
+ add hl, de
+ ld a, [hli]
+ ld h, [hl]
+ ld l, a
+ jp hl
+
+BattleBGEffects: ; c805a (32:405a)
+; entries correspond to ANIM_BG_* constants
+ dw BattleBGEffect_End
+ dw BattleBGEffect_FlashInverted
+ dw BattleBGEffect_FlashWhite
+ dw BattleBGEffect_WhiteHues
+ dw BattleBGEffect_BlackHues
+ dw BattleBGEffect_AlternateHues
+ dw BattleBGEffect_06
+ dw BattleBGEffect_07
+ dw BattleBGEffect_08
+ dw BattleBGEffect_HideMon
+ dw BattleBGEffect_ShowMon
+ dw BattleBGEffect_EnterMon
+ dw BattleBGEffect_ReturnMon
+ dw BattleBGEffect_Surf
+ ;dw BattleBGEffect_Whirlpool
+ dw BattleBGEffect_Teleport
+ dw BattleBGEffect_NightShade
+ dw BattleBGEffect_FeetFollow
+ dw BattleBGEffect_HeadFollow
+ dw BattleBGEffect_DoubleTeam
+ dw BattleBGEffect_AcidArmor
+ dw BattleBGEffect_RapidFlash
+ dw BattleBGEffect_16
+ dw BattleBGEffect_17
+ dw BattleBGEffect_18
+ dw BattleBGEffect_19
+ dw BattleBGEffect_1a
+ dw BattleBGEffect_1b
+ dw BattleBGEffect_1c
+ dw BattleBGEffect_1d
+ dw BattleBGEffect_1e
+ dw BattleBGEffect_1f
+ dw BattleBGEffect_20
+ dw BattleBGEffect_Withdraw
+ dw BattleBGEffect_BounceDown
+ dw BattleBGEffect_Dig
+ dw BattleBGEffect_Tackle
+ ;dw BattleBGEffect_25
+ dw BattleBGEffect_26
+ dw BattleBGEffect_27
+ dw BattleBGEffect_28
+ dw BattleBGEffect_Psychic
+ dw BattleBGEffect_2a
+ dw BattleBGEffect_2b
+ dw BattleBGEffect_2c
+ dw BattleBGEffect_2d
+ dw BattleBGEffect_2e
+ dw BattleBGEffect_2f
+ ;dw BattleBGEffect_30
+ ;dw BattleBGEffect_31
+ ;dw BattleBGEffect_32
+ ;dw BattleBGEffect_VibrateMon
+ ;dw BattleBGEffect_WobbleMon
+
+
+BattleBGEffect_End: ; c80c6 (32:40c6)
+ call EndBattleBGEffect
+ ret
+
+BattleBGEffects_AnonJumptable: ; c80d7 (32:40d7)
+ ld hl, sp+$0
+ ld e, [hl]
+ inc hl
+ ld d, [hl]
+ inc de
+BatttleBGEffects_GetNamedJumptablePointer: ; c80ca (32:40ca)
+ ld hl, BG_EFFECT_STRUCT_JT_INDEX
+ add hl, bc
+ ld l, [hl]
+ ld h, 0
+ add hl, hl
+ add hl, de
+ ld a, [hli]
+ ld h, [hl]
+ ld l, a
+ ret
+
+BattleBGEffects_IncrementJumptable: ; c80e5 (32:40e5)
+ ld hl, BG_EFFECT_STRUCT_JT_INDEX
+ add hl, bc
+ inc [hl]
+ ret
+
+BattleBGEffect_FlashInverted: ; c80eb (32:40eb)
+ ld de, .inverted
+ call BattleBGEffect_FlashContinue
+ ret
+
+.inverted
+ db %11100100 ; 3210
+ db %00011011 ; 0123
+; c80f3
+
+BattleBGEffect_FlashWhite: ; c80f3 (32:40f3)
+ ld de, .white
+ call BattleBGEffect_FlashContinue
+ ret
+
+.white
+ db %11100100 ; 3210
+ db %00000000 ; 0000
+; c80fb
+
+BattleBGEffect_FlashContinue: ; c80fb (32:40fb)
+; current timer, flash duration, number of flashes
+ ld a, $1
+ ld [wBattleAnimTemp0], a
+ ld hl, BG_EFFECT_STRUCT_JT_INDEX
+ add hl, bc
+ ld a, [hl]
+ and a
+ jr z, .init
+ dec [hl]
+ ret
+
+.init
+ ld hl, BG_EFFECT_STRUCT_BATTLE_TURN
+ add hl, bc
+ ld a, [hl]
+ ld hl, BG_EFFECT_STRUCT_JT_INDEX
+ add hl, bc
+ ld [hl], a
+ ld hl, BG_EFFECT_STRUCT_03
+ add hl, bc
+ ld a, [hl]
+ and a
+ jr nz, .apply_pal
+ call EndBattleBGEffect
+ ret
+
+.apply_pal
+ dec a
+ ld [hl], a
+ and 1
+ ld l, a
+ ld h, 0
+ add hl, de
+ ld a, [hl]
+ ld [wBGP], a
+ ret
+
+BattleBGEffect_WhiteHues: ; c812d (32:412d)
+ ld de, .Pals
+ call BattleBGEffect_GetNthDMGPal
+ jr c, .quit
+ ld [wBGP], a
+ ret
+
+.quit
+ call EndBattleBGEffect
+ ret
+
+.Pals:
+ db %11100100
+ db %11100000
+ db %11010000
+ db -1
+; c8141
+
+BattleBGEffect_BlackHues: ; c8141 (32:4141)
+ ld de, .Pals
+ call BattleBGEffect_GetNthDMGPal
+ jr c, .quit
+ ld [wBGP], a
+ ret
+
+.quit
+ call EndBattleBGEffect
+ ret
+
+.Pals:
+ db %11100100
+ db %11110100
+ db %11111000
+ db -1
+; c8155
+
+BattleBGEffect_AlternateHues: ; c8155 (32:4155)
+ ld de, .Pals
+ call BattleBGEffect_GetNthDMGPal
+ jr c, .quit
+ ld [wBGP], a
+ ld [wOBP1], a
+ ret
+
+.quit
+ call EndBattleBGEffect
+ ret
+
+.Pals:
+ db %11100100
+ db %11111000
+ db %11111100
+ db %11111000
+ db %11100100
+ db %10010000
+ db %01000000
+ db %10010000
+ db -2
+; c8171
+
+BattleBGEffect_06: ; c8171 (32:4171)
+ call BattleBGEffects_CheckSGB
+ jr nz, .sgb
+ ld de, .PalsCGB
+ jr .okay
+
+.sgb
+ ld de, .PalsSGB
+.okay
+ call BattleBGEffect_GetNthDMGPal
+ ld [wOBP0], a
+ ret
+
+.PalsCGB:
+ db %11100100
+ db %10010000
+ db -2
+
+.PalsSGB:
+ db %11110000
+ db %11000000
+ db -2
+; c818b
+
+BattleBGEffect_07: ; c818b (32:418b)
+ call BattleBGEffects_CheckSGB
+ jr nz, .sgb
+ ld de, .PalsCGB
+ jr .okay
+
+.sgb
+ ld de, .PalsSGB
+.okay
+ call BattleBGEffect_GetNthDMGPal
+ ld [wOBP0], a
+ ret
+
+.PalsCGB:
+ db %11100100
+ db %11011000
+ db -2
+
+.PalsSGB:
+ db %11110000
+ db %11001100
+ db -2
+; c81a5
+
+BattleBGEffect_08: ; c81a5 (32:41a5)
+ ld de, .Pals
+ call BattleBGEffect_GetNthDMGPal
+ ld [wBGP], a
+ ret
+
+.Pals:
+ db %00011011
+ db %01100011
+ db %10000111
+ db -2
+; c81b3
+
+BattleBGEffect_HideMon: ; c81b3 (32:41b3)
+ call BattleBGEffects_AnonJumptable
+ jp hl
+.anon_dw
+ dw .zero
+ dw BattleBGEffects_IncrementJumptable
+ dw BattleBGEffects_IncrementJumptable
+ dw BattleBGEffects_IncrementJumptable
+ dw .four
+
+
+.zero
+ call BattleBGEffects_IncrementJumptable
+ push bc
+ call BGEffect_CheckBattleTurn
+ jr nz, .player_side
+ hlcoord 12, 0
+ lb bc, 7, 7
+ jr .got_pointer
+
+.player_side
+ hlcoord 2, 6
+ lb bc, 6, 6
+.got_pointer
+ call ClearBox
+ pop bc
+ ld a, $1
+ ldh [hBGMapMode], a
+ ret
+
+.four
+ xor a
+ ldh [hBGMapMode], a
+ call EndBattleBGEffect
+ ret
+
+BattleBGEffect_ShowMon: ; c81ea (32:41ea)
+ call BGEffect_CheckFlyDigStatus
+ jr z, .not_flying
+ call EndBattleBGEffect
+ ret
+
+.not_flying
+ call BGEffect_CheckBattleTurn
+ jr nz, .player_side
+ ld de, .EnemyData
+ jr .got_pointer
+
+.player_side
+ ld de, .PlayerData
+.got_pointer
+ ld a, e
+ ld [wBattleAnimTemp1], a
+ ld a, d
+ ld [wBattleAnimTemp2], a
+ call BattleBGEffect_RunPicResizeScript
+ ret
+
+.PlayerData:
+ db 0, $31, 0
+ db -1
+.EnemyData:
+ db 3, $00, 3
+ db -1
+; c8214
+
+BattleBGEffect_FeetFollow: ; c8214 (32:4214)
+ call BattleBGEffects_AnonJumptable
+ jp hl
+.anon_dw
+ dw .zero
+ dw .one
+ dw BattleBGEffects_IncrementJumptable
+ dw BattleBGEffects_IncrementJumptable
+ dw BattleBGEffects_IncrementJumptable
+ dw .five
+
+
+.zero
+ call BGEffect_CheckFlyDigStatus
+ jr z, .not_flying_digging
+ call EndBattleBGEffect
+ ret
+
+.not_flying_digging
+ call BattleBGEffects_IncrementJumptable
+ push bc
+ call BGEffect_CheckBattleTurn
+ jr nz, .player_turn
+ ld a, ANIM_OBJ_PLAYERFEETFOLLOW
+ ld [wBattleAnimTemp0], a
+ ld a, 16 * 8 + 4
+ jr .okay
+
+.player_turn
+ ld a, ANIM_OBJ_ENEMYFEETFOLLOW
+ ld [wBattleAnimTemp0], a
+ ld a, 6 * 8
+.okay
+ ld [wBattleAnimTemp1], a
+ ld a, 8 * 8
+ ld [wBattleAnimTemp2], a
+ xor a
+ ld [wBattleAnimTemp3], a
+ call _QueueBattleAnimation
+ pop bc
+ ret
+
+.one
+ call BattleBGEffects_IncrementJumptable
+ push bc
+ call BGEffect_CheckBattleTurn
+ jr nz, .player_turn_2
+ hlcoord 12, 6
+ lb bc, 1, 7
+ jr .okay2
+
+.player_turn_2
+ hlcoord 2, 6
+ lb bc, 1, 6
+.okay2
+ call ClearBox
+ ld a, $1
+ ldh [hBGMapMode], a
+ pop bc
+ ret
+
+.five
+ xor a
+ ldh [hBGMapMode], a
+ call EndBattleBGEffect
+ ret
+
+BattleBGEffect_HeadFollow: ; c8281 (32:4281)
+ call BattleBGEffects_AnonJumptable
+ jp hl
+.anon_dw
+ dw .zero
+ dw .one
+ dw BattleBGEffects_IncrementJumptable
+ dw BattleBGEffects_IncrementJumptable
+ dw BattleBGEffects_IncrementJumptable
+ dw .five
+
+
+.zero
+ call BGEffect_CheckFlyDigStatus
+ jr z, .not_flying_digging
+ call EndBattleBGEffect
+ ret
+
+.not_flying_digging
+ call BattleBGEffects_IncrementJumptable
+ push bc
+ call BGEffect_CheckBattleTurn
+ jr nz, .player_turn
+ ld a, ANIM_OBJ_PLAYERHEADFOLLOW
+ ld [wBattleAnimTemp0], a
+ ld a, 16 * 8 + 4
+ jr .okay
+
+.player_turn
+ ld a, ANIM_OBJ_ENEMYHEADFOLLOW
+ ld [wBattleAnimTemp0], a
+ ld a, 6 * 8
+.okay
+ ld [wBattleAnimTemp1], a
+ ld a, 8 * 8
+ ld [wBattleAnimTemp2], a
+ xor a
+ ld [wBattleAnimTemp3], a
+ call _QueueBattleAnimation
+ pop bc
+ ret
+
+.one
+ call BattleBGEffects_IncrementJumptable
+ push bc
+ call BGEffect_CheckBattleTurn
+ jr nz, .player_turn_2
+ hlcoord 12, 5
+ lb bc, 2, 7
+ jr .okay2
+
+.player_turn_2
+ hlcoord 2, 6
+ lb bc, 2, 6
+.okay2
+ call ClearBox
+ ld a, $1
+ ldh [hBGMapMode], a
+ pop bc
+ ret
+
+.five
+ xor a
+ ldh [hBGMapMode], a
+ call EndBattleBGEffect
+ ret
+
+_QueueBattleAnimation: ; c82ee (32:42ee)
+ callfar QueueBattleAnimation
+ ret
+
+BattleBGEffect_27: ; c82f5 (32:42f5)
+ call BattleBGEffects_AnonJumptable
+ jp hl
+.anon_dw
+ dw .zero
+ dw .one
+ dw BattleBGEffects_IncrementJumptable
+ dw BattleBGEffects_IncrementJumptable
+ dw .four
+
+
+.zero
+ call BattleBGEffects_IncrementJumptable
+ call BGEffect_CheckBattleTurn
+ ld [hl], a
+ ld hl, BG_EFFECT_STRUCT_03
+ add hl, bc
+ ld [hl], $8
+ ret
+
+.one
+ ld hl, BG_EFFECT_STRUCT_BATTLE_TURN
+ add hl, bc
+ ld a, [hl]
+ and a
+ jr z, .user_2
+ hlcoord 0, 6
+ lb de, 8, 6
+.row1
+ push de
+ push hl
+.col1
+ inc hl
+ ld a, [hld]
+ ld [hli], a
+ dec d
+ jr nz, .col1
+ pop hl
+ ld de, SCREEN_WIDTH
+ add hl, de
+ pop de
+ dec e
+ jr nz, .row1
+ jr .okay2
+
+.user_2
+ hlcoord 19, 0
+ lb de, 8, 7
+.row2
+ push de
+ push hl
+.col2
+ dec hl
+ ld a, [hli]
+ ld [hld], a
+ dec d
+ jr nz, .col2
+ pop hl
+ ld de, SCREEN_WIDTH
+ add hl, de
+ pop de
+ dec e
+ jr nz, .row2
+.okay2
+ ld a, $1
+ ldh [hBGMapMode], a
+ call BattleBGEffects_IncrementJumptable
+ ld hl, BG_EFFECT_STRUCT_03
+ add hl, bc
+ dec [hl]
+ ret
+
+.four
+ xor a
+ ldh [hBGMapMode], a
+ ld hl, BG_EFFECT_STRUCT_03
+ add hl, bc
+ ld a, [hl]
+ and a
+ jr z, .done
+ ld hl, BG_EFFECT_STRUCT_JT_INDEX
+ add hl, bc
+ ld [hl], $1
+ ret
+
+.done
+ call EndBattleBGEffect
+ ret
+
+BattleBGEffect_EnterMon: ; c837b (32:437b)
+ call BGEffect_CheckBattleTurn
+ jr nz, .player_turn
+ ld de, .EnemyData
+ jr .okay
+
+.player_turn
+ ld de, .PlayerData
+.okay
+ ld a, e
+ ld [wBattleAnimTemp1], a
+ ld a, d
+ ld [wBattleAnimTemp2], a
+ call BattleBGEffect_RunPicResizeScript
+ ret
+
+.PlayerData:
+ db 2, $31, 2
+ db 1, $31, 1
+ db 0, $31, 0
+ db -1
+.EnemyData:
+ db 5, $00, 5
+ db 4, $00, 4
+ db 3, $00, 3
+ db -1
+; c83a8
+
+BattleBGEffect_ReturnMon: ; c83a8 (32:43a8)
+ call BGEffect_CheckBattleTurn
+ jr nz, .player_turn
+ ld de, .EnemyData
+ jr .okay
+
+.player_turn
+ ld de, .PlayerData
+.okay
+ ld a, e
+ ld [wBattleAnimTemp1], a
+ ld a, d
+ ld [wBattleAnimTemp2], a
+ call BattleBGEffect_RunPicResizeScript
+ ret
+
+.PlayerData:
+ db 0, $31, 0
+ db -2, $66, 0
+ db 1, $31, 1
+ db -2, $44, 1
+ db 2, $31, 2
+ db -2, $22, 2
+ db -3, $00, 0
+ db -1
+.EnemyData:
+ db 3, $00, 3
+ db -2, $77, 3
+ db 4, $00, 4
+ db -2, $55, 4
+ db 5, $00, 5
+ db -2, $33, 5
+ db -3, $00, 0
+ db -1
+; c83ed
+
+BattleBGEffect_RunPicResizeScript: ; c83ed (32:43ed)
+ call BattleBGEffects_AnonJumptable
+ jp hl
+.anon_dw
+ dw .zero
+ dw BattleBGEffects_IncrementJumptable
+ dw BattleBGEffects_IncrementJumptable
+ dw BattleBGEffects_IncrementJumptable
+ dw .restart
+ dw .end
+
+
+.zero
+ ld hl, BG_EFFECT_STRUCT_03
+ add hl, bc
+ ld e, [hl]
+ ld d, $0
+ inc [hl]
+ ld a, [wBattleAnimTemp1]
+ ld l, a
+ ld a, [wBattleAnimTemp2]
+ ld h, a
+ add hl, de
+ add hl, de
+ add hl, de
+ ld a, [hl]
+ cp -1
+ jr z, .end
+ cp -2
+ jr z, .clear
+ cp -3
+ jr z, .skip
+ call .PlaceGraphic
+.skip
+ call BattleBGEffects_IncrementJumptable
+ ld a, $1
+ ldh [hBGMapMode], a
+ ret
+
+.clear
+ call .ClearBox
+ jr .zero
+
+.restart
+ xor a
+ ldh [hBGMapMode], a
+ ld hl, BG_EFFECT_STRUCT_JT_INDEX
+ add hl, bc
+ ld [hl], $0
+ ret
+
+.end
+ xor a
+ ldh [hBGMapMode], a
+ call EndBattleBGEffect
+ ret
+
+.ClearBox:
+; get dims
+ push bc
+ inc hl
+ ld a, [hli]
+ ld b, a
+ and $f
+ ld c, a
+ ld a, b
+ swap a
+ and $f
+ ld b, a
+; get coords
+ ld e, [hl]
+ ld d, 0
+ ld hl, .Coords
+ add hl, de
+ add hl, de
+ ld a, [hli]
+ ld h, [hl]
+ ld l, a
+ call ClearBox
+ pop bc
+ ret
+
+.PlaceGraphic:
+; get dims
+ push bc
+ push hl
+ ld e, [hl]
+ ld d, 0
+ ld hl, .BGSquares
+ add hl, de
+ add hl, de
+ add hl, de
+ ld a, [hli]
+ ld b, a
+ and $f
+ ld c, a
+ ld a, b
+ swap a
+ and $f
+ ld b, a
+; store pointer
+ ld e, [hl]
+ inc hl
+ ld d, [hl]
+; get byte
+ pop hl
+ inc hl
+ ld a, [hli]
+ ld [wBattleAnimTemp0], a
+; get coord
+ push de
+ ld e, [hl]
+ ld d, 0
+ ld hl, .Coords
+ add hl, de
+ add hl, de
+ ld a, [hli]
+ ld h, [hl]
+ ld l, a
+ pop de
+; fill box
+.row
+ push bc
+ push hl
+ ld a, [wBattleAnimTemp0]
+ ld b, a
+.col
+ ld a, [de]
+ add b
+ ld [hli], a
+ inc de
+ dec c
+ jr nz, .col
+ pop hl
+ ld bc, SCREEN_WIDTH
+ add hl, bc
+ pop bc
+ dec b
+ jr nz, .row
+ pop bc
+ ret
+
+.Coords:
+ dwcoord 2, 6
+ dwcoord 3, 8
+ dwcoord 4, 10
+ dwcoord 12, 0
+ dwcoord 13, 2
+ dwcoord 14, 4
+
+.BGSquares:
+bgsquare: MACRO
+ dn \1, \2
+ dw \3
+ENDM
+
+ bgsquare 6, 6, .SixBySix
+ bgsquare 4, 4, .FourByFour
+ bgsquare 2, 2, .TwoByTwo
+ bgsquare 7, 7, .SevenBySeven
+ bgsquare 5, 5, .FiveByFive
+ bgsquare 3, 3, .ThreeByThree
+
+.SixBySix:
+ db $00, $06, $0c, $12, $18, $1e
+ db $01, $07, $0d, $13, $19, $1f
+ db $02, $08, $0e, $14, $1a, $20
+ db $03, $09, $0f, $15, $1b, $21
+ db $04, $0a, $10, $16, $1c, $22
+ db $05, $0b, $11, $17, $1d, $23
+
+.FourByFour:
+ db $00, $0c, $12, $1e
+ db $02, $0e, $14, $20
+ db $03, $0f, $15, $21
+ db $05, $11, $17, $23
+
+.TwoByTwo:
+ db $00, $1e
+ db $05, $23
+
+.SevenBySeven:
+ db $00, $07, $0e, $15, $1c, $23, $2a
+ db $01, $08, $0f, $16, $1d, $24, $2b
+ db $02, $09, $10, $17, $1e, $25, $2c
+ db $03, $0a, $11, $18, $1f, $26, $2d
+ db $04, $0b, $12, $19, $20, $27, $2e
+ db $05, $0c, $13, $1a, $21, $28, $2f
+ db $06, $0d, $14, $1b, $22, $29, $30
+
+.FiveByFive:
+ db $00, $07, $15, $23, $2a
+ db $01, $08, $16, $24, $2b
+ db $03, $0a, $18, $26, $2d
+ db $05, $0c, $1a, $28, $2f
+ db $06, $0d, $1b, $29, $30
+
+.ThreeByThree:
+ db $00, $15, $2a
+ db $03, $18, $2d
+ db $06, $1b, $30
+; c8545
+
+BattleBGEffect_Surf: ; c8545 (32:4545)
+ call BattleBGEffects_AnonJumptable
+ jp hl
+.anon_dw
+ dw .zero
+ dw .one
+
+
+.zero
+ call BattleBGEffects_IncrementJumptable
+ lb de, 4, 1
+ call InitSurfWaves
+
+.one
+ ldh a, [hLCDCPointer]
+ and a
+ ret z
+ push bc
+ call .RotatewSurfWaveBGEffect
+ pop bc
+ ret
+
+.RotatewSurfWaveBGEffect:
+ ld hl, wLYOverrides
+ ld de, wLYOverrides2 + 1
+.asm_c853e:
+ ld bc, wLYOverrides2
+ ld a, [bc]
+ push af
+ ld a, $7f
+.asm_c8545:
+ push af
+ ld a, [de]
+.asm_c8547:
+ ld [bc], a
+ ldh a, [hLYOverrideStart]
+ cp l
+ jr nc, .asm_c8555
+ ldh a, [hLYOverrideEnd]
+ cp l
+ jr c, .asm_c8555
+ ld a, [de]
+ jr .asm_c8556
+
+.asm_c8555:
+ xor a
+.asm_c8556:
+ ld [hli], a
+ inc de
+ inc bc
+ pop af
+ dec a
+ jr nz, .asm_c8545
+ pop af
+ ld [bc], a
+ ret
+
+BattleBGEffect_Psychic: ; c8607 (32:4607)
+ call BattleBGEffects_AnonJumptable
+ jp hl
+.anon_dw
+ dw .zero
+ dw .one
+ dw .two
+
+
+.zero
+ call BattleBGEffects_IncrementJumptable
+ call BattleBGEffects_ClearLYOverrides
+ ld a, LOW(rSCX)
+ ldh [hLCDCPointer], a
+ xor a
+ ldh [hLYOverrideStart], a
+ ld a, $5f
+ ldh [hLYOverrideEnd], a
+ lb de, 6, 5
+ call Functionc8f2e
+ ld hl, BG_EFFECT_STRUCT_03
+ add hl, bc
+ ld [hl], $0
+ ret
+
+.one
+ ld hl, BG_EFFECT_STRUCT_03
+ add hl, bc
+ ld a, [hl]
+ inc [hl]
+ and $3
+ ret nz
+ call BattleBGEffect_WavyScreenFX
+ ret
+
+.two
+ call BattleAnim_ResetLCDStatCustom
+ ret
+
+BattleBGEffect_Teleport: ; c863f (32:463f)
+ call BattleBGEffects_AnonJumptable
+ jp hl
+.anon_dw
+ dw .zero
+ dw .one
+ dw .two
+
+
+.zero
+ call BattleBGEffects_IncrementJumptable
+ call BattleBGEffects_ClearLYOverrides
+ ld a, LOW(rSCX)
+ call BattleBGEffect_SetLCDStatCustoms
+ lb de, 6, 5
+ call Functionc8f2e
+ ret
+
+.one
+ call BattleBGEffect_WavyScreenFX
+ ret
+
+.two
+ call BattleAnim_ResetLCDStatCustom
+ ret
+
+BattleBGEffect_NightShade: ; c8662 (32:4662)
+ call BattleBGEffects_AnonJumptable
+ jp hl
+.anon_dw
+ dw .zero
+ dw .one
+ dw .two
+
+
+.zero
+ call BattleBGEffects_IncrementJumptable
+ call BattleBGEffects_ClearLYOverrides
+ ld a, LOW(rSCY)
+ call BattleBGEffect_SetLCDStatCustoms
+ ld hl, BG_EFFECT_STRUCT_03
+ add hl, bc
+ ld e, [hl]
+ ld d, 3
+ call Functionc8f2e
+ ret
+
+.one
+ call BattleBGEffect_WavyScreenFX
+ ret
+
+.two
+ call BattleAnim_ResetLCDStatCustom
+ ret
+
+BattleBGEffect_DoubleTeam: ; c8689 (32:4689)
+ call BattleBGEffects_AnonJumptable
+ jp hl
+.anon_dw
+ dw .zero
+ dw .one
+ dw .two
+ dw .three
+ dw .four
+ dw .five
+
+
+.zero
+ call BattleBGEffects_IncrementJumptable
+ call BattleBGEffects_ClearLYOverrides
+ ld a, LOW(rSCX)
+ call BattleBGEffect_SetLCDStatCustoms
+ ld hl, BG_EFFECT_STRUCT_BATTLE_TURN
+ add hl, bc
+ ld [hl], $0
+ ret
+
+.one
+ ld hl, BG_EFFECT_STRUCT_03
+ add hl, bc
+ ld a, [hl]
+ cp $10
+ jr nc, .next
+ inc [hl]
+ call .UpdateLYOverrides
+ ret
+
+.three
+ ld hl, BG_EFFECT_STRUCT_03
+ add hl, bc
+ ld a, [hl]
+ cp $ff
+ jr z, .next
+ dec [hl]
+ call .UpdateLYOverrides
+ ret
+
+.next
+ call BattleBGEffects_IncrementJumptable
+ ret
+
+.two
+ ld hl, BG_EFFECT_STRUCT_BATTLE_TURN
+ add hl, bc
+ ld a, [hl]
+ ld d, $2
+ call BattleBGEffects_Sine
+ ld hl, BG_EFFECT_STRUCT_03
+ add hl, bc
+ add [hl]
+ call .UpdateLYOverrides
+ ld hl, BG_EFFECT_STRUCT_BATTLE_TURN
+ add hl, bc
+ ld a, [hl]
+ add $4
+ ld [hl], a
+
+.four
+ ret
+
+.UpdateLYOverrides:
+ ld e, a
+ xor $ff
+ inc a
+ ld d, a
+ ld h, HIGH(wLYOverrides)
+ ldh a, [hLYOverrideStart]
+ ld l, a
+ ldh a, [hLYOverrideEnd]
+ sub l
+ srl a
+.loop
+ ld [hl], e
+ inc hl
+ ld [hl], d
+ inc hl
+ dec a
+ jr nz, .loop
+ ld [hl], e
+ ret
+
+.five
+ call BattleAnim_ResetLCDStatCustom
+ ret
+
+BattleBGEffect_AcidArmor: ; c8709 (32:4709)
+ call BattleBGEffects_AnonJumptable
+ jp hl
+.anon_dw
+ dw .zero
+ dw .one
+ dw .two
+
+
+.zero
+ call BattleBGEffects_IncrementJumptable
+ call BattleBGEffects_ClearLYOverrides
+ ld a, LOW(rSCY)
+ call BattleBGEffect_SetLCDStatCustoms
+ ld hl, BG_EFFECT_STRUCT_03
+ add hl, bc
+ ld e, [hl]
+ ld d, 3
+ call Functionc8f2e
+ ret
+
+.one
+ ldh a, [hLYOverrideEnd]
+ ld l, a
+ ld h, HIGH(wLYOverrides)
+ ld e, l
+ ld d, h
+ dec de
+.loop
+ ld a, [de]
+ dec de
+ ld [hld], a
+ ldh a, [hLYOverrideStart]
+ cp l
+ jr nz, .loop
+ ld [hl], $90
+ ret
+
+.two
+ call BattleAnim_ResetLCDStatCustom
+ ret
+
+BattleBGEffect_Withdraw: ; c8761 (32:4761)
+ call BattleBGEffects_AnonJumptable
+ jp hl
+.anon_dw
+ dw .zero
+ dw .one
+ dw .two
+
+
+.zero
+ call BattleBGEffects_IncrementJumptable
+ call BattleBGEffects_ClearLYOverrides
+ ld a, LOW(rSCY)
+ call BattleBGEffect_SetLCDStatCustoms
+ ldh a, [hLYOverrideEnd]
+ inc a
+ ldh [hLYOverrideEnd], a
+ ld hl, BG_EFFECT_STRUCT_BATTLE_TURN
+ add hl, bc
+ ld [hl], $1
+ ret
+
+.one
+ ld hl, BG_EFFECT_STRUCT_03
+ add hl, bc
+ ld a, [hl]
+ and $3f
+ ld d, a
+ ld hl, BG_EFFECT_STRUCT_BATTLE_TURN
+ add hl, bc
+ ld a, [hl]
+ cp d
+ ret nc
+ call BGEffect_DisplaceLYOverridesBackup
+ ld hl, BG_EFFECT_STRUCT_03
+ add hl, bc
+ ld a, [hl]
+ rlca
+ rlca
+ and $3
+ ld hl, BG_EFFECT_STRUCT_BATTLE_TURN
+ add hl, bc
+ add [hl]
+ ld [hl], a
+ ret
+
+.two
+ call BattleAnim_ResetLCDStatCustom
+ ret
+
+BattleBGEffect_Dig: ; c87a7 (32:47a7)
+ call BattleBGEffects_AnonJumptable
+ jp hl
+.anon_dw
+ dw .zero
+ dw .one
+ dw .two
+ dw .three
+
+
+.zero
+ call BattleBGEffects_IncrementJumptable
+ call BattleBGEffects_ClearLYOverrides
+ ld a, LOW(rSCY)
+ call BattleBGEffect_SetLCDStatCustoms
+ ldh a, [hLYOverrideEnd]
+ inc a
+ ldh [hLYOverrideEnd], a
+ ld hl, BG_EFFECT_STRUCT_BATTLE_TURN
+ add hl, bc
+ ld [hl], $2
+ ld hl, BG_EFFECT_STRUCT_03
+ add hl, bc
+ ld [hl], $0
+ ret
+
+.one
+ ld hl, BG_EFFECT_STRUCT_03
+ add hl, bc
+ ld a, [hl]
+ and a
+ jr z, .next
+ dec [hl]
+ ret
+
+.next
+ ld [hl], $10
+ call BattleBGEffects_IncrementJumptable
+.two
+ ldh a, [hLYOverrideStart]
+ ld l, a
+ ldh a, [hLYOverrideEnd]
+ sub l
+ dec a
+ ld hl, BG_EFFECT_STRUCT_BATTLE_TURN
+ add hl, bc
+ cp [hl]
+ ret c
+ ld a, [hl]
+ push af
+ and $7
+ jr nz, .skip
+ ld hl, BG_EFFECT_STRUCT_JT_INDEX
+ add hl, bc
+ dec [hl]
+.skip
+ pop af
+ call BGEffect_DisplaceLYOverridesBackup
+ ld hl, BG_EFFECT_STRUCT_BATTLE_TURN
+ add hl, bc
+ inc [hl]
+ inc [hl]
+ ret
+
+.three
+ call BattleAnim_ResetLCDStatCustom
+ ret
+
+BattleBGEffect_Tackle: ; c8805 (32:4805)
+ call BattleBGEffects_AnonJumptable
+ jp hl
+.anon_dw
+ dw .zero
+ dw Tackle_BGEffect25_2d_one
+ dw Tackle_BGEffect25_2d_two
+ dw .three
+
+
+.zero
+ call BattleBGEffects_IncrementJumptable
+ call BattleBGEffects_ClearLYOverrides
+ ld a, LOW(rSCX)
+ call BattleBGEffect_SetLCDStatCustoms
+ ldh a, [hLYOverrideEnd]
+ inc a
+ ldh [hLYOverrideEnd], a
+ ld hl, BG_EFFECT_STRUCT_03
+ add hl, bc
+ ld [hl], $0
+ call BGEffect_CheckBattleTurn
+ jr nz, .player_side
+ ld a, 2
+ jr .okay
+
+.player_side
+ ld a, -2
+.okay
+ ld [hl], a
+ ret
+
+.three
+ call BattleAnim_ResetLCDStatCustom
+ ret
+
+Tackle_BGEffect25_2d_one:
+ ld hl, BG_EFFECT_STRUCT_03
+ add hl, bc
+ ld a, [hl]
+ cp -8
+ jr z, .reached_limit
+ cp 8
+ jr nz, .finish
+.reached_limit
+ call BattleBGEffects_IncrementJumptable
+.finish
+ call Functionc88a5
+ ld hl, BG_EFFECT_STRUCT_BATTLE_TURN
+ add hl, bc
+ ld a, [hl]
+ ld hl, BG_EFFECT_STRUCT_03
+ add hl, bc
+ add [hl]
+ ld [hl], a
+ ret
+
+Tackle_BGEffect25_2d_two:
+ ld hl, BG_EFFECT_STRUCT_03
+ add hl, bc
+ ld a, [hl]
+ and a
+ jr nz, .asm_c8893
+ call BattleBGEffects_IncrementJumptable
+.asm_c8893
+ call Functionc88a5
+ ld hl, BG_EFFECT_STRUCT_BATTLE_TURN
+ add hl, bc
+ ld a, [hl]
+ xor $ff
+ inc a
+ ld hl, BG_EFFECT_STRUCT_03
+ add hl, bc
+ add [hl]
+ ld [hl], a
+ ret
+
+Functionc88a5: ; c88a5 (32:48a5)
+ push af
+.asm_c87ab:
+ ld a, [rLY]
+ cp $60
+ jr c, .asm_c87ab
+ pop af
+ call BGEffect_FillLYOverridesBackup
+ ret
+
+BattleBGEffect_2d: ; c88e7 (32:48e7)
+ call BattleBGEffects_AnonJumptable
+ jp hl
+.anon_dw
+ dw BGEffect2d_2f_zero
+ dw Tackle_BGEffect25_2d_one
+ dw Tackle_BGEffect25_2d_two
+ dw .three
+
+
+.three
+ call BattleAnim_ResetLCDStatCustom
+ ret
+
+BGEffect2d_2f_zero:
+ call BattleBGEffects_IncrementJumptable
+ call BattleBGEffects_ClearLYOverrides
+ ld a, LOW(rSCX)
+ call BattleBGEffect_SetLCDStatCustoms
+ ldh a, [hLYOverrideEnd]
+ inc a
+ ldh [hLYOverrideEnd], a
+ ld hl, BG_EFFECT_STRUCT_03
+ add hl, bc
+ ld [hl], $0
+ call BGEffect_CheckBattleTurn
+ jr nz, .player_turn
+ ld a, -2
+ jr .okay
+
+.player_turn
+ ld a, 2
+.okay
+ ld [hl], a
+ ret
+
+BattleBGEffect_2f: ; c8919 (32:4919)
+ call BattleBGEffects_AnonJumptable
+ jp hl
+.anon_dw
+ dw BGEffect2d_2f_zero
+ dw Tackle_BGEffect25_2d_one
+ dw .two
+ dw Tackle_BGEffect25_2d_two
+ dw .four
+
+.four
+ call BattleAnim_ResetLCDStatCustom
+.two
+ ret
+
+BattleBGEffect_26: ; c892a (32:492a)
+ call BattleBGEffects_AnonJumptable
+ jp hl
+.anon_dw
+ dw .zero
+ dw .one
+ dw .two
+
+
+.zero
+ call BattleBGEffects_IncrementJumptable
+ call BattleBGEffects_ClearLYOverrides
+ ld a, LOW(rSCX)
+ call BattleBGEffect_SetLCDStatCustoms
+ ldh a, [hLYOverrideEnd]
+ inc a
+ ldh [hLYOverrideEnd], a
+ ld hl, BG_EFFECT_STRUCT_03
+ add hl, bc
+ ld [hl], $0
+ ret
+
+.one
+ ld hl, BG_EFFECT_STRUCT_03
+ add hl, bc
+ ld a, [hl]
+ ld d, $8
+ call BattleBGEffects_Sine
+ call .Functionc8836
+ ld hl, BG_EFFECT_STRUCT_03
+ add hl, bc
+ ld a, [hl]
+ add $4
+ ld [hl], a
+ ret
+
+.two
+ call BattleAnim_ResetLCDStatCustom
+ ret
+
+.Functionc8836:
+ push af
+.loop
+ ld a, [rLY]
+ cp $60
+ jr c, .loop
+ pop af
+ call BGEffect_FillLYOverridesBackup
+ ret
+
+BattleBGEffect_2c: ; c8964 (32:4964)
+ call BattleBGEffects_AnonJumptable
+ jp hl
+.anon_dw
+ dw .zero
+ dw .one
+ dw .two
+
+
+.zero
+ call BattleBGEffects_IncrementJumptable
+ call BattleBGEffects_ClearLYOverrides
+ ld a, LOW(rSCX)
+ call BattleBGEffect_SetLCDStatCustoms
+ ldh a, [hLYOverrideEnd]
+ inc a
+ ldh [hLYOverrideEnd], a
+ xor a
+ ld hl, BG_EFFECT_STRUCT_BATTLE_TURN
+ add hl, bc
+ ld [hli], a
+ ld [hl], a
+ ret
+
+.one
+ ld hl, BG_EFFECT_STRUCT_03
+ add hl, bc
+ ld a, [hl]
+ ld d, $6
+ call BattleBGEffects_Sine
+ push af
+ ld hl, BG_EFFECT_STRUCT_BATTLE_TURN
+ add hl, bc
+ ld a, [hl]
+ ld d, $2
+ call BattleBGEffects_Sine
+ ld e, a
+ pop af
+ add e
+ call .Functionc8894
+ ld hl, BG_EFFECT_STRUCT_BATTLE_TURN
+ add hl, bc
+ ld a, [hl]
+ add $8
+ ld [hl], a
+ ld hl, BG_EFFECT_STRUCT_03
+ add hl, bc
+ ld a, [hl]
+ add $2
+ ld [hl], a
+ ret
+
+.two
+ call BattleAnim_ResetLCDStatCustom
+ ret
+
+.Functionc8894:
+ push af
+.asm_c8895:
+ ld a, [rLY]
+ cp $60
+ jr c, .asm_c8895
+ pop af
+ call BGEffect_FillLYOverridesBackup
+ ret
+
+BattleBGEffect_28: ; c89b5 (32:49b5)
+ call BattleBGEffects_AnonJumptable
+ jp hl
+.anon_dw
+ dw .zero
+ dw .one
+ dw .two
+
+
+.zero
+ call BattleBGEffects_IncrementJumptable
+ call BattleBGEffects_ClearLYOverrides
+ ld a, LOW(rSCX)
+ call BattleBGEffect_SetLCDStatCustoms
+ ret
+
+.one
+ ld hl, BG_EFFECT_STRUCT_03
+ add hl, bc
+ ld a, [hl]
+ cp $20
+ ret nc
+ inc [hl]
+ ld d, a
+ ld e, 4
+ call Functionc8f2e
+ ret
+
+.two
+ ld hl, BG_EFFECT_STRUCT_03
+ add hl, bc
+ ld a, [hl]
+ and a
+ jr z, .reset
+ dec [hl]
+ ld d, a
+ ld e, 4
+ call Functionc8f2e
+ ret
+
+.reset
+ call BattleAnim_ResetLCDStatCustom
+ ret
+
+BattleBGEffect_BounceDown: ; c89ee (32:49ee)
+ call BattleBGEffects_AnonJumptable
+ jp hl
+.anon_dw
+ dw .zero
+ dw .one
+ dw .two
+
+
+.zero
+ call BattleBGEffects_IncrementJumptable
+ call BattleBGEffects_ClearLYOverrides
+ ld a, LOW(rSCY)
+ call BattleBGEffect_SetLCDStatCustoms
+ ldh a, [hLYOverrideEnd]
+ inc a
+ ldh [hLYOverrideEnd], a
+ ld hl, BG_EFFECT_STRUCT_BATTLE_TURN
+ add hl, bc
+ ld [hl], $1
+ ld hl, BG_EFFECT_STRUCT_03
+ add hl, bc
+ ld [hl], $20
+ ret
+
+.one
+ ld hl, BG_EFFECT_STRUCT_BATTLE_TURN
+ add hl, bc
+ ld a, [hl]
+ cp $38
+ ret nc
+ push af
+ ld hl, BG_EFFECT_STRUCT_03
+ add hl, bc
+ ld a, [hl]
+ ld d, $10
+ call BattleBGEffects_Cosine
+ add $10
+ ld d, a
+ pop af
+ add d
+ call BGEffect_DisplaceLYOverridesBackup
+ ld hl, BG_EFFECT_STRUCT_03
+ add hl, bc
+ inc [hl]
+ inc [hl]
+ ret
+
+.two
+ call BattleAnim_ResetLCDStatCustom
+ ret
+
+BattleBGEffect_2a: ; c8a3a (32:4a3a)
+ call BattleBGEffects_AnonJumptable
+ jp hl
+.anon_dw
+ dw .zero
+ dw .one
+ dw .two
+ dw .three
+ dw .four
+ dw .five
+
+.zero
+ call BattleBGEffects_IncrementJumptable
+ ld a, $e4
+ call BattleBGEffects_SetLYOverrides
+ ld a, $47
+ call BattleBGEffect_SetLCDStatCustoms
+ ldh a, [hLYOverrideEnd]
+ inc a
+ ldh [hLYOverrideEnd], a
+ ldh a, [hLYOverrideStart]
+ ld l, a
+ ld h, HIGH(wLYOverrides)
+.loop
+ ldh a, [hLYOverrideEnd]
+ cp l
+ jr z, .done
+ xor a
+ ld [hli], a
+ jr .loop
+
+.done
+ ld hl, BG_EFFECT_STRUCT_03
+ add hl, bc
+ ld [hl], $0
+.one
+.four
+ ret
+
+.two
+ call .GetLYOverride
+ jr nc, .next
+ call .SetLYOverridesBackup
+ ret
+
+.next
+ ld hl, BG_EFFECT_STRUCT_03
+ add hl, bc
+ ld [hl], $0
+ ldh a, [hLYOverrideStart]
+ inc a
+ ldh [hLYOverrideStart], a
+ call BattleBGEffects_IncrementJumptable
+ ret
+
+.three
+ call .GetLYOverride
+ jr nc, .finish
+ call .SetLYOverridesBackup
+ ldh a, [hLYOverrideEnd]
+ dec a
+ ld l, a
+ ld [hl], e
+ ret
+
+.finish
+ call BattleBGEffects_IncrementJumptable
+ ret
+
+.SetLYOverridesBackup:
+ ld e, a
+ ldh a, [hLYOverrideStart]
+ ld l, a
+ ldh a, [hLYOverrideEnd]
+ sub l
+ srl a
+ ld h, HIGH(wLYOverrides)
+.loop2
+ ld [hl], e
+ inc hl
+ inc hl
+ dec a
+ jr nz, .loop2
+ ret
+
+.five
+ call BattleBGEffects_ResetVideoHRAM
+ ret
+
+.GetLYOverride:
+ ld hl, BG_EFFECT_STRUCT_03
+ add hl, bc
+ ld a, [hl]
+ inc [hl]
+ srl a
+ srl a
+ srl a
+ ld e, a
+ ld d, 0
+ ld hl, .data
+ add hl, de
+ ld a, [hl]
+ cp $ff
+ ret
+
+.data
+ db $00, $40, $90, $e4
+ db -1
+; c8acc
+
+BattleBGEffect_2b: ; c8acc (32:4acc)
+ call BattleBGEffects_AnonJumptable
+ jp hl
+.anon_dw
+ dw .zero
+ dw .one
+
+
+.zero
+ call BattleBGEffects_IncrementJumptable
+ call BattleBGEffects_ClearLYOverrides
+ ld a, LOW(rSCX)
+ call BattleBGEffect_SetLCDStatCustoms
+ ld hl, BG_EFFECT_STRUCT_BATTLE_TURN
+ add hl, bc
+ ld [hl], $40
+ ret
+
+.one
+ ld hl, BG_EFFECT_STRUCT_BATTLE_TURN
+ add hl, bc
+ ld a, [hl]
+ and a
+ jr z, .done
+ dec [hl]
+ srl a
+ srl a
+ srl a
+ and $f
+ ld d, a
+ ld e, a
+ call Functionc8f2e
+ ret
+
+.done
+ call BattleAnim_ResetLCDStatCustom
+ ret
+
+BattleBGEffect_1c: ; c8b00 (32:4b00)
+ call BattleBGEffects_AnonJumptable
+ jp hl
+.anon_dw
+ dw .zero
+ dw .one
+ dw .two
+
+
+.zero
+ call BattleBGEffects_IncrementJumptable
+ ld a, $e4
+ call BattleBGEffects_SetLYOverrides
+ ld a, LOW(rBGP)
+ ldh [hLCDCPointer], a
+ xor a
+ ldh [hLYOverrideStart], a
+ ld a, $60
+ ldh [hLYOverrideEnd], a
+ ret
+
+.one
+ ld hl, BG_EFFECT_STRUCT_03
+ add hl, bc
+ ld a, [hl]
+ inc [hl]
+ and $18
+ srl a
+ srl a
+ ld e, a
+ ld d, $0
+ push bc
+ call BGEffect_CheckBattleTurn
+ jr nz, .player
+ ld hl, .CGB_DMGEnemyData
+ add hl, de
+ ld a, [hli]
+ ld [wOBP1], a
+ ld d, a
+ ld e, [hl]
+ lb bc, $2f, $30
+ jr .okay
+
+.player
+ ld hl, .DMG_PlayerData
+ add hl, de
+ ld d, [hl]
+ inc hl
+ ld a, [hl]
+ ld [wOBP1], a
+ ld e, a
+ lb bc, $37, $28
+.okay
+ call .DMG_LYOverrideLoads
+ pop bc
+ ret
+
+.two
+ call BattleBGEffects_ResetVideoHRAM
+ ld a, $e4
+ ld [wBGP], a
+ ld [wOBP1], a
+ ret
+
+.DMG_LYOverrideLoads:
+ ld hl, wLYOverrides
+.loop1
+ ld [hl], d
+ inc hl
+ dec b
+ jr nz, .loop1
+.loop2
+ ld [hl], e
+ inc hl
+ dec c
+ jr nz, .loop2
+ ret
+
+.CGB_DMGEnemyData:
+ db $e4, $e4
+ db $f8, $90
+ db $fc, $40
+ db $f8, $90
+.DMG_PlayerData:
+ db $e4, $e4
+ db $90, $f8
+ db $40, $fc
+ db $90, $f8
+; c8be8
+
+BattleBGEffect_RapidFlash: ; c8be8 (32:4be8)
+ ld de, .FlashPals
+ call BGEffect_RapidCyclePals
+ ret
+
+.FlashPals:
+ db $e4, $6c, $fe
+; c8bf2
+
+BattleBGEffect_16: ; c8bf2 (32:4bf2)
+ ld de, .Pals
+ call BGEffect_RapidCyclePals
+ ret
+
+.Pals:
+ db $e4, $90, $40, $ff
+; c8bfd
+
+BattleBGEffect_17: ; c8bfd (32:4bfd)
+ ld de, .Pals
+ call BGEffect_RapidCyclePals
+ ret
+
+.Pals:
+ db $e4, $f8, $fc, $ff
+; c8c08
+
+BattleBGEffect_18: ; c8c08 (32:4c08)
+ ld de, .Pals
+ call BGEffect_RapidCyclePals
+ ret
+
+.Pals:
+ db $e4, $90, $40, $90, $fe
+; c8c14
+
+BattleBGEffect_19: ; c8c14 (32:4c14)
+ ld de, .Pals
+ call BGEffect_RapidCyclePals
+ ret
+
+.Pals:
+ db $e4, $f8, $fc, $f8, $fe
+; c8c20
+
+BattleBGEffect_1a: ; c8c20 (32:4c20)
+ ld de, .Pals
+ call BGEffect_RapidCyclePals
+ ret
+
+.Pals:
+ db $e4, $f8, $fc, $f8, $e4, $90, $40, $90, $fe
+; c8c30
+
+BattleBGEffect_1b: ; c8c30 (32:4c30)
+ ld de, .Pals
+ call BGEffect_RapidCyclePals
+ ret
+
+.Pals:
+ db $e4, $fc, $e4, $00, $fe
+; c8c3c
+
+BattleBGEffect_1d: ; c8c3c (32:4c3c)
+ ld de, .Pals
+ call BGEffect_RapidCyclePals
+ ret
+
+.Pals:
+ db $e4, $90, $40, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $40, $90, $e4, $ff
+; c8c55
+
+BattleBGEffect_1e: ; c8c55 (32:4c55)
+ ld de, .Pals
+ call BGEffect_RapidCyclePals
+ ret
+
+.Pals:
+ db $00, $40, $90, $e4, $ff
+; c8c61
+
+BattleBGEffect_2e: ; c8ce1 (32:4ce1)
+ call Functionc8d0b
+ jr c, .xor_a
+ bit 7, a
+ jr z, .okay
+.xor_a
+ xor a
+.okay
+ ldh [hSCY], a
+ xor $ff
+ inc a
+ ld [$c753], a ; wAnimObject01YOffset
+ ret
+
+BattleBGEffect_1f: ; c8cf9 (32:4cf9)
+ call Functionc8d0b
+ jr nc, .skip
+ xor a
+.skip
+ ldh [hSCX], a
+ ret
+
+BattleBGEffect_20: ; c8d02 (32:4d02)
+ call Functionc8d0b
+ jr nc, .skip
+ xor a
+.skip
+ ldh [hSCY], a
+ ret
+
+Functionc8d0b: ; c8d0b (32:4d0b)
+ ld hl, BG_EFFECT_STRUCT_JT_INDEX
+ add hl, bc
+ ld a, [hl]
+ and a
+ jr nz, .okay
+ call EndBattleBGEffect
+ scf
+ ret
+
+.okay
+ dec [hl]
+ ld hl, BG_EFFECT_STRUCT_03
+ add hl, bc
+ ld a, [hl]
+ and $f
+ jr z, .every_16_frames
+ dec [hl]
+ ld hl, BG_EFFECT_STRUCT_BATTLE_TURN
+ add hl, bc
+ ld a, [hl]
+ and a
+ ret
+
+.every_16_frames
+ ld a, [hl]
+ swap a
+ or [hl]
+ ld [hl], a
+ ld hl, BG_EFFECT_STRUCT_BATTLE_TURN
+ add hl, bc
+ ld a, [hl]
+ xor $ff
+ inc a
+ ld [hl], a
+ and a
+ ret
+
+BattleBGEffect_GetNthDMGPal: ; c8d57 (32:4d57)
+ ld hl, BG_EFFECT_STRUCT_JT_INDEX
+ add hl, bc
+ ld a, [hl]
+ and a
+ jr z, .zero
+ dec [hl]
+ ld hl, BG_EFFECT_STRUCT_03
+ add hl, bc
+ ld a, [hl]
+ call BattleBGEffect_GetNextDMGPal
+ ret
+
+.zero
+ ld hl, BG_EFFECT_STRUCT_BATTLE_TURN
+ add hl, bc
+ ld a, [hl]
+ ld hl, BG_EFFECT_STRUCT_JT_INDEX
+ add hl, bc
+ ld [hl], a
+ call BattleBGEffect_GetFirstDMGPal
+ ret
+
+BGEffect_RapidCyclePals: ; c8d77 (32:4d77)
+ push de
+ ld de, .Jumptable_DMG
+ call BatttleBGEffects_GetNamedJumptablePointer
+ pop de
+ jp hl
+
+.Jumptable_DMG:
+ dw .zero_dmg
+ dw .one_dmg
+ dw .two_dmg
+
+
+.zero_dmg ; c8d8b (32:4d8b)
+ call BattleBGEffects_IncrementJumptable
+ ld a, $e4
+ call BattleBGEffects_SetLYOverrides
+ ld a, $47
+ call BattleBGEffect_SetLCDStatCustoms
+ ldh a, [hLYOverrideEnd]
+ inc a
+ ldh [hLYOverrideEnd], a
+ ld hl, BG_EFFECT_STRUCT_03
+ add hl, bc
+ ld a, [hl]
+ ld [hl], $0
+ ld hl, BG_EFFECT_STRUCT_BATTLE_TURN
+ add hl, bc
+ ld [hl], a
+ ret
+
+.one_dmg ; c8daa (32:4daa)
+ ld hl, BG_EFFECT_STRUCT_BATTLE_TURN
+ add hl, bc
+ ld a, [hl]
+ and $f
+ jr z, .okay_1_dmg
+ dec [hl]
+ ret
+
+.okay_1_dmg
+ ld a, [hl]
+ swap a
+ or [hl]
+ ld [hl], a
+ call BattleBGEffect_GetFirstDMGPal
+ jr c, .okay_2_dmg
+ call BGEffect_FillLYOverridesBackup
+ ret
+
+.okay_2_dmg
+ ld hl, BG_EFFECT_STRUCT_03
+ add hl, bc
+ dec [hl]
+ ret
+
+.two_dmg ; c8dc9 (32:4dc9)
+ call BattleBGEffects_ResetVideoHRAM
+ ld a, %11100100
+ ld [rBGP], a
+ call EndBattleBGEffect
+ ret
+
+BattleBGEffect_GetFirstDMGPal: ; c8eac (32:4eac)
+ ld hl, BG_EFFECT_STRUCT_03
+ add hl, bc
+ ld a, [hl]
+ inc [hl]
+BattleBGEffect_GetNextDMGPal: ; c8eb2 (32:4eb2)
+ ld l, a
+ ld h, $0
+ add hl, de
+ ld a, [hl]
+ cp -1
+ jr z, .quit
+ cp -2
+ jr nz, .repeat
+ ld a, [de]
+ ld hl, BG_EFFECT_STRUCT_03
+ add hl, bc
+ ld [hl], $0
+.repeat
+ and a
+ ret
+
+.quit
+ scf
+ ret
+
+BattleBGEffects_ClearLYOverrides: ; c8eca (32:4eca)
+ xor a
+BattleBGEffects_SetLYOverrides: ; c8ecb (32:4ecb)
+ ld hl, wLYOverrides
+ ld e, $91
+.loop
+ ld [hli], a
+ dec e
+ jr nz, .loop
+ ret
+
+BattleBGEffect_SetLCDStatCustoms: ; c8ede (32:4ede)
+ ldh [hLCDCPointer], a
+ call BGEffect_CheckBattleTurn
+ jr nz, .player_turn
+ lb de, $00, $36
+ jr .okay
+
+.player_turn
+ lb de, $2f, $5e
+.okay
+ ld a, d
+ ldh [hLYOverrideStart], a
+ ld a, e
+ ldh [hLYOverrideEnd], a
+ ret
+
+BattleAnim_ResetLCDStatCustom: ; c8f0a (32:4f0a)
+ xor a
+ ldh [hLYOverrideStart], a
+ ldh [hLYOverrideEnd], a
+ call BattleBGEffects_ClearLYOverrides
+ xor a
+ ldh [hLCDCPointer], a
+ call EndBattleBGEffect
+ ret
+
+BattleBGEffects_ResetVideoHRAM: ; c8f19 (32:4f19)
+ xor a
+ ldh [hLCDCPointer], a
+ ldh [hLYOverrideStart], a
+ ldh [hLYOverrideEnd], a
+ call BattleBGEffects_ClearLYOverrides
+ ret
+
+Functionc8f2e: ; c8f2e (32:4f2e)
+ push bc
+ xor a
+ ld [wBattleAnimTemp0], a
+ ld a, e
+ ld [wBattleAnimTemp1], a
+ ld a, d
+ ld [wBattleAnimTemp2], a
+ ld a, $80
+ ld [wBattleAnimTemp3], a
+ ld bc, wLYOverrides
+.loop
+ ldh a, [hLYOverrideStart]
+ cp c
+ jr nc, .next
+ ldh a, [hLYOverrideEnd]
+ cp c
+ jr c, .next
+ ld a, [wBattleAnimTemp2]
+ ld d, a
+ ld a, [wBattleAnimTemp0]
+ call BattleBGEffects_Sine
+ ld [bc], a
+.next
+ inc bc
+ ld a, [wBattleAnimTemp1]
+ ld hl, wBattleAnimTemp0
+ add [hl]
+ ld [hl], a
+ ld hl, wBattleAnimTemp3
+ dec [hl]
+ jr nz, .loop
+ pop bc
+ ret
+
+InitSurfWaves: ; c8f69 (32:4f69)
+ push bc
+ xor a
+ ld [wBattleAnimTemp0], a
+ ld a, e
+ ld [wBattleAnimTemp1], a
+ ld a, d
+ ld [wBattleAnimTemp2], a
+ ld a, $80
+ ld [wBattleAnimTemp3], a
+ ld bc, wLYOverrides2
+.loop
+ ld a, [wBattleAnimTemp2]
+ ld d, a
+ ld a, [wBattleAnimTemp0]
+ call BattleBGEffects_Sine
+ ld [bc], a
+ inc bc
+ ld a, [wBattleAnimTemp1]
+ ld hl, wBattleAnimTemp0
+ add [hl]
+ ld [hl], a
+ ld hl, wBattleAnimTemp3
+ dec [hl]
+ jr nz, .loop
+ pop bc
+ ret
+
+BattleBGEffect_WavyScreenFX: ; c8fef (32:4fef)
+ push bc
+ ldh a, [hLYOverrideStart]
+ ld l, a
+ inc a
+ ld e, a
+ ld h, HIGH(wLYOverrides)
+ ld d, h
+ ldh a, [hLYOverrideEnd]
+ sub l
+ and a
+ jr z, .done
+ ld c, a
+ ld a, [hl]
+ push af
+.loop
+ ld a, [de]
+ inc de
+ ld [hli], a
+ dec c
+ jr nz, .loop
+ pop af
+ ld [hl], a
+.done
+ pop bc
+ ret
+
+BGEffect_FillLYOverridesBackup: ; c900b (32:500b)
+ push af
+ ld h, HIGH(wLYOverrides)
+ ldh a, [hLYOverrideStart]
+ ld l, a
+ ldh a, [hLYOverrideEnd]
+ sub l
+ ld d, a
+ pop af
+.loop
+ ld [hli], a
+ dec d
+ jr nz, .loop
+ ret
+
+BGEffect_DisplaceLYOverridesBackup: ; c901b (32:501b)
+ ; e = a; d = [hLYOverrideEnd] - [hLYOverrideStart] - a
+ push af
+ ld e, a
+ ldh a, [hLYOverrideStart]
+ ld l, a
+ ldh a, [hLYOverrideEnd]
+ sub l
+ sub e
+ ld d, a
+ ld h, HIGH(wLYOverrides)
+ ldh a, [hLYOverrideStart]
+ ld l, a
+ ld a, $90
+.loop
+ ld [hli], a
+ dec e
+ jr nz, .loop
+ pop af
+ xor $ff
+ inc a
+.loop2
+ ld [hli], a
+ dec d
+ jr nz, .loop2
+ ret
+
+BGEffect_CheckBattleTurn: ; c9038 (32:5038)
+ ld hl, BG_EFFECT_STRUCT_BATTLE_TURN
+ add hl, bc
+ ldh a, [hBattleTurn]
+ and $1
+ xor [hl]
+ ret
+
+BGEffect_CheckFlyDigStatus: ; c9042 (32:5042)
+ ld hl, BG_EFFECT_STRUCT_BATTLE_TURN
+ add hl, bc
+ ldh a, [hBattleTurn]
+ and $1
+ xor [hl]
+ jr nz, .player
+ ld a, [wEnemySubStatus3] ; EnemySubStatus3
+ bit 6, a
+ ret
+
+.player
+ ld a, [wPlayerSubStatus3] ; PlayerSubStatus3
+ bit 6, a
+ ret
+
+BattleBGEffects_CheckSGB: ; c9059 (32:5059)
+ ld a, [wcccf]
+ and a
+ ret
+
+BattleBGEffects_Sine: ; c905d (32:505d)
+ ld e, a
+ callfar BattleAnim_Sine_e
+ ld a, e
+ ret
+
+BattleBGEffects_Cosine: ; c9066 (32:5066)
+ ld e, a
+ callfar BattleAnim_Cosine_e
+ ld a, e
+ ret
+
+; c906f (32:506f)
diff --git a/hram.asm b/hram.asm
index 9e3e438..8e59150 100644
--- a/hram.asm
+++ b/hram.asm
@@ -101,8 +101,9 @@ hPrintNumTemp:: ds 3 ; ffba big-endian
hLCDCPointer:: ; ffd0
db
-
- ds 3 ; TODO
+hLYOverrideStart:: db ; ffd1
+hLYOverrideEnd:: db ; ffd2
+ ds 1 ; TODO
hSerialReceived:: ; ffd4
@@ -188,4 +189,6 @@ hRandomAdd:: db ; ffef
hRandomSub:: db ; fff0
hRTCRandom:: db ; fff1
+hBattleTurn:: db ; fff2
+
; TODO
diff --git a/shim.sym b/shim.sym
index 6460009..92bda27 100644
--- a/shim.sym
+++ b/shim.sym
@@ -4,6 +4,7 @@
00:051C Reset
00:0D0A LoadFont
00:0D1A LoadFontExtra
+00:0E18 ClearBox
00:0E2A ClearTileMap
00:0E3D DrawTextBox
00:0E93 PlaceString
@@ -179,13 +180,15 @@
24:4000 SetClockDialog
24:4239 SlotMachineGame
-32:4000 Function_c8000
32:76FF Function_cb6ff
32:7710 Function_cb710
32:7733 Function_cb733
33:4000 Function_cc000
33:4000 Function_cc000_2
33:4001 Function_cc001
+33:467B QueueBattleAnimation
+33:625D BattleAnim_Sine_e
+33:6263 BattleAnim_Cosine_e
3A:441D Function_e841d
3A:45D8 Function_e85d8
3A:47F9 Function_e87f9
diff --git a/wram.asm b/wram.asm
index 861fd97..06e8e37 100644
--- a/wram.asm
+++ b/wram.asm
@@ -120,12 +120,67 @@ NEXTU
wLYOverrides:: ; c600
ds SCREEN_HEIGHT_PX
+; c690
+ ds $10
+wLYOverrides2:: ; c6a0
NEXTU
+; Battle-related
+
+ ds $1ea
+
+; c7ea
+wActiveBGEffects:: ; c7ea
+wBGEffect1:: battle_bg_effect wBGEffect1
+wBGEffect2:: battle_bg_effect wBGEffect2
+wBGEffect3:: battle_bg_effect wBGEffect3
+wBGEffect4:: battle_bg_effect wBGEffect4
+wBGEffect5:: battle_bg_effect wBGEffect5
+wActiveBGEffectsEnd::
+
+wNumActiveBattleAnims:: db ; c7fe
+
+wBattleAnimFlags:: db ; c7ff
+wBattleAnimAddress:: dw ; c800
+wBattleAnimDuration:: db ; c802
+wBattleAnimParent:: dw ; c803
+wBattleAnimLoops:: db ; c805
+wBattleAnimVar:: db ; c806
+wBattleAnimByte:: db ; c807
+wBattleAnimOAMPointerLo:: db ; c808
+ db
- ds $422 ; TODO
-
-wTrainerClass:: ; ca22
+UNION ; c80a
+; unidentified
+wBattleAnimTemp0:: db
+wBattleAnimTemp1:: db
+wBattleAnimTemp2:: db
+wBattleAnimTemp3:: db
+
+NEXTU ; c80a
+wBattleAnimTempOAMFlags:: db
+wBattleAnimTempField02:: db
+wBattleAnimTempTileID:: db
+wBattleAnimTempXCoord:: db
+wBattleAnimTempYCoord:: db
+wBattleAnimTempXOffset:: db
+wBattleAnimTempYOffset:: db
+wBattleAnimTempAddSubFlags:: db
+wBattleAnimTempPalette:: db
+ENDU ; c813
+
+ ds $32
+wBattleAnimEnd::
+; c845
+
+ ds $1f8 ; TODO
+
+wPlayerSubStatus3:: db ; ca3d
+ ds $4
+wEnemySubStatus3:: db ; ca42
+; ca43
+ ds $14
+wTrainerClass:: ; ca57
db
ENDU
@@ -249,6 +304,7 @@ wOBP1:: db ; cccc
SECTION "CCCE", WRAM0[$CCCE]
wDisableVBlankWYUpdate:: db ; ccce
+wcccf:: db
SECTION "CD26", WRAM0[$CD26]