named animation functions/variables

This commit is contained in:
YamaArashi 2015-07-24 14:39:45 -07:00
parent e6d02b4b7b
commit 82512e4491
41 changed files with 781 additions and 642 deletions

View file

@ -65,16 +65,16 @@ DisplayCreditsMon: ; 740cb (1d:40cb)
call GetMonHeader
call LoadFrontSpriteByMonIndex
ld hl,vBGMap0 + $c
call CopyTileMapToVRAM
call CreditsCopyTileMapToVRAM
xor a
ld [H_AUTOBGTRANSFERENABLED],a
call LoadScreenTilesFromBuffer1
ld hl,vBGMap0
call CopyTileMapToVRAM
call CreditsCopyTileMapToVRAM
ld a,$A7
ld [rWX],a
ld hl,vBGMap1
call CopyTileMapToVRAM
call CreditsCopyTileMapToVRAM
call FillMiddleOfScreenWithWhite
ld a,%11111100 ; make the mon a black silhouette
ld [rBGP],a
@ -136,12 +136,12 @@ HoFGBPalettes: ; 74160 (1d:4160)
db %11100000
db %11110000
CopyTileMapToVRAM: ; 74164 (1d:4164)
CreditsCopyTileMapToVRAM: ; 74164 (1d:4164)
ld a, l
ld [H_AUTOBGTRANSFERDEST], a
ld a, h
ld [H_AUTOBGTRANSFERDEST + 1], a
ld a, $1
ld a, 1
ld [H_AUTOBGTRANSFERENABLED], a
jp Delay3

File diff suppressed because it is too large Load diff

View file

@ -210,28 +210,28 @@ BattleTransition_Spiral: ; 70a72 (1c:4a72)
.outwardSpiral
coord hl, 10, 10
ld a, $3
ld [wd09f], a
ld [wOutwardSpiralCurrentDirection], a
ld a, l
ld [wd09b], a
ld [wOutwardSpiralTileMapPointer + 1], a
ld a, h
ld [wd09a], a
ld b, $78
.loop1
ld c, $3
.loop2
ld [wOutwardSpiralTileMapPointer], a
ld b, 120
.loop
ld c, 3
.innerLoop
push bc
call BattleTransition_OutwardSpiral_
pop bc
dec c
jr nz, .loop2
jr nz, .innerLoop
call DelayFrame
dec b
jr nz, .loop1
jr nz, .loop
.done
call BattleTransition_BlackScreen
xor a
ld [wd09b], a
ld [wd09a], a
ld [wOutwardSpiralTileMapPointer + 1], a
ld [wOutwardSpiralTileMapPointer], a
ret
BattleTransition_InwardSpiral: ; 70aaa (1c:4aaa)
@ -286,69 +286,69 @@ BattleTransition_InwardSpiral_: ; 70ae0 (1c:4ae0)
BattleTransition_OutwardSpiral_: ; 70af9 (1c:4af9)
ld bc, -SCREEN_WIDTH
ld de, SCREEN_WIDTH
ld a, [wd09b]
ld a, [wOutwardSpiralTileMapPointer + 1]
ld l, a
ld a, [wd09a]
ld a, [wOutwardSpiralTileMapPointer]
ld h, a
ld a, [wd09f]
ld a, [wOutwardSpiralCurrentDirection]
cp $0
jr z, .zero
jr z, .up
cp $1
jr z, .one
jr z, .left
cp $2
jr z, .two
jr z, .down
cp $3
jr z, .three
.done1
jr z, .right
.keepSameDirection
ld [hl], $ff
.done2_
.done
ld a, l
ld [wd09b], a
ld [wOutwardSpiralTileMapPointer + 1], a
ld a, h
ld [wd09a], a
ld [wOutwardSpiralTileMapPointer], a
ret
.zero
.up
dec hl
ld a, [hl]
cp $ff
jr nz, .done2
jr nz, .changeDirection
inc hl
add hl, bc
jr .done1
.one
jr .keepSameDirection
.left
add hl, de
ld a, [hl]
cp $ff
jr nz, .done2
jr nz, .changeDirection
add hl, bc
dec hl
jr .done1
.two
jr .keepSameDirection
.down
inc hl
ld a, [hl]
cp $ff
jr nz, .done2
jr nz, .changeDirection
dec hl
add hl, de
jr .done1
.three
jr .keepSameDirection
.right
add hl, bc
ld a, [hl]
cp $ff
jr nz, .done2
jr nz, .changeDirection
add hl, de
inc hl
jr .done1
.done2
jr .keepSameDirection
.changeDirection
ld [hl], $ff
ld a, [wd09f]
ld a, [wOutwardSpiralCurrentDirection]
inc a
cp $4
jr nz, .skip
xor a
.skip
ld [wd09f], a
jr .done2_
ld [wOutwardSpiralCurrentDirection], a
jr .done
FlashScreen:
BattleTransition_FlashScreen_: ; 70b5d (1c:4b5d)

