Move battle start animation functions to its own file

This commit is contained in:
PikalaxALT 2015-10-19 10:23:58 -04:00
parent 52605b764a
commit 0a244e043c
24 changed files with 1350 additions and 1673 deletions

View File

@ -1,11 +1,11 @@
AI_SwitchOrTryItem: ; 38000 AI_SwitchOrTryItem: ; 38000
and a and a
ld a, [IsInBattle] ld a, [wBattleMode]
dec a dec a
ret z ret z
ld a, [InLinkBattle] ld a, [wLinkMode]
and a and a
ret nz ret nz
@ -731,7 +731,7 @@ AI_Switch: ; 3846c
callba Function3d57a callba Function3d57a
xor a xor a
ld [wd264], a ld [wd264], a
ld a, [InLinkBattle] ld a, [wLinkMode]
and a and a
ret nz ret nz
scf scf

View File

@ -25,7 +25,7 @@ Function3c000: ; 3c000
.asm_3c021 .asm_3c021
ld a, d ld a, d
ld [wBattleAction], a ld [wBattleAction], a
ld a, [InLinkBattle] ld a, [wLinkMode]
and a and a
jr z, .asm_3c031 jr z, .asm_3c031
@ -34,7 +34,7 @@ Function3c000: ; 3c000
jr z, .asm_3c04c jr z, .asm_3c04c
.asm_3c031 .asm_3c031
ld a, [IsInBattle] ld a, [wBattleMode]
dec a dec a
jr z, .asm_3c047 jr z, .asm_3c047
xor a xor a
@ -97,7 +97,7 @@ Function3c000: ; 3c000
call Function309d call Function309d
call SetPlayerTurn call SetPlayerTurn
call SpikesDamage call SpikesDamage
ld a, [InLinkBattle] ld a, [wLinkMode]
and a and a
jr z, .asm_3c0df jr z, .asm_3c0df
ld a, [$ffcb] ld a, [$ffcb]
@ -127,7 +127,7 @@ WildFled_EnemyFled_LinkBattleCanceled: ; 3c0e5
and $c0 and $c0
add $2 add $2
ld [wd0ee], a ld [wd0ee], a
ld a, [InLinkBattle] ld a, [wLinkMode]
and a and a
ld hl, BattleText_WildFled ld hl, BattleText_WildFled
jr z, .asm_3c115 jr z, .asm_3c115
@ -438,7 +438,7 @@ Function3c27c: ; 3c27c
; 3c300 ; 3c300
Function3c300: ; 3c300 Function3c300: ; 3c300
ld a, [InLinkBattle] ld a, [wLinkMode]
and a and a
jr z, .asm_3c30d jr z, .asm_3c30d
ld a, [wBattleAction] ld a, [wBattleAction]
@ -456,7 +456,7 @@ Function3c300: ; 3c300
; 3c314 ; 3c314
Function3c314: ; 3c314 Function3c314: ; 3c314
ld a, [InLinkBattle] ld a, [wLinkMode]
and a and a
jr z, .asm_3c35b jr z, .asm_3c35b
ld a, [wBattleAction] ld a, [wBattleAction]
@ -778,7 +778,7 @@ Function3c4df: ; 3c4df
Function3c543: ; 3c543 Function3c543: ; 3c543
ld a, [IsInBattle] ld a, [wBattleMode]
dec a dec a
jr nz, .Stay jr nz, .Stay
@ -1272,7 +1272,7 @@ Function3c801: ; 3c801
xor a xor a
ld [hli], a ld [hli], a
ld [hl], a ld [hl], a
ld a, [IsInBattle] ld a, [wBattleMode]
dec a dec a
ret z ret z
ld hl, OTPartyMon1HP ld hl, OTPartyMon1HP
@ -1429,7 +1429,7 @@ Function3c93c: ; 3c93c
jr z, .asm_3c99b jr z, .asm_3c99b
ld de, wc739 ld de, wc739
ld hl, wc735 ld hl, wc735
ld a, [IsInBattle] ld a, [wBattleMode]
dec a dec a
jr z, .asm_3c99b jr z, .asm_3c99b
ld hl, OTPartyMon1PP ld hl, OTPartyMon1PP
@ -1518,7 +1518,7 @@ Function3c93c: ; 3c93c
ld a, [hBattleTurn] ld a, [hBattleTurn]
and a and a
jr z, .asm_3ca12 jr z, .asm_3ca12
ld a, [IsInBattle] ld a, [wBattleMode]
dec a dec a
jr z, .asm_3ca14 jr z, .asm_3ca14
call Function3df1f call Function3df1f
@ -1637,7 +1637,7 @@ HanleDefrost: ; 3ca8f
xor a xor a
ld [EnemyMonStatus], a ld [EnemyMonStatus], a
ld a, [IsInBattle] ld a, [wBattleMode]
dec a dec a
jr z, .asm_3caef jr z, .asm_3caef
ld a, [CurOTMon] ld a, [CurOTMon]
@ -2119,7 +2119,7 @@ Function3cd55: ; 3cd55
ld c, 60 ld c, 60
call DelayFrames call DelayFrames
ld a, [IsInBattle] ld a, [wBattleMode]
dec a dec a
jr nz, .asm_3cd8c jr nz, .asm_3cd8c
@ -2196,7 +2196,7 @@ Function3cdca: ; 3cdca
Function3ce01: ; 3ce01 Function3ce01: ; 3ce01
call UpdateBattleMonInParty call UpdateBattleMonInParty
ld a, [IsInBattle] ld a, [wBattleMode]
dec a dec a
jr z, .asm_3ce16 jr z, .asm_3ce16
ld a, [CurOTMon] ld a, [CurOTMon]
@ -2215,7 +2215,7 @@ Function3ce01: ; 3ce01
ld [hl], a ld [hl], a
call NewEnemyMonStatus call NewEnemyMonStatus
call BreakAttraction call BreakAttraction
ld a, [IsInBattle] ld a, [wBattleMode]
dec a dec a
jr z, .asm_3ce2f jr z, .asm_3ce2f
jr .asm_3ce37 jr .asm_3ce37
@ -2240,7 +2240,7 @@ Function3ce01: ; 3ce01
ld a, d ld a, d
and a and a
ret z ret z
ld a, [IsInBattle] ld a, [wBattleMode]
dec a dec a
call z, Function3d0ea call z, Function3d0ea
call EmptyBattleTextBox call EmptyBattleTextBox
@ -2401,7 +2401,7 @@ Function3cf4a: ; 3cf4a
call Function3e12e call Function3e12e
call WaitBGMap call WaitBGMap
callba Function2c012 callba Function2c012
ld a, [InLinkBattle] ld a, [wLinkMode]
and a and a
jr z, .asm_3cf6d jr z, .asm_3cf6d
call Function3e8e4 call Function3e8e4
@ -2452,7 +2452,7 @@ Function3cfa4: ; 3cfa4
ld a, $1 ld a, $1
ld [wc6fd], a ld [wc6fd], a
ld [BattleEnded], a ld [BattleEnded], a
ld a, [InLinkBattle] ld a, [wLinkMode]
and a and a
ld a, b ld a, b
call z, Function3d0ea call z, Function3d0ea
@ -2461,7 +2461,7 @@ Function3cfa4: ; 3cfa4
call StdBattleTextBox call StdBattleTextBox
call IsMobileBattle call IsMobileBattle
jr z, .asm_3cff5 jr z, .asm_3cff5
ld a, [InLinkBattle] ld a, [wLinkMode]
and a and a
ret nz ret nz
@ -2664,7 +2664,7 @@ Function3d0ea: ; 3d0ea
call PlayMusic call PlayMusic
call DelayFrame call DelayFrame
ld de, MUSIC_WILD_VICTORY ld de, MUSIC_WILD_VICTORY
ld a, [IsInBattle] ld a, [wBattleMode]
dec a dec a
jr nz, .asm_3d113 jr nz, .asm_3d113
push de push de
@ -2747,7 +2747,7 @@ KantoGymLeaders:
db SABRINA db SABRINA
db BLAINE db BLAINE
db BLUE db BLUE
db $ff db -1
Function3d14e: ; 3d14e Function3d14e: ; 3d14e
@ -2768,7 +2768,7 @@ Function3d14e: ; 3d14e
or [hl] or [hl]
jr nz, .asm_3d185 jr nz, .asm_3d185
call Function3ce01 call Function3ce01
ld a, [IsInBattle] ld a, [wBattleMode]
dec a dec a
jr nz, .asm_3d17f jr nz, .asm_3d17f
ld a, $1 ld a, $1
@ -2842,7 +2842,7 @@ Function3d1aa: ; 3d1aa
Function3d1f8: ; 3d1f8 Function3d1f8: ; 3d1f8
call EmptyBattleTextBox call EmptyBattleTextBox
call Function309d call Function309d
ld a, [IsInBattle] ld a, [wBattleMode]
and a and a
dec a dec a
ret nz ret nz
@ -2870,7 +2870,7 @@ Function3d227: ; 3d227
call Function1d6e call Function1d6e
call Function3d2f7 call Function3d2f7
call ForcePickPartyMonInBattle call ForcePickPartyMonInBattle
ld a, [InLinkBattle] ld a, [wLinkMode]
and a and a
jr z, .asm_3d241 jr z, .asm_3d241
ld a, $1 ld a, $1
@ -2949,8 +2949,8 @@ Function3d2b3: ; 3d2b3
Function3d2e0: ; 3d2e0 Function3d2e0: ; 3d2e0
ld a, [InLinkBattle] ld a, [wLinkMode]
cp $4 cp LINK_MOBILE
jr nz, .asm_3d2ef ; It's not a mobile battle jr nz, .asm_3d2ef ; It's not a mobile battle
ld a, [wcd2b] ld a, [wcd2b]
@ -2967,8 +2967,8 @@ Function3d2e0: ; 3d2e0
; 3d2f1 ; 3d2f1
IsMobileBattle: ; 3d2f1 IsMobileBattle: ; 3d2f1
ld a, [InLinkBattle] ld a, [wLinkMode]
cp $4 cp LINK_MOBILE
ret ret
; 3d2f7 ; 3d2f7
@ -3119,7 +3119,7 @@ LostBattle: ; 3d38e
ret ret
.asm_3d3e3 .asm_3d3e3
ld a, [InLinkBattle] ld a, [wLinkMode]
and a and a
jr nz, .LostLinkBattle jr nz, .LostLinkBattle
@ -3337,7 +3337,7 @@ Function3d517: ; 3d517
; 3d533 ; 3d533
Function3d533: ; 3d533 Function3d533: ; 3d533
ld a, [InLinkBattle] ld a, [wLinkMode]
and a and a
jr z, .asm_3d541 jr z, .asm_3d541
@ -3630,7 +3630,7 @@ Function3d714: ; 3d714
ld a, [PartyCount] ld a, [PartyCount]
dec a dec a
jp z, .asm_3d749 jp z, .asm_3d749
ld a, [InLinkBattle] ld a, [wLinkMode]
and a and a
jp nz, .asm_3d749 jp nz, .asm_3d749
ld a, [Options] ld a, [Options]
@ -3862,11 +3862,11 @@ Function3d8b3: ; 3d8b3
cp BATTLETYPE_SUICUNE cp BATTLETYPE_SUICUNE
jp z, .asm_3d98d jp z, .asm_3d98d
ld a, [InLinkBattle] ld a, [wLinkMode]
and a and a
jp nz, .asm_3d9a2 jp nz, .asm_3d9a2
ld a, [IsInBattle] ld a, [wBattleMode]
dec a dec a
jp nz, .asm_3d992 jp nz, .asm_3d992
@ -3979,7 +3979,7 @@ Function3d8b3: ; 3d8b3
ret ret
.asm_3d9a2 .asm_3d9a2
ld a, [InLinkBattle] ld a, [wLinkMode]
and a and a
ld a, $2 ld a, $2
jr z, .asm_3d9cf jr z, .asm_3d9cf
@ -4107,7 +4107,7 @@ Function3da97: ; 3da97
bit SUBSTATUS_TRANSFORMED, a bit SUBSTATUS_TRANSFORMED, a
ret z ret z
ld hl, wc6f2 ld hl, wc6f2
ld a, [IsInBattle] ld a, [wBattleMode]
dec a dec a
ret z ret z
ld hl, OTPartyMon1DVs ld hl, OTPartyMon1DVs
@ -4658,7 +4658,7 @@ Function3de51: ; 3de51
call Function3df1f call Function3df1f
xor a xor a
ld [bc], a ld [bc], a
ld a, [IsInBattle] ld a, [wBattleMode]
dec a dec a
ret z ret z
ld [hl], $0 ld [hl], $0
@ -5127,7 +5127,7 @@ BattleMenu: ; 3e139
ld a, [InputType] ld a, [InputType]
or a or a
jr z, .asm_3e171 jr z, .asm_3e171
callba Function1de294 callba _DudeAutoInput_DownA
.asm_3e171 .asm_3e171
call LoadBattleMenu2 call LoadBattleMenu2
@ -5183,7 +5183,7 @@ LoadBattleMenu2: ; 3e19b
; 3e1c7 ; 3e1c7
BattleMenu_Pack: ; 3e1c7 BattleMenu_Pack: ; 3e1c7
ld a, [InLinkBattle] ld a, [wLinkMode]
and a and a
jp nz, ItemsCantBeUsed jp nz, ItemsCantBeUsed
@ -5422,7 +5422,7 @@ Function3e358: ; 3e358
Function3e3ad: ; 3e3ad Function3e3ad: ; 3e3ad
ld a, 1 ld a, 1
ld [wPlayerIsSwitching], a ld [wPlayerIsSwitching], a
ld a, [InLinkBattle] ld a, [wLinkMode]
and a and a
jr z, .asm_3e3c1 jr z, .asm_3e3c1
call Function1d6e call Function1d6e
@ -5431,7 +5431,7 @@ Function3e3ad: ; 3e3ad
.asm_3e3c1 .asm_3e3c1
call Function3e7c1 call Function3e7c1
ld a, [InLinkBattle] ld a, [wLinkMode]
and a and a
jr nz, .asm_3e3cf jr nz, .asm_3e3cf
@ -5650,7 +5650,7 @@ Function3e4bc: ; 3e4bc
dec a dec a
ld b, $c3 ld b, $c3
jr z, .asm_3e569 jr z, .asm_3e569
ld a, [InLinkBattle] ld a, [wLinkMode]
and a and a
jr nz, .asm_3e569 jr nz, .asm_3e569
ld b, $c7 ld b, $c7
@ -5960,8 +5960,8 @@ MoveInfoBox: ; 3e6c8
Function3e75f: ; 3e75f Function3e75f: ; 3e75f
hlcoord 5, 11 hlcoord 5, 11
ld a, [InLinkBattle] ld a, [wLinkMode] ; What's the point of this check?
cp $4 cp LINK_MOBILE
jr c, .ok jr c, .ok
hlcoord 5, 11 hlcoord 5, 11
.ok .ok
@ -6034,7 +6034,7 @@ Function3e7c1: ; 3e7c1
ld a, [wEnemyIsSwitching] ld a, [wEnemyIsSwitching]
and a and a
ret nz ret nz
ld a, [InLinkBattle] ld a, [wLinkMode]
and a and a
jr z, .asm_3e817 jr z, .asm_3e817
call EmptyBattleTextBox call EmptyBattleTextBox
@ -6108,7 +6108,7 @@ Function3e7c1: ; 3e7c1
jr .asm_3e8bd jr .asm_3e8bd
.asm_3e84f .asm_3e84f
ld a, [IsInBattle] ld a, [wBattleMode]
dec a dec a
jr nz, .asm_3e882 jr nz, .asm_3e882
.asm_3e855 .asm_3e855
@ -6222,7 +6222,7 @@ LoadEnemyMon: ; 3e8eb
call ByteFill call ByteFill
; We don't need to be here if we're in a link battle ; We don't need to be here if we're in a link battle
ld a, [InLinkBattle] ld a, [wLinkMode]
and a and a
jp nz, Function3dabd jp nz, Function3dabd
@ -6244,7 +6244,7 @@ LoadEnemyMon: ; 3e8eb
; Let's get the item: ; Let's get the item:
; Is the item predetermined? ; Is the item predetermined?
ld a, [IsInBattle] ld a, [wBattleMode]
dec a dec a
jr z, .WildItem jr z, .WildItem
@ -6293,7 +6293,7 @@ LoadEnemyMon: ; 3e8eb
; Initialize DVs ; Initialize DVs
; If we're in a trainer battle, DVs are predetermined ; If we're in a trainer battle, DVs are predetermined
ld a, [IsInBattle] ld a, [wBattleMode]
and a and a
jr z, .InitDVs jr z, .InitDVs
@ -6320,7 +6320,7 @@ LoadEnemyMon: ; 3e8eb
; See GetTrainerDVs for more on that ; See GetTrainerDVs for more on that
callba GetTrainerDVs callba GetTrainerDVs
; These are the DVs we'll use if we're actually in a trainer battle ; These are the DVs we'll use if we're actually in a trainer battle
ld a, [IsInBattle] ld a, [wBattleMode]
dec a dec a
jr nz, .UpdateDVs jr nz, .UpdateDVs
@ -6396,7 +6396,7 @@ LoadEnemyMon: ; 3e8eb
; We've still got more to do if we're dealing with a wild monster ; We've still got more to do if we're dealing with a wild monster
ld a, [IsInBattle] ld a, [wBattleMode]
dec a dec a
jr nz, .Happiness jr nz, .Happiness
@ -6496,7 +6496,7 @@ LoadEnemyMon: ; 3e8eb
; If we're in a trainer battle, ; If we're in a trainer battle,
; get the rest of the parameters from the party struct ; get the rest of the parameters from the party struct
ld a, [IsInBattle] ld a, [wBattleMode]
cp a, TRAINER_BATTLE cp a, TRAINER_BATTLE
jr z, .OpponentParty jr z, .OpponentParty
@ -6586,7 +6586,7 @@ LoadEnemyMon: ; 3e8eb
; Get moves ; Get moves
ld de, EnemyMonMoves ld de, EnemyMonMoves
; Are we in a trainer battle? ; Are we in a trainer battle?
ld a, [IsInBattle] ld a, [wBattleMode]
cp a, TRAINER_BATTLE cp a, TRAINER_BATTLE
jr nz, .WildMoves jr nz, .WildMoves
; Then copy moves from the party struct ; Then copy moves from the party struct
@ -6613,7 +6613,7 @@ endr
.PP .PP
; Trainer battle? ; Trainer battle?
ld a, [IsInBattle] ld a, [wBattleMode]
cp a, TRAINER_BATTLE cp a, TRAINER_BATTLE
jr z, .TrainerPP jr z, .TrainerPP
@ -6657,7 +6657,7 @@ endr
call GetPokemonName call GetPokemonName
; Did we catch it? ; Did we catch it?
ld a, [IsInBattle] ld a, [wBattleMode]
and a and a
ret z ret z
@ -6725,7 +6725,7 @@ CheckSleepingTreeMon: ; 3eb38
db EXEGGCUTE db EXEGGCUTE
db LEDYBA db LEDYBA
db AIPOM db AIPOM
db $ff ; end db -1 ; end
.Day .Day
db VENONAT db VENONAT
@ -6733,7 +6733,7 @@ CheckSleepingTreeMon: ; 3eb38
db NOCTOWL db NOCTOWL
db SPINARAK db SPINARAK
db HERACROSS db HERACROSS
db $ff ; end db -1 ; end
.Morn .Morn
db VENONAT db VENONAT
@ -6741,7 +6741,7 @@ CheckSleepingTreeMon: ; 3eb38
db NOCTOWL db NOCTOWL
db SPINARAK db SPINARAK
db HERACROSS db HERACROSS
db $ff ; end db -1 ; end
; 3eb75 ; 3eb75
@ -7116,7 +7116,7 @@ BadgeStatBoosts: ; 3ed45
; The boosted stats are in order, except PlainBadge and MineralBadge's boosts are swapped. ; The boosted stats are in order, except PlainBadge and MineralBadge's boosts are swapped.
ld a, [InLinkBattle] ld a, [wLinkMode]
and a and a
ret nz ret nz
@ -7237,7 +7237,7 @@ _BattleRandom:: ; 3edd8
; To circumvent this a shared PRNG is used instead. ; To circumvent this a shared PRNG is used instead.
; But if we're in a non-link battle we're safe to use it ; But if we're in a non-link battle we're safe to use it
ld a, [InLinkBattle] ld a, [wLinkMode]
and a and a
jp z, Random jp z, Random
@ -7338,7 +7338,7 @@ Function3ee27: ; 3ee27
Function3ee3b: ; 3ee3b Function3ee3b: ; 3ee3b
; Give experience. ; Give experience.
ld a, [InLinkBattle] ld a, [wLinkMode]
and a and a
ret nz ret nz
@ -7452,7 +7452,7 @@ endr
.asm_3eee2 .asm_3eee2
ld [StringBuffer2 + 2], a ld [StringBuffer2 + 2], a
ld a, [IsInBattle] ld a, [wBattleMode]
dec a dec a
call nz, DoubleExp call nz, DoubleExp
push bc push bc
@ -7977,7 +7977,7 @@ Function3f22c: ; 3f22c
SendOutPkmnText: ; 3f26d SendOutPkmnText: ; 3f26d
ld a, [InLinkBattle] ld a, [wLinkMode]
and a and a
jr z, .asm_3f27c jr z, .asm_3f27c
@ -8446,7 +8446,7 @@ Function3f4dd: ; 3f4dd
ld bc, 4 << 8 + 10 ld bc, 4 << 8 + 10
call ClearBox call ClearBox
call ClearSprites call ClearSprites
ld a, [IsInBattle] ld a, [wBattleMode]
cp $1 cp $1
call z, UpdateEnemyHUD call z, UpdateEnemyHUD
ld a, $1 ld a, $1
@ -8521,10 +8521,10 @@ Function3f594: ; 3f594
hlcoord 12, 0 hlcoord 12, 0
lb bc, 7, 7 lb bc, 7, 7
predef FillBox predef FillBox
ld a, $ff ld a, -1
ld [CurOTMon], a ld [CurOTMon], a
ld a, TRAINER_BATTLE ld a, TRAINER_BATTLE
ld [IsInBattle], a ld [wBattleMode], a
call IsJohtoGymLeader call IsJohtoGymLeader
jr nc, .done jr nc, .done
@ -8554,7 +8554,7 @@ Function3f594: ; 3f594
Function3f607: ; 3f607 Function3f607: ; 3f607
ld a, $1 ld a, $1
ld [IsInBattle], a ld [wBattleMode], a
callba Function10605d callba Function10605d
call LoadEnemyMon call LoadEnemyMon
ld hl, EnemyMonMoves ld hl, EnemyMonMoves
@ -8647,7 +8647,7 @@ Function3f69e: ; 3f69e
; 3f6a5 ; 3f6a5
Function3f6a5: ; 3f6a5 Function3f6a5: ; 3f6a5
ld a, [InLinkBattle] ld a, [wLinkMode]
and a and a
jr z, .asm_3f6b7 jr z, .asm_3f6b7
call Function3f759 call Function3f759
@ -8672,7 +8672,7 @@ Function3f6d0: ; 3f6d0
call Function3f998 call Function3f998
xor a xor a
ld [Danger], a ld [Danger], a
ld [IsInBattle], a ld [wBattleMode], a
ld [BattleType], a ld [BattleType], a
ld [AttackMissed], a ld [AttackMissed], a
ld [TempWildMonSpecies], a ld [TempWildMonSpecies], a
@ -8830,8 +8830,8 @@ Function3f80f: ; 3f80f
Function3f830: ; 3f830 Function3f830: ; 3f830
ld a, [InLinkBattle] ld a, [wLinkMode]
cp $4 cp LINK_MOBILE
ret ret
; 3f836 ; 3f836
@ -9478,7 +9478,7 @@ Function3fc5b: ; 3fc5b
BattleStartMessage: ; 3fc8b BattleStartMessage: ; 3fc8b
ld a, [IsInBattle] ld a, [wBattleMode]
dec a dec a
jr z, .asm_3fcaa jr z, .asm_3fcaa

