Some work on battle animations

This commit is contained in:
PikalaxALT
2015-11-09 16:41:09 -05:00
parent 59d67a44be
commit 93ab6985d2
29 changed files with 787 additions and 675 deletions

View File

@@ -40,7 +40,7 @@ _PlayBattleAnim: ; cc0e4
push af
ld [hl], c
call Functioncc11c
call BattleAnimRunScript
pop af
ld [hVBlank], a
@@ -55,17 +55,17 @@ _PlayBattleAnim: ; cc0e4
ret
; cc11c
Functioncc11c: ; cc11c
BattleAnimRunScript: ; cc11c
ld a, [FXAnimIDHi]
and a
jr nz, .asm_cc156
jr nz, .hi_byte
callba CheckBattleScene
jr c, .asm_cc141
jr c, .disabled
call BattleAnimClearHud
call Functioncc163
call RunBattleAnimScript
call BattleAnimAssignPals
call BattleAnimRequestPals
@@ -76,31 +76,31 @@ Functioncc11c: ; cc11c
call BattleAnimDelayFrame
call BattleAnimRestoreHuds
.asm_cc141
.disabled
ld a, [wcfca]
and a
jr z, .asm_cc15f
jr z, .done
ld l, a
ld h, 0
ld de, $10e
ld de, ANIM_MISS
add hl, de
ld a, l
ld [FXAnimIDLo], a
ld a, h
ld [FXAnimIDHi], a
.asm_cc156
.hi_byte
call WaitSFX
call Functioncc881
call Functioncc163
call RunBattleAnimScript
.asm_cc15f
.done
call Functioncc8f6
ret
; cc163
Functioncc163: ; cc163
RunBattleAnimScript: ; cc163
call Functioncc8d3
@@ -257,11 +257,11 @@ Functioncc23d: ; cc23d
ld a, [BattleAnimFlags]
bit 3, a
jr z, .asm_cc254
jr z, .skip
ld hl, Sprites + 3
ld c, (SpritesEnd - Sprites) / 4
.asm_cc249
.loop
ld a, [hl]
and $f0
ld [hli], a
@@ -269,71 +269,71 @@ rept 3
inc hl
endr
dec c
jr nz, .asm_cc249
jr nz, .loop
ret
.asm_cc254
.skip
ld hl, Sprites
ld c, SpritesEnd - Sprites
xor a
.asm_cc25a
.loop2
ld [hli], a
dec c
jr nz, .asm_cc25a
jr nz, .loop2
ret
; cc25f
Functioncc25f: ; cc25f
call Functioncc267
call .CheckTimer
ret nc
call Functioncc275
call .RunScript
ret
; cc267
Functioncc267: ; cc267
.CheckTimer: ; cc267
ld a, [BattleAnimDuration]
and a
jr z, .asm_cc273
jr z, .done
dec a
ld [BattleAnimDuration], a
and a
ret
.asm_cc273
.done
scf
ret
; cc275
Functioncc275: ; cc275
.RunScript: ; cc275
.loop
call GetBattleAnimByte
cp $ff
jr nz, .asm_cc286
jr nz, .not_done_with_anim
; Return from a subroutine.
ld hl, BattleAnimFlags
bit 1, [hl]
jr nz, .asm_cc28e
jr nz, .do_anim
set 0, [hl]
ret
.asm_cc286
.not_done_with_anim
cp $d0
jr nc, .asm_cc28e
jr nc, .do_anim
ld [BattleAnimDuration], a
ret
.asm_cc28e
call Functioncc293
.do_anim
call .DoCommand
jr Functioncc275
jr .loop
; cc293
Functioncc293: ; cc293
.DoCommand: ; cc293
; Execute battle animation command in [BattleAnimByte].
ld a, [BattleAnimByte]
sub $d0
@@ -1332,11 +1332,11 @@ Datacc871: ; cc871
Functioncc881: ; cc881
ld a, [wcfca]
cp $1
jr z, .asm_cc88b
jr z, .okay
cp $4
ret nz
.asm_cc88b
.okay
ld a, [TypeModifier]
and $7f
ret z
@@ -1358,41 +1358,43 @@ Functioncc881: ; cc881
BattleAnimAssignPals: ; cc8a4
ld a, [hCGB]
and a
jr nz, .asm_cc8be
jr nz, .cgb
ld a, [hSGB]
and a
ld a, $e0
jr z, .asm_cc8b2
ld a, $f0
ld a, %11100000
jr z, .sgb
ld a, %11110000
.asm_cc8b2
.sgb
ld [wcfc8], a
ld a, $e4
ld a, %11100100
ld [wcfc7], a
ld [wcfc9], a
ret
.asm_cc8be
ld a, $e4
.cgb
ld a, %11100100
ld [wcfc7], a
ld [wcfc8], a
ld [wcfc9], a
call DmgToCgbBGPals
ld de, $e4e4
lb de, %11100100, %11100100
call DmgToCgbObjPals
ret
; cc8d3
Functioncc8d3: ; cc8d3
; Clear animation block
ld hl, LYOverrides
ld bc, $0354
.asm_cc8d9
ld bc, wBattleAnimEnd - LYOverrides
.loop
ld [hl], $0
inc hl
dec bc
ld a, c
or b
jr nz, .asm_cc8d9
jr nz, .loop
ld hl, FXAnimIDLo
ld e, [hl]
inc hl
@@ -1401,7 +1403,7 @@ Functioncc8d3: ; cc8d3
rept 2
add hl, de
endr
call Function3ae1
call GetBattleAnimPointer
call BattleAnimAssignPals
call BattleAnimDelayFrame
ret
@@ -1409,12 +1411,12 @@ endr
Functioncc8f6: ; cc8f6
call WaitTop
ld a, $e4
ld a, %11100100
ld [wcfc7], a
ld [wcfc8], a
ld [wcfc9], a
call DmgToCgbBGPals
ld de, $e4e4
lb de, %11100100, %11100100
call DmgToCgbObjPals
xor a
ld [hSCX], a

