Split up anim objects into several files

This commit is contained in:
PikalaxALT 2015-12-24 14:07:33 -05:00
parent 41618f9e98
commit 2a2222476a
9 changed files with 1197 additions and 880 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

573
battle/objects/data.asm Executable file

File diff suppressed because it is too large Load Diff

314
battle/objects/engine.asm Executable file
View File

@ -0,0 +1,314 @@
QueueBattleAnimation: ; cc9a1 (33:49a1)
ld hl, ActiveAnimObjects
ld e, 10
.loop
ld a, [hl]
and a
jr z, .done
ld bc, BATTLEANIMSTRUCT_LENGTH
add hl, bc
dec e
jr nz, .loop
scf
ret
.done
ld c, l
ld b, h
ld hl, wNumActiveBattleAnims
inc [hl]
call InitBattleAnimation
ret
DeinitBattleAnimation: ; cc9bd
ld hl, BATTLEANIMSTRUCT_INDEX
add hl, bc
ld [hl], $0
ret
; cc9c4
InitBattleAnimation: ; cc9c4 (33:49c4)
ld a, [wBattleAnimTemp0]
ld e, a
ld d, 0
ld hl, BattleAnimObjects
rept 6
add hl, de
endr
ld e, l
ld d, h
ld hl, BATTLEANIMSTRUCT_INDEX
add hl, bc
ld a, [wNumActiveBattleAnims]
ld [hli], a ; Index
ld a, [de]
inc de
ld [hli], a ; 01
ld a, [de]
inc de
ld [hli], a ; 02
ld a, [de]
inc de
ld [hli], a ; Frameset ID
ld a, [de]
inc de
ld [hli], a ; Function
ld a, [de]
inc de
ld [hli], a ; 05
ld a, [de]
call GetBattleAnimTileOffset
ld [hli], a ; Tile ID
ld a, [wBattleAnimTemp1]
ld [hli], a ; X Coord
ld a, [wBattleAnimTemp2]
ld [hli], a ; Y Coord
xor a
ld [hli], a ; X Offset
ld [hli], a ; Y Offset
ld a, [wBattleAnimTemp3]
ld [hli], a ; 0b
xor a
ld [hli], a ; 0c
dec a
ld [hli], a ; 0d
xor a
ld [hli], a ; 0e
ld [hli], a ; 0f
ld [hl], a ; 10
ret
BattleAnimOAMUpdate: ; cca09
call InitBattleAnimBuffer
call GetBattleAnimFrame
cp -3
jp z, .done
cp -4
jp z, .delete
push af
ld hl, wBattleAnimTempOAMFlags
ld a, [wBattleAnimTemp7]
xor [hl]
and $e0
ld [hl], a
pop af
push bc
call GetBattleAnimOAMPointer
ld a, [wBattleAnimTempTileID]
add [hl]
ld [wBattleAnimTempTileID], a
inc hl
ld a, [hli]
ld c, a
ld a, [hli]
ld h, [hl]
ld l, a
ld a, [wBattleAnimOAMPointerLo]
ld e, a
ld d, Sprites / $100
.loop
ld a, [wBattleAnimTempYCoord]
ld b, a
ld a, [wBattleAnimTempYOffset]
add b
ld b, a
push hl
ld a, [hl]
ld hl, wBattleAnimTempOAMFlags
bit 6, [hl]
jr z, .no_yflip
add $8
xor $ff
inc a
.no_yflip
pop hl
add b
ld [de], a
inc hl
inc de
ld a, [wBattleAnimTempXCoord]
ld b, a
ld a, [wBattleAnimTempXOffset]
add b
ld b, a
push hl
ld a, [hl]
ld hl, wBattleAnimTempOAMFlags
bit 5, [hl]
jr z, .no_xflip
add $8
xor $ff
inc a
.no_xflip
pop hl
add b
ld [de], a
inc hl
inc de
ld a, [wBattleAnimTempTileID]
add $31
add [hl]
ld [de], a
inc hl
inc de
ld a, [wBattleAnimTempOAMFlags]
ld b, a
ld a, [hl]
xor b
and $e0
ld b, a
ld a, [hl]
and $10
or b
ld b, a
ld a, [wBattleAnimTempPalette]
and $f
or b
ld [de], a
inc hl
inc de
ld a, e
ld [wBattleAnimOAMPointerLo], a
cp $a0
jr nc, .exit_set_carry
dec c
jr nz, .loop
pop bc
jr .done
.delete
call DeinitBattleAnimation
.done
and a
ret
.exit_set_carry
pop bc
scf
ret
; ccaaa
InitBattleAnimBuffer: ; ccaaa
ld hl, BATTLEANIMSTRUCT_01
add hl, bc
ld a, [hl]
and %10000000
ld [wBattleAnimTempOAMFlags], a
xor a
ld [wBattleAnimTemp7], a
ld hl, BATTLEANIMSTRUCT_PALETTE
add hl, bc
ld a, [hl]
ld [wBattleAnimTempPalette], a
ld hl, BATTLEANIMSTRUCT_02
add hl, bc
ld a, [hl]
ld [wBattleAnimTemp1], a
ld hl, BATTLEANIMSTRUCT_TILEID
add hl, bc
ld a, [hli]
ld [wBattleAnimTempTileID], a
ld a, [hli]
ld [wBattleAnimTempXCoord], a
ld a, [hli]
ld [wBattleAnimTempYCoord], a
ld a, [hli]
ld [wBattleAnimTempXOffset], a
ld a, [hli]
ld [wBattleAnimTempYOffset], a
ld a, [hBattleTurn]
and a
ret z
ld hl, BATTLEANIMSTRUCT_01
add hl, bc
ld a, [hl]
ld [wBattleAnimTempOAMFlags], a
bit 0, [hl]
ret z
ld hl, BATTLEANIMSTRUCT_XCOORD
add hl, bc
ld a, [hli]
ld d, a
ld a, (-10 * 8) + 4
sub d
ld [wBattleAnimTempXCoord], a
ld a, [hli]
ld d, a
ld a, [wBattleAnimTemp1]
cp $ff
jr nz, .check_kinesis_softboiled_milkdrink
ld a, 5 * 8
add d
jr .done
.check_kinesis_softboiled_milkdrink
sub d
push af
ld a, [FXAnimIDHi]
or a
jr nz, .no_sub
ld a, [FXAnimIDLo]
cp KINESIS
jr z, .kinesis
cp SOFTBOILED
jr z, .softboiled
cp MILK_DRINK
jr nz, .no_sub
.kinesis
.softboiled
.milk_drink
pop af
sub 1 * 8
jr .done
.no_sub
pop af
.done
ld [wBattleAnimTempYCoord], a
ld a, [hli]
xor $ff
inc a
ld [wBattleAnimTempXOffset], a
ret
; ccb31
GetBattleAnimTileOffset: ; ccb31 (33:4b31)
push hl
push bc
ld hl, wBattleAnimTileDict
ld b, a
ld c, 10 / 2
.loop
ld a, [hli]
cp b
jr z, .load
inc hl
dec c
jr nz, .loop
xor a
jr .done
.load
ld a, [hl]
.done
pop bc
pop hl
ret
_ExecuteBGEffects: ; ccb48
callab ExecuteBGEffects
ret
; ccb4f
_QueueBGEffect: ; ccb4f (33:4b4f)
callab QueueBGEffect
ret
; ccb56 (33:4b56)