View File

@ -12,7 +12,7 @@ DoPlayerTurn: ; 34000
DoEnemyTurn: ; 3400a DoEnemyTurn: ; 3400a
call SetEnemyTurn call SetEnemyTurn
ld a, [InLinkBattle] ld a, [wLinkMode]
and a and a
jr z, DoTurn jr z, DoTurn
@ -696,7 +696,7 @@ BattleCommand02: ; 343db
; No obedience in link battles ; No obedience in link battles
; (since no handling exists for enemy) ; (since no handling exists for enemy)
ld a, [InLinkBattle] ld a, [wLinkMode]
and a and a
ret nz ret nz
@ -1080,7 +1080,7 @@ endr
jr z, .asm_345a4 jr z, .asm_345a4
; skip this part entirely if wildbattle ; skip this part entirely if wildbattle
ld a, [IsInBattle] ld a, [wBattleMode]
dec a dec a
jr z, .asm_345c5 jr z, .asm_345c5
@ -3521,7 +3521,7 @@ Function3534d: ; 3534d
inc l inc l
.asm_3536b .asm_3536b
ld a, [InLinkBattle] ld a, [wLinkMode]
cp 3 cp 3
jr z, .done jr z, .done
@ -3835,11 +3835,11 @@ BattleCommanda1: ; 35461
sub b sub b
ld [DefaultFlypoint], a ld [DefaultFlypoint], a
.asm_3550d .asm_3550d
ld a, [IsInBattle] ld a, [wBattleMode]
dec a dec a
jr z, .asm_3556b jr z, .asm_3556b
ld a, [InLinkBattle] ld a, [wLinkMode]
and a and a
jr nz, .asm_35532 jr nz, .asm_35532
@ -4825,7 +4825,7 @@ BattleCommand46: ; 35a74
call Function372d8 call Function372d8
ld a, [InLinkBattle] ld a, [wLinkMode]
and a and a
jr z, .asm_35a83 jr z, .asm_35a83
call AnimateFailedMove call AnimateFailedMove
@ -4888,7 +4888,7 @@ BattleCommand46: ; 35a74
ld a, [hBattleTurn] ld a, [hBattleTurn]
and a and a
jr z, .asm_35af6 jr z, .asm_35af6
ld a, [IsInBattle] ld a, [wBattleMode]
dec a dec a
jr nz, .asm_35af6 jr nz, .asm_35af6
ld a, [hl] ld a, [hl]
@ -5180,7 +5180,7 @@ endr
ld a, [hBattleTurn] ld a, [hBattleTurn]
and a and a
jr nz, .asm_35c81 jr nz, .asm_35c81
ld a, [IsInBattle] ld a, [wBattleMode]
dec a dec a
jr nz, .asm_35c81 jr nz, .asm_35c81
ld hl, wc739 ld hl, wc739
@ -5585,7 +5585,7 @@ Function35ece: ; 35ece
jr z, .asm_35eec jr z, .asm_35eec
; Not in link battle ; Not in link battle
ld a, [InLinkBattle] ld a, [wLinkMode]
and a and a
jr nz, .asm_35eec jr nz, .asm_35eec
@ -5683,7 +5683,7 @@ BattleCommand2f: ; 35f2c
and a and a
jr z, .asm_35f89 jr z, .asm_35f89
ld a, [InLinkBattle] ld a, [wLinkMode]
and a and a
jr nz, .asm_35f89 jr nz, .asm_35f89
@ -6331,7 +6331,7 @@ BattleCommand1d: ; 362e3
and a and a
jr z, .DidntMiss jr z, .DidntMiss
ld a, [InLinkBattle] ld a, [wLinkMode]
and a and a
jr nz, .DidntMiss jr nz, .DidntMiss
@ -7124,7 +7124,7 @@ BattleCommanda0: ; 36778
ld a, [hBattleTurn] ld a, [hBattleTurn]
and a and a
jr nz, .asm_367bf jr nz, .asm_367bf
ld a, [IsInBattle] ld a, [wBattleMode]
dec a dec a
jr nz, .failed jr nz, .failed
ld a, [CurPartyLevel] ld a, [CurPartyLevel]
@ -7149,7 +7149,7 @@ BattleCommanda0: ; 36778
jp PrintButItFailed jp PrintButItFailed
.asm_367bf .asm_367bf
ld a, [IsInBattle] ld a, [wBattleMode]
dec a dec a
jr nz, .failed jr nz, .failed
ld a, [BattleMonLevel] ld a, [BattleMonLevel]
@ -7214,7 +7214,7 @@ BattleCommand23: ; 3680f
ld a, [AttackMissed] ld a, [AttackMissed]
and a and a
jr nz, .asm_36852 ; 36830 $20 jr nz, .asm_36852 ; 36830 $20
ld a, [IsInBattle] ld a, [wBattleMode]
dec a dec a
jr nz, .asm_36869 ; 36836 $31 jr nz, .asm_36869 ; 36836 $31
ld a, [CurPartyLevel] ld a, [CurPartyLevel]
@ -7300,7 +7300,7 @@ BattleCommand23: ; 3680f
and a and a
jr nz, .asm_368f3 jr nz, .asm_368f3
ld a, [IsInBattle] ld a, [wBattleMode]
dec a dec a
jr nz, .asm_36908 jr nz, .asm_36908
@ -7496,7 +7496,7 @@ BattleCommand24: ; 369b6
dec a dec a
jr .asm_36a3a jr .asm_36a3a
.asm_36a0b .asm_36a0b
ld a, [IsInBattle] ld a, [wBattleMode]
cp $1 cp $1
jp z, .asm_36a1e jp z, .asm_36a1e
ld a, [OTPartyCount] ld a, [OTPartyCount]
@ -8177,7 +8177,7 @@ BattleCommand30: ; 36dc7
and a and a
jr z, .asm_36e0e jr z, .asm_36e0e
ld a, [InLinkBattle] ld a, [wLinkMode]
and a and a
jr nz, .asm_36e0e jr nz, .asm_36e0e
@ -9281,7 +9281,7 @@ BattleCommand53: ; 37563
and a and a
jr z, .party jr z, .party
ld a, [IsInBattle] ld a, [wBattleMode]
dec a dec a
jr z, .done jr z, .done
@ -9493,7 +9493,7 @@ BattleCommand60: ; 3784b
BattleCommand61: ; 37874 BattleCommand61: ; 37874
; present ; present
ld a, [InLinkBattle] ld a, [wLinkMode]
cp $3 cp $3
jr z, .asm_3787d jr z, .asm_3787d
push bc push bc
@ -9502,7 +9502,7 @@ BattleCommand61: ; 37874
call BattleCommand07 call BattleCommand07
ld a, [InLinkBattle] ld a, [wLinkMode]
cp $3 cp $3
jr z, .asm_37889 jr z, .asm_37889
pop de pop de
@ -9765,7 +9765,7 @@ BattleCommand67: ; 379c9
.Enemy .Enemy
; Wildmons don't have anything to switch to ; Wildmons don't have anything to switch to
ld a, [IsInBattle] ld a, [wBattleMode]
dec a ; WILDMON dec a ; WILDMON
jp z, FailedBatonPass jp z, FailedBatonPass
@ -9800,7 +9800,7 @@ BattleCommand67: ; 379c9
BatonPass_LinkPlayerSwitch: ; 37a67 BatonPass_LinkPlayerSwitch: ; 37a67
ld a, [InLinkBattle] ld a, [wLinkMode]
and a and a
ret z ret z
@ -9819,7 +9819,7 @@ BatonPass_LinkPlayerSwitch: ; 37a67
BatonPass_LinkEnemySwitch: ; 37a82 BatonPass_LinkEnemySwitch: ; 37a82
ld a, [InLinkBattle] ld a, [wLinkMode]
and a and a
ret z ret z
@ -10057,7 +10057,7 @@ BattleCommand6a6c: ; 37b7e
jr z, .Full jr z, .Full
; Don't factor in time of day in link battles. ; Don't factor in time of day in link battles.
ld a, [InLinkBattle] ld a, [wLinkMode]
and a and a
jr nz, .Weather jr nz, .Weather