View File

@@ -255,6 +255,7 @@ BattleAnimations:: ; c906f
dw BattleAnim_253
dw BattleAnim_254
dw BattleAnim_SweetScent2
; $100
dw BattleAnim_ThrowPokeBall
dw BattleAnim_SendOutMon
dw BattleAnim_ReturnMon

View File

@@ -2022,7 +2022,7 @@ Function3ccc2: ; 3ccc2
ret
; 3ccde
Function3ccde: ; 3ccde
CheckUserHasEnoughHP: ; 3ccde
ld hl, BattleMonHP + 1
ld a, [hBattleTurn]
and a
@@ -3740,7 +3740,7 @@ Function3d7a0: ; 3d7a0
lb bc, 4, 10
call ClearBox
call WaitBGMap
jp Function3ee27
jp FinishBattleAnim
; 3d7b8
Function_BattleTextEnemySentOut: ; 3d7b8
@@ -4253,7 +4253,7 @@ SendOutPlayerMon: ; 3db5f
ld [hBGMapMode], a
call GetMonBackpic
xor a
ld [$ffad], a
ld [hFillBox], a
ld [wd0d2], a
ld [CurMoveNum], a
ld [TypeModifier], a
@@ -4262,7 +4262,7 @@ SendOutPlayerMon: ; 3db5f
ld [LastPlayerCounterMove], a
ld [LastPlayerMove], a
call CheckAmuletCoin
call Function3ee27
call FinishBattleAnim
xor a
ld [wEnemyWrapCount], a
call SetPlayerTurn
@@ -5132,7 +5132,7 @@ Function3e12e: ; 3e12e
ld a, [hl]
cp b
ret z
jp Function3ee27
jp FinishBattleAnim
; 3e138
Function3e138: ; 3e138
@@ -5269,7 +5269,7 @@ BattleMenu_Pack: ; 3e1c7
call GetMonFrontpic
call ExitMenu
call WaitBGMap
call Function3ee27
call FinishBattleAnim
call LoadTileMapToTempTileMap
jp BattleMenu
; 3e22b
@@ -5309,7 +5309,7 @@ Function3e234: ; 3e234
call WaitBGMap
call LoadTileMapToTempTileMap
call ResetTextRelatedRAM
call Function3ee27
call FinishBattleAnim
and a
ret
@@ -6873,7 +6873,7 @@ Function3ebc7: ; 3ebc7
Function3ebd8: ; 3ebd8
xor a
ld [TempEnemyMonSpecies], a
call Function3ee27
call FinishBattleAnim
ld a, [OtherTrainerClass]
ld [TrainerClass], a
ld de, VTiles2
@@ -7368,7 +7368,7 @@ Call_PlayBattleAnim: ; 3ee17
predef_jump PlayBattleAnim
; 3ee27
Function3ee27: ; 3ee27
FinishBattleAnim: ; 3ee27
push af
push bc
push de
@@ -8377,7 +8377,7 @@ GetMonBackpic: ; 3f43d
ld a, [PlayerSubStatus4]
bit SUBSTATUS_SUBSTITUTE, a
ld hl, BattleAnimCmd_DD
jr nz, Function3f46f
jr nz, Function3f46f ; substitute
Function3f447: ; 3f447
ld a, [wc6fe]
@@ -8576,7 +8576,7 @@ InitEnemyTrainer: ; 3f594
ld de, VTiles2
callab GetTrainerPic
xor a
ld [$ffad], a
ld [hFillBox], a
dec a
ld [wc6e6], a
hlcoord 12, 0
@@ -8641,7 +8641,7 @@ InitEnemyWildmon: ; 3f607
predef Function5108b
xor a
ld [TrainerClass], a
ld [$ffad], a
ld [hFillBox], a
hlcoord 12, 0
lb bc, 7, 7
predef FillBox
@@ -9400,7 +9400,7 @@ Function3fb6c: ; 3fb6c
ld a, $1
ld [hBGMapMode], a
ld a, $31
ld [$ffad], a
ld [hFillBox], a
hlcoord 2, 6
lb bc, 6, 6
predef FillBox
@@ -9494,7 +9494,7 @@ CopyBackpic: ; 3fc30
ld [rSVBK], a
call Function3fc5b
ld a, $31
ld [$ffad], a
ld [hFillBox], a
hlcoord 2, 6
lb bc, 6, 6
predef FillBox