130
battle/objects/library.asm Executable file
View File

@ -0,0 +1,130 @@
ReinitBattleAnimFrameset: ; ce7bf (33:67bf)
ld hl, BATTLEANIMSTRUCT_FRAMESET_ID
add hl, bc
ld [hl], a
ld hl, BATTLEANIMSTRUCT_DURATION
add hl, bc
ld [hl], 0
ld hl, BATTLEANIMSTRUCT_FRAME
add hl, bc
ld [hl], -1
ret
GetBattleAnimFrame: ; ce7d1
.loop
ld hl, BATTLEANIMSTRUCT_DURATION
add hl, bc
ld a, [hl]
and a
jr z, .next_frame
dec [hl]
call .GetPointer
ld a, [hli]
push af
jr .okay
.next_frame
ld hl, BATTLEANIMSTRUCT_FRAME
add hl, bc
inc [hl]
call .GetPointer
ld a, [hli]
cp -2
jr z, .restart
cp -1
jr z, .repeat_last
push af
ld a, [hl]
push hl
and $3f
ld hl, BATTLEANIMSTRUCT_DURATION
add hl, bc
ld [hl], a
pop hl
.okay
ld a, [hl]
and $c0
srl a
ld [wBattleAnimTemp7], a
pop af
ret
.repeat_last
xor a
ld hl, BATTLEANIMSTRUCT_DURATION
add hl, bc
ld [hl], a
ld hl, BATTLEANIMSTRUCT_FRAME
add hl, bc
dec [hl]
dec [hl]
jr .loop
.restart
xor a
ld hl, BATTLEANIMSTRUCT_DURATION
add hl, bc
ld [hl], a
dec a
ld hl, BATTLEANIMSTRUCT_FRAME
add hl, bc
ld [hl], a
jr .loop
; ce823
.GetPointer: ; ce823
ld hl, BATTLEANIMSTRUCT_FRAMESET_ID
add hl, bc
ld e, [hl]
ld d, 0
ld hl, BattleAnimFrameData
add hl, de
add hl, de
ld e, [hl]
inc hl
ld d, [hl]
ld hl, BATTLEANIMSTRUCT_FRAME
add hl, bc
ld l, [hl]
ld h, $0
add hl, hl
add hl, de
ret
; ce83c
GetBattleAnimOAMPointer: ; ce83c
ld l, a
ld h, 0
ld de, BattleAnimOAMData
add hl, hl
add hl, hl
add hl, de
ret
; ce846
LoadBattleAnimObj: ; ce846 (33:6846)
push hl
ld l, a
ld h, 0
add hl, hl
add hl, hl
ld de, AnimObjGFX
add hl, de
ld c, [hl]
inc hl
ld b, [hl]
inc hl
ld a, [hli]
ld h, [hl]
ld l, a
pop de
push bc
call DecompressRequest2bpp
pop bc
ret
; ce85e (33:685e)