View File

@ -30,11 +30,11 @@ BattleCommand50: ; 37492
and a and a
ret nz ret nz
ld a, [InLinkBattle] ld a, [wLinkMode]
and a and a
jr z, .stealenemyitem jr z, .stealenemyitem
ld a, [IsInBattle] ld a, [wBattleMode]
dec a dec a
ret z ret z

View File

@ -161,7 +161,7 @@ endr
DoBadgeTypeBoosts: ; fbe24 DoBadgeTypeBoosts: ; fbe24
ld a, [InLinkBattle] ld a, [wLinkMode]
and a and a
ret nz ret nz

View File

@ -315,3 +315,32 @@ SUBSTATUS_CURLED EQU 0
const EFFECT_BEAT_UP const EFFECT_BEAT_UP
const EFFECT_FLY const EFFECT_FLY
const EFFECT_DEFENSE_CURL const EFFECT_DEFENSE_CURL
; Battle vars used in home/battle.asm
const_def
const PLAYER_SUBSTATUS_1
const ENEMY_SUBSTATUS_1
const PLAYER_SUBSTATUS_2
const ENEMY_SUBSTATUS_2
const PLAYER_SUBSTATUS_3
const ENEMY_SUBSTATUS_3
const PLAYER_SUBSTATUS_4
const ENEMY_SUBSTATUS_4
const PLAYER_SUBSTATUS_5
const ENEMY_SUBSTATUS_5
const PLAYER_STATUS
const ENEMY_STATUS
const PLAYER_MOVE_ANIMATION
const ENEMY_MOVE_ANIMATION
const PLAYER_MOVE_EFFECT
const ENEMY_MOVE_EFFECT
const PLAYER_MOVE_POWER
const ENEMY_MOVE_POWER
const PLAYER_MOVE_TYPE
const ENEMY_MOVE_TYPE
const PLAYER_CUR_MOVE
const ENEMY_CUR_MOVE
const PLAYER_COUNTER_MOVE
const ENEMY_COUNTER_MOVE
const PLAYER_LAST_MOVE
const ENEMY_LAST_MOVE

872
engine/battle_start.asm Normal file
View File