View file

@ -357,7 +357,7 @@ EnemyRan: ; 3c202 (f:4202)
call PlaySoundWaitForCurrent
xor a
ld [H_WHOSETURN], a
jpab AnimationSlideEnemyMonOut
jpab AnimationSlideEnemyMonOff
WildRanText: ; 3c229 (f:4229)
TX_FAR _WildRanText

View file

@ -12,10 +12,10 @@ MarowakAnim: ; 708ca (1c:48ca)
ld [H_AUTOBGTRANSFERENABLED], a ; disable BG transfer so we don't see the Marowak too soon
; replace ghost pic with Marowak in BG
ld a, MAROWAK
ld [wHPBarMaxHP], a
ld [wChangeMonPicEnemyTurnSpecies], a
ld a, $1
ld [H_WHOSETURN], a
callab Func_79793
callab ChangeMonPic
; alternate between black and light grey 8 times.
; this makes the ghost's body appear to flash
ld d, $80

View file

@ -293,7 +293,7 @@ UpdateCinnabarGymGateTileBlocks_: ; 1eb0a (7:6b0a)
ld a, $e
.next
pop bc
ld [wd09f], a
ld [wNewTileBlockID], a
predef ReplaceTileBlock
ld hl, $ffdb
dec [hl]

View file

@ -38,7 +38,7 @@ PlayIntroScene: ; 4169d (10:569d)
ld a, SFX_INTRO_HIP
call PlaySound
xor a
ld [wd09f], a
ld [wIntroNidorinoBaseTile], a
ld de, IntroNidorinoAnimation1
call AnimateIntroNidorino
; hop
@ -86,7 +86,7 @@ PlayIntroScene: ; 4169d (10:569d)
ld a, SFX_INTRO_HIP
call PlaySound
ld a, $24
ld [wd09f], a
ld [wIntroNidorinoBaseTile], a
ld de, IntroNidorinoAnimation3
call AnimateIntroNidorino
ld c, $1e
@ -105,7 +105,7 @@ PlayIntroScene: ; 4169d (10:569d)
ld a, SFX_INTRO_HIP
call PlaySound
xor a
ld [wd09f], a
ld [wIntroNidorinoBaseTile], a
ld de, IntroNidorinoAnimation4
call AnimateIntroNidorino
; hop
@ -118,7 +118,7 @@ PlayIntroScene: ; 4169d (10:569d)
ret c
ld a, $24
ld [wd09f], a
ld [wIntroNidorinoBaseTile], a
ld de, IntroNidorinoAnimation6
call AnimateIntroNidorino
ld c, $1e
@ -129,7 +129,7 @@ PlayIntroScene: ; 4169d (10:569d)
ld a, SFX_INTRO_LUNGE
call PlaySound
ld a, $48
ld [wd09f], a
ld [wIntroNidorinoBaseTile], a
ld de, IntroNidorinoAnimation7
jp AnimateIntroNidorino
@ -152,17 +152,17 @@ AnimateIntroNidorino: ; 41793 (10:5793)
UpdateIntroNidorinoOAM: ; 417ae (10:57ae)
ld hl, wOAMBuffer
ld a, [wd09f]
ld a, [wIntroNidorinoBaseTile]
ld d, a
.loop
ld a, [W_BASECOORDY]
add [hl]
ld [hli], a
ld [hli], a ; Y
ld a, [W_BASECOORDX]
add [hl]
ld [hli], a
ld [hli], a ; X
ld a, d
ld [hli], a
ld [hli], a ; tile
inc hl
inc d
dec c