View File

@ -1,9 +1,3 @@
wPlaceBallsDirection EQU $d003
wTrainerHUDTiles EQU $d004
wPlaceBallsX EQU $cfc4
wPlaceBallsY EQU $cfc5
GLOBAL wPlaceBallsDirection, wTrainerHUDTiles, wPlaceBallsX, wPlaceBallsY
BattleStart_TrainerHuds: ; 2c000
ld a, $e4
ld [rOBP0], a

View File

@ -1,9 +1,5 @@
INCLUDE "includes.asm"
wCreditsBorderFrame EQU $cf64
wCreditsBorderMon EQU $cf65
wCreditsLYOverride EQU $cf66
SECTION "Credits", ROMX, BANK[CREDITS]
const_def

View File

@ -1,6 +1,3 @@
wCurrPocket EQU $cf65
Pack: ; 10000
ld hl, Options
set NO_TEXT_SCROLL, [hl]

View File

@ -1532,14 +1532,18 @@ wMomBankDigitCursorPosition::
wIntroSceneFrameCounter::
wHoldingUnownPuzzlePiece::
wCardFlipCursorY::
wCreditsBorderFrame::
wcf64:: ds 1
IF !DEF(CRYSTAL11)
wPokedexStatus::
ENDC
wCreditsBorderMon::
wTitleScreenTimerLo::
wUnownPuzzleCursorPosition::
wCardFlipCursorX::
wCurrPocket::
wcf65:: ds 1
wCreditsLYOverride::
wTitleScreenTimerHi::
wUnownPuzzleHeldPiece::
wCardFlipWhichCard::
@ -1679,8 +1683,11 @@ FXAnimID::
FXAnimIDLo:: ; cfc2
ds 1
FXAnimIDHi:: ; cfc3
ds 3
ds 1
wPlaceBallsX:: ; cfc4
ds 1
wPlaceBallsY:: ; cfc5
ds 1
TileAnimationTimer:: ; cfc6
ds 1
@ -1795,11 +1802,13 @@ LuckyNumberDigit2Buffer::
PhoneCallerLo::
wNextRadioLine::
wMovementBufferPerson::
wPlaceBallsDirection::
ds 1
wd004::
LuckyNumberDigit3Buffer::
PhoneCallerHi::
wRadioTextDelay::
wTrainerHUDTiles::
ds 1
wd005::
LuckyNumberDigit4Buffer::