@ -0,0 +1,872 @@
Predef_StartBattle: ; 8c20f
call Function8c26d
ld a, [rBGP]
ld [wcfc7], a
ld a, [rOBP0]
ld [wcfc8], a
ld a, [rOBP1]
ld [wcfc9], a
call DelayFrame
ld hl, hVBlank
ld a, [hl]
push af
ld [hl], $1
.loop
ld a, [wcf63]
bit 7, a
jr nz, .done
call FlashyTransitionToBattle
call DelayFrame
jr .loop
.done
ld a, [rSVBK]
push af
ld a, $5
ld [rSVBK], a
ld hl, Unkn1Pals
ld bc, $0040
xor a
call ByteFill
pop af
ld [rSVBK], a
ld a, %11111111
ld [wcfc7], a
call DmgToCgbBGPals
call DelayFrame
xor a
ld [hLCDStatCustom], a
ld [hLCDStatCustom + 1], a
ld [hLCDStatCustom + 2], a
ld [hSCY], a
ld a, $1
ld [rSVBK], a
pop af
ld [hVBlank], a
call DelayFrame
ret
; 8c26d
Function8c26d: ; 8c26d
ld a, [wLinkMode]
cp LINK_MOBILE
jr z, .mobile
callba Function6454
call UpdateSprites
call DelayFrame
call Function8c2a0
call Function8cf4f
jr .resume
.mobile
call LoadTrainerBattlePokeballTiles
.resume
ld a, SCREEN_HEIGHT_PX
ld [hWY], a
call DelayFrame
xor a
ld [hBGMapMode], a
ld hl, wcf63
xor a
rept 2
ld [hli], a
endr
ld [hl], a
call WipeLYOverrides
ret
; 8c2a0
Function8c2a0: ; 8c2a0
call LoadTrainerBattlePokeballTiles
ld hl, VBGMap0
call Function8c2cf
ret
; 8c2aa
LoadTrainerBattlePokeballTiles:
; Load the tiles used in the Pokeball Graphic that fills the screen
; at the start of every Trainer battle.
ld de, TrainerBattlePokeballTiles
ld hl, VTiles1 tile $7e
ld b, BANK(TrainerBattlePokeballTiles)
ld c, 2
call Request2bpp
ld a, [rVBK]
push af
ld a, $1
ld [rVBK], a
ld de, TrainerBattlePokeballTiles
ld hl, VTiles4 tile $7e
ld b, BANK(TrainerBattlePokeballTiles)
ld c, 2
call Request2bpp
pop af
ld [rVBK], a
ret
; 8c2cf
Function8c2cf: ; 8c2cf
ld a, [rSVBK]
push af
ld a, $6
ld [rSVBK], a
push hl
ld hl, w6_d000
ld bc, $28 * $10
.loop
ld [hl], -1
inc hl
dec bc
ld a, c
or b
jr nz, .loop
pop hl
ld de, w6_d000
ld b, BANK(Function8c2cf) ; BANK(@)
ld c, $28
call Request2bpp
pop af
ld [rSVBK], a
ret
; 8c2f4
TrainerBattlePokeballTiles: ; 8c2f4
INCBIN "gfx/overworld/trainer_battle_pokeball_tiles.2bpp"
FlashyTransitionToBattle: ; 8c314
ld a, [wcf63]
ld e, a
ld d, 0
ld hl, .jumptable
rept 2
add hl, de
endr
ld a, [hli]
ld h, [hl]
ld l, a
jp [hl]
; 8c323
.jumptable: ; 8c323 (23:4323)
dw StartTrainerBattle_DetermineWhichAnimation ; 00
; Animation 1: cave
dw StartTrainerBattle_LoadPokeBallGraphics ; 01
dw StartTrainerBattle_SetUpBGMap ; 02
dw StartTrainerBattle_Flash ; 03
dw StartTrainerBattle_Flash ; 04
dw StartTrainerBattle_Flash ; 05
dw StartTrainerBattle_NextScene ; 06
dw StartTrainerBattle_SetUpForWavyOutro ; 07
dw StartTrainerBattle_SineWave ; 08
; Animation 2: cave, stronger
dw StartTrainerBattle_LoadPokeBallGraphics ; 09
dw StartTrainerBattle_SetUpBGMap ; 0a
dw StartTrainerBattle_Flash ; 0b
dw StartTrainerBattle_Flash ; 0c
dw StartTrainerBattle_Flash ; 0d
dw StartTrainerBattle_NextScene ; 0e
; There is no setup for this one
dw StartTrainerBattle_ZoomToBlack ; 0f
; Animation 3: no cave
dw StartTrainerBattle_LoadPokeBallGraphics ; 10
dw StartTrainerBattle_SetUpBGMap ; 11
dw StartTrainerBattle_Flash ; 12
dw StartTrainerBattle_Flash ; 13
dw StartTrainerBattle_Flash ; 14
dw StartTrainerBattle_NextScene ; 15
dw StartTrainerBattle_SetUpForSpinOutro ; 16
dw StartTrainerBattle_SpinToBlack ; 17
; Animation 4: no cave, stronger
dw StartTrainerBattle_LoadPokeBallGraphics ; 18
dw StartTrainerBattle_SetUpBGMap ; 19
dw StartTrainerBattle_Flash ; 1a
dw StartTrainerBattle_Flash ; 1b
dw StartTrainerBattle_Flash ; 1c
dw StartTrainerBattle_NextScene ; 1d
dw StartTrainerBattle_SetUpForRandomScatterOutro ; 1e
dw StartTrainerBattle_SpeckleToBlack ; 1f
; All animations jump to here.
dw StartTrainerBattle_Finish ; 20
StartTrainerBattle_DetermineWhichAnimation: ; 8c365 (23:4365)
; The screen flashes a different number of
; times depending on the level of your lead
; Pokemon relative to the opponent's.
ld de, 0
ld a, [BattleMonLevel]
add 3
ld hl, EnemyMonLevel
cp [hl]
jr nc, .okay
set 0, e
.okay
ld a, [wPermission]
cp CAVE
jr z, .okay2
cp PERM_5
jr z, .okay2
cp DUNGEON
jr z, .okay2
set 1, e
.okay2
ld hl, .StartingPoints
add hl, de
ld a, [hl]
ld [wcf63], a
ret
; 8c38f (23:438f)
.StartingPoints: ; 8c38f
db 1, 9
db 16, 24
; 8c393
StartTrainerBattle_Finish: ; 8c393 (23:4393)
call ClearSprites
ld a, $80
ld [wcf63], a
ret
StartTrainerBattle_NextScene: ; 8c39c (23:439c)
ld hl, wcf63
inc [hl]
ret
StartTrainerBattle_SetUpBGMap: ; 8c3a1 (23:43a1)
call StartTrainerBattle_NextScene
xor a
ld [wcf64], a
ld [hBGMapMode], a ; $ff00+$d4
ret
StartTrainerBattle_Flash: ; 8c3ab (23:43ab)
call .DoFlashAnimation
ret nc
call StartTrainerBattle_NextScene
ret
.DoFlashAnimation: ; 8c3b3 (23:43b3)
ld a, [wd847]
cp -1
jr z, .done
ld hl, wcf64
ld a, [hl]
inc [hl]
srl a
ld e, a
ld d, 0
ld hl, .pals
add hl, de
ld a, [hl]
cp %00000001
jr z, .done
ld [wcfc7], a
call DmgToCgbBGPals
and a
ret
.done
xor a
ld [wcf64], a
scf
ret
; 8c3db (23:43db)
.pals: ; 8c3db
db %11111001 ; 3321
db %11111110 ; 3332
db %11111111 ; 3333
db %11111110 ; 3332
db %11111001 ; 3321
db %11100100 ; 3210
db %10010000 ; 2100
db %01000000 ; 1000
db %00000000 ; 0000
db %01000000 ; 1000
db %10010000 ; 2100
db %11100100 ; 3210
db %00000001 ; 0001
; 8c3e8
StartTrainerBattle_SetUpForWavyOutro: ; 8c3e8 (23:43e8)
callba Function5602
ld a, $5
ld [rSVBK], a ; $ff00+$70
call StartTrainerBattle_NextScene
ld a, $43
ld [hLCDStatCustom], a ; $ff00+$c6
xor a
ld [hLCDStatCustom + 1], a
ld a, $90
ld [hLCDStatCustom + 2], a
xor a
ld [wcf64], a
ld [wcf65], a
ret
StartTrainerBattle_SineWave: ; 8c408 (23:4408)
ld a, [wcf64]
cp $60
jr nc, .end
call .DoSineWave
ret
.end
ld a, $20
ld [wcf63], a
ret
.DoSineWave: ; 8c419 (23:4419)
ld hl, wcf65
ld a, [hl]
inc [hl]
ld hl, wcf64
ld d, [hl]
add [hl]
ld [hl], a
ld a, $90
ld bc, wd100
ld e, $0
.loop
push af
push de
ld a, e
call StartTrainerBattle_DrawSineWave
ld [bc], a
inc bc
pop de
ld a, e
add $2
ld e, a
pop af
dec a
jr nz, .loop
ret
StartTrainerBattle_SetUpForSpinOutro: ; 8c43d (23:443d)
callba Function5602
ld a, $5
ld [rSVBK], a ; $ff00+$70
call StartTrainerBattle_NextScene
xor a
ld [wcf64], a
ret
spintable_entry: MACRO
db \1
dw .wedge\2
dwcoord \3, \4
ENDM
; quadrants
const_def
const UPPER_LEFT
const UPPER_RIGHT
const LOWER_LEFT
const LOWER_RIGHT
StartTrainerBattle_SpinToBlack: ; 8c44f (23:444f)
xor a
ld [hBGMapMode], a ; $ff00+$d4
ld a, [wcf64]
ld e, a
ld d, 0
ld hl, .spintable
rept 5
add hl, de
endr
ld a, [hli]
cp -1
jr z, .end
ld [wcf65], a
call .load
ld a, $1
ld [hBGMapMode], a ; $ff00+$d4
call DelayFrame
call DelayFrame
ld hl, wcf64
inc [hl]
ret
.end
ld a, $1
ld [hBGMapMode], a ; $ff00+$d4
call DelayFrame
call DelayFrame
call DelayFrame
xor a
ld [hBGMapMode], a ; $ff00+$d4
ld a, $20
ld [wcf63], a
ret
; 8c490 (23:4490)
.spintable: ; 8c490
spintable_entry UPPER_LEFT, 1, 1, 6
spintable_entry UPPER_LEFT, 2, 0, 3
spintable_entry UPPER_LEFT, 3, 1, 0
spintable_entry UPPER_LEFT, 4, 5, 0
spintable_entry UPPER_LEFT, 5, 9, 0
spintable_entry UPPER_RIGHT, 5, 10, 0
spintable_entry UPPER_RIGHT, 4, 14, 0
spintable_entry UPPER_RIGHT, 3, 18, 0
spintable_entry UPPER_RIGHT, 2, 19, 3
spintable_entry UPPER_RIGHT, 1, 18, 6
spintable_entry LOWER_RIGHT, 1, 18, 11
spintable_entry LOWER_RIGHT, 2, 19, 14
spintable_entry LOWER_RIGHT, 3, 18, 17
spintable_entry LOWER_RIGHT, 4, 14, 17
spintable_entry LOWER_RIGHT, 5, 10, 17
spintable_entry LOWER_LEFT, 5, 9, 17
spintable_entry LOWER_LEFT, 4, 5, 17
spintable_entry LOWER_LEFT, 3, 1, 17
spintable_entry LOWER_LEFT, 2, 0, 14
spintable_entry LOWER_LEFT, 1, 1, 11
db -1
; 8c4f5
.load: ; 8c4f5 (23:44f5)
ld a, [hli]
ld e, a
ld a, [hli]
ld d, a
ld a, [hli]
ld h, [hl]
ld l, a
.loop
push hl
ld a, [de]
ld c, a
inc de
.loop1
ld [hl], $ff
ld a, [wcf65]
bit 0, a
jr z, .leftside
inc hl
jr .okay1
.leftside
dec hl
.okay1
dec c
jr nz, .loop1
pop hl
ld a, [wcf65]
bit 1, a
ld bc, SCREEN_WIDTH
jr z, .upper
ld bc, -SCREEN_WIDTH
.upper
add hl, bc
ld a, [de]
inc de
cp -1
ret z
and a
jr z, .loop
ld c, a
.loop2
ld a, [wcf65]
bit 0, a
jr z, .leftside2
dec hl
jr .okay2
.leftside2
inc hl
.okay2
dec c
jr nz, .loop2
jr .loop
; 8c538 (23:4538)
.wedge1: db 2, 3, 5, 4, 9, -1
.wedge2: db 1, 1, 2, 2, 4, 2, 4, 2, 3, -1
.wedge3: db 2, 1, 3, 1, 4, 1, 4, 1, 4, 1, 3, 1, 2, 1, 1, 1, 1, -1
.wedge4: db 4, 1, 4, 0, 3, 1, 3, 0, 2, 1, 2, 0, 1, -1
.wedge5: db 4, 0, 3, 0, 3, 0, 2, 0, 2, 0, 1, 0, 1, 0, 1, -1
; 8c578
StartTrainerBattle_SetUpForRandomScatterOutro: ; 8c578 (23:4578)
callba Function5602
ld a, $5
ld [rSVBK], a ; $ff00+$70
call StartTrainerBattle_NextScene
ld a, $10
ld [wcf64], a
ld a, $1
ld [hBGMapMode], a ; $ff00+$d4
ret
StartTrainerBattle_SpeckleToBlack: ; 8c58f (23:458f)
ld hl, wcf64
ld a, [hl]
and a
jr z, .done
dec [hl]
ld c, $c
.loop
push bc
call .BlackOutRandomTile
pop bc
dec c
jr nz, .loop
ret
.done
ld a, $1
ld [hBGMapMode], a ; $ff00+$d4
call DelayFrame
call DelayFrame
call DelayFrame
xor a
ld [hBGMapMode], a ; $ff00+$d4
ld a, $20
ld [wcf63], a
ret
.BlackOutRandomTile: ; 8c5b8 (23:45b8)
.y_loop
call Random
cp SCREEN_HEIGHT
jr nc, .y_loop
ld b, a
.x_loop
call Random
cp SCREEN_WIDTH
jr nc, .x_loop
ld c, a
hlcoord 0, -1
ld de, SCREEN_WIDTH
inc b
.row_loop
add hl, de
dec b
jr nz, .row_loop
add hl, bc
; If the tile has already been blacked out,
; sample a new tile
ld a, [hl]
cp $ff
jr z, .y_loop
ld [hl], $ff
ret
StartTrainerBattle_LoadPokeBallGraphics: ; 8c5dc (23:45dc)
ld a, [OtherTrainerClass]
and a
jp z, .nextscene
xor a
ld [hBGMapMode], a ; $ff00+$d4
hlcoord 0, 0, AttrMap
ld bc, SCREEN_HEIGHT * SCREEN_WIDTH
inc b
inc c
jr .enter_loop_midway
.loop
ld a, [hl]
or %00000111
ld [hli], a
.enter_loop_midway
dec c
jr nz, .loop
dec b
jr nz, .loop
call .loadpokeballgfx ; load a, [OtherTrainerClass] \ ld de, PokeBallTransition
hlcoord 2, 1
ld b, SCREEN_WIDTH - 4
.loop2
push hl
ld c, 2
.loop3
push hl
ld a, [de]
inc de
.loop4
; Loading is done bit by bit
and a
jr z, .done
sla a
jr nc, .no_load
ld [hl], $fe ; "8"
.no_load
inc hl
jr .loop4
.done
pop hl
push bc
ld bc, (SCREEN_WIDTH - 4) / 2
add hl, bc
pop bc
dec c
jr nz, .loop3
pop hl
push bc
ld bc, SCREEN_WIDTH
add hl, bc
pop bc
dec b
jr nz, .loop2
ld a, [hCGB] ; $ff00+$e6
and a
jr nz, .cgb
ld a, $1
ld [hBGMapMode], a ; $ff00+$d4
call DelayFrame
call DelayFrame
jr .nextscene
.cgb
ld hl, .daypals
ld a, [TimeOfDayPal]
and (1 << 2) - 1
cp 3
jr nz, .daytime
ld hl, .nightpals
.daytime
ld a, [rSVBK] ; $ff00+$70
push af
ld a, $5 ; WRAM5 = palettes
ld [rSVBK], a ; $ff00+$70
call .copypals
push hl
ld de, Unkn1Pals + 8 * 7
ld bc, $8
call CopyBytes
pop hl
ld de, BGPals + 8 * 7
ld bc, $8
call CopyBytes
pop af
ld [rSVBK], a ; $ff00+$70
ld a, $1
ld [hCGBPalUpdate], a ; $ff00+$e5
call DelayFrame
call Function8cf4f
.nextscene: ; 8c673 (23:4673)
call StartTrainerBattle_NextScene
ret
.copypals: ; 8c677 (23:4677)
ld de, Unkn1Pals + 8 * 7
call .copy
ld de, BGPals + 8 * 7
call .copy
ld de, Unkn2Pals + 8 * 6
call .copy
ld de, OBPals + 8 * 6
call .copy
ld de, Unkn2Pals + 8 * 7
call .copy
ld de, OBPals + 8 * 7
.copy: ; 8c698 (23:4698)
push hl
ld bc, $8
call CopyBytes
pop hl
ret
; 8c6a1 (23:46a1)
.daypals: ; 8c6a1
RGB 31, 18, 29
RGB 31, 11, 15
RGB 31, 05, 05
RGB 07, 07, 07
; 8c6a9
.nightpals: ; 8c6a9
RGB 31, 18, 29
RGB 31, 05, 05
RGB 31, 05, 05
RGB 31, 05, 05
.loadpokeballgfx:
ld a, [OtherTrainerClass]
ld de, PokeBallTransition
ret
PokeBallTransition:
db %00000011, %11000000
db %00001111, %11110000
db %00111100, %00111100
db %00110000, %00001100
db %01100000, %00000110
db %01100011, %11000110
db %11000110, %01100011
db %11111100, %00111111
db %11111100, %00111111
db %11000110, %01100011
db %01100011, %11000110
db %01100000, %00000110
db %00110000, %00001100
db %00111100, %00111100
db %00001111, %11110000
db %00000011, %11000000
WipeLYOverrides: ; 8c6d8
ld a, [rSVBK]
push af
ld a, $5
ld [rSVBK], a
ld hl, LYOverrides
call .wipe
ld hl, LYOverridesBackup
call .wipe
pop af
ld [rSVBK], a
ret
; 8c6ef
.wipe: ; 8c6ef
xor a
ld c, SCREEN_HEIGHT_PX
.loop
ld [hli], a
dec c
jr nz, .loop
ret
; 8c6f7
StartTrainerBattle_DrawSineWave: ; 8c6f7 (23:46f7)
and (1 << 6) - 1
cp 1 << 5
jr nc, .okay
call .DoSineWave
ld a, h
ret
.okay
and (1 << 5) - 1
call .DoSineWave
ld a, h
xor -1 ; cpl
inc a
ret
.DoSineWave: ; 8c70c (23:470c)
ld e, a
ld a, d
ld d, 0
ld hl, .sinewave
rept 2
add hl, de
endr
ld e, [hl]
inc hl
ld d, [hl]
ld hl, 0
.loop
srl a
jr nc, .skip
add hl, de
.skip
sla e
rl d
and a
jr nz, .loop
ret
; 8c728 (23:4728)
.sinewave: ; 8c728
sine_wave $100
; 8c768
zoombox: macro
; width, height, start y, start x
db \1, \2
dwcoord \3, \4
endm
StartTrainerBattle_ZoomToBlack: ; 8c768 (23:4768)
callba Function5602
ld de, .boxes
.loop
ld a, [de]
cp -1
jr z, .done
inc de
ld c, a
ld a, [de]
inc de
ld b, a
ld a, [de]
inc de
ld l, a
ld a, [de]
inc de
ld h, a
xor a
ld [hBGMapMode], a ; $ff00+$d4
call .Copy
call WaitBGMap
jr .loop
.done
ld a, $20
ld [wcf63], a
ret
; 8c792 (23:4792)
.boxes: ; 8c792
zoombox 4, 2, 8, 8
zoombox 6, 4, 7, 7
zoombox 8, 6, 6, 6
zoombox 10, 8, 5, 5
zoombox 12, 10, 4, 4
zoombox 14, 12, 3, 3
zoombox 16, 14, 2, 2
zoombox 18, 16, 1, 1
zoombox 20, 18, 0, 0
db -1
; 8c7b7
.Copy: ; 8c7b7 (23:47b7)
ld a, $ff
.row
push bc
push hl
.col
ld [hli], a
dec c
jr nz, .col
pop hl
ld bc, SCREEN_WIDTH
add hl, bc
pop bc
dec b
jr nz, .row
ret
; 8c7c9 (23:47c9)