View File

@@ -13,7 +13,7 @@ BattleCommandPointers: ; 3fd28
dw BattleCommand_LowerSub ; 34eee
dw BattleCommand_HitTargetNoSub ; 34f60
dw BattleCommand_RaiseSub ; 35004
dw BattleCommand_ResultText ; 35023
dw BattleCommand_FailureText ; 35023
dw BattleCommand_CheckFaint ; 3505e
dw BattleCommand_CriticalText ; 35175
dw BattleCommand_SuperEffectiveText ; 351ad

File diff suppressed because it is too large Load Diff

View File

@@ -20,7 +20,7 @@ BattleCommand_Attract: ; 377ce
jp StdBattleTextBox
.failed
jp Function37354
jp FailAttract
; 377f5

View File

@@ -19,5 +19,5 @@ BattleCommand_Foresight: ; 376a0
jp StdBattleTextBox
.failed
jp Function37354
jp FailForesight
; 376c2

View File

@@ -1,8 +1,8 @@
BattleCommand_Metronome: ; 37418
; metronome
call Function372d8
call Function34548
call ClearLastMove
call CheckUserIsCharging
jr nz, .asm_3742b
ld a, [wKickCounter]
@@ -12,7 +12,7 @@ BattleCommand_Metronome: ; 37418
ld [wKickCounter], a
.asm_3742b
call PlayPlayerMoveAnim_ClearHiID
call LoadMoveAnim
.GetMove
call BattleRandom

View File

@@ -1,7 +1,7 @@
BattleCommand_MirrorMove: ; 373c9
; mirrormove
call Function372d8
call ClearLastMove
ld a, BATTLE_VARS_MOVE
call GetBattleVarAddr
@@ -37,7 +37,7 @@ BattleCommand_MirrorMove: ; 373c9
call GetMoveData
call GetMoveName
call CopyName1
call Function34548
call CheckUserIsCharging
jr nz, .done
ld a, [wKickCounter]

View File

@@ -23,7 +23,7 @@ ProtectChance: ; 3762c
ld de, EnemyProtectCount
.asm_37637
call Function36abf
call CheckOpponentWentFirst
jr nz, .failed
; Can't have a substitute.