View file

@ -319,7 +319,7 @@ ItemUseBall: ; d687 (3:5687)
ld a,TOSS_ANIM
ld [W_ANIMATIONID],a
xor a
ld [$fff3],a
ld [H_WHOSETURN],a
ld [wAnimationType],a
ld [wDamageMultipliers],a
ld a,[wWhichPokemon]

View file

@ -47,7 +47,7 @@ PrintCardKeyText: ; 52673 (14:6673)
.notSilphCo11F
ld a, $e
.replaceCardKeyDoorTileBlock
ld [wd09f], a
ld [wNewTileBlockID], a
predef ReplaceTileBlock
ld hl, wd126
set 5, [hl]

View file

@ -3,21 +3,21 @@ UsedCut: ; ef54 (3:6f54)
ld [wActionResultOrTookBattleTurn], a ; initialise to failure value
ld a, [W_CURMAPTILESET]
and a ; OVERWORLD
jr z, .asm_ef6b
jr z, .overworld
cp GYM
jr nz, .asm_ef77
jr nz, .nothingToCut
ld a, [wTileInFrontOfPlayer]
cp $50 ; gym cut tree
jr nz, .asm_ef77
jr .asm_ef82
.asm_ef6b
jr nz, .nothingToCut
jr .canCut
.overworld
dec a
ld a, [wTileInFrontOfPlayer]
cp $3d ; cut tree
jr z, .asm_ef82
jr z, .canCut
cp $52 ; grass
jr z, .asm_ef82
.asm_ef77
jr z, .canCut
.nothingToCut
ld hl, .NothingToCutText
jp PrintText
@ -25,9 +25,9 @@ UsedCut: ; ef54 (3:6f54)
TX_FAR _NothingToCutText
db "@"
.asm_ef82
.canCut
ld [wCutTile], a
ld a, $1
ld a, 1
ld [wActionResultOrTookBattleTurn], a ; used cut
ld a, [wWhichPokemon]
ld hl, wPartyMonNicks
@ -37,7 +37,7 @@ UsedCut: ; ef54 (3:6f54)
call GBPalWhiteOutWithDelay3
call ClearSprites
call RestoreScreenTilesAndReloadTilePatterns
ld a, $90
ld a, SCREEN_HEIGHT_PIXELS
ld [hWY], a
call Delay3
call LoadGBPal
@ -53,11 +53,11 @@ UsedCut: ; ef54 (3:6f54)
res 6, [hl]
ld a, $ff
ld [wUpdateSpritesEnabled], a
call AnimateCutTree
call InitCutAnimOAM
ld de, CutTreeBlockSwaps
call Func_f09f
call ReplaceTreeTileBlock
call RedrawMapView
callba Func_79e96
callba AnimCut
ld a, $1
ld [wUpdateSpritesEnabled], a
ld a, SFX_CUT
@ -71,14 +71,15 @@ UsedCutText: ; eff2 (3:6ff2)
TX_FAR _UsedCutText
db "@"
AnimateCutTree: ; eff7 (3:6ff7)
InitCutAnimOAM: ; eff7 (3:6ff7)
xor a
ld [wWhichAnimationOffsets], a
ld a, $e4
ld [rOBP1], a
ld a, [wCutTile]
cp $52
jr z, .asm_f020
jr z, .grass
; tree
ld de, Overworld_GFX + $2d0 ; cuttable tree sprite top row
ld hl, vChars1 + $7c0
ld bc, (BANK(Overworld_GFX) << 8) + $02
@ -87,45 +88,45 @@ AnimateCutTree: ; eff7 (3:6ff7)
ld hl, vChars1 + $7e0
ld bc, (BANK(Overworld_GFX) << 8) + $02
call CopyVideoData
jr WriteCutTreeBoulderDustAnimationOAMBlock
.asm_f020
jr WriteCutOrBoulderDustAnimationOAMBlock
.grass
ld hl, vChars1 + $7c0
call LoadCutTreeAnimationTilePattern
call LoadCutGrassAnimationTilePattern
ld hl, vChars1 + $7d0
call LoadCutTreeAnimationTilePattern
call LoadCutGrassAnimationTilePattern
ld hl, vChars1 + $7e0
call LoadCutTreeAnimationTilePattern
call LoadCutGrassAnimationTilePattern
ld hl, vChars1 + $7f0
call LoadCutTreeAnimationTilePattern
call WriteCutTreeBoulderDustAnimationOAMBlock
call LoadCutGrassAnimationTilePattern
call WriteCutOrBoulderDustAnimationOAMBlock
ld hl, wOAMBuffer + $93
ld de, $4
ld de, 4
ld a, $30
ld c, e
.asm_f044
.loop
ld [hl], a
add hl, de
xor $60
dec c
jr nz, .asm_f044
jr nz, .loop
ret
LoadCutTreeAnimationTilePattern: ; f04c (3:704c)
LoadCutGrassAnimationTilePattern: ; f04c (3:704c)
ld de, AnimationTileset2 + $60 ; tile depicting a leaf
ld bc, (BANK(AnimationTileset2) << 8) + $01
jp CopyVideoData
WriteCutTreeBoulderDustAnimationOAMBlock: ; f055 (3:7055)
call GetCutTreeBoulderDustAnimationOffsets
WriteCutOrBoulderDustAnimationOAMBlock: ; f055 (3:7055)
call GetCutOrBoulderDustAnimationOffsets
ld a, $9
ld de, CutTreeBoulderDustAnimationTilesAndAttributes
ld de, CutOrBoulderDustAnimationTilesAndAttributes
jp WriteOAMBlock
CutTreeBoulderDustAnimationTilesAndAttributes: ; f060 (3:7060)
CutOrBoulderDustAnimationTilesAndAttributes: ; f060 (3:7060)
db $FC,$10,$FD,$10
db $FE,$10,$FF,$10
GetCutTreeBoulderDustAnimationOffsets: ; f068 (3:7068)
GetCutOrBoulderDustAnimationOffsets: ; f068 (3:7068)
ld hl, wSpriteStateData1 + 4
ld a, [hli] ; player's sprite screen Y position
ld b, a
@ -140,10 +141,10 @@ GetCutTreeBoulderDustAnimationOffsets: ; f068 (3:7068)
ld d, $0 ; de holds direction (00: down, 02: up, 04: left, 06: right)
ld a, [wWhichAnimationOffsets]
and a
ld hl, CutTreeAnimationOffsets
jr z, .asm_f084
ld hl, CutAnimationOffsets
jr z, .next
ld hl, BoulderDustAnimationOffsets
.asm_f084
.next
add hl, de
ld e, [hl]
inc hl
@ -156,7 +157,7 @@ GetCutTreeBoulderDustAnimationOffsets: ; f068 (3:7068)
ld c, a
ret
CutTreeAnimationOffsets: ; f08f (3:708f)
CutAnimationOffsets: ; f08f (3:708f)
; Each pair represents the x and y pixels offsets from the player of where the cut tree animation should be drawn
db 8, 36 ; player is facing down
db 8, 4 ; player is facing up
@ -171,75 +172,79 @@ BoulderDustAnimationOffsets: ; f097 (3:7097)
db -24, 20 ; player is facing left
db 40, 20 ; player is facing right
Func_f09f: ; f09f (3:709f)
ReplaceTreeTileBlock: ; f09f (3:709f)
; Determine the address of the tile block that contains the tile in front of the
; player (i.e. where the tree is) and replace it with the corresponding tile
; block that doesn't have the tree.
push de
ld a, [W_CURMAPWIDTH]
add $6
add 6
ld c, a
ld b, $0
ld d, $0
ld b, 0
ld d, 0
ld hl, wCurrentTileBlockMapViewPointer
ld a, [hli]
ld h, [hl]
ld l, a
add hl, bc
ld a, [wSpriteStateData1 + 9]
ld a, [wSpriteStateData1 + 9] ; player sprite's facing direction
and a
jr z, .down
cp SPRITE_FACING_UP
jr z, .up
cp SPRITE_FACING_LEFT
jr z, .left
; right
ld a, [W_XBLOCKCOORD]
and a
jr z, .asm_f0e0
jr .asm_f0ec
jr z, .centerTileBlock
jr .rightOfCenter
.down
ld a, [W_YBLOCKCOORD]
and a
jr z, .asm_f0e0
jr .asm_f0df
jr z, .centerTileBlock
jr .belowCenter
.up
ld a, [W_YBLOCKCOORD]
and a
jr z, .asm_f0e1
jr .asm_f0e0
jr z, .aboveCenter
jr .centerTileBlock
.left
ld a, [W_XBLOCKCOORD]
and a
jr z, .asm_f0e6
jr .asm_f0e0
.asm_f0df
jr z, .leftOfCenter
jr .centerTileBlock
.belowCenter
add hl, bc
.asm_f0e0
.centerTileBlock
add hl, bc
.asm_f0e1
.aboveCenter
ld e, $2
add hl, de
jr .asm_f0f0
.asm_f0e6
jr .next
.leftOfCenter
ld e, $1
add hl, bc
add hl, de
jr .asm_f0f0
.asm_f0ec
jr .next
.rightOfCenter
ld e, $3
add hl, bc
add hl, de
.asm_f0f0
.next
pop de
ld a, [hl]
ld c, a
.asm_f0f3
.loop ; find the matching tile block in the array
ld a, [de]
inc de
inc de
cp $ff
ret z
cp c
jr nz, .asm_f0f3
jr nz, .loop
dec de
ld a, [de]
ld a, [de] ; replacement tile block from matching array entry
ld [hl], a
ret