View File

@ -506,7 +506,7 @@ endr
; 9693a ; 9693a
Function9693a: ; 9693a Function9693a: ; 9693a
ld a, [InLinkBattle] ld a, [wLinkMode]
and a and a
jr nz, .nothing jr nz, .nothing
@ -957,7 +957,7 @@ SelectMenuCallback: ; 96b66
CountStep: ; 96b79 CountStep: ; 96b79
ld a, [InLinkBattle] ld a, [wLinkMode]
and a and a
jr nz, .done jr nz, .done

View File

@ -1112,7 +1112,7 @@ Function107bb: ; 107bb
ld a, [InputType] ld a, [InputType]
or a or a
jr z, .asm_107ca jr z, .asm_107ca
callba Function1de28f callba _DudeAutoInput_RightA
.asm_107ca .asm_107ca
call Function107d7 call Function107d7

View File

@ -3,7 +3,7 @@
Functiond0000: ; d0000 Functiond0000: ; d0000
hlcoord 12, 0 hlcoord 12, 0
ld a, [IsInBattle] ld a, [wBattleMode]
cp $1 cp $1
jr z, .asm_d0012 jr z, .asm_d0012
ld e, $0 ld e, $0

View File

@ -106,7 +106,7 @@ UpdateEnemyMonInParty:: ; 39b0
; Update level, status, current HP ; Update level, status, current HP
; No wildmons. ; No wildmons.
ld a, [IsInBattle] ld a, [wBattleMode]
dec a dec a
ret z ret z
@ -194,34 +194,6 @@ endr
dw .status, .statusopp, .animation, .effect, .power, .type dw .status, .statusopp, .animation, .effect, .power, .type
dw .curmove, .lastcounter, .lastcounteropp, .lastmove, .lastmoveopp dw .curmove, .lastcounter, .lastcounteropp, .lastmove, .lastmoveopp
const_def
const PLAYER_SUBSTATUS_1
const ENEMY_SUBSTATUS_1
const PLAYER_SUBSTATUS_2
const ENEMY_SUBSTATUS_2
const PLAYER_SUBSTATUS_3
const ENEMY_SUBSTATUS_3
const PLAYER_SUBSTATUS_4
const ENEMY_SUBSTATUS_4
const PLAYER_SUBSTATUS_5
const ENEMY_SUBSTATUS_5
const PLAYER_STATUS
const ENEMY_STATUS
const PLAYER_MOVE_ANIMATION
const ENEMY_MOVE_ANIMATION
const PLAYER_MOVE_EFFECT
const ENEMY_MOVE_EFFECT
const PLAYER_MOVE_POWER
const ENEMY_MOVE_POWER
const PLAYER_MOVE_TYPE
const ENEMY_MOVE_TYPE
const PLAYER_CUR_MOVE
const ENEMY_CUR_MOVE
const PLAYER_COUNTER_MOVE
const ENEMY_COUNTER_MOVE
const PLAYER_LAST_MOVE
const ENEMY_LAST_MOVE
; player enemy ; player enemy
.substatus1 db PLAYER_SUBSTATUS_1, ENEMY_SUBSTATUS_1 .substatus1 db PLAYER_SUBSTATUS_1, ENEMY_SUBSTATUS_1
.substatus1opp db ENEMY_SUBSTATUS_1, PLAYER_SUBSTATUS_1 .substatus1opp db ENEMY_SUBSTATUS_1, PLAYER_SUBSTATUS_1
@ -293,8 +265,8 @@ CELL_PHONE_TOP EQU $5e
CELL_PHONE_BOTTOM EQU $5f CELL_PHONE_BOTTOM EQU $5f
; For mobile link battles only. ; For mobile link battles only.
ld a, [InLinkBattle] ld a, [wLinkMode]
cp 4 cp LINK_MOBILE
ret c ret c
; Draw a cell phone icon at the ; Draw a cell phone icon at the

View File

@ -227,7 +227,7 @@ Request2bpp:: ; eba
ld a, $8 ld a, $8
ld [$ffd3], a ld [$ffd3], a
ld a, [InLinkBattle] ld a, [wLinkMode]
cp $4 cp $4
jr nz, .okay jr nz, .okay
ld a, [$ffe9] ld a, [$ffe9]
@ -301,7 +301,7 @@ Request1bpp:: ; f1e
ld a, $8 ld a, $8
ld [$ffd3], a ld [$ffd3], a
ld a, [InLinkBattle] ld a, [wLinkMode]
cp $4 cp $4
jr nz, .NotMobile jr nz, .NotMobile
ld a, [$ffe9] ld a, [$ffe9]

View File

@ -198,14 +198,14 @@ GetJoypad:: ; 984
.updateauto .updateauto
; An input of $ff will end the stream. ; An input of $ff will end the stream.
ld a, [hli] ld a, [hli]
cp a, $ff cp a, -1
jr z, .stopauto jr z, .stopauto
ld b, a ld b, a
; A duration of $ff will end the stream indefinitely. ; A duration of $ff will end the stream indefinitely.
ld a, [hli] ld a, [hli]
ld [AutoInputLength], a ld [AutoInputLength], a
cp a, $ff cp a, -1
jr nz, .next jr nz, .next
; The current input is overwritten. ; The current input is overwritten.
@ -362,17 +362,20 @@ Functiona80:: ; a80
push af push af
xor a xor a
ld [hConnectionStripLength], a ld [hConnectionStripLength], a
ld a, $6 ld a, 6
ld [hConnectedMapWidth], a ld [hConnectedMapWidth], a
.asm_a8d
.loop
push hl push hl
hlcoord 18, 17 hlcoord 18, 17
call Functionb06 call Functionb06
pop hl pop hl
call JoyTextDelay call JoyTextDelay
ld a, [hJoyLast] ld a, [hJoyLast]
and $3 and A_BUTTON | B_BUTTON
jr z, .asm_a8d jr z, .loop
pop af pop af
ld [hConnectedMapWidth], a ld [hConnectedMapWidth], a
pop af pop af
@ -381,67 +384,69 @@ Functiona80:: ; a80
; aa5 ; aa5
Functionaa5:: ; aa5 Functionaa5:: ; aa5
.loop
call JoyTextDelay call JoyTextDelay
ld a, [hJoyLast] ld a, [hJoyLast]
and A_BUTTON | B_BUTTON and A_BUTTON | B_BUTTON
jr z, Functionaa5 jr z, .loop
ret ret
; aaf ; aaf
KeepTextOpen:: ; aaf KeepTextOpen:: ; aaf
ld a, [InLinkBattle] ld a, [wLinkMode]
and a and a
jr nz, .asm_ac1 jr nz, .link
call Functionac6 call .wait_input
push de push de
ld de, SFX_READ_TEXT_2 ld de, SFX_READ_TEXT_2
call PlaySFX call PlaySFX
pop de pop de
ret ret
.asm_ac1 .link
ld c, 65 ld c, 65
jp DelayFrames jp DelayFrames
; ac6 ; ac6
Functionac6:: ; ac6 .wait_input: ; ac6
ld a, [hOAMUpdate] ld a, [hOAMUpdate]
push af push af
ld a, $1 ld a, $1
ld [hOAMUpdate], a ld [hOAMUpdate], a
ld a, [InputType] ld a, [InputType]
or a or a
jr z, .asm_ad9 jr z, .input_wait_loop
callba Function1de28a callba _DudeAutoInput_A
.asm_ad9
call Functionaf5 .input_wait_loop
call .blink_cursor
call JoyTextDelay call JoyTextDelay
ld a, [hJoyPressed] ld a, [hJoyPressed]
and $3 and A_BUTTON | B_BUTTON
jr nz, .asm_af1 jr nz, .received_input
call RTC call RTC
ld a, $1 ld a, $1
ld [hBGMapMode], a ld [hBGMapMode], a
call DelayFrame call DelayFrame
jr .asm_ad9 jr .input_wait_loop
.asm_af1 .received_input
pop af pop af
ld [hOAMUpdate], a ld [hOAMUpdate], a
ret ret
; af5 ; af5
Functionaf5:: ; af5 .blink_cursor: ; af5
ld a, [$ff9b] ld a, [$ff9b]
and $10 and %00010000 ; bit 4, a
jr z, .asm_aff jr z, .cursor_off
ld a, $ee ld a, "▼"
jr .asm_b02 jr .load_cursor_state
.asm_aff .cursor_off
ld a, [TileMap + 17 + 17 * SCREEN_WIDTH] ld a, [TileMap + 17 + 17 * SCREEN_WIDTH]
.asm_b02 .load_cursor_state
ld [TileMap + 18 + 17 * SCREEN_WIDTH], a ld [TileMap + 18 + 17 * SCREEN_WIDTH], a
ret ret
; b06 ; b06
@ -450,7 +455,7 @@ Functionb06:: ; b06
push bc push bc
ld a, [hl] ld a, [hl]
ld b, a ld b, a
ld a, $ee ld a, "▼"
cp b cp b
pop bc pop bc
jr nz, .asm_b27 jr nz, .asm_b27
@ -462,11 +467,11 @@ Functionb06:: ; b06
dec a dec a
ld [hConnectedMapWidth], a ld [hConnectedMapWidth], a
ret nz ret nz
ld a, $7a ld a, "─"
ld [hl], a ld [hl], a
ld a, $ff ld a, -1
ld [hConnectionStripLength], a ld [hConnectionStripLength], a
ld a, $6 ld a, 6
ld [hConnectedMapWidth], a ld [hConnectedMapWidth], a
ret ret

View File

@ -334,7 +334,7 @@ Function87d:: ; 87d
Function8c1:: ; 8c1 Function8c1:: ; 8c1
push bc push bc
ld b, $60 ld b, $60
ld a, [InLinkBattle] ld a, [wLinkMode]
cp $1 cp $1
jr z, .asm_8d7 jr z, .asm_8d7
ld b, $60 ld b, $60
@ -391,7 +391,7 @@ Function908:: ; 908
; 919 ; 919
Function919:: ; 919 Function919:: ; 919
ld a, [InLinkBattle] ld a, [wLinkMode]
and a and a
ret nz ret nz
ld a, $2 ld a, $2