View File

@@ -23,5 +23,5 @@ BattleCommand_Spikes: ; 37683
jp StdBattleTextBox
.failed
jp Function37354
jp FailSpikes
; 376a0

View File

@@ -1,50 +1,50 @@
Functionfbd54: ; fbd54
_DisappearUser: ; fbd54
xor a
ld [hBGMapMode], a ; $ff00+$d4
ld a, [hBattleTurn] ; $ff00+$e4
and a
jr z, .asm_fbd61
call Functionfbd96
jr .asm_fbd64
.asm_fbd61
call Functionfbd9d
.asm_fbd64
jr z, .player
call GetEnemyFrontpicCoords
jr .okay
.player
call GetPlayerBackpicCoords
.okay
call ClearBox
jr Functionfbd91
jr FinishAppearDisappearUser
Functionfbd69: ; fbd69 (3e:7d69)
_AppearUserRaiseSub: ; fbd69 (3e:7d69)
callba BattleCommand_RaiseSubNoAnim
jr Functionfbd77
jr AppearUser
Functionfbd71: ; fbd71 (3e:7d71)
_AppearUserLowerSub: ; fbd71 (3e:7d71)
callba BattleCommand_LowerSubNoAnim
Functionfbd77: ; fbd77 (3e:7d77)
AppearUser: ; fbd77 (3e:7d77)
xor a
ld [hBGMapMode], a ; $ff00+$d4
ld a, [hBattleTurn] ; $ff00+$e4
and a
jr z, .asm_fbd85
call Functionfbd96
jr z, .player
call GetEnemyFrontpicCoords
xor a
jr .asm_fbd8a
.asm_fbd85
call Functionfbd9d
jr .okay
.player
call GetPlayerBackpicCoords
ld a, $31
.asm_fbd8a
ld [$ffad], a
.okay
ld [hFillBox], a
predef FillBox
Functionfbd91: ; fbd91 (3e:7d91)
FinishAppearDisappearUser: ; fbd91 (3e:7d91)
ld a, $1
ld [hBGMapMode], a ; $ff00+$d4
ret
Functionfbd96: ; fbd96 (3e:7d96)
GetEnemyFrontpicCoords: ; fbd96 (3e:7d96)
hlcoord 12, 0
lb bc, 7, 7
ret
Functionfbd9d: ; fbd9d (3e:7d9d)
GetPlayerBackpicCoords: ; fbd9d (3e:7d9d)
hlcoord 2, 6
lb bc, 6, 6
ret
@@ -62,7 +62,7 @@ DoWeatherModifiers: ; fbda4
ld a, [de]
inc de
cp $ff
jr z, .asm_fbdc0
jr z, .done_weather_types
cp b
jr nz, .NextWeatherType
@@ -78,7 +78,7 @@ endr
jr .CheckWeatherType
.asm_fbdc0
.done_weather_types
ld de, .WeatherMoveModifiers
ld a, BATTLE_VARS_MOVE_EFFECT
@@ -217,10 +217,10 @@ DoBadgeTypeBoosts: ; fbe24
ld a, e
or d
jr nz, .asm_fbe6f
jr nz, .done_min
ld e, 1
.asm_fbe6f
.done_min
add hl, de
jr nc, .Update

File diff suppressed because it is too large Load Diff

View File