View file

@ -1,19 +1,19 @@
Func_79e96: ; 79e96 (1e:5e96)
AnimCut: ; 79e96 (1e:5e96)
ld a, [wCutTile]
cp $52
jr z, .asm_79ec8
jr z, .grass
ld c, $8
.asm_79e9f
.cutTreeLoop
push bc
ld hl, wOAMBuffer + $91
ld a, $1
ld [wd08a], a
ld c, $2
ld a, 1
ld [wCoordAdjustmentAmount], a
ld c, 2
call AdjustOAMBlockXPos2
ld hl, wOAMBuffer + $99
ld a, $ff
ld [wd08a], a
ld c, $2
ld a, -1
ld [wCoordAdjustmentAmount], a
ld c, 2
call AdjustOAMBlockXPos2
ld a, [rOBP1]
xor $64
@ -21,49 +21,49 @@ Func_79e96: ; 79e96 (1e:5e96)
call DelayFrame
pop bc
dec c
jr nz, .asm_79e9f
jr nz, .cutTreeLoop
ret
.asm_79ec8
ld c, $2
.asm_79eca
.grass
ld c, 2
.cutGrassLoop
push bc
ld c, $8
call Func_79eed
call Func_79f30
call AnimCutGrass_UpdateOAMEntries
call AnimCutGrass_SwapOAMEntries
ld c, $8
call Func_79eed
call Func_79f30
call AnimCutGrass_UpdateOAMEntries
call AnimCutGrass_SwapOAMEntries
ld hl, wOAMBuffer + $90
ld a, $2
ld [wd08a], a
ld c, $4
ld a, 2
ld [wCoordAdjustmentAmount], a
ld c, 4
call AdjustOAMBlockYPos2
pop bc
dec c
jr nz, .asm_79eca
jr nz, .cutGrassLoop
ret
Func_79eed: ; 79eed (1e:5eed)
AnimCutGrass_UpdateOAMEntries: ; 79eed (1e:5eed)
push bc
ld hl, wOAMBuffer + $91
ld a, $1
ld [wd08a], a
ld c, $1
ld a, 1
ld [wCoordAdjustmentAmount], a
ld c, 1
call AdjustOAMBlockXPos2
ld hl, wOAMBuffer + $95
ld a, $2
ld [wd08a], a
ld c, $1
ld a, 2
ld [wCoordAdjustmentAmount], a
ld c, 1
call AdjustOAMBlockXPos2
ld hl, wOAMBuffer + $99
ld a, $fe
ld [wd08a], a
ld c, $1
ld a, -2
ld [wCoordAdjustmentAmount], a
ld c, 1
call AdjustOAMBlockXPos2
ld hl, wOAMBuffer + $9d
ld a, $ff
ld [wd08a], a
ld c, $1
ld a, -1
ld [wCoordAdjustmentAmount], a
ld c, 1
call AdjustOAMBlockXPos2
ld a, [rOBP1]
xor $64
@ -71,19 +71,19 @@ Func_79eed: ; 79eed (1e:5eed)
call DelayFrame
pop bc
dec c
jr nz, Func_79eed
jr nz, AnimCutGrass_UpdateOAMEntries
ret
Func_79f30: ; 79f30 (1e:5f30)
AnimCutGrass_SwapOAMEntries: ; 79f30 (1e:5f30)
ld hl, wOAMBuffer + $90
ld de, wHPBarMaxHP
ld de, wBuffer
ld bc, $8
call CopyData
ld hl, wOAMBuffer + $98
ld de, wOAMBuffer + $90
ld bc, $8
call CopyData
ld hl, wHPBarMaxHP
ld hl, wBuffer
ld de, wOAMBuffer + $98
ld bc, $8
jp CopyData