View File

@ -389,7 +389,7 @@ PlaceMoveTargetsName_5A: ; 1205
PlaceEnemysName:: ; 121b PlaceEnemysName:: ; 121b
push de push de
ld a, [InLinkBattle] ld a, [wLinkMode]
and a and a
jr nz, .linkbattle jr nz, .linkbattle
@ -428,9 +428,9 @@ PlaceGenderedPlayerName:: ; 1252
ld l, c ld l, c
ld a, [PlayerGender] ld a, [PlayerGender]
bit 0, a bit 0, a
ld de, String12a5 ld de, String_kun
jr z, PlaceCommandCharacter jr z, PlaceCommandCharacter
ld de, String12a6 ld de, String_chan
jr PlaceCommandCharacter jr PlaceCommandCharacter
@ -456,8 +456,8 @@ String12a2:: db " @" ; 12a2
Char35Text:: Char35Text::
Char36Text:: Char36Text::
Char37Text:: db "@" ; 12a4 Char37Text:: db "@" ; 12a4
String12a5:: db "@" ; 12a5 String_kun:: db "@" ; 12a5
String12a6:: db "@" ; 12a6 String_chan:: db "@" ; 12a6
; 12a7 ; 12a7
NextLineChar:: ; 12a7 NextLineChar:: ; 12a7
@ -483,31 +483,31 @@ TextFar:: ; 12b9
add hl, bc add hl, bc
ld de, -SCREEN_WIDTH ld de, -SCREEN_WIDTH
ld c, 1 ld c, 1
.asm_12c4 .loop
ld a, h ld a, h
and a and a
jr nz, .asm_12cd jr nz, .next
ld a, l ld a, l
cp SCREEN_WIDTH cp SCREEN_WIDTH
jr c, .asm_12d1 jr c, .done
.asm_12cd .next
add hl, de add hl, de
inc c inc c
jr .asm_12c4 jr .loop
.asm_12d1 .done
hlcoord 0, 0 hlcoord 0, 0
ld de, SCREEN_WIDTH ld de, SCREEN_WIDTH
ld a, c ld a, c
.asm_12d8 .loop2
and a and a
jr z, .asm_12df jr z, .done2
add hl, de add hl, de
dec a dec a
jr .asm_12d8 jr .loop2
.asm_12df .done2
pop de pop de
inc de inc de
ld a, [de] ld a, [de]
@ -529,20 +529,20 @@ LineChar:: ; 12ea
Paragraph:: ; 12f2 Paragraph:: ; 12f2
push de push de
ld a, [InLinkBattle] ld a, [wLinkMode]
cp $3 cp LINK_COLOSSEUM
jr z, .asm_1301 jr z, .linkbattle
cp $4 cp LINK_MOBILE
jr z, .asm_1301 jr z, .linkbattle
call Function13c7 call LoadBlinkingCursor
.asm_1301
.linkbattle
call Function13b6 call Function13b6
call KeepTextOpen call KeepTextOpen
hlcoord TEXTBOX_INNERX, TEXTBOX_INNERY hlcoord TEXTBOX_INNERX, TEXTBOX_INNERY
lb bc, TEXTBOX_INNERH - 1, TEXTBOX_INNERW lb bc, TEXTBOX_INNERH - 1, TEXTBOX_INNERW
call ClearBox call ClearBox
call Function13cd call UnloadBlinkingCursor
ld c, 20 ld c, 20
call DelayFrames call DelayFrames
hlcoord TEXTBOX_INNERX, TEXTBOX_INNERY hlcoord TEXTBOX_INNERX, TEXTBOX_INNERY
@ -552,26 +552,26 @@ Paragraph:: ; 12f2
Char4B:: ; 131f Char4B:: ; 131f
ld a, [InLinkBattle] ld a, [wLinkMode]
or a or a
jr nz, .asm_1328 jr nz, .communication
call Function13c7 call LoadBlinkingCursor
.asm_1328
.communication
call Function13b6 call Function13b6
push de push de
call KeepTextOpen call KeepTextOpen
pop de pop de
ld a, [InLinkBattle] ld a, [wLinkMode]
or a or a
call z, Function13cd call z, UnloadBlinkingCursor
Char4C:: ; 1337 Char4C:: ; 1337
push de push de
call Function138c call TextScroll
call Function138c call TextScroll
hlcoord TEXTBOX_INNERX, TEXTBOX_INNERY + 2 hlcoord TEXTBOX_INNERX, TEXTBOX_INNERY + 2
pop de pop de
jp NextChar jp NextChar
@ -602,22 +602,22 @@ PlaceDexEnd:: ; 1356
; 135a ; 135a
PromptText:: ; 135a PromptText:: ; 135a
ld a, [InLinkBattle] ld a, [wLinkMode]
cp $3 cp LINK_COLOSSEUM
jr z, .ok jr z, .ok
cp $4 cp LINK_MOBILE
jr z, .ok jr z, .ok
call Function13c7 call LoadBlinkingCursor
.ok
.ok
call Function13b6 call Function13b6
call KeepTextOpen call KeepTextOpen
ld a, [InLinkBattle] ld a, [wLinkMode]
cp $3 cp LINK_COLOSSEUM
jr z, DoneText jr z, DoneText
cp $4 cp LINK_MOBILE
jr z, DoneText jr z, DoneText
call Function13cd call UnloadBlinkingCursor
DoneText:: ; 137c DoneText:: ; 137c
pop hl pop hl
@ -634,19 +634,22 @@ NullChar:: ; 1383
jp NextChar jp NextChar
; 138c ; 138c
Function138c:: ; 138c TextScroll:: ; 138c
hlcoord TEXTBOX_INNERX, TEXTBOX_INNERY hlcoord TEXTBOX_INNERX, TEXTBOX_INNERY
decoord TEXTBOX_INNERX, TEXTBOX_INNERY - 1 decoord TEXTBOX_INNERX, TEXTBOX_INNERY - 1
ld a, TEXTBOX_INNERH - 1 ld a, TEXTBOX_INNERH - 1
.col .col
push af push af
ld c, TEXTBOX_INNERW ld c, TEXTBOX_INNERW
.row .row
ld a, [hli] ld a, [hli]
ld [de], a ld [de], a
inc de inc de
dec c dec c
jr nz, .row jr nz, .row
rept 2 rept 2
inc de inc de
endr endr
@ -656,6 +659,7 @@ endr
pop af pop af
dec a dec a
jr nz, .col jr nz, .col
hlcoord TEXTBOX_INNERX, TEXTBOX_INNERY + 2 hlcoord TEXTBOX_INNERX, TEXTBOX_INNERY + 2
ld a, " " ld a, " "
ld bc, TEXTBOX_INNERW ld bc, TEXTBOX_INNERW
@ -671,7 +675,9 @@ Function13b6:: ; 13b6
push af push af
ld a, 1 ld a, 1
ld [hOAMUpdate], a ld [hOAMUpdate], a
call WaitBGMap call WaitBGMap
pop af pop af
ld [hOAMUpdate], a ld [hOAMUpdate], a
pop bc pop bc
@ -682,15 +688,15 @@ Diacritic:: ; 13c6
ret ret
; 13c7 ; 13c7
Function13c7:: ; 13c7 LoadBlinkingCursor:: ; 13c7
ld a, "▼" ld a, "▼"
ld [TileMap + 18 + 17 * SCREEN_WIDTH], a ldcoord_a 18, 17
ret ret
; 13cd ; 13cd
Function13cd:: ; 13cd UnloadBlinkingCursor:: ; 13cd
ld a, [TileMap + 17 + 17 * SCREEN_WIDTH] lda_coord 17, 17
ld [TileMap + 18 + 17 * SCREEN_WIDTH], a ldcoord_a 18, 17
ret ret
; 13d4 ; 13d4
@ -722,19 +728,19 @@ PlaceWholeStringInBoxAtOnce:: ; 13e5
set 1, a set 1, a
ld [TextBoxFrame + 1], a ld [TextBoxFrame + 1], a
call Function13f6 call DoTextUntilTerminator
pop af pop af
ld [TextBoxFrame + 1], a ld [TextBoxFrame + 1], a
ret ret
; 13f6 ; 13f6
Function13f6:: ; 13f6 DoTextUntilTerminator:: ; 13f6
ld a, [hli] ld a, [hli]
cp "@" cp "@"
ret z ret z
call .TextCommand call .TextCommand
jr Function13f6 jr DoTextUntilTerminator
.TextCommand: .TextCommand:
push hl push hl
@ -757,19 +763,19 @@ endr
; 1410 ; 1410
TextCommands:: ; 1410 TextCommands:: ; 1410
dw Text_00 dw Text_TX
dw Text_01 dw Text_TX_RAM
dw Text_02 dw Text_TX_BCD
dw Text_03 dw Text_TX_MOVE
dw Text_04 dw Text_TX_BOX
dw Text_05 dw Text_TX_LOW
dw Text_06 dw Text_WAIT_BUTTON
dw Text_07 dw Text_TX_SCROLL
dw Text_08 dw Text_START_ASM
dw Text_09 dw Text_TX_NUM
dw Text_0A dw Text_TX_EXIT
dw Text_PlaySound ; $0b dw Text_PlaySound ; $0b
dw Text_0C dw Text_TX_DOTS
dw Text_0D dw Text_0D
dw Text_PlaySound ; $0e dw Text_PlaySound ; $0e
dw Text_PlaySound ; $0f dw Text_PlaySound ; $0f
@ -777,12 +783,12 @@ TextCommands:: ; 1410
dw Text_PlaySound ; $11 dw Text_PlaySound ; $11
dw Text_PlaySound ; $12 dw Text_PlaySound ; $12
dw Text_PlaySound ; $13 dw Text_PlaySound ; $13
dw Text_14 dw Text_TX_STRINGBUFFER
dw Text_15 dw Text_TX_DAY
dw Text_16 dw Text_TX_FAR
; 143e ; 143e
Text_00:: ; 143e Text_TX:: ; 143e
; TX ; TX
; write text until "@" ; write text until "@"
; [$00]["...@"] ; [$00]["...@"]
@ -798,7 +804,7 @@ Text_00:: ; 143e
ret ret
; 1449 ; 1449
Text_01:: ; 1449 Text_TX_RAM:: ; 1449
; text_from_ram ; text_from_ram
; write text from a ram address ; write text from a ram address
; little endian ; little endian
@ -816,7 +822,7 @@ Text_01:: ; 1449
ret ret
; 1455 ; 1455
Text_16:: ; 1455 Text_TX_FAR:: ; 1455
; text_jump ; text_jump
; write text from a different bank ; write text from a different bank
; little endian ; little endian
@ -837,7 +843,7 @@ Text_16:: ; 1455
push hl push hl
ld h, d ld h, d
ld l, e ld l, e
call Function13f6 call DoTextUntilTerminator
pop hl pop hl
pop af pop af
@ -846,7 +852,7 @@ Text_16:: ; 1455
ret ret
; 1470 ; 1470
Text_02:: ; 1470 Text_TX_BCD:: ; 1470
; TX_BCD ; TX_BCD
; write bcd from address, typically ram ; write bcd from address, typically ram
; [$02][addr][flags] ; [$02][addr][flags]
@ -868,7 +874,7 @@ Text_02:: ; 1470
ret ret
; 1480 ; 1480
Text_03:: ; 1480 Text_TX_MOVE:: ; 1480
; TX_MOVE ; TX_MOVE
; move to a new tile ; move to a new tile
; [$03][addr] ; [$03][addr]
@ -882,7 +888,7 @@ Text_03:: ; 1480
ret ret
; 148b ; 148b
Text_04:: ; 148b Text_TX_BOX:: ; 148b
; TX_BOX ; TX_BOX
; draw a box ; draw a box
; little endian ; little endian
@ -904,7 +910,7 @@ Text_04:: ; 148b
ret ret
; 149b ; 149b
Text_05:: ; 149b Text_TX_LOW:: ; 149b
; TX_LOW ; TX_LOW
; write text at (1,16) ; write text at (1,16)
; [$05] ; [$05]
@ -913,39 +919,41 @@ Text_05:: ; 149b
ret ret
; 149f ; 149f
Text_06:: ; 149f Text_WAIT_BUTTON:: ; 149f
; TX_WAITBUTTON ; TX_WAITBUTTON
; wait for button press ; wait for button press
; show arrow ; show arrow
; [06] ; [06]
ld a, [InLinkBattle] ld a, [wLinkMode]
cp $3 cp LINK_COLOSSEUM
jp z, Text_0D jp z, Text_0D
cp $4 cp LINK_MOBILE
jp z, Text_0D jp z, Text_0D
push hl push hl
call Function13c7 call LoadBlinkingCursor
push bc push bc
call KeepTextOpen call KeepTextOpen
pop bc pop bc
call Function13cd call UnloadBlinkingCursor
pop hl pop hl
ret ret
; 14ba ; 14ba
Text_07:: ; 14ba Text_TX_SCROLL:: ; 14ba
; pushes text up two lines and sets the BC cursor to the border tile
; below the first character column of the text box.
push hl push hl
call Function13cd call UnloadBlinkingCursor
call Function138c call TextScroll
call Function138c call TextScroll
pop hl pop hl
bccoord TEXTBOX_INNERX, TEXTBOX_INNERY + 2 bccoord TEXTBOX_INNERX, TEXTBOX_INNERY + 2
ret ret
; 14c9 ; 14c9
Text_08:: ; 14c9 Text_START_ASM:: ; 14c9
; TX_ASM ; TX_ASM
bit 7, h bit 7, h
@ -958,7 +966,7 @@ Text_08:: ; 14c9
ret ret
; 14d2 ; 14d2
Text_09:: ; 14d2 Text_TX_NUM:: ; 14d2
; TX_NUM ; TX_NUM
; [$09][addr][hi:bytes lo:digits] ; [$09][addr][hi:bytes lo:digits]
ld a, [hli] ld a, [hli]
@ -984,7 +992,7 @@ Text_09:: ; 14d2
ret ret
; 14ed ; 14ed
Text_0A:: ; 14ed Text_TX_EXIT:: ; 14ed
push hl push hl
push bc push bc
call GetJoypad call GetJoypad
@ -1059,13 +1067,14 @@ TextSFX:: ; 152d
db -1 db -1
; 1543 ; 1543
Text_0C:: ; 1543 Text_TX_DOTS:: ; 1543
; [$0C][num] ; [$0C][num]
ld a, [hli] ld a, [hli]
ld d, a ld d, a
push hl push hl
ld h, b ld h, b
ld l, c ld l, c
.loop .loop
push de push de
ld a, "…" ld a, "…"
@ -1080,6 +1089,7 @@ Text_0C:: ; 1543
pop de pop de
dec d dec d
jr nz, .loop jr nz, .loop
ld b, h ld b, h
ld c, l ld c, l
pop hl pop hl
@ -1097,7 +1107,7 @@ Text_0D:: ; 1562
ret ret
; 156a ; 156a
Text_14:: ; 156a Text_TX_STRINGBUFFER:: ; 156a
; Print a string from one of the following: ; Print a string from one of the following:
; 0: StringBuffer3 ; 0: StringBuffer3
; 1: StringBuffer4 ; 1: StringBuffer4
@ -1127,7 +1137,7 @@ endr
ret ret
; 1582 ; 1582
Text_15:: ; 1582 Text_TX_DAY:: ; 1582
; TX_DAY ; TX_DAY
call GetWeekday call GetWeekday