@@ -1,26 +1,3 @@
ANIM_SWEET_SCENT_2 EQU 255 ; unused?
ANIM_THROW_POKE_BALL EQU 256
ANIM_SEND_OUT_MON EQU 257 ; seems to also cover shiny
ANIM_RETURN_MON EQU 258
ANIM_CONFUSED EQU 259
ANIM_SLP EQU 260
ANIM_BRN EQU 261
ANIM_PSN EQU 262
ANIM_SAP EQU 263
ANIM_FRZ EQU 264
ANIM_PAR EQU 265
ANIM_IN_LOVE EQU 266
ANIM_IN_SANDSTORM EQU 267
ANIM_IN_NIGHTMARE EQU 268
ANIM_IN_WHIRLPOOL EQU 269
ANIM_MISS EQU 270
ANIM_ENEMY_DAMAGE EQU 271
ANIM_ENEMY_STAT_DOWN EQU 272 ; vibrate horizontally
ANIM_PLAYER_STAT_DOWN EQU 273 ; wobble horizontally
ANIM_PLAYER_DAMAGE EQU 274
ANIM_WOBBLE EQU 275
ANIM_SHAKE EQU 276
ANIM_HIT_CONFUSION EQU 277
ANIM_OBJ_BURNED EQU $10
ANIM_OBJ_FROZEN EQU $2a
@@ -71,3 +48,53 @@ ANIM_BG_WOBBLE_MON EQU $34
const ANIM_MON_UNUSED ; 6
const ANIM_MON_EGG1 ; 7
const ANIM_MON_EGG2 ; 8
const_value SET $d0
const BATTLEANIM_D0
const BATTLEANIM_D1
const BATTLEANIM_D2
const BATTLEANIM_D3
const BATTLEANIM_D4
const BATTLEANIM_D5
const BATTLEANIM_D6
const BATTLEANIM_D7
const BATTLEANIM_D8
const BATTLEANIM_D9
const BATTLEANIM_DA
const BATTLEANIM_DB
const BATTLEANIM_DC
const BATTLEANIM_DD
const BATTLEANIM_DE
const BATTLEANIM_DF
const BATTLEANIM_E0
const BATTLEANIM_E1
const BATTLEANIM_E2
const BATTLEANIM_E3
const BATTLEANIM_E4
const BATTLEANIM_E5
const BATTLEANIM_E6
const BATTLEANIM_E7
const BATTLEANIM_E8
const BATTLEANIM_E9
const BATTLEANIM_EA
const BATTLEANIM_EB
const BATTLEANIM_EC
const BATTLEANIM_ED
const BATTLEANIM_EE
const BATTLEANIM_EF
const BATTLEANIM_F0
const BATTLEANIM_F1
const BATTLEANIM_F2
const BATTLEANIM_F3
const BATTLEANIM_F4
const BATTLEANIM_F5
const BATTLEANIM_F6
const BATTLEANIM_F7
const BATTLEANIM_F8
const BATTLEANIM_F9
const BATTLEANIM_FA
const BATTLEANIM_FB
const BATTLEANIM_FC
const BATTLEANIM_FD
const BATTLEANIM_FE
const BATTLEANIM_FF

View File

@@ -256,3 +256,44 @@
const_value SET const_value + -1
const NUM_ATTACKS ; $fb
; Battle animations use the same constants
; as the moves up to this point.
const ANIM_FC ; $fc
const ANIM_FD ; $fd
const ANIM_FE ; $fe
const ANIM_SWEET_SCENT_2 ; $ff
const ANIM_THROW_POKE_BALL ; $100
const ANIM_SEND_OUT_MON ; $101
const ANIM_RETURN_MON ; $102
const ANIM_CONFUSED ; $103
const ANIM_SLP ; $104
const ANIM_BRN ; $105
const ANIM_PSN ; $106
const ANIM_SAP ; $107
const ANIM_FRZ ; $108
const ANIM_PAR ; $109
const ANIM_IN_LOVE ; $10a
const ANIM_IN_SANDSTORM ; $10b
const ANIM_IN_NIGHTMARE ; $10c
const ANIM_IN_WHIRLPOOL ; $10d
; battle anims
const ANIM_MISS ; $10e
const ANIM_ENEMY_DAMAGE ; $10f
const ANIM_ENEMY_STAT_DOWN ; $110
const ANIM_PLAYER_STAT_DOWN ; $111
const ANIM_PLAYER_DAMAGE ; $112
const ANIM_WOBBLE ; $113
const ANIM_SHAKE ; $114
const ANIM_HIT_CONFUSION ; $115
; wcfca uses offsets from ANIM_MISS
const_def
const BATTLEANIM_NONE
const BATTLEANIM_ENEMY_DAMAGE
const BATTLEANIM_ENEMY_STAT_DOWN
const BATTLEANIM_PLAYER_STAT_DOWN
const BATTLEANIM_PLAYER_DAMAGE
const BATTLEANIM_WOBBLE
const BATTLEANIM_SHAKE
const BATTLEANIM_HIT_CONFUSION

View File