View file

@ -8,14 +8,14 @@ AnimateBoulderDust: ; 79f54 (1e:5f54)
ld a, %11100100
ld [rOBP1], a
call LoadSmokeTileFourTimes
callba WriteCutTreeBoulderDustAnimationOAMBlock
callba WriteCutOrBoulderDustAnimationOAMBlock
ld c, 8 ; number of steps in animation
.loop
push bc
call GetMoveBoulderDustFunctionPointer
ld bc, .returnAddress
push bc
ld c, $4
ld c, 4
jp [hl]
.returnAddress
ld a, [rOBP1]
@ -36,7 +36,7 @@ GetMoveBoulderDustFunctionPointer: ; 79f92 (1e:5f92)
ld b, $0
add hl, bc
ld a, [hli]
ld [wd08a], a
ld [wCoordAdjustmentAmount], a
ld a, [hli]
ld e, a
ld a, [hli]

View file

@ -711,12 +711,12 @@ SlotMachine_PayCoinsToPlayer: ; 3776b (d:776b)
SlotMachine_PutOutLitBalls: ; 377ce (d:77ce)
ld a, $23
ld [wd08a], a
ld [wNewSlotMachineBallTile], a
jr SlotMachine_UpdateThreeCoinBallTiles
SlotMachine_LightBalls: ; 377d5 (d:77d5)
ld a, $14
ld [wd08a], a
ld [wNewSlotMachineBallTile], a
ld a, [wSlotMachineBet]
dec a
jr z, SlotMachine_UpdateOneCoinBallTiles
@ -739,7 +739,7 @@ SlotMachine_UpdateOneCoinBallTiles: ; 377fb (d:77fb)
coord hl, 3, 6
SlotMachine_UpdateBallTiles: ; 377fe (d:77fe)
ld a, [wd08a]
ld a, [wNewSlotMachineBallTile]
ld [hl], a
ld bc, 13
add hl, bc

View file

@ -304,25 +304,25 @@ Trade_AnimateBallEnteringLinkCable: ; 412d2 (10:52d2)
ld a, %11100100
ld [rOBP0], a
xor a
ld [wd09f], a
ld [wLinkCableAnimBulgeToggle], a
ld bc, $2060
.moveBallInsideLinkCableLoop
push bc
xor a
ld de, Trade_BallInsideLinkCableOAM
call WriteOAMBlock
ld a, [wd09f]
ld a, [wLinkCableAnimBulgeToggle]
xor $1
ld [wd09f], a
ld [wLinkCableAnimBulgeToggle], a
add $7e
ld hl, wOAMBuffer + $02
ld de, $4
ld de, 4
ld c, e
.cycleSpriteFramesLoop
.cycleLinkCableBulgeTile
ld [hl], a
add hl, de
dec c
jr nz, .cycleSpriteFramesLoop
jr nz, .cycleLinkCableBulgeTile
call Delay3
pop bc
ld a, c