View File

@ -208,7 +208,7 @@ FriendBall:
MoonBall: MoonBall:
LoveBall: LoveBall:
ParkBall: ; e8a2 ParkBall: ; e8a2
ld a, [IsInBattle] ld a, [wBattleMode]
dec a dec a
jp nz, Functionf7a0 jp nz, Functionf7a0
@ -1657,7 +1657,7 @@ Functionf0d6: ; f0d6
call Functionf30d call Functionf30d
ld a, 1 ld a, 1
ret nz ret nz
ld a, [IsInBattle] ld a, [wBattleMode]
and a and a
jr z, .asm_f104 jr z, .asm_f104
@ -1936,7 +1936,7 @@ Functionf2a2: ; f2a2 (3:72a2)
ret ret
Functionf2a6: ; f2a6 (3:72a6) Functionf2a6: ; f2a6 (3:72a6)
ld a, [IsInBattle] ld a, [wBattleMode]
and a and a
ret z ret z
ld a, [CurPartyMon] ld a, [CurPartyMon]
@ -2280,7 +2280,7 @@ XAccuracy: ; f482
PokeDoll: ; f48f PokeDoll: ; f48f
ld a, [IsInBattle] ld a, [wBattleMode]
dec a dec a
jr nz, .asm_f4a6 jr nz, .asm_f4a6
inc a inc a
@ -2362,7 +2362,7 @@ Tablef504: ; f504
PokeFlute: ; f50c PokeFlute: ; f50c
ld a, [IsInBattle] ld a, [wBattleMode]
and a and a
jr nz, .asm_f512 jr nz, .asm_f512
.asm_f512 .asm_f512
@ -2375,7 +2375,7 @@ PokeFlute: ; f50c
ld hl, PartyMon1Status ld hl, PartyMon1Status
call .Functionf554 call .Functionf554
ld a, [IsInBattle] ld a, [wBattleMode]
cp WILD_BATTLE cp WILD_BATTLE
jr z, .asm_f52b jr z, .asm_f52b
ld hl, OTPartyMon1Status ld hl, OTPartyMon1Status
@ -2448,7 +2448,7 @@ UnknownText_0xf576: ; 0xf576
Function_0xf57b: ; f57b Function_0xf57b: ; f57b
ld a, [IsInBattle] ld a, [wBattleMode]
and a and a
jr nz, .asm_f58c jr nz, .asm_f58c
@ -2600,7 +2600,7 @@ Functionf64c: ; f64c
; f652 ; f652
Functionf652: ; f652 Functionf652: ; f652
ld a, [IsInBattle] ld a, [wBattleMode]
and a and a
jr z, .asm_f66c jr z, .asm_f66c
ld a, [CurPartyMon] ld a, [CurPartyMon]

View File

@ -111,7 +111,7 @@ dwcoord: MACRO
endr endr
ENDM ENDM
ldcoord: MACRO ldcoord_a: MACRO
if _NARG < 3 if _NARG < 3
ld [TileMap + SCREEN_WIDTH * (\2) + (\1)], a ld [TileMap + SCREEN_WIDTH * (\2) + (\1)], a
else else
@ -119,6 +119,14 @@ ldcoord: MACRO
endc endc
ENDM ENDM
lda_coord: MACRO
if _NARG < 3
ld a, [TileMap + SCREEN_WIDTH * (\2) + (\1)]
else
ld a, [\3 + SCREEN_WIDTH * (\2) + (\1)]
endc
ENDM
; pic animations ; pic animations
frame: MACRO frame: MACRO
db \1 db \1

1471
main.asm

File diff suppressed because it is too large Load Diff

View File