@@ -366,7 +366,7 @@ ParseCredits: ; 1099aa
; First, let's clear the current text display,
; starting from line 5.
xor a
ld [$ffd4], a
ld [hBGMapMode], a
hlcoord 0, 5
ld bc, 20 * 12
ld a, " "
@@ -479,9 +479,9 @@ endr
ld [CreditsTimer], a
xor a
ld [$ffd5], a
ld [hBGMapThird], a
ld a, 1
ld [$ffd4], a
ld [hBGMapMode], a
.done
jp Function109951

View File

@@ -440,14 +440,14 @@ Script_closetext: ; 0x96ed9
Script_keeptextopen: ; 0x96edc
; script command 0x55
ld a, [$ffd8]
ld a, [hOAMUpdate]
push af
ld a, $1
ld [$ffd8], a
ld [hOAMUpdate], a
call WaitBGMap
call KeepTextOpen
pop af
ld [$ffd8], a
ld [hOAMUpdate], a
ret
; 0x96eed

View File

@@ -1724,7 +1724,7 @@ Function378b:: ; 378b
predef GetFrontpic
pop hl
xor a
ld [$ffad], a
ld [hFillBox], a
lb bc, 7, 7
predef FillBox
xor a
@@ -1991,57 +1991,6 @@ Function392d:: ; 392d
INCLUDE "home/battle.asm"
Function3ae1:: ; 3ae1
GLOBAL BattleAnimations
GLOBAL BattleAnimCommands
ld a, BANK(BattleAnimations)
rst Bankswitch
ld a, [hli]
ld [BattleAnimAddress], a
ld a, [hl]
ld [BattleAnimAddress + 1], a
ld a, BANK(BattleAnimCommands)
rst Bankswitch
ret
; 3af0
GetBattleAnimByte:: ; 3af0
push hl
push de
ld hl, BattleAnimAddress
ld e, [hl]
inc hl
ld d, [hl]
ld a, BANK(BattleAnimations)
rst Bankswitch
ld a, [de]
ld [BattleAnimByte], a
inc de
ld a, BANK(BattleAnimCommands)
rst Bankswitch
ld [hl], d
dec hl
ld [hl], e
pop de
pop hl
ld a, [BattleAnimByte]
ret
; 3b0c
Function3b0c:: ; 3b0c
ld a, [hLCDStatCustom]

View File

@@ -309,3 +309,53 @@ GLOBAL BattleText
rst Bankswitch
ret
; 3ae1
GetBattleAnimPointer:: ; 3ae1
GLOBAL BattleAnimations
GLOBAL BattleAnimCommands
ld a, BANK(BattleAnimations)
rst Bankswitch
ld a, [hli]
ld [BattleAnimAddress], a
ld a, [hl]
ld [BattleAnimAddress + 1], a
ld a, BANK(BattleAnimCommands)
rst Bankswitch
ret
; 3af0
GetBattleAnimByte:: ; 3af0
push hl
push de
ld hl, BattleAnimAddress
ld e, [hl]
inc hl
ld d, [hl]
ld a, BANK(BattleAnimations)
rst Bankswitch
ld a, [de]
ld [BattleAnimByte], a
inc de
ld a, BANK(BattleAnimCommands)
rst Bankswitch
ld [hl], d
dec hl
ld [hl], e
pop de
pop hl
ld a, [BattleAnimByte]
ret
; 3b0c

View File

@@ -124,9 +124,10 @@ LoadMapPart:: ; 217a
; 2198
LoadMetatiles:: ; 2198
; de <- wd194
ld a, [wd194]
ld e, a
ld a, [wd195]
ld a, [wd194 + 1]
ld d, a
ld hl, wMisc
ld b, 5 ; SCREEN_WIDTH / 4
@@ -163,20 +164,21 @@ endr
ld h, a
rept 3
; copy 4 bytes from hl to de
rept 4
ld a, [hli]
ld [de], a
inc de
endr
; next row
ld a, e
add 5 * 4
add SCREEN_WIDTH
ld e, a
jr nc, .next\@
inc d
.next\@
endr
; copy 4 more bytes from hl to de
rept 4
ld a, [hli]
ld [de], a

Some files were not shown because too many files have changed in this diff Show More