@ -19,6 +19,7 @@ Function17a68f:: ; 17a68f (5e:668f)
pop de pop de
xor a xor a
ret ret
.asm_17a6a6 .asm_17a6a6
scf scf
ret ret
@ -82,6 +83,7 @@ Function17a713: ; 17a713 (5e:6713)
inc c inc c
and a and a
ret ret
.asm_17a71d .asm_17a71d
ld [hl], $ff ld [hl], $ff
scf scf
@ -113,10 +115,12 @@ Function17a721: ; 17a721 (5e:6721)
dec b dec b
jr nz, .asm_17a732 jr nz, .asm_17a732
ret ret
.asm_17a748 .asm_17a748
ld a, $ff ld a, $ff
ld [de], a ld [de], a
ret ret
.asm_17a74c .asm_17a74c
ld a, $f0 ld a, $f0
or c or c
@ -167,6 +171,7 @@ Function17a78f: ; 17a78f (5e:678f)
jr nz, .asm_17a79f jr nz, .asm_17a79f
callba Function10402d callba Function10402d
ret ret
.asm_17a79f .asm_17a79f
callba Function104061 callba Function104061
ret ret
@ -297,41 +302,49 @@ Function17a848: ; 17a848 (5e:6848)
jr nz, .asm_17a8a7 jr nz, .asm_17a8a7
xor a xor a
ret ret
.asm_17a876 .asm_17a876
ld a, $9 ld a, $9
call Function17aad0 call Function17aad0
scf scf
ret ret
.asm_17a87d .asm_17a87d
ld a, $a ld a, $a
call Function17aad0 call Function17aad0
scf scf
ret ret
.asm_17a884 .asm_17a884
ld a, $b ld a, $b
call Function17aad0 call Function17aad0
scf scf
ret ret
.asm_17a88b .asm_17a88b
ld a, $c ld a, $c
call Function17aad0 call Function17aad0
scf scf
ret ret
.asm_17a892 .asm_17a892
ld a, $5 ld a, $5
call Function17aad0 call Function17aad0
scf scf
ret ret
.asm_17a899 .asm_17a899
ld a, $6 ld a, $6
call Function17aad0 call Function17aad0
scf scf
ret ret
.asm_17a8a0 .asm_17a8a0
ld a, $7 ld a, $7
call Function17aad0 call Function17aad0
scf scf
ret ret
.asm_17a8a7 .asm_17a8a7
ld a, $8 ld a, $8
call Function17aad0 call Function17aad0
@ -347,6 +360,7 @@ Function17a8ae: ; 17a8ae (5e:68ae)
jr nz, .asm_17a8d7 jr nz, .asm_17a8d7
xor a xor a
ret ret
.asm_17a8bc .asm_17a8bc
ld a, $b ld a, $b
ld [$d08a], a ld [$d08a], a
@ -355,12 +369,14 @@ Function17a8ae: ; 17a8ae (5e:68ae)
call Function17aa88 call Function17aa88
scf scf
ret ret
.asm_17a8cc .asm_17a8cc
call Function17aad7 call Function17aad7
call Function17aa98 call Function17aa98
call Function17a8de call Function17a8de
scf scf
ret ret
.asm_17a8d7 .asm_17a8d7
ld a, $c ld a, $c
call Function17aad3 call Function17aad3
@ -383,16 +399,19 @@ Function17a8de: ; 17a8de (5e:68de)
ld [$d087], a ld [$d087], a
call Function17aa88 call Function17aa88
ret ret
.asm_17a8fd .asm_17a8fd
call Function17a943 call Function17a943
call Function17aa88 call Function17aa88
ret ret
.asm_17a904 .asm_17a904
call Function17aad7 call Function17aad7
call Function17aa98 call Function17aa98
call Function17a91e call Function17a91e
call Function17aa88 call Function17aa88
ret ret
.asm_17a911 .asm_17a911
call Function17aa98 call Function17aa98
ld a, $5 ld a, $5
@ -409,6 +428,7 @@ Function17a91e: ; 17a91e (5e:691e)
ld [$d087], a ld [$d087], a
xor a xor a
ret ret
.asm_17a92c .asm_17a92c
call Function1d6e call Function1d6e
call Function17a99e call Function17a99e
@ -436,6 +456,7 @@ Function17a943: ; 17a943 (5e:6943)
ld [$d087], a ld [$d087], a
and a and a
ret ret
.asm_17a95d .asm_17a95d
ld a, $5 ld a, $5
ld [$d087], a ld [$d087], a
@ -455,6 +476,7 @@ Function17a964: ; 17a964 (5e:6964)
ld [hl], e ld [hl], e
and a and a
ret ret
.asm_17a979 .asm_17a979
scf scf
ret ret
@ -479,6 +501,7 @@ Function17a97b: ; 17a97b (5e:697b)
dec c dec c
jr nz, .asm_17a990 jr nz, .asm_17a990
ret ret
.asm_17a99d .asm_17a99d
ret ret
@ -503,12 +526,13 @@ Function17a9cb: ; 17a9cb (5e:69cb)
ld de, Sprites ; $c400 ld de, Sprites ; $c400
ld hl, $d088 ld hl, $d088
bit 6, [hl] bit 6, [hl]
jr nz, .asm_17a9df jr nz, .bit_6_set
call Function17a9e3 call Function17a9e3
call Function17aa22 call Function17aa22
call Function17a9f5 call Function17a9f5
ret ret
.asm_17a9df
.bit_6_set
call Function17a9e3 call Function17a9e3
ret ret
@ -533,9 +557,9 @@ Function17a9f5: ; 17a9f5 (5e:69f5)
ld [$d08e], a ld [$d08e], a
ld a, [$d08c] ld a, [$d08c]
cp $10 cp $10
jr c, .asm_17aa0f jr c, .okay
dec a dec a
.asm_17aa0f .okay
ld c, $8 ld c, $8
call SimpleMultiply call SimpleMultiply
add $18 add $18
@ -581,7 +605,7 @@ Function17aa4a: ; 17aa4a (5e:6a4a)
add $10 add $10
ld c, a ld c, a
ld a, [hli] ld a, [hli]
.asm_17aa56 .loop
push af push af
ld a, [hli] ld a, [hli]
add c add c
@ -603,7 +627,7 @@ Function17aa4a: ; 17aa4a (5e:6a4a)
inc de inc de
pop af pop af
dec a dec a
jr nz, .asm_17aa56 jr nz, .loop
ret ret
; 17aa72 (5e:6a72) ; 17aa72 (5e:6a72)
@ -662,7 +686,7 @@ rept 2
ld [hli], a ld [hli], a
endr endr
pop hl pop hl
ld de, $14 ld de, SCREEN_WIDTH
add hl, de add hl, de
rept 2 rept 2
ld [hli], a ld [hli], a
@ -721,16 +745,20 @@ Function17aba0: ; 17aba0 (5e:6ba0)
push af push af
ld a, $1 ld a, $1
ld [rVBK], a ; $ff00+$4f ld [rVBK], a ; $ff00+$4f
ld hl, VTiles2 tile $00
ld hl, VTiles5 tile $00
ld de, GFX_17afa5 ld de, GFX_17afa5
lb bc, BANK(GFX_17afa5), $80 lb bc, BANK(GFX_17afa5), $80
call Get2bpp call Get2bpp
pop af pop af
ld [rVBK], a ; $ff00+$4f ld [rVBK], a ; $ff00+$4f
ld hl, VTiles0 tile $00 ld hl, VTiles0 tile $00
ld de, GFX_17afa5 + $4c0 ld de, GFX_17afa5 + $4c0
lb bc, BANK(GFX_17afa5), 5 lb bc, BANK(GFX_17afa5), 5
call Get2bpp call Get2bpp
ld hl, VTiles0 tile $05 ld hl, VTiles0 tile $05
ld de, GFX_11601a ld de, GFX_11601a
lb bc, BANK(GFX_11601a), 4 lb bc, BANK(GFX_11601a), 4
@ -740,25 +768,30 @@ Function17aba0: ; 17aba0 (5e:6ba0)
Function17abcf: ; 17abcf (5e:6bcf) Function17abcf: ; 17abcf (5e:6bcf)
ld a, [rSVBK] ; $ff00+$70 ld a, [rSVBK] ; $ff00+$70
push af push af
ld a, $5 ld a, BANK(Unkn1Pals)
ld [rSVBK], a ; $ff00+$70 ld [rSVBK], a ; $ff00+$70
ld hl, Palette_17ac55 ld hl, Palette_17ac55
ld de, Unkn1Pals ; $d000 ld de, Unkn1Pals ; $d000
ld bc, $30 ld bc, $30
call CopyBytes call CopyBytes
ld hl, Palette_17ac95 ld hl, Palette_17ac95
ld de, Unkn2Pals ld de, Unkn2Pals
ld bc, $40 ld bc, $40
call CopyBytes call CopyBytes
ld hl, GFX_17afa5 + $510 ld hl, GFX_17afa5 + $510
ld de, $d048 ld de, Unkn2Pals + 2 * 4
ld bc, $10 ld bc, $10
call CopyBytes call CopyBytes
ld hl, MapObjectPals + 8 ld hl, MapObjectPals + 8
ld de, $d058 ld de, Unkn2Pals + 6 * 4
ld bc, $8 ld bc, $8
ld a, BANK(MapObjectPals) ld a, BANK(MapObjectPals)
call FarCopyBytes call FarCopyBytes
pop af pop af
ld [rSVBK], a ; $ff00+$70 ld [rSVBK], a ; $ff00+$70
ret ret
@ -767,42 +800,43 @@ Function17ac0c: ; 17ac0c (5e:6c0c)
call Function17ac1d call Function17ac1d
call Function17ac2a call Function17ac2a
hlcoord 0, 0 hlcoord 0, 0
ld b, $2 ld b, 2
ld c, $12 ld c, SCREEN_WIDTH - 2
call Function17ac46 call Function17ac46
ret ret
Function17ac1d: ; 17ac1d (5e:6c1d) Function17ac1d: ; 17ac1d (5e:6c1d)
ld hl, Tilemap_17acd5 ld hl, Tilemap_17acd5
decoord 0, 4 decoord 0, 4
ld bc, $118 ld bc, (SCREEN_HEIGHT - 4) * SCREEN_WIDTH
call CopyBytes call CopyBytes
ret ret
Function17ac2a: ; 17ac2a (5e:6c2a) Function17ac2a: ; 17ac2a (5e:6c2a)
ld hl, Tilemap_17ae3d ld hl, Tilemap_17ae3d
decoord 0, 4, AttrMap decoord 0, 4, AttrMap
ld bc, $118 ld bc, (SCREEN_HEIGHT - 4) * SCREEN_WIDTH
call CopyBytes call CopyBytes
hlcoord 0, 4, AttrMap hlcoord 0, 4, AttrMap
ld bc, $118 ld bc, (SCREEN_HEIGHT - 4) * SCREEN_WIDTH
.asm_17ac3c .loop
ld a, [hl] ld a, [hl]
or $8 or $8
ld [hli], a ld [hli], a
dec bc dec bc
ld a, b ld a, b
or c or c
jr nz, .asm_17ac3c jr nz, .loop
ret ret
Function17ac46: ; 17ac46 (5e:6c46) Function17ac46: ; 17ac46 (5e:6c46)
ld a, [$d088] ld a, [$d088]
bit 4, a bit 4, a
jr nz, .asm_17ac51 jr nz, .bit_4_set
call TextBox call TextBox
ret ret
.asm_17ac51
.bit_4_set
call Function3eea call Function3eea
ret ret
; 17ac55 (5e:6c55) ; 17ac55 (5e:6c55)
@ -812,30 +846,37 @@ Palette_17ac55: ; 17ac55
RGB 9, 10, 25 RGB 9, 10, 25
RGB 16, 19, 31 RGB 16, 19, 31
RGB 31, 31, 31 RGB 31, 31, 31
RGB 5, 11, 9 RGB 5, 11, 9
RGB 7, 14, 12 RGB 7, 14, 12
RGB 17, 24, 22 RGB 17, 24, 22
RGB 28, 31, 31 RGB 28, 31, 31
RGB 0, 0, 0 RGB 0, 0, 0
RGB 3, 0, 10 RGB 3, 0, 10
RGB 3, 3, 16 RGB 3, 3, 16
RGB 6, 8, 25 RGB 6, 8, 25
RGB 5, 11, 9 RGB 5, 11, 9
RGB 28, 31, 31 RGB 28, 31, 31
RGB 7, 14, 12 RGB 7, 14, 12
RGB 17, 24, 22 RGB 17, 24, 22
RGB 0, 0, 0 RGB 0, 0, 0
RGB 5, 2, 16 RGB 5, 2, 16
RGB 8, 8, 26 RGB 8, 8, 26
RGB 13, 9, 17 RGB 13, 9, 17
RGB 0, 0, 0 RGB 0, 0, 0
RGB 0, 0, 0 RGB 0, 0, 0
RGB 0, 0, 0 RGB 0, 0, 0
RGB 0, 0, 0 RGB 0, 0, 0
RGB 0, 0, 0 RGB 0, 0, 0
RGB 0, 0, 0 RGB 0, 0, 0
RGB 0, 0, 0 RGB 0, 0, 0
RGB 0, 0, 0 RGB 0, 0, 0
RGB 0, 0, 0 RGB 0, 0, 0
RGB 0, 0, 0 RGB 0, 0, 0
RGB 0, 0, 0 RGB 0, 0, 0
@ -846,30 +887,37 @@ Palette_17ac95: ; 17ac95
RGB 4, 3, 3 RGB 4, 3, 3
RGB 31, 13, 0 RGB 31, 13, 0
RGB 31, 31, 31 RGB 31, 31, 31
RGB 31, 31, 31 RGB 31, 31, 31
RGB 0, 0, 0 RGB 0, 0, 0
RGB 31, 31, 31 RGB 31, 31, 31
RGB 31, 31, 31 RGB 31, 31, 31
RGB 31, 0, 0 RGB 31, 0, 0
RGB 16, 3, 0 RGB 16, 3, 0
RGB 28, 19, 11 RGB 28, 19, 11
RGB 31, 31, 31 RGB 31, 31, 31
RGB 31, 16, 0 RGB 31, 16, 0
RGB 9, 6, 4 RGB 9, 6, 4
RGB 31, 16, 0 RGB 31, 16, 0
RGB 31, 24, 0 RGB 31, 24, 0
RGB 31, 18, 6 RGB 31, 18, 6
RGB 0, 3, 0 RGB 0, 3, 0
RGB 0, 9, 0 RGB 0, 9, 0
RGB 0, 12, 0 RGB 0, 12, 0
RGB 0, 16, 0 RGB 0, 16, 0
RGB 0, 22, 0 RGB 0, 22, 0
RGB 0, 25, 0 RGB 0, 25, 0
RGB 0, 27, 0 RGB 0, 27, 0
RGB 0, 31, 0 RGB 0, 31, 0
RGB 3, 31, 0 RGB 3, 31, 0
RGB 8, 31, 0 RGB 8, 31, 0
RGB 14, 31, 0 RGB 14, 31, 0
RGB 16, 31, 0 RGB 16, 31, 0
RGB 22, 31, 0 RGB 22, 31, 0
RGB 27, 31, 0 RGB 27, 31, 0

View File

@ -168,17 +168,17 @@ Function1000fa: ; 1000fa
ld [$ffc9], a ld [$ffc9], a
ld [$ffe9], a ld [$ffe9], a
ei ei
ld a, [InLinkBattle] ld a, [wLinkMode]
push af push af
xor a xor a
ld [InLinkBattle], a ld [wLinkMode], a
ld a, $4 ld a, $4
ld [wPartyMonMenuIconAnims + 5], a ld [wPartyMonMenuIconAnims + 5], a
callba Function11619d callba Function11619d
ld hl, wcd29 ld hl, wcd29
set 6, [hl] set 6, [hl]
pop af pop af
ld [InLinkBattle], a ld [wLinkMode], a
ret ret
; 100144 ; 100144
@ -1612,7 +1612,7 @@ Function100a09: ; 100a09
call Function100a2e call Function100a2e
ld [wd431], a ld [wd431], a
callba Function4000 callba Function4000
ld a, [InLinkBattle] ld a, [wLinkMode]
cp $4 cp $4
jr nz, .asm_100a2a jr nz, .asm_100a2a
call Function100a87 call Function100a87
@ -2134,7 +2134,7 @@ Function100db0: ; 100db0
Function100dc0: ; 100dc0 Function100dc0: ; 100dc0
ld a, [InLinkBattle] ld a, [wLinkMode]
cp $4 cp $4
jr nz, .asm_100dd0 jr nz, .asm_100dd0
ld hl, wcd2a ld hl, wcd2a
@ -2770,13 +2770,13 @@ Function1011f1: ; 1011f1
ld [wdc5f], a ld [wdc5f], a
ld [wdc60], a ld [wdc60], a
ld a, $4 ld a, $4
ld [InLinkBattle], a ld [wLinkMode], a
ret ret
; 101220 ; 101220
Function101220: ; 101220 Function101220: ; 101220
xor a xor a
ld [InLinkBattle], a ld [wLinkMode], a
ret ret
; 101225 ; 101225
@ -6802,7 +6802,7 @@ Function102e07: ; 102e07
hlcoord 3, 10 hlcoord 3, 10
ld b, $1 ld b, $1
ld c, $b ld c, $b
ld a, [IsInBattle] ld a, [wBattleMode]
and a and a
jr z, .asm_102e19 jr z, .asm_102e19
call TextBox call TextBox

View File

@ -5976,7 +5976,7 @@ Function1163c0: ; 1163c0
pop af pop af
ld [rSVBK], a ld [rSVBK], a
callba Function104061 callba Function104061
ld a, [InLinkBattle] ld a, [wLinkMode]
cp $4 cp $4
jr z, .asm_11642a jr z, .asm_11642a
ld a, $8 ld a, $8
@ -16146,10 +16146,10 @@ Function11b7e5: ; 11b7e5
ld a, $1 ld a, $1
ld [wd1e9], a ld [wd1e9], a
ld a, $2 ld a, $2
ld [InLinkBattle], a ld [wLinkMode], a
callba Function421d8 callba Function421d8
xor a xor a
ld [InLinkBattle], a ld [wLinkMode], a
callba Function14a58 callba Function14a58
ld a, $5 ld a, $5
call GetSRAMBank call GetSRAMBank
@ -22841,7 +22841,7 @@ RunBattleTowerBattle: ; 17024d
or $1 or $1
ld [InBattleTowerBattle], a ld [InBattleTowerBattle], a
xor a xor a
ld [InLinkBattle], a ld [wLinkMode], a
callba Mobile_HealParty callba Mobile_HealParty
callba HealParty callba HealParty
call Function1702b7 call Function1702b7

View File

@ -300,10 +300,10 @@ Function17d0f3: ; 17d0f3
ld a, $1 ld a, $1
ld [wd1e9], a ld [wd1e9], a
ld a, $2 ld a, $2
ld [InLinkBattle], a ld [wLinkMode], a
callba Function421d8 callba Function421d8
xor a xor a
ld [InLinkBattle], a ld [wLinkMode], a
callba Function14a58 callba Function14a58
ld a, $5 ld a, $5
call GetSRAMBank call GetSRAMBank

View File

@ -294,7 +294,7 @@ wc2d7:: ds 1
wc2d8:: ds 1 wc2d8:: ds 1
wc2d9:: ds 1 wc2d9:: ds 1
wc2da:: ds 2 wc2da:: ds 2
InLinkBattle:: ; c2dc wLinkMode:: ; c2dc
; 0 not in link battle ; 0 not in link battle
; 1 link battle ; 1 link battle
; 4 mobile battle ; 4 mobile battle
@ -1760,7 +1760,7 @@ EnemyMonBaseExp:: db ; d22c
EnemyMonEnd:: EnemyMonEnd::
IsInBattle:: ; d22d wBattleMode:: ; d22d
; 0: overworld ; 0: overworld
; 1: wild battle ; 1: wild battle
; 2: trainer battle ; 2: trainer battle